예제 #1
0
파일: 760.cs 프로젝트: yanhan-dev/BNSAtomix
 public override void OnReceiveNPCCommand(ActorNPC npc, string command)
 {
     if (command == "q225.Start")
     {
         AI.Deactivate();
         AI.Pause = true;
         BeginTask();
         Delay(13);
         Move(-2342, 10776, 555, 116, 64);
         Move(-2322, 10753, 555, 312, 500);
         Move(-2301, 10731, 555, 312, 500);
         Move(-2288, 10716, 555, 312, 306);
         Move(-2284, 10711, 555, 306, 500, false);
         Move(-2280, 10705, 555, 306, 500, false);
         NPCChat(1559, 306);
         StartTask();
     }
     if (command == "q225.End")
     {
         AI.DueTime = 25000;
         AI.Activate();
         AI.Pause = false;
         BeginTask();
         Delay(180);
         Move(-2282, 10706, 555, 153, 32);
         Move(-2300, 10731, 555, 126, 500);
         Move(-2318, 10756, 555, 126, 500);
         Move(-2330, 10772, 555, 126, 322);
         Move(-2337, 10774, 555, 159, 500, false);
         Move(-2343, 10777, 555, 159, 428, false);
         Move(-2343, 10777, 555, 196, 0);
         NPCChat(2336, 196);
         StartTask();
     }
 }
예제 #2
0
 public override void OnReceiveNPCCommand(ActorNPC npc, string command)
 {
     if (command == "q224.Start")
     {
         Disappear();
     }
 }
예제 #3
0
 public override void OnReceiveNPCCommand(ActorNPC npc, string command)
 {
     if (command == "q225.Start")
     {
         AI.Deactivate();
         BeginTask();
         AI.Pause = true;
         Delay(10);
         Move(-2156, 10566, 555, 350, 274);
         Move(-2177, 10588, 555, 132, 500);
         Move(-2197, 10610, 555, 132, 500);
         Move(-2208, 10622, 557, 132, 258);
         Move(-2216, 10624, 557, 166, 444, false);
         NPCChat(1557, 166);
         StartTask();
     }
     if (command == "q225.End")
     {
         AI.DueTime = 25000;
         AI.Activate();
         AI.Pause = false;
         BeginTask();
         Delay(180);
         Move(-2214, 10621, 557, 304, 48);
         Move(-2194, 10598, 555, 312, 500);
         Move(-2174, 10575, 555, 312, 500);
         Move(-2169, 10570, 555, 312, 112);
         Move(-2160, 10569, 555, 348, 500, false);
         Move(-2155, 10567, 555, 348, 277, false);
         Move(-2155, 10567, 555, 337, 0);
         NPCChat(2334, 337);
         StartTask();
     }
 }
    public void CreateNPC(int collectionDataID, int state)
    {
        this.RemoveNPC(collectionDataID);
        ActorNPC value = NPCManager.Instance.CreateNPC(collectionDataID, DataReader <CaiJiPeiZhi> .Get(collectionDataID).model, new CollectionNPCBehavior(collectionDataID, state));

        this.collectionNPCData.Add(collectionDataID, value);
    }
예제 #5
0
파일: 763.cs 프로젝트: yanhan-dev/BNSAtomix
 public override void OnReceiveNPCCommand(ActorNPC npc, string command)
 {
     if (command == "q225.Start")
     {
         AI.Deactivate();
         AI.Pause = true;
         BeginTask();
         Delay(10);
         Move(-2386, 10641, 555, 270, 48);
         Move(-2355, 10645, 555, 8, 500);
         Move(-2324, 10650, 555, 8, 500);
         Move(-2306, 10653, 557, 8, 290);
         Move(-2298, 10652, 557, 350, 500, false);
         Move(-2295, 10651, 557, 350, 187, false);
         NPCChat(1558, 350);
         StartTask();
     }
     if (command == "q225.End")
     {
         AI.DueTime = 25000;
         AI.Activate();
         AI.Pause = false;
         BeginTask();
         Delay(180);
         Move(-2299, 10651, 557, 180, 64);
         Move(-2329, 10645, 555, 192, 500);
         Move(-2360, 10639, 555, 192, 500);
         Move(-2373, 10636, 555, 192, 209);
         Move(-2381, 10638, 555, 164, 500, false);
         Move(-2387, 10640, 555, 164, 375, false);
         Move(-2387, 10640, 555, 147, 0);
         NPCChat(2335, 147);
         StartTask();
     }
 }
