Created
August 5, 2022 05:05
-
-
Save Elmuti/921d25700f4c108515506f58f4cba2b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local RATING_CONVERSION_TABLE = { | |
CritRating = { [1] = 1.4, [60] = 14, [70] = 22.1}; | |
HitRating = { [1] = 2, [60] = 10, [70] = 15.8}; | |
HasteRating = { [1] = 2, [60] = 10, [70] = 15.8}; | |
DodgeRating = { [1] = 2.2, [60] = 12, [70] = 18.9}; | |
ParryRating = { [1] = 3, [60] = 20, [70] = 31.5}; | |
BlockRating = { [1] = 0.5, [60] = 5, [70] = 7.9}; | |
Resilience = { [1] = 3.5, [60] = 25, [70] = 39.4}; | |
ArmorPen = { [1] = 0.75, [60] = 5.92, [70] = 13.99}; | |
DefenseRating = { [1] = 0.75, [60] = 5.92, [70] = 13.99}; | |
} | |
local RESIL_CONVERSION_TABLE = { | |
CritChance = { [1] = 3, [60] = 54, [70] = 85}; | |
DrainAndCritDmg = { [1] = 1, [60] = 25, [70] = 40}; | |
DamageReduction = { [1] = 2, [60] = 27, [70] = 43}; | |
} | |
function Lerp(start, goal, alpha) | |
return start * (1 - alpha) + goal * alpha | |
end | |
function LerpInCirc(start, goal, alpha) | |
return start * (1 - alpha) | |
end | |
function LerpTable(t) | |
local low = t[1] | |
local high = t[60] | |
for lvl = 1, 60 do | |
if lvl > 1 and lvl < 60 then | |
t[lvl] = Lerp(low, high, lvl / 60) | |
end | |
end | |
end | |
function PrintTable(f, t, resil) | |
for tName, data in pairs(t) do | |
if not resil then | |
f:write("\t[UnitStat.".. tName .. "] = {\n") | |
else | |
f:write("\t".. tName .. " = {\n") | |
end | |
for level, value in ipairs(data) do | |
f:write(string.format("\t\t[%d] = %f;\n", level, value)) | |
end | |
f:write("\t};\n") | |
end | |
end | |
function main() | |
for rating, t in pairs(RATING_CONVERSION_TABLE) do | |
LerpTable(t) | |
end | |
for rating, t in pairs(RESIL_CONVERSION_TABLE) do | |
LerpTable(t) | |
end | |
local f = io.open("output.txt", "w+") | |
f:write("RATING_CONVERSION_TABLE = {\n") | |
PrintTable(f, RATING_CONVERSION_TABLE, false) | |
f:write("}\n\n") | |
f:write("\nRESIL_CONVERSION_TABLE = {\n") | |
PrintTable(f, RESIL_CONVERSION_TABLE, true) | |
f:write("}\n\n") | |
f:close() | |
end | |
local s,e = pcall(main) | |
if not s then | |
print(e) | |
end | |
io.read() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment