Skip to content
Draft
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
37 changes: 31 additions & 6 deletions src/Classes/GemSelectControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,9 @@ function GemSelectClass:Draw(viewPort, noTooltip)
nameSpec = gemData.name,
skillId = gemData.grantedEffectId,
displayEffect = nil,
gemData = gemData
gemData = gemData,
corruptLevel = 0,
corrupted = false,
}
self:AddGemTooltip(gemInstance)
self.tooltip:AddSeparator(10)
Expand Down Expand Up @@ -600,11 +602,30 @@ function GemSelectClass:AddGrantedEffectInfo(gemInstance, grantedEffect, addReq)
self.tooltip:AddLine(fontSizeBig, string.format("^x7F7F7FTier: ^7%d", gemInstance.gemData.Tier), "FONTIN SC")
end
if addReq and not grantedEffect.support then
self.tooltip:AddLine(fontSizeBig, string.format("^x7F7F7FLevel: ^7%d%s%s",
gemInstance.level,
((displayInstance.level > gemInstance.level) and " (" .. colorCodes.MAGIC .. "+" .. (displayInstance.level - gemInstance.level) .. "^7)") or ((displayInstance.level < gemInstance.level) and " (" .. colorCodes.WARNING .. "-" .. (gemInstance.level - displayInstance.level) .. "^7)") or "",
(gemInstance.level >= gemInstance.gemData.naturalMaxLevel) and " (Max)" or ""
),"FONTIN SC")
local totalLevel
totalLevel = displayInstance.level
if displayInstance.corruptLevel ~= 0 or
(displayInstance.gemPropertyInfo and displayInstance.gemPropertyInfo[1].value.value > 0 ) or
(displayInstance.level - gemInstance.level - displayInstance.corruptLevel > 0)
then
self.tooltip:AddLine(fontSizeBig, string.format("^x7F7F7FLevel: ^7" .. colorCodes.MAGIC .. totalLevel), "FONTIN SC")
self.tooltip:AddLine(fontSizeBig, "^7" .. gemInstance.level .. " Levels from Gem" .. ((gemInstance.level >= gemInstance.gemData.naturalMaxLevel) and " (Max)" or ""), "FONTIN SC")
else
self.tooltip:AddLine(fontSizeBig, string.format("^x7F7F7FLevel: ^7" .. totalLevel .. ((gemInstance.level >= gemInstance.gemData.naturalMaxLevel) and " (Max)" or "")), "FONTIN SC")
end
if displayInstance.corruptLevel > 0 then
self.tooltip:AddLine(fontSizeBig, colorCodes.MAGIC .. "+" .. displayInstance.corruptLevel .. " Level from Corruption", "FONTIN SC")
elseif displayInstance.corruptLevel < 0 then
self.tooltip:AddLine(fontSizeBig, colorCodes.MAGIC .. displayInstance.corruptLevel .. " Level from Corruption", "FONTIN SC")
end
if displayInstance.gemPropertyInfo and displayInstance.gemPropertyInfo[1].value.value > 0 then
self.tooltip:AddLine(fontSizeBig, colorCodes.MAGIC .. "+" .. displayInstance.gemPropertyInfo[1].value.value .. " Levels from Global Modifiers", "FONTIN SC")
if displayInstance.level - gemInstance.level - displayInstance.corruptLevel - displayInstance.gemPropertyInfo[1].value.value > 0 then
self.tooltip:AddLine(fontSizeBig, colorCodes.MAGIC .. "+" .. displayInstance.level - gemInstance.level - displayInstance.corruptLevel - displayInstance.gemPropertyInfo[1].value.value .. " Levels from Supports", "FONTIN SC")
end
elseif displayInstance.level - gemInstance.level - displayInstance.corruptLevel > 0 then
self.tooltip:AddLine(fontSizeBig, colorCodes.MAGIC .. "+" .. displayInstance.level - gemInstance.level - displayInstance.corruptLevel .. " Levels from Supports", "FONTIN SC")
end
end
if grantedEffect.support then
if grantedEffectLevel.manaMultiplier and grantedEffectLevel.reservationMultiplier and grantedEffectLevel.manaMultiplier == grantedEffectLevel.reservationMultiplier then
Expand Down Expand Up @@ -707,6 +728,10 @@ function GemSelectClass:AddGrantedEffectInfo(gemInstance, grantedEffect, addReq)
for _, line in ipairs(wrap) do
self.tooltip:AddLine(fontSizeBig, colorCodes.GEMDESCRIPTION..line, "FONTIN ITALIC")
end
if displayInstance.corrupted == true then
self.tooltip:AddSeparator(10)
self.tooltip:AddLine(fontSizeBig, colorCodes.NEGATIVE .. "Corrupted", "FONTIN SC")
end
end
end
function GemSelectClass:AddStatSetInfo(gemInstance, grantedEffect, statSet, noLabel, index)
Expand Down
7 changes: 5 additions & 2 deletions src/Classes/ImportTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ function ImportTabClass:ImportItemsAndSkills(charData)
if gemId then
local gemInstance = { level = 20, quality = 0, enabled = true, enableGlobal1 = true, enableGlobal2 = true, count = 1, gemId = gemId }
gemInstance.support = skillData.support
gemInstance.corrupted = skillData.corrupted

