moved dispatch cn thing to it's own class

This commit is contained in:
AlessandroCH
2025-05-13 15:12:40 +02:00
parent 2e2469cf00
commit 18414087f3
5 changed files with 145 additions and 54 deletions

View File

@@ -2,9 +2,29 @@
{ {
public static class GameConstants public static class GameConstants
{ {
//TODO, have to check if this is really userful for support different platform or if android version doesn't need the GAME_VERSION_ASSET_URL (probably not?)
//So, in case is useful only if the android build it's different than 0.5.28
public static List<GameVersionConst> GAME_VERSIONS = new()
{
new GameVersionConst("0.5.28"), //Windows CBT2
new GameVersionConst("x.x.xx"), //Android CBT2
};
public static string GAME_VERSION = "0.5.28"; //CBT 2 public static string GAME_VERSION = "0.5.28"; //CBT 2
public static string
public static string GAME_VERSION_ASSET_URL = "https://beyond.hg-cdn.com/uXUuLlNbIYmMMTlN/0.5/update/6/1/Windows/0.5.28_U1mgxrslUitdn3hb/files";//CBT 2 public static string GAME_VERSION_ASSET_URL = "https://beyond.hg-cdn.com/uXUuLlNbIYmMMTlN/0.5/update/6/1/Windows/0.5.28_U1mgxrslUitdn3hb/files";//CBT 2
public static int MAX_TEAMS_NUMBER = 5; //Not used yet public static int MAX_TEAMS_NUMBER = 5; //Not used yet
public static (long, string) SERVER_UID = (99, "99"); //Not used yet, no friend chat in current Beta public static (long, string) SERVER_UID = (99, "99"); //Not used yet, no friend chat in current Beta
} }
public class GameVersionConst
{
public string GAME_VERSION = "0.5.28";
public string GAME_VERSION_ASSET_URL = "https://beyond.hg-cdn.com/uXUuLlNbIYmMMTlN/0.5/update/6/1/Windows/0.5.28_U1mgxrslUitdn3hb/files";//CBT 2
public GameVersionConst() { }
public GameVersionConst(string version)
{
this.GAME_VERSION = version;
}
}
} }

View File

