Beispiel #1
0
 public void Complete(DungeonScene _this, ulong playerId, FubenResult result)
 {
     CoroutineFactory.NewCoroutine(CompleteCoroutine, _this, playerId, result).MoveNext();
 }
        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();
        }
Beispiel #3
0
 public void NotifyAllianceWarInfo(AllianceWar _this, int occupantId)
 {
     CoroutineFactory.NewCoroutine(NotifyAllianceWarInfoCoroutine, _this, occupantId).MoveNext();
 }
Beispiel #4
0
        public void TimeOver(PlayerConnect _this)
        {
            PlayerLog.WriteLog((int)LogType.PlayerConnect, "TimeOver -----State:{0}", _this.State);
            _this.trigger = null;
            switch (_this.State)
            {
            case ConnectState.Wait:
                break;

            case ConnectState.Landing:
            {
                //todo 选择角色时间太长
                if (_this.Player != null)
                {
                    _this.Player.Kick(_this.ClientId, KickClientType.LoginTimeOut);
                    CoroutineFactory.NewCoroutine(LoginServer.Instance.ServerControl.PlayerLogout, _this.ClientId)
                    .MoveNext();
                }
            }
            break;

            case ConnectState.EnterGame:
            {
                //todo 进入游戏时间太长
                if (_this.Player != null)
                {
                    _this.Player.Kick(_this.ClientId, KickClientType.LoginTimeOut);
                    CoroutineFactory.NewCoroutine(LoginServer.Instance.ServerControl.PlayerLogout, _this.ClientId)
                    .MoveNext();
                }
            }
            break;

            case ConnectState.InGame:
                break;

            case ConnectState.WaitReConnet:
            {
                if (null == _this.Player || null == _this.Player.DbData)
                {
                    _this.ClientId = 0;
                    Logger.Error("PlayerConnect TimeOver WaitReConnet InGame player is null");
                    break;
                }

                //var character = CharacterManager.Instance.GetCharacterControllerFromMemroy(_this.Player.DbData.SelectChar);
                //if (character != null)
                //{
                //    character.LostLine();
                //    CharacterManager.PopServerPlayer(character.mDbData.ServerId);
                //    CoroutineFactory.NewCoroutine(CharacterManager.Instance.RemoveCharacter,
                //        _this.Player.DbData.SelectChar).MoveNext();
                //}

                PlayerLog.PlayerLogger(_this.Player.DbData.Id, "WaitReConnet TimeOver ClientId={0}", _this.ClientId);
                PlayerConnect oldPlayer;
                if (QueueManager.InGamePlayerList.TryGetValue(_this.Player.DbData.Id, out oldPlayer))
                {
                    if (oldPlayer != null)
                    {
                        QueueManager.LeaverPlayer(oldPlayer);
                    }
                    QueueManager.InGamePlayerList.Remove(_this.Player.DbData.Id);
                }

                LoginServerControlDefaultImpl.CleanCharacterData(_this.ClientId, _this.Player.DbData.SelectChar);

                CoroutineFactory.NewCoroutine(LoginServer.Instance.ServerControl.PlayerLogout, _this.ClientId)
                .MoveNext();
            }
            break;

            case ConnectState.OffLine:
                QueueManager.CacheLost.Remove(_this.GetKey());
                break;

            case ConnectState.WaitOffLine:
                QueueManager.CacheLost.Remove(_this.GetKey());
                break;
            }
        }
Beispiel #5
0
 private void SendLastDamageList()
 {
     CoroutineFactory.NewCoroutine(SendDamageListCoroutine).MoveNext();
 }
Beispiel #6
0
 public void SSChangeExdata(ulong id, Dict_int_int_Data changes)
 {
     CoroutineFactory.NewCoroutine(SSChangeExdataCoroutine, id, changes).MoveNext();
 }
Beispiel #7
0
 public void NotifyEnterFuben(ulong characterId, int fubenId)
 {
     CoroutineFactory.NewCoroutine(NotifyEnterFubenCoroutine, characterId, fubenId).MoveNext();
 }
