예제 #1
0
 public bool startup()
 {
     this.GetHuanLeDaiBi(0);
     TCPCmdDispatcher.getInstance().registerProcessorEx(2087, 3, 3, HuanLeDaiBiManager.GetInstance(), TCPCmdFlags.IsStringArrayParams);
     return(true);
 }
        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();
        }
예제 #3
0
        public static CallSpriteResult CallPet(GameClient client, int times, out string strGetGoods)
        {
            strGetGoods = "";
            CallSpriteResult result;

            if (times != 1 && times != 10)
            {
                result = CallSpriteResult.ErrorParams;
            }
            else
            {
                CallPetType TypeData = CallPetManager.GetCallPetType(1);
                if (null == TypeData)
                {
                    result = CallSpriteResult.ErrorConfig;
                }
                else if (client.ClientData.Level < TypeData.MinLevel)
                {
                    result = CallSpriteResult.ErrorLevel;
                }
                else if (client.ClientData.Level > TypeData.MaxLevel)
                {
                    result = CallSpriteResult.ErrorLevel;
                }
                else if (client.ClientData.ChangeLifeCount < TypeData.MinZhuanSheng)
                {
                    result = CallSpriteResult.ErrorLevel;
                }
                else if (client.ClientData.ChangeLifeCount > TypeData.MaxZhuanSheng)
                {
                    result = CallSpriteResult.ErrorLevel;
                }
                else
                {
                    bool bFreeCall = false;
                    bool bUseGoods = false;
                    int  bind      = 0;
                    if (1 == times)
                    {
                        if (CallPetManager.getFreeSec(client) <= 0L)
                        {
                            bFreeCall = true;
                            bind      = 1;
                        }
                    }
                    if (!bFreeCall && CallPetManager.CallPetGoodsID > 0)
                    {
                        if (1 == times)
                        {
                            if (null != Global.GetGoodsByID(client, CallPetManager.CallPetGoodsID))
                            {
                                bUseGoods = true;
                                bind      = 1;
                            }
                        }
                    }
                    int nNeedLuckStar = CallPetManager.GetCallPetPrice(times);
                    if (nNeedLuckStar < 0)
                    {
                        result = CallSpriteResult.ErrorConfig;
                    }
                    else
                    {
                        if (!bFreeCall && !bUseGoods)
                        {
                            if (Global.IsRoleHasEnoughMoney(client, nNeedLuckStar, 163) < 0 && !HuanLeDaiBiManager.GetInstance().HuanledaibiReplaceEnough(client, nNeedLuckStar, DaiBiSySType.JingLingLieQu))
                            {
                                return(CallSpriteResult.ZuanShiNotEnough);
                            }
                        }
                        if (CallPetManager.GetMaxPetCount() - CallPetManager.GetPetListCount(client) < times)
                        {
                            result = CallSpriteResult.SpriteBagIsFull;
                        }
                        else
                        {
                            if (!bFreeCall)
                            {
                                if (bUseGoods)
                                {
                                    bool usedBinding     = false;
                                    bool usedTimeLimited = false;
                                    if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, CallPetManager.CallPetGoodsID, 1, false, out usedBinding, out usedTimeLimited, false))
                                    {
                                        bUseGoods = false;
                                    }
                                }
                            }
                            if (!bFreeCall && !bUseGoods)
                            {
                                if (!GameManager.ClientMgr.ModifyLuckStarValue(client, -nNeedLuckStar, "精灵召唤", false, DaiBiSySType.JingLingLieQu))
                                {
                                    return(CallSpriteResult.ZuanShiNotEnough);
                                }
                                bind = 0;
                            }
                            for (int i = 0; i < times; i++)
                            {
                                CallPetConfig        CfgData = null;
                                List <CallPetConfig> CfgList = CallPetManager.GetCallPetConfigList(bFreeCall || bUseGoods);
                                if (CfgList == null || CfgList.Count <= 0)
                                {
                                    return(CallSpriteResult.ErrorConfig);
                                }
                                int random = Global.GetRandomNumber(1, 100001);
                                foreach (CallPetConfig item in CfgList)
                                {
                                    if (random >= item.StartValues && random <= item.EndValues)
                                    {
                                        CfgData = item;
                                        break;
                                    }
                                }
                                LogManager.WriteLog(LogTypes.Info, string.Format("获取精灵随机数: random = {0}, GoodsID = {1}", random, CfgData.GoodsID), null, true);
                                if (null != CfgData)
                                {
                                    int nExcellenceProp = 0;
                                    if (CfgData.ZhuoYueFallID != -1)
                                    {
                                        nExcellenceProp = GameManager.GoodsPackMgr.GetExcellencePropertysID(CfgData.GoodsID, CfgData.ZhuoYueFallID);
                                    }
                                    Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, CfgData.GoodsID, CfgData.Num, 0, "", 0, bind, 4000, "", false, 1, "精灵召唤", "1900-01-01 12:00:00", 0, 0, 0, 0, nExcellenceProp, 0, 0, null, null, 0, true);
                                    strGetGoods += string.Format("{0},{1},{2},{3},{4},{5},{6}|", new object[]
                                    {
                                        CfgData.GoodsID,
                                        CfgData.Num,
                                        bind,
                                        0,
                                        0,
                                        0,
                                        nExcellenceProp
                                    });
                                }
                            }
                            if (bFreeCall)
                            {
                                Global.UpdateRoleParamByName(client, "CallPetFreeTime", Global.GetOffsetSecond(TimeUtil.NowDateTime()).ToString(), true);
                                if (client._IconStateMgr.CheckPetIcon(client))
                                {
                                    client._IconStateMgr.SendIconStateToClient(client);
                                }
                            }
                            else if (!bUseGoods)
                            {
                                int nPetJiFen = (int)((double)nNeedLuckStar * CallPetManager.ConsumeCallPetJiFen);
                                GameManager.ClientMgr.ModifyPetJiFenValue(client, nPetJiFen, "精灵召唤", false, true);
                            }
                            result = CallSpriteResult.Success;
                        }
                    }
                }
            }
            return(result);
        }
