Compare commits

..

1 Commits

Author SHA1 Message Date
BSRevival 97ad13f8bf Initial Commit of WebAPI and proxy. 2024-05-27 02:39:27 -07:00
131 changed files with 1129 additions and 596 deletions

13
.idea/.idea.Elisa/.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/contentModel.xml
/modules.xml
/.idea.Elisa.iml
/projectSettingsUpdater.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@ -1 +0,0 @@
namespace Elisa.Common.Data.Tables;

View File

@ -1,18 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="System.Text.Json" Version="8.0.3" />
</ItemGroup>
</Project>

View File

@ -1 +0,0 @@
namespace Elisa.Common.Messages;

View File

@ -1 +0,0 @@
namespace Elisa.Common.Messages;

View File

@ -1 +0,0 @@
namespace Elisa.Common.Messages;

View File

@ -1 +0,0 @@
namespace Elisa.Common.Messages;

View File

@ -1 +0,0 @@
namespace Elisa.Common.Models;

View File

@ -1 +0,0 @@
namespace Elisa.Common.Models;

View File

@ -1,17 +0,0 @@
using Elisa.GameServer.Commands;
using Microsoft.AspNetCore.Mvc;
namespace Elisa.Controllers;
[ApiController]
[Route("/")]
public class CommandController : ControllerBase
{
[HttpGet("command")]
public async Task<IResult> Command([FromQuery] string command)
{
CommandHandlerFactory.HandleCommand(command);
return Results.Text("Command executed");
}
}

View File

@ -1,30 +0,0 @@
using Microsoft.AspNetCore.Mvc;
namespace Elisa.GameServer.Controllers;
public class FileController : Controller
{
[HttpGet("image/imageconfig.txt", Name = "ImageConfig")]
public async Task<IResult> ImageConfig()
{
return Results.Text(System.IO.File.ReadAllText(@"Resources\image\ImageConfig.txt"));
}
[HttpGet("userProtocol_en_v005.txt", Name = "Terms Of Service")]
public async Task<IResult> TermsOfService()
{
return Results.Text(System.IO.File.ReadAllText(@"Resources\userProtocol_en_v005.txt"));
}
[HttpGet("iedsafe/Client/Android/24027/config2.xml", Name = "dl.listdl Config2")]
public async Task<IResult> config2()
{
return Results.Text(System.IO.File.ReadAllText(@"Resources\config2.xml"));
}
[HttpGet("sunborn-p1-us/HomePage.txt/r={rvalue}", Name = "HomePage.txt")]
public async Task<IResult> homepage(string rvalue)
{
return Results.Text(@"1|2|4|5|6|7|9|10|11|13");
}
}

View File

@ -1,62 +0,0 @@
using Elisa.Common.Utils;
using Microsoft.AspNetCore.Mvc;
namespace Elisa.GameServer.Controllers;
public class IndexController : Controller
{
[HttpPost("index.php", Name = "ServerList")]
public async Task<IResult> ServerList()
{
//read the serverlist
var text = System.IO.File.ReadAllText(@"Resources\serverList.xml");
return Results.Content(text, "text/html");
}
[HttpPost("index.php/1001/index/version", Name = "Version")]
public async Task<IResult> Version([FromQuery] string req_id)
{
return Results.Json(new
{
now = DateTime.Now.ToUnixSeconds(),
tomorrow_zero = Time.GetTomorrowZero(),
month_zero = Time.GetCurrentMonthZero(),
next_month_zero = Time.GetNextMonthZero(),
timezone = "PST8PDT",
data_version = GameServer.DataVersion,
client_version = GameServer.ClientVersion,
ab_version = GameServer.ABVersion,
is_kick = "0",
weekday = 1,
authentication_url = @"http://realauth.ucenter.ppgame.com/authoriz.html?appid={0}&openid={1}&accounttype=1&language=zh"
});
}
[HttpPost("index.php/1001/index/getUidEnMicaQueue", Name = "GetUidMicaQueue")]
public async Task<IResult> GetUidMicaQueue([FromQuery] string req_id)
{
return Results.Json(new
{
uid = "9303",
sign = "1f8063d3eb961af28f3fa5b90e9d3ba0",
is_username_exist = true,
real_name = 0,
authentication_url = @"http://realauth.ucenter.ppgame.com/authoriz.html?appid={0}&openid={1}&accounttype=1&language=zh",
tc_order_retry = 0
});
}
[HttpPost("index.php/1001/index/Index", Name = "Index")]
public async Task<IResult> Index([FromQuery] string req_id)
{
return Results.Json(new
{ });
}
/*
[Route("{*url}")]
public async Task<IActionResult> HandleAll(string url)
{
Log.Information("Handling unmatched request for URL: {Url}", url);
return Content($"Handled by catch-all route: {url}");
}
*/
}

View File

@ -1,18 +0,0 @@
using Microsoft.AspNetCore.Mvc;
namespace Elisa.GameServer.Controllers;
public class PassportController : Controller
{
[HttpPost("/passport/userProtocol", Name = "UserProtocol")]
public async Task<IResult> UserProtocol()
{
return Results.Json(new
{
user_protocol = "http://127.0.0.1/userProtocol_en_v005.txt",
delete_protocol = "http://127.0.0.1/passport/deleteProtocol",
delete_notice= @"<p class=MsoPlainText><span lang=EN-US style='font-family:宋体'>1.Please perform this on a safe and frequently-used network and devices.</span></p><p class=MsoPlainText><span lang=EN-US style='font-family:宋体'>2.If there are any unused paid services or virtual currency on the linked accounts, they will all be lost along with the account. All game account information on the Sunborn Network will be deleted, so please take care when performing this action.</span></p><p class=MsoPlainText><span lang=EN-US style='font-family:宋体'>3.Please read the Deletion Terms below carefully. Your account cannot be restored once it is deleted, so please consider your decision carefully.</span></p>",
twitter_disable = true
});
}
}

View File