Beispiel #8
0
        public void EnterFuben(QueueResultBase _this)
        {
            var tbQueue = _this.mQueue.tbQueue;
            var fubenId = tbQueue.Param;
            var tbFuben = Table.GetFuben(fubenId);

            if (tbFuben == null)
            {
                Logger.Error("Not Find FubenID! QueueId = {0} ", tbQueue.Id);
                return;
            }
            if (_this.CharacterState.Count < 1)
            {
                return;
            }
            var tbScene = Table.GetScene(tbFuben.SceneId);

            switch ((eQueueType)tbQueue.AppType)
            {
            case eQueueType.Dungeon:
            {
                var characters = new List <ulong>();
                foreach (var character in _this.CharacterState)
                {
                    characters.Add(character.Key);
                }
                var serverId = tbScene.CanCrossServer == 1 ? -1 : _this.mTeamList[0][0].mDatas[0].ServerId;
                CoroutineFactory.NewCoroutine(Utility.AskEnterDungeonByTeamCoroutine, characters, serverId, tbFuben,
                                              (ulong)0).MoveNext();
                foreach (var matchingCharacter in _this.CharacterState)
                {
                    QueueManager.Pop(matchingCharacter.Key, eLeaveMatchingType.Success);
                }
            }
            break;

            case eQueueType.BattleField:
            {
                if (_this.mTeamList.Count % 2 != 0)
                {
                    Logger.Error("fightQueue mTeamList Count ={0}", _this.mTeamList.Count);
                }
                var index      = 0;
                var characters = new List <ulong>();
                var tempScene  = QueueSceneManager.CreateScene(tbQueue.Id);
                foreach (var list in _this.mTeamList)
                {
                    foreach (var character in list)
                    {
                        foreach (var data in character.mDatas)
                        {
                            characters.Add(data.Id);
                            CoroutineFactory.NewCoroutine(NotifyCharacterSceneCamp, _this, data.Id, index)
                            .MoveNext();
                            tempScene.InitCharacter(data.Id, index);
                        }
                    }
                    if (index == 0)
                    {
                        index = 1;
                    }
                    else
                    {
                        index = 0;
                    }
                }
                var serverId = tbScene.CanCrossServer == 1 ? -1 : _this.mTeamList[0][0].mDatas[0].ServerId;
                CoroutineFactory.NewCoroutine(Utility.AskEnterDungeonByTeamCoroutine, characters, serverId, tbFuben,
                                              (ulong)0).MoveNext();
                foreach (var matchingCharacter in _this.CharacterState)
                {
                    QueueManager.Pop(matchingCharacter.Key, eLeaveMatchingType.Success);
                }
            }
            break;

            case eQueueType.ActivityDungeon:
            {
                var characters = new List <ulong>();
                foreach (var character in _this.CharacterState)
                {
                    characters.Add(character.Key);
                    if (tbFuben.FubenCountNode == (int)eDungeonSettlementNode.Start)
                    {
                        Utility.NotifyEnterFuben(character.Key, fubenId);
                    }
                }
                var serverId = tbScene.CanCrossServer == 1 ? -1 : _this.ServerId;
                CoroutineFactory.NewCoroutine(Utility.AskEnterDungeonByTeamCoroutine, characters, serverId,
                                              tbFuben, (ulong)0).MoveNext();
                foreach (var matchingCharacter in _this.CharacterState)
                {
                    QueueManager.Pop(matchingCharacter.Key, eLeaveMatchingType.Success);
                }
            }
            break;
            }
        }
 public void Init(BlackStoreManager _this, int serverId)
 {
     CoroutineFactory.NewCoroutine(ReadDb, _this, serverId).MoveNext();
 }
Beispiel #10
0
 public void SaveLoginTime(PlayerController _this)
 {
     CoroutineFactory.NewCoroutine(SaveLoginTimeCoroutine, _this).MoveNext();
 }
