From c9795055ee1b6079ef9b0c0e3faf4bb79704bd98 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 25 Jul 2016 02:30:47 +0300 Subject: Add into player attributes prefix PLAYER_. --- src/net/ea/inventoryrecv.cpp | 4 +- src/net/ea/playerhandler.cpp | 2 +- src/net/ea/playerrecv.cpp | 6 +-- src/net/eathena/charserverrecv.cpp | 32 ++++++------ src/net/eathena/playerhandler.cpp | 100 ++++++++++++++++++------------------- src/net/eathena/playerrecv.cpp | 60 +++++++++++----------- src/net/tmwa/charserverrecv.cpp | 26 +++++----- src/net/tmwa/playerhandler.cpp | 100 ++++++++++++++++++------------------- src/net/tmwa/playerrecv.cpp | 53 ++++++++++---------- 9 files changed, 193 insertions(+), 190 deletions(-) (limited to 'src/net') diff --git a/src/net/ea/inventoryrecv.cpp b/src/net/ea/inventoryrecv.cpp index 3910011d4..dbbe38c75 100644 --- a/src/net/ea/inventoryrecv.cpp +++ b/src/net/ea/inventoryrecv.cpp @@ -171,8 +171,8 @@ void InventoryRecv::processPlayerAttackRange(Net::MessageIn &msg) const int range = msg.readInt16("range"); if (localPlayer) localPlayer->setAttackRange(range); - PlayerInfo::setStatBase(Attributes::ATTACK_RANGE, range); - PlayerInfo::setStatMod(Attributes::ATTACK_RANGE, 0); + PlayerInfo::setStatBase(Attributes::PLAYER_ATTACK_RANGE, range); + PlayerInfo::setStatMod(Attributes::PLAYER_ATTACK_RANGE, 0); BLOCK_END("InventoryRecv::processPlayerAttackRange") } diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 0c57ab0ef..5a231c25c 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -49,7 +49,7 @@ int PlayerHandler::getDefaultWalkSpeed() const bool PlayerHandler::canUseMagic() const { - return PlayerInfo::getStatEffective(Attributes::MATK) > 0; + return PlayerInfo::getStatEffective(Attributes::PLAYER_MATK) > 0; } } // namespace Ea diff --git a/src/net/ea/playerrecv.cpp b/src/net/ea/playerrecv.cpp index 8035b9612..7a3b448f7 100644 --- a/src/net/ea/playerrecv.cpp +++ b/src/net/ea/playerrecv.cpp @@ -181,9 +181,9 @@ void PlayerRecv::processPlayerStatUpdate4(Net::MessageIn &msg) { const int oldValue = PlayerInfo::getStatBase( static_cast(type)); - const int points = PlayerInfo::getAttribute(Attributes::CHAR_POINTS) - + oldValue - value; - PlayerInfo::setAttribute(Attributes::CHAR_POINTS, points); + const int points = PlayerInfo::getAttribute( + Attributes::PLAYER_CHAR_POINTS) + oldValue - value; + PlayerInfo::setAttribute(Attributes::PLAYER_CHAR_POINTS, points); NotifyManager::notify(NotifyTypes::SKILL_RAISE_ERROR); } diff --git a/src/net/eathena/charserverrecv.cpp b/src/net/eathena/charserverrecv.cpp index 38cca2208..5341e16da 100644 --- a/src/net/eathena/charserverrecv.cpp +++ b/src/net/eathena/charserverrecv.cpp @@ -88,9 +88,9 @@ void CharServerRecv::readPlayerData(Net::MessageIn &msg, tempPlayer->setGender(token.sex); PlayerInfoBackend &data = character->data; - data.mAttributes[Attributes::EXP] = msg.readInt32("exp"); + data.mAttributes[Attributes::PLAYER_EXP] = msg.readInt32("exp"); data.mAttributes[Attributes::MONEY] = msg.readInt32("money"); - Stat &jobStat = data.mStats[Attributes::JOB]; + Stat &jobStat = data.mStats[Attributes::PLAYER_JOB]; jobStat.exp = msg.readInt32("job"); const int temp = msg.readInt32("job level"); @@ -109,16 +109,16 @@ void CharServerRecv::readPlayerData(Net::MessageIn &msg, if (packetVersion >= 20081217) { - data.mAttributes[Attributes::HP] = msg.readInt32("hp"); - data.mAttributes[Attributes::MAX_HP] = msg.readInt32("max hp"); + data.mAttributes[Attributes::PLAYER_HP] = msg.readInt32("hp"); + data.mAttributes[Attributes::PLAYER_MAX_HP] = msg.readInt32("max hp"); } else { - data.mAttributes[Attributes::HP] = msg.readInt16("hp"); - data.mAttributes[Attributes::MAX_HP] = msg.readInt16("max hp"); + data.mAttributes[Attributes::PLAYER_HP] = msg.readInt16("hp"); + data.mAttributes[Attributes::PLAYER_MAX_HP] = msg.readInt16("max hp"); } - data.mAttributes[Attributes::MP] = msg.readInt16("mp/sp"); - data.mAttributes[Attributes::MAX_MP] = msg.readInt16("max mp/sp"); + data.mAttributes[Attributes::PLAYER_MP] = msg.readInt16("mp/sp"); + data.mAttributes[Attributes::PLAYER_MAX_MP] = msg.readInt16("max mp/sp"); msg.readInt16("speed"); const uint16_t race = msg.readInt16("class"); @@ -133,7 +133,7 @@ void CharServerRecv::readPlayerData(Net::MessageIn &msg, weapon); tempPlayer->setWeaponId(weapon); - data.mAttributes[Attributes::LEVEL] = msg.readInt16("level"); + data.mAttributes[Attributes::PLAYER_LEVEL] = msg.readInt16("level"); msg.readInt16("skill points"); const int bottomClothes = msg.readInt16("head bottom"); @@ -161,12 +161,12 @@ void CharServerRecv::readPlayerData(Net::MessageIn &msg, character->dummy = tempPlayer; - character->data.mStats[Attributes::STR].base = msg.readUInt8("str"); - character->data.mStats[Attributes::AGI].base = msg.readUInt8("agi"); - character->data.mStats[Attributes::VIT].base = msg.readUInt8("vit"); - character->data.mStats[Attributes::INT].base = msg.readUInt8("int"); - character->data.mStats[Attributes::DEX].base = msg.readUInt8("dex"); - character->data.mStats[Attributes::LUK].base = msg.readUInt8("luk"); + character->data.mStats[Attributes::PLAYER_STR].base = msg.readUInt8("str"); + character->data.mStats[Attributes::PLAYER_AGI].base = msg.readUInt8("agi"); + character->data.mStats[Attributes::PLAYER_VIT].base = msg.readUInt8("vit"); + character->data.mStats[Attributes::PLAYER_INT].base = msg.readUInt8("int"); + character->data.mStats[Attributes::PLAYER_DEX].base = msg.readUInt8("dex"); + character->data.mStats[Attributes::PLAYER_LUK].base = msg.readUInt8("luk"); character->slot = msg.readInt16("character slot id"); if (packetVersion >= 20061023) @@ -282,7 +282,7 @@ void CharServerRecv::processCharMapInfo(Net::MessageIn &restrict msg) // Prevent the selected local player from being deleted localPlayer = charServerHandler->mSelectedCharacter->dummy; PlayerInfo::setBackend(charServerHandler->mSelectedCharacter->data); - PlayerInfo::setStatBase(Attributes::WALK_SPEED, + PlayerInfo::setStatBase(Attributes::PLAYER_WALK_SPEED, playerHandler->getDefaultWalkSpeed()); charServerHandler->mSelectedCharacter->dummy = nullptr; diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp index b21e9d64d..5b7b8baf5 100644 --- a/src/net/eathena/playerhandler.cpp +++ b/src/net/eathena/playerhandler.cpp @@ -81,7 +81,7 @@ void PlayerHandler::emote(const uint8_t emoteId) const void PlayerHandler::increaseAttribute(const AttributesT attr, const int amount) const { - if (attr >= Attributes::STR && attr <= Attributes::LUK) + if (attr >= Attributes::PLAYER_STR && attr <= Attributes::PLAYER_LUK) { createOutPacket(CMSG_STAT_UPDATE_REQUEST); outMsg.writeInt16(CAST_S16(attr), "attribute id"); @@ -91,7 +91,7 @@ void PlayerHandler::increaseAttribute(const AttributesT attr, void PlayerHandler::increaseSkill(const uint16_t skillId) const { - if (PlayerInfo::getAttribute(Attributes::SKILL_POINTS) <= 0) + if (PlayerInfo::getAttribute(Attributes::PLAYER_SKILL_POINTS) <= 0) return; createOutPacket(CMSG_SKILL_LEVELUP_REQUEST); @@ -520,26 +520,26 @@ void PlayerHandler::setStat(Net::MessageIn &msg, { case Sp::SPEED: localPlayer->setWalkSpeed(base); - PlayerInfo::setStatBase(Attributes::WALK_SPEED, base); - PlayerInfo::setStatMod(Attributes::WALK_SPEED, 0); + PlayerInfo::setStatBase(Attributes::PLAYER_WALK_SPEED, base); + PlayerInfo::setStatMod(Attributes::PLAYER_WALK_SPEED, 0); break; case Sp::BASEEXP: - PlayerInfo::setAttribute(Attributes::EXP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_EXP, base); break; case Sp::JOBEXP: - PlayerInfo::setStatExperience(Attributes::JOB, base, - PlayerInfo::getStatExperience(Attributes::JOB).second); + PlayerInfo::setStatExperience(Attributes::PLAYER_JOB, base, + PlayerInfo::getStatExperience(Attributes::PLAYER_JOB).second); break; case Sp::KARMA: - PlayerInfo::setStatBase(Attributes::KARMA, base); - PlayerInfo::setStatMod(Attributes::KARMA, 0); + PlayerInfo::setStatBase(Attributes::PLAYER_KARMA, base); + PlayerInfo::setStatMod(Attributes::PLAYER_KARMA, 0); break; case Sp::MANNER: - PlayerInfo::setStatBase(Attributes::MANNER, base); - PlayerInfo::setStatMod(Attributes::MANNER, 0); + PlayerInfo::setStatBase(Attributes::PLAYER_MANNER, base); + PlayerInfo::setStatMod(Attributes::PLAYER_MANNER, 0); break; case Sp::HP: - PlayerInfo::setAttribute(Attributes::HP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_HP, base); if (localPlayer->isInParty() && Party::getParty(1)) { PartyMember *const m = Party::getParty(1) @@ -547,12 +547,12 @@ void PlayerHandler::setStat(Net::MessageIn &msg, if (m) { m->setHp(base); - m->setMaxHp(PlayerInfo::getAttribute(Attributes::MAX_HP)); + m->setMaxHp(PlayerInfo::getAttribute(Attributes::PLAYER_MAX_HP)); } } break; case Sp::MAXHP: - PlayerInfo::setAttribute(Attributes::MAX_HP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_MAX_HP, base); if (localPlayer->isInParty() && Party::getParty(1)) { @@ -560,22 +560,22 @@ void PlayerHandler::setStat(Net::MessageIn &msg, localPlayer->getId()); if (m) { - m->setHp(PlayerInfo::getAttribute(Attributes::HP)); + m->setHp(PlayerInfo::getAttribute(Attributes::PLAYER_HP)); m->setMaxHp(base); } } break; case Sp::SP: - PlayerInfo::setAttribute(Attributes::MP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_MP, base); break; case Sp::MAXSP: - PlayerInfo::setAttribute(Attributes::MAX_MP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_MAX_MP, base); break; case Sp::STATUSPOINT: - PlayerInfo::setAttribute(Attributes::CHAR_POINTS, base); + PlayerInfo::setAttribute(Attributes::PLAYER_CHAR_POINTS, base); break; case Sp::BASELEVEL: - PlayerInfo::setAttribute(Attributes::LEVEL, base); + PlayerInfo::setAttribute(Attributes::PLAYER_LEVEL, base); if (localPlayer) { localPlayer->setLevel(base); @@ -583,27 +583,27 @@ void PlayerHandler::setStat(Net::MessageIn &msg, } break; case Sp::SKILLPOINT: - PlayerInfo::setAttribute(Attributes::SKILL_POINTS, base); + PlayerInfo::setAttribute(Attributes::PLAYER_SKILL_POINTS, base); if (skillDialog) skillDialog->update(); break; case Sp::STR: - setStatComplex(Attributes::STR); + setStatComplex(Attributes::PLAYER_STR); break; case Sp::AGI: - setStatComplex(Attributes::AGI); + setStatComplex(Attributes::PLAYER_AGI); break; case Sp::VIT: - setStatComplex(Attributes::VIT); + setStatComplex(Attributes::PLAYER_VIT); break; case Sp::INT: - setStatComplex(Attributes::INT); + setStatComplex(Attributes::PLAYER_INT); break; case Sp::DEX: - setStatComplex(Attributes::DEX); + setStatComplex(Attributes::PLAYER_DEX); break; case Sp::LUK: - setStatComplex(Attributes::LUK); + setStatComplex(Attributes::PLAYER_LUK); break; case Sp::ZENY: { @@ -624,12 +624,12 @@ void PlayerHandler::setStat(Net::MessageIn &msg, break; } case Sp::NEXTBASEEXP: - PlayerInfo::setAttribute(Attributes::EXP_NEEDED, base); + PlayerInfo::setAttribute(Attributes::PLAYER_EXP_NEEDED, base); break; // ++ here used in wrong way. Need like Sp::NEXTBASEEXP? case Sp::NEXTJOBEXP: - PlayerInfo::setStatExperience(Attributes::JOB, - PlayerInfo::getStatExperience(Attributes::JOB).first, base); + PlayerInfo::setStatExperience(Attributes::PLAYER_JOB, + PlayerInfo::getStatExperience(Attributes::PLAYER_JOB).first, base); break; case Sp::WEIGHT: PlayerInfo::setAttribute(Attributes::TOTAL_WEIGHT, base); @@ -638,70 +638,70 @@ void PlayerHandler::setStat(Net::MessageIn &msg, PlayerInfo::setAttribute(Attributes::MAX_WEIGHT, base); break; case Sp::USTR: - statusWindow->setPointsNeeded(Attributes::STR, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_STR, base); break; case Sp::UAGI: - statusWindow->setPointsNeeded(Attributes::AGI, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_AGI, base); break; case Sp::UVIT: - statusWindow->setPointsNeeded(Attributes::VIT, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_VIT, base); break; case Sp::UINT: - statusWindow->setPointsNeeded(Attributes::INT, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_INT, base); break; case Sp::UDEX: - statusWindow->setPointsNeeded(Attributes::DEX, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_DEX, base); break; case Sp::ULUK: - statusWindow->setPointsNeeded(Attributes::LUK, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_LUK, base); break; case Sp::ATK1: - PlayerInfo::setStatBase(Attributes::ATK, base); + PlayerInfo::setStatBase(Attributes::PLAYER_ATK, base); PlayerInfo::updateAttrs(); break; case Sp::ATK2: - PlayerInfo::setStatMod(Attributes::ATK, base); + PlayerInfo::setStatMod(Attributes::PLAYER_ATK, base); PlayerInfo::updateAttrs(); break; case Sp::MATK1: - PlayerInfo::setStatBase(Attributes::MATK, base); + PlayerInfo::setStatBase(Attributes::PLAYER_MATK, base); break; case Sp::MATK2: - PlayerInfo::setStatMod(Attributes::MATK, base); + PlayerInfo::setStatMod(Attributes::PLAYER_MATK, base); break; case Sp::DEF1: - PlayerInfo::setStatBase(Attributes::DEF, base); + PlayerInfo::setStatBase(Attributes::PLAYER_DEF, base); break; case Sp::DEF2: - PlayerInfo::setStatMod(Attributes::DEF, base); + PlayerInfo::setStatMod(Attributes::PLAYER_DEF, base); break; case Sp::MDEF1: - PlayerInfo::setStatBase(Attributes::MDEF, base); + PlayerInfo::setStatBase(Attributes::PLAYER_MDEF, base); break; case Sp::MDEF2: - PlayerInfo::setStatMod(Attributes::MDEF, base); + PlayerInfo::setStatMod(Attributes::PLAYER_MDEF, base); break; case Sp::HIT: - PlayerInfo::setStatBase(Attributes::HIT, base); + PlayerInfo::setStatBase(Attributes::PLAYER_HIT, base); break; case Sp::FLEE1: - PlayerInfo::setStatBase(Attributes::FLEE, base); + PlayerInfo::setStatBase(Attributes::PLAYER_FLEE, base); break; case Sp::FLEE2: - PlayerInfo::setStatMod(Attributes::FLEE, base); + PlayerInfo::setStatMod(Attributes::PLAYER_FLEE, base); break; case Sp::CRITICAL: - PlayerInfo::setStatBase(Attributes::CRIT, base); + PlayerInfo::setStatBase(Attributes::PLAYER_CRIT, base); break; case Sp::ASPD: localPlayer->setAttackSpeed(base); - PlayerInfo::setStatBase(Attributes::ATTACK_DELAY, base); - PlayerInfo::setStatMod(Attributes::ATTACK_DELAY, 0); + PlayerInfo::setStatBase(Attributes::PLAYER_ATTACK_DELAY, base); + PlayerInfo::setStatMod(Attributes::PLAYER_ATTACK_DELAY, 0); PlayerInfo::updateAttrs(); break; case Sp::JOBLEVEL: - PlayerInfo::setStatBase(Attributes::JOB, base); + PlayerInfo::setStatBase(Attributes::PLAYER_JOB, base); break; default: diff --git a/src/net/eathena/playerrecv.cpp b/src/net/eathena/playerrecv.cpp index 6f9f5a43c..3c32be745 100644 --- a/src/net/eathena/playerrecv.cpp +++ b/src/net/eathena/playerrecv.cpp @@ -74,14 +74,14 @@ void PlayerRecv::processPlayerShowEquip(Net::MessageIn &msg) void PlayerRecv::processPlayerStatUpdate5(Net::MessageIn &msg) { BLOCK_START("PlayerRecv::processPlayerStatUpdate5") - PlayerInfo::setAttribute(Attributes::CHAR_POINTS, + PlayerInfo::setAttribute(Attributes::PLAYER_CHAR_POINTS, msg.readInt16("char points")); unsigned int val = msg.readUInt8("str"); - PlayerInfo::setStatBase(Attributes::STR, val); + PlayerInfo::setStatBase(Attributes::PLAYER_STR, val); if (statusWindow) { - statusWindow->setPointsNeeded(Attributes::STR, + statusWindow->setPointsNeeded(Attributes::PLAYER_STR, msg.readUInt8("str cost")); } else @@ -90,10 +90,10 @@ void PlayerRecv::processPlayerStatUpdate5(Net::MessageIn &msg) } val = msg.readUInt8("agi"); - PlayerInfo::setStatBase(Attributes::AGI, val); + PlayerInfo::setStatBase(Attributes::PLAYER_AGI, val); if (statusWindow) { - statusWindow->setPointsNeeded(Attributes::AGI, + statusWindow->setPointsNeeded(Attributes::PLAYER_AGI, msg.readUInt8("agi cost")); } else @@ -102,10 +102,10 @@ void PlayerRecv::processPlayerStatUpdate5(Net::MessageIn &msg) } val = msg.readUInt8("vit"); - PlayerInfo::setStatBase(Attributes::VIT, val); + PlayerInfo::setStatBase(Attributes::PLAYER_VIT, val); if (statusWindow) { - statusWindow->setPointsNeeded(Attributes::VIT, + statusWindow->setPointsNeeded(Attributes::PLAYER_VIT, msg.readUInt8("vit cost")); } else @@ -114,10 +114,10 @@ void PlayerRecv::processPlayerStatUpdate5(Net::MessageIn &msg) } val = msg.readUInt8("int"); - PlayerInfo::setStatBase(Attributes::INT, val); + PlayerInfo::setStatBase(Attributes::PLAYER_INT, val); if (statusWindow) { - statusWindow->setPointsNeeded(Attributes::INT, + statusWindow->setPointsNeeded(Attributes::PLAYER_INT, msg.readUInt8("int cost")); } else @@ -126,10 +126,10 @@ void PlayerRecv::processPlayerStatUpdate5(Net::MessageIn &msg) } val = msg.readUInt8("dex"); - PlayerInfo::setStatBase(Attributes::DEX, val); + PlayerInfo::setStatBase(Attributes::PLAYER_DEX, val); if (statusWindow) { - statusWindow->setPointsNeeded(Attributes::DEX, + statusWindow->setPointsNeeded(Attributes::PLAYER_DEX, msg.readUInt8("dex cost")); } else @@ -138,10 +138,10 @@ void PlayerRecv::processPlayerStatUpdate5(Net::MessageIn &msg) } val = msg.readUInt8("luk"); - PlayerInfo::setStatBase(Attributes::LUK, val); + PlayerInfo::setStatBase(Attributes::PLAYER_LUK, val); if (statusWindow) { - statusWindow->setPointsNeeded(Attributes::LUK, + statusWindow->setPointsNeeded(Attributes::PLAYER_LUK, msg.readUInt8("luk cost")); } else @@ -149,34 +149,34 @@ void PlayerRecv::processPlayerStatUpdate5(Net::MessageIn &msg) msg.readUInt8("luk cost"); } - PlayerInfo::setStatBase(Attributes::ATK, + PlayerInfo::setStatBase(Attributes::PLAYER_ATK, msg.readInt16("left atk"), Notify_false); - PlayerInfo::setStatMod(Attributes::ATK, msg.readInt16("right atk")); + PlayerInfo::setStatMod(Attributes::PLAYER_ATK, msg.readInt16("right atk")); PlayerInfo::updateAttrs(); val = msg.readInt16("right matk"); - PlayerInfo::setStatBase(Attributes::MATK, val, Notify_false); + PlayerInfo::setStatBase(Attributes::PLAYER_MATK, val, Notify_false); val = msg.readInt16("left matk"); - PlayerInfo::setStatMod(Attributes::MATK, val); + PlayerInfo::setStatMod(Attributes::PLAYER_MATK, val); - PlayerInfo::setStatBase(Attributes::DEF, + PlayerInfo::setStatBase(Attributes::PLAYER_DEF, msg.readInt16("left def"), Notify_false); - PlayerInfo::setStatMod(Attributes::DEF, msg.readInt16("right def")); + PlayerInfo::setStatMod(Attributes::PLAYER_DEF, msg.readInt16("right def")); - PlayerInfo::setStatBase(Attributes::MDEF, + PlayerInfo::setStatBase(Attributes::PLAYER_MDEF, msg.readInt16("left mdef"), Notify_false); - PlayerInfo::setStatMod(Attributes::MDEF, msg.readInt16("right mdef")); + PlayerInfo::setStatMod(Attributes::PLAYER_MDEF, msg.readInt16("right mdef")); - PlayerInfo::setStatBase(Attributes::HIT, msg.readInt16("hit")); + PlayerInfo::setStatBase(Attributes::PLAYER_HIT, msg.readInt16("hit")); - PlayerInfo::setStatBase(Attributes::FLEE, + PlayerInfo::setStatBase(Attributes::PLAYER_FLEE, msg.readInt16("flee"), Notify_false); - PlayerInfo::setStatMod(Attributes::FLEE, msg.readInt16("flee2/10")); + PlayerInfo::setStatMod(Attributes::PLAYER_FLEE, msg.readInt16("flee2/10")); - PlayerInfo::setStatBase(Attributes::CRIT, msg.readInt16("crit/10")); + PlayerInfo::setStatBase(Attributes::PLAYER_CRIT, msg.readInt16("crit/10")); - PlayerInfo::setAttribute(Attributes::ATTACK_DELAY, + PlayerInfo::setAttribute(Attributes::PLAYER_ATTACK_DELAY, msg.readInt16("attack speed")); msg.readInt16("plus speed = 0"); @@ -248,8 +248,9 @@ void PlayerRecv::processPlayerHeal(Net::MessageIn &msg) const int amount = msg.readInt16("value"); if (type == Sp::HP) { - const int base = PlayerInfo::getAttribute(Attributes::HP) + amount; - PlayerInfo::setAttribute(Attributes::HP, base); + const int base = PlayerInfo::getAttribute(Attributes::PLAYER_HP) + + amount; + PlayerInfo::setAttribute(Attributes::PLAYER_HP, base); if (localPlayer->isInParty() && Party::getParty(1)) { PartyMember *const m = Party::getParty(1) @@ -257,7 +258,8 @@ void PlayerRecv::processPlayerHeal(Net::MessageIn &msg) if (m) { m->setHp(base); - m->setMaxHp(PlayerInfo::getAttribute(Attributes::MAX_HP)); + m->setMaxHp(PlayerInfo::getAttribute( + Attributes::PLAYER_MAX_HP)); } } localPlayer->addHpMessage(amount); diff --git a/src/net/tmwa/charserverrecv.cpp b/src/net/tmwa/charserverrecv.cpp index 9728303ff..31a5afe64 100644 --- a/src/net/tmwa/charserverrecv.cpp +++ b/src/net/tmwa/charserverrecv.cpp @@ -74,9 +74,9 @@ void CharServerRecv::readPlayerData(Net::MessageIn &msg, msg.readBeingId("account id"), BeingTypeId_zero); PlayerInfoBackend &data = character->data; - data.mAttributes[Attributes::EXP] = msg.readInt32("exp"); + data.mAttributes[Attributes::PLAYER_EXP] = msg.readInt32("exp"); data.mAttributes[Attributes::MONEY] = msg.readInt32("money"); - Stat &jobStat = data.mStats[Attributes::JOB]; + Stat &jobStat = data.mStats[Attributes::PLAYER_JOB]; jobStat.exp = msg.readInt32("job"); const int temp = msg.readInt32("job level"); @@ -93,10 +93,10 @@ void CharServerRecv::readPlayerData(Net::MessageIn &msg, tempPlayer->setManner(msg.readInt32("manner")); msg.readInt16("character points left"); - data.mAttributes[Attributes::HP] = msg.readInt16("hp"); - data.mAttributes[Attributes::MAX_HP] = msg.readInt16("max hp"); - data.mAttributes[Attributes::MP] = msg.readInt16("mp"); - data.mAttributes[Attributes::MAX_MP] = msg.readInt16("max mp"); + data.mAttributes[Attributes::PLAYER_HP] = msg.readInt16("hp"); + data.mAttributes[Attributes::PLAYER_MAX_HP] = msg.readInt16("max hp"); + data.mAttributes[Attributes::PLAYER_MP] = msg.readInt16("mp"); + data.mAttributes[Attributes::PLAYER_MAX_MP] = msg.readInt16("max mp"); msg.readInt16("speed"); const uint16_t race = msg.readInt16("class"); @@ -108,7 +108,7 @@ void CharServerRecv::readPlayerData(Net::MessageIn &msg, weapon); tempPlayer->setWeaponId(weapon); - data.mAttributes[Attributes::LEVEL] = msg.readInt16("level"); + data.mAttributes[Attributes::PLAYER_LEVEL] = msg.readInt16("level"); msg.readInt16("skill point"); const int bottomClothes = msg.readInt16("bottom clothes"); @@ -137,12 +137,12 @@ void CharServerRecv::readPlayerData(Net::MessageIn &msg, character->dummy = tempPlayer; - character->data.mStats[Attributes::STR].base = msg.readUInt8("str"); - character->data.mStats[Attributes::AGI].base = msg.readUInt8("agi"); - character->data.mStats[Attributes::VIT].base = msg.readUInt8("vit"); - character->data.mStats[Attributes::INT].base = msg.readUInt8("int"); - character->data.mStats[Attributes::DEX].base = msg.readUInt8("dex"); - character->data.mStats[Attributes::LUK].base = msg.readUInt8("luk"); + character->data.mStats[Attributes::PLAYER_STR].base = msg.readUInt8("str"); + character->data.mStats[Attributes::PLAYER_AGI].base = msg.readUInt8("agi"); + character->data.mStats[Attributes::PLAYER_VIT].base = msg.readUInt8("vit"); + character->data.mStats[Attributes::PLAYER_INT].base = msg.readUInt8("int"); + character->data.mStats[Attributes::PLAYER_DEX].base = msg.readUInt8("dex"); + character->data.mStats[Attributes::PLAYER_LUK].base = msg.readUInt8("luk"); tempPlayer->setSpriteId(SPRITE_HAIR, shoes); diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index eb9665af9..5058e1d39 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -79,7 +79,7 @@ void PlayerHandler::emote(const uint8_t emoteId) const void PlayerHandler::increaseAttribute(const AttributesT attr, const int amount A_UNUSED) const { - if (attr >= Attributes::STR && attr <= Attributes::LUK) + if (attr >= Attributes::PLAYER_STR && attr <= Attributes::PLAYER_LUK) { createOutPacket(CMSG_STAT_UPDATE_REQUEST); outMsg.writeInt16(CAST_S16(attr), "attribute id"); @@ -89,7 +89,7 @@ void PlayerHandler::increaseAttribute(const AttributesT attr, void PlayerHandler::increaseSkill(const uint16_t skillId) const { - if (PlayerInfo::getAttribute(Attributes::SKILL_POINTS) <= 0) + if (PlayerInfo::getAttribute(Attributes::PLAYER_SKILL_POINTS) <= 0) return; createOutPacket(CMSG_SKILL_LEVELUP_REQUEST); @@ -224,26 +224,26 @@ void PlayerHandler::setStat(Net::MessageIn &msg, { case Sp::SPEED: localPlayer->setWalkSpeed(base); - PlayerInfo::setStatBase(Attributes::WALK_SPEED, base); - PlayerInfo::setStatMod(Attributes::WALK_SPEED, 0); + PlayerInfo::setStatBase(Attributes::PLAYER_WALK_SPEED, base); + PlayerInfo::setStatMod(Attributes::PLAYER_WALK_SPEED, 0); break; case Sp::BASEEXP: - PlayerInfo::setAttribute(Attributes::EXP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_EXP, base); break; case Sp::JOBEXP: - PlayerInfo::setStatExperience(Attributes::JOB, base, - PlayerInfo::getStatExperience(Attributes::JOB).second); + PlayerInfo::setStatExperience(Attributes::PLAYER_JOB, base, + PlayerInfo::getStatExperience(Attributes::PLAYER_JOB).second); break; case Sp::KARMA: - PlayerInfo::setStatBase(Attributes::KARMA, base); - PlayerInfo::setStatMod(Attributes::KARMA, 0); + PlayerInfo::setStatBase(Attributes::PLAYER_KARMA, base); + PlayerInfo::setStatMod(Attributes::PLAYER_KARMA, 0); break; case Sp::MANNER: - PlayerInfo::setStatBase(Attributes::MANNER, base); - PlayerInfo::setStatMod(Attributes::MANNER, 0); + PlayerInfo::setStatBase(Attributes::PLAYER_MANNER, base); + PlayerInfo::setStatMod(Attributes::PLAYER_MANNER, 0); break; case Sp::HP: - PlayerInfo::setAttribute(Attributes::HP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_HP, base); if (localPlayer->isInParty() && Party::getParty(1)) { PartyMember *const m = Party::getParty(1) @@ -251,12 +251,12 @@ void PlayerHandler::setStat(Net::MessageIn &msg, if (m) { m->setHp(base); - m->setMaxHp(PlayerInfo::getAttribute(Attributes::MAX_HP)); + m->setMaxHp(PlayerInfo::getAttribute(Attributes::PLAYER_MAX_HP)); } } break; case Sp::MAXHP: - PlayerInfo::setAttribute(Attributes::MAX_HP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_MAX_HP, base); if (localPlayer->isInParty() && Party::getParty(1)) { @@ -264,22 +264,22 @@ void PlayerHandler::setStat(Net::MessageIn &msg, localPlayer->getId()); if (m) { - m->setHp(PlayerInfo::getAttribute(Attributes::HP)); + m->setHp(PlayerInfo::getAttribute(Attributes::PLAYER_HP)); m->setMaxHp(base); } } break; case Sp::SP: - PlayerInfo::setAttribute(Attributes::MP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_MP, base); break; case Sp::MAXSP: - PlayerInfo::setAttribute(Attributes::MAX_MP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_MAX_MP, base); break; case Sp::STATUSPOINT: - PlayerInfo::setAttribute(Attributes::CHAR_POINTS, base); + PlayerInfo::setAttribute(Attributes::PLAYER_CHAR_POINTS, base); break; case Sp::BASELEVEL: - PlayerInfo::setAttribute(Attributes::LEVEL, base); + PlayerInfo::setAttribute(Attributes::PLAYER_LEVEL, base); if (localPlayer) { localPlayer->setLevel(base); @@ -287,27 +287,27 @@ void PlayerHandler::setStat(Net::MessageIn &msg, } break; case Sp::SKILLPOINT: - PlayerInfo::setAttribute(Attributes::SKILL_POINTS, base); + PlayerInfo::setAttribute(Attributes::PLAYER_SKILL_POINTS, base); if (skillDialog) skillDialog->update(); break; case Sp::STR: - setStatComplex(Attributes::STR); + setStatComplex(Attributes::PLAYER_STR); break; case Sp::AGI: - setStatComplex(Attributes::AGI); + setStatComplex(Attributes::PLAYER_AGI); break; case Sp::VIT: - setStatComplex(Attributes::VIT); + setStatComplex(Attributes::PLAYER_VIT); break; case Sp::INT: - setStatComplex(Attributes::INT); + setStatComplex(Attributes::PLAYER_INT); break; case Sp::DEX: - setStatComplex(Attributes::DEX); + setStatComplex(Attributes::PLAYER_DEX); break; case Sp::LUK: - setStatComplex(Attributes::LUK); + setStatComplex(Attributes::PLAYER_LUK); break; case Sp::ZENY: { @@ -328,11 +328,11 @@ void PlayerHandler::setStat(Net::MessageIn &msg, break; } case Sp::NEXTBASEEXP: - PlayerInfo::setAttribute(Attributes::EXP_NEEDED, base); + PlayerInfo::setAttribute(Attributes::PLAYER_EXP_NEEDED, base); break; case Sp::JOB_MOD: - PlayerInfo::setStatExperience(Attributes::JOB, - PlayerInfo::getStatExperience(Attributes::JOB).first, base); + PlayerInfo::setStatExperience(Attributes::PLAYER_JOB, + PlayerInfo::getStatExperience(Attributes::PLAYER_JOB).first, base); break; case Sp::WEIGHT: PlayerInfo::setAttribute(Attributes::TOTAL_WEIGHT, base); @@ -341,70 +341,70 @@ void PlayerHandler::setStat(Net::MessageIn &msg, PlayerInfo::setAttribute(Attributes::MAX_WEIGHT, base); break; case Sp::USTR: - statusWindow->setPointsNeeded(Attributes::STR, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_STR, base); break; case Sp::UAGI: - statusWindow->setPointsNeeded(Attributes::AGI, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_AGI, base); break; case Sp::UVIT: - statusWindow->setPointsNeeded(Attributes::VIT, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_VIT, base); break; case Sp::UINT: - statusWindow->setPointsNeeded(Attributes::INT, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_INT, base); break; case Sp::UDEX: - statusWindow->setPointsNeeded(Attributes::DEX, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_DEX, base); break; case Sp::ULUK: - statusWindow->setPointsNeeded(Attributes::LUK, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_LUK, base); break; case Sp::ATK1: - PlayerInfo::setStatBase(Attributes::ATK, base); + PlayerInfo::setStatBase(Attributes::PLAYER_ATK, base); PlayerInfo::updateAttrs(); break; case Sp::ATK2: - PlayerInfo::setStatMod(Attributes::ATK, base); + PlayerInfo::setStatMod(Attributes::PLAYER_ATK, base); PlayerInfo::updateAttrs(); break; case Sp::MATK1: - PlayerInfo::setStatBase(Attributes::MATK, base); + PlayerInfo::setStatBase(Attributes::PLAYER_MATK, base); break; case Sp::MATK2: - PlayerInfo::setStatMod(Attributes::MATK, base); + PlayerInfo::setStatMod(Attributes::PLAYER_MATK, base); break; case Sp::DEF1: - PlayerInfo::setStatBase(Attributes::DEF, base); + PlayerInfo::setStatBase(Attributes::PLAYER_DEF, base); break; case Sp::DEF2: - PlayerInfo::setStatMod(Attributes::DEF, base); + PlayerInfo::setStatMod(Attributes::PLAYER_DEF, base); break; case Sp::MDEF1: - PlayerInfo::setStatBase(Attributes::MDEF, base); + PlayerInfo::setStatBase(Attributes::PLAYER_MDEF, base); break; case Sp::MDEF2: - PlayerInfo::setStatMod(Attributes::MDEF, base); + PlayerInfo::setStatMod(Attributes::PLAYER_MDEF, base); break; case Sp::HIT: - PlayerInfo::setStatBase(Attributes::HIT, base); + PlayerInfo::setStatBase(Attributes::PLAYER_HIT, base); break; case Sp::FLEE1: - PlayerInfo::setStatBase(Attributes::FLEE, base); + PlayerInfo::setStatBase(Attributes::PLAYER_FLEE, base); break; case Sp::FLEE2: - PlayerInfo::setStatMod(Attributes::FLEE, base); + PlayerInfo::setStatMod(Attributes::PLAYER_FLEE, base); break; case Sp::CRITICAL: - PlayerInfo::setStatBase(Attributes::CRIT, base); + PlayerInfo::setStatBase(Attributes::PLAYER_CRIT, base); break; case Sp::ASPD: localPlayer->setAttackSpeed(base); - PlayerInfo::setStatBase(Attributes::ATTACK_DELAY, base); - PlayerInfo::setStatMod(Attributes::ATTACK_DELAY, 0); + PlayerInfo::setStatBase(Attributes::PLAYER_ATTACK_DELAY, base); + PlayerInfo::setStatMod(Attributes::PLAYER_ATTACK_DELAY, 0); PlayerInfo::updateAttrs(); break; case Sp::JOBLEVEL: - PlayerInfo::setStatBase(Attributes::JOB, base); + PlayerInfo::setStatBase(Attributes::PLAYER_JOB, base); break; case Sp::GM_LEVEL: localPlayer->setGMLevel(base); diff --git a/src/net/tmwa/playerrecv.cpp b/src/net/tmwa/playerrecv.cpp index 6d2eefb86..0c15fff57 100644 --- a/src/net/tmwa/playerrecv.cpp +++ b/src/net/tmwa/playerrecv.cpp @@ -37,14 +37,14 @@ namespace TmwAthena void PlayerRecv::processPlayerStatUpdate5(Net::MessageIn &msg) { BLOCK_START("PlayerRecv::processPlayerStatUpdate5") - PlayerInfo::setAttribute(Attributes::CHAR_POINTS, + PlayerInfo::setAttribute(Attributes::PLAYER_CHAR_POINTS, msg.readInt16("char points")); unsigned int val = msg.readUInt8("str"); - PlayerInfo::setStatBase(Attributes::STR, val); + PlayerInfo::setStatBase(Attributes::PLAYER_STR, val); if (statusWindow) { - statusWindow->setPointsNeeded(Attributes::STR, + statusWindow->setPointsNeeded(Attributes::PLAYER_STR, msg.readUInt8("str cost")); } else @@ -53,10 +53,10 @@ void PlayerRecv::processPlayerStatUpdate5(Net::MessageIn &msg) } val = msg.readUInt8("agi"); - PlayerInfo::setStatBase(Attributes::AGI, val); + PlayerInfo::setStatBase(Attributes::PLAYER_AGI, val); if (statusWindow) { - statusWindow->setPointsNeeded(Attributes::AGI, + statusWindow->setPointsNeeded(Attributes::PLAYER_AGI, msg.readUInt8("agi cost")); } else @@ -65,10 +65,10 @@ void PlayerRecv::processPlayerStatUpdate5(Net::MessageIn &msg) } val = msg.readUInt8("vit"); - PlayerInfo::setStatBase(Attributes::VIT, val); + PlayerInfo::setStatBase(Attributes::PLAYER_VIT, val); if (statusWindow) { - statusWindow->setPointsNeeded(Attributes::VIT, + statusWindow->setPointsNeeded(Attributes::PLAYER_VIT, msg.readUInt8("vit cost")); } else @@ -77,10 +77,10 @@ void PlayerRecv::processPlayerStatUpdate5(Net::MessageIn &msg) } val = msg.readUInt8("int"); - PlayerInfo::setStatBase(Attributes::INT, val); + PlayerInfo::setStatBase(Attributes::PLAYER_INT, val); if (statusWindow) { - statusWindow->setPointsNeeded(Attributes::INT, + statusWindow->setPointsNeeded(Attributes::PLAYER_INT, msg.readUInt8("int cost")); } else @@ -89,10 +89,10 @@ void PlayerRecv::processPlayerStatUpdate5(Net::MessageIn &msg) } val = msg.readUInt8("dex"); - PlayerInfo::setStatBase(Attributes::DEX, val); + PlayerInfo::setStatBase(Attributes::PLAYER_DEX, val); if (statusWindow) { - statusWindow->setPointsNeeded(Attributes::DEX, + statusWindow->setPointsNeeded(Attributes::PLAYER_DEX, msg.readUInt8("dex cost")); } else @@ -101,10 +101,10 @@ void PlayerRecv::processPlayerStatUpdate5(Net::MessageIn &msg) } val = msg.readUInt8("luk"); - PlayerInfo::setStatBase(Attributes::LUK, val); + PlayerInfo::setStatBase(Attributes::PLAYER_LUK, val); if (statusWindow) { - statusWindow->setPointsNeeded(Attributes::LUK, + statusWindow->setPointsNeeded(Attributes::PLAYER_LUK, msg.readUInt8("luk cost")); } else @@ -112,34 +112,35 @@ void PlayerRecv::processPlayerStatUpdate5(Net::MessageIn &msg) msg.readUInt8("luk cost"); } - PlayerInfo::setStatBase(Attributes::ATK, + PlayerInfo::setStatBase(Attributes::PLAYER_ATK, msg.readInt16("atk"), Notify_false); - PlayerInfo::setStatMod(Attributes::ATK, msg.readInt16("atk+")); + PlayerInfo::setStatMod(Attributes::PLAYER_ATK, msg.readInt16("atk+")); PlayerInfo::updateAttrs(); val = msg.readInt16("matk"); - PlayerInfo::setStatBase(Attributes::MATK, val, Notify_false); + PlayerInfo::setStatBase(Attributes::PLAYER_MATK, val, Notify_false); val = msg.readInt16("matk+"); - PlayerInfo::setStatMod(Attributes::MATK, val); + PlayerInfo::setStatMod(Attributes::PLAYER_MATK, val); - PlayerInfo::setStatBase(Attributes::DEF, + PlayerInfo::setStatBase(Attributes::PLAYER_DEF, msg.readInt16("def"), Notify_false); - PlayerInfo::setStatMod(Attributes::DEF, msg.readInt16("def+")); + PlayerInfo::setStatMod(Attributes::PLAYER_DEF, msg.readInt16("def+")); - PlayerInfo::setStatBase(Attributes::MDEF, + PlayerInfo::setStatBase(Attributes::PLAYER_MDEF, msg.readInt16("mdef"), Notify_false); - PlayerInfo::setStatMod(Attributes::MDEF, msg.readInt16("mdef+")); + PlayerInfo::setStatMod(Attributes::PLAYER_MDEF, msg.readInt16("mdef+")); - PlayerInfo::setStatBase(Attributes::HIT, msg.readInt16("hit")); + PlayerInfo::setStatBase(Attributes::PLAYER_HIT, msg.readInt16("hit")); - PlayerInfo::setStatBase(Attributes::FLEE, + PlayerInfo::setStatBase(Attributes::PLAYER_FLEE, msg.readInt16("flee"), Notify_false); - PlayerInfo::setStatMod(Attributes::FLEE, msg.readInt16("flee+")); + PlayerInfo::setStatMod(Attributes::PLAYER_FLEE, msg.readInt16("flee+")); - PlayerInfo::setStatBase(Attributes::CRIT, msg.readInt16("crit")); + PlayerInfo::setStatBase(Attributes::PLAYER_CRIT, msg.readInt16("crit")); - PlayerInfo::setStatBase(Attributes::MANNER, msg.readInt16("manner")); + PlayerInfo::setStatBase(Attributes::PLAYER_MANNER, + msg.readInt16("manner")); msg.readInt16("unused?"); BLOCK_END("PlayerRecv::processPlayerStatUpdate5") } -- cgit v1.2.3-70-g09d2