Add sell all button to NPC trade

This commit is contained in:
Eduardo Bart
2013-02-15 16:38:57 -02:00
parent 28cdd6aa53
commit 67fc77d507
6 changed files with 65 additions and 18 deletions

View File

@@ -352,6 +352,7 @@ namespace Otc
GameNewSpeedLaw = 36,
GameForceFirstAutoWalkStep = 37,
GameMinimapRemove = 38,
GameDoubleShopSellAmount = 39,
// 51-100 reserved to be defined in lua
LastGameFeature = 101
};

View File

@@ -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);

View File

@@ -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);
}