Beispiel #11
0
 private static void SaveDb()
 {
     CoroutineFactory.NewCoroutine(SaveDb).MoveNext();
 }
        public void Init()
        {
            Table.ForeachServerName(record =>
            {
                var id = record.LogicID;

                if (!BossHomeManager.Boss.ContainsKey(id) && record.IsClientDisplay == 1)
                {
                    BossHomeManager.Boss.Add(id, new DBBossHomeActivityData());

                    Table.ForeachBossHome(tb =>
                    {
                        //1:死亡   0:活着
                        BossHomeManager.Boss[id].BossState.Add(tb.Id, 1);

                        return(true);
                    });
                }
                return(true);
            });

            EventDispatcher.Instance.AddEventListener(ReloadTableEvent.EVENT_TYPE, ReloadTable);

            Dictionary <int, List <int> > dic = new Dictionary <int, List <int> >();
            {//刷新trigger
                Table.ForeachBossHome(tb =>
                {
                    var t = tb.RefreshTime.Split('|');
                    if (t.Length > 0)
                    {
                        foreach (var v in t)
                        {
                            var tt = v.Split(':');
                            if (tt.Length > 1)
                            {
                                var iTime = int.Parse(tt[0]) * 100 + int.Parse(tt[1]);
                                if (dic.ContainsKey(iTime) == false)
                                {
                                    dic.Add(iTime, new List <int>());
                                }
                                dic[iTime].Add(tb.Id);
                            }
                        }
                    }
                    return(true);
                });
                //Debug.Assert(false);
                foreach (var v in dic)
                {
                    DateTime t = DateTime.Now.Date.AddHours(v.Key / 100).AddMinutes(v.Key % 100);
                    if (t < DateTime.Now)
                    {
                        //CoroutineFactory.NewCoroutine(BossRefreshTimer, v.Value).MoveNext();
                        t = t.AddDays(1);
                    }

                    ActivityServerControl.Timer.CreateTrigger(t, () =>
                    {
                        CoroutineFactory.NewCoroutine(BossRefreshTimer, v.Value).MoveNext();
                    }, 24 * 60 * 60 * 1000);
                }
            }
        }
Beispiel #13
0
 private void StartSyncBatteryGuid()
 {
     CoroutineFactory.NewCoroutine(SendSyncBatteryGuidMsg).MoveNext();
 }
Beispiel #14
0
        public override void OnPlayerPickItem(ObjPlayer player, ObjDropItem item)
        {
            if (player.mIsDead)
            {
                return;
            }
            if (item.TableDrop.Type != 300)
            {
                return;
            }
            var tbChecken = Table.GetChecken(item.TableDrop.Exdata[0]);

            if (tbChecken == null)
            {
                return;
            }
            var p = _playerList.Find(r => r.objId == player.ObjId);

            if (p == null)
            {
                return;
            }

            //播放特效
            player.Proxy.NotifyPlayEffect(700);

            //添加经验
            OnPlayerGetExp(player, p, tbChecken.ExData1);
            int idx = _playerList.FindIndex(r => r.objId == player.ObjId);

            //添加吃鸡的积分
            if (_playerList[idx] != null)
            {
                _playerList[idx].point += tbChecken.ExData2;
            }

            //添加Buff
            player.AddBuff(tbChecken.BuffId, 1, player);
            //添加道具
            Dict_int_int_Data data = new Dict_int_int_Data();

            for (int i = 0; i < tbChecken.ItemID.Length && i < tbChecken.Num.Length; i++)
            {
                if (tbChecken.ItemID[i] > 0 && tbChecken.Num[i] > 0)
                {
                    data.Data.Add(tbChecken.ItemID[i], tbChecken.Num[i]);
                }
            }
            for (int i = 0; i < dropBuffList.Count; i++)
            {
                if (item.ObjId == dropBuffList[i].ObjId)
                {
                    dropBuffList.RemoveAt(i);
                    break;
                }
            }
            for (int i = 0; i < dropChickenList.Count; i++)
            {
                if (item.ObjId == dropChickenList[i].ObjId)
                {
                    dropChickenList.RemoveAt(i);
                    break;
                }
            }

            CoroutineFactory.NewCoroutine(GiveItemList, player, data).MoveNext();
        }
 private void GetDbActiData(AcientBattle _this)
 {
     CoroutineFactory.NewCoroutine(GetDbActiDataCoroutine, _this).MoveNext();
 }
 public void FirstOnlineMsg(CharacterController _this, ulong clientId)
 {
     CoroutineFactory.NewCoroutine(_this.FirstOnline, clientId, _this.CharacterId, _this.mDbData.Continuedays).MoveNext();
 }
