예제 #1
0
        public static TCPProcessCmdResults ProcessGetNewzoneActiveAward(DBManager dbMgr, 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);
            }
            TCPProcessCmdResults ret = TCPProcessCmdResults.RESULT_FAILED;

            try
            {
                string[] fields = cmdData.Split(new char[]
                {
                    ':'
                });
                if (fields.Length != 5)
                {
                    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]);
                string   fromDate      = fields[1].Replace('$', ':');
                string   toDate        = fields[2].Replace('$', ':');
                int      activetype    = Global.SafeConvertToInt32(fields[4], 10);
                string[] minYuanBaoArr = fields[3].Split(new char[]
                {
                    '_'
                });
                List <int> minGateValueList = new List <int>();
                foreach (string item in minYuanBaoArr)
                {
                    minGateValueList.Add(Global.SafeConvertToInt32(item, 10));
                }
                switch (activetype)
                {
                case 34:
                    ret = NewZoneActiveMgr.GetRechargeKingAward(dbMgr, pool, nID, roleID, activetype, fromDate, toDate, minGateValueList, out tcpOutPacket);
                    break;

                case 35:
                    ret = NewZoneActiveMgr.GetConsumeKingAward(dbMgr, pool, nID, roleID, activetype, fromDate, toDate, minGateValueList, out tcpOutPacket);
                    break;

                case 36:
                    ret = NewZoneActiveMgr.GetBossKillAward(dbMgr, pool, nID, roleID, activetype, fromDate, toDate, minGateValueList, out tcpOutPacket);
                    break;

                case 37:
                    ret = NewZoneActiveMgr.GetNewFanliAward(dbMgr, pool, nID, roleID, activetype, fromDate, toDate, minGateValueList, out tcpOutPacket);
                    break;
                }
            }
            catch (Exception ex)
            {
            }
            return(ret);
        }