Skip to content

Commit

Permalink
import belt buckle (breaking change)
Browse files Browse the repository at this point in the history
  • Loading branch information
insunaa committed Dec 2, 2022
1 parent ae01259 commit 1949b61
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 20 deletions.
19 changes: 16 additions & 3 deletions QEGearImporter/questionablyepic_enhanced.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function scanGear()
local unique = bit.band(itemSplit[8], 65535)
suffix = ",suffix=" .. suffix .. ",unique=" .. unique
else suffix = "" end

local hasBuckle = false
--local _, enchantId, gem1, gem2, gem3, gem4 = string.match(itemLink, "item:(%d+):(%d+):(%d+):(%d+):(%d+):(%d+)")
local enchantId = itemSplit[2]
local gem1 = itemSplit[3]
Expand All @@ -92,13 +92,19 @@ function scanGear()
SocketInventoryItem(i)
gemColors = {nil, nil, nil}
for j=1, GetNumSockets() do
_, _, _, _, _, _, _, _, equipLoc = GetItemInfo(itemLink)
if (equipLoc ~= nil and equipLoc == "INVTYPE_WAIST") then
if (GetSocketTypes(j) ~= nil and GetSocketTypes(j) == "Prismatic") then
hasBuckle = true
end
end
_, _, gemColors[j] = GetExistingSocketInfo(j)
end
CloseSocketInfo()
local itemName, _, _, _, _, _, _, _, _, _, _, classID, subclassID = GetItemInfo(equipID);
--print(classID)
if (classID == 2 or classID == 4) then
addPrint(slotNames[i] .. "=,id=" .. equipID .. suffix .. ",enchantId=" .. enchantId .. ",gem1=" .. gem1 ..":" .. tostring(gemColors[1]) .. ",gem2=" .. gem2 ..":" .. tostring(gemColors[2]) .. ",gem3=" .. gem3 ..":" .. tostring(gemColors[3]))
addPrint(slotNames[i] .. "=,id=" .. equipID .. suffix .. ",enchantId=" .. enchantId .. ",gem1=" .. gem1 ..":" .. tostring(gemColors[1]) .. ",gem2=" .. gem2 ..":" .. tostring(gemColors[2]) .. ",gem3=" .. gem3 ..":" .. tostring(gemColors[3]) .. ",buckle=" .. tostring(hasBuckle))
--print(itemName .. "(" .. itemType .. ")");

end
Expand Down Expand Up @@ -144,6 +150,7 @@ function scanGear()
local itemLink = GetContainerItemLink(bag, bagSlots)
local itemSplit = GetItemSplit(itemLink)
local suffix = itemSplit[7] * -1
local hasBuckle = false
local enchantId = itemSplit[2]
local gem1 = itemSplit[3]
local gem2 = itemSplit[4]
Expand All @@ -157,6 +164,12 @@ function scanGear()
SocketContainerItem(bag, bagSlots)
gemColors = {nil, nil, nil}
for j=1, GetNumSockets() do
_, _, _, _, _, _, _, _, equipLoc = GetItemInfo(itemLink)
if (equipLoc ~= nil and equipLoc == "INVTYPE_WAIST") then
if (GetSocketTypes(j) ~= nil and GetSocketTypes(j) == "Prismatic") then
hasBuckle = true
end
end
_, _, gemColors[j] = GetExistingSocketInfo(j)
end
CloseSocketInfo()
Expand All @@ -168,7 +181,7 @@ function scanGear()
--addPrint("# " .. convertSlot(itemEquipLoc) .. "=,id=" .. itemID .. suffix)
local _, itemCount = GetContainerItemInfo(bag, bagSlots)
--addPrint(itemName)
addPrint("id=" .. itemID .. suffix .. ",count=" .. itemCount .. ",enchantId=" .. enchantId .. ",gem1=" .. gem1 ..":" .. tostring(gemColors[1]) .. ",gem2=" .. gem2 ..":" .. tostring(gemColors[2]) .. ",gem3=" .. gem3 ..":" .. tostring(gemColors[3]))
addPrint("id=" .. itemID .. suffix .. ",count=" .. itemCount .. ",enchantId=" .. enchantId .. ",gem1=" .. gem1 ..":" .. tostring(gemColors[1]) .. ",gem2=" .. gem2 ..":" .. tostring(gemColors[2]) .. ",gem3=" .. gem3 ..":" .. tostring(gemColors[3]) .. ",buckle=" .. tostring(hasBuckle))
--print(itemName .. "(" .. itemType .. ")");

end
Expand Down
52 changes: 35 additions & 17 deletions src/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def get_char_info():

return result

def add_to_itemlists(slot_id, item_entry, suffix, enchant, gems, bag_id=0, item_count=1):
def add_to_itemlists(slot_id, item_entry, suffix, enchant, gems, buckle, bag_id=0, item_count=1):
global inventory_list, instance_list, itemguiditr
socketBonus = 0
inventory_list += wornTemplate.fill(
Expand Down Expand Up @@ -86,16 +86,28 @@ def add_to_itemlists(slot_id, item_entry, suffix, enchant, gems, bag_id=0, item_
socketBonus = itemSocketBonusMapWotlk[int(item_entry)]
if str(suffix) not in suffixTable:
suffix = 0
enchantments = instanceEnchantTemplate.fill(
main_enchant=enchant,
gem1=gemPropertyMapWotLK[gemIDPropertyMapWotlk[int(gems[0].split(":")[0])]],
gem2=gemPropertyMapWotLK[gemIDPropertyMapWotlk[int(gems[1].split(":")[0])]],
gem3=gemPropertyMapWotLK[gemIDPropertyMapWotlk[int(gems[2].split(":")[0])]],
socket_bonus=socketBonus,
enchant_1=suffixTable[str(suffix)][0],
enchant_2=suffixTable[str(suffix)][1],
enchant_3=suffixTable[str(suffix)][2],
)
if buckle == "false":
enchantments = instanceEnchantTemplate.fill(
main_enchant=enchant,
gem1=gemPropertyMapWotLK[gemIDPropertyMapWotlk[int(gems[0].split(":")[0])]],
gem2=gemPropertyMapWotLK[gemIDPropertyMapWotlk[int(gems[1].split(":")[0])]],
gem3=gemPropertyMapWotLK[gemIDPropertyMapWotlk[int(gems[2].split(":")[0])]],
socket_bonus=socketBonus,
enchant_1=suffixTable[str(suffix)][0],
enchant_2=suffixTable[str(suffix)][1],
enchant_3=suffixTable[str(suffix)][2],
)
else:
enchantments = instanceEnchantTemplate.fill(
main_enchant=enchant,
gem1=gemPropertyMapWotLK[gemIDPropertyMapWotlk[int(gems[0].split(":")[0])]],
gem2=gemPropertyMapWotLK[gemIDPropertyMapWotlk[int(gems[1].split(":")[0])]],
gem3=gemPropertyMapWotLK[gemIDPropertyMapWotlk[int(gems[2].split(":")[0])]],
socket_bonus=socketBonus,
enchant_1=3729,
enchant_2=suffixTable[str(suffix)][1],
enchant_3=suffixTable[str(suffix)][2],
)
instance_list += instanceTemplate.fill(
item_guid=itemguiditr,
item_entry=item_entry,
Expand All @@ -111,18 +123,21 @@ def parse_slots_base():
suffix = "0"
enchant = "0"
gems = []
if len(item_info) == 8:
buckle = "false"
if len(item_info) == 9:
suffix = item_info[2].split("=")[1]
enchant = item_info[4].split("=")[1]
gems = [item_info[5].split("=")[1], item_info[6].split("=")[1], item_info[7].split("=")[1]]
elif len(item_info) == 6:
buckle = [item_info[8].split("=")[1]]
elif len(item_info) == 7:
enchant = item_info[2].split("=")[1]
gems = [item_info[3].split("=")[1], item_info[4].split("=")[1], item_info[5].split("=")[1]]
buckle = [item_info[6].split("=")[1]]

item_entry = (
f[i + equip_offset].split("=")[2].split(",")[0].replace("\n", "")
)
add_to_itemlists(slotMap[slot], item_entry, suffix, enchant, gems)
add_to_itemlists(slotMap[slot], item_entry, suffix, enchant, gems, buckle[0].rstrip())

slots = [
"head",
Expand Down Expand Up @@ -217,24 +232,27 @@ def parse_bag_base():
suffix = "0"
enchant = "0"
gems = []
buckle = "false"
item_data = item.split(",")
item_count = ""
item_entry = item_data[0].split("=")
if len(item_entry) > 1:
item_entry = item_entry[1]
if len(item_data) > 1:
item_count = clean(item_data[1].split("=")[1])
if len(item_data) == 8:
if len(item_data) == 9:
item_count = clean(item_data[3].split("=")[1])
suffix = item_data[1].split("=")[1]
enchant = item_data[4].split("=")[1]
gems = [item_data[5].split("=")[1], item_data[6].split("=")[1], item_data[7].split("=")[1]]
if len(item_data) == 6:
buckle = [item_data[8].split("=")[1]]
if len(item_data) == 7:
enchant = item_data[2].split("=")[1]
gems = [item_data[3].split("=")[1], item_data[4].split("=")[1], item_data[5].split("=")[1]]
buckle = [item_data[6].split("=")[1]]
slotID = firstSlot % 28
bagID = int(firstSlot / 28) + 216
add_to_itemlists(slotID, item_entry, suffix, enchant, gems, bagID, item_count=item_count)
add_to_itemlists(slotID, item_entry, suffix, enchant, gems, buckle[0], bagID, item_count=item_count)
firstSlot += 1

firstSlot = 23 + 14
Expand Down

0 comments on commit 1949b61

Please sign in to comment.