summaryrefslogtreecommitdiff
path: root/src/net/ea
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-04-07 21:16:24 -0600
committerJared Adams <jaxad0127@gmail.com>2009-04-07 21:23:27 -0600
commit73c773adfb8b65e1305242ab55607882a46e71c3 (patch)
tree5b6d767ce2f44e33283f4e78edbb5a08f0c2b52a /src/net/ea
parentaefbc69aac9f7c793725153eefce2631555bfd1f (diff)
downloadmana-client-73c773adfb8b65e1305242ab55607882a46e71c3.tar.gz
mana-client-73c773adfb8b65e1305242ab55607882a46e71c3.tar.bz2
mana-client-73c773adfb8b65e1305242ab55607882a46e71c3.tar.xz
mana-client-73c773adfb8b65e1305242ab55607882a46e71c3.zip
Implement TMWServ's PartyHandler
Diffstat (limited to 'src/net/ea')
-rw-r--r--src/net/ea/generalhandler.cpp4
-rw-r--r--src/net/ea/gui/partytab.cpp60
-rw-r--r--src/net/ea/partyhandler.cpp6
-rw-r--r--src/net/ea/partyhandler.h4
4 files changed, 42 insertions, 32 deletions
diff --git a/src/net/ea/generalhandler.cpp b/src/net/ea/generalhandler.cpp
index e0974e63..2dee8d1e 100644
--- a/src/net/ea/generalhandler.cpp
+++ b/src/net/ea/generalhandler.cpp
@@ -141,7 +141,9 @@ void GeneralHandler::unload()
{
mNetwork->clearHandlers();
- delete partyTab;
+ // The party tab might not have been made (if we never loaded the main GUI)
+ if (partyTab)
+ delete partyTab;
}
void GeneralHandler::flushNetwork()
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 <party-name>"));
- partyTab->chatLog(_("Command: /party create <party-name>"));
- partyTab->chatLog(_("These commands create a new party <party-name."));
+ chatLog(_("Command: /new <party-name>"));
+ chatLog(_("Command: /create <party-name>"));
+ chatLog(_("These commands create a new party called <party-name>."));
}
//else if (msg == "settings")
//else if (msg == "info")
+ else if (args == "invite")
+ {
+ chatLog(_("Command: /invite <nick>"));
+ chatLog(_("This command invites <nick> to party with you."));
+ chatLog(_("If the <nick> 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 <command>"));
- partyTab->chatLog(_("This command displays help on <command>."));
+ chatLog(_("Command: /help"));
+ chatLog(_("This command displays a list of all commands available."));
+ chatLog(_("Command: /help <command>"));
+ chatLog(_("This command displays help on <command>."));
}
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");
}
}
diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp
index 863765d5..f76bd7d8 100644
--- a/src/net/ea/partyhandler.cpp
+++ b/src/net/ea/partyhandler.cpp
@@ -219,10 +219,10 @@ void PartyHandler::join(int partyId)
{
}
-void PartyHandler::invite(int playerId)
+void PartyHandler::invite(Player *player)
{
MessageOut outMsg(CMSG_PARTY_INVITE);
- outMsg.writeInt32(playerId);
+ outMsg.writeInt32(player->getId());
}
void PartyHandler::invite(const std::string &name)
@@ -230,7 +230,7 @@ void PartyHandler::invite(const std::string &name)
// TODO
}
-void PartyHandler::inviteResponse(bool accept)
+void PartyHandler::inviteResponse(const std::string &inviter, bool accept)
{
MessageOut outMsg(CMSG_PARTY_INVITED);
outMsg.writeInt32(player_node->getId());
diff --git a/src/net/ea/partyhandler.h b/src/net/ea/partyhandler.h
index d156cdc1..41338c96 100644
--- a/src/net/ea/partyhandler.h
+++ b/src/net/ea/partyhandler.h
@@ -39,11 +39,11 @@ class PartyHandler : public MessageHandler, public Net::PartyHandler
void join(int partyId);
- void invite(int playerId);
+ void invite(Player *player);
void invite(const std::string &name);
- void inviteResponse(bool accept);
+ void inviteResponse(const std::string &inviter, bool accept);
void leave();