summaryrefslogtreecommitdiff
path: root/src/net/ea
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-05-01 14:35:41 -0600
committerJared Adams <jaxad0127@gmail.com>2009-05-01 14:35:41 -0600
commit6a7d3f9343f29bd9b46f3bbac917aa190b42b14d (patch)
tree6de65bfdc540ea9ea1a065b013179f02a968d35d /src/net/ea
parentb6fb2326ffa687f6028d991e2d6203b3f2a92c5a (diff)
downloadmana-client-6a7d3f9343f29bd9b46f3bbac917aa190b42b14d.tar.gz
mana-client-6a7d3f9343f29bd9b46f3bbac917aa190b42b14d.tar.bz2
mana-client-6a7d3f9343f29bd9b46f3bbac917aa190b42b14d.tar.xz
mana-client-6a7d3f9343f29bd9b46f3bbac917aa190b42b14d.zip
Merge the NPC dialogs into one
Also add support for the new TMWServ NPC packets
Diffstat (limited to 'src/net/ea')
-rw-r--r--src/net/ea/beinghandler.cpp7
-rw-r--r--src/net/ea/npchandler.cpp49
-rw-r--r--src/net/ea/playerhandler.cpp12
3 files changed, 25 insertions, 43 deletions
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp
index 65d19040..1f5f79c7 100644
--- a/src/net/ea/beinghandler.cpp
+++ b/src/net/ea/beinghandler.cpp
@@ -35,12 +35,8 @@
#include "npc.h"
#include "playerrelations.h"
-#include "gui/npctextdialog.h"
-
#include <iostream>
-extern NpcTextDialog *npcTextDialog;
-
namespace EAthena {
const int EMOTION_TIME = 150; /**< Duration of emotion icon */
@@ -246,9 +242,6 @@ void BeingHandler::handleMessage(MessageIn &msg)
// A being should be removed or has died
id = msg.readInt32();
- if (id == current_npc)
- npcTextDialog->showCloseButton();
-
dstBeing = beingManager->findBeing(id);
if (!dstBeing)
diff --git a/src/net/ea/npchandler.cpp b/src/net/ea/npchandler.cpp
index 5c41c380..16137476 100644
--- a/src/net/ea/npchandler.cpp
+++ b/src/net/ea/npchandler.cpp
@@ -32,10 +32,7 @@
#include "localplayer.h"
#include "npc.h"
-#include "gui/npctextdialog.h"
-#include "gui/npcintegerdialog.h"
-#include "gui/npclistdialog.h"
-#include "gui/npcstringdialog.h"
+#include "gui/npcdialog.h"
#include <SDL_types.h>
@@ -68,57 +65,58 @@ void NpcHandler::handleMessage(MessageIn &msg)
msg.readInt16(); // length
current_npc = msg.readInt32();
player_node->setAction(LocalPlayer::STAND);
- npcListDialog->parseItems(msg.readString(msg.getLength() - 8));
- npcListDialog->setVisible(true);
- npcListDialog->requestFocus();
+ npcDialog->setNpc(current_npc);
+ npcDialog->choiceRequest();
+ npcDialog->parseListItems(msg.readString(msg.getLength() - 8));
+ npcDialog->setVisible(true);
break;
case SMSG_NPC_MESSAGE:
msg.readInt16(); // length
current_npc = msg.readInt32();
player_node->setAction(LocalPlayer::STAND);
- npcTextDialog->addText(msg.readString(msg.getLength() - 8));
- npcTextDialog->setVisible(true);
- npcTextDialog->requestFocus();
+ npcDialog->setNpc(current_npc);
+ npcDialog->addText(msg.readString(msg.getLength() - 8));
+ npcDialog->setVisible(true);
break;
case SMSG_NPC_CLOSE:
id = msg.readInt32();
// If we're talking to that NPC, show the close button
if (id == current_npc)
- npcTextDialog->showCloseButton();
+ npcDialog->showCloseButton();
// Otherwise, move on as an empty dialog doesn't help
else
- npcTextDialog->closeDialog(id);
+ npcDialog->closeDialog();
break;
+ /* Note: with the new dialog, we automaticilly assume "Next"
case SMSG_NPC_NEXT:
id = msg.readInt32();
// If we're talking to that NPC, show the next button
- if (id == current_npc)
- npcTextDialog->showNextButton();
+ if (id == current_npc && dialog)
+ dialog->showNextButton();
// Otherwise, move on as an empty dialog doesn't help
- else
- npcTextDialog->nextDialog(id);
+ else if (dialog)
+ nextDialog(id);
break;
-
+ */
case SMSG_NPC_INT_INPUT:
// Request for an integer
current_npc = msg.readInt32();
player_node->setAction(LocalPlayer::STAND);
- npcIntegerDialog->setRange(0, 2147483647);
- npcIntegerDialog->setDefaultValue(0);
- npcIntegerDialog->setVisible(true);
- npcIntegerDialog->requestFocus();
+ npcDialog->setNpc(current_npc);
+ npcDialog->integerRequest(0);
+ npcDialog->setVisible(true);
break;
case SMSG_NPC_STR_INPUT:
// Request for a string
current_npc = msg.readInt32();
player_node->setAction(LocalPlayer::STAND);
- npcStringDialog->setValue("");
- npcStringDialog->setVisible(true);
- npcStringDialog->requestFocus();
+ npcDialog->setNpc(current_npc);
+ npcDialog->textRequest("");
+ npcDialog->setVisible(true);
break;
}
}
@@ -140,6 +138,8 @@ void NpcHandler::closeDialog(int npcId)
{
MessageOut outMsg(CMSG_NPC_CLOSE);
outMsg.writeInt32(npcId);
+ npcDialog->setText("");
+ npcDialog->setVisible(false);
}
void NpcHandler::listInput(int npcId, int value)
@@ -158,6 +158,7 @@ void NpcHandler::integerInput(int npcId, int value)
void NpcHandler::stringInput(int npcId, const std::string &value)
{
+ printf("I got a %s", value.c_str());
MessageOut outMsg(CMSG_NPC_STR_RESPONSE);
outMsg.writeInt16(value.length() + 9);
outMsg.writeInt32(npcId);
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index ef6edc87..3f8fbc09 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -35,10 +35,6 @@
#include "gui/buy.h"
#include "gui/buysell.h"
#include "gui/gui.h"
-#include "gui/npctextdialog.h"
-#include "gui/npcintegerdialog.h"
-#include "gui/npclistdialog.h"
-#include "gui/npcstringdialog.h"
#include "gui/okdialog.h"
#include "gui/sell.h"
#include "gui/skill.h"
@@ -81,14 +77,6 @@ namespace {
{
player_node->revive();
deathNotice = NULL;
- npcIntegerDialog->reset();
- npcIntegerDialog->setVisible(false);
- npcListDialog->reset();
- npcListDialog->setVisible(false);
- npcStringDialog->setValue("");
- npcStringDialog->setVisible(false);
- npcTextDialog->clearText();
- npcTextDialog->setVisible(false);
buyDialog->setVisible(false);
sellDialog->setVisible(false);
buySellDialog->setVisible(false);