Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
340a2a0516 | ||
|
|
3120fae436 | ||
|
|
4b779d2730 | ||
|
|
559be46b38 | ||
|
|
e82a29e317 | ||
|
|
223299024b | ||
|
|
6c720ed8d1 | ||
|
|
9d5c9956ad | ||
|
|
d20ec3a1ac | ||
|
|
2e771bfe17 |
@@ -4,8 +4,7 @@ Pulse is a clientside mod for Titanfall 2 letting you view killstats collected b
|
||||
|
||||
Currently, features include:
|
||||
- displaying kills in `Pilot Weapons`
|
||||
- displaying kills in `Titans` tab
|
||||
- mostly functional `Overview` tab
|
||||
- displaying kills and most used weapon (by kills) in `Overview`
|
||||
|
||||
Want to know what we have planned for future updates? See [here.](https://github.com/ToneAPI/pulse/projects?query=is%3Aopen)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"Name": "ToneAPI.pulse",
|
||||
"Description": "Displays Tone API kill data in the Stats tab.",
|
||||
"Version": "1.1.0",
|
||||
"Description": "placeholder text",
|
||||
"Version": "0.0.1",
|
||||
"LoadPriority": 1,
|
||||
"Scripts": [
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,29 +1,15 @@
|
||||
global function GetStatsFromToneAPI
|
||||
global function getWeaponKillsFromToneApi
|
||||
global function getNemesisWeaponFromToneAPI
|
||||
global function getDWEFromToneAPI
|
||||
|
||||
global table globalToneAPIKillData = {}
|
||||
global table globalToneAPIDeathData = {}
|
||||
global table globalToneAPIDWEData = {}
|
||||
|
||||
void function GetStatsFromToneAPI()
|
||||
{
|
||||
thread GetStatsFromToneAPI_threaded()
|
||||
}
|
||||
|
||||
void function GetStatsFromToneAPI_threaded(){
|
||||
|
||||
while(true){
|
||||
if(NSIsMasterServerAuthenticated()) break
|
||||
WaitFrame()
|
||||
}
|
||||
|
||||
//SetConVarString("ToneURL", "https://toneapi.sleepycat.date/v2_test")
|
||||
//SetConVarString("ToneURL", "https://toneapi.sleepycat.date/v1")
|
||||
print("[PULSE] Loaded, getting data...")
|
||||
HttpRequest getStats
|
||||
getStats.method = HttpRequestMethod.GET
|
||||
getStats.url = "https://tone.sleepycat.date/v2/client/weapons"
|
||||
getStats.url = "https://tone.sleepycat.date/v1/client/weapons"
|
||||
getStats.queryParameters["player"] <- [NSGetLocalPlayerUID().tostring()]
|
||||
void functionref(HttpRequestResponse) onSuccess = void function(HttpRequestResponse response)
|
||||
{
|
||||
@@ -31,9 +17,9 @@ void function GetStatsFromToneAPI_threaded(){
|
||||
table JSONForConversion = DecodeJSON(response.body)
|
||||
foreach (var key, var value in JSONForConversion) {
|
||||
table test = expect table(value)
|
||||
globalToneAPIKillData[string(key)] <- test.kills
|
||||
globalToneAPIDeathData[string(key)] <- test.deaths
|
||||
globalToneAPIDWEData[string(key)] <- test.deaths_while_equipped
|
||||
//this won't work on v2 since kills will be an integer already
|
||||
string kills = expect string(test.kills)
|
||||
globalToneAPIKillData[string(key)] <- kills.tointeger()
|
||||
print("[PULSE] " + key + " has been added.")
|
||||
}
|
||||
print("[PULSE] Kill data has been processed.")
|
||||
@@ -50,27 +36,20 @@ void function GetStatsFromToneAPI_threaded(){
|
||||
|
||||
int function getWeaponKillsFromToneApi(string weaponRef){
|
||||
|
||||
//Sliced names are to be removed afterwards
|
||||
print("[PULSE]" + weaponRef)
|
||||
if(weaponRef.find("mp_weapon") != null){
|
||||
weaponRef = weaponRef.slice(10)
|
||||
}
|
||||
|
||||
foreach (var key, var value in globalToneAPIKillData) {
|
||||
print(key)
|
||||
print(value)
|
||||
}
|
||||
if(weaponRef in globalToneAPIKillData){
|
||||
print("[PULSE] Found matching weapon : " + weaponRef + " with " + globalToneAPIKillData[weaponRef] + " kills")
|
||||
print("found!")
|
||||
print(globalToneAPIKillData[weaponRef])
|
||||
return expect int(globalToneAPIKillData[weaponRef])
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
int function getNemesisWeaponFromToneAPI(string weaponRef){
|
||||
|
||||
if(weaponRef in globalToneAPIDeathData){
|
||||
print("[PULSE] Found matching weapon : " + weaponRef + " with " + globalToneAPIDeathData[weaponRef] + " nemesis weapon kills")
|
||||
return expect int(globalToneAPIDeathData[weaponRef])
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
int function getDWEFromToneAPI(string weaponRef){
|
||||
|
||||
if(weaponRef in globalToneAPIDWEData){
|
||||
print("[PULSE] Found matching weapon : " + weaponRef + " with " + globalToneAPIDeathData[weaponRef] + " deaths while equipped")
|
||||
return expect int(globalToneAPIDWEData[weaponRef])
|
||||
}
|
||||
return 0
|
||||
}
|
||||
@@ -51,19 +51,12 @@ function UpdateViewStatsOverviewMenu()
|
||||
int timesMVP = GetPlayerStatInt( player, "game_stats", "mvp_total" )
|
||||
int timesTop3 = GetPlayerStat_AllCompetitiveModesAndMapsInt( player, "game_stats", "top3OnTeam" )
|
||||
|
||||
//SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat0" ), Localize( "#STATS_HEADER_TIME_PLAYED" ), timePlayed )
|
||||
//SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat1" ), Localize( "#STATS_GAMES_PLAYED" ), string( gamesPlayed ) )
|
||||
//SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat2" ), Localize( "#STATS_GAMES_WON" ), string( gamesWon ) )
|
||||
//SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat3" ), Localize( "#STATS_GAMES_WIN_PERCENT" ), Localize( "#STATS_PERCENTAGE", winPercent ) )
|
||||
//SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat4" ), Localize( "#STATS_GAMES_MVP" ), string( timesMVP ) )
|
||||
//SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat5" ), Localize( "#STATS_GAMES_TOP3" ), string( timesTop3 ) )
|
||||
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat0" ), Localize( "#STATS_HEADER_TIME_PLAYED" ), string( 0 ))
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat1" ), Localize( "#STATS_GAMES_PLAYED" ), string( 0 ) )
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat2" ), Localize( "#STATS_GAMES_WON" ), string( 0 ) )
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat3" ), Localize( "#STATS_GAMES_WIN_PERCENT" ), string( 0 ) )
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat4" ), Localize( "#STATS_GAMES_MVP" ), string( 0 ) )
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat5" ), Localize( "#STATS_GAMES_TOP3" ), string( 0 ) )
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat0" ), Localize( "#STATS_HEADER_TIME_PLAYED" ), timePlayed )
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat1" ), Localize( "#STATS_GAMES_PLAYED" ), string( gamesPlayed ) )
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat2" ), Localize( "#STATS_GAMES_WON" ), string( gamesWon ) )
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat3" ), Localize( "#STATS_GAMES_WIN_PERCENT" ), Localize( "#STATS_PERCENTAGE", winPercent ) )
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat4" ), Localize( "#STATS_GAMES_MVP" ), string( timesMVP ) )
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat5" ), Localize( "#STATS_GAMES_TOP3" ), string( timesTop3 ) )
|
||||
|
||||
//#########################
|
||||
// Modes
|
||||
@@ -125,7 +118,7 @@ function UpdateViewStatsOverviewMenu()
|
||||
|
||||
table<string, table> weaponData = GetOverviewWeaponData()
|
||||
table mostKillsData = weaponData[ "most_kills" ]
|
||||
table nemesisWeapon = weaponData[ "nemesis_weapon" ]
|
||||
table mostUsedData = weaponData[ "most_used" ]
|
||||
table highestKPMData = weaponData[ "highest_kpm" ]
|
||||
|
||||
var weaponImageElem
|
||||
@@ -165,14 +158,14 @@ function UpdateViewStatsOverviewMenu()
|
||||
weaponNameElem = Hud_GetChild( file.menu, "WeaponName1" )
|
||||
weaponDescElem = Hud_GetChild( file.menu, "WeaponDesc1" )
|
||||
noDataElem = Hud_GetChild( file.menu, "WeaponImageTextOverlay1" )
|
||||
if ( nemesisWeapon.ref != "" )
|
||||
if ( mostUsedData.ref != "" )
|
||||
{
|
||||
SetItemImageWidth( weaponImageElem, expect string( nemesisWeapon.ref ) )
|
||||
RuiSetImage( weaponRui, "buttonImage", GetItemImage( expect string( nemesisWeapon.ref ) ) )
|
||||
SetItemImageWidth( weaponImageElem, expect string( mostUsedData.ref ) )
|
||||
RuiSetImage( weaponRui, "buttonImage", GetItemImage( expect string( mostUsedData.ref ) ) )
|
||||
Hud_Show( weaponImageElem )
|
||||
Hud_SetText( weaponNameElem, nemesisWeapon.printName )
|
||||
Hud_SetText( weaponNameElem, mostUsedData.printName )
|
||||
Hud_Show( weaponNameElem )
|
||||
Hud_SetText( weaponDescElem, nemesisWeapon.val + " DEATHS BY WEAPON" )
|
||||
SetStatsLabelValue( file.menu, "WeaponDesc1", HoursToTimeString( expect float( mostUsedData.val ) ) )
|
||||
Hud_Show( weaponDescElem )
|
||||
Hud_Hide( noDataElem )
|
||||
}
|
||||
@@ -197,7 +190,7 @@ function UpdateViewStatsOverviewMenu()
|
||||
Hud_Show( weaponImageElem )
|
||||
Hud_SetText( weaponNameElem, highestKPMData.printName )
|
||||
Hud_Show( weaponNameElem )
|
||||
Hud_SetText( weaponDescElem, highestKPMData.val + " K/D")
|
||||
Hud_SetText( weaponDescElem, "#STATS_MOST_EFFICIENT_VALUE", highestKPMData.val )
|
||||
Hud_Show( weaponDescElem )
|
||||
Hud_Hide( noDataElem )
|
||||
}
|
||||
@@ -253,22 +246,7 @@ function UpdateViewStatsOverviewMenu()
|
||||
//#########################
|
||||
|
||||
// Lifetime
|
||||
|
||||
var totalPilotKills = 0
|
||||
|
||||
foreach (var key, var value in globalToneAPIKillData) {
|
||||
totalPilotKills += value
|
||||
}
|
||||
|
||||
var totalPilotDeaths = 0
|
||||
|
||||
foreach (var key, var value in globalToneAPIDWEData) {
|
||||
totalPilotDeaths += value
|
||||
}
|
||||
|
||||
float kdval = float(totalPilotKills) / float(totalPilotDeaths)
|
||||
|
||||
local lifetimeAverage = kdval
|
||||
local lifetimeAverage = player.GetPersistentVar( "kdratio_lifetime" ).tofloat()
|
||||
local formattedLifetimeAverage
|
||||
if ( lifetimeAverage % 1 == 0 )
|
||||
formattedLifetimeAverage = format( "%.0f", lifetimeAverage )
|
||||
@@ -333,29 +311,36 @@ function UpdateViewStatsOverviewMenu()
|
||||
SetStatsLabelValue( file.menu, "Last10GamesPVPValue", [ "#STATS_KD_VALUE", kdratiopvp_match_average ] )
|
||||
PlotKDPointsOnGraph( file.menu, 1, kdratiopvp_match, lifetimeAveragePVP )
|
||||
|
||||
var totalPilotKills = 0
|
||||
|
||||
foreach (var key, var value in globalToneAPIKillData) {
|
||||
totalPilotKills += value
|
||||
}
|
||||
|
||||
/////////////////////////
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue0" ), string( totalPilotKills ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue1" ), string( GetPlayerStatInt( player, "kills_stats", "titanKillsAsPilot" ) ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue2" ), string( GetPlayerStatInt( player, "kills_stats", "totalNPC" ) ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue3" ), string( getWeaponKillsFromToneApi("pilot_emptyhanded") ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue4" ), string( getWeaponKillsFromToneApi("human_execution") ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue3" ), string( GetPlayerStatInt( player, "kills_stats", "pilotKickMeleePilot" ) ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue4" ), string( GetPlayerStatInt( player, "kills_stats", "pilotExecutePilot" ) ) )
|
||||
// Hud_SetText( GetElem( file.menu, "KillsAsPilotValue5" ), string( GetPlayerStatInt( player, "kills_stats", "titanFallKill" ) ) )
|
||||
|
||||
var titanMeleeKills = 0
|
||||
titanMeleeKills += getWeaponKillsFromToneApi("titan_punch_ion")
|
||||
titanMeleeKills += getWeaponKillsFromToneApi("titan_punch_scorch")
|
||||
titanMeleeKills += getWeaponKillsFromToneApi("titan_punch_northstar")
|
||||
titanMeleeKills += getWeaponKillsFromToneApi("titan_sword")
|
||||
titanMeleeKills += getWeaponKillsFromToneApi("titan_punch_tone")
|
||||
titanMeleeKills += getWeaponKillsFromToneApi("titan_punch_legion")
|
||||
titanMeleeKills += getWeaponKillsFromToneApi("titan_punch_vanguard")
|
||||
titanMeleeKills += getWeaponKillsFromToneApi("auto_titan_melee")
|
||||
|
||||
|
||||
int totalTitanExecutions = 0
|
||||
totalTitanExecutions += GetPlayerStatInt( player, "kills_stats", "titanExocutionIon" )
|
||||
totalTitanExecutions += GetPlayerStatInt( player, "kills_stats", "titanExocutionScorch" )
|
||||
totalTitanExecutions += GetPlayerStatInt( player, "kills_stats", "titanExocutionNorthstar" )
|
||||
totalTitanExecutions += GetPlayerStatInt( player, "kills_stats", "titanExocutionRonin" )
|
||||
totalTitanExecutions += GetPlayerStatInt( player, "kills_stats", "titanExocutionTone" )
|
||||
totalTitanExecutions += GetPlayerStatInt( player, "kills_stats", "titanExocutionLegion" )
|
||||
totalTitanExecutions += GetPlayerStatInt( player, "kills_stats", "titanExocutionVanguard" )
|
||||
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsTitanValue0" ), string( GetPlayerStatInt( player, "kills_stats", "pilotKillsAsTitan" ) ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsTitanValue1" ), string( GetPlayerStatInt( player, "kills_stats", "titanKillsAsTitan" ) ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsTitanValue2" ), string( titanMeleeKills ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsTitanValue2" ), string( totalTitanExecutions ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsTitanValue3" ), string( GetPlayerStatInt( player, "kills_stats", "titanMeleePilot" ) ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsTitanValue4" ), string( getWeaponKillsFromToneApi("damagedef_titan_step") ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsTitanValue4" ), string( GetPlayerStatInt( player, "kills_stats", "titanStepCrushPilot" ) ) )
|
||||
}
|
||||
|
||||
function PlotKDPointsOnGraph( menu, graphIndex, values, dottedAverage )
|
||||
|
||||
@@ -1,227 +0,0 @@
|
||||
//TODO: Kills Per Minute stat
|
||||
|
||||
global function InitViewStatsTitansMenu
|
||||
|
||||
struct
|
||||
{
|
||||
var menu
|
||||
var[NUM_PERSISTENT_TITAN_LOADOUTS] buttons
|
||||
array<ItemDisplayData> allTitans
|
||||
table<string, array<string> > titanStatLoadout
|
||||
} file
|
||||
|
||||
void function InitViewStatsTitansMenu()
|
||||
{
|
||||
var menu = GetMenu( "ViewStats_Titans_Menu" )
|
||||
file.menu = menu
|
||||
|
||||
Hud_SetText( Hud_GetChild( file.menu, "MenuTitle" ), "#STATS_TITANS" )
|
||||
|
||||
AddMenuEventHandler( file.menu, eUIEvent.MENU_OPEN, OnViewStatsTitans_Open )
|
||||
|
||||
for ( int i = 0; i < NUM_PERSISTENT_TITAN_LOADOUTS; i++ )
|
||||
{
|
||||
var button = Hud_GetChild( menu, "Button" + i )
|
||||
//button.s.rowIndex <- i
|
||||
//Hud_AddEventHandler( button, UIE_CLICK, OnButton_Activate )
|
||||
Hud_AddEventHandler( button, UIE_GET_FOCUS, OnButton_Focused )
|
||||
file.buttons[i] = button
|
||||
}
|
||||
|
||||
AddMenuFooterOption( file.menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" )
|
||||
}
|
||||
|
||||
void function OnViewStatsTitans_Open()
|
||||
{
|
||||
UI_SetPresentationType( ePresentationType.STORE_PRIME_TITANS )
|
||||
RunMenuClientFunction( "UpdateTitanModel", 0 )
|
||||
|
||||
// Get Titan list
|
||||
file.allTitans = GetVisibleItemsOfType( eItemTypes.TITAN )
|
||||
var dataTable = GetDataTable( $"datatable/titan_properties.rpak" )
|
||||
|
||||
foreach ( titan in file.allTitans )
|
||||
{
|
||||
file.titanStatLoadout[ titan.ref ] <- []
|
||||
|
||||
int row = GetDataTableRowMatchingStringValue( dataTable, GetDataTableColumnByName( dataTable, "titanRef" ), titan.ref )
|
||||
file.titanStatLoadout[ titan.ref ].append( GetDataTableString( dataTable, row, GetDataTableColumnByName( dataTable, "primary" ) ) )
|
||||
file.titanStatLoadout[ titan.ref ].append( GetDataTableString( dataTable, row, GetDataTableColumnByName( dataTable, "ordnance" ) ) )
|
||||
file.titanStatLoadout[ titan.ref ].append( GetDataTableString( dataTable, row, GetDataTableColumnByName( dataTable, "special" ) ) )
|
||||
file.titanStatLoadout[ titan.ref ].append( GetDataTableString( dataTable, row, GetDataTableColumnByName( dataTable, "antirodeo" ) ) )
|
||||
file.titanStatLoadout[ titan.ref ].append( GetDataTableString( dataTable, row, GetDataTableColumnByName( dataTable, "coreAbility" ) ) )
|
||||
file.titanStatLoadout[ titan.ref ].append( GetDataTableString( dataTable, row, GetDataTableColumnByName( dataTable, "melee" ) ) )
|
||||
}
|
||||
|
||||
UpdateButtons( 0, file.buttons )
|
||||
UpdateStatsForTitan( file.allTitans[ 0 ].ref, 0 )
|
||||
}
|
||||
|
||||
void function UpdateButtons( int selectedIndex, var[NUM_PERSISTENT_TITAN_LOADOUTS] buttons )
|
||||
{
|
||||
foreach ( index, button in buttons )
|
||||
{
|
||||
TitanLoadoutDef loadout = GetCachedTitanLoadout( index )
|
||||
RHud_SetText( button, GetTitanLoadoutName( loadout ) )
|
||||
|
||||
Hud_SetEnabled( button, true )
|
||||
Hud_SetVisible( button, true )
|
||||
}
|
||||
}
|
||||
|
||||
//void function OnButton_Activate( var button )
|
||||
//{
|
||||
// int id = int( Hud_GetScriptID( button ) )
|
||||
// if ( !IsControllerModeActive() )
|
||||
// UpdateStatsForTitan( file.allTitans[ id ].ref, id )
|
||||
//}
|
||||
|
||||
void function OnButton_Focused( var button )
|
||||
{
|
||||
int id = int( Hud_GetScriptID( button ) )
|
||||
//if ( IsControllerModeActive() )
|
||||
UpdateStatsForTitan( file.allTitans[ id ].ref, id )
|
||||
}
|
||||
|
||||
void function UpdateStatsForTitan( string titanRef, int loadoutIndex )
|
||||
{
|
||||
entity player = GetUIPlayer()
|
||||
if ( player == null )
|
||||
return
|
||||
|
||||
RunMenuClientFunction( "UpdateTitanModel", loadoutIndex )
|
||||
RunMenuClientFunction( "UpdateStorePrimeBg", loadoutIndex )
|
||||
|
||||
// Name
|
||||
Hud_SetText( Hud_GetChild( file.menu, "TitanName" ), GetItemName( titanRef ) )
|
||||
|
||||
// Locked info
|
||||
var lockLabel = GetElementsByClassname( file.menu, "LblTitanLocked" )[0]
|
||||
|
||||
if ( IsItemLocked( player, titanRef ) )
|
||||
{
|
||||
Hud_SetText( lockLabel, "#LOUADOUT_UNLOCK_REQUIREMENT_LEVEL", GetUnlockLevelReq( titanRef ) )
|
||||
Hud_Show( lockLabel )
|
||||
}
|
||||
else
|
||||
{
|
||||
Hud_Hide( lockLabel )
|
||||
}
|
||||
|
||||
string timeUsed = StatToTimeString( "time_stats", "hours_as_titan_" + titanRef )
|
||||
int shotsHit
|
||||
foreach ( weaponRef in file.titanStatLoadout[ titanRef ] )
|
||||
shotsHit += GetPlayerStatInt( player, "weapon_stats", "shotsHit", weaponRef )
|
||||
int coresEarned = GetPlayerStatInt( player, "titan_stats", "coresEarned", titanRef )
|
||||
|
||||
int crits
|
||||
bool critsApplicable = false
|
||||
foreach ( weaponRef in file.titanStatLoadout[ titanRef ] )
|
||||
{
|
||||
if ( GetWeaponInfoFileKeyField_Global( weaponRef, "critical_hit" ) == true )
|
||||
{
|
||||
critsApplicable = true
|
||||
crits += GetPlayerStatInt( player, "weapon_stats", "critHits", weaponRef )
|
||||
}
|
||||
}
|
||||
|
||||
string critHitsValue = Localize( "#STATS_NOT_APPLICABLE" )
|
||||
if ( critsApplicable )
|
||||
critHitsValue = string( crits )
|
||||
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat0" ), Localize( "#STATS_HEADER_TIME_USED" ), timeUsed )
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat1" ), Localize( "#STATS_HEADER_SHOTS_HIT" ), string( shotsHit ) )
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat2" ), Localize( "#STATS_HEADER_CORES_EARNED" ), string( coresEarned ) )
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat3" ), Localize( "#STATS_HEADER_CRITICAL_HITS" ), critHitsValue )
|
||||
|
||||
string nextUnlockRef = GetNextUnlockForTitanLevel( player, titanRef, TitanGetRawLevel( player, titanRef ) + 1 )
|
||||
if ( nextUnlockRef != "" )
|
||||
{
|
||||
var rui = Hud_GetRui( Hud_GetChild( file.menu, "NextUnlock" ) )
|
||||
|
||||
if ( nextUnlockRef == "random" )
|
||||
{
|
||||
RuiSetString( rui, "unlockName", "" )
|
||||
RuiSetImage( rui, "unlockImage", $"rui/menu/common/unlock_random" )
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemDisplayData displayData
|
||||
if ( IsSubItemType( GetItemType( nextUnlockRef ) ) )
|
||||
displayData = GetItemDisplayData( nextUnlockRef, titanRef )
|
||||
else
|
||||
displayData = GetItemDisplayData( nextUnlockRef )
|
||||
RuiSetString( rui, "unlockName", displayData.name )
|
||||
RuiSetImage( rui, "unlockImage", displayData.image )
|
||||
|
||||
vector aspect = GetItemImageAspect( nextUnlockRef )
|
||||
|
||||
float mult = 1.0
|
||||
if ( aspect.x > aspect.y )
|
||||
mult = 120.0 / aspect.x
|
||||
else
|
||||
mult = 120.0 / aspect.y
|
||||
|
||||
aspect.x *= mult
|
||||
aspect.y *= mult
|
||||
|
||||
RuiSetFloat2( rui, "unlockImageSize", aspect )
|
||||
}
|
||||
}
|
||||
|
||||
int totalKills
|
||||
int pilotKills
|
||||
int titanKills
|
||||
int aiKills
|
||||
foreach ( weaponRef in file.titanStatLoadout[ titanRef ] )
|
||||
{
|
||||
totalKills += getWeaponKillsFromToneApi(weaponRef)
|
||||
pilotKills += GetPlayerStatInt( player, "weapon_kill_stats", "pilots", weaponRef )
|
||||
titanKills += GetPlayerStatInt( player, "weapon_kill_stats", "titansTotal", weaponRef )
|
||||
aiKills += GetPlayerStatInt( player, "weapon_kill_stats", "ai", weaponRef )
|
||||
}
|
||||
|
||||
// Total Kills Stats
|
||||
SetStatsLabelValue( file.menu, "KillsValue0", totalKills )
|
||||
SetStatsLabelValue( file.menu, "KillsValue1", pilotKills )
|
||||
SetStatsLabelValue( file.menu, "KillsValue2", titanKills )
|
||||
SetStatsLabelValue( file.menu, "KillsValue3", aiKills )
|
||||
}
|
||||
|
||||
asset function GetTitanStatImage( string titanRef )
|
||||
{
|
||||
asset image
|
||||
|
||||
switch ( titanRef )
|
||||
{
|
||||
case "ion":
|
||||
image = $"r2_ui/menus/loadout_icons/titans/ion_icon"
|
||||
break
|
||||
|
||||
case "scorch":
|
||||
image = $"r2_ui/menus/loadout_icons/titans/scorch_icon"
|
||||
break
|
||||
|
||||
case "northstar":
|
||||
image = $"r2_ui/menus/loadout_icons/titans/northstar_icon"
|
||||
break
|
||||
|
||||
case "ronin":
|
||||
image = $"r2_ui/menus/loadout_icons/titans/ronin_icon"
|
||||
break
|
||||
|
||||
case "tone":
|
||||
image = $"r2_ui/menus/loadout_icons/titans/tone_icon"
|
||||
break
|
||||
|
||||
case "legion":
|
||||
image = $"r2_ui/menus/loadout_icons/titans/legion_icon"
|
||||
break
|
||||
|
||||
case "vanguard":
|
||||
image = $"r2_ui/menus/loadout_icons/titans/vanguard_icon"
|
||||
break
|
||||
}
|
||||
|
||||
return image
|
||||
}
|
||||
@@ -306,10 +306,10 @@ table<string, table> function GetOverviewWeaponData()
|
||||
Table[ "most_kills" ].ref <- ""
|
||||
Table[ "most_kills" ].printName <- ""
|
||||
Table[ "most_kills" ].val <- 0
|
||||
Table[ "nemesis_weapon" ] <- {}
|
||||
Table[ "nemesis_weapon" ].ref <- ""
|
||||
Table[ "nemesis_weapon" ].printName <- ""
|
||||
Table[ "nemesis_weapon" ].val <- 0
|
||||
Table[ "most_used" ] <- {}
|
||||
Table[ "most_used" ].ref <- ""
|
||||
Table[ "most_used" ].printName <- ""
|
||||
Table[ "most_used" ].val <- 0
|
||||
Table[ "highest_kpm" ] <- {}
|
||||
Table[ "highest_kpm" ].ref <- ""
|
||||
Table[ "highest_kpm" ].printName <- ""
|
||||
@@ -346,31 +346,24 @@ table<string, table> function GetOverviewWeaponData()
|
||||
Table[ "most_kills" ].val = val
|
||||
}
|
||||
|
||||
int nval = getNemesisWeaponFromToneAPI(weaponName)
|
||||
if ( nval > Table[ "nemesis_weapon" ].val )
|
||||
float fVal = GetPlayerStatFloat( player, "weapon_stats", "hoursUsed", weaponName )
|
||||
if ( fVal > Table[ "most_used" ].val )
|
||||
{
|
||||
Table[ "nemesis_weapon" ].ref = weaponName
|
||||
Table[ "nemesis_weapon" ].printName = weaponDisplayName
|
||||
Table[ "nemesis_weapon" ].val = nval
|
||||
Table[ "most_used" ].ref = weaponName
|
||||
Table[ "most_used" ].printName = weaponDisplayName
|
||||
Table[ "most_used" ].val = fVal
|
||||
}
|
||||
|
||||
float kdval = 0
|
||||
float kval = 0
|
||||
float dval = 0
|
||||
if( getWeaponKillsFromToneApi(weaponName) != 0 && getDWEFromToneAPI(weaponName) != 0){
|
||||
kval = float(getWeaponKillsFromToneApi(weaponName))
|
||||
dval = float(getDWEFromToneAPI(weaponName))
|
||||
if (kval / dval > kdval){
|
||||
kdval = kval / dval
|
||||
}
|
||||
}
|
||||
int rnd= int(kdval*100)
|
||||
kdval = float(rnd)/100
|
||||
if ( kdval > Table[ "highest_kpm" ].val.tofloat() )
|
||||
local killsPerMinute = 0
|
||||
local hoursEquipped = GetPlayerStatFloat( player, "weapon_stats", "hoursEquipped", weaponName )
|
||||
local killCount = GetPlayerStatInt( player, "weapon_kill_stats", "total", weaponName )
|
||||
if ( hoursEquipped > 0 )
|
||||
killsPerMinute = format( "%.2f", ( killCount / ( hoursEquipped * 60.0 ) ).tofloat() )
|
||||
if ( killsPerMinute.tofloat() > Table[ "highest_kpm" ].val.tofloat() )
|
||||
{
|
||||
Table[ "highest_kpm" ].ref = weaponName
|
||||
Table[ "highest_kpm" ].printName = weaponDisplayName
|
||||
Table[ "highest_kpm" ].val = kdval
|
||||
Table[ "highest_kpm" ].val = killsPerMinute
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user