From 8b93d471ecc91f13524c157b36204da08d7d7dd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Kami=C5=84ski?= Date: Sun, 24 Mar 2024 09:27:48 +0100 Subject: [PATCH] Fix remaining warnings --- UdpHosts/GameServer/Controllers/GenericShard.cs | 7 +++++-- UdpHosts/GameServer/Data/Zone.cs | 2 +- UdpHosts/GameServer/Entities/Outpost/OutpostEntity.cs | 4 ++-- .../GameServer/StaticDB/Records/customdata/Outpost.cs | 2 +- .../GameServer/StaticDB/Records/dbcharacter/Faction.cs | 2 +- UdpHosts/GameServer/Test/DataUtils.cs | 8 ++++++-- 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/UdpHosts/GameServer/Controllers/GenericShard.cs b/UdpHosts/GameServer/Controllers/GenericShard.cs index 271f4a67..aa025774 100644 --- a/UdpHosts/GameServer/Controllers/GenericShard.cs +++ b/UdpHosts/GameServer/Controllers/GenericShard.cs @@ -120,8 +120,11 @@ public void RequestLogout(INetworkClient client, IPlayer player, ulong entityId, } } - _ = GRPCService.SaveCharacterSessionDataAsync(player.CharacterId + 0xFE, zone.ID, closestOutpostId, - (uint)DateTimeOffset.UtcNow.ToUnixTimeSeconds() - player.ConnectedAt); + _ = GRPCService.SaveCharacterSessionDataAsync( + player.CharacterId + 0xFE, + zone.ID, + closestOutpostId, + (uint)DateTimeOffset.UtcNow.ToUnixTimeSeconds() - player.ConnectedAt); } [MessageID((byte)Commands.RequestEncounterInfo)] diff --git a/UdpHosts/GameServer/Data/Zone.cs b/UdpHosts/GameServer/Data/Zone.cs index 5415353a..1f524f51 100644 --- a/UdpHosts/GameServer/Data/Zone.cs +++ b/UdpHosts/GameServer/Data/Zone.cs @@ -5,7 +5,7 @@ namespace GameServer.Data; public class Zone { - private static readonly HashSet OpenWorldZones = [162, 448, 1030]; + private static readonly HashSet OpenWorldZones = new() { 162, 448, 1030 }; public Zone() { diff --git a/UdpHosts/GameServer/Entities/Outpost/OutpostEntity.cs b/UdpHosts/GameServer/Entities/Outpost/OutpostEntity.cs index 8debdc20..5f58990c 100644 --- a/UdpHosts/GameServer/Entities/Outpost/OutpostEntity.cs +++ b/UdpHosts/GameServer/Entities/Outpost/OutpostEntity.cs @@ -29,7 +29,7 @@ public OutpostEntity(IShard shard, ulong eid, Data.SDB.Records.customdata.Outpos public SpawnPoint RandomSpawnPoint => SpawnPoints[Rng.Next(SpawnPoints.Count)]; public bool IsCapturedByHostiles => Faction.HostileFactionIds.Contains(Outpost_ObserverView.FactionIdProp); - private List SpawnPoints { get; set; } = []; + private List SpawnPoints { get; set; } = new(); private void InitFields() { @@ -70,7 +70,7 @@ private void AddSpawnPoints(Data.SDB.Records.customdata.Outpost record) { if (record.SpawnPoints.Count == 0) { - SpawnPoints = [ new SpawnPoint { Position = record.Position } ]; + SpawnPoints = new List { new() { Position = record.Position } }; } else { diff --git a/UdpHosts/GameServer/StaticDB/Records/customdata/Outpost.cs b/UdpHosts/GameServer/StaticDB/Records/customdata/Outpost.cs index 14bd4f50..aee879eb 100644 --- a/UdpHosts/GameServer/StaticDB/Records/customdata/Outpost.cs +++ b/UdpHosts/GameServer/StaticDB/Records/customdata/Outpost.cs @@ -9,7 +9,7 @@ public record Outpost public uint OutpostName { get; set; } public Vector3 Position { get; set; } - public List SpawnPoints { get; set; } = []; + public List SpawnPoints { get; set; } = new(); public uint LevelBandId { get; set; } public byte SinUnlockIndex { get; set; } public int TeleportCost { get; set; } diff --git a/UdpHosts/GameServer/StaticDB/Records/dbcharacter/Faction.cs b/UdpHosts/GameServer/StaticDB/Records/dbcharacter/Faction.cs index 9754faf5..332b2638 100644 --- a/UdpHosts/GameServer/StaticDB/Records/dbcharacter/Faction.cs +++ b/UdpHosts/GameServer/StaticDB/Records/dbcharacter/Faction.cs @@ -3,7 +3,7 @@ namespace GameServer.Data.SDB.Records.dbcharacter; public record class Faction { - public static readonly HashSet HostileFactionIds = [2, 3, 5, 6, 7, 8, 17, 22, 42, 43, 45, 46, 47, 48]; + public static readonly HashSet HostileFactionIds = new() { 2, 3, 5, 6, 7, 8, 17, 22, 42, 43, 45, 46, 47, 48 }; public uint LocalizedNameId { get; set; } public int StartingReputation { get; set; } diff --git a/UdpHosts/GameServer/Test/DataUtils.cs b/UdpHosts/GameServer/Test/DataUtils.cs index 83af3d23..3eea8743 100644 --- a/UdpHosts/GameServer/Test/DataUtils.cs +++ b/UdpHosts/GameServer/Test/DataUtils.cs @@ -66,8 +66,12 @@ public static string FormatArmyTag(string armyTag) private static void AddZone(uint id, string name, ulong timestamp, Vector3 spawn, uint defaultOutpostId = 0) { - var zone = new Zone { ID = id, Name = name, Timestamp = timestamp, POIs = { { "origin", new Vector3(0.0f, 0.0f, 0.0f) }, { "spawn", spawn } }, - DefaultOutpostId = defaultOutpostId }; + var zone = new Zone + { + ID = id, Name = name, Timestamp = timestamp, + POIs = { { "origin", new Vector3(0.0f, 0.0f, 0.0f) }, { "spawn", spawn } }, + DefaultOutpostId = defaultOutpostId + }; _zones.AddOrUpdate(zone.ID, zone, (_, nc) => nc); } } \ No newline at end of file