RPTools.net

Discussion and Support

Skip to content

It is currently Fri Feb 23, 2018 5:35 pm 






Reply to topic  [ 11 posts ] 

Previous topic | Next topic 

  Print view

Author Message
User avatar  Offline
Cave Troll
 
Joined: Tue Sep 29, 2009 4:28 pm
Posts: 45
Location: New York
 Post subject: Converting the .dnd4e file into JSON, or csv or a token
PostPosted: Thu Apr 07, 2011 7:35 pm 
It's easy to have your way with the .dnd4e character save files if you use xslt. Here are two working methods to dissect the .dnd4e files and re-assemble them into whatever format you could ever want. The first one makes a giant JSON variable for MapTool, the second makes a web page that has tables with all the character data. An artistic person could make their own html character sheet.
Here is an example of the JSON variable
{ "name": " Amnon " ,
"Level": " 1 " ,
"Player": "" ,
"Height": "" ,
"Weight": "" ,
"Gender": "" ,
"Age": "" ,
"Alignment": "" ,
"Company": "" ,
"Portrait": "" ,
"Experience": "" ,
"CarriedMoney": " 100 gp " ,
"StoredMoney": "" ,
"Traits": "" ,
"Appearance": "" ,
"Companions": "" ,
"Notes": "" ,
"Strength": "10" ,
"Constitution": "16" ,
"Dexterity": "10" ,
"Intelligence": "8" ,
"Wisdom": "11" ,
"Charisma": "20" ,
"Strength modifier": "0" ,
"Dexterity modifier": "0" ,
"Constitution modifier": "3" ,
"Intelligence modifier": "-1" ,
"Wisdom modifier": "0" ,
"Charisma modifier": "5" ,
"AC": "16" ,
"Fortitude Defense": "14" ,
"Reflex Defense": "10" ,
"Will Defense": "16" ,
"Death Saves Count": "3" ,
"Level": "1" ,
"Hit Points": "33" ,
"_LEVEL-ONE-HPS": "12" ,
"Healing Surges": "10" ,
"HALF-LEVEL": "0" ,
"Fortitude Defense Class Bonus": "1" ,
"Reflex Defense Class Bonus": "0" ,
"Will Defense Class Bonus": "1" ,
"Initiative": "0" ,
"Initiative Misc": "0" ,
"Ring Slots": "2" ,
"_BaseActionPoints": "1" ,
"XP Needed": "1000" ,
"Acrobatics": "-1" ,
"Acrobatics Trained": "0" ,
"Acrobatics Misc": "0" ,
"Armor Penalty": "-1" ,
"Arcana": "-1" ,
"Arcana Trained": "0" ,
"Arcana Misc": "0" ,
"Bluff": "12" ,
"Bluff Trained": "5" ,
"Bluff Misc": "2" ,
"Diplomacy": "10" ,
"Diplomacy Trained": "5" ,
"Diplomacy Misc": "0" ,
"Dungeoneering": "0" ,
"Dungeoneering Trained": "0" ,
"Dungeoneering Misc": "0" ,
"Endurance": "2" ,
"Endurance Trained": "0" ,
"Endurance Misc": "0" ,
"Heal": "0" ,
"Heal Trained": "0" ,
"Heal Misc": "0" ,
"History": "-1" ,
"History Trained": "0" ,
"History Misc": "0" ,
"Insight": "0" ,
"Insight Trained": "0" ,
"Insight Misc": "0" ,
"Intimidate": "10" ,
"Intimidate Trained": "5" ,
"Intimidate Misc": "0" ,
"Nature": "0" ,
"Nature Trained": "0" ,
"Nature Misc": "0" ,
"Perception": "0" ,
"Perception Trained": "0" ,
"Perception Misc": "0" ,
"Religion": "-1" ,
"Religion Trained": "0" ,
"Religion Misc": "0" ,
"Stealth": "1" ,
"Stealth Trained": "0" ,
"Stealth Misc": "2" ,
"Streetwise": "10" ,
"Streetwise Trained": "5" ,
"Streetwise Misc": "0" ,
"Thievery": "-1" ,
"Thievery Trained": "0" ,
"Thievery Misc": "0" ,
"Athletics": "-1" ,
"Athletics Trained": "0" ,
"Athletics Misc": "0" ,
"Passive Perception": "10" ,
"Passive Insight": "10" ,
"Speed": "5" ,
"Average Height": "0" ,
"Average Weight": "0" ,
"Size": "0" ,
"Fire Resistance": "5" ,
"resist:fire": "5" ,
"Bloodhunt": "1" ,
"attack rolls": "0" ,
"Language Count": "2" ,
"_CLASSNAME": "0" ,
"_PER-LEVEL-HPS": "5" ,
"damage rolls": "0" ,
"Mantle of Elation": "3" ,
"Power Points": "2" ,
"Toughness": "5" ,
"Hybrid Power Points": "4" ,
"Weight": "52" ,
"RulesElements" : {
"type" : "Alignment" , "name" : "Lawful Good" , "url" : "" ,
"type" : "Build" , "name" : "Euphoric Ardent" , "url" : "" ,
"type" : "Build Suggestions" , "name" : "Euphoric Ardent" , "url" : "" ,
"type" : "Class" , "name" : "Ardent" , "url" : "http://www.wizards.com/dndinsider/compendium/class.aspx?id=529" ,
"type" : "Class Feature" , "name" : "Ardent Mantle" , "url" : "" ,
"type" : "Class Feature" , "name" : "Mantle of Elation" , "url" : "" ,
"type" : "Class Feature" , "name" : "Ardent Surge" , "url" : "" ,
"type" : "Class Feature" , "name" : "Psionic Augmentation" , "url" : "" ,
"type" : "Feat" , "name" : "Toughness" , "url" : "http://www.wizards.com/dndinsider/compendium/feat.aspx?id=171" ,
"type" : "Gender" , "name" : "male" , "url" : "" ,
"type" : "Grants" , "name" : "Tiefling" , "url" : "" ,
"type" : "Grants" , "name" : "Ardent" , "url" : "" ,
"type" : "Grants" , "name" : "Ardent Implements" , "url" : "" ,
"type" : "Internal" , "name" : "Background Benefit" , "url" : "" ,
"type" : "Internal" , "name" : "Psionic First Class" , "url" : "" ,
"type" : "Internal" , "name" : "Augment Powers" , "url" : "" ,
"type" : "Internal" , "name" : "No Encounter Powers" , "url" : "" ,
"type" : "Internal" , "name" : "Dark Sun" , "url" : "" ,
"type" : "Language" , "name" : "Common" , "url" : "" ,
"type" : "Language" , "name" : "Primordial" , "url" : "" ,
"type" : "Level" , "name" : "1" , "url" : "" ,
"type" : "Level1Rules" , "name" : "Level1Rules" , "url" : "" ,
"type" : "Level1Rules" , "name" : "SkillRules" , "url" : "" ,
"type" : "Level1Rules" , "name" : "DetailsRules" , "url" : "" ,
"type" : "Level1Rules" , "name" : "Expansion1" , "url" : "" ,
"type" : "Level1Rules" , "name" : "Expansion2" , "url" : "" ,
"type" : "Level1Rules" , "name" : "Expansion3" , "url" : "" ,
"type" : "Level1Rules" , "name" : "Expansion4" , "url" : "" ,
"type" : "Level1Rules" , "name" : "Expansion5" , "url" : "" ,
"type" : "Power" , "name" : "Melee Basic Attack" , "url" : "" ,
"type" : "Power" , "name" : "Ranged Basic Attack" , "url" : "" ,
"type" : "Power" , "name" : "Infernal Wrath" , "url" : "http://www.wizards.com/dndinsider/compendium/power.aspx?id=1628" ,
"type" : "Power" , "name" : "Ardent Surge" , "url" : "http://www.wizards.com/dndinsider/compendium/power.aspx?id=10273" ,
"type" : "Power" , "name" : "Demoralizing Strike" , "url" : "http://www.wizards.com/dndinsider/compendium/power.aspx?id=11061" ,
"type" : "Power" , "name" : "Focusing Strike" , "url" : "http://www.wizards.com/dndinsider/compendium/power.aspx?id=10275" ,
"type" : "Power" , "name" : "Foretaste of Death" , "url" : "http://www.wizards.com/dndinsider/compendium/power.aspx?id=12937" ,
"type" : "Power" , "name" : "Thought Projection" , "url" : "http://www.wizards.com/dndinsider/compendium/power.aspx?id=12409" ,
"type" : "Power" , "name" : "Quick Formation" , "url" : "http://www.wizards.com/dndinsider/compendium/power.aspx?id=11778" ,
"type" : "Power" , "name" : "Ardent Outrage" , "url" : "http://www.wizards.com/dndinsider/compendium/power.aspx?id=11060" ,
"type" : "Power Source" , "name" : "Psionic" , "url" : "" ,
"type" : "Race" , "name" : "Tiefling" , "url" : "http://www.wizards.com/dndinsider/compendium/race.aspx?id=8" ,
"type" : "Race Ability Bonus" , "name" : "Charisma" , "url" : "" ,
"type" : "Race Ability Bonus" , "name" : "Constitution" , "url" : "" ,
"type" : "Racial Trait" , "name" : "Infernal Wrath" , "url" : "" ,
"type" : "Racial Trait" , "name" : "Fire Resistance" , "url" : "" ,
"type" : "Racial Trait" , "name" : "Bloodhunt" , "url" : "" ,
"type" : "Racial Trait" , "name" : "Bluff Bonus" , "url" : "" ,
"type" : "Racial Trait" , "name" : "Stealth Bonus" , "url" : "" ,
"type" : "Role" , "name" : "Leader" , "url" : "" ,
"type" : "Size" , "name" : "Medium" , "url" : "" ,
"type" : "Skill" , "name" : "Acrobatics" , "url" : "http://www.wizards.com/dndinsider/compendium/skill.aspx?id=1" ,
"type" : "Skill" , "name" : "Arcana" , "url" : "http://www.wizards.com/dndinsider/compendium/skill.aspx?id=2" ,
"type" : "Skill" , "name" : "Bluff" , "url" : "http://www.wizards.com/dndinsider/compendium/skill.aspx?id=3" ,
"type" : "Skill" , "name" : "Diplomacy" , "url" : "http://www.wizards.com/dndinsider/compendium/skill.aspx?id=6" ,
"type" : "Skill" , "name" : "Dungeoneering" , "url" : "http://www.wizards.com/dndinsider/compendium/skill.aspx?id=7" ,
"type" : "Skill" , "name" : "Endurance" , "url" : "http://www.wizards.com/dndinsider/compendium/skill.aspx?id=8" ,
"type" : "Skill" , "name" : "Heal" , "url" : "http://www.wizards.com/dndinsider/compendium/skill.aspx?id=9" ,
"type" : "Skill" , "name" : "History" , "url" : "http://www.wizards.com/dndinsider/compendium/skill.aspx?id=11" ,
"type" : "Skill" , "name" : "Insight" , "url" : "http://www.wizards.com/dndinsider/compendium/skill.aspx?id=13" ,
"type" : "Skill" , "name" : "Intimidate" , "url" : "http://www.wizards.com/dndinsider/compendium/skill.aspx?id=14" ,
"type" : "Skill" , "name" : "Nature" , "url" : "http://www.wizards.com/dndinsider/compendium/skill.aspx?id=16" ,
"type" : "Skill" , "name" : "Perception" , "url" : "http://www.wizards.com/dndinsider/compendium/skill.aspx?id=17" ,
"type" : "Skill" , "name" : "Religion" , "url" : "http://www.wizards.com/dndinsider/compendium/skill.aspx?id=18" ,
"type" : "Skill" , "name" : "Stealth" , "url" : "http://www.wizards.com/dndinsider/compendium/skill.aspx?id=20" ,
"type" : "Skill" , "name" : "Streetwise" , "url" : "http://www.wizards.com/dndinsider/compendium/skill.aspx?id=21" ,
"type" : "Skill" , "name" : "Thievery" , "url" : "http://www.wizards.com/dndinsider/compendium/skill.aspx?id=23" ,
"type" : "Skill" , "name" : "Athletics" , "url" : "http://www.wizards.com/dndinsider/compendium/skill.aspx?id=27" ,
"type" : "Skill Training" , "name" : "Bluff" , "url" : "" ,
"type" : "Skill Training" , "name" : "Intimidate" , "url" : "" ,
"type" : "Skill Training" , "name" : "Diplomacy" , "url" : "" ,
"type" : "Skill Training" , "name" : "Streetwise" , "url" : "" ,
"type" : "Theme" , "name" : "Dune Trader" , "url" : "" ,
"type" : "Tier" , "name" : "Heroic" , "url" : "" ,
"type" : "Vision" , "name" : "Low-light" , "url" : "" ,
} , "Loot" : {
"name" : "Trikal" , "type" : "Weapon" , "url" : "http://www.wizards.com/dndinsider/compendium/item.aspx?fid=145&ftype=3" , "name2" : "" , "type2" : "" , "url2" : "" ,
"name" : "Chainmail" , "type" : "Armor" , "url" : "http://www.wizards.com/dndinsider/compendium/item.aspx?fid=4&ftype=2" , "name2" : "" , "type2" : "" , "url2" : "" ,
} , "Powers" : {
"Name" : "Infernal Wrath" , "PowerUsage" : " Encounter " , "ActionType" : " Free Action " , "Keywords" : " Fire " , "AttackType" : " Close burst 10 " , "Target" : " The triggering enemy in the burst " , "Attack" : "" , "Flavor" : " You call upon the hellfire burning in your soul to punish your enemy. " , "Trigger" : " An enemy within 10 squares of you hits you. " , "Hit" : "" , "Additional" : " " , "Effect" : " An enemy within 10 squares of you hits you. " , "Special" : "" , "Weapon" : "" , "WeaponNum" : "" , "AttackBonus" : "", "vsDefense" : "" , "Damage" : "" , "Conditions" : "" ,
"Name" : "Thought Projection" , "PowerUsage" : " At-Will " , "ActionType" : " Minor Action " , "Keywords" : " Psionic " , "AttackType" : " Close burst 5 " , "Target" : " One or more allies in the burst " , "Attack" : "" , "Flavor" : " You broadcast a thought or an image to nearby allies. " , "Trigger" : "" , "Hit" : "" , "Additional" : " " , "Effect" : "" , "Special" : "" , "Weapon" : "" , "WeaponNum" : "" , "AttackBonus" : "", "vsDefense" : "" , "Damage" : "" , "Conditions" : "" ,
"Name" : "Ardent Outrage" , "PowerUsage" : " Encounter " , "ActionType" : " No Action " , "Keywords" : " Psionic " , "AttackType" : " Close burst 5 " , "Target" : " Each enemy in the burst " , "Attack" : "" , "Flavor" : " As you take a hit, your anger unbalances your foes. " , "Trigger" : " You are bloodied by an attack " , "Hit" : "" , "Additional" : " " , "Effect" : " You are bloodied by an attack " , "Special" : "" , "Weapon" : "" , "WeaponNum" : "" , "AttackBonus" : "", "vsDefense" : "" , "Damage" : "" , "Conditions" : "" ,
"Name" : "Melee Basic Attack" , "PowerUsage" : " At-Will " , "ActionType" : " Standard Action " , "Keywords" : " Weapon " , "AttackType" : " Melee weapon " , "Target" : " One creature " , "Attack" : " Strength vs. AC " , "Flavor" : " You resort to the simple attack you learned when you first picked up a melee weapon. " , "Trigger" : "" , "Hit" : " 1[W] + Strength modifier damage. " , "Additional" : " Level 21 2[W] + Strength modifier damage.
" , "Effect" : "" , "Special" : "" , "Weapon" : "Trikal" , "WeaponNum" : "1" , "AttackBonus" : " 2 " , "vsDefense" : " AC " , "Damage" : " 1d10 " , "Conditions" : " +1 Racial bonus to attack rolls against bloodied foes - Bloodhunt. +3 to damage rolls on opportunity attacks - Mantle of Elation. " ,
"Name" : "Melee Basic Attack" , "PowerUsage" : " At-Will " , "ActionType" : " Standard Action " , "Keywords" : " Weapon " , "AttackType" : " Melee weapon " , "Target" : " One creature " , "Attack" : " Strength vs. AC " , "Flavor" : " You resort to the simple attack you learned when you first picked up a melee weapon. " , "Trigger" : "" , "Hit" : " 1[W] + Strength modifier damage. " , "Additional" : " Level 21 2[W] + Strength modifier damage.
" , "Effect" : "" , "Special" : "" , "Weapon" : "Unarmed" , "WeaponNum" : "2" , "AttackBonus" : " 0 " , "vsDefense" : " AC " , "Damage" : " 1d4 " , "Conditions" : " +1 Racial bonus to attack rolls against bloodied foes - Bloodhunt. +3 to damage rolls on opportunity attacks - Mantle of Elation. " ,
"Name" : "Ranged Basic Attack" , "PowerUsage" : " At-Will " , "ActionType" : " Standard Action " , "Keywords" : " Weapon " , "AttackType" : " Ranged weapon " , "Target" : " One creature " , "Attack" : " Dexterity vs. AC " , "Flavor" : " You resort to the simple attack you learned when you first picked up a ranged weapon. " , "Trigger" : "" , "Hit" : " 1[W] + Dexterity modifier damage. " , "Additional" : " Level 21 2[W] + Dexterity modifier damage.
" , "Effect" : "" , "Special" : "" , "Weapon" : "Unarmed" , "WeaponNum" : "1" , "AttackBonus" : " 0 " , "vsDefense" : " AC " , "Damage" : " 1d4 " , "Conditions" : " +1 Racial bonus to attack rolls against bloodied foes - Bloodhunt. +3 to damage rolls on opportunity attacks - Mantle of Elation. " ,
"Name" : "Ardent Surge" , "PowerUsage" : " Encounter (Special) " , "ActionType" : " Minor Action " , "Keywords" : " Healing, Psionic " , "AttackType" : " Close burst 5 (10 at 16th level) " , "Target" : " You or one ally " , "Attack" : "" , "Flavor" : " You send a surge of powerful emotion that revives a faltering ally. " , "Trigger" : "" , "Hit" : "" , "Additional" : " Mantle of Clarity The target gains a +1 bonus to all defenses until the end of your next turn.
Mantle of Elation The target gains a +1 bonus to attack rolls until the end of your next turn.
" , "Effect" : "" , "Special" : " You can use this power twice per encounter, but only once per round. At 16th level, you can use this power three times per encounter, but only once per round. " , "Weapon" : "Unarmed" , "WeaponNum" : "1" , "AttackBonus" : " 0 " , "vsDefense" : " unknown " , "Damage" : " " , "Conditions" : " +1 Racial bonus to attack rolls against bloodied foes - Bloodhunt. " ,
"Name" : "Demoralizing Strike" , "PowerUsage" : " At-Will " , "ActionType" : " Standard Action " , "Keywords" : " Augmentable, Fear, Psionic, Weapon " , "AttackType" : " Melee weapon " , "Target" : " One creature " , "Attack" : " Charisma vs. AC " , "Flavor" : " The fury of your assault causes a surge of fear in your foe's heart. " , "Trigger" : "" , "Hit" : " 1[W] + Charisma modifier damage, and the target takes a -2 penalty to all defenses until the end of your next turn. " , "Additional" : " Augment 1
Hit 1[W] + Charisma modifier damage, and the target takes a penalty to Will equal to 1 + your Constitution modifier until the end of your next turn.
Augment 1
Close burst 1
Target Each creature in the burst
Hit 1[W] + Charisma modifier damage, and the target takes a penalty to Will equal to 1 + your Constitution modifier until the end of your next turn.
" , "Effect" : "" , "Special" : "" , "Weapon" : "Trikal" , "WeaponNum" : "1" , "AttackBonus" : " 7 " , "vsDefense" : " AC " , "Damage" : " 1d10+5 " , "Conditions" : " +1 Racial bonus to attack rolls against bloodied foes - Bloodhunt. " ,
"Name" : "Demoralizing Strike" , "PowerUsage" : " At-Will " , "ActionType" : " Standard Action " , "Keywords" : " Augmentable, Fear, Psionic, Weapon " , "AttackType" : " Melee weapon " , "Target" : " One creature " , "Attack" : " Charisma vs. AC " , "Flavor" : " The fury of your assault causes a surge of fear in your foe's heart. " , "Trigger" : "" , "Hit" : " 1[W] + Charisma modifier damage, and the target takes a -2 penalty to all defenses until the end of your next turn. " , "Additional" : " Augment 1
Hit 1[W] + Charisma modifier damage, and the target takes a penalty to Will equal to 1 + your Constitution modifier until the end of your next turn.
Augment 1
Close burst 1
Target Each creature in the burst
Hit 1[W] + Charisma modifier damage, and the target takes a penalty to Will equal to 1 + your Constitution modifier until the end of your next turn.
" , "Effect" : "" , "Special" : "" , "Weapon" : "Unarmed" , "WeaponNum" : "2" , "AttackBonus" : " 5 " , "vsDefense" : " AC " , "Damage" : " 1d4+5 " , "Conditions" : " +1 Racial bonus to attack rolls against bloodied foes - Bloodhunt. " ,
"Name" : "Focusing Strike" , "PowerUsage" : " At-Will " , "ActionType" : " Standard Action " , "Keywords" : " Augmentable, Psionic, Weapon " , "AttackType" : " Melee weapon " , "Target" : " One creature " , "Attack" : " Charisma vs. AC " , "Flavor" : " You attack your foe with calm and clarity of mind, extending that clarity to give a nearby ally a chance to clear a lingering effect. " , "Trigger" : "" , "Hit" : " 1[W] + Charisma modifier damage, and you or one ally within 5 squares of you can make a saving throw. " , "Additional" : " Augment 1
Hit As above, and if the saving throw is against a charm or a fear effect, it gains a power bonus equal to your Wisdom modifier.
Augment 1
Hit As above, and if the saving throw is against a charm or a fear effect, it gains a power bonus equal to your Wisdom modifier.
" , "Effect" : "" , "Special" : "" , "Weapon" : "Trikal" , "WeaponNum" : "1" , "AttackBonus" : " 7 " , "vsDefense" : " AC " , "Damage" : " 1d10+5 " , "Conditions" : " +1 Racial bonus to attack rolls against bloodied foes - Bloodhunt. " ,
"Name" : "Focusing Strike" , "PowerUsage" : " At-Will " , "ActionType" : " Standard Action " , "Keywords" : " Augmentable, Psionic, Weapon " , "AttackType" : " Melee weapon " , "Target" : " One creature " , "Attack" : " Charisma vs. AC " , "Flavor" : " You attack your foe with calm and clarity of mind, extending that clarity to give a nearby ally a chance to clear a lingering effect. " , "Trigger" : "" , "Hit" : " 1[W] + Charisma modifier damage, and you or one ally within 5 squares of you can make a saving throw. " , "Additional" : " Augment 1
Hit As above, and if the saving throw is against a charm or a fear effect, it gains a power bonus equal to your Wisdom modifier.
Augment 1
Hit As above, and if the saving throw is against a charm or a fear effect, it gains a power bonus equal to your Wisdom modifier.
" , "Effect" : "" , "Special" : "" , "Weapon" : "Unarmed" , "WeaponNum" : "2" , "AttackBonus" : " 5 " , "vsDefense" : " AC " , "Damage" : " 1d4+5 " , "Conditions" : " +1 Racial bonus to attack rolls against bloodied foes - Bloodhunt. " ,
"Name" : "Foretaste of Death" , "PowerUsage" : " Daily " , "ActionType" : " Standard Action " , "Keywords" : " Illusion, Psionic, Psychic, Weapon " , "AttackType" : " Melee weapon " , "Target" : " One creature " , "Attack" : " Charisma vs. AC " , "Flavor" : " Your attack causes a foe to be overcome with a vision of its own death, hindering its effectiveness in combat. " , "Trigger" : "" , "Hit" : " 1[W] + Charisma modifier damage. " , "Additional" : " " , "Effect" : "" , "Special" : "" , "Weapon" : "Trikal" , "WeaponNum" : "1" , "AttackBonus" : " 7 " , "vsDefense" : " AC " , "Damage" : " 1d10+5 " , "Conditions" : " +1 Racial bonus to attack rolls against bloodied foes - Bloodhunt. " ,
"Name" : "Foretaste of Death" , "PowerUsage" : " Daily " , "ActionType" : " Standard Action " , "Keywords" : " Illusion, Psionic, Psychic, Weapon " , "AttackType" : " Melee weapon " , "Target" : " One creature " , "Attack" : " Charisma vs. AC " , "Flavor" : " Your attack causes a foe to be overcome with a vision of its own death, hindering its effectiveness in combat. " , "Trigger" : "" , "Hit" : " 1[W] + Charisma modifier damage. " , "Additional" : " " , "Effect" : "" , "Special" : "" , "Weapon" : "Unarmed" , "WeaponNum" : "2" , "AttackBonus" : " 5 " , "vsDefense" : " AC " , "Damage" : " 1d4+5 " , "Conditions" : " +1 Racial bonus to attack rolls against bloodied foes - Bloodhunt. " ,
"Name" : "Quick Formation" , "PowerUsage" : " Encounter " , "ActionType" : " Standard Action " , "Keywords" : " Martial, Weapon " , "AttackType" : " Melee or Ranged weapon " , "Target" : " One creature " , "Attack" : " Primary ability vs. AC " , "Flavor" : " You lash at your enemies and move your allies into a defensible position. " , "Trigger" : "" , "Hit" : " 1[W] + ability modifier damage, and either you shift 4 squares, or each ally within 5 squares of you can shift 2 squares as a free action. Level 11: 2[W] + ability modifier damage. Level 21: 3[W] + ability modifier damage. " , "Additional" : " " , "Effect" : "" , "Special" : "" , "Weapon" : "Trikal" , "WeaponNum" : "1" , "AttackBonus" : " 7 " , "vsDefense" : " AC " , "Damage" : " 1d10+5 " , "Conditions" : " +1 Racial bonus to attack rolls against bloodied foes - Bloodhunt. " ,
"Name" : "Quick Formation" , "PowerUsage" : " Encounter " , "ActionType" : " Standard Action " , "Keywords" : " Martial, Weapon " , "AttackType" : " Melee or Ranged weapon " , "Target" : " One creature " , "Attack" : " Primary ability vs. AC " , "Flavor" : " You lash at your enemies and move your allies into a defensible position. " , "Trigger" : "" , "Hit" : " 1[W] + ability modifier damage, and either you shift 4 squares, or each ally within 5 squares of you can shift 2 squares as a free action. Level 11: 2[W] + ability modifier damage. Level 21: 3[W] + ability modifier damage. " , "Additional" : " " , "Effect" : "" , "Special" : "" , "Weapon" : "Unarmed" , "WeaponNum" : "2" , "AttackBonus" : " 5 " , "vsDefense" : " AC " , "Damage" : " 1d4+5 " , "Conditions" : " +1 Racial bonus to attack rolls against bloodied foes - Bloodhunt. " ,
} }


