chore: formatting
All checks were successful
Build, Package and Push Images / preprocess (push) Successful in 2s
Build, Package and Push Images / build (push) Successful in 27s
Build, Package and Push Images / sbom-scan (push) Successful in 44s
Build, Package and Push Images / container-build (push) Successful in 1m37s
Build, Package and Push Images / sonarqube (push) Successful in 1m40s
Build, Package and Push Images / container-sbom-scan (push) Successful in 36s

This commit is contained in:
Timothy Schenk 2023-11-19 20:20:16 +01:00
parent 85dd69d243
commit 733db535ac
2 changed files with 52 additions and 42 deletions

View file

@ -90,8 +90,9 @@ public class CharacterCreationHandler : IPacketHandler<CharacterCreationPacket>
} }
private static Character CreateDefaultCharacter(CharacterCreationPacket packet, Account account, private static Character CreateDefaultCharacter(CharacterCreationPacket packet, Account account,
InventoryItem[] items, JobSpecificMapping firstJobConfig) => InventoryItem[] items, JobSpecificMapping firstJobConfig)
new() {
return new Character
{ {
Account = account, Account = account,
MapId = 300, MapId = 300,
@ -108,9 +109,11 @@ public class CharacterCreationHandler : IPacketHandler<CharacterCreationPacket>
Health = CalculateCurrentHealth(1, firstJobConfig), Health = CalculateCurrentHealth(1, firstJobConfig),
Mana = CalculateCurrentMana(1, firstJobConfig) Mana = CalculateCurrentMana(1, firstJobConfig)
}; };
}
private JobSpecificMapping SelectFirstJobConfig(byte firstJob) => private JobSpecificMapping SelectFirstJobConfig(byte firstJob)
firstJob switch {
return firstJob switch
{ {
1 => _characterStatsMapping.Swordsman, 1 => _characterStatsMapping.Swordsman,
2 => _characterStatsMapping.Mage, 2 => _characterStatsMapping.Mage,
@ -118,9 +121,11 @@ public class CharacterCreationHandler : IPacketHandler<CharacterCreationPacket>
4 => _characterStatsMapping.Scout, 4 => _characterStatsMapping.Scout,
_ => _characterStatsMapping.Swordsman _ => _characterStatsMapping.Swordsman
}; };
}
private InventoryItem[] CreateChosenItems(CharacterCreationPacket packet) => private InventoryItem[] CreateChosenItems(CharacterCreationPacket packet)
new[] {
return new[]
{ {
_itemObjectPoolService.GetBaseInventoryItem((ushort)((packet.FirstJob - 1) * 6 + _itemObjectPoolService.GetBaseInventoryItem((ushort)((packet.FirstJob - 1) * 6 +
((byte)packet.Gender - 1) * 3 + ((byte)packet.Gender - 1) * 3 +
@ -131,16 +136,21 @@ public class CharacterCreationHandler : IPacketHandler<CharacterCreationPacket>
_itemObjectPoolService.GetBaseInventoryItem((ushort)(((byte)packet.Gender - 1) * 3 + _itemObjectPoolService.GetBaseInventoryItem((ushort)(((byte)packet.Gender - 1) * 3 +
packet.Shirt + 49)), packet.Shirt + 49)),
_itemObjectPoolService.GetBaseInventoryItem((ushort)(((byte)packet.Gender - 1) * 3 + _itemObjectPoolService.GetBaseInventoryItem((ushort)(((byte)packet.Gender - 1) * 3 +
packet.Pants + 58)), packet.Pants + 58))
}; };
}
private static int CalculateCurrentHealth(ushort level, JobSpecificMapping firstJobConfig) => private static int CalculateCurrentHealth(ushort level, JobSpecificMapping firstJobConfig)
(int)((level - 1) * firstJobConfig.DynamicStats.HealthPerLevel + {
firstJobConfig.BaseStats.Vitality * firstJobConfig.DynamicStats.HealthPerVitality); return (int)((level - 1) * firstJobConfig.DynamicStats.HealthPerLevel +
firstJobConfig.BaseStats.Vitality * firstJobConfig.DynamicStats.HealthPerVitality);
}
private static int CalculateCurrentMana(ushort level, JobSpecificMapping firstJobConfig) => private static int CalculateCurrentMana(ushort level, JobSpecificMapping firstJobConfig)
(int)((level - 1) * firstJobConfig.DynamicStats.ManaPerLevel + {
firstJobConfig.BaseStats.Wisdom * firstJobConfig.DynamicStats.ManaPerWisdom); return (int)((level - 1) * firstJobConfig.DynamicStats.ManaPerLevel +
firstJobConfig.BaseStats.Wisdom * firstJobConfig.DynamicStats.ManaPerWisdom);
}
private static ushort[] GetItemIDsByInventoryTab(IEnumerable<Tuple<ushort, byte>> items) private static ushort[] GetItemIDsByInventoryTab(IEnumerable<Tuple<ushort, byte>> items)
{ {

View file

@ -4,49 +4,49 @@ services:
image: continuity:latest image: continuity:latest
restart: always restart: always
depends_on: depends_on:
- db - db
environment: environment:
- ENVIRONMENT=Development - ENVIRONMENT=Development
- Testing:CreateAccountOnLogin=true - Testing:CreateAccountOnLogin=true
- DB:Host=db - DB:Host=db
- DB:Port=5432 - DB:Port=5432
- DB:Username=continuity - DB:Username=continuity
- DB:Password=continuity - DB:Password=continuity
- Game:Data:Path=/app/data/ - Game:Data:Path=/app/data/
networks: networks:
- continuity - continuity
ports: ports:
- 10001:10001 - 10001:10001
volumes: volumes:
- type: bind - type: bind
source: ../wk-data source: ../wk-data
target: /app/data target: /app/data
read_only: true read_only: true
- type: bind - type: bind
source: ../wk-logs source: ../wk-logs
target: /app/logs target: /app/logs
read_only: false read_only: false
- type: bind - type: bind
source: ../config source: ../config
target: /app/config target: /app/config
read_only: true read_only: true
db: db:
container_name: continuity-db container_name: continuity-db
image: postgres:16.1-alpine image: postgres:16.1-alpine
restart: always restart: always
environment: environment:
- POSTGRES_USER=continuity - POSTGRES_USER=continuity
- POSTGRES_DB=continuity - POSTGRES_DB=continuity
- POSTGRES_PASSWORD=continuity - POSTGRES_PASSWORD=continuity
networks: networks:
- continuity - continuity
ports: ports:
- 5432:5432 - 5432:5432
volumes: volumes:
- db-data:/var/lib/postgresql/data - db-data:/var/lib/postgresql/data
healthcheck: 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 interval: 10s
timeout: 3s timeout: 3s
retries: 3 retries: 3