@ -1,55 +0,0 @@
using Elisa.Common.Data;
using Elisa.GameServer.Commands;
using Elisa.GameServer.Services;
using Serilog;
using System.Diagnostics;
using System.Reflection;
using System.Text.Encodings.Web;
namespace Elisa.GameServer;
public static class GameServer
{
public static string ClientVersion = 30400.ToString();
public static string DataVersion = "4e7d9f82634fd8c557600524b55c8efe";
public static string ABVersion = 2024052719.ToString();
public static void Main(string[] args)
{
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
builder.Host.UseSerilog((context, configuration) => configuration.ReadFrom.Configuration(context.Configuration));
builder.Services.AddHttpClient();
builder.Services.AddControllers()
.AddJsonOptions(options => options.JsonSerializerOptions.Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping);
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
//builder.Services.AddHostedService(provider => new ProxyBackgroundService("127.0.0.1"));
WebApplication app = builder.Build();
app.UseSerilogRequestLogging();
app.UseAuthorization();
app.MapControllers();
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
Log.Information($"Version {Assembly.GetEntryAssembly()?.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion}");
Log.Information($"Client Version: {ClientVersion}");
Log.Information($"Data Version: {DataVersion}");
Log.Information($"AB Version: {ABVersion}");
Log.Information($"Starting {Assembly.GetEntryAssembly()?.GetName().Name.Split('.')[0]}...");
Stopwatch stopwatch = Stopwatch.StartNew();
{
CommandHandlerFactory.RegisterCommands(Assembly.GetExecutingAssembly());
Table.Load();
}
stopwatch.Stop();
Log.Information($"Done! Loaded in {stopwatch.ElapsedMilliseconds}ms");
app.Run();
}
}

View File

@ -1,136 +0,0 @@
using Serilog;
using System.Text.RegularExpressions;
using Titanium.Web.Proxy;
using Titanium.Web.Proxy.EventArguments;
using Titanium.Web.Proxy.Models;
namespace Elisa.GameServer;
public class ProxyControl
{
static readonly Regex HostFilter = new Regex("(.*).(girlfrontline\\.co\\.kr|ppgame\\.com|txwy\\.tw|sunborngame\\.com|aihelp\\.net).*");
static readonly Regex AWSFilter = new Regex(@"s3.*.amazonaws.com");
static readonly Regex DLlistFilter = new Regex(@"dl.listdl.com");
readonly string forwardIpAddress;
readonly ProxyServer proxyServer;
readonly ExplicitProxyEndPoint explicitEndPoint;
public ProxyControl(string forwardIpAddress, int port = 9000)
{
this.forwardIpAddress = forwardIpAddress;
proxyServer = new ProxyServer();
explicitEndPoint = new ExplicitProxyEndPoint(System.Net.IPAddress.Any, port, true);
proxyServer.BeforeRequest += OnRequest;
//Ssl handling
explicitEndPoint.BeforeTunnelConnectRequest += OnBeforeTunnelConnectRequest;
proxyServer.ServerCertificateValidationCallback += OnCertificateValidation;
proxyServer.ClientCertificateSelectionCallback += OnCertificateSelection;
}
public void Start()
{
proxyServer.AddEndPoint(explicitEndPoint);
proxyServer.Start();
//proxyServer.SetAsSystemHttpProxy(explicitEndPoint);
//proxyServer.SetAsSystemHttpsProxy(explicitEndPoint);
}
public void Stop()
{
proxyServer.BeforeRequest -= OnRequest;
//Ssl Handling
proxyServer.ServerCertificateValidationCallback -= OnCertificateValidation;
proxyServer.ClientCertificateSelectionCallback -= OnCertificateSelection;
explicitEndPoint.BeforeTunnelConnectRequest -= OnBeforeTunnelConnectRequest;
//proxyServer.DisableAllSystemProxies();
proxyServer.Stop();
}
private async Task OnBeforeTunnelConnectRequest(object sender, TunnelConnectSessionEventArgs e)
{
string hostname = e.HttpClient.Request.RequestUri.Host;
//show the hostname
Log.Information($"Tunnel Connect Request for {hostname}");
//Forward to our domain --this doesn't work
if (HostFilter.IsMatch(hostname) || AWSFilter.IsMatch(hostname) || DLlistFilter.IsMatch(hostname))
{
Log.Information($"Forwarding tunnel connect request for {hostname} to {forwardIpAddress}");
e.DecryptSsl = true;
e.HttpClient.Request.RequestUri = new Uri("https://" + forwardIpAddress + e.HttpClient.Request.RequestUri.PathAndQuery, UriKind.Absolute);
return;
}
if (hostname.Contains("gf-passport.sunborngame.com"))
{
// Exclude Https addresses you don't want to proxy
// Useful for clients that use certificate pinning
// for example dropbox.com
e.DecryptSsl = false;
}
}
public Task OnCertificateValidation(object sender, CertificateValidationEventArgs e)
{
// set IsValid to true/false based on Certificate Errors
//if (e.SslPolicyErrors == System.Net.Security.SslPolicyErrors.None)
e.IsValid = true;
return Task.CompletedTask;
}
// Allows overriding default client certificate selection logic during mutual authentication
public Task OnCertificateSelection(object sender, CertificateSelectionEventArgs e)
{
// set e.clientCertificate to override
return Task.CompletedTask;
}
private async Task OnRequest(object sender, SessionEventArgs e)
{
if (e.IsHttps)
{
Log.Information("HTTPS request detected, skipping");
return;
}
Uri requestUri = e.HttpClient.Request.RequestUri;
if (HostFilter.IsMatch(requestUri.Host))
{
Log.Information($"Forwarding request for {requestUri} to {forwardIpAddress}");
Uri newUri = new Uri("http://" + forwardIpAddress + requestUri.PathAndQuery, UriKind.Absolute);
Log.Information($"Forwarded request to {newUri}");
e.HttpClient.Request.RequestUri = newUri;
// Bubble it out to user
}
//Test for aws
else if (AWSFilter.IsMatch(requestUri.Host))
{
Log.Information($"Forwarding AWS request for {requestUri} to {forwardIpAddress}");
Uri newUri = new Uri("http://" + forwardIpAddress + requestUri.PathAndQuery, UriKind.Absolute);
Log.Information($"Forwarded request to {newUri}");
e.HttpClient.Request.RequestUri = newUri;
}
else if (DLlistFilter.IsMatch(requestUri.Host))
{
Log.Information($"Forwarding DLList request for {requestUri} to {forwardIpAddress}");
Uri newUri = new Uri("http://" + forwardIpAddress + requestUri.PathAndQuery, UriKind.Absolute);
Log.Information($"Forwarded request to {newUri}");
e.HttpClient.Request.RequestUri = newUri;
}
}
}

View File

@ -1,11 +0,0 @@
//类型名|是否会保存到本地|资源名
//HotUpdateBackground|true|Background161101.png
HotUpdateBackground|true|1ff934568eb9d2a6_draw_221213175434.png
LoginBackground|true|201805
HomeBackground|true|
attendance1|true|
attendance2|true|d3d1b3e115da2221_draw_240507142255.jpg
CDKey2|true|
SevenSupply1|true|c30482012b01a83a_draw_181106004.png
FirstPurchase1|true|

View File

