Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6833514
Initial tattoo implementation
Wires77 Aug 18, 2023
cddc327
Tattoo spec update
Wires77 Aug 18, 2023
e1f5950
Tattoo export
Wires77 Aug 18, 2023
1b74958
Update spec
Wires77 Aug 18, 2023
7924808
Fix spec
Aug 18, 2023
18b16ea
New dat files
Aug 18, 2023
eff4c4d
More fixes
Wires77 Aug 19, 2023
b7e3091
Add artwork, restrict Makanga tattoos
Wires77 Aug 21, 2023
27557d7
Fix bug with saving/loading, cleanup code
Wires77 Aug 21, 2023
743a9b3
Fixed import bug and matched format for save files
Wires77 Aug 22, 2023
20d3b3d
Fixing logic issues preventing proper tattoos from appearing
Wires77 Aug 22, 2023
97497cc
Fixed bug with linked node count and supported new tattoo jewel
Wires77 Aug 22, 2023
66e7a62
Temp fix for effectSprites
Wires77 Aug 22, 2023
04c56eb
Can't tattoo changed nodes
Wires77 Aug 22, 2023
adc659e
Fix tattoo interaction with Timeless jewels
Wires77 Aug 23, 2023
61380cd
Update tree, fix more bugs
Wires77 Aug 23, 2023
d47324e
Add dropdown search
Wires77 Aug 23, 2023
2c42610
Add help text to tattoo dropdown
Wires77 Aug 23, 2023
3ca79fd
Fix stat description error
Wires77 Aug 23, 2023
0d117ef
Dynamically set popup width
Wires77 Aug 23, 2023
435ea34
Made popup width fully dynamic
Wires77 Aug 23, 2023
8c275df
Truncate mod lines in tattoo popup
Wires77 Aug 23, 2023
8936c2d
text wrap in popup
Peechey Aug 23, 2023
a530ab9
Dynamic word wrapping, ignoring GGG wrapping
Wires77 Aug 23, 2023
07ae49b
Merge remote-tracking branch 'fork/dev' into tattoos
Wires77 Aug 23, 2023
e9523b9
Revert tree merge
Aug 23, 2023
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
14 changes: 13 additions & 1 deletion src/Classes/ImportTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,18 @@ function ImportTabClass:ImportPassiveTreeAndJewels(json, charData)
end
end

if charPassiveData.skill_overrides then
for nodeId, override in pairs(charPassiveData.skill_overrides) do
override.id = nodeId
local modCount = 0
for _, statLine in ipairs(override.stats) do
self.build.spec:NodeAdditionOrReplacementFromString(override, statLine, modCount == 0)
modCount = modCount + 1
end
override.dn = override.name
end
end

if errMsg then
self.charImportStatus = colorCodes.NEGATIVE.."Error processing character data, try again later."
return
Expand Down Expand Up @@ -602,7 +614,7 @@ function ImportTabClass:ImportPassiveTreeAndJewels(json, charData)
end
end
end
self.build.spec:ImportFromNodeList(charData.classId, charData.ascendancyClass, charPassiveData.hashes, charPassiveData.mastery_effects or {}, latestTreeVersion .. (charData.league:match("Ruthless") and "_ruthless" or ""))
self.build.spec:ImportFromNodeList(charData.classId, charData.ascendancyClass, charPassiveData.hashes, charPassiveData.skill_overrides, charPassiveData.mastery_effects or {}, latestTreeVersion .. (charData.league:match("Ruthless") and "_ruthless" or ""))
self.build.spec:AddUndoState()
self.build.characterLevel = charData.level
self.build.characterLevelAutoMode = false
Expand Down
73 changes: 68 additions & 5 deletions src/Classes/PassiveSpec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ function PassiveSpecClass:Init(treeVersion, convert)

-- Keys are mastery node IDs, values are mastery effect IDs
self.masterySelections = { }

-- Keys are node IDs, values are the replacement node
self.hashOverrides = { }
end

function PassiveSpecClass:Load(xml, dbFileName)
Expand Down Expand Up @@ -130,7 +133,35 @@ function PassiveSpecClass:Load(xml, dbFileName)
masteryEffects[tonumber(mastery)] = tonumber(effect)
end
end
self:ImportFromNodeList(tonumber(xml.attrib.classId), tonumber(xml.attrib.ascendClassId), hashList, masteryEffects)
for _, node in pairs(xml) do
if type(node) == "table" then
if node.elem == "Overrides" then
for _, child in ipairs(node) do
if not child.attrib.nodeId then
launch:ShowErrMsg("^1Error parsing '%s': 'Override' element missing 'nodeId' attribute", dbFileName)
return true
end

local nodeId = tonumber(child.attrib.nodeId)