Try this:
  • Step 1 - Make a 4th edition character in the new online character builder.
  • Step 2 - Export him/her and save it as a .dnd4e file
  • Step 3 - Rename the end of the file extension to .xml (for example: ElvenRanger8.xml instead of ElvenRanger8.dnd4e)
  • Step 4 - Right-click it and open it in Internet Explorer, or Notepad and look at it, it's a bunch of tagged data. Now close it.
  • Step 5 - download this xsl http://dl.dropbox.com/u/454578/dnd4eToJSON.xsl sheet and put it into the same directory as your .dnd4e file . It uses the xslt language to provide a map of the xml data.
    xslt is very easy to learn, and is like a css style sheet that is called at the top of an xml file to translate xml into whatever you want.
  • Step 6 - right click your ElvenRanger8.xml character file and edit him in Notepad (or text editor); paste these two lines at the top
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="dnd4etoJSON.xsl" ?>
  • Step 7 - Open your ElvenRanger8.xml using Internet Explorer or Firefox

Voila!

What the xsl file does is use it's own language to parse out the xml character file and reformat it into whatever you specify. In this first case I made it into a JSON variable. When you open that file you'll see a gigantic JSON variable with every single piece of data from the character sheet. Parsed into sections. You can highlight the entire thing and paste it into a "property" on a MapTools token. Then, with Macros such as:
[r:myAC = json.get(theJSONpropertyIpasted,"AC")]
or
[r:AllMyPowerNames=json.get(json.get(theJSONpropertyIpasted,"Powers"),"Name")]
or
[r:AtkBonusOfmyThirdPwr=json.get(json.get(json.get(theJSONpropertyIpasted,"Powers"),"AttackBonus"),3)]

