All pastes #1407355 Raw Edit

Something

public diff v1 · immutable
#1407355 ·published 2009-04-29 14:14 UTC
rendered paste body
diff --git a/src/net/tmwserv/npchandler.cpp b/src/net/tmwserv/npchandler.cppindex 5670bd6..df4d8f2 100644--- a/src/net/tmwserv/npchandler.cpp+++ b/src/net/tmwserv/npchandler.cpp@@ -48,6 +48,8 @@ NpcHandler::NpcHandler()         GPMSG_NPC_POST,         GPMSG_NPC_MESSAGE,         GPMSG_NPC_ERROR,+        GPMSG_NPC_CLOSE_MESSAGE,+        GPMSG_NPC_NEXT_MESSAGE,         0     };     handledMessages = _messages;@@ -62,11 +64,10 @@ void NpcHandler::handleMessage(MessageIn &msg)         return;     } -    current_npc = being->getId();-     switch (msg.getId())     {         case GPMSG_NPC_CHOICE:+            current_npc = being->getId();             npcListDialog->reset();             while (msg.getUnreadLength())             {@@ -76,6 +77,7 @@ void NpcHandler::handleMessage(MessageIn &msg)             break;          case GPMSG_NPC_POST:+            current_npc = being->getId();             npcTextDialog->setVisible(false);             npcPostDialog->clear();             npcPostDialog->setVisible(true);@@ -83,12 +85,32 @@ void NpcHandler::handleMessage(MessageIn &msg)          case GPMSG_NPC_ERROR:             current_npc = NULL;+         case GPMSG_NPC_MESSAGE:+            current_npc = being->getId();             npcTextDialog->addText(msg.readString(msg.getUnreadLength()));             npcListDialog->setVisible(false);             npcTextDialog->setVisible(true);             npcPostDialog->setVisible(false);             break;++        case GPMSG_NPC_CLOSE_MESSAGE:+            // If we're talking to that NPC, show the close button+            if (being->getId() == current_npc)+                npcTextDialog->showCloseButton();+            // Othersize, move on as a empty dialog doesn't help+            else+                npcTextDialog->closeDialog(being->getId());+            break;++        case GPMSG_NPC_NEXT_MESSAGE:+            // If we're talking to that NPC, show the next button+            if (being->getId() == current_npc)+                npcTextDialog->showNextButton();+            // Otherwise, move on as an empty dialog doesn't help+            else+                npcTextDialog->nextDialog(being->getId());+            break;     } } diff --git a/src/net/tmwserv/protocol.h b/src/net/tmwserv/protocol.hindex fc52bd5..30ba956 100644--- a/src/net/tmwserv/protocol.h+++ b/src/net/tmwserv/protocol.h@@ -111,6 +111,8 @@ enum {     GPMSG_BEING_ATTACK             = 0x0291, // W being id     PGMSG_SAY                      = 0x02A0, // S text     GPMSG_SAY                      = 0x02A1, // W being id, S text++    // Handles NPC dialogs     GPMSG_NPC_CHOICE               = 0x02B0, // W being id, { S text }*     GPMSG_NPC_MESSAGE              = 0x02B1, // W being id, B* text     PGMSG_NPC_TALK                 = 0x02B2, // W being id@@ -120,9 +122,14 @@ enum {     GPMSG_NPC_SELL                 = 0x02B6, // W being id, { W item id, W amount, W cost }*     PGMSG_NPC_BUYSELL              = 0x02B7, // W item id, W amount     GPMSG_NPC_ERROR                = 0x02B8, // B error+    GPMSG_NPC_NEXT_MESSAGE         = 0x02B9, // W being id +    GPMSG_NPC_CLOSE_MESSAGE        = 0x02BA, // W being id++    // Handles NPC postal service     GPMSG_NPC_POST                 = 0x02D0, // W being id     PGMSG_NPC_POST_SEND            = 0x02D1, // S name, S text, W item id     GPMSG_NPC_POST_GET             = 0x02D2, // W being id, { S name, S text, W item id }+     PGMSG_TRADE_REQUEST            = 0x02C0, // W being id     GPMSG_TRADE_REQUEST            = 0x02C1, // W being id     GPMSG_TRADE_START              = 0x02C2, // -