@ -1,97 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<servers>
<server>
<name>GRIFFIN</name>
<addr>http://127.0.0.1/index.php/1001/</addr>
<worldId>1001</worldId>
<recommended>0</recommended>
<condition>0</condition>
<is_check>0</is_check>
<nc>0</nc>
<ab_version>2024052719</ab_version>
<open_time>1715129630</open_time>
<naive_switch>1</naive_switch>
</server>
<config>
<notice_url>http://127.0.0.1/pages/notice</notice_url>
<update_log_url>http://127.0.0.1/pages/update_url</update_log_url>
<update_start_time>2018-05-16 20:00:43</update_start_time>
<update_end_time>2036-09-01 00:00:00</update_end_time>
<client_version>30400</client_version>
<platform>https://play.google.com/store/apps/details?id=com.sunborn.girlsfrontline.en</platform>
<top_client_version>20410</top_client_version>
<version_desc>v.3.0400 Update Content:
[Mobile Armor System Optimizations]
1. Optimized: The &quot;Mobile Armor&quot; combat results screen now shows the remaining HP and other such info of the Mobile Armor units in question. An option to &quot;Armor Enhancement&quot; has been added to the Mission Failed screen.
2. Optimized: If a Mobile Armor unit is not &quot;In Combat&quot;, Fire Support Units assigned to the armor in question can be independently deployed as normal.
3. Optimized: The &quot;Tech Tree&quot; display of the Mobile Armor system now features a before and after display of effects when activating certain nodes.
4. Optimized: Mobile Armor support skills are now labelled with the [Support] tag.
5. Optimized: The Armor Design Shop's item preview function now adds an indication that an item is being previewed, as well as showing if a certain mobile armor design will clash with others. You can also instantly purchase a desired item after trying it out. Changing an armor's degisn blueprint no longer clears out equipped designs.
The &quot;Armor Design&quot; set display mode has also been added. You may use this function to preview the look of a scerain set of armor designs as well as purchase it immediately.
The &quot;Armor Design&quot; purchase screen has been made easier to use.
The arrangement of items in the &quot;Armor Design&quot; blueprint display screen has been improved.
6. Optimized: Information display for non-generic components has been improved and the equip screen has been mae easier to use.
7. Optimized: Information display and filtering for generic components has been improved.
[Other New Content]
1. Added: &quot;Armored Assault&quot; mode in &quot;Gray Zone Exploration&quot; now has the &quot;Sweep&quot; function. If you have already cleared up to a certain point in the stage, you can click &quot;Sweep&quot; to expend attempts to directly obtain the stage rewards.
2. Added: The &quot;Gray Zone Exploration&quot; system now features a new Proxy Planning function. At the &quot;Echelon Formation&quot; or the &quot;Gray Zone Exploration&quot; difficulty select, you can click the newly-added &quot;Echelon Pre-Select&quot; button to enter the echelon pre-selection screen.
On this screen, you can edit and select echelons for use in Proxy Battle mode, as well as deciding whether the echelons in question will take part in day or night battles.
Once you have finished editing, selected and activated your pre-selected echelons, the system will only use these echelons or units during Proxy Battle mode.
3. Added: Combat Simulations now have the &quot;Sweep&quot; function. During &quot;EXP Mode&quot;, &quot;Data Mode&quot;, &quot;Capsule Mode&quot;, &quot;Neural Cloud Corridor&quot; and &quot;Coalition Drill, you can select the number of times you want to sweep the simulation in question and press the &quot;Sweep&quot; button to expend the corresponding amount of attempts and gain the appropriate materials as rewards.
4. Added: The &quot;Echelon Formation&quot; screen now has a Share function. By clicking the &quot;Share&quot; button, you can convert your current echelon's data into a bar code or QR code which can be shared with other Commanders. This code can be used by other Commanders to reproduce your echelon.
This function is not currently available for vehicle echelons.
5. Added: The &quot;Search&quot; function has ben aded to the unit display screen. You can enter keywords to search for units which meet the criteria.
6. Added: The &quot;Favorite&quot; function has been added to unit detail pages. By clicking it, you can favorite the unit in question, which enables the filter option &quot;Only show favorited&quot; units.
7. Added: The armor components &quot;Vehicle Shotgun&quot;, &quot;Mini Mortar&quot;, &quot;Laser Rangefinder&quot;, &quot;Camouflage Netting&quot;, &quot;Top Slat Armor&quot; can be obtained through exploring the &quot;Vitrified - Hell&quot; region during &quot;Gray Zone Exploration&quot;.
[Other Optimizations]
1. Optimized: The &quot;Repair All &quot; option now includes Fire Support Units and Mobile Armors.
2. Optimized: Mid-battle nformation display for Fire Support Units has been improved. You can view information on Fire Support Units and Mobile Armors units by clicking and holding on them.
3. Optimized: The post-mission reward display screen in Gray Zone Exploration has been tweaked.
4. Optimized: The overall functional experience of the Proxy Battle system in Gray Zone Exploration has been improved.
5. Optimized: The Chip Enhancement system for Fire Support Units has been improved. The Chip Enhancement screen now has options to &quot;Max-Enhance One Chip&quot; and &quot;Max-Enhance Multiple Chips&quot;.
6. Optimized: Data display for &quot;Equipment&quot; has been improved. A special equipment buff tab has been added for the equipment detail display screen.
7. Optimized: The Echelon Formation screen now gives the option to select multiple echelons at once. Also, certain Fire Support Units selection screens allow you to select multiple Fire Support Units at once.
8. Optimized: The maximum amount of Surplus EXP that can be held at one time has been increased. Kalina's speed of writing combat reports has also been increased.
9. Optimized: Alerts have been added for the addition of new Career Missions.
10. Optimized: Unit selection displays have been improved. The option to select units based on their Repair, Move Speed and other stats has also been added.
11. Optimized: The potential dropped items display for missions ahas been improved. It now has popups for unlock conditions and the layout has been improved.
12. Optimized: Planning Mode AP expenditures now display extra APs for echelons and vehicle fuel supply status.
13. Optimized: A problem where one could not drag or shrink unit CGs when inspecting them in the Unit Details screen.
14. Optimized: A problem where the rewards screen would be displayed multiple times after certain Ranking Mode stages were made permanently available in the campaign tab.</version_desc>
</config>
</servers>

View File

@ -1 +0,0 @@
Suck me TOS

View File

