summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-04-02 22:37:35 -0600
committerJared Adams <jaxad0127@gmail.com>2009-04-02 22:37:35 -0600
commitd13b3eaca82e3547c84f60b9b135464ff3a51cf0 (patch)
treee4ede7c58a991b85ff208a7155d0b74236f23bac /src/net
parent4916370e6130bfee7eb9ae486f03391d2214ecf4 (diff)
downloadmana-d13b3eaca82e3547c84f60b9b135464ff3a51cf0.tar.gz
mana-d13b3eaca82e3547c84f60b9b135464ff3a51cf0.tar.bz2
mana-d13b3eaca82e3547c84f60b9b135464ff3a51cf0.tar.xz
mana-d13b3eaca82e3547c84f60b9b135464ff3a51cf0.zip
Start TMWServ's PlayerHandler and InventoryHandler
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/playerhandler.cpp2
-rw-r--r--src/net/ea/playerhandler.h2
-rw-r--r--src/net/playerhandler.h2
-rw-r--r--src/net/tmwserv/inventoryhandler.cpp43
-rw-r--r--src/net/tmwserv/inventoryhandler.h20
-rw-r--r--src/net/tmwserv/playerhandler.cpp63
-rw-r--r--src/net/tmwserv/playerhandler.h25
7 files changed, 152 insertions, 5 deletions
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index f0876a6e..29900730 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -487,7 +487,7 @@ void PlayerHandler::pickUp(FloorItem *floorItem)
outMsg.writeInt32(floorItem->getId());
}
-void PlayerHandler::setDirection(int direction)
+void PlayerHandler::setDirection(char direction)
{
// TODO
}
diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h
index cc84dec0..22f6a132 100644
--- a/src/net/ea/playerhandler.h
+++ b/src/net/ea/playerhandler.h
@@ -43,7 +43,7 @@ class PlayerHandler : public MessageHandler, public Net::PlayerHandler
void pickUp(FloorItem *floorItem);
- void setDirection(int direction);
+ void setDirection(char direction);
void setDestination(int x, int y, int direction = -1);
diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h
index 6e277dc3..63a1ea3d 100644
--- a/src/net/playerhandler.h
+++ b/src/net/playerhandler.h
@@ -41,7 +41,7 @@ class PlayerHandler
virtual void pickUp(FloorItem *floorItem) = 0;
- virtual void setDirection(int direction) = 0;
+ virtual void setDirection(char direction) = 0;
virtual void setDestination(int x, int y, int direction = -1) = 0;
diff --git a/src/net/tmwserv/inventoryhandler.cpp b/src/net/tmwserv/inventoryhandler.cpp
index f6522128..a342c1d3 100644
--- a/src/net/tmwserv/inventoryhandler.cpp
+++ b/src/net/tmwserv/inventoryhandler.cpp
@@ -23,6 +23,8 @@
#include "net/tmwserv/protocol.h"
+#include "net/tmwserv/gameserver/player.h"
+
#include "net/messagein.h"
#include "equipment.h"
@@ -77,3 +79,44 @@ void InventoryHandler::handleMessage(MessageIn &msg)
break;
}
}
+
+void InventoryHandler::equipItem(Item *item)
+{
+ Net::GameServer::Player::equip(item->getInvIndex());
+}
+
+void InventoryHandler::unequipItem(Item *item)
+{
+ Net::GameServer::Player::unequip(item->getInvIndex());
+}
+
+void InventoryHandler::useItem(Item *item)
+{
+ Net::GameServer::Player::useItem(item->getInvIndex());
+}
+
+void InventoryHandler::dropItem(Item *item, int amount)
+{
+ Net::GameServer::Player::drop(item->getInvIndex(), amount);
+}
+
+void InventoryHandler::splitItem(Item *item, int amount)
+{
+ // TODO
+}
+
+void InventoryHandler::openStorage()
+{
+ // TODO
+}
+
+void InventoryHandler::closeStorage()
+{
+ // TODO
+}
+
+void InventoryHandler::moveItem(StorageType source, int slot, int amount,
+ StorageType destination)
+{
+ // TODO
+}
diff --git a/src/net/tmwserv/inventoryhandler.h b/src/net/tmwserv/inventoryhandler.h
index 4144d89c..3d7fce1a 100644
--- a/src/net/tmwserv/inventoryhandler.h
+++ b/src/net/tmwserv/inventoryhandler.h
@@ -22,14 +22,32 @@
#ifndef NET_TMWSERV_INVENTORYHANDLER_H
#define NET_TMWSERV_INVENTORYHANDLER_H
+#include "net/inventoryhandler.h"
#include "net/messagehandler.h"
-class InventoryHandler : public MessageHandler
+class InventoryHandler : public MessageHandler, Net::InventoryHandler
{
public:
InventoryHandler();
void handleMessage(MessageIn &msg);
+
+ void equipItem(Item *item);
+
+ void unequipItem(Item *item);
+
+ void useItem(Item *item);
+
+ void dropItem(Item *item, int amount);
+
+ void splitItem(Item *item, int amount);
+
+ void openStorage();
+
+ void closeStorage();
+
+ void moveItem(StorageType source, int slot, int amount,
+ StorageType destination);
};
#endif
diff --git a/src/net/tmwserv/playerhandler.cpp b/src/net/tmwserv/playerhandler.cpp
index 106894a1..4643dd8a 100644
--- a/src/net/tmwserv/playerhandler.cpp
+++ b/src/net/tmwserv/playerhandler.cpp
@@ -23,8 +23,11 @@
#include "net/tmwserv/protocol.h"
+#include "net/tmwserv/gameserver/player.h"
+
#include "net/messagein.h"
+#include "effectmanager.h"
#include "engine.h"
#include "localplayer.h"
#include "log.h"
@@ -325,3 +328,63 @@ void PlayerHandler::handleMapChangeMessage(MessageIn &msg)
(int) scrollOffsetY);
viewport->scrollBy(scrollOffsetX, scrollOffsetY);
}
+
+void PlayerHandler::attack(Being *being)
+{
+ // TODO
+}
+
+void PlayerHandler::emote(int emoteId)
+{
+ // TODO
+}
+
+void PlayerHandler::increaseStat(LocalPlayer::Attribute attr)
+{
+ // TODO
+}
+
+void PlayerHandler::decreaseStat(LocalPlayer::Attribute attr)
+{
+ // TODO
+}
+
+void PlayerHandler::pickUp(FloorItem *floorItem)
+{
+ int id = floorItem->getId();
+ Net::GameServer::Player::pickUp(id >> 16, id & 0xFFFF);
+}
+
+void PlayerHandler::setDirection(char direction)
+{
+ Net::GameServer::Player::changeDir(direction);
+}
+
+void PlayerHandler::setDestination(int x, int y, int direction)
+{
+ Net::GameServer::Player::walk(x, y);
+ //Debugging fire burst
+ effectManager->trigger(15, x, y);
+}
+
+void PlayerHandler::changeAction(Being::Action action)
+{
+ if (action == Being::SIT)
+ player_node->setAction(action);
+ Net::GameServer::Player::changeAction(action);
+}
+
+void PlayerHandler::respawn()
+{
+ // TODO
+}
+
+void PlayerHandler::ingorePlayer(const std::string &player, bool ignore)
+{
+ // TODO
+}
+
+void PlayerHandler::ingoreAll(bool ignore)
+{
+ // TODO
+}
diff --git a/src/net/tmwserv/playerhandler.h b/src/net/tmwserv/playerhandler.h
index c8eacc38..572c8712 100644
--- a/src/net/tmwserv/playerhandler.h
+++ b/src/net/tmwserv/playerhandler.h
@@ -23,14 +23,37 @@
#define NET_TMWSERV_PLAYERHANDLER_H
#include "net/messagehandler.h"
+#include "net/playerhandler.h"
-class PlayerHandler : public MessageHandler
+class PlayerHandler : public MessageHandler, public Net::PlayerHandler
{
public:
PlayerHandler();
void handleMessage(MessageIn &msg);
+ void attack(Being *being);
+
+ void emote(int emoteId);
+
+ void increaseStat(LocalPlayer::Attribute attr);
+
+ void decreaseStat(LocalPlayer::Attribute attr);
+
+ void pickUp(FloorItem *floorItem);
+
+ void setDirection(char direction);
+
+ void setDestination(int x, int y, int direction = -1);
+
+ void changeAction(Being::Action action);
+
+ void respawn();
+
+ void ingorePlayer(const std::string &player, bool ignore);
+
+ void ingoreAll(bool ignore);
+
private:
void handleMapChangeMessage(MessageIn &msg);
};