private void OlympicsGuess(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            string[] fields = null;
            int      length = 2;

            if (!CheckHelper.CheckTCPCmdFields(nID, cmdParams, count, out fields, length))
            {
                client.sendCmd <bool>(nID, false);
            }
            else
            {
                int roleID = int.Parse(fields[0]);
                int dayID  = int.Parse(fields[1]);
                OlympicsGuessDataDB data = new OlympicsGuessDataDB();
                data.RoleID = roleID;
                data.DayID  = dayID;
                using (MyDbConnection3 conn = new MyDbConnection3(false))
                {
                    string          cmdText = string.Format("SELECT a1,a2,a3,award1,award2,award3 FROM t_olympics_guess WHERE roleID='{0}' and dayID='{1}' ", roleID, dayID);
                    MySQLDataReader reader  = conn.ExecuteReader(cmdText, new MySQLParameter[0]);
                    while (reader.Read())
                    {
                        data.A1     = int.Parse(reader["a1"].ToString());
                        data.A2     = int.Parse(reader["a2"].ToString());
                        data.A3     = int.Parse(reader["a3"].ToString());
                        data.Award1 = int.Parse(reader["award1"].ToString());
                        data.Award2 = int.Parse(reader["award2"].ToString());
                        data.Award3 = int.Parse(reader["award3"].ToString());
                    }
                }
                client.sendCmd <OlympicsGuessDataDB>(nID, data);
            }
        }
        public void processCmd(GameServerClient client, byte[] cmdParams, int count)
        {
            string cmdData = null;
            int    nID     = 20002;

            try
            {
                cmdData = new UTF8Encoding().GetString(cmdParams, 0, count);
            }
            catch (Exception)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("解析指令字符串错误, CMD={0}", (TCPGameServerCmds)nID));
                client.sendCmd(32767, "0");
                return;
            }
            string[] fields = cmdData.Split(new char[]
            {
                ':'
            });
            if (fields.Length != 24)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("指令参数个数错误, CMD={0}, Recv={1}, CmdData={2}", (TCPGameServerCmds)nID, fields.Length, cmdData));
                client.sendCmd(32767, "0");
            }
            else
            {
                DBItemLogWriter.getInstance().insertTradeNumLog(DBManager.getInstance(), fields);
                string strcmd = string.Format("{0}", 1);
                client.sendCmd(nID, strcmd);
            }
        }
        public void processCmd(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            int[] challengeRankings = DataHelper.BytesToObject <int[]>(cmdParams, 0, count);
            List <PlayerJingJiMiniData> miniDatas = JingJiChangManager.getInstance().getChallengeData(challengeRankings);

            client.sendCmd <List <PlayerJingJiMiniData> >(10141, miniDatas);
        }
 public void processCmd(GameServerClient client, int nID, byte[] cmdParams, int count)
 {
     if (nID == 1452)
     {
         this.ProcessArmorLevelStarUpCmd(client, nID, cmdParams, count);
     }
 }
Example #5
0
        public void processCmd(GameServerClient client, byte[] cmdParams, int count)
        {
            string cmdData = null;
            int    nID     = (int)TCPGameServerCmds.CMD_SPR_GETBAITANLOG;

            try
            {
                cmdData = new UTF8Encoding().GetString(cmdParams, 0, count);
            }
            catch (Exception) //解析错误
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("解析指令字符串错误, CMD={0}", (TCPGameServerCmds)nID));
                client.sendCmd((int)TCPGameServerCmds.CMD_DB_ERR_RETURN, "0");
                return;
            }

            List <BaiTanLogItemData> list = new List <BaiTanLogItemData>();

            string[] fields = cmdData.Split(':');
            if (fields.Length != 2)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("指令参数个数错误, CMD={0}, Recv={1}, CmdData={2}",
                                                                  (TCPGameServerCmds)nID, fields.Length, cmdData));

                client.sendCmd((int)TCPGameServerCmds.CMD_DB_ERR_RETURN, list);
                return;
            }

            int rid       = Convert.ToInt32(fields[0]);
            int pageIndex = Convert.ToInt32(fields[1]);

            client.sendCmd <List <BaiTanLogItemData> >((int)TCPGameServerCmds.CMD_SPR_GETBAITANLOG, BaiTanManager.getInstance().getDetailByPageIndex(rid, pageIndex));
        }
