summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/buy.cpp9
-rw-r--r--src/gui/buysell.cpp14
-rw-r--r--src/gui/npc_text.cpp11
-rw-r--r--src/gui/npcintegerdialog.cpp8
-rw-r--r--src/gui/npclistdialog.cpp8
-rw-r--r--src/gui/npcstringdialog.cpp10
-rw-r--r--src/gui/sell.cpp9
7 files changed, 25 insertions, 44 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 6d336e4c..7cefa3e5 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -37,8 +37,7 @@
#ifdef TMWSERV_SUPPORT
#include "net/tmwserv/gameserver/player.h"
#else
-#include "net/messageout.h"
-#include "net/ea/protocol.h"
+#include "net/ea/npchandler.h"
#endif
#include "resources/iteminfo.h"
@@ -188,14 +187,12 @@ void BuyDialog::action(const gcn::ActionEvent &event)
else if (event.getId() == "buy" && mAmountItems > 0 &&
mAmountItems <= mMaxItems)
{
+ // Net::getNpcHandler()->buyItem(current_npc, mShopItems->at(selectedItem)->getId(), mAmountItems);
#ifdef TMWSERV_SUPPORT
Net::GameServer::Player::tradeWithNPC
(mShopItems->at(selectedItem)->getId(), mAmountItems);
#else
- MessageOut outMsg(CMSG_NPC_BUY_REQUEST);
- outMsg.writeInt16(8);
- outMsg.writeInt16(mAmountItems);
- outMsg.writeInt16(mShopItems->at(selectedItem)->getId());
+ npcHandler->buyItem(current_npc, mShopItems->at(selectedItem)->getId(), mAmountItems);
#endif
// Update money and adjust the max number of items that can be bought
diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp
index a0e2fc93..33e12e87 100644
--- a/src/gui/buysell.cpp
+++ b/src/gui/buysell.cpp
@@ -25,8 +25,7 @@
#include "gui/button.h"
-#include "net/messageout.h"
-#include "net/ea/protocol.h"
+#include "net/ea/npchandler.h"
#include "utils/gettext.h"
@@ -77,25 +76,22 @@ void BuySellDialog::setVisible(bool visible)
void BuySellDialog::action(const gcn::ActionEvent &event)
{
setVisible(false);
- int action = 0;
NPC::isTalking = false;
if (event.getId() == "Buy")
{
- action = 0;
+ // Net::getNpcHandler()->buy(current_npc);
+ npcHandler->buy(current_npc);
}
else if (event.getId() == "Sell")
{
- action = 1;
+ // Net::getNpcHandler()->buy(current_npc);
+ npcHandler->sell(current_npc);
}
else if (event.getId() == "Cancel")
{
current_npc = 0;
return;
}
-
- MessageOut outMsg(CMSG_NPC_BUY_SELL_REQUEST);
- outMsg.writeInt32(current_npc);
- outMsg.writeInt8(action);
}
diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp
index 31f48486..b33b9970 100644
--- a/src/gui/npc_text.cpp
+++ b/src/gui/npc_text.cpp
@@ -28,11 +28,10 @@
#include "../npc.h"
-#include "../net/messageout.h"
#ifdef TMWSERV_SUPPORT
#include "../net/tmwserv/gameserver/player.h"
#else
-#include "../net/ea/protocol.h"
+#include "../net/ea/npchandler.h"
#endif
#include "../utils/gettext.h"
@@ -126,19 +125,19 @@ void NpcTextDialog::action(const gcn::ActionEvent &event)
void NpcTextDialog::nextDialog(int npcID)
{
+ // Net::getNpcHandler()->nextDialog(npcID);
#ifdef TMWSERV_SUPPORT
Net::GameServer::Player::talkToNPC(npcID, false);
#else
- MessageOut outMsg(CMSG_NPC_NEXT_REQUEST);
- outMsg.writeInt32(npcID);
+ npcHandler->nextDialog(npcID);
#endif
}
void NpcTextDialog::closeDialog(int npcID)
{
+ // Net::getNpcHandler()->closeDialog(npcID);
#ifdef EATHENA_SUPPORT
- MessageOut outMsg(CMSG_NPC_CLOSE);
- outMsg.writeInt32(npcID);
+ npcHandler->closeDialog(npcID);
#endif
}
diff --git a/src/gui/npcintegerdialog.cpp b/src/gui/npcintegerdialog.cpp
index 4d2ae1ce..86dad4ab 100644
--- a/src/gui/npcintegerdialog.cpp
+++ b/src/gui/npcintegerdialog.cpp
@@ -28,9 +28,8 @@
#include "../npc.h"
-#include "../net/messageout.h"
#ifdef EATHENA_SUPPORT
-#include "../net/ea/protocol.h"
+#include "../net/ea/npchandler.h"
#endif
#include "../utils/gettext.h"
@@ -119,10 +118,9 @@ void NpcIntegerDialog::action(const gcn::ActionEvent &event)
setVisible(false);
NPC::isTalking = false;
+ // Net::getNpcHandler()->integerInput(current_npc, mValueField->getValue());
#ifdef EATHENA_SUPPORT
- MessageOut outMsg(CMSG_NPC_INT_RESPONSE);
- outMsg.writeInt32(current_npc);
- outMsg.writeInt32(mValueField->getValue());
+ npcHandler->integerInput(current_npc, mValueField->getValue());
#endif
mValueField->reset();
diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp
index efac8954..8b0128d5 100644
--- a/src/gui/npclistdialog.cpp
+++ b/src/gui/npclistdialog.cpp
@@ -31,11 +31,10 @@
#include "../npc.h"
-#include "../net/messageout.h"
#ifdef TMWSERV_SUPPORT
#include "../net/tmwserv/gameserver/player.h"
#else
-#include "../net/ea/protocol.h"
+#include "../net/ea/npchandler.h"
#endif
#include "../utils/gettext.h"
@@ -133,12 +132,11 @@ void NpcListDialog::action(const gcn::ActionEvent &event)
saveWindowState();
reset();
+ // Net::getNpcHandler()->listInput(current_npc, choice);
#ifdef TMWSERV_SUPPORT
Net::GameServer::Player::selectFromNPC(current_npc, choice);
#else
- MessageOut outMsg(CMSG_NPC_LIST_CHOICE);
- outMsg.writeInt32(current_npc);
- outMsg.writeInt8(choice);
+ npcHandler->listInput(current_npc, choice);
#endif
}
}
diff --git a/src/gui/npcstringdialog.cpp b/src/gui/npcstringdialog.cpp
index e5137d9c..8d45e332 100644
--- a/src/gui/npcstringdialog.cpp
+++ b/src/gui/npcstringdialog.cpp
@@ -28,9 +28,8 @@
#include "../npc.h"
-#include "../net/messageout.h"
#ifdef EATHENA_SUPPORT
-#include "../net/ea/protocol.h"
+#include "../net/ea/npchandler.h"
#endif
#include "../utils/gettext.h"
@@ -87,12 +86,9 @@ void NpcStringDialog::action(const gcn::ActionEvent &event)
std::string text = mValueField->getText();
mValueField->setText("");
+ // Net::getNpcHandler()->stringInput(current_npc, text);
#ifdef EATHENA_SUPPORT
- MessageOut outMsg(CMSG_NPC_STR_RESPONSE);
- outMsg.writeInt16(text.length() + 9);
- outMsg.writeInt32(current_npc);
- outMsg.writeString(text, text.length());
- outMsg.writeInt8(0);
+ npcHandler->stringInput(current_npc, text);
#endif
}
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index 1057c2e9..3b4e9982 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -34,11 +34,10 @@
#include "shopitem.h"
#include "units.h"
-#include "net/messageout.h"
#ifdef TMWSERV_SUPPORT
#include "net/tmwserv/gameserver/player.h"
#else
-#include "net/ea/protocol.h"
+#include "net/ea/npchandler.h"
#endif
#include "resources/iteminfo.h"
@@ -207,14 +206,12 @@ void SellDialog::action(const gcn::ActionEvent &event)
mAmountItems * mShopItems->at(selectedItem)->getPrice();
mMaxItems -= mAmountItems;
while (mAmountItems > 0) {
- MessageOut outMsg(CMSG_NPC_SELL_REQUEST);
- outMsg.writeInt16(8);
- outMsg.writeInt16(item->getCurrentInvIndex() + 2);
// This order is important, item->getCurrentInvIndex() would return
// the inventory index of the next Duplicate otherwise.
sellCount = item->sellCurrentDuplicate(mAmountItems);
mAmountItems -= sellCount;
- outMsg.writeInt16(sellCount);
+ // Net::getNpcHandler()->sellItem(current_npc, item->getCurrentInvIndex(), sellCount);
+ npcHandler->sellItem(current_npc, item->getCurrentInvIndex(), sellCount);
}
#endif