summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-07-14 10:14:35 -0600
committerJared Adams <jaxad0127@gmail.com>2009-07-14 10:33:44 -0600
commitcc0878202c99c896f98918b219253eddcf9abf53 (patch)
treeadced066461c9f987d3e05dba50617f4e8ee3395
parent6d3e53146ba15e4d90670db3067fa7f1a67034e1 (diff)
downloadmana-client-cc0878202c99c896f98918b219253eddcf9abf53.tar.gz
mana-client-cc0878202c99c896f98918b219253eddcf9abf53.tar.bz2
mana-client-cc0878202c99c896f98918b219253eddcf9abf53.tar.xz
mana-client-cc0878202c99c896f98918b219253eddcf9abf53.zip
Add netcode for specials
-rw-r--r--src/localplayer.cpp3
-rw-r--r--src/net/ea/protocol.h5
-rw-r--r--src/net/ea/specialhandler.cpp15
-rw-r--r--src/net/tmwserv/gameserver/player.cpp7
-rw-r--r--src/net/tmwserv/gameserver/player.h1
-rw-r--r--src/net/tmwserv/specialhandler.cpp11
6 files changed, 29 insertions, 13 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index fac0d5d0..3f1a3904 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -48,6 +48,7 @@
#include "net/net.h"
#include "net/partyhandler.h"
#include "net/playerhandler.h"
+#include "net/specialhandler.h"
#include "net/tradehandler.h"
#ifdef TMWSERV_SUPPORT
@@ -661,7 +662,7 @@ void LocalPlayer::attack()
*/
void LocalPlayer::useSpecial(int special)
{
- Net::GameServer::Player::useSpecial(special);
+ Net::getSpecialHandler()->use(special);
}
#endif
diff --git a/src/net/ea/protocol.h b/src/net/ea/protocol.h
index ce8417bf..fcb96f22 100644
--- a/src/net/ea/protocol.h
+++ b/src/net/ea/protocol.h
@@ -161,6 +161,11 @@ static const int STORAGE_OFFSET = 1;
#define CMSG_SKILL_LEVELUP_REQUEST 0x0112
#define CMSG_STAT_UPDATE_REQUEST 0x00bb
+#define CMSG_SKILL_USE_BEING 0x0113
+#define CMSG_SKILL_USE_POSITION 0x0116
+// Variant of 0x116 with 80 char string at end (unsure of use)
+#define CMSG_SKILL_USE_POSITION_MORE 0x0190
+#define CMSG_SKILL_USE_MAP 0x011b
#define CMSG_PLAYER_INVENTORY_USE 0x00a7
#define CMSG_PLAYER_INVENTORY_DROP 0x00a2
diff --git a/src/net/ea/specialhandler.cpp b/src/net/ea/specialhandler.cpp
index e75ed1bb..218ff795 100644
--- a/src/net/ea/specialhandler.cpp
+++ b/src/net/ea/specialhandler.cpp
@@ -230,17 +230,26 @@ void SpecialHandler::use(int id)
void SpecialHandler::use(int id, int level, int beingId)
{
- // TODO
+ MessageOut outMsg(CMSG_SKILL_USE_BEING);
+ outMsg.writeInt16(level);
+ outMsg.writeInt16(id);
+ outMsg.writeInt16(beingId);
}
void SpecialHandler::use(int id, int level, int x, int y)
{
- // TODO
+ MessageOut outMsg(CMSG_SKILL_USE_POSITION);
+ outMsg.writeInt16(level);
+ outMsg.writeInt16(id);
+ outMsg.writeInt16(x);
+ outMsg.writeInt16(y);
}
void SpecialHandler::use(int id, const std::string &map)
{
- // TODO
+ MessageOut outMsg(CMSG_SKILL_USE_MAP);
+ outMsg.writeInt16(id);
+ outMsg.writeString(map, 16);
}
} // namespace EAthena
diff --git a/src/net/tmwserv/gameserver/player.cpp b/src/net/tmwserv/gameserver/player.cpp
index 10ffdcda..7935b06d 100644
--- a/src/net/tmwserv/gameserver/player.cpp
+++ b/src/net/tmwserv/gameserver/player.cpp
@@ -50,13 +50,6 @@ void Net::GameServer::Player::moveItem(int oldSlot, int newSlot, int amount)
Net::GameServer::connection->send(msg);
}
-void Net::GameServer::Player::useSpecial(int special)
-{
- MessageOut msg(PGMSG_USE_SPECIAL);
- msg.writeInt8(special);
- Net::GameServer::connection->send(msg);
-}
-
void Net::GameServer::Player::raiseAttribute(int attribute)
{
MessageOut msg(PGMSG_RAISE_ATTRIBUTE);
diff --git a/src/net/tmwserv/gameserver/player.h b/src/net/tmwserv/gameserver/player.h
index b6a51ef0..823dcb11 100644
--- a/src/net/tmwserv/gameserver/player.h
+++ b/src/net/tmwserv/gameserver/player.h
@@ -42,7 +42,6 @@ namespace Net
{
void walk(int x, int y);
void moveItem(int oldSlot, int newSlot, int amount);
- void useSpecial(int special);
void raiseAttribute(int attribute);
void lowerAttribute(int attribute);
void respawn();
diff --git a/src/net/tmwserv/specialhandler.cpp b/src/net/tmwserv/specialhandler.cpp
index 5be8272a..f259e77a 100644
--- a/src/net/tmwserv/specialhandler.cpp
+++ b/src/net/tmwserv/specialhandler.cpp
@@ -21,6 +21,13 @@
#include "net/tmwserv/specialhandler.h"
+#include "net/tmwserv/gameserver/internal.h"
+
+#include "net/tmwserv/connection.h"
+#include "net/tmwserv/protocol.h"
+
+#include "net/messageout.h"
+
Net::SpecialHandler *specialHandler;
namespace TmwServ {
@@ -32,7 +39,9 @@ SpecialHandler::SpecialHandler()
void SpecialHandler::use(int id)
{
- // TODO
+ MessageOut msg(PGMSG_USE_SPECIAL);
+ msg.writeInt8(id);
+ Net::GameServer::connection->send(msg);
}
void SpecialHandler::use(int id, int level, int beingId)