From 8c79a56c0f3710e20888d1031f179dc98f37e0a4 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Wed, 7 Jan 2009 15:22:44 +0000 Subject: Add dialogs to input text and numbers for scripts --- src/npc.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/npc.cpp') diff --git a/src/npc.cpp b/src/npc.cpp index a9aa216c..ae5ca476 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -134,6 +134,24 @@ void NPC::dialogChoice(char choice) outMsg.writeInt8(choice); } +void NPC::integerInput(int value) +{ + MessageOut outMsg(mNetwork); + outMsg.writeInt16(CMSG_NPC_INT_RESPONSE); + outMsg.writeInt32(mId); + outMsg.writeInt32(value); +} + +void NPC::stringInput(const std::string &value) +{ + MessageOut outMsg(mNetwork); + outMsg.writeInt16(CMSG_NPC_STR_RESPONSE); + outMsg.writeInt16(value.length() + 8); + outMsg.writeInt32(mId); + outMsg.writeString(value, value.length()); + outMsg.writeInt8(0); // Just to be safe +} + /* * TODO Unify the buy() and sell() methods, without sacrificing readability of * the code calling the method. buy(bool buySell) would be bad... -- cgit v1.2.3-60-g2f50