AzerothCore 3.3.5a
OpenSource WoW Emulator
|
#include "ReputationMgr.h"
Public Member Functions | |
ReputationMgr (Player *owner) | |
~ReputationMgr () | |
void | SaveToDB (CharacterDatabaseTransaction trans) |
void | LoadFromDB (PreparedQueryResult result) |
uint8 | GetVisibleFactionCount () const |
uint8 | GetHonoredFactionCount () const |
uint8 | GetReveredFactionCount () const |
uint8 | GetExaltedFactionCount () const |
FactionStateList const & | GetStateList () const |
FactionState const * | GetState (FactionEntry const *factionEntry) const |
FactionState const * | GetState (RepListID id) const |
bool | IsAtWar (uint32 faction_id) const |
bool | IsAtWar (FactionEntry const *factionEntry) const |
int32 | GetReputation (uint32 faction_id) const |
int32 | GetReputation (FactionEntry const *factionEntry) const |
int32 | GetBaseReputation (FactionEntry const *factionEntry) const |
ReputationRank | GetRank (FactionEntry const *factionEntry) const |
ReputationRank | GetBaseRank (FactionEntry const *factionEntry) const |
uint32 | GetReputationRankStrIndex (FactionEntry const *factionEntry) const |
ReputationRank const * | GetForcedRankIfAny (FactionTemplateEntry const *factionTemplateEntry) const |
bool | SetReputation (FactionEntry const *factionEntry, float standing) |
bool | ModifyReputation (FactionEntry const *factionEntry, float standing, bool noSpillOver=false, Optional< ReputationRank > repMaxCap={}) |
void | SetVisible (FactionTemplateEntry const *factionTemplateEntry) |
void | SetVisible (FactionEntry const *factionEntry) |
void | SetAtWar (RepListID repListID, bool on) |
void | SetInactive (RepListID repListID, bool on) |
void | ApplyForceReaction (uint32 faction_id, ReputationRank rank, bool apply) |
bool | SetOneFactionReputation (FactionEntry const *factionEntry, float standing, bool incremental, Optional< ReputationRank > repMaxCap={ }) |
Public for chat command needs. More... | |
void | SendInitialReputations () |
void | SendForceReactions () |
void | SendState (FactionState const *faction) |
void | SendStates () |
Static Public Member Functions | |
static ReputationRank | ReputationToRank (int32 standing) |
static int32 | ReputationRankToStanding (ReputationRank rank) |
Static Public Attributes | |
static const int32 | PointsInRank [MAX_REPUTATION_RANK] = {36000, 3000, 3000, 3000, 6000, 12000, 21000, 1000} |
static const int32 | Reputation_Cap = 42999 |
static const int32 | Reputation_Bottom = -42000 |
Private Member Functions | |
void | Initialize () |
uint32 | GetDefaultStateFlags (FactionEntry const *factionEntry) const |
bool | SetReputation (FactionEntry const *factionEntry, float standing, bool incremental, bool noSpillOver=false, Optional< ReputationRank > repMaxCap={ }) |
void | SetVisible (FactionState *faction) |
void | SetAtWar (FactionState *faction, bool atWar) const |
void | SetInactive (FactionState *faction, bool inactive) const |
void | SendVisible (FactionState const *faction) const |
void | UpdateRankCounters (ReputationRank old_rank, ReputationRank new_rank) |
Private Attributes | |
Player * | _player |
FactionStateList | _factions |
ForcedReactions | _forcedReactions |
uint8 | _visibleFactionCount: 8 |
uint8 | _honoredFactionCount: 8 |
uint8 | _reveredFactionCount: 8 |
uint8 | _exaltedFactionCount: 8 |
bool | _sendFactionIncreased |
|
inlineexplicit |
|
inline |
void ReputationMgr::ApplyForceReaction | ( | uint32 | faction_id, |
ReputationRank | rank, | ||
bool | apply | ||
) |
References _forcedReactions.
Referenced by AuraEffect::HandleForceReaction().
ReputationRank ReputationMgr::GetBaseRank | ( | FactionEntry const * | factionEntry | ) | const |
References GetBaseReputation(), and ReputationToRank().
Referenced by Initialize().
int32 ReputationMgr::GetBaseReputation | ( | FactionEntry const * | factionEntry | ) | const |
References _player, FactionEntry::BaseRepClassMask, FactionEntry::BaseRepRaceMask, FactionEntry::BaseRepValue, Unit::getClassMask(), and Unit::getRaceMask().
Referenced by GetBaseRank(), GetReputation(), LoadFromDB(), and SetOneFactionReputation().
|
private |
References _player, FactionEntry::BaseRepClassMask, FactionEntry::BaseRepRaceMask, Unit::getClassMask(), Unit::getRaceMask(), and FactionEntry::ReputationFlags.
Referenced by Initialize().
|
inline |
References _exaltedFactionCount.
|
inline |
References _forcedReactions, and FactionTemplateEntry::faction.
Referenced by Unit::_IsValidAttackTarget(), and Unit::GetReactionTo().
|
inline |
References _honoredFactionCount.
ReputationRank ReputationMgr::GetRank | ( | FactionEntry const * | factionEntry | ) | const |
References GetReputation(), and ReputationToRank().
Referenced by Player::GetReputationRank(), GetReputationRankStrIndex(), character_commandscript::HandleCharacterReputationCommand(), LoadFromDB(), and SetReputation().
int32 ReputationMgr::GetReputation | ( | FactionEntry const * | factionEntry | ) | const |
References GetBaseReputation(), and GetState().
References _player, WorldObject::GetName(), GetReputation(), LOG_ERROR, and sFactionStore.
Referenced by GetRank(), GetReputation(), Player::GetReputation(), character_commandscript::HandleCharacterReputationCommand(), spell_gen_oracle_wolvar_reputation::HandleDummy(), lookup_commandscript::HandleLookupFactionCommand(), modify_commandscript::HandleModifyRepCommand(), and AchievementMgr::UpdateAchievementCriteria().
|
inline |
References GetRank(), and ReputationRankStrIndex.
Referenced by lookup_commandscript::HandleLookupFactionCommand().
|
inline |
References _reveredFactionCount.
|
inline |
References FactionEntry::CanHaveReputation(), GetState(), and FactionEntry::reputationListID.
Referenced by Unit::_IsValidAttackTarget(), GetReputation(), GetState(), lookup_commandscript::HandleLookupFactionCommand(), modify_commandscript::HandleModifyRepCommand(), and IsAtWar().
|
inline |
References _factions.
|
inline |
|
inline |
References _visibleFactionCount.
|
private |
References _exaltedFactionCount, _factions, _honoredFactionCount, _reveredFactionCount, _sendFactionIncreased, _visibleFactionCount, FACTION_FLAG_VISIBLE, FactionState::Flags, GetBaseRank(), GetDefaultStateFlags(), FactionState::ID, FactionEntry::ID, FactionState::needSave, FactionState::needSend, REP_HOSTILE, FactionState::ReputationListID, FactionEntry::reputationListID, FactionState::roundedUp, sFactionStore, FactionState::Standing, and UpdateRankCounters().
Referenced by LoadFromDB().
bool ReputationMgr::IsAtWar | ( | FactionEntry const * | factionEntry | ) | const |
References FACTION_FLAG_AT_WAR, and GetState().
bool ReputationMgr::IsAtWar | ( | uint32 | faction_id | ) | const |
References _player, WorldObject::GetName(), IsAtWar(), LOG_ERROR, and sFactionStore.
Referenced by Unit::GetReactionTo(), and IsAtWar().
void ReputationMgr::LoadFromDB | ( | PreparedQueryResult | result | ) |
References _factions, FACTION_FLAG_AT_WAR, FACTION_FLAG_HIDDEN, FACTION_FLAG_INACTIVE, FACTION_FLAG_VISIBLE, FactionState::Flags, Field::Get(), GetBaseReputation(), GetRank(), Initialize(), FactionState::needSave, FactionState::needSend, REP_HOSTILE, REP_NEUTRAL, FactionEntry::reputationListID, ReputationToRank(), FactionState::roundedUp, SetAtWar(), SetInactive(), SetVisible(), sFactionStore, FactionState::Standing, and UpdateRankCounters().
Referenced by Player::LoadFromDB().
|
inline |
Referenced by Spell::EffectReputation(), OutdoorPvPSI::HandleAreaTrigger(), and Player::RewardReputation().
|
static |
References MIN_REPUTATION_RANK, PointsInRank, and Reputation_Bottom.
Referenced by SetOneFactionReputation().
|
static |
References MAX_REPUTATION_RANK, MIN_REPUTATION_RANK, PointsInRank, and Reputation_Cap.
Referenced by GetBaseRank(), GetRank(), LoadFromDB(), and SetOneFactionReputation().
void ReputationMgr::SaveToDB | ( | CharacterDatabaseTransaction | trans | ) |
References _factions, _player, CHAR_DEL_CHAR_REPUTATION_BY_FACTION, CHAR_INS_CHAR_REPUTATION_BY_FACTION, CharacterDatabase, ObjectGuid::GetCounter(), Object::GetGUID(), and PreparedStatementBase::SetData().
Referenced by Player::SaveToDB().
void ReputationMgr::SendForceReactions | ( | ) |
References _forcedReactions, _player, WorldPacket::Initialize(), Player::SendDirectMessage(), and SMSG_SET_FORCED_REACTIONS.
Referenced by AuraEffect::HandleForceReaction(), and Player::SendInitialPacketsBeforeAddToMap().
void ReputationMgr::SendInitialReputations | ( | ) |
References _factions, _player, Player::SendDirectMessage(), and SMSG_INITIALIZE_FACTIONS.
Referenced by Player::SendInitialPacketsBeforeAddToMap().
void ReputationMgr::SendState | ( | FactionState const * | faction | ) |
References _factions, _player, _sendFactionIncreased, ByteBuffer::put(), FactionState::ReputationListID, Player::SendDirectMessage(), SMSG_SET_FACTION_STANDING, FactionState::Standing, and ByteBuffer::wpos().
Referenced by modify_commandscript::HandleModifyRepCommand(), SendStates(), and SetReputation().
void ReputationMgr::SendStates | ( | ) |
References _factions, and SendState().
Referenced by WorldSession::HandlePlayerLoginFromDB(), and WorldSession::HandleSetFactionCheat().
|
private |
References _player, Player::GetSession(), WorldSession::PlayerLoading(), FactionState::ReputationListID, Player::SendDirectMessage(), and SMSG_SET_FACTION_VISIBLE.
Referenced by SetVisible().
|
private |
References FACTION_FLAG_AT_WAR, FACTION_FLAG_PEACE_FORCED, FactionState::Flags, FactionState::needSave, and FactionState::needSend.
void ReputationMgr::SetAtWar | ( | RepListID | repListID, |
bool | on | ||
) |
References _factions, FACTION_FLAG_HIDDEN, FACTION_FLAG_INVISIBLE_FORCED, and SetAtWar().
Referenced by WorldSession::HandleSetFactionAtWar(), LoadFromDB(), SetAtWar(), and SetOneFactionReputation().
|
private |
References FACTION_FLAG_HIDDEN, FACTION_FLAG_INACTIVE, FACTION_FLAG_INVISIBLE_FORCED, FACTION_FLAG_VISIBLE, FactionState::Flags, FactionState::needSave, and FactionState::needSend.
void ReputationMgr::SetInactive | ( | RepListID | repListID, |
bool | on | ||
) |
References _factions, and SetInactive().
Referenced by WorldSession::HandleSetFactionInactiveOpcode(), LoadFromDB(), and SetInactive().
bool ReputationMgr::SetOneFactionReputation | ( | FactionEntry const * | factionEntry, |
float | standing, | ||
bool | incremental, | ||
Optional< ReputationRank > | repMaxCap = { } |
||
) |
Public for chat command needs.
References _factions, _player, _sendFactionIncreased, ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION, ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION, ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION, ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION, ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS, GetBaseReputation(), FactionEntry::ID, RATE_REPUTATION_GAIN, REP_HOSTILE, Reputation_Bottom, Reputation_Cap, Player::ReputationChanged(), FactionEntry::reputationListID, ReputationRankToStanding(), ReputationToRank(), SetAtWar(), SetVisible(), sScriptMgr, sWorld, Player::UpdateAchievementCriteria(), and UpdateRankCounters().
Referenced by modify_commandscript::HandleModifyRepCommand(), WorldSession::HandlePlayerLoginFromDB(), and SetReputation().
|
inline |
References SetReputation().
Referenced by spell_gen_oracle_wolvar_reputation::HandleDummy(), SetReputation(), and Player::SetReputation().
|
private |
References _factions, _player, FACTION_FLAG_SPECIAL, GetFactionTeamList(), GetRank(), Player::GetReputationRank(), FactionEntry::ID, MAX_SPILLOVER_FACTIONS, FactionEntry::reputationListID, SendState(), SetOneFactionReputation(), sFactionStore, sObjectMgr, FactionEntry::spilloverRateOut, and FactionEntry::team.
void ReputationMgr::SetVisible | ( | FactionEntry const * | factionEntry | ) |
References _factions, FactionEntry::reputationListID, and SetVisible().
|
private |
References _visibleFactionCount, FACTION_FLAG_HIDDEN, FACTION_FLAG_INVISIBLE_FORCED, FACTION_FLAG_SPECIAL, FACTION_FLAG_VISIBLE, FactionState::Flags, FactionState::needSave, FactionState::needSend, and SendVisible().
void ReputationMgr::SetVisible | ( | FactionTemplateEntry const * | factionTemplateEntry | ) |
References _player, FactionTemplateEntry::faction, Unit::getRaceMask(), Reputation_Bottom, SetVisible(), and sFactionStore.
Referenced by Player::AddQuest(), WorldSession::HandleGossipHelloOpcode(), LoadFromDB(), SetOneFactionReputation(), and SetVisible().
|
private |
References _exaltedFactionCount, _honoredFactionCount, _reveredFactionCount, REP_EXALTED, REP_HONORED, and REP_REVERED.
Referenced by Initialize(), LoadFromDB(), and SetOneFactionReputation().
|
private |
Referenced by GetExaltedFactionCount(), Initialize(), and UpdateRankCounters().
|
private |
|
private |
Referenced by ApplyForceReaction(), GetForcedRankIfAny(), and SendForceReactions().
|
private |
Referenced by GetHonoredFactionCount(), Initialize(), and UpdateRankCounters().
|
private |
|
private |
Referenced by GetReveredFactionCount(), Initialize(), and UpdateRankCounters().
|
private |
Referenced by Initialize(), SendState(), and SetOneFactionReputation().
|
private |
Referenced by GetVisibleFactionCount(), Initialize(), and SetVisible().
|
static |
Referenced by modify_commandscript::HandleModifyRepCommand(), ReputationRankToStanding(), and ReputationToRank().
|
static |
Referenced by ReputationRankToStanding(), SetOneFactionReputation(), and SetVisible().
|
static |
Referenced by ObjectMgr::LoadQuests(), ReputationToRank(), and SetOneFactionReputation().