diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-02-08 14:40:04 -0700 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-02-08 14:43:51 -0700 |
commit | 8a31e96d8534d402db9cd48183c0b15732f7d95e (patch) | |
tree | 885d83febf301c1289c3bf7f83bf9dca89e0347c /src/net/manaserv | |
parent | bc5c031e43eff506c925682349dd2a52b89d6565 (diff) | |
download | mana-8a31e96d8534d402db9cd48183c0b15732f7d95e.tar.gz mana-8a31e96d8534d402db9cd48183c0b15732f7d95e.tar.bz2 mana-8a31e96d8534d402db9cd48183c0b15732f7d95e.tar.xz mana-8a31e96d8534d402db9cd48183c0b15732f7d95e.zip |
Merge PartyWindow and GuildWindow into SocialWindow
Diffstat (limited to 'src/net/manaserv')
-rw-r--r-- | src/net/manaserv/chathandler.cpp | 1 | ||||
-rw-r--r-- | src/net/manaserv/generalhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/manaserv/guildhandler.cpp | 26 | ||||
-rw-r--r-- | src/net/manaserv/partyhandler.cpp | 30 | ||||
-rw-r--r-- | src/net/manaserv/partyhandler.h | 4 |
5 files changed, 33 insertions, 32 deletions
diff --git a/src/net/manaserv/chathandler.cpp b/src/net/manaserv/chathandler.cpp index 08863eca..e849b51a 100644 --- a/src/net/manaserv/chathandler.cpp +++ b/src/net/manaserv/chathandler.cpp @@ -29,7 +29,6 @@ #include "main.h" #include "gui/chat.h" -#include "gui/guildwindow.h" #include "gui/widgets/channeltab.h" diff --git a/src/net/manaserv/generalhandler.cpp b/src/net/manaserv/generalhandler.cpp index de066aca..aa3b06f5 100644 --- a/src/net/manaserv/generalhandler.cpp +++ b/src/net/manaserv/generalhandler.cpp @@ -26,7 +26,6 @@ #include "gui/changeemaildialog.h" #include "gui/charselectdialog.h" #include "gui/inventorywindow.h" -#include "gui/partywindow.h" #include "gui/register.h" #include "gui/skilldialog.h" #include "gui/specialswindow.h" @@ -159,8 +158,7 @@ void GeneralHandler::flushNetwork() void GeneralHandler::guiWindowsLoaded() { inventoryWindow->setSplitAllowed(true); - partyWindow->clearPartyName(); - skillDialog->loadSkills("mana-skills.xml"); + skillDialog->loadSkills("tmw-skills.xml"); specialsWindow->loadSpecials("specials.xml"); player_node->setExpNeeded(100); diff --git a/src/net/manaserv/guildhandler.cpp b/src/net/manaserv/guildhandler.cpp index 44220e9a..fc0e7e25 100644 --- a/src/net/manaserv/guildhandler.cpp +++ b/src/net/manaserv/guildhandler.cpp @@ -21,17 +21,18 @@ #include "net/manaserv/guildhandler.h" -#include "gui/widgets/channeltab.h" -#include "gui/chat.h" -#include "gui/guildwindow.h" - #include "guild.h" #include "log.h" #include "localplayer.h" #include "channel.h" #include "channelmanager.h" +#include "gui/widgets/channeltab.h" +#include "gui/chat.h" +#include "gui/socialwindow.h" + #include "net/messagein.h" +#include "net/net.h" #include "net/manaserv/connection.h" #include "net/manaserv/messagein.h" @@ -135,8 +136,6 @@ void GuildHandler::handleMessage(Net::MessageIn &msg) guild->addMember(member); } } - - guildWindow->updateTab(); } } break; @@ -183,9 +182,6 @@ void GuildHandler::handleMessage(Net::MessageIn &msg) logger->log("Invalid guild event"); } } - guildWindow->updateTab(); - - } break; case CPMSG_GUILD_INVITED: @@ -196,7 +192,7 @@ void GuildHandler::handleMessage(Net::MessageIn &msg) int guildId = msg.readInt16(); // Open a dialog asking if the player accepts joining the guild. - guildWindow->openAcceptDialog(inviterName, guildName, guildId); + socialWindow->showGuildInvite(guildName, guildId, inviterName); } break; case CPMSG_GUILD_PROMOTE_MEMBER_RESPONSE: @@ -236,7 +232,6 @@ void GuildHandler::handleMessage(Net::MessageIn &msg) { Channel *channel = channelManager->findByName(guild->getName()); channelManager->removeChannel(channel); - guildWindow->removeTab(guildId); player_node->removeGuild(guildId); } } @@ -252,11 +247,12 @@ void GuildHandler::joinedGuild(Net::MessageIn &msg) short channelId = msg.readInt16(); std::string announcement = msg.readString(); - // Add guild to player and create new guild tab - Guild *guild = player_node->addGuild(guildId, permissions); + // Add guild to player + Guild *guild = Guild::getGuild(guildId); guild->setName(guildName); - guildWindow->newGuildTab(guildName); - guildWindow->requestMemberList(guildId); + guild->setRights(permissions); + player_node->addGuild(guild); + Net::getGuildHandler()->memberList(guildId); // Automatically create the guild channel // COMMENT: Should this go here?? diff --git a/src/net/manaserv/partyhandler.cpp b/src/net/manaserv/partyhandler.cpp index cec33fc4..da97374b 100644 --- a/src/net/manaserv/partyhandler.cpp +++ b/src/net/manaserv/partyhandler.cpp @@ -21,13 +21,13 @@ #include "net/manaserv/partyhandler.h" -#include "gui/partywindow.h" - -#include "gui/widgets/chattab.h" - #include "log.h" #include "localplayer.h" +#include "gui/socialwindow.h" + +#include "gui/widgets/chattab.h" + #include "net/manaserv/connection.h" #include "net/manaserv/messagein.h" #include "net/manaserv/messageout.h" @@ -38,13 +38,16 @@ #include <iostream> +#define PARTY_ID 1 + extern Net::PartyHandler *partyHandler; namespace ManaServ { extern Connection *chatServerConnection; -PartyHandler::PartyHandler() +PartyHandler::PartyHandler(): + mParty(Party::getParty(PARTY_ID)) { static const Uint16 _messages[] = { CPMSG_PARTY_INVITE_RESPONSE, @@ -74,15 +77,14 @@ void PartyHandler::handleMessage(Net::MessageIn &msg) case CPMSG_PARTY_INVITED: { - std::string inviter = msg.readString(); - partyWindow->showPartyInvite(inviter); + socialWindow->showPartyInvite(msg.readString()); } break; case CPMSG_PARTY_ACCEPT_INVITE_RESPONSE: { if (msg.readInt8() == ERRMSG_OK) { - player_node->setInParty(true); + // localChatTab->chatLog(_("Joined party.")); } } @@ -91,7 +93,8 @@ void PartyHandler::handleMessage(Net::MessageIn &msg) { if (msg.readInt8() == ERRMSG_OK) { - player_node->setInParty(false); + mParty->clearMembers(); + player_node->setParty(NULL); } } break; @@ -103,15 +106,16 @@ void PartyHandler::handleMessage(Net::MessageIn &msg) localChatTab->chatLog(strprintf(_("%s joined the party."), name.c_str())); - if (!player_node->isInParty()) - player_node->setInParty(true); + if (id == player_node->getId()) + player_node->setParty(mParty); - partyWindow->updateMember(id, name); + PartyMember *member = new PartyMember(PARTY_ID, id, name); + mParty->addMember(member); } break; case CPMSG_PARTY_MEMBER_LEFT: { - partyWindow->removeMember(msg.readString()); + mParty->removeMember(msg.readString()); } break; case CPMSG_PARTY_REJECTED: diff --git a/src/net/manaserv/partyhandler.h b/src/net/manaserv/partyhandler.h index 5ab03785..f97d9fb9 100644 --- a/src/net/manaserv/partyhandler.h +++ b/src/net/manaserv/partyhandler.h @@ -26,6 +26,8 @@ #include "net/manaserv/messagehandler.h" +#include "party.h" + #include <string> namespace ManaServ { @@ -64,6 +66,8 @@ public: PartyShare getShareItems() { return PARTY_SHARE_NO; } void setShareItems(PartyShare share) {} +private: + Party *mParty; }; } // namespace ManaServ |