diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-10-07 16:07:32 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-10-07 16:14:32 +0300 |
commit | 7859c4315e8c59ebeef3b6b030f921badd542f09 (patch) | |
tree | 69986384245e2bb7f8b21da816ea8978475f6fd7 /src/net | |
parent | 629aa611136745eba65dbae6ed8762c133161894 (diff) | |
download | manaverse-7859c4315e8c59ebeef3b6b030f921badd542f09.tar.gz manaverse-7859c4315e8c59ebeef3b6b030f921badd542f09.tar.bz2 manaverse-7859c4315e8c59ebeef3b6b030f921badd542f09.tar.xz manaverse-7859c4315e8c59ebeef3b6b030f921badd542f09.zip |
Move processGuildExpulsion from ea namespace into eathena and tmwa.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/ea/guildhandler.cpp | 82 | ||||
-rw-r--r-- | src/net/ea/guildhandler.h | 4 | ||||
-rw-r--r-- | src/net/eathena/guildhandler.cpp | 15 | ||||
-rw-r--r-- | src/net/eathena/guildhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/guildhandler.cpp | 15 | ||||
-rw-r--r-- | src/net/tmwa/guildhandler.h | 2 |
6 files changed, 75 insertions, 45 deletions
diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp index 2364cfa9a..0cc03d805 100644 --- a/src/net/ea/guildhandler.cpp +++ b/src/net/ea/guildhandler.cpp @@ -448,49 +448,6 @@ void GuildHandler::processGuildLeave(Net::MessageIn &msg) const } } -void GuildHandler::processGuildExpulsion(Net::MessageIn &msg) const -{ - msg.skip(2); // size (can be many explusions in list) - const std::string nick = msg.readString(24); // Name (of expulsed?) - msg.skip(24); // acc - msg.readString(44); // Message - if (taGuild) - taGuild->removeMember(nick); - - if (!localPlayer) - return; - - if (nick == localPlayer->getName()) - { - if (taGuild) - { - taGuild->removeFromMembers(); - taGuild->clearMembers(); - } - NotifyManager::notify(NotifyTypes::GUILD_KICKED); - delete2(guildTab) - - if (socialWindow && taGuild) - socialWindow->removeTab(taGuild); - if (actorManager) - actorManager->updatePlayerColors(); - } - else - { - NotifyManager::notify(NotifyTypes::GUILD_USER_KICKED, nick); - if (actorManager) - { - Being *const b = actorManager->findBeingByName( - nick, ActorType::Player); - - if (b) - b->clearGuilds(); - if (taGuild) - taGuild->removeMember(nick); - } - } -} - void GuildHandler::processGuildExpulsionList(Net::MessageIn &msg) const { const int length = msg.readInt16(); @@ -577,4 +534,43 @@ ChatTab *GuildHandler::getTab() const return guildTab; } +void GuildHandler::processGuildExpulsionContinue(const std::string &nick) const +{ + if (taGuild) + taGuild->removeMember(nick); + + if (!localPlayer) + return; + + if (nick == localPlayer->getName()) + { + if (taGuild) + { + taGuild->removeFromMembers(); + taGuild->clearMembers(); + } + NotifyManager::notify(NotifyTypes::GUILD_KICKED); + delete2(guildTab) + + if (socialWindow && taGuild) + socialWindow->removeTab(taGuild); + if (actorManager) + actorManager->updatePlayerColors(); + } + else + { + NotifyManager::notify(NotifyTypes::GUILD_USER_KICKED, nick); + if (actorManager) + { + Being *const b = actorManager->findBeingByName( + nick, ActorType::Player); + + if (b) + b->clearGuilds(); + if (taGuild) + taGuild->removeMember(nick); + } + } +} + } // namespace Ea diff --git a/src/net/ea/guildhandler.h b/src/net/ea/guildhandler.h index ee3ce2672..2bfa4c4a2 100644 --- a/src/net/ea/guildhandler.h +++ b/src/net/ea/guildhandler.h @@ -81,8 +81,6 @@ class GuildHandler notfinal : public Net::GuildHandler virtual void processGuildLeave(Net::MessageIn &msg) const; - virtual void processGuildExpulsion(Net::MessageIn &msg) const; - virtual void processGuildExpulsionList(Net::MessageIn &msg) const; virtual void processGuildMessage(Net::MessageIn &msg) const; @@ -99,6 +97,8 @@ class GuildHandler notfinal : public Net::GuildHandler virtual void processGuildBroken(Net::MessageIn &msg) const; + void processGuildExpulsionContinue(const std::string &nick) const; + void clear() const override final; ChatTab *getTab() const override final; diff --git a/src/net/eathena/guildhandler.cpp b/src/net/eathena/guildhandler.cpp index 51ff00cce..6c740c945 100644 --- a/src/net/eathena/guildhandler.cpp +++ b/src/net/eathena/guildhandler.cpp @@ -23,6 +23,7 @@ #include "actormanager.h" #include "configuration.h" +#include "notifymanager.h" #include "being/localplayer.h" #include "being/playerinfo.h" @@ -35,6 +36,10 @@ #include "net/eathena/messageout.h" #include "net/eathena/protocol.h" +#include "resources/notifytypes.h" + +#include "utils/delete2.h" + #include "debug.h" extern Net::GuildHandler *guildHandler; @@ -414,4 +419,14 @@ void GuildHandler::processGuildMemberLogin(Net::MessageIn &msg) const } } +void GuildHandler::processGuildExpulsion(Net::MessageIn &msg) const +{ + msg.skip(2); // size (can be many explusions in list) + const std::string nick = msg.readString(24); // Name (of expulsed?) + msg.skip(24); // acc + msg.readString(44); // Message + + processGuildExpulsionContinue(nick); +} + } // namespace EAthena diff --git a/src/net/eathena/guildhandler.h b/src/net/eathena/guildhandler.h index 7f8d4ba6a..7370da44e 100644 --- a/src/net/eathena/guildhandler.h +++ b/src/net/eathena/guildhandler.h @@ -79,6 +79,8 @@ class GuildHandler final : public Ea::GuildHandler, public MessageHandler void processGuildPositionInfo(Net::MessageIn &msg) const; void processGuildMemberLogin(Net::MessageIn &msg) const; + + void processGuildExpulsion(Net::MessageIn &msg) const; }; // extern Ea::GuildTab *guildTab; diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp index 8226bea3f..ec7c9541a 100644 --- a/src/net/tmwa/guildhandler.cpp +++ b/src/net/tmwa/guildhandler.cpp @@ -23,6 +23,7 @@ #include "actormanager.h" #include "configuration.h" +#include "notifymanager.h" #include "being/localplayer.h" #include "being/playerinfo.h" @@ -37,6 +38,10 @@ #include "net/tmwa/messageout.h" #include "net/tmwa/protocol.h" +#include "resources/notifytypes.h" + +#include "utils/delete2.h" + #include "debug.h" extern Net::GuildHandler *guildHandler; @@ -399,4 +404,14 @@ void GuildHandler::processGuildMemberLogin(Net::MessageIn &msg) const } } +void GuildHandler::processGuildExpulsion(Net::MessageIn &msg) const +{ + msg.skip(2, "len?"); + const std::string nick = msg.readString(24, "name?"); + msg.skip(24, "player name"); + msg.readString(44, "message"); // Message + + processGuildExpulsionContinue(nick); +} + } // namespace TmwAthena diff --git a/src/net/tmwa/guildhandler.h b/src/net/tmwa/guildhandler.h index a7f32c9c6..acc32e70b 100644 --- a/src/net/tmwa/guildhandler.h +++ b/src/net/tmwa/guildhandler.h @@ -77,6 +77,8 @@ class GuildHandler final : public Ea::GuildHandler, public MessageHandler void processGuildPositionInfo(Net::MessageIn &msg) const; void processGuildMemberLogin(Net::MessageIn &msg) const; + + void processGuildExpulsion(Net::MessageIn &msg) const; }; extern Ea::GuildTab *guildTab; |