From 733db535ac823b6038cbed2f1959274df989a41a Mon Sep 17 00:00:00 2001 From: Timothy Schenk Date: Sun, 19 Nov 2023 20:20:16 +0100 Subject: [PATCH] chore: formatting --- .../CharacterCreationHandler.cs | 36 +++++++----- Server/docker-compose.yml | 58 +++++++++---------- 2 files changed, 52 insertions(+), 42 deletions(-) diff --git a/Server/PacketHandlers/CharacterCreationHandler.cs b/Server/PacketHandlers/CharacterCreationHandler.cs index 67f53fb..614a676 100644 --- a/Server/PacketHandlers/CharacterCreationHandler.cs +++ b/Server/PacketHandlers/CharacterCreationHandler.cs @@ -90,8 +90,9 @@ public class CharacterCreationHandler : IPacketHandler } private static Character CreateDefaultCharacter(CharacterCreationPacket packet, Account account, - InventoryItem[] items, JobSpecificMapping firstJobConfig) => - new() + InventoryItem[] items, JobSpecificMapping firstJobConfig) + { + return new Character { Account = account, MapId = 300, @@ -108,9 +109,11 @@ public class CharacterCreationHandler : IPacketHandler Health = CalculateCurrentHealth(1, firstJobConfig), Mana = CalculateCurrentMana(1, firstJobConfig) }; + } - private JobSpecificMapping SelectFirstJobConfig(byte firstJob) => - firstJob switch + private JobSpecificMapping SelectFirstJobConfig(byte firstJob) + { + return firstJob switch { 1 => _characterStatsMapping.Swordsman, 2 => _characterStatsMapping.Mage, @@ -118,9 +121,11 @@ public class CharacterCreationHandler : IPacketHandler 4 => _characterStatsMapping.Scout, _ => _characterStatsMapping.Swordsman }; + } - private InventoryItem[] CreateChosenItems(CharacterCreationPacket packet) => - new[] + private InventoryItem[] CreateChosenItems(CharacterCreationPacket packet) + { + return new[] { _itemObjectPoolService.GetBaseInventoryItem((ushort)((packet.FirstJob - 1) * 6 + ((byte)packet.Gender - 1) * 3 + @@ -131,16 +136,21 @@ public class CharacterCreationHandler : IPacketHandler _itemObjectPoolService.GetBaseInventoryItem((ushort)(((byte)packet.Gender - 1) * 3 + packet.Shirt + 49)), _itemObjectPoolService.GetBaseInventoryItem((ushort)(((byte)packet.Gender - 1) * 3 + - packet.Pants + 58)), + packet.Pants + 58)) }; + } - private static int CalculateCurrentHealth(ushort level, JobSpecificMapping firstJobConfig) => - (int)((level - 1) * firstJobConfig.DynamicStats.HealthPerLevel + - firstJobConfig.BaseStats.Vitality * firstJobConfig.DynamicStats.HealthPerVitality); + private static int CalculateCurrentHealth(ushort level, JobSpecificMapping firstJobConfig) + { + return (int)((level - 1) * firstJobConfig.DynamicStats.HealthPerLevel + + firstJobConfig.BaseStats.Vitality * firstJobConfig.DynamicStats.HealthPerVitality); + } - private static int CalculateCurrentMana(ushort level, JobSpecificMapping firstJobConfig) => - (int)((level - 1) * firstJobConfig.DynamicStats.ManaPerLevel + - firstJobConfig.BaseStats.Wisdom * firstJobConfig.DynamicStats.ManaPerWisdom); + private static int CalculateCurrentMana(ushort level, JobSpecificMapping firstJobConfig) + { + return (int)((level - 1) * firstJobConfig.DynamicStats.ManaPerLevel + + firstJobConfig.BaseStats.Wisdom * firstJobConfig.DynamicStats.ManaPerWisdom); + } private static ushort[] GetItemIDsByInventoryTab(IEnumerable> items) { diff --git a/Server/docker-compose.yml b/Server/docker-compose.yml index 18f2a41..15191a8 100644 --- a/Server/docker-compose.yml +++ b/Server/docker-compose.yml @@ -4,49 +4,49 @@ services: image: continuity:latest restart: always depends_on: - - db + - db environment: - - ENVIRONMENT=Development - - Testing:CreateAccountOnLogin=true - - DB:Host=db - - DB:Port=5432 - - DB:Username=continuity - - DB:Password=continuity - - Game:Data:Path=/app/data/ + - ENVIRONMENT=Development + - Testing:CreateAccountOnLogin=true + - DB:Host=db + - DB:Port=5432 + - DB:Username=continuity + - DB:Password=continuity + - Game:Data:Path=/app/data/ networks: - - continuity + - continuity ports: - - 10001:10001 + - 10001:10001 volumes: - - type: bind - source: ../wk-data - target: /app/data - read_only: true - - type: bind - source: ../wk-logs - target: /app/logs - read_only: false - - type: bind - source: ../config - target: /app/config - read_only: true + - type: bind + source: ../wk-data + target: /app/data + read_only: true + - type: bind + source: ../wk-logs + target: /app/logs + read_only: false + - type: bind + source: ../config + target: /app/config + read_only: true db: container_name: continuity-db image: postgres:16.1-alpine restart: always environment: - - POSTGRES_USER=continuity - - POSTGRES_DB=continuity - - POSTGRES_PASSWORD=continuity + - POSTGRES_USER=continuity + - POSTGRES_DB=continuity + - POSTGRES_PASSWORD=continuity networks: - - continuity + - continuity ports: - - 5432:5432 + - 5432:5432 volumes: - - db-data:/var/lib/postgresql/data + - db-data:/var/lib/postgresql/data healthcheck: - test: [CMD-SHELL, 'pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}'] + test: [ CMD-SHELL, 'pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}' ] interval: 10s timeout: 3s retries: 3