summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-01 19:19:15 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-01 19:28:09 +0300
commita88beff0cb22094bd5d4558fcc6937f94480c150 (patch)
treeb1b649c2caaa12afe3ad255020548b8f2edbb56a
parent624ddd306ebbd1cfdfd5bf85832ee969e15a619c (diff)
downloadplus-a88beff0cb22094bd5d4558fcc6937f94480c150.tar.gz
plus-a88beff0cb22094bd5d4558fcc6937f94480c150.tar.bz2
plus-a88beff0cb22094bd5d4558fcc6937f94480c150.tar.xz
plus-a88beff0cb22094bd5d4558fcc6937f94480c150.zip
Use constants for all server side stats.
-rw-r--r--src/net/ea/eaprotocol.h50
-rw-r--r--src/net/ea/playerhandler.cpp87
2 files changed, 94 insertions, 43 deletions
diff --git a/src/net/ea/eaprotocol.h b/src/net/ea/eaprotocol.h
index 589e7bdcd..00cf0f067 100644
--- a/src/net/ea/eaprotocol.h
+++ b/src/net/ea/eaprotocol.h
@@ -23,6 +23,56 @@
#ifndef NET_EA_EAPROTOCOL_H
#define NET_EA_EAPROTOCOL_H
+namespace Ea
+{
+ enum
+ {
+ WALK_SPEED = 0,
+ EXP = 1,
+ JOB_EXP = 2,
+ KARMA = 3,
+ MANNER = 4,
+ HP = 5,
+ MAX_HP = 6,
+ MP = 7,
+ MAX_MP = 8,
+ CHAR_POINTS = 9,
+ LEVEL = 11,
+ SKILL_POINTS = 12,
+ STR = 13,
+ AGI = 14,
+ VIT = 15,
+ INT = 16,
+ DEX = 17,
+ LUK = 18,
+ MONEY = 20,
+ EXP_NEEDED = 22,
+ JOB_MOD = 23,
+ TOTAL_WEIGHT = 24,
+ MAX_WEIGHT = 25,
+ STR_NEEDED = 32,
+ AGI_NEEDED = 33,
+ VIT_NEEDED = 34,
+ INT_NEEDED = 35,
+ DEX_NEEDED = 36,
+ LUK_NEEDED = 37,
+ ATK = 41,
+ ATK_MOD = 42,
+ MATK = 43,
+ MATK_MOD = 44,
+ DEF = 45,
+ DEF_MOD = 46,
+ MDEF = 47,
+ MDEF_MOD = 48,
+ HIT = 49,
+ FLEE = 50,
+ FLEE_MOD = 51,
+ CRIT = 52,
+ ATTACK_DELAY = 53,
+ JOB = 55
+ };
+} // namespace Net
+
enum
{
EA_SPRITE_BASE = 0,
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index 8a2b2bf30..55054c928 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -291,28 +291,28 @@ void PlayerHandler::setStat(const int type,
{
switch (type)
{
- case 0x0000:
+ case Ea::WALK_SPEED:
localPlayer->setWalkSpeed(Vector(static_cast<float>(
base), static_cast<float>(base), 0));
PlayerInfo::setStatBase(Attributes::WALK_SPEED, base);
PlayerInfo::setStatMod(Attributes::WALK_SPEED, 0);
break;
- case 0x0001:
+ case Ea::EXP:
PlayerInfo::setAttribute(Attributes::EXP, base);
break;
- case 0x0002:
+ case Ea::JOB_EXP:
PlayerInfo::setStatExperience(Attributes::JOB, base,
PlayerInfo::getStatExperience(Attributes::JOB).second);
break;
- case 0x0003:
+ case Ea::KARMA:
PlayerInfo::setStatBase(Attributes::KARMA, base);
PlayerInfo::setStatMod(Attributes::KARMA, 0);
break;
- case 0x0004:
+ case Ea::MANNER:
PlayerInfo::setStatBase(Attributes::MANNER, base);
PlayerInfo::setStatMod(Attributes::MANNER, 0);
break;
- case 0x0005:
+ case Ea::HP:
PlayerInfo::setAttribute(Attributes::HP, base);
if (localPlayer->isInParty() && Party::getParty(1))
{
@@ -325,7 +325,7 @@ void PlayerHandler::setStat(const int type,
}
}
break;
- case 0x0006:
+ case Ea::MAX_HP:
PlayerInfo::setAttribute(Attributes::MAX_HP, base);
if (localPlayer->isInParty() && Party::getParty(1))
@@ -339,16 +339,16 @@ void PlayerHandler::setStat(const int type,
}
}
break;
- case 0x0007:
+ case Ea::MP:
PlayerInfo::setAttribute(Attributes::MP, base);
break;
- case 0x0008:
+ case Ea::MAX_MP:
PlayerInfo::setAttribute(Attributes::MAX_MP, base);
break;
- case 0x0009:
+ case Ea::CHAR_POINTS:
PlayerInfo::setAttribute(Attributes::CHAR_POINTS, base);
break;
- case 0x000b:
+ case Ea::LEVEL:
PlayerInfo::setAttribute(Attributes::LEVEL, base);
if (localPlayer)
{
@@ -356,30 +356,30 @@ void PlayerHandler::setStat(const int type,
localPlayer->updateName();
}
break;
- case 0x000c:
+ case Ea::SKILL_POINTS:
PlayerInfo::setAttribute(Attributes::SKILL_POINTS, base);
if (skillDialog)
skillDialog->update();
break;
- case 0x000d:
+ case Ea::STR:
setStatComplex(Attributes::STR);
break;
- case 0x000e:
+ case Ea::AGI:
setStatComplex(Attributes::AGI);
break;
- case 0x000f:
+ case Ea::VIT:
setStatComplex(Attributes::VIT);
break;
- case 0x0010:
+ case Ea::INT:
setStatComplex(Attributes::INT);
break;
- case 0x0011:
+ case Ea::DEX:
setStatComplex(Attributes::DEX);
break;
- case 0x0012:
+ case Ea::LUK:
setStatComplex(Attributes::LUK);
break;
- case 0x0014:
+ case Ea::MONEY:
{
const int oldMoney = PlayerInfo::getAttribute(Attributes::MONEY);
const int newMoney = base;
@@ -397,14 +397,14 @@ void PlayerHandler::setStat(const int type,
PlayerInfo::setAttribute(Attributes::MONEY, newMoney);
break;
}
- case 0x0016:
+ case Ea::EXP_NEEDED:
PlayerInfo::setAttribute(Attributes::EXP_NEEDED, base);
break;
- case 0x0017:
+ case Ea::JOB_MOD:
PlayerInfo::setStatExperience(Attributes::JOB,
PlayerInfo::getStatExperience(Attributes::JOB).first, base);
break;
- case 0x0018:
+ case Ea::TOTAL_WEIGHT:
if (!weightNotice && config.getBoolValue("weightMsg"))
{
const int max = PlayerInfo::getAttribute(
@@ -446,72 +446,73 @@ void PlayerHandler::setStat(const int type,
}
PlayerInfo::setAttribute(Attributes::TOTAL_WEIGHT, base);
break;
- case 0x0019:
+ case Ea::MAX_WEIGHT:
PlayerInfo::setAttribute(Attributes::MAX_WEIGHT, base);
break;
- case 0x0020:
+ case Ea::STR_NEEDED:
statusWindow->setPointsNeeded(Attributes::STR, base);
break;
- case 0x0021:
+ case Ea::AGI_NEEDED:
statusWindow->setPointsNeeded(Attributes::AGI, base);
break;
- case 0x0022:
+ case Ea::VIT_NEEDED:
statusWindow->setPointsNeeded(Attributes::VIT, base);
break;
- case 0x0023:
+ case Ea::INT_NEEDED:
statusWindow->setPointsNeeded(Attributes::INT, base);
break;
- case 0x0024:
+ case Ea::DEX_NEEDED:
statusWindow->setPointsNeeded(Attributes::DEX, base);
break;
- case 0x0025:
+ case Ea::LUK_NEEDED:
statusWindow->setPointsNeeded(Attributes::LUK, base);
break;
- case 0x0029:
+
+ case Ea::ATK:
PlayerInfo::setStatBase(Attributes::ATK, base);
PlayerInfo::updateAttrs();
break;
- case 0x002a:
+ case Ea::ATK_MOD:
PlayerInfo::setStatMod(Attributes::ATK, base);
PlayerInfo::updateAttrs();
break;
- case 0x002b:
+ case Ea::MATK:
PlayerInfo::setStatBase(Attributes::MATK, base);
break;
- case 0x002c:
+ case Ea::MATK_MOD:
PlayerInfo::setStatMod(Attributes::MATK, base);
break;
- case 0x002d:
+ case Ea::DEF:
PlayerInfo::setStatBase(Attributes::DEF, base);
break;
- case 0x002e:
+ case Ea::DEF_MOD:
PlayerInfo::setStatMod(Attributes::DEF, base);
break;
- case 0x002f:
+ case Ea::MDEF:
PlayerInfo::setStatBase(Attributes::MDEF, base);
break;
- case 0x0030:
+ case Ea::MDEF_MOD:
PlayerInfo::setStatMod(Attributes::MDEF, base);
break;
- case 0x0031:
+ case Ea::HIT:
PlayerInfo::setStatBase(Attributes::HIT, base);
break;
- case 0x0032:
+ case Ea::FLEE:
PlayerInfo::setStatBase(Attributes::FLEE, base);
break;
- case 0x0033:
+ case Ea::FLEE_MOD:
PlayerInfo::setStatMod(Attributes::FLEE, base);
break;
- case 0x0034:
+ case Ea::CRIT:
PlayerInfo::setStatBase(Attributes::CRIT, base);
break;
- case 0x0035:
+ case Ea::ATTACK_DELAY:
localPlayer->setAttackSpeed(base);
PlayerInfo::setStatBase(Attributes::ATTACK_DELAY, base);
PlayerInfo::setStatMod(Attributes::ATTACK_DELAY, 0);
PlayerInfo::updateAttrs();
break;
- case 0x0037:
+ case Ea::JOB:
PlayerInfo::setStatBase(Attributes::JOB, base);
break;