Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

Commit

Permalink
Added mounts.json documentation and added missing mounts. Fixes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Sembiance committed Feb 4, 2016
1 parent 320f3f1 commit 72bd6de
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 9 deletions.
22 changes: 16 additions & 6 deletions generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ C.EXTRA_HEROES_GAMEDATA_FOLDERS.forEach(function(EXTRA_HERO)
NEEDED_FILE_PATHS.push("mods\\heroesdata.stormmod\\base.stormdata\\GameData\\Heroes\\" + EXTRA_HERO + "Data\\" + EXTRA_HERO + "Data.xml");
});

Object.forEach(C.EXTRA_MOUNT_DATA_FILES, function(EXTRA_MOUNT_DIR, EXTRA_MOUNT_FILES)
{
EXTRA_MOUNT_FILES.forEach(function(EXTRA_MOUNT_FILE)
{
NEEDED_FILE_PATHS.push("mods\\heroesdata.stormmod\\base.stormdata\\GameData\\Mounts\\" + EXTRA_MOUNT_DIR + "Data\\Mount_" + EXTRA_MOUNT_FILE + "Data.xml");
});
});

Object.forEach(C.EXTRA_HEROES_HEROMODS_NAMED, function(heroName, gameDataName)
{
NEEDED_FILE_PATHS.push("mods\\heromods\\" + heroName + ".stormmod\\base.stormdata\\GameData\\" + gameDataName + "Data.xml");
Expand Down Expand Up @@ -161,6 +169,7 @@ tiptoe(

base.info("\nValidating %d mounts...", mounts.length);
mounts.forEach(validateMount);
mounts.sort(function(a, b) { return (a.name.startsWith("The ") ? a.name.substring(4) : a.name).localeCompare((b.name.startsWith("The ") ? b.name.substring(4) : b.name)); });

base.info("\nSaving JSON...");

Expand All @@ -187,16 +196,17 @@ function processMountNode(mountNode)
mount.id = attributeValue(mountNode, "id");
mount.name = S["Mount/Name/" + mount.id];

if(!mount.name)
if(!mount.name || !!(+getValue(mountNode, "Flags[@index='IsVariation']", 0)))
return undefined;

mount.description = S["Mount/Info/" + mount.id];
mount.franchise = getValue(mountNode, "Universe", "Starcraft");

if(!!(+getValue(mountNode, "Flags[@index='IsVariation']", 0)))
return undefined;

mount.releaseDate = processReleaseDate(mountNode.get("ReleaseDate"));
mount.productid = getValue(mountNode, "ProductId");
if(mount.productid)
mount.productid = +mount.productid;
else
delete mount.productid;

/*
<CMount id="DiabloRun">
Expand Down
26 changes: 25 additions & 1 deletion shared/C.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,28 @@ exports.HERO_ID_TEXTURE_RENAMES = {"Dryad" : "lunara", "Greymane" : "genngreyman

exports.EXTRA_XML_FILE_PATHS = [];

// Extra mount data files in GameData/Mounts/<key>Data/Mount_<array value>Data.xml
exports.EXTRA_MOUNT_DATA_FILES = {
"Cloud9Nexagon" : ["Ridesurf_Cloud9Nexagon"],
"Felstalker" : ["Ride_Felstalker"],
"Horse" : ["Horse_ArmoredWarSteed",
"Horse_Common",
"Horse_HeadlessHorseman",
"Horse_IllidansNightmare",
"Horse_JudgementCharger",
"Horse_MalthaelsPhantom",
"Horse_MarshalsOutrider",
"Horse_Nazeebra",
"Horse_NexusCharger",
"Horse_RainbowUnicorn",
"Horse_TyraelsCharger" ],
"LionGreymane" : ["Ride_LionGreymane"],
"LunarDragon" : ["Ride_LunarDragon"],
"StarChariot" : ["Ridesurf_StarChariot"],
"Starbreaker" : ["Ridebike_Starbreaker"],
"TreasureGoblinWinter" : ["Ride_TreasureGoblinWinter"]
};

// Extra hero data files GameData/Heroes/<hero>Data.xml
exports.EXTRA_HEROES_GAMEDATA_FILES = ["Chen", "Zagara"];

Expand Down Expand Up @@ -297,11 +319,13 @@ exports.MOUNT_JSON_SCHEMA =
name : { type : "string", minLength : 1 },
description : { type : "string", minLength : 1 },
franchise : { type : "string", minLength : 1 },
releaseDate : { type : "string", pattern : "2[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" }
releaseDate : { type : "string", pattern : "2[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" },
productid : { type : "integer" }
}
};

exports.MOUNT_JSON_SCHEMA.required = Object.keys(exports.MOUNT_JSON_SCHEMA.properties);
exports.MOUNT_JSON_SCHEMA.required.remove("productid");

exports.HERO_JSON_SCHEMA =
{
Expand Down
9 changes: 9 additions & 0 deletions web/changelog.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[
{
"version" : "2.7.1",
"when" : "2016-02-04",
"patchVersion" : "40431",
"changes" : [
"Added documentation for mounts.json file.",
"Added some missing mounts."
]
},
{
"version" : "2.7.0",
"when" : "2016-02-02",
Expand Down
1 change: 1 addition & 0 deletions web/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ tiptoe(
base.info("Rendering index...");

dustData.heroesSize = printUtil.toSize(fs.statSync(path.join(WEB_OUT_PATH, "heroes.json")).size, 1);
dustData.mountsSize = printUtil.toSize(fs.statSync(path.join(WEB_OUT_PATH, "mounts.json")).size, 1);
dustData.changeLog = JSON.parse(fs.readFileSync(path.join(__dirname, "changelog.json"), {encoding : "utf8"})).map(function(o) { o.when = moment(o.when, "YYYY-MM-DD").format("MMM D, YYYY"); return o; });
dustData.lastUpdated = dustData.changeLog[0].when;
dustData.version = dustData.changeLog[0].version;
Expand Down
65 changes: 63 additions & 2 deletions web/index.dust
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@
<span class="size">{heroesSize}</span>
</td>
</tr>
<tr>
<td class="sizeColLeft">
<a href="json/mounts.json">mounts.json</a>
</td>
<td class="sizeColRight">
<span class="size">{mountsSize}</span>
</td>
</tr>
</tbody>
</table>
<br>
Expand All @@ -60,7 +68,7 @@
<br>The 'heroes.json' file is an array where each entry is a hero object with key/value pairs.<br>
<br>Below you will find a table detailing each key.<br>
<br>
The heros are sorted by 'name'.<br>
The heroes are sorted by 'name'.<br>
<br>
All data is extracted directly from the Heros of the Storm game files.<br>
<br>
Expand Down Expand Up @@ -90,7 +98,7 @@
<td>The name of this hero.</td>
</tr>
<tr>
<td>title</td>
<td>title</td>7
<td>"Dominion Ghost"</td>
<td>The title of this hero.</td>
</tr>
Expand Down Expand Up @@ -356,6 +364,59 @@
</table>
<br>
<hr>
<h1>mounts.json Documentation<a href="#top">(back to top)</a></h1>
<p>All JSON files are UTF8 encoded and may contain UTF8 characters.<br>
<br>The 'mounts.json' file is an array where each entry is a mount object with key/value pairs.<br>
<br>Below you will find a table detailing each key.<br>
<br>
The mounts are sorted by 'name'.<br>
<br>
All data is extracted directly from the Heros of the Storm game files.<br>
<br>
</p>
<table>
<thead>
<tr>
<th>Key</th>
<th>Example</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>"MoneyPig"</td>
<td>The internal ID of this mount.</td>
</tr>
<tr>
<td>name</td>
<td>"Piggy Bank"</td>
<td>The name of this mount.</td>
</tr>
<tr>
<td>description</td>
<td>"This little piggy went, "Whee whee whee!" all the way to the bank!"</td>
<td>The description of this mount.</td>
</tr>
<tr>
<td>franchise</td>
<td>"Heroes"</td>
<td>Which universe/franchise this mount comes from.</td>
</tr>
<tr>
<td>releaseDate</td>
<td>"2014-10-14"</td>
<td>The release date for this mount. Date format: YYYY-MM-DD</td>
</tr>
<tr>
<td>productid</td>
<td>10072</td>
<td>The internal product id for this mount. Not present for all mounts.</td>
</tr>
</tbody>
</table>
<br>
<hr>
<a name="exampleHero"></a>
<h1>Example Hero<a href="#top">(back to top)</a></h1>
<pre id="heroExampleCode"><code data-language="javascript">
Expand Down

0 comments on commit 72bd6de

Please sign in to comment.