예제 #6
0
        public void OnActorSelection(ActorPC sActor, MapEventArgs args)
        {
            Map.ActorSelArgs arg = (Map.ActorSelArgs)args;
            Packets.Server.ActorSelection sendSelectionPacket = new SagaMap.Packets.Server.ActorSelection();
            Map map;

            MapManager.Instance.GetMap(sActor.Map, out map);
            Actor dActor = map.GetActor(arg.target);

            sendSelectionPacket.SetSourceActorID(sActor.id);
            if (dActor != null)
            {
                if (dActor.type == ActorType.NPC)
                {
                    ActorNPC npc = (ActorNPC)dActor;
                    sendSelectionPacket.SetHP(npc.HP);
                    sendSelectionPacket.SetMaxHP(npc.maxHP);
                    sendSelectionPacket.SetSP(npc.SP);
                    sendSelectionPacket.SetMaxSP(npc.maxSP);
                }
                if (dActor.type == ActorType.PC)
                {
                    ActorPC pc = (ActorPC)dActor;
                    sendSelectionPacket.SetHP(pc.HP);
                    sendSelectionPacket.SetMaxHP(pc.maxHP);
                    sendSelectionPacket.SetSP(pc.SP);
                    sendSelectionPacket.SetMaxSP(pc.maxSP);
                }
                sendSelectionPacket.SetTargetActorID(dActor.id);
            }
            this.C.netIO.SendPacket(sendSelectionPacket, this.C.SessionID);
        }
예제 #7
0
    public void CreateNPC(int npcDataID, NPCInformation info)
    {
        this.RemoveNPC(npcDataID);
        ActorNPC value = NPCManager.Instance.CreateNPC(npcDataID, DataReader <NPC> .Get(npcDataID).model, new TaskNPCBehavior(npcDataID, this.SetNPCCurrentState(npcDataID, info)));

        this.taskNPCData.Add(npcDataID, value);
    }
예제 #8
0
 public override void OnReceiveNPCCommand(ActorNPC npc, string command)
 {
     if (npc != NPC && command == "q226_1_finished")
     {
         Disappear(2339);
     }
 }
예제 #9
0
 public static void Proc(ref Actor sActor, ref Actor dActor, ref Map.SkillArgs args)
 {
     if (sActor.type == ActorType.PC)
     {
         ActorPC pc = (ActorPC)sActor;
         if (!SkillHandler.CheckSkillSP(pc, args.skillID))
         {
             SkillHandler.SetSkillFailed(ref args);
             return;
         }
         args.damage     = 0;
         args.isCritical = SkillHandler.CalcCrit(sActor, dActor, args, SkillHandler.AttackType.Physical);
         if (args.isCritical != Map.SkillArgs.AttackResult.Miss && args.isCritical != Map.SkillArgs.AttackResult.Block)
         {
             if (dActor.type == ActorType.NPC)
             {
                 ActorNPC npc = (ActorNPC)dActor;
                 if (npc.npcType >= 10000 && npc.npcType < 50000)
                 {
                     Mob mob = (Mob)npc.e;
                     if (mob.Hate.ContainsKey(sActor.id))
                     {
                         mob.Hate[sActor.id] = 65535;
                     }
                     else
                     {
                         mob.Hate.Add(sActor.id, 65535);
                     }
                 }
             }
         }
     }
 }
예제 #10
0
        public void OnNPCShopSell(SagaMap.Packets.Client.NPCShopSell p)
        {
            if (this.state != SESSION_STATE.MAP_LOADED)
            {
                return;
            }
            try
            {
                if (this.Char.CurTarget == null)
                {
                    return;
                }
                ActorNPC npc     = (ActorNPC)this.Char.CurTarget;
                Item     item    = this.Char.inv.GetItem((CONTAINER_TYPE)p.GetContainer(), p.GetIndex()); // TODO:  Theres gotta be a better way to do this.
                byte     ammount = p.GetAmount();
                uint     price   = item.price * ammount;

                this.map.RemoveItemFromActorPC(this.Char, p.GetIndex(), item.id, ammount, ITEM_UPDATE_REASON.SOLD);

                this.Char.zeny += (price / 4);
                this.SendZeny();
            }
            catch (Exception)
            {
                SendMessage("Saga", "Error on selling this item!", SagaMap.Packets.Server.SendChat.MESSAGE_TYPE.SYSTEM_MESSAGE);
                //Logger.ShowWarning( ex, null );
            }
        }
