From 73c773adfb8b65e1305242ab55607882a46e71c3 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Tue, 7 Apr 2009 21:16:24 -0600 Subject: Implement TMWServ's PartyHandler --- src/net/ea/gui/partytab.cpp | 60 +++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 26 deletions(-) (limited to 'src/net/ea/gui/partytab.cpp') diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp index 0e0e339e..5f6da0f9 100644 --- a/src/net/ea/gui/partytab.cpp +++ b/src/net/ea/gui/partytab.cpp @@ -22,8 +22,7 @@ #include "partytab.h" #include "net/net.h" - -#include "net/ea/partyhandler.h" +#include "net/partyhandler.h" #include "resources/iteminfo.h" #include "resources/itemdb.h" @@ -44,8 +43,7 @@ PartyTab::~PartyTab() void PartyTab::handleInput(const std::string &msg) { - // Net::getPartyHandler()->chat(msg); - partyHandler->chat(msg); + Net::getPartyHandler()->chat(msg); } void PartyTab::handleCommand(std::string msg) @@ -58,36 +56,44 @@ void PartyTab::handleCommand(std::string msg) { if (args == "") { - partyTab->chatLog(_("-- Help --")); - partyTab->chatLog(_("/help > Display this help.")); - partyTab->chatLog(_("/create > Create a new party")); - partyTab->chatLog(_("/new > alias of create")); - partyTab->chatLog(_("/leave > leave the party you are in")); + chatLog(_("-- Help --")); + chatLog(_("/help > Display this help.")); + chatLog(_("/create > Create a new party")); + chatLog(_("/new > Alias of create")); + chatLog(_("/invite > Invite a player to your party")); + chatLog(_("/leave > Leave the party you are in")); } else if (args == "create" || args == "new") { - partyTab->chatLog(_("Command: /party new ")); - partyTab->chatLog(_("Command: /party create ")); - partyTab->chatLog(_("These commands create a new party ")); + chatLog(_("Command: /create ")); + chatLog(_("These commands create a new party called .")); } //else if (msg == "settings") //else if (msg == "info") + else if (args == "invite") + { + chatLog(_("Command: /invite ")); + chatLog(_("This command invites to party with you.")); + chatLog(_("If the has spaces in it, enclose it in " + "double quotes (\").")); + } else if (args == "leave") { - partyTab->chatLog(_("Command: /party leave")); - partyTab->chatLog(_("This command causes the player to leave the party.")); + chatLog(_("Command: /leave")); + chatLog(_("This command causes the player to leave the party.")); } else if (args == "help") { - partyTab->chatLog(_("Command: /help")); - partyTab->chatLog(_("This command displays a list of all commands available.")); - partyTab->chatLog(_("Command: /help ")); - partyTab->chatLog(_("This command displays help on .")); + chatLog(_("Command: /help")); + chatLog(_("This command displays a list of all commands available.")); + chatLog(_("Command: /help ")); + chatLog(_("This command displays help on .")); } else { - partyTab->chatLog(_("Unknown command.")); - partyTab->chatLog(_("Type /help for a list of commands.")); + chatLog(_("Unknown command.")); + chatLog(_("Type /help for a list of commands.")); } } else if (type == "create" || type == "new") @@ -95,17 +101,19 @@ void PartyTab::handleCommand(std::string msg) if (args.empty()) chatLog(_("Party name is missing."), BY_SERVER); else - // Net::getPartyHandler()->create(args); - partyHandler->create(args); + Net::getPartyHandler()->create(args); + } + else if (type == "invite") + { + Net::getPartyHandler()->invite(args); } else if (type == "leave") { - // Net::getPartyHandler()->leave(); - partyHandler->leave(); + Net::getPartyHandler()->leave(); } else if (type == "settings") { - partyTab->chatLog(_("The settings command is not yet implemented!")); + chatLog(_("The settings command is not yet implemented!")); /* MessageOut outMsg(CMSG_PARTY_SETTINGS); outMsg.writeInt16(0); // Experience @@ -114,6 +122,6 @@ void PartyTab::handleCommand(std::string msg) } else { - partyTab->chatLog("Unknown command"); + chatLog("Unknown command"); } } -- cgit v1.2.3-70-g09d2