TrinityCore
Loading...
Searching...
No Matches
ReputationMgr.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ReputationMgr.h"
19#include "DBCStores.h"
20#include "DatabaseEnv.h"
21#include "Log.h"
22#include "MapUtils.h"
23#include "ObjectMgr.h"
24#include "Player.h"
25#include "ReputationPackets.h"
26#include "ScriptMgr.h"
27#include "World.h"
28#include "WorldPacket.h"
29#include "WorldSession.h"
30
36
37std::set<int32> const ReputationMgr::ReputationRankThresholds =
38{
39 -42000,
40 // Hated
41 -6000,
42 // Hostile
43 -3000,
44 // Unfriendly
45 0,
46 // Neutral
47 3000,
48 // Friendly
49 9000,
50 // Honored
51 21000,
52 // Revered
53 42000,
54 // Exalted
55 43000
56};
57
60
62{
63 auto itr = ReputationRankThresholds.begin();
64 auto end = ReputationRankThresholds.end();
65 int32 rank = -1;
66 while (itr != end && standing >= *itr)
67 {
68 ++rank;
69 ++itr;
70 }
71
72 return ReputationRank(rank);
73}
74
75FactionState const* ReputationMgr::GetState(FactionEntry const* factionEntry) const
76{
77 return factionEntry->CanHaveReputation() ? GetState(factionEntry->ReputationIndex) : nullptr;
78}
79
80bool ReputationMgr::IsAtWar(uint32 faction_id) const
81{
82 FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id);
83
84 if (!factionEntry)
85 {
86 TC_LOG_ERROR("misc", "ReputationMgr::IsAtWar: Can't get AtWar flag of {} for unknown faction (faction id) #{}.", _player->GetName(), faction_id);
87 return 0;
88 }
89
90 return IsAtWar(factionEntry);
91}
92
93bool ReputationMgr::IsAtWar(FactionEntry const* factionEntry) const
94{
95 if (!factionEntry)
96 return false;
97
98 if (FactionState const* factionState = GetState(factionEntry))
99 return factionState->Flags.HasFlag(ReputationFlags::AtWar);
100 return false;
101}
102
104{
105 // @hack some quests give reputation to Alliance-only AND Horde-only factions, but DBC data does not allow to identify faction-only reputations
106 if (team == TEAM_HORDE && (
107 factionId == 1037 || // Alliance Vanguard
108 factionId == 946)) // Honor Hold
109 return false;
110
111 if (team == TEAM_ALLIANCE &&
112 factionId == 947) // Thrallmar
113 return false;
114
115 return true;
116}
117
119{
120 FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id);
121
122 if (!factionEntry)
123 {
124 TC_LOG_ERROR("misc", "ReputationMgr::GetReputation: Can't get reputation of {} for unknown faction (faction id) #{}.", _player->GetName(), faction_id);
125 return 0;
126 }
127
128 return GetReputation(factionEntry);
129}
130
132{
133 int32 dataIndex = GetFactionDataIndexForRaceAndClass(factionEntry);
134 if (dataIndex < 0)
135 return 0;
136
137 return factionEntry->ReputationBase[dataIndex];
138}
139
141{
142 return Reputation_Bottom;
143}
144
146{
147 return Reputation_Cap;
148}
149
151{
152 // Faction without recorded reputation. Just ignore.
153 if (!factionEntry)
154 return 0;
155
156 if (FactionState const* state = GetState(factionEntry))
157 return GetBaseReputation(factionEntry) + state->Standing;
158
159 return 0;
160}
161
163{
164 int32 reputation = GetReputation(factionEntry);
165 return ReputationToRank(factionEntry, reputation);
166}
167
169{
170 int32 reputation = GetBaseReputation(factionEntry);
171 return ReputationToRank(factionEntry, reputation);
172}
173
174std::string ReputationMgr::GetReputationRankName(FactionEntry const* factionEntry) const
175{
176 ReputationRank rank = GetRank(factionEntry);
177 return sObjectMgr->GetTrinityString(ReputationRankStrIndex[rank], _player->GetSession()->GetSessionDbcLocale());
178}
179
181{
182 return GetForcedRankIfAny(factionTemplateEntry->Faction);
183}
184
189
191{
192 if (apply)
193 _forcedReactions[faction_id] = rank;
194 else
195 _forcedReactions.erase(faction_id);
196}
197
199{
200 int32 dataIndex = GetFactionDataIndexForRaceAndClass(factionEntry);
201 if (dataIndex < 0)
203
204 return static_cast<ReputationFlags>(factionEntry->ReputationFlags[dataIndex]);
205}
206
208{
209 WorldPacket data;
211 data << uint32(_forcedReactions.size());
212 for (ForcedReactions::const_iterator itr = _forcedReactions.begin(); itr != _forcedReactions.end(); ++itr)
213 {
214 data << uint32(itr->first); // faction_id (Faction.dbc)
215 data << uint32(itr->second); // reputation rank
216 }
218}
219
221{
222 uint32 count = faction ? 1 : 0;
223
225 data << float(0);
227 _sendFactionIncreased = false; // Reset
228
229 size_t p_count = data.wpos();
230 data << uint32(count);
231
232 if (faction)
233 {
234 data << uint32(faction->ReputationListID);
235 data << uint32(faction->Standing);
236 }
237
238 for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
239 {
240 if (itr->second.needSend)
241 {
242 itr->second.needSend = false;
243 if (!faction || itr->second.ReputationListID != faction->ReputationListID)
244 {
245 data << uint32(itr->second.ReputationListID);
246 data << uint32(itr->second.Standing);
247 ++count;
248 }
249 }
250 }
251
252 data.put<uint32>(p_count, count);
254}
255
257{
259
260 for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
261 {
262 WorldPackets::Reputation::FactionData& factionData = initFactions.Factions[itr->first];
263 factionData.Flags = itr->second.Flags.AsUnderlyingType();
264 factionData.Standing = itr->second.Standing;
265 itr->second.needSend = false;
266 }
267
268 _player->SendDirectMessage(initFactions.Write());
269}
270
271void ReputationMgr::SendVisible(FactionState const* faction) const
272{
274 return;
275
276 // make faction visible in reputation list at client
278 data << faction->ReputationListID;
280}
281
283{
284 _factions.clear();
289 _sendFactionIncreased = false;
290
291 for (unsigned int i = 1; i < sFactionStore.GetNumRows(); i++)
292 {
293 FactionEntry const* factionEntry = sFactionStore.LookupEntry(i);
294
295 if (factionEntry && factionEntry->CanHaveReputation())
296 {
297 FactionState newFaction;
298 newFaction.ID = factionEntry->ID;
299 newFaction.ReputationListID = factionEntry->ReputationIndex;
300 newFaction.Standing = 0;
301 newFaction.Flags = GetDefaultStateFlags(factionEntry);
302 newFaction.needSend = true;
303 newFaction.needSave = true;
304
305 if (newFaction.Flags.HasFlag(ReputationFlags::Visible))
307
309
310 _factions[newFaction.ReputationListID] = newFaction;
311 }
312 }
313}
314
315bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental, bool spillOverOnly)
316{
317 sScriptMgr->OnPlayerReputationChange(_player, factionEntry->ID, standing, incremental);
318 bool res = false;
319 // if spillover definition exists in DB, override DBC
320 if (RepSpilloverTemplate const* repTemplate = sObjectMgr->GetRepSpilloverTemplate(factionEntry->ID))
321 {
322 for (uint32 i = 0; i < MAX_SPILLOVER_FACTIONS; ++i)
323 {
324 if (repTemplate->faction[i])
325 {
326 if (_player->GetReputationRank(repTemplate->faction[i]) <= ReputationRank(repTemplate->faction_rank[i]))
327 {
328 // bonuses are already given, so just modify standing by rate
329 int32 spilloverRep = int32(standing * repTemplate->faction_rate[i]);
330 SetOneFactionReputation(sFactionStore.AssertEntry(repTemplate->faction[i]), spilloverRep, incremental);
331 }
332 }
333 }
334 }
335 else
336 {
337 float spillOverRepOut = float(standing);
338 // check for sub-factions that receive spillover
339 SimpleFactionsList const* flist = GetFactionTeamList(factionEntry->ID);
340 // if has no sub-factions, check for factions with same parent
341 if (!flist && factionEntry->ParentFactionID && factionEntry->ParentFactionMod[1] != 0.0f)
342 {
343 spillOverRepOut *= factionEntry->ParentFactionMod[1];
344 if (FactionEntry const* parent = sFactionStore.LookupEntry(factionEntry->ParentFactionID))
345 {
346 FactionStateList::iterator parentState = _factions.find(parent->ReputationIndex);
347 // some team factions have own reputation standing, in this case do not spill to other sub-factions
348 if (parentState != _factions.end() && parentState->second.Flags.HasFlag(ReputationFlags::HeaderShowsBar))
349 {
350 SetOneFactionReputation(parent, int32(spillOverRepOut), incremental);
351 }
352 else // spill to "sister" factions
353 {
354 flist = GetFactionTeamList(factionEntry->ParentFactionID);
355 }
356 }
357 }
358 if (flist)
359 {
360 // Spillover to affiliated factions
361 for (SimpleFactionsList::const_iterator itr = flist->begin(); itr != flist->end(); ++itr)
362 {
363 if (FactionEntry const* factionEntryCalc = sFactionStore.LookupEntry(*itr))
364 {
365 if (factionEntryCalc == factionEntry || GetRank(factionEntryCalc) > ReputationRank(factionEntryCalc->ParentFactionCap[0]))
366 continue;
367 int32 spilloverRep = int32(spillOverRepOut * factionEntryCalc->ParentFactionMod[0]);
368 if (spilloverRep != 0 || !incremental)
369 res = SetOneFactionReputation(factionEntryCalc, spilloverRep, incremental);
370 }
371 }
372 }
373 }
374
375 // spillover done, update faction itself
376 FactionStateList::iterator faction = _factions.find(factionEntry->ReputationIndex);
377 if (faction != _factions.end())
378 {
379 // if we update spillover only, do not update main reputation (rank exceeds creature reward rate)
380 if (!spillOverOnly)
381 res = SetOneFactionReputation(factionEntry, standing, incremental);
382
383 // only this faction gets reported to client, even if it has no own visible standing
384 SendState(&faction->second);
385 }
386 return res;
387}
388
389bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental)
390{
391 FactionStateList::iterator itr = _factions.find(factionEntry->ReputationIndex);
392 if (itr != _factions.end())
393 {
394 int32 BaseRep = GetBaseReputation(factionEntry);
395
396 if (incremental)
397 {
398 // int32 *= float cause one point loss?
399 standing = int32(floor((float)standing * sWorld->getRate(RATE_REPUTATION_GAIN) + 0.5f));
400 standing += itr->second.Standing + BaseRep;
401 }
402
403 if (standing > GetMaxReputation(factionEntry))
404 standing = GetMaxReputation(factionEntry);
405 else if (standing < GetMinReputation(factionEntry))
406 standing = GetMinReputation(factionEntry);
407
408 ReputationRank old_rank = ReputationToRank(factionEntry, itr->second.Standing + BaseRep);
409 ReputationRank new_rank = ReputationToRank(factionEntry, standing);
410
411 itr->second.Standing = standing - BaseRep;
412 itr->second.needSend = true;
413 itr->second.needSave = true;
414
415 SetVisible(&itr->second);
416
417 if (new_rank <= REP_HOSTILE)
418 SetAtWar(&itr->second, true);
419 else if (new_rank > old_rank)
420 SetAtWar(&itr->second, false);
421
422 if (new_rank > old_rank)
424
425 UpdateRankCounters(old_rank, new_rank);
426
427 _player->ReputationChanged(factionEntry);
433
434 return true;
435 }
436 return false;
437}
438
439void ReputationMgr::SetVisible(FactionTemplateEntry const*factionTemplateEntry)
440{
441 if (!factionTemplateEntry->Faction)
442 return;
443
444 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->Faction))
445 // Never show factions of the opposing team
446 if (!(factionEntry->ReputationRaceMask[1] & _player->GetRaceMask() && factionEntry->ReputationBase[1] == Reputation_Bottom))
447 SetVisible(factionEntry);
448}
449
451{
452 if (!factionEntry->CanHaveReputation())
453 return;
454
455 FactionStateList::iterator itr = _factions.find(factionEntry->ReputationIndex);
456 if (itr == _factions.end())
457 return;
458
459 SetVisible(&itr->second);
460}
461
463{
464 // always invisible or hidden faction can't be make visible
466 return;
467
469 return;
470
471 // already set
473 return;
474
476 faction->needSend = true;
477 faction->needSave = true;
478
480
481 SendVisible(faction);
482}
483
484void ReputationMgr::SetAtWar(RepListID repListID, bool on)
485{
486 FactionStateList::iterator itr = _factions.find(repListID);
487 if (itr == _factions.end())
488 return;
489
490 // always invisible or hidden faction can't change war state
491 if (itr->second.Flags.HasFlag(ReputationFlags::Hidden | ReputationFlags::Header))
492 return;
493
494 SetAtWar(&itr->second, on);
495}
496
497void ReputationMgr::SetAtWar(FactionState* faction, bool atWar) const
498{
499 // Do not allow to declare war to our own faction. But allow for rival factions (eg Aldor vs Scryer).
500 if (atWar && faction->Flags.HasFlag(ReputationFlags::Peaceful) && GetRank(sFactionStore.AssertEntry(faction->ID)) > REP_HATED)
501 return;
502
503 // already set
504 if (faction->Flags.HasFlag(ReputationFlags::AtWar) == atWar)
505 return;
506
507 if (atWar)
508 faction->Flags |= ReputationFlags::AtWar;
509 else
510 faction->Flags &= ~ReputationFlags::AtWar;
511
512 faction->needSend = true;
513 faction->needSave = true;
514}
515
516void ReputationMgr::SetInactive(RepListID repListID, bool on)
517{
518 FactionStateList::iterator itr = _factions.find(repListID);
519 if (itr == _factions.end())
520 return;
521
522 SetInactive(&itr->second, on);
523}
524
525void ReputationMgr::SetInactive(FactionState* faction, bool inactive) const
526{
527 // always invisible or hidden faction can't be inactive
529 return;
530
531 // already set
532 if (faction->Flags.HasFlag(ReputationFlags::Inactive) == inactive)
533 return;
534
535 if (inactive)
537 else
539
540 faction->needSend = true;
541 faction->needSave = true;
542}
543
545{
546 // Set initial reputations (so everything is nifty before DB data load)
547 Initialize();
548
549 //QueryResult* result = CharacterDatabase.PQuery("SELECT faction, standing, flags FROM character_reputation WHERE guid = '{}'", GetGUID().GetCounter());
550
551 if (result)
552 {
553 do
554 {
555 Field* fields = result->Fetch();
556
557 FactionEntry const* factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt16());
558 if (factionEntry && factionEntry->CanHaveReputation())
559 {
560 FactionState* faction = &_factions[factionEntry->ReputationIndex];
561
562 // update standing to current
563 faction->Standing = fields[1].GetInt32();
564
565 // update counters
566 int32 BaseRep = GetBaseReputation(factionEntry);
567 ReputationRank old_rank = ReputationToRank(factionEntry, BaseRep);
568 ReputationRank new_rank = ReputationToRank(factionEntry, BaseRep + faction->Standing);
569 UpdateRankCounters(old_rank, new_rank);
570
571 EnumFlag<ReputationFlags> dbFactionFlags = static_cast<ReputationFlags>(fields[2].GetUInt16());
572
573 if (dbFactionFlags.HasFlag(ReputationFlags::Visible))
574 SetVisible(faction); // have internal checks for forced invisibility
575
576 if (dbFactionFlags.HasFlag(ReputationFlags::Inactive))
577 SetInactive(faction, true); // have internal checks for visibility requirement
578
579 if (dbFactionFlags.HasFlag(ReputationFlags::AtWar)) // DB at war
580 SetAtWar(faction, true); // have internal checks for ReputationFlags::Peaceful
581 else // DB not at war
582 {
583 // allow remove if visible (and then not FACTION_FLAG_INVISIBLE_FORCED or FACTION_FLAG_HIDDEN)
585 SetAtWar(faction, false); // have internal checks for ReputationFlags::Peaceful
586 }
587
588 // set atWar for hostile
589 if (GetRank(factionEntry) <= REP_HOSTILE)
590 SetAtWar(faction, true);
591
592 // reset changed flag if values similar to saved in DB
593 if (faction->Flags == dbFactionFlags)
594 {
595 faction->needSend = false;
596 faction->needSave = false;
597 }
598 }
599 }
600 while (result->NextRow());
601 }
602}
603
605{
606 for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
607 {
608 if (itr->second.needSave)
609 {
611 stmt->setUInt32(0, _player->GetGUID().GetCounter());
612 stmt->setUInt16(1, uint16(itr->second.ID));
613 trans->Append(stmt);
614
615 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_REPUTATION_BY_FACTION);
616 stmt->setUInt32(0, _player->GetGUID().GetCounter());
617 stmt->setUInt16(1, uint16(itr->second.ID));
618 stmt->setInt32(2, itr->second.Standing);
619 stmt->setUInt16(3, itr->second.Flags.AsUnderlyingType());
620 trans->Append(stmt);
621
622 itr->second.needSave = false;
623 }
624 }
625}
626
628{
629 if (old_rank >= REP_EXALTED)
631 if (old_rank >= REP_REVERED)
633 if (old_rank >= REP_HONORED)
635
636 if (new_rank >= REP_EXALTED)
638 if (new_rank >= REP_REVERED)
640 if (new_rank >= REP_HONORED)
642}
643
645{
646 if (!factionEntry)
647 return -1;
648
649 uint32 raceMask = _player->GetRaceMask();
650 uint32 classMask = _player->GetClassMask();
651 for (int32 i = 0; i < 4; i++)
652 {
653 if ((factionEntry->ReputationRaceMask[i] & raceMask || (!factionEntry->ReputationRaceMask[i] && factionEntry->ReputationClassMask[i] != 0))
654 && (factionEntry->ReputationClassMask[i] & classMask || factionEntry->ReputationClassMask[i] == 0))
655
656 return i;
657 }
658
659 return -1;
660}
@ CHAR_INS_CHAR_REPUTATION_BY_FACTION
@ CHAR_DEL_CHAR_REPUTATION_BY_FACTION
@ ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION
Definition DBCEnums.h:173
@ ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION
Definition DBCEnums.h:208
@ ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION
Definition DBCEnums.h:172
@ ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS
Definition DBCEnums.h:210
@ ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION
Definition DBCEnums.h:209
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
SimpleFactionsList const * GetFactionTeamList(uint32 faction)
std::list< uint32 > SimpleFactionsList
Definition DBCStores.h:36
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint16_t uint16
Definition Define.h:134
uint32_t uint32
Definition Define.h:133
@ LANG_REP_FRIENDLY
Definition Language.h:377
@ LANG_REP_HONORED
Definition Language.h:378
@ LANG_REP_NEUTRAL
Definition Language.h:376
@ LANG_REP_REVERED
Definition Language.h:379
@ LANG_REP_HOSTILE
Definition Language.h:374
@ LANG_REP_HATED
Definition Language.h:373
@ LANG_REP_EXALTED
Definition Language.h:380
@ LANG_REP_UNFRIENDLY
Definition Language.h:375
#define TC_LOG_ERROR(filterType__,...)
Definition Log.h:165
#define sObjectMgr
Definition ObjectMgr.h:1721
uint32 const ReputationRankStrIndex[MAX_REPUTATION_RANK]
uint32 RepListID
TC_GAME_API uint32 const ReputationRankStrIndex[MAX_REPUTATION_RANK]
ReputationFlags
#define sScriptMgr
Definition ScriptMgr.h:1168
#define MAX_REPUTATION_RANK
TeamId
@ TEAM_ALLIANCE
@ TEAM_HORDE
ReputationRank
@ REP_HATED
@ REP_EXALTED
@ REP_HONORED
@ REP_REVERED
@ REP_HOSTILE
#define MAX_SPILLOVER_FACTIONS
size_t wpos() const
Definition ByteBuffer.h:325
void put(std::size_t pos, T value)
Definition ByteBuffer.h:141
constexpr bool HasFlag(T flag) const
Definition EnumFlag.h:106
Class used to access individual fields of database query result.
Definition Field.h:92
uint16 GetUInt16() const
Definition Field.cpp:45
int32 GetInt32() const
Definition Field.cpp:69
LowType GetCounter() const
Definition ObjectGuid.h:156
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
void ReputationChanged(FactionEntry const *factionEntry)
Definition Player.cpp:16412
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:6163
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, WorldObject *ref=nullptr)
Definition Player.cpp:24914
WorldSession * GetSession() const
Definition Player.h:1705
ReputationRank GetReputationRank(uint32 faction_id) const
Definition Player.cpp:6305
void setUInt16(uint8 index, uint16 value)
void setUInt32(uint8 index, uint32 value)
void setInt32(uint8 index, int32 value)
std::string GetReputationRankName(FactionEntry const *factionEntry) const
uint8 _honoredFactionCount
ReputationRank GetBaseRank(FactionEntry const *factionEntry) const
int32 GetFactionDataIndexForRaceAndClass(FactionEntry const *factionEntry) const
void SetVisible(FactionTemplateEntry const *factionTemplateEntry)
int32 GetBaseReputation(FactionEntry const *factionEntry) const
int32 GetMaxReputation(FactionEntry const *factionEntry) const
uint8 _visibleFactionCount
void SendVisible(FactionState const *faction) const
ReputationFlags GetDefaultStateFlags(FactionEntry const *factionEntry) const
void SetAtWar(RepListID repListID, bool on)
void SendState(FactionState const *faction)
int32 GetReputation(uint32 faction_id) const
bool SetReputation(FactionEntry const *factionEntry, int32 standing)
void ApplyForceReaction(uint32 faction_id, ReputationRank rank, bool apply)
ReputationRank GetRank(FactionEntry const *factionEntry) const
int32 GetMinReputation(FactionEntry const *factionEntry) const
void SendInitialReputations()
static ReputationRank ReputationToRank(FactionEntry const *factionEntry, int32 standing)
uint8 _exaltedFactionCount
FactionState const * GetState(FactionEntry const *factionEntry) const
uint8 _reveredFactionCount
FactionStateList _factions
ForcedReactions _forcedReactions
static const int32 Reputation_Bottom
bool IsAtWar(uint32 faction_id) const
bool SetOneFactionReputation(FactionEntry const *factionEntry, int32 standing, bool incremental)
Public for chat command needs.
bool _sendFactionIncreased
static std::set< int32 > const ReputationRankThresholds
void SendForceReactions()
void UpdateRankCounters(ReputationRank old_rank, ReputationRank new_rank)
static const int32 Reputation_Cap
bool IsReputationAllowedForTeam(TeamId team, uint32 factionId) const
void LoadFromDB(PreparedQueryResult result)
ReputationRank const * GetForcedRankIfAny(FactionTemplateEntry const *factionTemplateEntry) const
void SetInactive(RepListID repListID, bool on)
void SaveToDB(CharacterDatabaseTransaction trans)
uint32 GetRaceMask() const
Definition Unit.h:908
uint32 GetClassMask() const
Definition Unit.h:911
std::string const & GetName() const
Definition Object.h:384
void Initialize(uint16 opcode, size_t newres=200)
Definition WorldPacket.h:51
std::array< FactionData, FactionCount > Factions
LocaleConstant GetSessionDbcLocale() const
bool PlayerLoading() const
@ SMSG_SET_FACTION_VISIBLE
Definition Opcodes.h:320
@ SMSG_SET_FACTION_STANDING
Definition Opcodes.h:321
@ SMSG_SET_FORCED_REACTIONS
Definition Opcodes.h:706
#define sWorld
Definition World.h:901
@ RATE_REPUTATION_GAIN
Definition World.h:435
auto MapGetValuePtr(M &map, typename M::key_type const &key)
Definition MapUtils.h:29
int32 ReputationBase[4]
uint32 ReputationClassMask[4]
int32 ReputationIndex
uint32 ParentFactionID
uint32 ReputationRaceMask[4]
bool CanHaveReputation() const
float ParentFactionMod[2]
uint32 ReputationFlags[4]
RepListID ReputationListID
EnumFlag< ReputationFlags > Flags