예제 #11
0
 private static void CalcHitNPC(ref ActorNPC npc)
 {
     if (npc.BattleStatus.hit == 0)
     {
         npc.BattleStatus.hit = 1;                            //hit must be greater than 0
     }
 }
예제 #12
0
        public void OnNPCShopBuy(SagaMap.Packets.Client.NPCShopBuy p)
        {
            if (this.state != SESSION_STATE.MAP_LOADED)
            {
                return;
            }
            ActorNPC npc  = (ActorNPC)this.Char.CurTarget;
            Item     item = new Item(npc.NPCinv[p.GetIndex()].id);
            Npc      n    = (Npc)npc.e;

            item.creatorName = n.Name;
            byte amount = p.GetAmount();

            if (!this.Char.inv.HasFreeSpace())
            {
                this.SendMessage(n.Name, "You do not have enough space in your inventory!");
                return;
            }
            uint price = item.price * amount;

            if (this.Char.zeny < price)
            {
                return;
            }
            this.Char.zeny -= price;
            this.SendZeny();
            item.stack = amount;
            this.map.AddItemToActor(this.Char, item, ITEM_UPDATE_REASON.SOLD);
        }
예제 #13
0
 private void OnTriggerExit(Collider other)
 {
     if (ActorNPC.IsColliderActorSelf(other))
     {
         this.OnActSelfTriggerExit(other);
     }
 }
예제 #14
0
        // 0x06 Packets =========================================

        public void OnGetHateInfo(SagaMap.Packets.Client.GetHateInfo p)
        {
            ActorNPC actor = (ActorNPC)map.GetActor(p.GetActorID());

            if (actor == null)
            {
                return;
            }
            if (actor.npcType < 10000)
            {
                return;
            }
            Mob mob = (Mob)actor.e;

            if (this.state != SESSION_STATE.MAP_LOADED)
            {
                return;
            }
            Packets.Server.SendHateInfo sendPacket = new SagaMap.Packets.Server.SendHateInfo();
            sendPacket.SetActor(p.GetActorID());
            if (mob.Hate.ContainsKey(this.Char.id))
            {
                sendPacket.SetHateInfo(mob.Hate[this.Char.id]); // 0 hate = No reason to attack, client stops attacking.
            }
            else
            {
                sendPacket.SetHateInfo(0); // 0 hate = No reason to attack, client stops attacking.
            }
            this.netIO.SendPacket(sendPacket, this.SessionID);
        }
예제 #15
0
    public void CreateNPC(int hearthDataID)
    {
        this.RemoveNPC(hearthDataID);
        ActorNPC value = NPCManager.Instance.CreateNPC(hearthDataID, DataReader <ChuanSongMenNPC> .Get(hearthDataID).model, new HearthNPCBehavior(hearthDataID));

        this.hearthNPCData.Add(hearthDataID, value);
    }
예제 #16
0
 private void OnTriggerEnter(Collider other)
 {
     if (ActorNPC.IsColliderActorSelf(other))
     {
         base.SendMessageUpwards("OnActSelfTriggerEnter", other, 1);
     }
 }
