refactor: remove testing code
All checks were successful
Build, Package and Push Images / preprocess (push) Successful in 4s
Build, Package and Push Images / docs (push) Successful in 47s
Build, Package and Push Images / build (push) Successful in 46s
Build, Package and Push Images / sonarqube (push) Has been skipped
Build, Package and Push Images / sbom-scan (push) Successful in 1m1s
Build, Package and Push Images / build-docs-container (push) Successful in 1m40s
Build, Package and Push Images / deploy-wiki (push) Successful in 4s
Build, Package and Push Images / container-build (push) Successful in 2m31s
Build, Package and Push Images / container-sbom-scan (push) Successful in 42s
All checks were successful
Build, Package and Push Images / preprocess (push) Successful in 4s
Build, Package and Push Images / docs (push) Successful in 47s
Build, Package and Push Images / build (push) Successful in 46s
Build, Package and Push Images / sonarqube (push) Has been skipped
Build, Package and Push Images / sbom-scan (push) Successful in 1m1s
Build, Package and Push Images / build-docs-container (push) Successful in 1m40s
Build, Package and Push Images / deploy-wiki (push) Successful in 4s
Build, Package and Push Images / container-build (push) Successful in 2m31s
Build, Package and Push Images / container-sbom-scan (push) Successful in 42s
This commit is contained in:
parent
a11675df45
commit
b68e058429
1 changed files with 16 additions and 103 deletions
|
@ -1,6 +1,5 @@
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Server.DB.Documents;
|
using Server.DB.Documents;
|
||||||
using Wonderking.Game.Data.Character;
|
|
||||||
using Wonderking.Packets.Incoming;
|
using Wonderking.Packets.Incoming;
|
||||||
using Wonderking.Packets.Outgoing;
|
using Wonderking.Packets.Outgoing;
|
||||||
using Wonderking.Packets.Outgoing.Data;
|
using Wonderking.Packets.Outgoing.Data;
|
||||||
|
@ -34,19 +33,19 @@ public class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPacket>
|
||||||
{
|
{
|
||||||
var authSession = (AuthSession)session;
|
var authSession = (AuthSession)session;
|
||||||
ChannelSelectionResponsePacket responsePacket;
|
ChannelSelectionResponsePacket responsePacket;
|
||||||
CharacterSelectionSetGuildNamePacket guildNameResponsePacket;
|
var guildNameResponsePacket = new CharacterSelectionSetGuildNamePacket { GuildNames = Array.Empty<string>() };
|
||||||
|
|
||||||
var hasCharacters = this._wonderkingContext.Accounts.Include(account => account.Characters)
|
var hasCharacters = this._wonderkingContext.Accounts.Include(account => account.Characters)
|
||||||
.FirstOrDefault(a => a.Id == authSession.AccountId)?.Characters.Count > 0;
|
.FirstOrDefault(a => a.Id == authSession.AccountId)?.Characters.Count > 0;
|
||||||
var testingChars = false;
|
if (hasCharacters)
|
||||||
if (hasCharacters && !testingChars)
|
|
||||||
{
|
{
|
||||||
responsePacket = new ChannelSelectionResponsePacket
|
responsePacket = new ChannelSelectionResponsePacket
|
||||||
{
|
{
|
||||||
ChannelIsFullFlag = 0,
|
ChannelIsFullFlag = 0,
|
||||||
Endpoint = "127.0.0.1",
|
Endpoint = "127.0.0.1",
|
||||||
Port = 12345,
|
Port = 12345,
|
||||||
Characters = this._wonderkingContext.Characters.AsNoTracking().Where(c => c.Account.Id == authSession.AccountId)
|
Characters = this._wonderkingContext.Characters.AsNoTracking()
|
||||||
|
.Where(c => c.Account.Id == authSession.AccountId)
|
||||||
.Select(c =>
|
.Select(c =>
|
||||||
new CharacterData
|
new CharacterData
|
||||||
{
|
{
|
||||||
|
@ -54,7 +53,8 @@ public class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPacket>
|
||||||
Job = c.JobData,
|
Job = c.JobData,
|
||||||
Gender = c.Gender,
|
Gender = c.Gender,
|
||||||
Level = c.Level,
|
Level = c.Level,
|
||||||
Experience = 0,
|
// TODO: Calculate instead of clamping based on max experience for level
|
||||||
|
Experience = Math.Clamp(c.Experience, 0, 100),
|
||||||
Stats = c.BaseStats,
|
Stats = c.BaseStats,
|
||||||
Health = c.Health,
|
Health = c.Health,
|
||||||
Mana = c.Mana,
|
Mana = c.Mana,
|
||||||
|
@ -65,116 +65,29 @@ public class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPacket>
|
||||||
EquippedCashItems = c.InventoryItems
|
EquippedCashItems = c.InventoryItems
|
||||||
.Where(item => item.InventoryTab == InventoryTab.WornCashEquipment)
|
.Where(item => item.InventoryTab == InventoryTab.WornCashEquipment)
|
||||||
.Select(item => item.ItemId)
|
.Select(item => item.ItemId)
|
||||||
.ToArray(),
|
.ToArray()
|
||||||
})
|
})
|
||||||
.ToArray(),
|
.ToArray(),
|
||||||
};
|
};
|
||||||
|
|
||||||
guildNameResponsePacket = new CharacterSelectionSetGuildNamePacket
|
guildNameResponsePacket.GuildNames = this._wonderkingContext.Characters
|
||||||
{
|
.Where(c => c.Account.Id == authSession.AccountId)
|
||||||
GuildNames = this._wonderkingContext.Characters.Where(c => c.Account.Id == authSession.AccountId)
|
.Select(character => character.Guild.Name).ToArray();
|
||||||
.Select(character => character.Guild.Name).ToArray()
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
responsePacket = testingChars
|
responsePacket = new ChannelSelectionResponsePacket
|
||||||
? CreateTestChannelSelectionResponsePacket()
|
|
||||||
: new ChannelSelectionResponsePacket
|
|
||||||
{
|
|
||||||
ChannelIsFullFlag = 0,
|
|
||||||
Endpoint = "127.0.0.1",
|
|
||||||
Port = 12345,
|
|
||||||
Characters = Array.Empty<CharacterData>()
|
|
||||||
};
|
|
||||||
guildNameResponsePacket = new CharacterSelectionSetGuildNamePacket
|
|
||||||
{
|
{
|
||||||
GuildNames = new[] { "ABCDEFGHIJKLMNOP", "QRSTUVWXYZ123456", "A Guild Name For" }
|
ChannelIsFullFlag = 0,
|
||||||
|
Endpoint = "127.0.0.1",
|
||||||
|
Port = 12345,
|
||||||
|
Characters = Array.Empty<CharacterData>()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
authSession.Send(responsePacket);
|
authSession.Send(responsePacket);
|
||||||
if (guildNameResponsePacket.GuildNames.Length > 0)
|
authSession.Send(guildNameResponsePacket);
|
||||||
{
|
|
||||||
authSession.Send(guildNameResponsePacket);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ChannelSelectionResponsePacket CreateTestChannelSelectionResponsePacket()
|
|
||||||
{
|
|
||||||
return new ChannelSelectionResponsePacket
|
|
||||||
{
|
|
||||||
ChannelIsFullFlag = 0,
|
|
||||||
Endpoint = "127.0.0.1",
|
|
||||||
Port = 12345,
|
|
||||||
Characters = new[]
|
|
||||||
{
|
|
||||||
new CharacterData
|
|
||||||
{
|
|
||||||
Name = "1",
|
|
||||||
Job = new JobData { FirstJob = 1, SecondJob = 0, ThirdJob = 0, FourthJob = 0 },
|
|
||||||
Gender = Gender.Female,
|
|
||||||
Level = ushort.MaxValue - 1,
|
|
||||||
Experience = 255,
|
|
||||||
Stats = new BaseStats
|
|
||||||
{
|
|
||||||
Strength = 5,
|
|
||||||
Dexterity = 5,
|
|
||||||
Intelligence = 5,
|
|
||||||
Vitality = 5,
|
|
||||||
Luck = 5,
|
|
||||||
Wisdom = 5
|
|
||||||
},
|
|
||||||
Health = int.MaxValue - 1,
|
|
||||||
Mana = int.MaxValue - 1,
|
|
||||||
EquippedItems = Enumerable.Repeat((ushort)25, 20).ToArray(),
|
|
||||||
EquippedCashItems = Enumerable.Repeat((ushort)70, 20).ToArray()
|
|
||||||
},
|
|
||||||
new CharacterData
|
|
||||||
{
|
|
||||||
Name = "2",
|
|
||||||
Job = new JobData { FirstJob = 1, SecondJob = 0, ThirdJob = 0, FourthJob = 0 },
|
|
||||||
Gender = Gender.Female,
|
|
||||||
Level = ushort.MaxValue - 1,
|
|
||||||
Experience = 255,
|
|
||||||
Stats = new BaseStats
|
|
||||||
{
|
|
||||||
Strength = 5,
|
|
||||||
Dexterity = 5,
|
|
||||||
Intelligence = 5,
|
|
||||||
Vitality = 5,
|
|
||||||
Luck = 5,
|
|
||||||
Wisdom = 5
|
|
||||||
},
|
|
||||||
Health = int.MaxValue - 1,
|
|
||||||
Mana = int.MaxValue - 1,
|
|
||||||
EquippedItems = Enumerable.Repeat((ushort)35, 20).ToArray(),
|
|
||||||
EquippedCashItems = Enumerable.Repeat((ushort)55, 20).ToArray()
|
|
||||||
},
|
|
||||||
new CharacterData
|
|
||||||
{
|
|
||||||
Name = "3",
|
|
||||||
Job = new JobData { FirstJob = 1, SecondJob = 0, ThirdJob = 0, FourthJob = 0 },
|
|
||||||
Gender = Gender.Female,
|
|
||||||
Level = ushort.MaxValue - 1,
|
|
||||||
Experience = 255,
|
|
||||||
Stats = new BaseStats
|
|
||||||
{
|
|
||||||
Strength = 5,
|
|
||||||
Dexterity = 5,
|
|
||||||
Intelligence = 5,
|
|
||||||
Vitality = 5,
|
|
||||||
Luck = 5,
|
|
||||||
Wisdom = 5
|
|
||||||
},
|
|
||||||
Health = int.MaxValue - 1,
|
|
||||||
Mana = int.MaxValue - 1,
|
|
||||||
EquippedItems = Enumerable.Repeat((ushort)45, 20).ToArray(),
|
|
||||||
EquippedCashItems = Enumerable.Repeat((ushort)65, 20).ToArray()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue