fix(Core/Spell): PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW applies only with invisibility type INVISIBILITY_GENERAL (0) (#7863)

Co-Authored-By: Meji <2695278+meji46@users.noreply.github.com>
This commit is contained in:
Kitzunu
2021-09-18 18:09:48 +02:00
committed by GitHub
parent 606ea325a2
commit 4fb2dc1fc4
2 changed files with 57 additions and 5 deletions

View File

@@ -477,6 +477,49 @@ enum PlayerFlags
PLAYER_FLAGS_UNK31 = 0x80000000,
};
enum PlayerBytesOffsets //@todo: Implement
{
PLAYER_BYTES_OFFSET_SKIN_ID = 0,
PLAYER_BYTES_OFFSET_FACE_ID = 1,
PLAYER_BYTES_OFFSET_HAIR_STYLE_ID = 2,
PLAYER_BYTES_OFFSET_HAIR_COLOR_ID = 3
};
enum PlayerBytes2Offsets //@todo: Implement
{
PLAYER_BYTES_2_OFFSET_FACIAL_STYLE = 0,
PLAYER_BYTES_2_OFFSET_PARTY_TYPE = 1,
PLAYER_BYTES_2_OFFSET_BANK_BAG_SLOTS = 2,
PLAYER_BYTES_2_OFFSET_REST_STATE = 3
};
enum PlayerBytes3Offsets //@todo: Implement
{
PLAYER_BYTES_3_OFFSET_GENDER = 0,
PLAYER_BYTES_3_OFFSET_INEBRIATION = 1,
PLAYER_BYTES_3_OFFSET_PVP_TITLE = 2,
PLAYER_BYTES_3_OFFSET_ARENA_FACTION = 3
};
enum PlayerFieldBytesOffsets //@todo: Implement
{
PLAYER_FIELD_BYTES_OFFSET_FLAGS = 0,
PLAYER_FIELD_BYTES_OFFSET_RAF_GRANTABLE_LEVEL = 1,
PLAYER_FIELD_BYTES_OFFSET_ACTION_BAR_TOGGLES = 2,
PLAYER_FIELD_BYTES_OFFSET_LIFETIME_MAX_PVP_RANK = 3
};
enum PlayerFieldBytes2Offsets
{
PLAYER_FIELD_BYTES_2_OFFSET_OVERRIDE_SPELLS_ID = 0, // uint16!
PLAYER_FIELD_BYTES_2_OFFSET_IGNORE_POWER_REGEN_PREDICTION_MASK = 2,
PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION = 3
};
static_assert((PLAYER_FIELD_BYTES_2_OFFSET_OVERRIDE_SPELLS_ID & 1) == 0, "PLAYER_FIELD_BYTES_2_OFFSET_OVERRIDE_SPELLS_ID must be aligned to 2 byte boundary");
#define PLAYER_BYTES_2_OVERRIDE_SPELLS_UINT16_OFFSET (PLAYER_FIELD_BYTES_2_OFFSET_OVERRIDE_SPELLS_ID / 2)
#define KNOWN_TITLES_SIZE 3
#define MAX_TITLE_INDEX (KNOWN_TITLES_SIZE*64) // 3 uint64 fields

View File

@@ -1523,8 +1523,8 @@ void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode
if (apply)
{
// apply glow vision
if (target->GetTypeId() == TYPEID_PLAYER)
target->SetByteFlag(PLAYER_FIELD_BYTES2, 3, PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
if (target->GetTypeId() == TYPEID_PLAYER && type == INVISIBILITY_GENERAL)
target->SetByteFlag(PLAYER_FIELD_BYTES2, PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION, PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
target->m_invisibility.AddFlag(type);
target->m_invisibility.AddValue(type, GetAmount());
@@ -1534,7 +1534,7 @@ void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode
if (!target->HasAuraType(SPELL_AURA_MOD_INVISIBILITY))
{
// if not have different invisibility auras.
// remove glow vision
// always remove glow vision
if (target->GetTypeId() == TYPEID_PLAYER)
target->RemoveByteFlag(PLAYER_FIELD_BYTES2, 3, PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
@@ -1553,7 +1553,16 @@ void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode
}
}
if (!found)
{
// if not have invisibility auras of type INVISIBILITY_GENERAL
// remove glow vision
if (target->GetTypeId() == TYPEID_PLAYER && type == INVISIBILITY_GENERAL)
{
target->RemoveByteFlag(PLAYER_FIELD_BYTES2, PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION, PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
}
target->m_invisibility.DelFlag(type);
}
}
target->m_invisibility.AddValue(type, -GetAmount());
@@ -5725,7 +5734,7 @@ void AuraEffect::HandleAuraOverrideSpells(AuraApplication const* aurApp, uint8 m
if (apply)
{
target->SetUInt16Value(PLAYER_FIELD_BYTES2, 0, overrideId);
target->SetUInt16Value(PLAYER_FIELD_BYTES2, PLAYER_BYTES_2_OVERRIDE_SPELLS_UINT16_OFFSET, overrideId);
if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
if (uint32 spellId = overrideSpells->spellId[i])
@@ -5733,7 +5742,7 @@ void AuraEffect::HandleAuraOverrideSpells(AuraApplication const* aurApp, uint8 m
}
else
{
target->SetUInt16Value(PLAYER_FIELD_BYTES2, 0, 0);
target->SetUInt16Value(PLAYER_FIELD_BYTES2, PLAYER_BYTES_2_OVERRIDE_SPELLS_UINT16_OFFSET, 0);
if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
if (uint32 spellId = overrideSpells->spellId[i])