Example #6
0
 public void processCmd(GameServerClient client, int nID, byte[] cmdParams, int count)
 {
     try
     {
         lock (this.AuctionMsgMutex)
         {
             if (nID == 2080)
             {
                 this.GetGlodAuction(client, nID, cmdParams, count);
             }
             else if (nID == 2081)
             {
                 this.SetGlodAuction(client, nID, cmdParams, count);
             }
             else
             {
                 LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]id err id={0}", nID), null, true);
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true);
     }
 }
Example #7
0
        private void GetJieRiHongBaoRankList(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            List <JieriHongBaoKingItemData> list = new List <JieriHongBaoKingItemData>();

            try
            {
                List <string> args = DataHelper.BytesToObject <List <string> >(cmdParams, 0, count);
                using (MyDbConnection3 conn = new MyDbConnection3(false))
                {
                    string cmdText = string.Format("SELECT `rid`,`count`,`getawardtimes`,`lasttime`,`rname` FROM `t_hongbao_jieri_recv` WHERE `keystr`='{0}' ORDER BY `count` DESC,`lasttime` ASC,rid ASC limit {1};", args[0], args[1]);
                    using (MySQLDataReader reader = conn.ExecuteReader(cmdText, new MySQLParameter[0]))
                    {
                        int ranking = 1;
                        while (reader.Read())
                        {
                            list.Add(new JieriHongBaoKingItemData
                            {
                                RoleID        = Global.SafeConvertToInt32(reader[0].ToString(), 10),
                                TotalRecv     = Global.SafeConvertToInt32(reader[1].ToString(), 10),
                                GetAwardTimes = Global.SafeConvertToInt32(reader[2].ToString(), 10),
                                Rolename      = reader[4].ToString(),
                                Rank          = ranking++
                            });
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteException(ex.ToString());
            }
            client.sendCmd <List <JieriHongBaoKingItemData> >(nID, list);
        }
Example #8
0
        public void processCmd(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            int roleId            = DataHelper.BytesToObject <int>(cmdParams, 0, count);
            PlayerJingJiData data = JingJiChangManager.getInstance().getPlayerJingJiDataById(roleId);

            client.sendCmd <PlayerJingJiData>(10140, data);
        }
Example #9
0
        public void processCmdUpdateBuildLog(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            string cmdData = null;

            try
            {
                cmdData = new UTF8Encoding().GetString(cmdParams, 0, count);
            }
            catch (Exception)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("解析指令字符串错误, CMD={0}", (TCPGameServerCmds)nID), null, true);
                client.sendCmd(30767, "0");
                return;
            }
            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);
                client.sendCmd(30767, "0");
            }
            else
            {
                string          TimeLog = fields[0];
                BuildingLogType LogType = (BuildingLogType)Convert.ToInt32(fields[1]);
                DBManager       dbMgr   = DBManager.getInstance();
                DBWriter.UpdateBuildingLog(dbMgr, TimeLog, LogType);
                string strcmd = string.Format("{0}", 0);
                client.sendCmd(nID, strcmd);
            }
        }
Example #10
0
 public void SetYaoSaiMissionData(GameServerClient client, int nID, byte[] cmdParams, int count)
 {
     try
     {
         Dictionary <int, List <YaoSaiMissionData> > missionDict = DataHelper.BytesToObject <Dictionary <int, List <YaoSaiMissionData> > >(cmdParams, 0, count);
         foreach (KeyValuePair <int, List <YaoSaiMissionData> > item in missionDict)
         {
             foreach (YaoSaiMissionData mission in item.Value)
             {
                 string cmdText = string.Format("insert into t_yaosaimission values ({0},{1},{2},{3},'{4}','{5}') on duplicate key update missionid={2},state={3},zhipaijingling='{4}',starttime='{5}';\r\n", new object[]
                 {
                     item.Key,
                     mission.SiteID,
                     mission.MissionID,
                     mission.State,
                     mission.ZhiPaiJingLing,
                     mission.StartTime
                 });
                 GameDBManager.SystemServerSQLEvents.AddEvent(string.Format("+SQL: {0}", cmdText), EventLevels.Important);
                 using (MyDbConnection3 conn = new MyDbConnection3(false))
                 {
                     conn.ExecuteNonQuery(cmdText, 0);
                 }
             }
         }
         client.sendCmd <int>(nID, 0);
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Error, string.Format("YaoSaiMission :: 更新角色任务信息错误 cmd={0}, ex={1}", nID, ex.Message), null, true);
     }
 }
