namespace Application.Domain; public class GameTool { /// /// 获取等级基础属性 /// /// /// public static unit_user_attr GetAttrData(int lev) { unit_user_attr data = new unit_user_attr(); data.lev = lev; data.minAtk = lev + 2; data.maxAtk = lev + Convert.ToInt32(lev * 0.05) + 4; data.defense = lev; data.agility = lev; data.upBlood = ((lev - 1) * 5) + 80; data.upMorale = 100 + (lev / 5) * 10; data.levUpdate = TimeExtend.GetTimeStampSeconds; return data; } /// /// 获取等级升级经验 /// /// /// public static long GetUserUpExp(int lev) { long result = 50 * ((lev * lev * lev) + (5 * lev)) - 80; return result; } public static bool AreaVerify(int area, string areas) { List onArea = new List() { "0", area.ToString() }; return onArea.Any(it => areas.Contains(it)); } public static string GetCurrencyName(string payCode) { string result = ""; switch (payCode) { case "gold": result = "金元"; break; case "cowry": result = "金贝"; break; case "copper": result = "铜贝"; break; case "teach": result = "师德"; break; case "renown": result = "声望"; break; } return result; } public static async Task GetPropWeight(string goodsType, string parameter) { int weight = 0; if (goodsType.Equals(nameof(GameEnum.PropCode.Goods))) { var goodsService = App.GetService(); var info = await goodsService.GetGoodsInfo(Convert.ToInt32(parameter)); if (info != null) { weight = (int)info.weight; } } else if (goodsType.Equals(nameof(GameEnum.PropCode.Equ))) { var equService = App.GetService(); var info = await equService.GetEquInfo(Convert.ToInt32(parameter)); if (info != null) { weight = (int)info.weight; } } return weight; } }