Skip to content

Commit

Permalink
#205 parser updates complete
Browse files Browse the repository at this point in the history
  • Loading branch information
ebshimizu committed Jul 12, 2018
1 parent 65729db commit a8fa329
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 12 deletions.
2 changes: 1 addition & 1 deletion assets/heroes-talents
Submodule heroes-talents updated 40 files
+2 −2 hero/alexstrasza.json
+4 −4 hero/anubarak.json
+121 −142 hero/azmodan.json
+2 −2 hero/cassia.json
+2 −2 hero/guldan.json
+1 −1 hero/jaina.json
+126 −144 hero/raynor.json
+1 −1 hero/thelostvikings.json
+ images/talents/storm_ui_icon_azmodan_allshallburn.png
+ images/talents/storm_ui_icon_azmodan_allshallburn_a.png
+ images/talents/storm_ui_icon_azmodan_blackpool.png
+ images/talents/storm_ui_icon_azmodan_demonicinvasion.png
+ images/talents/storm_ui_icon_azmodan_generalofhell.png
+ images/talents/storm_ui_icon_azmodan_globeofannihilation.png
+ images/talents/storm_ui_icon_azmodan_globeofannihilation_a.png
+ images/talents/storm_ui_icon_azmodan_globeofannihilation_b.png
+ images/talents/storm_ui_icon_azmodan_gluttonousward.png
+ images/talents/storm_ui_icon_azmodan_relentless.png
+ images/talents/storm_ui_icon_azmodan_sinsgrasp.png
+ images/talents/storm_ui_icon_azmodan_summondemonwarrior.png
+ images/talents/storm_ui_icon_azmodan_summondemonwarrior_a.png
+ images/talents/storm_ui_icon_azmodan_trample.png
+ images/talents/storm_ui_icon_raynor_acardtoplay.png
+ images/talents/storm_ui_icon_raynor_acquireweakspot.png
+ images/talents/storm_ui_icon_raynor_adrenalinrush.png
+ images/talents/storm_ui_icon_raynor_advancedoptics.png
+ images/talents/storm_ui_icon_raynor_commandraynorsraiders.png
+ images/talents/storm_ui_icon_raynor_hulkarmor.png
+ images/talents/storm_ui_icon_raynor_hyperion.png
+ images/talents/storm_ui_icon_raynor_inspire.png
+ images/talents/storm_ui_icon_raynor_inspire_a.png
+ images/talents/storm_ui_icon_raynor_penetratinground.png
+ images/talents/storm_ui_icon_raynor_penetratinground_var1.png
+ images/talents/storm_ui_icon_raynor_puttinonaclinic.png
+ images/talents/storm_ui_icon_raynor_raidersrecruitment.png
+ images/talents/storm_ui_icon_raynor_raynorsraiders.png
+ images/talents/storm_ui_icon_raynor_relentlessleader.png
+ images/talents/storm_ui_icon_raynor_split_debilitatingrounds.png
+ images/talents/storm_ui_icon_raynor_split_fuelrush.png
+ images/talents/storm_ui_icon_talent_autoattack_building.png
7 changes: 7 additions & 0 deletions docs/hots-replay-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,13 @@ Contents:
* Team: `event.m_fixedData[0].m_value` - Team in **fixed integer** format. 1: blue, 2: red after resolving.
* Score: `event.m_intData[1].m_value` - Number of gems required for the current spawn.

#### Braxis Holdout: Wave Complete
Event Name: `BraxisHoldoutMapEventComplete`

Contents:
* Blue Team Progress: `event.m_fixedData[0].m_value`
* Red Team Progress: `event.m_fixedData[1].m_value`

### <a name="tracker11"></a>Score (NNet.Replay.Tracker.SScoreResultEvent), _eventid = 11
This event contains the end of game stats (hero damage, xp contribution, etc.).

Expand Down
3 changes: 2 additions & 1 deletion parser/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ const StatEventType = {
SixTowersStart: 'Six Town Event Start',
SixTowersEnd: 'Six Town Event End',
TowersFortCaptured: 'Town Captured',
Upvote: 'EndOfGameUpVotesCollected'
Upvote: 'EndOfGameUpVotesCollected',
BraxisWaveStart: `BraxisHoldoutMapEventComplete`
};