You can pull whatever you want into whatever MapTools framework you want.


Note: the format of the .dnd4e character file changes a lot. Every time WotC issues an update it seems they add or remove things from the .dnd4e file. A character I made a week ago had very little "Power" information, but the one I made this week contains every detail of all his powers, such as AttackBonuses, effects, etc. It also might be my imagination: but, I made a character and exported him and he had no Power info, but then I went into the builder and clicked on the Character Sheet button to look at him, and after that exported him, and then all his Power info was in his .dnd4e file.


Here's also a different xslt http://dl.dropbox.com/u/454578/dnd4eTable.xsl file that simply changes the character save file into an HTML tables so you can see how it works. To get this one to work you have to put those two lines at the top of your xml character file but change the href="dnd4etoJSON.xsl" into href="dnd4eTable.xsl"


I'm working on a visual basic or java program that will apply the xslt translation programatically, so you don't have to manually add those two lines at the top of your character.xml file every time.

P.S. The Maptools tokens .rptok are also just zip files renamed. They contain a content.xml file. Someone could easily write an xslt file that would translate the .dnd4e straight into a content.xml. (I'm also working on this)

P.P.S.
Some of you programmers there might want to edit those xsl files. Great!! here are some sites that are very helpful.
Five Tips
http://ondotnet.com/pub/a/dotnet/2003/0 ... ttips.html
lots of great xslt syntax examples
http://www.fincher.org/tips/web/xslt/
Try it webpage
http://www.w3schools.com/Xml/tryxslt.as ... ile=simple
sample files that work great
http://www.4serendipity.com/xml/testfil ... mples.html


Top
 Profile  
 
User avatar  Offline
Site Admin
 
Joined: Mon Jun 12, 2006 12:20 pm
Posts: 12111
Location: Tampa, FL
 Post subject: Re: Converting the .dnd4e file into JSON, or csv or a token
PostPosted: Thu Apr 07, 2011 10:56 pm 
JamesManhattan wrote:
[*]Step 7 - Open your ElvenRanger8.xml using Internet Explorer or Firefox

Older version of IE won't automatically run the transform. So to anyone who tries this and it fails: Google for "xslt" and your version of IE to determine if you have this issue. (I don't remember where the cut-off was for IE doing in-place xsl transforms.)

