Reorganization, betterer asp.net things, new proxy, other stuff

This commit is contained in:
Kyle873 2024-05-27 08:29:01 -04:00
parent ad219b095c
commit febd87782d
116 changed files with 557 additions and 351 deletions

View File

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

View File

@ -1,10 +1,10 @@
using Elisa.Data.Tables; using Elisa.Common.Data.Tables;
using Serilog; using Serilog;
using System.Collections; using System.Collections;
using System.Reflection; using System.Reflection;
using System.Text.Json; using System.Text.Json;
namespace Elisa.Data; namespace Elisa.Common.Data;
public enum LoadDataType public enum LoadDataType
{ {
@ -33,7 +33,7 @@ public static class Table
[LoadData("daily.json", LoadDataType.STC)] [LoadData("daily.json", LoadDataType.STC)]
public static List<Daily> daily { get; private set; } = null!; public static List<Daily> daily { get; private set; } = null!;
[LoadData("equip.json", LoadDataType.STC)] [LoadData("equip.json", LoadDataType.STC)]
public static List<Equip> equip { get; private set; } = null!; public static List<Equip> equip { get; private set; } = null!;
@ -45,7 +45,7 @@ public static class Table
[LoadData("gift_item.json", LoadDataType.STC)] [LoadData("gift_item.json", LoadDataType.STC)]
public static List<GiftItem> gift_item { get; private set; } = null!; public static List<GiftItem> gift_item { get; private set; } = null!;
[LoadData("gun.json", LoadDataType.STC)] [LoadData("gun.json", LoadDataType.STC)]
public static List<Gun> gun { get; private set; } = null!; public static List<Gun> gun { get; private set; } = null!;
@ -57,7 +57,7 @@ public static class Table
[LoadData("present.json", LoadDataType.STC)] [LoadData("present.json", LoadDataType.STC)]
public static List<Present> present { get; private set; } = null!; public static List<Present> present { get; private set; } = null!;
[LoadData("prize.json", LoadDataType.STC)] [LoadData("prize.json", LoadDataType.STC)]
public static List<Prize> prize { get; private set; } = null!; public static List<Prize> prize { get; private set; } = null!;
@ -66,13 +66,13 @@ public static class Table
[LoadData("skin.json", LoadDataType.STC)] [LoadData("skin.json", LoadDataType.STC)]
public static List<Skin> skin { get; private set; } = null!; public static List<Skin> skin { get; private set; } = null!;
[LoadData("spot.json", LoadDataType.STC)] [LoadData("spot.json", LoadDataType.STC)]
public static List<Spot> spot { get; private set; } = null!; public static List<Spot> spot { get; private set; } = null!;
[LoadData("squad.json", LoadDataType.STC)] [LoadData("squad.json", LoadDataType.STC)]
public static List<Squad> squad { get; private set; } = null!; public static List<Squad> squad { get; private set; } = null!;
[LoadData("vehicle.json", LoadDataType.STC)] [LoadData("vehicle.json", LoadDataType.STC)]
public static List<Vehicle> vehicle { get; private set; } = null!; public static List<Vehicle> vehicle { get; private set; } = null!;
@ -81,7 +81,7 @@ public static class Table
[LoadData("weekly.json", LoadDataType.STC)] [LoadData("weekly.json", LoadDataType.STC)]
public static List<Weekly> weekly { get; private set; } = null!; public static List<Weekly> weekly { get; private set; } = null!;
#endregion #endregion
public static void Load() public static void Load()

View File

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

View File

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

View File

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

View File

@ -0,0 +1,18 @@
<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,6 +1,6 @@
using Elisa.Models; using Elisa.Common.Models;
namespace Elisa.Messages; namespace Elisa.Common.Messages;
public class GetAllBonusRequest public class GetAllBonusRequest
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@ using System.IO.Compression;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
namespace Elisa.Utils; namespace Elisa.Common.Utils;
public static class Crypto public static class Crypto
{ {
@ -15,7 +15,7 @@ public static class Crypto
if (string.IsNullOrEmpty(body) || string.IsNullOrEmpty(key)) if (string.IsNullOrEmpty(body) || string.IsNullOrEmpty(key))
return string.Empty; return string.Empty;
if (body.Length == 1 || body.StartsWith("error:") || (body.StartsWith("{") && body.EndsWith("}"))) if (body.Length == 1 || body.StartsWith("error:") || body.StartsWith("{") && body.EndsWith("}"))
return body; return body;
try try
@ -27,13 +27,13 @@ public static class Crypto
{ {
body = body.Substring(1); body = body.Substring(1);
return GZipDecompress(RC4(ConvertFromBase64String(body), pwd).Skip(26).ToArray<byte>()); return GZipDecompress(RC4(ConvertFromBase64String(body), pwd).Skip(26).ToArray());
} }
byte[] bytes = RC4(ConvertFromBase64String(body), pwd); byte[] bytes = RC4(ConvertFromBase64String(body), pwd);
string @string = Encoding.UTF8.GetString(bytes); string @string = Encoding.UTF8.GetString(bytes);
return (@string.Length > 26) ? @string.Substring(26) : string.Empty; return @string.Length > 26 ? @string.Substring(26) : string.Empty;
} }
catch catch
{ {
@ -52,7 +52,7 @@ public static class Crypto
string text2 = MD5(text.Substring(16, 16)); string text2 = MD5(text.Substring(16, 16));
string pwd = text2 + MD5(text2); string pwd = text2 + MD5(text2);
byte[] bytes = Encoding.UTF8.GetBytes(string.Format("{0}", Math.Round(GetCurrentSec()) + 3600.0)); 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); string s2 = MD5(array.Concat(Encoding.UTF8.GetBytes(s)).ToArray()).Substring(0, 16);
byte[] array2 = new byte[array.Length + 26]; byte[] array2 = new byte[array.Length + 26];
Array.Copy(bytes, 0, array2, 0, bytes.Length); Array.Copy(bytes, 0, array2, 0, bytes.Length);
@ -134,11 +134,11 @@ public static class Crypto
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
{ {
array[i] = (int)pwd[i % pwd.Length]; array[i] = pwd[i % pwd.Length];
array2[i] = i; array2[i] = i;
} }
for (i = (num = 0); i < 256; i++) for (i = num = 0; i < 256; i++)
{ {
int num2 = array2[i]; int num2 = array2[i];
@ -148,7 +148,7 @@ public static class Crypto
} }
int num3; int num3;
num = (num3 = (i = 0)); num = num3 = i = 0;
while (i < data.Length) while (i < data.Length)
{ {
@ -162,7 +162,7 @@ public static class Crypto
array2[num] = num2; array2[num] = num2;
int num4 = array2[(array2[num3] + array2[num]) % 256]; int num4 = array2[(array2[num3] + array2[num]) % 256];
array3[i] = (byte)((int)data[i] ^ num4); array3[i] = (byte)(data[i] ^ num4);
i++; i++;
} }

View File

@ -1,4 +1,4 @@
namespace Elisa.Utils; namespace Elisa.Common.Utils;
public static class RNG public static class RNG
{ {
@ -14,7 +14,7 @@ public static class RNG
{ {
double range = (double)max - min; double range = (double)max - min;
double sample = random.NextDouble(); double sample = random.NextDouble();
double scaled = (sample * range) + min; double scaled = sample * range + min;
return (float)scaled; return (float)scaled;
} }

View File

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

View File

@ -1,4 +1,4 @@
namespace Elisa.Utils; namespace Elisa.Common.Utils;
public static class Time public static class Time
{ {
@ -12,7 +12,7 @@ public static class Time
=> new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1, 0, 0, 0, DateTimeKind.Utc).AddMonths(1).ToUnixSeconds(); => new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1, 0, 0, 0, DateTimeKind.Utc).AddMonths(1).ToUnixSeconds();
} }
internal static class DateTimeExtensions public static class DateTimeExtensions
{ {
public static long ToUnixSeconds(this DateTime dateTime) public static long ToUnixSeconds(this DateTime dateTime)
=> (long)(dateTime - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds; => (long)(dateTime - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds;

View File

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

View File

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

View File

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

View File

@ -0,0 +1,17 @@
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

@ -0,0 +1,47 @@
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()
{
return Results.Text(System.IO.File.ReadAllText(@"Resources\serverList.xml"));
}
[HttpGet("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"
});
}
[HttpGet("image/imageconfig.txt", Name = "ImageConfig")]
public async Task<IResult> ImageConfig()
{
return Results.Text(System.IO.File.ReadAllText(@"Resources\image\ImageConfig.txt"));
}
/*
[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,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
@ -12,12 +12,21 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Update="appsettings.Development.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="appsettings.json"> <None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Update="Resources\serverList.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\catchdata\*.json"> <None Update="Resources\catchdata\*.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Update="Resources\image\*.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\stc\*.json"> <None Update="Resources\stc\*.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
@ -29,10 +38,15 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Serilog" Version="3.1.1" /> <PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.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.Console" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" /> <PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="SharpZipLib" Version="1.4.2" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
<PackageReference Include="System.Text.Json" Version="8.0.3" /> <PackageReference Include="Titanium.Web.Proxy" Version="3.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Elisa.Common\Elisa.Common.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,54 @@
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 = "d630eea53a1b869fa4d7d1479a3d09e7";
public static string ABVersion = 2024051417.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

@ -0,0 +1,40 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:3505",
"sslPort": 44376
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"launchUrl": "swagger",
"applicationUrl": "http://127.0.0.1",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7010;http://localhost:5208",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@ -0,0 +1,55 @@
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.cn).*");
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;
}
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)
{
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
}
}
}

View File

@ -0,0 +1,11 @@
//类型名|是否会保存到本地|资源名
//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

@ -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 @@
namespace Elisa.GameServer.Services;
public class ProxyBackgroundService : BackgroundService
{
readonly ProxyControl proxyControl;
public ProxyBackgroundService(string forwardIpAddress)
{
proxyControl = new ProxyControl(forwardIpAddress);
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
proxyControl.Start();
stoppingToken.Register(() => proxyControl.Stop());
while (!stoppingToken.IsCancellationRequested)
await Task.Delay(1000, stoppingToken);
}
public override async Task StopAsync(CancellationToken stoppingToken)
{
await base.StopAsync(stoppingToken);
}
}

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