diff --git a/FFXIVClassic Map Server/Database.cs b/FFXIVClassic Map Server/Database.cs index 4c8303a4..b3574e21 100644 --- a/FFXIVClassic Map Server/Database.cs +++ b/FFXIVClassic Map Server/Database.cs @@ -1324,29 +1324,22 @@ namespace FFXIVClassic_Map_Server cmd = new MySqlCommand(query, conn); cmd.Parameters.AddWithValue("@charId", player.actorId); cmd.Parameters.AddWithValue("@classId", player.charaWork.parameterSave.state_mainSkill[0]); - player.charaWork.commandBorder = 32; - for (int i = player.charaWork.commandBorder; i < player.charaWork.commandCategory.Length; i++) - { - player.charaWork.command[i] = 0; - player.charaWork.commandCategory[i] = 0; - player.charaWork.parameterSave.commandSlot_recastTime[i - player.charaWork.commandBorder] = 0; - } + + player.charaWork.commandBorder = 32; using (MySqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { - int index = reader.GetUInt16(0); - uint trueCommandId = reader.GetUInt32(1); - player.charaWork.command[index] = trueCommandId; - player.charaWork.commandCategory[index] = 1; - player.charaWork.parameterSave.commandSlot_recastTime[index - player.charaWork.commandBorder] = reader.GetUInt32(2); + int hotbarSlot = reader.GetUInt16("hotbarSlot"); + uint commandId = reader.GetUInt32("commandId"); + player.charaWork.command[hotbarSlot + player.charaWork.commandBorder] = commandId | 0xA0F00000; + player.charaWork.commandCategory[hotbarSlot + player.charaWork.commandBorder] = 1; + player.charaWork.parameterSave.commandSlot_recastTime[hotbarSlot] = reader.GetUInt32("recastTime"); //Recast timer - BattleCommand ability = Server.GetWorldManager().GetBattleCommand((ushort)(trueCommandId ^ 2700083200)); - player.charaWork.parameterTemp.maxCommandRecastTime[index - player.charaWork.commandBorder] = (ushort) (ability != null ? ability.recastTimeSeconds : 1); - //Previous recast timer - player.charaWork.parameterSave.commandSlot_recastTime[index - player.charaWork.commandBorder] = reader.GetUInt32(2); + BattleCommand ability = Server.GetWorldManager().GetBattleCommand((ushort)(commandId)); + player.charaWork.parameterTemp.maxCommandRecastTime[hotbarSlot] = (ushort) (ability != null ? ability.recastTimeSeconds : 1); } } } diff --git a/FFXIVClassic Map Server/actors/chara/ai/state/AttackState.cs b/FFXIVClassic Map Server/actors/chara/ai/state/AttackState.cs index 53bb1c8b..25b6c088 100644 --- a/FFXIVClassic Map Server/actors/chara/ai/state/AttackState.cs +++ b/FFXIVClassic Map Server/actors/chara/ai/state/AttackState.cs @@ -110,7 +110,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state owner.OnAttack(this, action, ref errorResult); // handle paralyze/intimidate/sleep/whatever in character thing - owner.DoBattleAction((ushort)BattleActionX01PacketCommand.Attack, 0x19001000, errorResult != null ? action : errorResult); + owner.DoBattleAction((ushort)BattleActionX01PacketCommand.Attack, 0x19001000, errorResult == null ? action : errorResult); //this.errorPacket = BattleActionX01Packet.BuildPacket(target.actorId, owner.actorId, target.actorId, 0, effectId, 0, (ushort)BattleActionX01PacketCommand.Attack, (ushort)damage, 0); } diff --git a/FFXIVClassic Map Server/packets/send/Actor/battle/BattleAction.cs b/FFXIVClassic Map Server/packets/send/Actor/battle/BattleAction.cs index 5ee1523e..7eb08a81 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/battle/BattleAction.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/battle/BattleAction.cs @@ -6,13 +6,16 @@ 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 + HitEffectType = 8 << 24, + //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. - RecoilLv1 = 0, - RecoilLv2 = 1 << 0, - RecoilLv3 = 1 << 1, + RecoilLv1 = 0 | HitEffectType, + RecoilLv2 = 1 << 0 | HitEffectType, + RecoilLv3 = 1 << 1 | HitEffectType, //Setting both recoil flags triggers the "Critical!" pop-up text and hit visual effect. CriticalHit = RecoilLv2 | RecoilLv3, @@ -21,10 +24,10 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle //Mixing these flags together will yield different results. //Each visual likely relates to a specific weapon. //Ex: HitVisual4 flag alone appears to be the visual and sound effect for hand-to-hand attacks. - HitVisual1 = 1 << 2, - HitVisual2 = 1 << 3, - HitVisual3 = 1 << 4, - HitVisual4 = 1 << 5, + HitVisual1 = 1 << 2 | HitEffectType, + HitVisual2 = 1 << 3 | HitEffectType, + HitVisual3 = 1 << 4 | HitEffectType, + HitVisual4 = 1 << 5 | HitEffectType, //An additional visual effect that plays on the target when attacked if: //The attack is physical and they have the protect buff on. @@ -33,20 +36,20 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle //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 = 1 << 6, - Shell = 1 << 7, + Protect = 1 << 6 | HitEffectType, + Shell = 1 << 7 | HitEffectType, ProtectShellSpecial = Protect | Shell, //Unknown = 1 << 8, -- Not sure what this flag does. //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, - HitEffect2 = 1 << 10, //Plays the standard hit visual effect, but with no sound if used alone. + HitEffect1 = 1 << 9 | HitEffectType, + HitEffect2 = 1 << 10 | HitEffectType, //Plays the standard hit visual effect, but with no sound if used alone. Hit = HitEffect1 | HitEffect2, //A standard hit effect with sound effect. - HitEffect3 = 1 << 11, - HitEffect4 = 1 << 12, - HitEffect5 = 1 << 13, + HitEffect3 = 1 << 11 | HitEffectType, + HitEffect4 = 1 << 12 | HitEffectType, + HitEffect5 = 1 << 13 | HitEffectType, GustyHitEffect = HitEffect3 | HitEffect2, GreenTintedHitEffect = HitEffect4 | HitEffect1, @@ -77,10 +80,10 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle //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, + SkillCombo1 = 1 << 15 | HitEffectType, + SkillCombo2 = 1 << 16 | HitEffectType, SkillCombo3 = SkillCombo1 | SkillCombo2, - SkillCombo4 = 1 << 17 + SkillCombo4 = 1 << 17 | HitEffectType //Flags beyond here are unknown/untested. } diff --git a/data/scripts/effects/regen.lua b/data/scripts/effects/regen.lua index 7b460604..2b13811d 100644 --- a/data/scripts/effects/regen.lua +++ b/data/scripts/effects/regen.lua @@ -13,7 +13,7 @@ function onTick(target, effect) sender = "regen"; -- todo: actual regen effect thing - local ability = GetWorldManager().GetAbility(27346); + local ability = GetWorldManager().GetBattleCommand(27346); local anim = bit32.bxor(bit32.lshift(ability.animationType, 24), bit32.lshift(tonumber(1), 12) , 101); local addHp = effect.GetMagnitude();