Example #11
0
        private void HandleClear(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            bool bResult = false;

            try
            {
                int        roleId = DataHelper.BytesToObject <int>(cmdParams, 0, count);
                DBRoleInfo dbRole = DBManager.getInstance().GetDBRoleInfo(ref roleId);
                if (dbRole == null)
                {
                    throw new Exception("SevenDayActivityManager.HandleClear not Find DBRoleInfo, roleid=" + roleId);
                }
                string sql = string.Format("DELETE FROM t_seven_day_act where roleid={0}", roleId);
                if (!this.ExecNonQuery(sql))
                {
                    throw new Exception("SevenDayActivityManager.HandleClear ExecSql Failed, sql= " + sql);
                }
                lock (dbRole.SevenDayActDict)
                {
                    dbRole.SevenDayActDict.Clear();
                }
                bResult = true;
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Error, ex.Message, null, true);
                bResult = false;
            }
            client.sendCmd <bool>(nID, bResult);
        }
 private void HandleGetZhanBao(GameServerClient client, int nID, byte[] cmdParams, int count)
 {
     try
     {
         string   cmdData = new UTF8Encoding().GetString(cmdParams, 0, count);
         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);
             client.sendCmd(30767, "0");
         }
         else
         {
             int  role        = Convert.ToInt32(fields[0]);
             int  role2       = Convert.ToInt32(fields[1]);
             long unionCouple = this.GetUnionCouple(role, role2);
             List <CoupleArenaZhanBaoItemData> result = this.GetZhanBao(unionCouple).ToList <CoupleArenaZhanBaoItemData>();
             result.Reverse();
             client.sendCmd <List <CoupleArenaZhanBaoItemData> >(nID, result);
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Error, "HandleGetZhanBao failed, " + ex.Message, null, true);
         client.sendCmd(30767, "0");
     }
 }
Example #13
0
 public static void UpdateLineHeart(GameServerClient client, int lineID, int onlineNum, string strMapOnlineNum = "")
 {
     lock (LineManager.Mutex)
     {
         LineItem lineItem = null;
         if (LineManager._LinesDict.TryGetValue(lineID, out lineItem))
         {
             lineItem.OnlineCount  = onlineNum;
             lineItem.OnlineTicks  = DateTime.Now.Ticks / 10000L;
             lineItem.MapOnlineNum = strMapOnlineNum;
             lineItem.ServerClient = client;
             client.LineId         = lineID;
         }
         else if (lineID >= 9000)
         {
             lineItem = new LineItem();
             LineManager._LinesDict[lineID] = lineItem;
             lineItem.LineID       = lineID;
             lineItem.OnlineCount  = onlineNum;
             lineItem.OnlineTicks  = DateTime.Now.Ticks / 10000L;
             lineItem.MapOnlineNum = strMapOnlineNum;
             lineItem.ServerClient = client;
             client.LineId         = lineID;
             if (!LineManager._LinesList.Contains(lineItem))
             {
                 LineManager._LinesList.Add(lineItem);
             }
         }
     }
 }
Example #14
0
        private void OlympicsGuessList(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            int roleID = DataHelper.BytesToObject <int>(cmdParams, 0, count);
            List <OlympicsGuessDataDB> list = new List <OlympicsGuessDataDB>();

            using (MyDbConnection3 conn = new MyDbConnection3(false))
            {
                string          cmdText = string.Format("SELECT roleID,dayID,a1,a2,a3,award1,award2,award3 FROM t_olympics_guess WHERE roleID={0} ORDER BY dayID ", roleID);
                MySQLDataReader reader  = conn.ExecuteReader(cmdText, new MySQLParameter[0]);
                while (reader.Read())
                {
                    list.Add(new OlympicsGuessDataDB
                    {
                        RoleID = int.Parse(reader["roleID"].ToString()),
                        DayID  = int.Parse(reader["dayID"].ToString()),
                        A1     = int.Parse(reader["a1"].ToString()),
                        A2     = int.Parse(reader["a2"].ToString()),
                        A3     = int.Parse(reader["a3"].ToString()),
                        Award1 = int.Parse(reader["award1"].ToString()),
                        Award2 = int.Parse(reader["award2"].ToString()),
                        Award3 = int.Parse(reader["award3"].ToString())
                    });
                }
            }
            client.sendCmd <List <OlympicsGuessDataDB> >(nID, list);
        }