@ -0,0 +1,96 @@
using System.Text;
using Elisa.WebAPI.Utils;
using Microsoft.AspNetCore.Mvc;
using Serilog;
namespace Elisa.WebAPI.Controllers;
public class IndexController : Controller
{
string ClientVersion = 30400.ToString();
string DataVersion = "d630eea53a1b869fa4d7d1479a3d09e7";
string ABVersion = 2024051417.ToString();
[HttpPost("index.php", Name = "ServerList")]
public async Task<IResult> ServerList([FromForm] IFormCollection req_id)
{
//Log all the values
foreach (var key in req_id.Keys)
{
Log.Information("{key} = {value}", key, req_id[key]);
//See if req_id has the value "newserverList"
if (req_id[key].Contains("newserverList"))
{
//Print out the current working directory
Log.Information("Current working directory: {0}", Directory.GetCurrentDirectory());
//If it does, return the new serverlist.xml
var stream = System.IO.File.ReadAllText("Data\\serverlist.xml");
return Results.Text(stream, "text/html", Encoding.UTF8);
}
}
//If it doesn't, return the default response
return Results.Json(new
{
now = DateTime.Now.ToUnixSeconds(),
tomorrow_zero = Time.GetTomorrowZero(),
month_zero = Time.GetCurrentMonthZero(),
next_month_zero = Time.GetNextMonthZero(),
timezone = "PST8PDT",
data_version = DataVersion,
client_version = ClientVersion,
ab_version = ABVersion,
is_kick = "0",
weekday = 1,
authentication_url = $"http://realauth.ucenter.ppgame.com/authoriz.html?appid={0}&openid={1}&accounttype=1&language=zh"
});
}
[HttpGet("1001/index/version", Name = "Version")]
public async Task<IResult> Version([FromQuery] string req_id)
{
//If it doesn't, return the default response
return Results.Json(new
{
now = DateTime.Now.ToUnixSeconds(),
tomorrow_zero = Time.GetTomorrowZero(),
month_zero = Time.GetCurrentMonthZero(),
next_month_zero = Time.GetNextMonthZero(),
timezone = "PST8PDT",
data_version = DataVersion,
client_version = ClientVersion,
ab_version = ABVersion,
is_kick = "0",
weekday = 1,
authentication_url = $"http://realauth.ucenter.ppgame.com/authoriz.html?appid={0}&openid={1}&accounttype=1&language=zh"
});
}
[HttpGet("image/imageconfig.txt", Name = "ImageConfig")]
public async Task<IResult> ImageConfig([FromQuery] string req_id)
{
//If it doesn't, return the default response
return Results.Text(@"//类型名|是否会保存到本地|资源名
//HotUpdateBackground|true|Background161101.png
HotUpdateBackground|true|1ff934568eb9d2a6_draw_221213175434.png
LoginBackground|true|201805
HomeBackground|true|
attendance1|true|
attendance2|true|d3d1b3e115da2221_draw_240507142255.jpg
CDKey2|true|
SevenSupply1|true|c30482012b01a83a_draw_181106004.png
FirstPurchase1|true|");
}
[Route("{*url}")]
public IActionResult HandleAll(string url)
{
// Log the incoming request
Serilog.Log.Information("Handling unmatched request for URL: {Url}", url);
// Return a custom response
return Content($"Handled by catch-all route: {url}");
}
}

View File

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<servers>
<server>
<name>GRIFFIN</name>
<addr>http://127.0.0.1/</addr>
<worldId>1001</worldId>
<recommended>0</recommended>
<condition>0</condition>
<is_check>0</is_check>
<nc>0</nc>
<ab_version>2024051417</ab_version>
<open_time>1714705161</open_time>
<naive_switch>1</naive_switch>
</server>
<config>
<notice_url>http://127.0.0.1/pages/notice</notice_url>
<update_log_url>http://127.0.0.1/pages/update_url</update_log_url>
<update_start_time>2018-05-16 20:00:43</update_start_time>
<update_end_time>2036-09-01 00:00:00</update_end_time>
<client_version>30400</client_version>
<platform>https://play.google.com/store/apps/details?id=com.sunborn.girlsfrontline.en</platform>
<top_client_version>20410</top_client_version>
<version_desc>
v.3.0400 Update Content:
[Mobile Armor System Optimizations]
1. Optimized: The "Mobile Armor" combat results screen now shows the remaining HP and other such info of the Mobile Armor units in question. An option to "Armor Enhancement" has been added to the Mission Failed screen.
2. Optimized: If a Mobile Armor 4unit is not "In Combat", Fire Support Units assigned to the armor in question can be independently deployed as normal.
3. Optimized: The "Tech Tree" display of the Mobile Armor system now features a before and after display of effects when activating certain nodes.
4. Optimized: Mobile Armor support skills are now labelled with the [Support] tag.
5. Optimized: The Armor Design Shop's item preview function now adds an indication that an item is being previewed, as well as showing if a certain mobile armor design will clash with others. You can also instantly purchase a desired item after trying it out. Changing an armor's degisn blueprint no longer clears out equipped designs.
The "Armor Design" set display mode has also been added. You may use this function to preview the look of a scerain set of armor designs as well as purchase it immediately.
The "Armor Design" purchase screen has been made easier to use.
The arrangement of items in the "Armor Design" blueprint display screen has been improved.
6. Optimized: Information display for non-generic components has been improved and the equip screen has been mae easier to use.
7. Optimized: Information display and filtering for generic components has been improved.
[Other New Content]
1. Added: "Armored Assault" mode in "Gray Zone Exploration" now has the "Sweep" function. If you have already cleared up to a certain point in the stage, you can click "Sweep" to expend attempts to directly obtain the stage rewards.
2. Added: The "Gray Zone Exploration" system now features a new Proxy Planning function. At the "Echelon Formation" or the "Gray Zone Exploration" difficulty select, you can click the newly-added "Echelon Pre-Select" button to enter the echelon pre-selection screen.
On this screen, you can edit and select echelons for use in Proxy Battle mode, as well as deciding whether the echelons in question will take part in day or night battles.
Once you have finished editing, selected and activated your pre-selected echelons, the system will only use these echelons or units during Proxy Battle mode.
3. Added: Combat Simulations now have the "Sweep" function. During "EXP Mode", "Data Mode", "Capsule Mode", "Neural Cloud Corridor" and "Coalition Drill, you can select the number of times you want to sweep the simulation in question and press the "Sweep" button to expend the corresponding amount of attempts and gain the appropriate materials as rewards.
4. Added: The "Echelon Formation" screen now has a Share function. By clicking the "Share" button, you can convert your current echelon's data into a bar code or QR code which can be shared with other Commanders. This code can be used by other Commanders to reproduce your echelon.
This function is not currently available for vehicle echelons.
5. Added: The "Search" function has ben aded to the unit display screen. You can enter keywords to search for units which meet the criteria.
6. Added: The "Favorite" function has been added to unit detail pages. By clicking it, you can favorite the unit in question, which enables the filter option "Only show favorited" units.
7. Added: The armor components "Vehicle Shotgun", "Mini Mortar", "Laser Rangefinder", "Camouflage Netting", "Top Slat Armor" can be obtained through exploring the "Vitrified - Hell" region during "Gray Zone Exploration".
[Other Optimizations]
1. Optimized: The "Repair All " option now includes Fire Support Units and Mobile Armors.
2. Optimized: Mid-battle nformation display for Fire Support Units has been improved. You can view information on Fire Support Units and Mobile Armors units by clicking and holding on them.
3. Optimized: The post-mission reward display screen in Gray Zone Exploration has been tweaked.
4. Optimized: The overall functional experience of the Proxy Battle system in Gray Zone Exploration has been improved.
5. Optimized: The Chip Enhancement system for Fire Support Units has been improved. The Chip Enhancement screen now has options to "Max-Enhance One Chip" and "Max-Enhance Multiple Chips".
6. Optimized: Data display for "Equipment" has been improved. A special equipment buff tab has been added for the equipment detail display screen.
7. Optimized: The Echelon Formation screen now gives the option to select multiple echelons at once. Also, certain Fire Support Units selection screens allow you to select multiple Fire Support Units at once.
8. Optimized: The maximum amount of Surplus EXP that can be held at one time has been increased. Kalina's speed of writing combat reports has also been increased.
9. Optimized: Alerts have been added for the addition of new Career Missions.
10. Optimized: Unit selection displays have been improved. The option to select units based on their Repair, Move Speed and other stats has also been added.
11. Optimized: The potential dropped items display for missions ahas been improved. It now has popups for unlock conditions and the layout has been improved.
12. Optimized: Planning Mode AP expenditures now display extra APs for echelons and vehicle fuel supply status.
13. Optimized: A problem where one could not drag or shrink unit CGs when inspecting them in the Unit Details screen.
14. Optimized: A problem where the rewards screen would be displayed multiple times after certain Ranking Mode stages were made permanently available in the campaign tab.
</version_desc>
</config>
</servers>

View File

@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog" Version="4.0.0-dev-02191" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.2-dev-00338" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.1-dev-10391" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
<PackageReference Include="Titanium.Web.Proxy" Version="3.2.2-beta" />
</ItemGroup>
<ItemGroup>
<None Update="Data\serverlist.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

53
Elisa.WebAPI/Program.cs Normal file
View File

@ -0,0 +1,53 @@
using System.Reflection;
using System.Text.Encodings.Web;
using Elisa.WebAPI.Services;
using Serilog;
string ClientVersion = 30400.ToString();
string DataVersion = "d630eea53a1b869fa4d7d1479a3d09e7";
string ABVersion = 2024051417.ToString();
var builder = WebApplication.CreateBuilder(args);
builder.Host.UseSerilog((context, configuration) => configuration.ReadFrom.Configuration(context.Configuration));
builder.Services.AddHttpClient();
// Add services to the container.
builder.Services.AddControllers()
.AddJsonOptions(options =>
{
options.JsonSerializerOptions.Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping;
});
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddHostedService<ProxyBackgroundService>(provider =>
new ProxyBackgroundService("127.0.0.1"));
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseSerilogRequestLogging();
//app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
Log.Information($"Version {Assembly.GetEntryAssembly()?.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion}");
Log.Information($"Client Version: {ClientVersion}");
Log.Information($"Data Version: {DataVersion}");
Log.Information($"AB Version: {ABVersion}");
Log.Information($"Starting {Assembly.GetEntryAssembly()?.GetName().Name}...");
app.Run();

View File

@ -14,7 +14,7 @@
"dotnetRunMessages": true,
"launchBrowser": false,
"launchUrl": "swagger",
"applicationUrl": "https://127.0.0.1;http://127.0.0.1;",
"applicationUrl": "http://127.0.0.1",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
@ -22,9 +22,9 @@
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:443;http://localhost:80",
"applicationUrl": "https://localhost:7010;http://localhost:5208",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}

