summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorJan-Fabian Humann <malastare@gmx.net>2005-04-06 14:46:50 +0000
committerJan-Fabian Humann <malastare@gmx.net>2005-04-06 14:46:50 +0000
commitccf84aa701dc938e7e390339c8ca5c2c7e5a21c5 (patch)
tree53c4f5ff30a981f0f946ab66f4b3c90dc730dd28 /src/game.cpp
parentc74357ef532d9c90ec1605048b9602da78e7928c (diff)
downloadmana-ccf84aa701dc938e7e390339c8ca5c2c7e5a21c5.tar.gz
mana-ccf84aa701dc938e7e390339c8ca5c2c7e5a21c5.tar.bz2
mana-ccf84aa701dc938e7e390339c8ca5c2c7e5a21c5.tar.xz
mana-ccf84aa701dc938e7e390339c8ca5c2c7e5a21c5.zip
update for trade: now on right click
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp65
1 files changed, 64 insertions, 1 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 118e6d3d..f4ecd0b7 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -358,6 +358,14 @@ void do_input()
WFIFOSET(7);
current_npc = id;
}
+ } else {
+ id = find_pc(mx, my);
+ if (id != 0) {
+ // Begin a trade
+ WFIFOW(0) = net_w_value(0x00e4);
+ WFIFOL(2) = net_l_value(id);
+ WFIFOSET(6);
+ }
}
}
}
@@ -740,7 +748,62 @@ void do_parse() {
npcTextDialog->setVisible(true);
current_npc = RFIFOL(4);
break;
-
+
+ // Trade: Receiving a request to trade
+ case 0x00e5:
+ //printf("Getting a call from %s\n", RFIFOP(2));
+ requestTradeDialog->request(RFIFOP(2));
+ break;
+
+ // Trade: Response
+ case 0x00e7:
+ switch (RFIFOB(2)) {
+ case 0:
+ // too far away
+ chatWindow->chat_log("Trading isn't possible. Trade partner is too far away.", BY_SERVER);
+ break;
+ case 1:
+ // Character doesn't exist
+ chatWindow->chat_log("Trading isn't possible. Character doesn't exist.", BY_SERVER);
+ break;
+ case 2:
+ // invite request check failed...
+ chatWindow->chat_log("Trade cancelled due to an unknown reason.", BY_SERVER);
+ break;
+ case 3:
+ // Trade accepted
+ tradeWindow->setVisible(true);
+ break;
+ case 4:
+ // Trade cancelled
+ chatWindow->chat_log("Trade cancelled.", BY_SERVER);
+ break;
+ default:
+ // Shouldn't happen as well, but to be sure
+ chatWindow->chat_log("Unhandled trade cancel packet",
+ BY_SERVER);
+ break;
+ }
+ break;
+ // Trade: Item successfully added
+ case 0x00ea:
+ switch (RFIFOB(4)) {
+ case 0:
+ //printf("Item successfully added\n");
+ // Add code to be added
+ break;
+ default:
+ //printf("Unhandled 0x00ea byte!\n");
+ break;
+ }
+ break;
+
+ // Trade: Trade cancelled
+ case 0x00ee:
+ chatWindow->chat_log("Trade cancelled.", BY_SERVER);
+ tradeWindow->setVisible(false);
+ break;
+
// Get the items
// Only called on map load / warp
case 0x01ee: