Skip to content
Merged
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
34 changes: 34 additions & 0 deletions spec/System/TestImport_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,40 @@ Implicits: 0]])
end)
end

it("keeps Wickerman items separate through import and save/load", function()
-- Live OAuth structure and Lesser names; IDs and boundary-case rolls are synthetic.
local examples = {
{ "Ravenous Skull", "Ravenous Skull", "Head", "Every 3 seconds, Consume a Corpse within 5 metres to Recover 4% of Life" },
{ "Lesser Warden's Arm", "Warden's Arm", "Arm", "+43 to maximum Life" },
{ "Greater Sirus' Head", "Sirus' Head", "Head", "+10 to Strength" },
{ "Lesser Blackened Lungs", "Blackened Lungs", "Body", "12% increased Warcry Speed", "VisceraBody" },
{ "Lesser Pocked Leg", "Pocked Leg", "Leg", "20% increased Armour from Equipped Helmet and Gloves", "VisceraLeg" },
{ "Artificial Appendage", "Artificial Appendage", "Arm", "25% increased Effect of Chill" },
{ "Artificial Appendage", "Artificial Appendage", "Arm", "18% increased Area of Effect for Attacks" },
{ "Artificial Appendage", "Artificial Appendage", "Arm", "Minions have 30% increased Critical Strike Chance" },
}
local equipped, items = { }, { }
for i, example in ipairs(examples) do
local slot = example[2]
local item = { id = "synthetic-wickerman-" .. i, name = "", typeLine = example[1], baseType = example[1], frameType = 15, ilvl = 83,
inventoryId = example[5] or (example[2] == "Head" and "VisceraHead" or "VisceraArm"), implicitMods = { { description = example[4] } } }
table.insert(items, item)
equipped[slot] = item.id
end
local character = { level = 80, equipment = { }, wickerman = items }
build.importTab:ImportItemsAndSkills(character, true, false)
build.importTab:ImportItemsAndSkills(character, false, false) -- Replace only matching IDs.
loadBuildFromXML(build:SaveDB("code"))
assert.equals(#examples, #build.itemsTab.itemOrderList)
for i, example in ipairs(examples) do
local item = build.itemsTab.items[build.itemsTab.itemOrderList[i]]
assert.equals("synthetic-wickerman-" .. i, item.uniqueID)
assert.equals(example[2], item.baseName)
assert.equals("NORMAL", item.rarity)
assert.equals("Viscera", item.type)
assert.equals(example[4], item.implicitModLines[1].line)
end
end)
local function characterWithImbuedSupport(name)
local character = copyTable(sampleData, true)
for _, item in ipairs(character.equipment) do
Expand Down
2 changes: 1 addition & 1 deletion spec/System/TestItemDBControl_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ describe("ItemDBControl", function()
control.controls.slot:SelByValue("Graft 2")
assert.are.equal("Graft 2", control.slotList[control.controls.slot.selIndex])
local lastIndex = control.controls.slot.selIndex
for _, slotName in ipairs({ "Wickerman Head", "Wickerman Torso", "Wickerman Upper Limb", "Wickerman Lower Limb" }) do
for _, slotName in ipairs({ "Head", "Body", "Arm", "Leg" }) do
control.controls.slot:SelByValue(slotName)
assert.are.equal(lastIndex + 1, control.controls.slot.selIndex)
assert.is_false(control:DoesItemMatchFilters(item))
Expand Down
45 changes: 45 additions & 0 deletions spec/System/TestItemParse_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,51 @@ describe("TestItemParse", function()
return "Rarity: Rare\nName\n"..base.."\n"..s
end

it("pastes Viscera names and implicit rolls without adding item descriptions as modifiers", function()
newBuild()
local cases = {
{ "Greater Gladiator's Heart", "Gladiator's Heart", "Greater ", "Torso" }, -- Live clipboard sample.
{ "Lesser Gladiator's Heart", "Gladiator's Heart", "Lesser ", "Torso" }, -- Synthetic unlisted name.
{ "Gladiator's Heart", "Gladiator's Heart", "", "Torso" },
{ "Greater Sirus' Head", "Sirus' Head", "Greater ", "Head" }, -- Exact base takes precedence.
{ "Experimental Gladiator's Heart", "Gladiator's Heart", "Experimental ", "Torso" }, -- Synthetic unknown prefix.
{ "Lesser Warden's Arm", "Warden's Arm", "Lesser ", "Upper Limb" },
{ "Lesser Pocked Leg", "Pocked Leg", "Lesser ", "Lower Limb" },
}
for _, example in ipairs(cases) do
local text = "Item Class: Viscera\n" .. example[1] .. "\n" .. [[
--------
]] .. example[4] .. "\n" .. [[
--------
Item Level: 69
--------
{ Implicit Modifier }
+6(5-7) to Maximum Rage
(Every Rage grants 1% more Attack Damage. Maximum Rage is 30. Lose 10 Rage per second if you have not been Hit or gained Rage in the last 2 seconds)
--------
Take this to the Wickerman in a town or hideout to attach it.
]]
build.itemsTab.displayItem = nil
build.itemsTab:CreateDisplayItemFromRaw(text, true)
local item = assert(build.itemsTab.displayItem)
assert.equals("NORMAL", item.rarity)
assert.equals(example[1], item.name)
assert.equals(example[2], item.baseName)
assert.equals(example[3], item.namePrefix)
assert.equals("Viscera", item.type)
assert.equals(69, item.itemLevel)
assert.equals(1, #item.implicitModLines)
assert.equals("+(5-7) to Maximum Rage", item.implicitModLines[1].line)
assert.equals(0.5, item.implicitModLines[1].range)
assert.equals(0, #item.explicitModLines)
local saved = new("Item"):Item(item:BuildRaw())
assert.equals(example[1], saved.name)
assert.equals(example[2], saved.baseName)
assert.equals(1, #saved.implicitModLines)
assert.equals(0.5, saved.implicitModLines[1].range)
end
end)

it("Rarity", function()
local item = new("Item"):Item("Rarity: Normal\nCoral Ring")
assert.are.equals("NORMAL", item.rarity)
Expand Down
12 changes: 10 additions & 2 deletions src/Classes/ImportTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,7 @@ end

--- @class CharacterItemsData : CharacterBasicData
--- @field equipment GGGItem[]
--- @field wickerman? GGGItem[]
--- @param charData CharacterItemsData
--- @param clearItems boolean
--- @param clearSkills boolean
Expand Down Expand Up @@ -1422,6 +1423,9 @@ function ImportTabClass:ImportItemsAndSkills(charData, clearItems, clearSkills,
end
self:AssignGuardianItemSet(guardianSet.id)
end
for _, itemData in ipairs(charData.wickerman or { }) do
self:ImportItem(itemData)
end
if skillOrder then
local groupOrder = { }
for index, socketGroup in ipairs(self.build.skillsTab.socketGroupList) do
Expand Down Expand Up @@ -1490,9 +1494,10 @@ function ImportTabClass:ImportItemsAndSkills(charData, clearItems, clearSkills,
return charData, colorCodes.POSITIVE .. "Items and skills successfully imported."
end

local rarityMap = { [0] = "NORMAL", "MAGIC", "RARE", "UNIQUE", [9] = "RELIC", [10] = "RELIC" }
local rarityMap = { [0] = "NORMAL", "MAGIC", "RARE", "UNIQUE", [9] = "RELIC", [10] = "RELIC", [15] = "NORMAL" }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason to duplicate [0] ("NORMAL")

@AdamZ-8113 AdamZ-8113 Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API response uses NORMAL with a new frameType

"rarity": "Normal",
"frameType": 15,
"frameTypeId": "Viscera"

I just followed what I thought the existing pattern was.

local slotMap = { ["Weapon"] = "Weapon 1", ["Offhand"] = "Weapon 2", ["Weapon2"] = "Weapon 1 Swap", ["Offhand2"] = "Weapon 2 Swap", ["Helm"] = "Helmet", ["BodyArmour"] = "Body Armour", ["Gloves"] = "Gloves", ["Boots"] = "Boots",
["Amulet"] = "Amulet", ["Ring"] = "Ring 1", ["Ring2"] = "Ring 2", ["Ring3"] = "Ring 3", ["Belt"] = "Belt", ["BrequelGrafts"] = "Graft 1", ["BrequelGrafts2"] = "Graft 2", }
["Amulet"] = "Amulet", ["Ring"] = "Ring 1", ["Ring2"] = "Ring 2", ["Ring3"] = "Ring 3", ["Belt"] = "Belt", ["BrequelGrafts"] = "Graft 1", ["BrequelGrafts2"] = "Graft 2",
["VisceraHead"] = "Head", ["VisceraBody"] = "Body", ["VisceraArm"] = "Arm", ["VisceraLeg"] = "Leg", }

function ImportTabClass:ImportItem(itemData, slotName, ignoreWeaponSwap, itemSetId)
if not slotName then
Expand Down Expand Up @@ -1543,6 +1548,9 @@ function ImportTabClass:ImportItem(itemData, slotName, ignoreWeaponSwap, itemSet
itemData.explicitMods = { }
end
for baseName, baseData in pairs(self.build.data.itemBases) do
if item.baseName then
break
end
local s, e = item.name:find(baseName, 1, true)
if s then
item.baseName = baseName
Expand Down
17 changes: 15 additions & 2 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,14 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
local itemClass
if self.rawLines[l] then
if self.rawLines[l]:match("^Item Class:") then
itemClass = self.rawLines[l]:gsub("^Item Class: %s+", "%1")
itemClass = self.rawLines[l]:match("^Item Class:%s*(.*)")
l = l + 1 -- Item class is already determined by the base type
end
local rarity = self.rawLines[l]:match("^Rarity: (%a+)")
if itemClass == "Viscera" and not rarity then
self.rarity = "NORMAL"
mode = "GAME"
end
if rarity then
mode = "GAME"
if colorCodes[rarity:upper()] then
Expand Down Expand Up @@ -538,7 +542,10 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
if line == "Veiled Prefix" or line == "Veiled Suffix" then
self.veiled = true
end
if flaskBuffLines and flaskBuffLines[line] then
if itemClass == "Viscera" and (line == "Head" or line == "Torso" or line == "Upper Limb" or line == "Lower Limb"
or line == "Take this to the Wickerman in a town or hideout to attach it.") then
-- Slot labels and instructions in the game clipboard are not modifiers.
elseif flaskBuffLines and flaskBuffLines[line] then
flaskBuffLines[line] = nil
elseif tinctureBuffLines and tinctureBuffLines[line] then
tinctureBuffLines[line] = nil
Expand Down Expand Up @@ -2191,6 +2198,12 @@ function ItemClass:GetPrimarySlot()
return "Flask 1"
elseif self.type == "Graft" then
return "Graft 1"
elseif self.type == "Viscera" then
for tag, _ in pairs(self.base.tags) do
if tag:match("^viscera_") then
return tag:gsub("^viscera_", ""):gsub("^%l", string.upper)
end
end
else
return self.type
end
Expand Down
2 changes: 1 addition & 1 deletion src/Classes/ItemDBControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function ItemDBClass:ItemDBControl(anchor, rect, itemsTab, db, dbType)
self.typeList = { "Any type", "Armour", "Jewellery", "One Handed Melee", "Two Handed Melee" }
self.slotList = { "Any slot", "Weapon 1", "Weapon 2", "Helmet", "Body Armour", "Gloves", "Boots", "Amulet", "Ring", "Belt", "Jewel", "Flask", "Graft 1", "Graft 2",
-- Wickerman (3.30)
"Wickerman Head", "Wickerman Torso", "Wickerman Upper Limb", "Wickerman Lower Limb"
"Head", "Body", "Arm", "Leg"
}
local baseY = dbType == "RARE" and -22 or -62
self.controls.slot = new("DropDownControl"):DropDownControl({"BOTTOMLEFT",self,"TOPLEFT"}, {0, baseY, 179, 18}, self.slotList, function(index, value)
Expand Down
21 changes: 18 additions & 3 deletions src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ function ItemsTabClass:ItemsTab(build)
return self.build.spec.treeVersion:find("3_30")
end
prevSlot = self.controls.wickermanHeader
for _, slotName in ipairs({ "Wickerman Head", "Wickerman Torso", "Wickerman Upper Limb", "Wickerman Lower Limb" }) do
local slot = new("ItemSlotControl"):ItemSlotControl({"TOPLEFT",prevSlot,"BOTTOMLEFT"}, 0, 2, self, slotName, (slotName:gsub("^Wickerman ", "")))
for _, slotName in ipairs({ "Head", "Body", "Arm", "Leg" }) do
local slot = new("ItemSlotControl"):ItemSlotControl({"TOPLEFT",prevSlot,"BOTTOMLEFT"}, 0, 2, self, slotName)
slot.shown = self.controls.wickermanHeader.shown
addSlot(slot)
end
Expand Down Expand Up @@ -299,7 +299,7 @@ function ItemsTabClass:ItemsTab(build)
self.controls.selectDBLabel.shown = function()
return self.height < 980
end
self.controls.selectDB = new("DropDownControl"):DropDownControl({"LEFT",self.controls.selectDBLabel,"RIGHT"}, {4, 0, 150, 18}, { "Uniques", "Rare Templates" })
self.controls.selectDB = new("DropDownControl"):DropDownControl({"LEFT",self.controls.selectDBLabel,"RIGHT"}, {4, 0, 150, 18}, { "Uniques", "Rare Templates", "Viscera" })

-- Unique database
self.controls.uniqueDB = new("ItemDBControl"):ItemDBControl({"TOPLEFT",self.controls.itemList,"BOTTOMLEFT"}, {0, 76, 360, function(c) return m_min(244, self.maxY - select(2, c:GetPos())) end}, self, main.uniqueDB, "UNIQUE")
Expand All @@ -318,6 +318,14 @@ function ItemsTabClass:ItemsTab(build)
self.controls.rareDB.shown = function()
return not self.controls.selectDBLabel:IsShown() or self.controls.selectDB.selIndex == 2
end
-- Viscera database
self.controls.visceraDB = new("ItemDBControl"):ItemDBControl({"TOPLEFT",self.controls.itemList,"BOTTOMLEFT"}, {0, 76, 360, function(c) return m_min(260, self.maxY - select(2, c:GetPos())) end}, self, main.visceraDB, "RARE")
self.controls.visceraDB.y = function()
return self.controls.selectDBLabel:IsShown() and 78 or 396
end
self.controls.visceraDB.shown = function()
return not self.controls.selectDBLabel:IsShown() or self.controls.selectDB.selIndex == 3
end
-- Create/import item
self.controls.craftDisplayItem = new("ButtonControl"):ButtonControl({"TOPLEFT",main.portraitMode and self.controls.setManage or self.controls.itemList,"TOPRIGHT"}, {20, main.portraitMode and 0 or -20, 120, 20}, "Craft item...", function()
self:CraftItem()
Expand Down Expand Up @@ -1234,6 +1242,8 @@ holding Shift will put it in the second.]])
t_insert(self.controls.uniqueDB.dragTargetList, self.controls.itemList)
t_insert(self.controls.uniqueDB.dragTargetList, self.controls.sharedItemList)
t_insert(self.controls.uniqueDB.dragTargetList, build.controls.mainSkillMinion)
t_insert(self.controls.visceraDB.dragTargetList, self.controls.itemList)
t_insert(self.controls.visceraDB.dragTargetList, self.controls.sharedItemList)
t_insert(self.controls.rareDB.dragTargetList, self.controls.itemList)
t_insert(self.controls.rareDB.dragTargetList, self.controls.sharedItemList)
t_insert(self.controls.rareDB.dragTargetList, build.controls.mainSkillMinion)
Expand All @@ -1243,6 +1253,7 @@ holding Shift will put it in the second.]])
t_insert(self.controls.itemList.dragTargetList, slot)
t_insert(self.controls.uniqueDB.dragTargetList, slot)
t_insert(self.controls.rareDB.dragTargetList, slot)
t_insert(self.controls.visceraDB.dragTargetList, slot)
t_insert(self.controls.sharedItemList.dragTargetList, slot)
end

Expand Down Expand Up @@ -2658,6 +2669,10 @@ function ItemsTabClass:IsItemValidForSlot(item, slotName, itemSet)
end
elseif item.type == slotType then
return true
elseif item.type == "Viscera" then
if item.base.tags["viscera_" .. (slotName:gsub("^%u", string.lower))] then
return true
end
elseif item.type == "Tincture" and slotType == "Flask" then
return true
elseif item.type == "Jewel" and item.base.subType == "Abyss" and slotName:match("Abyssal Socket") then
Expand Down
Loading
Loading