public override void Cast(SkillCast skillCast) { int spiritCost = skillCast.GetSpCost(); int staminaCost = skillCast.GetStaCost(); if (Value.Stats[StatId.Spirit].Total < spiritCost || Value.Stats[StatId.Stamina].Total < staminaCost) { return; } SkillCast = skillCast; ConsumeSp(spiritCost); ConsumeStamina(staminaCost); Value.Session.SendNotice(skillCast.SkillId.ToString()); // TODO: Move this and all others combat cases like recover sp to its own class. // Since the cast is always sent by the skill, we have to check buffs even when not doing damage. if (skillCast.IsBuffToOwner() || skillCast.IsBuffToEntity() || skillCast.IsBuffShield() || skillCast.IsDebuffToOwner()) { Status status = new(skillCast, ObjectId, ObjectId, 1); StatusHandler.Handle(Value.Session, status); } Value.Session.FieldManager.BroadcastPacket(SkillUsePacket.SkillUse(skillCast)); Value.Session.Send(StatPacket.SetStats(this)); StartCombatStance(); }
public override void Execute(GameCommandTrigger trigger) { int id = trigger.Get <int>("id"); if (SkillMetadataStorage.GetSkill(id) == null) { trigger.Session.SendNotice($"No skill found with id: {id}"); return; } short level = trigger.Get <short>("level") <= 10 && trigger.Get <short>("level") != 0 ? trigger.Get <short>("level") : (short)1; // The Status packet needs this in miliseconds, we are converting them here for the user to just input the actual seconds. int duration = trigger.Get <int>("duration") <= 3600 && trigger.Get <int>("duration") != 0 ? trigger.Get <int>("duration") * 1000 : 10000; int stacks = trigger.Get <int>("stacks") == 0 ? 1 : trigger.Get <int>("stacks"); SkillCast skillCast = new SkillCast(id, level); if (skillCast.IsBuffToOwner() || skillCast.IsBuffToEntity() || skillCast.IsBuffShield() || skillCast.IsGM() || skillCast.IsGlobal() || skillCast.IsHealFromBuff()) { Status status = new Status(skillCast, trigger.Session.FieldPlayer.ObjectId, trigger.Session.FieldPlayer.ObjectId, stacks); StatusHandler.Handle(trigger.Session, status); return; } trigger.Session.SendNotice($"Skill with id: {id} is not a buff to the owner."); }
public virtual void Cast(SkillCast skillCast) { SkillCast = skillCast; // TODO: Move this and all others combat cases like recover sp to its own class. // Since the cast is always sent by the skill, we have to check buffs even when not doing damage. if (skillCast.IsBuffToOwner() || skillCast.IsBuffToEntity() || skillCast.IsBuffShield() || skillCast.IsDebuffToOwner()) { Status status = new(skillCast, ObjectId, ObjectId, 1); //StatusHandler.Handle(Value.Session, status); } }