Beispiel #17
0
 //给某个玩家发奖
 private void GiveItem(GroupShopOne _this)
 {
     //给予物品
     CoroutineFactory.NewCoroutine(GroupShopMailCoroutine, _this).MoveNext();
     Reset(_this);
 }
 public void NotifyEnterScene(CharacterController _this)
 {
     CoroutineFactory.NewCoroutine(_this.NotifyEnterSceneCoroutine).MoveNext();
 }
Beispiel #19
0
 public void SendMail(ulong id, string title, string content, Dict_int_int_Data items)
 {
     CoroutineFactory.NewCoroutine(SendMailCoroutine, id, title, content, items).MoveNext();
 }
Beispiel #20
0
        private IEnumerator TryPick(Coroutine coroutine, ObjDropItem objDrop, ObjPlayer character)
        {
            //增加道具
            PlayerLog.WriteLog((int)LogType.DropItem, "TryPickDropItem  Id ={0}  ObjPlayer={1}", objDrop.ObjId,
                               character.ObjId);
            var result = SceneServer.Instance.LogicAgent.GiveItem(character.ObjId, objDrop.ItemId, objDrop.Count, -1);

            yield return(result.SendAndWaitUntilDone(coroutine));

            if (result.State != MessageState.Reply)
            {
                PlayerLog.WriteLog((int)LogType.DropItem, "PickUpItemSuccess not reply  Id ={0}  ObjPlayer={1}",
                                   objDrop.ObjId, character.ObjId);
                objDrop.Remove();
                yield break;
            }
            if (result.Response == (int)ErrorCodes.OK)
            {
//Logic增加道具成功
                //告诉客户端我拾取了
                if (character.Proxy != null)
                {
                    character.Proxy.PickUpItemSuccess(objDrop.ObjId);
                    character.Proxy.Wait(coroutine, TimeSpan.FromSeconds(3));
                }
                PlayerLog.WriteLog((int)LogType.DropItem, "PickUpItemSuccess  Id ={0}  ObjPlayer={1}", objDrop.ObjId,
                                   character.ObjId);
                //删除自己
                objDrop.Remove();
                if (character.Scene != null)
                {
                    character.Scene.OnPlayerPickItem(character, objDrop);
                }
            }
            else
            {
//Logic增加道具失败
                if (character.Proxy != null)
                {
                    character.Proxy.BagisFull(objDrop.ObjId, objDrop.ItemId, objDrop.Count);
                }
                objDrop.mPickList.Remove(character.ObjId);
                if (objDrop.mOverTrigger == null)
                {
                    yield break;
                }
                if (objDrop.mPickList.Count > 0)
                {
                    foreach (var i in objDrop.mPickList)
                    {
                        var uId = i.Key;
                        var cl  = CharacterManager.Instance.GetCharacterControllerFromMemroy(uId);
                        if (cl == null)
                        {
                            continue;
                        }
                        CoroutineFactory.NewCoroutine(TryPick, objDrop, cl).MoveNext();
                        //TryPick(coroutine, ObjDropItem objDrop, ObjPlayer character)
                        yield break;
                    }
                }
            }
        }
