Skip to content
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
38 changes: 38 additions & 0 deletions spec/System/TestImport_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,42 @@ 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", "Head", "Every 3 seconds, Consume a Corpse within 5 metres to Recover 4% of Life" },
{ "Lesser Warden's Arm", "Upper Limb", "+43 to maximum Life" },
{ "Greater Sirus' Head", "Head", "+10 to Strength" },
{ "Lesser Blackened Lungs", "Torso", "12% increased Warcry Speed", "VisceraBody" },
{ "Lesser Pocked Leg", "Lower Limb", "20% increased Armour from Equipped Helmet and Gloves", "VisceraLeg" },
{ "Artificial Appendage", "Upper Limb", "25% increased Effect of Chill" },
{ "Artificial Appendage", "Upper Limb", "18% increased Area of Effect for Attacks" },
{ "Artificial Appendage", "Upper Limb", "Minions have 30% increased Critical Strike Chance" },
}
local equipped, items = { }, { }
for i, example in ipairs(examples) do
local slot = "Wickerman " .. example[2]
local item = { id = "synthetic-wickerman-" .. i, name = "", typeLine = example[1], baseType = example[1], frameType = 15, ilvl = 83,
inventoryId = example[4] or (example[2] == "Head" and "VisceraHead" or "VisceraArm"), implicitMods = { { description = example[3] } } }
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[1], item.baseName)
assert.equals("NORMAL", item.rarity)
assert.equals("Wickerman " .. example[2], item.type)
assert.equals(example[3], item.implicitModLines[1].line)
end
for slot, id in pairs(equipped) do
assert.equals(id, build.itemsTab.items[build.itemsTab.slots[slot].selItemId].uniqueID)
end
end)

end)
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", "Greater Sirus' Head", "", "Head" }, -- Exact base takes precedence.
{ "Experimental Gladiator's Heart", "Gladiator's Heart", "Experimental ", "Torso" }, -- Synthetic unknown prefix.
{ "Lesser Warden's Arm", "Lesser Warden's Arm", "", "Upper Limb" },
{ "Lesser Pocked Leg", "Lesser Pocked Leg", "", "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("Wickerman " .. example[4], 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
18 changes: 16 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 @@ -1542,7 +1547,16 @@ function ImportTabClass:ImportItem(itemData, slotName, ignoreWeaponSwap, itemSet
itemData.implicitMods = { }
itemData.explicitMods = { }
end
-- Lesser and Greater Wickerman names overlap ordinary names: prefer the exact base.
local exactBase = self.build.data.itemBases[item.name]
if exactBase and exactBase.type:match("^Wickerman ") then
item.baseName = item.name
item.type = exactBase.type
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
11 changes: 9 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
8 changes: 6 additions & 2 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 @@ -2658,6 +2658,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