コード例 #1
0
        public void TimerProc(object sender, EventArgs e)
        {
            Dictionary <int, int> dict = new Dictionary <int, int>();

            if (KuaFuManager.getInstance().CanKuaFuLogin())
            {
                lock (this.RuntimeData.Mutex)
                {
                    foreach (int mapCode in this.RuntimeData.MapCode2KuaFuLineDataDict.Keys)
                    {
                        dict[mapCode] = 0;
                    }
                }
            }
            List <int> list = dict.Keys.ToList <int>();

            foreach (int mapCode in list)
            {
                dict[mapCode] = GameManager.ClientMgr.GetMapClientsCount(mapCode);
            }
            if (KuaFuManager.KuaFuWorldKuaFuGameServer)
            {
                KuaFuWorldClient.getInstance().UpdateKuaFuMapClientCount(dict);
            }
            else
            {
                YongZheZhanChangClient.getInstance().UpdateKuaFuMapClientCount(dict);
            }
        }
コード例 #2
0
 public bool showdown()
 {
     try
     {
         lock (this.RuntimeData.Mutex)
         {
             this.RuntimeData.BackGroundThread.Abort();
             this.RuntimeData.BackGroundThread = null;
         }
         GlobalEventSource.getInstance().removeListener(12, KuaFuManager.getInstance());
         if (!HuanYingSiYuanClient.getInstance().showdown())
         {
             return(false);
         }
         if (!SpreadClient.getInstance().showdown())
         {
             return(false);
         }
         if (!AllyClient.getInstance().showdown())
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
     return(true);
 }
コード例 #3
0
        public bool GetKuaFuDbServerInfo(int serverId, out string dbIp, out int dbPort, out string logIp, out int logPort, out string gsIp, out int gsPort)
        {
            KuaFuServerInfo kuaFuServerInfo;
            bool            result;

            if (KuaFuManager.getInstance().TryGetValue(serverId, out kuaFuServerInfo))
            {
                dbIp    = kuaFuServerInfo.DbIp;
                dbPort  = kuaFuServerInfo.DbPort;
                logIp   = kuaFuServerInfo.DbIp;
                logPort = kuaFuServerInfo.LogDbPort;
                gsIp    = kuaFuServerInfo.Ip;
                gsPort  = kuaFuServerInfo.Port;
                result  = true;
            }
            else
            {
                dbIp    = null;
                dbPort  = 0;
                logIp   = null;
                logPort = 0;
                gsIp    = null;
                gsPort  = 0;
                result  = false;
            }
            return(result);
        }
コード例 #4
0
        /// <summary>
        /// 玩家离开
        /// </summary>
        public void LeaveFuBen(GameClient client)
        {
            //ElementWarClient.getInstance().GameFuBenRoleChangeState(client.ClientData.RoleID, (int)KuaFuRoleStates.None);

            ElementWarScene scene = null;

            lock (_sceneDict)
            {
                if (!_sceneDict.TryGetValue(client.ClientData.FuBenSeqID, out scene))
                {
                    return;
                }
            }

            lock (scene)
            {
                scene.PlayerCount--;
                if (scene.SceneStatus != GameSceneStatuses.STATUS_END &&
                    scene.SceneStatus != GameSceneStatuses.STATUS_AWARD &&
                    scene.SceneStatus != GameSceneStatuses.STATUS_CLEAR)
                {
                    KuaFuManager.getInstance().SetCannotJoinKuaFu_UseAutoEndTicks(client);
                }
            }
        }
コード例 #5
0
 public bool ProcessJoinCmd(GameClient client, int nID, byte[] bytes, string[] cmdParams)
 {
     try
     {
         SceneUIClasses sceneType = Global.GetMapSceneType(client.ClientData.MapCode);
         if (sceneType != SceneUIClasses.Normal)
         {
             client.sendCmd(nID, "-21".ToString(), false);
             return(true);
         }
         if (!this.IsGongNengOpened(client, true))
         {
             client.sendCmd(nID, "-2001".ToString(), false);
             return(true);
         }
         if (client.ClientData.SignUpGameType != 0)
         {
             client.sendCmd(nID, "-2002".ToString(), false);
             return(true);
         }
         if (KuaFuManager.getInstance().IsInCannotJoinKuaFuCopyTime(client))
         {
             client.sendCmd(nID, "-2004".ToString(), false);
             return(true);
         }
         SystemXmlItem systemFuBenItem = null;
         if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(this._runtimeData.CopyID, out systemFuBenItem))
         {
             client.sendCmd(nID, "-3".ToString(), false);
             return(true);
         }
         int minLevel      = systemFuBenItem.GetIntValue("MinLevel", -1);
         int minZhuanSheng = systemFuBenItem.GetIntValue("MinZhuanSheng", -1);
         int levelLimit    = minZhuanSheng * 100 + minLevel;
         if (client.ClientData.ChangeLifeCount * 100 + client.ClientData.Level < levelLimit)
         {
             client.sendCmd(nID, "-19".ToString(), false);
             return(true);
         }
         int oldCount = this.GetElementWarCount(client);
         if (oldCount >= systemFuBenItem.GetIntValue("FinishNumber", -1))
         {
             client.sendCmd(nID, "-16".ToString(), false);
             return(true);
         }
         int result = 0;
         if (result > 0)
         {
             client.ClientData.SignUpGameType = 4;
             GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 1, 0, 0, 0, 4);
         }
         client.sendCmd <int>(nID, result, false);
         return(true);
     }
     catch (Exception ex)
     {
         DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(client.ClientSocket), false, false);
     }
     return(false);
 }
