From 9f395820cd9d17e077562f731c4641187ad45644 Mon Sep 17 00:00:00 2001 From: Sainan Date: Wed, 29 May 2024 07:00:01 +0200 Subject: [PATCH 1/6] improve(webui): Keep sidebar visible when scrolling --- static/webui/style.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/static/webui/style.css b/static/webui/style.css index ac9bf2a1..109802b4 100644 --- a/static/webui/style.css +++ b/static/webui/style.css @@ -5,6 +5,12 @@ gap: 1.5rem; } + body.logged-in #sidebar { + position: sticky; + top: 5rem; + height: 100px; + } + body:not(.logged-in) #sidebar { display: none; } -- 2.47.2 From d52bd1bf8dd92b26bf2d420df7a47799e4564f1a Mon Sep 17 00:00:00 2001 From: Sainan Date: Wed, 29 May 2024 07:02:24 +0200 Subject: [PATCH 2/6] improve(webui): Close mobile sidebar when a link is clicked --- static/webui/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/webui/index.html b/static/webui/index.html index c8556dc3..b6888212 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -51,8 +51,8 @@ -- 2.47.2 From d593c89d857e73b823629d880a4b68bd2f3ed35f Mon Sep 17 00:00:00 2001 From: Sainan Date: Wed, 29 May 2024 12:28:43 +0200 Subject: [PATCH 3/6] feat(webui): Add list of owned rivens --- static/webui/RivenParser.js | 1177 +++++++++++++++++++++++++++++++++++ static/webui/index.html | 13 +- static/webui/script.js | 65 +- 3 files changed, 1251 insertions(+), 4 deletions(-) create mode 100644 static/webui/RivenParser.js diff --git a/static/webui/RivenParser.js b/static/webui/RivenParser.js new file mode 100644 index 00000000..07f4a321 --- /dev/null +++ b/static/webui/RivenParser.js @@ -0,0 +1,1177 @@ +// 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, .66000003, .5, .40000001, .34999999]; +const numBuffsCurseAtten = [0, 1, .33000001, .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/index.html b/static/webui/index.html index b6888212..caf0197c 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -87,7 +87,7 @@
Warframes
- +
@@ -105,7 +105,7 @@
Weapons
- +
@@ -139,6 +139,14 @@ Need help with the fingerprint?
+
+
Rivens
+
+ + +
+
+
@@ -152,6 +160,7 @@ > +