Beispiel #1
0
        public void OnLeaveScene(GameClient client, SceneUIClasses sceneType, bool logout = false)
        {
            if (client.ClientSocket.IsKuaFuLogin)
            {
                switch (sceneType)
                {
                case SceneUIClasses.HuanYingSiYuan:
                    HuanYingSiYuanManager.getInstance().OnLogout(client);
                    break;

                case SceneUIClasses.TianTi:
                    TianTiManager.getInstance().OnLogout(client);
                    break;

                case SceneUIClasses.YongZheZhanChang:
                    YongZheZhanChangManager.getInstance().OnLogout(client);
                    break;

                case SceneUIClasses.KingOfBattle:
                    KingOfBattleManager.getInstance().OnLogout(client);
                    break;

                case SceneUIClasses.MoRiJudge:
                    MoRiJudgeManager.Instance().OnLogOut(client);
                    break;

                case SceneUIClasses.ElementWar:
                    ElementWarManager.getInstance().OnLogout(client);
                    break;

                case SceneUIClasses.LangHunLingYu:
                    LangHunLingYuManager.getInstance().OnLogout(client);
                    break;

                case SceneUIClasses.CopyWolf:
                    CopyWolfManager.getInstance().OnLogout(client);
                    break;

                case SceneUIClasses.KFZhengBa:
                    ZhengBaManager.Instance().OnLogout(client);
                    break;

                case SceneUIClasses.CoupleArena:
                    CoupleArenaManager.Instance().OnLeaveFuBen(client);
                    break;
                }

                if (!logout)
                {
                    GotoLastMap(client);
                }
            }
        }
Beispiel #2
0
        public bool OnInitGame(GameClient client)
        {
            int gameType = Global.GetClientKuaFuServerLoginData(client).GameType;

            switch (gameType)
            {
            case (int)GameTypes.HuanYingSiYuan:
                return(HuanYingSiYuanManager.getInstance().OnInitGame(client));

            case (int)GameTypes.TianTi:
                return(TianTiManager.getInstance().OnInitGame(client));

            case (int)GameTypes.YongZheZhanChang:
                return(YongZheZhanChangManager.getInstance().OnInitGame(client));

            case (int)GameTypes.KingOfBattle:
                return(KingOfBattleManager.getInstance().OnInitGame(client));

            case (int)GameTypes.MoRiJudge:
                return(MoRiJudgeManager.Instance().OnInitGame(client));

            case (int)GameTypes.ElementWar:
                return(ElementWarManager.getInstance().OnInitGame(client));

            case (int)GameTypes.KuaFuBoss:
                return(KuaFuBossManager.getInstance().OnInitGame(client));

            case (int)GameTypes.KuaFuMap:
                return(KuaFuMapManager.getInstance().OnInitGame(client));

            case (int)GameTypes.KuaFuCopy:
                return(CopyTeamManager.Instance().HandleKuaFuInitGame(client));

            case (int)GameTypes.LangHunLingYu:
                return(LangHunLingYuManager.getInstance().OnInitGameKuaFu(client));

            case (int)GameTypes.ZhengBa:
                return(ZhengBaManager.Instance().KuaFuInitGame(client));

            case (int)GameTypes.CoupleArena:
                return(CoupleArenaManager.Instance().KuaFuInitGame(client));
            }

            return(false);
        }
Beispiel #3
0
        //刷新当前的功能开启状态,处理有关逻辑
        public static void RefreshGongNeng(GameClient client)
        {
            CaiJiLogic.InitRoleDailyCaiJiData(client, false, false);
            HuanYingSiYuanManager.getInstance().InitRoleDailyHYSYData(client);
            Global.InitRoleDailyTaskData(client, false);
            // 检测触发开启守护之灵
            GuardStatueManager.Instance().OnTaskComplete(client);

            // 检测开启梅林魔法书 [XSea 2015/6/23]
            GameManager.MerlinMagicBookMgr.InitMerlinMagicBook(client);

            // 魂石系统
            SoulStoneManager.Instance().CheckOpen(client);

            ZhengBaManager.Instance().CheckGongNengCanOpen(client);

            FundManager.initFundData(client);

            CoupleArenaManager.Instance().CheckGongNengOpen(client);
        }
Beispiel #4
0
        public static void RefreshGongNeng(GameClient client)
        {
            CaiJiLogic.InitRoleDailyCaiJiData(client, false, false);
            HuanYingSiYuanManager.getInstance().InitRoleDailyHYSYData(client);
            Global.InitRoleDailyTaskData(client, false);
            SingletonTemplate <GuardStatueManager> .Instance().OnTaskComplete(client);

            GameManager.MerlinMagicBookMgr.InitMerlinMagicBook(client);
            SingletonTemplate <SoulStoneManager> .Instance().CheckOpen(client);

            SingletonTemplate <ZhengBaManager> .Instance().CheckGongNengCanOpen(client);

            FundManager.initFundData(client);
            SingletonTemplate <CoupleArenaManager> .Instance().CheckGongNengOpen(client);

            ShenShiManager.getInstance().InitRoleShenShiData(client);
            JueXingManager.getInstance().InitRoleJueXingData(client);
            ZuoQiManager.getInstance().InitRoleZuoQiData(client);
            GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
            GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, true, false, 7);
        }
Beispiel #5
0
        public static int ReqStartCaiJi(GameClient client, int monsterId, out int GatherTime)
        {
            GatherTime = 0;
            CaiJiLogic.CancelCaiJiState(client);
            int result;

            if (TimeUtil.NOW() < client.ClientData.CurrentMagicActionEndTicks)
            {
                result = -43;
            }
            else if (client.ClientData.CurrentLifeV <= 0)
            {
                CaiJiLogic.CancelCaiJiState(client);
                result = -3;
            }
            else
            {
                Monster monster = GameManager.MonsterMgr.FindMonster(client.ClientData.MapCode, monsterId);
                if (null == monster)
                {
                    result = -1;
                }
                else if (monster.MonsterType != 1601)
                {
                    result = -4;
                }
                else if (monster.IsCollected)
                {
                    result = -4;
                }
                else
                {
                    SceneUIClasses          sceneType = Global.GetMapSceneType(client.ClientData.MapCode);
                    GetCaiJiTimeEventObject eventObj  = new GetCaiJiTimeEventObject(client, monster);
                    bool handled = GlobalEventSource4Scene.getInstance().fireEvent(eventObj, (int)sceneType);
                    if (handled)
                    {
                        if (Global.GetTwoPointDistance(client.CurrentPos, monster.CurrentPos) > 600.0)
                        {
                            return(-301);
                        }
                        GatherTime = eventObj.GatherTime;
                        if (GatherTime < 0)
                        {
                            return(GatherTime);
                        }
                    }
                    else if (sceneType == SceneUIClasses.HuanYingSiYuan)
                    {
                        if (Global.GetTwoPointDistance(client.CurrentPos, monster.CurrentPos) > 600.0)
                        {
                            return(-301);
                        }
                        GatherTime = HuanYingSiYuanManager.getInstance().GetCaiJiMonsterTime(client, monster);
                        if (GatherTime < 0)
                        {
                            return(GatherTime);
                        }
                    }
                    else if (sceneType == SceneUIClasses.YongZheZhanChang)
                    {
                        if (Global.GetTwoPointDistance(client.CurrentPos, monster.CurrentPos) > 600.0)
                        {
                            return(-301);
                        }
                        GatherTime = YongZheZhanChangManager.getInstance().GetCaiJiMonsterTime(client, monster);
                        if (GatherTime < 0)
                        {
                            return(GatherTime);
                        }
                    }
                    else if (sceneType == SceneUIClasses.KingOfBattle)
                    {
                        if (Global.GetTwoPointDistance(client.CurrentPos, monster.CurrentPos) > 600.0)
                        {
                            return(-301);
                        }
                        GatherTime = KingOfBattleManager.getInstance().GetCaiJiMonsterTime(client, monster);
                        if (GatherTime < 0)
                        {
                            return(GatherTime);
                        }
                    }
                    else if (sceneType == SceneUIClasses.Comp)
                    {
                        if (Global.GetTwoPointDistance(client.CurrentPos, monster.CurrentPos) > 600.0)
                        {
                            return(-301);
                        }
                        GatherTime = CompManager.getInstance().GetCaiJiMonsterTime(client, monster);
                        if (GatherTime < 0)
                        {
                            return(GatherTime);
                        }
                    }
                    else if (sceneType == SceneUIClasses.KarenEast)
                    {
                        if (Global.GetTwoPointDistance(client.CurrentPos, monster.CurrentPos) > 600.0)
                        {
                            return(-301);
                        }
                        GatherTime = KarenBattleManager_MapEast.getInstance().GetCaiJiMonsterTime(client, monster);
                        if (GatherTime < 0)
                        {
                            return(GatherTime);
                        }
                    }
                    else if (sceneType == SceneUIClasses.LingDiCaiJi)
                    {
                        if (Global.GetTwoPointDistance(client.CurrentPos, monster.CurrentPos) > 400.0)
                        {
                            return(-301);
                        }
                        GatherTime = LingDiCaiJiManager.getInstance().GetCaiJiMonsterTime(client, monster);
                        if (GatherTime < 0)
                        {
                            return(GatherTime);
                        }
                    }
                    else if (sceneType == SceneUIClasses.EscapeBattle)
                    {
                        if (Global.GetTwoPointDistance(client.CurrentPos, monster.CurrentPos) > 400.0)
                        {
                            return(-301);
                        }
                        GatherTime = EscapeBattleManager.getInstance().GetCaiJiMonsterTime(client, monster);
                        if (GatherTime < 0)
                        {
                            return(GatherTime);
                        }
                    }
                    else
                    {
                        if (Global.GetTwoPointDistance(client.CurrentPos, monster.CurrentPos) > 400.0)
                        {
                            return(-301);
                        }
                        SystemXmlItem CaiJiMonsterXmlItem = null;
                        if (!GameManager.systemCaiJiMonsterMgr.SystemXmlItemDict.TryGetValue(monster.MonsterInfo.ExtensionID, out CaiJiMonsterXmlItem) || null == CaiJiMonsterXmlItem)
                        {
                            return(-4);
                        }
                        GatherTime = CaiJiMonsterXmlItem.GetIntValue("GatherTime", -1);
                        if (client.ClientData.DailyCrystalCollectNum >= CaiJiLogic.DailyNum)
                        {
                            return(-5);
                        }
                    }
                    Global.EndMeditate(client);
                    CaiJiLogic.SetCaiJiState(client, monsterId, 0L, monster.UniqueID);
                    result = 0;
                }
            }
            return(result);
        }
Beispiel #6
0
        public static int ReqFinishCaiJi(GameClient client, int monsterId)
        {
            int result;

            if (monsterId != client.ClientData.CaijTargetId || client.ClientData.CaiJiStartTick == 0U || client.ClientData.CaijTargetId == 0)
            {
                CaiJiLogic.CancelCaiJiState(client);
                result = -3;
            }
            else if (client.ClientData.CurrentLifeV <= 0)
            {
                CaiJiLogic.CancelCaiJiState(client);
                result = -3;
            }
            else
            {
                Monster monster = GameManager.MonsterMgr.FindMonster(client.ClientData.MapCode, monsterId);
                if (null == monster)
                {
                    CaiJiLogic.CancelCaiJiState(client);
                    result = -1;
                }
                else if (monster.UniqueID != client.ClientData.CaiJiTargetUniqueID)
                {
                    CaiJiLogic.CancelCaiJiState(client);
                    result = -1;
                }
                else if (monster.MonsterType != 1601)
                {
                    CaiJiLogic.CancelCaiJiState(client);
                    result = -4;
                }
                else
                {
                    SystemXmlItem           CaiJiMonsterXmlItem = null;
                    SceneUIClasses          sceneType           = Global.GetMapSceneType(client.ClientData.MapCode);
                    GetCaiJiTimeEventObject eventObj            = new GetCaiJiTimeEventObject(client, monster);
                    bool handled = GlobalEventSource4Scene.getInstance().fireEvent(eventObj, (int)sceneType);
                    int  GatherTime;
                    if (handled)
                    {
                        if (Global.GetTwoPointDistance(client.CurrentPos, monster.CurrentPos) > 600.0)
                        {
                            return(-301);
                        }
                        GatherTime = eventObj.GatherTime;
                        if (GatherTime < 0)
                        {
                            return(GatherTime);
                        }
                    }
                    else if (sceneType == SceneUIClasses.HuanYingSiYuan)
                    {
                        GatherTime = HuanYingSiYuanManager.getInstance().GetCaiJiMonsterTime(client, monster);
                        if (GatherTime < 0)
                        {
                            return(-4);
                        }
                    }
                    else if (sceneType == SceneUIClasses.YongZheZhanChang)
                    {
                        GatherTime = YongZheZhanChangManager.getInstance().GetCaiJiMonsterTime(client, monster);
                        if (GatherTime < 0)
                        {
                            return(-4);
                        }
                    }
                    else if (sceneType == SceneUIClasses.KingOfBattle)
                    {
                        GatherTime = KingOfBattleManager.getInstance().GetCaiJiMonsterTime(client, monster);
                        if (GatherTime < 0)
                        {
                            return(-4);
                        }
                    }
                    else if (sceneType == SceneUIClasses.Comp)
                    {
                        GatherTime = CompManager.getInstance().GetCaiJiMonsterTime(client, monster);
                        if (GatherTime < 0)
                        {
                            return(-4);
                        }
                    }
                    else if (sceneType == SceneUIClasses.KarenEast)
                    {
                        GatherTime = KarenBattleManager_MapEast.getInstance().GetCaiJiMonsterTime(client, monster);
                        if (GatherTime < 0)
                        {
                            return(-4);
                        }
                    }
                    else if (sceneType == SceneUIClasses.LingDiCaiJi)
                    {
                        GatherTime = LingDiCaiJiManager.getInstance().GetCaiJiMonsterTime(client, monster);
                        if (GatherTime < 0)
                        {
                            CaiJiLogic.CancelCaiJiState(client);
                            return(GatherTime);
                        }
                    }
                    else if (sceneType == SceneUIClasses.EscapeBattle)
                    {
                        GatherTime = EscapeBattleManager.getInstance().GetCaiJiMonsterTime(client, monster);
                        if (GatherTime < 0)
                        {
                            return(-4);
                        }
                    }
                    else
                    {
                        if (sceneType == SceneUIClasses.ShuiJingHuanJing)
                        {
                            if (client.ClientData.DailyCrystalCollectNum >= CaiJiLogic.DailyNum)
                            {
                                CaiJiLogic.CancelCaiJiState(client);
                                return(-6);
                            }
                        }
                        if (!GameManager.systemCaiJiMonsterMgr.SystemXmlItemDict.TryGetValue(monster.MonsterInfo.ExtensionID, out CaiJiMonsterXmlItem) || null == CaiJiMonsterXmlItem)
                        {
                            CaiJiLogic.CancelCaiJiState(client);
                            return(-4);
                        }
                        GatherTime = CaiJiMonsterXmlItem.GetIntValue("GatherTime", -1);
                    }
                    GatherTime = GatherTime * CaiJiLogic.GatherTimePer / 100;
                    uint intervalmsec = TimeUtil.timeGetTime() - client.ClientData.CaiJiStartTick;
                    if ((ulong)intervalmsec < (ulong)((long)(GatherTime * 1000)))
                    {
                        CaiJiLogic.CancelCaiJiState(client);
                        LogManager.WriteLog(LogTypes.Error, string.Format("采集读条时间不足intervalmsec={0}", intervalmsec), null, true);
                        result = -5;
                    }
                    else
                    {
                        CaiJiLogic.CancelCaiJiState(client);
                        if (Global.GetTwoPointDistance(client.CurrentPos, monster.CurrentPos) > 400.0)
                        {
                            result = -2;
                        }
                        else
                        {
                            lock (monster.CaiJiStateLock)
                            {
                                if (monster.IsCollected)
                                {
                                    return(-4);
                                }
                                monster.IsCollected = true;
                            }
                            if (!GlobalEventSource4Scene.getInstance().fireEvent(new CaiJiEventObject(client, monster), (int)sceneType))
                            {
                                if (sceneType == SceneUIClasses.HuanYingSiYuan)
                                {
                                    HuanYingSiYuanManager.getInstance().OnCaiJiFinish(client, monster);
                                }
                                else if (sceneType == SceneUIClasses.LingDiCaiJi)
                                {
                                    LingDiCaiJiManager.getInstance().OnCaiJiFinish(client, monster);
                                }
                                else
                                {
                                    CaiJiLogic.UpdateCaiJiData(client);
                                    CaiJiLogic.NotifyCollectLastNum(client, 0, CaiJiLogic.DailyNum - client.ClientData.DailyCrystalCollectNum);
                                    float AwardRate  = 1f;
                                    int   rangeIndex = CaiJiLogic.JugeDateTimeInTimeRange(TimeUtil.NowDateTime(), CaiJiLogic.dateTimeRangeArray, true);
                                    if (rangeIndex >= 0)
                                    {
                                        AwardRate = CaiJiLogic.dateTimeRangeArray[rangeIndex].DoubleAwardRate;
                                    }
                                    int ExpAward         = (int)(AwardRate * (float)CaiJiMonsterXmlItem.GetIntValue("ExpAward", -1));
                                    int XingHunAward     = (int)(AwardRate * (float)CaiJiMonsterXmlItem.GetIntValue("XingHunAward", -1));
                                    int BindZuanShiAward = (int)(AwardRate * (float)CaiJiMonsterXmlItem.GetIntValue("BindZuanShiAward", -1));
                                    int BindJinBiAward   = (int)(AwardRate * (float)CaiJiMonsterXmlItem.GetIntValue("BindJinBiAward", -1));
                                    int MoJingAward      = (int)(AwardRate * (float)CaiJiMonsterXmlItem.GetIntValue("MoJingAward", -1));
                                    if (ExpAward > 0)
                                    {
                                        GameManager.ClientMgr.ProcessRoleExperience(client, (long)ExpAward, true, true, false, "none");
                                    }
                                    if (XingHunAward > 0)
                                    {
                                        GameManager.ClientMgr.ModifyStarSoulValue(client, XingHunAward, "采集获得星魂", true, true);
                                    }
                                    if (BindZuanShiAward > 0)
                                    {
                                        GameManager.ClientMgr.AddUserGold(client, BindZuanShiAward, "采集获得绑钻");
                                    }
                                    if (BindJinBiAward > 0)
                                    {
                                        GameManager.ClientMgr.AddMoney1(client, BindJinBiAward, "采集获得绑金", true);
                                        GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(28, new object[0]), new object[]
                                        {
                                            BindJinBiAward
                                        }), GameInfoTypeIndexes.Hot, ShowGameInfoTypes.OnlyErr, 0);
                                    }
                                    if (MoJingAward > 0)
                                    {
                                        GameManager.ClientMgr.ModifyTianDiJingYuanValue(client, MoJingAward, "采集获得魔晶", true, true, false);
                                    }
                                    ProcessTask.ProcessAddTaskVal(client, TaskTypes.CaiJi_ShuiJingHuanJing, -1, 1, new object[0]);
                                }
                            }
                            GameManager.MonsterMgr.DeadMonsterImmediately(monster);
                            ProcessTask.Process(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, monster.RoleID, monster.MonsterInfo.ExtensionID, -1, TaskTypes.CaiJiGoods, null, 0, -1L, null);
                            result = 0;
                        }
                    }
                }
            }
            return(result);
        }
