Esempio n. 1
0
        //09 0A
        public void OnItemToggle(SagaMap.Packets.Client.ItemToggle p)
        {
            if (this.state != SESSION_STATE.MAP_LOADED)
            {
                return;
            }

            Actor target;

            Map.SkillArgs args;
            Actor         sActor = (Actor)this.Char;
            int           id;
            byte          index = p.GetIndex();

            target = this.map.GetActor(p.GetTargetID());
            args   = new Map.SkillArgs(p.GetSkillType(), 0, p.GetSkillID(), p.GetTargetID(), 0);
            SkillHandler.CastSkill(ref sActor, ref target, ref args);
            Packets.Server.ItemActive packet = new SagaMap.Packets.Server.ItemActive();
            packet.SetSkillType(p.GetSkillType());
            packet.SetContainer(p.GetContainer());
            packet.SetIndex(p.GetIndex());
            packet.SetSkillID(p.GetSkillID());
            packet.SetSActor(this.Char.id);
            packet.SetDActor(p.GetTargetID());
            packet.SetValue(args.damage);
            this.netIO.SendPacket(packet, this.SessionID);;
            this.SendCharStatus(0);
            Item item = this.Char.inv.GetItem((CONTAINER_TYPE)p.GetContainer(), index);

            id = item.id;
            this.map.RemoveItemFromActorPC(this.Char, index, id, 1, ITEM_UPDATE_REASON.PURCHASED);
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
0
 public void OnSkillToggle(Packets.Client.SkillToggle p)
 {
     if (this.state != SESSION_STATE.MAP_LOADED)
     {
         return;
     }
     // Attack
     if (p.GetSkillType() != 9)
     {
         Map.SkillArgs sArgs;
         Actor         aActor = (Actor)this.Char;
         Actor         sActor = (Actor)this.Char;
         sArgs = new Map.SkillArgs(p.GetSkillType(), 0, p.GetSkillID(), sActor.id, 0);
         //cast skill
         SkillHandler.CastSkill(ref sActor, ref aActor, ref sArgs);
         Packets.Server.SkillToggle p1 = new SagaMap.Packets.Server.SkillToggle();
         p1.SetSkillType(p.GetSkillType());
         p1.SetSkillID(p.GetSkillID());
         p1.SetToggle(sArgs.failed);
         this.netIO.SendPacket(p1, this.SessionID);
         sArgs.failed = false;
         this.map.SendEventToAllActorsWhoCanSeeActor(Map.EVENT_TYPE.SKILL, sArgs, this.Char, true);
     }
 }