summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-07 19:05:04 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-07 19:05:04 +0300
commitd3cdfdb52f031d6974d72e61914a073cb2995d34 (patch)
treee865e27b44abdfddd3e950c6a32f7e1cfb86efdb /src/net
parentb73aec167532701db9ab645ef5d75e5dff1fa963 (diff)
downloadmanaverse-d3cdfdb52f031d6974d72e61914a073cb2995d34.tar.gz
manaverse-d3cdfdb52f031d6974d72e61914a073cb2995d34.tar.bz2
manaverse-d3cdfdb52f031d6974d72e61914a073cb2995d34.tar.xz
manaverse-d3cdfdb52f031d6974d72e61914a073cb2995d34.zip
Move processPartyInfo from ea namespace into eathena and tmwa.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/partyhandler.cpp104
-rw-r--r--src/net/ea/partyhandler.h2
-rw-r--r--src/net/eathena/partyhandler.cpp105
-rw-r--r--src/net/eathena/partyhandler.h2
-rw-r--r--src/net/tmwa/partyhandler.cpp105
-rw-r--r--src/net/tmwa/partyhandler.h2
6 files changed, 214 insertions, 106 deletions
diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp
index 7e2be5a95..5c5aaf80b 100644
--- a/src/net/ea/partyhandler.cpp
+++ b/src/net/ea/partyhandler.cpp
@@ -81,110 +81,6 @@ void PartyHandler::processPartyCreate(Net::MessageIn &msg) const
NotifyManager::notify(NotifyTypes::PARTY_CREATED);
}
-void PartyHandler::processPartyInfo(Net::MessageIn &msg) const
-{
- bool isOldParty = false;
- std::set<std::string> names;
- std::set<std::string> onlineNames;
- if (!Ea::taParty)
- {
- logger->log1("error: party empty in SMSG_PARTY_INFO");
- Ea::taParty = Party::getParty(1);
- }
- if (Ea::taParty)
- {
- if (Ea::taParty->getNumberOfElements() > 1)
- {
- isOldParty = true;
- Ea::taParty->getNamesSet(names);
- const Party::MemberList *const members = Ea::taParty->getMembers();
- FOR_EACHP (Party::MemberList::const_iterator, it, members)
- {
- if ((*it)->getOnline())
- onlineNames.insert((*it)->getName());
- }
- if (localPlayer)
- onlineNames.insert(localPlayer->getName());
- }
- }
-
- if (!localPlayer)
- logger->log1("error: localPlayer==0 in SMSG_PARTY_INFO");
-
- if (Ea::taParty)
- Ea::taParty->clearMembers();
-
- const int length = msg.readInt16();
- if (Ea::taParty)
- Ea::taParty->setName(msg.readString(24));
-
- const int count = (length - 28) / 46;
- if (localPlayer && Ea::taParty)
- {
- localPlayer->setParty(Ea::taParty);
- localPlayer->setPartyName(Ea::taParty->getName());
- }
-
- for (int i = 0; i < count; i++)
- {
- const int id = msg.readInt32();
- std::string nick = msg.readString(24);
- std::string map = msg.readString(16);
- const bool leader = msg.readUInt8() == 0U;
- const bool online = msg.readUInt8() == 0U;
-
- if (Ea::taParty)
- {
- bool joined(false);
-
- if (isOldParty)
- {
- if (names.find(nick) == names.end())
- {
- NotifyManager::notify(NotifyTypes::PARTY_USER_JOINED,
- nick);
- joined = true;
- }
- }
- PartyMember *const member = Ea::taParty->addMember(id, nick);
- if (member)
- {
- if (!joined && Ea::partyTab)
- {
- if (!names.empty() && ((onlineNames.find(nick)
- == onlineNames.end() && online)
- || (onlineNames.find(nick) != onlineNames.end()
- && !online)))
- {
- Ea::partyTab->showOnline(nick, online);
- }
-
- member->setLeader(leader);
- member->setOnline(online);
- member->setMap(map);
- }
- else
- {
- member->setLeader(leader);
- member->setOnline(online);
- member->setMap(map);
- }
- }
- }
- }
-
- if (Ea::taParty)
- Ea::taParty->sort();
-
- if (localPlayer && Ea::taParty)
- {
- localPlayer->setParty(Ea::taParty);
- localPlayer->setPartyName(Ea::taParty->getName());
- if (socialWindow)
- socialWindow->updateParty();
- }
-}
-
void PartyHandler::processPartyInviteResponse(Net::MessageIn &msg) const
{
if (!Ea::partyTab)
diff --git a/src/net/ea/partyhandler.h b/src/net/ea/partyhandler.h
index 93ebde5c4..fbe77d376 100644
--- a/src/net/ea/partyhandler.h
+++ b/src/net/ea/partyhandler.h
@@ -62,8 +62,6 @@ class PartyHandler notfinal : public Net::PartyHandler
virtual void processPartyCreate(Net::MessageIn &msg) const;
- virtual void processPartyInfo(Net::MessageIn &msg) const;
-
virtual void processPartyInviteResponse(Net::MessageIn &msg) const;
virtual void processPartyInvited(Net::MessageIn &msg) const;
diff --git a/src/net/eathena/partyhandler.cpp b/src/net/eathena/partyhandler.cpp
index 99a9e86bd..2a91722ef 100644
--- a/src/net/eathena/partyhandler.cpp
+++ b/src/net/eathena/partyhandler.cpp
@@ -29,6 +29,7 @@
#include "being/localplayer.h"
#include "gui/windows/chatwindow.h"
+#include "gui/windows/socialwindow.h"
#include "net/ea/gui/partytab.h"
@@ -271,4 +272,108 @@ void PartyHandler::processPartySettings(Net::MessageIn &msg)
processPartySettingsContinue(exp, item);
}
+void PartyHandler::processPartyInfo(Net::MessageIn &msg) const
+{
+ bool isOldParty = false;
+ std::set<std::string> names;
+ std::set<std::string> onlineNames;
+ if (!Ea::taParty)
+ {
+ logger->log1("error: party empty in SMSG_PARTY_INFO");
+ Ea::taParty = Party::getParty(1);
+ }
+ if (Ea::taParty)
+ {
+ if (Ea::taParty->getNumberOfElements() > 1)
+ {
+ isOldParty = true;
+ Ea::taParty->getNamesSet(names);
+ const Party::MemberList *const members = Ea::taParty->getMembers();
+ FOR_EACHP (Party::MemberList::const_iterator, it, members)
+ {
+ if ((*it)->getOnline())
+ onlineNames.insert((*it)->getName());
+ }
+ if (localPlayer)
+ onlineNames.insert(localPlayer->getName());
+ }
+ }
+
+ if (!localPlayer)
+ logger->log1("error: localPlayer==0 in SMSG_PARTY_INFO");
+
+ if (Ea::taParty)
+ Ea::taParty->clearMembers();
+
+ const int length = msg.readInt16();
+ if (Ea::taParty)
+ Ea::taParty->setName(msg.readString(24));
+
+ const int count = (length - 28) / 46;
+ if (localPlayer && Ea::taParty)
+ {
+ localPlayer->setParty(Ea::taParty);
+ localPlayer->setPartyName(Ea::taParty->getName());
+ }
+
+ for (int i = 0; i < count; i++)
+ {
+ const int id = msg.readInt32();
+ std::string nick = msg.readString(24);
+ std::string map = msg.readString(16);
+ const bool leader = msg.readUInt8() == 0U;
+ const bool online = msg.readUInt8() == 0U;
+
+ if (Ea::taParty)
+ {
+ bool joined(false);
+
+ if (isOldParty)
+ {
+ if (names.find(nick) == names.end())
+ {
+ NotifyManager::notify(NotifyTypes::PARTY_USER_JOINED,
+ nick);
+ joined = true;
+ }
+ }
+ PartyMember *const member = Ea::taParty->addMember(id, nick);
+ if (member)
+ {
+ if (!joined && Ea::partyTab)
+ {
+ if (!names.empty() && ((onlineNames.find(nick)
+ == onlineNames.end() && online)
+ || (onlineNames.find(nick) != onlineNames.end()
+ && !online)))
+ {
+ Ea::partyTab->showOnline(nick, online);
+ }
+
+ member->setLeader(leader);
+ member->setOnline(online);
+ member->setMap(map);
+ }
+ else
+ {
+ member->setLeader(leader);
+ member->setOnline(online);
+ member->setMap(map);
+ }
+ }
+ }
+ }
+
+ if (Ea::taParty)
+ Ea::taParty->sort();
+
+ if (localPlayer && Ea::taParty)
+ {
+ localPlayer->setParty(Ea::taParty);
+ localPlayer->setPartyName(Ea::taParty->getName());
+ if (socialWindow)
+ socialWindow->updateParty();
+ }
+}
+
} // namespace EAthena
diff --git a/src/net/eathena/partyhandler.h b/src/net/eathena/partyhandler.h
index 690949293..2b7df42b1 100644
--- a/src/net/eathena/partyhandler.h
+++ b/src/net/eathena/partyhandler.h
@@ -69,6 +69,8 @@ class PartyHandler final : public MessageHandler, public Ea::PartyHandler
void processPartyInvitationStats(Net::MessageIn &msg);
void processPartyMemberInfo(Net::MessageIn &msg);
+
+ void processPartyInfo(Net::MessageIn &msg) const;
};
} // namespace EAthena
diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp
index c438b9302..0caaace29 100644
--- a/src/net/tmwa/partyhandler.cpp
+++ b/src/net/tmwa/partyhandler.cpp
@@ -29,6 +29,7 @@
#include "being/localplayer.h"
#include "gui/windows/chatwindow.h"
+#include "gui/windows/socialwindow.h"
#include "net/ea/gui/partytab.h"
@@ -229,4 +230,108 @@ void PartyHandler::processPartySettings(Net::MessageIn &msg)
processPartySettingsContinue(exp, item);
}
+void PartyHandler::processPartyInfo(Net::MessageIn &msg) const
+{
+ bool isOldParty = false;
+ std::set<std::string> names;
+ std::set<std::string> onlineNames;
+ if (!Ea::taParty)
+ {
+ logger->log1("error: party empty in SMSG_PARTY_INFO");
+ Ea::taParty = Party::getParty(1);
+ }
+ if (Ea::taParty)
+ {
+ if (Ea::taParty->getNumberOfElements() > 1)
+ {
+ isOldParty = true;
+ Ea::taParty->getNamesSet(names);
+ const Party::MemberList *const members = Ea::taParty->getMembers();
+ FOR_EACHP (Party::MemberList::const_iterator, it, members)
+ {
+ if ((*it)->getOnline())
+ onlineNames.insert((*it)->getName());
+ }
+ if (localPlayer)
+ onlineNames.insert(localPlayer->getName());
+ }
+ }
+
+ if (!localPlayer)
+ logger->log1("error: localPlayer==0 in SMSG_PARTY_INFO");
+
+ if (Ea::taParty)
+ Ea::taParty->clearMembers();
+
+ const int length = msg.readInt16();
+ if (Ea::taParty)
+ Ea::taParty->setName(msg.readString(24));
+
+ const int count = (length - 28) / 46;
+ if (localPlayer && Ea::taParty)
+ {
+ localPlayer->setParty(Ea::taParty);
+ localPlayer->setPartyName(Ea::taParty->getName());
+ }
+
+ for (int i = 0; i < count; i++)
+ {
+ const int id = msg.readInt32();
+ std::string nick = msg.readString(24);
+ std::string map = msg.readString(16);
+ const bool leader = msg.readUInt8() == 0U;
+ const bool online = msg.readUInt8() == 0U;
+
+ if (Ea::taParty)
+ {
+ bool joined(false);
+
+ if (isOldParty)
+ {
+ if (names.find(nick) == names.end())
+ {
+ NotifyManager::notify(NotifyTypes::PARTY_USER_JOINED,
+ nick);
+ joined = true;
+ }
+ }
+ PartyMember *const member = Ea::taParty->addMember(id, nick);
+ if (member)
+ {
+ if (!joined && Ea::partyTab)
+ {
+ if (!names.empty() && ((onlineNames.find(nick)
+ == onlineNames.end() && online)
+ || (onlineNames.find(nick) != onlineNames.end()
+ && !online)))
+ {
+ Ea::partyTab->showOnline(nick, online);
+ }
+
+ member->setLeader(leader);
+ member->setOnline(online);
+ member->setMap(map);
+ }
+ else
+ {
+ member->setLeader(leader);
+ member->setOnline(online);
+ member->setMap(map);
+ }
+ }
+ }
+ }
+
+ if (Ea::taParty)
+ Ea::taParty->sort();
+
+ if (localPlayer && Ea::taParty)
+ {
+ localPlayer->setParty(Ea::taParty);
+ localPlayer->setPartyName(Ea::taParty->getName());
+ if (socialWindow)
+ socialWindow->updateParty();
+ }
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/partyhandler.h b/src/net/tmwa/partyhandler.h
index 1ffc8d1e0..f731fa32a 100644
--- a/src/net/tmwa/partyhandler.h
+++ b/src/net/tmwa/partyhandler.h
@@ -65,6 +65,8 @@ class PartyHandler final : public MessageHandler, public Ea::PartyHandler
protected:
void processPartySettings(Net::MessageIn &msg);
+
+ void processPartyInfo(Net::MessageIn &msg) const;
};
} // namespace TmwAthena