Example #15
0
        private void ProcessArmorLevelStarUpCmd(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            int ret = 0;
            RoleDataCmdT <RoleArmorData> data = DataHelper.BytesToObject <RoleDataCmdT <RoleArmorData> >(cmdParams, 0, count);

            if (data != null && data.RoleID > 0)
            {
                DBManager  dbMgr      = DBManager.getInstance();
                DBRoleInfo dbRoleInfo = dbMgr.GetDBRoleInfo(ref data.RoleID);
                if (null != dbRoleInfo)
                {
                    if (dbRoleInfo.ArmorData.Armor != data.Value.Armor || dbRoleInfo.ArmorData.Exp != data.Value.Exp)
                    {
                        dbRoleInfo.ArmorData.Armor = data.Value.Armor;
                        dbRoleInfo.ArmorData.Exp   = data.Value.Exp;
                        using (MyDbConnection3 conn = new MyDbConnection3(false))
                        {
                            string cmdText = string.Format("update t_roles set armor={1},armorexp={2} where rid={0}", data.RoleID, data.Value.Armor, data.Value.Exp);
                            ret = conn.ExecuteSql(cmdText, new MySQLParameter[0]);
                        }
                    }
                }
            }
            client.sendCmd(nID, string.Format("{0}", ret));
        }
        public void processCmd(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            switch (nID)
            {
            case 20306:
                this.GetYaoSaiBossData(client, nID, cmdParams, count);
                break;

            case 20307:
                this.SetYaoSaiBossData(client, nID, cmdParams, count);
                break;

            case 20308:
                this.GetYaoSaiBossFightLog(client, nID, cmdParams, count);
                break;

            case 20309:
                this.SetYaoSaiBossFightLog(client, nID, cmdParams, count);
                break;

            case 20310:
                this.CleanYaoSaiBossFightData(client, nID, cmdParams, count);
                break;
            }
        }
Example #17
0
        public void processCmd(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            JingJiChallengeResultData data = DataHelper.BytesToObject <JingJiChallengeResultData>(cmdParams, 0, count);
            int ranking = JingJiChangManager.getInstance().onChallengeEnd(data);

            client.sendCmd <int>(10144, ranking);
        }
Example #18
0
        private void RoleDataSelectorQuery(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            int roleId = DataHelper.BytesToObject <int>(cmdParams, 0, count);
            RoleData4Selector roleData4Selector = this.GetRoleData4Selector(roleId, true);

            client.sendCmd <RoleData4Selector>(nID, roleData4Selector);
        }
Example #19
0
 public void processCmd(GameServerClient client, int nID, byte[] cmdParams, int count)
 {
     if (nID == 10230)
     {
         this.RoleCustomDataQuery(client, nID, cmdParams, count);
     }
 }
