Skip to content

Add support for Runes on Wand / Staff #1125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -791,26 +791,28 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
end
-- this will need more advanced logic for jewel sockets in items to work properly but could just be removed as items like this was only introduced during development.
if self.base then
if self.base.weapon or self.base.armour then
if self.base.weapon or self.base.armour or self.base.tags.wand or self.base.tags.staff then
local shouldFixRunesOnItem = #self.runes == 0

-- Form a key value table with the following format
-- { [strippedModLine] = { { runeName1, runeValue1 }, etc, }, etc}
-- This will be used to more easily grab the relevant runes that combinations will need to be of.
-- This could be refactored to only needs to be called once.
local statGroupedRunes = { }
local type = self.base.weapon and "weapon" or "armour" -- minor optimisation
local type = self.base.weapon and "weapon" or (self.base.tags.wand or self.base.tags.staff ) and "caster" or "armour" -- minor optimisation
for runeName, runeMods in pairs(data.itemMods.Runes) do
-- gets the first value in the mod and its stripped line.
local runeValue
local runeStrippedModeLine = runeMods[type][1]:gsub("(%d%.?%d*)", function(val)
runeValue = val
return "#"
end)
if statGroupedRunes[runeStrippedModeLine] == nil then
statGroupedRunes[runeStrippedModeLine] = { }
if runeMods[type] then -- Check to make sure rune mod exists for base type
-- gets the first value in the mod and its stripped line.
local runeValue
local runeStrippedModeLine = runeMods[type][1]:gsub("(%d%.?%d*)", function(val)
runeValue = val
return "#"
end)
if statGroupedRunes[runeStrippedModeLine] == nil then
statGroupedRunes[runeStrippedModeLine] = { }
end
t_insert(statGroupedRunes[runeStrippedModeLine], { runeName, runeValue });
end
t_insert(statGroupedRunes[runeStrippedModeLine], { runeName, runeValue });
end

-- Sort table to ensure first entries are always largest.
Expand Down Expand Up @@ -1192,7 +1194,7 @@ function ItemClass:BuildRaw()
if self.quality then
t_insert(rawLines, "Quality: " .. self.quality)
end
if self.itemSocketCount and self.itemSocketCount > 0 and (self.base.weapon or self.base.armour) then
if self.itemSocketCount and self.itemSocketCount > 0 and (self.base.weapon or self.base.armour or self.base.tags.wand or self.base.tags.staff) then
local socketString = ""
for _ = 1, self.itemSocketCount do
socketString = socketString .. "S "
Expand Down Expand Up @@ -1252,7 +1254,7 @@ function ItemClass:UpdateRunes()
for i = 1, self.itemSocketCount do
local name = self.runes[i]
if name and name ~= "None" then
local mod = self.base.weapon and data.itemMods.Runes[name].weapon or self.base.armour and data.itemMods.Runes[name].armour or { }
local mod = self.base.weapon and data.itemMods.Runes[name].weapon or self.base.armour and data.itemMods.Runes[name].armour or (item.base.tags.wand or item.base.tags.staff) and data.itemMods.Runes[name].caster or { }
for i, line in ipairs(mod) do
local order = mod.statOrder[i]
if statOrder[order] then
Expand Down
19 changes: 14 additions & 5 deletions src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,11 @@ holding Shift will put it in the second.]])

-- Section: Sockets and Links
self.controls.displayItemSectionSockets = new("Control", {"TOPLEFT",self.controls.displayItemSectionVariant,"BOTTOMLEFT"}, {0, 0, 0, function()
return self.displayItem and (self.displayItem.base.weapon or self.displayItem.base.armour) and 28 or 0
return self.displayItem and (self.displayItem.base.weapon or self.displayItem.base.armour or self.displayItem.base.tags.wand or self.displayItem.base.tags.staff) and 28 or 0
end})
self.controls.displayItemSocketRune = new("LabelControl", {"TOPLEFT",self.controls.displayItemSectionSockets,"TOPLEFT"}, {0, 0, 36, 20}, "^x7F7F7FS")
self.controls.displayItemSocketRune.shown = function()
return self.displayItem.base.weapon or self.displayItem.base.armour
return self.displayItem.base.weapon or self.displayItem.base.armour or self.displayItem.base.tags.wand or self.displayItem.base.tags.staff
end
self.controls.displayItemSocketRuneEdit = new("EditControl", {"LEFT",self.controls.displayItemSocketRune,"RIGHT"}, {2, 0, 50, 20}, nil, nil, "%D", 1, function(buf)
if tonumber(buf) > 6 then
Expand Down Expand Up @@ -501,7 +501,7 @@ holding Shift will put it in the second.]])

