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.
113 lines
2.9 KiB
113 lines
2.9 KiB
1 month ago
|
using ProtoCSStruct;
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Threading.Tasks;
|
||
|
using Sog;
|
||
|
|
||
|
namespace Game
|
||
|
{
|
||
|
public static class PlayerDataExtension
|
||
|
{
|
||
|
public static int GetLevel(this PlayerOnGame player)
|
||
|
{
|
||
|
return player.RoleData.Knight.DbHero.Level;
|
||
|
}
|
||
|
|
||
|
public static long GetGold(this PlayerOnGame player)
|
||
|
{
|
||
|
var idx = UnifyOp.GetIndexById(player, ItemId.Gold);
|
||
|
return idx < 0 ? 0 : player.RoleData.PandoraBag.ItemList[idx].Count;
|
||
|
}
|
||
|
|
||
|
public static long GetDiamond(this PlayerOnGame player)
|
||
|
{
|
||
|
var idx = UnifyOp.GetIndexById(player, ItemId.Diamond);
|
||
|
return idx < 0 ? 0 : player.RoleData.PandoraBag.ItemList[idx].Count;
|
||
|
}
|
||
|
|
||
|
public static int GetExp(this PlayerOnGame player)
|
||
|
{
|
||
|
return player.RoleData.Knight.DbHero.Exp;
|
||
|
}
|
||
|
|
||
|
public static int GetHeroExpPool(this PlayerOnGame player)
|
||
|
{
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
public static int GetVipLevel(this PlayerOnGame player)
|
||
|
{
|
||
|
return player.RoleBase.VipLevel;
|
||
|
}
|
||
|
|
||
|
public static string GetNick(this PlayerOnGame player)
|
||
|
{
|
||
|
return player.RoleBase.Nick.GetString();
|
||
|
}
|
||
|
|
||
|
public static int GetGender(this PlayerOnGame player)
|
||
|
{
|
||
|
return player.RoleBase.Gender;
|
||
|
}
|
||
|
|
||
|
public static int GetIconFrame(this PlayerOnGame player)
|
||
|
{
|
||
|
return player.RoleData.IconFrameData.IconFrameId;
|
||
|
}
|
||
|
|
||
|
public static string GetIcon(this PlayerOnGame player)
|
||
|
{
|
||
|
return player.RoleBase.Icon.GetString();
|
||
|
}
|
||
|
|
||
|
public static int GetClientVipLevel(this PlayerOnGame player)
|
||
|
{
|
||
|
int trueLevel = player.RoleBase.VipLevel;
|
||
|
return trueLevel;
|
||
|
}
|
||
|
|
||
|
public static int GetVipExp(this PlayerOnGame player)
|
||
|
{
|
||
|
return player.RoleBase.VipExp;
|
||
|
}
|
||
|
|
||
|
|
||
|
//检查货币的还是放在这里
|
||
|
public static CSErrCode CheckMoneyNum(this PlayerOnGame player ,int Type, long CheckNum)
|
||
|
{
|
||
|
if (Type == (int)CurrencyType.Chip)
|
||
|
{
|
||
|
if (player.RoleBase.Chip < CheckNum)
|
||
|
{
|
||
|
return CSErrCode.CostChipNotEnough;
|
||
|
}
|
||
|
}
|
||
|
else if (Type == (int)CurrencyType.Diamond)
|
||
|
{
|
||
|
if (player.GetDiamond() < CheckNum)
|
||
|
{
|
||
|
return CSErrCode.CostDiamondNotEnough;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return CSErrCode.SysFailure;
|
||
|
}
|
||
|
|
||
|
return CSErrCode.None;
|
||
|
}
|
||
|
|
||
|
public static int GetBigReamlId(this PlayerOnGame player)
|
||
|
{
|
||
|
var configRealm = GameServerUtils.GetGameServerData().m_configRealm;
|
||
|
var realmBrief = configRealm.FirstOrDefault(r => r.realmId == player.RealmID);
|
||
|
if(realmBrief != null)
|
||
|
{
|
||
|
return realmBrief.bigRealmId;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
}
|
||
|
}
|