diff options
Diffstat (limited to 'src/net')
-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 | ||||
-rw-r--r-- | src/net/tmwserv/chathandler.cpp | 44 | ||||
-rw-r--r-- | src/net/tmwserv/guildhandler.cpp | 15 | ||||
-rw-r--r-- | src/net/tmwserv/partyhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/tmwserv/playerhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwserv/tradehandler.cpp | 8 |
12 files changed, 69 insertions, 68 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); diff --git a/src/net/tmwserv/chathandler.cpp b/src/net/tmwserv/chathandler.cpp index 65fd062c..2d151472 100644 --- a/src/net/tmwserv/chathandler.cpp +++ b/src/net/tmwserv/chathandler.cpp @@ -38,6 +38,8 @@ #include "../../gui/chat.h" #include "../../gui/guildwindow.h" +#include "utils/gettext.h" + extern Being *player_node; ChatHandler::ChatHandler() @@ -105,22 +107,22 @@ void ChatHandler::handleGameChatMessage(MessageIn &msg) if (id == 0) { - chatWindow->chatLog(chatMsg, BY_SERVER); + localChatTab->chatLog(chatMsg, BY_SERVER); return; } Being *being = beingManager->findBeing(id); + std::string mes; if (being) { - chatWindow->chatLog(being->getName() + " : " + chatMsg, - being == player_node ? BY_PLAYER : BY_OTHER, "General"); + mes = being->getName() + " : " + chatMsg; being->setSpeech(chatMsg, SPEECH_TIME); } else - { - chatWindow->chatLog("Unknown : " + chatMsg, BY_OTHER, "General"); - } + mes = "Unknown : " + chatMsg; + + localChatTab->chatLog(mes, being == player_node ? BY_PLAYER : BY_OTHER); } void ChatHandler::handleEnterChannelResponse(MessageIn &msg) @@ -132,12 +134,12 @@ void ChatHandler::handleEnterChannelResponse(MessageIn &msg) std::string announcement = msg.readString(); Channel *channel = new Channel(channelId, channelName, announcement); channelManager->addChannel(channel); - chatWindow->addTab(new ChannelTab(channel)); - chatWindow->chatLog("Topic: " + announcement, BY_CHANNEL, channelName); + ChatTab *tab = channel->getTab(); + tab->chatLog(_("Topic: ") + announcement, BY_CHANNEL); std::string user; std::string userModes; - chatWindow->chatLog("Players in this channel:", BY_CHANNEL, channelName); + tab->chatLog("Players in this channel:", BY_CHANNEL); while(msg.getUnreadLength()) { user = msg.readString(); @@ -148,19 +150,19 @@ void ChatHandler::handleEnterChannelResponse(MessageIn &msg) { user = "@" + user; } - chatWindow->chatLog(user, BY_CHANNEL, channelName); + tab->chatLog(user, BY_CHANNEL); } } else { - chatWindow->chatLog("Error joining channel", BY_SERVER); + localChatTab->chatLog("Error joining channel", BY_SERVER); } } void ChatHandler::handleListChannelsResponse(MessageIn &msg) { - chatWindow->chatLog("Listing Channels", BY_SERVER); + localChatTab->chatLog("Listing Channels", BY_SERVER); while(msg.getUnreadLength()) { std::string channelName = msg.readString(); @@ -170,9 +172,9 @@ void ChatHandler::handleListChannelsResponse(MessageIn &msg) numUsers << msg.readInt16(); channelName += " - "; channelName += numUsers.str(); - chatWindow->chatLog(channelName, BY_SERVER); + localChatTab->chatLog(channelName, BY_SERVER); } - chatWindow->chatLog("End of channel list", BY_SERVER); + localChatTab->chatLog("End of channel list", BY_SERVER); } void ChatHandler::handlePrivateMessage(MessageIn &msg) @@ -186,7 +188,7 @@ void ChatHandler::handlePrivateMessage(MessageIn &msg) void ChatHandler::handleAnnouncement(MessageIn &msg) { std::string chatMsg = msg.readString(); - chatWindow->chatLog(chatMsg, BY_GM); + localChatTab->chatLog(chatMsg, BY_GM); } void ChatHandler::handleChatMessage(MessageIn &msg) @@ -205,17 +207,17 @@ void ChatHandler::handleQuitChannelResponse(MessageIn &msg) { short channelId = msg.readInt16(); Channel *channel = channelManager->findById(channelId); - // remove the chat tab - chatWindow->removeTab(channel->getTab()); + channelManager->removeChannel(channel); } } void ChatHandler::handleListChannelUsersResponse(MessageIn &msg) { - std::string channel = msg.readString(); + std::string channelName = msg.readString(); std::string userNick; std::string userModes; - chatWindow->chatLog("Players in this channel:", BY_CHANNEL, channel); + Channel *channel = channelManager->findByName(channelName); + channel->getTab()->chatLog("Players in this channel:", BY_CHANNEL); while(msg.getUnreadLength()) { userNick = msg.readString(); @@ -228,7 +230,7 @@ void ChatHandler::handleListChannelUsersResponse(MessageIn &msg) { userNick = "@" + userNick; } - chatWindow->chatLog(userNick, BY_CHANNEL, channel); + localChatTab->chatLog(userNick, BY_CHANNEL, channel); } } @@ -277,7 +279,7 @@ void ChatHandler::handleChannelEvent(MessageIn &msg) line = "Unknown channel event."; } - chatWindow->chatLog(line, BY_CHANNEL, channel->getName()); + channel->getTab()->chatLog(line, BY_CHANNEL); } } diff --git a/src/net/tmwserv/guildhandler.cpp b/src/net/tmwserv/guildhandler.cpp index 5927f175..2127b730 100644 --- a/src/net/tmwserv/guildhandler.cpp +++ b/src/net/tmwserv/guildhandler.cpp @@ -64,12 +64,12 @@ void GuildHandler::handleMessage(MessageIn &msg) if(msg.readInt8() == ERRMSG_OK) { // TODO - Acknowledge guild was created - chatWindow->chatLog("Guild created."); + localChatTab->chatLog("Guild created."); joinedGuild(msg); } else { - chatWindow->chatLog("Error creating guild."); + localChatTab->chatLog("Error creating guild."); } } break; @@ -79,7 +79,7 @@ void GuildHandler::handleMessage(MessageIn &msg) if(msg.readInt8() == ERRMSG_OK) { // TODO - Acknowledge invite was sent - chatWindow->chatLog("Invite sent."); + localChatTab->chatLog("Invite sent."); } } break; @@ -181,12 +181,12 @@ void GuildHandler::handleMessage(MessageIn &msg) if (msg.readInt8() == ERRMSG_OK) { // promotion succeeded - chatWindow->chatLog("Member was promoted successfully"); + localChatTab->chatLog("Member was promoted successfully"); } else { // promotion failed - chatWindow->chatLog("Failed to promote member"); + localChatTab->chatLog("Failed to promote member"); } } @@ -210,7 +210,7 @@ void GuildHandler::handleMessage(MessageIn &msg) if (guild) { Channel *channel = channelManager->findByName(guild->getName()); - chatWindow->removeTab(channel->getTab()); + channelManager->removeChannel(channel); guildWindow->removeTab(guildId); player_node->removeGuild(guildId); } @@ -237,6 +237,5 @@ void GuildHandler::joinedGuild(MessageIn &msg) // COMMENT: Should this go here?? Channel *channel = new Channel(channelId, guildName, announcement); channelManager->addChannel(channel); - chatWindow->addTab(new ChannelTab(channel)); - chatWindow->chatLog("Topic: " + announcement, BY_CHANNEL, guildName); + channel->getTab()->chatLog("Topic: " + announcement, BY_CHANNEL); } diff --git a/src/net/tmwserv/partyhandler.cpp b/src/net/tmwserv/partyhandler.cpp index aa5ef0b8..880674d3 100644 --- a/src/net/tmwserv/partyhandler.cpp +++ b/src/net/tmwserv/partyhandler.cpp @@ -70,7 +70,7 @@ void PartyHandler::handleMessage(MessageIn &msg) if (msg.readInt8() == ERRMSG_OK) { player_node->setInParty(true); - chatWindow->chatLog("Joined party"); + localChatTab->chatLog("Joined party"); } } @@ -87,7 +87,7 @@ void PartyHandler::handleMessage(MessageIn &msg) msg.readInt16(); // being id std::string name = msg.readString(); - chatWindow->chatLog(name + " joined the party"); + localChatTab->chatLog(name + " joined the party"); if (!player_node->getInParty()) player_node->setInParty(true); diff --git a/src/net/tmwserv/playerhandler.cpp b/src/net/tmwserv/playerhandler.cpp index f5fbe784..e8efef52 100644 --- a/src/net/tmwserv/playerhandler.cpp +++ b/src/net/tmwserv/playerhandler.cpp @@ -280,7 +280,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/tmwserv/tradehandler.cpp b/src/net/tmwserv/tradehandler.cpp index bfbdbdef..525d46f0 100644 --- a/src/net/tmwserv/tradehandler.cpp +++ b/src/net/tmwserv/tradehandler.cpp @@ -73,9 +73,9 @@ void TradeHandler::setAcceptTradeRequests(bool acceptTradeRequests) { mAcceptTradeRequests = acceptTradeRequests; if (mAcceptTradeRequests) { - chatWindow->chatLog("Accepting incoming trade requests", BY_SERVER); + localChatTab->chatLog("Accepting incoming trade requests", BY_SERVER); } else { - chatWindow->chatLog("Ignoring incoming trade requests", BY_SERVER); + localChatTab->chatLog("Ignoring incoming trade requests", BY_SERVER); } } @@ -121,14 +121,14 @@ void TradeHandler::handleMessage(MessageIn &msg) break; case GPMSG_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 GPMSG_TRADE_COMPLETE: - chatWindow->chatLog("Trade completed.", BY_SERVER); + localChatTab->chatLog("Trade completed.", BY_SERVER); tradeWindow->setVisible(false); tradeWindow->reset(); player_node->setTrading(false); |