Beispiel #7
0
        public void OnLeaveScene(GameClient client, SceneUIClasses sceneType, bool logout = false)
        {
            if (client.ClientSocket.IsKuaFuLogin)
            {
                switch (sceneType)
                {
                case SceneUIClasses.HuanYingSiYuan:
                    HuanYingSiYuanManager.getInstance().OnLogout(client);
                    goto IL_1E7;

                case SceneUIClasses.TianTi:
                    TianTiManager.getInstance().OnLogout(client);
                    goto IL_1E7;

                case SceneUIClasses.YongZheZhanChang:
                    YongZheZhanChangManager.getInstance().OnLogout(client);
                    goto IL_1E7;

                case SceneUIClasses.ElementWar:
                    ElementWarManager.getInstance().OnLogout(client);
                    goto IL_1E7;

                case SceneUIClasses.MoRiJudge:
                    SingletonTemplate <MoRiJudgeManager> .Instance().OnLogOut(client);

                    goto IL_1E7;

                case SceneUIClasses.CopyWolf:
                    CopyWolfManager.getInstance().OnLogout(client);
                    goto IL_1E7;

                case SceneUIClasses.LangHunLingYu:
                    LangHunLingYuManager.getInstance().OnLogout(client);
                    goto IL_1E7;

                case SceneUIClasses.KFZhengBa:
                    SingletonTemplate <ZhengBaManager> .Instance().OnLogout(client);

                    goto IL_1E7;

                case SceneUIClasses.CoupleArena:
                    SingletonTemplate <CoupleArenaManager> .Instance().OnLeaveFuBen(client);

                    goto IL_1E7;

                case SceneUIClasses.KingOfBattle:
                    KingOfBattleManager.getInstance().OnLogout(client);
                    goto IL_1E7;

                case SceneUIClasses.KarenWest:
                    KarenBattleManager_MapWest.getInstance().OnLogout(client);
                    goto IL_1E7;

                case SceneUIClasses.KarenEast:
                    KarenBattleManager_MapEast.getInstance().OnLogout(client);
                    goto IL_1E7;

                case SceneUIClasses.LingDiCaiJi:
                    LingDiCaiJiManager.getInstance().OnLeaveFuBen(client);
                    goto IL_1E7;

                case SceneUIClasses.BangHuiMatch:
                    BangHuiMatchManager.getInstance().OnLogout(client);
                    goto IL_1E7;

                case SceneUIClasses.KuaFuLueDuo:
                    KuaFuLueDuoManager.getInstance().OnLogout(client);
                    goto IL_1E7;

                case SceneUIClasses.WanMoXiaGu:
                    WanMoXiaGuManager.getInstance().OnLogout(client);
                    goto IL_1E7;

                case SceneUIClasses.ZorkBattle:
                    ZorkBattleManager.getInstance().OnLogout(client);
                    goto IL_1E7;
                }
                if (SingletonTemplate <CopyTeamManager> .Instance().IsKuaFuCopy(client.ClientData.FuBenID))
                {
                    SingletonTemplate <CopyTeamManager> .Instance().OnLeaveFuBen(client, sceneType);
                }
IL_1E7:
                if (!logout)
                {
                    this.GotoLastMap(client);
                }
            }
        }
