Adding 1.20 item translation

This commit is contained in:
b 2021-01-23 04:53:24 -06:00
parent fe124b4b0f
commit 8bad627a3d
7 changed files with 260930 additions and 70 deletions

View file

@ -94,6 +94,7 @@ for (const it of itemTypes) {
let itemMap = new Map();
/* Mapping from item names to set names. */
let idMap = new Map();
let redirectMap = new Map();
/*
* Function that takes an item list and populates its corresponding dropdown.
@ -150,13 +151,18 @@ function init() {
items = items.concat(noneItems);
console.log(items);
for (const item of items) {
itemLists.get(item.type).push(item.displayName);
itemMap.set(item.displayName, item);
if (noneItems.includes(item)) {
idMap.set(item.id, "");
if (item.remapID === undefined) {
itemLists.get(item.type).push(item.displayName);
itemMap.set(item.displayName, item);
if (noneItems.includes(item)) {
idMap.set(item.id, "");
}
else {
idMap.set(item.id, item.displayName);
}
}
else {
idMap.set(item.id, item.displayName);
redirectMap.set(item.id, item.remapID);
}
}
@ -211,6 +217,13 @@ function init() {
decodeBuild(url_tag);
}
function getItemNameFromID(id) {
if (redirectMap.has(id)) {
return getItemNameFromID(redirectMap.get(id));
}
return idMap.get(id);
}
/*
* Populate fields based on url, and calculate build.
*/
@ -226,7 +239,7 @@ function decodeBuild(url_tag) {
if (version === "0" || version === "1" || version === "2" || version === "3") {
let equipments = info[1];
for (let i = 0; i < 9; ++i ) {
equipment[i] = idMap.get(Base64.toInt(equipments.slice(i*3,i*3+3)));
equipment[i] = getItemNameFromID(Base64.toInt(equipments.slice(i*3,i*3+3)));
}
}
if (version === "1") {

View file

@ -1,7 +1,7 @@
{
"items": [
{
"name": "Demon Tide (1.20)",
"name": "Demon Tide",
"tier": "Legendary",
"type": "leggings",
"set": null,
@ -35506,6 +35506,7 @@
},
{
"name": "Cancer\u058e",
"displayName": "Cancer",
"tier": "Legendary",
"type": "helmet",
"set": null,
@ -265939,8 +265940,8 @@
{
"tier": "Rare",
"type": "boots",
"name": "Ensa\u2019s Ideals (1.20)",
"displayName": "Ensa\u2019s Ideals (1.20)",
"name": "Ensa's Ideals (1.20)",
"displayName": "Ensa's Ideals (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -266378,8 +266379,8 @@
{
"tier": "Rare",
"type": "ring",
"name": "Tisaun\u2019s Honor (1.20)",
"displayName": "Tisaun\u2019s Honor (1.20)",
"name": "Tisaun's Honor (1.20)",
"displayName": "Tisaun's Honor (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -266718,8 +266719,8 @@
{
"tier": "Unique",
"type": "chestplate",
"name": "Nether\u2019s Reach (1.20)",
"displayName": "Nether\u2019s Reach (1.20)",
"name": "Nether's Reach (1.20)",
"displayName": "Nether's Reach (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -266792,8 +266793,8 @@
{
"tier": "Legendary",
"type": "dagger",
"name": "Bob\u2019s Mythic Daggers (1.20)",
"displayName": "Bob\u2019s Mythic Daggers (1.20)",
"name": "Bob's Mythic Daggers (1.20)",
"displayName": "Bob's Mythic Daggers (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -267206,8 +267207,8 @@
{
"tier": "Legendary",
"type": "spear",
"name": "Bob\u2019s Mythic Spear (1.20)",
"displayName": "Bob\u2019s Mythic Spear (1.20)",
"name": "Bob's Mythic Spear (1.20)",
"displayName": "Bob's Mythic Spear (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -267445,8 +267446,8 @@
{
"tier": "Legendary",
"type": "chestplate",
"name": "Terra\u2019s Mold (1.20)",
"displayName": "Terra\u2019s Mold (1.20)",
"name": "Terra's Mold (1.20)",
"displayName": "Terra's Mold (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -267900,8 +267901,8 @@
{
"tier": "Legendary",
"type": "ring",
"name": "Old Keeper\u2019s Ring (1.20)",
"displayName": "Old Keeper\u2019s Ring (1.20)",
"name": "Old Keeper's Ring (1.20)",
"displayName": "Old Keeper's Ring (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -268068,7 +268069,7 @@
{
"tier": "Rare",
"type": "leggings",
"name": "Paradox (1.20)",
"name": "One For All",
"displayName": "Paradox (1.20)",
"set": null,
"quest": null,
@ -268272,7 +268273,7 @@
{
"tier": "Rare",
"type": "boots",
"name": "Dragon Dance (1.20)",
"name": "Paradox",
"displayName": "Dragon Dance (1.20)",
"set": null,
"quest": null,
@ -268560,8 +268561,8 @@
{
"tier": "Rare",
"type": "leggings",
"name": "Lion\u2019s Pelt (1.20)",
"displayName": "Lion\u2019s Pelt (1.20)",
"name": "Lion's Pelt (1.20)",
"displayName": "Lion's Pelt (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -269385,8 +269386,8 @@
{
"tier": "Legendary",
"type": "chestplate",
"name": "Tisaun\u2019s Valor (1.20)",
"displayName": "Tisaun\u2019s Valor (1.20)",
"name": "Tisaun's Valor (1.20)",
"displayName": "Tisaun's Valor (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -269965,8 +269966,8 @@
{
"tier": "Unique",
"type": "helmet",
"name": "Sano\u2019s Care (1.20)",
"displayName": "Sano\u2019s Care (1.20)",
"name": "Sano's Care (1.20)",
"displayName": "Sano's Care (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -270772,12 +270773,11 @@
{
"tier": "Set",
"type": "ring",
"name": "Black Catalyst Set (1.20)",
"displayName": "Black Catalyst Set (1.20)",
"name": "Black Catalyst Set",
"displayName": "Black Catalyst Set (DEPRECATED!!!)",
"set": null,
"quest": null,
"classReq": null,
"restrict": "1.20 item",
"fixID": true,
"strReq": 0,
"dexReq": 0,
@ -270797,7 +270797,7 @@
"sdPct": 8,
"spPct1": -12,
"spPct3": -12,
"id": 10249
"id": 3574
},
{
"tier": "Rare",
@ -272002,8 +272002,8 @@
{
"tier": "Legendary",
"type": "boots",
"name": "Nether\u2019s Scar (1.20)",
"displayName": "Nether\u2019s Scar (1.20)",
"name": "Nether's Scar (1.20)",
"displayName": "Nether's Scar (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -272146,8 +272146,8 @@
{
"tier": "Unique",
"type": "leggings",
"name": "Bantisu\u2019s Approach (1.20)",
"displayName": "Bantisu\u2019s Approach (1.20)",
"name": "Bantisu's Approach (1.20)",
"displayName": "Bantisu's Approach (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -272406,8 +272406,8 @@
{
"tier": "Legendary",
"type": "helmet",
"name": "Gale\u2019s Sight (1.20)",
"displayName": "Gale\u2019s Sight (1.20)",
"name": "Gale's Sight (1.20)",
"displayName": "Gale's Sight (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -272584,8 +272584,8 @@
{
"tier": "Legendary",
"type": "bow",
"name": "Bob\u2019s Mythic Bow (1.20)",
"displayName": "Bob\u2019s Mythic Bow (1.20)",
"name": "Bob's Mythic Bow (1.20)",
"displayName": "Bob's Mythic Bow (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -272824,8 +272824,8 @@
{
"tier": "Unique",
"type": "chestplate",
"name": "Ahm\u2019s Remains (1.20)",
"displayName": "Ahm\u2019s Remains (1.20)",
"name": "Ahm's Remains (1.20)",
"displayName": "Ahm's Remains (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -273249,8 +273249,8 @@
{
"tier": "Legendary",
"type": "wand",
"name": "Bob\u2019s Mythic Wand (1.20)",
"displayName": "Bob\u2019s Mythic Wand (1.20)",
"name": "Bob's Mythic Wand (1.20)",
"displayName": "Bob's Mythic Wand (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -273535,8 +273535,8 @@
{
"tier": "Legendary",
"type": "boots",
"name": "Cerid\u2019s Ingenuity (1.20)",
"displayName": "Cerid\u2019s Ingenuity (1.20)",
"name": "Cerid's Ingenuity (1.20)",
"displayName": "Cerid's Ingenuity (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -273845,8 +273845,8 @@
{
"tier": "Legendary",
"type": "leggings",
"name": "Ohms\u2019 Rage (1.20)",
"displayName": "Ohms\u2019 Rage (1.20)",
"name": "Ohms' Rage (1.20)",
"displayName": "Ohms' Rage (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -274024,8 +274024,8 @@
{
"tier": "Legendary",
"type": "necklace",
"name": "Ensa\u2019s Faith (1.20)",
"displayName": "Ensa\u2019s Faith (1.20)",
"name": "Ensa's Faith (1.20)",
"displayName": "Ensa's Faith (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -274798,8 +274798,8 @@
{
"tier": "Rare",
"type": "leggings",
"name": "Rodoroc\u2019s Guard (1.20)",
"displayName": "Rodoroc\u2019s Guard (1.20)",
"name": "Rodoroc's Guard (1.20)",
"displayName": "Rodoroc's Guard (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -275277,7 +275277,7 @@
{
"tier": "Rare",
"type": "boots",
"name": "Weatherwalkers (1.20)",
"name": "All for One",
"displayName": "Weatherwalkers (1.20)",
"set": null,
"quest": null,
@ -275654,8 +275654,8 @@
{
"tier": "Rare",
"type": "dagger",
"name": "Skien\u2019s Paranoia (1.20)",
"displayName": "Skien\u2019s Paranoia (1.20)",
"name": "Skien's Paranoia (1.20)",
"displayName": "Skien's Paranoia (1.20)",
"set": null,
"quest": null,
"classReq": null,
@ -276384,6 +276384,80 @@
"gXp": 0,
"gSpd": 0,
"id": 10406
},
{
"name": "Cursed Jackboots",
"tier": "Legendary",
"type": "boots",
"set": null,
"quest": "Lost Soles",
"poison": 0,
"thorns": 0,
"sprint": 0,
"category": "armor",
"slots": 2,
"drop": "never",
"hp": 1400,
"fDef": 0,
"wDef": 50,
"aDef": 0,
"tDef": 80,
"eDef": 0,
"lvl": 60,
"classReq": null,
"strReq": 0,
"dexReq": 0,
"intReq": 0,
"agiReq": 0,
"defReq": 0,
"hprPct": -20,
"mr": 0,
"sdPct": 0,
"mdPct": 0,
"ls": 0,
"ms": 2,
"xpb": 0,
"lb": 0,
"ref": 0,
"str": 0,
"dex": 7,
"int": 7,
"agi": 0,
"def": 0,
"expd": 0,
"spd": 0,
"atkTier": 0,
"hpBonus": 0,
"spRegen": 0,
"eSteal": 0,
"hprRaw": 0,
"sdRaw": 100,
"mdRaw": 0,
"fDamPct": 0,
"wDamPct": 10,
"aDamPct": 0,
"tDamPct": 10,
"eDamPct": 0,
"fDefPct": 0,
"wDefPct": 0,
"aDefPct": 0,
"tDefPct": 0,
"eDefPct": -35,
"spPct1": 0,
"spRaw1": 0,
"spPct2": 0,
"spRaw2": 0,
"spPct3": 0,
"spRaw3": 0,
"spPct4": 0,
"spRaw4": 0,
"rainbowRaw": 0,
"sprintReg": 0,
"jh": 0,
"lq": 0,
"gXp": 0,
"gSpd": 0,
"id": 10407
}
],
"sets": {
@ -276998,13 +277072,17 @@
"xpb": -5
},
{
"mr": 1,
"sdPct": 10,
"xpb": 30,
"expd": 10,
"hpBonus": 325,
"hp": -325,
"str": 0,
"dex": 0,
"int": 0,
"def": 0,
"agi": 0,
"xpb": 25,
"spRegen": 10,
"sdRaw": 90
"sdPct": 8,
"spPct1": -12,
"spPct3": -12
}
]
},

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

14
load.js
View file

@ -1,4 +1,4 @@
const DB_VERSION = 25;
const DB_VERSION = 26;
// @See https://github.com/mdn/learning-area/blob/master/javascript/apis/client-side-storage/indexeddb/video-store/index.js
let db;
@ -48,12 +48,14 @@ async function load_local(init_func) {
* Clean bad item data. For now just assigns display name if it isn't already assigned.
*/
function clean_item(item) {
if (item.displayName === undefined) {
item.displayName = item.name;
if (item.remapID === undefined) {
if (item.displayName === undefined) {
item.displayName = item.name;
}
item.skillpoints = [item.str, item.dex, item.int, item.def, item.agi];
item.has_negstat = item.str < 0 || item.dex < 0 || item.int < 0 || item.def < 0 || item.agi < 0;
item.reqs = [item.strReq, item.dexReq, item.intReq, item.defReq, item.agiReq];
}
item.skillpoints = [item.str, item.dex, item.int, item.def, item.agi];
item.has_negstat = item.str < 0 || item.dex < 0 || item.int < 0 || item.def < 0 || item.agi < 0;
item.reqs = [item.strReq, item.dexReq, item.intReq, item.defReq, item.agiReq];
}
/*

80
update_merge.py Normal file
View file

@ -0,0 +1,80 @@
import json
with open("clean.json") as infile:
olds = json.load(infile)
items = olds["items"]
item_oldnames_map = dict()
item_newnames_map = dict()
VERSION_STR = " (1.20)"
max_old_id = 0
for item in items:
item_id = item["id"]
if "displayName" in item:
displayName = item["displayName"]
else:
displayName = item["name"]
item_name = displayName.replace(VERSION_STR, "")
if item_id > 10000:
map_name = item["name"].replace(VERSION_STR, "")
item_newnames_map[map_name] = item
item["displayName"] = item_name
else:
item_oldnames_map[item_name] = item
if item_id > max_old_id:
max_old_id = item_id
dummy_items = []
for (name, item) in item_newnames_map.items():
if name in item_oldnames_map:
old_item = item_oldnames_map[name]
if "displayName" in item:
displayName = item["displayName"].replace(VERSION_STR, "")
else:
displayName = name
save_old = ["id","set","quest","drop","restrict", "name"]
old_mappings = { k: old_item[k] for k in save_old if k in old_item }
old_item.clear()
if "restrict" in item:
del item["restrict"]
for k in item:
old_item[k] = item[k]
for k in old_mappings:
old_item[k] = old_mappings[k]
save_id = item["id"]
item.clear()
item["id"] = save_id
item["name"] = str(save_id)
item["remapID"] = old_item["id"]
else:
if "restrict" in item:
in_str = input(name + " restriction: ").strip()
if in_str:
item["restrict"] = in_str
else:
del item["restrict"]
item["name"] = name
dummy_item = dict()
dummy_item["id"] = item["id"]
max_old_id += 1
item["id"] = max_old_id
dummy_item["remapID"] = item["id"]
dummy_items.append(dummy_item)
items.extend(dummy_items)
sets = olds["sets"]
data = dict()
data["items"] = items
data["sets"] = sets
with open("updated.json", "w") as outfile:
json.dump(data, outfile, indent=2)

260687
updated.json Normal file

File diff suppressed because it is too large Load diff