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 "DatabaseEnv.h"
20#include "DBCStores.h"
21#include "Log.h"
22#include "MapUtils.h"
23#include "ObjectMgr.h"
24#include "Player.h"
25#include "ScriptMgr.h"
26#include "World.h"
27#include "WorldPacket.h"
28#include "WorldSession.h"
29
35
36std::set<int32> const ReputationMgr::ReputationRankThresholds =
37{
38 -42000,
39 // Hated
40 -6000,
41 // Hostile
42 -3000,
43 // Unfriendly
44 0,
45 // Neutral
46 3000,
47 // Friendly
48 9000,
49 // Honored
50 21000,
51 // Revered
52 42000,
53 // Exalted
54 43000
55};
56
59
61{
62 auto itr = ReputationRankThresholds.begin();
63 auto end = ReputationRankThresholds.end();
64 int32 rank = -1;
65 while (itr != end && standing >= *itr)
66 {
67 ++rank;
68 ++itr;
69 }
70
71 return ReputationRank(rank);
72}
73
74FactionState const* ReputationMgr::GetState(FactionEntry const* factionEntry) const
75{
76 return factionEntry->CanHaveReputation() ? GetState(factionEntry->ReputationIndex) : nullptr;
77}
78
79bool ReputationMgr::IsAtWar(uint32 faction_id) const
80{
81 FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id);
82
83 if (!factionEntry)
84 {
85 TC_LOG_ERROR("misc", "ReputationMgr::IsAtWar: Can't get AtWar flag of {} for unknown faction (faction id) #{}.", _player->GetName(), faction_id);
86 return 0;
87 }
88
89 return IsAtWar(factionEntry);
90}
91
92bool ReputationMgr::IsAtWar(FactionEntry const* factionEntry) const
93{
94 if (!factionEntry)
95 return false;
96
97 if (FactionState const* factionState = GetState(factionEntry))
98 return factionState->Flags.HasFlag(ReputationFlags::AtWar);
99 return false;
100}
101
103{
104 // @hack some quests give reputation to Alliance-only AND Horde-only factions, but DBC data does not allow to identify faction-only reputations
105 if (team == TEAM_HORDE && (
106 factionId == 1037 || // Alliance Vanguard
107 factionId == 946)) // Honor Hold
108 return false;
109
110 if (team == TEAM_ALLIANCE &&
111 factionId == 947) // Thrallmar
112 return false;
113
114 return true;
115}
116
118{
119 FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id);
120
121 if (!factionEntry)
122 {
123 TC_LOG_ERROR("misc", "ReputationMgr::GetReputation: Can't get reputation of {} for unknown faction (faction id) #{}.", _player->GetName(), faction_id);
124 return 0;
125 }
126
127 return GetReputation(factionEntry);
128}
129
131{
132 int32 dataIndex = GetFactionDataIndexForRaceAndClass(factionEntry);
133 if (dataIndex < 0)
134 return 0;
135
136 return factionEntry->ReputationBase[dataIndex];
137}
138
140{
141 return Reputation_Bottom;
142}
143
145{
146 return Reputation_Cap;
147}
148
150{
151 // Faction without recorded reputation. Just ignore.
152 if (!factionEntry)
153 return 0;
154
155 if (FactionState const* state = GetState(factionEntry))
156 return GetBaseReputation(factionEntry) + state->Standing;
157
158 return 0;
159}
160
162{
163 int32 reputation = GetReputation(factionEntry);
164 return ReputationToRank(factionEntry, reputation);
165}
166
168{
169 int32 reputation = GetBaseReputation(factionEntry);
170 return ReputationToRank(factionEntry, reputation);
171}
172
173std::string ReputationMgr::GetReputationRankName(FactionEntry const* factionEntry) const
174{
175 ReputationRank rank = GetRank(factionEntry);
176 return sObjectMgr->GetTrinityString(ReputationRankStrIndex[rank], _player->GetSession()->GetSessionDbcLocale());
177}
178
180{
181 return GetForcedRankIfAny(factionTemplateEntry->Faction);
182}
183
188
190{
191 if (apply)
192 _forcedReactions[faction_id] = rank;
193 else
194 _forcedReactions.erase(faction_id);
195}
196
198{
199 int32 dataIndex = GetFactionDataIndexForRaceAndClass(factionEntry);
200 if (dataIndex < 0)
202
203 return static_cast<ReputationFlags>(factionEntry->ReputationFlags[dataIndex]);
204}
205
207{
208 WorldPacket data;
210 data << uint32(_forcedReactions.size());
211 for (ForcedReactions::const_iterator itr = _forcedReactions.begin(); itr != _forcedReactions.end(); ++itr)
212 {
213 data << uint32(itr->first); // faction_id (Faction.dbc)
214 data << uint32(itr->second); // reputation rank
215 }
217}
218
220{
221 uint32 count = faction ? 1 : 0;
222
224 data << float(0);
226 _sendFactionIncreased = false; // Reset
227
228 size_t p_count = data.wpos();
229 data << uint32(count);
230
231 if (faction)
232 {
233 data << uint32(faction->ReputationListID);
234 data << uint32(faction->Standing);
235 }
236
237 for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
238 {
239 if (itr->second.needSend)
240 {
241 itr->second.needSend = false;
242 if (!faction || itr->second.ReputationListID != faction->ReputationListID)
243 {
244 data << uint32(itr->second.ReputationListID);
245 data << uint32(itr->second.Standing);
246 ++count;
247 }
248 }
249 }
250
251 data.put<uint32>(p_count, count);
253}
254
256{
257 uint8 count = 128;
258 WorldPacket data(SMSG_INITIALIZE_FACTIONS, 4 + count * 5);
259 data << uint32(count);
260
261 RepListID a = 0;
262
263 for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
264 {
265 // fill in absent fields
266 for (; a != itr->first; ++a)
267 {
268 data << uint8(0);
269 data << uint32(0);
270 }
271
272 // fill in encountered data
273 data << uint8(itr->second.Flags.AsUnderlyingType());
274 data << uint32(itr->second.Standing);
275
276 itr->second.needSend = false;
277
278 ++a;
279 }
280
281 // fill in absent fields
282 for (; a != count; ++a)
283 {
284 data << uint8(0);
285 data << uint32(0);
286 }
287
289}
290
291void ReputationMgr::SendVisible(FactionState const* faction) const
292{
294 return;
295
296 // make faction visible in reputation list at client
298 data << faction->ReputationListID;
300}
301
303{
304 _factions.clear();
309 _sendFactionIncreased = false;
310
311 for (unsigned int i = 1; i < sFactionStore.GetNumRows(); i++)
312 {
313 FactionEntry const* factionEntry = sFactionStore.LookupEntry(i);
314
315 if (factionEntry && (factionEntry->ReputationIndex >= 0))
316 {
317 FactionState newFaction;
318 newFaction.ID = factionEntry->ID;
319 newFaction.ReputationListID = factionEntry->ReputationIndex;
320 newFaction.Standing = 0;
321 newFaction.Flags = GetDefaultStateFlags(factionEntry);
322 newFaction.needSend = true;
323 newFaction.needSave = true;
324
325 if (newFaction.Flags.HasFlag(ReputationFlags::Visible))
327
329
330 _factions[newFaction.ReputationListID] = newFaction;
331 }
332 }
333}
334
335bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental, bool spillOverOnly)
336{
337 sScriptMgr->OnPlayerReputationChange(_player, factionEntry->ID, standing, incremental);
338 bool res = false;
339 // if spillover definition exists in DB, override DBC
340 if (RepSpilloverTemplate const* repTemplate = sObjectMgr->GetRepSpilloverTemplate(factionEntry->ID))
341 {
342 for (uint32 i = 0; i < MAX_SPILLOVER_FACTIONS; ++i)
343 {
344 if (repTemplate->faction[i])
345 {
346 if (_player->GetReputationRank(repTemplate->faction[i]) <= ReputationRank(repTemplate->faction_rank[i]))
347 {
348 // bonuses are already given, so just modify standing by rate
349 int32 spilloverRep = int32(standing * repTemplate->faction_rate[i]);
350 SetOneFactionReputation(sFactionStore.AssertEntry(repTemplate->faction[i]), spilloverRep, incremental);
351 }
352 }
353 }
354 }
355 else
356 {
357 float spillOverRepOut = float(standing);
358 // check for sub-factions that receive spillover
359 SimpleFactionsList const* flist = GetFactionTeamList(factionEntry->ID);
360 // if has no sub-factions, check for factions with same parent
361 if (!flist && factionEntry->ParentFactionID && factionEntry->ParentFactionMod[1] != 0.0f)
362 {
363 spillOverRepOut *= factionEntry->ParentFactionMod[1];
364 if (FactionEntry const* parent = sFactionStore.LookupEntry(factionEntry->ParentFactionID))
365 {
366 FactionStateList::iterator parentState = _factions.find(parent->ReputationIndex);
367 // some team factions have own reputation standing, in this case do not spill to other sub-factions
368 if (parentState != _factions.end() && parentState->second.Flags.HasFlag(ReputationFlags::HeaderShowsBar))
369 {
370 SetOneFactionReputation(parent, int32(spillOverRepOut), incremental);
371 }
372 else // spill to "sister" factions
373 {
374 flist = GetFactionTeamList(factionEntry->ParentFactionID);
375 }
376 }
377 }
378 if (flist)
379 {
380 // Spillover to affiliated factions
381 for (SimpleFactionsList::const_iterator itr = flist->begin(); itr != flist->end(); ++itr)
382 {
383 if (FactionEntry const* factionEntryCalc = sFactionStore.LookupEntry(*itr))
384 {
385 if (factionEntryCalc == factionEntry || GetRank(factionEntryCalc) > ReputationRank(factionEntryCalc->ParentFactionCap[0]))
386 continue;
387 int32 spilloverRep = int32(spillOverRepOut * factionEntryCalc->ParentFactionMod[0]);
388 if (spilloverRep != 0 || !incremental)
389 res = SetOneFactionReputation(factionEntryCalc, spilloverRep, incremental);
390 }
391 }
392 }
393 }
394
395 // spillover done, update faction itself
396 FactionStateList::iterator faction = _factions.find(factionEntry->ReputationIndex);
397 if (faction != _factions.end())
398 {
399 // if we update spillover only, do not update main reputation (rank exceeds creature reward rate)
400 if (!spillOverOnly)
401 res = SetOneFactionReputation(factionEntry, standing, incremental);
402
403 // only this faction gets reported to client, even if it has no own visible standing
404 SendState(&faction->second);
405 }
406 return res;
407}
408
409bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental)
410{
411 FactionStateList::iterator itr = _factions.find(factionEntry->ReputationIndex);
412 if (itr != _factions.end())
413 {
414 int32 BaseRep = GetBaseReputation(factionEntry);
415
416 if (incremental)
417 {
418 // int32 *= float cause one point loss?
419 standing = int32(floor((float)standing * sWorld->getRate(RATE_REPUTATION_GAIN) + 0.5f));
420 standing += itr->second.Standing + BaseRep;
421 }
422
423 if (standing > GetMaxReputation(factionEntry))
424 standing = GetMaxReputation(factionEntry);
425 else if (standing < GetMinReputation(factionEntry))
426 standing = GetMinReputation(factionEntry);
427
428 ReputationRank old_rank = ReputationToRank(factionEntry, itr->second.Standing + BaseRep);
429 ReputationRank new_rank = ReputationToRank(factionEntry, standing);
430
431 itr->second.Standing = standing - BaseRep;
432 itr->second.needSend = true;
433 itr->second.needSave = true;
434
435 SetVisible(&itr->second);
436
437 if (new_rank <= REP_HOSTILE)
438 SetAtWar(&itr->second, true);
439 else if (new_rank > old_rank)
440 SetAtWar(&itr->second, false);
441
442 if (new_rank > old_rank)
444
445 UpdateRankCounters(old_rank, new_rank);
446
447 _player->ReputationChanged(factionEntry);
453
454 return true;
455 }
456 return false;
457}
458
459void ReputationMgr::SetVisible(FactionTemplateEntry const*factionTemplateEntry)
460{
461 if (!factionTemplateEntry->Faction)
462 return;
463
464 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->Faction))
465 // Never show factions of the opposing team
466 if (!(factionEntry->ReputationRaceMask[1] & _player->GetRaceMask() && factionEntry->ReputationBase[1] == Reputation_Bottom))
467 SetVisible(factionEntry);
468}
469
471{
472 if (factionEntry->ReputationIndex < 0)
473 return;
474
475 FactionStateList::iterator itr = _factions.find(factionEntry->ReputationIndex);
476 if (itr == _factions.end())
477 return;
478
479 SetVisible(&itr->second);
480}
481
483{
484 // always invisible or hidden faction can't be make visible
486 return;
487
489 return;
490
491 // already set
493 return;
494
496 faction->needSend = true;
497 faction->needSave = true;
498
500
501 SendVisible(faction);
502}
503
504void ReputationMgr::SetAtWar(RepListID repListID, bool on)
505{
506 FactionStateList::iterator itr = _factions.find(repListID);
507 if (itr == _factions.end())
508 return;
509
510 // always invisible or hidden faction can't change war state
511 if (itr->second.Flags.HasFlag(ReputationFlags::Hidden | ReputationFlags::Header))
512 return;
513
514 SetAtWar(&itr->second, on);
515}
516
517void ReputationMgr::SetAtWar(FactionState* faction, bool atWar) const
518{
519 // Do not allow to declare war to our own faction. But allow for rival factions (eg Aldor vs Scryer).
520 if (atWar && faction->Flags.HasFlag(ReputationFlags::Peaceful) && GetRank(sFactionStore.AssertEntry(faction->ID)) > REP_HATED)
521 return;
522
523 // already set
524 if (faction->Flags.HasFlag(ReputationFlags::AtWar) == atWar)
525 return;
526
527 if (atWar)
528 faction->Flags |= ReputationFlags::AtWar;
529 else
530 faction->Flags &= ~ReputationFlags::AtWar;
531
532 faction->needSend = true;
533 faction->needSave = true;
534}
535
536void ReputationMgr::SetInactive(RepListID repListID, bool on)
537{
538 FactionStateList::iterator itr = _factions.find(repListID);
539 if (itr == _factions.end())
540 return;
541
542 SetInactive(&itr->second, on);
543}
544
545void ReputationMgr::SetInactive(FactionState* faction, bool inactive) const
546{
547 // always invisible or hidden faction can't be inactive
549 return;
550
551 // already set
552 if (faction->Flags.HasFlag(ReputationFlags::Inactive) == inactive)
553 return;
554
555 if (inactive)
557 else
559
560 faction->needSend = true;
561 faction->needSave = true;
562}
563
565{
566 // Set initial reputations (so everything is nifty before DB data load)
567 Initialize();
568
569 //QueryResult* result = CharacterDatabase.PQuery("SELECT faction, standing, flags FROM character_reputation WHERE guid = '{}'", GetGUID().GetCounter());
570
571 if (result)
572 {
573 do
574 {
575 Field* fields = result->Fetch();
576
577 FactionEntry const* factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt16());
578 if (factionEntry && (factionEntry->ReputationIndex >= 0))
579 {
580 FactionState* faction = &_factions[factionEntry->ReputationIndex];
581
582 // update standing to current
583 faction->Standing = fields[1].GetInt32();
584
585 // update counters
586 int32 BaseRep = GetBaseReputation(factionEntry);
587 ReputationRank old_rank = ReputationToRank(factionEntry, BaseRep);
588 ReputationRank new_rank = ReputationToRank(factionEntry, BaseRep + faction->Standing);
589 UpdateRankCounters(old_rank, new_rank);
590
591 EnumFlag<ReputationFlags> dbFactionFlags = static_cast<ReputationFlags>(fields[2].GetUInt16());
592
593 if (dbFactionFlags.HasFlag(ReputationFlags::Visible))
594 SetVisible(faction); // have internal checks for forced invisibility
595
596 if (dbFactionFlags.HasFlag(ReputationFlags::Inactive))
597 SetInactive(faction, true); // have internal checks for visibility requirement
598
599 if (dbFactionFlags.HasFlag(ReputationFlags::AtWar)) // DB at war
600 SetAtWar(faction, true); // have internal checks for ReputationFlags::Peaceful
601 else // DB not at war
602 {
603 // allow remove if visible (and then not FACTION_FLAG_INVISIBLE_FORCED or FACTION_FLAG_HIDDEN)
605 SetAtWar(faction, false); // have internal checks for ReputationFlags::Peaceful
606 }
607
608 // set atWar for hostile
609 if (GetRank(factionEntry) <= REP_HOSTILE)
610 SetAtWar(faction, true);
611
612 // reset changed flag if values similar to saved in DB
613 if (faction->Flags == dbFactionFlags)
614 {
615 faction->needSend = false;
616 faction->needSave = false;
617 }
618 }
619 }
620 while (result->NextRow());
621 }
622}
623
625{
626 for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
627 {
628 if (itr->second.needSave)
629 {
631 stmt->setUInt32(0, _player->GetGUID().GetCounter());
632 stmt->setUInt16(1, uint16(itr->second.ID));
633 trans->Append(stmt);
634
635 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_REPUTATION_BY_FACTION);
636 stmt->setUInt32(0, _player->GetGUID().GetCounter());
637 stmt->setUInt16(1, uint16(itr->second.ID));
638 stmt->setInt32(2, itr->second.Standing);
639 stmt->setUInt16(3, itr->second.Flags.AsUnderlyingType());
640 trans->Append(stmt);
641
642 itr->second.needSave = false;
643 }
644 }
645}
646
648{
649 if (old_rank >= REP_EXALTED)
651 if (old_rank >= REP_REVERED)
653 if (old_rank >= REP_HONORED)
655
656 if (new_rank >= REP_EXALTED)
658 if (new_rank >= REP_REVERED)
660 if (new_rank >= REP_HONORED)
662}
663
665{
666 if (!factionEntry)
667 return -1;
668
669 uint32 raceMask = _player->GetRaceMask();
670 uint32 classMask = _player->GetClassMask();
671 for (int32 i = 0; i < 4; i++)
672 {
673 if ((factionEntry->ReputationRaceMask[i] & raceMask || (!factionEntry->ReputationRaceMask[i] && factionEntry->ReputationClassMask[i] != 0))
674 && (factionEntry->ReputationClassMask[i] & classMask || factionEntry->ReputationClassMask[i] == 0))
675
676 return i;
677 }
678
679 return -1;
680}
@ 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:321
void put(std::size_t pos, T value)
Definition ByteBuffer.h:137
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:16393
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:6161
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, WorldObject *ref=nullptr)
Definition Player.cpp:24940
WorldSession * GetSession() const
Definition Player.h:1719
ReputationRank GetReputationRank(uint32 faction_id) const
Definition Player.cpp:6303
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:894
uint32 GetClassMask() const
Definition Unit.h:897
std::string const & GetName() const
Definition Object.h:382
void Initialize(uint16 opcode, size_t newres=200)
Definition WorldPacket.h:73
LocaleConstant GetSessionDbcLocale() const
bool PlayerLoading() const
@ SMSG_SET_FACTION_VISIBLE
Definition Opcodes.h:320
@ SMSG_SET_FACTION_STANDING
Definition Opcodes.h:321
@ SMSG_INITIALIZE_FACTIONS
Definition Opcodes.h:319
@ SMSG_SET_FORCED_REACTIONS
Definition Opcodes.h:706
#define sWorld
Definition World.h:900
@ RATE_REPUTATION_GAIN
Definition World.h:434
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