Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
ReputationMgr.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "DatabaseEnv.h"
7#include "DBCStores.h"
8#include "ObjectMgr.h"
9#include "Opcodes.h"
10#include "Player.h"
11#include "ReputationMgr.h"
12#include "ScriptMgr.h"
13#include "World.h"
14#include "WorldPacket.h"
15#include "WorldSession.h"
16
17const int32 ReputationMgr::PointsInRank[MAX_REPUTATION_RANK] = { 36000, 3000, 3000, 3000, 6000, 12000, 21000, 1000 };
18
20{
21 int32 limit = Reputation_Cap + 1;
22 for (int i = MAX_REPUTATION_RANK - 1; i >= MIN_REPUTATION_RANK; --i)
23 {
24 limit -= PointsInRank[i];
25 if (standing >= limit)
26 return ReputationRank(i);
27 }
29}
30
31bool ReputationMgr::IsAtWar(uint32 faction_id) const
32{
33 FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id);
34
35 if (!factionEntry)
36 {
37 SF_LOG_ERROR("misc", "ReputationMgr::IsAtWar: Can't get AtWar flag of %s for unknown faction (faction id) #%u.", _player->GetName().c_str(), faction_id);
38 return 0;
39 }
40
41 return IsAtWar(factionEntry);
42}
43
44bool ReputationMgr::IsAtWar(FactionEntry const* factionEntry) const
45{
46 if (!factionEntry)
47 return false;
48
49 if (FactionState const* factionState = GetState(factionEntry))
50 return (factionState->Flags & FACTION_FLAG_AT_WAR);
51 return false;
52}
53
55{
56 FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id);
57
58 if (!factionEntry)
59 {
60 SF_LOG_ERROR("misc", "ReputationMgr::GetReputation: Can't get reputation of %s for unknown faction (faction id) #%u.", _player->GetName().c_str(), faction_id);
61 return 0;
62 }
63
64 return GetReputation(factionEntry);
65}
66
68{
69 if (!factionEntry)
70 return 0;
71
72 uint32 raceMask = _player->getRaceMask();
73 uint32 classMask = _player->getClassMask();
74 for (int i = 0; i < 4; i++)
75 {
76 if ((factionEntry->BaseRepRaceMask[i] & raceMask ||
77 (factionEntry->BaseRepRaceMask[i] == 0 &&
78 factionEntry->BaseRepClassMask[i] != 0)) &&
79 (factionEntry->BaseRepClassMask[i] & classMask ||
80 factionEntry->BaseRepClassMask[i] == 0))
81
82 return factionEntry->BaseRepValue[i];
83 }
84
85 // in faction.dbc exist factions with (RepListId >=0, listed in character reputation list) with all BaseRepRaceMask[i] == 0
86 return 0;
87}
88
90{
91 // Faction without recorded reputation. Just ignore.
92 if (!factionEntry)
93 return 0;
94
95 if (FactionState const* state = GetState(factionEntry))
96 return GetBaseReputation(factionEntry) + state->Standing;
97
98 return 0;
99}
100
102{
103 int32 reputation = GetReputation(factionEntry);
104 return ReputationToRank(reputation);
105}
106
108{
109 int32 reputation = GetBaseReputation(factionEntry);
110 return ReputationToRank(reputation);
111}
112
114{
115 if (apply)
116 _forcedReactions[faction_id] = rank;
117 else
118 _forcedReactions.erase(faction_id);
119}
120
122{
123 if (!factionEntry)
124 return 0;
125
126 uint32 raceMask = _player->getRaceMask();
127 uint32 classMask = _player->getClassMask();
128 for (int i = 0; i < 4; i++)
129 {
130 if ((factionEntry->BaseRepRaceMask[i] & raceMask ||
131 (factionEntry->BaseRepRaceMask[i] == 0 &&
132 factionEntry->BaseRepClassMask[i] != 0)) &&
133 (factionEntry->BaseRepClassMask[i] & classMask ||
134 factionEntry->BaseRepClassMask[i] == 0))
135
136 return factionEntry->ReputationFlags[i];
137 }
138 return 0;
139}
140
142{
143 WorldPacket data(SMSG_SET_FORCED_REACTIONS, 1 + _forcedReactions.size() * (4 + 4));
144 data.WriteBits(_forcedReactions.size(), 6);
145 data.FlushBits();
146
147 for (ForcedReactions::const_iterator itr = _forcedReactions.begin(); itr != _forcedReactions.end(); ++itr)
148 {
149 data << uint32(itr->first); // faction_id (Faction.dbc)
150 data << uint32(itr->second); // reputation rank
151 }
152
153 _player->SendDirectMessage(&data);
154}
155
157{
158 uint32 count = 1;
159
160 WorldPacket data(SMSG_SET_FACTION_STANDING, 4 + 4 + 3 + 4 + 4);
161 size_t countPos = data.bitwpos();
162
164 data.WriteBits(count, 21);
165 data.FlushBits();
166
167 _sendFactionIncreased = false; // Reset
168
169 data << uint32(faction->Standing);
170 data << uint32(faction->ReputationListID);
171
172 for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
173 {
174 if (itr->second.needSend)
175 {
176 itr->second.needSend = false;
177 if (itr->second.ReputationListID != faction->ReputationListID)
178 {
179 data << uint32(itr->second.ReputationListID);
180 data << uint32(itr->second.Standing);
181 ++count;
182 }
183 }
184 }
185
186 // RaF data
187 data << float(0);
188 data << float(0);
189
190 data.PutBits(countPos, count, 21);
191 _player->SendDirectMessage(&data);
192}
193
195{
196 uint16 count = 256;
197 RepListID a = 0;
198 ByteBuffer bitData;
199
200 WorldPacket data(SMSG_INITIALIZE_FACTIONS, (count * (1 + 4)) + 32);
201
202 for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
203 {
204 // fill in absent fields
205 for (; a != itr->first; ++a)
206 {
207 data << uint8(0);
208 data << uint32(0);
209 bitData.WriteBit(0);
210 }
211
212 // fill in encountered data
213 data << uint8(itr->second.Flags);
214 data << uint32(itr->second.Standing);
215
216 // Bonus reputation (Your account has unlocked bonus reputation gain with this faction.)
217 bitData.WriteBit(0);
218
219 itr->second.needSend = false;
220
221 ++a;
222 }
223
224 // fill in absent fields
225 for (; a != count; ++a)
226 {
227 data << uint8(0);
228 data << uint32(0);
229 bitData.WriteBit(0);
230 }
231
232 bitData.FlushBits();
233 data.append(bitData);
234
235 _player->SendDirectMessage(&data);
236}
237
239{
240 for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
241 SendState(&(itr->second));
242}
243
244void ReputationMgr::SendVisible(FactionState const* faction) const
245{
246 if (_player->GetSession()->PlayerLoading())
247 return;
248
249 // make faction visible in reputation list at client
251 data << faction->ReputationListID;
252 _player->SendDirectMessage(&data);
253}
254
256{
257 _factions.clear();
262 _sendFactionIncreased = false;
263
264 for (unsigned int i = 1; i < sFactionStore.GetNumRows(); i++)
265 {
266 FactionEntry const* factionEntry = sFactionStore.LookupEntry(i);
267
268 if (factionEntry && (factionEntry->reputationListID >= 0))
269 {
270 FactionState newFaction;
271 newFaction.ID = factionEntry->ID;
272 newFaction.ReputationListID = factionEntry->reputationListID;
273 newFaction.Standing = 0;
274 newFaction.Flags = GetDefaultStateFlags(factionEntry);
275 newFaction.needSend = true;
276 newFaction.needSave = true;
277
278 if (newFaction.Flags & FACTION_FLAG_VISIBLE)
280
282
283 _factions[newFaction.ReputationListID] = newFaction;
284 }
285 }
286}
287
288bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental)
289{
290 sScriptMgr->OnPlayerReputationChange(_player, factionEntry->ID, standing, incremental);
291 bool res = false;
292 // if spillover definition exists in DB, override DBC
293 if (const RepSpilloverTemplate* repTemplate = sObjectMgr->GetRepSpilloverTemplate(factionEntry->ID))
294 {
295 for (uint32 i = 0; i < MAX_SPILLOVER_FACTIONS; ++i)
296 {
297 if (repTemplate->faction[i])
298 {
299 if (_player->GetReputationRank(repTemplate->faction[i]) <= ReputationRank(repTemplate->faction_rank[i]))
300 {
301 // bonuses are already given, so just modify standing by rate
302 int32 spilloverRep = int32(standing * repTemplate->faction_rate[i]);
303 SetOneFactionReputation(sFactionStore.LookupEntry(repTemplate->faction[i]), spilloverRep, incremental);
304 }
305 }
306 }
307 }
308 else
309 {
310 float spillOverRepOut = float(standing);
311 // check for sub-factions that receive spillover
312 SimpleFactionsList const* flist = GetFactionTeamList(factionEntry->ID);
313 // if has no sub-factions, check for factions with same parent
314 if (!flist && factionEntry->team && factionEntry->spilloverRateOut != 0.0f)
315 {
316 spillOverRepOut *= factionEntry->spilloverRateOut;
317 if (FactionEntry const* parent = sFactionStore.LookupEntry(factionEntry->team))
318 {
319 FactionStateList::iterator parentState = _factions.find(parent->reputationListID);
320 // some team factions have own reputation standing, in this case do not spill to other sub-factions
321 if (parentState != _factions.end() && (parentState->second.Flags & FACTION_FLAG_SPECIAL))
322 {
323 SetOneFactionReputation(parent, int32(spillOverRepOut), incremental);
324 }
325 else // spill to "sister" factions
326 {
327 flist = GetFactionTeamList(factionEntry->team);
328 }
329 }
330 }
331 if (flist)
332 {
333 // Spillover to affiliated factions
334 for (SimpleFactionsList::const_iterator itr = flist->begin(); itr != flist->end(); ++itr)
335 {
336 if (FactionEntry const* factionEntryCalc = sFactionStore.LookupEntry(*itr))
337 {
338 if (factionEntryCalc == factionEntry || GetRank(factionEntryCalc) > ReputationRank(factionEntryCalc->spilloverMaxRankIn))
339 continue;
340 int32 spilloverRep = int32(spillOverRepOut * factionEntryCalc->spilloverRateIn);
341 if (spilloverRep != 0 || !incremental)
342 res = SetOneFactionReputation(factionEntryCalc, spilloverRep, incremental);
343 }
344 }
345 }
346 }
347
348 // spillover done, update faction itself
349 FactionStateList::iterator faction = _factions.find(factionEntry->reputationListID);
350 if (faction != _factions.end())
351 {
352 res = SetOneFactionReputation(factionEntry, standing, incremental);
353 // only this faction gets reported to client, even if it has no own visible standing
354 SendState(&faction->second);
355 }
356 return res;
357}
358
359bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental)
360{
361 FactionStateList::iterator itr = _factions.find(factionEntry->reputationListID);
362 if (itr != _factions.end())
363 {
364 int32 BaseRep = GetBaseReputation(factionEntry);
365
366 if (incremental)
367 {
368 // int32 *= float cause one point loss?
369 standing = int32(floor(((float)standing * sWorld->getRate(Rates::RATE_REPUTATION_GAIN) + 0.5f) * GetLFGBonus(factionEntry)));
370 standing += itr->second.Standing + BaseRep;
371 }
372
373 if (standing > Reputation_Cap)
374 standing = Reputation_Cap;
375 else if (standing < Reputation_Bottom)
376 standing = Reputation_Bottom;
377
378 ReputationRank old_rank = ReputationToRank(itr->second.Standing + BaseRep);
379 ReputationRank new_rank = ReputationToRank(standing);
380
381 itr->second.Standing = standing - BaseRep;
382 itr->second.needSend = true;
383 itr->second.needSave = true;
384
385 SetVisible(&itr->second);
386
387 if (new_rank <= REP_HOSTILE)
388 SetAtWar(&itr->second, true);
389
390 if (new_rank > old_rank)
392
393 UpdateRankCounters(old_rank, new_rank);
394
395 _player->ReputationChanged(factionEntry);
396 _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS, factionEntry->ID);
397 _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION, factionEntry->ID);
398 _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION, factionEntry->ID);
399 _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION, factionEntry->ID);
400 _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION, factionEntry->ID);
401
402 return true;
403 }
404 return false;
405}
406
407void ReputationMgr::SetVisible(FactionTemplateEntry const* factionTemplateEntry)
408{
409 if (!factionTemplateEntry->faction)
410 return;
411
412 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
413 // Never show factions of the opposing team
414 if (!(factionEntry->BaseRepRaceMask[1] & _player->getRaceMask() && factionEntry->BaseRepValue[1] == Reputation_Bottom))
415 SetVisible(factionEntry);
416}
417
419{
420 if (factionEntry->reputationListID < 0)
421 return;
422
423 FactionStateList::iterator itr = _factions.find(factionEntry->reputationListID);
424 if (itr == _factions.end())
425 return;
426
427 SetVisible(&itr->second);
428}
429
431{
432 // always invisible or hidden faction can't be make visible
433 // except if faction has FACTION_FLAG_SPECIAL
435 return;
436
437 // already set
438 if (faction->Flags & FACTION_FLAG_VISIBLE)
439 return;
440
441 faction->Flags |= FACTION_FLAG_VISIBLE;
442 faction->needSend = true;
443 faction->needSave = true;
444
446
447 SendVisible(faction);
448}
449
451{
452 FactionStateList::iterator itr = _factions.find(FactionIndexID);
453 if (itr == _factions.end())
454 return;
455
456 // always invisible or hidden faction can't change war state
457 if (itr->second.Flags & (FACTION_FLAG_INVISIBLE_FORCED | FACTION_FLAG_HIDDEN))
458 return;
459
460 SetAtWar(&itr->second, true);
461}
462
464{
465 FactionStateList::iterator itr = _factions.find(FactionIndexID);
466 if (itr == _factions.end())
467 return;
468
469 // always invisible or hidden faction can't change war state
470 if (itr->second.Flags & (FACTION_FLAG_INVISIBLE_FORCED | FACTION_FLAG_HIDDEN))
471 return;
472
473 SetAtWar(&itr->second, false);
474}
475
476void ReputationMgr::SetAtWar(FactionState* faction, bool atWar) const
477{
478 // not allow declare war to own faction
479 if (atWar && (faction->Flags & FACTION_FLAG_PEACE_FORCED))
480 return;
481
482 // already set
483 if (((faction->Flags & FACTION_FLAG_AT_WAR) != 0) == atWar)
484 return;
485
486 if (atWar)
487 faction->Flags |= FACTION_FLAG_AT_WAR;
488 else
489 faction->Flags &= ~FACTION_FLAG_AT_WAR;
490
491 faction->needSend = true;
492 faction->needSave = true;
493}
494
495
496
498{
499 FactionStateList::iterator itr = _factions.find(FactionIndex);
500 if (itr == _factions.end())
501 return;
502
503 SetInactive(&itr->second, Status);
504}
505
506void ReputationMgr::SetInactive(FactionState* faction, bool inactive) const
507{
508 // always invisible or hidden faction can't be inactive
509 if (inactive && ((faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED | FACTION_FLAG_HIDDEN)) || !(faction->Flags & FACTION_FLAG_VISIBLE)))
510 return;
511
512 // already set
513 if (((faction->Flags & FACTION_FLAG_INACTIVE) != 0) == inactive)
514 return;
515
516 if (inactive)
517 faction->Flags |= FACTION_FLAG_INACTIVE;
518 else
519 faction->Flags &= ~FACTION_FLAG_INACTIVE;
520
521 faction->needSend = true;
522 faction->needSave = true;
523}
524
526{
527 // Set initial reputations (so everything is nifty before DB data load)
528 Initialize();
529
530 //QueryResult* result = CharacterDatabase.PQuery("SELECT faction, standing, flags FROM character_reputation WHERE guid = '%u'", GetGUIDLow());
531
532 if (result)
533 {
534 do
535 {
536 Field* fields = result->Fetch();
537
538 FactionEntry const* factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt16());
539 if (factionEntry && (factionEntry->reputationListID >= 0))
540 {
541 FactionState* faction = &_factions[factionEntry->reputationListID];
542
543 // update standing to current
544 faction->Standing = fields[1].GetInt32();
545
546 // update counters
547 int32 BaseRep = GetBaseReputation(factionEntry);
548 ReputationRank old_rank = ReputationToRank(BaseRep);
549 ReputationRank new_rank = ReputationToRank(BaseRep + faction->Standing);
550 UpdateRankCounters(old_rank, new_rank);
551
552 uint32 dbFactionFlags = fields[2].GetUInt16();
553
554 if (dbFactionFlags & FACTION_FLAG_VISIBLE)
555 SetVisible(faction); // have internal checks for forced invisibility
556
557 if (dbFactionFlags & FACTION_FLAG_INACTIVE)
558 SetInactive(faction, true); // have internal checks for visibility requirement
559
560 if (dbFactionFlags & FACTION_FLAG_AT_WAR) // DB at war
561 SetAtWar(faction, true); // have internal checks for FACTION_FLAG_PEACE_FORCED
562 else // DB not at war
563 {
564 // allow remove if visible (and then not FACTION_FLAG_INVISIBLE_FORCED or FACTION_FLAG_HIDDEN)
565 if (faction->Flags & FACTION_FLAG_VISIBLE)
566 SetAtWar(faction, false); // have internal checks for FACTION_FLAG_PEACE_FORCED
567 }
568
569 // set atWar for hostile
570 if (GetRank(factionEntry) <= REP_HOSTILE)
571 SetAtWar(faction, true);
572
573 // reset changed flag if values similar to saved in DB
574 if (faction->Flags == dbFactionFlags)
575 {
576 faction->needSend = false;
577 faction->needSave = false;
578 }
579 }
580 } while (result->NextRow());
581 }
582}
583
585{
586 for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
587 {
588 if (itr->second.needSave)
589 {
591 stmt->setUInt32(0, _player->GetGUIDLow());
592 stmt->setUInt16(1, uint16(itr->second.ID));
593 trans->Append(stmt);
594
595 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_REPUTATION_BY_FACTION);
596 stmt->setUInt32(0, _player->GetGUIDLow());
597 stmt->setUInt16(1, uint16(itr->second.ID));
598 stmt->setInt32(2, itr->second.Standing);
599 stmt->setUInt16(3, uint16(itr->second.Flags));
600 trans->Append(stmt);
601
602 itr->second.needSave = false;
603 }
604 }
605}
606
608{
609 if (old_rank >= REP_EXALTED)
611 if (old_rank >= REP_REVERED)
613 if (old_rank >= REP_HONORED)
615
616 if (new_rank >= REP_EXALTED)
618 if (new_rank >= REP_REVERED)
620 if (new_rank >= REP_HONORED)
622}
623
624float ReputationMgr::GetLFGBonus(FactionEntry const* factionEntry)
625{
626 if (factionEntry && (factionEntry->ID == _player->GetUInt32Value(PLAYER_FIELD_LFG_BONUS_FACTION_ID)))
627 return sWorld->getRate(Rates::RATE_REPUTATION_LFG_BONUS) * 2.0f;
628
630}
@ CHAR_INS_CHAR_REPUTATION_BY_FACTION
@ CHAR_DEL_CHAR_REPUTATION_BY_FACTION
@ ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION
Definition DBCEnums.h:212
@ ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION
Definition DBCEnums.h:248
@ ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION
Definition DBCEnums.h:211
@ ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS
Definition DBCEnums.h:250
@ ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION
Definition DBCEnums.h:249
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
SimpleFactionsList const * GetFactionTeamList(uint32 faction)
std::list< uint32 > SimpleFactionsList
Definition DBCStores.h:15
std::int32_t int32
Definition Define.h:73
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
std::uint16_t uint16
Definition Define.h:78
#define SF_LOG_ERROR(filterType__,...)
Definition Log.h:143
#define sObjectMgr
Definition ObjectMgr.h:1617
Skyfire::AutoPtr< PreparedResultSet, Skyfire::Mutex > PreparedQueryResult
Definition QueryResult.h:94
uint8 FactionIndex
uint32 RepListID
@ FACTION_FLAG_INACTIVE
@ FACTION_FLAG_PEACE_FORCED
@ FACTION_FLAG_INVISIBLE_FORCED
@ FACTION_FLAG_HIDDEN
@ FACTION_FLAG_VISIBLE
@ FACTION_FLAG_AT_WAR
@ FACTION_FLAG_SPECIAL
#define sScriptMgr
Definition ScriptMgr.h:764
#define MAX_REPUTATION_RANK
#define MIN_REPUTATION_RANK
ReputationRank
@ REP_EXALTED
@ REP_HONORED
@ REP_REVERED
@ REP_HOSTILE
#define MAX_SPILLOVER_FACTIONS
Skyfire::AutoPtr< Transaction, Skyfire::Mutex > SQLTransaction
Definition Transaction.h:42
@ PLAYER_FIELD_LFG_BONUS_FACTION_ID
bool WriteBit(uint32 bit)
Definition ByteBuffer.h:164
size_t bitwpos() const
Returns position of last written bit.
Definition ByteBuffer.h:492
void append(T value)
Definition ByteBuffer.h:147
void PutBits(size_t pos, T value, uint32 bitCount)
Definition ByteBuffer.h:283
void WriteBits(T value, size_t bits)
Definition ByteBuffer.h:192
void FlushBits()
Definition ByteBuffer.h:154
Definition Field.h:16
uint16 GetUInt16() const
Definition Field.h:69
int32 GetInt32() const
Definition Field.h:123
void setUInt16(const uint8 index, const uint16 value)
void setUInt32(const uint8 index, const uint32 value)
void setInt32(const uint8 index, const int32 value)
uint8 _honoredFactionCount
ReputationRank GetBaseRank(FactionEntry const *factionEntry) const
float GetLFGBonus(FactionEntry const *factionEntry)
void SetVisible(FactionTemplateEntry const *factionTemplateEntry)
int32 GetBaseReputation(FactionEntry const *factionEntry) const
uint8 _visibleFactionCount
void SendVisible(FactionState const *faction) const
static const int32 PointsInRank[MAX_REPUTATION_RANK]
void SetAtWar(FactionIndex FactionIndexID)
void SendState(FactionState const *faction)
int32 GetReputation(uint32 faction_id) const
uint32 GetDefaultStateFlags(FactionEntry const *factionEntry) const
void SaveToDB(SQLTransaction &trans)
bool SetReputation(FactionEntry const *factionEntry, int32 standing)
void ApplyForceReaction(uint32 faction_id, ReputationRank rank, bool apply)
ReputationRank GetRank(FactionEntry const *factionEntry) const
void SendInitialReputations()
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
void SetNotAtWar(FactionIndex FactionIndexID)
void SendForceReactions()
static ReputationRank ReputationToRank(int32 standing)
void UpdateRankCounters(ReputationRank old_rank, ReputationRank new_rank)
static const int32 Reputation_Cap
void LoadFromDB(PreparedQueryResult result)
void SetInactive(RepListID repListID, bool on)
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition Main.cpp:41
@ SMSG_SET_FACTION_VISIBLE
Definition Opcodes.h:953
@ SMSG_SET_FACTION_STANDING
Definition Opcodes.h:952
@ SMSG_INITIALIZE_FACTIONS
Definition Opcodes.h:719
@ SMSG_SET_FORCED_REACTIONS
Definition Opcodes.h:955
#define sWorld
Definition World.h:910
@ RATE_REPUTATION_GAIN
Definition World.h:402
@ RATE_REPUTATION_LFG_BONUS
Definition World.h:403
uint32 ID
int32 BaseRepValue[4]
uint32 team
float spilloverRateOut
uint32 BaseRepRaceMask[4]
uint32 ReputationFlags[4]
uint32 BaseRepClassMask[4]
int32 reputationListID
RepListID ReputationListID
uint32 faction