diff --git a/d2bs/kolbot/libs/GameAction.js b/d2bs/kolbot/libs/GameAction.js index 51c8b845a..00dcb1007 100644 --- a/d2bs/kolbot/libs/GameAction.js +++ b/d2bs/kolbot/libs/GameAction.js @@ -257,149 +257,7 @@ var GameAction = { desc = this.getItemDesc(unit, logIlvl) + "$" + unit.gid + ":" + unit.classid + ":" + unit.location + ":" + unit.x + ":" + unit.y + (unit.getFlag(0x400000) ? ":eth" : ""); color = unit.getColor(); - - switch (unit.quality) { - case 5: // Set - switch (unit.classid) { - case 27: // Angelic sabre - code = "inv9sbu"; - - break; - case 74: // Arctic short war bow - code = "invswbu"; - - break; - case 308: // Berserker's helm - code = "invhlmu"; - - break; - case 330: // Civerb's large shield - code = "invlrgu"; - - break; - case 31: // Cleglaw's long sword - case 227: // Szabi's cryptic sword - code = "invlsdu"; - - break; - case 329: // Cleglaw's small shield - code = "invsmlu"; - - break; - case 328: // Hsaru's buckler - code = "invbucu"; - - break; - case 306: // Infernal cap / Sander's cap - code = "invcapu"; - - break; - case 30: // Isenhart's broad sword - code = "invbsdu"; - - break; - case 309: // Isenhart's full helm - code = "invfhlu"; - - break; - case 333: // Isenhart's gothic shield - code = "invgtsu"; - - break; - case 326: // Milabrega's ancient armor - case 442: // Immortal King's sacred armor - code = "invaaru"; - - break; - case 331: // Milabrega's kite shield - code = "invkitu"; - - break; - case 332: // Sigon's tower shield - code = "invtowu"; - - break; - case 325: // Tancred's full plate mail - code = "invfulu"; - - break; - case 3: // Tancred's military pick - code = "invmpiu"; - - break; - case 113: // Aldur's jagged star - code = "invmstu"; - - break; - case 234: // Bul-Kathos' colossus blade - code = "invgsdu"; - - break; - case 372: // Grizwold's ornate plate - code = "invxaru"; - - break; - case 366: // Heaven's cuirass - case 215: // Heaven's reinforced mace - case 449: // Heaven's ward - case 426: // Heaven's spired helm - code = "inv" + unit.code + "s"; - - break; - case 357: // Hwanin's grand crown - code = "invxrnu"; - - break; - case 195: // Nalya's scissors suwayyah - code = "invskru"; - - break; - case 395: // Nalya's grim helm - case 465: // Trang-Oul's bone visage - code = "invbhmu"; - - break; - case 261: // Naj's elder staff - code = "invcstu"; - - break; - case 375: // Orphan's round shield - code = "invxmlu"; - - break; - case 12: // Sander's bone wand - code = "invbwnu"; - - break; - } - - break; - case 7: // Unique - for (i = 0; i < 401; i += 1) { - if (unit.code === getBaseStat(17, i, 4).trim() && unit.fname.split("\n").reverse()[0].indexOf(getLocaleString(getBaseStat(17, i, 2))) > -1) { - code = getBaseStat(17, i, "invfile"); - - break; - } - } - - break; - } - - if (!code) { - if (["ci2", "ci3"].indexOf(unit.code) > -1) { // Tiara/Diadem - code = unit.code; - } else { - code = getBaseStat(0, unit.classid, 'normcode') || unit.code; - } - - code = code.replace(" ", ""); - - if ([10, 12, 58, 82, 83, 84].indexOf(unit.itemType) > -1) { - code += (unit.gfx + 1); - } - } - + code = unit.skinCode; sock = unit.getItems(); if (sock) { diff --git a/d2bs/kolbot/libs/MuleLogger.js b/d2bs/kolbot/libs/MuleLogger.js index 9ec7ef370..a7502afa1 100644 --- a/d2bs/kolbot/libs/MuleLogger.js +++ b/d2bs/kolbot/libs/MuleLogger.js @@ -132,149 +132,7 @@ var MuleLogger = { desc = this.getItemDesc(unit, logIlvl) + "$" + unit.gid + ":" + unit.classid + ":" + unit.location + ":" + unit.x + ":" + unit.y + (unit.getFlag(0x400000) ? ":eth" : ""); color = unit.getColor(); - - switch (unit.quality) { - case 5: // Set - switch (unit.classid) { - case 27: // Angelic sabre - code = "inv9sbu"; - - break; - case 74: // Arctic short war bow - code = "invswbu"; - - break; - case 308: // Berserker's helm - code = "invhlmu"; - - break; - case 330: // Civerb's large shield - code = "invlrgu"; - - break; - case 31: // Cleglaw's long sword - case 227: // Szabi's cryptic sword - code = "invlsdu"; - - break; - case 329: // Cleglaw's small shield - code = "invsmlu"; - - break; - case 328: // Hsaru's buckler - code = "invbucu"; - - break; - case 306: // Infernal cap / Sander's cap - code = "invcapu"; - - break; - case 30: // Isenhart's broad sword - code = "invbsdu"; - - break; - case 309: // Isenhart's full helm - code = "invfhlu"; - - break; - case 333: // Isenhart's gothic shield - code = "invgtsu"; - - break; - case 326: // Milabrega's ancient armor - case 442: // Immortal King's sacred armor - code = "invaaru"; - - break; - case 331: // Milabrega's kite shield - code = "invkitu"; - - break; - case 332: // Sigon's tower shield - code = "invtowu"; - - break; - case 325: // Tancred's full plate mail - code = "invfulu"; - - break; - case 3: // Tancred's military pick - code = "invmpiu"; - - break; - case 113: // Aldur's jagged star - code = "invmstu"; - - break; - case 234: // Bul-Kathos' colossus blade - code = "invgsdu"; - - break; - case 372: // Grizwold's ornate plate - code = "invxaru"; - - break; - case 366: // Heaven's cuirass - case 215: // Heaven's reinforced mace - case 449: // Heaven's ward - case 426: // Heaven's spired helm - code = "inv" + unit.code + "s"; - - break; - case 357: // Hwanin's grand crown - code = "invxrnu"; - - break; - case 195: // Nalya's scissors suwayyah - code = "invskru"; - - break; - case 395: // Nalya's grim helm - case 465: // Trang-Oul's bone visage - code = "invbhmu"; - - break; - case 261: // Naj's elder staff - code = "invcstu"; - - break; - case 375: // Orphan's round shield - code = "invxmlu"; - - break; - case 12: // Sander's bone wand - code = "invbwnu"; - - break; - } - - break; - case 7: // Unique - for (i = 0; i < 401; i += 1) { - if (unit.code === getBaseStat(17, i, 4).trim() && unit.fname.split("\n").reverse()[0].indexOf(getLocaleString(getBaseStat(17, i, 2))) > -1) { - code = getBaseStat(17, i, "invfile"); - - break; - } - } - - break; - } - - if (!code) { - if (["ci2", "ci3"].indexOf(unit.code) > -1) { // Tiara/Diadem - code = unit.code; - } else { - code = getBaseStat(0, unit.classid, 'normcode') || unit.code; - } - - code = code.replace(" ", ""); - - if ([10, 12, 58, 82, 83, 84].indexOf(unit.itemType) > -1) { - code += (unit.gfx + 1); - } - } - + code = unit.skinCode; sock = unit.getItems(); if (sock) { diff --git a/d2bs/kolbot/libs/NTItemAlias.dbl b/d2bs/kolbot/libs/NTItemAlias.dbl index e9e4a470a..3f8dd9a6f 100644 --- a/d2bs/kolbot/libs/NTItemAlias.dbl +++ b/d2bs/kolbot/libs/NTItemAlias.dbl @@ -801,6 +801,37 @@ NTIPAliasColor["darkgold"] = 16; NTIPAliasColor["darkgreen"] = 11; NTIPAliasColor["darkblue"] = 5; +var NTIPAliasSkin = {}; +// rings +NTIPAliasSkin["coral"] = "rin1"; +NTIPAliasSkin["smallblue"] = "rin2"; +NTIPAliasSkin["bigblue"] = "rin3"; +NTIPAliasSkin["orangestone"] = "rin4"; NTIPAliasSkin["orangering"] = "rin4"; +NTIPAliasSkin["crown"] = "rin5"; +// amulets +NTIPAliasSkin["dot"] = "amu1"; +NTIPAliasSkin["sun"] = "amu2"; +NTIPAliasSkin["penta"] = "amu3"; +// jewels +NTIPAliasSkin["pink"] = "jew1"; +NTIPAliasSkin["blue"] = "jew2"; +NTIPAliasSkin["orange"] = "jew3"; +NTIPAliasSkin["green"] = "jew4"; +NTIPAliasSkin["red"] = "jew5"; +NTIPAliasSkin["white"] = "jew6"; +// small charms +NTIPAliasSkin["brown"] = "cm11"; +NTIPAliasSkin["bear"] = "cm12"; NTIPAliasSkin["bearfoot"] = "cm12"; +NTIPAliasSkin["m"] = "cm13"; NTIPAliasSkin["M"] = "cm13"; +// large charms +NTIPAliasSkin["paw"] = "cm21"; +NTIPAliasSkin["horn"] = "cm22"; +NTIPAliasSkin["tower"] = "cm23"; +// grand charms +NTIPAliasSkin["eye"] = "cm31"; +NTIPAliasSkin["dna"] = "cm32"; NTIPAliasSkin["DNA"] = "cm32"; NTIPAliasSkin["spaghetti"] = "cm32"; +NTIPAliasSkin["dragon"] = "cm33"; + var NTIPAliasStat = {}; NTIPAliasStat["strength"] = 0; NTIPAliasStat["energy"] = 1; diff --git a/d2bs/kolbot/libs/NTItemParser.dbl b/d2bs/kolbot/libs/NTItemParser.dbl index 51626cc1b..ecf756df2 100644 --- a/d2bs/kolbot/libs/NTItemParser.dbl +++ b/d2bs/kolbot/libs/NTItemParser.dbl @@ -3,7 +3,7 @@ [Item-parser Syntax Information] 1. [Keyword] separates into two groups - - [Property Keywords] : [Type], [Name], [Class], [Quality], [Flag], [Level], [Prefix], [Suffix] + - [Property Keywords] : [Type], [Name], [Class], [Quality], [Flag], [Level], [Prefix], [Suffix], [Skin] - [Stat Keywords] : [Number or Alias] 2. [Keyword] must be surrounded by '[' and ']' @@ -412,6 +412,10 @@ NTIP.ParseLineInt = function (input, info) { p_end += 2; + break; + case 'skin': + p_result[0] += "item.skinCode"; + break; default: Misc.errorReport("Unknown property: " + property + " File: " + info.file + " Line: " + info.line); @@ -507,6 +511,16 @@ NTIP.ParseLineInt = function (input, info) { case 'suffix': p_result[0] += "\"" + p_keyword + "\")"; + break; + case 'skin': + if (NTIPAliasSkin[p_keyword] === undefined) { + Misc.errorReport("Unknown skin: " + p_keyword + " File: " + info.file + " Line: " + info.line); + + return false; + } + + p_result[0] += "\"" + NTIPAliasSkin[p_keyword] + "\""; + break; } } else { diff --git a/d2bs/kolbot/libs/common/Misc.js b/d2bs/kolbot/libs/common/Misc.js index b96ea162d..a9c388469 100644 --- a/d2bs/kolbot/libs/common/Misc.js +++ b/d2bs/kolbot/libs/common/Misc.js @@ -1381,150 +1381,7 @@ var Misc = { } } - if (unit.getFlag(0x10)) { - switch (unit.quality) { - case 5: // Set - switch (unit.classid) { - case 27: // Angelic sabre - code = "inv9sbu"; - - break; - case 74: // Arctic short war bow - code = "invswbu"; - - break; - case 308: // Berserker's helm - code = "invhlmu"; - - break; - case 330: // Civerb's large shield - code = "invlrgu"; - - break; - case 31: // Cleglaw's long sword - case 227: // Szabi's cryptic sword - code = "invlsdu"; - - break; - case 329: // Cleglaw's small shield - code = "invsmlu"; - - break; - case 328: // Hsaru's buckler - code = "invbucu"; - - break; - case 306: // Infernal cap / Sander's cap - code = "invcapu"; - - break; - case 30: // Isenhart's broad sword - code = "invbsdu"; - - break; - case 309: // Isenhart's full helm - code = "invfhlu"; - - break; - case 333: // Isenhart's gothic shield - code = "invgtsu"; - - break; - case 326: // Milabrega's ancient armor - case 442: // Immortal King's sacred armor - code = "invaaru"; - - break; - case 331: // Milabrega's kite shield - code = "invkitu"; - - break; - case 332: // Sigon's tower shield - code = "invtowu"; - - break; - case 325: // Tancred's full plate mail - code = "invfulu"; - - break; - case 3: // Tancred's military pick - code = "invmpiu"; - - break; - case 113: // Aldur's jagged star - code = "invmstu"; - - break; - case 234: // Bul-Kathos' colossus blade - code = "invgsdu"; - - break; - case 372: // Grizwold's ornate plate - code = "invxaru"; - - break; - case 366: // Heaven's cuirass - case 215: // Heaven's reinforced mace - case 449: // Heaven's ward - case 426: // Heaven's spired helm - code = "inv" + unit.code + "s"; - - break; - case 357: // Hwanin's grand crown - code = "invxrnu"; - - break; - case 195: // Nalya's scissors suwayyah - code = "invskru"; - - break; - case 395: // Nalya's grim helm - case 465: // Trang-Oul's bone visage - code = "invbhmu"; - - break; - case 261: // Naj's elder staff - code = "invcstu"; - - break; - case 375: // Orphan's round shield - code = "invxmlu"; - - break; - case 12: // Sander's bone wand - code = "invbwnu"; - - break; - } - - break; - case 7: // Unique - for (i = 0; i < 401; i += 1) { - if (unit.code === getBaseStat(17, i, 4).trim() && unit.fname.split("\n").reverse()[0].indexOf(getLocaleString(getBaseStat(17, i, 2))) > -1) { - code = getBaseStat(17, i, "invfile"); - - break; - } - } - - break; - } - } - - if (!code) { - if (["ci2", "ci3"].indexOf(unit.code) > -1) { // Tiara/Diadem - code = unit.code; - } else { - code = getBaseStat(0, unit.classid, 'normcode') || unit.code; - } - - code = code.replace(" ", ""); - - if ([10, 12, 58, 82, 83, 84].indexOf(unit.itemType) > -1) { - code += (unit.gfx + 1); - } - } - + code = unit.skinCode; sock = unit.getItem(); if (sock) { diff --git a/d2bs/kolbot/libs/common/Prototypes.js b/d2bs/kolbot/libs/common/Prototypes.js index f3e7f8d94..3316dd1ea 100644 --- a/d2bs/kolbot/libs/common/Prototypes.js +++ b/d2bs/kolbot/libs/common/Prototypes.js @@ -1039,6 +1039,158 @@ Unit.prototype.getColor = function () { return -1; }; +Object.defineProperty(Unit.prototype, "skinCode", { + get: function() { + var code; + if (this.getFlag(0x10)) { + switch (this.quality) { + case 5: // Set + switch (this.classid) { + case 27: // Angelic sabre + code = "inv9sbu"; + + break; + case 74: // Arctic short war bow + code = "invswbu"; + + break; + case 308: // Berserker's helm + code = "invhlmu"; + + break; + case 330: // Civerb's large shield + code = "invlrgu"; + + break; + case 31: // Cleglaw's long sword + case 227: // Szabi's cryptic sword + code = "invlsdu"; + + break; + case 329: // Cleglaw's small shield + code = "invsmlu"; + + break; + case 328: // Hsaru's buckler + code = "invbucu"; + + break; + case 306: // Infernal cap / Sander's cap + code = "invcapu"; + + break; + case 30: // Isenhart's broad sword + code = "invbsdu"; + + break; + case 309: // Isenhart's full helm + code = "invfhlu"; + + break; + case 333: // Isenhart's gothic shield + code = "invgtsu"; + + break; + case 326: // Milabrega's ancient armor + case 442: // Immortal King's sacred armor + code = "invaaru"; + + break; + case 331: // Milabrega's kite shield + code = "invkitu"; + + break; + case 332: // Sigon's tower shield + code = "invtowu"; + + break; + case 325: // Tancred's full plate mail + code = "invfulu"; + + break; + case 3: // Tancred's military pick + code = "invmpiu"; + + break; + case 113: // Aldur's jagged star + code = "invmstu"; + + break; + case 234: // Bul-Kathos' colossus blade + code = "invgsdu"; + + break; + case 372: // Grizwold's ornate plate + code = "invxaru"; + + break; + case 366: // Heaven's cuirass + case 215: // Heaven's reinforced mace + case 449: // Heaven's ward + case 426: // Heaven's spired helm + code = "inv" + this.code + "s"; + + break; + case 357: // Hwanin's grand crown + code = "invxrnu"; + + break; + case 195: // Nalya's scissors suwayyah + code = "invskru"; + + break; + case 395: // Nalya's grim helm + case 465: // Trang-Oul's bone visage + code = "invbhmu"; + + break; + case 261: // Naj's elder staff + code = "invcstu"; + + break; + case 375: // Orphan's round shield + code = "invxmlu"; + + break; + case 12: // Sander's bone wand + code = "invbwnu"; + + break; + } + + break; + case 7: // Unique + for (var i = 0; i < 401; i += 1) { + if (this.fname.split("\n").reverse()[0].indexOf(getLocaleString(getBaseStat(17, i, 2))) > -1) { + code = getBaseStat(17, i, "invfile"); + + break; + } + } + + break; + } + } + + if (!code) { + if (["ci2", "ci3"].indexOf(this.code) > -1) { // Tiara/Diadem + code = this.code; + } else { + code = getBaseStat(0, this.classid, 'normcode') || this.code; + } + + code = code.replace(" ", ""); + + if ([10, 12, 58, 82, 83, 84].indexOf(this.itemType) > -1) { // ring/amu/jewel/sc/lc/gc + code += (this.gfx + 1); + } + } + + return code; + }, + enumerable: true +}); + // Object.assign polyfill from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign if (typeof Object.assign !== 'function') { Object.defineProperty(Object, "assign", {