Exemplo n.º 1
0
        public override void OnNpcDie(ObjNPC npc, ulong characterId = 0)
        {
            if (npc == null)
            {
                return;
            }
            base.OnNpcDie(npc, characterId);
            bool bSend = false;

            Table.ForeachBossHome(tb =>
            {
                id        = tb.Id;
                isDie     = 0;
                BossScene = tb.Scene;
                if (tb.CharacterBaseId == npc.TypeId)
                {
                    bSend = true;
                    isDie = 1;
                    dicBoss.Remove(tb.SceneNpcId);
                    return(false);
                }
                return(true);
            });
            if (bSend == true)
            {
                var idx = MapNpcRecords.FindIndex(r => r.NpcID == npc.TypeId);
                if (idx == -1)
                {
                    return;
                }
                var info = MapNpcInfo.Data[idx];
                info.Alive = false;
                var data = new MapNpcInfos();
                data.Data.Add(info);
                PushActionToAllPlayer(p =>
                {
                    if (p.Proxy == null)
                    {
                        return;
                    }
                    p.Proxy.NotifyNpcStatus(data);
                });
            }
            CoroutineFactory.NewCoroutine(GetNPCDie, (ulong)0, npc.TypeId).MoveNext();
        }
Exemplo n.º 2
0
        public void OnNpcDie(DungeonScene _this, ObjNPC npc, ulong characterId)
        {
            var idx = _this.MapNpcRecords.FindIndex(r => r.NpcID == npc.TypeId);

            if (idx == -1)
            {
                return;
            }
            var info = _this.MapNpcInfo.Data[idx];

            info.Alive = false;
            var data = new MapNpcInfos();

            data.Data.Add(info);
            _this.PushActionToAllPlayer(p =>
            {
                if (p.Proxy == null)
                {
                    return;
                }
                p.Proxy.NotifyNpcStatus(data);
            });
        }
Exemplo n.º 3
0
        //private void PlayerRelive(ObjPlayer player)
        //{
        //    var campId = player.GetCamp();
        //    player.SetPosition(59f,16f);
        //    player.Relive();
        //}
        public override void OnNpcEnter(ObjNPC npc)
        {
            base.OnNpcEnter(npc);
            bool bSend = false;

            Table.ForeachBossHome(tb =>
            {
                id        = tb.Id;
                BossScene = tb.Scene;
                if (tb.CharacterBaseId == npc.TypeId)
                {
                    bSend = true;
                    return(false);
                }
                return(true);
            });
            if (bSend == true)
            {
                var idx = MapNpcRecords.FindIndex(r => r.NpcID == npc.TypeId);
                if (idx == -1)
                {
                    return;
                }
                var info = MapNpcInfo.Data[idx];
                info.Alive = true;
                var data = new MapNpcInfos();
                data.Data.Add(info);
                PushActionToAllPlayer(p =>
                {
                    if (p.Proxy == null)
                    {
                        return;
                    }
                    p.Proxy.NotifyNpcStatus(data);
                });
            }
        }
Exemplo n.º 4
0
        public override void OnNpcDie(ObjNPC npc, ulong characterId = 0)
        {
            if (npc == null)
            {
                return;
            }

            ObjCharacter killer = null;

            if (npc.TableNpc.BelongType == 1)                       //古域战场,如果是队内伤害最高,就扣他的体力因为他会得宝物
            {
                killer = FindCharacter(npc.GetTargetCharacterId()); //古域战场Boss,是谁获得了奖励扣谁的体力
            }
            else
            {
                killer = FindCharacter(characterId); //古域战场小怪,是谁获得了奖励扣谁的体力
            }
            if (killer == null)
            {
                return;
            }

            base.OnNpcDie(npc, characterId);
            var tbNpc = Table.GetNpcBase(npc.TypeId);

            if (tbNpc != null)
            {
                var player = killer as ObjPlayer;
                if (null != player)
                {
                    PetIslandReduceTili(player.ObjId, tbNpc.KillExpendType, tbNpc.KillExpendValue);
                }
            }



            bool bSend = false;

            Table.ForeachAcientBattleField(tb =>
            {
                if (tb.CharacterBaseId == npc.TypeId)
                {
                    bSend = true;
                    return(false);
                }
                return(true);
            });
            if (bSend == true)
            {
                var idx = MapNpcRecords.FindIndex(r => r.NpcID == npc.TypeId);
                if (idx == -1)
                {
                    return;
                }
                var info = MapNpcInfo.Data[idx];
                info.Alive = false;
                var data = new MapNpcInfos();
                data.Data.Add(info);
                PushActionToAllPlayer(p =>
                {
                    if (p.Proxy == null)
                    {
                        return;
                    }
                    p.Proxy.NotifyNpcStatus(data);
                });
            }
            CoroutineFactory.NewCoroutine(GetNPCDie, (ulong)0, npc.TypeId).MoveNext();
        }
Exemplo n.º 5
0
 public void NotifyNpcStatus(MapNpcInfos infos)
 {
     EventDispatcher.Instance.DispatchEvent(new MapNpcInfoEvent(infos));
 }