diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-11-07 11:47:24 -0700 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-11-07 11:47:24 -0700 |
commit | 99be9859a30e84e758ee3bfe7dcc3de33dfa2391 (patch) | |
tree | 49354012582a4c9e9218ebafad429b07b19b2539 /src/net/manaserv/guildhandler.cpp | |
parent | 9c1cc1e46fd21ec48809fbb8f64853fcecef2439 (diff) | |
download | mana-99be9859a30e84e758ee3bfe7dcc3de33dfa2391.tar.gz mana-99be9859a30e84e758ee3bfe7dcc3de33dfa2391.tar.bz2 mana-99be9859a30e84e758ee3bfe7dcc3de33dfa2391.tar.xz mana-99be9859a30e84e758ee3bfe7dcc3de33dfa2391.zip |
More eAthena guild stuff
Also some related chenges elsewhere
Diffstat (limited to 'src/net/manaserv/guildhandler.cpp')
-rw-r--r-- | src/net/manaserv/guildhandler.cpp | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/src/net/manaserv/guildhandler.cpp b/src/net/manaserv/guildhandler.cpp index e71f4d20..dfc0e8c5 100644 --- a/src/net/manaserv/guildhandler.cpp +++ b/src/net/manaserv/guildhandler.cpp @@ -111,10 +111,10 @@ void GuildHandler::handleMessage(Net::MessageIn &msg) logger->log("Received CPMSG_GUILD_GET_MEMBERS_RESPONSE"); if(msg.readInt8() == ERRMSG_OK) { - std::string guildMember; + std::string name; bool online; - std::string guildName; Guild *guild; + GuildMember *member; short guildId = msg.readInt16(); guild = player_node->getGuild(guildId); @@ -122,16 +122,17 @@ void GuildHandler::handleMessage(Net::MessageIn &msg) if (!guild) return; - guildName = guild->getName(); + guild->clearMembers(); while(msg.getUnreadLength()) { - guildMember = msg.readString(); + name = msg.readString(); online = msg.readInt8(); - if(guildMember != "") + if(name != "") { - guild->addMember(guildMember); - guildWindow->setOnline(guildName, guildMember, online); + member = new GuildMember(guildId, name); + member->setOnline(online); + guild->addMember(member); } } @@ -143,8 +144,9 @@ void GuildHandler::handleMessage(Net::MessageIn &msg) { logger->log("Received CPMSG_GUILD_UPDATE_LIST"); short guildId = msg.readInt16(); - std::string guildMember = msg.readString(); + std::string name = msg.readString(); char eventId = msg.readInt8(); + GuildMember *member; Guild *guild = player_node->getGuild(guildId); if (guild) @@ -152,23 +154,29 @@ void GuildHandler::handleMessage(Net::MessageIn &msg) switch(eventId) { case GUILD_EVENT_NEW_PLAYER: - guild->addMember(guildMember); - guildWindow->setOnline(guild->getName(), guildMember, - true); + member = new GuildMember(guildId, name); + member->setOnline(true); + guild->addMember(member); break; case GUILD_EVENT_LEAVING_PLAYER: - guild->removeMember(guildMember); + guild->removeMember(name); break; case GUILD_EVENT_ONLINE_PLAYER: - guildWindow->setOnline(guild->getName(), guildMember, - true); + member = guild->getMember(name); + if (member) + { + member->setOnline(true); + } break; case GUILD_EVENT_OFFLINE_PLAYER: - guildWindow->setOnline(guild->getName(), guildMember, - false); + member = guild->getMember(name); + if (member) + { + member->setOnline(false); + } break; default: @@ -292,7 +300,7 @@ void GuildHandler::leave(int guildId) chatServerConnection->send(msg); } -void GuildHandler::kick(int guildId, int playerId) +void GuildHandler::kick(GuildMember member) { // TODO } @@ -309,7 +317,7 @@ void GuildHandler::memberList(int guildId) chatServerConnection->send(msg); } -void GuildHandler::changeMemberPostion(int guildId, int playerId, int level) +void GuildHandler::changeMemberPostion(GuildMember member, int level) { /*MessageOut msg(PCMSG_GUILD_PROMOTE_MEMBER); msg.writeInt16(guildId); |