summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-01-28 21:00:12 +0300
committerAndrei Karas <akaras@inbox.ru>2012-01-28 21:00:12 +0300
commita93722a53e2d50466dfd5512c4a6a1c3dfc60fb1 (patch)
treeb4ade374e591f520ae49b1dcb3317b19d503f089 /src/net
parente5695ad6c41d4deb79504998b2bc5caeb1e61285 (diff)
downloadmv-a93722a53e2d50466dfd5512c4a6a1c3dfc60fb1.tar.gz
mv-a93722a53e2d50466dfd5512c4a6a1c3dfc60fb1.tar.bz2
mv-a93722a53e2d50466dfd5512c4a6a1c3dfc60fb1.tar.xz
mv-a93722a53e2d50466dfd5512c4a6a1c3dfc60fb1.zip
Add support for processing player statuses in evol server.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/playerhandler.cpp5
-rw-r--r--src/net/ea/playerhandler.h2
-rw-r--r--src/net/manaserv/playerhandler.cpp5
-rw-r--r--src/net/manaserv/playerhandler.h2
-rw-r--r--src/net/playerhandler.h2
-rw-r--r--src/net/tmwa/playerhandler.cpp33
-rw-r--r--src/net/tmwa/playerhandler.h1
-rw-r--r--src/net/tmwa/protocol.h1
8 files changed, 45 insertions, 6 deletions
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index 6a841415f..90c635428 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -645,4 +645,9 @@ int PlayerHandler::getAttackLocation() const
{
return EA_ATK;
}
+
+void PlayerHandler::updateStatus()
+{
+
+}
} // namespace Ea
diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h
index d0402ecfc..7bf569349 100644
--- a/src/net/ea/playerhandler.h
+++ b/src/net/ea/playerhandler.h
@@ -68,6 +68,8 @@ class PlayerHandler : public Net::PlayerHandler
void processPlayerStatUpdate6(Net::MessageIn &msg);
void processPlayerArrowMessage(Net::MessageIn &msg);
+
+ void updateStatus();
};
} // namespace Ea
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp
index 5ebf840bc..aa79d4d41 100644
--- a/src/net/manaserv/playerhandler.cpp
+++ b/src/net/manaserv/playerhandler.cpp
@@ -448,4 +448,9 @@ void PlayerHandler::requestOnlineList()
}
+void PlayerHandler::updateStatus(Uint8 status)
+{
+
+}
+
} // namespace ManaServ
diff --git a/src/net/manaserv/playerhandler.h b/src/net/manaserv/playerhandler.h
index 0255406a8..23d2f5e32 100644
--- a/src/net/manaserv/playerhandler.h
+++ b/src/net/manaserv/playerhandler.h
@@ -74,6 +74,8 @@ class PlayerHandler : public MessageHandler, public Net::PlayerHandler
Vector getDefaultWalkSpeed() const;
+ void updateStatus(Uint8 status);
+
private:
void handleMapChangeMessage(Net::MessageIn &msg);
};
diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h
index f62acc0c9..6ae912102 100644
--- a/src/net/playerhandler.h
+++ b/src/net/playerhandler.h
@@ -73,6 +73,8 @@ class PlayerHandler
virtual Vector getDefaultWalkSpeed() const = 0;
virtual void requestOnlineList() = 0;
+
+ virtual void updateStatus(Uint8 status) = 0;
};
} // namespace Net
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index 3d48fb341..621a747b0 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -22,6 +22,7 @@
#include "net/tmwa/playerhandler.h"
+#include "configuration.h"
#include "logger.h"
#include "net/messagein.h"
@@ -227,8 +228,8 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg)
return;
}
- const char *start = msg.readBytes(size);
- const char *buf = start;
+ char *start = (char*)msg.readBytes(size);
+ char *buf = start;
int addVal = 1;
if (serverVersion >= 4)
@@ -236,9 +237,9 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg)
while (buf - start + 1 < size && *(buf + addVal))
{
- char status = 0;
- char ver = 0;
- char level = 0;
+ unsigned char status = 0;
+ unsigned char ver = 0;
+ unsigned char level = 0;
if (serverVersion >= 4)
{
status = *buf;
@@ -248,7 +249,20 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg)
ver = *buf;
}
buf ++;
- arr.push_back(new OnlinePlayer(buf, status, level, ver));
+
+ int gender = GENDER_UNSPECIFIED;
+ if (serverVersion >= 4)
+ {
+ if (config.getBoolValue("showgender"))
+ {
+ if (status & Being::FLAG_GENDER)
+ gender = GENDER_MALE;
+ else
+ gender = GENDER_FEMALE;
+ }
+ }
+ arr.push_back(new OnlinePlayer((char*)buf,
+ status, level, gender, ver));
buf += strlen(buf) + 1;
}
@@ -257,4 +271,11 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg)
delete [] start;
}
+void PlayerHandler::updateStatus(Uint8 status)
+{
+ MessageOut outMsg(CMSG_SET_STATUS);
+ outMsg.writeInt8(status);
+ outMsg.writeInt8(0);
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/playerhandler.h b/src/net/tmwa/playerhandler.h
index 0fa524d51..14aa191f6 100644
--- a/src/net/tmwa/playerhandler.h
+++ b/src/net/tmwa/playerhandler.h
@@ -53,6 +53,7 @@ class PlayerHandler : public MessageHandler, public Ea::PlayerHandler
void changeAction(Being::Action action);
void processOnlineList(Net::MessageIn &msg);
void requestOnlineList();
+ void updateStatus(Uint8 status);
void respawn();
};
diff --git a/src/net/tmwa/protocol.h b/src/net/tmwa/protocol.h
index ddc642101..256f1dce4 100644
--- a/src/net/tmwa/protocol.h
+++ b/src/net/tmwa/protocol.h
@@ -336,5 +336,6 @@ enum
#define CMSG_ONLINE_LIST 0x0210
#define SMSG_ONLINE_LIST 0x0211
#define SMSG_NPC_COMMAND 0x0212
+#define CMSG_SET_STATUS 0x0213
#endif