@@ -97,17 +97,7 @@ namespace Campofinale.Http
await ctx.Response.SendAsync(resp); await ctx.Response.SendAsync(resp);
} }
[StaticRoute(HttpServerLite.HttpMethod.GET, "/api/remote_config/get_remote_config/3/prod-cbt/default/default/network_config")]
public static async Task network_config_cn(HttpContext ctx)
{
string resp = "{\"asset\":\"https://beyond.hg-cdn.com/asset/\",\"hgage\":\"\",\"sdkenv\":\"2\",\"u8root\":\"https://u8.gryphline.com/u8\",\"appcode\":4,\"channel\":\"prod\",\"netlogid\":\"GFz8RRMDN45w\",\"gameclose\":false,\"netlogurl\":\"http://native-log-collect.gryphline.com:32000/\",\"accounturl\":\"https://binding-api-account-prod.gryphline.com\",\"launcherurl\":\"https://launcher.gryphline.com\"}";
ctx.Response.StatusCode = 200;
ctx.Response.ContentLength = resp.Length;
ctx.Response.ContentType = "application/json";
await ctx.Response.SendAsync(resp);
}
[StaticRoute(HttpServerLite.HttpMethod.GET, "/api/remote_config/get_remote_config/1003/prod-cbt/default/Windows/game_config")] [StaticRoute(HttpServerLite.HttpMethod.GET, "/api/remote_config/get_remote_config/1003/prod-cbt/default/Windows/game_config")]
public static async Task game_config(HttpContext ctx) public static async Task game_config(HttpContext ctx)
{ {
@@ -119,17 +109,7 @@ namespace Campofinale.Http
await ctx.Response.SendAsync(resp); await ctx.Response.SendAsync(resp);
} }
[StaticRoute(HttpServerLite.HttpMethod.GET, "/api/remote_config/get_remote_config/3/prod-cbt/default/Windows/game_config")]
public static async Task game_config_cn(HttpContext ctx)
{
string resp = "{\"mockLogin\": false, \"selectSrv\": false, \"enableHotUpdate\": false, \"enableEntitySpawnLog\": false}";
ctx.Response.StatusCode = 200;
ctx.Response.ContentLength = resp.Length;
ctx.Response.ContentType = "application/json";
await ctx.Response.SendAsync(resp);
}
[StaticRoute(HttpServerLite.HttpMethod.GET, "/api/gameBulletin/version")] [StaticRoute(HttpServerLite.HttpMethod.GET, "/api/gameBulletin/version")]
public static async Task Version(HttpContext ctx) public static async Task Version(HttpContext ctx)
{ {
@@ -166,35 +146,8 @@ namespace Campofinale.Http
public string password; public string password;
} }
[StaticRoute(HttpServerLite.HttpMethod.GET, "/api/remote_config/get_remote_config/3/prod-cbt/default/Windows/res_version")]
public static async Task cn_res_version(HttpContext ctx)
{
string resp = "{\"version\": \"2089329-32\", \"kickFlag\": true}";
ctx.Response.StatusCode = 200;
//ctx.Response.ContentLength = resp.Length;
ctx.Response.ContentType = "application/json";
await ctx.Response.SendAsync(resp);
}
[StaticRoute(HttpServerLite.HttpMethod.GET, "/api/remote_config/get_remote_config/3/prod-cbt/default/default/server_config_China")]
public static async Task server_config_China(HttpContext ctx)
{
string requestBody = ctx.Request.DataAsString;
Console.WriteLine(requestBody);
string resp = "{\"addr\": \"" + Server.config.gameServer.accessAddress + "\", \"port\": " + Server.config.gameServer.accessPort + "}";
ctx.Response.StatusCode = 200;
ctx.Response.ContentType = "application/json";
await ctx.Response.SendAsync(resp);
}
[StaticRoute(HttpServerLite.HttpMethod.GET, "/api/remote_config/get_remote_config/1003/prod-cbt/default/default/server_config_EUAndUS")] [StaticRoute(HttpServerLite.HttpMethod.GET, "/api/remote_config/get_remote_config/1003/prod-cbt/default/default/server_config_EUAndUS")]
public static async Task server_config_EUAndUS(HttpContext ctx) public static async Task server_config_EUAndUS(HttpContext ctx)
{ {

View File

@@ -0,0 +1,91 @@
using HttpServerLite;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Campofinale.Http
{
internal class DispatchCN
{
//SERVER
[StaticRoute(HttpServerLite.HttpMethod.GET, "/api/remote_config/get_remote_config/3/prod-cbt/default/default/server_config_China")]
public static async Task server_config_China(HttpContext ctx)
{
string requestBody = ctx.Request.DataAsString;
Console.WriteLine(requestBody);
string resp = "{\"addr\": \"" + Server.config.gameServer.accessAddress + "\", \"port\": " + Server.config.gameServer.accessPort + "}";
ctx.Response.StatusCode = 200;
ctx.Response.ContentType = "application/json";
await ctx.Response.SendAsync(resp);
}
//DEFAULT
[StaticRoute(HttpServerLite.HttpMethod.GET, "/api/remote_config/get_remote_config/3/prod-cbt/default/default/network_config")]
public static async Task network_config_cn(HttpContext ctx)
{
string resp = "{\"asset\":\"https://beyond.hg-cdn.com/asset/\",\"hgage\":\"\",\"sdkenv\":\"2\",\"u8root\":\"https://u8.gryphline.com/u8\",\"appcode\":4,\"channel\":\"prod\",\"netlogid\":\"GFz8RRMDN45w\",\"gameclose\":false,\"netlogurl\":\"http://native-log-collect.gryphline.com:32000/\",\"accounturl\":\"https://binding-api-account-prod.gryphline.com\",\"launcherurl\":\"https://launcher.gryphline.com\"}";
ctx.Response.StatusCode = 200;
ctx.Response.ContentLength = resp.Length;
ctx.Response.ContentType = "application/json";
await ctx.Response.SendAsync(resp);
}
//WINDOWS
[StaticRoute(HttpServerLite.HttpMethod.GET, "/api/remote_config/get_remote_config/3/prod-cbt/default/Windows/res_version")]
public static async Task cn_res_version(HttpContext ctx)
{
string resp = "{\"version\": \"2089329-32\", \"kickFlag\": true}";
ctx.Response.StatusCode = 200;
//ctx.Response.ContentLength = resp.Length;
ctx.Response.ContentType = "application/json";
await ctx.Response.SendAsync(resp);
}
[StaticRoute(HttpServerLite.HttpMethod.GET, "/api/remote_config/get_remote_config/3/prod-cbt/default/Windows/game_config")]
public static async Task game_config_cn_windows(HttpContext ctx)
{
string resp = "{\"mockLogin\": false, \"selectSrv\": false, \"enableHotUpdate\": true, \"enableEntitySpawnLog\": false}";
ctx.Response.StatusCode = 200;
ctx.Response.ContentLength = resp.Length;
ctx.Response.ContentType = "application/json";
await ctx.Response.SendAsync(resp);
}
//ANDROID
[StaticRoute(HttpServerLite.HttpMethod.GET, "/api/remote_config/get_remote_config/3/prod-cbt/default/Android/res_version")]
public static async Task cn_android_res_version(HttpContext ctx)
{
string resp = "{\"version\": \"2332867-572\", \"kickFlag\": true}";
ctx.Response.StatusCode = 200;
//ctx.Response.ContentLength = resp.Length;
ctx.Response.ContentType = "application/json";
await ctx.Response.SendAsync(resp);
}
[StaticRoute(HttpServerLite.HttpMethod.GET, "/api/remote_config/get_remote_config/3/prod-cbt/default/Android/game_config")]
public static async Task game_config_cn_android(HttpContext ctx)
{
string resp = "{\"mockLogin\": false, \"selectSrv\": false, \"enableHotUpdate\": true, \"enableEntitySpawnLog\": false}";
ctx.Response.StatusCode = 200;
ctx.Response.ContentLength = resp.Length;
ctx.Response.ContentType = "application/json";
await ctx.Response.SendAsync(resp);
}
}
}

View File

@@ -186,15 +186,38 @@ namespace Campofinale.Packets.Cs
ScSyncAllMission m = Newtonsoft.Json.JsonConvert.DeserializeObject<ScSyncAllMission>(json1); ScSyncAllMission m = Newtonsoft.Json.JsonConvert.DeserializeObject<ScSyncAllMission>(json1);
m.TrackMissionId = ""; m.TrackMissionId = "";
session.Send(ScMsgId.ScSyncAllMission, m); session.Send(ScMsgId.ScSyncAllMission, m);
/*session.Send(ScMsgId.ScSyncAllMission, new ScSyncAllMission() /* session.Send(ScMsgId.ScSyncAllMission, new ScSyncAllMission()
{ {
NewMissionTags =
{
new NewMissionTag()
{
MissionId="e0m0",
QuestId="e0m0_q#1",
}
},
Missions = Missions =
{ {
{"e0m0", new Mission() {"e0m0", new Mission()
{ {
MissionId="e0m0", MissionId="e0m0",
MissionState=(int)MissionState.Processing, MissionState=(int)MissionState.Processing,
SucceedId=-1,
Properties =
{
{1,new DynamicParameter()
{
RealType=1,
ValueType=1,
ValueBoolList =
{
true
}
} }
}
} } } }
}, },
TrackMissionId = "e0m0", TrackMissionId = "e0m0",
@@ -209,8 +232,9 @@ namespace Campofinale.Packets.Cs
{ {
new QuestObjective() new QuestObjective()
{ {
ConditionId="", ConditionId="f6415b84",
IsComplete=false
} }
} }
} } } }

View File

@@ -25,7 +25,10 @@ namespace Campofinale.Packets.Sc
}, },
}; };
client.chars.ForEach(c => proto.CharInfo.Add(c.ToProto())); client.chars.ForEach(c =>
{
proto.CharInfo.Add(c.ToProto());
});
client.teams.ForEach(c => client.teams.ForEach(c =>
{ {
proto.TeamInfo.Add(new CharTeamInfo() proto.TeamInfo.Add(new CharTeamInfo()