feat: identical to item listing, stats not being calculated in its entirety
All checks were successful
Build, Package and Push Images / preprocess (push) Successful in 3s
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 40s
Build, Package and Push Images / container-build (push) Successful in 1m32s
Build, Package and Push Images / container-sbom-scan (push) Successful in 33s
All checks were successful
Build, Package and Push Images / preprocess (push) Successful in 3s
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 40s
Build, Package and Push Images / container-build (push) Successful in 1m32s
Build, Package and Push Images / container-sbom-scan (push) Successful in 33s
This commit is contained in:
parent
17a2a49cfd
commit
efdbad09d0
4 changed files with 44 additions and 29 deletions
|
@ -39,7 +39,7 @@ public class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPacket>
|
|||
{
|
||||
ChannelIsFullFlag = 0,
|
||||
Endpoint = "127.0.0.1",
|
||||
Port = 12345,
|
||||
Port = 2000,
|
||||
Characters = await _wonderkingContext.Characters.AsNoTracking()
|
||||
.Where(c => c.Account.Id == authSession.AccountId)
|
||||
.Select(c =>
|
||||
|
@ -54,20 +54,19 @@ public class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPacket>
|
|||
Stats = c.BaseStats,
|
||||
Health = c.Health,
|
||||
Mana = c.Mana,
|
||||
EquippedItems =
|
||||
c.InventoryItems.Where(item => item.InventoryTab == InventoryTab.WornEquipment)
|
||||
.Select(item => item.ItemId)
|
||||
.ToArray(),
|
||||
EquippedCashItems = c.InventoryItems
|
||||
EquippedItems = GetItemIDsByInventoryTab(c.InventoryItems
|
||||
.Where(item => item.InventoryTab == InventoryTab.WornEquipment)
|
||||
.Select(item => new Tuple<ushort, byte>(item.ItemId, item.Slot)).ToArray()),
|
||||
EquippedCashItems = GetItemIDsByInventoryTab(c.InventoryItems
|
||||
.Where(item => item.InventoryTab == InventoryTab.WornCashEquipment)
|
||||
.Select(item => item.ItemId)
|
||||
.ToArray()
|
||||
.Select(item => new Tuple<ushort, byte>(item.ItemId, item.Slot)).ToArray()),
|
||||
})
|
||||
.ToArrayAsync().ConfigureAwait(true),
|
||||
};
|
||||
|
||||
guildNameResponsePacket.GuildNames = await _wonderkingContext.Characters
|
||||
.Where(c => c.Account.Id == authSession.AccountId)
|
||||
.Where(c => c.Guild != null)
|
||||
.Select(character => character.Guild.Name).ToArrayAsync().ConfigureAwait(true);
|
||||
}
|
||||
else
|
||||
|
@ -88,4 +87,16 @@ public class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPacket>
|
|||
authSession.Send(guildNameResponsePacket);
|
||||
}
|
||||
}
|
||||
|
||||
private static ushort[] GetItemIDsByInventoryTab(Tuple<ushort, byte>[] items)
|
||||
{
|
||||
var ids = new ushort[20];
|
||||
|
||||
for (var i = 0; i < 20; i++)
|
||||
{
|
||||
ids[i] = items.FirstOrDefault(item => item.Item2 == i)?.Item1 ?? 0;
|
||||
}
|
||||
|
||||
return ids;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@ public class CharacterDeletionHandler : IPacketHandler<CharacterDeletePacket>
|
|||
return;
|
||||
}
|
||||
|
||||
_wonderkingContext.Characters.Remove(character);
|
||||
await _wonderkingContext.SaveChangesAsync().ConfigureAwait(false);
|
||||
//_wonderkingContext.Characters.Remove(character);
|
||||
//await _wonderkingContext.SaveChangesAsync().ConfigureAwait(false);
|
||||
|
||||
authSession.Send(response);
|
||||
}
|
||||
|
|
|
@ -29,39 +29,41 @@ public class ChannelSelectionResponsePacket : IPacket
|
|||
// Character Data
|
||||
for (var i = 0; i < Characters.Length; i++)
|
||||
{
|
||||
int offset = 20 + (i * 132);
|
||||
var character = Characters[i];
|
||||
BinaryPrimitives.WriteInt32LittleEndian(data.Slice(20 + (i * 132), 4), i);
|
||||
Encoding.ASCII.GetBytes(character.Name, data.Slice(24 + (i * 132), 20));
|
||||
// Character Data
|
||||
BinaryPrimitives.WriteInt32LittleEndian(data.Slice(offset, 4), i);
|
||||
Encoding.ASCII.GetBytes(character.Name, data.Slice(offset + 4, 20));
|
||||
|
||||
// Job Data
|
||||
data[44 + (i * 132)] = character.Job.FirstJob;
|
||||
data[45 + (i * 132)] = character.Job.SecondJob;
|
||||
data[46 + (i * 132)] = character.Job.ThirdJob;
|
||||
data[47 + (i * 132)] = character.Job.FourthJob;
|
||||
data[offset + 24] = character.Job.FirstJob;
|
||||
data[offset + 25] = character.Job.SecondJob;
|
||||
data[offset + 26] = character.Job.ThirdJob;
|
||||
data[offset + 27] = character.Job.FourthJob;
|
||||
|
||||
data[48 + (i * 132)] = (byte)character.Gender;
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(data.Slice(49 + (i * 132), 2), character.Level);
|
||||
data[51 + (i * 132)] = (byte)character.Experience;
|
||||
data[offset + 28] = (byte)character.Gender;
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(data.Slice(offset + 29, 2), character.Level);
|
||||
data[offset + 31] = (byte)character.Experience;
|
||||
|
||||
// Stats
|
||||
BinaryPrimitives.WriteInt16LittleEndian(data.Slice(52 + (i * 132), 2), character.Stats.Strength);
|
||||
BinaryPrimitives.WriteInt16LittleEndian(data.Slice(54 + (i * 132), 2), character.Stats.Dexterity);
|
||||
BinaryPrimitives.WriteInt16LittleEndian(data.Slice(56 + (i * 132), 2), character.Stats.Intelligence);
|
||||
BinaryPrimitives.WriteInt16LittleEndian(data.Slice(58 + (i * 132), 2), character.Stats.Vitality);
|
||||
BinaryPrimitives.WriteInt16LittleEndian(data.Slice(60 + (i * 132), 2), character.Stats.Luck);
|
||||
BinaryPrimitives.WriteInt16LittleEndian(data.Slice(62 + (i * 132), 2), character.Stats.Wisdom);
|
||||
BinaryPrimitives.WriteInt16LittleEndian(data.Slice(offset + 32, 2), character.Stats.Strength);
|
||||
BinaryPrimitives.WriteInt16LittleEndian(data.Slice(offset + 34, 2), character.Stats.Dexterity);
|
||||
BinaryPrimitives.WriteInt16LittleEndian(data.Slice(offset + 36, 2), character.Stats.Intelligence);
|
||||
BinaryPrimitives.WriteInt16LittleEndian(data.Slice(offset + 38, 2), character.Stats.Vitality);
|
||||
BinaryPrimitives.WriteInt16LittleEndian(data.Slice(offset + 40, 2), character.Stats.Luck);
|
||||
BinaryPrimitives.WriteInt16LittleEndian(data.Slice(offset + 42, 2), character.Stats.Wisdom);
|
||||
|
||||
BinaryPrimitives.WriteInt32LittleEndian(data.Slice(64 + (i * 132), 4), character.Health);
|
||||
BinaryPrimitives.WriteInt32LittleEndian(data.Slice(68 + (i * 132), 4), character.Mana);
|
||||
BinaryPrimitives.WriteInt32LittleEndian(data.Slice(offset + 44, 4), character.Health);
|
||||
BinaryPrimitives.WriteInt32LittleEndian(data.Slice(offset + 48, 4), character.Mana);
|
||||
|
||||
for (var j = 0; j < 20; j++)
|
||||
{
|
||||
// Equipped Items
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(data.Slice(72 + (i * 132) + (j * 2), 2),
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(data.Slice(offset + 52 + j * 2, 2),
|
||||
character.EquippedItems.Length > j ? character.EquippedItems[j] : (ushort)0);
|
||||
|
||||
// Equipped Cash Items
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(data.Slice(112 + (i * 132) + (j * 2), 2),
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(data.Slice(offset + 92 + j * 2, 2),
|
||||
character.EquippedCashItems.Length > j ? character.EquippedCashItems[j] : (ushort)0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@ public class CharacterCreationResponsePacket : IPacket
|
|||
{
|
||||
Span<byte> data = stackalloc byte[1 + 132];
|
||||
data[0] = isDuplicate ? (byte)1 : (byte)0;
|
||||
|
||||
// Character Data
|
||||
BinaryPrimitives.WriteInt32LittleEndian(data.Slice(1, 4), Slot);
|
||||
Encoding.ASCII.GetBytes(Character.Name, data.Slice(5, 20));
|
||||
|
||||
|
|
Loading…
Reference in a new issue