self.hashOverrides[nodeId] = copyTable(self.nodes[nodeId], true)
self.hashOverrides[nodeId].id = nodeId
self.hashOverrides[nodeId].isTattoo = true
self.hashOverrides[nodeId].icon = child.attrib.icon
self.hashOverrides[nodeId].activeEffectImage = child.attrib.activeEffectImage
self.hashOverrides[nodeId].dn = child.attrib.dn
local modCount = 0
for _, modLine in ipairs(child) do
for line in string.gmatch(modLine .. "\r\n", "([^\r\n\t]*)\r?\n") do
self:NodeAdditionOrReplacementFromString(self.hashOverrides[nodeId], line, modCount == 0)
modCount = modCount + 1
end
end
end
end
end
end
self:ImportFromNodeList(tonumber(xml.attrib.classId), tonumber(xml.attrib.ascendClassId), hashList, self.hashOverrides, masteryEffects)
elseif url then
self:DecodeURL(url)
end
Expand Down Expand Up @@ -172,6 +203,20 @@ function PassiveSpecClass:Save(xml)
end
end
t_insert(xml, sockets)

local overrides = {
elem = "Overrides"
}
if self.hashOverrides then
for nodeId, node in pairs(self.hashOverrides) do
local override = { elem = "Override", attrib = { nodeId = tostring(nodeId), icon = tostring(node.icon), activeEffectImage = tostring(node.activeEffectImage), dn = tostring(node.dn) } }
for _, modLine in ipairs(node.sd) do
t_insert(override, modLine)
end
t_insert(overrides, override)
end
end
t_insert(xml, overrides)

end

Expand All @@ -180,13 +225,14 @@ function PassiveSpecClass:PostLoad()
end

-- Import passive spec from the provided class IDs and node hash list
function PassiveSpecClass:ImportFromNodeList(classId, ascendClassId, hashList, masteryEffects, treeVersion)
function PassiveSpecClass:ImportFromNodeList(classId, ascendClassId, hashList, hashOverrides, masteryEffects, treeVersion)
if treeVersion and treeVersion ~= self.treeVersion then
self:Init(treeVersion)
self.build.treeTab.showConvert = self.treeVersion ~= latestTreeVersion
end
self:ResetNodes()
self:SelectClass(classId)
self.hashOverrides = hashOverrides
-- move above setting allocNodes so we can compare mastery with selection
wipeTable(self.masterySelections)
for mastery, effect in pairs(masteryEffects) do
Expand All @@ -195,6 +241,14 @@ function PassiveSpecClass:ImportFromNodeList(classId, ascendClassId, hashList, m
self.masterySelections[mastery] = effect
end
end
for id, override in pairs(hashOverrides) do
local node = self.nodes[id]
if node then
override.effectSprites = self.tree.spriteMap[override.activeEffectImage]
override.sprites = self.tree.spriteMap[override.icon]
self:ReplaceNode(node, override)
end
end
for _, id in pairs(hashList) do
local node = self.nodes[id]
if node then
Expand Down Expand Up @@ -706,6 +760,11 @@ function PassiveSpecClass:BuildAllDependsAndPaths()
end

for id, node in pairs(self.nodes) do
-- If node is tattooed, replace it
if self.hashOverrides[node.id] then
self:ReplaceNode(node, self.hashOverrides[node.id])
end

-- If node is conquered, replace it or add mods
if node.conqueredBy and node.type ~= "Socket" then
local conqueredBy = node.conqueredBy
Expand Down Expand Up @@ -863,10 +922,10 @@ function PassiveSpecClass:BuildAllDependsAndPaths()
end
end
elseif conqueredBy.conqueror.type == "karui" then
local str = isValueInArray(attributes, node.dn) and "2" or "4"
local str = (isValueInArray(attributes, node.dn) or node.isTattoo) and "2" or "4"
self:NodeAdditionOrReplacementFromString(node, " \n+" .. str .. " to Strength")
elseif conqueredBy.conqueror.type == "maraketh" then
local dex = isValueInArray(attributes, node.dn) and "2" or "4"
local dex = (isValueInArray(attributes, node.dn) or node.isTattoo) and "2" or "4"
self:NodeAdditionOrReplacementFromString(node, " \n+" .. dex .. " to Dexterity")
elseif conqueredBy.conqueror.type == "templar" then
if isValueInArray(attributes, node.dn) then
Expand Down Expand Up @@ -1048,9 +1107,12 @@ function PassiveSpecClass:ReplaceNode(old, newNode)
old.modList = new("ModList")
old.modList:AddList(newNode.modList)
old.sprites = newNode.sprites
old.effectSprites = newNode.effectSprites
old.isTattoo = newNode.isTattoo
old.keystoneMod = newNode.keystoneMod
old.icon = newNode.icon
old.spriteId = newNode.spriteId
old.activeEffectImage = newNode.activeEffectImage
old.reminderText = newNode.reminderText or { }
end

Expand Down Expand Up @@ -1563,13 +1625,14 @@ function PassiveSpecClass:CreateUndoState()
classId = self.curClassId,
ascendClassId = self.curAscendClassId,
hashList = allocNodeIdList,
hashOverrides = self.hashOverrides,
masteryEffects = selections,
treeVersion = self.treeVersion
}
end

function PassiveSpecClass:RestoreUndoState(state, treeVersion)
self:ImportFromNodeList(state.classId, state.ascendClassId, state.hashList, state.masteryEffects, treeVersion or state.treeVersion)
self:ImportFromNodeList(state.classId, state.ascendClassId, state.hashList, state.hashOverrides, state.masteryEffects, treeVersion or state.treeVersion)
self:SetWindowTitleWithBuildClass()
end

