diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/game.cpp | 48 | ||||
-rw-r--r-- | src/gui/chat.cpp | 30 | ||||
-rw-r--r-- | src/gui/chat.h | 6 | ||||
-rw-r--r-- | src/gui/login.cpp | 6 | ||||
-rw-r--r-- | src/gui/trade.cpp | 2 |
6 files changed, 52 insertions, 46 deletions
@@ -1,3 +1,9 @@ +2006-01-03 Eugenio Favalli <elvenprogrammer@gmail.com> + + * src/game.cpp, src/gui/chat.cpp, src/gui/chat.h, src/gui/login.cpp, + src/gui/trade.cpp: Really disabled /commands and added proper message + when logging in and banned. + 2006-01-02 Eugenio Favalli <elvenprogrammer@gmail.com> * src/gui/char_select.cpp, src/gui/char_select.h, diff --git a/src/game.cpp b/src/game.cpp index fb130acc..37b2e995 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -849,7 +849,7 @@ void do_parse() std::string chatMsg = msg.readString(chatMsgLength); - chatWindow->chat_log(chatMsg, BY_OTHER); + chatWindow->chatLog(chatMsg, BY_OTHER); chatMsg.erase(0, chatMsg.find(" : ", 0) + 3); being->setSpeech(chatMsg, SPEECH_TIME); @@ -870,7 +870,7 @@ void do_parse() if (msg.getId() == SMSG_PLAYER_CHAT) { - chatWindow->chat_log(chatMsg, BY_PLAYER); + chatWindow->chatLog(chatMsg, BY_PLAYER); std::string::size_type pos = chatMsg.find(" : ", 0); if (pos != std::string::npos) @@ -881,7 +881,7 @@ void do_parse() } else { - chatWindow->chat_log(chatMsg, BY_GM); + chatWindow->chatLog(chatMsg, BY_GM); } } break; @@ -1125,17 +1125,17 @@ void do_parse() switch (msg.readInt8()) { case 0: // Too far away - chatWindow->chat_log("Trading isn't possible. " + chatWindow->chatLog("Trading isn't possible. " "Trade partner is too far away.", BY_SERVER); break; case 1: // Character doesn't exist - chatWindow->chat_log("Trading isn't possible. " + chatWindow->chatLog("Trading isn't possible. " "Character doesn't exist.", BY_SERVER); break; case 2: // Invite request check failed... - chatWindow->chat_log("Trade cancelled due to an " + chatWindow->chatLog("Trade cancelled due to an " "unknown reason.", BY_SERVER); break; case 3: // Trade accepted @@ -1146,11 +1146,11 @@ void do_parse() requestTradeDialogOpen = false; break; case 4: // Trade cancelled - chatWindow->chat_log("Trade cancelled.", BY_SERVER); + chatWindow->chatLog("Trade cancelled.", BY_SERVER); tradeWindow->setVisible(false); break; default: // Shouldn't happen as well, but to be sure - chatWindow->chat_log("Unhandled trade cancel packet", + chatWindow->chatLog("Unhandled trade cancel packet", BY_SERVER); break; } @@ -1194,12 +1194,12 @@ void do_parse() break; case 1: // Add item failed - player overweighted - chatWindow->chat_log("Failed adding item. Trade " + chatWindow->chatLog("Failed adding item. Trade " "partner is over weighted.", BY_SERVER); break; default: - chatWindow->chat_log("Failed adding item for " + chatWindow->chatLog("Failed adding item for " "unknown reason.", BY_SERVER); break; } @@ -1212,13 +1212,13 @@ void do_parse() break; case SMSG_TRADE_CANCEL: - chatWindow->chat_log("Trade canceled.", BY_SERVER); + chatWindow->chatLog("Trade canceled.", BY_SERVER); tradeWindow->setVisible(false); tradeWindow->reset(); break; case SMSG_TRADE_COMPLETE: - chatWindow->chat_log("Trade completed.", BY_SERVER); + chatWindow->chatLog("Trade completed.", BY_SERVER); tradeWindow->setVisible(false); tradeWindow->reset(); break; @@ -1294,7 +1294,7 @@ void do_parse() Sint16 amount = msg.readInt16(); if (msg.readInt8() == 0) { - chatWindow->chat_log("Failed to use item", BY_SERVER); + chatWindow->chatLog("Failed to use item", BY_SERVER); } else { inventory->getItem(index)->setQuantity(amount); } @@ -1346,7 +1346,7 @@ void do_parse() { printf("Action: %d/%d", action.bskill, action.success); } - chatWindow->chat_log(action); + chatWindow->chatLog(action); break; case SMSG_PLAYER_STAT_UPDATE_1: @@ -1566,24 +1566,24 @@ void do_parse() } } else { - chatWindow->chat_log("Nothing to sell", BY_SERVER); + chatWindow->chatLog("Nothing to sell", BY_SERVER); current_npc = 0; } break; case SMSG_NPC_BUY_RESPONSE: if (msg.readInt8() == 0) { - chatWindow->chat_log("Thanks for buying", BY_SERVER); + chatWindow->chatLog("Thanks for buying", BY_SERVER); } else { - chatWindow->chat_log("Unable to buy", BY_SERVER); + chatWindow->chatLog("Unable to buy", BY_SERVER); } break; case SMSG_NPC_SELL_RESPONSE: if (msg.readInt8() == 0) { - chatWindow->chat_log("Thanks for selling", BY_SERVER); + chatWindow->chatLog("Thanks for selling", BY_SERVER); } else { - chatWindow->chat_log("Unable to sell", BY_SERVER); + chatWindow->chatLog("Unable to sell", BY_SERVER); } break; @@ -1601,7 +1601,7 @@ void do_parse() Sint8 fail = msg.readInt8(); if (fail > 0) { - chatWindow->chat_log("Unable to pick up item", + chatWindow->chatLog("Unable to pick up item", BY_SERVER); } else { inventory->addItem(index, itemId, amount, @@ -1661,7 +1661,7 @@ void do_parse() case 0x010c: // Display MVP player msg.readInt32(); // id - chatWindow->chat_log("MVP player", BY_SERVER); + chatWindow->chatLog("MVP player", BY_SERVER); break; case SMSG_ITEM_VISIBLE: @@ -1721,7 +1721,7 @@ void do_parse() index, equipPoint, type); if (type == 0) { - chatWindow->chat_log("Unable to equip.", BY_SERVER); + chatWindow->chatLog("Unable to equip.", BY_SERVER); } else if (equipPoint) { @@ -1768,7 +1768,7 @@ void do_parse() Sint8 type = msg.readInt8(); if (type == 0) { - chatWindow->chat_log("Unable to unequip.", BY_SERVER); + chatWindow->chatLog("Unable to unequip.", BY_SERVER); break; } @@ -1836,7 +1836,7 @@ void do_parse() switch (type) { case 0: - chatWindow->chat_log("Equip arrows first", + chatWindow->chatLog("Equip arrows first", BY_SERVER); break; default: diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 664ba5cd..91b6be91 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -101,7 +101,7 @@ ChatWindow::logic() } void -ChatWindow::chat_log(std::string line, int own) +ChatWindow::chatLog(std::string line, int own) { // Delete overhead from the end of the list while ((int)chatlog.size() > items_keep) { @@ -183,9 +183,9 @@ ChatWindow::chat_log(std::string line, int own) } void -ChatWindow::chat_log(CHATSKILL act) +ChatWindow::chatLog(CHATSKILL act) { - chat_log(const_msg(act), BY_SERVER); + chatLog(const_msg(act), BY_SERVER); } void @@ -194,6 +194,7 @@ ChatWindow::action(const std::string& eventId) if (eventId == "chatinput") { std::string message = chatInput->getText(); + printf("Message: %s\n", message.c_str()); if (message.length() > 0) { // If message different from previous, put it in the history @@ -205,7 +206,7 @@ ChatWindow::action(const std::string& eventId) curHist = history.end(); // Send the message to the server - chat_send(player_info->name.c_str(), message.c_str()); + chatSend(player_info->name.c_str(), message.c_str()); // Clear the text from the chat input chatInput->setText(""); @@ -250,32 +251,25 @@ ChatWindow::isFocused() } void -ChatWindow::chat_send(std::string nick, std::string msg) +ChatWindow::chatSend(std::string nick, std::string msg) { short packetId = CMSG_CHAT_MESSAGE; // prepare command if (msg.substr(0, 1) == "/") { - // global announcement - /*if(msg.substr(0, IS_ANNOUNCE_LENGTH) == IS_ANNOUNCE) { - msg.erase(0, IS_ANNOUNCE_LENGTH); - packid = 0x0099; - }*/ // prepare ordinary message - chat_log("Sorry but /commands are not available yet", BY_PLAYER); + chatLog("Sorry but /commands are not available yet", BY_SERVER); } else { nick += " : "; nick += msg; msg = nick; - //packetId = 0x008c; - } - // send processed message - MessageOut outMsg; - outMsg.writeInt16(packetId); - outMsg.writeInt16(msg.length() + 4); - outMsg.writeString(msg, msg.length()); + MessageOut outMsg; + outMsg.writeInt16(packetId); + outMsg.writeInt16(msg.length() + 4); + outMsg.writeString(msg, msg.length()); + } } std::string diff --git a/src/gui/chat.h b/src/gui/chat.h index a4547d86..80189665 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -130,12 +130,12 @@ class ChatWindow : public Window, public gcn::ActionListener, * @param line Text message. * @parem own Type of message (usually the owner-type). */ - void chat_log(std::string line, int own); + void chatLog(std::string line, int own); /* * Calls original chat_log() after processing the packet. */ - void chat_log(CHATSKILL); + void chatLog(CHATSKILL); /** * Performs action. @@ -177,7 +177,7 @@ class ChatWindow : public Window, public gcn::ActionListener, * chatlog.chat_send("Zaeiru", "Hello to all users on the screen!"); */ void - chat_send(std::string nick, std::string msg); + chatSend(std::string nick, std::string msg); /** Called when key is pressed */ void keyPress(const gcn::Key& key); diff --git a/src/gui/login.cpp b/src/gui/login.cpp index b24c4629..13908bf9 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -325,9 +325,15 @@ LoginDialog::checkLogin() case 4: errorMessage = "You have been blocked by the GM Team"; break; + case 6: + errorMessage = "You have been banned for 5 minutes"; + break; case 9: errorMessage = "This account is already logged in"; break; + default: + errorMessage = "Unknown error"; + break; } skip(msg.getLength()); state = ERROR_STATE; diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index 31efab2e..767888f4 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -284,7 +284,7 @@ void TradeWindow::action(const std::string &eventId) } if (myInventory->contains(item)) { - chatWindow->chat_log("Failed adding item. You can not " + chatWindow->chatLog("Failed adding item. You can not " "overlap one kind of item on the window.", BY_SERVER); return; } |