summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/buy.cpp12
-rw-r--r--src/gui/sell.cpp15
2 files changed, 7 insertions, 20 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 9ac37e96..6cfe5e18 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -31,9 +31,8 @@
#include "slider.h"
#include "../npc.h"
-
+#include "../net/gameserver/player.h"
#include "../resources/itemdb.h"
-
#include "../utils/tostring.h"
@@ -176,13 +175,8 @@ void BuyDialog::action(const gcn::ActionEvent &event)
else if (event.getId() == "buy" && mAmountItems > 0 &&
mAmountItems <= mMaxItems)
{
- // XXX Convert for new server
- /*
- MessageOut outMsg(CMSG_NPC_BUY_REQUEST);
- outMsg.writeShort(8);
- outMsg.writeShort(mAmountItems);
- outMsg.writeShort(mShopItems->at(selectedItem).id);
- */
+ Net::GameServer::Player::tradeWithNPC
+ (mShopItems->at(selectedItem).id, mAmountItems);
// Update money and adjust the max number of items that can be bought
mMoney -= mAmountItems * mShopItems->at(selectedItem).price;
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index 53746248..b601d70c 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -35,10 +35,9 @@
#include "../item.h"
#include "../npc.h"
-
-#include "../resources/iteminfo.h"
+#include "../net/gameserver/player.h"
#include "../resources/itemdb.h"
-
+#include "../resources/iteminfo.h"
#include "../utils/tostring.h"
SellDialog::SellDialog():
@@ -177,14 +176,8 @@ void SellDialog::action(const gcn::ActionEvent &event)
else if (event.getId() == "sell" && mAmountItems > 0
&& mAmountItems <= mMaxItems)
{
- // Attempt sell
- // XXX Convert for new server
- /*
- MessageOut outMsg(CMSG_NPC_SELL_REQUEST);
- outMsg.writeShort(8);
- outMsg.writeShort(mShopItems->at(selectedItem).index);
- outMsg.writeShort(mAmountItems);
- */
+ Net::GameServer::Player::tradeWithNPC
+ (mShopItems->at(selectedItem).id, mAmountItems);
mMaxItems -= mAmountItems;
mShopItems->getShop()->at(selectedItem).quantity = mMaxItems;