• 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!

OTClient useThing:getServerId() shows id 0

Makin

New Member
Joined
Sep 17, 2018
Messages
37
Solutions
1
Reaction score
2
Hello, I have a problem with adding options to Otclient. I use TFS 1.2
Lua:
    menu:addOption(tr('Add Loot'), function() g_game.talk('!add ' .. useThing:getServerId()) end)
useThing: getServerId () shows me ID 0. And I don't know if it's the server's fault or otlcient
 
All that OTC knows about items is name, client id and count/subtype.

C++:
ItemPtr ProtocolGame::getItem(const InputMessagePtr& msg, int id)
{
    if(id == 0)
        id = msg->getU16();

    ItemPtr item = Item::create(id);
    if(item->getId() == 0)
        stdext::throw_exception(stdext::format("unable to create item with invalid id %d", id));

    if(g_game.getFeature(Otc::GameThingMarks)) {
        msg->getU8(); // mark
    }

    if(item->isStackable() || item->isFluidContainer() || item->isSplash() || item->isChargeable())
        item->setCountOrSubType(msg->getU8());

    if(g_game.getFeature(Otc::GameItemAnimationPhase)) {
        if(item->getAnimationPhases() > 1) {
            // 0x00 => automatic phase
            // 0xFE => random phase
            // 0xFF => async phase
            msg->getU8();
            //item->setPhase(msg->getU8());
        }
    }

    return item;
}
 
I had to add. And now it's working properly

otclient/init.lua
Lua:
g_things.loadOtb('data/things/800/items.otb')
 
Back
Top