local spectreList = data.spectres
if typeLine:sub(1, 8) == "Spectre:" then
Expand Down Expand Up @@ -830,8 +831,10 @@ function ImportTabClass:ImportItemsAndSkills(charData)
else
gemInstance.level = tonumber(property.values[1][1]:match("%d+"))
end
if skillData.properties[_ + 2] and skillData.properties[_ + 2].values[1][1]:match("(%d+) Level[s]? from Corruption") then
gemInstance.level = gemInstance.level + tonumber(skillData.properties[_ + 2].values[1][1]:match("(%d+) Level[s]? from Corruption"))
if skillData.properties[_ + 2] and skillData.properties[_ + 2].values[1][1]:match("(-?%d+) Level[s]? from Corruption") then
gemInstance.corruptLevel = tonumber(skillData.properties[_ + 2].values[1][1]:match("(-?%d+) Level[s]? from Corruption"))
else
gemInstance.corruptLevel = 0
end
elseif escapeGGGString(property.name) == "Quality" then
gemInstance.quality = tonumber(property.values[1][1]:match("%d+"))
Expand Down
136 changes: 125 additions & 11 deletions src/Classes/SkillsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ local showSupportGemTypeList = {
{ label = "Awakened", show = "AWAKENED" },
}

local corruptOption = {
{ label = "Not Corrupted", level = 0 },
{ label = "+1 to Gem Level", level = 1 },
{ label = "Corrupted", level = 0 },
{ label = "-1 to Gem Level", level = -1 },
}

local sortGemTypeList = {
{ label = "Full DPS", type = "FullDPS" },
{ label = "Combined DPS", type = "CombinedDPS" },
Expand Down Expand Up @@ -260,10 +267,23 @@ will automatically apply to the skill.]]
self.controls.gemNameHeader = new("LabelControl", {"BOTTOMLEFT", self.gemSlots[1].nameSpec, "TOPLEFT"}, {0, -2, 0, 16}, "^7Gem name:")
self.controls.gemLevelHeader = new("LabelControl", {"BOTTOMLEFT", self.gemSlots[1].level, "TOPLEFT"}, {0, -2, 0, 16}, "^7Level:")
self.controls.gemQualityHeader = new("LabelControl", {"BOTTOMLEFT", self.gemSlots[1].quality, "TOPLEFT"}, {0, -2, 0, 16}, "^7Quality:")
self.controls.gemCorruptHeader = new("LabelControl", {"BOTTOMLEFT", self.gemSlots[1].corruptLevel, "TOPLEFT"}, {0, -2, 0, 16}, "^7Corrupt:")
self.controls.gemEnableHeader = new("LabelControl", {"BOTTOMLEFT", self.gemSlots[1].enabled, "TOPLEFT"}, {-16, -2, 0, 16}, "^7Enabled:")
self.controls.gemCountHeader = new("LabelControl", {"BOTTOMLEFT", self.gemSlots[1].count, "TOPLEFT"}, {8, -2, 0, 16}, "^7Count:")
end)

