Skip to content

Commit 96a8f01

Browse files
committed
Import json chakras (monk runes)
1 parent 5e6180b commit 96a8f01

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

src/Classes/ImportTab.lua

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,12 +1023,39 @@ function ImportTabClass:ImportItemsAndSkills(charData)
10231023
return charData -- For the wrapper
10241024
end
10251025

1026+
function ImportTabClass:ImportChakra(slotName, runeName)
1027+
local slot = self.build.itemsTab.runeSlots[slotName]
1028+
-- note that if the rune is not in ModRunes.lua, this will not select it
1029+
if slot then
1030+
slot:SelByValue(runeName, "name")
1031+
end
1032+
end
1033+
1034+
function ImportTabClass:ImportChakra(slotName, runeName)
1035+
local slot = self.build.itemsTab.runeSlots[slotName]
1036+
-- note that if the rune is not in ModRunes.lua, this will not select it
1037+
if slot then
1038+
slot:SelByValue(runeName, "name")
1039+
end
1040+
end
1041+
10261042
local rarityMap = { [0] = "NORMAL", "MAGIC", "RARE", "UNIQUE", [9] = "RELIC", [10] = "RELIC", [13] = "RARE" }
10271043
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", ["IncursionArmLeft"] = "Arm 2", ["IncursionArmRight"] = "Arm 1", ["IncursionLegLeft"] = "Leg 2", ["IncursionLegRight"] = "Leg 1" }
10281044

10291045
function ImportTabClass:ImportItem(itemData, slotName)
10301046
if not slotName then
1031-
if itemData.inventoryId == "PassiveJewels" then
1047+
-- monk martial artist rune tattoos
1048+
if itemData.inventoryId == "Chakra" then
1049+
-- TODO: should probably be exported from chakraslots.dat64
1050+
-- API doesn't have slots directly, but has an x position similar to flasks
1051+
slotMap = {"Helmet Rune #1", "Body Armour Rune #1", "Body Armour Rune #2", "Gloves Rune #1", "Boots Rune #1"}
1052+
if slotMap[itemData.x + 1] and itemData.baseType then
1053+
slotName = slotMap[itemData.x + 1]
1054+
-- runes are imported differently as they're not items located in your inventory
1055+
self:ImportChakra(slotName, itemData.baseType)
1056+
return
1057+
end
1058+
elseif itemData.inventoryId == "PassiveJewels" then
10321059
slotName = "Jewel ".. self.build.latestTree.jewelSlots[itemData.x + 1]
10331060
elseif itemData.inventoryId == "Flask" then
10341061
if itemData.x > 1 then

src/Classes/ItemsTab.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,12 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro
267267
end
268268
end
269269
local function addRuneSockets()
270+
-- TODO: use game data for this from chakraslots.dat64
270271
local slots = { { type = "Helmet", n = 1 }, { type = "Body Armour", n = 2 }, { type = "Gloves", n = 1 }, { type = "Boots", n = 1 } }
271272
for _, slot in ipairs(slots) do
272273
for i = 1, slot.n do
273274
local slotName = s_format("%s Rune #%d", slot.type, i)
274-
local label = slotName:gsub(" Armour", "")
275+
local label = slotName:gsub(" Armour", ""):gsub("#", "")
275276

276277
local runeSlot = new("DropDownControl", { "TOPLEFT", prevSlot, "BOTTOMLEFT" }, {0, 2, 310, 20}, runeList[slot.type:lower()], function ()
277278
self.build.buildFlag = true

0 commit comments

Comments
 (0)