예제 #17
0
 public static void Proc(ref Actor sActor, ref Actor dActor, ref Map.SkillArgs args)
 {
     if (sActor.type == ActorType.PC)
     {
         ActorPC pc = (ActorPC)sActor;
         ActorEventHandlers.PC_EventHandler eh = (SagaMap.ActorEventHandlers.PC_EventHandler)sActor.e;
         if (!SkillHandler.CheckSkillSP(pc, args.skillID) || pc.LP < 1)
         {
             SkillHandler.SetSkillFailed(ref args);
             return;
         }
         pc.LP -= 1;
         eh.C.SendCharStatus(0);
         Map map;
         if (dActor.mapID == 0)
         {
             if (dActor.type == ActorType.PC)
             {
                 eh           = (SagaMap.ActorEventHandlers.PC_EventHandler)dActor.e;
                 dActor.mapID = (byte)eh.C.map.ID;
             }
         }
         if (MapManager.Instance.GetMap(dActor.mapID, out map))
         {
             foreach (Actor actor in map.GetActorsArea(dActor, 500, true))
             {
                 Actor tmp = actor;
                 if (actor == sActor || actor.stance == Global.STANCE.DIE || actor.type != ActorType.NPC)
                 {
                     continue;
                 }
                 args.damage     = 0;
                 args.isCritical = SkillHandler.CalcCrit(sActor, actor, args, SkillHandler.AttackType.Physical);
                 ActorNPC npc = (ActorNPC)actor;
                 if (npc.npcType < 10000)
                 {
                     continue;
                 }
                 if (args.isCritical != Map.SkillArgs.AttackResult.Miss && args.isCritical != Map.SkillArgs.AttackResult.Block)
                 {
                     ActorPC targetPC = (ActorPC)sActor;
                     args.damage = CalcDamage(sActor, actor, args);
                 }
                 SkillHandler.PhysicalAttack(ref sActor, ref tmp, args.damage, SkillHandler.AttackElements.NEUTRAL, ref args);
                 if (actor != dActor)
                 {
                     args.targetActorID = actor.id;
                     map.SendEventToAllActorsWhoCanSeeActor(Map.EVENT_TYPE.SKILL, args, sActor, true);
                 }
             }
             args.targetActorID = dActor.id;
         }
         else
         {
             SkillHandler.SetSkillFailed(ref args);
             return;
         }
     }
 }
예제 #18
0
파일: AI.cs 프로젝트: yanhan-dev/BNSAtomix
 public AI(ActorNPC npc)
     : base(2000, 1000, "NPCAI")
 {
     this.npc   = npc;
     IsSlowTask = true;
     Status     = AIStatus.Normal;
     SmartEngine.Network.Map.PathFinding.PathFinding.MaxIteration = 50;
 }
예제 #19
0
 public void RemoveNPC(ActorNPC npc)
 {
     if (npc == null)
     {
         return;
     }
     this.npcLogicList.Remove(npc);
     npc.Release();
 }
예제 #20
0
 private static void CalcAtkNPC(ref ActorNPC npc)
 {
     try
     {
         Mob mob = (Mob)npc.e;
         npc.BattleStatus.atk = Global.Random.Next((int)mob.MinAtk, (int)mob.MaxAtk) + npc.BattleStatus.atkskill;
     }
     catch (Exception) { }
 }
예제 #21
0
 public Attack(AI ai, ActorNPC self, ActorExt target)
 {
     this.ai     = ai;
     this.self   = self;
     this.target = target;
     map         = Map.MapManager.Instance.GetMap(self.MapInstanceID);
     ai.Period   = 400;
     Init();
 }
예제 #22
0
 public override void OnReceiveNPCCommand(ActorNPC npc, string command)
 {
     if (command == "q303_end")
     {
         BeginTask();
         Delay(5);
         NPCChat(1623, 84);
         StartTask();
     }
 }
예제 #23
0
 public override void OnReceiveNPCCommand(ActorNPC npc, string command)
 {
     if (command == "q224.Start2")
     {
         BeginTask();
         Delay(50);
         NPCChat(1565, 300);
         StartTask();
     }
 }
예제 #24
0
    public ActorNPC CreateNPC(int id, int modelID, NPCBehavior npcEvent)
    {
        GameObject gameObject = new GameObject();

        UGUITools.ResetTransform(gameObject.get_transform(), NPCPool.Instance.root.get_transform());
        ActorNPC actorNPC = gameObject.AddUniqueComponent <ActorNPC>();

        actorNPC.Init(id, modelID, npcEvent);
        this.npcLogicList.Add(actorNPC);
        return(actorNPC);
    }