function SkillsTabClass:GetCorruptIndex(gemInstance)
if gemInstance.corruptLevel == 1 then
return 2 -- +1 to Gem Level
elseif gemInstance.corruptLevel == -1 then
return 4 -- -1 to Gem Level
elseif gemInstance.corrupted == true then
return 3 -- Corrupted
else
return 1 -- Not Corrupted
end
end

function SkillsTabClass:LoadSkill(node, skillSetId)
if node.elem ~= "Skill" then
return
Expand Down Expand Up @@ -333,6 +353,8 @@ function SkillsTabClass:LoadSkill(node, skillSetId)
gemInstance.skillMinionItemSetCalcs = tonumber(child.attrib.skillMinionItemSetCalcs)
gemInstance.skillMinionSkill = tonumber(child.attrib.skillMinionSkill)
gemInstance.skillMinionSkillCalcs = tonumber(child.attrib.skillMinionSkillCalcs)
gemInstance.corrupted = child.attrib.corrupted == "true"
gemInstance.corruptLevel = tonumber(child.attrib.corruptLevel)
gemInstance.statSet = { }
gemInstance.statSetCalcs = { }
gemInstance.skillMinionSkillStatSetIndexLookup = { }
Expand Down Expand Up @@ -461,6 +483,8 @@ function SkillsTabClass:Save(xml)
skillMinionItemSetCalcs = gemInstance.skillMinionItemSetCalcs and tostring(gemInstance.skillMinionItemSetCalcs),
skillMinionSkill = gemInstance.skillMinionSkill and tostring(gemInstance.skillMinionSkill),
skillMinionSkillCalcs = gemInstance.skillMinionSkillCalcs and tostring(gemInstance.skillMinionSkillCalcs),
corrupted = tostring(gemInstance.corrupted),
corruptLevel = tostring(gemInstance.corruptLevel),
} }
if gemInstance.statSet then
for grantedEffect, index in pairs(gemInstance.statSet) do
Expand Down Expand Up @@ -575,8 +599,15 @@ function SkillsTabClass:CopySocketGroup(socketGroup)
skillText = skillText .. "Slot: " .. socketGroup.slot .. "\r\n"
end
for _, gemInstance in ipairs(socketGroup.gemList) do
skillText = skillText .. string.format("%s %d/%d %s %d\r\n", gemInstance.nameSpec, gemInstance.level, gemInstance.quality, gemInstance.enabled and "" or "DISABLED", gemInstance.count or 1)
end
skillText = skillText .. string.format(
"%s %d/%d %s %d%s\r\n",
gemInstance.nameSpec,
gemInstance.level,
gemInstance.quality,
gemInstance.enabled and "" or "DISABLED",
gemInstance.count or 1,
gemInstance.corrupted and (" C" .. ((gemInstance.corruptLevel or 0) ~= 0 and ((gemInstance.corruptLevel > 0 and "+" or "") .. gemInstance.corruptLevel) or "")) or ""
) end
Copy(skillText)
end

Expand All @@ -592,15 +623,50 @@ function SkillsTabClass:PasteSocketGroup(testInput)
if slot then
newGroup.slot = slot
end
for nameSpec, level, quality, state, count in skillText:gmatch("([ %a']+) (%d+)/(%d+) ?(%a*) (%d+)") do
for nameSpec, level, quality, state, count, cFlag, cLevel in
skillText:gmatch("([ %a':]+) (%d+)/(%d+) ?(%a*) (%d+) ?(C?)([+-]?%d*)")
do
local skillMinion = nil
local skillMinionCalcs = nil
local minionName = nil
local minionList = nil

