summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-01-07 15:22:44 +0000
committerIra Rice <irarice@gmail.com>2009-01-18 14:10:43 -0700
commit8c79a56c0f3710e20888d1031f179dc98f37e0a4 (patch)
tree7051569ba28b217941cf39cf4776d1343b2c173f /src/net
parent8446b826926ebbdb584cdfcd3dc5e4eb5bd142f1 (diff)
downloadmana-client-8c79a56c0f3710e20888d1031f179dc98f37e0a4.tar.gz
mana-client-8c79a56c0f3710e20888d1031f179dc98f37e0a4.tar.bz2
mana-client-8c79a56c0f3710e20888d1031f179dc98f37e0a4.tar.xz
mana-client-8c79a56c0f3710e20888d1031f179dc98f37e0a4.zip
Add dialogs to input text and numbers for scripts
Diffstat (limited to 'src/net')
-rw-r--r--src/net/npchandler.cpp22
-rw-r--r--src/net/protocol.h5
2 files changed, 26 insertions, 1 deletions
diff --git a/src/net/npchandler.cpp b/src/net/npchandler.cpp
index 4f3c4354..c597e31c 100644
--- a/src/net/npchandler.cpp
+++ b/src/net/npchandler.cpp
@@ -28,10 +28,14 @@
#include "../npc.h"
#include "../gui/npc_text.h"
+#include "../gui/npcintegerdialog.h"
#include "../gui/npclistdialog.h"
+#include "../gui/npcstringdialog.h"
+extern NpcIntegerDialog *npcIntegerDialog;
extern NpcListDialog *npcListDialog;
extern NpcTextDialog *npcTextDialog;
+extern NpcStringDialog *npcStringDialog;
NPCHandler::NPCHandler()
{
@@ -40,6 +44,8 @@ NPCHandler::NPCHandler()
SMSG_NPC_MESSAGE,
SMSG_NPC_NEXT,
SMSG_NPC_CLOSE,
+ SMSG_NPC_INT_INPUT,
+ SMSG_NPC_STR_INPUT,
0
};
handledMessages = _messages;
@@ -79,5 +85,21 @@ void NPCHandler::handleMessage(MessageIn *msg)
case SMSG_NPC_NEXT:
// Next button in NPC dialog, currently unused
break;
+
+ case SMSG_NPC_INT_INPUT:
+ // Request for an integer
+ id = msg->readInt32();
+ current_npc = dynamic_cast<NPC*>(beingManager->findBeing(id));
+ npcIntegerDialog->prepDialog(0, 0, 2147483647);
+ npcIntegerDialog->setVisible(true);
+ break;
+
+ case SMSG_NPC_STR_INPUT:
+ // Request for a string
+ id = msg->readInt32();
+ current_npc = dynamic_cast<NPC*>(beingManager->findBeing(id));
+ npcStringDialog->setValue("");
+ npcStringDialog->setVisible(true);
+ break;
}
}
diff --git a/src/net/protocol.h b/src/net/protocol.h
index 783283ba..0538abf4 100644
--- a/src/net/protocol.h
+++ b/src/net/protocol.h
@@ -79,7 +79,8 @@
#define SMSG_NPC_SELL 0x00c7
#define SMSG_NPC_BUY_RESPONSE 0x00ca
#define SMSG_NPC_SELL_RESPONSE 0x00cb
-
+#define SMSG_NPC_INT_INPUT 0x0142 /**< Integer input */
+#define SMSG_NPC_STR_INPUT 0x01d4 /**< String input */
#define SMSG_PLAYER_CHAT 0x008e /**< Player talks */
#define SMSG_WHISPER 0x0097 /**< Whisper Recieved */
#define SMSG_WHISPER_RESPONSE 0x0098
@@ -128,6 +129,8 @@
#define CMSG_NPC_LIST_CHOICE 0x00b8
#define CMSG_NPC_NEXT_REQUEST 0x00b9
#define CMSG_NPC_SELL_REQUEST 0x00c9
+#define CMSG_NPC_INT_RESPONSE 0x0143
+#define CMSG_NPC_STR_RESPONSE 0x01d5
#define CMSG_SKILL_LEVELUP_REQUEST 0x0112
#define CMSG_STAT_UPDATE_REQUEST 0x00bb
#define CMSG_TRADE_ITEM_ADD_REQUEST 0x00e8