diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-12-22 16:46:49 +0000 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-12-22 16:46:49 +0000 |
commit | fb32cb1b780c1169a834c951bc0c928199a2b59e (patch) | |
tree | e2435cc869fed0fa3f7c3d187335d2350b8b1e14 /Northstar.CustomServers/mod/scripts | |
parent | dade102a0d4d14ba5ee560022b8e2f1ddf960977 (diff) | |
download | NorthstarMods-fb32cb1b780c1169a834c951bc0c928199a2b59e.tar.gz NorthstarMods-fb32cb1b780c1169a834c951bc0c928199a2b59e.zip |
playtest fixes
Diffstat (limited to 'Northstar.CustomServers/mod/scripts')
21 files changed, 105 insertions, 989 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut index 2017b64b..af028e71 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut @@ -55,7 +55,14 @@ void function SetWeaponDropsEnabled( bool enabled ) void function DestroyDroppedWeapon( entity victim, entity attacker, var damageInfo ) { if ( !file.weaponDropsEnabled && IsValid( victim.GetActiveWeapon() ) ) - victim.GetActiveWeapon().Destroy() + thread DelayDestroyDroppedWeapon( victim.GetActiveWeapon() ) +} + +void function DelayDestroyDroppedWeapon( entity weapon ) +{ + WaitEndFrame() + if ( IsValid( weapon ) ) + weapon.Destroy() } TitanLoadoutDef function GetTitanLoadoutForPlayer( entity player ) @@ -258,7 +265,7 @@ void function TryGivePilotLoadoutForGracePeriod( entity player ) else respawnTimeReal = expect float( player.s.respawnTime ) - if ( Time() - respawnTimeReal <= CLASS_CHANGE_GRACE_PERIOD || player.p.usingLoadoutCrate || GetGameState() < eGameState.Playing ) + if ( ( ( Time() - respawnTimeReal <= CLASS_CHANGE_GRACE_PERIOD || GetGameState() < eGameState.Playing ) && file.loadoutGracePeriodEnabled ) || player.p.usingLoadoutCrate ) { // because the game sucks and stuff Loadouts_TryGivePilotLoadout doesn't work in intro so have to do this manually int loadoutIndex = GetPersistentSpawnLoadoutIndex( player, "pilot" ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_mapspawn.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_mapspawn.gnut index 3efee093..73e76910 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/_mapspawn.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/_mapspawn.gnut @@ -208,9 +208,12 @@ var function CodeCallback_ClientCommand( entity player, array<string> args ) } else { - printl( "############################" ) - printl( "CommandString: " + commandString + " was not added via AddClientCommandCallback but is being called in CodeCallback_ClientCommand" ) - printl( "############################" ) + if ( GetConVarBool( "ns_should_log_unknown_clientcommands" ) ) + { + printl( "############################" ) + printl( "CommandString: " + commandString + " was not added via AddClientCommandCallback but is being called in CodeCallback_ClientCommand" ) + printl( "############################" ) + } return false } } diff --git a/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut index c698cb36..6682807b 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut @@ -22,6 +22,8 @@ void function EarnMeterMP_SetTitanLoadout( entity player ) { if ( EarnMeterMP_IsTitanEarnGametype() ) PlayerEarnMeter_SetGoal( player, EarnObject_GetByRef( GetTitanLoadoutForPlayer( player ).titanClass ) ) + else + PlayerEarnMeter_SetGoal( player, EarnObject_GetByRef( GetSelectedBurncardRefFromWeaponOrPlayer( null, player ) ) ) } void function EarnMeterMP_SetPassiveMeterGainEnabled( bool enabled ) @@ -46,6 +48,8 @@ void function SetupPlayerEarnMeter( entity player ) PlayerEarnMeter_SetGoal( player, EarnObject_GetByRef( GetTitanLoadoutForPlayer( player ).titanClass ) ) PlayerEarnMeter_EnableGoal( player ) // prevents goalstate from being set incorrectly } + else + PlayerEarnMeter_SetGoal( player, EarnObject_GetByRef( GetSelectedBurncardRefFromWeaponOrPlayer( null, player ) ) ) // catchup bonus for late joiners // todo: maths on this is fine but for some reason it won't set correctly, could be getting reset somewhere? @@ -66,10 +70,9 @@ void function OnPlaying() { Riff_ForceTitanAvailability( eTitanAvailability.Custom ) // doesn't seem to affect anything aside from preventing some annoying client stuff svGlobal.titanAvailabilityCheck = IsTitanAvailable - SetCallback_EarnMeterGoalEarned( EarnMeterMP_TitanEarned ) } - else // if no titans from earnmeter in this mode, just reset when we finish meter - SetCallback_EarnMeterGoalEarned( PlayerEarnMeter_Reset ) + + SetCallback_EarnMeterGoalEarned( EarnMeterMP_TitanEarned ) } void function OnPlayerRespawned( entity player ) @@ -179,6 +182,21 @@ void function EarnMeterMP_BoostEarned( entity player ) void function EarnMeterMP_TitanEarned( entity player ) { - SetTitanAvailable( player ) - //Remote_CallFunction_Replay( player, "ServerCallback_TitanReadyMessage" ) // broken for some reason + if ( EarnMeterMP_IsTitanEarnGametype() ) + { + SetTitanAvailable( player ) + //Remote_CallFunction_Replay( player, "ServerCallback_TitanReadyMessage" ) // broken for some reason + } + else + { + PlayerEarnMeter_Reset( player ) + // reset rewards + string burncardRef = GetSelectedBurncardRefFromWeaponOrPlayer( null, player ) + PlayerEarnMeter_SetReward( player, EarnObject_GetByRef( burncardRef ) ) + PlayerEarnMeter_SetRewardFrac( player, BurnReward_GetByRef( burncardRef ).cost ) + PlayerEarnMeter_EnableReward( player ) + + if ( PlayerEarnMeter_GetRewardFrac( player ) != 0 ) + PlayerEarnMeter_EnableReward( player ) + } }
\ No newline at end of file diff --git a/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut b/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut index d086d65b..ac5b8129 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut @@ -102,7 +102,10 @@ void function EvacEpilogue() ( file.evacNodes.len() > 0 || IsValid( GetEnt( "escape_node1" ) ) ) // code assumes escape_node1 should be first node if automatically registering if ( canRunEvac ) + { + SetRespawnsEnabled( false ) thread Evac( GetOtherTeam( winner ), EVAC_INITIAL_WAIT, EVAC_ARRIVAL_TIME, EVAC_WAIT_TIME, EvacEpiloguePlayerCanBoard, EvacEpilogueShouldLeaveEarly, EvacEpilogueCompleted ) + } else thread EvacEpilogueCompleted( null ) // this is hacky but like, this also shouldn't really be hit in normal gameplay } diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut index 4ea25fa7..8e5599a1 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut @@ -27,6 +27,7 @@ void function GamemodeCP_Init() file.ampingEnabled = GetCurrentPlaylistVarInt( "cp_amped_capture_points", 1 ) == 1 RegisterSignal( "HardpointCaptureStart" ) + ScoreEvent_SetupEarnMeterValuesForMixedModes() AddCallback_EntitiesDidLoad( SpawnHardpoints ) AddCallback_GameStateEnter( eGameState.Playing, StartHardpointThink ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ffa.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ffa.nut index 6a8b3ea4..27eef177 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ffa.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ffa.nut @@ -3,6 +3,7 @@ global function FFA_Init void function FFA_Init() { ClassicMP_ForceDisableEpilogue( true ) + ScoreEvent_SetupEarnMeterValuesForMixedModes() AddCallback_OnPlayerKilled( OnPlayerKilled ) } diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_lts.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_lts.nut index 5de78b53..485981d8 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_lts.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_lts.nut @@ -21,6 +21,7 @@ void function GamemodeLts_Init() Riff_ForceSetSpawnAsTitan( eSpawnAsTitan.Always ) SetShouldUseRoundWinningKillReplay( true ) SetRoundWinningKillReplayKillClasses( true, true ) // both titan and pilot kills are tracked + ScoreEvent_SetupEarnMeterValuesForTitanModes() FlagSet( "ForceStartSpawn" ) AddCallback_OnPilotBecomesTitan( RefreshThirtySecondWallhackHighlight ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_mfd.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_mfd.nut index 326f3302..9d5dbd24 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_mfd.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_mfd.nut @@ -13,6 +13,7 @@ void function GamemodeMfd_Init() GamemodeMfdShared_Init() RegisterSignal( "MarkKilled" ) + ScoreEvent_SetupEarnMeterValuesForMixedModes() // todo if ( GAMETYPE == MARKED_FOR_DEATH_PRO ) @@ -175,8 +176,9 @@ void function UpdateMarksForKill( entity victim, entity attacker, var damageInfo { if ( victim == GetMarked( victim.GetTeam() ) ) { + MessageToAll( eEventNotifications.MarkedForDeathKill, null, victim, attacker.GetEncodedEHandle() ) svGlobal.levelEnt.Signal( "MarkKilled", { mark = victim } ) - + if ( attacker.IsPlayer() ) attacker.SetPlayerGameStat( PGS_ASSAULT_SCORE, attacker.GetPlayerGameStat( PGS_ASSAULT_SCORE ) + 1 ) } diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ps.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ps.nut index 3a852f91..4e62e8c5 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ps.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ps.nut @@ -2,7 +2,10 @@ global function GamemodePs_Init void function GamemodePs_Init() { + Riff_ForceTitanAvailability( eTitanAvailability.Never ) + AddCallback_OnPlayerKilled( GiveScoreForPlayerKill ) + ScoreEvent_SetupEarnMeterValuesForMixedModes() } void function GiveScoreForPlayerKill( entity victim, entity attacker, var damageInfo ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_speedball.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_speedball.nut index abc9013a..49fd5f2e 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_speedball.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_speedball.nut @@ -17,6 +17,7 @@ void function GamemodeSpeedball_Init() SetShouldUseRoundWinningKillReplay( true ) Riff_ForceTitanAvailability( eTitanAvailability.Never ) Riff_ForceSetEliminationMode( eEliminationMode.Pilots ) + ScoreEvent_SetupEarnMeterValuesForMixedModes() AddSpawnCallbackEditorClass( "script_ref", "info_speedball_flag", CreateFlag ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut index 9e80b863..5dd8a403 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut @@ -4,6 +4,7 @@ global function RateSpawnpoints_Directional void function GamemodeTdm_Init() { AddCallback_OnPlayerKilled( GiveScoreForPlayerKill ) + ScoreEvent_SetupEarnMeterValuesForMixedModes() } void function GiveScoreForPlayerKill( entity victim, entity attacker, var damageInfo ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ttdm.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ttdm.nut index faf3e5ca..c4ffada1 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ttdm.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ttdm.nut @@ -7,6 +7,7 @@ void function GamemodeTTDM_Init() Riff_ForceSetSpawnAsTitan( eSpawnAsTitan.Always ) Riff_ForceTitanExitEnabled( eTitanExitEnabled.Never ) TrackTitanDamageInPlayerGameStat( PGS_ASSAULT_SCORE ) + ScoreEvent_SetupEarnMeterValuesForMixedModes() ClassicMP_SetCustomIntro( TTDMIntroSetup, TTDMIntroLength ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut b/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut index 7011de08..3acd1652 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut @@ -91,7 +91,7 @@ bool function ClientCommandCallback_SetCustomMap( entity player, array<string> a bool function ClientCommandCallback_PrivateMatchSwitchTeams( entity player, array<string> args ) { - if ( file.startState == ePrivateMatchStartState.STARTING ) + if ( file.startState == ePrivateMatchStartState.STARTING || GetGamemodeVarOrUseValue( file.mode, "max_teams", "2" ).tointeger() != 2 ) return true // currently only support 2 teams in private matches diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut index 9c4949b6..6945fb96 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut @@ -38,8 +38,8 @@ void function BaseGametype_Init_MPSP() AddClientCommandCallback( "spec_prev", ClientCommandCallback_spec_prev ) AddClientCommandCallback( "spec_mode", ClientCommandCallback_spec_mode ) - AddDamageCallback( "player", AddToTitanDamageStat ) - AddDamageCallback( "npc_titan", AddToTitanDamageStat ) + AddPostDamageCallback( "player", AddToTitanDamageStat ) + AddPostDamageCallback( "npc_titan", AddToTitanDamageStat ) RegisterSignal( "PlayerRespawnStarted" ) } @@ -354,10 +354,8 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga else // spawn as pilot RespawnAsPilot( player ) } - else - { + else if ( GamePlayingOrSuddenDeath() || GetGameState() == eGameState.Epilogue ) thread PlayerBecomesSpectator( player ) - } } void function PlayerWatchesKillReplayWrapper( entity player, entity attacker, float timeSinceAttackerSpawned, float timeOfDeath, float beforeTime, table replayTracker ) @@ -372,7 +370,8 @@ void function PlayerWatchesKillReplayWrapper( entity player, entity attacker, fl OnThreadEnd( function() : ( player ) { - if ( IsValid( player ) ) + // don't clear if we're in a roundwinningkillreplay + if ( IsValid( player ) && !( ( GetGameState() == eGameState.SwitchingSides || GetGameState() == eGameState.WinnerDetermined ) && IsRoundWinningKillReplayEnabled() ) ) { player.ClearReplayDelay() player.ClearViewEntity() @@ -389,9 +388,9 @@ void function DecideRespawnPlayer( entity player ) // this isn't even used atm, could likely be removed if some vanilla code didn't rely on it } -void function RespawnAsPilot( entity player, bool manualPosition = false ) +void function RespawnAsPilot( entity player ) { - player.RespawnPlayer( FindSpawnPoint( player, false, ShouldStartSpawn( player ) && !IsFFAGame() ) ) + player.RespawnPlayer( FindSpawnPoint( player, false, ( ShouldStartSpawn( player ) || Flag( "ForceStartSpawn" ) ) && !IsFFAGame() ) ) } void function RespawnAsTitan( entity player, bool manualPosition = false ) @@ -399,7 +398,7 @@ void function RespawnAsTitan( entity player, bool manualPosition = false ) player.Signal( "PlayerRespawnStarted" ) player.isSpawning = true - entity spawnpoint = FindSpawnPoint( player, true, ShouldStartSpawn( player ) && !IsFFAGame() ) + entity spawnpoint = FindSpawnPoint( player, true, ( ShouldStartSpawn( player ) || Flag( "ForceStartSpawn" ) ) && !IsFFAGame() ) TitanLoadoutDef titanLoadout = GetTitanLoadoutForPlayer( player ) @@ -501,15 +500,23 @@ void function PlayerBecomesSpectator( entity player ) targetIndex-- } + if ( targetIndex >= targets.len() ) + targetIndex = 0 + entity target = targets[ targetIndex ] player.StopObserverMode() - player.SetSpecReplayDelay( 0.0 ) // clear spectator replay + if ( player.IsWatchingSpecReplay() ) + player.SetSpecReplayDelay( 0.0 ) // clear spectator replay if ( target.IsPlayer() ) { - player.SetObserverTarget( target ) - player.StartObserverMode( OBS_MODE_CHASE ) + try + { + player.SetObserverTarget( target ) + player.StartObserverMode( OBS_MODE_CHASE ) + } + catch ( ex ) {} } else { diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut index 69f67584..1e6d8271 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut @@ -150,10 +150,11 @@ void function SpawnPlayerIntoDropship( entity player ) playerDropship = dropship playerDropshipIndex = i + dropship.players[ i ] = player break } - if ( true )//if ( playerDropship.dropship == null ) + if ( playerDropship.dropship == null ) { // if we're at this point, we have more players than we do dropships, so just pick a random one playerDropship = teamDropships.getrandom() @@ -189,10 +190,11 @@ void function SpawnPlayerIntoDropship( entity player ) jumpSequence.firstPersonAnim = DROPSHIP_JUMP_ANIMS_POV[ playerDropshipIndex ] jumpSequence.thirdPersonAnim = DROPSHIP_JUMP_ANIMS[ playerDropshipIndex ] jumpSequence.attachment = "ORIGIN" - jumpSequence.setInitialTime = Time() - ( file.introStartTime + 10.9 ) // pretty sure you should do this with GetScriptedAnimEventCycleFrac? + jumpSequence.setInitialTime = max( 0.0, Time() - ( file.introStartTime + 11.0 ) ) // pretty sure you should do this with GetScriptedAnimEventCycleFrac? // idk unsure how to use that, all i know is getsequenceduration > the length it actually should be - FirstPersonSequence( jumpSequence, player, playerDropship.dropship ) + thread FirstPersonSequence( jumpSequence, player, playerDropship.dropship ) + WaittillAnimDone( player ) // somehow this is better than just waiting for the blocking FirstPersonSequence call? player.s.dropshipIntroIsJumping <- true thread PlayerJumpsFromDropship( player ) @@ -217,6 +219,7 @@ void function PlayerJumpsFromDropship( entity player ) player.ConsumeDoubleJump() // movementdisable doesn't prevent double jumps // wait for player to hit the ground + wait 0.1 // assume players will never actually hit ground before this while ( !player.IsOnGround() && !player.IsWallRunning() && !player.IsWallHanging() ) // todo this needs tweaking WaitFrame() diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut index b2ce4fca..4b90b1a2 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut @@ -127,7 +127,7 @@ void function WaitForPlayers( ) // note: atm if someone disconnects as this happens the game will just wait forever float endTime = Time() + 30.0 - while ( GetPendingClientsCount() != 0 && endTime > Time() ) + while ( ( GetPendingClientsCount() != 0 && endTime > Time() ) || GetPlayerArray().len() == 0 ) WaitFrame() print( "done waiting!" ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_playlist.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_playlist.gnut index 8db52b11..b27fdbaa 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_playlist.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_playlist.gnut @@ -7,6 +7,12 @@ void function Playlist_Init() AddCallback_OnPlayerRespawned( FeaturedModeSettingsSetupPilotLoadouts ) AddCallback_OnPilotBecomesTitan( FeaturedModeSettingsSetupTitanLoadouts ) + if ( IsFeaturedMode( "all_holopilot" ) || IsFeaturedMode( "all_grapple" ) || + IsFeaturedMode( "all_phase" ) || IsFeaturedMode( "all_ticks" ) || + IsFeaturedMode( "rocket_arena" ) || IsFeaturedMode( "shotguns_snipers" ) || + IsFeaturedMode( "tactikill" ) || IsFeaturedMode( "amped_tacticals" ) ) + SetLoadoutGracePeriodEnabled( false ) + // iron lts rules if ( HasIronRules() ) Riff_ForceTitanExitEnabled( eTitanExitEnabled.Never ) @@ -78,6 +84,8 @@ void function FeaturedModeSettingsSetupPilotLoadouts( entity player ) modifiedLoadout.secondaryMods = [ "rocket_arena" ] } + modifiedLoadout.meleeMods = [ "rocket_arena" ] + player.GiveExtraWeaponMod( "rocket_arena" ) } @@ -120,7 +128,12 @@ void function FeaturedModeSettingsSetupTitanLoadouts( entity player, entity tita if ( IsFeaturedMode( "turbo_titans" ) ) { array<string> settingsMods = player.GetPlayerSettingsMods() - settingsMods.append( "turbo_titan" ) - player.SetPlayerSettingsWithMods( player.GetPlayerSettings(), settingsMods ) + + // seems to crash if we set both of these at once? idk odd game + if ( !settingsMods.contains( "pas_mobility_dash_capacity" ) ) + { + settingsMods.append( "turbo_titan" ) + player.SetPlayerSettingsWithMods( player.GetPlayerSettings(), settingsMods ) + } } }
\ No newline at end of file diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut index ac64af37..e52c9142 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut @@ -10,6 +10,7 @@ global function ScoreEvent_NPCKilled global function ScoreEvent_SetEarnMeterValues global function ScoreEvent_SetupEarnMeterValuesForMixedModes +global function ScoreEvent_SetupEarnMeterValuesForTitanModes struct { bool firstStrikeDone = false @@ -212,7 +213,7 @@ void function ScoreEvent_SetupEarnMeterValuesForMixedModes() // mixed modes in t { // todo needs earn/overdrive values // player-controlled stuff - ScoreEvent_SetEarnMeterValues( "KillPilot", 0.0, 0.05 ) + ScoreEvent_SetEarnMeterValues( "KillPilot", 0.7, 0.15 ) ScoreEvent_SetEarnMeterValues( "KillTitan", 0.0, 0.15 ) ScoreEvent_SetEarnMeterValues( "TitanKillTitan", 0.0, 0.0 ) // unsure ScoreEvent_SetEarnMeterValues( "PilotBatteryStolen", 0.0, 0.35 ) @@ -227,6 +228,5 @@ void function ScoreEvent_SetupEarnMeterValuesForMixedModes() // mixed modes in t void function ScoreEvent_SetupEarnMeterValuesForTitanModes() { - // todo needs earn/overdrive values - + // relatively sure we don't have to do anything here but leaving this function for consistency }
\ No newline at end of file diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut index 88f1e04c..9b293524 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut @@ -267,7 +267,7 @@ bool function IsSpawnpointValid( entity spawnpoint, int team ) return false } - array<entity> projectiles = GetProjectileArrayEx( "any", TEAM_ANY, TEAM_ANY, spawnpoint.GetOrigin(), 400 ) + array<entity> projectiles = GetProjectileArrayEx( "any", TEAM_ANY, TEAM_ANY, spawnpoint.GetOrigin(), 600 ) foreach ( entity projectile in projectiles ) if ( projectile.GetTeam() != team ) return false @@ -283,13 +283,14 @@ bool function IsSpawnpointValid( entity spawnpoint, int team ) { if ( enemyPlayer.GetTeam() == team || !IsAlive( enemyPlayer ) ) continue + + float dist = 1000.0 + // check fov, constant here is stolen from every other place this is done + if ( VectorDot_PlayerToOrigin( enemyPlayer, spawnpoint.GetOrigin() ) > 0.8 ) + dist /= 0.75 // check distance, constant here is basically arbitrary - if ( Distance( enemyPlayer.GetOrigin(), spawnpoint.GetOrigin() ) > 1000.0 ) - continue - - // check fov, constant here is stolen from every other place this is done - if ( VectorDot_PlayerToOrigin( enemyPlayer, spawnpoint.GetOrigin() ) < 0.8 ) + if ( Distance( enemyPlayer.GetOrigin(), spawnpoint.GetOrigin() ) > dist ) continue // check actual los diff --git a/Northstar.CustomServers/mod/scripts/vscripts/sh_calling_cards.gnut b/Northstar.CustomServers/mod/scripts/vscripts/sh_calling_cards.gnut deleted file mode 100644 index 67461945..00000000 --- a/Northstar.CustomServers/mod/scripts/vscripts/sh_calling_cards.gnut +++ /dev/null @@ -1,424 +0,0 @@ -global function ShCallingCards_Init - -global function PlayerCallingCard_GetActive -global function PlayerCallingCard_GetActiveIndex - -global function CallingCard_GetRef -global function CallingCard_GetImage -global function CallingCards_GetCount -global function CallingCard_GetByIndex -global function CallingCard_GetByRef - -global function PlayerCallsignIcon_GetActive -global function PlayerCallsignIcon_GetActiveIndex - -global function CallsignIcon_GetRef -global function CallsignIcon_GetImage -global function CallingCard_GetLayout -global function CallsignIcon_GetSmallImage -global function CallsignIcons_GetCount -global function CallsignIcon_GetByIndex -global function CallsignIcon_GetByRef - -global function PlayerCallingCard_RefOverride - -#if SERVER - global function PlayerCallsignIcon_SetActive - global function PlayerCallingCard_SetActiveByRef - global function PlayerCallsignIcon_SetActiveByRef -#endif - -global struct CallingCard -{ - int index = -1 - string ref = "" - asset image = $"" - int layoutType = 0 -} - -global struct CallsignIcon -{ - int index = -1 - string ref = "" - asset image = $"" - asset smallImage = $"" - int layoutType = 0 -} - -struct -{ - table<string, CallingCard> callingCards - array<string> callingCardRefs - - table<string, CallsignIcon> callsignIcons - array<string> callsignIconRefs - - int nextCallingCardIndex = 0 - int nextCallsignIconIndex = 0 -} file - -void function ShCallingCards_Init() -{ - bool initialized = ( file.callingCardRefs.len() > 0 ) - - if ( !initialized ) - { - var dataTable = GetDataTable( $"datatable/calling_cards.rpak" ) - for ( int row = 0; row < GetDatatableRowCount( dataTable ); row++ ) - { - string cardRef = GetDataTableString( dataTable, row, GetDataTableColumnByName( dataTable, CALLING_CARD_REF_COLUMN_NAME ) ) - asset image = GetDataTableAsset( dataTable, row, GetDataTableColumnByName( dataTable, CALLING_CARD_IMAGE_COLUMN_NAME ) ) - int layoutType = GetDataTableInt( dataTable, row, GetDataTableColumnByName( dataTable, CALLING_CARD_LAYOUT_COLUMN_NAME ) ) - - CallingCard callingCard - callingCard.ref = cardRef - callingCard.image = image - callingCard.index = row - callingCard.layoutType = layoutType - - file.callingCards[cardRef] <- callingCard - file.callingCardRefs.append( cardRef ) - } - } - - if ( !initialized ) - { - var dataTable = GetDataTable( $"datatable/callsign_icons.rpak" ) - for ( int row = 0; row < GetDatatableRowCount( dataTable ); row++ ) - { - string iconRef = GetDataTableString( dataTable, row, GetDataTableColumnByName( dataTable, CALLSIGN_ICON_REF_COLUMN_NAME ) ) - asset image = GetDataTableAsset( dataTable, row, GetDataTableColumnByName( dataTable, CALLSIGN_ICON_IMAGE_COLUMN_NAME ) ) - asset smallImage = GetDataTableAsset( dataTable, row, GetDataTableColumnByName( dataTable, CALLSIGN_ICON_SMALL_IMAGE_COLUMN_NAME ) ) - - CallsignIcon callsignIcon - callsignIcon.ref = iconRef - callsignIcon.image = image - callsignIcon.smallImage = smallImage - callsignIcon.index = row - - file.callsignIcons[iconRef] <- callsignIcon - file.callsignIconRefs.append( iconRef ) - } - } - - #if SERVER - AddCallback_OnClientConnecting( OnClientConnecting ) - AddCallback_OnTitanBecomesPilot( OnClassChangeBecomePilot ) - AddCallback_OnPilotBecomesTitan( OnClassChangeBecomeTitan ) - #endif -} - -#if SERVER -void function OnClientConnecting( entity player ) -{ - // hack - don't do this because pdefs aren't fully working - - // initialize the persistent network vars - // string ref = CallingCard_GetRef( PlayerCallingCard_GetActive( player ) ) - // PlayerCallingCard_SetActiveByRef( player, ref ) - // - // CallsignIcon callsignIcon = PlayerCallsignIcon_GetActive( player ) - // - // PlayerCallsignIcon_SetActive( player, callsignIcon ) - // player.SetTargetInfoIcon( callsignIcon.smallImage ) -} -#endif - -#if DEV -CallingCard function DEV_GetNextCallingCard() -{ - int index = file.nextCallingCardIndex - printt( "using CallingCard index", index ) - file.nextCallingCardIndex++ - file.nextCallingCardIndex = file.nextCallingCardIndex % file.callingCardRefs.len() - - string ref = file.callingCardRefs[index] - return file.callingCards[ref] -} - -CallsignIcon function DEV_GetNextCallsignIcon() -{ - int index = file.nextCallsignIconIndex - printt( "using CallsignIcon index", index ) - file.nextCallsignIconIndex++ - file.nextCallsignIconIndex = file.nextCallsignIconIndex % file.callsignIconRefs.len() - - string ref = file.callsignIconRefs[index] - return file.callsignIcons[ref] -} -#endif - -int function PlayerCallingCard_GetActiveIndex( entity player ) -{ - #if CLIENT - int index - if ( player != GetLocalClientPlayer() ) - index = player.GetPlayerNetInt( "activeCallingCardIndex" ) - else - index = player.GetPersistentVarAsInt( "activeCallingCardIndex" ) - #else - int index = player.GetPersistentVarAsInt( "activeCallingCardIndex" ) - #endif - return index -} - -CallingCard function PlayerCallingCard_GetActive( entity player ) -{ - int index = PlayerCallingCard_GetActiveIndex( player ) - string ref = file.callingCardRefs[index] - #if CLIENT || UI - ref = PlayerCallingCard_RefOverride( player, ref ) - #endif - return file.callingCards[ref] -} - -string function CallingCard_GetRef( CallingCard callingCard ) -{ - return callingCard.ref -} - -asset function CallingCard_GetImage( CallingCard callingCard ) -{ - return callingCard.image -} - -int function CallingCard_GetLayout( CallingCard callingCard ) -{ - return callingCard.layoutType -} - -int function CallingCards_GetCount() -{ - return file.callingCards.len() -} - -CallingCard function CallingCard_GetByIndex( int index ) -{ - // JFS: handle players with invalid indices - //Assert( index < CallingCards_GetCount() ) - if ( index >= file.callingCards.len() ) - return file.callingCards["callsign_16_col"] - - return file.callingCards[file.callingCardRefs[index]] -} - -CallingCard function CallingCard_GetByRef( string ref ) -{ - return file.callingCards[ref] -} - - -int function PlayerCallsignIcon_GetActiveIndex( entity player ) -{ - #if CLIENT - int index - if ( player != GetLocalClientPlayer() ) - index = player.GetPlayerNetInt( "activeCallsignIconIndex" ) - else - index = player.GetPersistentVarAsInt( "activeCallsignIconIndex" ) - #else - int index = player.GetPersistentVarAsInt( "activeCallsignIconIndex" ) - #endif - return index -} - -CallsignIcon function PlayerCallsignIcon_GetActive( entity player ) -{ - int index = PlayerCallsignIcon_GetActiveIndex( player ) - string ref = file.callsignIconRefs[index] - return file.callsignIcons[ref] -} - -string function CallsignIcon_GetRef( CallsignIcon callsignIcon ) -{ - return callsignIcon.ref -} - -asset function CallsignIcon_GetImage( CallsignIcon callsignIcon ) -{ - return callsignIcon.image -} - -asset function CallsignIcon_GetSmallImage( CallsignIcon callsignIcon ) -{ - return callsignIcon.smallImage -} - -int function CallsignIcons_GetCount() -{ - return file.callsignIcons.len() -} - -CallsignIcon function CallsignIcon_GetByIndex( int index ) -{ - // JFS: handle players with invalid indices - // Assert( index < CallsignIcons_GetCount() ) - - if ( index >= file.callsignIconRefs.len() ) - index = 0 - - return file.callsignIcons[file.callsignIconRefs[index]] -} - -CallsignIcon function CallsignIcon_GetByRef( string ref ) -{ - return file.callsignIcons[ref] -} - - -const table< string, string > dynamicCardRefMap = { - callsign_fd_ion_dynamic = "ion", - callsign_fd_tone_dynamic = "tone", - callsign_fd_scorch_dynamic = "scorch", - callsign_fd_legion_dynamic = "legion", - callsign_fd_northstar_dynamic = "northstar", - callsign_fd_ronin_dynamic = "ronin", - callsign_fd_monarch_dynamic = "vanguard", -} - -const table< string, array<string> > dynamicCardMap = { - callsign_fd_ion_dynamic = - [ - "callsign_fd_ion_dynamic", - "callsign_fd_ion_dynamic", - "callsign_fd_ion_hard", - "callsign_fd_ion_master", - "callsign_fd_ion_insane", - ], - - callsign_fd_tone_dynamic = - [ - "callsign_fd_tone_dynamic", - "callsign_fd_tone_dynamic", - "callsign_fd_tone_hard", - "callsign_fd_tone_master", - "callsign_fd_tone_insane", - ], - - callsign_fd_scorch_dynamic = - [ - "callsign_fd_scorch_dynamic", - "callsign_fd_scorch_dynamic", - "callsign_fd_scorch_hard", - "callsign_fd_scorch_master", - "callsign_fd_scorch_insane", - ], - - callsign_fd_legion_dynamic = - [ - "callsign_fd_legion_dynamic", - "callsign_fd_legion_dynamic", - "callsign_fd_legion_hard", - "callsign_fd_legion_master", - "callsign_fd_legion_insane", - ], - - callsign_fd_northstar_dynamic = - [ - "callsign_fd_northstar_dynamic", - "callsign_fd_northstar_dynamic", - "callsign_fd_northstar_hard", - "callsign_fd_northstar_master", - "callsign_fd_northstar_insane", - ], - - callsign_fd_ronin_dynamic = - [ - "callsign_fd_ronin_dynamic", - "callsign_fd_ronin_dynamic", - "callsign_fd_ronin_hard", - "callsign_fd_ronin_master", - "callsign_fd_ronin_insane", - ], - - callsign_fd_monarch_dynamic = - [ - "callsign_fd_monarch_dynamic", - "callsign_fd_monarch_dynamic", - "callsign_fd_monarch_hard", - "callsign_fd_monarch_master", - "callsign_fd_monarch_insane", - ], -} - -string function PlayerCallingCard_RefOverride( entity player, string ref ) -{ - const string CARD_DYNAMIC = "_dynamic" - - if ( ref.find( CARD_DYNAMIC ) == null ) - return ref - - if ( ref.find( CARD_DYNAMIC ) != ref.len() - CARD_DYNAMIC.len() ) - return ref - - if ( ref in dynamicCardRefMap ) - { - string titanRef = dynamicCardRefMap[ref] - int highestDifficulty = FD_GetHighestDifficultyForTitan( player, titanRef ) - - return dynamicCardMap[ref][minint( highestDifficulty, dynamicCardMap[ref].len() - 1 )] - } - - return ref -} - -#if SERVER -/* -InitUnlockAsEntitlement( "callsign_fd_ion_dynamic", "", ET_DLC7_ION_WARPAINT ) -InitUnlockAsEntitlement( "callsign_fd_tone_dynamic", "", ET_DLC7_TONE_WARPAINT ) -InitUnlockAsEntitlement( "callsign_fd_scorch_dynamic", "", ET_DLC7_SCORCH_WARPAINT ) -InitUnlockAsEntitlement( "callsign_fd_legion_dynamic", "", ET_DLC7_LEGION_WARPAINT ) -InitUnlockAsEntitlement( "callsign_fd_northstar_dynamic", "", ET_DLC7_NORTHSTAR_WARPAINT ) -InitUnlockAsEntitlement( "callsign_fd_ronin_dynamic", "", ET_DLC7_RONIN_WARPAINT ) -InitUnlockAsEntitlement( "callsign_fd_monarch_dynamic", "", ET_DLC7_MONARCH_WARPAINT ) -*/ - -void function PlayerCallingCard_SetActiveByIndex( entity player, int index ) -{ -// if ( player.GetPersistentVarAsInt( "activeCallingCardIndex" ) != index ) - player.SetCallingCard( index ) - - player.SetPlayerNetInt( "activeCallingCardIndex", index ) - player.SetPersistentVar( "activeCallingCardIndex", index ) -} - -void function PlayerCallingCard_SetActiveByRef( entity player, string ref ) -{ - PlayerCallingCard_SetActiveByIndex( player, file.callingCards[ref].index ) - - if ( PlayerCallingCard_RefOverride( player, ref ) != ref ) - player.SetCallingCard( file.callingCards[PlayerCallingCard_RefOverride( player, ref )].index ) -} - -void function PlayerCallsignIcon_SetActiveByIndex( entity player, int index ) -{ -// if ( player.GetPersistentVarAsInt( "activeCallsignIconIndex" ) != index ) - player.SetCallSign( index ) - - player.SetPlayerNetInt( "activeCallsignIconIndex", index ) - player.SetPersistentVar( "activeCallsignIconIndex", index ) -} - -void function PlayerCallsignIcon_SetActive( entity player, CallsignIcon callsignIcon ) -{ - PlayerCallsignIcon_SetActiveByIndex( player, callsignIcon.index ) -} - -void function PlayerCallsignIcon_SetActiveByRef( entity player, string ref ) -{ - PlayerCallsignIcon_SetActiveByIndex( player, file.callsignIcons[ref].index ) -} - -void function OnClassChangeBecomePilot( entity player, entity titan ) -{ - CallsignIcon callsignIcon = PlayerCallsignIcon_GetActive( player ) - player.SetTargetInfoIcon( callsignIcon.smallImage ) -} - -void function OnClassChangeBecomeTitan( entity player, entity titan ) -{ - string titanRef = GetTitanCharacterNameFromSetFile( player.GetPlayerSettings() ) - player.SetTargetInfoIcon( GetTitanCoreIcon( titanRef ) ) -} - -#endif
\ No newline at end of file diff --git a/Northstar.CustomServers/mod/scripts/vscripts/sh_stats.gnut b/Northstar.CustomServers/mod/scripts/vscripts/sh_stats.gnut deleted file mode 100644 index 31634a9b..00000000 --- a/Northstar.CustomServers/mod/scripts/vscripts/sh_stats.gnut +++ /dev/null @@ -1,526 +0,0 @@ - -global function InitStatsTables -global function IsValidStat -global function GetPlayerStatInt -global function GetPlayerStatFloat -global function GetPlayerStat_AllCompetitiveModesAndMapsInt -global function GetStatVar -global function GetStatVarType -global function GetStatVarLocalizedUnlock -global function Stats_GetFixedSaveVar -global function FD_GetHighestDifficultyForTitan - -/*void function AddItemsToStatsList( array<string> refs ) -{ - foreach ( ref in refs ) - shGlobalMP.statsItemsList.append( ref ) -}*/ - -void function InitStatsTables() -{ - int persistenceItemsCount = PersistenceGetEnumCount( "loadoutWeaponsAndAbilities" ) - for ( int i = 0; i < persistenceItemsCount; i++ ) - { - string enumName = PersistenceGetEnumItemNameForIndex( "loadoutWeaponsAndAbilities", i ) - if ( enumName != "" ) - shGlobalMP.statsItemsList.append( enumName ) - } - - //############################################## - // GAMES STATS - //############################################## - - AddPersistentStatCategory( "game_stats" ) - - AddPersistentStat( "game_stats", "game_joined", "", "mapStats[%mapname%].gamesJoined[%gamemode%]", "#" ) - AddPersistentStat( "game_stats", "game_completed", "", "mapStats[%mapname%].gamesCompleted[%gamemode%]", "#" ) - AddPersistentStat( "game_stats", "game_won", "", "mapStats[%mapname%].gamesWon[%gamemode%]", "#" ) - AddPersistentStat( "game_stats", "game_lost", "", "mapStats[%mapname%].gamesLost[%gamemode%]", "#" ) - AddPersistentStat( "game_stats", "mvp", "", "mapStats[%mapname%].topPlayerOnTeam[%gamemode%]", "#" ) - AddPersistentStat( "game_stats", "top3OnTeam", "", "mapStats[%mapname%].top3OnTeam[%gamemode%]", "#" ) - AddPersistentStat( "game_stats", "hoursPlayed", "", "mapStats[%mapname%].hoursPlayed[%gamemode%]", "#" ) - AddPersistentStat( "game_stats", "perfectMatches", "", "mapStats[%mapname%].perfectMatchesByDifficulty[%difficulty%]", "#" ) - AddPersistentStat( "game_stats", "games_completed_fd", "", "mapStats[%mapname%].matchesByDifficulty[%difficulty%]", "#" ) - AddPersistentStat( "game_stats", "games_won_fd", "", "mapStats[%mapname%].winsByDifficulty[%difficulty%]", "#" ) - - int gameModeCount = PersistenceGetEnumCount( "gameModes" ) - for ( int modeIndex = 0; modeIndex < gameModeCount; modeIndex++ ) - { - string gameModeName = PersistenceGetEnumItemNameForIndex( "gameModes", modeIndex ) - - AddPersistentStat( "game_stats", "mode_played", gameModeName, "gameStats.modesPlayed[" + gameModeName + "]", "#UNLOCK_MODE_PLAYED" ) - AddPersistentStat( "game_stats", "mode_won", gameModeName, "gameStats.modesWon[" + gameModeName + "]", "#UNLOCK_MODE_WON" ) - - AddPersistentStat( "game_stats", "pvp_kills_by_mode", gameModeName, "gameStats.pvpKills[" + gameModeName + "]", "#UNLOCK_MODE_PILOT_KILLS" ) - AddPersistentStat( "game_stats", "times_kd_2_to_1_by_mode", gameModeName, "gameStats.timesKillDeathRatio2to1[" + gameModeName + "]", "#UNLOCK_MODE_KD_2_1" ) - AddPersistentStat( "game_stats", "times_kd_2_to_1_pvp_by_mode", gameModeName, "gameStats.timesKillDeathRatio2to1_pvp[" + gameModeName + "]", "#UNLOCK_MODE_PILOT_KD_2_1" ) - } - - AddPersistentStat( "game_stats", "mvp_total", "", "gameStats.mvp_total", "#UNLOCK_GAME_MVP" ) - AddPersistentStat( "game_stats", "game_completed_total", "", "gameStats.gamesCompletedTotal", "#UNLOCK_GAME_COMPLETED" ) - AddPersistentStat( "game_stats", "game_won_total", "", "gameStats.gamesWonTotal", "#UNLOCK_GAME_WON" ) - - //############################################## - // TIME STATS - //############################################## - - AddPersistentStatCategory( "time_stats" ) - - AddPersistentStatFloat( "time_stats", "hours_total", "", "timeStats.total", "#UNLOCK_TIME_HOURS" ) - AddPersistentStatFloat( "time_stats", "hours_as_pilot", "", "timeStats.asPilot", "#UNLOCK_TIME_HOURS_PILOT" ) - AddPersistentStatFloat( "time_stats", "hours_wallrunning", "", "timeStats.wallrunning", "#UNLOCK_TIME_HOURS_WALLRUN" ) - AddPersistentStatFloat( "time_stats", "hours_inAir", "", "timeStats.inAir", "#UNLOCK_TIME_HOURS_AIR" ) - AddPersistentStatFloat( "time_stats", "hours_as_titan", "", "timeStats.asTitanTotal", "#UNLOCK_TIME_HOURS_TITAN" ) - - AddPersistentStatFloat( "time_stats", "hours_dead", "", "timeStats.dead", "#" ) - AddPersistentStatFloat( "time_stats", "hours_wallhanging", "", "timeStats.wallhanging", "#" ) - - // hours_as_titan_stryder - // hours_as_titan_atlas - // hours_as_titan_ogre - foreach ( titan, alias in GetAsTitanTypes() ) - { - AddPersistentStatFloat( "time_stats", "hours_as_titan_" + alias, "", "timeStats.asTitan[" + alias + "]", "#UNLOCK_TIME_HOURS_TITAN_SPECIFIC" ) - } - - //############################################## - // DISTANCE STATS - //############################################## - - AddPersistentStatCategory( "distance_stats" ) - - AddPersistentStatFloat( "distance_stats", "total", "", "distanceStats.total", "#UNLOCK_DISTANCE_KM" ) - AddPersistentStatFloat( "distance_stats", "asPilot", "", "distanceStats.asPilot", "#UNLOCK_DISTANCE_KM_PILOT" ) - AddPersistentStatFloat( "distance_stats", "wallrunning", "", "distanceStats.wallrunning", "#UNLOCK_DISTANCE_KM_WALLRUN" ) - AddPersistentStatFloat( "distance_stats", "inAir", "", "distanceStats.inAir", "#UNLOCK_DISTANCE_KM_AIR" ) - AddPersistentStatFloat( "distance_stats", "asTitan", "", "distanceStats.asTitanTotal", "#UNLOCK_TIME_HOURS_TITAN" ) - - AddPersistentStatFloat( "distance_stats", "ziplining", "", "distanceStats.ziplining", "#" ) - AddPersistentStatFloat( "distance_stats", "onFriendlyTitan", "", "distanceStats.onFriendlyTitan", "#" ) - AddPersistentStatFloat( "distance_stats", "onEnemyTitan", "", "distanceStats.onEnemyTitan", "#" ) - - foreach ( titan, alias in GetAsTitanTypes() ) - { - AddPersistentStatFloat( "distance_stats", titan, "", "distanceStats.asTitan[" + alias + "]", "#UNLOCK_DISTANCE_KM_TITAN_SPECIFIC" ) - } - - //############################################## - // WEAPON STATS - //############################################## - - AddPersistentStatCategory( "weapon_stats" ) - - foreach ( string ref in shGlobalMP.statsItemsList ) - { - AddPersistentStat( "weapon_stats", "shotsHit", ref, "weaponStats[" + ref + "].shotsHit", "#UNLOCK_WEAPON_SHOTS_HIT" ) - AddPersistentStat( "weapon_stats", "headshots", ref, "weaponStats[" + ref + "].headshots", "#UNLOCK_WEAPON_HEADSHOTS" ) - AddPersistentStat( "weapon_stats", "critHits", ref, "weaponStats[" + ref + "].critHits", "#UNLOCK_WEAPON_SHOTS_CRIT" ) - AddPersistentStatFloat( "weapon_stats", "hoursUsed", ref, "weaponStats[" + ref + "].hoursUsed", "#UNLOCK_WEAPON_HOURS_USED" ) - AddPersistentStatFloat( "weapon_stats", "hoursEquipped", ref, "weaponStats[" + ref + "].hoursEquipped", "#UNLOCK_WEAPON_HOURS_EQUIPPED" ) - - AddPersistentStat( "weapon_stats", "shotsFired", ref, "weaponStats[" + ref + "].shotsFired", "#" ) - AddPersistentStat( "weapon_stats", "titanDamage", ref, "weaponStats[" + ref + "].titanDamage", "#UNLOCK_WEAPON_TITAN_DAMAGE" ) - } - - //############################################## - // KILLS STATS FOR WEAPON - //############################################## - - AddPersistentStatCategory( "weapon_kill_stats" ) - - foreach ( string ref in shGlobalMP.statsItemsList ) - { - AddPersistentStat( "weapon_kill_stats", "total", ref, "weaponKillStats[" + ref + "].total", "#UNLOCK_WEAPON_KILLS" ) - AddPersistentStat( "weapon_kill_stats", "pilots", ref, "weaponKillStats[" + ref + "].pilots", "#UNLOCK_WEAPON_PILOT_KILLS" ) - AddPersistentStat( "weapon_kill_stats", "ejecting_pilots", ref, "weaponKillStats[" + ref + "].ejecting_pilots", "#UNLOCK_WEAPON_GOOSER_KILLS" ) - AddPersistentStat( "weapon_kill_stats", "titansTotal", ref, "weaponKillStats[" + ref + "].titansTotal", "#UNLOCK_WEAPON_TITAN_KILLS" ) - AddPersistentStat( "weapon_kill_stats", "assistsTotal", ref, "weaponKillStats[" + ref + "].assistsTotal", "#UNLOCK_WEAPON_ASSISTS" ) - AddPersistentStat( "weapon_kill_stats", "killingSprees", ref, "weaponKillStats[" + ref + "].killingSprees", "#UNLOCK_WEAPON_KILLING_SPREES" ) - - AddPersistentStat( "weapon_kill_stats", "spectres", ref, "weaponKillStats[" + ref + "].spectres", "#" ) - AddPersistentStat( "weapon_kill_stats", "marvins", ref, "weaponKillStats[" + ref + "].marvins", "#" ) - AddPersistentStat( "weapon_kill_stats", "grunts", ref, "weaponKillStats[" + ref + "].grunts", "#" ) - AddPersistentStat( "weapon_kill_stats", "ai", ref, "weaponKillStats[" + ref + "].ai", "#" ) - - foreach ( titan, alias in GetPluralTitanTypes() ) - { - AddPersistentStat( "weapon_kill_stats", titan, ref, "weaponKillStats[" + ref + "].titans[" + alias + "]", "#" ) - } - - // fix this so it doesn't need explicit list of titans - AddPersistentStat( "weapon_kill_stats", "npcTitans_ion", ref, "weaponKillStats[" + ref + "].npcTitans[ion]", "#" ) - AddPersistentStat( "weapon_kill_stats", "npcTitans_scorch", ref, "weaponKillStats[" + ref + "].npcTitans[scorch]", "#" ) - AddPersistentStat( "weapon_kill_stats", "npcTitans_northstar", ref, "weaponKillStats[" + ref + "].npcTitans[northstar]", "#" ) - AddPersistentStat( "weapon_kill_stats", "npcTitans_ronin", ref, "weaponKillStats[" + ref + "].npcTitans[ronin]", "#" ) - AddPersistentStat( "weapon_kill_stats", "npcTitans_tone", ref, "weaponKillStats[" + ref + "].npcTitans[tone]", "#" ) - AddPersistentStat( "weapon_kill_stats", "npcTitans_legion", ref, "weaponKillStats[" + ref + "].npcTitans[legion]", "#" ) - AddPersistentStat( "weapon_kill_stats", "npcTitans_vanguard", ref, "weaponKillStats[" + ref + "].npcTitans[vanguard]", "#" ) - } - - //############################################## - // GENERAL KILLS STATS - //############################################## - - AddPersistentStatCategory( "kills_stats" ) - - AddPersistentStat( "kills_stats", "total", "", "killStats.total", "#UNLOCK_KILLS_TOTAL" ) - AddPersistentStat( "kills_stats", "totalWhileUsingBurnCard", "", "killStats.totalWhileUsingBurnCard", "#" ) - AddPersistentStat( "kills_stats", "titansWhileTitanBCActive", "", "killStats.titansWhileTitanBCActive", "#" ) - AddPersistentStat( "kills_stats", "totalPVP", "", "killStats.totalPVP", "#" ) - AddPersistentStat( "kills_stats", "pilots", "", "killStats.pilots", "#UNLOCK_KILLS_PILOT" ) - AddPersistentStat( "kills_stats", "spectres", "", "killStats.spectres", "#" ) - AddPersistentStat( "kills_stats", "marvins", "", "killStats.marvins", "#" ) - AddPersistentStat( "kills_stats", "grunts", "", "killStats.grunts", "#" ) - AddPersistentStat( "kills_stats", "totalTitans", "", "killStats.totalTitans", "#UNLOCK_KILLS_TITAN" ) - AddPersistentStat( "kills_stats", "totalPilots", "", "killStats.totalPilots", "#" ) - AddPersistentStat( "kills_stats", "totalNPC", "", "killStats.totalNPC", "#" ) - AddPersistentStat( "kills_stats", "totalTitansWhileDoomed", "", "killStats.totalTitansWhileDoomed", "#UNLOCK_KILLS_TITAN_WHILE_DOOMED" ) - AddPersistentStat( "kills_stats", "asPilot", "", "killStats.asPilot", "#" ) - AddPersistentStat( "kills_stats", "totalAssists", "", "killStats.totalAssists", "#UNLOCK_KILLS_ASSISTS" ) - - foreach ( titan, alias in GetAsTitanTypes() ) - { - AddPersistentStat( "kills_stats", titan, "", "killStats.asTitan[" + alias + "]", "#UNLOCK_KILLS_ASTITAN" ) - } - - AddPersistentStat( "kills_stats", "killingSpressAs_ion", "", "killStats.killingSprees[ion]", "#UNLOCK_KILLS_SPREES_ASTITAN" ) - AddPersistentStat( "kills_stats", "killingSpressAs_scorch", "", "killStats.killingSprees[scorch]", "#UNLOCK_KILLS_SPREES_ASTITAN" ) - AddPersistentStat( "kills_stats", "killingSpressAs_northstar", "", "killStats.killingSprees[northstar]", "#UNLOCK_KILLS_SPREES_ASTITAN" ) - AddPersistentStat( "kills_stats", "killingSpressAs_ronin", "", "killStats.killingSprees[ronin]", "#UNLOCK_KILLS_SPREES_ASTITAN" ) - AddPersistentStat( "kills_stats", "killingSpressAs_tone", "", "killStats.killingSprees[tone]", "#UNLOCK_KILLS_SPREES_ASTITAN" ) - AddPersistentStat( "kills_stats", "killingSpressAs_legion", "", "killStats.killingSprees[legion]", "#UNLOCK_KILLS_SPREES_ASTITAN" ) - AddPersistentStat( "kills_stats", "killingSpressAs_vanguard", "", "killStats.killingSprees[vanguard]", "#UNLOCK_KILLS_SPREES_ASTITAN" ) - - AddPersistentStat( "kills_stats", "firstStrikes", "", "killStats.firstStrikes", "#UNLOCK_KILLS_FIRST_STRIKE" ) - AddPersistentStat( "kills_stats", "ejectingPilots", "", "killStats.ejectingPilots", "#UNLOCK_KILLS_GOOSER" ) - AddPersistentStat( "kills_stats", "whileEjecting", "", "killStats.whileEjecting", "#" ) - AddPersistentStat( "kills_stats", "cloakedPilots", "", "killStats.cloakedPilots", "#" ) - AddPersistentStat( "kills_stats", "whileCloaked", "", "killStats.whileCloaked", "#" ) - AddPersistentStat( "kills_stats", "wallrunningPilots", "", "killStats.wallrunningPilots", "#" ) - AddPersistentStat( "kills_stats", "whileWallrunning", "", "killStats.whileWallrunning", "#" ) - AddPersistentStat( "kills_stats", "wallhangingPilots", "", "killStats.wallhangingPilots", "#" ) - AddPersistentStat( "kills_stats", "whileWallhanging", "", "killStats.whileWallhanging", "#" ) - - AddPersistentStat( "kills_stats", "pilotExecution", "", "killStats.pilotExecution", "#" ) - AddPersistentStat( "kills_stats", "pilotExecutePilot", "", "killStats.pilotExecutePilot", "#UNLOCK_KILLS_PILOT_EXECUTION" ) - AddPersistentStat( "kills_stats", "pilotExecutePilotWhileCloaked", "", "killStats.pilotExecutePilotWhileCloaked", "#UNLOCK_KILLS_PILOT_EXECUTION_WHILE_CLOAKED" ) - AddPersistentStat( "kills_stats", "pilotKillsWithHoloPilotActive", "", "killStats.pilotKillsWithHoloPilotActive", "#UNLOCK_KILLS_PILOT_KILLS_WHILE_HOLOPILOT_ACTIVE" ) - AddPersistentStat( "kills_stats", "pilotKillsWithAmpedWallActive", "", "killStats.pilotKillsWithAmpedWallActive", "#UNLOCK_KILLS_PILOT_KILLS_WHILE_AMPEDWALL_ACTIVE" ) - - int pilotExecutionCount = PersistenceGetEnumCount( "pilotExecution" ) - for ( int i = 0; i < pilotExecutionCount; i++ ) - { - string executionRef = PersistenceGetEnumItemNameForIndex( "pilotExecution", i ) - if ( executionRef != "" ) - AddPersistentStat( "kills_stats", "pilotExecutePilotUsing_" + executionRef, "", "killStats.pilotExecutePilotByType[" + executionRef + "]", "#UNLOCK_KILLS_PILOT_EXECUTION_USING_TELEFRAG" ) // will need to modify string if other unlock refs are used - } - - AddPersistentStat( "kills_stats", "pilotKickMelee", "", "killStats.pilotKickMelee", "#" ) - AddPersistentStat( "kills_stats", "pilotKickMeleePilot", "", "killStats.pilotKickMeleePilot", "#" ) - AddPersistentStat( "kills_stats", "titanMelee", "", "killStats.titanMelee", "#" ) - AddPersistentStat( "kills_stats", "titanMeleePilot", "", "killStats.titanMeleePilot", "#" ) - AddPersistentStat( "kills_stats", "titanStepCrush", "", "killStats.titanStepCrush", "#" ) - AddPersistentStat( "kills_stats", "titanStepCrushPilot", "", "killStats.titanStepCrushPilot", "#" ) - - foreach ( titan, alias in GetCapitalizedTitanTypes() ) - { - AddPersistentStat( "kills_stats", "titanExocution" + titan, "", "killStats.titanExocution" + titan, "#UNLOCK_KILLS_TITAN_EXECUTION" ) - } - - AddPersistentStat( "kills_stats", "titanFallKill", "", "killStats.titanFallKill", "#UNLOCK_KILLS_TITANFALL" ) - AddPersistentStat( "kills_stats", "petTitanKillsFollowMode", "", "killStats.petTitanKillsFollowMode", "#" ) - AddPersistentStat( "kills_stats", "petTitanKillsGuardMode", "", "killStats.petTitanKillsGuardMode", "#" ) - AddPersistentStat( "kills_stats", "rodeo_total", "", "killStats.rodeo_total", "#UNLOCK_KILLS_RODEO" ) - AddPersistentStat( "kills_stats", "pilot_headshots_total", "", "killStats.pilot_headshots_total", "#UNLOCK_KILLS_HEADSHOT" ) - AddPersistentStat( "kills_stats", "evacShips", "", "killStats.evacShips", "#" ) - AddPersistentStat( "kills_stats", "flyers", "", "killStats.flyers", "#" ) - AddPersistentStat( "kills_stats", "nuclearCore", "", "killStats.nuclearCore", "#" ) - AddPersistentStat( "kills_stats", "evacuatingEnemies", "", "killStats.evacuatingEnemies", "#" ) - AddPersistentStat( "kills_stats", "coopChallenge_NukeTitan_Kills", "", "killStats.coopChallenge_NukeTitan_Kills", "#" ) - AddPersistentStat( "kills_stats", "coopChallenge_MortarTitan_Kills", "", "killStats.coopChallenge_MortarTitan_Kills", "#" ) - AddPersistentStat( "kills_stats", "coopChallenge_EmpTitan_Kills", "", "killStats.coopChallenge_EmpTitan_Kills", "#" ) - AddPersistentStat( "kills_stats", "coopChallenge_SuicideSpectre_Kills", "", "killStats.coopChallenge_SuicideSpectre_Kills", "#" ) - AddPersistentStat( "kills_stats", "coopChallenge_Turret_Kills", "", "killStats.coopChallenge_Turret_Kills", "#" ) - AddPersistentStat( "kills_stats", "coopChallenge_CloakDrone_Kills", "", "killStats.coopChallenge_CloakDrone_Kills", "#" ) - AddPersistentStat( "kills_stats", "coopChallenge_BubbleShieldGrunt_Kills", "", "killStats.coopChallenge_BubbleShieldGrunt_Kills", "#" ) - AddPersistentStat( "kills_stats", "coopChallenge_Dropship_Kills", "", "killStats.coopChallenge_Dropship_Kills", "#" ) - AddPersistentStat( "kills_stats", "coopChallenge_Sniper_Kills", "", "killStats.coopChallenge_Sniper_Kills", "#" ) - AddPersistentStat( "kills_stats", "ampedVortexKills", "", "killStats.ampedVortexKills", "#" ) - AddPersistentStat( "kills_stats", "meleeWhileCloaked", "", "killStats.meleeWhileCloaked", "#" ) - AddPersistentStat( "kills_stats", "pilotKillsWhileUsingActiveRadarPulse", "", "killStats.pilotKillsWhileUsingActiveRadarPulse", "#" ) - AddPersistentStat( "kills_stats", "titanKillsAsPilot", "", "killStats.titanKillsAsPilot", "#UNLOCK_KILLS_PVT" ) - AddPersistentStat( "kills_stats", "pilotKillsWhileStimActive", "", "killStats.pilotKillsWhileStimActive", "#" ) - AddPersistentStat( "kills_stats", "pilotKillsAsTitan", "", "killStats.pilotKillsAsTitan", "#UNLOCK_KILLS_TVP" ) - AddPersistentStat( "kills_stats", "pilotKillsAsPilot", "", "killStats.pilotKillsAsPilot", "#" ) - AddPersistentStat( "kills_stats", "titanKillsAsTitan", "", "killStats.titanKillsAsTitan", "#" ) - - #if SERVER - AddPersistentStat( "kills_stats", "pilotExecutePilotUsing_execution_telefrag", "", "killStats.pilotExecutePilotUsing_execution_telefrag", "#" ) - #endif - - //############################################## - // GENERAL DEATHS STATS - //############################################## - - AddPersistentStatCategory( "deaths_stats" ) - - AddPersistentStat( "deaths_stats", "total", "", "deathStats.total" ) - AddPersistentStat( "deaths_stats", "totalPVP", "", "deathStats.totalPVP" ) - AddPersistentStat( "deaths_stats", "asPilot", "", "deathStats.asPilot" ) - - foreach ( titan, alias in GetAsTitanTypes() ) - { - AddPersistentStat( "deaths_stats", titan, "", "deathStats.asTitan[" + alias + "]" ) - } - - AddPersistentStat( "deaths_stats", "byPilots", "", "deathStats.byPilots" ) - - foreach ( titan, alias in GetByTitanTypes() ) - { - AddPersistentStat( "deaths_stats", titan, "", "deathStats.byTitans[" + alias + "]" ) - } - - AddPersistentStat( "deaths_stats", "bySpectres", "", "deathStats.bySpectres" ) - AddPersistentStat( "deaths_stats", "byGrunts", "", "deathStats.byGrunts" ) - - foreach ( titan, alias in GetAsNPCTitanTypes() ) - { - AddPersistentStat( "deaths_stats", titan, "", "deathStats.byNPCTitans[" + alias + "]" ) - } - AddPersistentStat( "deaths_stats", "suicides", "", "deathStats.suicides" ) - AddPersistentStat( "deaths_stats", "whileEjecting", "", "deathStats.whileEjecting" ) - - - array<string> titanChassis = ["ion", "scorch", "northstar", "ronin", "tone", "legion", "vanguard"] - - AddPersistentStatCategory( "titan_stats" ) - - foreach ( titan, chassis in GetCapitalizedTitanTypes() ) - { - AddPersistentStat( "titan_stats", "pilots", chassis, "titanStats[" + chassis + "].pilots", "#UNLOCK_TITAN_PILOT_KILLS" ) - AddPersistentStat( "titan_stats", "titansTotal", chassis, "titanStats[" + chassis + "].titansTotal", "#UNLOCK_TITAN_TITAN_KILLS" ) - AddPersistentStat( "titan_stats", "titanDamage", chassis, "titanStats[" + chassis + "].titanDamage", "#UNLOCK_TITAN_TITAN_DAMAGE" ) - AddPersistentStat( "titan_stats", "coresEarned", chassis, "titanStats[" + chassis + "].coresEarned" ) - AddPersistentStat( "titan_stats", "pilotsAsPrime", chassis, "titanStats[" + chassis + "].pilotsAsPrime", "#UNLOCK_TITAN_PRIME_PILOT_KILLS" ) - AddPersistentStat( "titan_stats", "titansAsPrime", chassis, "titanStats[" + chassis + "].titansAsPrime", "#UNLOCK_TITAN_PRIME_TITAN_KILLS" ) - AddPersistentStat( "titan_stats", "executionsAsPrime", chassis, "titanStats[" + chassis + "].executionsAsPrime", "#UNLOCK_TITAN_PRIME_EXECUTIONS" ) - AddPersistentStat( "titan_stats", "matchesByDifficulty", chassis, "titanStats[" + chassis + "].matchesByDifficulty[%difficulty%]", "" ) - AddPersistentStat( "titan_stats", "perfectMatchesByDifficulty", chassis, "titanStats[" + chassis + "].perfectMatchesByDifficulty[%difficulty%]", "" ) - } - - //############################################## - // MISC STATS - //############################################## - - AddPersistentStatCategory( "misc_stats" ) - - AddPersistentStat( "misc_stats", "titanFalls", "", "miscStats.titanFalls", "#UNLOCK_MISC_TITANFALLS" ) - AddPersistentStat( "misc_stats", "titanFallsFirst", "", "miscStats.titanFallsFirst", "#UNLOCK_MISC_TITANFALLS_FIRST" ) - AddPersistentStat( "misc_stats", "titanEmbarks", "", "miscStats.titanEmbarks", "#" ) - AddPersistentStat( "misc_stats", "rodeos", "", "miscStats.rodeos", "#UNLOCK_MISC_RODEOS" ) - AddPersistentStat( "misc_stats", "rodeosFromEject", "", "miscStats.rodeosFromEject", "#UNLOCK_MISC_RODOES_EJECT" ) - AddPersistentStat( "misc_stats", "timesEjected", "", "miscStats.timesEjected", "#" ) - AddPersistentStat( "misc_stats", "timesEjectedNuclear", "", "miscStats.timesEjectedNuclear", "#" ) - AddPersistentStat( "misc_stats", "burnCardsEarned", "", "miscStats.burnCardsEarned", "#" ) - AddPersistentStat( "misc_stats", "burnCardsSpent", "", "miscStats.burnCardsSpent", "#" ) - AddPersistentStat( "misc_stats", "boostsActivated", "", "miscStats.boostsActivated", "#" ) - AddPersistentStat( "misc_stats", "spectreLeeches", "", "miscStats.spectreLeeches", "#" ) - AddPersistentStat( "misc_stats", "spectreLeechesByMap", "", "miscStats.spectreLeechesByMap[%mapname%]", "#" ) - AddPersistentStat( "misc_stats", "evacsAttempted", "", "miscStats.evacsAttempted", "#" ) - AddPersistentStat( "misc_stats", "evacsSurvived", "", "miscStats.evacsSurvived", "#UNLOCK_MISC_EVACS" ) - AddPersistentStat( "misc_stats", "flagsCaptured", "", "miscStats.flagsCaptured", "#" ) - AddPersistentStat( "misc_stats", "flagsReturned", "", "miscStats.flagsReturned", "#" ) - AddPersistentStat( "misc_stats", "arcCannonMultiKills", "", "miscStats.arcCannonMultiKills", "#" ) - AddPersistentStat( "misc_stats", "gruntsConscripted", "", "miscStats.gruntsConscripted", "#" ) - AddPersistentStat( "misc_stats", "hardpointsCaptured", "", "miscStats.hardpointsCaptured", "#" ) - AddPersistentStat( "misc_stats", "challengeTiersCompleted", "", "miscStats.challengeTiersCompleted", "#" ) - AddPersistentStat( "misc_stats", "challengesCompleted", "", "miscStats.challengesCompleted", "#" ) - AddPersistentStat( "misc_stats", "dailyChallengesCompleted", "", "miscStats.dailyChallengesCompleted", "#" ) - AddPersistentStat( "misc_stats", "timesLastTitanRemaining", "", "miscStats.timesLastTitanRemaining", "#" ) - AddPersistentStat( "misc_stats", "killingSprees", "", "miscStats.killingSprees", "#UNLOCK_MISC_KILLING_SPREES" ) - AddPersistentStat( "misc_stats", "coopChallengesCompleted", "", "miscStats.coopChallengesCompleted", "#" ) - - //############################################## - // FD STATS - //############################################## - - AddPersistentStatCategory( "fd_stats" ) - - AddPersistentStat( "fd_stats", "arcMinesPlaced", "", "fdStats.arcMinesPlaced", "#UNLOCK_MISC_ARC_MINE_PLACE" ) - AddPersistentStat( "fd_stats", "turretsPlaced", "", "fdStats.turretsPlaced", "#UNLOCK_MISC_TURRET_PLACE" ) - AddPersistentStat( "fd_stats", "rodeos", "", "fdStats.rodeos", "#UNLOCK_FD_RODEOS" ) - AddPersistentStat( "fd_stats", "rodeoNukes", "", "fdStats.rodeoNukes", "#UNLOCK_MISC_RODEO_NUKES" ) - AddPersistentStat( "fd_stats", "arcMineZaps", "", "fdStats.arcMineZaps", "#UNLOCK_MISC_ARC_MINE_ZAPS" ) - AddPersistentStat( "fd_stats", "turretKills", "", "fdStats.turretKills", "#UNLOCK_MISC_TURRET_KILLS" ) - AddPersistentStat( "fd_stats", "harvesterBoosts", "", "fdStats.harvesterBoosts", "#UNLOCK_MISC_HARVESTER_BOOSTS" ) - AddPersistentStat( "fd_stats", "wavesComplete", "", "fdStats.wavesComplete", "#UNLOCK_MISC_WAVES_COMPLETE" ) - AddPersistentStat( "fd_stats", "easyWins", "", "fdStats.easyWins", "#UNLOCK_FD_EASY_WINS" ) - AddPersistentStat( "fd_stats", "normalWins", "", "fdStats.normalWins", "#UNLOCK_FD_NORMAL_WINS" ) - AddPersistentStat( "fd_stats", "hardWins", "", "fdStats.hardWins", "#UNLOCK_FD_HARD_WINS" ) - AddPersistentStat( "fd_stats", "masterWins", "", "fdStats.masterWins", "#UNLOCK_FD_MASTER_WINS" ) - AddPersistentStat( "fd_stats", "insaneWins", "", "fdStats.insaneWins", "#UNLOCK_FD_INSANE_WINS" ) - AddPersistentStat( "fd_stats", "highestTitanFDLevel", "", "fdStats.highestTitanFDLevel", "#UNLOCK_FD_TITAN_LEVEL" ) - - //############################################################# - // DEV ONLY STATS (NOT TRACKED IN RETAIL FOR PLAYER DISPLAY) - //############################################################# - - AddPersistentStatCategory( "dev_stats" ) - - AddPersistentStat( "dev_stats", "rank_skill", "", DEV_STAT ) - AddPersistentStat( "dev_stats", "raw_rank_skill", "", DEV_STAT ) -} - -void function AddPersistentStatCategory( string category ) -{ - shGlobalMP.playerStatVars[ category ] <- {} -} - -void function AddPersistentStat( string category, string alias, string subAlias, string variable, string localizedUnlock = "" ) -{ - if ( !( alias in shGlobalMP.playerStatVars[ category ] ) ) - shGlobalMP.playerStatVars[ category ][ alias ] <- {} - Assert( !( variable in shGlobalMP.playerStatVars[ category ][ alias ] ) ) - - PlayerStatData playerStatData - playerStatData.statVar = variable - playerStatData.statType = ePlayerStatType.INT - playerStatData.localizedUnlock = localizedUnlock - shGlobalMP.playerStatVars[ category ][ alias ][ subAlias ] <- playerStatData -} - -void function AddPersistentStatInt( string category, string alias, string subAlias, string variable, string localizedUnlock = "" ) -{ - if ( !( alias in shGlobalMP.playerStatVars[ category ] ) ) - shGlobalMP.playerStatVars[ category ][ alias ] <- {} - Assert( !( variable in shGlobalMP.playerStatVars[ category ][ alias ] ) ) - - PlayerStatData playerStatData - playerStatData.statVar = variable - playerStatData.statType = ePlayerStatType.INT - playerStatData.localizedUnlock = localizedUnlock - shGlobalMP.playerStatVars[ category ][ alias ][ subAlias ] <- playerStatData -} - -void function AddPersistentStatFloat( string category, string alias, string subAlias, string variable, string localizedUnlock = "" ) -{ - if ( !( alias in shGlobalMP.playerStatVars[ category ] ) ) - shGlobalMP.playerStatVars[ category ][ alias ] <- {} - Assert( !( variable in shGlobalMP.playerStatVars[ category ][ alias ] ) ) - - PlayerStatData playerStatData - playerStatData.statVar = variable - playerStatData.statType = ePlayerStatType.FLOAT - playerStatData.localizedUnlock = localizedUnlock - shGlobalMP.playerStatVars[ category ][ alias ][ subAlias ] <- playerStatData -} - -bool function IsValidStat( string category, string alias, string subAlias ) -{ - if ( category == "" || alias == "" ) - return false - - if ( !( category in shGlobalMP.playerStatVars ) ) - return false - - if ( !( alias in shGlobalMP.playerStatVars[ category ] ) ) - return false - - return ( subAlias in shGlobalMP.playerStatVars[ category ][ alias ] ) -} - -string function GetStatVar( string category, string alias, string subAlias = "" ) -{ - Assert( category in shGlobalMP.playerStatVars, "Invalid stat category " + category ) - Assert( alias in shGlobalMP.playerStatVars[ category ], "No stat alias " + alias + " in category " + category ) - - - Assert( subAlias in shGlobalMP.playerStatVars[ category ][ alias ] ) - return shGlobalMP.playerStatVars[ category ][ alias ][ subAlias ].statVar -} - -int function GetStatVarType( string category, string alias, string subAlias = "" ) -{ - Assert( category in shGlobalMP.playerStatVars, "Invalid stat category " + category ) - Assert( alias in shGlobalMP.playerStatVars[ category ], "No stat alias " + alias + " in category " + category ) - - Assert( subAlias in shGlobalMP.playerStatVars[ category ][ alias ] ) - return shGlobalMP.playerStatVars[ category ][ alias ][ subAlias ].statType -} - -string function GetStatVarLocalizedUnlock( string category, string alias, string subAlias = "" ) -{ - Assert( category in shGlobalMP.playerStatVars, "Invalid stat category " + category ) - Assert( alias in shGlobalMP.playerStatVars[ category ], "No stat alias " + alias + " in category " + category ) - - Assert( subAlias in shGlobalMP.playerStatVars[ category ][ alias ] ) - return shGlobalMP.playerStatVars[ category ][ alias ][ subAlias ].localizedUnlock -} - -int function GetPlayerStatInt( entity player, string category, string alias, string subAlias = "" ) -{ - Assert( IsUI() || IsValid( player ) ) - - string statString = GetStatVar( category, alias, subAlias ) - return player.GetPersistentVarAsInt( statString ) -} - -float function GetPlayerStatFloat( entity player, string category, string alias, string subAlias = "" ) -{ - Assert( IsUI() || IsValid( player ) ) - - string statString = GetStatVar( category, alias, subAlias ) - return expect float( player.GetPersistentVar( statString ) ) -} - - -string function Stats_GetFixedSaveVar( string saveVar, string mapName, string modeName, string difficultyLevel ) -{ - string fixedSaveVar = saveVar - fixedSaveVar = StringReplace( fixedSaveVar, "%mapname%", mapName ) - fixedSaveVar = StringReplace( fixedSaveVar, "%gamemode%", modeName ) - fixedSaveVar = StringReplace( fixedSaveVar, "%difficulty%", difficultyLevel ) - - return fixedSaveVar -} - -int function GetPlayerStat_AllCompetitiveModesAndMapsInt( entity player, string category, string alias, string subAlias = "" ) -{ - Assert( IsUI() || IsValid( player ) ) - - int count = 0 - - int numMaps = PersistenceGetEnumCount( "maps" ) - int numModes = PersistenceGetEnumCount( "gameModes" ) - - string statVarName = GetStatVar( category, alias, subAlias ) - string fixedSaveVar - - for ( int mode = 0; mode < numModes; mode++ ) - { - for( int map = 0; map < numMaps; map++ ) - { - fixedSaveVar = Stats_GetFixedSaveVar( statVarName, string( map ), string( mode ), "0" ) - count += expect int( player.GetPersistentVar( fixedSaveVar ) ) - } - } - - return count -} - - -int function FD_GetHighestDifficultyForTitan( entity player, string titanRef ) -{ - string statVar = GetStatVar( "titan_stats", "matchesByDifficulty", titanRef ) - - int highestDifficulty = 0 - for ( int difficulty = 0; difficulty < 5; difficulty++ ) - { - string persistentVar = Stats_GetFixedSaveVar( statVar, "", "", string( difficulty ) ) - if ( player.GetPersistentVarAsInt( persistentVar ) > 0 ) - highestDifficulty = difficulty - } - - return highestDifficulty -} - |