const StructureStrings = {
Expand Down
37 changes: 27 additions & 10 deletions parser/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,12 @@ function processReplay(file, HeroesTalents, opts = {}) {
players[id].globes.count += 1;
players[id].globes.events.push(globe);
}
else if (event.m_eventName === ReplayTypes.StatEventType.BraxisWaveStart) {
match.objective.waves[waveID].startLoop = event._gameloop;
match.objective.waves[waveID].startTime = loopsToSeconds(event._gameloop - match.loopGameStart);

match.objective.waves[waveID].startScore = {0: event.m_fixedData[0].m_value / 4096, 1: event.m_fixedData[1].m_value / 4096};
}
}
else if (event._eventid === ReplayTypes.TrackerEvent.UnitBorn) {
// there's going to be a special case for tomb once i figure out the map name for it
Expand Down Expand Up @@ -993,7 +999,7 @@ function processReplay(file, HeroesTalents, opts = {}) {
}
else {
// TODO: wave strength score update
let score = {0: braxisWaveStrength(waveUnits[0]), 1: braxisWaveStrength(waveUnits[1])};
let score = {0: braxisWaveStrength(waveUnits[0], match.version.m_build), 1: braxisWaveStrength(waveUnits[1], match.version.m_build)};
score.loop = event._gameloop;
score.time = loopsToSeconds(score.loop - match.loopGameStart);
match.objective.waves[waveID].scores.push(score);
Expand All @@ -1003,10 +1009,12 @@ function processReplay(file, HeroesTalents, opts = {}) {
}
else if (type === ReplayTypes.UnitType.BraxisZergPath) {
// start the wave
match.objective.waves[waveID].startLoop = event._gameloop;
match.objective.waves[waveID].startTime = loopsToSeconds(event._gameloop - match.loopGameStart);
if (!match.objective.waves[waveID].startLoop) {
match.objective.waves[waveID].startLoop = event._gameloop;
match.objective.waves[waveID].startTime = loopsToSeconds(event._gameloop - match.loopGameStart);

match.objective.waves[waveID].startScore = {0: braxisWaveStrength(waveUnits[0]), 1: braxisWaveStrength(waveUnits[1])};
match.objective.waves[waveID].startScore = {0: braxisWaveStrength(waveUnits[0], match.version.m_build), 1: braxisWaveStrength(waveUnits[1], match.version.m_build)};
}
}
else if (type === ReplayTypes.UnitType.BraxisControlPoint) {
let id = event.m_unitTagIndex + '-' + event.m_unitTagRecycle;
Expand Down Expand Up @@ -1176,12 +1184,13 @@ function processReplay(file, HeroesTalents, opts = {}) {

if (id in waveUnits[0]) {
if (waveUnits[0][id].type === ReplayTypes.BraxisUnitType.ZergUltralisk) {
// this i think isn't relevant since build 66488
// ok so if an ultralisk died and the killer was null, then we have to update
// the starting strength of the other team's wave to 1 because this unit got
// dead instantly
if (event.m_killerPlayerId === null) {
if (!('startScore' in match.objective.waves[waveID])) {
match.objective.waves[waveID].startScore = {0: braxisWaveStrength(waveUnits[0]), 1: braxisWaveStrength(waveUnits[1]) };
match.objective.waves[waveID].startScore = {0: braxisWaveStrength(waveUnits[0], match.version.m_build), 1: braxisWaveStrength(waveUnits[1], match.version.m_build) };
}
match.objective.waves[waveID].startScore[1] = 1;
}
Expand All @@ -1198,7 +1207,7 @@ function processReplay(file, HeroesTalents, opts = {}) {
// dead instantly
if (event.m_killerPlayerId === null) {
if (!('startScore' in match.objective.waves[waveID])) {
match.objective.waves[waveID].startScore = {0: braxisWaveStrength(waveUnits[0]), 1: braxisWaveStrength(waveUnits[1]) };
match.objective.waves[waveID].startScore = {0: braxisWaveStrength(waveUnits[0], match.version.m_build), 1: braxisWaveStrength(waveUnits[1], match.version.m_build) };
}

match.objective.waves[waveID].startScore[0] = 1;
Expand Down Expand Up @@ -1750,7 +1759,7 @@ function processTauntData(players, takedowns, playerBSeq) {
}
}

function braxisWaveStrength(units) {
function braxisWaveStrength(units, build) {
// determines the strength of the wave based on
// this is basically just a max of all the possible percentages indicated by the units
var types = {};
Expand All @@ -1764,9 +1773,17 @@ function braxisWaveStrength(units) {
}

// percentage counts
var score = 0.05 * (types[ReplayTypes.BraxisUnitType.ZergZergling] - 6) + types[ReplayTypes.BraxisUnitType.ZergBaneling] * 0.05;
score = Math.max(score, types[ReplayTypes.BraxisUnitType.ZergHydralisk] * 0.14);
score = Math.max(score, types[ReplayTypes.BraxisUnitType.ZergGuardian] * 0.3);
var score = 0;
if (build < 66488) {
score = 0.05 * (types[ReplayTypes.BraxisUnitType.ZergZergling] - 6) + types[ReplayTypes.BraxisUnitType.ZergBaneling] * 0.05;
score = Math.max(score, types[ReplayTypes.BraxisUnitType.ZergHydralisk] * 0.14);
score = Math.max(score, types[ReplayTypes.BraxisUnitType.ZergGuardian] * 0.3);
}
else {
score = 0.1 * types[ReplayTypes.BraxisUnitType.ZergBaneling];
score = Math.max(score, 0.25 * (types[ReplayTypes.BraxisUnitType.ZergHydralisk] - 2));
score = Math.max(score, 0.35 * (types[ReplayTypes.BraxisUnitType.ZergGuardian] - 1));
}
// skip ultralisks they're unreliable

return score;
Expand Down

0 comments on commit a8fa329

Please sign in to comment.