diff options
Diffstat (limited to 'src/net/eathena')
-rw-r--r-- | src/net/eathena/guildhandler.cpp | 42 | ||||
-rw-r--r-- | src/net/eathena/guildhandler.h | 10 |
2 files changed, 50 insertions, 2 deletions
diff --git a/src/net/eathena/guildhandler.cpp b/src/net/eathena/guildhandler.cpp index 27d848e74..03c5a34ef 100644 --- a/src/net/eathena/guildhandler.cpp +++ b/src/net/eathena/guildhandler.cpp @@ -22,10 +22,15 @@ #include "net/eathena/guildhandler.h" #include "actormanager.h" +#include "configuration.h" #include "being/localplayer.h" #include "being/playerinfo.h" +#include "gui/windows/chatwindow.h" + +#include "net/ea/gui/guildtab.h" + #include "net/eathena/messageout.h" #include "net/eathena/protocol.h" @@ -348,4 +353,41 @@ void GuildHandler::checkMaster() const MessageOut msg(CMSG_GUILD_CHECK_MASTER); } +void GuildHandler::processGuildPositionInfo(Net::MessageIn &msg) const +{ + const int guildId = msg.readInt32(); + const int emblem = msg.readInt32(); + const int posMode = msg.readInt32(); + msg.readInt32(); // Unused + msg.readUInt8(); // Unused + std::string guildName = msg.readString(24); + + Guild *const g = Guild::getGuild(static_cast<int16_t>(guildId)); + if (!g) + return; + + g->setName(guildName); + g->setEmblemId(emblem); + if (!Ea::taGuild) + Ea::taGuild = g; + if (!Ea::guildTab && chatWindow) + { + Ea::guildTab = new Ea::GuildTab(chatWindow); + if (config.getBoolValue("showChatHistory")) + Ea::guildTab->loadFromLogFile("#Guild"); + if (localPlayer) + localPlayer->addGuild(Ea::taGuild); + memberList(guildId); + } + + if (localPlayer) + { + localPlayer->setGuild(g); + localPlayer->setGuildName(g->getName()); + } + + logger->log("Guild position info: %d %d %d %s\n", guildId, + emblem, posMode, guildName.c_str()); +} + } // namespace EAthena diff --git a/src/net/eathena/guildhandler.h b/src/net/eathena/guildhandler.h index a32a398f5..c9beedc6b 100644 --- a/src/net/eathena/guildhandler.h +++ b/src/net/eathena/guildhandler.h @@ -75,10 +75,16 @@ class GuildHandler final : public Ea::GuildHandler, public MessageHandler protected: void processGuildUpdateCoords(Net::MessageIn &msg) const; + + void processGuildPositionInfo(Net::MessageIn &msg) const; }; - extern Ea::GuildTab *guildTab; - extern Guild *taGuild; +// extern Ea::GuildTab *guildTab; } // namespace EAthena +namespace Ea +{ + extern Guild *taGuild; +} + #endif // NET_EATHENA_GUILDHANDLER_H |