-- Section: Rune Selection
self.controls.displayItemSectionRune = new("Control", {"TOPLEFT",self.controls.displayItemSectionClusterJewel,"BOTTOMLEFT"}, {0, 0, 0, function()
if not self.displayItem or self.displayItem.itemSocketCount == 0 or not (self.displayItem.base.weapon or self.displayItem.base.armour) then
if not self.displayItem or self.displayItem.itemSocketCount == 0 or not (self.displayItem.base.weapon or self.displayItem.base.armour or self.displayItem.base.tags.wand or self.displayItem.base.tags.staff) then
return 0
end
local h = 6
Expand Down Expand Up @@ -534,7 +534,7 @@ holding Shift will put it in the second.]])
end
end
drop.shown = function()
return self.displayItem and i <= self.displayItem.itemSocketCount and (self.displayItem.base.weapon or self.displayItem.base.armour)
return self.displayItem and i <= self.displayItem.itemSocketCount and (self.displayItem.base.weapon or self.displayItem.base.armour or self.displayItem.base.tags.wand or self.displayItem.base.tags.staff)
end

self.controls["displayItemRune"..i] = drop
Expand Down Expand Up @@ -1563,16 +1563,23 @@ end
-- build rune mod list for armour and weapons
local runeArmourModLines = { { name = "None", label = "None", order = -1 } }
local runeWeaponModLines = { { name = "None", label = "None", order = -1 } }
local runeCasterModLines = { { name = "None", label = "None", order = -1 } }
for name, modLines in pairs(data.itemMods.Runes) do
t_insert(runeArmourModLines, { name = name, label = modLines.armour[1], order = modLines.armour.statOrder[1]})
t_insert(runeWeaponModLines, { name = name, label = modLines.weapon[1], order = modLines.weapon.statOrder[1]})
if modLines.caster then
t_insert(runeCasterModLines, { name = name, label = modLines.caster[1], order = modLines.caster.statOrder[1]})
end
end
table.sort(runeArmourModLines, function(a, b)
return a.order < b.order
end)
table.sort(runeWeaponModLines, function(a, b)
return a.order < b.order
end)
table.sort(runeCasterModLines, function(a, b)
return a.order < b.order
end)
-- Update rune selection controls
function ItemsTabClass:UpdateRuneControls()
local item = self.displayItem
Expand All @@ -1581,6 +1588,8 @@ function ItemsTabClass:UpdateRuneControls()
self.controls["displayItemRune"..i].list = runeArmourModLines
elseif item.base.weapon then
self.controls["displayItemRune"..i].list = runeWeaponModLines
elseif item.base.tags.wand or item.base.tags.staff then
self.controls["displayItemRune"..i].list = runeCasterModLines
end
if item.runes[i] then
for j, modLine in ipairs(self.controls["displayItemRune"..i].list) do
Expand Down Expand Up @@ -1902,7 +1911,7 @@ function ItemsTabClass:CraftItem()
else
item.quality = nil
end
if base.base.socketLimit and (base.base.weapon or base.base.armour) then -- must be a martial weapon/armour
if base.base.socketLimit and (base.base.weapon or base.base.armour or base.base.tags.wand or base.base.tags.staff) then -- must be a martial weapon/armour
if #item.sockets == 0 then
for i = 1, base.base.socketLimit do
t_insert(item.sockets, { group = 0 })
Expand Down
1 change: 1 addition & 0 deletions src/Classes/TradeQueryGenerator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ function TradeQueryGeneratorClass:InitMods()
for name, modLines in pairs(data.itemMods.Runes) do
self:ProcessMod(modLines.armour, tradeQueryStatsParsed, regularItemMask, { ["Shield"] = true, ["Chest"] = true, ["Helmet"] = true, ["Gloves"] = true, ["Boots"] = true, ["Focus"] = true })
self:ProcessMod(modLines.weapon, tradeQueryStatsParsed, regularItemMask, { ["1HWeapon"] = true, ["2HWeapon"] = true, ["1HMace"] = true, ["Claw"] = true, ["Quarterstaff"] = true, ["Bow"] = true, ["2HMace"] = true, ["Crossbow"] = true, ["Spear"] = true, ["Flail"] = true })
self:ProcessMod(modLines.caster, tradeQueryStatsParsed, regularItemMask, { ["Wand"] = true, ["Staff"] = true })
end