Beispiel #8
0
        public bool OnInitGame(GameClient client)
        {
            int  gameType = Global.GetClientKuaFuServerLoginData(client).GameType;
            bool result;

            if (KuaFuManager.KuaFuWorldKuaFuGameServer && !KuaFuManager.KuaFuWorldGameTypes.Contains(gameType))
            {
                result = true;
            }
            else
            {
                switch (gameType)
                {
                case 1:
                    return(HuanYingSiYuanManager.getInstance().OnInitGame(client));

                case 2:
                    return(TianTiManager.getInstance().OnInitGame(client));

                case 3:
                    return(SingletonTemplate <MoRiJudgeManager> .Instance().OnInitGame(client));

                case 4:
                    return(ElementWarManager.getInstance().OnInitGame(client));

                case 5:
                    return(YongZheZhanChangManager.getInstance().OnInitGame(client));

                case 6:
                    return(KuaFuBossManager.getInstance().OnInitGame(client));

                case 7:
                case 32:
                    return(KuaFuMapManager.getInstance().OnInitGame(client));

                case 8:
                    return(SingletonTemplate <CopyTeamManager> .Instance().HandleKuaFuInitGame(client));

                case 10:
                    return(LangHunLingYuManager.getInstance().OnInitGameKuaFu(client));

                case 12:
                    return(SingletonTemplate <ZhengBaManager> .Instance().KuaFuInitGame(client));

                case 13:
                    return(SingletonTemplate <CoupleArenaManager> .Instance().KuaFuInitGame(client));

                case 15:
                    return(KingOfBattleManager.getInstance().OnInitGame(client));

                case 17:
                    return(ZhengDuoManager.getInstance().OnInitGame(client));

                case 19:
                    return(KarenBattleManager_MapWest.getInstance().OnInitGame(client));

                case 20:
                    return(KarenBattleManager_MapEast.getInstance().OnInitGame(client));

                case 22:
                    return(LingDiCaiJiManager.getInstance().KuaFuInitGame(client));

                case 24:
                    return(BangHuiMatchManager.getInstance().OnInitGameKuaFu(client));

                case 25:
                    return(KuaFuLueDuoManager.getInstance().OnInitGameKuaFu(client));

                case 26:
                    return(WanMoXiaGuManager.getInstance().OnInitGame(client));

                case 27:
                case 28:
                case 29:
                    return(CompManager.getInstance().OnInitGameKuaFu(client));

                case 30:
                    return(CompBattleManager.getInstance().OnInitGameKuaFu(client));

                case 31:
                    return(CompMineManager.getInstance().OnInitGameKuaFu(client));

                case 34:
                    return(TianTi5v5Manager.getInstance().OnInitGame(client));

                case 36:
                    return(ZorkBattleManager.getInstance().OnInitGameKuaFu(client));
                }
                EventObjectEx_I1 eventObject = new EventObjectEx_I1(client, 62, gameType);
                result = (GlobalEventSource4Scene.getInstance().fireEvent(eventObject, 10007) && eventObject.Result);
            }
            return(result);
        }
        public static void initialize()
        {
            ZhanMengShiJianManager.getInstance().initialize();
            JingJiChangManager.getInstance().initialize();
            LiXianBaiTanManager.getInstance().initialize();
            LiXianGuaJiManager.getInstance().initialize();
            CmdRegisterTriggerManager.getInstance().initialize();
            SendCmdManager.getInstance().initialize();
            BossAIManager.getInstance().initialize();
            WashPropsManager.initialize();
            SaleManager.getInstance().initialize();
            LianZhiManager.GetInstance().initialize();
            ChengJiuManager.GetInstance().initialize();
            PrestigeMedalManager.getInstance().initialize();
            UnionPalaceManager.getInstance().initialize();
            UserActivateManager.getInstance().initialize();
            PetSkillManager.getInstance().initialize();
            UserReturnManager.getInstance().initialize();
            OlympicsManager.getInstance().initialize();
            TalentManager.getInstance().initialize();
            TodayManager.getInstance().initialize();
            FundManager.getInstance().initialize();
            WarnManager.getInstance().initialize();
            EMoLaiXiCopySceneManager.LoadEMoLaiXiCopySceneInfo();
            LuoLanFaZhenCopySceneManager.initialize();
            MarryFuBenMgr.getInstance().initialize();
            MarryLogic.LoadMarryBaseConfig();
            MarryPartyLogic.getInstance().LoadMarryPartyConfig();
            BuildingManager.getInstance().initialize();
            OnePieceManager.getInstance().initialize();
            GlobalServiceManager.RegisterManager4Scene(0, SingletonTemplate <CopyTeamManager> .Instance());
            GlobalServiceManager.RegisterManager4Scene(0, KuaFuManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(35, LangHunLingYuManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, RebornManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, RebornBoss.getInstance());
            GlobalServiceManager.RegisterManager4Scene(24, LuoLanChengZhanManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, FashionManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, OrnamentManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, ShenJiFuWenManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, YaoSaiJianYuManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, AlchemyManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, EraManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, VideoLogic.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, SpecPlatFuLiManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(25, HuanYingSiYuanManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(10000, JingLingQiYuanManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(26, TianTiManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(27, YongZheZhanChangManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(39, KingOfBattleManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(45, BangHuiMatchManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(48, CompManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(52, CompBattleManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(53, CompMineManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(57, ZorkBattleManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(47, KuaFuLueDuoManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, KarenBattleManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(41, KarenBattleManager_MapWest.getInstance());
            GlobalServiceManager.RegisterManager4Scene(42, KarenBattleManager_MapEast.getInstance());
            GlobalServiceManager.RegisterManager4Scene(29, SingletonTemplate <MoRiJudgeManager> .Instance());
            GlobalServiceManager.RegisterManager4Scene(28, ElementWarManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(49, WanMoXiaGuManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(34, CopyWolfManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(31, KuaFuBossManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(10003, KuaFuMapManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(10002, SpreadManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(36, SingletonTemplate <ZhengBaManager> .Instance());
            GlobalServiceManager.RegisterManager4Scene(38, SingletonTemplate <CoupleArenaManager> .Instance());
            GlobalServiceManager.RegisterManager4Scene(10004, AllyManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(10005, SingletonTemplate <CoupleWishManager> .Instance());
            GlobalServiceManager.RegisterManager4Scene(40, ZhengDuoManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, AoYunDaTiManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, RoleManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, ZhuanPanManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, ShenQiManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, JunTuanManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, LingDiCaiJiManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, HongBaoManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, YaoSaiBossManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, YaoSaiMissionManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, HuiJiManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, DeControl.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, GVoiceManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, ShenShiManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, JueXingManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, ZuoQiManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, ThemeBoss.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, ArmorManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, JingLingYuanSuJueXingManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, BianShenManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(55, TianTi5v5Manager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, UserRegressActiveManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, MountHolyStampManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, MazingerStoreManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, GlodAuctionProcessCmdEx.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, BoCaiManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, FunctionSendManager.GetInstance());
            GlobalServiceManager.RegisterManager4Scene(0, HuanLeDaiBiManager.GetInstance());
            GlobalServiceManager.RegisterManager4Scene(0, NewTimerProc.GetInstance());
            GlobalServiceManager.RegisterManager4Scene(56, ZhanDuiZhengBaManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(59, EscapeBattleManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, TestReceiveModel.getInstance());
            RobotTaskValidator.getInstance().Initialize(false, 0, 0, "");
            HolyItemManager.getInstance().Initialize();
            TarotManager.getInstance().Initialize();
            SingletonTemplate <SevenDayActivityMgr> .Instance().initialize();

            SingletonTemplate <SoulStoneManager> .Instance().initialize();

            SingletonTemplate <TradeBlackManager> .Instance().LoadConfig();

            lock (GlobalServiceManager.Scene2ManagerDict)
            {
                foreach (List <IManager> list in GlobalServiceManager.Scene2ManagerDict.Values)
                {
                    foreach (IManager i in list)
                    {
                        bool success = true;
                        try
                        {
                            success = (success && i.initialize());
                            IManager2 m2 = i as IManager2;
                            if (null != m2)
                            {
                                success = (success && m2.initialize(GameCoreInterface.getinstance()));
                            }
                        }
                        catch (Exception ex)
                        {
                            success = false;
                            LogManager.WriteException(ex.ToString());
                        }
                        if (GameManager.ServerStarting && !success)
                        {
                            LogManager.WriteLog(LogTypes.Fatal, string.Format("执行{0}.initialize()失败,按任意键继续启动!", i.GetType()), null, true);
                            Console.ReadKey();
                        }
                    }
                }
            }
            TenManager.getInstance().initialize();
            TenRetutnManager.getInstance().initialize();
            GiftCodeNewManager.getInstance().initialize();
            FaceBookManager.getInstance().initialize();
            AssemblyPatchManager.getInstance().initialize();
            IPStatisticsManager.getInstance().initialize();
            FuMoManager.getInstance().Initialize();
        }
Beispiel #10
0
        public static void initialize()
        {
#if BetaConfig
            int round = 9;
            Console.WriteLine("连接调试器或按任意键继续");
            do
            {
                Console.Write("\b\b" + round);
                if (Console.KeyAvailable)
                {
                    break;
                }
                Thread.Sleep(1000);
            } while (--round > 0);
            Console.Write("\b\b");
#endif
            //战盟事件管理器
            ZhanMengShiJianManager.getInstance().initialize();

            //竞技场管理器
            JingJiChangManager.getInstance().initialize();

            //离线摆摊
            LiXianBaiTanManager.getInstance().initialize();

            //离线挂机
            LiXianGuaJiManager.getInstance().initialize();

            //副本活动组队管理器
            CopyTeamManager.Instance().initialize();

            //指令注册管理器
            CmdRegisterTriggerManager.getInstance().initialize();

            //发送指令管理
            SendCmdManager.getInstance().initialize();

            //Boss AI管理器
            BossAIManager.getInstance().initialize();

            //洗炼管理器
            WashPropsManager.initialize();

            //MU交易所
            SaleManager.getInstance().initialize();

            //炼制系统
            LianZhiManager.GetInstance().initialize();

            // 成就升级
            ChengJiuManager.GetInstance().initialize();

            //声望勋章
            PrestigeMedalManager.getInstance().initialize();

            UnionPalaceManager.getInstance().initialize();
            UserActivateManager.getInstance().initialize();

            PetSkillManager.getInstance().initialize();

            //玩家召回
            UserReturnManager.getInstance().initialize();

            //天赋
            TalentManager.getInstance().initialize();

            //每日专享
            TodayManager.getInstance().initialize();

            FundManager.getInstance().initialize();

            //警告
            WarnManager.getInstance().initialize();

            //恶魔来袭
            EMoLaiXiCopySceneManager.LoadEMoLaiXiCopySceneInfo();

            //罗兰法阵副本
            LuoLanFaZhenCopySceneManager.initialize();

            //情侣副本管理器
            MarryFuBenMgr.getInstance().initialize();
            MarryLogic.LoadMarryBaseConfig();
            MarryPartyLogic.getInstance().LoadMarryPartyConfig();

            //领地
            BuildingManager.getInstance().initialize();

            // 藏宝秘境
            OnePieceManager.getInstance().initialize();

            //初始化跨服相关管理器
            RegisterManager4Scene((int)SceneUIClasses.Normal, KuaFuManager.getInstance());
            // RegisterManager4Scene((int)SceneUIClasses.LangHunLingYu, LangHunLingYuManager.getInstance());

            //注册罗兰城战管理器
            RegisterManager4Scene((int)SceneUIClasses.LuoLanChengZhan, LuoLanChengZhanManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.Normal, FashionManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.HuanYingSiYuan, HuanYingSiYuanManager.getInstance());
            RegisterManager4Scene((int)ManagerTypes.ClientGoodsList, JingLingQiYuanManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.TianTi, TianTiManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.YongZheZhanChang, YongZheZhanChangManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.KingOfBattle, KingOfBattleManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.MoRiJudge, MoRiJudgeManager.Instance());
            RegisterManager4Scene((int)SceneUIClasses.ElementWar, ElementWarManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.CopyWolf, CopyWolfManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.KuaFuBoss, KuaFuBossManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.KuaFuMap, KuaFuMapManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.Spread, SpreadManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.KFZhengBa, ZhengBaManager.Instance());
            RegisterManager4Scene((int)SceneUIClasses.CoupleArena, CoupleArenaManager.Instance());
            RegisterManager4Scene((int)SceneUIClasses.Ally, AllyManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.CoupleWish, CoupleWishManager.Instance());

            // 读取外挂列表和相关配置
            RobotTaskValidator.getInstance().Initialize(false, 0, 0, "");

            //初始化圣物系统相关配置
            HolyItemManager.getInstance().Initialize();

            //初始化塔罗牌相关配置
            TarotManager.getInstance().Initialize();

            // 七日活动
            SevenDayActivityMgr.Instance().initialize();

            // 魂石
            SoulStoneManager.Instance().initialize();

            TradeBlackManager.Instance().LoadConfig();
            //调用所有注册的管理模块的初始化函数
            lock (Scene2ManagerDict)
            {
                foreach (var list in Scene2ManagerDict.Values)
                {
                    foreach (var m in list)
                    {
                        bool      success = m.initialize();
                        IManager2 m2      = m as IManager2;
                        if (null != m2)
                        {
                            success = success && m2.initialize(GameCoreInterface.getinstance());
                        }

                        if (GameManager.ServerStarting && !success)
                        {
                            LogManager.WriteLog(LogTypes.Fatal, string.Format("执行{0}.initialize()失败,按任意键继续启动!", m.GetType()));
                            //Console.ReadKey(); HX_SERVER close the copy scenes;
                        }
                    }
                }
            }

            //应用宝
            TenManager.getInstance().initialize();
            TenRetutnManager.getInstance().initialize();

            //礼包码
            GiftCodeNewManager.getInstance().initialize();
        }
Beispiel #11
0
        /// <summary>
        /// 获得剩余次数
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        private static int GetLeftCountByType(GameClient client, int type, int copyId)
        {
            int leftnum = 0;

            switch ((CandoType)type)
            {
            case CandoType.DailyTask:
            {
                DailyTaskData dailyTaskData = Global.FindDailyTaskDataByTaskClass(client, 8);
                if (null == dailyTaskData)
                {
                    return(Global.MaxDailyTaskNumForMU);
                }
                int maxnum = Global.GetMaxDailyTaskNum(client, 8, dailyTaskData);


                //获取最大日常任务次数

                leftnum = maxnum - dailyTaskData.RecNum;
            }
            break;

            case CandoType.DemonSquare:
            {
                int nMapID = Global.GetDaimonSquareCopySceneIDForRole(client);
                DaimonSquareDataInfo bcDataTmp = null;

                Data.DaimonSquareDataInfoList.TryGetValue(nMapID, out bcDataTmp);

                int nDate  = TimeUtil.NowDateTime().DayOfYear;                       // 当前时间
                int nCount = Global.QueryDayActivityEnterCountToDB(client, client.ClientData.RoleID, nDate, (int)SpecialActivityTypes.DemoSque);
                if (nCount < 0)
                {
                    nCount = 0;
                }
                int nVipLev = client.ClientData.VipLevel;

                int   nNum  = 0;
                int[] nArry = null;
                nArry = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPEnterDaimonSquareCountAddValue");

                if (nVipLev > 0 && nArry != null && nArry[nVipLev] > 0)
                {
                    nNum = nArry[nVipLev];
                }
                leftnum = bcDataTmp.MaxEnterNum + nNum - nCount;
            }
            break;

            case CandoType.AngelTemple:
            {
                DateTime now = TimeUtil.NowDateTime();

                string        nowTime        = TimeUtil.NowDateTime().ToString("HH:mm");
                List <string> timePointsList = GameManager.AngelTempleMgr.m_AngelTempleData.BeginTime;

                leftnum = 0;
                for (int i = 0; i < timePointsList.Count; i++)
                {
                    DateTime staticTime  = DateTime.Parse(timePointsList[i]);
                    DateTime perpareTime = staticTime.AddMinutes((double)(GameManager.AngelTempleMgr.m_AngelTempleData.PrepareTime / 60));

                    if (now <= perpareTime)
                    {
                        leftnum += 1;
                    }
                }
            }
            break;

            case CandoType.BloodCity:
            {
                int nMapID = Global.GetBloodCastleCopySceneIDForRole(client);
                BloodCastleDataInfo bcDataTmp = null;

                if (!Data.BloodCastleDataInfoList.TryGetValue(nMapID, out bcDataTmp))
                {
                    break;
                }

                int nDate = TimeUtil.NowDateTime().DayOfYear;                    // 当前时间
                int nType = (int)SpecialActivityTypes.BloodCastle;               // 血色堡垒

                int nCount = Global.QueryDayActivityEnterCountToDB(client, client.ClientData.RoleID, nDate, nType);
                if (nCount < 0)
                {
                    nCount = 0;
                }
                // VIP检测

                int nVipLev = client.ClientData.VipLevel;

                int   nNum  = 0;
                int[] nArry = null;
                nArry = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPEnterBloodCastleCountAddValue");

                if (nVipLev > 0 && nArry != null && nArry[nVipLev] > 0)
                {
                    nNum = nArry[nVipLev];
                }
                leftnum = bcDataTmp.MaxEnterNum + nNum - nCount;
            }
            break;

            case CandoType.Arena:
            {
                leftnum = JingJiChangManager.getInstance().GetLeftEnterCount(client);
            }
            break;

            case CandoType.OldBattlefield:
            {
                //古墓 古战场  剩余时间
                BufferData bufferData = Global.GetBufferDataByID(client, (int)BufferItemTypes.GuMuTimeLimit);
                leftnum = (int)(bufferData.BufferVal - bufferData.BufferSecs);
            }
            break;

            case CandoType.PartWar:
            {
                leftnum = GameManager.BattleMgr.LeftEnterCount();
            }
            break;

            case CandoType.PKKing:
            {
                leftnum = GameManager.ArenaBattleMgr.LeftEnterCount();
            }
            break;

            case CandoType.WanmoTower:
            {
                leftnum = 1;
                if (SweepWanMotaManager.GetSweepCount(client) >= SweepWanMotaManager.nWanMoTaMaxSweepNum)
                {
                    leftnum = 0;
                }
            }
            break;

            case CandoType.TaofaTaskCanDo:
            {
                DailyTaskData dailyTaskData = Global.FindDailyTaskDataByTaskClass(client, (int)TaskClasses.TaofaTask);
                if (null == dailyTaskData)
                {
                    return(Global.MaxTaofaTaskNumForMU);
                }
                int maxnum = Global.GetMaxDailyTaskNum(client, (int)TaskClasses.TaofaTask, dailyTaskData);

                //获取最大讨伐任务次数
                leftnum = maxnum - dailyTaskData.RecNum;
            }
            break;

            case CandoType.CrystalCollectCanDo:
            {
                //获取剩余水晶采集次数
                int temp = 0;
                CaiJiLogic.ReqCaiJiLastNum(client, 0, out temp);
                leftnum = temp;
            }
            break;

            case CandoType.HYSY:
            {
                leftnum = HuanYingSiYuanManager.getInstance().GetLeftCount(client);
            }
            break;

            default:
                if (copyId > 0)
                {
                    SystemXmlItem systemFuBenItem = null;
                    if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(copyId, out systemFuBenItem))
                    {
                        return(-1);
                    }
                    int enternum  = systemFuBenItem.GetIntValue("EnterNumber");
                    int finishnum = systemFuBenItem.GetIntValue("FinishNumber");

                    int total = enternum < finishnum ? finishnum : enternum;

                    if (type == (int)CandoType.GoldCopy || type == (int)CandoType.EXPCopy)
                    {
                        int[] nAddNum = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPJinBiFuBenNum");
                        if (type == (int)CandoType.EXPCopy)
                        {
                            nAddNum = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPJinYanFuBenNum");
                        }
                        if (client.ClientData.VipLevel > 0 && client.ClientData.VipLevel <= (int)VIPEumValue.VIPENUMVALUE_MAXLEVEL && nAddNum != null && nAddNum.Length > 0 && nAddNum.Length <= 13)
                        {
                            total = total + nAddNum[client.ClientData.VipLevel];
                        }
                    }

                    FuBenData tmpfubdata = Global.GetFuBenData(client, copyId);
                    if (null != tmpfubdata)
                    {
                        leftnum = total - tmpfubdata.EnterNum;
                    }
                    else
                    {
                        return(total);
                    }
                }
                break;
            }
            return(leftnum);
        }
Beispiel #12
0
        /// <summary>
        /// 请求完成采集
        /// </summary>
        public static int ReqFinishCaiJi(GameClient client, int monsterId)
        {
            //判断玩家当前状态能否采集
            if (monsterId != client.ClientData.CaijTargetId || client.ClientData.CaiJiStartTick == 0 || client.ClientData.CaijTargetId == 0)
            {
                //取消采集状态
                CaiJiLogic.CancelCaiJiState(client);
                return(-3);
            }

            //死亡时不能采集
            if (client.ClientData.CurrentLifeV <= 0)
            {
                //取消采集状态
                CaiJiLogic.CancelCaiJiState(client);
                return(-3);
            }

            //判断采集物是否存在
            Monster monster = GameManager.MonsterMgr.FindMonster(client.ClientData.MapCode, monsterId);

            if (null == monster)    //找不到采集物
            {
                //取消采集状态
                CaiJiLogic.CancelCaiJiState(client);
                return(-1);
            }

            //判断是不是采集物
            if (monster.MonsterType != (int)MonsterTypes.CaiJi)    //不是采集物
            {
                //取消采集状态
                CaiJiLogic.CancelCaiJiState(client);
                return(-4);
            }

            SystemXmlItem CaiJiMonsterXmlItem = null;
            int           GatherTime          = int.MaxValue;

            //采集条件判断
            SceneUIClasses sceneType = Global.GetMapSceneType(client.ClientData.MapCode);

            if (sceneType == SceneUIClasses.HuanYingSiYuan)
            {
                //幻影寺院采集圣杯
                GatherTime = HuanYingSiYuanManager.getInstance().GetCaiJiMonsterTime(client, monster);
                if (GatherTime < 0)
                {
                    return(-4);
                }
            }
            else if (sceneType == SceneUIClasses.YongZheZhanChang)
            {
                // 勇者战场 水晶
                GatherTime = YongZheZhanChangManager.getInstance().GetCaiJiMonsterTime(client, monster);
                if (GatherTime < 0)
                {
                    return(-4);
                }
            }
            else if (sceneType == SceneUIClasses.KingOfBattle)
            {
                // 王者战场 水晶
                GatherTime = KingOfBattleManager.getInstance().GetCaiJiMonsterTime(client, monster);
                if (GatherTime < 0)
                {
                    return(-4);
                }
            }
            else
            {
                //水晶环境采集水晶
                if (client.ClientData.DailyCrystalCollectNum >= DailyNum)
                {
                    CaiJiLogic.CancelCaiJiState(client);
                    return(-6);  //已经达到次数上限
                }
                //====Monsters===
                //if (!GameManager.systemCaiJiMonsterMgr.SystemXmlItemDict.TryGetValue(monster.MonsterInfo.ExtensionID, out CaiJiMonsterXmlItem) || null == CaiJiMonsterXmlItem)
                //{
                //    //取消采集状态
                //    CaiJiLogic.CancelCaiJiState(client);
                //    return -4;  //传来的monsterID不对
                //}

                //读条时间
                GatherTime = CaiJiMonsterXmlItem.GetIntValue("GatherTime");
                // 针对服务器时间漂移问题,对结束采集的读条时间进行缩短处理
                GatherTime = GatherTime * GatherTimePer / 100;
            }

            //读条时间不对不能采集
            uint intervalmsec = TimeUtil.timeGetTime() - client.ClientData.CaiJiStartTick;

            if (intervalmsec < GatherTime * 1000)
            {
                //取消采集状态
                CaiJiLogic.CancelCaiJiState(client);
                LogManager.WriteLog(LogTypes.Error, string.Format("采集读条时间不足intervalmsec={0}", intervalmsec));
                return(-5);
            }

            CaiJiLogic.CancelCaiJiState(client);

            //判断玩家与采集物的距离
            if (Global.GetTwoPointDistance(client.CurrentPos, monster.CurrentPos) > 400) //判断距离
            {
                return(-2);                                                              //太远了
            }

            lock (monster.CaiJiStateLock)
            {
                if (monster.IsCollected)
                {
                    return(-4);  //已经被别人采了
                }
                else
                {
                    monster.IsCollected = true;
                }
            }

            //采集完成
            bool handled = GlobalEventSource4Scene.getInstance().fireEvent(new CaiJiEventObject(client, monster), (int)sceneType);

            if (!handled)
            {
                if (sceneType == SceneUIClasses.HuanYingSiYuan)
                {
                    //幻影寺院采集圣杯
                    HuanYingSiYuanManager.getInstance().OnCaiJiFinish(client, monster);
                }
                else
                {
                    //水晶环境采集水晶
                    //增加采集次数
                    UpdateCaiJiData(client);

                    //通知客户端采集次数
                    NotifyCollectLastNum(client, 0, DailyNum - client.ClientData.DailyCrystalCollectNum);

                    //给予采集奖励
                    float AwardRate = 1.0f;

                    //判断是否有双倍
                    int rangeIndex = JugeDateTimeInTimeRange(TimeUtil.NowDateTime(), dateTimeRangeArray);
                    if (rangeIndex >= 0)
                    {
                        AwardRate = dateTimeRangeArray[rangeIndex].DoubleAwardRate;
                    }

                    int ExpAward         = (int)(AwardRate * CaiJiMonsterXmlItem.GetIntValue("ExpAward"));
                    int XingHunAward     = (int)(AwardRate * CaiJiMonsterXmlItem.GetIntValue("XingHunAward"));
                    int BindZuanShiAward = (int)(AwardRate * CaiJiMonsterXmlItem.GetIntValue("BindZuanShiAward"));
                    int BindJinBiAward   = (int)(AwardRate * CaiJiMonsterXmlItem.GetIntValue("BindJinBiAward"));
                    int MoJingAward      = (int)(AwardRate * CaiJiMonsterXmlItem.GetIntValue("MoJingAward"));

                    if (ExpAward > 0)
                    {
                        //处理角色经验
                        GameManager.ClientMgr.ProcessRoleExperience(client, ExpAward, true, true);
                    }

                    if (XingHunAward > 0)
                    {
                        GameManager.ClientMgr.ModifyStarSoulValue(client, XingHunAward, "采集获得星魂", true, true);
                    }

                    if (BindZuanShiAward > 0)
                    {
                        GameManager.ClientMgr.AddUserGold(client, BindZuanShiAward, "采集获得绑钻");
                    }

                    if (BindJinBiAward > 0)
                    {
                        GameManager.ClientMgr.AddMoney1(client, BindJinBiAward, "采集获得绑金", true);
                        GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client,
                                                                 StringUtil.substitute(Global.GetLang("获得绑定金币 +{0}"), BindJinBiAward),
                                                                 GameInfoTypeIndexes.Hot, ShowGameInfoTypes.OnlyErr, (int)HintErrCodeTypes.None);
                    }

                    if (MoJingAward > 0)
                    {
                        GameManager.ClientMgr.ModifyTianDiJingYuanValue(client, MoJingAward, "采集获得魔晶", true);
                    }

                    /*
                     * Monster monster = GameManager.MonsterMgr.FindMonster(client.ClientData.MapCode, caiJiRoleID);
                     * if (null != monster && monster.MonsterType == (int)MonsterTypes.CaiJi)
                     * {
                     *  //首先判断背包是否已经满了,如果是则提示用户采集失败
                     *  if (monster.MonsterInfo.FallGoodsPackID <= 0)
                     *  {
                     *      if (!Global.CanAddGoodsNum(client, 1))
                     *      {
                     *          GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                     *              client, StringUtil.substitute(Global.GetLang("背包已满,无法将进行采集")),
                     *              GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox);
                     *      }
                     *  }
                     *
                     *  //杀死怪物并处理任务
                     *  Global.SystemKillMonster(client, monster);
                     * }
                     */
                }
            }

            //清除采集物
            GameManager.MonsterMgr.DeadMonsterImmediately(monster);

            return(0);   //采集完成
        }
Beispiel #13
0
        /// <summary>
        /// 请求开始采集
        /// </summary>
        public static int ReqStartCaiJi(GameClient client, int monsterId, out int GatherTime)
        {
            GatherTime = 0;

            CaiJiLogic.CancelCaiJiState(client);

            //判断玩家当前状态能否采集
            //死亡时不能采集
            if (client.ClientData.CurrentLifeV <= 0)
            {
                //取消采集状态
                CaiJiLogic.CancelCaiJiState(client);
                return(-3);
            }

            //判断采集物是否存在
            Monster monster = GameManager.MonsterMgr.FindMonster(client.ClientData.MapCode, monsterId);

            if (null == monster)    //找不到采集物
            {
                return(-1);
            }

            //判断是不是采集物
            if (monster.MonsterType != (int)MonsterTypes.CaiJi)    //不是采集物
            {
                return(-4);
            }

            if (monster.IsCollected)
            {
                return(-4);  //已经被采集过了
            }

            SceneUIClasses sceneType = Global.GetMapSceneType(client.ClientData.MapCode);

            if (sceneType == SceneUIClasses.HuanYingSiYuan)
            {
                //判断玩家与采集物的距离
                if (Global.GetTwoPointDistance(client.CurrentPos, monster.CurrentPos) > 600)     //判断距离
                {
                    return(StdErrorCode.Error_Too_Far);
                }

                //幻影寺院采集圣杯
                GatherTime = HuanYingSiYuanManager.getInstance().GetCaiJiMonsterTime(client, monster);
                if (GatherTime < 0)
                {
                    return(GatherTime);
                }
            }
            else if (sceneType == SceneUIClasses.YongZheZhanChang)
            {
                if (Global.GetTwoPointDistance(client.CurrentPos, monster.CurrentPos) > 600)
                {
                    return(StdErrorCode.Error_Too_Far);
                }

                GatherTime = YongZheZhanChangManager.getInstance().GetCaiJiMonsterTime(client, monster);
                if (GatherTime < 0)
                {
                    return(GatherTime);
                }
            }
            else if (sceneType == SceneUIClasses.KingOfBattle)
            {
                if (Global.GetTwoPointDistance(client.CurrentPos, monster.CurrentPos) > 600)
                {
                    return(StdErrorCode.Error_Too_Far);
                }

                GatherTime = KingOfBattleManager.getInstance().GetCaiJiMonsterTime(client, monster);
                if (GatherTime < 0)
                {
                    return(GatherTime);
                }
            }
            else
            {
                //判断玩家与采集物的距离
                if (Global.GetTwoPointDistance(client.CurrentPos, monster.CurrentPos) > 400)     //判断距离
                {
                    return(StdErrorCode.Error_Too_Far);
                }

                //水晶环境采集水晶
                //====Monsters===
                //SystemXmlItem CaiJiMonsterXmlItem = null;
                //if (!GameManager.systemCaiJiMonsterMgr.SystemXmlItemDict.TryGetValue(monster.MonsterInfo.ExtensionID, out CaiJiMonsterXmlItem) || null == CaiJiMonsterXmlItem)
                //{
                //    return -4;  //传来的monsterID不对
                //}

                //GatherTime = CaiJiMonsterXmlItem.GetIntValue("GatherTime");

                //刷新活动中与采集相关的信息
                if (client.ClientData.DailyCrystalCollectNum >= DailyNum)
                {
                    return(-5);  //已经达到次数上限
                }
            }

            //结束冥想
            Global.EndMeditate(client);

            //设置玩家的采集状态
            SetCaiJiState(client, monsterId);

            return(0);   //采集开始
        }
Beispiel #14
0
        private static int GetLeftCountByType(GameClient client, int type, int copyId)
        {
            int leftnum = 0;

            switch (type)
            {
            case 1:
            {
                DailyTaskData dailyTaskData = Global.FindDailyTaskDataByTaskClass(client, 8);
                if (null == dailyTaskData)
                {
                    return(10);
                }
                int maxnum = Global.GetMaxDailyTaskNum(client, 8, dailyTaskData);
                leftnum = maxnum - dailyTaskData.RecNum;
                goto IL_4AC;
            }

            case 5:
            {
                int nMapID = Global.GetDaimonSquareCopySceneIDForRole(client);
                DaimonSquareDataInfo bcDataTmp = null;
                Data.DaimonSquareDataInfoList.TryGetValue(nMapID, out bcDataTmp);
                int nDate  = TimeUtil.NowDateTime().DayOfYear;
                int nCount = Global.QueryDayActivityEnterCountToDB(client, client.ClientData.RoleID, nDate, 2);
                if (nCount < 0)
                {
                    nCount = 0;
                }
                int   nVipLev = client.ClientData.VipLevel;
                int   nNum    = 0;
                int[] nArry   = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPEnterDaimonSquareCountAddValue", ',');
                if (nVipLev > 0 && nArry != null && nArry[nVipLev] > 0)
                {
                    nNum = nArry[nVipLev];
                }
                leftnum = bcDataTmp.MaxEnterNum + nNum - nCount;
                goto IL_4AC;
            }

            case 6:
            {
                int nMapID = Global.GetBloodCastleCopySceneIDForRole(client);
                BloodCastleDataInfo bcDataTmp2 = null;
                if (!Data.BloodCastleDataInfoList.TryGetValue(nMapID, out bcDataTmp2))
                {
                    goto IL_4AC;
                }
                int nDate  = TimeUtil.NowDateTime().DayOfYear;
                int nType  = 1;
                int nCount = Global.QueryDayActivityEnterCountToDB(client, client.ClientData.RoleID, nDate, nType);
                if (nCount < 0)
                {
                    nCount = 0;
                }
                int   nVipLev = client.ClientData.VipLevel;
                int   nNum    = 0;
                int[] nArry   = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPEnterBloodCastleCountAddValue", ',');
                if (nVipLev > 0 && nArry != null && nArry[nVipLev] > 0)
                {
                    nNum = nArry[nVipLev];
                }
                leftnum = bcDataTmp2.MaxEnterNum + nNum - nCount;
                goto IL_4AC;
            }

            case 7:
            {
                DateTime      now            = TimeUtil.NowDateTime();
                string        nowTime        = TimeUtil.NowDateTime().ToString("HH:mm");
                List <string> timePointsList = GameManager.AngelTempleMgr.m_AngelTempleData.BeginTime;
                leftnum = 0;
                for (int i = 0; i < timePointsList.Count; i++)
                {
                    DateTime perpareTime = DateTime.Parse(timePointsList[i]).AddMinutes((double)(GameManager.AngelTempleMgr.m_AngelTempleData.PrepareTime / 60));
                    if (now <= perpareTime)
                    {
                        leftnum++;
                    }
                }
                goto IL_4AC;
            }

            case 8:
                leftnum = 1;
                if (SweepWanMotaManager.GetSweepCount(client) >= SweepWanMotaManager.nWanMoTaMaxSweepNum)
                {
                    leftnum = 0;
                }
                goto IL_4AC;

            case 9:
            {
                BufferData bufferData = Global.GetBufferDataByID(client, 34);
                leftnum = (int)(bufferData.BufferVal - (long)bufferData.BufferSecs);
                goto IL_4AC;
            }

            case 10:
                leftnum = GameManager.BattleMgr.LeftEnterCount();
                goto IL_4AC;

            case 11:
                leftnum = GameManager.ArenaBattleMgr.LeftEnterCount();
                goto IL_4AC;

            case 13:
                leftnum = JingJiChangManager.getInstance().GetLeftEnterCount(client);
                goto IL_4AC;

            case 15:
            {
                DailyTaskData dailyTaskData = Global.FindDailyTaskDataByTaskClass(client, 9);
                if (null == dailyTaskData)
                {
                    return(Global.MaxTaofaTaskNumForMU);
                }
                int maxnum = Global.GetMaxDailyTaskNum(client, 9, dailyTaskData);
                leftnum = maxnum - dailyTaskData.RecNum;
                goto IL_4AC;
            }

            case 16:
            {
                int temp = 0;
                CaiJiLogic.ReqCaiJiLastNum(client, 0, out temp);
                leftnum = temp;
                goto IL_4AC;
            }

            case 19:
                leftnum = HuanYingSiYuanManager.getInstance().GetLeftCount(client);
                goto IL_4AC;
            }
            if (copyId > 0)
            {
                SystemXmlItem systemFuBenItem = null;
                if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(copyId, out systemFuBenItem))
                {
                    return(-1);
                }
                int enternum  = systemFuBenItem.GetIntValue("EnterNumber", -1);
                int finishnum = systemFuBenItem.GetIntValue("FinishNumber", -1);
                int total     = (enternum < finishnum) ? finishnum : enternum;
                if (type == 4 || type == 3)
                {
                    int[] nAddNum = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPJinBiFuBenNum", ',');
                    if (type == 3)
                    {
                        nAddNum = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPJinYanFuBenNum", ',');
                    }
                    if (client.ClientData.VipLevel > 0 && client.ClientData.VipLevel <= VIPEumValue.VIPENUMVALUE_MAXLEVEL && nAddNum != null && nAddNum.Length > VIPEumValue.VIPENUMVALUE_MAXLEVEL)
                    {
                        total += nAddNum[client.ClientData.VipLevel];
                    }
                }
                FuBenData tmpfubdata = Global.GetFuBenData(client, copyId);
                if (null == tmpfubdata)
                {
                    return(total);
                }
                leftnum = total - tmpfubdata.EnterNum;
            }
IL_4AC:
            return(leftnum);
        }