Example #20
0
        private void RoleCustomDataQuery(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            DBManager      dbMgr          = DBManager.getInstance();
            int            roleId         = DataHelper.BytesToObject <int>(cmdParams, 0, count);
            RoleCustomData roleCustomData = new RoleCustomData();

            roleCustomData.roleId = roleId;
            try
            {
                DBRoleInfo dbRoleInfo = dbMgr.GetDBRoleInfo(ref roleId);
                if (null != dbRoleInfo)
                {
                    if (null == dbRoleInfo.roleCustomData)
                    {
                        dbRoleInfo.roleCustomData = this.QueryRoleCustomData(roleId);
                    }
                    if (null != dbRoleInfo.roleCustomData)
                    {
                        roleCustomData.customDataList = dbRoleInfo.roleCustomData.customDataList;
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteException(ex.ToString());
            }
            client.sendCmd <RoleCustomData>(nID, roleCustomData);
        }
Example #21
0
        private void RecvZhanMengHongBao(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            int ret = 0;

            try
            {
                HongBaoRecvData args = DataHelper.BytesToObject <HongBaoRecvData>(cmdParams, 0, count);
                if (args != null)
                {
                    using (MyDbConnection3 conn = new MyDbConnection3(false))
                    {
                        string cmdText = string.Format("replace into `t_hongbao_recv` (`hongbaoid`, `rid`, `bhid`, `zuanshi`, `recvtime`, `rname`) values('{0}','{1}','{2}','{3}','{4}','{5}');", new object[]
                        {
                            args.HongBaoID,
                            args.RoleId,
                            args.BhId,
                            args.ZuanShi,
                            args.RecvTime,
                            args.RoleName
                        });
                        ret = conn.ExecuteSql(cmdText, new MySQLParameter[0]);
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteException(ex.ToString());
            }
            client.sendCmd <int>(nID, ret);
        }
Example #22
0
        private void getBoCaiOpenList(GameServerClient client, int nID, string cmdData)
        {
            GetOpenList msgData = new GetOpenList();

            msgData.Flag = false;
            try
            {
                string[] files = cmdData.Split(new char[]
                {
                    ','
                });
                int  type        = Convert.ToInt32(files[1]);
                long DataPeriods = Convert.ToInt64(files[1]);
                msgData.MaxDataPeriods = BoCaiDBOperator.GetMaxData(type);
                BoCaiDBOperator.SelectOpenLottery(type, out msgData.ItemList);
                if (msgData.MaxDataPeriods >= 0L && null != msgData.ItemList)
                {
                    msgData.Flag = true;
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true);
            }
            client.sendCmd <GetOpenList>(nID, msgData);
        }
Example #23
0
 public void processCmd(GameServerClient client, int nID, byte[] cmdParams, int count)
 {
     if (nID == 14014)
     {
         this.HandleLoadPkLog(client, nID, cmdParams, count);
     }
     else if (nID == 14013)
     {
         this.HandleLoadSupportLog(client, nID, cmdParams, count);
     }
     else if (nID == 14015)
     {
         this.HandleLoadSupportFlag(client, nID, cmdParams, count);
     }
     else if (nID == 14012)
     {
         this.HandleSavePkLog(client, nID, cmdParams, count);
     }
     else if (nID == 14011)
     {
         this.HandleSaveSupportLog(client, nID, cmdParams, count);
     }
     else if (nID == 14016)
     {
         this.HandleLoadWaitAwardYaZhu(client, nID, cmdParams, count);
     }
     else if (nID == 14017)
     {
         this.HandleSetYaZhuAward(client, nID, cmdParams, count);
     }
 }
        public void processCmd(GameServerClient client, byte[] cmdParams, int count)
        {
            string cmd = new UTF8Encoding().GetString(cmdParams, 0, count);

            string[] param = cmd.Split(':');

            ZhanMengShiJianData data = new ZhanMengShiJianData();

            data.BHID        = Convert.ToInt32(param[0]);
            data.RoleName    = Convert.ToString(param[1]);
            data.ShiJianType = Convert.ToInt32(param[2]);
            data.SubValue1   = Convert.ToInt32(param[3]);
            data.SubValue2   = Convert.ToInt32(param[4]);
            data.SubValue3   = Convert.ToInt32(param[5]);
            data.CreateTime  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            //需要特殊处理的战盟事件类型: 职务改变
            if (data.ShiJianType == ZhanMengShiJianConstants.ChangeZhiWu)
            {
                string otherRoleName;
                string otherUserID;
                Global.GetRoleNameAndUserID(DBManager.getInstance(), data.SubValue3, out otherRoleName, out otherUserID);
                data.RoleName = otherRoleName;
            }

            ZhanMengShiJianManager.getInstance().onAddZhanMengShiJian(data);

            byte[] arrSendData = DataHelper.ObjectToBytes <string>(string.Format("{0}", 1));
            client.sendCmd((int)TCPGameServerCmds.CMD_DB_ADD_ZHANMENGSHIJIAN, arrSendData);
        }
        public void processCmd(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            int         roleId = DataHelper.BytesToObject <int>(cmdParams, 0, count);
            WanMotaInfo data   = WanMoTaManager.getInstance().getWanMoTaData(roleId);

            client.sendCmd <WanMotaInfo>(10159, data);
        }
Example #26
0
        public void processCmd(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            string cmdData = null;

            try
            {
                cmdData = new UTF8Encoding().GetString(cmdParams, 0, count);
            }
            catch (Exception)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("解析指令字符串错误, CMD={0}", (TCPGameServerCmds)nID), null, true);
                client.sendCmd(30767, "0");
                return;
            }
            List <BaiTanLogItemData> list = new List <BaiTanLogItemData>();

            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);
                client.sendCmd <List <BaiTanLogItemData> >(30767, list);
            }
            else
            {
                int rid       = Convert.ToInt32(fields[0]);
                int pageIndex = Convert.ToInt32(fields[1]);
                client.sendCmd <List <BaiTanLogItemData> >(603, BaiTanManager.getInstance().getDetailByPageIndex(rid, pageIndex));
            }
        }
