mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
Changes to ReputationMgr::SetReputation that makes grouped reputation gains possible. Fixes ie. Alliance Vanguard/Horde Expedition rep, and correctly gives 25% of the earned rep to your home city to the other major cities of your faction.
Note: there will need to be some DB changes to creature_onkill_reputation to cover the grouped rep gains in some cases. --HG-- branch : trunk
This commit is contained in:
@@ -232,20 +232,74 @@ void ReputationMgr::Initilize()
|
||||
|
||||
bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental)
|
||||
{
|
||||
SimpleFactionsList const* flist = GetFactionTeamList(factionEntry->ID);
|
||||
if (flist)
|
||||
// Determines whether or not the faction is part of a team or the leader of a team.
|
||||
bool isTeamMember = false;
|
||||
|
||||
// Return variable for the function
|
||||
bool res = false;
|
||||
|
||||
SimpleFactionsList const* flist = GetFactionTeamList(factionEntry->ID, isTeamMember);
|
||||
// Determines whether reputation should be sent to team parent or other team members.
|
||||
int8 extraTarget = (isTeamMember || !flist ? -1 : 0); // 0 = Give equal amount of reputation to anyone in the team (unhandled cases).
|
||||
|
||||
/* When gaining reputation with some factions, you receive a reputation increase
|
||||
towards other reputations for that group.
|
||||
*/
|
||||
uint32 team = factionEntry->team;
|
||||
|
||||
int32 sharedStanding = standing; // Here we decide what the amount is to send to the others of the group.
|
||||
switch(team)
|
||||
{
|
||||
bool res = false;
|
||||
for (SimpleFactionsList::const_iterator itr = flist->begin();itr != flist->end();++itr)
|
||||
{
|
||||
FactionEntry const *factionEntryCalc = sFactionStore.LookupEntry(*itr);
|
||||
if(factionEntryCalc)
|
||||
res = SetOneFactionReputation(factionEntryCalc, standing, incremental);
|
||||
}
|
||||
return res;
|
||||
case HORDE: // When earning reputation with home city factions, 25% of the earned reputation
|
||||
case ALLIANCE: // is added to others of your alliance. (http://www.wowwiki.com/Reputation)
|
||||
sharedStanding *= 0.25f;
|
||||
extraTarget = 1;
|
||||
break;
|
||||
case 1037: // Alliance Vanguard
|
||||
case 1052: // Horde Expedition
|
||||
sharedStanding *= 0.5f; // Half of the reputation earned by any of the four subfactions of this team will
|
||||
extraTarget = 2; // be added to the main faction. (http://www.wowwiki.com/Alliance_Vanguard)
|
||||
break;
|
||||
}
|
||||
else
|
||||
return SetOneFactionReputation(factionEntry, standing, incremental);
|
||||
|
||||
FactionEntry const *targetFaction = NULL;
|
||||
switch(extraTarget)
|
||||
{
|
||||
case 0: // To entire team
|
||||
{
|
||||
for (SimpleFactionsList::const_iterator itr = flist->begin(); itr != flist->end(); ++itr)
|
||||
{
|
||||
targetFaction = sFactionStore.LookupEntry(*itr);
|
||||
ASSERT(targetFaction != NULL);
|
||||
res = SetOneFactionReputation(targetFaction, sharedStanding, incremental);
|
||||
}
|
||||
return res;
|
||||
}break;
|
||||
case 1: // To other team members
|
||||
{
|
||||
for (SimpleFactionsList::const_iterator itr = flist->begin(); itr != flist->end(); ++itr)
|
||||
{
|
||||
if((*itr) == factionEntry->ID) // Not to self
|
||||
continue;
|
||||
|
||||
targetFaction = sFactionStore.LookupEntry(*itr);
|
||||
ASSERT(targetFaction != NULL);
|
||||
res = SetOneFactionReputation(targetFaction, sharedStanding, incremental);
|
||||
}
|
||||
}break;
|
||||
case 2: // Extra rep to team parent.
|
||||
{
|
||||
targetFaction = sFactionStore.LookupEntry(team);
|
||||
ASSERT(targetFaction != NULL);
|
||||
res = SetOneFactionReputation(targetFaction, sharedStanding, incremental);
|
||||
}
|
||||
break;
|
||||
default: // -1 Default case, 1 faction
|
||||
return SetOneFactionReputation(factionEntry, standing, incremental);
|
||||
break;
|
||||
}
|
||||
|
||||
return (SetOneFactionReputation(factionEntry, standing, incremental) && res);
|
||||
}
|
||||
|
||||
bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental)
|
||||
|
||||
Reference in New Issue
Block a user