View File

@ -0,0 +1,63 @@
using System;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Titanium.Web.Proxy;
using Titanium.Web.Proxy.EventArguments;
using Titanium.Web.Proxy.Models;
namespace Elisa.WebAPI;
public class ProxyControl
{
private static readonly Regex HostFilter = new Regex("(.*).(girlfrontline\\.co\\.kr|ppgame\\.com|txwy\\.tw|sunborngame\\.com|aihelp.net.cn).*");
private readonly string forwardIpAddress;
private readonly ProxyServer proxyServer;
private readonly ExplicitProxyEndPoint explicitEndPoint;
public ProxyControl(string forwardIpAddress, int port = 8888)
{
this.forwardIpAddress = forwardIpAddress;
proxyServer = new ProxyServer();
explicitEndPoint = new ExplicitProxyEndPoint(System.Net.IPAddress.Any, port, true);
proxyServer.BeforeRequest += OnRequest;
}
public void Start()
{
proxyServer.AddEndPoint(explicitEndPoint);
proxyServer.Start();
proxyServer.SetAsSystemHttpProxy(explicitEndPoint);
proxyServer.SetAsSystemHttpsProxy(explicitEndPoint);
}
public void Stop()
{
proxyServer.BeforeRequest -= OnRequest;
proxyServer.Stop();
}
private async Task OnRequest(object sender, SessionEventArgs e)
{
var requestUri = e.HttpClient.Request.RequestUri;
if (HostFilter.IsMatch(requestUri.Host))
{
//Log the request and where its forwarding to
Serilog.Log.Information("Forwarding request for {RequestUri} to {ForwardIpAddress}", requestUri, forwardIpAddress);
//Build an entirely new URI with the specified IP address
var newUri = new Uri("http://" + forwardIpAddress + requestUri.PathAndQuery, UriKind.Absolute);
Serilog.Log.Information("Forwarded request to {requestUri}", newUri);
e.HttpClient.Request.RequestUri = newUri;
//Bubble it out to user
}
}
}

View File