Quote:
I'm working on a visual basic or java program that will apply the xslt translation programatically,

Hopefully not VB since that won't work for anyone except Windows users. :?

Quote:
so you don't have to manually add those two lines at the top of your character.xml file every time.

Actually, you don't have to. I don't remember the syntax, but you can create an XML file (A.xml) that contains a reference to the XSL (B.xsl) and to the actual data XML file (C.xml). Then when you open A.xml it'll automatically read the other two and perform the transform. Probably will need to Google it.



I'm glad someone knows about XSL! I had plans to add remote XSL transforms into MT but it won't happen in 1.3. The idea is that MT will open a campaign file and determine what version it is. If the campaign file is newer than the version of MT, it would download an XSLT from our web site and apply it to the data stream as it's read in.

Essentially this would allow older versions of MT to read campaign files created by later versions! But this will require a bit more infrastructure than I was prepared to add in 1.3 so it'll have to wait for 1.4 (or 1.5).

I think there's also a web page that will do this type of transform for you so you're not dependent on a particular version of a web browser. But again, you'll need to Google for it since I don't have it bookmarked.


Top
 Profile  
 
User avatar  Offline
Cave Troll
 
Joined: Tue Sep 29, 2009 4:28 pm
Posts: 45
Location: New York
 Post subject: Re: Converting the .dnd4e file into JSON, or csv or a token