コード例 #6
0
        public static TCPProcessCmdResults ProcessFazhenBossCMD(TCPManager tcpMgr, TMSKSocket socket, TCPClientPool tcpClientPool, TCPOutPacketPool pool, int nID, byte[] data, int count, out TCPOutPacket tcpOutPacket)
        {
            tcpOutPacket = null;
            string cmdData = null;

            try
            {
                cmdData = new UTF8Encoding().GetString(data, 0, count);
            }
            catch (Exception)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("解析指令字符串错误, CMD={0}, Client={1}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false)), null, true);
                return(TCPProcessCmdResults.RESULT_FAILED);
            }
            try
            {
                string[] fields = cmdData.Split(new char[]
                {
                    ':'
                });
                if (fields.Length != 1)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("指令参数个数错误, CMD={0}, Client={1}, Recv={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false), fields.Length), null, true);
                    return(TCPProcessCmdResults.RESULT_FAILED);
                }
                int        roleID = Convert.ToInt32(fields[0]);
                GameClient client = GameManager.ClientMgr.FindClient(socket);
                if (KuaFuManager.getInstance().ClientCmdCheckFaild(nID, client, ref roleID))
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("根据RoleID定位GameClient对象失败, CMD={0}, Client={1}, RoleID={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false), roleID), null, true);
                    return(TCPProcessCmdResults.RESULT_FAILED);
                }
                if (client.ClientData.FuBenID != LuoLanFaZhenCopySceneManager.LuoLanFaZhenFubenID)
                {
                    return(TCPProcessCmdResults.RESULT_OK);
                }
                SingleLuoLanFaZhenFubenData fubenData = LuoLanFaZhenCopySceneManager.GetFubenData(client.ClientData.FuBenSeqID);
                if (null == fubenData)
                {
                    return(TCPProcessCmdResults.RESULT_OK);
                }
                string strcmd = string.Format("{0}:{1}:{2}:{3}:{4}", new object[]
                {
                    LuoLanFaZhenCopySceneManager.LuoLanFaZhenFubenID,
                    LuoLanFaZhenCopySceneManager.FinalBossID,
                    fubenData.FinalBossLeftNum,
                    LuoLanFaZhenCopySceneManager.SpecialBossID,
                    fubenData.SpecailBossLeftNum
                });
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, 760);
                return(TCPProcessCmdResults.RESULT_DATA);
            }
            catch (Exception ex)
            {
                DataHelper.WriteFormatExceptionLog(ex, "ProcessFazhenBossCMD", false, false);
            }
            return(TCPProcessCmdResults.RESULT_FAILED);
        }
コード例 #7
0
        public static TCPProcessCmdResults ProcessGetActiveAwards(TCPManager tcpMgr, TMSKSocket socket, TCPClientPool tcpClientPool, TCPOutPacketPool pool, int nID, byte[] data, int count, out TCPOutPacket tcpOutPacket)
        {
            tcpOutPacket = null;
            string cmdData = null;

            try
            {
                cmdData = new UTF8Encoding().GetString(data, 0, count);
            }
            catch (Exception)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("解析指令字符串错误, CMD={0}", (TCPGameServerCmds)nID), null, true);
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 30767);
                return(TCPProcessCmdResults.RESULT_DATA);
            }
            try
            {
                string[] fields = cmdData.Split(new char[]
                {
                    ':'
                });
                if (fields.Length != 3)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("指令参数个数错误, CMD={0}, Recv={1}, CmdData={2}", (TCPGameServerCmds)nID, fields.Length, cmdData), null, true);
                    tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 30767);
                    return(TCPProcessCmdResults.RESULT_DATA);
                }
                int        roleID       = Convert.ToInt32(fields[0]);
                int        activityType = Global.SafeConvertToInt32(fields[1]);
                int        extTag       = Global.SafeConvertToInt32(fields[2]);
                GameClient client       = GameManager.ClientMgr.FindClient(socket);
                if (KuaFuManager.getInstance().ClientCmdCheckFaild(nID, client, ref roleID))
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("根据RoleID定位GameClient对象失败, CMD={0}, Client={1}, RoleID={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false), roleID), null, true);
                    return(TCPProcessCmdResults.RESULT_FAILED);
                }
                switch (activityType)
                {
                case 33:
                    return(NewZoneActiveManager.GetNewLevelUpMadmanAward(client, pool, nID, roleID, activityType, extTag, out tcpOutPacket));

                case 34:
                case 35:
                case 36:
                case 37:
                    return(NewZoneActiveManager.GetActiveAwards(client, tcpClientPool, pool, nID, roleID, activityType, out tcpOutPacket));
                }
            }
            catch (Exception ex)
            {
                DataHelper.WriteFormatExceptionLog(ex, "", false, false);
            }
            tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 30767);
            return(TCPProcessCmdResults.RESULT_DATA);
        }
コード例 #8
0
ファイル: VideoLogic.cs プロジェクト: qiuhoude/mu_server
 public bool ProcessGuanZhanTrackingCmd(GameClient client, int nID, byte[] bytes, string[] cmdParams)
 {
     try
     {
         int roleID     = Convert.ToInt32(cmdParams[0]);
         int beTrackRID = Convert.ToInt32(cmdParams[1]);
         if (KuaFuManager.getInstance().ClientCmdCheckFaild(nID, client, ref roleID))
         {
             return(true);
         }
         lock (this.Mutex)
         {
             if (client.ClientData.HideGM == 0 || roleID == beTrackRID)
             {
                 return(true);
             }
             int posX = 0;
             int posY = 0;
             if (!this.GetGuanZhanPos(client.ClientData.MapCode, ref posX, ref posY))
             {
                 int result = -21;
                 client.sendCmd(nID, string.Format("{0}:{1}", result, -1), false);
                 return(true);
             }
             if (-1 == beTrackRID)
             {
                 this.CancleTracking(client, true);
                 return(true);
             }
             GameClient beTrackingClient = GameManager.ClientMgr.FindClient(beTrackRID);
             if (beTrackingClient == null || beTrackingClient.ClientData.HideGM > 0 || beTrackingClient.ClientData.WaitingNotifyChangeMap || beTrackingClient.ClientData.WaitingForChangeMap)
             {
                 int result = -21;
                 client.sendCmd(nID, string.Format("{0}:{1}", result, -1), false);
                 return(true);
             }
             SceneUIClasses srcSceneType = Global.GetMapSceneType(client.ClientData.MapCode);
             SceneUIClasses tarSceneType = Global.GetMapSceneType(beTrackingClient.ClientData.MapCode);
             if (srcSceneType != tarSceneType)
             {
                 int result = -21;
                 client.sendCmd(nID, string.Format("{0}:{1}", result, -1), false);
                 return(true);
             }
             this.Tracking(client, beTrackingClient);
         }
         return(true);
     }
     catch (Exception ex)
     {
         DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(client.ClientSocket), false, false);
     }
     return(false);
 }
コード例 #9
0
 public bool initialize(ICoreInterface coreInterface)
 {
     try
     {
         this.CoreInterface = coreInterface;
         if (!this.InitConfig())
         {
             return(false);
         }
         RemotingConfiguration.Configure(Process.GetCurrentProcess().MainModule.FileName + ".config", false);
         if (!HuanYingSiYuanClient.getInstance().initialize(coreInterface))
         {
             return(false);
         }
         if (!TianTiClient.getInstance().initialize(coreInterface))
         {
             return(false);
         }
         if (!YongZheZhanChangClient.getInstance().initialize(coreInterface))
         {
             return(false);
         }
         if (!KFCopyRpcClient.getInstance().initialize(coreInterface))
         {
             return(false);
         }
         if (!SpreadClient.getInstance().initialize(coreInterface))
         {
             return(false);
         }
         if (!AllyClient.getInstance().initialize(coreInterface))
         {
             return(false);
         }
         if (!IPStatisticsClient.getInstance().initialize(coreInterface))
         {
             return(false);
         }
         if (!JunTuanClient.getInstance().initialize(coreInterface))
         {
             return(false);
         }
         if (!KuaFuWorldClient.getInstance().initialize(coreInterface))
         {
             return(false);
         }
         GlobalEventSource.getInstance().registerListener(12, KuaFuManager.getInstance());
     }
     catch (Exception ex)
     {
         return(false);
     }
     return(true);
 }
