diff options
Diffstat (limited to 'src/net/tmwa')
-rw-r--r-- | src/net/tmwa/buysellhandler.cpp | 1 | ||||
-rw-r--r-- | src/net/tmwa/generalhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/loginhandler.cpp | 9 | ||||
-rw-r--r-- | src/net/tmwa/playerhandler.cpp | 39 | ||||
-rw-r--r-- | src/net/tmwa/specialhandler.cpp | 3 |
5 files changed, 40 insertions, 14 deletions
diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp index 5368ba9d..8daebdec 100644 --- a/src/net/tmwa/buysellhandler.cpp +++ b/src/net/tmwa/buysellhandler.cpp @@ -129,7 +129,6 @@ void BuySellHandler::handleMessage(Net::MessageIn &msg) SERVER_NOTICE(_("Thanks for selling.")) else SERVER_NOTICE(_("Unable to sell.")) - break; } } diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index ef59ee12..b03fb3b8 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -225,7 +225,7 @@ void GeneralHandler::event(Event::Channel channel, if (event.getType() == Event::GuiWindowsLoaded) { inventoryWindow->setSplitAllowed(false); - skillDialog->loadSkills("ea-skills.xml"); + skillDialog->loadSkills(); statusWindow->addAttribute(STR, _("Strength"), true, ""); statusWindow->addAttribute(AGI, _("Agility"), true, ""); diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index 00b7b145..e03ff042 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -168,6 +168,9 @@ void LoginHandler::handleMessage(Net::MessageIn &msg) errorMessage = _("You have been permanently banned from " "the game. Please contact the GM team."); break; + case 5: + errorMessage = _("Client too old."); + break; case 6: errorMessage = strprintf(_("You have been temporarily " "banned from the game until " @@ -175,9 +178,15 @@ void LoginHandler::handleMessage(Net::MessageIn &msg) "team via the forums."), msg.readString(20).c_str()); break; + case 7: + errorMessage = _("Server overpopulated."); + break; case 9: errorMessage = _("This user name is already taken."); break; + case 99: + errorMessage = _("Username permanently erased."); + break; default: errorMessage = _("Unknown error."); break; diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 4bd637c3..ab63cc1d 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -22,8 +22,7 @@ #include "net/tmwa/playerhandler.h" #include "net/tmwa/beinghandler.h" -#include "client.h" -#include "event.h" +#include "configuration.h" #include "game.h" #include "localplayer.h" #include "log.h" @@ -227,6 +226,8 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) case SMSG_PLAYER_STAT_UPDATE_1: { + if (!player_node) + break; int type = msg.readInt16(); int value = msg.readInt32(); @@ -312,14 +313,24 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) PlayerInfo::setStatExperience(JOB, msg.readInt32(), PlayerInfo::getStatExperience(JOB).second); break; - case 0x0014: { + + case 0x0014: + { int oldMoney = PlayerInfo::getAttribute(MONEY); int newMoney = msg.readInt32(); + std::string money = Units::formatCurrency( + newMoney - oldMoney); PlayerInfo::setAttribute(MONEY, newMoney); if (newMoney > oldMoney) - SERVER_NOTICE(strprintf(_("You picked up %s."), - Units::formatCurrency(newMoney - - oldMoney).c_str())) + { + if (config.getBoolValue("showpickupchat")) + SERVER_NOTICE(strprintf(_("You picked up %s."), + Units::formatCurrency(newMoney - + oldMoney).c_str())) + if (config.getBoolValue("showpickupparticle")) + player_node->addMessageToQueue(money, + UserPalette::PICKUP_INFO); + } } break; case 0x0016: @@ -543,11 +554,17 @@ void PlayerHandler::increaseSkill(int skillId) void PlayerHandler::pickUp(FloorItem *floorItem) { - if (floorItem) - { - MessageOut outMsg(CMSG_ITEM_PICKUP); - outMsg.writeInt32(floorItem->getId()); - } + static Uint32 lastTime = 0; + + // Avoid spamming the server with pick-up requests to prevent the player + // from being kicked. + if (!floorItem || SDL_GetTicks() < lastTime + 100) + return; + + MessageOut outMsg(CMSG_ITEM_PICKUP); + outMsg.writeInt32(floorItem->getId()); + + lastTime = SDL_GetTicks(); } void PlayerHandler::setDirection(char direction) diff --git a/src/net/tmwa/specialhandler.cpp b/src/net/tmwa/specialhandler.cpp index 577bda7e..661d9e2c 100644 --- a/src/net/tmwa/specialhandler.cpp +++ b/src/net/tmwa/specialhandler.cpp @@ -105,7 +105,8 @@ void SpecialHandler::handleMessage(Net::MessageIn &msg) int up = msg.readInt8(); PlayerInfo::setStatBase(skillId, level); - skillDialog->setModifiable(skillId, up); + if (skillDialog) + skillDialog->setModifiable(skillId, up); } break; |