summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-04-30 16:57:31 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-04-30 16:57:31 +0200
commit908dceb882723460cde35ec8ef22927b702ab874 (patch)
tree0598a9cb5d720c66c619fd350d64453490b35143 /src/net/tmwa
parent8a67e721880959b431d220e2d1fd5b60a4f11ad7 (diff)
parent0b1c6eb3c4941dc2d47ad3207bab4509ae1014cc (diff)
downloadmana-client-908dceb882723460cde35ec8ef22927b702ab874.tar.gz
mana-client-908dceb882723460cde35ec8ef22927b702ab874.tar.bz2
mana-client-908dceb882723460cde35ec8ef22927b702ab874.tar.xz
mana-client-908dceb882723460cde35ec8ef22927b702ab874.zip
Merge branch '0.5'
Conflicts: CMakeLists.txt po/fi.po po/fr.po src/gui/skilldialog.cpp src/localplayer.cpp src/net/manaserv/generalhandler.cpp src/net/tmwa/buysellhandler.cpp src/net/tmwa/generalhandler.cpp src/net/tmwa/playerhandler.cpp src/net/tmwa/specialhandler.cpp src/winver.h
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/buysellhandler.cpp1
-rw-r--r--src/net/tmwa/generalhandler.cpp2
-rw-r--r--src/net/tmwa/loginhandler.cpp9
-rw-r--r--src/net/tmwa/playerhandler.cpp39
-rw-r--r--src/net/tmwa/specialhandler.cpp3
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;