public ActionChain DoSwingMotion(WorldObject target, out float animLength) { // FIXME: proper swing animation speeds var baseSpeed = GetAnimSpeed(); var animSpeedMod = IsDualWieldAttack ? 1.2f : 1.0f; // dual wield swing animation 20% faster var animSpeed = baseSpeed * animSpeedMod; var swingAnimation = new MotionItem(GetSwingAnimation(), animSpeed); animLength = MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, swingAnimation.Motion, animSpeed); var motion = new UniversalMotion(CurrentMotionState.Stance, swingAnimation); motion.MovementData.CurrentStyle = (uint)CurrentMotionState.Stance; motion.MovementData.TurnSpeed = 2.25f; motion.HasTarget = true; motion.TargetGuid = target.Guid; CurrentMotionState = motion; var actionChain = new ActionChain(); actionChain.AddAction(this, () => EnqueueBroadcastMotion(motion)); actionChain.AddDelaySeconds(animLength); actionChain.AddAction(this, () => Session.Network.EnqueueSend(new GameEventAttackDone(Session))); actionChain.AddAction(this, () => Session.Network.EnqueueSend(new GameEventCombatCommmenceAttack(Session))); actionChain.AddAction(this, () => Session.Network.EnqueueSend(new GameEventAttackDone(Session))); return(actionChain); }
public static MotionTable GetMotionTable(uint id) { MotionTable mtable = null; MotionTables.TryGetValue(id, out mtable); return(mtable); }
private void saveToolStripMenuItem_Click(object sender, EventArgs e) { if (IDEMode == IDE_MODE.Project) { if (Manager.Projects.Count > 0) { foreach (var proj in Manager.Projects.Values) { proj.Save(); } } } else if (IDEMode == IDE_MODE.Fighter) { foreach (var keypair in ScriptFiles) { keypair.Value.Export(Path.GetFileName(keypair.Key)); } MotionTable.Export( Path.Combine(Path.GetDirectoryName(ScriptFiles.Keys[0]), "motion.mtable")); } else if (IDEMode == IDE_MODE.File) { if (ScriptFiles.Count > 0) { ScriptFiles.Values[0].Export(ScriptFiles.Keys[0]); } else if (ParamFile != null) { ParamFile.Export(ParamFile.Filepath); } } }
/// <summary> /// Executes the weapon reload animation for the player /// </summary> public float ReloadMotion() { var reloadAnimation = new MotionItem(GetReloadAnimation(), 1.0f); var animLength = MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, reloadAnimation); var motion = new UniversalMotion(CurrentMotionState.Stance); motion.MovementData.CurrentStyle = (uint)CurrentMotionState.Stance; motion.MovementData.ForwardCommand = (uint)MotionCommand.Reload; motion.MovementData.TurnSpeed = 2.25f; //motion.HasTarget = true; //motion.TargetGuid = target.Guid; CurrentMotionState = motion; var actionChain = new ActionChain(); actionChain.AddAction(this, () => DoMotion(motion)); actionChain.AddDelaySeconds(animLength); actionChain.AddAction(this, () => { motion.MovementData.ForwardCommand = (uint)MotionCommand.Invalid; DoMotion(motion); CurrentMotionState = motion; }); actionChain.AddDelaySeconds(animLength); actionChain.AddAction(this, () => Session.Network.EnqueueSend(new GameEventAttackDone(Session))); actionChain.AddAction(this, () => Session.Network.EnqueueSend(new GameEventCombatCommmenceAttack(Session))); actionChain.AddAction(this, () => Session.Network.EnqueueSend(new GameEventAttackDone(Session))); actionChain.EnqueueChain(); var weapon = GetEquippedWeapon(); var reloadTime = weapon.DefaultCombatStyle == CombatStyle.Crossbow ? 3.2f : 1.6f; return(animLength * reloadTime); }
/// <summary> /// Handles switching between combat stances: /// old style -> peace mode -> hand combat (weapon swap) -> peace mode -> new style /// </summary> public float SwitchCombatStyles() { if (CurrentMotionState.Stance == MotionStance.NonCombat || CurrentMotionState.Stance == MotionStance.Invalid || IsMonster) { return(0.0f); } var combatStance = GetCombatStance(); float peace1 = 0.0f, unarmed = 0.0f, peace2 = 0.0f; // this is now handled as a proper 2-step process in HandleActionChangeCombatMode / NextUseTime // FIXME: just call generic method to switch to HandCombat first peace1 = MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, MotionCommand.Ready, MotionCommand.NonCombat); /*if (CurrentMotionState.Stance != MotionStance.HandCombat && combatStance != MotionStance.HandCombat) * { * unarmed = MotionTable.GetAnimationLength(MotionTableId, MotionStance.NonCombat, MotionCommand.Ready, MotionCommand.HandCombat); * peace2 = MotionTable.GetAnimationLength(MotionTableId, MotionStance.HandCombat, MotionCommand.Ready, MotionCommand.NonCombat); * }*/ SetStance(MotionStance.NonCombat, false); //Console.WriteLine($"SwitchCombatStyle() - animLength: {animLength}"); //Console.WriteLine($"SwitchCombatStyle() - peace1({peace1}) + unarmed({unarmed}) + peace2({peace2})"); var animLength = peace1 + unarmed + peace2; return(animLength); }
/// <summary> /// Perform the melee attack swing animation /// </summary> public void DoSwingMotion(WorldObject target, CombatManeuver maneuver, out float animLength, out List <float> attackFrames) { if (ForcePos) { SendUpdatePosition(); } var animSpeed = GetAnimSpeed(); animLength = MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, maneuver.Motion, animSpeed); attackFrames = MotionTable.GetAttackFrames(MotionTableId, CurrentMotionState.Stance, maneuver.Motion); var motion = new Motion(this, maneuver.Motion, animSpeed); motion.MotionState.TurnSpeed = 2.25f; if (!AiImmobile) { motion.MotionFlags |= MotionFlags.StickToObject; } motion.TargetGuid = target.Guid; CurrentMotionState = motion; EnqueueBroadcastMotion(motion); }
/// <summary> /// Switches a player or creature to melee attack stance /// </summary> public float HandleSwitchToMeleeCombatMode() { // get appropriate combat stance for currently wielded items var combatStance = GetCombatStance(); var animLength = SwitchCombatStyles(); animLength += MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, MotionCommand.Ready, (MotionCommand)combatStance); var motion = new UniversalMotion(combatStance); motion.MovementData.CurrentStyle = (uint)combatStance; ExecuteMotion(motion); var player = this as Player; if (player != null) { player.HandleActionTradeSwitchToCombatMode(player.Session); player.Session.Network.EnqueueSend(new GameMessagePrivateUpdatePropertyInt(this, PropertyInt.CombatMode, (int)CombatMode.Melee)); } //Console.WriteLine("HandleSwitchToMeleeCombatMode() - animLength: " + animLength); return(animLength); }
/// <summary> /// Perform the melee attack swing animation /// </summary> public void DoSwingMotion(WorldObject target, MotionCommand motionCommand, out float animLength, out List <float> attackFrames) { if (ForcePos) { SendUpdatePosition(); } //Console.WriteLine($"{maneuver.Style} - {maneuver.Motion} - {maneuver.AttackHeight}"); var baseSpeed = GetAnimSpeed(); var animSpeedMod = IsDualWieldAttack ? 1.2f : 1.0f; // dual wield swing animation 20% faster var animSpeed = baseSpeed * animSpeedMod; animLength = MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, motionCommand, animSpeed); attackFrames = MotionTable.GetAttackFrames(MotionTableId, CurrentMotionState.Stance, motionCommand); var motion = new Motion(this, motionCommand, animSpeed); motion.MotionState.TurnSpeed = 2.25f; if (!AiImmobile) { motion.MotionFlags |= MotionFlags.StickToObject; } motion.TargetGuid = target.Guid; CurrentMotionState = motion; EnqueueBroadcastMotion(motion); }
/// <summary> /// Handles switching between combat stances: /// old style -> peace mode -> hand combat (weapon swap) -> peace mode -> new style /// </summary> public float SwitchCombatStyles() { if (CurrentMotionState.Stance == MotionStance.NonCombat || CurrentMotionState.Stance == MotionStance.Invalid || IsMonster) { return(0.0f); } var combatStance = GetCombatStance(); float peace1 = 0.0f, unarmed = 0.0f, peace2 = 0.0f; // FIXME: just call generic method to switch to HandCombat first peace1 = MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, MotionCommand.Ready, MotionCommand.NonCombat); if (CurrentMotionState.Stance != MotionStance.HandCombat && combatStance != MotionStance.HandCombat) { unarmed = MotionTable.GetAnimationLength(MotionTableId, MotionStance.NonCombat, MotionCommand.Ready, MotionCommand.HandCombat); peace2 = MotionTable.GetAnimationLength(MotionTableId, MotionStance.HandCombat, MotionCommand.Ready, MotionCommand.NonCombat); } SetStance(MotionStance.NonCombat, false); //Console.WriteLine($"SwitchCombatStyle() - animLength: {animLength}"); //Console.WriteLine($"SwitchCombatStyle() - peace1({peace1}) + unarmed({unarmed}) + peace2({peace2})"); var animLength = peace1 + unarmed + peace2; return(animLength); }
/// <summary> /// Switches a player or creature to magic casting stance /// </summary> public float HandleSwitchToMagicCombatMode() { var wand = GetEquippedWand(); if (wand == null) { return(0.0f); } var animLength = SwitchCombatStyles(); animLength += MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, MotionCommand.Ready, MotionCommand.Magic); var motion = new Motion(MotionStance.Magic); ExecuteMotion(motion); var player = this as Player; if (player != null) { player.HandleActionTradeSwitchToCombatMode(player.Session); player.Session.Network.EnqueueSend(new GameMessagePrivateUpdatePropertyInt(this, PropertyInt.CombatMode, (int)CombatMode.Magic)); } //Console.WriteLine("HandleSwitchToMagicCombatMode() - animLength: " + animLength); return(animLength); }
/// <summary> /// Handles switching between combat stances: /// old style -> peace mode -> hand combat (weapon swap) -> peace mode -> new style /// </summary> public float SwitchCombatStyles() { if (CurrentMotionState.Stance == MotionStance.NonCombat || CurrentMotionState.Stance == MotionStance.Invalid) { return(0.0f); } var combatStance = GetCombatStance(); float peace1 = 0.0f, unarmed = 0.0f, peace2 = 0.0f; peace1 = MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, MotionCommand.Ready, MotionCommand.NonCombat); if (CurrentMotionState.Stance != MotionStance.HandCombat && combatStance != MotionStance.HandCombat) { unarmed = MotionTable.GetAnimationLength(MotionTableId, MotionStance.NonCombat, MotionCommand.Ready, MotionCommand.HandCombat); peace2 = MotionTable.GetAnimationLength(MotionTableId, MotionStance.HandCombat, MotionCommand.Ready, MotionCommand.NonCombat); } CurrentMotionState = new UniversalMotion(MotionStance.NonCombat); //Console.WriteLine($"SwitchCombatStyle() - animLength: {animLength}"); //Console.WriteLine($"SwitchCombatStyle() - peace1({peace1}) + unarmed({unarmed}) + peace2({peace2})"); var animLength = peace1 + unarmed + peace2; return(animLength); }
/// <summary> /// Returns the amount of time for this creature to rotate by the # of degrees /// from the input angle, using the omega speed from its MotionTable /// </summary> public virtual float GetRotateDelay(float angle) { var turnSpeed = MotionTable.GetTurnSpeed(MotionTableId); if (turnSpeed == 0.0f) return 0.0f; var rotateTime = Math.PI / turnSpeed / 180.0f * angle; return (float)rotateTime; }
public void Export(string dirpath) { Main.Export($"{dirpath}/game.bin"); SFX.Export($"{dirpath}/sound.bin"); GFX.Export($"{dirpath}/effect.bin"); Expression.Export($"{dirpath}/expression.bin"); MotionTable.Export($"{dirpath}/motion.mtable"); }
public void Save(String fname) { string path = Path.GetDirectoryName(fname) + "\\"; MotionTable.Export(fname); Game.Export(path + "game.bin"); Effect.Export(path + "effect.bin"); Sound.Export(path + "sound.bin"); Expression.Export(path + "expression.bin"); }
/// <summary> /// Executes the weapon reload animation for the player /// </summary> public float ReloadMotion() { var reloadAnimation = new MotionItem(GetReloadAnimation(), 1.0f); var animLength = MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, reloadAnimation); var motion = new UniversalMotion(CurrentMotionState.Stance); motion.MovementData.CurrentStyle = (uint)CurrentMotionState.Stance; motion.MovementData.ForwardCommand = (uint)MotionCommand.Reload; motion.MovementData.TurnSpeed = 2.25f; //motion.HasTarget = true; //motion.TargetGuid = target.Guid; CurrentMotionState = motion; var actionChain = new ActionChain(); actionChain.AddAction(this, () => DoMotion(motion)); actionChain.AddDelaySeconds(animLength); actionChain.AddAction(this, () => { motion.MovementData.ForwardCommand = (uint)MotionCommand.Invalid; DoMotion(motion); CurrentMotionState = motion; }); var ammo = GetEquippedAmmo(); if (ammo != null) { actionChain.AddAction(this, () => EnqueueBroadcast( new GameMessageParentEvent(this, ammo, (int)ACE.Entity.Enum.ParentLocation.RightHand, (int)ACE.Entity.Enum.Placement.RightHandCombat))); } actionChain.AddDelaySeconds(animLength); var player = this as Player; if (player != null) { actionChain.AddAction(this, () => player.Session.Network.EnqueueSend(new GameEventAttackDone(player.Session))); actionChain.AddAction(this, () => player.Session.Network.EnqueueSend(new GameEventCombatCommmenceAttack(player.Session))); // TODO: This gets rid of the hourglass but doesn't seem to be sent in retail pcaps... actionChain.AddAction(this, () => player.Session.Network.EnqueueSend(new GameEventAttackDone(player.Session))); } actionChain.EnqueueChain(); var weapon = GetEquippedWeapon(); var reloadTime = weapon.DefaultCombatStyle == CombatStyle.Crossbow ? 3.2f : 1.6f; return(animLength * reloadTime); }
public float ReloadMissileAmmo(ActionChain actionChain = null) { var weapon = GetEquippedMissileWeapon(); var ammo = GetEquippedAmmo(); if (weapon == null || ammo == null) { return(0.0f); } var newChain = actionChain == null; if (newChain) { actionChain = new ActionChain(); } var animLength = 0.0f; if (weapon.IsAmmoLauncher) { var animSpeed = GetAnimSpeed(); //Console.WriteLine($"AnimSpeed: {animSpeed}"); animLength = EnqueueMotion(actionChain, MotionCommand.Reload, animSpeed); // start pulling out next arrow EnqueueMotion(actionChain, MotionCommand.Ready); // finish reloading } // ensure ammo visibility for players actionChain.AddAction(this, () => { EnqueueActionBroadcast(p => p.TrackEquippedObject(this, ammo)); var delayChain = new ActionChain(); delayChain.AddDelaySeconds(0.001f); // ensuring this message gets sent after player broadcasts above... delayChain.AddAction(this, () => { EnqueueBroadcast(new GameMessageParentEvent(this, ammo, ACE.Entity.Enum.ParentLocation.RightHand, ACE.Entity.Enum.Placement.RightHandCombat)); }); delayChain.EnqueueChain(); }); if (newChain) { actionChain.EnqueueChain(); } var animLength2 = MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, MotionCommand.Reload, MotionCommand.Ready); //Console.WriteLine($"AnimLength: {animLength} + {animLength2}"); return(animLength + animLength2); }
/// <summary> /// Perform the melee attack swing animation /// </summary> public void DoSwingMotion(WorldObject target, CombatManeuver maneuver, out float animLength) { var animSpeed = GetAnimSpeed(); animLength = MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, maneuver.Motion, animSpeed); var motion = new Motion(this, maneuver.Motion, animSpeed); motion.MotionState.TurnSpeed = 2.25f; motion.MotionFlags |= MotionFlags.StickToObject; motion.TargetGuid = target.Guid; CurrentMotionState = motion; EnqueueBroadcastMotion(motion); }
public void GetMovementSpeed() { var moveSpeed = MotionTable.GetRunSpeed(MotionTableId); if (moveSpeed == 0) { moveSpeed = 2.5f; } var scale = ObjScale ?? 1.0f; RunRate = GetRunRate(); MoveSpeed = moveSpeed * RunRate * scale; //Console.WriteLine(Name + " - Run: " + runSkill + " - RunRate: " + RunRate + " - Move: " + MoveSpeed + " - Scale: " + scale); }
public MovesetManager(string mtablePath) { var directory = Path.GetDirectoryName(mtablePath); string[] files = Directory.EnumerateFiles(directory, "*.bin").ToArray(); if (files.Length == 0) { return; } foreach (string file in files) { var filename = Path.GetFileName(file); if (filename == "game.bin") { Game = new ACMDFile(file); Endian = Game.Endian; } if (filename == "effect.bin") { Effect = new ACMDFile(file); Endian = Effect.Endian; } if (filename == "sound.bin") { Sound = new ACMDFile(file); Endian = Sound.Endian; } if (filename == "expression.bin") { Expression = new ACMDFile(file); Endian = Expression.Endian; } } if (File.Exists(mtablePath)) { MotionTable = new MTable(mtablePath, Endian); } ScriptsHashList = new List <uint>(); if (MotionTable != null) { ScriptsHashList.AddRange(MotionTable.ToList()); } }
public void GetMovementSpeed() { var moveSpeed = MotionTable.GetRunSpeed(MotionTableId); if (moveSpeed == 0) { moveSpeed = 2.5f; } var scale = ObjScale ?? 1.0f; var runSkill = GetCreatureSkill(Skill.Run).Current; RunRate = (float)MovementSystem.GetRunRate(0.0f, (int)runSkill, 1.0f); MoveSpeed = moveSpeed * RunRate * scale; //Console.WriteLine(Name + " - Run: " + runSkill + " - RunRate: " + RunRate + " - Move: " + MoveSpeed + " - Scale: " + scale); }
/// <summary> /// Perform the melee attack swing animation /// </summary> public virtual ActionChain DoSwingMotion(WorldObject target, out float animLength) { var swingAnimation = new MotionItem(GetSwingAnimation(), 1.25f); animLength = MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, swingAnimation); var motion = new UniversalMotion(CurrentMotionState.Stance, swingAnimation); motion.MovementData.CurrentStyle = (uint)CurrentMotionState.Stance; motion.MovementData.TurnSpeed = 2.25f; motion.HasTarget = true; motion.TargetGuid = target.Guid; CurrentMotionState = motion; CurrentLandblock.EnqueueBroadcastMotion(this, motion); return(null); }
/// <summary> /// Perform the melee attack swing animation /// </summary> public void DoSwingMotion(WorldObject target, CombatManeuver maneuver, out float animLength) { var animSpeed = GetAnimSpeed(); var swingAnimation = new MotionItem(maneuver.Motion, animSpeed); animLength = MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, maneuver.Motion, animSpeed); var motion = new UniversalMotion(CurrentMotionState.Stance, swingAnimation); motion.MovementData.CurrentStyle = (uint)CurrentMotionState.Stance; motion.MovementData.TurnSpeed = 2.25f; motion.HasTarget = true; motion.TargetGuid = target.Guid; CurrentMotionState = motion; EnqueueBroadcastMotion(motion); }
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) { if (IDEMode == IDE_MODE.Project) { if (fsDlg.ShowDialog() == DialogResult.OK) { throw new NotImplementedException("Saving workspaces not yet supported"); //if (Manager.Projects.Count > 0) // foreach (var proj in Manager.Projects.Values) // proj.Save(); } } else if (IDEMode == IDE_MODE.Fighter) { if (fsDlg.ShowDialog() == DialogResult.OK) { foreach (var keypair in ScriptFiles) { keypair.Value.Export(Path.Combine(fsDlg.SelectedPath, Path.GetFileName(keypair.Key))); } MotionTable.Export(Path.Combine(fsDlg.SelectedPath, "motion.mtable")); } } else if (IDEMode == IDE_MODE.File) { if (ScriptFiles.Count > 0) { sfDlg.FileName = Path.GetFileNameWithoutExtension(ScriptFiles.Keys[0]); if (sfDlg.ShowDialog() == DialogResult.OK) { ScriptFiles.Values[0].Export(sfDlg.FileName); } } else if (ParamFile != null) { sfDlg.FileName = Path.GetFileNameWithoutExtension(ParamFile.Filepath); if (sfDlg.ShowDialog() == DialogResult.OK) { ParamFile.Export(sfDlg.FileName); } } } }
public void PopulateACMD() { ACMDNode.Nodes.Clear(); foreach (uint u in MotionTable) { ScriptNode snode = new ScriptNode(u, $"{MotionTable.IndexOf(u)} - {u.ToString("X8")}"); if (AnimationHashes.ContainsKey(u)) { snode.Text = $"{MotionTable.IndexOf(u)} - {AnimationHashes[u]}"; } if (ACMD_FILES.ContainsKey("game")) { if (ACMD_FILES["game"].Scripts.ContainsKey(u)) { snode.Scripts.Add("Game", ACMD_FILES["game"].Scripts[u]); } } if (ACMD_FILES.ContainsKey("effect")) { if (ACMD_FILES["effect"].Scripts.ContainsKey(u)) { snode.Scripts.Add("Effect", ACMD_FILES["effect"].Scripts[u]); } } if (ACMD_FILES.ContainsKey("sound")) { if (ACMD_FILES["sound"].Scripts.ContainsKey(u)) { snode.Scripts.Add("Sound", ACMD_FILES["sound"].Scripts[u]); } } if (ACMD_FILES.ContainsKey("expression")) { if (ACMD_FILES["expression"].Scripts.ContainsKey(u)) { snode.Scripts.Add("Expression", ACMD_FILES["expression"].Scripts[u]); } } ACMDNode.Nodes.Add(snode); } }
/// <summary> /// Switches a player or creature to non-combat mode /// </summary> public float HandleSwitchToPeaceMode() { var animLength = MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, MotionCommand.Ready, MotionCommand.NonCombat); var motion = new Motion(MotionStance.NonCombat); ExecuteMotion(motion); var player = this as Player; if (player != null) { player.stance = MotionStance.NonCombat; player.Session.Network.EnqueueSend(new GameMessagePrivateUpdatePropertyInt(this, PropertyInt.CombatMode, (int)CombatMode.NonCombat)); } //Console.WriteLine("HandleSwitchToPeaceMode() - animLength: " + animLength); return(animLength); }
/// <summary> /// Performs the player melee swing animation /// </summary> public float DoSwingMotion(WorldObject target) { // get the proper animation speed for this attack, // based on weapon speed and player quickness var baseSpeed = GetAnimSpeed(); var animSpeedMod = IsDualWieldAttack ? 1.2f : 1.0f; // dual wield swing animation 20% faster var animSpeed = baseSpeed * animSpeedMod; var swingAnimation = GetSwingAnimation(); var animLength = MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, swingAnimation, animSpeed); // broadcast player swing animation to clients var motion = new Motion(this, swingAnimation, animSpeed); motion.MotionState.TurnSpeed = 2.25f; motion.MotionFlags |= MotionFlags.StickToObject; motion.TargetGuid = target.Guid; CurrentMotionState = motion; EnqueueBroadcastMotion(motion); return(animLength); }
private void exec_motion(Dictionary <string, string> paramDict) { Util.Debug(string.Format("line{0} : motion ", currentExecuteLine.ToString())); List <IMaid> maidList = selectMaid(paramDict); foreach (IMaid maid in maidList) { if (paramDict.ContainsKey(key_name)) { maid.change_Motion(paramDict[key_name], isLoop: true); } else if (paramDict.ContainsKey(key_category)) { List <MotionInfo> motionList = MotionTable.queryTable_motionNameBase(paramDict[key_category]); maid.change_Motion(motionList, isLoop: true); } else { Util.Info(string.Format("line{0} : 모션이 지정되어 있지 않습니다", currentExecuteLine.ToString())); } } }
public float ReloadMissileAmmo() { var weapon = GetEquippedMissileWeapon(); var ammo = GetEquippedAmmo(); if (weapon == null || ammo == null) { return(0.0f); } var actionChain = new ActionChain(); var animLength = 0.0f; if (weapon.IsBow) { EnqueueMotion(actionChain, MotionCommand.Reload); // start pulling out next arrow EnqueueMotion(actionChain, MotionCommand.Ready); // finish reloading animLength = MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, MotionCommand.Reload, MotionCommand.Ready); actionChain.AddDelaySeconds(animLength); } // ensure ammo visibility for players actionChain.AddAction(this, () => { EnqueueBroadcast(new GameMessageParentEvent(this, ammo, (int)ACE.Entity.Enum.ParentLocation.RightHand, (int)ACE.Entity.Enum.Placement.RightHandCombat)); EnqueueActionBroadcast((Player p) => p.TrackObject(this)); }); actionChain.EnqueueChain(); var animLength2 = MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, MotionCommand.Ready, MotionCommand.Reload); //Console.WriteLine($"AnimLength: {animLength} + {animLength2}"); return(animLength + animLength2); }
public override ActionChain DoSwingMotion(WorldObject target, out float animLength) { var swingAnimation = new MotionItem(GetSwingAnimation(), 1.25f); animLength = MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, swingAnimation); var motion = new UniversalMotion(CurrentMotionState.Stance, swingAnimation); motion.MovementData.CurrentStyle = (uint)CurrentMotionState.Stance; motion.MovementData.TurnSpeed = 2.25f; motion.HasTarget = true; motion.TargetGuid = target.Guid; CurrentMotionState = motion; var actionChain = new ActionChain(); actionChain.AddAction(this, () => DoMotion(motion)); actionChain.AddDelaySeconds(animLength); actionChain.AddAction(this, () => Session.Network.EnqueueSend(new GameEventAttackDone(Session))); actionChain.AddAction(this, () => Session.Network.EnqueueSend(new GameEventCombatCommmenceAttack(Session))); actionChain.AddAction(this, () => Session.Network.EnqueueSend(new GameEventAttackDone(Session))); return(actionChain); }
/// <summary> /// Perform the melee attack swing animation /// </summary> public ActionChain DoSwingMotion(WorldObject target, CombatManeuver maneuver, out float animLength) { var animSpeed = GetAnimSpeed(); var swingAnimation = new MotionItem(maneuver.Motion, animSpeed); animLength = MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, maneuver.Motion, null, animSpeed); var motion = new UniversalMotion(CurrentMotionState.Stance, swingAnimation); motion.MovementData.CurrentStyle = (uint)CurrentMotionState.Stance; motion.MovementData.TurnSpeed = 2.25f; motion.HasTarget = true; motion.TargetGuid = target.Guid; CurrentMotionState = motion; EnqueueBroadcastMotion(motion); // play default script? (special attack) //if (MotionTable.HasDefaultScript(MotionTableId, maneuver.Motion, maneuver.Style)) //EnqueueBroadcast(new GameMessageScript(Guid, (PlayScript)DefaultScriptId)); return(null); }