-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
110 lines (99 loc) · 5.45 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
const { parseRiven } = require("./RivenParser.js");
function assert(bool) {
if (!bool) {
throw new Error("Assertion failed");
}
}
// Assert parsed data matches in-game values - Real Rivens
{
const { name, stats } = parseRiven(
"PlayerMeleeWeaponRandomModRare",
JSON.parse("{\"lvl\":8,\"buffs\":[{\"Tag\":\"WeaponMeleeDamageMod\",\"Value\":40881867},{\"Tag\":\"WeaponElectricityDamageMod\",\"Value\":176959},{\"Tag\":\"WeaponFireRateMod\",\"Value\":257573658}],\"curses\":[{\"Tag\":\"WeaponArmorPiercingDamageMod\",\"Value\":400514956}]}"),
1.10
);
assert(name == "Croni-visitio");
assert(stats[0].tag == "WeaponMeleeDamageMod");
assert(stats[0].displayValue == 154.2);
assert(stats[1].tag == "WeaponElectricityDamageMod");
assert(stats[1].displayValue == 83.5);
assert(stats[2].tag == "WeaponFireRateMod");
assert(stats[2].displayValue == 53.7);
assert(stats[3].tag == "WeaponArmorPiercingDamageMod");
assert(stats[3].displayValue == -96.2);
}
{
const { name, stats } = parseRiven(
"LotusPistolRandomModRare",
JSON.parse("{\"lvl\":8,\"buffs\":[{\"Tag\":\"WeaponReloadSpeedMod\",\"Value\":1031084030},{\"Tag\":\"WeaponProjectileSpeedMod\",\"Value\":979115818},{\"Tag\":\"WeaponFreezeDamageMod\",\"Value\":287446961}],\"curses\":[]}"),
1.00
);
assert(name == "Feva-concido");
assert(stats[0].tag == "WeaponReloadSpeedMod");
assert(stats[0].displayValue == 40.9);
assert(stats[1].tag == "WeaponProjectileSpeedMod");
assert(stats[1].displayValue == 73.1);
assert(stats[2].tag == "WeaponFreezeDamageMod");
assert(stats[2].displayValue == 64.4);
}
{
const { name, stats } = parseRiven(
"LotusRifleRandomModRare",
JSON.parse("{\"lvl\":8,\"buffs\":[{\"Tag\":\"WeaponElectricityDamageMod\",\"Value\":258268665},{\"Tag\":\"WeaponClipMaxMod\",\"Value\":57385833},{\"Tag\":\"WeaponStunChanceMod\",\"Value\":590970762}],\"curses\":[{\"Tag\":\"WeaponAmmoMaxMod\",\"Value\":462255655}]}"),
1.30
);
assert(name == "Hexa-vexitin");
assert(stats[0].tag == "WeaponElectricityDamageMod");
assert(stats[0].displayValue == 104);
assert(stats[1].tag == "WeaponClipMaxMod");
assert(stats[1].displayValue == 55.5);
assert(stats[2].tag == "WeaponStunChanceMod");
assert(stats[2].displayValue == 110.8);
assert(stats[3].tag == "WeaponAmmoMaxMod");
assert(stats[3].displayValue == -48);
}
// Assert parsed data matches in-game values - Contrived Rivens
{
const { name, stats } = parseRiven(
"LotusRifleRandomModRare",
JSON.parse("{\"compat\":\"/Lotus/Weapons/Tenno/Rifle/LotusRifle\",\"lim\":0,\"lvlReq\":0,\"lvl\":8,\"rerolls\":69420,\"pol\":\"AP_DEFENSE\",\"buffs\":[{\"Tag\":\"WeaponFireRateMod\",\"Value\":4294967295},{\"Tag\":\"WeaponFireRateMod\",\"Value\":1073741823}],\"curses\":[]}"),
0.65
);
assert(name == "dradra");
assert(stats[0].tag == "WeaponFireRateMod");
assert(stats[0].displayValue == 34.8);
assert(stats[1].tag == "WeaponFireRateMod");
assert(stats[1].displayValue == 42.5);
}
{
const { name } = parseRiven(
"LotusRifleRandomModRare",
JSON.parse("{\"compat\":\"/Lotus/Weapons/Tenno/Rifle/LotusRifle\",\"lim\":0,\"lvl\":8,\"lvlReq\":0,\"rerolls\":1337,\"pol\":\"AP_ANY\",\"buffs\":[{\"Tag\":\"WeaponCritChanceMod\",\"Value\":536870912},{\"Tag\":\"WeaponCritDamageMod\",\"Value\":536870912}],\"curses\":[]}"),
1
);
assert(name == "Acricron");
}
{
const { name } = parseRiven(
"PlayerMeleeWeaponRandomModRare",
JSON.parse("{\"compat\":\"/Lotus/Weapons/Tenno/Melee/PlayerMeleeWeapon\",\"lim\":0,\"lvl\":8,\"lvlReq\":0,\"rerolls\":1337,\"pol\":\"AP_ANY\",\"buffs\":[{\"Tag\":\"WeaponCritChanceMod\",\"Value\":1073741823},{\"Tag\":\"WeaponCritDamageMod\",\"Value\":536870912},{\"Tag\":\"WeaponCritDamageMod\",\"Value\":536870912},{\"Tag\":\"WeaponSlashDamageMod\",\"Value\":0}],\"curses\":[]}"),
1
);
assert(name == "Crita-acri-acrisus");
}
{
const { name } = parseRiven(
"PlayerMeleeWeaponRandomModRare",
JSON.parse("{\"compat\":\"/Lotus/Weapons/Tenno/Melee/PlayerMeleeWeapon\",\"lim\":0,\"lvl\":8,\"lvlReq\":0,\"rerolls\":1337,\"pol\":\"AP_ANY\",\"buffs\":[{\"Tag\":\"WeaponCritDamageMod\",\"Value\":1073741823},{\"Tag\":\"WeaponCritDamageMod\",\"Value\":1073741823},{\"Tag\":\"WeaponCritChanceMod\",\"Value\":1073741823},{\"Tag\":\"WeaponCritChanceMod\",\"Value\":536870912},{\"Tag\":\"WeaponSlashDamageMod\",\"Value\":536870912},{\"Tag\":\"WeaponSlashDamageMod\",\"Value\":536870912}],\"curses\":[]}"),
1
);
assert(name == "AcriAcri-crita-critasussus"); // WeaponCritDamageMod, WeaponCritChanceMod, WeaponSlashDamageMod
}
// This one makes no sense to me right now
/*{
const { name } = parseRiven(
"PlayerMeleeWeaponRandomModRare",
JSON.parse("{\"compat\":\"/Lotus/Weapons/Tenno/Melee/PlayerMeleeWeapon\",\"lim\":0,\"lvl\":8,\"lvlReq\":0,\"rerolls\":1337,\"pol\":\"AP_ANY\",\"buffs\":[{\"Tag\":\"WeaponMeleeDamageMod\",\"Value\":1073741823},{\"Tag\":\"WeaponCritChanceMod\",\"Value\":1073741823},{\"Tag\":\"WeaponCritDamageMod\",\"Value\":1073741823},{\"Tag\":\"WeaponStunChanceMod\",\"Value\":1073741823}],\"curses\":[]}"),
1
);
assert(name == "Acri-crita-visidex"); // WeaponCritDamageMod, WeaponCritChanceMod, WeaponMeleeDamageMod, WeaponStunChanceMod
}*/