diff --git a/libs/StatLogic/Cata_Logic.lua b/libs/StatLogic/Cata_Logic.lua index f0513d5..4cf47a6 100644 --- a/libs/StatLogic/Cata_Logic.lua +++ b/libs/StatLogic/Cata_Logic.lua @@ -2325,7 +2325,7 @@ if addon.playerRace == "Dwarf" then [StatLogic.Stats.Expertise] = { { ["value"] = 3, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Mace1H] = true, [Enum.ItemWeaponSubclass.Mace2H] = true, } @@ -2334,7 +2334,7 @@ if addon.playerRace == "Dwarf" then [StatLogic.Stats.RangedCrit] = { { ["value"] = 1, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Guns] = true, } } @@ -2352,7 +2352,7 @@ elseif addon.playerRace == "Gnome" then [StatLogic.Stats.Expertise] = { { ["value"] = 3, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Dagger] = true, [Enum.ItemWeaponSubclass.Sword1H] = true, } @@ -2371,7 +2371,7 @@ elseif addon.playerRace == "Human" then [StatLogic.Stats.Expertise] = { { ["value"] = 3, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Mace1H] = true, [Enum.ItemWeaponSubclass.Mace2H] = true, [Enum.ItemWeaponSubclass.Sword1H] = true, @@ -2385,7 +2385,7 @@ elseif addon.playerRace == "Orc" then [StatLogic.Stats.Expertise] = { { ["value"] = 3, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Axe1H] = true, [Enum.ItemWeaponSubclass.Axe2H] = true, [Enum.ItemWeaponSubclass.Unarmed] = true, @@ -2413,7 +2413,7 @@ elseif addon.playerRace == "Troll" then [StatLogic.Stats.RangedCrit] = { { ["value"] = 1, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Bows] = true, [Enum.ItemWeaponSubclass.Thrown] = true, } diff --git a/libs/StatLogic/StatLogic.lua b/libs/StatLogic/StatLogic.lua index cef5ed4..134c397 100644 --- a/libs/StatLogic/StatLogic.lua +++ b/libs/StatLogic/StatLogic.lua @@ -91,7 +91,7 @@ local tocversion = select(4, GetBuildInfo()) -- metatable for stat tables local statTableMetatable = { __index = function(_, k) - if k ~= "subclassID" then + if k ~= "weaponSubclass" then return 0 end end, @@ -166,7 +166,7 @@ end ---@field link string ---@field numLines integer ---@field inventoryType string ----@field subclassID Enum.ItemWeaponSubclass? +---@field weaponSubclass Enum.ItemWeaponSubclass? ---@field [Stat] number -- New table @@ -835,12 +835,12 @@ function addon.GenerateWeaponSubclassStats() for _, modList in pairs(StatLogic.StatModTable) do for stat, cases in pairs(modList) do for _, case in ipairs(cases) do - if case.weapon then - for subclassID in pairs(case.weapon) do - if not addon.WeaponSubclassStats[subclassID] then - addon.WeaponSubclassStats[subclassID] = {} + if case.weaponSubclass then + for weaponSubclass in pairs(case.weaponSubclass) do + if not addon.WeaponSubclassStats[weaponSubclass] then + addon.WeaponSubclassStats[weaponSubclass] = {} end - addon.WeaponSubclassStats[subclassID][stat] = true + addon.WeaponSubclassStats[weaponSubclass][stat] = true end end end @@ -1093,18 +1093,18 @@ addon.StatModValidators = { ["PLAYER_TALENT_UPDATE"] = true, }, }, - weapon = { + weaponSubclass = { validate = function(case, _, statModContext) - local subclassID + local weaponSubclass if statModContext then - subclassID = statModContext.overrideStats.subclassID + weaponSubclass = statModContext.overrideStats.weaponSubclass else local weapon = GetInventoryItemID("player", INVSLOT_MAINHAND) if weapon then - subclassID = select(7, C_Item.GetItemInfoInstant(weapon)) + weaponSubclass = select(7, C_Item.GetItemInfoInstant(weapon)) end end - return subclassID and case.weapon[subclassID] or false + return weaponSubclass and case.weaponSubclassSubclass[weaponSubclass] or false end, events = { ["UNIT_INVENTORY_CHANGED"] = "player", @@ -1164,7 +1164,7 @@ do end local function ValidateStatMod(statModName, case, statModContext) - if statModContext.overrideStats.subclassID and not case.weapon then + if statModContext.overrideStats.weaponSubclass and not case.weaponSubclass then -- If we're passed a weapon type, we're only interested in StatMods with weapon cases return false end @@ -1180,7 +1180,7 @@ local function ValidateStatMod(statModName, case, statModContext) end addon.StatModCacheInvalidators[key] = addon.StatModCacheInvalidators[key] or {} table.insert(addon.StatModCacheInvalidators[key], statModName) - if case.weapon then + if case.weaponSubclass then WeaponSubclassInvalidators[key] = true end end @@ -1861,7 +1861,7 @@ do if not statModContext then statModContext = StatLogic:NewStatModContext() end - statModContext.overrideStats["subclassID"] = itemSubclass + statModContext.overrideStats["weaponSubclass"] = itemSubclass local statMods = addon.WeaponSubclassStats[itemSubclass] if statMods then for statMod in pairs(statMods) do @@ -1870,7 +1870,7 @@ do end end -- Unset afterwards to prevent interference with ValidateStatMod - statModContext.overrideStats["subclassID"] = nil + statModContext.overrideStats["weaponSubclass"] = nil end log(link) diff --git a/libs/StatLogic/TBC_Logic.lua b/libs/StatLogic/TBC_Logic.lua index 97cc9fa..3f6d3e5 100644 --- a/libs/StatLogic/TBC_Logic.lua +++ b/libs/StatLogic/TBC_Logic.lua @@ -1153,7 +1153,7 @@ elseif addon.class == "ROGUE" then ["rank"] = { 1, 2, 3, 4, 5, }, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Dagger] = true, }, }, @@ -1164,7 +1164,7 @@ elseif addon.class == "ROGUE" then ["rank"] = { 1, 2, 3, 4, 5, }, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Unarmed] = true, }, }, @@ -1543,7 +1543,7 @@ elseif addon.class == "WARRIOR" then ["rank"] = { 1, 2, 3, 4, 5, }, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Axe1H] = true, [Enum.ItemWeaponSubclass.Axe2H] = true, [Enum.ItemWeaponSubclass.Polearm] = true, @@ -1558,7 +1558,7 @@ if addon.playerRace == "Dwarf" then [StatLogic.Stats.RangedCrit] = { { ["value"] = 1, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Guns] = true, } } @@ -1606,7 +1606,7 @@ elseif addon.playerRace == "Human" then [StatLogic.Stats.Expertise] = { { ["value"] = 5, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Mace1H] = true, [Enum.ItemWeaponSubclass.Mace2H] = true, [Enum.ItemWeaponSubclass.Sword1H] = true, @@ -1620,7 +1620,7 @@ elseif addon.playerRace == "Orc" then [StatLogic.Stats.Expertise] = { { ["value"] = 5, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Axe1H] = true, [Enum.ItemWeaponSubclass.Axe2H] = true, } @@ -1647,7 +1647,7 @@ elseif addon.playerRace == "Troll" then [StatLogic.Stats.RangedCrit] = { { ["value"] = 1, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Bows] = true, [Enum.ItemWeaponSubclass.Thrown] = true, } diff --git a/libs/StatLogic/Vanilla_Logic.lua b/libs/StatLogic/Vanilla_Logic.lua index 4ac3c93..5694ad1 100644 --- a/libs/StatLogic/Vanilla_Logic.lua +++ b/libs/StatLogic/Vanilla_Logic.lua @@ -896,7 +896,7 @@ elseif addon.class == "ROGUE" then ["rank"] = { 1, 2, 3, 4, 5, }, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Dagger] = true, }, }, @@ -907,7 +907,7 @@ elseif addon.class == "ROGUE" then ["rank"] = { 1, 2, 3, 4, 5, }, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Unarmed] = true, }, }, @@ -916,7 +916,7 @@ elseif addon.class == "ROGUE" then ["set"] = 1829, ["pieces"] = 3, ["value"] = 5, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Dagger] = true, }, }, @@ -929,7 +929,7 @@ elseif addon.class == "ROGUE" then ["rank"] = { 1, 2, 3, 4, 5, }, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Mace1H] = true, }, }, @@ -940,7 +940,7 @@ elseif addon.class == "ROGUE" then ["rank"] = { 3, 5, }, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Sword1H] = true, [Enum.ItemWeaponSubclass.Dagger] = true, [Enum.ItemWeaponSubclass.Unarmed] = true, @@ -1328,7 +1328,7 @@ elseif addon.class == "WARRIOR" then ["rank"] = { 1, 2, 3, 4, 5, }, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Axe1H] = true, [Enum.ItemWeaponSubclass.Axe2H] = true, }, @@ -1340,7 +1340,7 @@ elseif addon.class == "WARRIOR" then ["rank"] = { 1, 2, 3, 4, 5, }, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Polearm] = true, }, }, @@ -1379,7 +1379,7 @@ if addon.playerRace == "Dwarf" then [StatLogic.Stats.WeaponSkill] = { { ["value"] = 5, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Guns] = true, }, ["group"] = addon.ExclusiveGroup.WeaponRacial, @@ -1418,7 +1418,7 @@ elseif addon.playerRace == "Human" then [StatLogic.Stats.WeaponSkill] = { { ["value"] = 5, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Mace1H] = true, [Enum.ItemWeaponSubclass.Mace2H] = true, [Enum.ItemWeaponSubclass.Sword1H] = true, @@ -1433,7 +1433,7 @@ elseif addon.playerRace == "Orc" then [StatLogic.Stats.WeaponSkill] = { { ["value"] = 5, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Axe1H] = true, [Enum.ItemWeaponSubclass.Axe2H] = true, }, @@ -1461,7 +1461,7 @@ elseif addon.playerRace == "Troll" then [StatLogic.Stats.WeaponSkill] = { { ["value"] = 5, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Bows] = true, [Enum.ItemWeaponSubclass.Thrown] = true, }, @@ -1706,7 +1706,7 @@ StatLogic.StatModTable["ALL"] = { { ["rune"] = 51232, ["value"] = 5, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Sword1H] = true, [Enum.ItemWeaponSubclass.Sword2H] = true, }, @@ -1716,7 +1716,7 @@ StatLogic.StatModTable["ALL"] = { { ["rune"] = 51233, ["value"] = 5, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Axe1H] = true, [Enum.ItemWeaponSubclass.Axe2H] = true, }, @@ -1726,7 +1726,7 @@ StatLogic.StatModTable["ALL"] = { { ["rune"] = 51234, ["value"] = 5, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Mace1H] = true, [Enum.ItemWeaponSubclass.Mace2H] = true, }, @@ -1736,7 +1736,7 @@ StatLogic.StatModTable["ALL"] = { { ["rune"] = 51235, ["value"] = 5, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Dagger] = true, }, ["group"] = addon.ExclusiveGroup.WeaponRacial, @@ -1745,7 +1745,7 @@ StatLogic.StatModTable["ALL"] = { { ["rune"] = 51236, ["value"] = 5, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Unarmed] = true, }, ["group"] = addon.ExclusiveGroup.WeaponRacial, @@ -1754,7 +1754,7 @@ StatLogic.StatModTable["ALL"] = { { ["rune"] = 51237, ["value"] = 5, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Bows] = true, [Enum.ItemWeaponSubclass.Guns] = true, [Enum.ItemWeaponSubclass.Crossbow] = true, @@ -1766,7 +1766,7 @@ StatLogic.StatModTable["ALL"] = { { ["rune"] = 51238, ["value"] = 5, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Staff] = true, [Enum.ItemWeaponSubclass.Polearm] = true, }, diff --git a/libs/StatLogic/Wrath_Logic.lua b/libs/StatLogic/Wrath_Logic.lua index 563d321..61fba90 100644 --- a/libs/StatLogic/Wrath_Logic.lua +++ b/libs/StatLogic/Wrath_Logic.lua @@ -2466,7 +2466,7 @@ elseif addon.class == "ROGUE" then ["rank"] = { 1, 2, 3, 4, 5, }, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Dagger] = true, [Enum.ItemWeaponSubclass.Unarmed] = true, }, @@ -2920,7 +2920,7 @@ elseif addon.class == "WARRIOR" then ["rank"] = { 1, 2, 3, 4, 5, }, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Axe1H] = true, [Enum.ItemWeaponSubclass.Axe2H] = true, [Enum.ItemWeaponSubclass.Polearm] = true, @@ -2935,7 +2935,7 @@ if addon.playerRace == "Dwarf" then [StatLogic.Stats.Expertise] = { { ["value"] = 5, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Mace1H] = true, [Enum.ItemWeaponSubclass.Mace2H] = true, } @@ -2944,7 +2944,7 @@ if addon.playerRace == "Dwarf" then [StatLogic.Stats.RangedCrit] = { { ["value"] = 1, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Guns] = true, } } @@ -2974,7 +2974,7 @@ elseif addon.playerRace == "Human" then [StatLogic.Stats.Expertise] = { { ["value"] = 3, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Mace1H] = true, [Enum.ItemWeaponSubclass.Mace2H] = true, [Enum.ItemWeaponSubclass.Sword1H] = true, @@ -2988,7 +2988,7 @@ elseif addon.playerRace == "Orc" then [StatLogic.Stats.Expertise] = { { ["value"] = 5, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Axe1H] = true, [Enum.ItemWeaponSubclass.Axe2H] = true, [Enum.ItemWeaponSubclass.Unarmed] = true, @@ -3016,7 +3016,7 @@ elseif addon.playerRace == "Troll" then [StatLogic.Stats.RangedCrit] = { { ["value"] = 1, - ["weapon"] = { + ["weaponSubclass"] = { [Enum.ItemWeaponSubclass.Bows] = true, [Enum.ItemWeaponSubclass.Thrown] = true, }