PostPosted: Fri Apr 08, 2011 8:51 am 
Apparently there is a Firefox plugin that will open a web-page (or xml file) and apply an xslt transformation to it.
https://addons.mozilla.org/en-us/firefo ... l-results/

I haven't tried it, but it looks like you choose an xsl translation file on your hard-drive, then browse to a web-page online or an xml file on your hard-drive and Firefox will display the translated results . That seems easy.

Plus! it could be applied to the monsters on the compendium.

Theoretically:
  • Step 1 - turn on Firefox plugin with a custom xsl file
  • Step 2 - search for monster in the compendium,
  • Step 3 - load the monster and the monster gets translated in the browser window into code or JSON variable that could be copied straight into MapTool.

Plugin screenshot
Image


Top
 Profile  
 
 Offline
Dragon
 
Joined: Tue Mar 24, 2009 2:34 pm
Posts: 859
 Post subject: Re: Converting the .dnd4e file into JSON, or csv or a token
PostPosted: Fri Apr 08, 2011 4:41 pm 
JamesManhattan wrote:
Note: the format of the .dnd4e character file changes a lot. Every time WotC issues an update it seems they add or remove things from the .dnd4e file. A character I made a week ago had very little "Power" information, but the one I made this week contains every detail of all his powers, such as AttackBonuses, effects, etc. It also might be my imagination: but, I made a character and exported him and he had no Power info, but then I went into the builder and clicked on the Character Sheet button to look at him, and after that exported him, and then all his Power info was in his .dnd4e file.


