Ejemplo n.º 1
0
        public override void OnNpcDie(ObjNPC npc, ulong characterId = 0)
        {
            if (npc == null)
            {
                return;
            }

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

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

                //var player = killer.GetRewardOwner() as ObjPlayer;
                var player = killer as ObjPlayer;
                if (null != player)
                {
                    if (tbNpc.KillExpendType == (int)eExdataDefine.e630)
                    {
                        PetIslandReduceTili(player.ObjId, tbNpc.KillExpendType, tbNpc.KillExpendValue);
                    }
                }
            }
        }
Ejemplo n.º 2
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();
        }