From f67237cb69599753192c301f0f2eb38b88f7b57a Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Fri, 27 Mar 2009 16:24:01 -0600 Subject: Clean up some ifdefs and start cleanup of parties --- src/Makefile.am | 6 +- src/commandhandler.cpp | 2 +- src/engine.cpp | 16 +-- src/engine.h | 2 +- src/game.cpp | 5 +- src/gui/widgets/whispertab.cpp | 1 - src/map.cpp | 4 - src/net/ea/gui/partytab.cpp | 53 ++++++++++ src/net/ea/gui/partytab.h | 49 +++++++++ src/net/ea/party.cpp | 215 ++++++++++++++++++++++++++++++++++++++ src/net/ea/party.h | 74 +++++++++++++ src/net/ea/playerhandler.cpp | 5 +- src/net/tmwserv/playerhandler.cpp | 3 - src/party.cpp | 215 -------------------------------------- src/party.h | 74 ------------- 15 files changed, 404 insertions(+), 320 deletions(-) create mode 100644 src/net/ea/gui/partytab.cpp create mode 100644 src/net/ea/gui/partytab.h create mode 100644 src/net/ea/party.cpp create mode 100644 src/net/ea/party.h delete mode 100644 src/party.cpp delete mode 100644 src/party.h diff --git a/src/Makefile.am b/src/Makefile.am index 4c5893ac..3768b7cd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -461,6 +461,8 @@ tmw_SOURCES += \ net/ea/network.h \ net/ea/npchandler.cpp \ net/ea/npchandler.h \ + net/ea/party.cpp \ + net/ea/party.h \ net/ea/partyhandler.cpp \ net/ea/partyhandler.h \ net/ea/playerhandler.cpp \ @@ -470,9 +472,7 @@ tmw_SOURCES += \ net/ea/skillhandler.cpp \ net/ea/skillhandler.h \ net/ea/tradehandler.cpp \ - net/ea/tradehandler.h \ - party.cpp \ - party.h + net/ea/tradehandler.h endif # set the include path found by configure diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index a2de2c63..5431cf88 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -34,8 +34,8 @@ #include "net/tmwserv/chatserver/chatserver.h" #include "net/tmwserv/gameserver/player.h" #else -#include "party.h" #include "net/messageout.h" +#include "net/ea/party.h" #include "net/ea/protocol.h" #endif diff --git a/src/engine.cpp b/src/engine.cpp index d13fbf3f..04d06e38 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -33,11 +33,6 @@ #include "gui/minimap.h" #include "gui/viewport.h" -#ifdef EATHENA_SUPPORT -#include "net/messageout.h" -#include "net/ea/protocol.h" -#endif - #include "resources/mapreader.h" #include "resources/monsterdb.h" #include "resources/resourcemanager.h" @@ -54,7 +49,7 @@ Engine::~Engine() delete mCurrentMap; } -void Engine::changeMap(const std::string &mapPath) +bool Engine::changeMap(const std::string &mapPath) { // Clean up floor items, beings and particles floorItemManager->clear(); @@ -71,11 +66,7 @@ void Engine::changeMap(const std::string &mapPath) mMapName = mapPath; // Store full map path in global var -#ifdef TMWSERV_SUPPORT map_path = "maps/" + mapPath + ".tmx"; -#else - map_path = "maps/" + mapPath.substr(0, mapPath.rfind(".")) + ".tmx"; -#endif ResourceManager *resman = ResourceManager::getInstance(); if (!resman->exists(map_path)) map_path += ".gz"; @@ -143,10 +134,7 @@ void Engine::changeMap(const std::string &mapPath) mCurrentMap = newMap; -#ifdef EATHENA_SUPPORT - // Send "map loaded" - MessageOut outMsg(CMSG_MAP_LOADED); -#endif + return true; } void Engine::logic() diff --git a/src/engine.h b/src/engine.h index eafce3b9..963270e8 100644 --- a/src/engine.h +++ b/src/engine.h @@ -53,7 +53,7 @@ class Engine /** * Sets the currently active map. */ - void changeMap(const std::string &mapName); + bool changeMap(const std::string &mapName); /** * Performs engine logic. This method is called 100 times per second. diff --git a/src/game.cpp b/src/game.cpp index 856a5c11..6b9a829f 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -43,9 +43,6 @@ #include "log.h" #include "npc.h" #include "particle.h" -#ifdef EATHENA_SUPPORT -#include "party.h" -#endif #include "player_relations.h" #include "gui/widgets/chattab.h" @@ -110,6 +107,7 @@ #include "net/ea/inventoryhandler.h" #include "net/ea/itemhandler.h" #include "net/ea/npchandler.h" +#include "net/ea/party.h" #include "net/ea/playerhandler.h" #include "net/ea/tradehandler.h" #include "net/ea/protocol.h" @@ -450,6 +448,7 @@ Game::Game(Network *network): msg.writeInt32(tick_time); engine->changeMap(map_path); + MessageOut outMsg(CMSG_MAP_LOADED); #endif setupWindow->setInGame(true); diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp index 1621e965..9e6d9336 100644 --- a/src/gui/widgets/whispertab.cpp +++ b/src/gui/widgets/whispertab.cpp @@ -28,7 +28,6 @@ #ifdef TMWSERV_SUPPORT #include "net/tmwserv/chatserver/chatserver.h" #else -#include "party.h" #include "net/messageout.h" #include "net/ea/protocol.h" #endif diff --git a/src/map.cpp b/src/map.cpp index 59e6201f..8f736424 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -141,11 +141,7 @@ void MapLayer::draw(Graphics *graphics, int startX, int startY, // tiles have been drawn if (mIsFringeLayer) { -#ifdef TMWSERV_SUPPORT while (si != sprites.end() && (*si)->getPixelY() <= y * 32) -#else - while (si != sprites.end() && (*si)->getPixelY() <= y * 32) -#endif { (*si)->draw(graphics, -scrollX, -scrollY); si++; diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp new file mode 100644 index 00000000..a55d2492 --- /dev/null +++ b/src/net/ea/gui/partytab.cpp @@ -0,0 +1,53 @@ +/* + * The Mana World + * Copyright (C) 2008 The Mana World Development Team + * + * This file is part of The Mana World. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "partytab.h" + +#include "net/messageout.h" + +#include "net/ea/party.h" +#include "net/ea/protocol.h" + +#include "resources/iteminfo.h" +#include "resources/itemdb.h" + +#include "utils/dtor.h" +#include "utils/gettext.h" +#include "utils/strprintf.h" +#include "utils/stringutils.h" + +PartyTab::PartyTab() : ChatTab(_("Party")) +{ +} + +PartyTab::~PartyTab() +{ +} + +void PartyTab::handleInput(std::string &msg) { + // TODO +} + +void PartyTab::handleCommand(std::string &msg) { + // TODO +} diff --git a/src/net/ea/gui/partytab.h b/src/net/ea/gui/partytab.h new file mode 100644 index 00000000..b2aaca68 --- /dev/null +++ b/src/net/ea/gui/partytab.h @@ -0,0 +1,49 @@ +/* + * The Mana World + * Copyright (C) 2009 The Mana World Development Team + * + * This file is part of The Mana World. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef CHANNELTAB_H +#define CHANNELTAB_H + +#include "gui/widgets/chattab.h" + +/** + * A tab for a chat channel. + */ +class PartyTab : public ChatTab +{ + public: + /** + * Constructor. + */ + PartyTab(); + + /** + * Destructor. + */ + ~PartyTab(); + + protected: + void handleInput(const std::string &msg); + + void handleCommand(std::string msg); +}; + +#endif // CHANNELTAB_H diff --git a/src/net/ea/party.cpp b/src/net/ea/party.cpp new file mode 100644 index 00000000..2295cb81 --- /dev/null +++ b/src/net/ea/party.cpp @@ -0,0 +1,215 @@ +/* + * The Mana World + * Copyright (C) 2008 Lloyd Bryant + * + * This file is part of The Mana World. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "being.h" +#include "localplayer.h" +#include "party.h" + +#include "gui/widgets/chattab.h" +#include "gui/chat.h" +#include "gui/confirm_dialog.h" + +#include "net/messageout.h" +#include "net/ea/protocol.h" + +#include "utils/gettext.h" +#include "utils/strprintf.h" + +Party::Party() : + mInviteListener(&mInParty) +{ +} + +void Party::respond(const std::string &command, const std::string &args) +{ + if (command == "new" || command == "create") + { + create(args); + return; + } + if (command == "leave") + { + leave(args); + return; + } + if (command == "settings") + { + localChatTab->chatLog(_("Not yet implemented!"), BY_SERVER); + return; + /* + MessageOut outMsg(CMSG_PARTY_SETTINGS); + outMsg.writeInt16(0); // Experience + outMsg.writeInt16(0); // Item + */ + } + localChatTab->chatLog(_("Party command not known."), BY_SERVER); +} + +void Party::create(const std::string &party) +{ + if (party.empty()) + { + localChatTab->chatLog(_("Party name is missing."), BY_SERVER); + return; + } + MessageOut outMsg(CMSG_PARTY_CREATE); + outMsg.writeString(party.substr(0, 23), 24); + mCreating = true; +} + +void Party::leave(const std::string &args) +{ + MessageOut outMsg(CMSG_PARTY_LEAVE); + localChatTab->chatLog(_("Left party."), BY_SERVER); + mInParty = false; +} + +void Party::createResponse(bool ok) +{ + if (ok) + { + localChatTab->chatLog(_("Party successfully created."), BY_SERVER); + mInParty = true; + } + else + { + localChatTab->chatLog(_("Could not create party."), BY_SERVER); + } +} + +void Party::inviteResponse(const std::string &nick, int status) +{ + switch (status) + { + case 0: + localChatTab->chatLog(strprintf(_("%s is already a member of a party."), + nick.c_str()), BY_SERVER); + break; + case 1: + localChatTab->chatLog(strprintf(_("%s refused your invitation."), + nick.c_str()), BY_SERVER); + break; + case 2: + localChatTab->chatLog(strprintf(_("%s is now a member of your party."), + nick.c_str()), BY_SERVER); + break; + } +} + +void Party::invitedAsk(const std::string &nick, int gender, + const std::string &partyName) +{ + mPartyName = partyName; /* Quick and nasty - needs redoing */ + if (nick.empty()) + { + localChatTab->chatLog(_("You can\'t have a blank party name!"), BY_SERVER); + return; + } + mCreating = false; + ConfirmDialog *dlg = new ConfirmDialog(_("Invite to party"), + strprintf(_("%s invites you to join" + " the %s party, do you accept?"), + nick.c_str(), partyName.c_str())); + dlg->addActionListener(&mInviteListener); +} + +void Party::InviteListener::action(const gcn::ActionEvent &event) +{ + MessageOut outMsg(CMSG_PARTY_INVITED); + outMsg.writeInt32(player_node->getId()); + bool accept = event.getId() == "yes"; + outMsg.writeInt32(accept ? 1 : 0); + *mInParty = *mInParty || accept; +} + +void Party::leftResponse(const std::string &nick) +{ + localChatTab->chatLog(strprintf(_("%s has left your party."), nick.c_str()), + BY_SERVER); +} + +void Party::receiveChat(Being *being, const std::string &msg) +{ + if (!being) + { + return; + } + if (being->getType() != Being::PLAYER) + { + localChatTab->chatLog(_("Party chat received, but being is not a player"), + BY_SERVER); + return; + } + being->setSpeech(msg, SPEECH_TIME); + localChatTab->chatLog(being->getName() + " : " + msg, BY_PARTY); +} + +void Party::help(const std::string &args) +{ + // Strip "party " from the front + std::string msg = args.substr(6, args.length()); + + if (msg.empty()) + { + localChatTab->chatLog(_("Command: /party "), BY_SERVER); + localChatTab->chatLog(_("where can be one of:"), BY_SERVER); + localChatTab->chatLog(_(" /new"), BY_SERVER); + localChatTab->chatLog(_(" /create"), BY_SERVER); + localChatTab->chatLog(_(" /prefix"), BY_SERVER); + localChatTab->chatLog(_(" /leave"), BY_SERVER); + localChatTab->chatLog(_("This command implements the partying function."), + BY_SERVER); + localChatTab->chatLog(_("Type /help party for further help."), + BY_SERVER); + return; + } + if (msg == "new" || msg == "create") + { + localChatTab->chatLog(_("Command: /party new "), BY_SERVER); + localChatTab->chatLog(_("Command: /party create "), BY_SERVER); + localChatTab->chatLog(_("These commands create a new party chatLog(_("Command: /party prefix "), BY_SERVER); + localChatTab->chatLog(_("This command sets the party prefix character."), + BY_SERVER); + localChatTab->chatLog(_("Any message preceded by is sent to " + "the party instead of everyone."), BY_SERVER); + localChatTab->chatLog(_("Command: /party prefix"), BY_SERVER); + localChatTab->chatLog(_("This command reports the current party prefix " + "character."), BY_SERVER); + return; + } + //if (msg == "settings") + //if (msg == "info") + if (msg == "leave") + { + localChatTab->chatLog(_("Command: /party leave"), BY_SERVER); + localChatTab->chatLog(_("This command causes the player to leave the party."), + BY_SERVER); + return; + } + localChatTab->chatLog(_("Unknown /party command."), BY_SERVER); + localChatTab->chatLog(_("Type /help party for a list of options."), BY_SERVER); +} diff --git a/src/net/ea/party.h b/src/net/ea/party.h new file mode 100644 index 00000000..25af80b3 --- /dev/null +++ b/src/net/ea/party.h @@ -0,0 +1,74 @@ +/* + * The Mana World + * Copyright (C) 2008 Lloyd Bryant + * + * This file is part of The Mana World. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PARTY_H +#define PARTY_H + +#include + +#include + +class PartyHandler; +class Being; +class ChatWindow; + +class Party +{ + public: + Party(); + void respond(const std::string &command, const std::string &args); + + void create(const std::string &party); + void leave(const std::string &args); + + void createResponse(bool ok); + void inviteResponse(const std::string &nick, int status); + void invitedAsk(const std::string &nick, int gender, + const std::string &partyName); + void leftResponse(const std::string &nick); + void receiveChat(Being *being, const std::string &msg); + + void help(const std::string &args); + + private: + std::string mPartyName; + bool mInParty; + bool mCreating; /**< Used to give an appropriate response to + failure */ + PartyHandler *handler; + + class InviteListener : public gcn::ActionListener + { + public: + InviteListener(bool *inParty) : + mInParty(inParty) + {} + void action(const gcn::ActionEvent &event); + + private: + bool *mInParty; + }; + InviteListener mInviteListener; +}; + +extern Party *playerParty; + +#endif diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index bf775f51..05f74630 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -24,6 +24,7 @@ #include "net/ea/protocol.h" #include "net/messagein.h" +#include "net/messageout.h" #include "engine.h" #include "localplayer.h" @@ -193,7 +194,9 @@ void PlayerHandler::handleMessage(MessageIn &msg) nearby = (engine->getCurrentMapName() == mapPath); // Switch the actual map, deleting the previous one if necessary - engine->changeMap(mapPath); + mapPath = mapPath.substr(0, mapPath.rfind(".")); + if (engine->changeMap(mapPath)) + MessageOut outMsg(CMSG_MAP_LOADED); float scrollOffsetX = 0.0f; float scrollOffsetY = 0.0f; diff --git a/src/net/tmwserv/playerhandler.cpp b/src/net/tmwserv/playerhandler.cpp index f02ed4c1..106894a1 100644 --- a/src/net/tmwserv/playerhandler.cpp +++ b/src/net/tmwserv/playerhandler.cpp @@ -85,9 +85,6 @@ namespace { npcTextDialog->setVisible(false); buyDialog->setVisible(false); sellDialog->setVisible(false); -#ifdef EATHENA_SUPPORT - buySellDialog->setVisible(false); -#endif current_npc = 0; } } deathListener; diff --git a/src/party.cpp b/src/party.cpp deleted file mode 100644 index 2295cb81..00000000 --- a/src/party.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/* - * The Mana World - * Copyright (C) 2008 Lloyd Bryant - * - * This file is part of The Mana World. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "being.h" -#include "localplayer.h" -#include "party.h" - -#include "gui/widgets/chattab.h" -#include "gui/chat.h" -#include "gui/confirm_dialog.h" - -#include "net/messageout.h" -#include "net/ea/protocol.h" - -#include "utils/gettext.h" -#include "utils/strprintf.h" - -Party::Party() : - mInviteListener(&mInParty) -{ -} - -void Party::respond(const std::string &command, const std::string &args) -{ - if (command == "new" || command == "create") - { - create(args); - return; - } - if (command == "leave") - { - leave(args); - return; - } - if (command == "settings") - { - localChatTab->chatLog(_("Not yet implemented!"), BY_SERVER); - return; - /* - MessageOut outMsg(CMSG_PARTY_SETTINGS); - outMsg.writeInt16(0); // Experience - outMsg.writeInt16(0); // Item - */ - } - localChatTab->chatLog(_("Party command not known."), BY_SERVER); -} - -void Party::create(const std::string &party) -{ - if (party.empty()) - { - localChatTab->chatLog(_("Party name is missing."), BY_SERVER); - return; - } - MessageOut outMsg(CMSG_PARTY_CREATE); - outMsg.writeString(party.substr(0, 23), 24); - mCreating = true; -} - -void Party::leave(const std::string &args) -{ - MessageOut outMsg(CMSG_PARTY_LEAVE); - localChatTab->chatLog(_("Left party."), BY_SERVER); - mInParty = false; -} - -void Party::createResponse(bool ok) -{ - if (ok) - { - localChatTab->chatLog(_("Party successfully created."), BY_SERVER); - mInParty = true; - } - else - { - localChatTab->chatLog(_("Could not create party."), BY_SERVER); - } -} - -void Party::inviteResponse(const std::string &nick, int status) -{ - switch (status) - { - case 0: - localChatTab->chatLog(strprintf(_("%s is already a member of a party."), - nick.c_str()), BY_SERVER); - break; - case 1: - localChatTab->chatLog(strprintf(_("%s refused your invitation."), - nick.c_str()), BY_SERVER); - break; - case 2: - localChatTab->chatLog(strprintf(_("%s is now a member of your party."), - nick.c_str()), BY_SERVER); - break; - } -} - -void Party::invitedAsk(const std::string &nick, int gender, - const std::string &partyName) -{ - mPartyName = partyName; /* Quick and nasty - needs redoing */ - if (nick.empty()) - { - localChatTab->chatLog(_("You can\'t have a blank party name!"), BY_SERVER); - return; - } - mCreating = false; - ConfirmDialog *dlg = new ConfirmDialog(_("Invite to party"), - strprintf(_("%s invites you to join" - " the %s party, do you accept?"), - nick.c_str(), partyName.c_str())); - dlg->addActionListener(&mInviteListener); -} - -void Party::InviteListener::action(const gcn::ActionEvent &event) -{ - MessageOut outMsg(CMSG_PARTY_INVITED); - outMsg.writeInt32(player_node->getId()); - bool accept = event.getId() == "yes"; - outMsg.writeInt32(accept ? 1 : 0); - *mInParty = *mInParty || accept; -} - -void Party::leftResponse(const std::string &nick) -{ - localChatTab->chatLog(strprintf(_("%s has left your party."), nick.c_str()), - BY_SERVER); -} - -void Party::receiveChat(Being *being, const std::string &msg) -{ - if (!being) - { - return; - } - if (being->getType() != Being::PLAYER) - { - localChatTab->chatLog(_("Party chat received, but being is not a player"), - BY_SERVER); - return; - } - being->setSpeech(msg, SPEECH_TIME); - localChatTab->chatLog(being->getName() + " : " + msg, BY_PARTY); -} - -void Party::help(const std::string &args) -{ - // Strip "party " from the front - std::string msg = args.substr(6, args.length()); - - if (msg.empty()) - { - localChatTab->chatLog(_("Command: /party "), BY_SERVER); - localChatTab->chatLog(_("where can be one of:"), BY_SERVER); - localChatTab->chatLog(_(" /new"), BY_SERVER); - localChatTab->chatLog(_(" /create"), BY_SERVER); - localChatTab->chatLog(_(" /prefix"), BY_SERVER); - localChatTab->chatLog(_(" /leave"), BY_SERVER); - localChatTab->chatLog(_("This command implements the partying function."), - BY_SERVER); - localChatTab->chatLog(_("Type /help party for further help."), - BY_SERVER); - return; - } - if (msg == "new" || msg == "create") - { - localChatTab->chatLog(_("Command: /party new "), BY_SERVER); - localChatTab->chatLog(_("Command: /party create "), BY_SERVER); - localChatTab->chatLog(_("These commands create a new party chatLog(_("Command: /party prefix "), BY_SERVER); - localChatTab->chatLog(_("This command sets the party prefix character."), - BY_SERVER); - localChatTab->chatLog(_("Any message preceded by is sent to " - "the party instead of everyone."), BY_SERVER); - localChatTab->chatLog(_("Command: /party prefix"), BY_SERVER); - localChatTab->chatLog(_("This command reports the current party prefix " - "character."), BY_SERVER); - return; - } - //if (msg == "settings") - //if (msg == "info") - if (msg == "leave") - { - localChatTab->chatLog(_("Command: /party leave"), BY_SERVER); - localChatTab->chatLog(_("This command causes the player to leave the party."), - BY_SERVER); - return; - } - localChatTab->chatLog(_("Unknown /party command."), BY_SERVER); - localChatTab->chatLog(_("Type /help party for a list of options."), BY_SERVER); -} diff --git a/src/party.h b/src/party.h deleted file mode 100644 index 25af80b3..00000000 --- a/src/party.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * The Mana World - * Copyright (C) 2008 Lloyd Bryant - * - * This file is part of The Mana World. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PARTY_H -#define PARTY_H - -#include - -#include - -class PartyHandler; -class Being; -class ChatWindow; - -class Party -{ - public: - Party(); - void respond(const std::string &command, const std::string &args); - - void create(const std::string &party); - void leave(const std::string &args); - - void createResponse(bool ok); - void inviteResponse(const std::string &nick, int status); - void invitedAsk(const std::string &nick, int gender, - const std::string &partyName); - void leftResponse(const std::string &nick); - void receiveChat(Being *being, const std::string &msg); - - void help(const std::string &args); - - private: - std::string mPartyName; - bool mInParty; - bool mCreating; /**< Used to give an appropriate response to - failure */ - PartyHandler *handler; - - class InviteListener : public gcn::ActionListener - { - public: - InviteListener(bool *inParty) : - mInParty(inParty) - {} - void action(const gcn::ActionEvent &event); - - private: - bool *mInParty; - }; - InviteListener mInviteListener; -}; - -extern Party *playerParty; - -#endif -- cgit v1.2.3-70-g09d2