Skip to content

Commit

Permalink
refactoring description of attributes for items
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav committed Mar 29, 2024
1 parent 8234234 commit 9f9ed16
Show file tree
Hide file tree
Showing 8 changed files with 605 additions and 402 deletions.
642 changes: 272 additions & 370 deletions src/d2/attribute_enhancer.ts

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions src/d2/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,15 @@ export interface IMagicProperty {
id: number;
name: string;
values: number[];
description: string;
visible: boolean;
op_value: number;
op_stats: string[];
param?:number,
value?: number,
df?: number,
type?: string,
so?:number,
description?: string;
visible?: boolean;
op_value?: number;
op_stats?: string[];
}

export enum EStashType {
Expand Down
156 changes: 156 additions & 0 deletions src/data/ItemStatGroups.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
[
{
"s": "group:all-attr",
"statsInGroup": [
0,
1,
2,
3
],
"allEqual": true,
"dP": "to all Attributes",
"dN": "to all Attributes",
"dF": 1,
"dV": 1,
"so": 67
},
{
"s": "group:all-res",
"statsInGroup": [
39,
41,
43,
45
],
"allEqual": true,
"dP": "All Resistances +%d",
"dN": "All Resistances +%d",
"dF": 19,
"so": 40
},
{
"s": "group:enhanced-dmg",
"statsInGroup": [
17,
18
],
"allEqual": true,
"dP": "Enhanced damage",
"dN": "Enhanced damage",
"dF": 4,
"dV": 1,
"so": 130
},
{
"s": "group:primary-dmg",
"statsInGroup": [
21,
22
],
"isRange": true,
"dP": "+%d damage",
"dN": "Adds %d-%d damage",
"dF": 100,
"so": 127
},
{
"s": "group:secondary-dmg",
"statsInGroup": [
23,
24
],
"isRange": true,
"dP": "+%d damage",
"dN": "Adds %d-%d damage",
"dF": 100,
"so": 124
},
{
"s": "group:fire-dmg",
"statsInGroup": [
48,
49
],
"isRange": true,
"dP": "+%d fire damage",
"dN": "Adds %d-%d fire damage",
"dF": 100,
"so": 102
},
{
"s": "group:light-dmg",
"statsInGroup": [
50,
51
],
"isRange": true,
"dP": "+%d lightning damage",
"dN": "Adds %d-%d lightning damage",
"dF": 100,
"so": 99
},
{
"s": "group:magic-dmg",
"statsInGroup": [
52,
53
],
"isRange": true,
"dP": "+%d magic damage",
"dN": "Adds %d-%d magic damage",
"dF": 100,
"so": 104
},
{
"s": "group:cold-dmg",
"statsInGroup": [
54,
55,
56
],
"isRange": true,
"dP": "+%d cold damage",
"dN": "Adds %d-%d cold damage",
"dF": 100,
"so": 96
},
{
"s": "group:poison-dmg",
"statsInGroup": [
57,
58,
59
],
"isRange": true,
"dP": "+%d poison damage over %d seconds",
"dN": "Adds %d-%d poison damage over %d seconds",
"dF": 101,
"so": 92
},
{
"s": "group:min-dmg",
"statsInGroup": [
21,
23
],
"allEqual": true,
"dP": "to Minimum Damage",
"dN": "to Minimum Damage",
"dF": 1,
"dV": 1,
"so": 127
},
{
"s": "group:max-dmg",
"statsInGroup": [
22,
24
],
"allEqual": true,
"dP": "to Maximum Damage",
"dN": "to Maximum Damage",
"dF": 1,
"dV": 1,
"so": 126
}
]
107 changes: 107 additions & 0 deletions src/data/SkillTabs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
[
{
"id": 0,
"name": "Bow and Crossbow Skills",
"charClass": 0
},
{
"id": 1,
"name": "Passive and Magic Skills",
"charClass": 0
},
{
"id": 2,
"name": "Javelin and Spear Skills",
"charClass": 0
},
{
"id": 8,
"name": "Fire Skills",
"charClass": 1
},
{
"id": 9,
"name": "Lightning Skills",
"charClass": 1
},
{
"id": 10,
"name": "Cold Skills",
"charClass": 1
},
{
"id": 16,
"name": "Curses Skills",
"charClass": 2
},
{
"id": 17,
"name": "Poison and Bone Skills",
"charClass": 2
},
{
"id": 18,
"name": "Necromancer Summoning Skills",
"charClass": 2
},
{
"id": 24,
"name": "Paladin Combat Skills",
"charClass": 3
},
{
"id": 25,
"name": "Offensive Auras Skills",
"charClass": 3
},
{
"id": 26,
"name": "Defensive Auras Skills",
"charClass": 3
},
{
"id": 32,
"name": "Barbarian Combat Skills",
"charClass": 4
},
{
"id": 33,
"name": "Masteries Skills",
"charClass": 4
},
{
"id": 34,
"name": "Warcries Skills",
"charClass": 4
},
{
"id": 40,
"name": "Druid Summoning Skills",
"charClass": 5
},
{
"id": 41,
"name": "Shape Shifting Skills",
"charClass": 5
},
{
"id": 42,
"name": "Elemental Skills",
"charClass": 5
},
{
"id": 48,
"name": "Traps Skills",
"charClass": 6
},
{
"id": 49,
"name": "Shadow Disciplines Skills",
"charClass": 6
},
{
"id": 50,
"name": "Martial Arts Skills",
"charClass": 6
}
]
64 changes: 48 additions & 16 deletions src/data/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,57 +264,89 @@ function _readProperties(tsv: any, strings: any): any {
cStats[j].cVal = tsv.header.indexOf(`val${j}`);
}
for (let i = 1; i < tsv.lines.length; i++) {
const code = tsv.lines[i][cCode];
if (code != "Expansion") {
const prop = [];
const propId = tsv.lines[i][cCode];
if (propId != "Expansion") {
const stats = [];
//prop.code = code;
for (let j = 1; j <= 7; j++) {
let stat;
let type;
const func = tsv.lines[i][cStats[j].cFunc];
stat = tsv.lines[i][cStats[j].cStat];
type = propertyTypeFromFunc(func);
const val = tsv.lines[i][cStats[j].cVal];
if (!stat && !func) {
break;
}

switch (func) {
case "5": {
stat = "mindamage";
type = "other";
break;
}
case "6": {
stat = "maxdamage";
type = "other";
break;
}
// case "": {
// stat = "item_mindamage_percent";
// type = "other";
// break;
// }
case "7": {
stat = "item_maxdamage_percent";
type = "all";
break;
}
case "20": {
stat = "item_indesctructible";
type = "other";
break;
}
case "23": {
stat = "ethereal"
break;
}
// case "23": {
// stat = "ethereal"
// break;
// }
default: {
stat = tsv.lines[i][cStats[j].cStat];
break;
}
}
const val = tsv.lines[i][cStats[j].cVal];
if (!stat && !func) {
break;
}

const s = {} as any;
if (stat) s.s = stat;
if (type) s.type = type;
if (func) s.f = +func;
if (val) s.val = +val;
prop[j - 1] = s;
}
if (prop.length) {
arr[code] = prop;
stats[j - 1] = s;
}

arr[propId] = stats;
}
}
return arr;
}

function propertyTypeFromFunc(func: string): string {
switch (func) {
case "11":
return "proc";
case "19":
return "charges";
case "3":
return "all";
case "15":
return "min";
case "16":
return "max";
case "17":
return "param";
default:
return "other";
}
}

function _readRunewords(tsv: any, strings: any, skills: any[]): any[] {
const arr = [] as any[];
const cName = tsv.header.indexOf("Name");
Expand Down
2 changes: 1 addition & 1 deletion src/data/versions/99_constant_data.ts

Large diffs are not rendered by default.

Loading

0 comments on commit 9f9ed16

Please sign in to comment.