Expand Down
30 changes: 28 additions & 2 deletions src/Classes/PassiveTree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ local PassiveTreeClass = newClass("PassiveTree", function(self, treeVersion)
local versionNum = treeVersions[treeVersion].num

self.legion = LoadModule("Data/TimelessJewelData/LegionPassives")
self.tattoo = LoadModule("Data/TattooPassives")

MakeDir("TreeData")

Expand Down Expand Up @@ -304,8 +305,6 @@ local PassiveTreeClass = newClass("PassiveTree", function(self, treeVersion)
if versionNum <= 3.09 and node.passivePointsGranted > 0 then
t_insert(node.sd, "Grants "..node.passivePointsGranted.." Passive Skill Point"..(node.passivePointsGranted > 1 and "s" or ""))
end
node.conquered = false
node.alternative = {}
node.__index = node
node.linkedId = { }
nodeMap[node.id] = node
Expand Down Expand Up @@ -507,6 +506,33 @@ local PassiveTreeClass = newClass("PassiveTree", function(self, treeVersion)
self:ProcessStats(node)
end

-- Build ModList for tattoos
for _, node in pairs(self.tattoo.nodes) do
-- Determine node type
if node.m then
node.type = "Mastery"
elseif node.ks then
node.type = "Keystone"
if not self.keystoneMap[node.dn] then -- Don't override good tree data with legacy keystones
self.keystoneMap[node.dn] = node
end
elseif node["not"] then
node.type = "Notable"
else
node.type = "Normal"
end

-- Assign node artwork assets
node.sprites = self.spriteMap[node.icon]
node.effectSprites = self.spriteMap[node.activeEffectImage]
if not node.sprites then
--error("missing sprite "..node.icon)
node.sprites = { }
end

self:ProcessStats(node)
end

-- Late load the Generated data so we can take advantage of a tree existing
buildTreeDependentUniques(self)
end)
Expand Down
31 changes: 30 additions & 1 deletion src/Classes/PassiveTreeView.lua
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,12 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
build.itemsTab:SelectControl(slot)
build.viewMode = "ITEMS"
end
elseif hoverNode and (hoverNode.isTattoo
or (hoverNode.type == "Normal" and (hoverNode.dn == "Strength" or hoverNode.dn == "Dexterity" or hoverNode.dn == "Intelligence"))
or (hoverNode.type == "Notable" and (hoverNode.sd[1]:match("+30 to Dexterity") or hoverNode.sd[1]:match("+30 to Strength") or hoverNode.sd[1]:match("+30 to Intelligence"))))
then
build.treeTab:ModifyNodePopup(hoverNode, viewPort)
build.buildFlag = true
elseif hoverNode and hoverNode.alloc and hoverNode.type == "Mastery" and hoverNode.masteryEffects then
build.treeTab:OpenMasteryPopup(hoverNode, viewPort)
build.buildFlag = true
Expand Down Expand Up @@ -520,6 +526,9 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
SetDrawLayer(nil, 15)
else
-- Normal node (includes keystones and notables)
if node.isTattoo and node.effectSprites then -- trees < 3.22.0 don't have effectSprites
effect = node.effectSprites["tattooActiveEffect"]
end
base = node.sprites[node.type:lower()..(isAlloc and "Active" or "Inactive")]
overlay = node.overlay[state .. (node.ascendancyName and "Ascend" or "") .. (node.isBlighted and "Blighted" or "")]
end
Expand Down Expand Up @@ -599,9 +608,11 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
end
end

-- Draw master effect artwork
-- Draw mastery/tattoo effect artwork
if effect then
SetDrawLayer(nil, 15)
self:DrawAsset(effect, scrX, scrY, scale)
SetDrawLayer(nil, 25)
end

-- Draw base artwork
Expand Down Expand Up @@ -844,6 +855,15 @@ function PassiveTreeViewClass:DoesNodeMatchSearchParams(node)
if #needMatches == 0 then
return true
end

-- Check node id for devs
if launch.devMode then
err, needMatches = PCall(search, tostring(node.id), needMatches)
if err then return false end
if #needMatches == 0 then
return true
end
end
end

function PassiveTreeViewClass:AddNodeName(tooltip, node, build)
Expand Down Expand Up @@ -997,6 +1017,15 @@ function PassiveTreeViewClass:AddNodeTooltip(tooltip, node, build)
end
end

-- Tattoo Editing
if node and (node.isTattoo
or (node.type == "Normal" and (node.dn == "Strength" or node.dn == "Dexterity" or node.dn == "Intelligence"))
or (node.type == "Notable" and (node.sd[1]:match("+30 to Dexterity") or node.sd[1]:match("+30 to Strength") or node.sd[1]:match("+30 to Intelligence"))))
then
tooltip:AddSeparator(14)
tooltip:AddLine(14, colorCodes.TIP.."Tip: Right click to edit the tattoo for this node")
end

-- Mod differences
if self.showStatDifferences then
local calcFunc, calcBase = build.calcsTab:GetMiscCalculator(build)
Expand Down
Loading