// 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; }