mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 03:54:54 +02:00
Add sell all button to NPC trade
This commit is contained in:
@@ -352,6 +352,7 @@ namespace Otc
|
||||
GameNewSpeedLaw = 36,
|
||||
GameForceFirstAutoWalkStep = 37,
|
||||
GameMinimapRemove = 38,
|
||||
GameDoubleShopSellAmount = 39,
|
||||
// 51-100 reserved to be defined in lua
|
||||
LastGameFeature = 101
|
||||
};
|
||||
|
@@ -698,9 +698,14 @@ void ProtocolGame::parsePlayerGoods(const InputMessagePtr& msg)
|
||||
int size = msg->getU8();
|
||||
for(int i = 0; i < size; i++) {
|
||||
int itemId = msg->getU16();
|
||||
int count = msg->getU8();
|
||||
int amount;
|
||||
|
||||
goods.push_back(std::make_tuple(Item::create(itemId), count));
|
||||
if(g_game.getFeature(Otc::GameDoubleShopSellAmount))
|
||||
amount = msg->getU16();
|
||||
else
|
||||
amount = msg->getU8();
|
||||
|
||||
goods.push_back(std::make_tuple(Item::create(itemId), amount));
|
||||
}
|
||||
|
||||
g_game.processPlayerGoods(money, goods);
|
||||
|
@@ -319,7 +319,10 @@ void ProtocolGame::sendSellItem(int itemId, int subType, int amount, bool ignore
|
||||
msg->addU8(Proto::ClientSellItem);
|
||||
msg->addU16(itemId);
|
||||
msg->addU8(subType);
|
||||
msg->addU8(amount);
|
||||
if(g_game.getFeature(Otc::GameDoubleShopSellAmount))
|
||||
msg->addU16(amount);
|
||||
else
|
||||
msg->addU8(amount);
|
||||
msg->addU8(ignoreEquipped ? 0x01 : 0x00);
|
||||
send(msg);
|
||||
}
|
||||
|
Reference in New Issue
Block a user