예제 #4
0
        public ShenQiData LevelUpShenQiData(GameClient client, int useBaoJi)
        {
            ShenQiData result;

            if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.ShenQi, false))
            {
                result = new ShenQiData
                {
                    UpResultType = -1
                };
            }
            else
            {
                ShenQiData data = client.ClientData.shenQiData;
                try
                {
                    if (null == data)
                    {
                        LogManager.WriteLog(LogTypes.Error, string.Format("ShenQi :: 注入失败,获取角色神器数据错误,角色id:{0}", client.ClientData.RoleID), null, true);
                        return(new ShenQiData
                        {
                            UpResultType = 0
                        });
                    }
                    ArtifactItem artifactItem = null;
                    lock (this.ShenQiRunTimeData.Mutex)
                    {
                        this.ShenQiRunTimeData.ArtifactXmlDict.TryGetValue(data.ShenQiID, out artifactItem);
                    }
                    if (null == artifactItem)
                    {
                        LogManager.WriteLog(LogTypes.Error, string.Format("ShenQi :: 注入失败,获取角色神器数据配置项错误,角色id:{0}, ShenQiID:{1}", client.ClientData.RoleID, data.ShenQiID), null, true);
                        return(new ShenQiData
                        {
                            UpResultType = 0
                        });
                    }
                    if (client.ClientData.ShenLiJingHuaPoints < artifactItem.CostShenLiJingHua)
                    {
                        return(new ShenQiData
                        {
                            UpResultType = -2
                        });
                    }
                    int GoldGoodsNum = 0;
                    if (artifactItem.CostGoldGoodsID > 0)
                    {
                        GoldGoodsNum = Global.GetTotalGoodsCountByID(client, artifactItem.CostGoldGoodsID);
                    }
                    if (client.ClientData.YinLiang < artifactItem.CostGoldCoin && (artifactItem.CostGoldGoodsNum <= 0 || GoldGoodsNum < artifactItem.CostGoldGoodsNum))
                    {
                        return(new ShenQiData
                        {
                            UpResultType = -4
                        });
                    }
                    if (useBaoJi > 0 && client.ClientData.UserMoney < artifactItem.CostDiamond && !HuanLeDaiBiManager.GetInstance().HuanledaibiEnough(client, artifactItem.CostDiamond))
                    {
                        return(new ShenQiData
                        {
                            UpResultType = -3
                        });
                    }
                    GameManager.ClientMgr.ModifyShenLiJingHuaPointsValue(client, -artifactItem.CostShenLiJingHua, "神器注入_精华", true, true);
                    if (artifactItem.CostGoldGoodsNum > 0 && GoldGoodsNum >= artifactItem.CostGoldGoodsNum)
                    {
                        bool oneUseBind      = false;
                        bool oneUseTimeLimit = false;
                        if (Global.UseGoodsBindOrNot(client, artifactItem.CostGoldGoodsID, artifactItem.CostGoldGoodsNum, true, out oneUseBind, out oneUseTimeLimit) < 1)
                        {
                            return(new ShenQiData
                            {
                                UpResultType = -4
                            });
                        }
                    }
                    else if (!GameManager.ClientMgr.SubUserYinLiang(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, artifactItem.CostGoldCoin, "神器注入_金币", false))
                    {
                        return(new ShenQiData
                        {
                            UpResultType = -4
                        });
                    }
                    if (useBaoJi > 0)
                    {
                        if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, artifactItem.CostDiamond, "神器注入_钻石", true, true, false, DaiBiSySType.ShenQiXiTong))
                        {
                            return(new ShenQiData
                            {
                                UpResultType = -4
                            });
                        }
                    }
                    int   rate     = 0;
                    int   r        = Global.GetRandomNumber(0, 101);
                    int[] addProps = null;
                    for (int i = 0; i < artifactItem.QiangHuaRate.Length; i++)
                    {
                        rate += artifactItem.QiangHuaRate[i];
                        if (r <= rate)
                        {
                            addProps       = artifactItem.QiangHuaArray[i];
                            data.BurstType = i;
                            if (useBaoJi > 0 && 0 == i)
                            {
                                addProps       = artifactItem.QiangHuaArray[1];
                                data.BurstType = 1;
                            }
                            break;
                        }
                    }
                    data.LifeAdd      += addProps[0];
                    data.LifeAdd       = ((data.LifeAdd > artifactItem.PropArray[0]) ? artifactItem.PropArray[0] : data.LifeAdd);
                    data.AttackAdd    += addProps[1];
                    data.AttackAdd     = ((data.AttackAdd > artifactItem.PropArray[1]) ? artifactItem.PropArray[1] : data.AttackAdd);
                    data.DefenseAdd   += addProps[2];
                    data.DefenseAdd    = ((data.DefenseAdd > artifactItem.PropArray[2]) ? artifactItem.PropArray[2] : data.DefenseAdd);
                    data.ToughnessAdd += addProps[3];
                    data.ToughnessAdd  = ((data.ToughnessAdd > artifactItem.PropArray[3]) ? artifactItem.PropArray[3] : data.ToughnessAdd);
                    if (data.LifeAdd < artifactItem.PropArray[0] || data.DefenseAdd < artifactItem.PropArray[2] || data.AttackAdd < artifactItem.PropArray[1] || data.ToughnessAdd < artifactItem.PropArray[3])
                    {
                        data.UpResultType = 1;
                    }
                    else if (this.ShenQiRunTimeData.ArtifactXmlDict.ContainsKey(data.ShenQiID + 1))
                    {
                        data.UpResultType = 2;
                        data.ShenQiID++;
                        data.LifeAdd      = 0;
                        data.AttackAdd    = 0;
                        data.DefenseAdd   = 0;
                        data.ToughnessAdd = 0;
                    }
                    else
                    {
                        data.UpResultType = 3;
                    }
                    data.ShenLiJingHuaLeft = client.ClientData.ShenLiJingHuaPoints;
                    List <int> props = new List <int>();
                    props.AddRange(new int[]
                    {
                        data.ShenQiID,
                        data.LifeAdd,
                        data.AttackAdd,
                        data.DefenseAdd,
                        data.ToughnessAdd
                    });
                    Global.SaveRoleParamsIntListToDB(client, props, "36", true);
                    client.ClientData.shenQiData = data;
                    this.UpdateRoleShenQiProps(client);
                    this.UpdateRoleTouhgnessProps(client);
                    if (data.UpResultType == 2 || data.UpResultType == 3)
                    {
                        this.UpdateRoleGodProps(client);
                        GameManager.logDBCmdMgr.AddDBLogInfo(-1, "神像", "神器升阶", client.ClientData.RoleName, "系统", "增加", 1, client.ClientData.ZoneID, client.strUserID, data.ShenQiID, client.ServerId, null);
                    }
                    GameManager.logDBCmdMgr.AddDBLogInfo(-1, "韧性", "神器注入_韧性", client.ClientData.RoleName, "系统", "增加", addProps[3], client.ClientData.ZoneID, client.strUserID, Convert.ToInt32(RoleAlgorithm.GetExtProp(client, 101)), client.ServerId, null);
                    GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                    GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, true, false, 7);
                }
                catch (Exception ex)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("ShenQi :: 升级角色神器数据错误 roleid={0} ex:{1}", client.ClientData.RoleID, ex.Message), null, true);
                    return(data);
                }
                result = data;
            }
            return(result);
        }