コード例 #10
0
        public static TCPProcessCmdResults ProcessMarryInit(TCPManager tcpMgr, TMSKSocket socket, TCPClientPool tcpClientPool, TCPRandKey tcpRandKey, TCPOutPacketPool pool, int nID, byte[] data, int count, out TCPOutPacket tcpOutPacket)
        {
            string cmdData = null;

            try
            {
                cmdData = new UTF8Encoding().GetString(data, 0, count);
            }
            catch (Exception)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("解析指令字符串错误, CMD={0}, Client={1}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false)), null, true);
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "", nID);
                return(TCPProcessCmdResults.RESULT_FAILED);
            }
            try
            {
                string[] fields = cmdData.Split(new char[]
                {
                    ':'
                });
                if (fields.Length != 2)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("指令参数个数错误, CMD={0}, Client={1}, Recv={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false), fields.Length), null, true);
                    tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "", nID);
                    return(TCPProcessCmdResults.RESULT_FAILED);
                }
                int        roleID   = Convert.ToInt32(fields[0]);
                int        spouseID = Convert.ToInt32(fields[1]);
                GameClient client   = GameManager.ClientMgr.FindClient(socket);
                if (KuaFuManager.getInstance().ClientCmdCheckFaild(nID, client, ref roleID))
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("根据RoleID定位GameClient对象失败, CMD={0}, Client={1}, RoleID={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false), roleID), null, true);
                    tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "", nID);
                    return(TCPProcessCmdResults.RESULT_FAILED);
                }
                if (client.ClientSocket.IsKuaFuLogin)
                {
                    client.sendCmd(nID, string.Format("{0}:{1}:{2}", -12, roleID, spouseID), false);
                    tcpOutPacket = null;
                    return(TCPProcessCmdResults.RESULT_OK);
                }
                MarryResult result = MarryLogic.MarryInit(client, spouseID);
                string      strcmd = string.Format("{0}:{1}:{2}", (int)result, roleID, spouseID);
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID);
                return(TCPProcessCmdResults.RESULT_DATA);
            }
            catch (Exception ex)
            {
                DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(socket), false, false);
            }
            tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "", nID);
            return(TCPProcessCmdResults.RESULT_FAILED);
        }
コード例 #11
0
ファイル: VideoLogic.cs プロジェクト: qiuhoude/mu_server
 public TCPProcessCmdResults ProcessGuanZhanMoveToCmd(TMSKSocket socket, TCPOutPacketPool pool, int nID, byte[] data, int count, out TCPOutPacket tcpOutPacket)
 {
     tcpOutPacket = null;
     try
     {
         SpriteMoveData moveData = DataHelper.BytesToObject <SpriteMoveData>(data, 0, count);
         if (null == moveData)
         {
             LogManager.WriteLog(LogTypes.Error, string.Format("ProcessOpenVideoCmd解析客户端数据失败!", new object[0]), null, true);
             return(TCPProcessCmdResults.RESULT_FAILED);
         }
         int        roleID = moveData.roleID;
         GameClient client = GameManager.ClientMgr.FindClient(socket);
         if (KuaFuManager.getInstance().ClientCmdCheckFaild(nID, client, ref roleID))
         {
             LogManager.WriteLog(LogTypes.Error, string.Format("根据RoleID定位GameClient对象失败, CMD={0}, Client={1}, RoleID={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false), roleID), null, true);
             return(TCPProcessCmdResults.RESULT_FAILED);
         }
         if (client.ClientData.HideGM == 0)
         {
             LogManager.WriteLog(LogTypes.Error, string.Format("帐号{0}无观战权限,禁止传送!", client.strUserID), null, true);
             return(TCPProcessCmdResults.RESULT_OK);
         }
         int mapCode = moveData.mapCode;
         int toX     = moveData.toX;
         int toY     = moveData.toY;
         if (Global.GetMapSceneType(mapCode) != Global.GetMapSceneType(client.ClientData.MapCode))
         {
             LogManager.WriteLog(LogTypes.Error, string.Format("必须进入观战地图,才可传送在本活动关联地图范围内传送!", client.strUserID), null, true);
             return(TCPProcessCmdResults.RESULT_OK);
         }
         GameMap gameMap;
         if (GameManager.MapMgr.DictMaps.TryGetValue(mapCode, out gameMap))
         {
             if (mapCode != client.ClientData.MapCode)
             {
                 client.ClientData.WaitingChangeMapToMapCode = mapCode;
                 GameManager.ClientMgr.NotifyChangeMap(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, mapCode, toX, toY, -1, 0);
             }
             else
             {
                 GameManager.ClientMgr.NotifyOthersGoBack(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, toX, toY, -1);
             }
         }
         return(TCPProcessCmdResults.RESULT_OK);
     }
     catch (Exception ex)
     {
         DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(socket), false, false);
     }
     return(TCPProcessCmdResults.RESULT_FAILED);
 }
コード例 #12
0
        public TCPProcessCmdResults ProcessHoldQingGongYanCMD(TCPManager tcpMgr, TMSKSocket socket, TCPClientPool tcpClientPool, TCPOutPacketPool pool, int nID, byte[] data, int count, out TCPOutPacket tcpOutPacket)
        {
            tcpOutPacket = null;
            string cmdData = null;

            try
            {
                cmdData = new UTF8Encoding().GetString(data, 0, count);
            }
            catch (Exception)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("解析指令字符串错误, CMD={0}, Client={1}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false)), null, true);
                return(TCPProcessCmdResults.RESULT_FAILED);
            }
            try
            {
                string[] fields = cmdData.Split(new char[]
                {
                    ':'
                });
                if (fields.Length != 3)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("指令参数个数错误, CMD={0}, Client={1}, Recv={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false), fields.Length), null, true);
                    return(TCPProcessCmdResults.RESULT_FAILED);
                }
                int        roleID    = Convert.ToInt32(fields[0]);
                int        Index     = Convert.ToInt32(fields[1]);
                int        OnlyCheck = Convert.ToInt32(fields[2]);
                GameClient client    = GameManager.ClientMgr.FindClient(socket);
                if (KuaFuManager.getInstance().ClientCmdCheckFaild(nID, client, ref roleID))
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("根据RoleID定位GameClient对象失败, CMD={0}, Client={1}, RoleID={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false), roleID), null, true);
                    return(TCPProcessCmdResults.RESULT_FAILED);
                }
                QingGongYanResult result = this.HoldQingGongYan(client, Index, OnlyCheck);
                string            strcmd;
                if (result != QingGongYanResult.Success)
                {
                    strcmd       = string.Format("{0}:{1}:{2}", (int)result, roleID, OnlyCheck);
                    tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID);
                    return(TCPProcessCmdResults.RESULT_DATA);
                }
                strcmd       = string.Format("{0}:{1}:{2}", 0, roleID, OnlyCheck);
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID);
                return(TCPProcessCmdResults.RESULT_DATA);
            }
            catch (Exception ex)
            {
                DataHelper.WriteFormatExceptionLog(ex, "ProcessHoldQingGongYanCMD", false, false);
            }
            return(TCPProcessCmdResults.RESULT_FAILED);
        }
