mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[12078] Fix SMSG_SET_FACTION_STANDING
Client now correctly displays visual effect for faction rank increase. Also added comment for refer-a-friend bonus reputation field Based on patch by kaelima Thanks to TOM_RUS Signed-off-by: stfx <stfx@hotmail.de>
This commit is contained in:
parent
4bf5c3d701
commit
4a684fe630
3 changed files with 32 additions and 25 deletions
|
|
@ -120,19 +120,19 @@ void ReputationMgr::SendForceReactions()
|
||||||
m_player->SendDirectMessage(&data);
|
m_player->SendDirectMessage(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReputationMgr::SendState(FactionState const* faction)
|
void ReputationMgr::SendState(FactionState const* faction, bool anyRankIncreased)
|
||||||
{
|
{
|
||||||
uint32 count = 1;
|
uint32 count = 1;
|
||||||
|
|
||||||
WorldPacket data(SMSG_SET_FACTION_STANDING, (16)); // last check 2.4.0
|
WorldPacket data(SMSG_SET_FACTION_STANDING, 17);
|
||||||
data << (float) 0; // unk 2.4.0
|
data << float(0); // refer-a-friend bonus reputation
|
||||||
data << (uint8) 0; // wotlk 8634
|
data << uint8(anyRankIncreased ? 1 : 0); // display visual effect
|
||||||
|
|
||||||
size_t p_count = data.wpos();
|
size_t p_count = data.wpos();
|
||||||
data << (uint32) count; // placeholder
|
data << uint32(count); // placeholder
|
||||||
|
|
||||||
data << (uint32) faction->ReputationListID;
|
data << uint32(faction->ReputationListID);
|
||||||
data << (uint32) faction->Standing;
|
data << uint32(faction->Standing);
|
||||||
|
|
||||||
for (FactionStateList::iterator itr = m_factions.begin(); itr != m_factions.end(); ++itr)
|
for (FactionStateList::iterator itr = m_factions.begin(); itr != m_factions.end(); ++itr)
|
||||||
{
|
{
|
||||||
|
|
@ -141,8 +141,8 @@ void ReputationMgr::SendState(FactionState const* faction)
|
||||||
itr->second.needSend = false;
|
itr->second.needSend = false;
|
||||||
if (itr->second.ReputationListID != faction->ReputationListID)
|
if (itr->second.ReputationListID != faction->ReputationListID)
|
||||||
{
|
{
|
||||||
data << (uint32) itr->second.ReputationListID;
|
data << uint32(itr->second.ReputationListID);
|
||||||
data << (uint32) itr->second.Standing;
|
data << uint32(itr->second.Standing);
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
@ -231,9 +231,10 @@ void ReputationMgr::Initialize()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental)
|
void ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental)
|
||||||
{
|
{
|
||||||
bool res = false;
|
bool anyRankIncreased = false;
|
||||||
|
|
||||||
// if spillover definition exists in DB, override DBC
|
// if spillover definition exists in DB, override DBC
|
||||||
if (const RepSpilloverTemplate* repTemplate = sObjectMgr.GetRepSpilloverTemplate(factionEntry->ID))
|
if (const RepSpilloverTemplate* repTemplate = sObjectMgr.GetRepSpilloverTemplate(factionEntry->ID))
|
||||||
{
|
{
|
||||||
|
|
@ -245,7 +246,8 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
||||||
{
|
{
|
||||||
// bonuses are already given, so just modify standing by rate
|
// bonuses are already given, so just modify standing by rate
|
||||||
int32 spilloverRep = standing * repTemplate->faction_rate[i];
|
int32 spilloverRep = standing * repTemplate->faction_rate[i];
|
||||||
SetOneFactionReputation(sFactionStore.LookupEntry(repTemplate->faction[i]), spilloverRep, incremental);
|
if (SetOneFactionReputation(sFactionStore.LookupEntry(repTemplate->faction[i]), spilloverRep, incremental))
|
||||||
|
anyRankIncreased = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -265,7 +267,8 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
||||||
// some team factions have own reputation standing, in this case do not spill to other sub-factions
|
// some team factions have own reputation standing, in this case do not spill to other sub-factions
|
||||||
if (parentState != m_factions.end() && (parentState->second.Flags & FACTION_FLAG_TEAM_REPUTATION))
|
if (parentState != m_factions.end() && (parentState->second.Flags & FACTION_FLAG_TEAM_REPUTATION))
|
||||||
{
|
{
|
||||||
SetOneFactionReputation(parent, int32(spillOverRepOut), incremental);
|
if (SetOneFactionReputation(parent, int32(spillOverRepOut), incremental))
|
||||||
|
anyRankIncreased = true;
|
||||||
}
|
}
|
||||||
else // spill to "sister" factions
|
else // spill to "sister" factions
|
||||||
{
|
{
|
||||||
|
|
@ -282,9 +285,11 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
||||||
{
|
{
|
||||||
if (factionEntryCalc == factionEntry || GetRank(factionEntryCalc) > ReputationRank(factionEntryCalc->spilloverMaxRankIn))
|
if (factionEntryCalc == factionEntry || GetRank(factionEntryCalc) > ReputationRank(factionEntryCalc->spilloverMaxRankIn))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int32 spilloverRep = int32(spillOverRepOut * factionEntryCalc->spilloverRateIn);
|
int32 spilloverRep = int32(spillOverRepOut * factionEntryCalc->spilloverRateIn);
|
||||||
if (spilloverRep != 0 || !incremental)
|
if (spilloverRep != 0 || !incremental)
|
||||||
res = SetOneFactionReputation(factionEntryCalc, spilloverRep, incremental);
|
if (SetOneFactionReputation(factionEntryCalc, spilloverRep, incremental))
|
||||||
|
anyRankIncreased = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -293,11 +298,12 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
||||||
FactionStateList::iterator faction = m_factions.find(factionEntry->reputationListID);
|
FactionStateList::iterator faction = m_factions.find(factionEntry->reputationListID);
|
||||||
if (faction != m_factions.end())
|
if (faction != m_factions.end())
|
||||||
{
|
{
|
||||||
res = SetOneFactionReputation(factionEntry, standing, incremental);
|
if (SetOneFactionReputation(factionEntry, standing, incremental))
|
||||||
|
anyRankIncreased = true;
|
||||||
|
|
||||||
// only this faction gets reported to client, even if it has no own visible standing
|
// only this faction gets reported to client, even if it has no own visible standing
|
||||||
SendState(&faction->second);
|
SendState(&faction->second, anyRankIncreased);
|
||||||
}
|
}
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental)
|
bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental)
|
||||||
|
|
@ -336,6 +342,7 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
|
||||||
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION, factionEntry->ID);
|
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION, factionEntry->ID);
|
||||||
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION, factionEntry->ID);
|
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION, factionEntry->ID);
|
||||||
|
|
||||||
|
if (new_rank > old_rank)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -103,13 +103,13 @@ class ReputationMgr
|
||||||
}
|
}
|
||||||
|
|
||||||
public: // modifiers
|
public: // modifiers
|
||||||
bool SetReputation(FactionEntry const* factionEntry, int32 standing)
|
void SetReputation(FactionEntry const* factionEntry, int32 standing)
|
||||||
{
|
{
|
||||||
return SetReputation(factionEntry, standing, false);
|
SetReputation(factionEntry, standing, false);
|
||||||
}
|
}
|
||||||
bool ModifyReputation(FactionEntry const* factionEntry, int32 standing)
|
void ModifyReputation(FactionEntry const* factionEntry, int32 standing)
|
||||||
{
|
{
|
||||||
return SetReputation(factionEntry, standing, true);
|
SetReputation(factionEntry, standing, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetVisible(FactionTemplateEntry const* factionTemplateEntry);
|
void SetVisible(FactionTemplateEntry const* factionTemplateEntry);
|
||||||
|
|
@ -122,12 +122,12 @@ class ReputationMgr
|
||||||
public: // senders
|
public: // senders
|
||||||
void SendInitialReputations();
|
void SendInitialReputations();
|
||||||
void SendForceReactions();
|
void SendForceReactions();
|
||||||
void SendState(FactionState const* faction);
|
void SendState(FactionState const* faction, bool anyRankIncreased);
|
||||||
|
|
||||||
private: // internal helper functions
|
private: // internal helper functions
|
||||||
void Initialize();
|
void Initialize();
|
||||||
uint32 GetDefaultStateFlags(const FactionEntry* factionEntry) const;
|
uint32 GetDefaultStateFlags(const FactionEntry* factionEntry) const;
|
||||||
bool SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental);
|
void SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental);
|
||||||
bool SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental);
|
bool SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental);
|
||||||
void SetVisible(FactionState* faction);
|
void SetVisible(FactionState* faction);
|
||||||
void SetAtWar(FactionState* faction, bool atWar);
|
void SetAtWar(FactionState* faction, bool atWar);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "12077"
|
#define REVISION_NR "12078"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue