summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-14 00:24:26 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-14 00:24:26 +0300
commit69348d6158802801a626938d5ced85807fd514d8 (patch)
tree647dc95866ef2ef2d9d1c112459a8ce9f321bcfe
parent8438ad4513e9aa2af4b42317aa05358e36f06e98 (diff)
downloadplus-69348d6158802801a626938d5ced85807fd514d8.tar.gz
plus-69348d6158802801a626938d5ced85807fd514d8.tar.bz2
plus-69348d6158802801a626938d5ced85807fd514d8.tar.xz
plus-69348d6158802801a626938d5ced85807fd514d8.zip
eathena: fix packet SMSG_PARTY_INVITED 0x02c6.
-rw-r--r--src/gui/windows/socialwindow.cpp9
-rw-r--r--src/gui/windows/socialwindow.h4
-rw-r--r--src/net/eathena/partyhandler.cpp16
-rw-r--r--src/net/eathena/partyhandler.h1
-rw-r--r--src/net/partyhandler.h7
-rw-r--r--src/net/tmwa/partyhandler.cpp3
-rw-r--r--src/net/tmwa/partyhandler.h1
7 files changed, 20 insertions, 21 deletions
diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp
index 9005e8b35..6fae8deaa 100644
--- a/src/gui/windows/socialwindow.cpp
+++ b/src/gui/windows/socialwindow.cpp
@@ -91,6 +91,7 @@ SocialWindow::SocialWindow() :
mTabs(new TabbedArea(this)),
mMap(nullptr),
mLastUpdateTime(0),
+ mPartyId(0),
mNeedUpdate(false),
mProcessedPortals(false)
{
@@ -275,7 +276,7 @@ void SocialWindow::action(const ActionEvent &event)
strprintf(_("Accepted party invite from %s."),
mPartyInviter.c_str()));
}
- partyHandler->inviteResponse(mPartyInviter, true);
+ partyHandler->inviteResponse(mPartyInviter, mPartyId, true);
}
else if (eventId == "no")
{
@@ -286,7 +287,7 @@ void SocialWindow::action(const ActionEvent &event)
strprintf(_("Rejected party invite from %s."),
mPartyInviter.c_str()));
}
- partyHandler->inviteResponse(mPartyInviter, false);
+ partyHandler->inviteResponse(mPartyInviter, mPartyId, false);
}
mPartyInviter.clear();
@@ -431,7 +432,8 @@ void SocialWindow::showGuildInvite(const std::string &restrict guildName,
}
void SocialWindow::showPartyInvite(const std::string &restrict partyName,
- const std::string &restrict inviter)
+ const std::string &restrict inviter,
+ const int partyId)
{
// check there isnt already an invite showing
if (!mPartyInviter.empty())
@@ -486,6 +488,7 @@ void SocialWindow::showPartyInvite(const std::string &restrict partyName,
mPartyAcceptDialog->postInit();
mPartyAcceptDialog->addActionListener(this);
mPartyInviter = inviter;
+ mPartyId = partyId;
}
void SocialWindow::showPartyCreate()
diff --git a/src/gui/windows/socialwindow.h b/src/gui/windows/socialwindow.h
index 80cc38b0e..a2ecc5e8f 100644
--- a/src/gui/windows/socialwindow.h
+++ b/src/gui/windows/socialwindow.h
@@ -76,7 +76,8 @@ class SocialWindow final : public Window,
void showGuildCreate();
void showPartyInvite(const std::string &restrict partyName,
- const std::string &restrict inviter = "");
+ const std::string &restrict inviter,
+ const int partyId);
void showPartyCreate();
@@ -169,6 +170,7 @@ class SocialWindow final : public Window,
Map *mMap;
int mLastUpdateTime;
+ int mPartyId;
bool mNeedUpdate;
bool mProcessedPortals;
};
diff --git a/src/net/eathena/partyhandler.cpp b/src/net/eathena/partyhandler.cpp
index 452cf1408..ea5b71089 100644
--- a/src/net/eathena/partyhandler.cpp
+++ b/src/net/eathena/partyhandler.cpp
@@ -152,12 +152,13 @@ void PartyHandler::invite(const std::string &name) const
}
void PartyHandler::inviteResponse(const std::string &inviter A_UNUSED,
+ const int partyId,
const bool accept) const
{
if (localPlayer)
{
createOutPacket(CMSG_PARTY_INVITED2);
- outMsg.writeInt32(localPlayer->getId(), "account id");
+ outMsg.writeInt32(partyId, "party id");
outMsg.writeInt8(static_cast<int8_t>(accept ? 1 : 0), "accept");
}
}
@@ -501,20 +502,9 @@ void PartyHandler::processPartyInvited(Net::MessageIn &msg)
{
const int id = msg.readInt32("account id");
const std::string partyName = msg.readString(24, "party name");
- std::string nick;
-
- if (actorManager)
- {
- const Being *const being = actorManager->findBeing(id);
- if (being)
- {
- if (being->getType() == ActorType::Player)
- nick = being->getName();
- }
- }
if (socialWindow)
- socialWindow->showPartyInvite(partyName, nick);
+ socialWindow->showPartyInvite(partyName, "", id);
}
} // namespace EAthena
diff --git a/src/net/eathena/partyhandler.h b/src/net/eathena/partyhandler.h
index f389bcb42..81127f8c8 100644
--- a/src/net/eathena/partyhandler.h
+++ b/src/net/eathena/partyhandler.h
@@ -45,6 +45,7 @@ class PartyHandler final : public MessageHandler, public Ea::PartyHandler
void invite(const std::string &name) const override final;
void inviteResponse(const std::string &inviter,
+ const int partyId,
const bool accept) const override final;
void leave() const override final;
diff --git a/src/net/partyhandler.h b/src/net/partyhandler.h
index dbd0a0b9c..88c0555cf 100644
--- a/src/net/partyhandler.h
+++ b/src/net/partyhandler.h
@@ -48,9 +48,6 @@ class PartyHandler notfinal
virtual void invite(const std::string &name) const = 0;
- virtual void inviteResponse(const std::string &inviter,
- const bool accept) const = 0;
-
virtual void leave() const = 0;
virtual void kick(const Being *const player) const = 0;
@@ -76,6 +73,10 @@ class PartyHandler notfinal
virtual void clear() const = 0;
+ virtual void inviteResponse(const std::string &inviter,
+ const int partyId,
+ const bool accept) const = 0;
+
virtual ChatTab *getTab() const = 0;
};
diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp
index 5762503c7..fac29f8f3 100644
--- a/src/net/tmwa/partyhandler.cpp
+++ b/src/net/tmwa/partyhandler.cpp
@@ -133,6 +133,7 @@ void PartyHandler::invite(const std::string &name) const
}
void PartyHandler::inviteResponse(const std::string &inviter A_UNUSED,
+ const int partyId A_UNUSED,
const bool accept) const
{
if (localPlayer)
@@ -400,7 +401,7 @@ void PartyHandler::processPartyInvited(Net::MessageIn &msg)
}
if (socialWindow)
- socialWindow->showPartyInvite(partyName, nick);
+ socialWindow->showPartyInvite(partyName, nick, 0);
}
} // namespace TmwAthena
diff --git a/src/net/tmwa/partyhandler.h b/src/net/tmwa/partyhandler.h
index a29f03718..4baeada71 100644
--- a/src/net/tmwa/partyhandler.h
+++ b/src/net/tmwa/partyhandler.h
@@ -45,6 +45,7 @@ class PartyHandler final : public MessageHandler, public Ea::PartyHandler
void invite(const std::string &name) const override final;
void inviteResponse(const std::string &inviter,
+ const int partyId,
const bool accept) const override final;
void leave() const override final;