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/tmwa/charserverrecv.cpp | 26 +++++------ src/net/tmwa/playerhandler.cpp | 100 ++++++++++++++++++++-------------------- src/net/tmwa/playerrecv.cpp | 53 ++++++++++----------- 3 files changed, 90 insertions(+), 89 deletions(-) (limited to 'src/net/tmwa') 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