Half the handlers were still answering with a bare 0 or -1 even though the whole retcode table is generated. Values on the wire are unchanged, they just read properly now. Same for the item hint reasons. ActionReasonType is a generated enum and we were redeclaring six of its members as private consts in four different files.
55 lines
1.8 KiB
C#
55 lines
1.8 KiB
C#
using Google.Protobuf;
|
|
using Yuanshen.Protocol;
|
|
|
|
namespace Yuanshen.SDK.Handlers;
|
|
|
|
public static class RegionHandler
|
|
{
|
|
private const string GATESERVER_IP = "127.0.0.1";
|
|
private const int GATESERVER_PORT = 22102;
|
|
private const string CLIENT_CUSTOM_CONFIG = "{\"sdkenv\":\"2\",\"checkdevice\":\"false\",\"loadPatch\":\"false\",\"showexception\":\"false\",\"regionConfig\":\"pm|fk|add\",\"downloadMode\":\"0\"}";
|
|
|
|
private static readonly string s_regionList = BuildRegionList();
|
|
private static readonly string s_curRegion = BuildCurRegion();
|
|
|
|
public static IResult OnQueryRegionList() => TypedResults.Text(s_regionList, "text/plain");
|
|
public static IResult OnQueryCurRegion() => TypedResults.Text(s_curRegion, "text/plain");
|
|
|
|
private static string BuildRegionList()
|
|
{
|
|
QueryRegionListHttpRsp rsp = new()
|
|
{
|
|
Retcode = Retcode.RET_SUCC,
|
|
EnableLoginPc = true,
|
|
ClientCustomConfigEncrypted = ByteString.CopyFromUtf8(CLIENT_CUSTOM_CONFIG),
|
|
Servers =
|
|
{
|
|
new RegionSimpleInfo
|
|
{
|
|
Name = "os_yuanshen",
|
|
Title = "Yuanshen",
|
|
Type = "DEV_PUBLIC",
|
|
DispatchUrl = $"http://{GATESERVER_IP}:8899/query_cur_region"
|
|
}
|
|
}
|
|
};
|
|
|
|
return Convert.ToBase64String(rsp.ToByteArray());
|
|
}
|
|
|
|
private static string BuildCurRegion()
|
|
{
|
|
QueryCurrRegionHttpRsp rsp = new()
|
|
{
|
|
Retcode = Retcode.RET_SUCC,
|
|
RegionInfo = new RegionInfo
|
|
{
|
|
Ip = GATESERVER_IP,
|
|
Port = GATESERVER_PORT
|
|
},
|
|
RegionCustomConfigEncrypted = ByteString.CopyFromUtf8(CLIENT_CUSTOM_CONFIG)
|
|
};
|
|
|
|
return Convert.ToBase64String(rsp.ToByteArray());
|
|
}
|
|
}
|