if nameSpec:find("Spectre") then
minionName = nameSpec:match(": (.+)")
nameSpec = "Summon Spectre"
minionList = self.build.spectreList
elseif nameSpec:find("Companion") then
minionName = nameSpec:match(": (.+)")
nameSpec = "Tamed Companion"
minionList = self.build.beastList
end

-- Search for the minion if we found a spectre or companion
if minionName then
for id, spectre in pairs(data.spectres) do
if spectre.name == minionName then
if not isValueInArray(minionList, id) then
t_insert(minionList, id)
end
skillMinion = id
skillMinionCalcs = id
break
end
end
end

t_insert(newGroup.gemList, {
nameSpec = nameSpec,
level = tonumber(level) or 20,
quality = tonumber(quality) or 0,
enabled = state ~= "DISABLED",
count = tonumber(count) or 1,
corrupted = cFlag == "C",
corruptLevel = tonumber(cLevel) or 0,
enableGlobal1 = true,
enableGlobal2 = true
enableGlobal2 = true,
skillMinion = skillMinion,
skillMinionCalcs = skillMinionCalcs
})
end
if #newGroup.gemList > 0 then
Expand Down Expand Up @@ -632,6 +698,7 @@ function SkillsTabClass:CreateGemSlot(index)
self.gemSlots[index2].enableGlobal1.state = gemInstance.enableGlobal1
self.gemSlots[index2].enableGlobal2.state = gemInstance.enableGlobal2
self.gemSlots[index2].count:SetText(gemInstance.count or 1)
self.gemSlots[index2].corruptLevel.selIndex = self:GetCorruptIndex(gemInstance)
end
self:AddUndoState()
self.build.buildFlag = true
Expand Down Expand Up @@ -671,11 +738,14 @@ function SkillsTabClass:CreateGemSlot(index)
enableGlobal1 = true,
enableGlobal2 = true,
count = 1,
new = true
new = true,
corrupted = false,
corruptLevel = 0,
}
self.displayGroup.gemList[index] = gemInstance
slot.level:SetText(gemInstance.level)
slot.quality:SetText(gemInstance.quality)
slot.corruptLevel.selIndex = self:GetCorruptIndex(gemInstance)
slot.enabled.state = true
slot.enableGlobal1.state = true
slot.enableGlobal2.state = true
Expand Down Expand Up @@ -707,12 +777,13 @@ function SkillsTabClass:CreateGemSlot(index)
slot.level = new("EditControl", { "LEFT", slot.nameSpec, "RIGHT" }, { 2, 0, 60, 20 }, nil, nil, "%D", 2, function(buf)
local gemInstance = self.displayGroup.gemList[index]
if not gemInstance then
gemInstance = { nameSpec = "", level = self.defaultGemLevel or 20, quality = self.defaultGemQuality or 0, enabled = true, enableGlobal1 = true, enableGlobal2 = true, count = 1, new = true }
gemInstance = { nameSpec = "", level = self.defaultGemLevel or 20, quality = self.defaultGemQuality or 0, enabled = true, enableGlobal1 = true, enableGlobal2 = true, count = 1, new = true, corruptLevel = 0, corrupted = false }
self.displayGroup.gemList[index] = gemInstance
slot.quality:SetText(gemInstance.quality)
slot.enabled.state = true
slot.enableGlobal1.state = true
slot.count:SetText(gemInstance.count)
slot.corruptLevel = self:GetCorruptIndex(gemInstance)
end
gemInstance.level = tonumber(buf) or self.displayGroup.gemList[index].naturalMaxLevel or self:ProcessGemLevel(gemInstance.gemData) or 20
self:ProcessSocketGroup(self.displayGroup)
Expand All @@ -729,12 +800,13 @@ function SkillsTabClass:CreateGemSlot(index)
slot.quality = new("EditControl", {"LEFT",slot.level,"RIGHT"}, {2, 0, 60, 20}, nil, nil, "%D", 2, function(buf)
local gemInstance = self.displayGroup.gemList[index]
if not gemInstance then
gemInstance = { nameSpec = "", level = self.defaultGemLevel or 20, quality = self.defaultGemQuality or 0, enabled = true, enableGlobal1 = true, enableGlobal2 = true, count = 1, new = true }
gemInstance = { nameSpec = "", level = self.defaultGemLevel or 20, quality = self.defaultGemQuality or 0, enabled = true, enableGlobal1 = true, enableGlobal2 = true, count = 1, new = true, corruptLevel = 0, corrupted = false }
self.displayGroup.gemList[index] = gemInstance
slot.level:SetText(gemInstance.level)
slot.enabled.state = true
slot.enableGlobal1.state = true
slot.count:SetText(gemInstance.count)
slot.corruptLevel = self:GetCorruptIndex(gemInstance)
end
gemInstance.quality = tonumber(buf) or self.defaultGemQuality or 0
self:ProcessSocketGroup(self.displayGroup)
Expand Down Expand Up @@ -824,11 +896,12 @@ function SkillsTabClass:CreateGemSlot(index)
slot.enabled = new("CheckBoxControl", {"LEFT",slot.quality,"RIGHT"}, {18, 0, 20}, nil, function(state)
local gemInstance = self.displayGroup.gemList[index]
if not gemInstance then
gemInstance = { nameSpec = "", level = self.defaultGemLevel or 20, quality = self.defaultGemQuality or 0, enabled = true, enableGlobal1 = true, enableGlobal2 = true, count = 1, new = true }
gemInstance = { nameSpec = "", level = self.defaultGemLevel or 20, quality = self.defaultGemQuality or 0, enabled = true, enableGlobal1 = true, enableGlobal2 = true, count = 1, new = true, corruptLevel = 0, corrupted = false }
self.displayGroup.gemList[index] = gemInstance
slot.level:SetText(gemInstance.level)
slot.quality:SetText(gemInstance.quality)
slot.count:SetText(gemInstance.count)
slot.corruptLevel = self:GetCorruptIndex(gemInstance)
end
if not gemInstance.gemData.vaalGem then
slot.enableGlobal1.state = true
Expand Down Expand Up @@ -863,12 +936,13 @@ function SkillsTabClass:CreateGemSlot(index)
slot.count = new("EditControl", {"LEFT",slot.enabled,"RIGHT"}, {18, 0, 60, 20}, nil, nil, "%D", 2, function(buf)
local gemInstance = self.displayGroup.gemList[index]
if not gemInstance then
gemInstance = { nameSpec = "", level = self.defaultGemLevel or 20, quality = self.defaultGemQuality or 0, enabled = true, enableGlobal1 = true, count = 1, new = true }
gemInstance = { nameSpec = "", level = self.defaultGemLevel or 20, quality = self.defaultGemQuality or 0, enabled = true, enableGlobal1 = true, count = 1, new = true, corruptLevel = 0, corrupted = false }
self.displayGroup.gemList[index] = gemInstance
slot.level:SetText(gemInstance.level)
slot.quality:SetText(gemInstance.quality)
slot.enabled.state = true
slot.enableGlobal1.state = true
slot.corruptLevel = self:GetCorruptIndex(gemInstance)
end
gemInstance.count = tonumber(buf) or 1
slot.count.buf = tostring(gemInstance.count)
Expand Down Expand Up @@ -900,6 +974,43 @@ function SkillsTabClass:CreateGemSlot(index)
end
self.controls["gemSlot"..index.."Count"] = slot.count

slot.corruptLevel = new("DropDownControl", {"LEFT",slot.count,"RIGHT"}, {18, 0, 140, 20}, corruptOption, function(indexSel, value)
local gemInstance = self.displayGroup.gemList[index]
if not gemInstance then
gemInstance = { nameSpec = "", level = 20, quality = 0, enabled = true, enableGlobal1 = true, count = 1, new = true, corruptLevel = 0, corrupted = false }
self.displayGroup.gemList[index] = gemInstance
slot.level:SetText(gemInstance.level)
slot.quality:SetText(gemInstance.quality)
slot.enabled.state = true
slot.enableGlobal1.state = true
end
gemInstance.corruptLevel = value.level
gemInstance.corrupted = (value.label ~= "Not Corrupted")
slot.corruptLevel.selIndex = indexSel
self:ProcessSocketGroup(self.displayGroup)
self:AddUndoState()
self.build.buildFlag = true
end)

slot.corruptLevel.shown = function()
local gemInstance = self.displayGroup and self.displayGroup.gemList[index]
if gemInstance then
local grantedEffectList = gemInstance.gemData and gemInstance.gemData.grantedEffectList or { gemInstance.grantedEffect }
for index, grantedEffect in ipairs(grantedEffectList) do
if not grantedEffect.support and not grantedEffect.unsupported and (not grantedEffect.hasGlobalEffect or gemInstance["enableGlobal"..index]) then
return true
end
end
end
return false
end

slot.corruptLevel.enabled = function()
return index <= #self.displayGroup.gemList
end

self.controls["gemSlot"..index.."CorruptLevel"] = slot.corruptLevel

-- Parser/calculator error message
slot.errMsg = new("LabelControl", {"LEFT",slot.count,"RIGHT"}, {2, 2, 0, 16}, function()
local gemInstance = self.displayGroup and self.displayGroup.gemList[index]
Expand Down Expand Up @@ -962,6 +1073,7 @@ function SkillsTabClass:UpdateGemSlots()
slot.quality:SetText("")
slot.enabled.state = false
slot.count:SetText(1)
slot.corruptLevel.selIndex = 1
else
slot.nameSpec.inactiveCol = self.displayGroup.gemList[slotIndex].color
end
Expand Down Expand Up @@ -1133,6 +1245,7 @@ function SkillsTabClass:SetDisplayGroup(socketGroup)
self.gemSlots[index].enableGlobal1.state = gemInstance.enableGlobal1
self.gemSlots[index].enableGlobal2.state = gemInstance.enableGlobal2
self.gemSlots[index].count:SetText(gemInstance.count or 1)
self.gemSlots[index].corruptLevel.selIndex = self:GetCorruptIndex(gemInstance)
end
end
end
Expand All @@ -1159,13 +1272,14 @@ function SkillsTabClass:AddSocketGroupTooltip(tooltip, socketGroup)
end
tooltip:AddLine(16, "^7Active Skill #"..index..":")
for _, skillEffect in ipairs(activeSkill.effectList) do
tooltip:AddLine(20, string.format("%s%s ^7%d%s/%d%s",
tooltip:AddLine(20, string.format("%s%s ^7%d%s/%d%s%s",
data.skillColorMap[skillEffect.grantedEffect.color or skillEffect.gemData and skillEffect.gemData.grantedEffect.color],
skillEffect.srcInstance.nameSpec or skillEffect.grantedEffect.name,
skillEffect.srcInstance and skillEffect.srcInstance.level or skillEffect.level,
(skillEffect.srcInstance and skillEffect.level > skillEffect.srcInstance.level) and colorCodes.MAGIC.."+"..(skillEffect.level - skillEffect.srcInstance.level).."^7" or "",
skillEffect.srcInstance and skillEffect.srcInstance.quality or skillEffect.quality,
(skillEffect.srcInstance and skillEffect.quality > skillEffect.srcInstance.quality) and colorCodes.MAGIC.."+"..(skillEffect.quality - skillEffect.srcInstance.quality).."^7" or ""
(skillEffect.srcInstance and skillEffect.quality > skillEffect.srcInstance.quality) and colorCodes.MAGIC.."+"..(skillEffect.quality - skillEffect.srcInstance.quality).."^7" or "",
(skillEffect.srcInstance and skillEffect.srcInstance.corrupted == true) and (colorCodes.NEGATIVE.." C"..((skillEffect.srcInstance.corruptLevel or 0) ~= 0 and ((skillEffect.srcInstance.corruptLevel > 0 and "+" or "")..skillEffect.srcInstance.corruptLevel) or "")) or ""
))
if skillEffect.srcInstance then
gemShown[skillEffect.srcInstance] = true
Expand Down
Loading