weapons, classes, infusions done

This commit is contained in:
Frederik Palmø 2022-03-26 00:49:37 +01:00
parent 3aebfb43a1
commit 0c57b8ccef
3 changed files with 200 additions and 8 deletions

View file

@ -7,14 +7,23 @@
1. [UXM](https://cdn.discordapp.com/attachments/529900741998149643/949045219175825448/UXM_2.4.ER_EldenRingQuickhack.zip) to extract the game files.
2. [Yapped (Rune Bear)](https://github.com/vawser/Yapped-Rune-Bear) for converting regulation to `.csv`.
## Required Files
- `CharaInitParam.csv`
- `EquipParamAccessory.csv`
- `EquipParamProtector.csv`
- `EquipParamWeapon.csv`
- `ReinforceWeaponParam.csv`
- `SpEffectParam.csv`
## Param Categories
### Armor
- Weight: `EquipParamProtector.csv`
- Poise: `EquipParamProtector.csv` - in-game poise value is (poise \* 1000)
- Poise: `EquipParamProtector.csv` - in-game poise value is $(poise \cdot 1000)$
- Resistance: `EquipParamProtector.csv`
- Defenses: `EquipParamProtector.csv` - defense is (1 - absorption) \* 100
- Defenses: `EquipParamProtector.csv` - defense is $(1 - absorption) \cdot 100$
- Stats: ???
### Classes
@ -25,8 +34,8 @@
### Weapons
- Damage: `EquipParamWeapon.csv`
- Scaling: `EquipParamWeapon.csv`
- Upgrading: `ReinforceParamWeapon.csv`
- Scaling: `EquipParamWeapon.csv`
- Ash of War: `EquipParamGem.csv`
### Talismans

View file

@ -1,22 +1,42 @@
import csv
import json
from statistics import mean
import os
from corrections import IGNORED, MISSING, HELMET_STATS
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 ",
]
helmets = []
chestpieces = []
gauntlets = []
leggings = []
talismans = []
classes = []
weapons = []
infusions = []
def main():
# armors
with open("input/EquipParamProtector.csv") as af:
reader = list(csv.DictReader(af, delimiter=";"))
rows = list(csv.DictReader(af, delimiter=";"))
for armor in reader:
for armor in rows:
if not ignored(armor):
process_armor_piece(armor)
@ -26,12 +46,49 @@ def main():
open("input/SpEffectParam.csv") as ef,
):
effects = list(csv.DictReader(ef, delimiter=";"))
reader = list(csv.DictReader(tf, delimiter=";"))
rows = list(csv.DictReader(tf, delimiter=";"))
for talisman in reader:
for talisman in rows:
if not ignored(talisman):
process_talisman(talisman, effects)
# classes
with open("input/CharaInitParam.csv", "r") as cf:
rows = list(csv.DictReader(cf, delimiter=";"))
rows = [row for row in rows if 3000 <= int(row["Row ID"]) <= 3009]
for row in rows:
c = {}
c["id"] = to_kebab(row["Row Name"][8:])
c["name"] = row["Row Name"][8:]
c["level"] = int(row["Level"])
c["stats"] = [
int(row["Vigor"]),
int(row["Attunement"]),
int(row["Endurance"]),
int(row["Strength"]),
int(row["Dexterity"]),
int(row["Intelligence"]),
int(row["Faith"]),
int(row["Arcane"]),
]
classes.append(c)
# weapons
with open("input/EquipParamWeapon.csv") as wf:
rows = list(csv.DictReader(wf, delimiter=";"))
rows = [row for row in rows if 1000000 <= int(row["Row ID"]) <= 44010000]
for row in rows:
if not ignored(row):
process_weapon(row)
# infusions
with open("input/ReinforceParamWeapon.csv") as inf:
rows = list(csv.DictReader(inf, delimiter=";"))
extract_infusions(rows)
# add missing items
for h in MISSING["helmets"]:
helmets.append(h)
@ -42,11 +99,20 @@ def main():
for l in MISSING["leggings"]:
leggings.append(l)
# mark weapons with no infusions as "unique"
for weapon in weapons:
if weapon["infusions"] == []:
weapon["infusions"] = ["unique"]
# sort all files
helmets.sort(key=lambda item: item["id"])
chestpieces.sort(key=lambda item: item["id"])
gauntlets.sort(key=lambda item: item["id"])
leggings.sort(key=lambda item: item["id"])
talismans.sort(key=lambda item: item["id"])
classes.sort(key=lambda item: item["id"], reverse=True)
weapons.sort(key=lambda item: item["id"])
# infusions.sort(key=lambda item: item["id"])
# add none cases (no helmet etc.)
helmets.insert(0, {"id": "no-helmet", "name": "None"})
@ -61,14 +127,24 @@ def main():
open("output/gauntlets.json", "w") as gf,
open("output/leggings.json", "w") as lf,
open("output/talismans.json", "w") as tf,
open("output/classes.json", "w") as scf,
open("output/weapons.json", "w") as wf,
open("output/infusions.json", "w") as inf,
):
json.dump(helmets, hf)
json.dump(chestpieces, cf)
json.dump(gauntlets, gf)
json.dump(leggings, lf)
json.dump(talismans, tf)
json.dump(classes, scf)
json.dump(weapons, wf)
json.dump(infusions, inf)
# format output files with prettier
if os.system("prettier output --write") != 0:
print(
"please install prettier (the code formatting tool) to auto-format the output files after generating"
)
def ignored(row):
@ -162,4 +238,109 @@ def process_talisman(row, effects):
talismans.append(item)
def split_weapon_name(name):
infusion = "none"
for other in INFUSIONS:
if other in name and not to_kebab(name) in IGNORED_WEAPON_INFUSIONS:
infusion = other
name = name.replace(infusion, "")
return name.strip().replace(" ", " "), to_kebab(infusion)
def process_weapon(row):
name, infusion = split_weapon_name(row["Row Name"])
id = to_kebab(name)
for other in weapons:
if other["id"] == id:
weapon = other
weapon["infusions"].append(infusion)
return
weapon = {}
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"]),
]
if row["Enables Sorcery"] == "True":
weapon["sorcery-catalyst"] = True
if row["Enables Incantations"] == "True":
weapon["incantation-catalyst"] = True
if infusion == "none":
weapon["infusions"] = []
else:
weapon["infusions"] = [infusion]
weapons.append(weapon)
def regression(xs, ys):
n = len(xs)
xy = sum([x * y for x, y in zip(xs, ys)])
xsq = sum([x * x for x in xs])
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 = {}
infusion["id"] = to_kebab(ty)
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)]
# damage
physical = [float(relevant[i]["Damage %: Physical"]) for i in range(0, 26)]
fire = [float(relevant[i]["Damage %: Fire"]) for i in range(0, 26)]
magic = [float(relevant[i]["Damage %: Magic"]) for i in range(0, 26)]
lightning = [float(relevant[i]["Damage %: Lightning"]) for i in range(0, 26)]
holy = [float(relevant[i]["Damage %: Holy"]) for i in range(0, 26)]
infusion["damage"] = {
"physical": regression(xs, physical),
"fire": regression(xs, fire),
"magic": regression(xs, magic),
"lightning": regression(xs, lightning),
"holy": regression(xs, holy),
}
# scaling
strength = [float(relevant[i]["Scaling %: STR"]) for i in range(0, 26)]
dexterity = [float(relevant[i]["Scaling %: DEX"]) for i in range(0, 26)]
intelligence = [float(relevant[i]["Scaling %: INT"]) for i in range(0, 26)]
faith = [float(relevant[i]["Scaling %: FTH"]) for i in range(0, 26)]
arcane = [float(relevant[i]["Scaling %: ARC"]) for i in range(0, 26)]
infusion["scaling"] = {
"strength": regression(xs, strength),
"dexterity": regression(xs, dexterity),
"intelligence": regression(xs, intelligence),
"faith": regression(xs, faith),
"arcane": regression(xs, arcane),
}
infusions.append(infusion)
# catalyst
infusion = {}
main()

View file

@ -151,3 +151,5 @@ HELMET_STATS = {
"twinsage-glintstone-crown": [0, 0, 0, 0, 0, 6, 0, 0],
"witchs-glintstone-crown": [0, 0, 0, 0, 0, 3, 0, 3],
}
IGNORED_WEAPON_INFUSIONS = ["heavy-crossbow"]