• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Market system tfs 1.5 protocol 8.6

johnsamir

Advanced OT User
Joined
Oct 13, 2009
Messages
965
Solutions
6
Reaction score
164
Location
Nowhere
Hello, have enabled market system it seems to work, it display items, the buttons in the gui windows are enabled but when i try to create an offer to buy ex: an armor nothing happens if i re-click in create button, i get a message that i have to wait few seconds, the offer is not being created
in client i get this
Lua:
ERROR: ProtocolGame parse message exception (22 bytes, 1 unread, last opcode is 0x00 (0), prev opcode is 0xf6 (246)): InputMessage eof reached
Packet has been saved to packet.log, you can use it to find what was wrong. (Protocol: 860)
this is the log
Code:
ProtocolGame parse message exception (22 bytes, 1 unread, last opcode is 0x00 (0), prev opcode is 0xf6 (246), proto: 860): InputMessage eof reached
14 00 6c 06 d6 3b 0e 00
f6 00 00 00 ee 00 00 00 00 00 00 00
00 00

protocolgame.cpp
Code:
case 0xF6: parseMarketCreateOffer(msg); break;
Code:
void ProtocolGame::sendMarketEnter()
{
    NetworkMessage msg;
    msg.addByte(0xF6);
    msg.addByte(
        std::min<uint32_t>(IOMarket::getPlayerOfferCount(player->getGUID()), std::numeric_limits<uint8_t>::max()));

    player->setInMarket(true);

    std::map<uint16_t, uint32_t> depotItems;
    std::forward_list<Container*> containerList{ player->getInbox() };

    for (const auto& chest : player->depotChests) {
        if (!chest.second->empty()) {
            containerList.push_front(chest.second);
        }
    }

    do {
        Container* container = containerList.front();
        containerList.pop_front();

        for (Item* item : container->getItemList()) {
            Container* c = item->getContainer();
            if (c && !c->empty()) {
                containerList.push_front(c);
                continue;
            }

            const ItemType& itemType = Item::items[item->getID()];
            if (itemType.wareId == 0) {
                continue;
            }

            if (c && (!itemType.isContainer() || c->capacity() != itemType.maxItems)) {
                continue;
            }

            if (!item->hasMarketAttributes()) {
                continue;
            }

            depotItems[itemType.id] += Item::countByType(item, -1);
        }
    } while (!containerList.empty());

    uint16_t itemsToSend = std::min<size_t>(depotItems.size(), std::numeric_limits<uint16_t>::max());
    uint16_t i = 0;

    msg.add<uint16_t>(itemsToSend);
    for (std::map<uint16_t, uint32_t>::const_iterator it = depotItems.begin(); i < itemsToSend; ++it, ++i) {
        const ItemType& itemType = Item::items[it->first];
        msg.add<uint16_t>(itemType.wareId);
        if (itemType.classification > 0) {
            msg.addByte(0);
        }
        msg.add<uint16_t>(std::min<uint32_t>(0xFFFF, it->second));
    }
    writeToOutputBuffer(msg);

    sendResourceBalance(RESOURCE_BANK_BALANCE, player->getBankBalance());
    //sendResourceBalance(RESOURCE_GOLD_EQUIPPED, player->getMoney());
    //sendStoreBalance();
}
untitled.png


any help would be appreciated
ps: i've took the code from main tfs repository and for the client im using part of the code of sabreheaven otc at
Lua:
local function parseMarketEnter(protocol, msg)
in game.cpp changed spriteId to browseid( things related to market ofc)

like here
Code:
-void Game::playerBrowseMarket(uint32_t playerId, uint16_t spriteId)
+void Game::playerBrowseMarket(uint32_t playerId, uint16_t browseId)
{
    Player* player = getPlayerByID(playerId);
    if (!player) {

@@ -5262,7 +5262,7 @@ void Game::playerBrowseMarket(uint32_t playerId, uint16_t spriteId)
        player->sendMarketEnter();
    }

    -const ItemType& it = Item::items.getItemIdByClientId(spriteId);
   + const ItemType& it = Item::items.getItemIdByClientId(browseId);
 
Last edited:
Back
Top