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.

61 lines
1.6 KiB

1 month ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Game;
using Gate;
using Sog;
namespace Name
{
public static class NameServerUtils
{
public static string GetNameTableName(int accountType, string hashName)
{
int accountTableIndex = TableIndexCalc.CalcNameTableIndex(accountType, hashName);
return "tbname_" + accountTableIndex.ToString();
}
public static string GetAccountRealmUidLinkTableName(int accountType, string accountID)
{
int accountTableIndex = TableIndexCalc.CalcAccountTableIndex(accountType, accountID);
return "tbacc_realmuid_link_" + accountTableIndex.ToString();
}
public static NameServerData GetNameServerData()
{
return ServerDataObjMgr.GetDataObj<NameServerData>(NameServiceType.NameServerData);
}
public static ProtoCSStructPacker GetProtoPacker()
{
return ProtoPackerFactory.Instance.GetProtoCSStructPacker();
}
public static StructPacketSender GetPacketSender()
{
return GetNameServerData().m_packetSender;
}
public static long GetTimeSecond()
{
return GetNameServerData().m_app.Time.GetTimeSecond();
}
public static uint GetAppID()
{
return GetNameServerData().m_app.ServerID;
}
/// <summary>
/// 获取服务器配置方法
/// </summary>
public static NameServerConfig GetServerConfig()
{
return (NameServerConfig)ServerConfigMgr.Instance.m_serverConfig;
}
}
}