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

Solved How to remove Buy with backpack?

Way20

Well-Known Member
Joined
Sep 29, 2014
Messages
205
Solutions
3
Reaction score
79
Hi to everyone, well like the title say I need to remove the option "buy with backpack" from the npcs trade window, anyone know how can I do it? I'm talking about this option in the window

AHJ1IZR.png


Thanks in advance!
 
Hi to everyone, well like the title say I need to remove the option "buy with backpack" from the npcs trade window, anyone know how can I do it? I'm talking about this option in the window

AHJ1IZR.png


Thanks in advance!
It's client sided not server thing i think,
 
You can disable the use by modifying your src code.
But you can not remove the button itself without using OTC or something like that where you can fully modify it.
 
You can disable the use by modifying your src code.
But you can not remove the button itself without using OTC or something like that where you can fully modify it.

There is a way to remove this button, you just need to know how to mod CIP's client, there are a few dudes that are heavy into modifying it....I just can't remember the name.
 
You can disable the use by modifying your src code.
But you can not remove the button itself without using OTC or something like that where you can fully modify it.

Hmm, disable is enough, which source files I need change to disable it?
 
Oh tought you used 1.x.
Upload your parsePlayerPurchase function (the one you linked the text from).
Aswell as the Game::* function it links to (it's in game.cpp).
 
Oh tought you used 1.x.
Upload your parsePlayerPurchase function (the one you linked the text from).
Aswell as the Game::* function it links to (it's in game.cpp).

That is it?

Code:
void ProtocolGame::parsePlayerPurchase(NetworkMessage &msg)
{
    uint16_t id = msg.get<uint16_t>();
    uint16_t count = msg.get<char>();
    uint16_t amount = msg.get<char>();
    bool ignoreCap = msg.get<char>();
    bool inBackpacks = msg.get<char>();
    addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerPurchaseItem, player->getID(), id, count, amount, ignoreCap, inBackpacks);
}
 
Yes and then the Game :: PlayerPurchaseItem function. (without spaces due to the : p smiley)
 
I think should be it

Code:
bool Game::playerPurchaseItem(uint32_t playerId, uint16_t spriteId, uint8_t count, uint8_t amount,
    bool ignoreCap/* = false*/, bool inBackpacks/* = false*/)
{
    Player* player = getPlayerByID(playerId);
    if(!player || player->isRemoved())
        return false;

    int32_t onBuy, onSell;
    Npc* merchant = player->getShopOwner(onBuy, onSell);
    if(!merchant)
        return false;

    const ItemType& it = Item::items.getItemIdByClientId(spriteId);
    if(!it.id)
        return false;

    uint8_t subType = count;
    if(it.isFluidContainer() && count < uint8_t(sizeof(reverseFluidMap) / sizeof(int8_t)))
        subType = reverseFluidMap[count];

    if(!player->canShopItem(it.id, subType, SHOPEVENT_BUY))
        return false;

    merchant->onPlayerTrade(player, SHOPEVENT_BUY, onBuy, it.id, subType, amount, ignoreCap, inBackpacks);
    return true;
}
 
Code:
void ProtocolGame::parsePlayerPurchase(NetworkMessage &msg)
{
    uint16_t id = msg.get<uint16_t>();
    uint16_t count = msg.get<char>();
    uint16_t amount = msg.get<char>();
    bool ignoreCap = msg.get<char>();
    bool inBackpacks = false;
    msg.skip(1);
    addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerPurchaseItem, player->getID(), id, count, amount, ignoreCap, inBackpacks);
}
 
Code:
void ProtocolGame::parsePlayerPurchase(NetworkMessage &msg)
{
    uint16_t id = msg.get<uint16_t>();
    uint16_t count = msg.get<char>();
    uint16_t amount = msg.get<char>();
    bool ignoreCap = msg.get<char>();
    bool inBackpacks = false;
    msg.skip(1);
    addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerPurchaseItem, player->getID(), id, count, amount, ignoreCap, inBackpacks);
}

It worked!, thanks a lot man!!
 
Back
Top