summaryrefslogtreecommitdiff
path: root/src/gamehandler.cpp
diff options
context:
space:
mode:
authorAaron Marks <nymacro@gmail.com>2005-08-04 08:54:03 +0000
committerAaron Marks <nymacro@gmail.com>2005-08-04 08:54:03 +0000
commitca4fec29828b55ea66c5835ab20d2287bb1eb4ff (patch)
tree7211660bd5fed954a82a234faf14de1db0d612ab /src/gamehandler.cpp
parent18b778662388e98e90b13f28f28a83911ee96e95 (diff)
downloadmanaserv-ca4fec29828b55ea66c5835ab20d2287bb1eb4ff.tar.gz
manaserv-ca4fec29828b55ea66c5835ab20d2287bb1eb4ff.tar.bz2
manaserv-ca4fec29828b55ea66c5835ab20d2287bb1eb4ff.tar.xz
manaserv-ca4fec29828b55ea66c5835ab20d2287bb1eb4ff.zip
Added basic inventory (not fully functional)
Extended GameHandler Extended protocol Fixed problem with SQL query
Diffstat (limited to 'src/gamehandler.cpp')
-rw-r--r--src/gamehandler.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/gamehandler.cpp b/src/gamehandler.cpp
index 340e8690..568c7866 100644
--- a/src/gamehandler.cpp
+++ b/src/gamehandler.cpp
@@ -22,20 +22,37 @@
*/
#include "gamehandler.h"
+#include "messageout.h"
#include <iostream>
void GameHandler::receiveMessage(NetComputer &computer, MessageIn &message)
{
- if (computer.getAccount() == NULL)
+ if (computer.getCharacter() == NULL)
return;
+ MessageOut result;
+
switch (message.getId())
{
case CMSG_PICKUP:
- break;
+ {
+ // add item to inventory (this is too simplistic atm)
+ unsigned int itemId = message.readLong();
+
+ // remove the item from world map
+ // send feedback
+ computer.getCharacter()->addInventory(itemId);
+ result.writeShort(SMSG_PICKUP_RESPONSE);
+ result.writeByte(PICKUP_OK);
+ } break;
+
case CMSG_USE_OBJECT:
- break;
+ {
+ unsigned int itemId = message.readLong();
+ result.writeShort(SMSG_USE_RESPONSE);
+ result.writeByte(USE_OK);
+ } break;
case CMSG_TARGET:
break;
@@ -63,4 +80,6 @@ void GameHandler::receiveMessage(NetComputer &computer, MessageIn &message)
<< " (" << message.getId() << ")" << std::endl;
break;
}
+
+ computer.send(result.getPacket());
}