Skip to content

Commit 65726e0

Browse files
committed
addon(guildstock): track hidden items
1 parent d361de3 commit 65726e0

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

addons/guildstock.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ local makeDatabases = function(baseDir)
5555
ItemName = '',
5656
Count = 1,
5757
Max = 1,
58+
Hidden = true,
5859
Price = 1,
5960
},
6061
})
@@ -70,6 +71,7 @@ local makeDatabases = function(baseDir)
7071
ItemName = '',
7172
Count = 1,
7273
Max = 1,
74+
Hidden = true,
7375
Price = 1,
7476
},
7577
})
@@ -157,7 +159,8 @@ addon.onIncomingPacket = function(id, data)
157159
ItemName = backend.get_item_name(itemEntry.ItemNo),
158160
Count = itemEntry.Count,
159161
Max = itemEntry.Max,
160-
Price = itemEntry.Price,
162+
Hidden = bit.band(itemEntry.Price, 0x80000000) ~= 0, -- items with MSB set
163+
Price = bit.band(itemEntry.Price, 0x3FFFFFFF),
161164
}
162165
if addon.databases.global.buyList then
163166
addon.databases.global.buyList:add_or_update(itemKey, dbEntry)
@@ -192,7 +195,8 @@ addon.onIncomingPacket = function(id, data)
192195
ItemName = backend.get_item_name(itemEntry.ItemNo),
193196
Count = itemEntry.Count,
194197
Max = itemEntry.Max,
195-
Price = itemEntry.Price,
198+
Hidden = bit.band(itemEntry.Price, 0x80000000) ~= 0, -- items with MSB set
199+
Price = bit.band(itemEntry.Price, 0x3FFFFFFF),
196200
}
197201

198202
if addon.databases.global.sellList then

addons/shopstock.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ addon.onIncomingPacket = function(id, data)
197197
---@type GP_SERV_COMMAND_SHOP_LIST
198198
local buyListPacket = backend.parsePacket('incoming', data)
199199
for _, item in ipairs(buyListPacket.ShopItemTbl) do
200+
if bit.band(item.ItemPrice, 0x80000000) ~= 0 then
201+
backend.msg('ShopStock', string.format('Item %s has MSB set - Unknown meaning.', backend.get_item_name(item.ItemNo)))
202+
end
203+
200204
local itemKey = string.format('%s-%d', addon.shopNpc.Name, item.ItemNo)
201205
local itemEntry =
202206
{
@@ -206,7 +210,7 @@ addon.onIncomingPacket = function(id, data)
206210
GuildInfo = item.GuildInfo,
207211
ItemNo = item.ItemNo,
208212
ItemName = backend.get_item_name(item.ItemNo),
209-
ItemPrice = item.ItemPrice,
213+
ItemPrice = bit.band(item.ItemPrice, 0x3FFFFFFF), -- Not sure if MSB can be set in shop packets but just in case
210214
ShopIndex = item.ShopIndex,
211215
Skill = item.Skill,
212216
}
@@ -244,7 +248,7 @@ addon.onIncomingPacket = function(id, data)
244248
NpcZone = backend.zone_name(),
245249
ItemNo = invItem.Id,
246250
ItemName = backend.get_item_name(invItem.Id),
247-
Price = sellPacket.Price,
251+
Price = bit.band(sellPacket.Price, 0x3FFFFFFF), -- Not sure if MSB can be set in shop packets but just in case
248252
}
249253
if addon.databases.global.sellList then
250254
addon.databases.global.sellList:add_or_update(itemKey, itemEntry)

0 commit comments

Comments
 (0)