It's client sided not server thing i think,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
![]()
Thanks in advance!
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.
bool inBackpacks = msg.getByte() != 0;
msg.skipBytes(1);
bool inBackpacks = false;
https://github.com/otland/forgottenserver/blob/master/src/protocolgame.cpp#L958
Change
Code:bool inBackpacks = msg.getByte() != 0;
To
Code:msg.skipBytes(1); bool inBackpacks = false;
bool inBackpacks = msg.getByte() != 0;
bool inBackpacks = msg.get<char>();
msg.skipBytes(1);
bool inBackpacks = false;
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).
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);
}
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;
}
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); }