예제 #25
0
        public RespawnTask(int respawnTime, ActorNPC actor)
            : base(respawnTime, respawnTime, "Respawn")
        {
            this.actor = actor;
            if (actor.Tasks.TryRemove("Respawn", out Task removed))
            {
                removed.Deactivate();
            }

            actor.Tasks["Respawn"] = this;
        }
예제 #26
0
    public void CreateNPC(int id, int monsterID, bool isMultiBoss, int lv, Pos pos, List <int> dir, int state)
    {
        if (this.wildBossNPCData.ContainsKey(id))
        {
            return;
        }
        Monster monster = DataReader <Monster> .Get(monsterID);

        ActorNPC value = NPCManager.Instance.CreateNPC(id, monster.model, new BossNPCBehavior(monsterID, isMultiBoss, lv, pos, dir, state));

        this.wildBossNPCData.Add(id, value);
    }
예제 #27
0
 public Chase(AI ai, ActorNPC self, ActorExt target)
 {
     this.ai     = ai;
     this.self   = self;
     this.target = target;
     map         = Map.MapManager.Instance.GetMap(self.MapInstanceID);
     ai.Period   = (int)(1000 / ((float)self.Speed / 100));
     ai.Period   = SmartEngine.Network.Global.Random.Next(ai.Period - ai.Period / 20, ai.Period + ai.Period / 20);
     if (self.BaseData.NoMove)
     {
         status = CommandStatus.Finished;
     }
 }
예제 #28
0
파일: Map.cs 프로젝트: x3sphiorx/SagaRO2
        public void MobAIToggle(uint region, bool toggle)
        {
            List <Actor> actors;

            if (!this.actorsByRegion.ContainsKey(region))
            {
                return;
            }
            actors = this.actorsByRegion[region];
            foreach (Actor actor in actors)
            {
                if (actor.type == ActorType.NPC)
                {
                    ActorNPC npc = (ActorNPC)actor;
                    if (npc.npcType >= 10000 && npc.npcType < 50000)
                    {
                        Mob mob = (Mob)npc.e;
                        if (mob.ai == null)
                        {
                            continue;
                        }
                        switch (toggle)
                        {
                        case true:
                            mob.ai.Start();
                            break;

                        case false:
                            Tasks.MobTasks.AICommands.Attack att = null;
                            if (mob.ai.commands.ContainsKey("Attack"))
                            {
                                att = (Tasks.MobTasks.AICommands.Attack)mob.ai.commands["Attack"];
                            }
                            if (mob.ai.commands.ContainsKey("Chase"))
                            {
                                continue;
                            }
                            if (att != null)
                            {
                                if (att.active == true)
                                {
                                    continue;
                                }
                            }
                            mob.ai.Pause();
                            break;
                        }
                    }
                }
            }
        }
예제 #29
0
 public void ClearAllNPCs()
 {
     TaskNPCManager.Instance.ClearNPC();
     WildBossNPCManager.Instance.ClearNPC();
     HearthNPCManager.Instance.ClearNPC();
     CollectionNPCManager.Instance.ClearNPC();
     GuildWarMineNPCManager.Instance.ClearNPC();
     for (int i = 0; i < this.npcLogicList.get_Count(); i++)
     {
         ActorNPC actorNPC = this.npcLogicList.get_Item(i);
         actorNPC.Release();
     }
     this.npcLogicList.Clear();
 }
예제 #30
0
 public Move(AI ai, ActorNPC self, short x, short y, short z)
 {
     this.ai   = ai;
     this.self = self;
     this.x    = x;
     this.y    = y;
     this.z    = z;
     map       = Map.MapManager.Instance.GetMap(self.MapInstanceID);
     ai.Period = (int)(2000 / ((float)self.Speed / 200));
     if (self.BaseData.NoMove)
     {
         status = CommandStatus.Finished;
     }
 }
