This commit is contained in:
OTCv8
2020-09-11 01:13:37 +02:00
parent cf931af49e
commit dfd69fd3b5
19 changed files with 308 additions and 79 deletions

View File

@@ -39,15 +39,31 @@ end
-- parsing protocols
local function parseMarketEnter(protocol, msg)
local items
if g_game.getClientVersion() < 944 then
items = {}
local itemsCount = msg:getU16()
for i = 1, itemsCount do
local itemId = msg:getU16()
local category = msg:getU8()
local name = msg:getString()
table.insert(items, {
id = itemId,
category = category,
name = name
})
end
end
local balance
if g_game.getClientVersion() >= 981 then
if g_game.getClientVersion() >= 981 or g_game.getClientVersion() < 944 then
balance = msg:getU64()
else
balance = msg:getU32()
end
local vocation = -1
if g_game.getClientVersion() < 950 then
if g_game.getClientVersion() >= 944 and g_game.getClientVersion() < 950 then
vocation = msg:getU8() -- get vocation id
end
local offers = msg:getU8()
@@ -61,7 +77,7 @@ local function parseMarketEnter(protocol, msg)
depotItems[itemId] = itemCount
end
signalcall(Market.onMarketEnter, depotItems, offers, balance, vocation)
signalcall(Market.onMarketEnter, depotItems, offers, balance, vocation, items)
return true
end
@@ -134,7 +150,7 @@ local function parseMarketBrowse(protocol, msg)
table.insert(offers, readMarketOffer(msg, MarketAction.Sell, var))
end
signalcall(Market.onMarketBrowse, offers)
signalcall(Market.onMarketBrowse, offers, var)
return true
end
@@ -215,6 +231,10 @@ function MarketProtocol.sendMarketBrowseMyOffers()
MarketProtocol.sendMarketBrowse(MarketRequest.MyOffers)
end
function MarketProtocol.sendMarketBrowseMyHistory()
MarketProtocol.sendMarketBrowse(MarketRequest.MyHistory)
end
function MarketProtocol.sendMarketCreateOffer(type, spriteId, amount, price, anonymous)
if g_game.getFeature(GamePlayerMarket) then
local msg = OutputMessage.create()