Skip to content

Commit

Permalink
improve: remove unnecessary condition in cyclopedia (opentibiabr#2764)
Browse files Browse the repository at this point in the history
Remove unnecessary condition in Cyclopedia Character General Stats
  • Loading branch information
luanluciano93 authored Aug 9, 2024
1 parent 7766a1d commit 2df3d44
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3516,10 +3516,7 @@ void ProtocolGame::sendCyclopediaCharacterGeneralStats() {

for (uint8_t i = SKILL_FIRST; i < SKILL_CRITICAL_HIT_CHANCE; ++i) {
static const uint8_t HardcodedSkillIds[] = { 11, 9, 8, 10, 7, 6, 13 };
skills_t skill = static_cast<skills_t>(i);
if (!oldProtocol && (skill == SKILL_LIFE_LEECH_CHANCE || skill == SKILL_MANA_LEECH_CHANCE)) {
continue;
}
const auto skill = static_cast<skills_t>(i);
msg.addByte(HardcodedSkillIds[i]);
msg.add<uint16_t>(std::min<int32_t>(player->getSkillLevel(skill), std::numeric_limits<uint16_t>::max()));
msg.add<uint16_t>(player->getBaseSkill(skill));
Expand Down Expand Up @@ -3553,7 +3550,7 @@ void ProtocolGame::sendCyclopediaCharacterCombatStats() {
msg.addByte(CYCLOPEDIA_CHARACTERINFO_COMBATSTATS);
msg.addByte(0x00);
for (uint8_t i = SKILL_CRITICAL_HIT_CHANCE; i <= SKILL_LAST; ++i) {
if (!oldProtocol && (i == SKILL_LIFE_LEECH_CHANCE || i == SKILL_MANA_LEECH_CHANCE)) {
if (i == SKILL_LIFE_LEECH_CHANCE || i == SKILL_MANA_LEECH_CHANCE) {
continue;
}
skills_t skill = static_cast<skills_t>(i);
Expand All @@ -3579,7 +3576,7 @@ void ProtocolGame::sendCyclopediaCharacterCombatStats() {
msg.add<uint16_t>(static_cast<uint16_t>(player->getReflectFlat(COMBAT_PHYSICALDAMAGE)));

uint8_t haveBlesses = 0;
uint8_t blessings = 8;
const uint8_t blessings = 8;
for (uint8_t i = 1; i < blessings; ++i) {
if (player->hasBlessing(i)) {
++haveBlesses;
Expand Down

0 comments on commit 2df3d44

Please sign in to comment.