-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
287 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
178 changes: 178 additions & 0 deletions
178
Northstar.CustomServers/mod/scripts/vscripts/mp/_challenges.gnut
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,184 @@ | ||
global function InitChallenges | ||
global function SetPlayerChallengeEvacState //Hooked in _evac.gnut | ||
global function SetPlayerChallengeMatchWon //Hooked in _score.nut | ||
global function SetPlayerChallengeMatchComplete //Hooked in _score.nut | ||
global function SetPlayerChallengeSquadLeader //Hooked in _gamestate_mp.nut | ||
global function SetPlayerChallengeMeritScore //Up to gamemodes to use this | ||
global function IncrementPlayerChallengeTitanLeveledUp //Hooked in titan_xp.gnut | ||
global function IncrementPlayerChallengeWeaponLeveledUp //Hooked in weapon_xp.gnut | ||
global function IncrementPlayerChallengeFactionLeveledUp //Hooked in faction_xp.gnut (invisible but necessary for post-summary menu) | ||
global function RegisterChallenges_OnMatchEnd //Hooked in _gamestate_mp.gnut | ||
global function MatchChallenges_SetHappyHourActive //Quite sure this is called from Network code, which Northstar currently don't have | ||
|
||
struct | ||
{ | ||
table<entity,int> playerTotalMeritCount | ||
bool isHappyHourActive | ||
} file | ||
|
||
|
||
|
||
|
||
|
||
|
||
/*============================================================================================================= | ||
__ __ _ _ ____ _ _ _ | ||
| \/ | __ _ | |_ ___ | |__ / ___|| |__ __ _ | || | ___ _ __ __ _ ___ ___ | ||
| |\/| | / _` || __|/ __|| '_ \ | | | '_ \ / _` || || | / _ \| '_ \ / _` | / _ \/ __| | ||
| | | || (_| || |_| (__ | | | | | |___ | | | || (_| || || || __/| | | || (_| || __/\__ \ | ||
|_| |_| \__,_| \__|\___||_| |_| \____||_| |_| \__,_||_||_| \___||_| |_| \__, | \___||___/ | ||
|___/ | ||
=============================================================================================================*/ | ||
|
||
void function InitChallenges() | ||
{ | ||
#if (UI && CLIENT) | ||
|
||
SCB_SetCompleteMeritState( 2 ) | ||
SCB_SetEvacMeritState( 2 ) | ||
SCB_SetMeritCount( 2 ) | ||
SCB_SetScoreMeritState( 2 ) | ||
SCB_SetWinMeritState( 2 ) | ||
SCB_SetWeaponMeritCount( -1 ) | ||
SCB_SetTitanMeritCount( -1 ) | ||
|
||
#elseif (SERVER && MP) | ||
|
||
AddCallback_OnClientConnected( SetupPlayerMenuChallenges ) | ||
AddCallback_OnClientDisconnected( RemovePlayerFromChallengePool ) | ||
|
||
#endif | ||
} | ||
|
||
void function MatchChallenges_SetHappyHourActive() | ||
{ | ||
file.isHappyHourActive = true | ||
} | ||
|
||
void function SetupPlayerMenuChallenges( entity player ) | ||
{ | ||
file.playerTotalMeritCount[ player ] <- 0 | ||
|
||
Remote_CallFunction_UI( player, "SCB_SetCompleteMeritState", 0 ) | ||
Remote_CallFunction_UI( player, "SCB_SetMeritCount", 0 ) | ||
Remote_CallFunction_UI( player, "SCB_SetScoreMeritState", 0 ) | ||
Remote_CallFunction_UI( player, "SCB_SetWinMeritState", 0 ) | ||
Remote_CallFunction_UI( player, "SCB_SetWeaponMeritCount", 0 ) | ||
Remote_CallFunction_UI( player, "SCB_SetTitanMeritCount", 0 ) | ||
} | ||
|
||
void function RemovePlayerFromChallengePool( entity player ) | ||
{ | ||
if( player in file.playerTotalMeritCount ) | ||
delete file.playerTotalMeritCount[ player ] | ||
} | ||
|
||
void function RegisterChallenges_OnMatchEnd() | ||
{ | ||
if( file.isHappyHourActive ) | ||
{ | ||
foreach( player in GetPlayerArray() ) | ||
{ | ||
AddPlayerScore( player, "HappyHourBonus" ) | ||
player.SetPersistentVar( "xp_match[" + XP_TYPE.HAPPY_HOUR + "]", 5 ) //The XP Given from Happy Hour Score is 5 merits | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
/*============================================================================================================= | ||
____ _ _ _ _ | ||
/ ___| __ _ _ __ ___ ___ _ __ ___ ___ __| | ___ | | | | ___ ___ | | __ ___ | ||
| | _ / _` || '_ ` _ \ / _ \| '_ ` _ \ / _ \ / _` | / _ \ | |_| | / _ \ / _ \ | |/ // __| | ||
| |_| || (_| || | | | | || __/| | | | | || (_) || (_| || __/ | _ || (_) || (_) || < \__ \ | ||
\____| \__,_||_| |_| |_| \___||_| |_| |_| \___/ \__,_| \___| |_| |_| \___/ \___/ |_|\_\|___/ | ||
|
||
=============================================================================================================*/ | ||
|
||
void function SetPlayerChallengeEvacState( entity player, bool successEvac ) | ||
{ | ||
if( successEvac ) | ||
{ | ||
file.playerTotalMeritCount[ player ]++ | ||
Remote_CallFunction_UI( player, "SCB_SetEvacMeritState", 1 ) | ||
player.SetPersistentVar( "xp_match[" + XP_TYPE.EVAC + "]", 1 ) | ||
Remote_CallFunction_UI( player, "SCB_SetMeritCount", file.playerTotalMeritCount[ player ] ) | ||
} | ||
else | ||
Remote_CallFunction_UI( player, "SCB_SetEvacMeritState", -1 ) | ||
} | ||
|
||
void function SetPlayerChallengeMatchWon( entity player, bool playerWon ) | ||
{ | ||
if( playerWon ) | ||
{ | ||
file.playerTotalMeritCount[ player ]++ | ||
Remote_CallFunction_UI( player, "SCB_SetWinMeritState", 1 ) | ||
player.SetPersistentVar( "xp_match[" + XP_TYPE.MATCH_VICTORY + "]", 1 ) | ||
player.SetPersistentVar( "matchWin", true ) | ||
Remote_CallFunction_UI( player, "SCB_SetMeritCount", file.playerTotalMeritCount[ player ] ) | ||
} | ||
else | ||
Remote_CallFunction_UI( player, "SCB_SetWinMeritState", -1 ) | ||
} | ||
|
||
void function SetPlayerChallengeMatchComplete( entity player ) | ||
{ | ||
file.playerTotalMeritCount[ player ]++ | ||
Remote_CallFunction_UI( player, "SCB_SetCompleteMeritState", 1 ) | ||
player.SetPersistentVar( "xp_match[" + XP_TYPE.MATCH_COMPLETED + "]", 1 ) | ||
player.SetPersistentVar( "matchComplete", true ) | ||
Remote_CallFunction_UI( player, "SCB_SetMeritCount", file.playerTotalMeritCount[ player ] ) | ||
} | ||
|
||
void function SetPlayerChallengeSquadLeader( entity player ) | ||
{ | ||
Remote_CallFunction_NonReplay( player, "ServerCallback_SquadLeaderDoubleXP" ) | ||
Remote_CallFunction_NonReplay( player, "ServerCallback_SquadLeaderBonus", player.GetEncodedEHandle() ) | ||
player.SetPersistentVar( "matchSquadBonus", true ) | ||
Player_GiveDoubleXP( player, 1 ) | ||
foreach( entity teamplayer in GetPlayerArrayOfTeam( player.GetTeam() ) ) | ||
{ | ||
if( teamplayer == player ) | ||
continue | ||
|
||
Remote_CallFunction_NonReplay( player, "ServerCallback_SquadLeaderBonus", teamplayer.GetEncodedEHandle() ) | ||
} | ||
} | ||
|
||
void function SetPlayerChallengeMeritScore( entity player ) | ||
{ | ||
file.playerTotalMeritCount[ player ]++ | ||
Remote_CallFunction_UI( player, "SCB_SetScoreMeritState", 1 ) | ||
player.SetPersistentVar( "xp_match[" + XP_TYPE.SCORE_MILESTONE + "]", 1 ) | ||
player.SetPersistentVar( "matchScoreEvent", true ) | ||
Remote_CallFunction_UI( player, "SCB_SetMeritCount", file.playerTotalMeritCount[ player ] ) | ||
} | ||
|
||
void function IncrementPlayerChallengeTitanLeveledUp( entity player ) | ||
{ | ||
player.p.meritData.titanMerits++ | ||
file.playerTotalMeritCount[ player ]++ | ||
|
||
Remote_CallFunction_UI( player, "SCB_SetTitanMeritCount", player.p.meritData.titanMerits++ ) | ||
Remote_CallFunction_UI( player, "SCB_SetMeritCount", file.playerTotalMeritCount[ player ] ) | ||
} | ||
|
||
void function IncrementPlayerChallengeWeaponLeveledUp( entity player ) | ||
{ | ||
player.p.meritData.weaponMerits++ | ||
file.playerTotalMeritCount[ player ]++ | ||
|
||
Remote_CallFunction_UI( player, "SCB_SetWeaponMeritCount", player.p.meritData.weaponMerits ) | ||
Remote_CallFunction_UI( player, "SCB_SetMeritCount", file.playerTotalMeritCount[ player ] ) | ||
} | ||
|
||
void function IncrementPlayerChallengeFactionLeveledUp( entity player ) | ||
{ | ||
file.playerTotalMeritCount[ player ]++ | ||
Remote_CallFunction_UI( player, "SCB_SetMeritCount", file.playerTotalMeritCount[ player ] ) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
Northstar.CustomServers/mod/scripts/vscripts/titan_xp.gnut
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,35 @@ | ||
global function AddTitanXP | ||
global function AddFDTitanXP | ||
|
||
void function AddTitanXP( entity player, int amount ) | ||
{ | ||
string titan = GetActiveTitanLoadout( player ).titanClass | ||
int oldLevel = TitanGetLevel( player, titan ) | ||
int TitanXPMatch = player.GetPersistentVarAsInt( "xp_match[" + XP_TYPE.TITAN_LEVELED + "]" ) | ||
|
||
// increment xp | ||
player.SetPersistentVar( "titanXP[" + titan + "]", min( TitanGetXP( player, titan ) + amount, TitanGetMaxXP( titan ) ) ) | ||
Remote_CallFunction_NonReplay( player, "ServerCallback_TitanXPAdded", shTitanXP.titanClasses.find( titan ), TitanGetXP( player, titan ), amount ) | ||
|
||
// level up notif | ||
if ( TitanGetLevel( player, titan ) != oldLevel ) | ||
{ | ||
Remote_CallFunction_NonReplay( player, "ServerCallback_TitanLeveledUp", shTitanXP.titanClasses.find( titan ), TitanGetGen( player, titan ), TitanGetLevel( player, titan ) ) | ||
AddPlayerScore( player, "TitanLevelUp" ) | ||
IncrementPlayerChallengeTitanLeveledUp( player ) | ||
AwardRandomItemsForTitanLevels( player, titan, oldLevel, TitanGetLevel( player, titan ) ) | ||
player.SetPersistentVar( "xp_match[" + XP_TYPE.TITAN_LEVELED + "]", TitanXPMatch + 1 ) | ||
} | ||
} | ||
|
||
void function AddFDTitanXP( entity player, int fdXPamount ) | ||
{ | ||
string titanRef = GetActiveTitanLoadout( player ).titanClass | ||
|
||
player.SetPersistentVar( "fdTitanXP[" + titanRef + "]", FD_TitanGetPreviousXP( player, titanRef ) + fdXPamount ) | ||
int startingLevel = FD_TitanGetLevelForXP( titanRef, FD_TitanGetPreviousXP( player, titanRef ) ) | ||
int endingLevel = FD_TitanGetLevelForXP( titanRef, FD_TitanGetXP( player, titanRef ) ) | ||
|
||
Player_GiveFDUnlockPoints( player, endingLevel - startingLevel ) | ||
AwardRandomItemsForFDTitanLevels( player, titanRef, startingLevel, endingLevel ) | ||
} |
Oops, something went wrong.