summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Dombrowski <stefan@uni-bonn.de>2011-05-30 23:15:34 +0200
committerStefan Dombrowski <stefan@uni-bonn.de>2011-05-30 23:16:26 +0200
commit46f4b656eeced8947c31e1b9cf4f027954df1c2c (patch)
tree099a72d3698fc028356728d201c5752479779a54
parent0248b2f58c783f21b7e68a20deadc0a3f942c869 (diff)
downloadmana-client-46f4b656eeced8947c31e1b9cf4f027954df1c2c.tar.gz
mana-client-46f4b656eeced8947c31e1b9cf4f027954df1c2c.tar.bz2
mana-client-46f4b656eeced8947c31e1b9cf4f027954df1c2c.tar.xz
mana-client-46f4b656eeced8947c31e1b9cf4f027954df1c2c.zip
Routing party invite through the map server
The player sends party invites to the game server. If the invitee is within the visual range of the inviter, then the game server forwards the invite to the chat server. Reviewed-by: Bjorn, Jaxad0127
-rw-r--r--src/net/manaserv/manaserv_protocol.h8
-rw-r--r--src/net/manaserv/partyhandler.cpp14
2 files changed, 17 insertions, 5 deletions
diff --git a/src/net/manaserv/manaserv_protocol.h b/src/net/manaserv/manaserv_protocol.h
index 53dc07df..ca9a0f02 100644
--- a/src/net/manaserv/manaserv_protocol.h
+++ b/src/net/manaserv/manaserv_protocol.h
@@ -186,9 +186,11 @@ enum {
CPMSG_GUILD_REJOIN = 0x0389, // S name, W guild, W rights, W channel, S announce
// Party
- PCMSG_PARTY_INVITE = 0x03A0, // S name
- CPMSG_PARTY_INVITE_RESPONSE = 0x03A1, // B error, S name
- CPMSG_PARTY_INVITED = 0x03A2, // S name
+ PGMSG_PARTY_INVITE = 0x03A0, // S name
+ GPMSG_PARTY_INVITE_ERROR = 0x03A1, // S name
+ GCMSG_PARTY_INVITE = 0x03A2, // S inviter, S invitee
+ CPMSG_PARTY_INVITE_RESPONSE = 0x03A3, // B error, S name
+ CPMSG_PARTY_INVITED = 0x03A4, // S name
PCMSG_PARTY_ACCEPT_INVITE = 0x03A5, // S name
CPMSG_PARTY_ACCEPT_INVITE_RESPONSE = 0x03A6, // B error, { S name }
PCMSG_PARTY_REJECT_INVITE = 0x03A7, // S name
diff --git a/src/net/manaserv/partyhandler.cpp b/src/net/manaserv/partyhandler.cpp
index 3af54f26..38829507 100644
--- a/src/net/manaserv/partyhandler.cpp
+++ b/src/net/manaserv/partyhandler.cpp
@@ -44,11 +44,13 @@ extern Net::PartyHandler *partyHandler;
namespace ManaServ {
extern Connection *chatServerConnection;
+extern Connection *gameServerConnection;
PartyHandler::PartyHandler():
mParty(Party::getParty(PARTY_ID))
{
static const Uint16 _messages[] = {
+ GPMSG_PARTY_INVITE_ERROR,
CPMSG_PARTY_INVITE_RESPONSE,
CPMSG_PARTY_INVITED,
CPMSG_PARTY_ACCEPT_INVITE_RESPONSE,
@@ -68,6 +70,14 @@ void PartyHandler::handleMessage(Net::MessageIn &msg)
{
switch (msg.getId())
{
+ case GPMSG_PARTY_INVITE_ERROR:
+ {
+ std::string name = msg.readString();
+ SERVER_NOTICE(strprintf(_("Party invite failed, because no player "
+ "called %s is within the visual range."),
+ name.c_str()));
+ } break;
+
case CPMSG_PARTY_INVITE_RESPONSE:
{
if (msg.readInt8() == ERRMSG_OK)
@@ -150,11 +160,11 @@ void PartyHandler::invite(Being *being)
void PartyHandler::invite(const std::string &name)
{
- MessageOut msg(PCMSG_PARTY_INVITE);
+ MessageOut msg(PGMSG_PARTY_INVITE);
msg.writeString(name);
- chatServerConnection->send(msg);
+ gameServerConnection->send(msg);
}
void PartyHandler::inviteResponse(const std::string &inviter, bool accept)