local queryModsFile = io.open(queryModFilePath, 'w')
Expand Down
21 changes: 21 additions & 0 deletions src/Data/Bases/sceptre.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ itemBases["Rattling Sceptre"] = {
type = "Sceptre",
quality = 20,
spirit = 100,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
implicitModTypes = { },
Expand All @@ -15,6 +16,7 @@ itemBases["Stoic Sceptre"] = {
type = "Sceptre",
quality = 20,
spirit = 100,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Discipline",
implicitModTypes = { },
Expand All @@ -24,6 +26,7 @@ itemBases["Lupine Sceptre"] = {
type = "Sceptre",
quality = 20,
spirit = 100,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
implicitModTypes = { },
Expand All @@ -33,6 +36,7 @@ itemBases["Omen Sceptre"] = {
type = "Sceptre",
quality = 20,
spirit = 100,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Malice",
implicitModTypes = { },
Expand All @@ -42,6 +46,7 @@ itemBases["Ochre Sceptre"] = {
type = "Sceptre",
quality = 20,
spirit = 100,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
implicitModTypes = { },
Expand All @@ -51,6 +56,7 @@ itemBases["Shrine Sceptre"] = {
type = "Sceptre",
quality = 20,
spirit = 100,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Purity of Fire",
implicitModTypes = { },
Expand All @@ -60,6 +66,7 @@ itemBases["Shrine Sceptre"] = {
type = "Sceptre",
quality = 20,
spirit = 100,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Purity of Ice",
implicitModTypes = { },
Expand All @@ -69,6 +76,7 @@ itemBases["Shrine Sceptre"] = {
type = "Sceptre",
quality = 20,
spirit = 100,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Purity of Lightning",
implicitModTypes = { },
Expand All @@ -78,6 +86,7 @@ itemBases["Devouring Sceptre"] = {
type = "Sceptre",
quality = 20,
spirit = 100,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
implicitModTypes = { },
Expand All @@ -87,6 +96,7 @@ itemBases["Clasped Sceptre"] = {
type = "Sceptre",
quality = 20,
spirit = 100,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
implicitModTypes = { },
Expand All @@ -96,6 +106,7 @@ itemBases["Devotional Sceptre"] = {
type = "Sceptre",
quality = 20,
spirit = 100,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
implicitModTypes = { },
Expand All @@ -105,6 +116,7 @@ itemBases["Wrath Sceptre"] = {
type = "Sceptre",
quality = 20,
spirit = 100,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
implicitModTypes = { },
Expand All @@ -114,6 +126,7 @@ itemBases["Aromatic Sceptre"] = {
type = "Sceptre",
quality = 20,
spirit = 100,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
implicitModTypes = { },
Expand All @@ -123,6 +136,7 @@ itemBases["Pious Sceptre"] = {
type = "Sceptre",
quality = 20,
spirit = 100,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
implicitModTypes = { },
Expand All @@ -132,6 +146,7 @@ itemBases["Hallowed Sceptre"] = {
type = "Sceptre",
quality = 20,
spirit = 100,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
implicitModTypes = { },
Expand All @@ -143,6 +158,7 @@ itemBases["Shrine Sceptre"] = {
quality = 20,
spirit = 100,
hidden = true,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Purity of Fire",
implicitModTypes = { },
Expand All @@ -153,6 +169,7 @@ itemBases["Shrine Sceptre"] = {
quality = 20,
spirit = 100,
hidden = true,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Purity of Ice",
implicitModTypes = { },
Expand All @@ -163,6 +180,7 @@ itemBases["Shrine Sceptre"] = {
quality = 20,
spirit = 100,
hidden = true,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Purity of Lightning",
implicitModTypes = { },
Expand All @@ -173,6 +191,7 @@ itemBases["Shrine Sceptre (Purity of Fire)"] = {
type = "Sceptre",
quality = 20,
spirit = 100,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Purity of Fire",
implicitModTypes = { },
Expand All @@ -182,6 +201,7 @@ itemBases["Shrine Sceptre (Purity of Cold)"] = {
type = "Sceptre",
quality = 20,
spirit = 100,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Purity of Ice",
implicitModTypes = { },
Expand All @@ -191,6 +211,7 @@ itemBases["Shrine Sceptre (Purity of Lighting)"] = {
type = "Sceptre",
quality = 20,
spirit = 100,
socketLimit = 2,
tags = { default = true, onehand = true, sceptre = true, },
implicit = "Grants Skill: Level (1-20) Purity of Lightning",
implicitModTypes = { },
Expand Down
Loading