summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/chatserver/party.cpp14
-rw-r--r--src/net/chatserver/party.h5
-rw-r--r--src/net/partyhandler.cpp23
-rw-r--r--src/net/protocol.h7
4 files changed, 28 insertions, 21 deletions
diff --git a/src/net/chatserver/party.cpp b/src/net/chatserver/party.cpp
index 8d6fd7c2..e09803de 100644
--- a/src/net/chatserver/party.cpp
+++ b/src/net/chatserver/party.cpp
@@ -32,22 +32,14 @@
#include "../../log.h"
-void Net::ChatServer::Party::createParty()
-{
- logger->log("Sending PCMSG_PARTY_CREATE");
- MessageOut msg(PCMSG_PARTY_CREATE);
-
- Net::ChatServer::connection->send(msg);
-}
-
void Net::ChatServer::Party::invitePlayer(const std::string &name)
{
logger->log("Sending PCMSG_PARTY_INVITE");
-// MessageOut msg(PCMSG_GUILD_INVITE);
+ MessageOut msg(PCMSG_PARTY_INVITE);
-// msg.writeString(name);
+ msg.writeString(name);
-// Net::ChatServer::connection->send(msg);
+ Net::ChatServer::connection->send(msg);
}
void Net::ChatServer::Party::acceptInvite(const std::string &name)
diff --git a/src/net/chatserver/party.h b/src/net/chatserver/party.h
index 6f404583..f1bd7a7f 100644
--- a/src/net/chatserver/party.h
+++ b/src/net/chatserver/party.h
@@ -34,11 +34,6 @@ namespace Net
namespace Party
{
/**
- * Create party
- */
- void createParty();
-
- /**
* Invite a player to the party.
*/
void invitePlayer(const std::string &name);
diff --git a/src/net/partyhandler.cpp b/src/net/partyhandler.cpp
index 91f0014e..527797e3 100644
--- a/src/net/partyhandler.cpp
+++ b/src/net/partyhandler.cpp
@@ -40,7 +40,9 @@
PartyHandler::PartyHandler()
{
static const Uint16 _messages[] = {
- CPMSG_PARTY_CREATE_RESPONSE,
+ CPMSG_PARTY_INVITE_RESPONSE,
+ CPMSG_PARTY_INVITED,
+ CPMSG_PARTY_ACCEPT_INVITE_RESPONSE,
CPMSG_PARTY_QUIT_RESPONSE,
0
};
@@ -52,14 +54,29 @@ void PartyHandler::handleMessage(MessageIn &msg)
{
switch (msg.getId())
{
- case CPMSG_PARTY_CREATE_RESPONSE:
+ case CPMSG_PARTY_INVITE_RESPONSE:
{
if (msg.readInt8() == ERRMSG_OK)
{
- player_node->setInParty(true);
+ if (!player_node->getInParty())
+ player_node->setInParty(true);
}
} break;
+ case CPMSG_PARTY_INVITED:
+ {
+ //TODO: Show dialog to player asking to join party
+ std::string inviter = msg.readString();
+ } break;
+
+ case CPMSG_PARTY_ACCEPT_INVITE_RESPONSE:
+ {
+ if (msg.readInt8() == ERRMSG_OK)
+ {
+ player_node->setInParty(true);
+ }
+ }
+
case CPMSG_PARTY_QUIT_RESPONSE:
{
if (msg.readInt8() == ERRMSG_OK)
diff --git a/src/net/protocol.h b/src/net/protocol.h
index 5aab202c..e26e9ed5 100644
--- a/src/net/protocol.h
+++ b/src/net/protocol.h
@@ -148,8 +148,11 @@ enum {
CPMSG_GUILD_REJOIN = 0x0371, // S name, W guild, B rights, W channel
// Party
- PCMSG_PARTY_CREATE = 0x03A0, // -
- CPMSG_PARTY_CREATE_RESPONSE = 0x03A1, // B error
+ PCMSG_PARTY_INVITE = 0x03A0, // S name
+ CPMSG_PARTY_INVITE_RESPONSE = 0x03A1, // B error
+ CPMSG_PARTY_INVITED = 0x03A2, // S name
+ PCMSG_PARTY_ACCEPT_INVITE = 0x03A5, // S name
+ CPMSG_PARTY_ACCEPT_INVITE_RESPONSE = 0x03A6, // B error
PCMSG_PARTY_QUIT = 0x03AA, // -
CPMSG_PARTY_QUIT_RESPONSE = 0x03AB, // B error