diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-03-26 23:04:14 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-03-26 23:04:14 -0600 |
commit | e64b5a25a54f56bc836af57223e37449a1daffe8 (patch) | |
tree | f14f80a0bdc5268a2c4e2c70b6afcac080242ac5 /src/net/ea | |
parent | e03bd01fa02da71d41b85d3710a971da5a9c6c32 (diff) | |
download | mana-e64b5a25a54f56bc836af57223e37449a1daffe8.tar.gz mana-e64b5a25a54f56bc836af57223e37449a1daffe8.tar.bz2 mana-e64b5a25a54f56bc836af57223e37449a1daffe8.tar.xz mana-e64b5a25a54f56bc836af57223e37449a1daffe8.zip |
Major clean up of ChatTab handling
ChatTabs now manage their own adding/removal from the chat window, which
lost most of it's chat related messages. Whisper handling is stil done
by the ChatWindow, but it no longer manages any other tabs. ChannelTab
handling is now the sole responsability of the Channels they are
attached to. The general tab is handled by Game.
Diffstat (limited to 'src/net/ea')
-rw-r--r-- | src/net/ea/buysellhandler.cpp | 10 | ||||
-rw-r--r-- | src/net/ea/chathandler.cpp | 18 | ||||
-rw-r--r-- | src/net/ea/equipmenthandler.cpp | 4 | ||||
-rw-r--r-- | src/net/ea/inventoryhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/ea/playerhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/ea/skillhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/ea/tradehandler.cpp | 20 |
7 files changed, 32 insertions, 32 deletions
diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp index 8dbc2953..d60cb0e2 100644 --- a/src/net/ea/buysellhandler.cpp +++ b/src/net/ea/buysellhandler.cpp @@ -105,7 +105,7 @@ void BuySellHandler::handleMessage(MessageIn &msg) } else { - chatWindow->chatLog(_("Nothing to sell"), BY_SERVER); + localChatTab->chatLog(_("Nothing to sell"), BY_SERVER); current_npc = 0; } break; @@ -113,22 +113,22 @@ void BuySellHandler::handleMessage(MessageIn &msg) case SMSG_NPC_BUY_RESPONSE: if (msg.readInt8() == 0) { - chatWindow->chatLog(_("Thanks for buying"), BY_SERVER); + localChatTab->chatLog(_("Thanks for buying"), BY_SERVER); } else { // Reset player money since buy dialog already assumed purchase // would go fine buyDialog->setMoney(player_node->getMoney()); - chatWindow->chatLog(_("Unable to buy"), BY_SERVER); + localChatTab->chatLog(_("Unable to buy"), BY_SERVER); } break; case SMSG_NPC_SELL_RESPONSE: if (msg.readInt8() == 0) - chatWindow->chatLog(_("Thanks for selling"), BY_SERVER); + localChatTab->chatLog(_("Thanks for selling"), BY_SERVER); else - chatWindow->chatLog(_("Unable to sell"), BY_SERVER); + localChatTab->chatLog(_("Unable to sell"), BY_SERVER); break; } diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index aaf56555..c4743ff2 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -69,13 +69,13 @@ void ChatHandler::handleMessage(MessageIn &msg) { case 0x00: // comment out since we'll local echo in chat.cpp instead, then only report failures - //chatWindow->chatLog("Whisper sent", BY_SERVER); + //localChatTab->chatLog("Whisper sent", BY_SERVER); break; case 0x01: - chatWindow->chatLog(_("Whisper could not be sent, user is offline"), BY_SERVER); + localChatTab->chatLog(_("Whisper could not be sent, user is offline"), BY_SERVER); break; case 0x02: - chatWindow->chatLog(_("Whisper could not be sent, ignored by user"), BY_SERVER); + localChatTab->chatLog(_("Whisper could not be sent, ignored by user"), BY_SERVER); break; } break; @@ -94,7 +94,7 @@ void ChatHandler::handleMessage(MessageIn &msg) if (player_relations.hasPermission(nick, PlayerRelation::WHISPER)) chatWindow->whisper(nick, chatMsg); else - chatWindow->chatLog(chatMsg, BY_SERVER); + localChatTab->chatLog(chatMsg, BY_SERVER); break; @@ -118,7 +118,7 @@ void ChatHandler::handleMessage(MessageIn &msg) // We use getIgnorePlayer instead of ignoringPlayer here because ignorePlayer' side // effects are triggered right below for Being::IGNORE_SPEECH_FLOAT. if (player_relations.checkPermissionSilently(sender_name, PlayerRelation::SPEECH_LOG)) - chatWindow->chatLog(chatMsg, BY_OTHER); + localChatTab->chatLog(chatMsg, BY_OTHER); chatMsg.erase(0, pos + 3); trim(chatMsg); @@ -142,7 +142,7 @@ void ChatHandler::handleMessage(MessageIn &msg) if (msg.getId() == SMSG_PLAYER_CHAT) { - chatWindow->chatLog(chatMsg, BY_PLAYER); + localChatTab->chatLog(chatMsg, BY_PLAYER); if (pos != std::string::npos) chatMsg.erase(0, pos + 3); @@ -153,20 +153,20 @@ void ChatHandler::handleMessage(MessageIn &msg) } else { - chatWindow->chatLog(chatMsg, BY_GM); + localChatTab->chatLog(chatMsg, BY_GM); } break; } case SMSG_WHO_ANSWER: - chatWindow->chatLog("Online users: " + toString(msg.readInt32()), + localChatTab->chatLog("Online users: " + toString(msg.readInt32()), BY_SERVER); break; case 0x010c: // Display MVP player msg.readInt32(); // id - chatWindow->chatLog("MVP player", BY_SERVER); + localChatTab->chatLog("MVP player", BY_SERVER); break; } } diff --git a/src/net/ea/equipmenthandler.cpp b/src/net/ea/equipmenthandler.cpp index f5377cf2..d1e51900 100644 --- a/src/net/ea/equipmenthandler.cpp +++ b/src/net/ea/equipmenthandler.cpp @@ -98,7 +98,7 @@ void EquipmentHandler::handleMessage(MessageIn &msg) logger->log("Equipping: %i %i %i", index, equipPoint, type); if (!type) { - chatWindow->chatLog(_("Unable to equip."), BY_SERVER); + localChatTab->chatLog(_("Unable to equip."), BY_SERVER); break; } @@ -136,7 +136,7 @@ void EquipmentHandler::handleMessage(MessageIn &msg) type = msg.readInt8(); if (!type) { - chatWindow->chatLog(_("Unable to unequip."), BY_SERVER); + localChatTab->chatLog(_("Unable to unequip."), BY_SERVER); break; } diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index addcb06f..ce2e22e7 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -156,14 +156,14 @@ void InventoryHandler::handleMessage(MessageIn &msg) if (msg.readInt8() > 0) { if (config.getValue("showpickupchat", true)) { - chatWindow->chatLog(_("Unable to pick up item"), BY_SERVER); + localChatTab->chatLog(_("Unable to pick up item"), BY_SERVER); } } else { const ItemInfo &itemInfo = ItemDB::get(itemId); const std::string amountStr = (amount > 1) ? toString(amount) : "a"; if (config.getValue("showpickupchat", true)) { - chatWindow->chatLog(strprintf(_("You picked up %s [%s]"), + localChatTab->chatLog(strprintf(_("You picked up %s [%s]"), amountStr.c_str(), itemInfo.getName().c_str()), BY_SERVER); } @@ -206,7 +206,7 @@ void InventoryHandler::handleMessage(MessageIn &msg) amount = msg.readInt16(); if (msg.readInt8() == 0) { - chatWindow->chatLog(_("Failed to use item"), BY_SERVER); + localChatTab->chatLog(_("Failed to use item"), BY_SERVER); } else { if (Item *item = inventory->getItem(index)) item->setQuantity(amount); diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index fcc44cb0..60f0de79 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -284,7 +284,7 @@ void PlayerHandler::handleMessage(MessageIn &msg) int curGp = player_node->getMoney(); player_node->setMoney(msg.readInt32()); if (player_node->getMoney() > curGp) - chatWindow->chatLog(_("You picked up ") + + localChatTab->chatLog(_("You picked up ") + Units::formatCurrency(player_node->getMoney() - curGp), BY_SERVER); } @@ -407,7 +407,7 @@ void PlayerHandler::handleMessage(MessageIn &msg) switch (type) { case 0: - chatWindow->chatLog(_("Equip arrows first"), + localChatTab->chatLog(_("Equip arrows first"), BY_SERVER); break; default: diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp index c3f4ffec..ac474adc 100644 --- a/src/net/ea/skillhandler.cpp +++ b/src/net/ea/skillhandler.cpp @@ -200,7 +200,7 @@ void SkillHandler::handleMessage(MessageIn &msg) } } - chatWindow->chatLog(msg); + localChatTab->chatLog(msg); break; } } diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp index 78472083..0a44d995 100644 --- a/src/net/ea/tradehandler.cpp +++ b/src/net/ea/tradehandler.cpp @@ -104,15 +104,15 @@ void TradeHandler::handleMessage(MessageIn &msg) switch (msg.readInt8()) { case 0: // Too far away - chatWindow->chatLog(_("Trading isn't possible. Trade partner is too far away."), + localChatTab->chatLog(_("Trading isn't possible. Trade partner is too far away."), BY_SERVER); break; case 1: // Character doesn't exist - chatWindow->chatLog(_("Trading isn't possible. Character doesn't exist."), + localChatTab->chatLog(_("Trading isn't possible. Character doesn't exist."), BY_SERVER); break; case 2: // Invite request check failed... - chatWindow->chatLog(_("Trade cancelled due to an unknown reason."), + localChatTab->chatLog(_("Trade cancelled due to an unknown reason."), BY_SERVER); break; case 3: // Trade accepted @@ -124,7 +124,7 @@ void TradeHandler::handleMessage(MessageIn &msg) case 4: // Trade cancelled if (player_relations.hasPermission(tradePartnerName, PlayerRelation::SPEECH_LOG)) - chatWindow->chatLog(_("Trade with ") + tradePartnerName + + localChatTab->chatLog(_("Trade with ") + tradePartnerName + _(" cancelled"), BY_SERVER); // otherwise ignore silently @@ -132,7 +132,7 @@ void TradeHandler::handleMessage(MessageIn &msg) player_node->setTrading(false); break; default: // Shouldn't happen as well, but to be sure - chatWindow->chatLog(_("Unhandled trade cancel packet"), + localChatTab->chatLog(_("Unhandled trade cancel packet"), BY_SERVER); break; } @@ -182,16 +182,16 @@ void TradeHandler::handleMessage(MessageIn &msg) break; case 1: // Add item failed - player overweighted - chatWindow->chatLog(_("Failed adding item. Trade partner is over weighted."), + localChatTab->chatLog(_("Failed adding item. Trade partner is over weighted."), BY_SERVER); break; case 2: // Add item failed - player has no free slot - chatWindow->chatLog(_("Failed adding item. Trade partner has no free slot."), + localChatTab->chatLog(_("Failed adding item. Trade partner has no free slot."), BY_SERVER); break; default: - chatWindow->chatLog(_("Failed adding item for unknown reason."), + localChatTab->chatLog(_("Failed adding item for unknown reason."), BY_SERVER); break; } @@ -204,14 +204,14 @@ void TradeHandler::handleMessage(MessageIn &msg) break; case SMSG_TRADE_CANCEL: - chatWindow->chatLog(_("Trade canceled."), BY_SERVER); + localChatTab->chatLog(_("Trade canceled."), BY_SERVER); tradeWindow->setVisible(false); tradeWindow->reset(); player_node->setTrading(false); break; case SMSG_TRADE_COMPLETE: - chatWindow->chatLog(_("Trade completed."), BY_SERVER); + localChatTab->chatLog(_("Trade completed."), BY_SERVER); tradeWindow->setVisible(false); tradeWindow->reset(); player_node->setTrading(false); |