You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
2.7 KiB
105 lines
2.7 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
using Sog;
|
|
using ProtoCSStruct;
|
|
|
|
namespace World
|
|
{
|
|
public static class RankUtils
|
|
{
|
|
public static bool IsLoadRankDataFromDbSuccess()
|
|
{
|
|
WorldRankData rankData = WorldServerUtils.GetWorldRankData();
|
|
|
|
return rankData.IsLoadDbDataSuccess;
|
|
}
|
|
|
|
public static bool CheckLoadAllRankDataFromDbSuccess()
|
|
{
|
|
WorldRankData rankData = WorldServerUtils.GetWorldRankData();
|
|
|
|
foreach (var rankDesc in RankConfigDescMgr.Instance.ItemTable.Values)
|
|
{
|
|
WorldRankDataOne rankOne = GetWorldRankDataOne(rankDesc.rankId);
|
|
if (rankOne == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if(rankOne.CurRecord == null || rankOne.LastRecord == null)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public static WorldRankDataOne GetCreateWorldRankDataOne(int rankId)
|
|
{
|
|
WorldRankData rankData = WorldServerUtils.GetWorldRankData();
|
|
|
|
WorldRankDataOne oneRank = null;
|
|
|
|
if (!rankData.AllRank.ContainsKey(rankId))
|
|
{
|
|
oneRank = new WorldRankDataOne();
|
|
rankData.AllRank.Add(rankId, oneRank);
|
|
}
|
|
else
|
|
{
|
|
oneRank = rankData.AllRank[rankId];
|
|
}
|
|
|
|
return oneRank;
|
|
}
|
|
|
|
public static WorldRankDataOne GetWorldRankDataOne(int rankId)
|
|
{
|
|
WorldRankData rankData = WorldServerUtils.GetWorldRankData();
|
|
|
|
if (!rankData.AllRank.ContainsKey(rankId))
|
|
{
|
|
return null;
|
|
}
|
|
else
|
|
{
|
|
return rankData.AllRank[rankId];
|
|
}
|
|
}
|
|
|
|
public static bool IsAllDataSave()
|
|
{
|
|
//没加载成功,可以退出
|
|
if(IsLoadRankDataFromDbSuccess() == false)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
WorldRankData rankData = WorldServerUtils.GetWorldRankData();
|
|
|
|
foreach (var rankItem in rankData.AllRank.Values)
|
|
{
|
|
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public static long GetRoleTotalStatData(DBRoleData roleData, int id)
|
|
{
|
|
for(int i =0;i<roleData.StatData.Total.Count;i++)
|
|
{
|
|
if(roleData.StatData.Total[i].Id == id)
|
|
{
|
|
return roleData.StatData.Total[i].Value;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
|