コード例 #13
0
ファイル: VideoLogic.cs プロジェクト: qiuhoude/mu_server
        public TCPProcessCmdResults ProcessOpenVideoCmd(TMSKSocket socket, TCPOutPacketPool pool, int nID, byte[] data, int count, out TCPOutPacket tcpOutPacket)
        {
            tcpOutPacket = null;
            string cmdData = null;

            try
            {
                cmdData = new UTF8Encoding().GetString(data, 0, count);
            }
            catch (Exception)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("解析指令字符串错误, CMD={0}", (TCPGameServerCmds)nID), null, true);
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 1700);
                return(TCPProcessCmdResults.RESULT_DATA);
            }
            try
            {
                string[] fields = cmdData.Split(new char[]
                {
                    ':'
                });
                if (fields.Length != 1)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("指令参数个数错误, CMD={0}, Recv={1}, CmdData={2}", (TCPGameServerCmds)nID, fields.Length, cmdData), null, true);
                    tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 1700);
                    return(TCPProcessCmdResults.RESULT_DATA);
                }
                int        roleID = Convert.ToInt32(fields[0]);
                GameClient client = GameManager.ClientMgr.FindClient(socket);
                if (KuaFuManager.getInstance().ClientCmdCheckFaild(nID, client, ref roleID))
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("根据RoleID定位GameClient对象失败, CMD={0}, Client={1}, RoleID={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false), roleID), null, true);
                    return(TCPProcessCmdResults.RESULT_FAILED);
                }
                VideoData roomData = this.GetVideoRoomData(client);
                if (roomData == null)
                {
                    tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "", nID);
                    return(TCPProcessCmdResults.RESULT_DATA);
                }
                int    filterStatus = this.GetPlayerFilterStatus(client, roomData);
                string strcmd       = string.Format("{0}:{1}:{2}", roomData.TalkID, roomData.PassWord, filterStatus);
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID);
            }
            catch (Exception ex)
            {
                DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(socket), false, false);
            }
            return(TCPProcessCmdResults.RESULT_DATA);
        }
コード例 #14
0
        /// <summary>
        /// 匹配成功,立即开始或暂不进入
        /// </summary>
        public bool ProcessEnterCmd(GameClient client, int nID, byte[] bytes, string[] cmdParams)
        {
            try
            {
                if (!IsGongNengOpened(client))
                {
                    client.sendCmd(nID, StdErrorCode.Error_Success_No_Info.ToString());
                    return(true);
                }

                int result = StdErrorCode.Error_Success;
                client.ClientData.SignUpGameType = (int)GameTypes.None;

                int flag = Global.SafeConvertToInt32(cmdParams[1]);
                if (flag > 0)
                {
                    result = 0;// ElementWarClient.getInstance().RoleChangeState(client.ClientData.RoleID, KuaFuRoleStates.EnterGame);
                    if (result < 0)
                    {
                        flag = 0;
                    }
                }
                else
                {
                    // ElementWarClient.getInstance().RoleChangeState(client.ClientData.RoleID, KuaFuRoleStates.None);

                    //惩罚
                    KuaFuManager.getInstance().SetCannotJoinKuaFu_UseAutoEndTicks(client);
                }

                if (flag <= 0)
                {
                    Global.GetClientKuaFuServerLoginData(client).RoleId = 0;
                    client.sendCmd((int)TCPGameServerCmds.CMD_SPR_ELEMENT_WAR_QUIT, StdErrorCode.Error_Success_No_Info.ToString());
                }

                //client.sendCmd(nID, result);
                return(true);
            }
            catch (Exception ex)
            {
                DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(client.ClientSocket), false);
            }

            return(false);
        }
コード例 #15
0
 public TCPProcessCmdResults OnResponse(TCPManager tcpMgr, TMSKSocket socket, TCPClientPool tcpClientPool, TCPRandKey tcpRandKey, TCPOutPacketPool pool, int nID, byte[] data, int count, out TCPOutPacket tcpOutPacket)
 {
     tcpOutPacket = null;
     try
     {
         string[] fields = new UTF8Encoding().GetString(data, 0, count).Split(new char[]
         {
             ':'
         });
         if (fields == null || fields.Length <= 2)
         {
             return(TCPProcessCmdResults.RESULT_FAILED);
         }
         int        roleId = Convert.ToInt32(fields[0]);
         int        index  = Convert.ToInt32(fields[1]);
         GameClient client = GameManager.ClientMgr.FindClient(socket);
         if (KuaFuManager.getInstance().ClientCmdCheckFaild(nID, client, ref roleId))
         {
             LogManager.WriteLog(LogTypes.Error, string.Format("根据RoleID定位GameClient对象失败, CMD={0}, Client={1}, RoleID={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false), roleId), null, true);
             return(TCPProcessCmdResults.RESULT_FAILED);
         }
         if (index < 0 || index >= 2)
         {
             LogManager.WriteLog(LogTypes.Error, string.Format("角色返回敏感数据索引错误,roleid={0}, rolename={1}, index={2}", roleId, client.ClientData.RoleName, index), null, true);
             return(TCPProcessCmdResults.RESULT_FAILED);
         }
         lock (client.InterestingData)
         {
             InterestingData.Item item = client.InterestingData.itemArray[index];
             if (item != null)
             {
                 item.LastResponseMs = TimeUtil.NOW();
                 item.ResponseCount++;
                 if (index == 0)
                 {
                     this._CheckSpeed(client, item, fields);
                 }
             }
         }
     }
     catch
     {
     }
     return(TCPProcessCmdResults.RESULT_OK);
 }
コード例 #16
0
ファイル: GlobalNew.cs プロジェクト: songxiaopeng/mu_server
 public static void PushGameDbClient(int serverId, TCPClient tcpClient, int poolId)
 {
     if (serverId <= 0 || serverId == GameManager.ServerId || serverId == GameManager.KuaFuServerId)
     {
         if (poolId == 0)
         {
             Global._TCPManager.tcpClientPool.Push(tcpClient);
         }
         else
         {
             Global._TCPManager.tcpLogClientPool.Push(tcpClient);
         }
     }
     else
     {
         KuaFuManager.getInstance().PushGameDbClient(serverId, tcpClient, poolId);
     }
 }
コード例 #17
0
        public static TCPProcessCmdResults ProcessGetActiveInfo(TCPManager tcpMgr, TMSKSocket socket, TCPClientPool tcpClientPool, TCPOutPacketPool pool, int nID, byte[] data, int count, out TCPOutPacket tcpOutPacket)
        {
            tcpOutPacket = null;
            string cmdData = null;

            try
            {
                cmdData = new UTF8Encoding().GetString(data, 0, count);
            }
            catch (Exception)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("解析指令字符串错误, CMD={0}", (TCPGameServerCmds)nID), null, true);
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 30767);
                return(TCPProcessCmdResults.RESULT_DATA);
            }
            try
            {
                string[] fields = cmdData.Split(new char[]
                {
                    ':'
                });
                if (fields.Length != 2)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("指令参数个数错误, CMD={0}, Recv={1}, CmdData={2}", (TCPGameServerCmds)nID, fields.Length, cmdData), null, true);
                    tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 30767);
                    return(TCPProcessCmdResults.RESULT_DATA);
                }
                int        roleID     = Convert.ToInt32(fields[0]);
                int        activetype = Convert.ToInt32(fields[1]);
                GameClient client     = GameManager.ClientMgr.FindClient(socket);
                if (KuaFuManager.getInstance().ClientCmdCheckFaild(nID, client, ref roleID))
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("根据RoleID定位GameClient对象失败, CMD={0}, Client={1}, RoleID={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false), roleID), null, true);
                    return(TCPProcessCmdResults.RESULT_FAILED);
                }
                return(Global.RequestToDBServer2(tcpClientPool, pool, nID, Global.GetActivityRequestCmdString((ActivityTypes)activetype, client, 0), out tcpOutPacket, client.ServerId));
            }
            catch (Exception ex)
            {
                DataHelper.WriteFormatExceptionLog(ex, "", false, false);
            }
            return(TCPProcessCmdResults.RESULT_FAILED);
        }
コード例 #18
0
        public static TCPProcessCmdResults ProcessQueryLevelUpMadmanCmd(TCPManager tcpMgr, TMSKSocket socket, TCPClientPool tcpClientPool, TCPOutPacketPool pool, int nID, byte[] data, int count, out TCPOutPacket tcpOutPacket)
        {
            tcpOutPacket = null;
            string cmdData = null;

            try
            {
                cmdData = new UTF8Encoding().GetString(data, 0, count);
            }
            catch (Exception)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("解析指令字符串错误, CMD={0}, Client={1}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false)), null, true);
                return(TCPProcessCmdResults.RESULT_FAILED);
            }
            try
            {
                string[] fields = cmdData.Split(new char[]
                {
                    ':'
                });
                if (fields.Length != 1)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("指令参数个数错误, CMD={0}, Client={1}, Recv={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false), fields.Length), null, true);
                    return(TCPProcessCmdResults.RESULT_FAILED);
                }
                int        roleID = Convert.ToInt32(fields[0]);
                GameClient client = GameManager.ClientMgr.FindClient(socket);
                if (KuaFuManager.getInstance().ClientCmdCheckFaild(nID, client, ref roleID))
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("根据RoleID定位GameClient对象失败, CMD={0}, Client={1}, RoleID={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false), roleID), null, true);
                    return(TCPProcessCmdResults.RESULT_FAILED);
                }
                if (NewZoneActiveManager.QueryLevelUpMadman(client, pool, nID, out tcpOutPacket))
                {
                    return(TCPProcessCmdResults.RESULT_DATA);
                }
            }
            catch (Exception ex)
            {
                DataHelper.WriteFormatExceptionLog(ex, "ProcessQueryLevelUpMadmanCmd", false, false);
            }
            return(TCPProcessCmdResults.RESULT_FAILED);
        }
コード例 #19
0
ファイル: VideoLogic.cs プロジェクト: qiuhoude/mu_server
 public bool ProcessGuanZhanRoleMiniDataCmd(GameClient client, int nID, byte[] bytes, string[] cmdParams)
 {
     try
     {
         int roleID = Convert.ToInt32(cmdParams[0]);
         if (KuaFuManager.getInstance().ClientCmdCheckFaild(nID, client, ref roleID))
         {
             return(true);
         }
         if (client.ClientData.HideGM == 0)
         {
             return(true);
         }
         int posX = 0;
         int posY = 0;
         if (!this.GetGuanZhanPos(client.ClientData.MapCode, ref posX, ref posY))
         {
             return(true);
         }
         SceneUIClasses sceneType = Global.GetMapSceneType(client.ClientData.MapCode);
         GuanZhanData   gzData    = new GuanZhanData();
         if (SceneUIClasses.BangHuiMatch == sceneType)
         {
             BangHuiMatchManager.getInstance().FillGuanZhanData(client, gzData);
         }
         if (SceneUIClasses.LangHunLingYu == sceneType)
         {
             LangHunLingYuManager.getInstance().FillGuanZhanData(client, gzData);
         }
         if (SceneUIClasses.EscapeBattle == sceneType)
         {
             EscapeBattleManager.getInstance().FillGuanZhanData(client, gzData);
         }
         client.sendCmd <GuanZhanData>(nID, gzData, false);
         return(true);
     }
     catch (Exception ex)
     {
         DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(client.ClientSocket), false, false);
     }
     return(false);
 }
コード例 #20
0
        public void LeaveFuBen(GameClient client)
        {
            CopyWolfSceneInfo scene = null;

            lock (this._runtimeData.SceneDict)
            {
                if (!this._runtimeData.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out scene))
                {
                    return;
                }
            }
            lock (scene)
            {
                scene.PlayerCount--;
                if (scene.SceneStatus != GameSceneStatuses.STATUS_END && scene.SceneStatus != GameSceneStatuses.STATUS_AWARD && scene.SceneStatus != GameSceneStatuses.STATUS_CLEAR)
                {
                    KuaFuManager.getInstance().SetCannotJoinKuaFu_UseAutoEndTicks(client);
                }
            }
        }
