KaukausInsurgency / ki-dcs

Kaukasus Insurgency
5 stars 2 forks source link

Make Starting Lives Configurable #170

Open Igneous01 opened 6 years ago

Igneous01 commented 6 years ago

In the server table, add column 'MaxLives' which will be the maximum number of starting lives for new players. Send this data back as part of GetOrAddServer and use the data in server mod / config.

In the scheduled event job, do a join on server table to find out the max lives.

Igneous01 commented 6 years ago

Code Changes Required

A) In MySQL server table, add new column MaxLives (int, NULL) - if NULL players have infinite lives

B) In MySQL player table, remove column lives

C) In MySQL would need to create junction table xref_lives_player_server with columns (id, ucid, server_id, lives)

D) Update all queries and Sprocs that reference player.lives to now include join on the junction table

E) Update website player stats screen to hide 'Lives' as no longer useful in stats screen

F) Remove lives property from the player stats model

G) In MySQL Sproc GetOrAddServer, include parameter MaxLives, and return MaxLives column as second property

H) In KIServer_GameGUI InitKIServerConfig, add new Config ["MaxLives"]

I) In KIServer.RequestSessionID, send KIServer.Config.MaxLives as parameter to message, and get MaxLives from response.Data[2], if equal to JSON.Null, set MaxLives to nil

J) In KIServer.IsPlayerOutOfLives, would need to modify logic to allow players to slot in if KIServer.MaxLives is nil

K) Add new property KI.Data.MaxLives

L) In KI.Init.GetServerAndSession, get Data.MaxLives from data

M) In KI.Hooks.GameEventHandler:onEvent, update msg text in 'TAKEOFF' and 'LAND' Events to show KI.Data.MaxLives instead of the hardcoded '5'

N) In e_PlayerGainLife, update query to add life if current lives < server.MaxLives and server.MaxLives IS NOT NULL

O) Test

Impacts

Database Schema Database Sprocs and Code Website Rendering Website Model change Server Mod DCS Scripts KIServerConfig

Igneous01 commented 6 years ago

A large effort involved in supporting this change - estimate is about 5 to 10 days.

Igneous01 commented 6 years ago

Removing from v0.77 sprint as features is maxed out. Will be voted in next sprint.