summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Dombrowski <stefan@uni-bonn.de>2011-05-15 15:15:48 +0200
committerStefan Dombrowski <stefan@uni-bonn.de>2011-05-15 15:15:48 +0200
commitdbfee8acae48ee1eec46d049656e83e952686ece (patch)
treeba39bbfd9851c32d1d32ead544a88a245c8bf434
parent15beafcf8c2c489187a1233d03937b0e1eeb130a (diff)
downloadmana-dbfee8acae48ee1eec46d049656e83e952686ece.tar.gz
mana-dbfee8acae48ee1eec46d049656e83e952686ece.tar.bz2
mana-dbfee8acae48ee1eec46d049656e83e952686ece.tar.xz
mana-dbfee8acae48ee1eec46d049656e83e952686ece.zip
Starting to fix party invite
-rw-r--r--src/being.cpp5
-rw-r--r--src/gui/popupmenu.cpp5
-rw-r--r--src/gui/socialwindow.cpp4
-rw-r--r--src/gui/socialwindow.h4
-rw-r--r--src/net/manaserv/manaserv_protocol.h4
-rw-r--r--src/net/manaserv/partyhandler.cpp20
-rw-r--r--src/net/tmwa/partyhandler.cpp2
7 files changed, 25 insertions, 19 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 94ece475..548895cc 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -551,11 +551,6 @@ void Being::setParty(Party *party)
old->removeMember(mId);
}
- if (party)
- {
- party->addMember(mId, mName);
- }
-
updateColors();
if (this == player_node && socialWindow)
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 7e648311..1c2f3b60 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -129,10 +129,13 @@ void PopupMenu::showPopup(int x, int y, Being *being)
mBrowserBox->addRow(strprintf("@@guild|%s@@",
strprintf(_("Invite %s to join your guild"),
name.c_str()).c_str()));
- if (player_node->isInParty())
+ if (player_node->isInParty() ||
+ Net::getNetworkType() == ServerInfo::MANASERV)
+ {
mBrowserBox->addRow(strprintf("@@party|%s@@",
strprintf(_("Invite %s to join your party"),
name.c_str()).c_str()));
+ }
if (player_node->isGM())
{
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index 07f37eec..1aa57f2f 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -566,8 +566,8 @@ void SocialWindow::showGuildInvite(const std::string &guildName,
mGuildInvited = guildId;
}
-void SocialWindow::showPartyInvite(const std::string &partyName,
- const std::string &inviter)
+void SocialWindow::showPartyInvite(const std::string &inviter,
+ const std::string &partyName)
{
// check there isnt already an invite showing
if (mPartyInviter != "")
diff --git a/src/gui/socialwindow.h b/src/gui/socialwindow.h
index 885c0e54..b8930918 100644
--- a/src/gui/socialwindow.h
+++ b/src/gui/socialwindow.h
@@ -69,8 +69,8 @@ public:
void showGuildCreate();
- void showPartyInvite(const std::string &partyName,
- const std::string &inviter = "");
+ void showPartyInvite(const std::string &inviter,
+ const std::string &partyName = "");
void showPartyCreate();
diff --git a/src/net/manaserv/manaserv_protocol.h b/src/net/manaserv/manaserv_protocol.h
index b5023a42..53dc07df 100644
--- a/src/net/manaserv/manaserv_protocol.h
+++ b/src/net/manaserv/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
diff --git a/src/net/manaserv/partyhandler.cpp b/src/net/manaserv/partyhandler.cpp
index b30d5391..3af54f26 100644
--- a/src/net/manaserv/partyhandler.cpp
+++ b/src/net/manaserv/partyhandler.cpp
@@ -60,6 +60,8 @@ PartyHandler::PartyHandler():
};
handledMessages = _messages;
partyHandler = this;
+
+ mParty->setName("Party");
}
void PartyHandler::handleMessage(Net::MessageIn &msg)
@@ -83,10 +85,16 @@ void PartyHandler::handleMessage(Net::MessageIn &msg)
{
if (msg.readInt8() == ERRMSG_OK)
{
- //
- SERVER_NOTICE(_("Joined party."));
+ player_node->setParty(mParty);
+ while (msg.getUnreadLength())
+ {
+ std::string name = msg.readString();
+ mParty->addMember(0, name);
+ }
}
- }
+ else
+ SERVER_NOTICE(_("Joining party failed."));
+ } break;
case CPMSG_PARTY_QUIT_RESPONSE:
{
@@ -99,13 +107,13 @@ void PartyHandler::handleMessage(Net::MessageIn &msg)
case CPMSG_PARTY_NEW_MEMBER:
{
- int id = msg.readInt16(); // being id
+ int id = msg.readInt32();
std::string name = msg.readString();
SERVER_NOTICE(strprintf(_("%s joined the party."),
name.c_str()));
- if (id == player_node->getId())
+ if (name == player_node->getName())
player_node->setParty(mParty);
mParty->addMember(id, name);
@@ -113,7 +121,7 @@ void PartyHandler::handleMessage(Net::MessageIn &msg)
case CPMSG_PARTY_MEMBER_LEFT:
{
- mParty->removeMember(msg.readString());
+ // mParty->removeMember(msg.readString());
} break;
case CPMSG_PARTY_REJECTED:
diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp
index 00b1e621..2cfc2037 100644
--- a/src/net/tmwa/partyhandler.cpp
+++ b/src/net/tmwa/partyhandler.cpp
@@ -146,7 +146,7 @@ void PartyHandler::handleMessage(Net::MessageIn &msg)
nick = being->getName();
}
- socialWindow->showPartyInvite(partyName, nick);
+ socialWindow->showPartyInvite(nick, partyName);
break;
}
case SMSG_PARTY_SETTINGS: