예제 #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();
        }
예제 #2
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);
                });
            }
        }
예제 #3
0
        public IEnumerator RespawnGuard(Coroutine co, ObjPlayer player, int index, AsyncReturnValue <ErrorCodes> err)
        {
            if (player.GetCamp() != DefenderCampId)
            {
                err.Value = ErrorCodes.Error_JurisdictionNotEnough;
                yield break;
            }
            if (GuardReliveCount >= StaticVariable.AllianceWarGuardRespawnMaxCount)
            {
                err.Value = ErrorCodes.Error_GuardRespawnExceed;
                yield break;
            }
            var guard = Guards[index];

            if (!guard.IsDead())
            {
                NotifyAllianceWarNpcData(new List <ulong> {
                    player.ObjId
                });
                err.Value = ErrorCodes.Error_GuardNotDie;
                yield break;
            }
            //扣钱
            var cost = Table.GetSkillUpgrading(73000).GetSkillUpgradingValue(GuardReliveCount);
            var msg  = SceneServer.Instance.LogicAgent.DeleteItem(player.ObjId, (int)eResourcesType.DiamondRes, cost, (int)eDeleteItemType.FuHuoShouWei);

            yield return(msg.SendAndWaitUntilDone(co));

            if (msg.State != MessageState.Reply)
            {
                err.Value = ErrorCodes.Unknow;
                yield break;
            }
            var errCode = (ErrorCodes)msg.ErrorCode;

            if (errCode != ErrorCodes.OK)
            {
                err.Value = errCode;
                yield break;
            }
            err.Value = ErrorCodes.OK;
            var npc = CreateSceneNpc(index + GuardSceneNpcId0, Vector2.Zero, NpcLevel);

            Guards[index] = npc;
            ++GuardReliveCount;
            GuardState.Items[index] = 0;
            NotifyAllianceWarNpcDataToAllPlayer();

            //
            var idx = MapNpcRecords.FindIndex(r => r.NpcID == npc.TypeId);

            if (idx != -1)
            {
                var info = MapNpcInfo.Data[idx];
                info.Alive = true;
            }

            //发通告
            var args = new List <string>();

            args.Add(player.GetName());
            var content = Utils.WrapDictionaryId(300930, args);

            PushActionToAllPlayer(p => { p.Proxy.NotifyBattleReminder(14, content, 1); });
        }
예제 #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();
        }