summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/chathandler.h2
-rw-r--r--src/net/manaserv/chathandler.h2
-rw-r--r--src/net/tmwa/chathandler.cpp34
-rw-r--r--src/net/tmwa/chathandler.h2
-rw-r--r--src/net/tmwa/loginhandler.cpp2
5 files changed, 41 insertions, 1 deletions
diff --git a/src/net/chathandler.h b/src/net/chathandler.h
index c324c2d8..382ac39a 100644
--- a/src/net/chathandler.h
+++ b/src/net/chathandler.h
@@ -58,6 +58,8 @@ class ChatHandler
virtual void who() = 0;
virtual bool whoSupported() const = 0;
+
+ virtual void requestOnlineList() = 0;
};
}
diff --git a/src/net/manaserv/chathandler.h b/src/net/manaserv/chathandler.h
index c4dc6861..f17883ae 100644
--- a/src/net/manaserv/chathandler.h
+++ b/src/net/manaserv/chathandler.h
@@ -72,6 +72,8 @@ class ChatHandler final : public MessageHandler, public Net::ChatHandler
bool whoSupported() const override { return true; }
+ void requestOnlineList() override {}
+
private:
/**
* Handle chat messages sent from the game server.
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index a1e2d375..5d9a0e21 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -22,11 +22,14 @@
#include "net/tmwa/chathandler.h"
#include "actorspritemanager.h"
+#include "avatar.h"
#include "being.h"
#include "event.h"
#include "localplayer.h"
#include "playerrelations.h"
+#include "gui/socialwindow.h"
+
#include "net/tmwa/loginhandler.h"
#include "net/tmwa/messagein.h"
#include "net/tmwa/messageout.h"
@@ -50,6 +53,7 @@ ChatHandler::ChatHandler()
SMSG_WHISPER_RESPONSE,
SMSG_GM_CHAT,
SMSG_SCRIPT_MESSAGE,
+ SMSG_ONLINE_LIST,
0
};
handledMessages = _messages;
@@ -252,6 +256,31 @@ void ChatHandler::handleMessage(MessageIn &msg)
SERVER_NOTICE(msg.readString(chatMsgLength))
break;
}
+
+ case SMSG_ONLINE_LIST:
+ {
+ int length = msg.readInt16();
+ int count = (length - 4) / 31;
+ std::vector<Avatar*> players;
+
+ for (int i = 0; i < count; i++)
+ {
+ msg.readInt32(); // account id
+ std::string nick = msg.readString(24);
+ msg.readInt8(); // level
+ msg.readInt8(); // gm level
+ msg.readInt8(); // gender
+
+ Avatar *avatar = new Avatar(nick);
+ avatar->setOnline(true);
+ players.push_back(avatar);
+ }
+
+ socialWindow->setPlayersOnline(players);
+
+ break;
+ }
+
}
}
@@ -332,4 +361,9 @@ void ChatHandler::kickUser(int channelId, const std::string &name)
SERVER_NOTICE(_("Channels are not supported!"))
}
+void ChatHandler::requestOnlineList()
+{
+ MessageOut outMsg(CMSG_ONLINE_LIST);
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/chathandler.h b/src/net/tmwa/chathandler.h
index 9f838b2c..d545b221 100644
--- a/src/net/tmwa/chathandler.h
+++ b/src/net/tmwa/chathandler.h
@@ -66,6 +66,8 @@ class ChatHandler final : public MessageHandler, public Net::ChatHandler
bool whoSupported() const override { return false; }
+ void requestOnlineList() override;
+
private:
std::queue<std::string> mSentWhispers;
};
diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp
index 8ee5e102..24bc9ab2 100644
--- a/src/net/tmwa/loginhandler.cpp
+++ b/src/net/tmwa/loginhandler.cpp
@@ -321,7 +321,7 @@ void LoginHandler::sendLoginRegister(const std::string &username,
const std::string &password)
{
MessageOut outMsg(CMSG_LOGIN_REGISTER);
- outMsg.writeInt32(6); // client version
+ outMsg.writeInt32(8); // client version
outMsg.writeString(username, 24);
outMsg.writeString(password, 24);