chore: I don't know right now
All checks were successful
Build, Package and Push Images / preprocess (push) Successful in 2s
Build, Package and Push Images / build (push) Successful in 25s
Build, Package and Push Images / sonarqube (push) Has been skipped
Build, Package and Push Images / sbom-scan (push) Successful in 32s
Build, Package and Push Images / container-build (push) Successful in 1m23s
Build, Package and Push Images / container-sbom-scan (push) Successful in 37s
All checks were successful
Build, Package and Push Images / preprocess (push) Successful in 2s
Build, Package and Push Images / build (push) Successful in 25s
Build, Package and Push Images / sonarqube (push) Has been skipped
Build, Package and Push Images / sbom-scan (push) Successful in 32s
Build, Package and Push Images / container-build (push) Successful in 1m23s
Build, Package and Push Images / container-sbom-scan (push) Successful in 37s
This commit is contained in:
parent
4b7f0b6f00
commit
0077d380f3
6 changed files with 21 additions and 15 deletions
|
@ -62,7 +62,7 @@ public class CharacterCreationHandler : IPacketHandler<CharacterCreationPacket>
|
||||||
|
|
||||||
var calculateCurrentMana = CalculateCurrentMana(1, firstJobConfig);
|
var calculateCurrentMana = CalculateCurrentMana(1, firstJobConfig);
|
||||||
var calculateCurrentHealth = CalculateCurrentHealth(1, firstJobConfig);
|
var calculateCurrentHealth = CalculateCurrentHealth(1, firstJobConfig);
|
||||||
account?.Characters.Add(new Character
|
var toBeAddedCharacter = new Character
|
||||||
{
|
{
|
||||||
Account = account,
|
Account = account,
|
||||||
MapId = 300,
|
MapId = 300,
|
||||||
|
@ -78,7 +78,8 @@ public class CharacterCreationHandler : IPacketHandler<CharacterCreationPacket>
|
||||||
JobData = new JobData { FirstJob = packet.FirstJob, SecondJob = 0, ThirdJob = 0, FourthJob = 0 },
|
JobData = new JobData { FirstJob = packet.FirstJob, SecondJob = 0, ThirdJob = 0, FourthJob = 0 },
|
||||||
Health = calculateCurrentHealth,
|
Health = calculateCurrentHealth,
|
||||||
Mana = calculateCurrentMana
|
Mana = calculateCurrentMana
|
||||||
});
|
};
|
||||||
|
account?.Characters.Add(toBeAddedCharacter);
|
||||||
await _wonderkingContext.SaveChangesAsync().ConfigureAwait(true);
|
await _wonderkingContext.SaveChangesAsync().ConfigureAwait(true);
|
||||||
|
|
||||||
var amountOfCharacters = await _wonderkingContext.Characters.AsNoTrackingWithIdentityResolution()
|
var amountOfCharacters = await _wonderkingContext.Characters.AsNoTrackingWithIdentityResolution()
|
||||||
|
|
|
@ -18,15 +18,16 @@ public class CharacterDeletionHandler : IPacketHandler<CharacterDeletePacket>
|
||||||
public async Task HandleAsync(CharacterDeletePacket packet, TcpSession session)
|
public async Task HandleAsync(CharacterDeletePacket packet, TcpSession session)
|
||||||
{
|
{
|
||||||
using var authSession = session as AuthSession;
|
using var authSession = session as AuthSession;
|
||||||
var response = new CharacterDeleteResponsePacket { Response = CharacterDeletionResponse.MakeClientStuck };
|
|
||||||
if (authSession == null)
|
if (authSession == null)
|
||||||
{
|
{
|
||||||
|
session.Disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var character = await _wonderkingContext.Characters.FirstOrDefaultAsync(x => x.Name == packet.Name &&
|
var character = await _wonderkingContext.Characters.FirstOrDefaultAsync(x => x.Name == packet.Name &&
|
||||||
x.Account.Id == authSession.AccountId)
|
x.Account.Id == authSession.AccountId)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(true);
|
||||||
|
var response = new CharacterDeleteResponsePacket { IsDeleted = 0 };
|
||||||
if (character == null)
|
if (character == null)
|
||||||
{
|
{
|
||||||
authSession.Send(response);
|
authSession.Send(response);
|
||||||
|
@ -35,7 +36,6 @@ public class CharacterDeletionHandler : IPacketHandler<CharacterDeletePacket>
|
||||||
|
|
||||||
_wonderkingContext.Characters.Remove(character);
|
_wonderkingContext.Characters.Remove(character);
|
||||||
await _wonderkingContext.SaveChangesAsync().ConfigureAwait(false);
|
await _wonderkingContext.SaveChangesAsync().ConfigureAwait(false);
|
||||||
response.Response = CharacterDeletionResponse.Ok;
|
|
||||||
|
|
||||||
authSession.Send(response);
|
authSession.Send(response);
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class LoginHandler : IPacketHandler<LoginInfoPacket>
|
||||||
var loginResponsePacket = new LoginResponsePacket
|
var loginResponsePacket = new LoginResponsePacket
|
||||||
{
|
{
|
||||||
ResponseReason = loginResponseReason,
|
ResponseReason = loginResponseReason,
|
||||||
ChannelData = new[] { new ServerChannelData { ChannelId = 0, LoadPercentage = 75, ServerId = 0 } },
|
ChannelData = new[] { new ServerChannelData { ChannelId = 0, LoadPercentage = 0, ServerId = 0 } },
|
||||||
UnknownFlag = 1,
|
UnknownFlag = 1,
|
||||||
IsGameMaster = true
|
IsGameMaster = true
|
||||||
};
|
};
|
||||||
|
|
|
@ -58,5 +58,17 @@ public class WonderkingAuthServer : TcpServer, IHostedService
|
||||||
base.OnStopped();
|
base.OnStopped();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnConnected(TcpSession session)
|
||||||
|
{
|
||||||
|
this._logger.LogInformation("Client connected {Session}", session.Id);
|
||||||
|
base.OnConnected(session);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDisconnected(TcpSession session)
|
||||||
|
{
|
||||||
|
this._logger.LogInformation("Client disconnected {Session}", session.Id);
|
||||||
|
base.OnDisconnected(session);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnError(SocketError error) => this._logger.LogError("An error has occured {Error}", error);
|
protected override void OnError(SocketError error) => this._logger.LogError("An error has occured {Error}", error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ namespace Wonderking.Packets.Outgoing;
|
||||||
[PacketId(OperationCode.CharacterDeletionResponse)]
|
[PacketId(OperationCode.CharacterDeletionResponse)]
|
||||||
public class CharacterDeleteResponsePacket : IPacket
|
public class CharacterDeleteResponsePacket : IPacket
|
||||||
{
|
{
|
||||||
public required CharacterDeletionResponse Response { get; set; }
|
public required byte IsDeleted { get; set; }
|
||||||
|
|
||||||
public void Deserialize(byte[] data)
|
public void Deserialize(byte[] data)
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ public class CharacterDeleteResponsePacket : IPacket
|
||||||
public byte[] Serialize()
|
public byte[] Serialize()
|
||||||
{
|
{
|
||||||
Span<byte> data = stackalloc byte[1];
|
Span<byte> data = stackalloc byte[1];
|
||||||
data[0] = (byte)Response;
|
data[0] = IsDeleted;
|
||||||
return data.ToArray();
|
return data.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
namespace Wonderking.Packets.Outgoing;
|
|
||||||
|
|
||||||
public enum CharacterDeletionResponse : byte
|
|
||||||
{
|
|
||||||
Ok = 0,
|
|
||||||
MakeClientStuck = 1,
|
|
||||||
}
|
|
Loading…
Reference in a new issue