Merge pull request #196 from Mateleo/community

Fix project not compiling
This commit is contained in:
Enthusiast 2025-09-27 23:04:44 -03:00 committed by GitHub
commit 9bfeb96e4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 2527 additions and 23 deletions

3
.gitignore vendored
View File

@ -375,3 +375,6 @@ db/pgadmin/*
/src/DiIiS-NA/database.Worlds.config
/src/DiIiS-NA/database.Account.Debug.config
/src/DiIiS-NA/database.Worlds.Debug.config
# Generated config.mods.json
config.mods.json

24
Dockerfile Normal file
View File

@ -0,0 +1,24 @@
# Use the official .NET SDK image to build the application
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /app
# Copy the project file and restore dependencies
COPY ["src/DiIiS-NA/Blizzless.csproj", "src/DiIiS-NA/"]
RUN dotnet restore "src/DiIiS-NA/Blizzless.csproj"
# Copy the rest of the project files and build the application
COPY ["src/", "src/"]
WORKDIR "/app/src/DiIiS-NA"
RUN dotnet publish "Blizzless.csproj" -c Release --runtime linux-x64 --self-contained true -o /app/publish
# Use the official .NET runtime image to run the application
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS runtime
WORKDIR /app
# Copy the published application from the build stage
COPY --from=build /app/publish .
# Expose the port your application is running on (if needed)
EXPOSE 1345 1119 83 2001 9800 9100
# Start the application
ENTRYPOINT ["./Blizzless"]

2423
db_old/initdb/dump.sql Normal file

File diff suppressed because it is too large Load Diff

40
docker-compose.yml Normal file
View File

@ -0,0 +1,40 @@
services:
diiis-na-server:
build:
context: .
dockerfile: Dockerfile
container_name: diiis-na-server
volumes:
- ./src/DiIiS-NA/config.ini:/app/config.ini
ports:
- 83:83
- 1119:1119
- 1345:1345
- 2001:2001
- 9800:9800
- 9100:9100
depends_on:
db:
condition: service_healthy
db:
image: postgres:17
container_name: diiis-na-db
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=diablo
ports:
- 5432:5432
volumes:
- db-data:/var/lib/postgresql/data
- ./db/initdb:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
volumes:
db-data:

View File

@ -355,19 +355,12 @@ namespace DiIiS_NA.LoginServer.Base
private static string GetWebSocketLocation(IChannelPipeline cp, IHttpRequest req, string path)
{
string str = "ws";
if (cp.Get<TlsHandler>() != null)
{
str = "wss";
}
string protocol = cp.Get<TlsHandler>() != null ? "wss" : "ws";
string str2 = null;
if (req.Headers.TryGet(HttpHeaderNames.Host, out ICharSequence value))
{
str2 = value.ToString();
}
// Ignore the Host header and default to a placeholder or IP address
string host = "192.168.1.100"; // Replace with your desired default host, e.g., the server's IP or DNS.
return str + "://" + str2 + path;
return $"{protocol}://{host}{path}";
}
}
}

View File

@ -73,9 +73,11 @@ namespace DiIiS_NA.LoginServer.Battle
switch (message[0])
{
case "rngsr":
Logger.Info("test");
if (GameServers.ContainsKey(ipPort)) GameServers.Remove(ipPort);
string rgsIp = args[0];
int rgsPort = int.Parse(args[1].Trim());
Logger.Info("Range IP {0}:{1}", rgsIp, rgsPort);
GameServers.Add(ipPort, new ServerDescriptor { GameIp = rgsIp, GamePort = rgsPort });
Logger.Info("Game server was registered for Blizzless {0}:{1}.", rgsIp, rgsPort);
break;

View File

@ -894,7 +894,7 @@ namespace DiIiS_NA.LoginServer.Toons
.SetSnoQuest(273408))
;
#else
foreach (var inv in _dbQuests)
foreach (var inv in dbQuests)
{
// load quests
var quest = D3.Hero.QuestHistoryEntry.CreateBuilder()

View File

@ -11,6 +11,7 @@
<StartupObject>DiIiS_NA.Program</StartupObject>
<DebugType>full</DebugType>
<Configurations>Debug;Release;github</Configurations>
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@ -74,8 +74,11 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
string backEndIp = GameServerConfig.Instance.BindIP;
int backEndPort = GameServerConfig.Instance.Port;
bool pvp = false;
if (!pvp)
Logger.Info("We are here");
if (!pvp){
Logger.Info("Ip: {0}|{1}", backEndIp, backEndPort);
RegisterGameServer(backEndIp, backEndPort);
}
else
RegisterPvPGameServer(backEndIp, backEndPort);
return true;

View File

@ -36,6 +36,7 @@ using DiIiS_NA.Core.Extensions;
using DiIiS_NA.D3_GameServer;
using Spectre.Console;
using Environment = System.Environment;
using FluentNHibernate.Utils;
namespace DiIiS_NA
{
@ -110,8 +111,8 @@ namespace DiIiS_NA
_diabloCoreEnabled = true;
Logger.Info("Forcing Diablo III Core to be $[green]$enabled$[/]$ on debug mode.");
#else
if (!DiabloCoreEnabled)
Logger.Warning("Diablo III Core is $[red]$disabled$[/]$.");
if (!_diabloCoreEnabled)
Logger.Warn("Diablo III Core is $[red]$disabled$[/]$.");
#endif
var mod = GameModsConfig.Instance;
#pragma warning disable CS4014
@ -255,27 +256,35 @@ namespace DiIiS_NA
IChannel boundChannel = await serverBootstrap.BindAsync(loginConfig.Port);
Logger.Info("$[bold deeppink4]$Gracefully$[/]$ shutdown with $[red3_1]$CTRL+C$[/]$ or $[deeppink4]$!q[uit]$[/]$.");
Logger.Info("{0}", IsCancellationRequested());
while (!IsCancellationRequested())
{
var line = Console.ReadLine();
if (line is null or "!q" or "!quit" or "!exit")
if(line == null){
continue;
}
if (line == "!q" || line == "!quit" || line == "!exit")
{
Logger.Info("Break !quit");
break;
}
if (line is "!cls" or "!clear" or "cls" or "clear")
if (line == "!cls" || line == "!clear" || line == "cls" || line == "clear")
{
AnsiConsole.Clear();
AnsiConsole.Cursor.SetPosition(0, 0);
continue;
}
if (line.ToLower().StartsWith("!sno"))
if (line.StartsWith("!sno", StringComparison.OrdinalIgnoreCase))
{
if (IsTargetEnabled("ansi"))
Console.Clear();
MPQStorage.Data.SnoBreakdown(line.ToLower().Equals("!sno 1") ||
line.ToLower().Equals("!sno true"));
MPQStorage.Data.SnoBreakdown(
line.Equals("!sno 1", StringComparison.OrdinalIgnoreCase) ||
line.Equals("!sno true", StringComparison.OrdinalIgnoreCase)
);
continue;
}
@ -296,10 +305,12 @@ namespace DiIiS_NA
}
catch (Exception e)
{
Logger.Info(e.ToString());
Shutdown(e);
}
finally
{
Logger.Trace("Shutdown in progress !");
await Task.WhenAll(
boss.ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(1)),
worker.ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(1)));
@ -308,7 +319,10 @@ namespace DiIiS_NA
private static bool _shuttingDown = false;
public static void Shutdown(Exception exception = null)
{
Logger.Trace("Shutdown here");
Logger.Trace("Stack trace at shutdown: " + Environment.StackTrace); // Log the stack trace
if (_shuttingDown) return;
_shuttingDown = true;
if (!IsCancellationRequested())
@ -425,6 +439,7 @@ namespace DiIiS_NA
Logger.Trace("Discord bot Disabled..");
}
DiIiS_NA.GameServer.GSSystem.GeneratorsSystem.SpawnGenerator.RegenerateDensity();
Logger.Trace("We are here first");
DiIiS_NA.GameServer.ClientSystem.GameServer.GSBackend = new GsBackend(LoginServerConfig.Instance.BindIP, LoginServerConfig.Instance.WebPort);
}

View File

@ -38,7 +38,7 @@ MotdRemoteUrl = https://your-site.local/yourmotd
IP = 127.0.0.1
PublicIP = 127.0.0.1
PORT = 83
Public = true
Public = false
; Game Server Settings
[Game-Server]

View File

@ -8,7 +8,7 @@
<property name="use_proxy_validator">true</property>
<property name="command_timeout">0</property>
<property name="connection.connection_string">
Server=localhost;Database=diiis;User ID=postgres;Password=password
Server=diiis-na-db;Database=diiis;User ID=postgres;Password=postgres
</property>
<property name="connection.release_mode">on_close</property>
<property name="adonet.batch_size">0</property>

View File

@ -7,7 +7,7 @@
<property name="use_proxy_validator">true</property>
<property name="command_timeout">0</property>
<property name="connection.connection_string">
Server=localhost;Database=worlds;User ID=postgres;Password=password
Server=diiis-na-db;Database=worlds;User ID=postgres;Password=postgres
</property>
<property name="connection.release_mode">on_close</property>
<property name="adonet.batch_size">0</property>