Nope, that's exactly what happened. At one point last fall they updated the Builder to have more information in the XML export; when they made that change, they didn't regenerate all the XML export files. You have to actually look at the character in the builder before doing the export.

_________________
Reed (halfling sorcerer P3) // Collin (human fighter P2) // Cine (eladrin psion H2)
Sirath (deva shaman H1) // Alesk (dragonborn cleric H3) // Kevin (halfling barbarian H1)


Top
 Profile  
 
 Offline
Kobold
 
Joined: Sat Apr 02, 2011 10:03 am
Posts: 3
 Post subject: Re: Converting the .dnd4e file into JSON, or csv or a token
PostPosted: Sat May 14, 2011 11:38 pm 
JamesManhattan, If I could give you cookies or beer though the internet, I would.

I took the liberty of slapping together a program to turn a dnd4e file into a json file, using your .xsl, if you don't mind.

It assumes everything is all in one folder. So, it'd be dnd4etojson.exe -file=test.dnd4e, would output test.json, using JamesManhattan's xls. If you really care, you can use the -a switch to put it into absolute mode, but you need to supply all the paths, then. (So, dnd4etojson.exe -a -file=full-path-to-dnd4e-file -transform=full-path-to-xsl -output=full-path-to-output-file. It's probably easier to just do it with a batch file. But hey, the option is there.

It should work under mono. But I don't have a testing environment set up, so I can't tell for sure. If someone would like to test it for me, that'd be neat. :D

I might take a look at kicking out a pretty version of it, but that's probably going to have to wait until I'm not on cold meds. (It'll also most likely use WPF so be windows only. Sorry, but it's about the only GUI lib I can actually do anything with.)


File comment: Contains one hastily coded .exe, and James' xsl.
dnd4etojson.zip [12.52 KiB]
Downloaded 152 times
Top
 Profile  
 
User avatar  Offline
Cave Troll
 
Joined: Tue Sep 29, 2009 4:28 pm
Posts: 45
Location: New York
 Post subject: Re: Converting the .dnd4e file into JSON, or csv or a token
PostPosted: Thu May 26, 2011 11:07 am 
Here's a simple HTML file that uses java to apply the xsl translation to an xml file and show the results. No plugin required. Currently it only works in Firefox, I havent tried Opera etc. but Internet Explorer security measures block the java.

It must be placed in the same directory as both the .XSL file as well as any .XML file you are translating, including the .DND4E files.

This way you don't have to go in and edit the tops of all your .DND4E file to call the xsl.

Save the below code as .HTML and open it in firefox
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="content-type"
 content="text/html; charset=ISO-8859-1">
  <script>
function loadXMLDoc(dname)
{
if (window.XMLHttpRequest)
  {
  xhttp=new XMLHttpRequest();
  }
else
  {
  xhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xhttp.open("GET",dname,false);
xhttp.send("");
return xhttp.responseXML;
}

function displayResult()
{
var XMLFile=document.getElementById("MyFileName1").value;
var XSLFile=document.getElementById("MyFileName2").value;
xml=loadXMLDoc(XMLFile);
xsl=loadXMLDoc(XSLFile);
// code for IE
if (window.ActiveXObject)
  {
  ex=xml.transformNode(xsl);
  document.getElementById("Translated").innerHTML=ex;
  }
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
  {
  xsltProcessor=new XSLTProcessor();
  xsltProcessor.importStylesheet(xsl);
  resultDocument = xsltProcessor.transformToFragment(xml,document);
  document.getElementById("Translated").innerHTML="";
  document.getElementById("Translated").appendChild(resultDocument);
  }
}
  </script>
  <title>TestJavaXSLT4</title>
</head>
<body>
<input id="MyFileName1" value="HalfOrcKnight21.dnd4e" type="file">The
.dnd4e Character File<br>
<input id="MyFileName2" value="dnd4eToJSON.xsl" type="file">The
translation .xsl File<br>
<input onclick="displayResult()" value="Submit" type="button">
<div id="Translated"
 style="border-style: solid; border-width: 1px; overflow: auto; height: 500px; width: 500px;">Translated
dnd4e
will
go
here</div>
</body>
</html>


Top
 Profile  
 
 Offline
Kobold
 
Joined: Thu Jun 30, 2011 12:03 pm
Posts: 4
 Post subject: Re: Converting the .dnd4e file into JSON, or csv or a token
PostPosted: Thu Jun 30, 2011 12:20 pm 
I looked around, but couldn't find anything on this question I have so, my apologies if it is an easy one.

I have used the .exe above to create a JSON file from a dnd4e file. It seems to have worked, but my question is how do I use it?

I can't see how to get it into maptool.

Specifically, I am wondering how to use it along with DeviantNull's framework. I am likely going to be using maptool and DN's framework for a campaign this fall, and I am just getting back into things and testing it out.

Any help, or link to some instructions would be GREATLY appreciated.

Cheers!


Top
 Profile  
 
 Offline
Great Wyrm
 
Joined: Tue May 26, 2009 7:51 pm
Posts: 2060
Location: Philadelphia, PA
 Post subject: Re: Converting the .dnd4e file into JSON, or csv or a token
PostPosted: Thu Jun 30, 2011 4:31 pm 
mojoflow wrote:
I looked around, but couldn't find anything on this question I have so, my apologies if it is an easy one.

I have used the .exe above to create a JSON file from a dnd4e file. It seems to have worked, but my question is how do I use it?

I can't see how to get it into maptool.

Specifically, I am wondering how to use it along with DeviantNull's framework. I am likely going to be using maptool and DN's framework for a campaign this fall, and I am just getting back into things and testing it out.

Any help, or link to some instructions would be GREATLY appreciated.

Cheers!

You could take a look at how travist627(IIRC) does his regex parsing and do something similar, but use json calls to parse out the info.


Top
 Profile  
 
 Offline
Kobold
 
Joined: Thu Jun 30, 2011 12:03 pm
Posts: 4
 Post subject: Re: Converting the .dnd4e file into JSON, or csv or a token
PostPosted: Thu Jun 30, 2011 10:57 pm 
Thanks for the reply.

I just did some searching around and it looks like Travist has done some work with importing stat blocks for monsters (pretty slick, I will likely be making use of that), I can't see anything I can use for PC's, unless I am missing something?

Cheers!

EDIT:

I think I am getting this figured out. I have used James's javascript file above to successfully convert a dnd4e file using the dnd4eToDN.xsl transform file. I am a bit stuck now. I had thought that you just used the generated text to replace the text in the content.xml file in the rptok zip archive. I did this, but get an error when adding the token onto a map in MapTool.

Comparing a valid content.xml with the one generated, they are definitely different, so I am missing something.

Can anyone help point me in the right direction with this?

Cheers!


Top
 Profile  
 
 Offline
Kobold
 
Joined: Sat Oct 15, 2011 2:53 am
Posts: 1
 Post subject: Re: Converting the .dnd4e file into JSON, or csv or a token
PostPosted: Sat Oct 15, 2011 3:03 am 
Hopefully someone can soon enlighten us on what to do with the content.xml file.

I've used Rumble's framework in the past and now that W*tC has moved their creator online, it has become impossible to import characters. And since DN seems to the the most active framework, I've been trying to move to it for my current game.

Thanks, and I hope someone can shed some light on this.


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Mon Jul 18, 2011 12:10 pm
Posts: 719
Location: Toronto
 Post subject: Re: Converting the .dnd4e file into JSON, or csv or a token
PostPosted: Fri Apr 13, 2012 11:30 am 
Great work, JM! I have just finished implementing this for my framework. I use Rumble's properties so I imagine those using his framework can import my macro onto one of his tokens. It should work with a tiny bit of tweaking.

_________________
StarMan - The MacroPolicebox D&D 4E Framework: Import ANYTHING!


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 11 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 1 guest





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman