diff options
Diffstat (limited to 'src/game-server/inventory.cpp')
-rw-r--r-- | src/game-server/inventory.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/game-server/inventory.cpp b/src/game-server/inventory.cpp index af780117..767ed72e 100644 --- a/src/game-server/inventory.cpp +++ b/src/game-server/inventory.cpp @@ -136,6 +136,9 @@ void Inventory::sendFull() const } } + m.writeByte(255); + m.writeLong(mPoss->money); + gameHandler->sendTo(mClient, m); } @@ -303,6 +306,26 @@ int Inventory::count(int itemId) const return nb; } +bool Inventory::changeMoney(int amount) +{ + if (amount == 0) + { + return true; + } + + int money = mPoss->money + amount; + if (money < 0) + { + return false; + } + + prepare(); + + mPoss->money = money; + msg.writeByte(255); + msg.writeLong(money); +} + void Inventory::freeIndex(int i) { InventoryItem &it = mPoss->inventory[i]; |