public override void OnStart() { var returnCode = lua.LuaEngine.CallLuaBattleCommandFunction(owner, skill, "ability", "onAbilityStart", owner, target, skill); if (returnCode != 0) { interrupt = true; errorResult = new CommandResult(owner.actorId, (ushort)(returnCode == -1 ? 32558 : returnCode), 0); } else { if (!skill.IsInstantCast()) { float castTime = skill.castTimeMs; // command casting duration if (owner is Player) { // todo: modify spellSpeed based on modifiers and stuff ((Player)owner).SendStartCastbar(skill.id, Utils.UnixTimeStampUTC(DateTime.Now.AddMilliseconds(castTime))); } owner.GetSubState().chantId = 0xf0; owner.SubstateModified(); //You ready [skill] (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD) owner.DoBattleAction(skill.id, (uint)0x6F000000 | skill.castType, new CommandResult(target.actorId, 30126, 1, 0, 1)); } } }
public override void OnStart() { var returnCode = lua.LuaEngine.CallLuaBattleCommandFunction(owner, spell, "magic", "onMagicStart", owner, target, spell); if (returnCode != 0) { interrupt = true; errorResult = new CommandResult(target.actorId, (ushort)(returnCode == -1 ? 32553 : returnCode), 0, 0, 0, 1); } else { // todo: check within attack range float[] baseCastDuration = { 1.0f, 0.25f }; //There are no positional spells, so just check onCombo, need to check first because certain spells change aoe type/accuracy //If owner is a player and the spell being used is part of the current combo if (owner is Player && ((Player)owner).GetClass() == spell.job) { Player p = (Player)owner; if (spell.comboStep == 1 || ((p.playerWork.comboNextCommandId[0] == spell.id || p.playerWork.comboNextCommandId[1] == spell.id))) { lua.LuaEngine.CallLuaBattleCommandFunction(owner, spell, "magic", "onCombo", owner, target, spell); spell.isCombo = true; } } //Check combo stuff here because combos can impact spell cast times float spellSpeed = spell.castTimeMs; if (!spell.IsInstantCast()) { // command casting duration if (owner is Player) { // todo: modify spellSpeed based on modifiers and stuff ((Player)owner).SendStartCastbar(spell.id, Utils.UnixTimeStampUTC(DateTime.Now.AddMilliseconds(spellSpeed))); } owner.GetSubState().chantId = 0xf0; owner.SubstateModified(); owner.DoBattleAction(spell.id, (uint)0x6F000000 | spell.castType, new CommandResult(target.actorId, 30128, 1, 0, 1)); //You begin casting (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD) } } }
public override void OnStart() { var returnCode = lua.LuaEngine.CallLuaBattleCommandFunction(owner, skill, "weaponskill", "onSkillStart", owner, target, skill); if (returnCode != 0) { interrupt = true; errorResult = new CommandResult(owner.actorId, (ushort)(returnCode == -1 ? 32558 : returnCode), 0); } else { hitDirection = owner.GetHitDirection(target); //Do positionals and combo effects first because these can influence accuracy and amount of targets/numhits, which influence the rest of the steps //If there is no positon required or if the position bonus should be activated if ((skill.positionBonus & utils.BattleUtils.ConvertHitDirToPosition(hitDirection)) == skill.positionBonus) { //If there is a position bonus if (skill.positionBonus != BattleCommandPositionBonus.None) { //lua.LuaEngine.CallLuaBattleCommandFunction(owner, skill, "weaponskill", "onPositional", owner, target, skill); skill.CallLuaFunction(owner, "onPositional", owner, target, skill); } //Combo stuff if (owner is Player) { Player p = (Player)owner; //If skill is part of owner's class/job, it can be used in a combo if (skill.job == p.GetClass() || skill.job == p.GetCurrentClassOrJob()) { //If owner is a player and the skill being used is part of the current combo if (p.playerWork.comboNextCommandId[0] == skill.id || p.playerWork.comboNextCommandId[1] == skill.id) { lua.LuaEngine.CallLuaBattleCommandFunction(owner, skill, "weaponskill", "onCombo", owner, target, skill); skill.CallLuaFunction(owner, "onCombo", owner, target, skill); skill.isCombo = true; } //or if this just the start of a combo else if (skill.comboStep == 1) { skill.isCombo = true; } } } if (!skill.IsInstantCast()) { float castTime = skill.castTimeMs; // command casting duration if (owner is Player) { // todo: modify spellSpeed based on modifiers and stuff ((Player)owner).SendStartCastbar(skill.id, Utils.UnixTimeStampUTC(DateTime.Now.AddMilliseconds(castTime))); } owner.GetSubState().chantId = 0xf0; owner.SubstateModified(); //You ready [skill] (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD) owner.DoBattleAction(skill.id, (uint)0x6F000000 | skill.castType, new CommandResult(target.actorId, 30126, 1, 0, 1)); } } } }