fix(Core/Spells): pets should not dispel beneficials bufs from neutral units not being at war with pet's owner (#7230)

- Closes #6691
This commit is contained in:
UltraNix
2021-08-06 18:39:35 +02:00
committed by GitHub
parent ea76a0c2bb
commit 14ad1def8b
4 changed files with 39 additions and 14 deletions

View File

@@ -5137,7 +5137,27 @@ void Unit::GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelCharges
if (dispelMask & (1 << DISPEL_DISEASE) && HasAura(50536))
dispelMask &= ~(1 << DISPEL_DISEASE);
bool positive = IsFriendlyTo(caster);
ReputationRank rank = GetReactionTo(caster);
bool positive = rank >= REP_FRIENDLY;
// Neutral unit not at war with caster should be treated as a friendly unit
if (rank == REP_NEUTRAL)
{
if (Player* casterPlayer = caster->GetAffectingPlayer())
{
if (FactionTemplateEntry const* factionTemplateEntry = GetFactionTemplateEntry())
{
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
{
if (factionEntry->CanBeSetAtWar())
{
positive = !casterPlayer->GetReputationMgr().IsAtWar(factionEntry);
}
}
}
}
}
Unit::VisibleAuraMap const* visibleAuras = GetVisibleAuras();
for (Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr)
{

View File

@@ -20,19 +20,6 @@ static uint32 ReputationRankStrIndex[MAX_REPUTATION_RANK] =
LANG_REP_FRIENDLY, LANG_REP_HONORED, LANG_REP_REVERED, LANG_REP_EXALTED
};
enum FactionFlags
{
FACTION_FLAG_NONE = 0x00, // no faction flag
FACTION_FLAG_VISIBLE = 0x01, // makes visible in client (set or can be set at interaction with target of this faction)
FACTION_FLAG_AT_WAR = 0x02, // enable AtWar-button in client. player controlled (except opposition team always war state), Flag only set on initial creation
FACTION_FLAG_HIDDEN = 0x04, // hidden faction from reputation pane in client (player can gain reputation, but this update not sent to client)
FACTION_FLAG_INVISIBLE_FORCED = 0x08, // always overwrite FACTION_FLAG_VISIBLE and hide faction in rep.list, used for hide opposite team factions
FACTION_FLAG_PEACE_FORCED = 0x10, // always overwrite FACTION_FLAG_AT_WAR, used for prevent war with own team factions
FACTION_FLAG_INACTIVE = 0x20, // player controlled, state stored in characters.data (CMSG_SET_FACTION_INACTIVE)
FACTION_FLAG_RIVAL = 0x40, // flag for the two competing outland factions
FACTION_FLAG_SPECIAL = 0x80 // horde and alliance home cities and their northrend allies have this flag
};
typedef uint32 RepListID;
struct FactionState
{

View File

@@ -278,6 +278,19 @@ enum SpawnMask
SPAWNMASK_RAID_ALL = (SPAWNMASK_RAID_NORMAL_ALL | SPAWNMASK_RAID_HEROIC_ALL),
};
enum FactionFlags
{
FACTION_FLAG_NONE = 0x00, // no faction flag
FACTION_FLAG_VISIBLE = 0x01, // makes visible in client (set or can be set at interaction with target of this faction)
FACTION_FLAG_AT_WAR = 0x02, // enable AtWar-button in client. player controlled (except opposition team always war state), Flag only set on initial creation
FACTION_FLAG_HIDDEN = 0x04, // hidden faction from reputation pane in client (player can gain reputation, but this update not sent to client)
FACTION_FLAG_INVISIBLE_FORCED = 0x08, // always overwrite FACTION_FLAG_VISIBLE and hide faction in rep.list, used for hide opposite team factions
FACTION_FLAG_PEACE_FORCED = 0x10, // always overwrite FACTION_FLAG_AT_WAR, used for prevent war with own team factions
FACTION_FLAG_INACTIVE = 0x20, // player controlled, state stored in characters.data (CMSG_SET_FACTION_INACTIVE)
FACTION_FLAG_RIVAL = 0x40, // flag for the two competing outland factions
FACTION_FLAG_SPECIAL = 0x80 // horde and alliance home cities and their northrend allies have this flag
};
enum FactionTemplateFlags
{
FACTION_TEMPLATE_FLAG_PVP = 0x00000800, // flagged for PvP

View File

@@ -875,6 +875,11 @@ struct FactionEntry
{
return reputationListID >= 0;
}
[[nodiscard]] bool CanBeSetAtWar() const
{
return reputationListID >= 0 && BaseRepRaceMask[0] == 1791;
}
};
#define MAX_FACTION_RELATIONS 4