Example #27
0
 private void CheckRoleZuoQiData(GameServerClient client, int nID, byte[] cmdParams, int count)
 {
     try
     {
         string     cmdData    = new UTF8Encoding().GetString(cmdParams, 0, count);
         int        roleID     = Convert.ToInt32(cmdData);
         DBRoleInfo dbRoleInfo = DBManager.getInstance().FindDBRoleInfo(ref roleID);
         if (null == dbRoleInfo)
         {
             LogManager.WriteLog(LogTypes.Error, string.Format("发起请求的角色不存在,CMD={0}, RoleID={1}", (TCPGameServerCmds)nID, roleID), null, true);
             client.sendCmd(30767, "0");
         }
         else
         {
             using (MyDbConnection3 conn = new MyDbConnection3(false))
             {
                 string cmdText = string.Format("update t_zuoqi set isnew=0 where rid={0}", roleID);
                 conn.ExecuteNonQuery(cmdText, 0);
             }
             foreach (MountData item in dbRoleInfo.MountList)
             {
                 item.IsNew = false;
             }
             client.sendCmd <int>(nID, 1);
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteException(ex.Message);
         client.sendCmd <int>(nID, -8);
     }
 }
        public void processCmd(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            int  roleId = DataHelper.BytesToObject <int>(cmdParams, 0, count);
            bool result = JingJiChangManager.getInstance().removeCD(roleId);

            client.sendCmd <bool>(10147, result);
        }
Example #29
0
        private static void Test()
        {
            int threshold = 400 * 1000 * 1000;

            while (true)
            {
                var           gsc     = new GameServerClient();
                TrainResponse problem = gsc.Train(TrainProblemType.Any, 15);
                Console.Out.WriteLine("==== TrainProblem: {0}", problem);

                Task <int> countTask = Task.Run(() =>
                {
                    IEnumerable <byte[]> trees = new BinaryBruteForcer(problem.operators).Enumerate(problem.size - 1);
                    return(trees.TakeWhile((t, i) => i < threshold).Count());
                });
                Stopwatch sw     = Stopwatch.StartNew();
                string    answer = ConcurrentWithoutShitAlphaProtocol.PostSolution(problem.id, problem.size,
                                                                                   problem.operators);
                sw.Stop();
                Console.Out.WriteLine("==== Solved, waiting for TreeSize...");
                countTask.Wait();
                Console.Out.WriteLine("==== SolvedIn: {0} ms, Answer: {1}, TreeSize: {2}", sw.ElapsedMilliseconds,
                                      answer,
                                      countTask.Result);
            }
        }
Example #30
0
        public void processCmd(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            switch (nID)
            {
            case 13124:
                this.OlympicsShopList(client, nID, cmdParams, count);
                break;

            case 13125:
                this.OlympicsShopUpdate(client, nID, cmdParams, count);
                break;

            case 13126:
                this.OlympicsGuess(client, nID, cmdParams, count);
                break;

            case 13127:
                this.OlympicsGuessList(client, nID, cmdParams, count);
                break;

            case 13128:
                this.OlympicsGuessUpdate(client, nID, cmdParams, count);
                break;
            }
        }