コード例 #21
0
ファイル: GlobalNew.cs プロジェクト: songxiaopeng/mu_server
        public static TCPClient PopGameDbClient(int serverId, int poolId)
        {
            TCPClient result;

            if (serverId <= 0 || serverId == GameManager.ServerId || serverId == GameManager.KuaFuServerId)
            {
                if (poolId == 0)
                {
                    result = Global._TCPManager.tcpClientPool.Pop();
                }
                else
                {
                    result = Global._TCPManager.tcpLogClientPool.Pop();
                }
            }
            else
            {
                result = KuaFuManager.getInstance().PopGameDbClient(serverId, poolId);
            }
            return(result);
        }
コード例 #22
0
 public void ClearCopyMapClients(CopyMap copyMap)
 {
     try
     {
         List <GameClient> objsList = copyMap.GetClientsList();
         if (objsList != null && objsList.Count > 0)
         {
             for (int i = 0; i < objsList.Count; i++)
             {
                 GameClient c = objsList[i];
                 if (c != null)
                 {
                     KuaFuManager.getInstance().GotoLastMap(c);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         DataHelper.WriteExceptionLogEx(ex, "跨服组队竞技清场调度异常");
     }
 }
コード例 #23
0
        private static int ReloadXmlFile_config_systemparams()
        {
            int ret = GameManager.systemParamsList.ReloadLoadParamsList();

            JunQiManager.ParseWeekDaysTimes();
            LuoLanChengZhanManager.getInstance().InitConfig();
            Global.ResetHuangChengMapCode();
            Global.ResetHuangGongMapCode();
            Global.HorseNamesList = null;
            Global.HorseSpeedList = null;
            GameManager.ShengXiaoGuessMgr.ReloadConfig(false);
            Global.InitGuMuMapCodes();
            Global.InitVipGumuExpMultiple();
            GameManager.GoodsPackMgr.ResetLimitTimeRange();
            Global.ErGuoTouGoodsIDList           = null;
            Global._VipUseBindTongQianGoodsIDNum = null;
            GameManager.AutoGiveGoodsIDList      = null;
            CaiJiLogic.LoadConfig();
            GameManager.MagicSwordMgr.LoadMagicSwordData();
            GameManager.SummonerMgr.LoadSummonerData();
            GameManager.MerlinMagicBookMgr.LoadMerlinSystemParamsConfigData();
            Global.LoadItemLogMark();
            Global.LoadLogTradeGoods();
            Global.LoadForgeSystemParams();
            KuaFuManager.getInstance().InitCopyTime();
            SingletonTemplate <SoulStoneManager> .Instance().LoadJingHuaExpConfig();

            SingletonTemplate <MonsterAttackerLogManager> .Instance().LoadRecordMonsters();

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

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

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

            SingletonTemplate <CoupleArenaManager> .Instance().InitSystenParams();

            return(ret);
        }
コード例 #24
0
        public static void PushGameDbClient(int serverId, TCPClient tcpClient, int poolId)
        {
#if BetaConfig
            if (serverId <= 0)
#else
            if (serverId <= 0 || serverId == GameManager.ServerId)
#endif
            {
                if (poolId == 0)
                {
                    Global._TCPManager.tcpClientPool.Push(tcpClient);
                }
                else// if(poolId == 1)
                {
                    Global._TCPManager.tcpLogClientPool.Push(tcpClient);
                }
            }
            else
            {
                KuaFuManager.getInstance().PushGameDbClient(serverId, tcpClient, poolId);
            }
        }
コード例 #25
0
        public static TCPClient PopGameDbClient(int serverId, int poolId)
        {
#if BetaConfig
            if (serverId <= 0)
#else
            if (serverId <= 0 || serverId == GameManager.ServerId)
#endif
            {
                if (poolId == 0)
                {
                    return(Global._TCPManager.tcpClientPool.Pop());
                }
                else// if(poolId == 1)
                {
                    return(Global._TCPManager.tcpLogClientPool.Pop());
                }
            }
            else
            {
                return(KuaFuManager.getInstance().PopGameDbClient(serverId, poolId));
            }
        }
コード例 #26
0
        public string GetZoneName(int serverID)
        {
            string zoneName;

            lock (this.ZoneID2ZoneNameDict)
            {
                if (this.ZoneID2ZoneNameDict.TryGetValue(serverID, out zoneName))
                {
                    return(zoneName);
                }
            }
            KuaFuServerInfo kuaFuServerInfo;

            if (KuaFuManager.getInstance().TryGetValue(serverID, out kuaFuServerInfo))
            {
                zoneName = kuaFuServerInfo.strServerName;
                lock (this.ZoneID2ZoneNameDict)
                {
                    this.ZoneID2ZoneNameDict[serverID] = zoneName;
                }
            }
            return(zoneName);
        }
コード例 #27
0
 public bool ProcessEnterCmd(GameClient client, int nID, byte[] bytes, string[] cmdParams)
 {
     try
     {
         if (!this.IsGongNengOpened(client, false))
         {
             client.sendCmd(nID, 0.ToString(), false);
             return(true);
         }
         client.ClientData.SignUpGameType = 0;
         int flag = Global.SafeConvertToInt32(cmdParams[1]);
         if (flag > 0)
         {
             int result = 0;
             if (result < 0)
             {
                 flag = 0;
             }
         }
         else
         {
             KuaFuManager.getInstance().SetCannotJoinKuaFu_UseAutoEndTicks(client);
         }
         if (flag <= 0)
         {
             Global.GetClientKuaFuServerLoginData(client).RoleId = 0;
             client.sendCmd(1011, 0.ToString(), false);
         }
         return(true);
     }
     catch (Exception ex)
     {
         DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(client.ClientSocket), false, false);
     }
     return(false);
 }
コード例 #28
0
        public static int ReloadXmlFile(string xmlFileName)
        {
            string lowerXmlFileName = xmlFileName.ToLower();
            int    result;

            if (Global.GetGiftExchangeFileName().ToLower() == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_gifts_activities();
            }
            else if ("config/gifts/biggift.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_gifts_biggift();
            }
            else if ("config/gifts/loginnumgift.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_gifts_loginnumgift();
            }
            else if ("config/gifts/huodongloginnumgift.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_gifts_huodongloginnumgift();
            }
            else if ("config/gifts/newrolegift.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_gifts_newrolegift();
            }
            else if ("config/gifts/comateffectivenessgift.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_combat_effectiveness_gift();
            }
            else if ("config/gifts/uplevelgift.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_gifts_uplevelgift();
            }
            else if ("config/gifts/onlietimegift.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_gifts_onlietimegift();
            }
            else if ("config/platconfig.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_platconfig();
            }
            else if ("config/mall.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_mall();
            }
            else if ("config/monstergoodslist.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_monstergoodslist();
            }
            else if ("config/broadcastinfos.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_broadcastinfos();
            }
            else if ("config/specialtimes.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_specialtimes();
            }
            else if ("config/battle.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_battle();
            }
            else if ("config/arenabattle.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_ArenaBattle();
            }
            else if ("config/popupwin.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_popupwin();
            }
            else if ("config/npcscripts.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_npcscripts();
            }
            else if ("config/systemoperations.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_systemoperations();
            }
            else if ("config/systemparams.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_systemparams();
            }
            else if ("config/goodsmergeitems.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_goodsmergeitems();
            }
            else if ("config/qizhengegoods.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_qizhengegoods();
            }
            else if ("config/npcsalelist.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_npcsalelist();
            }
            else if ("config/goods.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_goods();
            }
            else if ("config/goodspack.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_goodspack();
            }
            else if ("config/systemtasks.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_systemtasks();
            }
            else if ("config/taskzhangjie.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_taskzhangjie();
            }
            else if ("config/equipupgrade.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_equipupgrade();
            }
            else if ("config/dig.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_dig();
            }
            else if ("config/battleexp.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_battleexp();
            }
            else if ("config/rebirth.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_rebirth();
            }
            else if ("config/battleaward.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_Award();
            }
            else if ("config/equipborn.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_EquipBorn();
            }
            else if ("config/bornname.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_BornName();
            }
            else if ("config/gifts/fanli.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_gifts_FanLi();
            }
            else if ("config/gifts/chongzhisong.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_gifts_ChongZhiSong();
            }
            else if ("config/gifts/chongzhiking.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_gifts_ChongZhiKing();
            }
            else if ("config/gifts/levelking.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_gifts_LevelKing();
            }
            else if ("config/gifts/bossking.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_gifts_EquipKing();
            }
            else if ("config/gifts/wuxueking.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_gifts_HorseKing();
            }
            else if ("config/gifts/jingmaiking.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_gifts_JingMaiKing();
            }
            else if ("config/gifts/vipdailyawards.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_gifts_VipDailyAwards();
            }
            else if ("config/activity/activitytip.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_ActivityTip();
            }
            else if ("config/luckyaward.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_LuckyAward();
            }
            else if ("config/lucky.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_Lucky();
            }
            else if ("config/chengjiu.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_ChengJiu();
            }
            else if ("config/chengjiubuff.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_ChengJiuBuff();
            }
            else if (string.Format("Config\\JieRiGifts\\ JieRiDanBiChongZhi.xml", new object[0]).ToLower() == lowerXmlFileName)
            {
                result = HuodongCachingMgr.ResetDanBiChongZhiActivity();
            }
            else if ("config/jingmai.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_JingMai();
            }
            else if ("config/wuxue.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_WuXue();
            }
            else if ("config/zuanhuang.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_ZuanHuang();
            }
            else if ("config/vip.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_Vip();
            }
            else if ("config/qianggou.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_QiangGou();
            }
            else if ("config/hefugifts/hefuqianggou.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_HeFuQiangGou();
            }
            else if ("config/jierigifts/jirriqianggou.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_JieRiQiangGou();
            }
            else if ("config/systemopen.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_SystemOpen();
            }
            else if ("config/DailyActiveInfor.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_DailyActive();
            }
            else if ("DailyActiveAward.xml" == lowerXmlFileName)
            {
                result = ReloadXmlManager.ReloadXmlFile_config_DailyActiveAward();
            }
            else if ("config/ipwhitelist.xml" == lowerXmlFileName)
            {
                SingletonTemplate <CreateRoleLimitManager> .Instance().LoadConfig();

                result = 1;
            }
            else
            {
                if ("kuafu" == lowerXmlFileName)
                {
                    if (KuaFuManager.getInstance().InitConfig())
                    {
                        return(1);
                    }
                }
                else if ("langhunlingyu" == lowerXmlFileName)
                {
                    if (LangHunLingYuManager.getInstance().InitConfig())
                    {
                        return(1);
                    }
                }
                else if ("config/chongzhi_app.xml" == lowerXmlFileName || "config/chongzhi_andrid.xml" == lowerXmlFileName || "config/chongzhi_android.xml" == lowerXmlFileName || "config/chongzhi_yueyu.xml" == lowerXmlFileName)
                {
                    UserMoneyMgr.getInstance().InitConfig();
                }
                else
                {
                    if ("config/AssInfo.xml" == lowerXmlFileName || "config/AssList.xml" == lowerXmlFileName || "config/AssConfig.xml" == lowerXmlFileName)
                    {
                        return(RobotTaskValidator.getInstance().LoadRobotTaskData() ? 1 : 0);
                    }
                    if ("Config/Auction.xml" == lowerXmlFileName || "Config/AngelTempleAuctionAward.xml" == lowerXmlFileName)
                    {
                        return(GoldAuctionConfigModel.LoadConfig());
                    }
                    if ("Config/CaiShuZi.xml" == lowerXmlFileName || "Config/CaiDaXiao.xml" == lowerXmlFileName || "Config/DuiHuanShangCheng.xml" == lowerXmlFileName || "Config/DaiBiShiYong.xml" == lowerXmlFileName)
                    {
                        return(BoCaiConfigMgr.LoadConfig(true));
                    }
                    if (lowerXmlFileName.IndexOf("Config\\Horse") > -1)
                    {
                        ZuoQiManager.getInstance().ReLoadConfig(false);
                    }
                }
                result = -1000;
            }
            return(result);
        }
コード例 #29
0
        public void TimerProc()
        {
            long nowTicks = TimeUtil.NOW();

            if (nowTicks >= KuaFuBossManager.NextHeartBeatTicks)
            {
                KuaFuBossManager.NextHeartBeatTicks = nowTicks + 1020L;
                foreach (KuaFuBossScene scene in this.SceneDict.Values)
                {
                    lock (this.RuntimeData.Mutex)
                    {
                        int nID        = scene.FuBenSeqId;
                        int nCopyID    = scene.CopyMapId;
                        int nMapCodeID = scene.m_nMapCode;
                        if (nID >= 0 && nCopyID >= 0 && nMapCodeID >= 0)
                        {
                            CopyMap  copyMap = scene.CopyMap;
                            DateTime now     = TimeUtil.NowDateTime();
                            long     ticks   = TimeUtil.NOW();
                            if (scene.m_eStatus == GameSceneStatuses.STATUS_NULL)
                            {
                                if (ticks >= scene.StartTimeTicks)
                                {
                                    scene.m_lPrepareTime         = scene.StartTimeTicks;
                                    scene.m_lBeginTime           = scene.m_lPrepareTime + (long)(scene.SceneInfo.PrepareSecs * 1000);
                                    scene.m_eStatus              = GameSceneStatuses.STATUS_PREPARE;
                                    scene.StateTimeData.GameType = 6;
                                    scene.StateTimeData.State    = (int)scene.m_eStatus;
                                    scene.StateTimeData.EndTicks = scene.m_lBeginTime;
                                    GameManager.ClientMgr.BroadSpecialCopyMapMessage <GameSceneStateTimeData>(827, scene.StateTimeData, scene.CopyMap);
                                }
                            }
                            else if (scene.m_eStatus == GameSceneStatuses.STATUS_PREPARE)
                            {
                                if (ticks >= scene.m_lBeginTime)
                                {
                                    scene.m_eStatus              = GameSceneStatuses.STATUS_BEGIN;
                                    scene.m_lEndTime             = scene.m_lBeginTime + (long)(scene.SceneInfo.FightingSecs * 1000);
                                    scene.StateTimeData.GameType = 6;
                                    scene.StateTimeData.State    = (int)scene.m_eStatus;
                                    scene.StateTimeData.EndTicks = scene.m_lEndTime;
                                    GameManager.ClientMgr.BroadSpecialCopyMapMessage <GameSceneStateTimeData>(827, scene.StateTimeData, scene.CopyMap);
                                }
                            }
                            else if (scene.m_eStatus == GameSceneStatuses.STATUS_BEGIN)
                            {
                                if (ticks >= scene.m_lEndTime)
                                {
                                    scene.m_eStatus              = GameSceneStatuses.STATUS_END;
                                    scene.m_lLeaveTime           = scene.m_lEndTime + (long)(scene.SceneInfo.ClearRolesSecs * 1000);
                                    scene.StateTimeData.GameType = 6;
                                    scene.StateTimeData.State    = 5;
                                    scene.StateTimeData.EndTicks = scene.m_lLeaveTime;
                                    GameManager.ClientMgr.BroadSpecialCopyMapMessage <GameSceneStateTimeData>(827, scene.StateTimeData, scene.CopyMap);
                                    this.NotifySceneData(scene);
                                }
                                else
                                {
                                    scene.ElapsedSeconds = (int)Math.Min((nowTicks - scene.m_lBeginTime) / 1000L, (long)scene.SceneInfo.TotalSecs);
                                    this.CheckCreateDynamicMonster(scene, ticks);
                                    if (nowTicks > scene.NextNotifySceneStateDataTicks)
                                    {
                                        scene.NextNotifySceneStateDataTicks = nowTicks + 3000L;
                                        this.NotifySceneData(scene);
                                    }
                                }
                            }
                            else if (scene.m_eStatus == GameSceneStatuses.STATUS_END)
                            {
                                GameManager.CopyMapMgr.KillAllMonster(scene.CopyMap);
                                scene.m_eStatus = GameSceneStatuses.STATUS_AWARD;
                                YongZheZhanChangClient.getInstance().PushGameResultData(scene.GameStatisticalData);
                                YongZheZhanChangClient.getInstance().GameFuBenChangeState(scene.GameId, GameFuBenState.End, now);
                                YongZheZhanChangFuBenData fuBenData;
                                if (this.RuntimeData.FuBenItemData.TryGetValue(scene.GameId, out fuBenData))
                                {
                                    fuBenData.State = GameFuBenState.End;
                                    LogManager.WriteLog(LogTypes.Error, string.Format("跨服Boss跨服副本GameID={0},战斗结束", fuBenData.GameId), null, true);
                                }
                            }
                            else if (scene.m_eStatus == GameSceneStatuses.STATUS_AWARD)
                            {
                                if (ticks >= scene.m_lLeaveTime)
                                {
                                    copyMap.SetRemoveTicks(scene.m_lLeaveTime);
                                    scene.m_eStatus = GameSceneStatuses.STATUS_CLEAR;
                                    try
                                    {
                                        List <GameClient> objsList = copyMap.GetClientsList();
                                        if (objsList != null && objsList.Count > 0)
                                        {
                                            for (int i = 0; i < objsList.Count; i++)
                                            {
                                                GameClient c = objsList[i];
                                                if (c != null)
                                                {
                                                    KuaFuManager.getInstance().GotoLastMap(c);
                                                }
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        DataHelper.WriteExceptionLogEx(ex, "跨服Boss系统清场调度异常");
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #30
0
ファイル: ShareManager.cs プロジェクト: qiuhoude/mu_server
        public static TCPProcessCmdResults ProcessShareCMD(TCPManager tcpMgr, TMSKSocket socket, TCPClientPool tcpClientPool, TCPOutPacketPool pool, int nID, byte[] data, int count, out TCPOutPacket tcpOutPacket)
        {
            tcpOutPacket = null;
            string cmdData = null;

            try
            {
                cmdData = new UTF8Encoding().GetString(data, 0, count);
            }
            catch (Exception)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("解析指令字符串错误, CMD={0}, Client={1}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false)), null, true);
                return(TCPProcessCmdResults.RESULT_FAILED);
            }
            try
            {
                string[] fields = cmdData.Split(new char[]
                {
                    ':'
                });
                int        roleID = Convert.ToInt32(fields[0]);
                GameClient client = GameManager.ClientMgr.FindClient(socket);
                if (KuaFuManager.getInstance().ClientCmdCheckFaild(nID, client, ref roleID))
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("根据RoleID定位GameClient对象失败, CMD={0}, Client={1}, RoleID={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false), roleID), null, true);
                    return(TCPProcessCmdResults.RESULT_FAILED);
                }
                int resoult = 0;
                int extdata = 0;
                switch (nID)
                {
                case 663:
                    ShareManager.UpdateRoleShareState(client);
                    if (ShareManager.HasDoneShare(client))
                    {
                        if (ShareManager.CanGetShareAward(client))
                        {
                            extdata = 1;
                        }
                        else
                        {
                            extdata = 2;
                        }
                    }
                    else
                    {
                        extdata = 0;
                    }
                    break;

                case 664:
                    resoult = ShareManager.GiveRoleShareAward(client);
                    if (resoult == 0 || resoult == -2)
                    {
                        extdata = 2;
                    }
                    else if (resoult == -1)
                    {
                        extdata = 0;
                    }
                    else
                    {
                        extdata = 1;
                    }
                    break;

                case 665:
                    if (ShareManager.HasDoneShare(client))
                    {
                        if (ShareManager.CanGetShareAward(client))
                        {
                            extdata = 1;
                        }
                        else
                        {
                            extdata = 2;
                        }
                    }
                    else
                    {
                        extdata = 0;
                    }
                    break;
                }
                string strcmd = string.Format("{0}:{1}", resoult, extdata);
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID);
            }
            catch (Exception ex)
            {
                DataHelper.WriteFormatExceptionLog(ex, "ProcessShareCMD", false, false);
            }
            return(TCPProcessCmdResults.RESULT_DATA);
        }