diff options
author | Freeyorp <TheFreeYorp@NOSPAM.G.m.a.i.l.replace> | 2013-05-02 22:09:33 +1200 |
---|---|---|
committer | Freeyorp <TheFreeYorp@NOSPAM.G.m.a.i.l.replace> | 2013-05-02 22:09:33 +1200 |
commit | abd89f6a42d1b87916c2c9c64a436581e7285b57 (patch) | |
tree | 728a3e1e636d3ef7a0ad53717bb4689540a3a2d4 | |
parent | 1354f7e82015e04818c6aa4e759bbb036547c58b (diff) | |
download | manavis-abd89f6a42d1b87916c2c9c64a436581e7285b57.tar.gz manavis-abd89f6a42d1b87916c2c9c64a436581e7285b57.tar.bz2 manavis-abd89f6a42d1b87916c2c9c64a436581e7285b57.tar.xz manavis-abd89f6a42d1b87916c2c9c64a436581e7285b57.zip |
Parse spell damage
This closes #10.
-rw-r--r-- | js/mv/parse.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/js/mv/parse.js b/js/mv/parse.js index 9ec0428..8094bc5 100644 --- a/js/mv/parse.js +++ b/js/mv/parse.js @@ -26,7 +26,8 @@ var mv = function(mv) { pcstat: pcstat[d[2]], target: "UNKNOWN", dmg: -1010, - wpn: "UNKNOWN" + wpn: "UNKNOWN", + atktype: "UNKNOWN" }; if (pcstat[d[2]] == undefined && (!fullyDefinedCutoff || ts > fullyDefinedCutoff)) { fullyDefinedCutoff = ts; @@ -45,7 +46,16 @@ var mv = function(mv) { softAssert(rec.target, "Unknown target!") rec.dmg = parseInt(d[8]); rec.wpn = item.nameByServerID(d[9]); + rec.atktype = "Physical"; } else { + /* Not weapon damage, perhaps it was spell damage? */ + d = spl[i - 2].match(/^(\d+\.\d+) PC(\d+) (\d+):(\d+),(\d+) SPELLDMG MOB(\d+) (\d+) FOR (\d+) BY ([^ ]+)/); + if (d) { + rec.target = mob.nameByServerID(d[7]); + rec.dmg = parseInt(d[8]); + rec.wpn = d[9]; + rec.atktype = "Magical"; + } // console.error("No match (deathblow):", spl[i - 2]); } } else { @@ -57,6 +67,7 @@ var mv = function(mv) { softAssert(rec.target, "Unknown (cloned) target!"); rec.dmg = clone.dmg; /* FIXME: Take into account actual assist damage */ rec.wpn = clone.wpn; + rec.atktype = clone.atktype; /* FIXME: Take into account what the assists used */ } else { // console.error("No match (clone):", spl[i - 1]); } |