From 9b566abb3d8850fbb43a56760f94ef6c7213fb6a Mon Sep 17 00:00:00 2001 From: Yogurt Date: Mon, 27 May 2019 15:00:17 -0700 Subject: [PATCH] Add new HitEffect flags --- .../send/Actor/battle/CommandResult.cs | 82 +++++++-- data/scripts/hiteffect.lua | 167 ++++++++++++------ 2 files changed, 184 insertions(+), 65 deletions(-) diff --git a/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResult.cs b/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResult.cs index f5c1ac94..212a493d 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResult.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResult.cs @@ -11,13 +11,24 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle //These flags can be stacked and mixed, but the client will prioritize certain flags over others. [Flags] public enum HitEffect : uint - { - //All HitEffects have the last byte 0x8 + { + //This is used for physical attacks HitEffectType = 8 << 24, + //This is used for additioanl effect hits. Only difference from HitEffectType is that it does not play audio. + AdditionalEffectType = 24 << 24, //Status effects use 32 << 24 StatusEffectType = 32 << 24, - //Magic effects use 48 << 24 + //When losing a status effect while using a skill, this prevents the hit effect from playing on the actor playing the animation + StatusLossType = 40 << 24, + //Magic effects use 48 << 24, this is also used for when statuses are lost on attack MagicEffectType = 48 << 24, + //This places the number on the user regardless of the target this hit effect is for, used for things like bloodbath + SelfHealType = 72 << 24, + + //Each Type has it's own set of flags. These should be split into their own enums, + //but for now just keep them all under HitEffect so we don't have to change anything. + + //HitEffectType flags //Not setting RecoilLv2 or RecoilLv3 results in the weaker RecoilLv1. //These are the recoil animations that play on the target, ranging from weak to strong. @@ -61,11 +72,6 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle Shell = 1 << 7 | HitEffectType, ProtectShellSpecial = Protect | Shell, - // Required for heal text to be blue, not sure if that's all it's used for - Heal = 1 << 8, - MP = 1 << 9, //Causes "MP" text to appear when used with MagicEffectType. | with Heal to make text blue - TP = 1 << 10,//Causes "TP" text to appear when used with MagicEffectType. | with Heal to make text blue - //If only HitEffect1 is set out of the hit effects, the "Evade!" pop-up text triggers along with the evade visual. //If no hit effects are set, the "Miss!" pop-up is triggered and no hit visual is played. HitEffect1 = 1 << 9, @@ -106,17 +112,69 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle UnknownShieldEffect = HitEffect5 | HitEffect4, Stoneskin = HitEffect5 | HitEffect4 | HitEffect1, - //Unknown = 1 << 14, -- Not sure what this flag does; might be another HitEffect. - //A special effect when performing appropriate skill combos in succession. //Ex: Thunder (SkillCombo1 Effect) -> Thundara (SkillCombo2 Effect) -> Thundaga (SkillCombo3 Effect) //Special Note: SkillCombo4 was never actually used in 1.0 since combos only chained up to 3 times maximum. SkillCombo1 = 1 << 15, SkillCombo2 = 1 << 16, SkillCombo3 = SkillCombo1 | SkillCombo2, - SkillCombo4 = 1 << 17 + SkillCombo4 = 1 << 17, - //Flags beyond here are unknown/untested. + //This is used in the absorb effect for some reason + Unknown = 1 << 19, + + //AdditionalEffectType flags + //The AdditionalEffectType is used for the additional effects some weapons have. + //These effect ids do not repeat the effect of the attack and will not show without a preceding HitEffectType or MagicEffectType + + //It's unclear what this is for. The ifrit fight capture has a BLM using the garuda weapon + //and this flag is set every time but has no apparent effect. + UnknownAdditionalFlag = 1, + + //These play effects on the target + FireEffect = 1 << 10, + IceEffect = 2 << 10, + WindEffect = 3 << 10, + EarthEffect = 4 << 10, + LightningEffect = 5 << 10, + WaterEffect = 6 << 10, + AstralEffect = 7 << 10, //Possibly for blind? + UmbralEffect = 8 << 10, //Posibly for poison? + + //Unknown status effect effects + StatusEffect1 = 12 << 10, + StatusEffect2 = 13 << 10, + + HPAbsorbEffect = 14 << 10, + MPAbsorbEffect = 15 << 10, + TPAbsorbEffect = 16 << 10, + TripleAbsorbEffect = 17 << 10, //Not sure about this + MoogleEffect = 18 << 10, + + //MagicEffectType Flags + //THese are used for magic effects that deal or heal damage as well as damage over time effects + //Crit is the same as HitEffectType + FullResist = 0, + WeakResist = 1 << 0, //Used for level 1, 2, and 3 resists probably + NoResist = 1 << 1, + + MagicShell = 1 << 4, //Used when casting on target with shell effects. MagicEffectType doesnt have a flag for protect or stoneskin + MagicShield = 1 << 5, //When used with an command that has an animation, this plays a purple shield effect. DoTs also have this flag set (at least on ifrit) but they have no animations so it doesnt show + + // Required for heal text to be blue, not sure if that's all it's used for + Heal = 1 << 8, + MP = 1 << 9, //Causes "MP" text to appear when used with MagicEffectType. | with Heal to make text blue + TP = 1 << 10, //Causes "TP" text to appear when used with MagicEffectType. | with Heal to make text blue + + //SelfHealType flags + //This category causes numbers to appear on the user rather regardless of the target associated with the hit effect and do not play an animation + //These determine the text that displays (HP has no text) + SelfHealHP = 0, + SelfHealMP = 1 << 0, //Shows MP text on self. | with SelfHeal to make blue + SelfHealTP = 1 << 1, //Shows TP text on self. | with SelfHeal to make blue + + //Causes self healing numbers to be blue + SelfHeal = 1 << 10, } //Mixing some of these flags will cause the client to crash. diff --git a/data/scripts/hiteffect.lua b/data/scripts/hiteffect.lua index 1285d363..01dc3d12 100644 --- a/data/scripts/hiteffect.lua +++ b/data/scripts/hiteffect.lua @@ -1,22 +1,35 @@ HitEffect = { - --All HitEffects have the last byte 0x8 - HitEffectType = 134217728, --8 << 24 - --Status effects use 32 <<,24 - StatusEffectType = 536870912,--32 << 24, - --Heal effects use 48 << 24 - MagicEffectType = 805306368,--48 << 24 + --This is used for physical attacks + HitEffectType = bit32.lshift(8,24), + --This is used for additioanl effect hits. Only difference from HitEffectType is that it does not play audio. + AdditionalEffectType = bit32.lshift(24, 24), + --Status effects use 32 << 24 + StatusEffectType = bit32.lshift(32, 24), + --When losing a status effect while using a skill, this prevents the hit effect from playing on the actor playing the animation + StatusLossType = bit32.lshift(40, 24), + --Magic effects use 48 << 24, this is also used for when statuses are lost on attack + MagicEffectType = bit32.lshift(48, 24), + --This places the number on the user regardless of the target this hit effect is for, used for things like bloodbath + SelfHealType = bit32.lshift(72, 24), + + --Each Type has it's own set of flags. These should be split into their own enums, + --but for now just keep them all under HitEffect so we don't have to change anything. + + --HitEffectType flags --Not setting RecoilLv2 or RecoilLv3 results in the weaker RecoilLv1. --These are the recoil animations that play on the target, ranging from weak to strong. --The recoil that gets set was likely based on the percentage of HP lost from the attack. - --These are used for resists for spells. RecoilLV1 is a full resist, RecoilLv2 is a partial resist, RecoilLv3 is no resist, CriticalHit is a crit + --These also have a visual effect with heals and spells but in reverse. RecoilLv1 has a large effect, Lv3 has none. Crit is very large + --For spells they represent resists. Lv0 is a max resist, Lv3 is no resist. Crit is still used for crits. + --Heals used the same effects sometimes but it isn't clear what for, it seems random? Possibly something like a trait proccing or even just a bug RecoilLv1 = 0, - RecoilLv2 = 1, - RecoilLv3 = 2, + RecoilLv2 = bit32.lshift(1, 0), + RecoilLv3 = bit32.lshift(1, 1), --Setting both recoil flags triggers the "Critical!" pop-up text and hit visual effect. - CriticalHit = 3, + CriticalHit = RecoilLv2 | RecoilLv3, --Hit visual and sound effects when connecting with the target. --Mixing these flags together will yield different results. @@ -28,14 +41,13 @@ HitEffect = --HitVisual2 is for piercing attacks --HitVisual1 | Hitvisual2 is for blunt attacks --HitVisual3 is for projectile attacks - --Basically, takes the attack property as defined by the weapon and shifts it left 2 + --Basically take the attack property of a weapon and shift it left 2 --For auto attacks attack property is weapon's damageAttributeType1 --Still not totally sure how this works with weaponskills or what hitvisual4 or the other combinations are for - HitVisual1 = 4, - HitVisual2 = 8, - HitVisual3 = 16, - HitVisual4 = 32, - + HitVisual1 = bit32.lshift(1, 2), + HitVisual2 = bit32.lshift(1, 3), + HitVisual3 = bit32.lshift(1, 4), + HitVisual4 = bit32.lshift(1, 5), --An additional visual effect that plays on the target when attacked if: --The attack is physical and they have the protect buff on. @@ -44,62 +56,111 @@ HitEffect = --Another effect plays when both Protect and Shell flags are activated. --Not sure what this effect is. --Random guess: if the attack was a hybrid of both physical and magical and the target had both Protect and Shell buffs applied. - Protect = 64, - Shell = 128, - ProtectShellSpecial = 192,-- Protect | Shell, + Protect = bit32.bor(bit32.lshift(1, 6), HitEffectType), + Shell = bit32.bor(bit32.lshift(1, 7), HitEffectType), + ProtectShellSpecial = Protect | Shell, - Heal = 256,-- Required for heal text to be blue along with HealEffectType, not sure if that's all it's used for - MP = 512, - --If only HitEffect1 is set out of the hit effects, the "Evade!" pop-up text triggers along with the evade visual. --If no hit effects are set, the "Miss!" pop-up is triggered and no hit visual is played. - HitEffect1 = 512, - HitEffect2 = 1024, --Plays the standard hit visual effect, but with no sound if used alone. - HitEffect3 = 2048, --Yellow effect, crit? - HitEffect4 = 4096, --Plays the blocking animation - HitEffect5 = 8192, - GustyHitEffect = 3072,--HitEffect3 | HitEffect2, - GreenTintedHitEffect = 4608,-- HitEffect4 | HitEffect1, + HitEffect1 = bit32.lshift(1, 9), + HitEffect2 = bit32.lshift(1, 10), --Plays the standard hit visual effect, but with no sound if used alone. + HitEffect3 = bit32.lshift(1, 11), --Yellow effect, crit? + HitEffect4 = bit32.lshift(1, 12), --Plays the blocking animation + HitEffect5 = bit32.lshift(1, 13), + GustyHitEffect = bit32.bor(HitEffect3, HitEffect2), + GreenTintedHitEffect = bit32.bor(itEffect4, HitEffect1), --For specific animations Miss = 0, - Evade = 512, - Hit = 1536, --HitEffect1 | HitEffect2, - Parry = 3584, --Hit | HitEffect3, - Block = 4096, - Crit = 2048, + Evade = HitEffect1, + Hit = HitEffect1 | HitEffect2, + Crit = HitEffect3, + Parry = Hit | HitEffect3, + Block = HitEffect4, --Knocks you back away from the attacker. - KnockbackLv1 = 5632,-- HitEffect4 | HitEffect2 | HitEffect1, - KnockbackLv2 = 6144,-- HitEffect4 | HitEffect3, - KnockbackLv3 = 6656,-- HitEffect4 | HitEffect3 | HitEffect1, - KnockbackLv4 = 7168,-- HitEffect4 | HitEffect3 | HitEffect2, - KnockbackLv5 = 7680,-- HitEffect4 | HitEffect3 | HitEffect2 | HitEffect1, + KnockbackLv1 = bit32.bor(HitEffect4, HitEffect2, HitEffect1), + KnockbackLv2 = bit32.bor(HitEffect4, HitEffect3), + KnockbackLv3 = bit32.bor(HitEffect4, HitEffect3, HitEffect1), + KnockbackLv4 = bit32.bor(HitEffect4, HitEffect3, HitEffect2), + KnockbackLv5 = bit32.bor(HitEffect4, HitEffect3, HitEffect2, HitEffect1), --Knocks you away from the attacker in a counter-clockwise direction. - KnockbackCounterClockwiseLv1 = 8192, - KnockbackCounterClockwiseLv2 = 8704,-- HitEffect5 | HitEffect1, + KnockbackCounterClockwiseLv1 = HitEffect5, + KnockbackCounterClockwiseLv2 = bit32.bor(HitEffect5, HitEffect1), --Knocks you away from the attacker in a clockwise direction. - KnockbackClockwiseLv1 = 9216,-- HitEffect5 | HitEffect2, - KnockbackClockwiseLv2 = 9728,-- HitEffect5 | HitEffect2 | HitEffect1, + KnockbackClockwiseLv1 = bit32.bor(HitEffect5, HitEffect2), + KnockbackClockwiseLv2 = bit32.bor(HitEffect5, HitEffect2, HitEffect1), --Completely drags target to the attacker, even across large distances. - DrawIn = 10240,-- HitEffect5 | HitEffect3, + DrawIn = bit32.bor(HitEffect5, HitEffect3), --An additional visual effect that plays on the target based on according buff. - UnknownShieldEffect = 12288,-- HitEffect5 | HitEffect4, - Stoneskin = 12800,-- HitEffect5 | HitEffect4 | HitEffect1, - - --Unknown = 1 << 14, -- Not sure what this flag does; might be another HitEffect. + UnknownShieldEffect = bit32.bor(HitEffect5, HitEffect4), + Stoneskin = bit32.bor(HitEffect5, HitEffect4, HitEffect1), --A special effect when performing appropriate skill combos in succession. --Ex: Thunder (SkillCombo1 Effect) -> Thundara (SkillCombo2 Effect) -> Thundaga (SkillCombo3 Effect) --Special Note: SkillCombo4 was never actually used in 1.0 since combos only chained up to 3 times maximum. - SkillCombo1 = 32768, - SkillCombo2 = 65536, - SkillCombo3 = 98304,-- SkillCombo1 | SkillCombo2, - SkillCombo4 = 131072 + SkillCombo1 = bit32.lshift(1, 15), + SkillCombo2 = bit32.lshift(1, 16), + SkillCombo3 = bit32.bor(SkillCombo1, SkillCombo2), + SkillCombo4 = bit32.lshift(1, 17), - --Flags beyond here are unknown/untested. + --This is used in the absorb effect for some reason + Unknown = bit32.lshift(1, 19), + + --AdditionalEffectType flags + --The AdditionalEffectType is used for the additional effects some weapons have. + --These effect ids do not repeat the effect of the attack and will not show without a preceding HitEffectType or MagicEffectType + + --It's unclear what this is for. The ifrit fight capture has a BLM using the garuda weapon + --and this flag is set every time but has no apparent effect. + UnknownAdditionalFlag = 1, + + --These play effects on the target + FireEffect = bit32.lshift(1, 10), + IceEffect = bit32.lshift(2, 10), + WindEffect = bit32.lshift(3, 10), + EarthEffect = bit32.lshift(4, 10), + LightningEffect = bit32.lshift(5, 10), + WaterEffect = bit32.lshift(6, 10), + AstralEffect = bit32.lshift(7, 10), --Possibly for blind? + UmbralEffect = bit32.lshift(8, 10), --Posibly for poison? + + --Unknown status effect effects + StatusEffect1 = bit32.lshift(12, 10), + StatusEffect2 = bit32.lshift(13, 10), + + HPAbsorbEffect = bit32.lshift(14, 10), + MPAbsorbEffect = bit32.lshift(15, 10), + TPAbsorbEffect = bit32.lshift(16, 10), + TripleAbsorbEffect = bit32.lshift(17, 10), --Not sure about this + MoogleEffect = bit32.lshift(18, 10), + + --MagicEffectType Flags + --THese are used for magic effects that deal or heal damage as well as damage over time effects + --Crit is the same as HitEffectType + FullResist = 0, + WeakResist = bit32.lshift(1, 0), --Used for level 1, 2, and 3 resists probably + NoResist = bit32.lshift(1, 1), + + MagicShell = bit32.lshift(1, 4), --Used when casting on target with shell effects. MagicEffectType doesnt have a flag for protect or stoneskin + MagicShield = bit32.lshift(1, 5), --When used with an command that has an animation, this plays a purple shield effect. DoTs also have this flag set (at least on ifrit) but they have no animations so it doesnt show + + -- Required for heal text to be blue, not sure if that's all it's used for + Heal = bit32.lshift(1, 8), + MP = bit32.lshift(1, 9), --Causes "MP" text to appear when used with MagicEffectType. | with Heal to make text blue + TP = bit32.lshift(1, 10), --Causes "TP" text to appear when used with MagicEffectType. | with Heal to make text blue + + --SelfHealType flags + --This category causes numbers to appear on the user rather regardless of the target associated with the hit effect and do not play an animation + --These determine the text that displays (HP has no text) + SelfHealHP = 0, + SelfHealMP = bit32.lshift(1, 0), --Shows MP text on self. | with SelfHeal to make blue + SelfHealTP = bit32.lshift(1, 1), --Shows TP text on self. | with SelfHeal to make blue + + --Causes self healing numbers to be blue + SelfHeal = bit32.lshift(1, 10), } \ No newline at end of file