Skip to content

Commit 62e3c1f

Browse files
author
LocalIdentity
committed
Add support for Runes on Wand / Staff
GGG added more runes for wands and staves in the patch a couple weeks ago I don't particularly like how this is done as it requires more individual base checks each time a soul core or rune can go into a different base This becomes even more of a problem when trying to support the new talismans that can be socketed into gloves, boots, helmets, body armours and sceptres
1 parent 3b3d8f1 commit 62e3c1f

13 files changed

Lines changed: 182 additions & 60 deletions

File tree

src/Classes/Item.lua

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -791,26 +791,28 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
791791
end
792792
-- 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.
793793
if self.base then
794-
if self.base.weapon or self.base.armour then
794+
if self.base.weapon or self.base.armour or self.base.tags.wand or self.base.tags.staff then
795795
local shouldFixRunesOnItem = #self.runes == 0
796796

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

816818
-- Sort table to ensure first entries are always largest.
@@ -1192,7 +1194,7 @@ function ItemClass:BuildRaw()
11921194
if self.quality then
11931195
t_insert(rawLines, "Quality: " .. self.quality)
11941196
end
1195-
if self.itemSocketCount and self.itemSocketCount > 0 and (self.base.weapon or self.base.armour) then
1197+
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
11961198
local socketString = ""
11971199
for _ = 1, self.itemSocketCount do
11981200
socketString = socketString .. "S "
@@ -1252,7 +1254,7 @@ function ItemClass:UpdateRunes()
12521254
for i = 1, self.itemSocketCount do
12531255
local name = self.runes[i]
12541256
if name and name ~= "None" then
1255-
local mod = self.base.weapon and data.itemMods.Runes[name].weapon or self.base.armour and data.itemMods.Runes[name].armour or { }
1257+
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 { }
12561258
for i, line in ipairs(mod) do
12571259
local order = mod.statOrder[i]
12581260
if statOrder[order] then

src/Classes/ItemsTab.lua

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,11 @@ holding Shift will put it in the second.]])
366366

367367
-- Section: Sockets and Links
368368
self.controls.displayItemSectionSockets = new("Control", {"TOPLEFT",self.controls.displayItemSectionVariant,"BOTTOMLEFT"}, {0, 0, 0, function()
369-
return self.displayItem and (self.displayItem.base.weapon or self.displayItem.base.armour) and 28 or 0
369+
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
370370
end})
371371
self.controls.displayItemSocketRune = new("LabelControl", {"TOPLEFT",self.controls.displayItemSectionSockets,"TOPLEFT"}, {0, 0, 36, 20}, "^x7F7F7FS")
372372
self.controls.displayItemSocketRune.shown = function()
373-
return self.displayItem.base.weapon or self.displayItem.base.armour
373+
return self.displayItem.base.weapon or self.displayItem.base.armour or self.displayItem.base.tags.wand or self.displayItem.base.tags.staff
374374
end
375375
self.controls.displayItemSocketRuneEdit = new("EditControl", {"LEFT",self.controls.displayItemSocketRune,"RIGHT"}, {2, 0, 50, 20}, nil, nil, "%D", 1, function(buf)
376376
if tonumber(buf) > 6 then
@@ -501,7 +501,7 @@ holding Shift will put it in the second.]])
501501

502502
-- Section: Rune Selection
503503
self.controls.displayItemSectionRune = new("Control", {"TOPLEFT",self.controls.displayItemSectionClusterJewel,"BOTTOMLEFT"}, {0, 0, 0, function()
504-
if not self.displayItem or self.displayItem.itemSocketCount == 0 or not (self.displayItem.base.weapon or self.displayItem.base.armour) then
504+
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
505505
return 0
506506
end
507507
local h = 6
@@ -534,7 +534,7 @@ holding Shift will put it in the second.]])
534534
end
535535
end
536536
drop.shown = function()
537-
return self.displayItem and i <= self.displayItem.itemSocketCount and (self.displayItem.base.weapon or self.displayItem.base.armour)
537+
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)
538538
end
539539

