2022-03-25 20:09:00 +00:00
|
|
|
import csv
|
|
|
|
import json
|
2022-03-25 23:49:37 +00:00
|
|
|
import os
|
2022-03-25 20:09:00 +00:00
|
|
|
|
2022-03-25 23:49:37 +00:00
|
|
|
from corrections import IGNORED, IGNORED_WEAPON_INFUSIONS, MISSING, HELMET_STATS
|
|
|
|
|
|
|
|
INFUSIONS = [
|
|
|
|
"Standard ",
|
|
|
|
"Heavy ",
|
|
|
|
"Keen ",
|
|
|
|
"Quality ",
|
|
|
|
"Fire ",
|
|
|
|
"Flame Art ",
|
|
|
|
"Lightning ",
|
|
|
|
"Sacred ",
|
|
|
|
"Magic ",
|
|
|
|
"Cold ",
|
|
|
|
"Poison ",
|
|
|
|
"Blood ",
|
|
|
|
"Occult ",
|
|
|
|
]
|
2022-03-25 20:09:00 +00:00
|
|
|
|
2022-04-05 19:55:34 +00:00
|
|
|
WEAPON_CATEGORIES = {
|
|
|
|
1: "dagger",
|
|
|
|
2: "straight-sword",
|
|
|
|
3: "greatsword",
|
|
|
|
4: "colossal-sword",
|
|
|
|
5: "thrusting-sword",
|
|
|
|
6: "heavy-thrusting-sword",
|
|
|
|
7: "curved-sword",
|
|
|
|
8: "curved-greatsword",
|
|
|
|
9: "katana",
|
|
|
|
10: "twinblade",
|
|
|
|
11: "hammer",
|
|
|
|
12: "great-hammer",
|
|
|
|
13: "flail",
|
|
|
|
14: "axe",
|
|
|
|
15: "greataxe",
|
|
|
|
16: "spear",
|
|
|
|
17: "great-spear",
|
|
|
|
18: "halberd",
|
|
|
|
19: "scythe",
|
|
|
|
20: "whip",
|
|
|
|
21: "fist",
|
|
|
|
22: "claw",
|
|
|
|
23: "colossal-weapon",
|
|
|
|
24: "torch",
|
|
|
|
30: "small-shield",
|
|
|
|
31: "medium-shield",
|
|
|
|
32: "greatshield",
|
|
|
|
33: "glintstone-staff",
|
|
|
|
34: "sacred-seal",
|
|
|
|
40: "light-bow",
|
|
|
|
41: "bow",
|
|
|
|
42: "greatbow",
|
|
|
|
43: "crossbow",
|
|
|
|
44: "ballista",
|
|
|
|
}
|
2022-03-25 20:09:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2022-04-05 19:55:34 +00:00
|
|
|
|
|
|
|
global helmets
|
|
|
|
helmets = {}
|
|
|
|
global chestpieces
|
|
|
|
chestpieces = {}
|
|
|
|
global gauntlets
|
|
|
|
gauntlets = {}
|
|
|
|
global leggings
|
|
|
|
leggings = {}
|
|
|
|
global talismans
|
|
|
|
talismans = {}
|
|
|
|
global classes
|
|
|
|
classes = {}
|
|
|
|
global weapons
|
|
|
|
weapons = {}
|
|
|
|
global infusions
|
|
|
|
infusions = {}
|
|
|
|
global calculations
|
|
|
|
calculations = {}
|
|
|
|
|
2022-03-25 20:09:00 +00:00
|
|
|
# armors
|
|
|
|
with open("input/EquipParamProtector.csv") as af:
|
2022-03-25 23:49:37 +00:00
|
|
|
rows = list(csv.DictReader(af, delimiter=";"))
|
2022-03-25 20:09:00 +00:00
|
|
|
|
2022-03-25 23:49:37 +00:00
|
|
|
for armor in rows:
|
2022-03-25 21:24:43 +00:00
|
|
|
if not ignored(armor):
|
|
|
|
process_armor_piece(armor)
|
2022-03-25 20:09:00 +00:00
|
|
|
|
|
|
|
# talismans
|
|
|
|
with (
|
|
|
|
open("input/EquipParamAccessory.csv") as tf,
|
|
|
|
open("input/SpEffectParam.csv") as ef,
|
|
|
|
):
|
2022-04-05 19:55:34 +00:00
|
|
|
|
2022-03-25 20:09:00 +00:00
|
|
|
effects = list(csv.DictReader(ef, delimiter=";"))
|
2022-03-25 23:49:37 +00:00
|
|
|
rows = list(csv.DictReader(tf, delimiter=";"))
|
2022-03-25 20:09:00 +00:00
|
|
|
|
2022-03-25 23:49:37 +00:00
|
|
|
for talisman in rows:
|
2022-03-25 21:24:43 +00:00
|
|
|
if not ignored(talisman):
|
|
|
|
process_talisman(talisman, effects)
|
2022-03-25 20:09:00 +00:00
|
|
|
|
2022-03-25 23:49:37 +00:00
|
|
|
# classes
|
2022-04-05 19:55:34 +00:00
|
|
|
classes = [
|
|
|
|
{
|
|
|
|
"id": "vagabond",
|
|
|
|
"name": "Vagabond",
|
|
|
|
"level": 9,
|
|
|
|
"stats": [15, 10, 11, 14, 13, 9, 9, 7],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "warrior",
|
|
|
|
"name": "Warrior",
|
|
|
|
"level": 8,
|
|
|
|
"stats": [11, 12, 11, 10, 16, 10, 8, 9],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "hero",
|
|
|
|
"name": "Hero",
|
|
|
|
"level": 7,
|
|
|
|
"stats": [14, 9, 12, 16, 9, 7, 8, 11],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "bandit",
|
|
|
|
"name": "Bandit",
|
|
|
|
"level": 5,
|
|
|
|
"stats": [10, 11, 10, 9, 13, 9, 8, 14],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "astrologer",
|
|
|
|
"name": "Astrologer",
|
|
|
|
"level": 6,
|
|
|
|
"stats": [9, 15, 9, 8, 12, 16, 7, 9],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "prophet",
|
|
|
|
"name": "Prophet",
|
|
|
|
"level": 7,
|
|
|
|
"stats": [10, 14, 8, 11, 10, 7, 16, 10],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "samurai",
|
|
|
|
"name": "Samurai",
|
|
|
|
"level": 9,
|
|
|
|
"stats": [12, 11, 13, 12, 15, 9, 8, 8],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "prisoner",
|
|
|
|
"name": "Prisoner",
|
|
|
|
"level": 9,
|
|
|
|
"stats": [11, 12, 11, 11, 14, 14, 6, 9],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "confessor",
|
|
|
|
"name": "Confessor",
|
|
|
|
"level": 10,
|
|
|
|
"stats": [10, 13, 10, 12, 12, 9, 14, 9],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "wretch",
|
|
|
|
"name": "Wretch",
|
|
|
|
"level": 1,
|
|
|
|
"stats": [10, 10, 10, 10, 10, 10, 10, 10],
|
|
|
|
},
|
|
|
|
]
|
2022-03-25 23:49:37 +00:00
|
|
|
|
|
|
|
# weapons
|
2022-03-28 11:54:02 +00:00
|
|
|
with (
|
|
|
|
open("input/AttackElementCorrectParam.csv") as af,
|
|
|
|
open("input/EquipParamWeapon.csv") as wf,
|
|
|
|
open("input/CalcCorrectGraph.csv") as cf,
|
2022-04-20 18:43:56 +00:00
|
|
|
open("input/SpEffectParam.csv") as sf,
|
2022-03-28 11:54:02 +00:00
|
|
|
):
|
2022-04-05 19:55:34 +00:00
|
|
|
|
2022-03-25 23:49:37 +00:00
|
|
|
rows = list(csv.DictReader(wf, delimiter=";"))
|
|
|
|
rows = [row for row in rows if 1000000 <= int(row["Row ID"]) <= 44010000]
|
|
|
|
|
2022-03-28 11:54:02 +00:00
|
|
|
masks = list(csv.DictReader(af, delimiter=";"))
|
|
|
|
masks = {row["Row ID"]: row for row in masks}
|
|
|
|
|
|
|
|
softcaps = list(csv.DictReader(cf, delimiter=";"))
|
2022-04-05 19:55:34 +00:00
|
|
|
softcaps = {
|
|
|
|
row["Row ID"]: row for row in softcaps if 0 <= int(row["Row ID"]) <= 16
|
|
|
|
}
|
2022-03-28 11:54:02 +00:00
|
|
|
|
2022-04-20 18:43:56 +00:00
|
|
|
effects = list(csv.DictReader(sf, delimiter=";"))
|
|
|
|
effects = {row["Row ID"]: row for row in effects}
|
|
|
|
|
2022-03-25 23:49:37 +00:00
|
|
|
for row in rows:
|
|
|
|
if not ignored(row):
|
2022-04-20 18:43:56 +00:00
|
|
|
process_weapon(row, masks, effects)
|
2022-03-25 23:49:37 +00:00
|
|
|
|
2022-04-05 19:55:34 +00:00
|
|
|
process_damage(softcaps)
|
|
|
|
|
2022-03-25 23:49:37 +00:00
|
|
|
# infusions
|
|
|
|
with open("input/ReinforceParamWeapon.csv") as inf:
|
|
|
|
rows = list(csv.DictReader(inf, delimiter=";"))
|
|
|
|
|
|
|
|
extract_infusions(rows)
|
|
|
|
|
2022-03-25 20:09:00 +00:00
|
|
|
# add missing items
|
2022-04-05 19:55:34 +00:00
|
|
|
helmets.update(MISSING["helmets"])
|
|
|
|
chestpieces.update(MISSING["chestpieces"])
|
|
|
|
gauntlets.update(MISSING["gauntlets"])
|
|
|
|
leggings.update(MISSING["leggings"])
|
2022-03-25 20:09:00 +00:00
|
|
|
|
|
|
|
# sort all files
|
2022-04-05 19:55:34 +00:00
|
|
|
helmets = dict(sorted(helmets.items(), key=lambda item: item[0]))
|
|
|
|
chestpieces = dict(sorted(chestpieces.items(), key=lambda item: item[0]))
|
|
|
|
gauntlets = dict(sorted(gauntlets.items(), key=lambda item: item[0]))
|
|
|
|
leggings = dict(sorted(leggings.items(), key=lambda item: item[0]))
|
|
|
|
classes = sorted(classes, key=lambda item: item["level"])
|
|
|
|
weapons = dict(sorted(weapons.items(), key=lambda item: item[0]))
|
2022-03-25 20:09:00 +00:00
|
|
|
|
|
|
|
# add none cases (no helmet etc.)
|
2022-04-05 19:55:34 +00:00
|
|
|
helmets = {
|
|
|
|
"no-helmet": {
|
|
|
|
"id": "no-helmet",
|
|
|
|
"name": "No helmet",
|
|
|
|
"defenses": [0, 0, 0, 0, 0, 0, 0, 0],
|
|
|
|
"resistances": [0, 0, 0, 0],
|
|
|
|
"poise": 0,
|
|
|
|
"weight": 0,
|
|
|
|
},
|
|
|
|
**helmets,
|
|
|
|
}
|
|
|
|
chestpieces = {
|
|
|
|
"no-chestpiece": {
|
2022-04-07 08:15:07 +00:00
|
|
|
"id": "no-chestpiece",
|
2022-04-05 19:55:34 +00:00
|
|
|
"name": "No chestpiece",
|
|
|
|
"defenses": [0, 0, 0, 0, 0, 0, 0, 0],
|
|
|
|
"resistances": [0, 0, 0, 0],
|
|
|
|
"poise": 0,
|
|
|
|
"weight": 0,
|
|
|
|
},
|
|
|
|
**chestpieces,
|
|
|
|
}
|
|
|
|
gauntlets = {
|
|
|
|
"no-gauntlets": {
|
|
|
|
"id": "no-gauntlets",
|
|
|
|
"name": "No gauntlets",
|
|
|
|
"defenses": [0, 0, 0, 0, 0, 0, 0, 0],
|
|
|
|
"resistances": [0, 0, 0, 0],
|
|
|
|
"poise": 0,
|
|
|
|
"weight": 0,
|
|
|
|
},
|
|
|
|
**gauntlets,
|
|
|
|
}
|
|
|
|
leggings = {
|
|
|
|
"no-leggings": {
|
|
|
|
"id": "no-leggings",
|
|
|
|
"name": "No leggings",
|
|
|
|
"defenses": [0, 0, 0, 0, 0, 0, 0, 0],
|
|
|
|
"resistances": [0, 0, 0, 0],
|
|
|
|
"poise": 0,
|
|
|
|
"weight": 0,
|
|
|
|
},
|
|
|
|
**leggings,
|
|
|
|
}
|
|
|
|
talismans = {
|
|
|
|
"no-talisman": {
|
2022-04-07 08:15:07 +00:00
|
|
|
"id": "no-talisman",
|
2022-04-05 19:55:34 +00:00
|
|
|
"name": "No talisman",
|
|
|
|
},
|
|
|
|
**talismans,
|
|
|
|
}
|
|
|
|
weapons = {
|
2022-04-05 19:56:03 +00:00
|
|
|
"unarmed": {
|
2022-04-05 19:55:34 +00:00
|
|
|
"id": "unarmed",
|
|
|
|
"name": "Unarmed",
|
|
|
|
"requirements": [0, 0, 0, 0, 0],
|
2022-04-07 08:15:07 +00:00
|
|
|
"category": "fist",
|
2022-04-05 19:55:34 +00:00
|
|
|
"unique": False,
|
|
|
|
"infusions": {
|
|
|
|
"standard": {
|
|
|
|
"damage": [20, 0, 0, 0, 0],
|
|
|
|
"scaling": [0.5, 0.5, 0.0, 0.0, 0.0],
|
|
|
|
"masks": [
|
|
|
|
[1, 1, 0, 0, 0],
|
|
|
|
[0, 0, 1, 0, 0],
|
|
|
|
[0, 0, 0, 1, 0],
|
|
|
|
[0, 1, 0, 0, 0],
|
|
|
|
[0, 0, 0, 1, 0],
|
|
|
|
],
|
|
|
|
"corrections": ["0", "0", "0", "0", "0"],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
**weapons,
|
|
|
|
}
|
2022-03-25 20:09:00 +00:00
|
|
|
|
|
|
|
# save to files
|
2022-03-25 21:24:43 +00:00
|
|
|
with (
|
|
|
|
open("output/helmets.json", "w") as hf,
|
|
|
|
open("output/chestpieces.json", "w") as cf,
|
|
|
|
open("output/gauntlets.json", "w") as gf,
|
|
|
|
open("output/leggings.json", "w") as lf,
|
|
|
|
open("output/talismans.json", "w") as tf,
|
2022-03-25 23:49:37 +00:00
|
|
|
open("output/classes.json", "w") as scf,
|
2022-03-25 21:24:43 +00:00
|
|
|
open("output/weapons.json", "w") as wf,
|
2022-03-25 23:49:37 +00:00
|
|
|
open("output/infusions.json", "w") as inf,
|
2022-04-05 19:55:34 +00:00
|
|
|
open("output/damage.json", "w") as df,
|
2022-03-25 21:24:43 +00:00
|
|
|
):
|
2022-03-25 20:09:00 +00:00
|
|
|
json.dump(helmets, hf)
|
|
|
|
json.dump(chestpieces, cf)
|
|
|
|
json.dump(gauntlets, gf)
|
|
|
|
json.dump(leggings, lf)
|
|
|
|
json.dump(talismans, tf)
|
2022-03-25 23:49:37 +00:00
|
|
|
json.dump(classes, scf)
|
2022-03-25 21:24:43 +00:00
|
|
|
json.dump(weapons, wf)
|
2022-03-25 23:49:37 +00:00
|
|
|
json.dump(infusions, inf)
|
2022-04-05 19:55:34 +00:00
|
|
|
json.dump(calculations, df)
|
2022-03-25 23:49:37 +00:00
|
|
|
|
|
|
|
# format output files with prettier
|
2022-03-28 11:54:02 +00:00
|
|
|
if os.system("prettier output --write --tab-width 4") != 0:
|
2022-03-25 23:49:37 +00:00
|
|
|
print(
|
|
|
|
"please install prettier (the code formatting tool) to auto-format the output files after generating"
|
|
|
|
)
|
2022-03-25 20:09:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
def ignored(row):
|
|
|
|
id = to_kebab(row["Row Name"])
|
|
|
|
return id.startswith("type-") or id in IGNORED
|
|
|
|
|
|
|
|
|
|
|
|
def to_kebab(name):
|
|
|
|
return (
|
|
|
|
name.lower()
|
|
|
|
.replace("(", "")
|
|
|
|
.replace(")", "")
|
|
|
|
.replace("'", "")
|
|
|
|
.strip()
|
|
|
|
.replace(" ", "-")
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2022-03-25 21:24:43 +00:00
|
|
|
def process_armor_piece(row):
|
2022-03-25 20:09:00 +00:00
|
|
|
item = {}
|
|
|
|
|
2022-04-05 19:55:34 +00:00
|
|
|
id = to_kebab(row["Row Name"])
|
|
|
|
item["id"] = id
|
2022-03-25 20:09:00 +00:00
|
|
|
item["name"] = row["Row Name"]
|
2022-03-25 21:24:43 +00:00
|
|
|
|
2022-04-05 19:55:34 +00:00
|
|
|
if id in HELMET_STATS:
|
|
|
|
item["stats"] = HELMET_STATS[id]
|
2022-03-25 20:09:00 +00:00
|
|
|
|
|
|
|
item["defenses"] = [
|
|
|
|
round((1.0 - float(row["Absorption - Physical"])) * 100.0, 2),
|
|
|
|
round((1.0 - float(row["Absorption - Strike"])) * 100.0, 2),
|
|
|
|
round((1.0 - float(row["Absorption - Slash"])) * 100.0, 2),
|
|
|
|
round((1.0 - float(row["Absorption - Thrust"])) * 100.0, 2),
|
|
|
|
round((1.0 - float(row["Absorption - Magic"])) * 100.0, 2),
|
|
|
|
round((1.0 - float(row["Absorption - Fire"])) * 100.0, 2),
|
|
|
|
round((1.0 - float(row["Absorption - Lightning"])) * 100.0, 2),
|
|
|
|
round((1.0 - float(row["Absorption - Holy"])) * 100.0, 2),
|
|
|
|
]
|
|
|
|
|
|
|
|
item["resistances"] = [
|
|
|
|
int(row["Resist - Scarlet Rot"]),
|
|
|
|
int(row["Resist - Hemorrhage"]),
|
|
|
|
int(row["Resist - Sleep"]),
|
|
|
|
int(row["Resist - Blight"]),
|
|
|
|
]
|
|
|
|
|
2022-03-25 21:24:43 +00:00
|
|
|
item["poise"] = int(round(float(row["Poise"]) * 1000.0, 2))
|
2022-03-25 20:09:00 +00:00
|
|
|
item["weight"] = round(float(row["Weight"]), 2)
|
|
|
|
|
2022-03-25 21:24:43 +00:00
|
|
|
if row["Is Head Equipment"] == "True":
|
2022-04-05 19:55:34 +00:00
|
|
|
helmets[id] = item
|
2022-03-25 21:24:43 +00:00
|
|
|
elif row["Is Body Equipment"] == "True":
|
2022-04-05 19:55:34 +00:00
|
|
|
chestpieces[id] = item
|
2022-03-25 21:24:43 +00:00
|
|
|
elif row["Is Arm Equipment"] == "True":
|
2022-04-05 19:55:34 +00:00
|
|
|
gauntlets[id] = item
|
2022-03-25 21:24:43 +00:00
|
|
|
elif row["Is Leg Equipment"] == "True":
|
2022-04-05 19:55:34 +00:00
|
|
|
leggings[id] = item
|
2022-03-25 20:09:00 +00:00
|
|
|
|
|
|
|
|
2022-03-25 21:24:43 +00:00
|
|
|
def process_talisman(row, effects):
|
2022-03-25 20:09:00 +00:00
|
|
|
item = {}
|
|
|
|
|
2022-04-05 19:55:34 +00:00
|
|
|
id = to_kebab(row["Row Name"])
|
|
|
|
item["id"] = id
|
2022-03-25 20:09:00 +00:00
|
|
|
item["name"] = row["Row Name"]
|
|
|
|
|
|
|
|
item["weight"] = row["Weight"]
|
|
|
|
|
2022-04-19 11:53:23 +00:00
|
|
|
effect_id = row["SpEffect ID [0]"]
|
2022-03-25 20:09:00 +00:00
|
|
|
for effect in effects:
|
|
|
|
if effect["Row ID"] == effect_id:
|
|
|
|
item["stats"] = [
|
|
|
|
int(effect["Vigor"]),
|
|
|
|
int(effect["Mind"]),
|
|
|
|
int(effect["Endurance"]),
|
|
|
|
int(effect["Strength"]),
|
|
|
|
int(effect["Dexterity"]),
|
|
|
|
int(effect["Intelligence"]),
|
|
|
|
int(effect["Faith"]),
|
|
|
|
int(effect["Arcane"]),
|
|
|
|
]
|
|
|
|
item["multipliers"] = [
|
|
|
|
float(effect["Max HP"]),
|
|
|
|
float(effect["Max FP"]),
|
|
|
|
float(effect["Max Stamina"]),
|
|
|
|
float(effect["Equip Load %"]),
|
|
|
|
]
|
2022-03-28 11:54:02 +00:00
|
|
|
|
|
|
|
if all(stat == 0.0 for stat in item["stats"]):
|
|
|
|
item.pop("stats")
|
|
|
|
if all(mult == 1.0 for mult in item["multipliers"]):
|
|
|
|
item.pop("multipliers")
|
2022-03-25 20:09:00 +00:00
|
|
|
|
2022-04-05 19:55:34 +00:00
|
|
|
talismans[id] = item
|
2022-03-25 20:09:00 +00:00
|
|
|
|
|
|
|
|
2022-03-25 23:49:37 +00:00
|
|
|
def split_weapon_name(name):
|
2022-03-28 11:54:02 +00:00
|
|
|
infusion = "standard"
|
2022-03-25 23:49:37 +00:00
|
|
|
for other in INFUSIONS:
|
2022-04-05 19:55:34 +00:00
|
|
|
if "Bloody" in name and not to_kebab(name) in IGNORED_WEAPON_INFUSIONS:
|
2022-03-28 11:54:02 +00:00
|
|
|
name = name.replace("Bloody ", "")
|
|
|
|
infusion = "blood"
|
2022-04-05 19:55:34 +00:00
|
|
|
elif "celebrants-cleaver-blades" in to_kebab(name):
|
|
|
|
name = "Celebrant's Cleaver"
|
|
|
|
elif other in name and not to_kebab(name) in IGNORED_WEAPON_INFUSIONS:
|
2022-03-25 23:49:37 +00:00
|
|
|
infusion = other
|
|
|
|
name = name.replace(infusion, "")
|
|
|
|
|
|
|
|
return name.strip().replace(" ", " "), to_kebab(infusion)
|
|
|
|
|
|
|
|
|
2022-03-28 11:54:02 +00:00
|
|
|
def to_mask(str):
|
|
|
|
if str == "True":
|
|
|
|
return 1
|
|
|
|
else:
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
2022-04-20 18:43:56 +00:00
|
|
|
def process_weapon(row, masks, effects):
|
2022-03-25 23:49:37 +00:00
|
|
|
name, infusion = split_weapon_name(row["Row Name"])
|
|
|
|
id = to_kebab(name)
|
|
|
|
|
2022-03-28 11:54:02 +00:00
|
|
|
damage = [
|
|
|
|
int(row["Damage: Physical"]),
|
|
|
|
int(row["Damage: Magic"]),
|
|
|
|
int(row["Damage: Fire"]),
|
|
|
|
int(row["Damage: Lightning"]),
|
|
|
|
int(row["Damage: Holy"]),
|
|
|
|
]
|
2022-03-25 23:49:37 +00:00
|
|
|
|
2022-03-28 11:54:02 +00:00
|
|
|
scaling = [
|
2022-04-19 11:53:23 +00:00
|
|
|
float(row["Correction: STR"]) / 100.0,
|
|
|
|
float(row["Correction: DEX"]) / 100.0,
|
|
|
|
float(row["Correction: INT"]) / 100.0,
|
|
|
|
float(row["Correction: FTH"]) / 100.0,
|
|
|
|
float(row["Correction: ARC"]) / 100.0,
|
2022-03-28 11:54:02 +00:00
|
|
|
]
|
2022-03-25 23:49:37 +00:00
|
|
|
|
2022-03-28 11:54:02 +00:00
|
|
|
mask_id = row["Attack Element Correct ID"]
|
|
|
|
mask_row = masks[mask_id]
|
|
|
|
|
|
|
|
weapon_masks = [
|
|
|
|
[ # physical
|
2022-04-19 11:53:23 +00:00
|
|
|
to_mask(mask_row["Physical Correction: STR"]),
|
|
|
|
to_mask(mask_row["Physical Correction: DEX"]),
|
|
|
|
to_mask(mask_row["Physical Correction: INT"]),
|
|
|
|
to_mask(mask_row["Physical Correction: FTH"]),
|
|
|
|
to_mask(mask_row["Physical Correction: ARC"]),
|
2022-03-28 11:54:02 +00:00
|
|
|
],
|
|
|
|
[ # magic
|
2022-04-19 11:53:23 +00:00
|
|
|
to_mask(mask_row["Magic Correction: STR"]),
|
|
|
|
to_mask(mask_row["Magic Correction: DEX"]),
|
|
|
|
to_mask(mask_row["Magic Correction: INT"]),
|
|
|
|
to_mask(mask_row["Magic Correction: FTH"]),
|
|
|
|
to_mask(mask_row["Magic Correction: ARC"]),
|
2022-03-28 11:54:02 +00:00
|
|
|
],
|
|
|
|
[ # fire
|
2022-04-19 11:53:23 +00:00
|
|
|
to_mask(mask_row["Fire Correction: STR"]),
|
|
|
|
to_mask(mask_row["Fire Correction: DEX"]),
|
|
|
|
to_mask(mask_row["Fire Correction: INT"]),
|
|
|
|
to_mask(mask_row["Fire Correction: FTH"]),
|
|
|
|
to_mask(mask_row["Fire Correction: ARC"]),
|
2022-03-28 11:54:02 +00:00
|
|
|
],
|
|
|
|
[ # lightning
|
2022-04-19 11:53:23 +00:00
|
|
|
to_mask(mask_row["Lightning Correction: STR"]),
|
|
|
|
to_mask(mask_row["Lightning Correction: DEX"]),
|
|
|
|
to_mask(mask_row["Lightning Correction: INT"]),
|
|
|
|
to_mask(mask_row["Lightning Correction: FTH"]),
|
|
|
|
to_mask(mask_row["Lightning Correction: ARC"]),
|
2022-03-28 11:54:02 +00:00
|
|
|
],
|
|
|
|
[ # holy
|
2022-04-19 11:53:23 +00:00
|
|
|
to_mask(mask_row["Holy Correction: STR"]),
|
|
|
|
to_mask(mask_row["Holy Correction: DEX"]),
|
|
|
|
to_mask(mask_row["Holy Correction: INT"]),
|
|
|
|
to_mask(mask_row["Holy Correction: FTH"]),
|
|
|
|
to_mask(mask_row["Holy Correction: ARC"]),
|
2022-03-28 11:54:02 +00:00
|
|
|
],
|
|
|
|
]
|
2022-03-25 23:49:37 +00:00
|
|
|
|
2022-03-28 11:54:02 +00:00
|
|
|
corrections = [
|
|
|
|
row["Correction Type: Physical"],
|
|
|
|
row["Correction Type: Magic"],
|
|
|
|
row["Correction Type: Fire"],
|
|
|
|
row["Correction Type: Lightning"],
|
|
|
|
row["Correction Type: Holy"],
|
|
|
|
]
|
2022-03-25 23:49:37 +00:00
|
|
|
|
2022-04-19 11:53:23 +00:00
|
|
|
buffable = "True" in row["Is Buffable"]
|
|
|
|
|
2022-04-20 18:43:56 +00:00
|
|
|
# Auxiliary Effects (blood, poison)
|
|
|
|
aux = {}
|
|
|
|
for aux_id in [row["Behavior SpEffect 1"], row["Behavior SpEffect 2"]]:
|
|
|
|
if int(aux_id) != -1 and int(aux_id) > 100000:
|
|
|
|
aux_name = effects[aux_id]["Row Name"]
|
|
|
|
xs = [x for x in range(0, 26)]
|
|
|
|
ys = [effects[str(int(aux_id) + x)] for x in xs]
|
|
|
|
|
|
|
|
if "Hemorrhage" in aux_name:
|
|
|
|
ty = "bleed"
|
|
|
|
ys = [int(y["Inflict Hemorrhage +"]) for y in ys]
|
|
|
|
elif "Frostbite" in aux_name:
|
|
|
|
ty = "frost"
|
|
|
|
ys = [int(y["Inflict Frostbite +"]) for y in ys]
|
|
|
|
elif "Poison" in aux_name:
|
|
|
|
ty = "poison"
|
|
|
|
ys = [int(y["Inflict Poison +"]) for y in ys]
|
|
|
|
elif "Scarlet Rot" in aux_name:
|
|
|
|
ty = "scarlet_rot"
|
|
|
|
ys = [int(y["Inflict Scarlet Rot +"]) for y in ys]
|
|
|
|
elif "Madness" in aux_name:
|
|
|
|
ty = "madness"
|
|
|
|
ys = [int(y["Inflict Madness +"]) for y in ys]
|
|
|
|
elif "Sleep" in aux_name:
|
|
|
|
ty = "sleep"
|
|
|
|
ys = [int(y["Inflict Sleep +"]) for y in ys]
|
|
|
|
elif "Blight" in aux_name:
|
|
|
|
ty = "blight"
|
|
|
|
ys = [int(y["Inflict Blight +"]) for y in ys]
|
|
|
|
aux[ty] = regression(xs, ys)
|
|
|
|
elif int(aux_id) != -1 and int(aux_id) <= 100000:
|
|
|
|
aux_name = effects[aux_id]["Row Name"]
|
|
|
|
if "Hemorrhage" in aux_name:
|
|
|
|
ty = "bleed"
|
|
|
|
base = effects[aux_id]["Inflict Hemorrhage +"]
|
|
|
|
elif "Frostbite" in aux_name:
|
|
|
|
ty = "frost"
|
|
|
|
base = effects[aux_id]["Inflict Frostbite +"]
|
|
|
|
elif "Poison" in aux_name:
|
|
|
|
ty = "poison"
|
|
|
|
base = effects[aux_id]["Inflict Poison +"]
|
|
|
|
elif "Scarlet Rot" in aux_name:
|
|
|
|
ty = "scarlet_rot"
|
|
|
|
base = effects[aux_id]["Inflict Scarlet Rot +"]
|
|
|
|
elif "Madness" in aux_name:
|
|
|
|
ty = "madness"
|
|
|
|
base = effects[aux_id]["Inflict Madness +"]
|
|
|
|
elif "Sleep" in aux_name:
|
|
|
|
ty = "sleep"
|
|
|
|
base = effects[aux_id]["Inflict Sleep +"]
|
|
|
|
elif "Blight" in aux_name:
|
|
|
|
ty = "blight"
|
|
|
|
base = effects[aux_id]["Inflict Blight +"]
|
|
|
|
aux[ty] = [0.0, aux_name]
|
|
|
|
|
2022-04-05 19:55:34 +00:00
|
|
|
if id in weapons:
|
2022-04-07 08:15:07 +00:00
|
|
|
if not id in IGNORED_WEAPON_INFUSIONS:
|
|
|
|
weapon = weapons[id]
|
|
|
|
weapon["infusions"][infusion] = {
|
|
|
|
"damage": damage,
|
|
|
|
"scaling": scaling,
|
2022-04-20 18:43:56 +00:00
|
|
|
"aux": aux,
|
2022-04-07 08:15:07 +00:00
|
|
|
"masks": weapon_masks,
|
|
|
|
"corrections": corrections,
|
2022-04-19 11:53:23 +00:00
|
|
|
"buffable": buffable,
|
2022-04-07 08:15:07 +00:00
|
|
|
}
|
2022-04-05 19:55:34 +00:00
|
|
|
return
|
2022-03-25 23:49:37 +00:00
|
|
|
else:
|
2022-04-05 19:55:34 +00:00
|
|
|
weapon = {}
|
|
|
|
|
2022-03-28 11:54:02 +00:00
|
|
|
weapon["id"] = id
|
|
|
|
weapon["name"] = name
|
|
|
|
|
|
|
|
weapon["requirements"] = [
|
|
|
|
int(row["Requirement: STR"]),
|
|
|
|
int(row["Requirement: DEX"]),
|
|
|
|
int(row["Requirement: INT"]),
|
|
|
|
int(row["Requirement: FTH"]),
|
|
|
|
int(row["Requirement: ARC"]),
|
|
|
|
]
|
|
|
|
|
2022-04-05 19:55:34 +00:00
|
|
|
weapon["category"] = WEAPON_CATEGORIES[int(row["Row ID"]) // 1000000]
|
|
|
|
|
|
|
|
if int(row["Reinforcement Material Set ID"]) == 2200:
|
|
|
|
weapon["unique"] = True
|
|
|
|
else:
|
|
|
|
weapon["unique"] = False
|
2022-03-28 11:54:02 +00:00
|
|
|
|
|
|
|
weapon["infusions"] = {}
|
|
|
|
weapon["infusions"][infusion] = {
|
|
|
|
"damage": damage,
|
|
|
|
"scaling": scaling,
|
2022-04-20 18:43:56 +00:00
|
|
|
"aux": aux,
|
2022-03-28 11:54:02 +00:00
|
|
|
"masks": weapon_masks,
|
2022-04-05 19:55:34 +00:00
|
|
|
"corrections": corrections,
|
2022-04-19 11:53:23 +00:00
|
|
|
"buffable": buffable,
|
2022-03-28 11:54:02 +00:00
|
|
|
}
|
2022-03-25 23:49:37 +00:00
|
|
|
|
2022-04-05 19:55:34 +00:00
|
|
|
weapons[id] = weapon
|
2022-03-25 23:49:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
def regression(xs, ys):
|
2022-03-28 11:54:02 +00:00
|
|
|
# least-squares sum regression
|
2022-03-25 23:49:37 +00:00
|
|
|
n = len(xs)
|
2022-03-28 11:54:02 +00:00
|
|
|
xy = sum([x * y for x, y in zip(xs, ys)]) # sum of all x * y
|
|
|
|
xsq = sum([x * x for x in xs]) # sum of all squared xs
|
2022-03-25 23:49:37 +00:00
|
|
|
|
|
|
|
a = (n * xy - sum(xs) * sum(ys)) / (n * xsq - sum(xs) ** 2)
|
|
|
|
b = ys[0]
|
|
|
|
|
|
|
|
return round(a, 5), b
|
|
|
|
|
|
|
|
|
|
|
|
def extract_infusions(rows):
|
|
|
|
for i, ty in enumerate(INFUSIONS):
|
|
|
|
infusion = {}
|
2022-04-05 19:55:34 +00:00
|
|
|
id = to_kebab(ty)
|
|
|
|
|
|
|
|
infusion["id"] = id
|
2022-03-25 23:49:37 +00:00
|
|
|
infusion["name"] = ty.strip()
|
|
|
|
|
|
|
|
relevant = [row for row in rows[0 + i + i * 25 : 26 + i + i * 25]]
|
|
|
|
|
|
|
|
xs = [x for x in range(0, 26)]
|
|
|
|
|
2022-03-28 11:54:02 +00:00
|
|
|
# damage & upgrade
|
2022-03-25 23:49:37 +00:00
|
|
|
physical = [float(relevant[i]["Damage %: Physical"]) for i in range(0, 26)]
|
|
|
|
magic = [float(relevant[i]["Damage %: Magic"]) for i in range(0, 26)]
|
2022-03-28 11:54:02 +00:00
|
|
|
fire = [float(relevant[i]["Damage %: Fire"]) for i in range(0, 26)]
|
2022-03-25 23:49:37 +00:00
|
|
|
lightning = [float(relevant[i]["Damage %: Lightning"]) for i in range(0, 26)]
|
|
|
|
holy = [float(relevant[i]["Damage %: Holy"]) for i in range(0, 26)]
|
|
|
|
|
2022-03-28 11:54:02 +00:00
|
|
|
physical_upg, physical_dmg = regression(xs, physical)
|
|
|
|
magic_upg, magic_dmg = regression(xs, magic)
|
|
|
|
fire_upg, fire_dmg = regression(xs, fire)
|
|
|
|
lightning_upg, lightning_dmg = regression(xs, lightning)
|
|
|
|
holy_upg, holy_dmg = regression(xs, holy)
|
|
|
|
|
|
|
|
infusion["damage"] = [
|
|
|
|
physical_dmg,
|
|
|
|
magic_dmg,
|
|
|
|
fire_dmg,
|
|
|
|
lightning_dmg,
|
|
|
|
holy_dmg,
|
|
|
|
]
|
|
|
|
infusion["upgrade"] = [
|
|
|
|
physical_upg,
|
|
|
|
magic_upg,
|
|
|
|
fire_upg,
|
|
|
|
lightning_upg,
|
|
|
|
holy_upg,
|
|
|
|
]
|
2022-03-25 23:49:37 +00:00
|
|
|
|
|
|
|
# scaling
|
2022-04-19 11:53:23 +00:00
|
|
|
strength = [float(relevant[i]["Correction %: STR"]) for i in range(0, 26)]
|
|
|
|
dexterity = [float(relevant[i]["Correction %: DEX"]) for i in range(0, 26)]
|
|
|
|
intelligence = [float(relevant[i]["Correction %: INT"]) for i in range(0, 26)]
|
|
|
|
faith = [float(relevant[i]["Correction %: FTH"]) for i in range(0, 26)]
|
|
|
|
arcane = [float(relevant[i]["Correction %: ARC"]) for i in range(0, 26)]
|
2022-03-25 23:49:37 +00:00
|
|
|
|
2022-03-28 11:54:02 +00:00
|
|
|
str_growth, str_scaling = regression(xs, strength)
|
|
|
|
dex_growth, dex_scaling = regression(xs, dexterity)
|
|
|
|
int_growth, int_scaling = regression(xs, intelligence)
|
|
|
|
fth_growth, fth_scaling = regression(xs, faith)
|
|
|
|
arc_growth, arc_scaling = regression(xs, arcane)
|
|
|
|
|
|
|
|
infusion["scaling"] = [
|
|
|
|
str_scaling,
|
|
|
|
dex_scaling,
|
|
|
|
int_scaling,
|
|
|
|
fth_scaling,
|
|
|
|
arc_scaling,
|
|
|
|
]
|
|
|
|
infusion["growth"] = [
|
|
|
|
str_growth,
|
|
|
|
dex_growth,
|
|
|
|
int_growth,
|
|
|
|
fth_growth,
|
|
|
|
arc_growth,
|
|
|
|
]
|
2022-03-25 23:49:37 +00:00
|
|
|
|
2022-04-05 19:55:34 +00:00
|
|
|
infusions[id] = infusion
|
|
|
|
|
|
|
|
|
|
|
|
def process_damage(caps):
|
|
|
|
for row in caps.values():
|
|
|
|
calculation = {}
|
|
|
|
|
|
|
|
id = row["Row ID"]
|
|
|
|
calculation["id"] = id
|
|
|
|
|
|
|
|
calculation["softcaps"] = [
|
|
|
|
[ # physical
|
|
|
|
int(row["Stat Max 0"]),
|
|
|
|
int(row["Stat Max 1"]),
|
|
|
|
int(row["Stat Max 2"]),
|
|
|
|
int(row["Stat Max 3"]),
|
|
|
|
int(row["Stat Max 4"]),
|
|
|
|
],
|
|
|
|
[ # magic
|
|
|
|
int(row["Stat Max 0"]),
|
|
|
|
int(row["Stat Max 1"]),
|
|
|
|
int(row["Stat Max 2"]),
|
|
|
|
int(row["Stat Max 3"]),
|
|
|
|
int(row["Stat Max 4"]),
|
|
|
|
],
|
|
|
|
[ # fire
|
|
|
|
int(row["Stat Max 0"]),
|
|
|
|
int(row["Stat Max 1"]),
|
|
|
|
int(row["Stat Max 2"]),
|
|
|
|
int(row["Stat Max 3"]),
|
|
|
|
int(row["Stat Max 4"]),
|
|
|
|
],
|
|
|
|
[ # lightning
|
|
|
|
int(row["Stat Max 0"]),
|
|
|
|
int(row["Stat Max 1"]),
|
|
|
|
int(row["Stat Max 2"]),
|
|
|
|
int(row["Stat Max 3"]),
|
|
|
|
int(row["Stat Max 4"]),
|
|
|
|
],
|
|
|
|
[ # holy
|
|
|
|
int(row["Stat Max 0"]),
|
|
|
|
int(row["Stat Max 1"]),
|
|
|
|
int(row["Stat Max 2"]),
|
|
|
|
int(row["Stat Max 3"]),
|
|
|
|
int(row["Stat Max 4"]),
|
|
|
|
],
|
|
|
|
]
|
|
|
|
|
|
|
|
calculation["growth"] = [
|
|
|
|
[
|
|
|
|
int(row["Grow 0"]),
|
|
|
|
int(row["Grow 1"]),
|
|
|
|
int(row["Grow 2"]),
|
|
|
|
int(row["Grow 3"]),
|
|
|
|
int(row["Grow 4"]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
int(row["Grow 0"]),
|
|
|
|
int(row["Grow 1"]),
|
|
|
|
int(row["Grow 2"]),
|
|
|
|
int(row["Grow 3"]),
|
|
|
|
int(row["Grow 4"]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
int(row["Grow 0"]),
|
|
|
|
int(row["Grow 1"]),
|
|
|
|
int(row["Grow 2"]),
|
|
|
|
int(row["Grow 3"]),
|
|
|
|
int(row["Grow 4"]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
int(row["Grow 0"]),
|
|
|
|
int(row["Grow 1"]),
|
|
|
|
int(row["Grow 2"]),
|
|
|
|
int(row["Grow 3"]),
|
|
|
|
int(row["Grow 4"]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
int(row["Grow 0"]),
|
|
|
|
int(row["Grow 1"]),
|
|
|
|
int(row["Grow 2"]),
|
|
|
|
int(row["Grow 3"]),
|
|
|
|
int(row["Grow 4"]),
|
|
|
|
],
|
|
|
|
]
|
|
|
|
|
|
|
|
calculation["adjustments"] = [
|
|
|
|
[
|
|
|
|
float(row["Adjustment Point - Grow 0"]),
|
|
|
|
float(row["Adjustment Point - Grow 1"]),
|
|
|
|
float(row["Adjustment Point - Grow 2"]),
|
|
|
|
float(row["Adjustment Point - Grow 3"]),
|
|
|
|
float(row["Adjustment Point - Grow 4"]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
float(row["Adjustment Point - Grow 0"]),
|
|
|
|
float(row["Adjustment Point - Grow 1"]),
|
|
|
|
float(row["Adjustment Point - Grow 2"]),
|
|
|
|
float(row["Adjustment Point - Grow 3"]),
|
|
|
|
float(row["Adjustment Point - Grow 4"]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
float(row["Adjustment Point - Grow 0"]),
|
|
|
|
float(row["Adjustment Point - Grow 1"]),
|
|
|
|
float(row["Adjustment Point - Grow 2"]),
|
|
|
|
float(row["Adjustment Point - Grow 3"]),
|
|
|
|
float(row["Adjustment Point - Grow 4"]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
float(row["Adjustment Point - Grow 0"]),
|
|
|
|
float(row["Adjustment Point - Grow 1"]),
|
|
|
|
float(row["Adjustment Point - Grow 2"]),
|
|
|
|
float(row["Adjustment Point - Grow 3"]),
|
|
|
|
float(row["Adjustment Point - Grow 4"]),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
float(row["Adjustment Point - Grow 0"]),
|
|
|
|
float(row["Adjustment Point - Grow 1"]),
|
|
|
|
float(row["Adjustment Point - Grow 2"]),
|
|
|
|
float(row["Adjustment Point - Grow 3"]),
|
|
|
|
float(row["Adjustment Point - Grow 4"]),
|
|
|
|
],
|
|
|
|
]
|
2022-03-25 23:49:37 +00:00
|
|
|
|
2022-04-05 19:55:34 +00:00
|
|
|
calculations[id] = calculation
|
2022-03-25 23:49:37 +00:00
|
|
|
|
|
|
|
|
2022-03-25 20:09:00 +00:00
|
|
|
main()
|