diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/chat-server/party.h | 3 | ||||
-rw-r--r-- | src/chat-server/partyhandler.cpp | 21 | ||||
-rw-r--r-- | src/common/manaserv_protocol.h | 4 |
3 files changed, 19 insertions, 9 deletions
diff --git a/src/chat-server/party.h b/src/chat-server/party.h index 8d053a18..f003c0b1 100644 --- a/src/chat-server/party.h +++ b/src/chat-server/party.h @@ -54,8 +54,11 @@ public: */ unsigned int getId() const { return mId; } + const PartyUsers &getUsers() const { return mUsers; } + private: PartyUsers mUsers; + unsigned int mId; }; diff --git a/src/chat-server/partyhandler.cpp b/src/chat-server/partyhandler.cpp index 3d4eaebc..52eb89a3 100644 --- a/src/chat-server/partyhandler.cpp +++ b/src/chat-server/partyhandler.cpp @@ -42,8 +42,6 @@ void updateInfo(ChatClient *client, int partyId) bool ChatHandler::handlePartyJoin(const std::string &invited, const std::string &inviter) { - MessageOut out(CPMSG_PARTY_INVITE_RESPONSE); - // Get inviting client ChatClient *c1 = getClient(inviter); if (c1) @@ -52,13 +50,16 @@ bool ChatHandler::handlePartyJoin(const std::string &invited, const std::string if (!c1->party) { c1->party = new Party(); + // add inviter to the party + c1->party->addUser(inviter); + MessageOut out(CPMSG_PARTY_NEW_MEMBER); + out.writeInt32(c1->characterId); + out.writeString(inviter); + c1->send(out); // tell game server to update info updateInfo(c1, c1->party->getId()); } - // add inviter to the party - c1->party->addUser(inviter); - // Get invited client ChatClient *c2 = getClient(invited); if (c2) @@ -67,6 +68,7 @@ bool ChatHandler::handlePartyJoin(const std::string &invited, const std::string c1->party->addUser(invited); c2->party = c1->party; // was successful so return success to inviter + MessageOut out(CPMSG_PARTY_INVITE_RESPONSE); out.writeString(invited); out.writeInt8(ERRMSG_OK); c1->send(out); @@ -146,6 +148,11 @@ void ChatHandler::handlePartyAcceptInvite(ChatClient &client, MessageIn &msg) if (handlePartyJoin(client.characterName, inviter)) { out.writeInt8(ERRMSG_OK); + Party::PartyUsers users = client.party->getUsers(); + const unsigned usersSize = users.size(); + for (unsigned i = 0; i < usersSize; i++) + out.writeString(users[i]); + mPartyInvitedUsers.erase(itr); found = true; break; @@ -239,7 +246,7 @@ void ChatHandler::informPartyMemberQuit(ChatClient &client) if (itr->second->party == client.party) { MessageOut out(CPMSG_PARTY_MEMBER_LEFT); - out.writeInt16(client.characterId); + out.writeInt32(client.characterId); itr->second->send(out); } } @@ -255,7 +262,7 @@ void ChatHandler::informPartyMemberJoined(ChatClient &client) if (itr->second->party == client.party) { MessageOut out(CPMSG_PARTY_NEW_MEMBER); - out.writeInt16(client.characterId); + out.writeInt32(client.characterId); out.writeString(client.characterName); itr->second->send(out); } diff --git a/src/common/manaserv_protocol.h b/src/common/manaserv_protocol.h index 78497eb4..3205d004 100644 --- a/src/common/manaserv_protocol.h +++ b/src/common/manaserv_protocol.h @@ -195,8 +195,8 @@ enum { CPMSG_PARTY_REJECTED = 0x03A8, // S name PCMSG_PARTY_QUIT = 0x03AA, // - CPMSG_PARTY_QUIT_RESPONSE = 0x03AB, // B error - CPMSG_PARTY_NEW_MEMBER = 0x03B0, // W being id, S name - CPMSG_PARTY_MEMBER_LEFT = 0x03B1, // W being id + CPMSG_PARTY_NEW_MEMBER = 0x03B0, // D character id, S name + CPMSG_PARTY_MEMBER_LEFT = 0x03B1, // D character id // Chat CPMSG_ERROR = 0x0401, // B error |