540540
self.controls["displayItemRune"..i] = drop
@@ -1563,16 +1563,23 @@ end
15631563
-- build rune mod list for armour and weapons
15641564
local runeArmourModLines = { { name = "None", label = "None", order = -1 } }
15651565
local runeWeaponModLines = { { name = "None", label = "None", order = -1 } }
1566+
local runeCasterModLines = { { name = "None", label = "None", order = -1 } }
15661567
for name, modLines in pairs(data.itemMods.Runes) do
15671568
t_insert(runeArmourModLines, { name = name, label = modLines.armour[1], order = modLines.armour.statOrder[1]})
15681569
t_insert(runeWeaponModLines, { name = name, label = modLines.weapon[1], order = modLines.weapon.statOrder[1]})
1570+
if modLines.caster then
1571+
t_insert(runeCasterModLines, { name = name, label = modLines.caster[1], order = modLines.caster.statOrder[1]})
1572+
end
15691573
end
15701574
table.sort(runeArmourModLines, function(a, b)
15711575
return a.order < b.order
15721576
end)
15731577
table.sort(runeWeaponModLines, function(a, b)
15741578
return a.order < b.order
15751579
end)
1580+
table.sort(runeCasterModLines, function(a, b)
1581+
return a.order < b.order
1582+
end)
15761583
-- Update rune selection controls
15771584
function ItemsTabClass:UpdateRuneControls()
15781585
local item = self.displayItem
@@ -1581,6 +1588,8 @@ function ItemsTabClass:UpdateRuneControls()
15811588
self.controls["displayItemRune"..i].list = runeArmourModLines
15821589
elseif item.base.weapon then
15831590
self.controls["displayItemRune"..i].list = runeWeaponModLines
1591+
elseif item.base.tags.wand or item.base.tags.staff then
1592+
self.controls["displayItemRune"..i].list = runeCasterModLines
15841593
end
15851594
if item.runes[i] then
15861595
for j, modLine in ipairs(self.controls["displayItemRune"..i].list) do
@@ -1902,7 +1911,7 @@ function ItemsTabClass:CraftItem()
19021911
else
19031912
item.quality = nil
19041913
end
1905-
if base.base.socketLimit and (base.base.weapon or base.base.armour) then -- must be a martial weapon/armour
1914+
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
19061915
if #item.sockets == 0 then
19071916
for i = 1, base.base.socketLimit do
19081917
t_insert(item.sockets, { group = 0 })

src/Classes/TradeQueryGenerator.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ function TradeQueryGeneratorClass:InitMods()
419419
for name, modLines in pairs(data.itemMods.Runes) do
420420
self:ProcessMod(modLines.armour, tradeQueryStatsParsed, regularItemMask, { ["Shield"] = true, ["Chest"] = true, ["Helmet"] = true, ["Gloves"] = true, ["Boots"] = true, ["Focus"] = true })
421421
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 })
422+
self:ProcessMod(modLines.caster, tradeQueryStatsParsed, regularItemMask, { ["Wand"] = true, ["Staff"] = true })
422423
end
423424

424425
local queryModsFile = io.open(queryModFilePath, 'w')

