summaryrefslogtreecommitdiff
path: root/src/net/ea
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/ea')
-rw-r--r--src/net/ea/playerhandler.cpp120
-rw-r--r--src/net/ea/playerhandler.h4
-rw-r--r--src/net/ea/specialhandler.cpp6
3 files changed, 48 insertions, 82 deletions
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index f46a2241b..81bc373f3 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -360,60 +360,48 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg)
break;
case 0x0029:
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(
- EA_ATK), value);
+ PlayerInfo::setStatBase(EA_ATK, value);
PlayerInfo::updateAttrs();
break;
case 0x002a:
- PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>(
- EA_ATK), value);
+ PlayerInfo::setStatMod(EA_ATK, value);
PlayerInfo::updateAttrs();
break;
case 0x002b:
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(
- EA_MATK), value);
+ PlayerInfo::setStatBase(EA_MATK, value);
break;
case 0x002c:
- PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>(
- EA_MATK), value);
+ PlayerInfo::setStatMod(EA_MATK, value);
break;
case 0x002d:
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(
- EA_DEF), value);
+ PlayerInfo::setStatBase(EA_DEF, value);
break;
case 0x002e:
- PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>(
- EA_DEF), value);
+ PlayerInfo::setStatMod(EA_DEF, value);
break;
case 0x002f:
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(
- EA_MDEF), value);
+ PlayerInfo::setStatBase(EA_MDEF, value);
break;
case 0x0030:
- PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>(
- EA_MDEF), value);
+ PlayerInfo::setStatMod(EA_MDEF, value);
break;
case 0x0031:
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(
- EA_HIT), value);
+ PlayerInfo::setStatBase(EA_HIT, value);
break;
case 0x0032:
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(
- EA_FLEE), value);
+ PlayerInfo::setStatBase(EA_FLEE, value);
break;
case 0x0033:
- PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>(
- EA_FLEE), value);
+ PlayerInfo::setStatMod(EA_FLEE, value);
break;
case 0x0034:
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(
- EA_CRIT), value);
+ PlayerInfo::setStatBase(EA_CRIT, value);
break;
case 0x0035:
@@ -424,8 +412,7 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg)
break;
case 0x0037:
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(
- EA_JOB), value);
+ PlayerInfo::setStatBase(EA_JOB, value);
break;
case 500:
@@ -460,10 +447,8 @@ void PlayerHandler::processPlayerStatUpdate2(Net::MessageIn &msg)
PlayerInfo::setAttribute(PlayerInfo::EXP, msg.readInt32());
break;
case 0x0002:
- PlayerInfo::setStatExperience(static_cast<PlayerInfo::Attribute>(
- EA_JOB), msg.readInt32(),
- PlayerInfo::getStatExperience(static_cast<PlayerInfo::Attribute>(
- EA_JOB)).second);
+ PlayerInfo::setStatExperience(EA_JOB, msg.readInt32(),
+ PlayerInfo::getStatExperience(EA_JOB).second);
break;
case 0x0014:
{
@@ -487,10 +472,8 @@ void PlayerHandler::processPlayerStatUpdate2(Net::MessageIn &msg)
PlayerInfo::setAttribute(PlayerInfo::EXP_NEEDED, msg.readInt32());
break;
case 0x0017:
- PlayerInfo::setStatExperience(static_cast<PlayerInfo::Attribute>(
- EA_JOB), PlayerInfo::getStatExperience(
- static_cast<PlayerInfo::Attribute>(EA_JOB)).first,
- msg.readInt32());
+ PlayerInfo::setStatExperience(EA_JOB, PlayerInfo::getStatExperience(
+ EA_JOB).first, msg.readInt32());
break;
default:
logger->log("QQQQ PLAYER_STAT_UPDATE_2 " + toString(type));
@@ -504,10 +487,8 @@ void PlayerHandler::processPlayerStatUpdate3(Net::MessageIn &msg)
const int base = msg.readInt32();
const int bonus = msg.readInt32();
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(
- type), base, false);
- PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>(
- type), bonus);
+ PlayerInfo::setStatBase(type, base, false);
+ PlayerInfo::setStatMod(type, bonus);
if (type == EA_ATK || type == PlayerInfo::ATTACK_DELAY)
PlayerInfo::updateAttrs();
}
@@ -520,15 +501,14 @@ void PlayerHandler::processPlayerStatUpdate4(Net::MessageIn &msg)
if (ok != 1)
{
- const int oldValue = PlayerInfo::getStatBase(
- static_cast<PlayerInfo::Attribute>(type));
+ const int oldValue = PlayerInfo::getStatBase(type);
int points = PlayerInfo::getAttribute(PlayerInfo::CHAR_POINTS);
points += oldValue - value;
PlayerInfo::setAttribute(PlayerInfo::CHAR_POINTS, points);
SERVER_NOTICE(_("Cannot raise skill!"))
}
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(type), value);
+ PlayerInfo::setStatBase(type, value);
}
void PlayerHandler::processPlayerStatUpdate5(Net::MessageIn &msg)
@@ -536,80 +516,69 @@ void PlayerHandler::processPlayerStatUpdate5(Net::MessageIn &msg)
PlayerInfo::setAttribute(PlayerInfo::CHAR_POINTS, msg.readInt16());
int val = msg.readInt8();
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_STR), val);
+ PlayerInfo::setStatBase(EA_STR, val);
if (statusWindow)
statusWindow->setPointsNeeded(EA_STR, msg.readInt8());
else
msg.readInt8();
val = msg.readInt8();
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_AGI), val);
+ PlayerInfo::setStatBase(EA_AGI, val);
if (statusWindow)
statusWindow->setPointsNeeded(EA_AGI, msg.readInt8());
else
msg.readInt8();
val = msg.readInt8();
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_VIT), val);
+ PlayerInfo::setStatBase(EA_VIT, val);
if (statusWindow)
statusWindow->setPointsNeeded(EA_VIT, msg.readInt8());
else
msg.readInt8();
val = msg.readInt8();
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_INT), val);
+ PlayerInfo::setStatBase(EA_INT, val);
if (statusWindow)
statusWindow->setPointsNeeded(EA_INT, msg.readInt8());
else
msg.readInt8();
val = msg.readInt8();
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_DEX), val);
+ PlayerInfo::setStatBase(EA_DEX, val);
if (statusWindow)
statusWindow->setPointsNeeded(EA_DEX, msg.readInt8());
else
msg.readInt8();
val = msg.readInt8();
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_LUK), val);
+ PlayerInfo::setStatBase(EA_LUK, val);
if (statusWindow)
statusWindow->setPointsNeeded(EA_LUK, msg.readInt8());
else
msg.readInt8();
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_ATK),
- msg.readInt16(), false);
- PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>(EA_ATK),
- msg.readInt16());
+ PlayerInfo::setStatBase(EA_ATK, msg.readInt16(), false);
+ PlayerInfo::setStatMod(EA_ATK, msg.readInt16());
PlayerInfo::updateAttrs();
val = msg.readInt16();
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_MATK),
- val, false);
+ PlayerInfo::setStatBase(EA_MATK, val, false);
val = msg.readInt16();
- PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>(EA_MATK), val);
+ PlayerInfo::setStatMod(EA_MATK, val);
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_DEF),
- msg.readInt16(), false);
- PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>(EA_DEF),
- msg.readInt16());
+ PlayerInfo::setStatBase(EA_DEF, msg.readInt16(), false);
+ PlayerInfo::setStatMod(EA_DEF, msg.readInt16());
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_MDEF),
- msg.readInt16(), false);
- PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>(EA_MDEF),
- msg.readInt16());
+ PlayerInfo::setStatBase(EA_MDEF, msg.readInt16(), false);
+ PlayerInfo::setStatMod(EA_MDEF, msg.readInt16());
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_HIT),
- msg.readInt16());
+ PlayerInfo::setStatBase(EA_HIT, msg.readInt16());
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_FLEE),
- msg.readInt16(), false);
- PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>(EA_FLEE),
- msg.readInt16());
+ PlayerInfo::setStatBase(EA_FLEE, msg.readInt16(), false);
+ PlayerInfo::setStatMod(EA_FLEE, msg.readInt16());
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_CRIT),
- msg.readInt16());
+ PlayerInfo::setStatBase(EA_CRIT, msg.readInt16());
msg.readInt16(); // manner
}
@@ -667,18 +636,17 @@ void PlayerHandler::processPlayerArrowMessage(Net::MessageIn &msg)
bool PlayerHandler::canUseMagic() const
{
- return PlayerInfo::getStatEffective(static_cast<PlayerInfo::Attribute>(
- EA_MATK)) > 0;
+ return PlayerInfo::getStatEffective(EA_MATK) > 0;
}
-PlayerInfo::Attribute PlayerHandler::getJobLocation() const
+int PlayerHandler::getJobLocation() const
{
- return static_cast<PlayerInfo::Attribute>(EA_JOB);
+ return EA_JOB;
}
-PlayerInfo::Attribute PlayerHandler::getAttackLocation() const
+int PlayerHandler::getAttackLocation() const
{
- return static_cast<PlayerInfo::Attribute>(EA_ATK);
+ return EA_ATK;
}
} // namespace Ea
diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h
index 6df4cc237..016b29782 100644
--- a/src/net/ea/playerhandler.h
+++ b/src/net/ea/playerhandler.h
@@ -49,9 +49,9 @@ class PlayerHandler : public Net::PlayerHandler
Vector getDefaultWalkSpeed() const A_WARN_UNUSED;
- PlayerInfo::Attribute getJobLocation() const A_WARN_UNUSED;
+ int getJobLocation() const A_WARN_UNUSED;
- PlayerInfo::Attribute getAttackLocation() const A_WARN_UNUSED;
+ int getAttackLocation() const A_WARN_UNUSED;
void processWalkResponse(Net::MessageIn &msg);
diff --git a/src/net/ea/specialhandler.cpp b/src/net/ea/specialhandler.cpp
index ba805e261..6f9b346a3 100644
--- a/src/net/ea/specialhandler.cpp
+++ b/src/net/ea/specialhandler.cpp
@@ -93,8 +93,7 @@ void SpecialHandler::processPlayerSkills(Net::MessageIn &msg)
msg.skip(24); // 0 unused
const int up = msg.readInt8();
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(
- skillId), level);
+ PlayerInfo::setStatBase(skillId, level);
if (skillDialog)
{
if (!skillDialog->updateSkill(skillId, range, up))
@@ -111,8 +110,7 @@ void SpecialHandler::processPlayerSkillUp(Net::MessageIn &msg)
const int range = msg.readInt16();
const int up = msg.readInt8();
- PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(
- skillId), level);
+ PlayerInfo::setStatBase(skillId, level);
if (skillDialog)
{
if (!skillDialog->updateSkill(skillId, range, up))