Beispiel #21
0
 //重载表格
 public void ReloadTable(string tableName)
 {
     //Table.ReloadTable(tableName);
     CoroutineFactory.NewCoroutine(ReloadTableCoroutine, tableName).MoveNext();
 }
Beispiel #22
0
 public void GetItem(ulong characterId, int itemId, int count)
 {
     CoroutineFactory.NewCoroutine(GetItemCoroutine, characterId, itemId, count).MoveNext();
 }
Beispiel #23
0
 protected void GetDbBossLevel()
 {
     CoroutineFactory.NewCoroutine(GetDbBossLevelCoroutine).MoveNext();
 }
Beispiel #24
0
 private void ChangePlayedTime(ObjPlayer player)
 {
     CoroutineFactory.NewCoroutine(ChangePlayedTimeCoroutine, player).MoveNext();
 }
Beispiel #25
0
 private void StartGetDamageList()
 {
     CoroutineFactory.NewCoroutine(GetDamageListCoroutine).MoveNext();
 }
Beispiel #26
0
 private void FetchPlayerExData(ObjPlayer player)
 {
     CoroutineFactory.NewCoroutine(FetchPlayerExDataCoroutine, player).MoveNext();
 }
        private void LogicTick()
        {
            // 每5分钟消耗一点体力
            foreach (var value in StayTimeDic)
            {
                TimeSpan delta = DateTime.Now - StayTimeDic[value.Key];
                if (delta.TotalSeconds > 1 && Math.Abs((int)delta.TotalSeconds % PlayerIdleCost) < 0.001f)
                {
                    PetIslandReduceTili(value.Key, ExdataIdx, 1);
                }
            }

            DynamicActivityRecord tbDynamic = Table.GetDynamicActivity(16);

            if (tbDynamic != null)
            {
                if (!Utils.CheckIsWeekLoopOk(tbDynamic.WeekLoop))
                {
                    foreach (var data in StateDic)
                    {
                        var character = FindCharacter(data.Key);
                        if (character != null)
                        {
                            //把玩家踢出去
                            var player = character as ObjPlayer;
                            if (player != null)
                            {
                                CoroutineFactory.NewCoroutine(player.ExitDungeon).MoveNext();
                            }
                        }
                    }
                    return;
                }
            }


            var tempRemove = new List <ulong>();

            tempRemove.Clear();
            foreach (var data in StateDic)
            {
                if (data.Value != null && data.Value.state == 0 && data.Value.time <= DateTime.Now)
                {
                    var character = FindCharacter(data.Key);
                    if (character != null)
                    {
                        //把玩家踢出去
                        var player = character as ObjPlayer;
                        if (player != null)
                        {
                            if (TiliDic.ContainsKey(data.Key))
                            {
                                if (TiliDic[data.Key] <= 0)
                                {
                                    CoroutineFactory.NewCoroutine(player.ExitDungeon).MoveNext();
                                    tempRemove.Add(data.Key);
                                    //RemoveRecord(data.Key);  迭代器失效
                                }
                                else
                                {
                                    if (StateDic.ContainsKey(data.Key))
                                    {
                                        StateDic[data.Key].state = 1;
                                        StateDic[data.Key].time  = DateTime.MaxValue;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            foreach (var data in tempRemove)
            {
                if (TiliDic.ContainsKey(data))
                {
                    RemoveRecord(data);
                }
            }
        }
 private void Save(AcientBattle oData)
 {
     CoroutineFactory.NewCoroutine(SaveCoroutine, oData).MoveNext();
 }
Beispiel #29
0
 private void ChangeNameTitle(ulong characterId, Dict_int_int_Data change)
 {
     CoroutineFactory.NewCoroutine(ChangeNameTitleCoroutine, characterId, change).MoveNext();
 }
Beispiel #30
0
 public void TimeOverClose(DungeonScene _this)
 {
     CoroutineFactory.NewCoroutine(_this.CloseDungeon).MoveNext();
 }