Skip to content

fix: Tibia Coins cannot be offered on the market (resource 0x5B never sent) - #868

Merged
jprzimba merged 1 commit into
zimbadev:mainfrom
msholl:fix/coin-resource
Aug 7, 2026
Merged

fix: Tibia Coins cannot be offered on the market (resource 0x5B never sent)#868
jprzimba merged 1 commit into
zimbadev:mainfrom
msholl:fix/coin-resource

Conversation

@msholl

@msholl msholl commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

On a 15.25 client it is impossible to create a market offer for Tibia Coins. The price field accepts input, but the amount control stays locked at zero, with no error message.

Cause. Resource_t in src/server/server_definitions.hpp ends at 0x57. The 15.x client reads how many coins may be offered from the resource balance:

-- modules/game_market/market_helpers.lua
function getTransferableTibiaCoins()
    return player:getResourceBalance(91) or 0  -- 0x5B
end

and then:

-- modules/game_market/t_market.lua
local itemCount = isTibiaCoin and getTransferableTibiaCoins() or getDepotItemCount(...)
if itemCount > 0 then ... else
    mainMarket.amountCreateScrollBar:setRange(0, 0)   -- locked
end

The server does send the balance, but only through 0xDF (sendCoinBalance), which the market module does not read. Since 0x5B never arrives, getResourceBalance(91) is always 0.

This is server-side only — Game::playerCreateMarketOffer already handles ITEM_STORE_COIN correctly; the client simply never lets the request be built.

Fix. Add RESOURCE_COIN_NORMAL = 0x5A / RESOURCE_COIN_TRANSFERRABLE = 0x5B and emit them at the end of sendCoinBalance(). The client parses this resource as u64 (default branch of parseResourceBalance), which is what sendResourceBalance already writes, so no format change is needed.

Guarded by !oldProtocol, so 11.00 clients are unaffected.

Reported by a player on a 15.25 OTClient build: the amount control is locked at zero while the price field works. grep over Resource_t confirms 0x5B has no sender on the server side. I have not yet had the reporter re-test with the patch applied, so treat the fix as reasoned from both sources rather than confirmed end to end.

O Resource_t parava em 0x57. O cliente 15.x le quantas Tibia Coins podem ir ao
market por getResourceBalance(91) -- 0x5B -- e nao pelo pacote 0xDF que o
sendCoinBalance ja enviava. Sem isso o t_market.lua faz setRange(0, 0) e a barra
de quantidade da oferta trava em zero: da pra digitar o preco, mas nao a
quantidade, sem mensagem de erro nenhuma.

O cliente le esse resource como u64 (protocolgameparse.cpp, branch default), que
e o formato que o sendResourceBalance ja usa.
@jprzimba
jprzimba merged commit 4452200 into zimbadev:main Aug 7, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants