Skip to content

Commit

Permalink
Added new property keyword Skin for pickit to filter rings, amulets…
Browse files Browse the repository at this point in the history
…, jewels and charms skin.

Refactored getting the skin value of item with property `skinCode` in Unit prototype.
  • Loading branch information
ryancrunchi committed Apr 6, 2019
1 parent c64eba1 commit c61aeb8
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 431 deletions.
144 changes: 1 addition & 143 deletions d2bs/kolbot/libs/GameAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
144 changes: 1 addition & 143 deletions d2bs/kolbot/libs/MuleLogger.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
31 changes: 31 additions & 0 deletions d2bs/kolbot/libs/NTItemAlias.dbl
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,37 @@ NTIPAliasColor["darkgold"] = 16;
NTIPAliasColor["darkgreen"] = 11;
NTIPAliasColor["darkblue"] = 5;

var NTIPAliasSkin = {};
// rings
NTIPAliasSkin["coral"] = "rin1"; NTIPAliasSkin["chain"] = "rin1";
NTIPAliasSkin["smallblue"] = "rin2"; NTIPAliasSkin["sloop"] = "rin2";
NTIPAliasSkin["bigblue"] = "rin3"; NTIPAliasSkin["bband"] = "rin3";
NTIPAliasSkin["orangestone"] = "rin4"; NTIPAliasSkin["orangering"] = "rin4";
NTIPAliasSkin["crown"] = "rin5"; NTIPAliasSkin["eturn"] = "rin5";
// amulets
NTIPAliasSkin["dot"] = "amu1"; NTIPAliasSkin["cross"] = "amu1";
NTIPAliasSkin["sun"] = "amu2";
NTIPAliasSkin["penta"] = "amu3"; NTIPAliasSkin["star"] = "amu3";
// jewels
NTIPAliasSkin["pink"] = "jew1";
NTIPAliasSkin["blue"] = "jew2";
NTIPAliasSkin["orange"] = "jew3"; NTIPAliasSkin["peach"] = "jew3";
NTIPAliasSkin["green"] = "jew4";
NTIPAliasSkin["red"] = "jew5";
NTIPAliasSkin["white"] = "jew6";
// small charms
NTIPAliasSkin["brown"] = "cm11"; NTIPAliasSkin["football"] = "cm11";
NTIPAliasSkin["bear"] = "cm12"; NTIPAliasSkin["bearfoot"] = "cm12"; NTIPAliasSkin["bearclaw"] = "cm12";
NTIPAliasSkin["m"] = "cm13"; NTIPAliasSkin["coin"] = "cm13";
// large charms
NTIPAliasSkin["paw"] = "cm21"; NTIPAliasSkin["paper"] = "cm21";
NTIPAliasSkin["horn"] = "cm22";
NTIPAliasSkin["tower"] = "cm23"; NTIPAliasSkin["obelisk"] = "cm23";
// grand charms
NTIPAliasSkin["eye"] = "cm31";
NTIPAliasSkin["dna"] = "cm32"; NTIPAliasSkin["lace"] = "cm32"; NTIPAliasSkin["spaghetti"] = "cm32";
NTIPAliasSkin["dragon"] = "cm33"; NTIPAliasSkin["monster"] = "cm33";

var NTIPAliasStat = {};
NTIPAliasStat["strength"] = 0;
NTIPAliasStat["energy"] = 1;
Expand Down
16 changes: 15 additions & 1 deletion d2bs/kolbot/libs/NTItemParser.dbl
Original file line number Diff line number Diff line change
Expand Up @@ -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 ']'
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down
Loading

0 comments on commit c61aeb8

Please sign in to comment.