summaryrefslogtreecommitdiff
path: root/src/net/ea
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-02 14:54:43 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-02 15:02:59 +0200
commitd20b79683997990a1b46ac8d4117f9195aa278f2 (patch)
tree8566fe6cd224003100be35743645c948536f26e8 /src/net/ea
parent128f908908b77b242b749b27879ba2a9f70a94f6 (diff)
downloadMana-d20b79683997990a1b46ac8d4117f9195aa278f2.tar.gz
Mana-d20b79683997990a1b46ac8d4117f9195aa278f2.tar.bz2
Mana-d20b79683997990a1b46ac8d4117f9195aa278f2.tar.xz
Mana-d20b79683997990a1b46ac8d4117f9195aa278f2.zip
Some cleanup and renaming
* Removed superfluous 'virtual' keyword in *Handler implementations * Renamed NPCHandler to NpcHandler * Renamed InvyHandler to InventoryHandler * Made all *Handler interface methods pure virtual * Used forward declarations in net.h * Renamed {start,end}Shoping to {start,end}Shopping
Diffstat (limited to 'src/net/ea')
-rw-r--r--src/net/ea/adminhandler.cpp2
-rw-r--r--src/net/ea/adminhandler.h23
-rw-r--r--src/net/ea/chathandler.cpp1
-rw-r--r--src/net/ea/chathandler.h25
-rw-r--r--src/net/ea/inventoryhandler.cpp14
-rw-r--r--src/net/ea/inventoryhandler.h25
-rw-r--r--src/net/ea/maphandler.cpp2
-rw-r--r--src/net/ea/maphandler.h13
-rw-r--r--src/net/ea/npchandler.cpp42
-rw-r--r--src/net/ea/npchandler.h36
-rw-r--r--src/net/ea/partyhandler.cpp5
-rw-r--r--src/net/ea/partyhandler.h19
-rw-r--r--src/net/ea/playerhandler.h25
-rw-r--r--src/net/ea/skillhandler.h5
-rw-r--r--src/net/ea/tradehandler.h19
15 files changed, 154 insertions, 102 deletions
diff --git a/src/net/ea/adminhandler.cpp b/src/net/ea/adminhandler.cpp
index c1194ef1..04c946c0 100644
--- a/src/net/ea/adminhandler.cpp
+++ b/src/net/ea/adminhandler.cpp
@@ -62,7 +62,7 @@ void AdminHandler::handleMessage(MessageIn &msg)
if (id == 0)
localChatTab->chatLog(_("Kick failed!"), BY_SERVER);
else
- localChatTab->chatLog(_("Kick succedded!"), BY_SERVER);
+ localChatTab->chatLog(_("Kick succeeded!"), BY_SERVER);
break;
}
}
diff --git a/src/net/ea/adminhandler.h b/src/net/ea/adminhandler.h
index ae40e9d7..a7db0113 100644
--- a/src/net/ea/adminhandler.h
+++ b/src/net/ea/adminhandler.h
@@ -22,6 +22,7 @@
#ifndef NET_EA_ADMINHANDLER_H
#define NET_EA_ADMINHANDLER_H
+#include "net/adminhandler.h"
#include "net/messagehandler.h"
#include "net/net.h"
@@ -30,27 +31,27 @@ class AdminHandler : public MessageHandler, public Net::AdminHandler
public:
AdminHandler();
- virtual void handleMessage(MessageIn &msg);
+ void handleMessage(MessageIn &msg);
- virtual void announce(const std::string &text);
+ void announce(const std::string &text);
- virtual void localAnnounce(const std::string &text);
+ void localAnnounce(const std::string &text);
- virtual void hide(bool hide);
+ void hide(bool hide);
- virtual void kick(int playerId);
+ void kick(int playerId);
- virtual void kick(const std::string &name);
+ void kick(const std::string &name);
- virtual void ban(int playerId);
+ void ban(int playerId);
- virtual void ban(const std::string &name);
+ void ban(const std::string &name);
- virtual void unban(int playerId);
+ void unban(int playerId);
- virtual void unban(const std::string &name);
+ void unban(const std::string &name);
- virtual void mute(int playerId, int type, int limit);
+ void mute(int playerId, int type, int limit);
};
extern AdminHandler *adminHandler;
diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp
index 2949c3dc..3abf2b24 100644
--- a/src/net/ea/chathandler.cpp
+++ b/src/net/ea/chathandler.cpp
@@ -29,6 +29,7 @@
#include "being.h"
#include "beingmanager.h"
#include "game.h"
+#include "localplayer.h"
#include "player_relations.h"
#include "gui/widgets/chattab.h"
diff --git a/src/net/ea/chathandler.h b/src/net/ea/chathandler.h
index 99c580dd..6ca71b80 100644
--- a/src/net/ea/chathandler.h
+++ b/src/net/ea/chathandler.h
@@ -22,6 +22,7 @@
#ifndef NET_EA_CHATHANDLER_H
#define NET_EA_CHATHANDLER_H
+#include "net/chathandler.h"
#include "net/messagehandler.h"
#include "net/net.h"
@@ -30,30 +31,30 @@ class ChatHandler : public MessageHandler, public Net::ChatHandler
public:
ChatHandler();
- virtual void handleMessage(MessageIn &msg);
+ void handleMessage(MessageIn &msg);
- virtual void talk(const std::string &text);
+ void talk(const std::string &text);
- virtual void me(const std::string &text);
+ void me(const std::string &text);
- virtual void privateMessage(const std::string &recipient,
+ void privateMessage(const std::string &recipient,
const std::string &text);
- virtual void channelList();
+ void channelList();
- virtual void enterChannel(int channelId, const std::string &password);
+ void enterChannel(int channelId, const std::string &password);
- virtual void quitChannel(int channelId);
+ void quitChannel(int channelId);
- virtual void sendToChannel(int channelId, const std::string &text);
+ void sendToChannel(int channelId, const std::string &text);
- virtual void userList(int channelId);
+ void userList(int channelId);
- virtual void setChannelTopic(int channelId, const std::string &text);
+ void setChannelTopic(int channelId, const std::string &text);
- virtual void setUserMode(int channelId, const std::string &name, int mode);
+ void setUserMode(int channelId, const std::string &name, int mode);
- virtual void kickUser(int channelId, const std::string &name);
+ void kickUser(int channelId, const std::string &name);
};
extern ChatHandler *chatHandler;
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index 423d2e9c..7dfb6277 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -47,7 +47,7 @@
enum { debugInventory = 1 };
-InventoryHandler *invyHandler;
+InventoryHandler *inventoryHandler;
InventoryHandler::InventoryHandler()
{
@@ -66,7 +66,7 @@ InventoryHandler::InventoryHandler()
0
};
handledMessages = _messages;
- invyHandler = this;
+ inventoryHandler = this;
}
void InventoryHandler::handleMessage(MessageIn &msg)
@@ -337,6 +337,16 @@ void InventoryHandler::dropItem(Item *item, int amount)
outMsg.writeInt16(amount);
}
+void InventoryHandler::splitItem(Item *item, int amount)
+{
+ // Not implemented for eAthena (possible?)
+}
+
+void InventoryHandler::openStorage()
+{
+ // Doesn't apply to eAthena, since opening happens through NPCs?
+}
+
void InventoryHandler::closeStorage()
{
MessageOut outMsg(CMSG_CLOSE_STORAGE);
diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h
index def4285f..bfebc9b3 100644
--- a/src/net/ea/inventoryhandler.h
+++ b/src/net/ea/inventoryhandler.h
@@ -22,30 +22,35 @@
#ifndef NET_EA_INVENTORYHANDLER_H
#define NET_EA_INVENTORYHANDLER_H
+#include "net/inventoryhandler.h"
#include "net/messagehandler.h"
#include "net/net.h"
-class InventoryHandler : public MessageHandler, public Net::InvyHandler
+class InventoryHandler : public MessageHandler, public Net::InventoryHandler
{
public:
InventoryHandler();
- virtual void handleMessage(MessageIn &msg);
+ void handleMessage(MessageIn &msg);
- virtual void equipItem(Item *item);
+ void equipItem(Item *item);
- virtual void unequipItem(Item *item);
+ void unequipItem(Item *item);
- virtual void useItem(Item *item);
+ void useItem(Item *item);
- virtual void dropItem(Item *item, int amount);
+ void dropItem(Item *item, int amount);
- virtual void closeStorage();
+ void splitItem(Item *item, int amount);
- virtual void moveItem(StorageType source, int slot, int amount,
- StorageType destination);
+ void openStorage();
+
+ void closeStorage();
+
+ void moveItem(StorageType source, int slot, int amount,
+ StorageType destination);
};
-extern InventoryHandler *invyHandler;
+extern InventoryHandler *inventoryHandler;
#endif // NET_EA_INVENTORYHANDLER_H
diff --git a/src/net/ea/maphandler.cpp b/src/net/ea/maphandler.cpp
index c7fe42d9..fefeac86 100644
--- a/src/net/ea/maphandler.cpp
+++ b/src/net/ea/maphandler.cpp
@@ -1,6 +1,6 @@
/*
* The Mana World
- * Copyright (C) 2004 The Mana World Development Team
+ * Copyright (C) 2009 The Mana World Development Team
*
* This file is part of The Mana World.
*
diff --git a/src/net/ea/maphandler.h b/src/net/ea/maphandler.h
index c264cf10..77811b4e 100644
--- a/src/net/ea/maphandler.h
+++ b/src/net/ea/maphandler.h
@@ -1,6 +1,6 @@
/*
* The Mana World
- * Copyright (C) 2004 The Mana World Development Team
+ * Copyright (C) 2009 The Mana World Development Team
*
* This file is part of The Mana World.
*
@@ -22,6 +22,7 @@
#ifndef NET_EA_MAPHANDLER_H
#define NET_EA_MAPHANDLER_H
+#include "net/maphandler.h"
#include "net/messagehandler.h"
#include "net/net.h"
@@ -30,15 +31,15 @@ class MapHandler : public MessageHandler, public Net::MapHandler
public:
MapHandler();
- virtual void handleMessage(MessageIn &msg);
+ void handleMessage(MessageIn &msg);
- virtual void connect();
+ void connect();
- virtual void mapLoaded(const std::string &mapName);
+ void mapLoaded(const std::string &mapName);
- virtual void who();
+ void who();
- virtual void quit();
+ void quit();
};
extern MapHandler *mapHandler;
diff --git a/src/net/ea/npchandler.cpp b/src/net/ea/npchandler.cpp
index 9f9bc6a6..33e478cb 100644
--- a/src/net/ea/npchandler.cpp
+++ b/src/net/ea/npchandler.cpp
@@ -39,9 +39,9 @@
#include <SDL_types.h>
-NPCHandler *npcHandler;
+NpcHandler *npcHandler;
-NPCHandler::NPCHandler()
+NpcHandler::NpcHandler()
{
static const Uint16 _messages[] = {
SMSG_NPC_CHOICE,
@@ -56,7 +56,7 @@ NPCHandler::NPCHandler()
npcHandler = this;
}
-void NPCHandler::handleMessage(MessageIn &msg)
+void NpcHandler::handleMessage(MessageIn &msg)
{
int id;
@@ -121,40 +121,40 @@ void NPCHandler::handleMessage(MessageIn &msg)
}
}
-void NPCHandler::talk(int npcId)
+void NpcHandler::talk(int npcId)
{
MessageOut outMsg(CMSG_NPC_TALK);
outMsg.writeInt32(npcId);
outMsg.writeInt8(0); // Unused
}
-void NPCHandler::nextDialog(int npcId)
+void NpcHandler::nextDialog(int npcId)
{
MessageOut outMsg(CMSG_NPC_NEXT_REQUEST);
outMsg.writeInt32(npcId);
}
-void NPCHandler::closeDialog(int npcId)
+void NpcHandler::closeDialog(int npcId)
{
MessageOut outMsg(CMSG_NPC_CLOSE);
outMsg.writeInt32(npcId);
}
-void NPCHandler::listInput(int npcId, int value)
+void NpcHandler::listInput(int npcId, int value)
{
MessageOut outMsg(CMSG_NPC_LIST_CHOICE);
outMsg.writeInt32(npcId);
outMsg.writeInt8(value);
}
-void NPCHandler::integerInput(int npcId, int value)
+void NpcHandler::integerInput(int npcId, int value)
{
MessageOut outMsg(CMSG_NPC_INT_RESPONSE);
outMsg.writeInt32(npcId);
outMsg.writeInt32(value);
}
-void NPCHandler::stringInput(int npcId, const std::string &value)
+void NpcHandler::stringInput(int npcId, const std::string &value)
{
MessageOut outMsg(CMSG_NPC_STR_RESPONSE);
outMsg.writeInt16(value.length() + 9);
@@ -163,23 +163,32 @@ void NPCHandler::stringInput(int npcId, const std::string &value)
outMsg.writeInt8(0); // Prevent problems with string reading
}
-void NPCHandler::buy(int beingId)
+void NpcHandler::sendLetter(int npcId, const std::string &recipient,
+ const std::string &text)
{
+ // TODO
+}
+void NpcHandler::startShopping(int beingId)
+{
+ // TODO
+}
+
+void NpcHandler::buy(int beingId)
+{
MessageOut outMsg(CMSG_NPC_BUY_SELL_REQUEST);
outMsg.writeInt32(beingId);
outMsg.writeInt8(0); // Buy
}
-void NPCHandler::sell(int beingId)
+void NpcHandler::sell(int beingId)
{
-
MessageOut outMsg(CMSG_NPC_BUY_SELL_REQUEST);
outMsg.writeInt32(beingId);
outMsg.writeInt8(1); // Sell
}
-void NPCHandler::buyItem(int beingId, int itemId, int amount)
+void NpcHandler::buyItem(int beingId, int itemId, int amount)
{
MessageOut outMsg(CMSG_NPC_BUY_REQUEST);
outMsg.writeInt16(8); // One item (length of packet)
@@ -187,10 +196,15 @@ void NPCHandler::buyItem(int beingId, int itemId, int amount)
outMsg.writeInt16(itemId);
}
-void NPCHandler::sellItem(int beingId, int itemId, int amount)
+void NpcHandler::sellItem(int beingId, int itemId, int amount)
{
MessageOut outMsg(CMSG_NPC_SELL_REQUEST);
outMsg.writeInt16(8); // One item (length of packet)
outMsg.writeInt16(itemId + INVENTORY_OFFSET);
outMsg.writeInt16(amount);
}
+
+void NpcHandler::endShopping(int beingId)
+{
+ // TODO
+}
diff --git a/src/net/ea/npchandler.h b/src/net/ea/npchandler.h
index a8212ce0..9ca83f11 100644
--- a/src/net/ea/npchandler.h
+++ b/src/net/ea/npchandler.h
@@ -24,35 +24,43 @@
#include "net/messagehandler.h"
#include "net/net.h"
+#include "net/npchandler.h"
-class NPCHandler : public MessageHandler, public Net::NpcHandler
+class NpcHandler : public MessageHandler, public Net::NpcHandler
{
public:
- NPCHandler();
+ NpcHandler();
- virtual void handleMessage(MessageIn &msg);
+ void handleMessage(MessageIn &msg);
- virtual void talk(int npcId);
+ void talk(int npcId);
- virtual void nextDialog(int npcId);
+ void nextDialog(int npcId);
- virtual void closeDialog(int npcId);
+ void closeDialog(int npcId);
- virtual void listInput(int npcId, int value);
+ void listInput(int npcId, int value);
- virtual void integerInput(int npcId, int value);
+ void integerInput(int npcId, int value);
- virtual void stringInput(int npcId, const std::string &value);
+ void stringInput(int npcId, const std::string &value);
- virtual void buy(int beingId);
+ void sendLetter(int npcId, const std::string &recipient,
+ const std::string &text);
- virtual void sell(int beingId);
+ void startShopping(int beingId);
- virtual void buyItem(int beingId, int itemId, int amount);
+ void buy(int beingId);
- virtual void sellItem(int beingId, int itemId, int amount);
+ void sell(int beingId);
+
+ void buyItem(int beingId, int itemId, int amount);
+
+ void sellItem(int beingId, int itemId, int amount);
+
+ void endShopping(int beingId);
};
-extern NPCHandler *npcHandler;
+extern NpcHandler *npcHandler;
#endif // NET_EA_NPCHANDLER_H
diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp
index 94abe0f1..38adaa7e 100644
--- a/src/net/ea/partyhandler.cpp
+++ b/src/net/ea/partyhandler.cpp
@@ -255,3 +255,8 @@ void PartyHandler::chat(const std::string &text)
outMsg.writeInt16(text.length() + 4);
outMsg.writeString(text, text.length());
}
+
+void PartyHandler::requestPartyMembers()
+{
+ // Our eAthena doesn't have this message
+}
diff --git a/src/net/ea/partyhandler.h b/src/net/ea/partyhandler.h
index 5db4d43a..df38bd6c 100644
--- a/src/net/ea/partyhandler.h
+++ b/src/net/ea/partyhandler.h
@@ -24,6 +24,7 @@
#include "net/messagehandler.h"
#include "net/net.h"
+#include "net/partyhandler.h"
class PartyHandler : public MessageHandler, public Net::PartyHandler
{
@@ -32,21 +33,23 @@ class PartyHandler : public MessageHandler, public Net::PartyHandler
~PartyHandler();
- virtual void handleMessage(MessageIn &msg);
+ void handleMessage(MessageIn &msg);
- virtual void create(const std::string &name="");
+ void create(const std::string &name = "");
- virtual void join(int partyId);
+ void join(int partyId);
- virtual void invite(int playerId);
+ void invite(int playerId);
- virtual void inviteResponse(bool accept);
+ void inviteResponse(bool accept);
- virtual void leave();
+ void leave();
- virtual void kick(int playerId);
+ void kick(int playerId);
- virtual void chat(const std::string &text);
+ void chat(const std::string &text);
+
+ void requestPartyMembers();
};
extern PartyHandler *partyHandler;
diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h
index f1d45a79..cc84dec0 100644
--- a/src/net/ea/playerhandler.h
+++ b/src/net/ea/playerhandler.h
@@ -24,35 +24,36 @@
#include "net/messagehandler.h"
#include "net/net.h"
+#include "net/playerhandler.h"
class PlayerHandler : public MessageHandler, public Net::PlayerHandler
{
public:
PlayerHandler();
- virtual void handleMessage(MessageIn &msg);
+ void handleMessage(MessageIn &msg);
- virtual void attack(Being *being);
+ void attack(Being *being);
- virtual void emote(int emoteId);
+ void emote(int emoteId);
- virtual void increaseStat(LocalPlayer::Attribute attr);
+ void increaseStat(LocalPlayer::Attribute attr);
- virtual void decreaseStat(LocalPlayer::Attribute attr);
+ void decreaseStat(LocalPlayer::Attribute attr);
- virtual void pickUp(FloorItem *floorItem);
+ void pickUp(FloorItem *floorItem);
- virtual void setDirection(int direction);
+ void setDirection(int direction);
- virtual void setDestination(int x, int y, int direction = -1);
+ void setDestination(int x, int y, int direction = -1);
- virtual void changeAction(Being::Action action);
+ void changeAction(Being::Action action);
- virtual void respawn();
+ void respawn();
- virtual void ingorePlayer(const std::string &player, bool ignore);
+ void ingorePlayer(const std::string &player, bool ignore);
- virtual void ingoreAll(bool ignore);
+ void ingoreAll(bool ignore);
};
extern PlayerHandler *playerHandler;
diff --git a/src/net/ea/skillhandler.h b/src/net/ea/skillhandler.h
index f3d1b9de..b4e464ed 100644
--- a/src/net/ea/skillhandler.h
+++ b/src/net/ea/skillhandler.h
@@ -24,15 +24,16 @@
#include "net/messagehandler.h"
#include "net/net.h"
+#include "net/skillhandler.h"
class SkillHandler : public MessageHandler, public Net::SkillHandler
{
public:
SkillHandler();
- virtual void handleMessage(MessageIn &msg);
+ void handleMessage(MessageIn &msg);
- virtual void up(int skillId);
+ void up(int skillId);
};
extern SkillHandler *skillHandler;
diff --git a/src/net/ea/tradehandler.h b/src/net/ea/tradehandler.h
index af7a064f..b6e0fdf8 100644
--- a/src/net/ea/tradehandler.h
+++ b/src/net/ea/tradehandler.h
@@ -24,29 +24,30 @@
#include "net/messagehandler.h"
#include "net/net.h"
+#include "net/tradehandler.h"
class TradeHandler : public MessageHandler, public Net::TradeHandler
{
public:
TradeHandler();
- virtual void handleMessage(MessageIn &msg);
+ void handleMessage(MessageIn &msg);
- virtual void request(Being *being);
+ void request(Being *being);
- virtual void respond(bool accept);
+ void respond(bool accept);
- virtual void addItem(int slotNum, int amount);
+ void addItem(int slotNum, int amount);
- virtual void removeItem(int slotNum, int amount);
+ void removeItem(int slotNum, int amount);
- virtual void setMoney(int amount);
+ void setMoney(int amount);
- virtual void confirm();
+ void confirm();
- virtual void finish();
+ void finish();
- virtual void cancel();
+ void cancel();
};
extern TradeHandler *tradeHandler;