diff options
Diffstat (limited to 'src/net/tmwserv')
-rw-r--r-- | src/net/tmwserv/chathandler.cpp | 13 | ||||
-rw-r--r-- | src/net/tmwserv/gameserver/player.cpp | 7 | ||||
-rw-r--r-- | src/net/tmwserv/gameserver/player.h | 1 | ||||
-rw-r--r-- | src/net/tmwserv/guildhandler.cpp | 25 | ||||
-rw-r--r-- | src/net/tmwserv/partyhandler.cpp | 8 | ||||
-rw-r--r-- | src/net/tmwserv/playerhandler.cpp | 12 | ||||
-rw-r--r-- | src/net/tmwserv/playerhandler.h | 6 | ||||
-rw-r--r-- | src/net/tmwserv/protocol.h | 8 | ||||
-rw-r--r-- | src/net/tmwserv/tradehandler.cpp | 19 |
9 files changed, 56 insertions, 43 deletions
diff --git a/src/net/tmwserv/chathandler.cpp b/src/net/tmwserv/chathandler.cpp index 41dc7bee..e2d09534 100644 --- a/src/net/tmwserv/chathandler.cpp +++ b/src/net/tmwserv/chathandler.cpp @@ -43,11 +43,12 @@ #include "gui/chat.h" #include "gui/guildwindow.h" +#include "utils/gettext.h" +#include "utils/stringutils.h" + #include <string> #include <iostream> -#include "utils/gettext.h" - extern Being *player_node; Net::ChatHandler *chatHandler; @@ -154,7 +155,7 @@ void ChatHandler::handleEnterChannelResponse(MessageIn &msg) Channel *channel = new Channel(channelId, channelName, announcement); channelManager->addChannel(channel); ChatTab *tab = channel->getTab(); - tab->chatLog(_("Topic: ") + announcement, BY_CHANNEL); + tab->chatLog(strprintf(_("Topic: %s"), announcement.c_str()), BY_CHANNEL); std::string user; std::string userModes; @@ -175,13 +176,13 @@ void ChatHandler::handleEnterChannelResponse(MessageIn &msg) } else { - localChatTab->chatLog("Error joining channel", BY_SERVER); + localChatTab->chatLog("Error joining channel.", BY_SERVER); } } void ChatHandler::handleListChannelsResponse(MessageIn &msg) { - localChatTab->chatLog("Listing Channels", BY_SERVER); + localChatTab->chatLog("Listing channels", BY_SERVER); while(msg.getUnreadLength()) { std::string channelName = msg.readString(); @@ -193,7 +194,7 @@ void ChatHandler::handleListChannelsResponse(MessageIn &msg) channelName += numUsers.str(); localChatTab->chatLog(channelName, BY_SERVER); } - localChatTab->chatLog("End of channel list", BY_SERVER); + localChatTab->chatLog("End of channel list.", BY_SERVER); } void ChatHandler::handlePrivateMessage(MessageIn &msg) diff --git a/src/net/tmwserv/gameserver/player.cpp b/src/net/tmwserv/gameserver/player.cpp index 3f05c954..93853681 100644 --- a/src/net/tmwserv/gameserver/player.cpp +++ b/src/net/tmwserv/gameserver/player.cpp @@ -58,13 +58,6 @@ void Net::GameServer::Player::moveItem(int oldSlot, int newSlot, int amount) Net::GameServer::connection->send(msg); } -void Net::GameServer::Player::attack(int direction) -{ - MessageOut msg(PGMSG_ATTACK); - msg.writeInt8(direction); - Net::GameServer::connection->send(msg); -} - void Net::GameServer::Player::useSpecial(int special) { MessageOut msg(PGMSG_USE_SPECIAL); diff --git a/src/net/tmwserv/gameserver/player.h b/src/net/tmwserv/gameserver/player.h index eddd9102..24b25dc7 100644 --- a/src/net/tmwserv/gameserver/player.h +++ b/src/net/tmwserv/gameserver/player.h @@ -43,7 +43,6 @@ namespace Net void walk(int x, int y); void pickUp(int x, int y); void moveItem(int oldSlot, int newSlot, int amount); - void attack(int direction); void useSpecial(int special); void requestTrade(int id); void acceptTrade(bool accept); diff --git a/src/net/tmwserv/guildhandler.cpp b/src/net/tmwserv/guildhandler.cpp index 92057e6e..8d078740 100644 --- a/src/net/tmwserv/guildhandler.cpp +++ b/src/net/tmwserv/guildhandler.cpp @@ -37,6 +37,9 @@ #include "channel.h" #include "channelmanager.h" +#include "utils/gettext.h" +#include "utils/stringutils.h" + #include <iostream> namespace TmwServ { @@ -68,12 +71,12 @@ void GuildHandler::handleMessage(MessageIn &msg) if(msg.readInt8() == ERRMSG_OK) { // TODO - Acknowledge guild was created - localChatTab->chatLog("Guild created."); + localChatTab->chatLog(_("Guild created.")); joinedGuild(msg); } else { - localChatTab->chatLog("Error creating guild."); + localChatTab->chatLog(_("Error creating guild.")); } } break; @@ -83,7 +86,7 @@ void GuildHandler::handleMessage(MessageIn &msg) if(msg.readInt8() == ERRMSG_OK) { // TODO - Acknowledge invite was sent - localChatTab->chatLog("Invite sent."); + localChatTab->chatLog(_("Invite sent.")); } } break; @@ -144,7 +147,8 @@ void GuildHandler::handleMessage(MessageIn &msg) { case GUILD_EVENT_NEW_PLAYER: guild->addMember(guildMember); - guildWindow->setOnline(guild->getName(), guildMember, true); + guildWindow->setOnline(guild->getName(), guildMember, + true); break; case GUILD_EVENT_LEAVING_PLAYER: @@ -152,11 +156,13 @@ void GuildHandler::handleMessage(MessageIn &msg) break; case GUILD_EVENT_ONLINE_PLAYER: - guildWindow->setOnline(guild->getName(), guildMember, true); + guildWindow->setOnline(guild->getName(), guildMember, + true); break; case GUILD_EVENT_OFFLINE_PLAYER: - guildWindow->setOnline(guild->getName(), guildMember, false); + guildWindow->setOnline(guild->getName(), guildMember, + false); break; default: @@ -185,12 +191,12 @@ void GuildHandler::handleMessage(MessageIn &msg) if (msg.readInt8() == ERRMSG_OK) { // promotion succeeded - localChatTab->chatLog("Member was promoted successfully"); + localChatTab->chatLog(_("Member was promoted successfully.")); } else { // promotion failed - localChatTab->chatLog("Failed to promote member"); + localChatTab->chatLog(_("Failed to promote member.")); } } @@ -241,7 +247,8 @@ void GuildHandler::joinedGuild(MessageIn &msg) // COMMENT: Should this go here?? Channel *channel = new Channel(channelId, guildName, announcement); channelManager->addChannel(channel); - channel->getTab()->chatLog("Topic: " + announcement, BY_CHANNEL); + channel->getTab()->chatLog(strprintf(_("Topic: %s"), announcement.c_str()), + BY_CHANNEL); } } // namespace TmwServ diff --git a/src/net/tmwserv/partyhandler.cpp b/src/net/tmwserv/partyhandler.cpp index 47ef791c..557a3a43 100644 --- a/src/net/tmwserv/partyhandler.cpp +++ b/src/net/tmwserv/partyhandler.cpp @@ -35,6 +35,9 @@ #include "log.h" #include "localplayer.h" +#include "utils/gettext.h" +#include "utils/stringutils.h" + #include <iostream> Net::PartyHandler *partyHandler; @@ -80,7 +83,7 @@ void PartyHandler::handleMessage(MessageIn &msg) if (msg.readInt8() == ERRMSG_OK) { player_node->setInParty(true); - localChatTab->chatLog("Joined party"); + localChatTab->chatLog(_("Joined party.")); } } @@ -97,7 +100,8 @@ void PartyHandler::handleMessage(MessageIn &msg) int id = msg.readInt16(); // being id std::string name = msg.readString(); - localChatTab->chatLog(name + " joined the party"); + localChatTab->chatLog(strprintf(_("%s joined the " + "party."), name.c_str())); if (!player_node->isInParty()) player_node->setInParty(true); diff --git a/src/net/tmwserv/playerhandler.cpp b/src/net/tmwserv/playerhandler.cpp index b697e8a8..e2b922f8 100644 --- a/src/net/tmwserv/playerhandler.cpp +++ b/src/net/tmwserv/playerhandler.cpp @@ -284,7 +284,7 @@ void PlayerHandler::handleMessage(MessageIn &msg) switch (type) { case 0: - localChatTab->chatLog("Equip arrows first", + localChatTab->chatLog(_("Equip arrows first."), BY_SERVER); break; default: @@ -332,9 +332,11 @@ void PlayerHandler::handleMapChangeMessage(MessageIn &msg) viewport->scrollBy(scrollOffsetX, scrollOffsetY); } -void PlayerHandler::attack(Being *being) +void PlayerHandler::attack(int id) { - // TODO + MessageOut msg(PGMSG_ATTACK); + msg.writeInt16(id); + Net::GameServer::connection->send(msg); } void PlayerHandler::emote(int emoteId) @@ -391,12 +393,12 @@ void PlayerHandler::respawn() // TODO } -void PlayerHandler::ingorePlayer(const std::string &player, bool ignore) +void PlayerHandler::ignorePlayer(const std::string &player, bool ignore) { // TODO } -void PlayerHandler::ingoreAll(bool ignore) +void PlayerHandler::ignoreAll(bool ignore) { // TODO } diff --git a/src/net/tmwserv/playerhandler.h b/src/net/tmwserv/playerhandler.h index 5524415e..164d30ae 100644 --- a/src/net/tmwserv/playerhandler.h +++ b/src/net/tmwserv/playerhandler.h @@ -34,7 +34,7 @@ class PlayerHandler : public MessageHandler, public Net::PlayerHandler void handleMessage(MessageIn &msg); - void attack(Being *being); + void attack(int id); void emote(int emoteId); @@ -52,9 +52,9 @@ class PlayerHandler : public MessageHandler, public Net::PlayerHandler void respawn(); - void ingorePlayer(const std::string &player, bool ignore); + void ignorePlayer(const std::string &player, bool ignore); - void ingoreAll(bool ignore); + void ignoreAll(bool ignore); private: void handleMapChangeMessage(MessageIn &msg); diff --git a/src/net/tmwserv/protocol.h b/src/net/tmwserv/protocol.h index 7fa3b372..6124263a 100644 --- a/src/net/tmwserv/protocol.h +++ b/src/net/tmwserv/protocol.h @@ -106,7 +106,7 @@ enum { GPMSG_BEING_DIR_CHANGE = 0x0273, // W being id, B direction GPMSG_BEINGS_MOVE = 0x0280, // { W being id, B flags [, C position, B speed] [, W*2 destination] }* GPMSG_ITEMS = 0x0281, // { W item id, W*2 position }* - PGMSG_ATTACK = 0x0290, // B direction + PGMSG_ATTACK = 0x0290, // W being id PGMSG_USE_SPECIAL = 0x0292, // B specialID GPMSG_BEING_ATTACK = 0x0291, // W being id PGMSG_SAY = 0x02A0, // S text @@ -162,9 +162,11 @@ enum { CPMSG_GUILD_QUIT_RESPONSE = 0x0361, // B error PCMSG_GUILD_PROMOTE_MEMBER = 0x0365, // W guild, S name, B rights CPMSG_GUILD_PROMOTE_MEMBER_RESPONSE = 0x0366, // B error + PCMSG_GUILD_KICK_MEMBER = 0x0370, // W guild, S name + CPMSG_GUILD_KICK_MEMBER_RESPONSE = 0x0371, // B error - CPMSG_GUILD_INVITED = 0x0370, // S char name, S guild name, W id - CPMSG_GUILD_REJOIN = 0x0371, // S name, W guild, W rights, W channel, S announce + CPMSG_GUILD_INVITED = 0x0388, // S char name, S guild name, W id + CPMSG_GUILD_REJOIN = 0x0389, // S name, W guild, W rights, W channel, S announce // Party PCMSG_PARTY_INVITE = 0x03A0, // S name diff --git a/src/net/tmwserv/tradehandler.cpp b/src/net/tmwserv/tradehandler.cpp index 74789a34..aabd8b2a 100644 --- a/src/net/tmwserv/tradehandler.cpp +++ b/src/net/tmwserv/tradehandler.cpp @@ -40,6 +40,9 @@ #include "gui/widgets/chattab.h" +#include "utils/gettext.h" +#include "utils/stringutils.h" + std::string tradePartnerName; int tradePartnerID; @@ -87,9 +90,9 @@ void TradeHandler::setAcceptTradeRequests(bool acceptTradeRequests) { mAcceptTradeRequests = acceptTradeRequests; if (mAcceptTradeRequests) { - localChatTab->chatLog("Accepting incoming trade requests", BY_SERVER); + localChatTab->chatLog(_("Accepting incoming trade requests."), BY_SERVER); } else { - localChatTab->chatLog("Ignoring incoming trade requests", BY_SERVER); + localChatTab->chatLog(_("Ignoring incoming trade requests."), BY_SERVER); } } @@ -108,8 +111,9 @@ void TradeHandler::handleMessage(MessageIn &msg) player_node->setTrading(true); tradePartnerName = being->getName(); tradePartnerID = being->getId(); - ConfirmDialog *dlg = new ConfirmDialog("Request for trade", - tradePartnerName + " wants to trade with you, do you accept?"); + ConfirmDialog *dlg = new ConfirmDialog(_("Request for Trade"), + strprintf(_("%s wants to trade with you, do you accept?"), + tradePartnerName.c_str())); dlg->addActionListener(&listener); } break; @@ -126,7 +130,8 @@ void TradeHandler::handleMessage(MessageIn &msg) case GPMSG_TRADE_START: tradeWindow->reset(); - tradeWindow->setCaption("Trading with " + tradePartnerName); + tradeWindow->setCaption(strprintf(_("Trading with %s"), + tradePartnerName.c_str())); tradeWindow->setVisible(true); break; @@ -139,14 +144,14 @@ void TradeHandler::handleMessage(MessageIn &msg) break; case GPMSG_TRADE_CANCEL: - localChatTab->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: - localChatTab->chatLog("Trade completed.", BY_SERVER); + localChatTab->chatLog(_("Trade completed."), BY_SERVER); tradeWindow->setVisible(false); tradeWindow->reset(); player_node->setTrading(false); |