diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 8716aca40..89bc8bbfa 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -7560,7 +7560,7 @@ bool PlayerCondition::Meets(Player const * player) const player->GetZoneAndAreaId(zone,area); return (zone == m_value1 || area == m_value1) == (m_value2 == 0); } - case CONDITION_REPUTATION_RANK: + case CONDITION_REPUTATION_RANK_MIN: { FactionEntry const* faction = sFactionStore.LookupEntry(m_value1); return faction && player->GetReputationMgr().GetRank(faction) >= ReputationRank(m_value2); @@ -7729,6 +7729,11 @@ bool PlayerCondition::Meets(Player const * player) const return !player->HasSkill(m_value1); else return player->HasSkill(m_value1) && player->GetBaseSkillValue(m_value1) < m_value2; + case CONDITION_REPUTATION_RANK_MAX: + { + FactionEntry const* faction = sFactionStore.LookupEntry(m_value1); + return faction && player->GetReputationMgr().GetRank(faction) <= ReputationRank(m_value2); + } default: return false; } @@ -7825,7 +7830,8 @@ bool PlayerCondition::IsValid(uint16 entry, ConditionType condition, uint32 valu } break; } - case CONDITION_REPUTATION_RANK: + case CONDITION_REPUTATION_RANK_MIN: + case CONDITION_REPUTATION_RANK_MAX: { FactionEntry const* factionEntry = sFactionStore.LookupEntry(value1); if (!factionEntry) @@ -7833,6 +7839,12 @@ bool PlayerCondition::IsValid(uint16 entry, ConditionType condition, uint32 valu sLog.outErrorDb("Reputation condition (entry %u, type %u) requires to have reputation non existing faction (%u), skipped", entry, condition, value1); return false; } + + if (value2 >= MAX_REPUTATION_RANK) + { + sLog.outErrorDb("Reputation condition (entry %u, type %u) has invalid rank requirement (value2 = %u) - must be between %u and %u, skipped", entry, condition, value2, MIN_REPUTATION_RANK, MAX_REPUTATION_RANK-1); + return false; + } break; } case CONDITION_TEAM: diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 632e697a7..585cb4a40 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -345,7 +345,7 @@ enum ConditionType CONDITION_ITEM = 2, // item_id count check present req. amount items in inventory CONDITION_ITEM_EQUIPPED = 3, // item_id 0 CONDITION_AREAID = 4, // area_id 0, 1 (0: in (sub)area, 1: not in (sub)area) - CONDITION_REPUTATION_RANK = 5, // faction_id min_rank + CONDITION_REPUTATION_RANK_MIN = 5, // faction_id min_rank CONDITION_TEAM = 6, // player_team 0, (469 - Alliance 67 - Horde) CONDITION_SKILL = 7, // skill_id skill_value CONDITION_QUESTREWARDED = 8, // quest_id 0 @@ -375,6 +375,7 @@ enum ConditionType CONDITION_SKILL_BELOW = 29, // skill_id skill_value // True if player has skill skill_id and skill less than (and not equal) skill_value (for skill_value > 1) // If skill_value == 1, then true if player has not skill skill_id + CONDITION_REPUTATION_RANK_MAX = 30, // faction_id max_rank }; class PlayerCondition diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e76a4a124..898ebdb06 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "12006" + #define REVISION_NR "12007" #endif // __REVISION_NR_H__