summaryrefslogtreecommitdiff
path: root/src/gui/chat.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2008-12-07 16:53:32 -0700
committerIra Rice <irarice@gmail.com>2008-12-07 16:53:32 -0700
commitaef082e6fe4fca268f9bfe401409eb342f82e4af (patch)
tree26e9f2f2be9ad59666a4c039c7717e0e5becd3eb /src/gui/chat.cpp
parent7f24abc455a407e84f13d75099e36db77fa8931d (diff)
parenta7c21e6f8add37af7412449742ec55c8daa8571a (diff)
downloadmana-aef082e6fe4fca268f9bfe401409eb342f82e4af.tar.gz
mana-aef082e6fe4fca268f9bfe401409eb342f82e4af.tar.bz2
mana-aef082e6fe4fca268f9bfe401409eb342f82e4af.tar.xz
mana-aef082e6fe4fca268f9bfe401409eb342f82e4af.zip
Merge commit 'a7c21e6f8add37af7412449742ec55c8daa8571a'
Conflicts: AUTHORS CMakeLists.txt ChangeLog INSTALL README aethyra.cbp configure.ac data/help/changes.txt data/help/commands.txt data/help/header.txt data/help/support.txt src/Makefile.am src/aethyra.rc src/being.cpp src/being.h src/equipment.cpp src/equipment.h src/floor_item.h src/game.cpp src/gui/buddywindow.cpp src/gui/char_select.cpp src/gui/char_server.cpp src/gui/chat.cpp src/gui/chat.h src/gui/equipmentwindow.cpp src/gui/equipmentwindow.h src/gui/gui.cpp src/gui/inventorywindow.cpp src/gui/inventorywindow.h src/gui/itemcontainer.cpp src/gui/itemcontainer.h src/gui/minimap.cpp src/gui/ministatus.cpp src/gui/newskill.cpp src/gui/npc_text.cpp src/gui/npclistdialog.h src/gui/ok_dialog.cpp src/gui/setup_video.cpp src/gui/skill.cpp src/gui/skill.h src/gui/status.h src/gui/table_model.h src/gui/updatewindow.cpp src/gui/viewport.cpp src/inventory.cpp src/inventory.h src/keyboardconfig.cpp src/keyboardconfig.h src/localplayer.cpp src/localplayer.h src/logindata.h src/main.cpp src/map.cpp src/monster.cpp src/monster.h src/net/beinghandler.cpp src/net/beinghandler.h src/net/buysellhandler.cpp src/net/equipmenthandler.cpp src/net/loginhandler.cpp src/net/loginhandler.h src/net/network.h src/net/npchandler.cpp src/net/playerhandler.cpp src/net/protocol.h src/net/tradehandler.cpp src/npc.cpp src/npc.h src/particleemitter.cpp src/particleemitterprop.h src/player.cpp src/player.h src/player_relations.cpp src/resources/imageset.cpp src/resources/imageset.h src/resources/itemdb.cpp src/resources/mapreader.cpp src/resources/monsterinfo.h src/text.cpp src/text.h src/textmanager.cpp src/textmanager.h src/tileset.h src/utils/fastsqrt.h src/utils/strprintf.cpp src/winver.h tools/tmxcopy/Makefile tools/tmxcopy/base64.cpp tools/tmxcopy/base64.h tools/tmxcopy/tostring.h Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r--src/gui/chat.cpp58
1 files changed, 36 insertions, 22 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index dd11cebb..3f12c462 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -257,7 +257,7 @@ bool ChatWindow::isInputFocused()
return mChatInput->isFocused();
}
-void ChatWindow::chatSend(const std::string & nick, std::string msg)
+void ChatWindow::chatSend(const std::string &nick, std::string msg)
{
/* Some messages are managed client side, while others
* require server handling by proper packet. Probably
@@ -302,37 +302,42 @@ void ChatWindow::chatSend(const std::string & nick, std::string msg)
trim(msg);
}
- if (command == "announce") {
+ if (command == "announce")
+ {
MessageOut outMsg(mNetwork);
outMsg.writeInt16(0x0099);
outMsg.writeInt16(msg.length() + 4);
outMsg.writeString(msg, msg.length());
return;
}
- if (command == "help") {
+ else if (command == "help")
+ {
+ msg.erase(0, 6);
+ trim(msg);
std::size_t space = msg.find(" ");
std::string msg1;
- if (space == std::string::npos) {
+ if (space == std::string::npos)
+ {
msg1 = "";
- } else {
+ }
+ else
+ {
msg1 = msg.substr(space + 1, msg.length());
msg = msg.substr(0, space);
}
- if (msg != "" && msg.at(0) == '/') {
+ if (msg != "" && msg.at(0) == '/')
+ {
msg.erase(0, 1);
}
- while (msg1 != "" && msg1.at(0) == ' ') {
- msg1.erase(0, 1);
- }
+ trim(msg1);
help(msg, msg1);
- return;
}
- if (command == "where") {
+ else if (command == "where")
+ {
// Display the current map, X, and Y
std::ostringstream where;
- where << map_path << " " << player_node->mX << " " << player_node->mY;
+ where << map_path << " " << player_node->mX << "," << player_node->mY;
chatLog(where.str(), BY_SERVER);
- return;
}
if (command == "who") {
MessageOut outMsg(mNetwork);
@@ -648,20 +653,23 @@ void ChatWindow::help(const std::string & msg1, const std::string & msg2)
chatLog("For more information, type /help <command>", BY_SERVER);
return;
}
- if (msg1 == "announce") {
+ if (msg1 == "announce")
+ {
chatLog("Command: /announce <msg>", BY_SERVER);
chatLog("*** only available to a GM ***", BY_SERVER);
chatLog("This command sends the message <msg> to "
"all players currently online.", BY_SERVER);
return;
}
- if (msg1 == "clear") {
+ if (msg1 == "clear")
+ {
chatLog("Command: /clear", BY_SERVER);
chatLog("This command clears the chat log of previous chat.",
BY_SERVER);
return;
}
- if (msg1 == "help") {
+ if (msg1 == "help")
+ {
chatLog("Command: /help", BY_SERVER);
chatLog("This command displays a list of all commands available.",
BY_SERVER);
@@ -669,22 +677,26 @@ void ChatWindow::help(const std::string & msg1, const std::string & msg2)
chatLog("This command displays help on <command>.", BY_SERVER);
return;
}
- if (msg1 == "party") {
+ if (msg1 == "party")
+ {
mParty->help(msg2);
return;
}
- if (msg1 == "present") {
+ if (msg1 == "present")
+ {
chatLog("Command: /present", BY_SERVER);
chatLog("This command gets a list of players within hearing "
"and sends it to either the record log if recording, or the "
"chat log otherwise.", BY_SERVER);
return;
}
- if (msg1 == "record") {
+ if (msg1 == "record")
+ {
mRecorder->help(msg2);
return;
}
- if (msg1 == "toggle") {
+ if (msg1 == "toggle")
+ {
chatLog("Command: /toggle <state>", BY_SERVER);
chatLog("This command sets whether the return key should toggle the "
"chat log, or whether the chat log turns off automatically.",
@@ -696,7 +708,8 @@ void ChatWindow::help(const std::string & msg1, const std::string & msg2)
chatLog("This command displays the return toggle status.", BY_SERVER);
return;
}
- if (msg1 == "where") {
+ if (msg1 == "where")
+ {
chatLog("Command: /where", BY_SERVER);
chatLog("This command displays the name of the current map.",
BY_SERVER);
@@ -709,7 +722,8 @@ void ChatWindow::help(const std::string & msg1, const std::string & msg2)
"double quotes (\").", BY_SERVER);
return;
}
- if (msg1 == "who") {
+ if (msg1 == "who")
+ {
chatLog("Command: /who", BY_SERVER);
chatLog("This command displays the number of players currently "
"online.", BY_SERVER);