Пример #1
0
 private bool LoadKuaFuLueDuoBHData(Dictionary <int, KuaFuData <KuaFuLueDuoBHData> > KuaFuLueDuoBHDataDict, int minSeason)
 {
     try
     {
         long   sAge   = TimeUtil.AgeByNow();
         string strSql = string.Format("SELECT * FROM t_kfld_banghui where `season`>={0}", minSeason);
         using (MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false))
         {
             while (sdr != null && sdr.Read())
             {
                 KuaFuData <KuaFuLueDuoBHData> bhData = new KuaFuData <KuaFuLueDuoBHData>();
                 bhData.V.season      = Convert.ToInt32(sdr["season"]);
                 bhData.V.bhid        = Convert.ToInt32(sdr["bhid"]);
                 bhData.V.bhname      = (sdr["bhname"] as string);
                 bhData.V.zoneid      = Convert.ToInt32(sdr["zoneid"]);
                 bhData.V.sum_ziyuan  = Convert.ToInt32(sdr["sum_ziyuan"]);
                 bhData.V.last_ziyuan = Convert.ToInt32(sdr["last"]);
                 bhData.Age           = sAge;
                 KuaFuLueDuoBHDataDict[bhData.V.bhid] = bhData;
                 int zoneid = bhData.V.zoneid;
                 if (bhData.V.sum_ziyuan > 0 && zoneid > 0 && zoneid < this.ZoneID2ServerIDs.Length)
                 {
                     KuaFuLueDuoServerInfo data;
                     if (this.ServerInfoDict.TryGetValue(this.ZoneID2ServerIDs[zoneid], out data))
                     {
                         string name = KuaFuServerManager.FormatName(bhData.V.bhname, bhData.V.zoneid);
                         data.MingXingList.Add(new KuaFuLueDuoRankInfo
                         {
                             Key    = bhData.V.bhid,
                             Param1 = name,
                             Value  = bhData.V.sum_ziyuan
                         });
                     }
                 }
             }
         }
         foreach (KuaFuLueDuoServerInfo data in this.ServerInfoDict.Values)
         {
             string mingxing = KuaFuLueDuoUtils.RankList2MingXingStr(data.MingXingList, 2);
             if (mingxing != data.MingXingZhanMengList)
             {
                 data.MingXingZhanMengList = mingxing;
                 string sql = string.Format("update t_kfld_server set `mingxing`='{1}' where `serverid`={0}", data.ServerId, mingxing);
                 this.ExecuteSqlNoQuery(sql);
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteExceptionUseCache(ex.ToString());
         return(false);
     }
     return(true);
 }
Пример #2
0
        private bool LoadBHMatchPKInfoList(BangHuiMatchType type, KuaFuData <List <BangHuiMatchPKInfo> > BHMatchPKInfoList_Gold)
        {
            bool result;

            if (null == BHMatchPKInfoList_Gold)
            {
                result = false;
            }
            else
            {
                BHMatchPKInfoList_Gold.V.Clear();
                try
                {
                    KuaFuData <BHMatchBHData> bhData = null;
                    string          strSql           = string.Format("SELECT * FROM t_banghui_match_pk_log WHERE `type`={0} ORDER BY `season` DESC, `round` DESC LIMIT {1}", (int)type, 80);
                    MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false);
                    while (sdr != null && sdr.Read())
                    {
                        BangHuiMatchPKInfo pkInfo = new BangHuiMatchPKInfo();
                        pkInfo.type    = Convert.ToByte(sdr["type"]);
                        pkInfo.season  = Convert.ToInt32(sdr["season"]);
                        pkInfo.round   = Convert.ToByte(sdr["round"]);
                        pkInfo.bhid1   = Convert.ToInt32(sdr["bhid1"]);
                        pkInfo.bhid2   = Convert.ToInt32(sdr["bhid2"]);
                        pkInfo.result  = Convert.ToByte(sdr["result"]);
                        pkInfo.zoneid1 = Convert.ToInt32(sdr["zoneid1"]);
                        pkInfo.zoneid2 = Convert.ToInt32(sdr["zoneid2"]);
                        if (this.BHMatchBHDataDict_Gold.TryGetValue(pkInfo.bhid1, out bhData))
                        {
                            pkInfo.bhname1 = KuaFuServerManager.FormatName(bhData.V.zoneid_bh, bhData.V.bhname);
                        }
                        if (this.BHMatchBHDataDict_Gold.TryGetValue(pkInfo.bhid2, out bhData))
                        {
                            pkInfo.bhname2 = KuaFuServerManager.FormatName(bhData.V.zoneid_bh, bhData.V.bhname);
                        }
                        BHMatchPKInfoList_Gold.V.Add(pkInfo);
                    }
                    TimeUtil.AgeByNow(ref BHMatchPKInfoList_Gold.Age);
                    if (sdr != null)
                    {
                        sdr.Close();
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteExceptionUseCache(ex.ToString());
                    return(false);
                }
                result = true;
            }
            return(result);
        }
Пример #3
0
        public void ChangeName(int ptId, int roleId, string roleName)
        {
            try
            {
                lock (this.Mutex)
                {
                    KeyValuePair <int, int>      key = new KeyValuePair <int, int>(ptId, roleId);
                    KuaFuData <KFRebornRoleData> kfRebornRoleData = null;
                    if (this.RebornRoleDataDict.TryGetValue(key, out kfRebornRoleData))
                    {
                        kfRebornRoleData.V.RoleName = roleName;
                        TimeUtil.AgeByNow(ref kfRebornRoleData.Age);
                        this.Persistence.UpdateRebornRoleDataRoleName(kfRebornRoleData.V);
                        bool refreshRank = false;
                        foreach (KeyValuePair <int, List <KFRebornRankInfo> > kvp in this.RebornRankDict.V)
                        {
                            KFRebornRankInfo item = kvp.Value.Find((KFRebornRankInfo x) => x.PtID == ptId && x.Key == roleId);
                            if (null != item)
                            {
                                string             worldRoleID   = ConstData.FormatWorldRoleID(roleId, ptId);
                                KuaFuWorldRoleData worldRoleData = TSingleton <KuaFuWorldManager> .getInstance().LoadKuaFuWorldRoleData(roleId, ptId, worldRoleID);

                                if (null != worldRoleData)
                                {
                                    item.Param1 = KuaFuServerManager.FormatName(item.tagInfo.V.RoleName, worldRoleData.ZoneID);
                                    refreshRank = true;
                                }
                            }
                        }
                        if (refreshRank)
                        {
                            TimeUtil.AgeByNow(ref this.RebornRankDict.Age);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteException(ex.ToString());
            }
        }
Пример #4
0
 public bool LoadZorkBattleRankInfo(int rankType, List <KFZorkRankInfo> rankList)
 {
     try
     {
         string strSql = this.FormatLoadZorkBattleRankSql(rankType);
         if (string.IsNullOrEmpty(strSql))
         {
             return(false);
         }
         MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false);
         while (sdr != null && sdr.Read())
         {
             KFZorkRankInfo rankInfo = new KFZorkRankInfo();
             rankInfo.Key   = Convert.ToInt32(sdr["a"]);
             rankInfo.Value = Convert.ToInt32(sdr["b"]);
             if (rankType == 1)
             {
                 string   strParam = string.Format("SELECT zoneid,rname,rebornlev FROM `t_kf_5v5_zhandui_roles` WHERE rid={0};", rankInfo.Key);
                 object[] arr;
                 if (DbHelperMySQL.GetSingleValues(strParam, out arr) >= 0)
                 {
                     rankInfo.StrParam1 = KuaFuServerManager.FormatName(Convert.ToInt32(arr[0]), arr[1].ToString());
                     rankInfo.Param1    = Convert.ToInt32(arr[2]);
                 }
                 rankList.Add(rankInfo);
             }
         }
         if (sdr != null)
         {
             sdr.Close();
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteExceptionUseCache(ex.ToString());
         return(false);
     }
     return(true);
 }
Пример #5
0
        private bool LoadKuaFuLueDuoRankInfo(int rankType, int minSeasonID, int seasonLast, Dictionary <int, KuaFuLueDuoRankListData> KuaFuLueDuoRankInfoDict)
        {
            try
            {
                long sAge   = TimeUtil.AgeByNow();
                int  length = this.ZoneID2GroupIDs.Length;
                KuaFuLueDuoRankListData[]    rankArr = new KuaFuLueDuoRankListData[length];
                List <KuaFuLueDuoRankInfo>[] listArr = new List <KuaFuLueDuoRankInfo> [length];
                for (int i = 0; i < this.ZoneID2GroupIDs.Length; i++)
                {
                    int groupID = this.ZoneID2GroupIDs[i];
                    KuaFuLueDuoRankListData rankData;
                    if (!KuaFuLueDuoRankInfoDict.TryGetValue(groupID, out rankData))
                    {
                        rankData = new KuaFuLueDuoRankListData
                        {
                            Age = sAge
                        };
                        rankData.LastInfoDict            = new Dictionary <int, KuaFuLueDuoRankInfo>();
                        rankData.SelfInfoDict            = new Dictionary <int, KuaFuLueDuoRankInfo>();
                        KuaFuLueDuoRankInfoDict[groupID] = rankData;
                    }
                    List <KuaFuLueDuoRankInfo> rankList;
                    if (!rankData.ListDict.TryGetValue(rankType, out rankList))
                    {
                        rankList = new List <KuaFuLueDuoRankInfo>();
                        rankData.ListDict[rankType] = rankList;
                    }
                    rankArr[i] = rankData;
                    listArr[i] = rankList;
                }
                string strSql = this.FormatLoadKuaFuLueDuoRankSql(rankType, minSeasonID, seasonLast);
                if (!string.IsNullOrEmpty(strSql))
                {
                    int rank = 0;
                    using (MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false))
                    {
                        while (sdr != null && sdr.Read())
                        {
                            int zoneID = Convert.ToInt32(sdr[3]);
                            if (zoneID < length)
                            {
                                rank++;
                                KuaFuLueDuoRankListData rankData = rankArr[zoneID];
                                KuaFuLueDuoRankInfo     rankInfo = new KuaFuLueDuoRankInfo();
                                int zoneId = Convert.ToInt32(sdr[3]);
                                rankInfo.Key    = Convert.ToInt32(sdr[0]);
                                rankInfo.Value  = Convert.ToInt32(sdr[1]);
                                rankInfo.Param1 = sdr[2].ToString();
                                switch (rankType)
                                {
                                case 0:
                                    listArr[zoneID].Add(rankInfo);
                                    if (rank == 1)
                                    {
                                        rankData.LastInfoDict[0] = rankInfo;
                                    }
                                    break;

                                case 2:
                                case 4:
                                    rankInfo.Param1 = KuaFuServerManager.FormatName(rankInfo.Param1, zoneId);
                                    listArr[zoneID].Add(rankInfo);
                                    break;

                                case 3:
                                case 5:
                                    rankInfo.Param1 = KuaFuServerManager.FormatName(rankInfo.Param1, zoneId);
                                    rankData.LastInfoDict[rankType - 1] = rankInfo;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.ToString());
                return(false);
            }
            return(true);
        }
Пример #6
0
        private bool LoadBHMatchRankInfo(int rankType, int seasonCur, int seasonLast, KuaFuData <Dictionary <int, List <BangHuiMatchRankInfo> > > BHMatchRankInfoDict)
        {
            bool result;

            if (null == BHMatchRankInfoDict)
            {
                result = false;
            }
            else
            {
                List <BangHuiMatchRankInfo> rankList = null;
                if (!BHMatchRankInfoDict.V.TryGetValue(rankType, out rankList))
                {
                    rankList = (BHMatchRankInfoDict.V[rankType] = new List <BangHuiMatchRankInfo>());
                }
                else
                {
                    rankList.Clear();
                }
                try
                {
                    string strSql = this.FormatLoadBHMatchRankSql(rankType, seasonCur, seasonLast);
                    if (string.IsNullOrEmpty(strSql))
                    {
                        return(false);
                    }
                    MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false);
                    while (sdr != null && sdr.Read())
                    {
                        BangHuiMatchRankInfo rankInfo = new BangHuiMatchRankInfo();
                        rankInfo.Key   = Convert.ToInt32(sdr["a"]);
                        rankInfo.Value = Convert.ToInt32(sdr["b"]);
                        switch (rankType)
                        {
                        case 4:
                        case 6:
                        case 10:
                        case 12:
                        {
                            string   strParam = string.Format("SELECT zoneid,rname FROM t_banghui_match_roles WHERE `type`={0} AND rid={1};", 1, rankInfo.Key);
                            object[] arr;
                            if (DbHelperMySQL.GetSingleValues(strParam, out arr) >= 0)
                            {
                                rankInfo.Param1 = KuaFuServerManager.FormatName(Convert.ToInt32(arr[0]), arr[1].ToString());
                            }
                            string strParam2 = string.Format("SELECT zoneid_bh,bhname FROM t_banghui_match_bh, \r\n                                                (SELECT bhid FROM t_banghui_match_roles WHERE `type`={0} AND rid={1}) a1 WHERE t_banghui_match_bh.bhid = a1.bhid;", 1, rankInfo.Key);
                            if (DbHelperMySQL.GetSingleValues(strParam2, out arr) >= 0)
                            {
                                rankInfo.Param2 = KuaFuServerManager.FormatName(Convert.ToInt32(arr[0]), arr[1].ToString());
                            }
                            rankList.Add(rankInfo);
                            break;
                        }

                        case 5:
                        case 7:
                        case 11:
                        case 13:
                        {
                            string strParam = string.Format("SELECT zoneid,rname FROM t_banghui_match_roles WHERE `type`={0} AND rid={1};", 2, rankInfo.Key);
                            rankInfo.Param1 = Convert.ToString(DbHelperMySQL.GetSingle(strParam));
                            object[] arr;
                            if (DbHelperMySQL.GetSingleValues(strParam, out arr) >= 0)
                            {
                                rankInfo.Param1 = KuaFuServerManager.FormatName(Convert.ToInt32(arr[0]), arr[1].ToString());
                            }
                            string strParam2 = string.Format("SELECT zoneid_bh,bhname FROM t_banghui_match_bh, \r\n                                                (SELECT bhid FROM t_banghui_match_roles WHERE `type`={0} AND rid={1}) a1 WHERE t_banghui_match_bh.bhid = a1.bhid;", 2, rankInfo.Key);
                            if (DbHelperMySQL.GetSingleValues(strParam2, out arr) >= 0)
                            {
                                rankInfo.Param2 = KuaFuServerManager.FormatName(Convert.ToInt32(arr[0]), arr[1].ToString());
                            }
                            rankList.Add(rankInfo);
                            break;
                        }

                        case 8:
                        case 9:
                            goto IL_24B;

                        default:
                            goto IL_24B;
                        }
                        continue;
IL_24B:
                        KuaFuData <BHMatchBHData> bhData = null;
                        if (this.BHMatchBHDataDict_Gold.TryGetValue(rankInfo.Key, out bhData))
                        {
                            rankInfo.Param1 = KuaFuServerManager.FormatName(bhData.V.zoneid_bh, bhData.V.bhname);
                            rankInfo.Param2 = KuaFuServerManager.FormatName(bhData.V.zoneid_r, bhData.V.rname);
                            rankList.Add(rankInfo);
                        }
                        else if (this.BHMatchBHDataDict_Rookie.TryGetValue(rankInfo.Key, out bhData))
                        {
                            rankInfo.Param1 = KuaFuServerManager.FormatName(bhData.V.zoneid_bh, bhData.V.bhname);
                            rankInfo.Param2 = KuaFuServerManager.FormatName(bhData.V.zoneid_r, bhData.V.rname);
                            rankList.Add(rankInfo);
                        }
                    }
                    TimeUtil.AgeByNow(ref BHMatchRankInfoDict.Age);
                    if (sdr != null)
                    {
                        sdr.Close();
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteExceptionUseCache(ex.ToString());
                    return(false);
                }
                result = true;
            }
            return(result);
        }
Пример #7
0
        public bool LoadRebornRankInfo(int rankType, KuaFuData <Dictionary <int, List <KFRebornRankInfo> > > RebornRankDict)
        {
            bool result;

            if (null == RebornRankDict)
            {
                result = false;
            }
            else
            {
                List <KFRebornRankInfo> rankList = null;
                if (!RebornRankDict.V.TryGetValue(rankType, out rankList))
                {
                    rankList = (RebornRankDict.V[rankType] = new List <KFRebornRankInfo>());
                }
                else
                {
                    rankList.Clear();
                }
                try
                {
                    string strSql = this.FormatLoadRebornRankSql(rankType);
                    if (string.IsNullOrEmpty(strSql))
                    {
                        return(false);
                    }
                    MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false);
                    while (sdr != null && sdr.Read())
                    {
                        KFRebornRankInfo rankInfo = new KFRebornRankInfo();
                        rankInfo.Key   = Convert.ToInt32(sdr["a"]);
                        rankInfo.Value = Convert.ToInt32(sdr["b"]);
                        rankInfo.PtID  = Convert.ToInt32(sdr["c"]);
                        KuaFuData <KFRebornRoleData> kfRoleData = null;
                        if (this.RebornRoleDataDict.TryGetValue(new KeyValuePair <int, int>(rankInfo.PtID, rankInfo.Key), out kfRoleData))
                        {
                            string             worldRoleID   = ConstData.FormatWorldRoleID(rankInfo.Key, rankInfo.PtID);
                            KuaFuWorldRoleData worldRoleData = TSingleton <KuaFuWorldManager> .getInstance().LoadKuaFuWorldRoleData(rankInfo.Key, rankInfo.PtID, worldRoleID);

                            if (null != worldRoleData)
                            {
                                int KFZoneID = ConstData.ConvertToKuaFuServerID(worldRoleData.ZoneID, worldRoleData.PTID);
                                rankInfo.Param1  = KuaFuServerManager.FormatName(kfRoleData.V.RoleName, KFZoneID);
                                rankInfo.Param2  = worldRoleData.Channel;
                                rankInfo.UserID  = worldRoleData.UserID;
                                rankInfo.tagInfo = kfRoleData;
                            }
                        }
                        rankList.Add(rankInfo);
                    }
                    if (null != RebornRankDict)
                    {
                        TimeUtil.AgeByNow(ref RebornRankDict.Age);
                    }
                    if (sdr != null)
                    {
                        sdr.Close();
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteExceptionUseCache(ex.ToString());
                    return(false);
                }
                result = true;
            }
            return(result);
        }
Пример #8
0
        public bool LoadCompRankInfo(int rankType, int compType, KuaFuData <Dictionary <int, List <KFCompRankInfo> > > CompRankDict, KuaFuData <List <KFCompRankInfo> > CompRankList)
        {
            bool result;

            if (CompRankDict == null && null == CompRankList)
            {
                result = false;
            }
            else
            {
                List <KFCompRankInfo> rankList = null;
                if (null != CompRankDict)
                {
                    if (!CompRankDict.V.TryGetValue(compType, out rankList))
                    {
                        rankList = (CompRankDict.V[compType] = new List <KFCompRankInfo>());
                    }
                    else
                    {
                        rankList.Clear();
                    }
                }
                else
                {
                    rankList = CompRankList.V;
                    rankList.Clear();
                }
                try
                {
                    string strSql = this.FormatLoadCompRankSql(rankType, compType);
                    if (string.IsNullOrEmpty(strSql))
                    {
                        return(false);
                    }
                    if (rankType == 3)
                    {
                        for (int i = 1; i <= 3; i++)
                        {
                            rankList.Add(new KFCompRankInfo());
                        }
                    }
                    MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false);
                    while (sdr != null && sdr.Read())
                    {
                        KFCompRankInfo rankInfo = new KFCompRankInfo();
                        rankInfo.Key   = Convert.ToInt32(sdr["a"]);
                        rankInfo.Value = Convert.ToInt32(sdr["b"]);
                        if (rankType == 3)
                        {
                            rankList[rankInfo.Key - 1] = rankInfo;
                        }
                        else
                        {
                            KuaFuData <KFCompRoleData> kfRoleData = null;
                            if (this.CompRoleDataDict.TryGetValue(rankInfo.Key, out kfRoleData))
                            {
                                rankInfo.Param1  = KuaFuServerManager.FormatName(kfRoleData.V.RoleName, kfRoleData.V.ZoneID);
                                rankInfo.tagInfo = kfRoleData;
                            }
                            rankList.Add(rankInfo);
                        }
                    }
                    if (null != CompRankDict)
                    {
                        TimeUtil.AgeByNow(ref CompRankDict.Age);
                    }
                    if (null != CompRankList)
                    {
                        TimeUtil.AgeByNow(ref CompRankList.Age);
                    }
                    if (sdr != null)
                    {
                        sdr.Close();
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteExceptionUseCache(ex.ToString());
                    return(false);
                }
                result = true;
            }
            return(result);
        }