From e980d344582741554615eb56e7ce32c6a5f983d4 Mon Sep 17 00:00:00 2001 From: Sainan Date: Sat, 1 Jun 2024 17:19:51 +0200 Subject: [PATCH] improve(webui): keep a local copy of riven tool (#261) --- package-lock.json | 6 + package.json | 1 + src/routes/webui.ts | 8 + static/webui/index.html | 6 +- static/webui/libs/RivenParser.js | 1178 ------------------------------ static/webui/script.js | 2 +- 6 files changed, 18 insertions(+), 1183 deletions(-) delete mode 100644 static/webui/libs/RivenParser.js diff --git a/package-lock.json b/package-lock.json index acca0552..66e1892a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "express": "^5.0.0-beta.3", "mongoose": "^8.1.1", "warframe-items": "^1.1261.19", + "warframe-riven-info": "^0.1.0", "winston": "^3.11.0", "winston-daily-rotate-file": "^4.7.1" }, @@ -3892,6 +3893,11 @@ "warframe-worldstate-data": "^2" } }, + "node_modules/warframe-riven-info": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/warframe-riven-info/-/warframe-riven-info-0.1.0.tgz", + "integrity": "sha512-99e1HsGZomE1vHXat97V/eseccEnnQ1rv9vC0bdV9mig1wPdWiixHqCIpvIOBVUGKSEKuw2DJEErPD5Nxg+EsQ==" + }, "node_modules/warframe-worldstate-data": { "version": "2.5.14", "resolved": "https://registry.npmjs.org/warframe-worldstate-data/-/warframe-worldstate-data-2.5.14.tgz", diff --git a/package.json b/package.json index ba09cc40..f0e06c0b 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "express": "^5.0.0-beta.3", "mongoose": "^8.1.1", "warframe-items": "^1.1261.19", + "warframe-riven-info": "^0.1.0", "winston": "^3.11.0", "winston-daily-rotate-file": "^4.7.1" }, diff --git a/src/routes/webui.ts b/src/routes/webui.ts index fcfa402f..750df395 100644 --- a/src/routes/webui.ts +++ b/src/routes/webui.ts @@ -33,4 +33,12 @@ webuiRouter.get("/favicon.ico", (_req, res) => { res.sendFile(path.join(rootDir, "static/fixed_responses/favicon.ico")); }); +// Serve warframe-riven-info +webuiRouter.get("/webui/riven-tool/", (_req, res) => { + res.sendFile(path.join(rootDir, "node_modules/warframe-riven-info/index.html")); +}); +webuiRouter.get("/webui/riven-tool/RivenParser.js", (_req, res) => { + res.sendFile(path.join(rootDir, "node_modules/warframe-riven-info/RivenParser.js")); +}); + export { webuiRouter }; diff --git a/static/webui/index.html b/static/webui/index.html index 72cb6ebe..a680fd33 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -161,9 +161,7 @@ placeholder="Fingerprint" > - - Need help with the fingerprint? - + Need help with the fingerprint?
@@ -200,7 +198,7 @@ - + diff --git a/static/webui/libs/RivenParser.js b/static/webui/libs/RivenParser.js deleted file mode 100644 index d8223ecd..00000000 --- a/static/webui/libs/RivenParser.js +++ /dev/null @@ -1,1178 +0,0 @@ -// Use the collapse feature in your editor :) -const riven_tags = { - LotusArchgunRandomModRare: [ - { - tag: "WeaponArmorPiercingDamageMod", - value: 0.01, - prefix: "insi", - suffix: "cak" - }, - { - tag: "WeaponCritChanceMod", - value: 0.0111, - prefix: "crita", - suffix: "cron" - }, - { - tag: "WeaponCritDamageMod", - value: 0.0089, - prefix: "acri", - suffix: "tis" - }, - { - tag: "WeaponElectricityDamageMod", - value: 0.0133, - prefix: "vexi", - suffix: "tio" - }, - { - tag: "WeaponFireDamageMod", - value: 0.0133, - prefix: "igni", - suffix: "pha" - }, - { - tag: "WeaponFireRateMod", - value: 0.00667, - prefix: "croni", - suffix: "dra" - }, - { - tag: "WeaponFreezeDamageMod", - value: 0.0133, - prefix: "geli", - suffix: "do" - }, - { - tag: "WeaponImpactDamageMod", - value: 0.01, - prefix: "magna", - suffix: "ton" - }, - { - tag: "WeaponProcTimeMod", - value: 0.01111, - prefix: "deci", - suffix: "des" - }, - { - tag: "WeaponSlashDamageMod", - value: 0.01, - prefix: "sci", - suffix: "sus" - }, - { - tag: "WeaponStunChanceMod", - value: 0.0067, - prefix: "hexa", - suffix: "dex" - }, - { - tag: "WeaponToxinDamageMod", - value: 0.0133, - prefix: "toxi", - suffix: "tox" - }, - { - tag: "WeaponAmmoMaxMod", - value: 0.0111, - prefix: "ampi", - suffix: "bin" - }, - { - tag: "WeaponClipMaxMod", - value: 0.0067, - prefix: "arma", - suffix: "tin" - }, - { - tag: "WeaponDamageAmountMod", - value: 0.0111, - prefix: "visi", - suffix: "ata" - }, - { - tag: "WeaponFireIterationsMod", - value: 0.0067, - prefix: "sati", - suffix: "can" - }, - { - tag: "WeaponPunctureDepthMod", - value: 0.03, - prefix: "lexi", - suffix: "nok" - }, - { - tag: "WeaponRecoilReductionMod", - value: -0.01, - prefix: "zeti", - suffix: "mag" - }, - { - tag: "WeaponReloadSpeedMod", - value: 0.0111, - prefix: "feva", - suffix: "tak" - }, - { - tag: "WeaponFactionDamageCorpus", - value: 0.005, - prefix: "manti", - suffix: "tron" - }, - { - tag: "WeaponFactionDamageGrineer", - value: 0.005, - prefix: "argi", - suffix: "con" - }, - { - tag: "WeaponZoomFovMod", - value: 0.006666, - prefix: "hera", - suffix: "lis" - } - ], - LotusModularMeleeRandomModRare: [ - { - tag: "WeaponMeleeDamageMod", - value: 0.0183, - prefix: "visi", - suffix: "ata" - }, - { - tag: "WeaponArmorPiercingDamageMod", - value: 0.0133, - prefix: "insi", - suffix: "cak" - }, - { - tag: "WeaponImpactDamageMod", - value: 0.0133, - prefix: "magna", - suffix: "ton" - }, - { - tag: "WeaponSlashDamageMod", - value: 0.0133, - prefix: "sci", - suffix: "sus" - }, - { - tag: "WeaponCritChanceMod", - value: 0.02, - prefix: "crita", - suffix: "cron" - }, - { - tag: "WeaponCritDamageMod", - value: 0.01, - prefix: "acri", - suffix: "tis" - }, - { - tag: "WeaponElectricityDamageMod", - value: 0.01, - prefix: "vexi", - suffix: "tio" - }, - { - tag: "WeaponFireDamageMod", - value: 0.01, - prefix: "igni", - suffix: "pha" - }, - { - tag: "WeaponFreezeDamageMod", - value: 0.01, - prefix: "geli", - suffix: "do" - }, - { - tag: "WeaponToxinDamageMod", - value: 0.01, - prefix: "toxi", - suffix: "tox" - }, - { - tag: "WeaponProcTimeMod", - value: 0.01111, - prefix: "deci", - suffix: "des" - }, - { - tag: "WeaponMeleeFactionDamageCorpus", - value: 0.005, - prefix: "manti", - suffix: "tron" - }, - { - tag: "WeaponMeleeFactionDamageGrineer", - value: 0.005, - prefix: "argi", - suffix: "con" - }, - { - tag: "WeaponMeleeFactionDamageInfested", - value: 0.005, - prefix: "pura", - suffix: "ada" - }, - { - tag: "WeaponFireRateMod", - value: 0.0061, - prefix: "croni", - suffix: "dra" - }, - { - tag: "WeaponStunChanceMod", - value: 0.01, - prefix: "hexa", - suffix: "dex" - }, - { - tag: "ComboDurationMod", - value: 0.09, - prefix: "tempi", - suffix: "nem" - }, - { - tag: "SlideAttackCritChanceMod", - value: 0.013334, - prefix: "pleci", - suffix: "nent" - }, - { - tag: "WeaponMeleeRangeIncMod", - value: 0.02158, - prefix: "locti", - suffix: "tor" - }, - { - tag: "WeaponMeleeFinisherDamageMod", - value: 0.0133, - prefix: "exi", - suffix: "cta" - }, - { - tag: "WeaponMeleeComboEfficiencyMod", - value: 0.00816, - prefix: "forti", - suffix: "us" - }, - { - tag: "WeaponMeleeComboInitialBonusMod", - value: 0.27224, - prefix: "para", - suffix: "um" - }, - { - tag: "WeaponMeleeComboPointsOnHitMod", - value: -0.01165 - }, - { - tag: "WeaponMeleeComboBonusOnHitMod", - value: 0.00653, - prefix: "laci", - suffix: "nus" - } - ], - LotusModularPistolRandomModRare: [ - { - tag: "WeaponArmorPiercingDamageMod", - value: 0.01333, - prefix: "insi", - suffix: "cak" - }, - { - tag: "WeaponCritChanceMod", - value: 0.016666, - prefix: "crita", - suffix: "cron" - }, - { - tag: "WeaponCritDamageMod", - value: 0.01, - prefix: "acri", - suffix: "tis" - }, - { - tag: "WeaponElectricityDamageMod", - value: 0.01, - prefix: "vexi", - suffix: "tio" - }, - { - tag: "WeaponFireDamageMod", - value: 0.01, - prefix: "igni", - suffix: "pha" - }, - { - tag: "WeaponFireRateMod", - value: 0.0083, - prefix: "croni", - suffix: "dra" - }, - { - tag: "WeaponFreezeDamageMod", - value: 0.01, - prefix: "geli", - suffix: "do" - }, - { - tag: "WeaponImpactDamageMod", - value: 0.013333, - prefix: "magna", - suffix: "ton" - }, - { - tag: "WeaponProcTimeMod", - value: 0.01111, - prefix: "deci", - suffix: "des" - }, - { - tag: "WeaponSlashDamageMod", - value: 0.013333, - prefix: "sci", - suffix: "sus" - }, - { - tag: "WeaponStunChanceMod", - value: 0.01, - prefix: "hexa", - suffix: "dex" - }, - { - tag: "WeaponToxinDamageMod", - value: 0.01, - prefix: "toxi", - suffix: "tox" - }, - { - tag: "WeaponAmmoMaxMod", - value: 0.01, - prefix: "ampi", - suffix: "bin" - }, - { - tag: "WeaponClipMaxMod", - value: 0.005555, - prefix: "arma", - suffix: "tin" - }, - { - tag: "WeaponDamageAmountMod", - value: 0.0244, - prefix: "visi", - suffix: "ata" - }, - { - tag: "WeaponFireIterationsMod", - value: 0.0133, - prefix: "sati", - suffix: "can" - }, - { - tag: "WeaponProjectileSpeedMod", - value: 0.01, - prefix: "conci", - suffix: "nak" - }, - { - tag: "WeaponPunctureDepthMod", - value: 0.03, - prefix: "lexi", - suffix: "nok" - }, - { - tag: "WeaponRecoilReductionMod", - value: -0.01, - prefix: "zeti", - suffix: "mag" - }, - { - tag: "WeaponReloadSpeedMod", - value: 0.005555, - prefix: "feva", - suffix: "tak" - }, - { - tag: "WeaponFactionDamageCorpus", - value: 0.005, - prefix: "manti", - suffix: "tron" - }, - { - tag: "WeaponFactionDamageGrineer", - value: 0.005, - prefix: "argi", - suffix: "con" - }, - { - tag: "WeaponFactionDamageInfested", - value: 0.005, - prefix: "pura", - suffix: "ada" - }, - { - tag: "WeaponZoomFovMod", - value: 0.0089, - prefix: "hera", - suffix: "lis" - } - ], - LotusPistolRandomModRare: [ - { - tag: "WeaponArmorPiercingDamageMod", - value: 0.01333, - prefix: "insi", - suffix: "cak" - }, - { - tag: "WeaponCritChanceMod", - value: 0.016666, - prefix: "crita", - suffix: "cron" - }, - { - tag: "WeaponCritDamageMod", - value: 0.01, - prefix: "acri", - suffix: "tis" - }, - { - tag: "WeaponElectricityDamageMod", - value: 0.01, - prefix: "vexi", - suffix: "tio" - }, - { - tag: "WeaponFireDamageMod", - value: 0.01, - prefix: "igni", - suffix: "pha" - }, - { - tag: "WeaponFireRateMod", - value: 0.0083, - prefix: "croni", - suffix: "dra" - }, - { - tag: "WeaponFreezeDamageMod", - value: 0.01, - prefix: "geli", - suffix: "do" - }, - { - tag: "WeaponImpactDamageMod", - value: 0.013333, - prefix: "magna", - suffix: "ton" - }, - { - tag: "WeaponProcTimeMod", - value: 0.01111, - prefix: "deci", - suffix: "des" - }, - { - tag: "WeaponSlashDamageMod", - value: 0.013333, - prefix: "sci", - suffix: "sus" - }, - { - tag: "WeaponStunChanceMod", - value: 0.01, - prefix: "hexa", - suffix: "dex" - }, - { - tag: "WeaponToxinDamageMod", - value: 0.01, - prefix: "toxi", - suffix: "tox" - }, - { - tag: "WeaponAmmoMaxMod", - value: 0.01, - prefix: "ampi", - suffix: "bin" - }, - { - tag: "WeaponClipMaxMod", - value: 0.005555, - prefix: "arma", - suffix: "tin" - }, - { - tag: "WeaponDamageAmountMod", - value: 0.0244, - prefix: "visi", - suffix: "ata" - }, - { - tag: "WeaponFireIterationsMod", - value: 0.0133, - prefix: "sati", - suffix: "can" - }, - { - tag: "WeaponProjectileSpeedMod", - value: 0.01, - prefix: "conci", - suffix: "nak" - }, - { - tag: "WeaponPunctureDepthMod", - value: 0.03, - prefix: "lexi", - suffix: "nok" - }, - { - tag: "WeaponRecoilReductionMod", - value: -0.01, - prefix: "zeti", - suffix: "mag" - }, - { - tag: "WeaponReloadSpeedMod", - value: 0.005555, - prefix: "feva", - suffix: "tak" - }, - { - tag: "WeaponFactionDamageCorpus", - value: 0.005, - prefix: "manti", - suffix: "tron" - }, - { - tag: "WeaponFactionDamageGrineer", - value: 0.005, - prefix: "argi", - suffix: "con" - }, - { - tag: "WeaponFactionDamageInfested", - value: 0.005, - prefix: "pura", - suffix: "ada" - }, - { - tag: "WeaponZoomFovMod", - value: 0.0089, - prefix: "hera", - suffix: "lis" - } - ], - LotusRifleRandomModRare: [ - { - tag: "WeaponArmorPiercingDamageMod", - value: 0.01333, - prefix: "insi", - suffix: "cak" - }, - { - tag: "WeaponCritChanceMod", - value: 0.016666, - prefix: "crita", - suffix: "cron" - }, - { - tag: "WeaponCritDamageMod", - value: 0.013333, - prefix: "acri", - suffix: "tis" - }, - { - tag: "WeaponElectricityDamageMod", - value: 0.01, - prefix: "vexi", - suffix: "tio" - }, - { - tag: "WeaponFireDamageMod", - value: 0.01, - prefix: "igni", - suffix: "pha" - }, - { - tag: "WeaponFireRateMod", - value: 0.00667, - prefix: "croni", - suffix: "dra" - }, - { - tag: "WeaponFreezeDamageMod", - value: 0.01, - prefix: "geli", - suffix: "do" - }, - { - tag: "WeaponImpactDamageMod", - value: 0.013333, - prefix: "magna", - suffix: "ton" - }, - { - tag: "WeaponProcTimeMod", - value: 0.01111, - prefix: "deci", - suffix: "des" - }, - { - tag: "WeaponSlashDamageMod", - value: 0.013333, - prefix: "sci", - suffix: "sus" - }, - { - tag: "WeaponStunChanceMod", - value: 0.01, - prefix: "hexa", - suffix: "dex" - }, - { - tag: "WeaponToxinDamageMod", - value: 0.01, - prefix: "toxi", - suffix: "tox" - }, - { - tag: "WeaponAmmoMaxMod", - value: 0.00555, - prefix: "ampi", - suffix: "bin" - }, - { - tag: "WeaponClipMaxMod", - value: 0.005555, - prefix: "arma", - suffix: "tin" - }, - { - tag: "WeaponDamageAmountMod", - value: 0.018333, - prefix: "visi", - suffix: "ata" - }, - { - tag: "WeaponFireIterationsMod", - value: 0.01, - prefix: "sati", - suffix: "can" - }, - { - tag: "WeaponProjectileSpeedMod", - value: 0.01, - prefix: "conci", - suffix: "nak" - }, - { - tag: "WeaponPunctureDepthMod", - value: 0.03, - prefix: "lexi", - suffix: "nok" - }, - { - tag: "WeaponRecoilReductionMod", - value: -0.01, - prefix: "zeti", - suffix: "mag" - }, - { - tag: "WeaponReloadSpeedMod", - value: 0.005555, - prefix: "feva", - suffix: "tak" - }, - { - tag: "WeaponFactionDamageCorpus", - value: 0.005, - prefix: "manti", - suffix: "tron" - }, - { - tag: "WeaponFactionDamageGrineer", - value: 0.005, - prefix: "argi", - suffix: "con" - }, - { - tag: "WeaponFactionDamageInfested", - value: 0.005, - prefix: "pura", - suffix: "ada" - }, - { - tag: "WeaponZoomFovMod", - value: 0.006666, - prefix: "hera", - suffix: "lis" - } - ], - LotusShotgunRandomModRare: [ - { - tag: "WeaponArmorPiercingDamageMod", - value: 0.01333, - prefix: "insi", - suffix: "cak" - }, - { - tag: "WeaponCritChanceMod", - value: 0.01, - prefix: "crita", - suffix: "cron" - }, - { - tag: "WeaponCritDamageMod", - value: 0.01, - prefix: "acri", - suffix: "tis" - }, - { - tag: "WeaponElectricityDamageMod", - value: 0.01, - prefix: "vexi", - suffix: "tio" - }, - { - tag: "WeaponFireDamageMod", - value: 0.01, - prefix: "igni", - suffix: "pha" - }, - { - tag: "WeaponFireRateMod", - value: 0.01, - prefix: "croni", - suffix: "dra" - }, - { - tag: "WeaponFreezeDamageMod", - value: 0.01, - prefix: "geli", - suffix: "do" - }, - { - tag: "WeaponImpactDamageMod", - value: 0.013333, - prefix: "magna", - suffix: "ton" - }, - { - tag: "WeaponProcTimeMod", - value: 0.01111, - prefix: "deci", - suffix: "des" - }, - { - tag: "WeaponSlashDamageMod", - value: 0.013333, - prefix: "sci", - suffix: "sus" - }, - { - tag: "WeaponStunChanceMod", - value: 0.01, - prefix: "hexa", - suffix: "dex" - }, - { - tag: "WeaponToxinDamageMod", - value: 0.01, - prefix: "toxi", - suffix: "tox" - }, - { - tag: "WeaponAmmoMaxMod", - value: 0.01, - prefix: "ampi", - suffix: "bin" - }, - { - tag: "WeaponClipMaxMod", - value: 0.005555, - prefix: "arma", - suffix: "tin" - }, - { - tag: "WeaponDamageAmountMod", - value: 0.0183, - prefix: "visi", - suffix: "ata" - }, - { - tag: "WeaponFireIterationsMod", - value: 0.0133, - prefix: "sati", - suffix: "can" - }, - { - tag: "WeaponProjectileSpeedMod", - value: 0.01, - prefix: "conci", - suffix: "nak" - }, - { - tag: "WeaponPunctureDepthMod", - value: 0.03, - prefix: "lexi", - suffix: "nok" - }, - { - tag: "WeaponRecoilReductionMod", - value: -0.01, - prefix: "zeti", - suffix: "mag" - }, - { - tag: "WeaponReloadSpeedMod", - value: 0.005555, - prefix: "feva", - suffix: "tak" - }, - { - tag: "WeaponFactionDamageCorpus", - value: 0.005, - prefix: "manti", - suffix: "tron" - }, - { - tag: "WeaponFactionDamageGrineer", - value: 0.005, - prefix: "argi", - suffix: "con" - }, - { - tag: "WeaponFactionDamageInfested", - value: 0.005, - prefix: "pura", - suffix: "ada" - } - ], - PlayerMeleeWeaponRandomModRare: [ - { - tag: "WeaponMeleeDamageMod", - value: 0.0183, - prefix: "visi", - suffix: "ata" - }, - { - tag: "WeaponArmorPiercingDamageMod", - value: 0.0133, - prefix: "insi", - suffix: "cak" - }, - { - tag: "WeaponImpactDamageMod", - value: 0.0133, - prefix: "magna", - suffix: "ton" - }, - { - tag: "WeaponSlashDamageMod", - value: 0.0133, - prefix: "sci", - suffix: "sus" - }, - { - tag: "WeaponCritChanceMod", - value: 0.02, - prefix: "crita", - suffix: "cron" - }, - { - tag: "WeaponCritDamageMod", - value: 0.01, - prefix: "acri", - suffix: "tis" - }, - { - tag: "WeaponElectricityDamageMod", - value: 0.01, - prefix: "vexi", - suffix: "tio" - }, - { - tag: "WeaponFireDamageMod", - value: 0.01, - prefix: "igni", - suffix: "pha" - }, - { - tag: "WeaponFreezeDamageMod", - value: 0.01, - prefix: "geli", - suffix: "do" - }, - { - tag: "WeaponToxinDamageMod", - value: 0.01, - prefix: "toxi", - suffix: "tox" - }, - { - tag: "WeaponProcTimeMod", - value: 0.01111, - prefix: "deci", - suffix: "des" - }, - { - tag: "WeaponMeleeFactionDamageCorpus", - value: 0.005, - prefix: "manti", - suffix: "tron" - }, - { - tag: "WeaponMeleeFactionDamageGrineer", - value: 0.005, - prefix: "argi", - suffix: "con" - }, - { - tag: "WeaponMeleeFactionDamageInfested", - value: 0.005, - prefix: "pura", - suffix: "ada" - }, - { - tag: "WeaponFireRateMod", - value: 0.0061, - prefix: "croni", - suffix: "dra" - }, - { - tag: "WeaponStunChanceMod", - value: 0.01, - prefix: "hexa", - suffix: "dex" - }, - { - tag: "ComboDurationMod", - value: 0.09, - prefix: "tempi", - suffix: "nem" - }, - { - tag: "SlideAttackCritChanceMod", - value: 0.013334, - prefix: "pleci", - suffix: "nent" - }, - { - tag: "WeaponMeleeRangeIncMod", - value: 0.02158, - prefix: "locti", - suffix: "tor" - }, - { - tag: "WeaponMeleeFinisherDamageMod", - value: 0.0133, - prefix: "exi", - suffix: "cta" - }, - { - tag: "WeaponMeleeComboEfficiencyMod", - value: 0.00816, - prefix: "forti", - suffix: "us" - }, - { - tag: "WeaponMeleeComboInitialBonusMod", - value: 0.27224, - prefix: "para", - suffix: "um" - }, - { - tag: "WeaponMeleeComboPointsOnHitMod", - value: -0.01165 - }, - { - tag: "WeaponMeleeComboBonusOnHitMod", - value: 0.00653, - prefix: "laci", - suffix: "nus" - } - ] -}; - -function rivenIntToFloat(i) { - const f = i / 0x3fffffff; // 1073741823 - if (f >= 0.0 && f <= 1.0) { - return f; - } - return 0.0; -} - -function floatToRivenInt(f) { - return Math.round(f * 0x3fffffff); -} - -function lerp(a, b, t) { - return a + (b - a) * t; -} - -const numBuffsAtten = [0, 1, 0.66000003, 0.5, 0.40000001, 0.34999999]; -const numBuffsCurseAtten = [0, 1, 0.33000001, 0.5, 1.25, 1.5]; - -function valueToDisplayValue(tag, value) { - if (tag == "WeaponMeleeComboInitialBonusMod") { - return Math.round(value * 10) / 10; - } - return Math.round(value * 1000) / 10; -} - -function displayValueToValue(tag, displayValue) { - if (tag == "WeaponMeleeComboInitialBonusMod") { - return displayValue; - } - return displayValue / 100; -} - -function toTitleCase(word) { - return word.charAt(0).toUpperCase() + word.substr(1); -} - -function parseRiven( - rivenType, // the part after /Lotus/Upgrades/Mods/Randomized/ - fingerprint, - omegaAttenuation // the weapon's riven disposition -) { - const curseAtten = Math.pow(1.25, fingerprint.curses.length); - - let stats = []; - - let attenuation = 1; - attenuation *= 1.5; // SPECIFIC_FIT_ATTENUATION - attenuation *= omegaAttenuation; - attenuation *= 10; // getBaseDrain(RIVEN_BASE_DRAIN) - - for (const buff of fingerprint.buffs) { - let upgradeValue = riven_tags[rivenType].find(x => x.tag == buff.Tag).value; - upgradeValue *= attenuation; - upgradeValue *= curseAtten; - upgradeValue *= lerp(0.9, 1.1, rivenIntToFloat(buff.Value)); - upgradeValue *= numBuffsAtten[Math.min(fingerprint.buffs.length, numBuffsAtten.length - 1)]; - upgradeValue *= fingerprint.lvl + 1; - stats.push({ - tag: buff.Tag, - value: upgradeValue, - displayValue: valueToDisplayValue(buff.Tag, upgradeValue) - }); - } - - for (const curse of fingerprint.curses) { - let upgradeValue = riven_tags[rivenType].find(x => x.tag == curse.Tag).value * -1.0; - upgradeValue *= attenuation; - upgradeValue *= lerp(0.9, 1.1, rivenIntToFloat(curse.Value)); - upgradeValue *= numBuffsCurseAtten[Math.min(fingerprint.buffs.length, numBuffsCurseAtten.length - 1)]; - upgradeValue *= numBuffsAtten[Math.min(fingerprint.curses.length, numBuffsAtten.length - 1)]; - upgradeValue *= fingerprint.lvl + 1; - stats.push({ - tag: curse.Tag, - value: upgradeValue, - displayValue: valueToDisplayValue(curse.Tag, upgradeValue) - }); - } - - let name = ""; - const sortedBuffs = structuredClone(fingerprint.buffs).sort((a, b) => { - if (a.Value == b.Value) { - return ( - riven_tags[rivenType].find(x => x.tag == b.Tag).value - - riven_tags[rivenType].find(x => x.tag == a.Tag).value - ); - } - return b.Value - a.Value; - }); - for (const buff of sortedBuffs) { - if (buff.Tag == sortedBuffs[sortedBuffs.length - 1].Tag) { - name += riven_tags[rivenType].find(x => x.tag == buff.Tag).suffix; - } else if (buff.Tag == sortedBuffs[0].Tag) { - name += toTitleCase(riven_tags[rivenType].find(x => x.tag == buff.Tag).prefix); - } else { - name += "-"; - name += riven_tags[rivenType].find(x => x.tag == buff.Tag).prefix; - } - } - - return { stats, name }; -} - -function unparseBuff(rivenType, omegaAttenuation, lvl, numBuffs, numCurses, tag, value) { - const curseAtten = Math.pow(1.25, numCurses); - - let attenuation = 1; - attenuation *= 1.5; // SPECIFIC_FIT_ATTENUATION - attenuation *= omegaAttenuation; - attenuation *= 10; // getBaseDrain(RIVEN_BASE_DRAIN) - - value /= lvl + 1; - value /= numBuffsAtten[Math.min(numBuffs, numBuffsAtten.length - 1)]; - value /= curseAtten; - value /= attenuation; - value /= riven_tags[rivenType].find(x => x.tag == tag).value; - - value -= 0.9; // 0.9..1.1 -> 0.0..0.2 - value /= 0.2; // 0.0..0.2 -> 0.0..1.0 - - return value; -} - -function unparseCurse(rivenType, omegaAttenuation, lvl, numBuffs, numCurses, tag, value) { - let attenuation = 1; - attenuation *= 1.5; // SPECIFIC_FIT_ATTENUATION - attenuation *= omegaAttenuation; - attenuation *= 10; // getBaseDrain(RIVEN_BASE_DRAIN) - - value /= lvl + 1; - value /= numBuffsAtten[Math.min(numCurses, numBuffsAtten.length - 1)]; - value /= numBuffsCurseAtten[Math.min(numBuffs, numBuffsCurseAtten.length - 1)]; - value /= attenuation; - value /= riven_tags[rivenType].find(x => x.tag == tag).value; - value /= -1.0; - - value -= 0.9; // 0.9..1.1 -> 0.0..0.2 - value /= 0.2; // 0.0..0.2 -> 0.0..1.0 - - return value; -} - -function floatToGrade(value) { - value = lerp(-10, +10, value); - if (value >= +9.5) return "S"; - if (value >= +7.5) return "A+"; - if (value >= +5.5) return "A"; - if (value >= +3.5) return "A-"; - if (value >= +1.5) return "B+"; - if (value >= -1.5) return "B"; - if (value >= -3.5) return "B-"; - if (value >= -5.5) return "C+"; - if (value >= -7.5) return "C"; - if (value >= -9.5) return "C-"; - return "F"; -} - -const RivenParser = { - riven_tags, - rivenIntToFloat, - floatToRivenInt, - valueToDisplayValue, - displayValueToValue, - parseRiven, - unparseBuff, - unparseCurse, - floatToGrade -}; -if (typeof module != "undefined") { - module.exports = RivenParser; -} -if (typeof window != "undefined") { - window.RivenParser = RivenParser; -} diff --git a/static/webui/script.js b/static/webui/script.js index 6fa3bbee..a50e0ab6 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -227,7 +227,7 @@ function updateInventory() { { const a = document.createElement("a"); a.href = - "https://riven.builds.wf/#" + + "riven-tool/#" + encodeURIComponent( JSON.stringify({ rivenType: rivenType,