@ -1,22 +1,29 @@
namespace Elisa.GameServer.Services;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
namespace Elisa.WebAPI.Services;
public class ProxyBackgroundService : BackgroundService
{
readonly ProxyControl proxyControl;
private readonly ProxyControl _proxyControl;
public ProxyBackgroundService(string forwardIpAddress)
{
proxyControl = new ProxyControl(forwardIpAddress);
_proxyControl = new ProxyControl(forwardIpAddress);
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
proxyControl.Start();
stoppingToken.Register(() => proxyControl.Stop());
_proxyControl.Start();
stoppingToken.Register(() => _proxyControl.Stop());
// Keep the background service running
while (!stoppingToken.IsCancellationRequested)
{
await Task.Delay(1000, stoppingToken);
}
}
public override async Task StopAsync(CancellationToken stoppingToken)
{

View File

@ -0,0 +1,253 @@
using ICSharpCode.SharpZipLib.GZip;
using System.IO.Compression;
using System.Security.Cryptography;
using System.Text;
namespace Elisa.WebAPI.Utils;
public static class Crypto
{
static DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
static MD5 md5 = System.Security.Cryptography.MD5.Create();
public static string Decrypt(string body, string key)
{
if (string.IsNullOrEmpty(body) || string.IsNullOrEmpty(key))
return string.Empty;
if (body.Length == 1 || body.StartsWith("error:") || (body.StartsWith("{") && body.EndsWith("}")))
return body;
try
{
string text = MD5(MD5(key).Substring(16));
string pwd = text + MD5(text);
if (body.StartsWith("#"))
{
body = body.Substring(1);
return GZipDecompress(RC4(ConvertFromBase64String(body), pwd).Skip(26).ToArray<byte>());
}
byte[] bytes = RC4(ConvertFromBase64String(body), pwd);
string @string = Encoding.UTF8.GetString(bytes);
return (@string.Length > 26) ? @string.Substring(26) : string.Empty;
}
catch
{
}
return string.Empty;
}
public static string Encrypt(string body, string key)
{
try
{
byte[] array = GZipCompress(Encoding.UTF8.GetBytes(body));
string text = MD5(key);
string s = MD5(text.Substring(0, 16));
string text2 = MD5(text.Substring(16, 16));
string pwd = text2 + MD5(text2);
byte[] bytes = Encoding.UTF8.GetBytes(string.Format("{0}", Math.Round(GetCurrentSec()) + 3600.0));
string s2 = MD5(array.Concat(Encoding.UTF8.GetBytes(s)).ToArray<byte>()).Substring(0, 16);
byte[] array2 = new byte[array.Length + 26];
Array.Copy(bytes, 0, array2, 0, bytes.Length);
Array.Copy(Encoding.UTF8.GetBytes(s2), 0, array2, 10, 16);
Array.Copy(array, 0, array2, 26, array.Length);
return "#" + Convert.ToBase64String(RC4(array2, pwd));
}
catch
{
}
return string.Empty;
}
public static byte[] ConvertFromBase64String(string input)
{
byte[] result = [];
try
{
result = Convert.FromBase64String(input);
}
catch
{
try
{
result = Convert.FromBase64String(input + "=");
}
catch
{
try
{
result = Convert.FromBase64String(input + "==");
}
catch
{
return result;
}
}
}
return result;
}
public static double GetCurrentSec()
{
return (DateTime.UtcNow - epoch).TotalSeconds;
}
public static string MD5(string input)
{
return MD5(Encoding.UTF8.GetBytes(input));
}
public static string MD5(byte[] input)
{
byte[] array = md5.ComputeHash(input);
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < array.Length; i++)
stringBuilder.Append(array[i].ToString("x2"));
return stringBuilder.ToString();
}
public static byte[] RC4(byte[] data, string pwd)
{
return RC4(data, Encoding.UTF8.GetBytes(pwd));
}
public static byte[] RC4(byte[] data, byte[] pwd)
{
int[] array = new int[256];
int[] array2 = new int[256];
byte[] array3 = new byte[data.Length];
int i;
int num;
for (i = 0; i < 256; i++)
{
array[i] = (int)pwd[i % pwd.Length];
array2[i] = i;
}
for (i = (num = 0); i < 256; i++)
{
int num2 = array2[i];
num = (num + array2[i] + array[i]) % 256;
array2[i] = array2[num];
array2[num] = num2;
}
int num3;
num = (num3 = (i = 0));
while (i < data.Length)
{
num3++;
num3 %= 256;
num += array2[num3];
num %= 256;
int num2 = array2[num3];
array2[num3] = array2[num];
array2[num] = num2;
int num4 = array2[(array2[num3] + array2[num]) % 256];
array3[i] = (byte)((int)data[i] ^ num4);
i++;
}
return array3;
}
public static byte[] GZipCompress(byte[] raw)
{
byte[] result;
using (MemoryStream memoryStream = new MemoryStream())
{
using GZipOutputStream gzipOutputStream = new GZipOutputStream(memoryStream);
gzipOutputStream.IsStreamOwner = false;
gzipOutputStream.Write(raw, 0, raw.Length);
gzipOutputStream.Flush();
gzipOutputStream.Finish();
result = memoryStream.ToArray();
}
return result;
}
public static string GZipDecompress(byte[] raw)
{
string result;
using (MemoryStream memoryStream = new MemoryStream(raw))
{
using Stream stream = new GZipInputStream(memoryStream);
using StreamReader streamReader = new StreamReader(stream, Encoding.UTF8);
result = streamReader.ReadToEnd();
}
return result;
}
public static string CompressText(string text)
{
byte[] bytes = Encoding.UTF8.GetBytes(text);
byte[]? inArray = null;
using (MemoryStream memoryStream = new MemoryStream())
{
using (GZipStream gzipStream = new GZipStream(memoryStream, CompressionMode.Compress))
{
gzipStream.Write(bytes, 0, bytes.Length);
}
inArray = memoryStream.ToArray();
}
return Convert.ToBase64String(inArray);
}
public static string DecompressText(string text)
{
string result = string.Empty;
using (MemoryStream memoryStream = new MemoryStream(Convert.FromBase64String(text)))
{
using (GZipStream gzipStream = new GZipStream(memoryStream, CompressionMode.Decompress))
{
using (StreamReader streamReader = new StreamReader(gzipStream))
{
result = streamReader.ReadToEnd();
}
}
}
return result;
}
public static string ConvertMD5(string input)
{
byte[] array = md5.ComputeHash(Encoding.UTF8.GetBytes(input));
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < array.Length; i++)
stringBuilder.Append(array[i].ToString("x2"));
return stringBuilder.ToString();
}
}

36
Elisa.WebAPI/Utils/RNG.cs Normal file
View File

