summaryrefslogtreecommitdiff
path: root/src/party.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/party.cpp')
-rw-r--r--src/party.cpp132
1 files changed, 67 insertions, 65 deletions
diff --git a/src/party.cpp b/src/party.cpp
index 70e0d3c2..fe575a37 100644
--- a/src/party.cpp
+++ b/src/party.cpp
@@ -33,7 +33,9 @@
#include "utils/strprintf.h"
Party::Party(ChatWindow *chat, Network *network) :
- mChat(chat), mNetwork(network), mInviteListener(network, &mInParty)
+ mChat(chat),
+ mNetwork(network),
+ mInviteListener(network, &mInParty)
{
}
@@ -41,24 +43,24 @@ void Party::respond(const std::string &command, const std::string &args)
{
if (command == "new" || command == "create")
{
- create(args);
- return;
+ create(args);
+ return;
}
if (command == "leave")
{
- leave(args);
- return;
+ leave(args);
+ return;
}
if (command == "settings")
{
- mChat->chatLog(_("Not yet implemented!"), BY_SERVER);
- return;
- /*
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_PARTY_SETTINGS);
- outMsg.writeInt16(0); // Experience
- outMsg.writeInt16(0); // Item
- */
+ mChat->chatLog(_("Not yet implemented!"), BY_SERVER);
+ return;
+ /*
+ MessageOut outMsg(mNetwork);
+ outMsg.writeInt16(CMSG_PARTY_SETTINGS);
+ outMsg.writeInt16(0); // Experience
+ outMsg.writeInt16(0); // Item
+ */
}
mChat->chatLog(_("Party command not known."), BY_SERVER);
}
@@ -67,8 +69,8 @@ void Party::create(const std::string &party)
{
if (party == "")
{
- mChat->chatLog(_("Party name is missing."), BY_SERVER);
- return;
+ mChat->chatLog(_("Party name is missing."), BY_SERVER);
+ return;
}
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_PARTY_CREATE);
@@ -88,12 +90,12 @@ void Party::createResponse(bool ok)
{
if (ok)
{
- mChat->chatLog(_("Party successfully created."), BY_SERVER);
- mInParty = true;
+ mChat->chatLog(_("Party successfully created."), BY_SERVER);
+ mInParty = true;
}
else
{
- mChat->chatLog(_("Could not create party."), BY_SERVER);
+ mChat->chatLog(_("Could not create party."), BY_SERVER);
}
}
@@ -102,34 +104,34 @@ void Party::inviteResponse(const std::string &nick, int status)
switch (status)
{
case 0:
- mChat->chatLog(strprintf(_("%s is already a member of a party."),
- nick.c_str()), BY_SERVER);
- break;
+ mChat->chatLog(strprintf(_("%s is already a member of a party."),
+ nick.c_str()), BY_SERVER);
+ break;
case 1:
- mChat->chatLog(strprintf(_("%s refused your invitation."),
- nick.c_str()), BY_SERVER);
- break;
+ mChat->chatLog(strprintf(_("%s refused your invitation."),
+ nick.c_str()), BY_SERVER);
+ break;
case 2:
- mChat->chatLog(strprintf(_("%s is now a member of your party."),
- nick.c_str()), BY_SERVER);
- break;
+ mChat->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)
+ const std::string &partyName)
{
mPartyName = partyName; /* Quick and nasty - needs redoing */
if (nick == "")
{
mChat->chatLog(_("You can\'t have a blank party name!"), BY_SERVER);
- return;
+ 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()));
+ strprintf(_("%s invites you to join"
+ " the %s party, do you accept?"),
+ nick.c_str(), partyName.c_str()));
dlg->addActionListener(&mInviteListener);
}
@@ -145,7 +147,7 @@ void Party::InviteListener::action(const gcn::ActionEvent &event)
void Party::leftResponse(const std::string &nick)
{
- mChat->chatLog(strprintf(_("%s has left your party."), nick.c_str()),
+ mChat->chatLog(strprintf(_("%s has left your party."), nick.c_str()),
BY_SERVER);
}
@@ -153,13 +155,13 @@ void Party::receiveChat(Being *being, const std::string &msg)
{
if (being == NULL)
{
- return;
+ return;
}
if (being->getType() != Being::PLAYER)
{
- mChat->chatLog(_("Party chat received, but being is not a player"),
+ mChat->chatLog(_("Party chat received, but being is not a player"),
BY_SERVER);
- return;
+ return;
}
being->setSpeech(msg, SPEECH_TIME);
mChat->chatLog(being->getName() + " : " + msg, BY_PARTY);
@@ -169,46 +171,46 @@ void Party::help(const std::string &msg)
{
if (msg == "")
{
- mChat->chatLog(_("Command: /party <command> <args>"), BY_SERVER);
- mChat->chatLog(_("where <command> can be one of:"), BY_SERVER);
- mChat->chatLog(_(" /new"), BY_SERVER);
- mChat->chatLog(_(" /create"), BY_SERVER);
- mChat->chatLog(_(" /prefix"), BY_SERVER);
- mChat->chatLog(_(" /leave"), BY_SERVER);
- mChat->chatLog(_("This command implements the partying function."),
- BY_SERVER);
- mChat->chatLog(_("Type /help party <command> for further help."),
- BY_SERVER);
- return;
+ mChat->chatLog(_("Command: /party <command> <args>"), BY_SERVER);
+ mChat->chatLog(_("where <command> can be one of:"), BY_SERVER);
+ mChat->chatLog(_(" /new"), BY_SERVER);
+ mChat->chatLog(_(" /create"), BY_SERVER);
+ mChat->chatLog(_(" /prefix"), BY_SERVER);
+ mChat->chatLog(_(" /leave"), BY_SERVER);
+ mChat->chatLog(_("This command implements the partying function."),
+ BY_SERVER);
+ mChat->chatLog(_("Type /help party <command> for further help."),
+ BY_SERVER);
+ return;
}
if (msg == "new" || msg == "create")
{
- mChat->chatLog(_("Command: /party new <party-name>"), BY_SERVER);
- mChat->chatLog(_("Command: /party create <party-name>"), BY_SERVER);
- mChat->chatLog(_("These commands create a new party <party-name."),
- BY_SERVER);
- return;
+ mChat->chatLog(_("Command: /party new <party-name>"), BY_SERVER);
+ mChat->chatLog(_("Command: /party create <party-name>"), BY_SERVER);
+ mChat->chatLog(_("These commands create a new party <party-name."),
+ BY_SERVER);
+ return;
}
if (msg == "prefix")
{
- mChat->chatLog(_("Command: /party prefix <prefix-char>"), BY_SERVER);
- mChat->chatLog(_("This command sets the party prefix character."),
- BY_SERVER);
- mChat->chatLog(_("Any message preceded by <prefix-char> is sent to "
- "the party instead of everyone."), BY_SERVER);
- mChat->chatLog(_("Command: /party prefix"), BY_SERVER);
- mChat->chatLog(_("This command reports the current party prefix "
- "character."), BY_SERVER);
- return;
+ mChat->chatLog(_("Command: /party prefix <prefix-char>"), BY_SERVER);
+ mChat->chatLog(_("This command sets the party prefix character."),
+ BY_SERVER);
+ mChat->chatLog(_("Any message preceded by <prefix-char> is sent to "
+ "the party instead of everyone."), BY_SERVER);
+ mChat->chatLog(_("Command: /party prefix"), BY_SERVER);
+ mChat->chatLog(_("This command reports the current party prefix "
+ "character."), BY_SERVER);
+ return;
}
//if (msg == "settings")
//if (msg == "info")
if (msg == "leave")
{
- mChat->chatLog(_("Command: /party leave"), BY_SERVER);
- mChat->chatLog(_("This command causes the player to leave the party."),
- BY_SERVER);
- return;
+ mChat->chatLog(_("Command: /party leave"), BY_SERVER);
+ mChat->chatLog(_("This command causes the player to leave the party."),
+ BY_SERVER);
+ return;
}
mChat->chatLog(_("Unknown /party command."), BY_SERVER);
mChat->chatLog(_("Type /help party for a list of options."), BY_SERVER);