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 | |
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')
-rw-r--r-- | src/net/manaserv/guildhandler.cpp | 44 | ||||
-rw-r--r-- | src/net/manaserv/guildhandler.h | 4 | ||||
-rw-r--r-- | src/net/manaserv/inventoryhandler.cpp | 25 | ||||
-rw-r--r-- | src/net/manaserv/inventoryhandler.h | 8 |
4 files changed, 46 insertions, 35 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); diff --git a/src/net/manaserv/guildhandler.h b/src/net/manaserv/guildhandler.h index d80f0b33..3beaf16f 100644 --- a/src/net/manaserv/guildhandler.h +++ b/src/net/manaserv/guildhandler.h @@ -45,13 +45,13 @@ public: void leave(int guildId); - void kick(int guildId, int playerId); + void kick(GuildMember member); void chat(int guildId, const std::string &text); void memberList(int guildId); - void changeMemberPostion(int guildId, int playerId, int level); + void changeMemberPostion(GuildMember member, int level); void requestAlliance(int guildId, int otherGuildId); diff --git a/src/net/manaserv/inventoryhandler.cpp b/src/net/manaserv/inventoryhandler.cpp index 0d0c1b34..e2a579fd 100644 --- a/src/net/manaserv/inventoryhandler.cpp +++ b/src/net/manaserv/inventoryhandler.cpp @@ -66,7 +66,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) case GPMSG_INVENTORY: while (msg.getUnreadLength()) { - int slot = msg.readInt8(); + unsigned int slot = msg.readInt8(); if (slot == 255) { player_node->setMoney(msg.readInt32()); @@ -78,7 +78,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) { player_node->mEquipment->setEquipment(slot, id); } - else if (slot >= 32 && slot < 32 + getInventorySize()) + else if (slot >= 32 && slot < 32 + getSize(INVENTORY)) { int amount = id ? msg.readInt8() : 0; player_node->setInvItem(slot - 32, id, amount); @@ -153,12 +153,12 @@ void InventoryHandler::moveItem(int oldIndex, int newIndex) gameServerConnection->send(msg); } -void InventoryHandler::openStorage() +void InventoryHandler::openStorage(StorageType type) { // TODO } -void InventoryHandler::closeStorage() +void InventoryHandler::closeStorage(StorageType type) { // TODO } @@ -169,14 +169,19 @@ void InventoryHandler::moveItem(StorageType source, int slot, int amount, // TODO } -size_t InventoryHandler::getInventorySize() const +size_t InventoryHandler::getSize(StorageType type) const { - return 50; -} + switch (type) + { + case INVENTORY: + return 50; + case STORAGE: + case GUILD_STORAGE: + return 300; + case CART: + return 0; + } -size_t InventoryHandler::getStorageSize() const -{ - return 300; } } // namespace ManaServ diff --git a/src/net/manaserv/inventoryhandler.h b/src/net/manaserv/inventoryhandler.h index 1f937df9..d3feca0a 100644 --- a/src/net/manaserv/inventoryhandler.h +++ b/src/net/manaserv/inventoryhandler.h @@ -49,16 +49,14 @@ class InventoryHandler : public MessageHandler, Net::InventoryHandler void moveItem(int oldIndex, int newIndex); - void openStorage(); + void openStorage(StorageType type); - void closeStorage(); + void closeStorage(StorageType type); void moveItem(StorageType source, int slot, int amount, StorageType destination); - size_t getInventorySize() const; - - size_t getStorageSize() const; + size_t getSize(StorageType type) const; }; } // namespace ManaServ |