Skip to content

Commit

Permalink
Make runesmith enchants an enchant instead of a craft (#8223)
Browse files Browse the repository at this point in the history
* make runesmith enchants an enchant instead of a craft

* fix spec description function

* make passive hash not spam consol
  • Loading branch information
Regisle committed Aug 31, 2024
1 parent 5c7f49f commit 996d33c
Show file tree
Hide file tree
Showing 7 changed files with 273 additions and 201 deletions.
7 changes: 3 additions & 4 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -679,11 +679,10 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
self.affixes = (self.base.subType and data.itemMods[self.base.type..self.base.subType])
or data.itemMods[self.base.type]
or data.itemMods.Item
if self.base.weapon then
self.enchantments = data.enchantments["Weapon"]
elseif self.base.flask then
self.enchantments = data.enchantments["Flask"]
if self.base.flask then
if self.base.utility_flask then
self.enchantments = data.enchantments["UtilityFlask"]
else
self.enchantments = data.enchantments["Flask"]
end
else
Expand Down
164 changes: 164 additions & 0 deletions src/Data/EnchantmentWeapon.lua

Large diffs are not rendered by default.

162 changes: 0 additions & 162 deletions src/Data/ModMaster.lua

Large diffs are not rendered by default.

85 changes: 77 additions & 8 deletions src/Export/Scripts/enchant.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,49 @@ if not loadStatFile then
end
loadStatFile("stat_descriptions.txt")

local itemClassMap = {
["LifeFlask"] = "Flask",
["ManaFlask"] = "Flask",
["HybridFlask"] = "Flask",
["Amulet"] = "Amulet",
["Ring"] = "Ring",
["Claw"] = "Claw",
["Dagger"] = "Dagger",
["Rune Dagger"] = "Dagger",
["Wand"] = "Wand",
["One Hand Sword"] = "One Handed Sword",
["Thrusting One Hand Sword"] = "Thrusting One Handed Sword",
["One Hand Axe"] = "One Handed Axe",
["One Hand Mace"] = "One Handed Mace",
["Bow"] = "Bow",
["Fishing Rod"] = "Fishing Rod",
["Staff"] = "Staff",
["Warstaff"] = "Staff",
["Two Hand Sword"] = "Two Handed Sword",
["Two Hand Axe"] = "Two Handed Axe",
["Two Hand Mace"] = "Two Handed Mace",
["Quiver"] = "Quiver",
["Belt"] = "Belt",
["Gloves"] = "Gloves",
["Boots"] = "Boots",
["Body Armour"] = "Body Armour",
["Helmet"] = "Helmet",
["Shield"] = "Shield",
["Sceptre"] = "Sceptre",
["UtilityFlask"] = "Flask",
["UtilityFlaskCritical"] = "Flask",
["Map"] = "Map",
["Jewel"] = "Jewel",
}

local lab = {
[32] = "NORMAL",
[53] = "CRUEL",
[66] = "MERCILESS",
[75] = "ENDGAME",
[83] = "DEDICATION",
}
local sourceOrder = { "NORMAL", "CRUEL", "MERCILESS", "ENDGAME", "DEDICATION", "ENKINDLING", "INSTILLING", "HARVEST", "HEIST" }
local sourceOrder = { "NORMAL", "CRUEL", "MERCILESS", "ENDGAME", "DEDICATION", "ENKINDLING", "INSTILLING", "HARVEST", "HEIST", "RUNESMITH" }

local function doLabEnchantment(fileName, group)
local byDiff = { }
Expand Down Expand Up @@ -44,13 +79,24 @@ doLabEnchantment("../Data/EnchantmentBelt.lua", "BuffEnchantment")

local function doOtherEnchantment(fileName, groupsList)
local byDiff = { }
local byDiffFullMods = { }
for generation in pairs(groupsList) do
for _, mod in ipairs(dat("Mods"):GetRowList("GenerationType", generation)) do
if groupsList[generation][mod.Family[1].Id] then
local stats, orders = describeMod(mod)
local diff = groupsList[generation][mod.Family[1].Id]
byDiff[diff] = byDiff[diff] or { }
table.insert(byDiff[diff], stats)
if type(generation) == "string" and generation == "Craft" then
for _, craft in ipairs(dat("CraftingBenchOptions"):GetRowList("IsDisabled", false)) do
if groupsList[generation][craft.SortCategory.Id] then
local diff = groupsList[generation][craft.SortCategory.Id]
byDiffFullMods[diff] = byDiffFullMods[diff] or { }
table.insert(byDiffFullMods[diff], craft)
end
end
else
for _, mod in ipairs(dat("Mods"):GetRowList("GenerationType", generation)) do
if groupsList[generation][mod.Family[1].Id] then
local stats, orders = describeMod(mod)
local diff = groupsList[generation][mod.Family[1].Id]
byDiff[diff] = byDiff[diff] or { }
table.insert(byDiff[diff], stats)
end
end
end
end
Expand All @@ -64,6 +110,29 @@ local function doOtherEnchantment(fileName, groupsList)
out:write('\t\t"'..table.concat(stats, '/')..'",\n')
end
out:write('\t},\n')
elseif byDiffFullMods[diff] then
out:write('\t["'..diff..'"] = {\n')
for _, mod in ipairs(byDiffFullMods[diff]) do
out:write('\t\t{ ')
out:write('type = "Runecraft", ')
local stats, orders = describeMod(mod.AddEnchantment)
out:write('modTags = { ', stats.modTags, ' }, ')
out:write('"', table.concat(stats, '", "'), '", ')
out:write('statOrder = { ', table.concat(orders, ', '), ' }, ')
out:write('types = { ')
local uniqueTypes = { }
for _, category in ipairs(mod.ItemCategories) do
for _, itemClass in ipairs(category.ItemClasses) do
if uniqueTypes[itemClassMap[itemClass.Id]] ~= itemClassMap[itemClass.Id] then
uniqueTypes[itemClassMap[itemClass.Id]] = itemClassMap[itemClass.Id]
out:write('["', itemClassMap[itemClass.Id], '"] = true, ')
end
end
end
out:write('}, ')
out:write('},\n')
end
out:write('\t},\n')
end
end
out:write('}')
Expand All @@ -75,7 +144,7 @@ doOtherEnchantment("../Data/EnchantmentFlask.lua", { --[3] = { ["FlaskEnchantmen
[21] = { ["FlaskEnchantment"] = "ENKINDLING" },
[22] = { ["FlaskEnchantment"] = "INSTILLING" } })
doOtherEnchantment("../Data/EnchantmentBody.lua", { [3] = { ["AlternateArmourQuality"] = "HARVEST", ["EnchantmentHeistArmour"] = "HEIST" } })
doOtherEnchantment("../Data/EnchantmentWeapon.lua", { [3] = { ["AlternateWeaponQuality"] = "HARVEST", ["EnchantmentHeistWeapon"] = "HEIST" } })
doOtherEnchantment("../Data/EnchantmentWeapon.lua", { [3] = { ["AlternateWeaponQuality"] = "HARVEST", ["EnchantmentHeistWeapon"] = "HEIST" }, ["Craft"] = { ["Runecrafting"] = "RUNESMITH" } })

local skillMap = {
["Summone?d?RagingSpirit"] = "Summon Raging Spirit",
Expand Down
24 changes: 2 additions & 22 deletions src/Export/Scripts/masters.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ local itemClassMap = {
["Ring"] = "Ring",
["Claw"] = "Claw",
["Dagger"] = "Dagger",
["Rune Dagger"] = "Dagger",
["Wand"] = "Wand",
["One Hand Sword"] = "One Handed Sword",
["Thrusting One Hand Sword"] = "Thrusting One Handed Sword",
Expand All @@ -19,6 +20,7 @@ local itemClassMap = {
["Bow"] = "Bow",
["Fishing Rod"] = "Fishing Rod",
["Staff"] = "Staff",
["Warstaff"] = "Staff",
["Two Hand Sword"] = "Two Handed Sword",
["Two Hand Axe"] = "Two Handed Axe",
["Two Hand Mace"] = "Two Handed Mace",
Expand All @@ -34,8 +36,6 @@ local itemClassMap = {
["UtilityFlaskCritical"] = "Flask",
["Map"] = "Map",
["Jewel"] = "Jewel",
["Rune Dagger"] = "Dagger",
["Warstaff"] = "Staff",
}
local out = io.open("../Data/ModMaster.lua", "w")
out:write('-- This file is automatically generated, do not edit!\n')
Expand Down Expand Up @@ -67,26 +67,6 @@ for _, craft in ipairs(dat("CraftingBenchOptions"):GetRowList("IsDisabled", fals
out:write('}, ')
out:write('},\n')
end
if craft.SortCategory.Id == "Runecrafting" then
out:write('\t{ ')
out:write('type = "Runecraft", ')
local stats, orders = describeMod(craft.AddEnchantment)
out:write('modTags = { ', stats.modTags, ' }, ')
out:write('"', table.concat(stats, '", "'), '", ')
out:write('statOrder = { ', table.concat(orders, ', '), ' }, ')
out:write('types = { ')
local uniqueTypes = { }
for _, category in ipairs(craft.ItemCategories) do
for _, itemClass in ipairs(category.ItemClasses) do
if uniqueTypes[itemClassMap[itemClass.Id]] ~= itemClassMap[itemClass.Id] then
uniqueTypes[itemClassMap[itemClass.Id]] = itemClassMap[itemClass.Id]
out:write('["', itemClassMap[itemClass.Id], '"] = true, ')
end
end
end
out:write('}, ')
out:write('},\n')
end
end
out:write('}')
out:close()
Expand Down
11 changes: 7 additions & 4 deletions src/Export/statdesc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,12 @@ function describeStats(stats)
val[spec.v].max, val[spec.v].min = 100 - val[spec.v].min, 100 - val[spec.v].max
elseif spec.k == "negate_and_double" then
val[spec.v].max, val[spec.v].min = -2 * val[spec.v].min, -2 * val[spec.v].max
elseif spec.k == "passive_hash" and val[spec.v].min < 0 then
val[spec.v].min = val[spec.v].min + 65536
val[spec.v].max = val[spec.v].max + 65536
elseif spec.k == "passive_hash" then
-- handled elsewhere
if val[spec.v].min < 0 then
val[spec.v].min = val[spec.v].min + 65536
val[spec.v].max = val[spec.v].max + 65536
end
elseif spec.k == "divide_by_two_0dp" then
val[spec.v].min = val[spec.v].min / 2
val[spec.v].max = val[spec.v].max / 2
Expand Down Expand Up @@ -217,7 +220,7 @@ function describeStats(stats)
elseif spec.k == "milliseconds_to_seconds_0dp" then
val[spec.v].min = val[spec.v].min / 1000
val[spec.v].max = val[spec.v].max / 1000
elseif spec.k == "milliseconds_to_seconds_2dp_if_required" then
elseif spec.k == "milliseconds_to_seconds_2dp_if_required" or spec.k == "milliseconds_to_seconds_2dp" then
val[spec.v].min = round(val[spec.v].min / 1000, 2)
val[spec.v].max = round(val[spec.v].max / 1000, 2)
val[spec.v].fmt = "g"
Expand Down
21 changes: 20 additions & 1 deletion src/Modules/Data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ data.jewelRadius = data.setJewelRadiiGlobally(latestTreeVersion)
data.enchantmentSource = {
{ name = "ENKINDLING", label = "Enkindling Orb" },
{ name = "INSTILLING", label = "Instilling Orb" },
{ name = "RUNESMITH", label = "Runecraft Bench" },
{ name = "HEIST", label = "Heist" },
{ name = "HARVEST", label = "Harvest" },
{ name = "DEDICATION", label = "Dedication to the Goddess" },
Expand Down Expand Up @@ -555,8 +556,26 @@ data.enchantments = {
["Belt"] = LoadModule("Data/EnchantmentBelt"),
["Body Armour"] = LoadModule("Data/EnchantmentBody"),
["Weapon"] = LoadModule("Data/EnchantmentWeapon"),
["Flask"] = LoadModule("Data/EnchantmentFlask"),
["UtilityFlask"] = LoadModule("Data/EnchantmentFlask"),
}
do
data.enchantments["Flask"] = data.enchantments["UtilityFlask"]--["HARVEST"]
for baseType, _ in pairs(data.weaponTypeInfo) do
data.enchantments[baseType] = { }
for enchantmentType, enchantmentList in pairs(data.enchantments["Weapon"]) do
if type(enchantmentList[1]) == "string" then
data.enchantments[baseType][enchantmentType] = enchantmentList
elseif type(enchantmentList[1]) == "table" then
data.enchantments[baseType][enchantmentType] = {}
for _, enchantment in ipairs(enchantmentList) do
if enchantment.types[baseType] then
t_insert(data.enchantments[baseType][enchantmentType], table.concat(enchantment, "/"))
end
end
end
end
end
end
data.essences = LoadModule("Data/Essence")
data.veiledMods = LoadModule("Data/ModVeiled")
data.necropolisMods = LoadModule("Data/ModNecropolis")
Expand Down

0 comments on commit 996d33c

Please sign in to comment.