diff options
Diffstat (limited to 'src/net/ea/party.cpp')
-rw-r--r-- | src/net/ea/party.cpp | 128 |
1 files changed, 8 insertions, 120 deletions
diff --git a/src/net/ea/party.cpp b/src/net/ea/party.cpp index 0fbba2f1..bb7fb4c6 100644 --- a/src/net/ea/party.cpp +++ b/src/net/ea/party.cpp @@ -33,38 +33,14 @@ #include "net/ea/gui/partytab.h" #include "utils/gettext.h" +#include "utils/stringutils.h" #include "utils/strprintf.h" -void eAthena::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") - { - partyTab->chatLog(_("Not yet implemented!"), BY_SERVER); - return; - /* - MessageOut outMsg(CMSG_PARTY_SETTINGS); - outMsg.writeInt16(0); // Experience - outMsg.writeInt16(0); // Item - */ - } - partyTab->chatLog(_("Party command not known."), BY_SERVER); -} - void eAthena::Party::create(const std::string &party) { if (party.empty()) { - localChatTab->chatLog(_("Party name is missing."), BY_SERVER); + partyTab->chatLog(_("Party name is missing."), BY_SERVER); return; } MessageOut outMsg(CMSG_PARTY_CREATE); @@ -74,7 +50,7 @@ void eAthena::Party::create(const std::string &party) void eAthena::Party::leave(const std::string &args) { MessageOut outMsg(CMSG_PARTY_LEAVE); - localChatTab->chatLog(_("Left party."), BY_SERVER); + partyTab->chatLog(_("Left party."), BY_SERVER); player_node->setInParty(false); } @@ -82,32 +58,19 @@ void eAthena::Party::createResponse(bool ok) { if (ok) { - localChatTab->chatLog(_("Party successfully created."), BY_SERVER); + partyTab->chatLog(_("Party successfully created."), BY_SERVER); player_node->setInParty(true); } else { - localChatTab->chatLog(_("Could not create party."), BY_SERVER); + partyTab->chatLog(_("Could not create party."), BY_SERVER); } } -void eAthena::Party::inviteResponse(const std::string &nick, int status) +void eAthena::Party::invite(Player *player) { - switch (status) - { - case 0: - partyTab->chatLog(strprintf(_("%s is already a member of a party."), - nick.c_str()), BY_SERVER); - break; - case 1: - partyTab->chatLog(strprintf(_("%s refused your invitation."), - nick.c_str()), BY_SERVER); - break; - case 2: - partyTab->chatLog(strprintf(_("%s is now a member of your party."), - nick.c_str()), BY_SERVER); - break; - } + MessageOut outMsg(CMSG_PARTY_INVITE); + outMsg.writeInt32(player->getId()); } void eAthena::Party::respondToInvite(bool accept) @@ -117,78 +80,3 @@ void eAthena::Party::respondToInvite(bool accept) outMsg.writeInt32(accept ? 1 : 0); player_node->setInParty(player_node->getInParty() || accept); } - -void eAthena::Party::leftResponse(const std::string &nick) -{ - localChatTab->chatLog(strprintf(_("%s has left your party."), nick.c_str()), - BY_SERVER); - partyWindow->removePartyMember(nick); -} - -void eAthena::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 eAthena::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 <command> <args>"), BY_SERVER); - localChatTab->chatLog(_("where <command> 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 <command> for further help."), - BY_SERVER); - return; - } - if (msg == "new" || msg == "create") - { - localChatTab->chatLog(_("Command: /party new <party-name>"), BY_SERVER); - localChatTab->chatLog(_("Command: /party create <party-name>"), BY_SERVER); - localChatTab->chatLog(_("These commands create a new party <party-name."), - BY_SERVER); - return; - } - if (msg == "prefix") - { - localChatTab->chatLog(_("Command: /party prefix <prefix-char>"), BY_SERVER); - localChatTab->chatLog(_("This command sets the party prefix character."), - BY_SERVER); - localChatTab->chatLog(_("Any message preceded by <prefix-char> 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); -} |