src/Data/Bases/sceptre.lua

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ itemBases["Rattling Sceptre"] = {
66
type = "Sceptre",
77
quality = 20,
88
spirit = 100,
9+
socketLimit = 2,
910
tags = { default = true, onehand = true, sceptre = true, },
1011
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
1112
implicitModTypes = { },
@@ -15,6 +16,7 @@ itemBases["Stoic Sceptre"] = {
1516
type = "Sceptre",
1617
quality = 20,
1718
spirit = 100,
19+
socketLimit = 2,
1820
tags = { default = true, onehand = true, sceptre = true, },
1921
implicit = "Grants Skill: Level (1-20) Discipline",
2022
implicitModTypes = { },
@@ -24,6 +26,7 @@ itemBases["Lupine Sceptre"] = {
2426
type = "Sceptre",
2527
quality = 20,
2628
spirit = 100,
29+
socketLimit = 2,
2730
tags = { default = true, onehand = true, sceptre = true, },
2831
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
2932
implicitModTypes = { },
@@ -33,6 +36,7 @@ itemBases["Omen Sceptre"] = {
3336
type = "Sceptre",
3437
quality = 20,
3538
spirit = 100,
39+
socketLimit = 2,
3640
tags = { default = true, onehand = true, sceptre = true, },
3741
implicit = "Grants Skill: Level (1-20) Malice",
3842
implicitModTypes = { },
@@ -42,6 +46,7 @@ itemBases["Ochre Sceptre"] = {
4246
type = "Sceptre",
4347
quality = 20,
4448
spirit = 100,
49+
socketLimit = 2,
4550
tags = { default = true, onehand = true, sceptre = true, },
4651
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
4752
implicitModTypes = { },
@@ -51,6 +56,7 @@ itemBases["Shrine Sceptre"] = {
5156
type = "Sceptre",
5257
quality = 20,
5358
spirit = 100,
59+
socketLimit = 2,
5460
tags = { default = true, onehand = true, sceptre = true, },
5561
implicit = "Grants Skill: Level (1-20) Purity of Fire",
5662
implicitModTypes = { },
@@ -60,6 +66,7 @@ itemBases["Shrine Sceptre"] = {
6066
type = "Sceptre",
6167
quality = 20,
6268
spirit = 100,
69+
socketLimit = 2,
6370
tags = { default = true, onehand = true, sceptre = true, },
6471
implicit = "Grants Skill: Level (1-20) Purity of Ice",
6572
implicitModTypes = { },
@@ -69,6 +76,7 @@ itemBases["Shrine Sceptre"] = {
6976
type = "Sceptre",
7077
quality = 20,
7178
spirit = 100,
79+
socketLimit = 2,
7280
tags = { default = true, onehand = true, sceptre = true, },
7381
implicit = "Grants Skill: Level (1-20) Purity of Lightning",
7482
implicitModTypes = { },
@@ -78,6 +86,7 @@ itemBases["Devouring Sceptre"] = {
7886
type = "Sceptre",
7987
quality = 20,
8088
spirit = 100,
89+
socketLimit = 2,
8190
tags = { default = true, onehand = true, sceptre = true, },
8291
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
8392
implicitModTypes = { },
@@ -87,6 +96,7 @@ itemBases["Clasped Sceptre"] = {
8796
type = "Sceptre",
8897
quality = 20,
8998
spirit = 100,
99+
socketLimit = 2,
90100
tags = { default = true, onehand = true, sceptre = true, },
91101
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
92102
implicitModTypes = { },
@@ -96,6 +106,7 @@ itemBases["Devotional Sceptre"] = {
96106
type = "Sceptre",
97107
quality = 20,
98108
spirit = 100,
109+
socketLimit = 2,
99110
tags = { default = true, onehand = true, sceptre = true, },
100111
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
101112
implicitModTypes = { },
@@ -105,6 +116,7 @@ itemBases["Wrath Sceptre"] = {
105116
type = "Sceptre",
106117
quality = 20,
107118
spirit = 100,
119+
socketLimit = 2,
108120
tags = { default = true, onehand = true, sceptre = true, },
109121
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
110122
implicitModTypes = { },
@@ -114,6 +126,7 @@ itemBases["Aromatic Sceptre"] = {
114126
type = "Sceptre",
115127
quality = 20,
116128
spirit = 100,
129+
socketLimit = 2,
117130
tags = { default = true, onehand = true, sceptre = true, },
118131
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
119132
implicitModTypes = { },
@@ -123,6 +136,7 @@ itemBases["Pious Sceptre"] = {
123136
type = "Sceptre",
124137
quality = 20,
125138
spirit = 100,
139+
socketLimit = 2,
126140
tags = { default = true, onehand = true, sceptre = true, },
127141
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
128142
implicitModTypes = { },
@@ -132,6 +146,7 @@ itemBases["Hallowed Sceptre"] = {
132146
type = "Sceptre",
133147
quality = 20,
134148
spirit = 100,
149+
socketLimit = 2,
135150
tags = { default = true, onehand = true, sceptre = true, },
136151
implicit = "Grants Skill: Level (1-20) Skeletal Warrior Minion",
137152
implicitModTypes = { },
@@ -143,6 +158,7 @@ itemBases["Shrine Sceptre"] = {
143158
quality = 20,
144159
spirit = 100,
145160
hidden = true,
161+
socketLimit = 2,
146162
tags = { default = true, onehand = true, sceptre = true, },
147163
implicit = "Grants Skill: Level (1-20) Purity of Fire",
148164
implicitModTypes = { },
@@ -153,6 +169,7 @@ itemBases["Shrine Sceptre"] = {
153169
quality = 20,
154170
spirit = 100,
155171
hidden = true,
172+
socketLimit = 2,
156173
tags = { default = true, onehand = true, sceptre = true, },
157174
implicit = "Grants Skill: Level (1-20) Purity of Ice",
158175
implicitModTypes = { },
@@ -163,6 +180,7 @@ itemBases["Shrine Sceptre"] = {
163180
quality = 20,
164181
spirit = 100,
165182
hidden = true,
183+
socketLimit = 2,
166184
tags = { default = true, onehand = true, sceptre = true, },
167185
implicit = "Grants Skill: Level (1-20) Purity of Lightning",
168186
implicitModTypes = { },
@@ -173,6 +191,7 @@ itemBases["Shrine Sceptre (Purity of Fire)"] = {
173191
type = "Sceptre",
174192
quality = 20,
175193
spirit = 100,
194+
socketLimit = 2,
176195
tags = { default = true, onehand = true, sceptre = true, },
177196
implicit = "Grants Skill: Level (1-20) Purity of Fire",
178197
implicitModTypes = { },
@@ -182,6 +201,7 @@ itemBases["Shrine Sceptre (Purity of Cold)"] = {
182201
type = "Sceptre",
183202
quality = 20,
184203
spirit = 100,
204+
socketLimit = 2,
185205
tags = { default = true, onehand = true, sceptre = true, },
186206
implicit = "Grants Skill: Level (1-20) Purity of Ice",
187207
implicitModTypes = { },
@@ -191,6 +211,7 @@ itemBases["Shrine Sceptre (Purity of Lighting)"] = {
191211
type = "Sceptre",
192212
quality = 20,
193213
spirit = 100,
214+
socketLimit = 2,
194215
tags = { default = true, onehand = true, sceptre = true, },
195216
implicit = "Grants Skill: Level (1-20) Purity of Lightning",
196217
implicitModTypes = { },

0 commit comments

Comments
 (0)