@ -0,0 +1,36 @@
namespace Elisa.WebAPI.Utils;
public static class RNG
{
static readonly Random random = new Random((int)DateTime.Now.Ticks);
public static int Next(int min, int max)
=> random.Next(min, max);
public static int Next(int max)
=> random.Next(max);
public static float NextFloat(float min, float max)
{
double range = (double)max - min;
double sample = random.NextDouble();
double scaled = (sample * range) + min;
return (float)scaled;
}
public static float NextFloat(float max)
=> NextFloat(0f, max);
public static bool NextBool()
=> random.Next(2) == 0;
public static float NextRoll()
=> NextFloat(100f);
public static T NextFromList<T>(IList<T> list)
=> list[random.Next(list.Count)];
public static U NextFromDict<T, U>(IDictionary<T, U> dict)
=> dict.ElementAt(random.Next(dict.Count)).Value;
}

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Utils;
namespace Elisa.WebAPI.Utils;
public abstract class Singleton<T> where T : new()
{

View File

@ -0,0 +1,19 @@
namespace Elisa.WebAPI.Utils;
public static class Time
{
public static long GetTomorrowZero()
=> new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0, DateTimeKind.Utc).AddDays(1).ToUnixSeconds();
public static long GetCurrentMonthZero()
=> new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1, 0, 0, 0, DateTimeKind.Utc).ToUnixSeconds();
public static long GetNextMonthZero()
=> new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1, 0, 0, 0, DateTimeKind.Utc).AddMonths(1).ToUnixSeconds();
}
internal static class DateTimeExtensions
{
public static long ToUnixSeconds(this DateTime dateTime)
=> (long)(dateTime - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds;
}

View File

@ -1,5 +1,4 @@
{
"Urls": "http://localhost:80",
"Logging": {
"LogLevel": {
"Default": "Information",

View File

@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34316.72
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elisa.Common", "Elisa.Common\Elisa.Common.csproj", "{41B9435A-3D9D-44BF-B1F5-60FBA8557A1A}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elisa", "Elisa\Elisa.csproj", "{AE240F77-1DA8-42B0-9D81-E42B8E7B7D77}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elisa.GameServer", "Elisa.GameServer\Elisa.GameServer.csproj", "{D7C3C727-8AB9-4C4A-91AE-7A416F452A96}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elisa.WebAPI", "Elisa.WebAPI\Elisa.WebAPI.csproj", "{926559D5-FF03-4D79-9475-3F187BB73E49}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -13,14 +13,14 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{41B9435A-3D9D-44BF-B1F5-60FBA8557A1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41B9435A-3D9D-44BF-B1F5-60FBA8557A1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41B9435A-3D9D-44BF-B1F5-60FBA8557A1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41B9435A-3D9D-44BF-B1F5-60FBA8557A1A}.Release|Any CPU.Build.0 = Release|Any CPU
{D7C3C727-8AB9-4C4A-91AE-7A416F452A96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D7C3C727-8AB9-4C4A-91AE-7A416F452A96}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D7C3C727-8AB9-4C4A-91AE-7A416F452A96}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D7C3C727-8AB9-4C4A-91AE-7A416F452A96}.Release|Any CPU.Build.0 = Release|Any CPU
{AE240F77-1DA8-42B0-9D81-E42B8E7B7D77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE240F77-1DA8-42B0-9D81-E42B8E7B7D77}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE240F77-1DA8-42B0-9D81-E42B8E7B7D77}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE240F77-1DA8-42B0-9D81-E42B8E7B7D77}.Release|Any CPU.Build.0 = Release|Any CPU
{926559D5-FF03-4D79-9475-3F187BB73E49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{926559D5-FF03-4D79-9475-3F187BB73E49}.Debug|Any CPU.Build.0 = Debug|Any CPU
{926559D5-FF03-4D79-9475-3F187BB73E49}.Release|Any CPU.ActiveCfg = Release|Any CPU
{926559D5-FF03-4D79-9475-3F187BB73E49}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -1,7 +1,7 @@
using Serilog;
using System.Reflection;
namespace Elisa.GameServer.Commands;
namespace Elisa.Commands;
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public class CommandHandler(string name, string description, string example) : Attribute
@ -140,7 +140,7 @@ public static class CommandHandlerFactory
if (connection is not null)
{
if (!commandFunctionsUser.TryGetValue(parts[0], out var command))
if (!(commandFunctionsUser).TryGetValue(parts[0], out var command))
{
Log.Warning($"Unknown command: {parts[0]}");
return;
@ -150,7 +150,7 @@ public static class CommandHandlerFactory
}
else
{
if (!commandFunctions.TryGetValue(parts[0], out var command))
if (!(commandFunctions).TryGetValue(parts[0], out var command))
{
Log.Warning($"Unknown command: {parts[0]}");
return;

View File

@ -1,7 +1,7 @@
using System.Reflection;
using System.Text;
namespace Elisa.GameServer.Commands;
namespace Elisa.Commands;
[CommandHandler("help", "Print out all commands with their description and example", "help")]
public class HelpCommand : Command

View File

@ -1,7 +1,7 @@
using Elisa.Common.Utils;
using Elisa.Utils;
using Serilog;
namespace Elisa.GameServer.Commands;
namespace Elisa.Commands;
[CommandHandler("test", "Command to test various functions", "test type=encrypt value=asdf")]
public class tESTcOMMAND : Command

View File

@ -0,0 +1,29 @@
using Elisa.Utils;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Elisa.Controllers;
[ApiController]
[Route("/Index")]
public class IndexController : ControllerBase
{
[HttpGet("version")]
public async Task<IResult> Version([FromQuery] string req_id)
{
return Results.Json(new
{
now = DateTime.Now.ToUnixSeconds(),
tomorrow_zero = Time.GetTomorrowZero(),
month_zero = Time.GetCurrentMonthZero(),
next_month_zero = Time.GetNextMonthZero(),
timezone = "PST8PDT",
data_version = Program.DataVersion,
client_version = Program.ClientVersion,
ab_version = Program.ABVersion,
is_kick = "0",
weekday = 1,
authentication_url = $"http://realauth.ucenter.ppgame.com/authoriz.html?appid={0}&openid={1}&accounttype=1&language=zh"
});
}
}

View File

@ -1,6 +1,6 @@
using System.Text.Json;
namespace Elisa.Common.Data;
namespace Elisa.Data;
public static class JSON
{

View File

@ -1,10 +1,10 @@
using Elisa.Common.Data.Tables;
using Elisa.Data.Tables;
using Serilog;
using System.Collections;
using System.Reflection;
using System.Text.Json;
namespace Elisa.Common.Data;
namespace Elisa.Data;
public enum LoadDataType
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Data.Tables;
namespace Elisa.Data.Tables;
public class GunExpInfo : Model
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Data.Tables;
namespace Elisa.Data.Tables;
public class Daily : Model
{

View File

@ -0,0 +1 @@
namespace Elisa.Data.Tables;

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
@ -12,44 +12,28 @@
</PropertyGroup>
<ItemGroup>
<None Update="appsettings.Development.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\serverList.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\catchdata\*.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\image\*.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\stc\*.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\text\table\*.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\userProtocol_en_v005.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
<PackageReference Include="Unobtanium.Web.Proxy" Version="0.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Elisa.Common\Elisa.Common.csproj" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="System.Text.Json" Version="8.0.3" />
<PackageReference Include="Titanium.Web.Proxy" Version="3.2.2-beta" />
</ItemGroup>
</Project>

40
Elisa/GameServer.cs Normal file
View File

@ -0,0 +1,40 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.Extensions.DependencyInjection;
using Serilog;
namespace Elisa;
public static class GameServer
{
public static async Task Start()
{
WebApplicationBuilder builder = WebApplication.CreateBuilder(Environment.GetCommandLineArgs());
builder.Host.UseSerilog();
builder.Services.Configure<KestrelServerOptions>(options =>
{
options.AllowSynchronousIO = true;
});
builder.Services.AddControllers();
WebApplication app = builder.Build();
app.UseAuthorization();
app.UseSerilogRequestLogging();
app.Map("/", HandleRequest);
app.MapControllers();
app.Run();
}
static async Task HandleRequest(HttpContext context)
{
// Is this even necessary?
if (context.Request.Method == "CONNECT")
context.Response.StatusCode = StatusCodes.Status200OK;
else
{
context.Response.StatusCode = StatusCodes.Status405MethodNotAllowed;
await context.Response.WriteAsync("Error 405: Method Not Allowed");
}
}
}

19
Elisa/InputSystem.cs Normal file
View File

@ -0,0 +1,19 @@
using Elisa.Commands;
namespace Elisa;
public static class InputSystem
{
public static void Start()
{
while (true)
{
string? command = Console.ReadLine();
if (string.IsNullOrEmpty(command))
continue;
CommandHandlerFactory.HandleCommand(command);
}
}
}

View File

@ -1,6 +1,6 @@
using Elisa.Common.Models;
using Elisa.Models;
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class GetAllBonusRequest
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class ChessGashaDrawRequest
{

View File

@ -1,6 +1,6 @@
using Elisa.Common.Models;
using Elisa.Models;
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class ChipEnhanceRequest
{

View File

@ -1,6 +1,6 @@
using Elisa.Common.Models;
using Elisa.Models;
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class EquipDevelopMultiRequest
{

View File

@ -1,6 +1,6 @@
using Elisa.Common.Models;
using Elisa.Models;
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class ChangeSkinRequest
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class AdjustRequest
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class BikiniVoteResultResponse
{

View File

@ -1,6 +1,6 @@
using Elisa.Common.Models;
using Elisa.Models;
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class GetAdaptiveTeamResponse
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class FairySkillUpgradeRequest
{

1
Elisa/Messages/Favor.cs Normal file
View File

@ -0,0 +1 @@
namespace Elisa.Messages;

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class ReadStoryRequest
{

View File

@ -1,6 +1,6 @@
using Elisa.Common.Models;
using Elisa.Models;
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class TeamGunsResponse
{

1
Elisa/Messages/Guide.cs Normal file
View File

@ -0,0 +1 @@
namespace Elisa.Messages;

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class GunCombineGunRequest
{

View File

@ -1,6 +1,6 @@
using Elisa.Common.Models;
using Elisa.Models;
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class ChangeAdjutantRequest
{

View File

@ -1,6 +1,6 @@
using Elisa.Common.Models;
using Elisa.Models;
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class IndexRequest
{

1
Elisa/Messages/Item.cs Normal file
View File

@ -0,0 +1 @@
namespace Elisa.Messages;

View File

@ -1,6 +1,5 @@
using Elisa.Common.Models;
namespace Elisa.Common.Messages;
using Elisa.Models;
namespace Elisa.Messages;
public class GetResourceInMailQuickRequest
{

View File

@ -1,6 +1,6 @@
using Elisa.Common.Models;
using Elisa.Models;
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class AbortMissionResponse
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class AbortOperationRequest
{

View File

@ -1,6 +1,6 @@
using Elisa.Common.Models;
using Elisa.Models;
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class EstablishBuildFinishRequest
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class GetEventPrizeRequest
{

View File

@ -1,6 +1,6 @@
using Elisa.Common.Models;
using Elisa.Models;
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class AccomplishAllQuestsResponse
{

View File

@ -1,6 +1,6 @@
using Elisa.Common.Models;
using Elisa.Models;
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class GetRankRequest
{

View File

@ -1,6 +1,6 @@
using Elisa.Common.Models;
using Elisa.Models;
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class SangvisAdvanceRequest
{

View File

@ -1,6 +1,6 @@
using Elisa.Common.Models;
using Elisa.Models;
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class GameSettingRequest
{

View File

@ -1,6 +1,6 @@
using Elisa.Common.Models;
using Elisa.Models;
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class AddSquadProgressRequest
{

View File

@ -1,6 +1,6 @@
using Elisa.Common.Models;
using Elisa.Models;
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class TheaterDataRequest
{

1
Elisa/Messages/User.cs Normal file
View File

@ -0,0 +1 @@
namespace Elisa.Messages;

View File

@ -1,6 +1,6 @@
using Elisa.Common.Models;
using Elisa.Models;
namespace Elisa.Common.Messages;
namespace Elisa.Messages;
public class VehicleUnlockResponse
{

View File

@ -0,0 +1 @@
namespace Elisa.Models;

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
public class ChessInfo
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
// TODO: check
public class Chip

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
public class DataAnalysisAct
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
public class DorFurniture
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
// TODO: check
public class Equip

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
public class EventInfo
{

View File

@ -1,6 +1,6 @@
using Elisa.Common.Messages;
using Elisa.Messages;
namespace Elisa.Common.Models;
namespace Elisa.Models;
public class ExploreAct
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
// TODO: check
public class Fairy

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
public class AllFavorupGun
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
public class FetterBounty
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
public class FriendAct
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
public class Guide
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
public class FixAct
{

1
Elisa/Models/Home.cs Normal file
View File

@ -0,0 +1 @@
namespace Elisa.Models;

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
public class Index
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
// TODO: check
public class CommanderUniform

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
public class IndexMail
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
public class Airbone
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
public class OperationAct
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
public class OuthouseFurniture
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
public class AddEquip
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
public class AccomplishQuestList
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
public class RankUserInfo
{

View File

@ -1,4 +1,4 @@
namespace Elisa.Common.Models;
namespace Elisa.Models;
// tODO: check
public class Sangvis

Some files were not shown because too many files have changed in this diff Show More