public static void NOVICE_MARTIALARTS(SkillBaseEventArgs bargument) { SkillToggleEventArgs arguments = (SkillToggleEventArgs)bargument; Actor starget = arguments.Target as Actor; Common.Skills.CreateAddition(starget, arguments.Addition); }
public static void RECRUIT_BAYONETSTANCE(SkillBaseEventArgs bargument) { Console.WriteLine("Bayonet stance"); if (bargument.Context == Saga.Enumarations.SkillContext.SkillToggle) { bargument.Failed = false; SkillToggleEventArgs arguments = (SkillToggleEventArgs)bargument; Actor starget = arguments.Target as Actor; arguments.Toggle(starget, arguments.SpellInfo.addition); } }
public static void CLOWN_SUPPORTIVESTANCE(SkillBaseEventArgs bargument) { if (bargument.Context == Saga.Enumarations.SkillContext.SkillToggle) { SkillToggleEventArgs arguments = (SkillToggleEventArgs)bargument; Actor starget = arguments.Target as Actor; if (Common.Skills.HasAddition(starget, arguments.Addition)) { Common.Skills.DeleteStaticAddition(starget, arguments.Addition); } else { Common.Skills.CreateAddition(starget, arguments.Addition); } } }
public static void NOVICE_ACTDEAD(SkillBaseEventArgs bargument) { if (bargument.Context == Saga.Enumarations.SkillContext.SkillToggle) { SkillToggleEventArgs arguments = (SkillToggleEventArgs)bargument; Actor starget = arguments.Target as Actor; if (Common.Skills.HasAddition(starget, arguments.Addition)) { Common.Skills.DeleteStaticAddition(starget, arguments.Addition); } else { Common.Skills.CreateAddition(starget, arguments.Addition, 30000); } } }
/// <summary> /// Occurs when toggling between skills (aka stances) /// </summary> /// <param name="cpkt"></param> private void CM_SKILLTOGGLE(CMSG_SKILLTOGLE cpkt) { lock (this.character.cooldowncollection) { try { uint skillid = cpkt.SkillID; byte skilltype = cpkt.SkillType; SkillToggleEventArgs argument = null; bool cancast = SkillToggleEventArgs.Create(skillid, this.character, this.character, out argument) && argument.SpellInfo.casttime > -1 && (argument.SpellInfo.casttime == 0 || this.character._lastcastedskill == skillid) && Environment.TickCount - this.character._lastcastedtick > 0 && (argument.SpellInfo.delay == 0 || !this.character.cooldowncollection.IsCoolDown(skillid)) && (argument.SpellInfo.maximumrange == 0 || argument.SpellInfo.IsInRangeOf((int)(Vector.GetDistance2D(this.character.Position, this.character.Position)))) && argument.SpellInfo.requiredWeapons[this.character.weapons.GetCurrentWeaponType()] == 1 && this.character.jlvl >= argument.SpellInfo.requiredJobs[this.character.job - 1] && argument.SpellInfo.IsTarget(this.character, this.character); if (cancast && argument.Use()) { int delay = (int)(argument.SpellInfo.delay - ((character.stats.Dexterity * 2) + (character.stats.Concentration * 2))); if (delay > 0) { this.character.cooldowncollection.Add(skillid, delay); } this.character.cooldowncollection.Update(); SMSG_SKILLTOGLE spkt2 = new SMSG_SKILLTOGLE(); spkt2.SkillID = cpkt.SkillID; spkt2.SkillType = cpkt.SkillType; spkt2.SessionId = this.character.id; spkt2.Toggle = argument.Failed; this.Send((byte[])spkt2); if (character._status.Updates > 0) { LifeCycle.Update(character); character._status.Updates = 0; } Regiontree tree = this.character.currentzone.Regiontree; foreach (Character regionObject in tree.SearchActors(this.character, SearchFlags.Characters)) { SMSG_OFFENSIVESKILL spkt = new SMSG_OFFENSIVESKILL(); spkt.Damage = argument.Damage; spkt.SourceActor = this.character.id; spkt.TargetActor = this.character.id; spkt.SessionId = regionObject.id; spkt.SkillID = cpkt.SkillID; regionObject.client.Send((byte[])spkt); } } else { Console.WriteLine("Stance failed"); SMSG_SKILLTOGLE spkt2 = new SMSG_SKILLTOGLE(); spkt2.SkillID = cpkt.SkillID; spkt2.SkillType = cpkt.SkillType; spkt2.SessionId = this.character.id; spkt2.Toggle = true; this.Send((byte[])spkt2); } } catch (Exception e) { Trace.TraceError("Exception processing the skill {0}", e.ToString()); //Skill failed SMSG_OFFENSIVESKILLFAILED spkt = new SMSG_OFFENSIVESKILLFAILED(); spkt.SkillID = cpkt.SkillID; spkt.SkillType = cpkt.SkillType; spkt.SourceActor = this.character.id; spkt.SessionId = this.character.id; this.Send((byte[])spkt); } } }