예제 #31
0
        public override void CreateModel()
        {
            //AvatarModelData data = AvatarModelData.dataMap[(int)vocation];
            LoggerHelper.Debug("EntityNPC create:" + ID);

            int modelID = NPCData.dataMap[(int)ID].mode;

            if (!AvatarModelData.dataMap.ContainsKey(modelID) && modelID != 150000)
                return;

            if (modelID != 150000)
            {
                AvatarModelData data = AvatarModelData.dataMap[modelID];

                AssetCacheMgr.GetInstanceAutoRelease(data.prefabName,
                    (prefab, guid, gameObject) =>
                    {
                        GameObject = gameObject as GameObject;
                        Transform = (gameObject as GameObject).transform;
                        Transform.position = position;
                        Transform.eulerAngles = rotation;
                        // Transform.localScale = scale;

                        animator = GameObject.GetComponent<Animator>();
                        SetIdleAction();

                        motor = null;
                        npcMotor = GameObject.AddComponent<MogoMotorNPC>();

                        Transform.tag = "NPC";
                        GameObject.layer = 17;
                        UpdatePosition();

                        ap = Transform.GetComponent<ActorNPC>();
                        if (ap == null)
                        {
                            Transform.gameObject.AddComponent<ActorNPC>();
                            ap = Transform.GetComponent<ActorNPC>();
                            (ap as ActorNPC).theEntity = this;
                        }

                        SphereCollider collider = Transform.gameObject.AddComponent<SphereCollider>();
                        collider.isTrigger = true;
                        collider.center = Vector3.zero;
                        collider.radius = NPCData.dataMap[(int)ID].colliderRange / ((Transform.localScale.x < Transform.localScale.y ? Transform.localScale.x : Transform.localScale.y) < Transform.localScale.z ? (Transform.localScale.x < Transform.localScale.y ? Transform.localScale.x : Transform.localScale.y) : Transform.localScale.z);

                        BillboardLogicManager.Instance.AddInfoBillboard(ID, Transform, this, false);
                        BillboardLogicManager.Instance.SetHead(this);
                        EventDispatcher.TriggerEvent<Vector3,uint>(BillboardLogicManager.BillboardLogicEvent.UPDATEBILLBOARDPOS, Transform.position,ID);

                        MogoFXManager.Instance.AddShadow(GameObject, ID, 1 / Transform.localScale.x, 1 / Transform.localScale.y, 1 / Transform.localScale.z);

                        if (MogoWorld.thePlayer.CurrentTask != null)
                        {
                            if (MogoWorld.thePlayer.CurrentTask.conditionType == 1 && MogoWorld.thePlayer.CurrentTask.condition != null
                                && MogoWorld.thePlayer.CurrentTask.condition.Count >= 3 && TaskData.dataMap.Get(MogoWorld.thePlayer.CurrentTask.condition[2]).npc == (int)ID)
                            {
                                SetNPCSign(NPCSignState.Doing);
                            }

                            if (MogoWorld.thePlayer.CurrentTask.isShowNPCTip == 1)
                            {
                                SetNPCSign(NPCSignState.Done);
                            }
                        }

                        ((GameObject)gameObject).AddComponent<MogoObjOpt>().ObjType = MogoObjType.NPC;

                        if (((GameObject)gameObject).GetComponent<Animator>() != null)
                        {
                            ((GameObject)gameObject).GetComponent<Animator>().enabled = false;
                        }

                        if (((GameObject)gameObject).GetComponent<Animation>() != null)
                        {
                            ((GameObject)gameObject).GetComponent<Animation>().enabled = false;
                        }

                        if (!NPCManager.npcEntitiePosition.ContainsKey((uint)ID))
                            NPCManager.npcEntitiePosition.Add((uint)ID, Transform.position);

                        EventDispatcher.TriggerEvent(Events.TaskEvent.CheckNpcInRange);

                        NPCCheckThink();
                    }
                );
            }
            else
            {
                GameObject = new GameObject();
                GameObject.name = "Sky_NPC";
                Transform = GameObject.transform;
                Transform.position = position;
                Transform.eulerAngles = rotation;
                // Transform.localScale = scale;
                Transform.tag = "NPC";

                UpdatePosition();

                ActorNPC ap = Transform.GetComponent<ActorNPC>();
                if (ap == null)
                {
                    Transform.gameObject.AddComponent<ActorNPC>();
                    ap = Transform.GetComponent<ActorNPC>();
                    (ap as ActorNPC).theEntity = this;
                }

                SphereCollider collider = Transform.gameObject.AddComponent<SphereCollider>();
                collider.isTrigger = true;
                collider.center = Vector3.zero;
                collider.radius = 5;
            }
        }