Exemplo n.º 1
0
        public void OnUseOffensiveSkill(Packets.Client.UseOffensiveSkill p)
        {
            if (this.state != SESSION_STATE.MAP_LOADED) return;
            // Attack
            try
            {
                if (p.GetSkillType() != 9)
                {
                    Map.SkillArgs sArgs;
                    Actor aActor = this.map.GetActor(p.GetTargetActorID());
                    Actor sActor = (Actor)this.Char;
                    sArgs = new Map.SkillArgs(p.GetSkillType(), 0, p.GetSkillID(), p.GetTargetActorID(), 0);
                    //cast skill
                    if (aActor == null)
                    {
                        sArgs.isCritical = Map.SkillArgs.AttackResult.Miss;
                        sArgs.failed = true;
                        this.map.SendEventToAllActorsWhoCanSeeActor(Map.EVENT_TYPE.SKILL, sArgs, this.Char, true);
                        return;
                    }
                    SkillHandler.CastSkill(ref sActor, ref aActor, ref sArgs);
                    if (aActor.type == ActorType.NPC)
                    {
                        Map.ActorSelArgs arg = new Map.ActorSelArgs(aActor.id);
                        this.map.SendEventToAllActorsWhoCanSeeActor(Map.EVENT_TYPE.ACTOR_SELECTION, arg, this.Char, true);
                    }
                    if (aActor.type == ActorType.PC && aActor.id != this.Char.id)
                    {
                        Map.ActorSelArgs arg = new Map.ActorSelArgs(aActor.id);
                        this.map.SendEventToAllActorsWhoCanSeeActor(Map.EVENT_TYPE.ACTOR_SELECTION, arg, this.Char, true);
                    }

                    this.map.SendEventToAllActorsWhoCanSeeActor(Map.EVENT_TYPE.SKILL, sArgs, this.Char, true);
                }

                // Emoticon
                if (p.GetSkillType() == 9)
                {
                    this.map.SendEventToAllActorsWhoCanSeeActor(Map.EVENT_TYPE.SKILL, new Map.SkillArgs(p.GetSkillType(), 0, p.GetSkillID(), p.GetTargetActorID(), (uint)Global.Random.Next()), this.Char, true);
                }
            }
            catch (Exception ex)
            {
                Logger.ShowError(ex, null);
            }
        }
Exemplo n.º 2
0
        // 0x09 Packets =========================================
        public void OnSkillCast(Packets.Client.SkillCast p)
        {
            if (this.state != SESSION_STATE.MAP_LOADED) return;
            // Attack
            if (p.GetSkillType() != 9)
            {
                Map.SkillArgs sArgs;
                Actor aActor = this.map.GetActor(p.GetTargetActorID());
                Actor sActor = (Actor)this.Char;
                sArgs = new Map.SkillArgs(p.GetSkillType(), 0, p.GetSkillID(), p.GetTargetActorID(), 0);
                sArgs.casting = true;
                if (aActor == null)
                {
                    sArgs.isCritical = Map.SkillArgs.AttackResult.Miss;
                    sArgs.failed = true;
                    this.map.SendEventToAllActorsWhoCanSeeActor(Map.EVENT_TYPE.SKILL, sArgs, this.Char, true);
                    return;
                }
                //cast skill
                if (aActor.type == ActorType.NPC)
                {
                    Map.ActorSelArgs arg = new Map.ActorSelArgs(aActor.id);
                    this.map.SendEventToAllActorsWhoCanSeeActor(Map.EVENT_TYPE.ACTOR_SELECTION, arg, this.Char, true);
                }
                if (aActor.type == ActorType.PC && aActor.id != this.Char.id)
                {
                    Map.ActorSelArgs arg = new Map.ActorSelArgs(aActor.id);
                    this.map.SendEventToAllActorsWhoCanSeeActor(Map.EVENT_TYPE.ACTOR_SELECTION, arg, this.Char, true);
                }

                this.map.SendEventToAllActorsWhoCanSeeActor(Map.EVENT_TYPE.SKILL, sArgs, this.Char, true);
            }
        }