diff --git a/README.md b/README.md index 28d57de..79feb37 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Pulse +# pulse -Pulse is a clientside mod for [TF|2 + Northstar](https://github.com/R2Northstar/Northstar) letting you view killstats collected by [the Tone API](https://toneapi.github.io/ToneAPI_webclient/) using the otherwise non-functional `Stats` tab. +**pulse** is a clientside mod for [TF|2 + Northstar](https://github.com/R2Northstar/Northstar) letting you view killstats collected by [the Tone API](https://toneapi.github.io/ToneAPI_webclient/) using the otherwise non-functional `Stats` tab. ## Currently, features include: - mostly functional `Overview` tab, @@ -31,7 +31,7 @@ Found a bug? Make an issue on GitHub [here.](https://github.com/ToneAPI/pulse/is | AI kills |Non-functional, Tone API does not collect AI kill data.| | Pilot melee kills |Shows only melee kills accumulated by player as Pilot.| | Pilot executions |Shows only executions accumulated by player as Pilot.| - + - Kills as Titan - shows general kill data for player as Titan, visualised in the table below: | Name | Description | @@ -73,8 +73,37 @@ Found a bug? Make an issue on GitHub [here.](https://github.com/ToneAPI/pulse/is - Kills by Gamemode - piechart showing all kills (in percent) on chosen map by gamemode. -## DISCLAIMER +## DISCLAIMERS The Tone API is NOT used by every server, view a list of supported servers [here.](https://tone.sleepycat.date/v2/client/servers) +**pulse** is very much a W.I.P as of right now, features may be missing/nonfunctional. -Pulse is very much a W.I.P as of right now, features may be missing/nonfunctional. +As of v2.1.0, **pulse** requires [loeb](https://github.com/okvdai/loeb) + +## CHANGELOG + +
+ pulse v2.0.0 "Demeter" + + - Switched to Thunderstore template on the GitHub site for easier development. + - General code rewrite - lots of improvements for easier development. Rewrite includes: + - common code file, for better code readability and ease of development, + - new parser, allowing for better expandability and faster data processing (and much simpler implementation, unlike the hellspawn that was the previous `getFromToneAPI` function), + - new request function, more compact and simple than previous iterations, + - other functions that simplify the code and make it easier to read / develop + - Localisation, currently available in: + - English, + - French, + - German, + - Italian, + - Polish. (Northstar isn't translated into Polish, but the game supports it.) + - Locking the Stats tab, avoiding situations where you could click too fast and see no stats. Also prevents the game from showing stats when the API is unreachable. +
+ +
+ pulse v2.1.0 + + - Changed endpoint + - Lots of bug fixes + - Uses new experimental loeb library +
diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..081973f Binary files /dev/null and b/icon.png differ diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..7471b25 --- /dev/null +++ b/manifest.json @@ -0,0 +1,7 @@ +{ + "name": "Pulse", + "description": "Adds stats (collected by the Tone API) back to the Stats tab.", + "version_number": "2.1.1", + "website_url": "https://github.com/ToneAPI/pulse", + "dependencies": ["Okudai-loeb-1.0.1"] +} diff --git a/mod.json b/mod.json deleted file mode 100644 index 6113565..0000000 --- a/mod.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "Name": "ToneAPI.pulse", - "Description": "Displays Tone API kill data in the Stats tab.", - "Version": "1.2.1", - "LoadPriority": 1, - "ConVars": [ - { - "Name": "ToneURL", - "DefaultValue": "https://tone.sleepycat.date/v2/client" - }, - { - "Name": "VersionURL", - "DefaultValue": "https://raw.githubusercontent.com/ToneAPI/pulse/main/version.json" - }, - { - "Name": "MajorVersion", - "DefaultValue": "1" - }, - { - "Name": "MinorVersion", - "DefaultValue": "2" - }, - { - "Name": "PatchVersion", - "DefaultValue": "1" - } - ], - "Scripts": [ - { - "Path": "pulse.gnut", - "RunOn": "UI", - "UICallback": { - "After": "pulseInit" - } - } - ] -} diff --git a/mod/scripts/vscripts/pulse.gnut b/mod/scripts/vscripts/pulse.gnut deleted file mode 100644 index c0cc1bf..0000000 --- a/mod/scripts/vscripts/pulse.gnut +++ /dev/null @@ -1,267 +0,0 @@ -global function pulseInit -global function GetWeaponStatsFromToneAPI -global function GetGlobalDataFromToneAPI -global function GetMapStatsFromToneAPI -global function GetGamemodeStatsFromToneAPI -global function getWeaponKillsFromToneAPI -global function getNemesisWeaponFromToneAPI -global function getDWEFromToneAPI -global function getMapKillFromToneAPI -global function getMapDeathFromToneAPI -global function getMapDistFromToneAPI -global function getMapMDistFromToneAPI -global function fetchGamemodeStatsFromToneAPI - -global table globalToneAPIKillData = {} -global table globalToneAPIDeathData = {} -global table globalToneAPIDWEData = {} -global table globalToneAPIMapDeathData = {} -global table globalToneAPIMapDistData = {} -global table globalToneAPIMapKillData = {} -global table globalToneAPIMapMDistData = {} -global table globalToneAPIGamemodeData = {} -global table globalToneAPIAllPlayerKillData = {} -global table globalToneAPIAllPlayerDeathData = {} -global table< table > globalToneAPIGamemodeMapData = {} - -string prefix = "default" -string HTTPrequestURL = "default" -string currentVersion = "default" -int weaponEntries = 0 -int mapEntries = 0 -int gamemodeEntries = 0 -int mapGamemodeEntries = 0 - -void function pulseInit() -{ - prefix = "\x1b[38;2;255;178;102m[PULSE]\x1b[0m " - HTTPrequestURL = GetConVarString("ToneURL") - currentVersion = "v" + GetConVarString("MajorVersion") + "." + GetConVarString("MinorVersion") + "." + GetConVarString("PatchVersion") - HttpRequest getVersion - getVersion.method = HttpRequestMethod.GET - getVersion.url = GetConVarString("VersionURL") - void functionref(HttpRequestResponse) onSuccess = void function(HttpRequestResponse response) - { - table JSONDecoded = DecodeJSON(response.body) - if (JSONDecoded["Major"] == GetConVarString("MajorVersion") && JSONDecoded["Minor"] == GetConVarString("MinorVersion") && JSONDecoded["Patch"] == GetConVarString("PatchVersion")) { - print(prefix + currentVersion + " has been loaded and is up to date.") - } else { - print(prefix + currentVersion + " has been loaded. Recommend updating to latest version: v" + JSONDecoded["Major"] + "." + JSONDecoded["Minor"] + "." + JSONDecoded["Patch"] + ".") - } - } - void functionref(HttpRequestFailure) onFailure = void function(HttpRequestFailure failure) - { - print(prefix + currentVersion + " has been loaded and has encountered an error getting latest version data.") - } - NSHttpRequest(getVersion, onSuccess, onFailure) -} - -void function GetWeaponStatsFromToneAPI() -{ - print(prefix + "Getting kill data...") - weaponEntries = 0 - HttpRequest getWeaponStats - getWeaponStats.method = HttpRequestMethod.GET - getWeaponStats.url = HTTPrequestURL + "/weapons" - getWeaponStats.queryParameters["player"] <- [NSGetLocalPlayerUID()] - void functionref(HttpRequestResponse) onSuccess = void function(HttpRequestResponse response) - { - print(prefix + "Kill data received, processing...") - 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 - weaponEntries += 1 - } - print(prefix + "Kill data has been processed with a total of " + string(weaponEntries) + " entries.") - } - - void functionref(HttpRequestFailure) onFailure = void function(HttpRequestFailure failure) - { - print(prefix + "Encountered an error getting kill data...") - } - - NSHttpRequest(getWeaponStats, onSuccess, onFailure) -} - -void function GetGlobalDataFromToneAPI() -{ - print(prefix + "Getting global data...") - weaponEntries = 0 - HttpRequest getGlobalStats - getGlobalStats.method = HttpRequestMethod.GET - getGlobalStats.url = HTTPrequestURL + "/weapons" - getGlobalStats.queryParameters["player"] <- ["!" + NSGetLocalPlayerUID()] - void functionref(HttpRequestResponse) onSuccess = void function(HttpRequestResponse response) - { - print(prefix + "Global data received, processing...") - table JSONForConversion = DecodeJSON(response.body) - foreach (var key, var value in JSONForConversion) { - table test = expect table(value) - globalToneAPIAllPlayerKillData[string(key)] <- test.kills - globalToneAPIAllPlayerDeathData[string(key)] <- test.deaths - weaponEntries += 1 - } - print(prefix + "Global data has been processed with a total of " + string(weaponEntries) + " entries.") - } - - void functionref(HttpRequestFailure) onFailure = void function(HttpRequestFailure failure) - { - print(prefix + "Encountered an error getting global data...") - } - - NSHttpRequest(getGlobalStats, onSuccess, onFailure) -} - -void function GetMapStatsFromToneAPI() -{ - print(prefix + "Getting map data...") - mapEntries = 0 - HttpRequest getMapStats - getMapStats.method = HttpRequestMethod.GET - getMapStats.url = HTTPrequestURL + "/maps" - getMapStats.queryParameters["player"] <- [NSGetLocalPlayerUID()] - void functionref(HttpRequestResponse) onSuccess = void function(HttpRequestResponse response) - { - print(prefix + "Map data received, processing...") - table JSONForConversion = DecodeJSON(response.body) - foreach (var key, var value in JSONForConversion) { - table test = expect table(value) - globalToneAPIMapKillData[string(key)] <- test.kills - globalToneAPIMapDeathData[string(key)] <- test.deaths - globalToneAPIMapDistData[string(key)] <- test.total_distance - globalToneAPIMapMDistData[string(key)] <- test.max_distance - mapEntries += 1 - } - print(prefix + "Map data has been processed with a total of " + string(mapEntries) + " entries.") - } - - void functionref(HttpRequestFailure) onFailure = void function(HttpRequestFailure failure) - { - print(prefix + "Encountered an error getting map data...") - } - - NSHttpRequest(getMapStats, onSuccess, onFailure) -} - -void function GetGamemodeStatsFromToneAPI() -{ - print(prefix + "Getting gamemode data...") - gamemodeEntries = 0 - HttpRequest getGamemodeStats - getGamemodeStats.method = HttpRequestMethod.GET - getGamemodeStats.url = HTTPrequestURL + "/gamemodes" - getGamemodeStats.queryParameters["player"] <- [NSGetLocalPlayerUID()] - void functionref(HttpRequestResponse) onSuccess = void function(HttpRequestResponse response) - { - print(prefix + "Gamemode data received, processing...") - table JSONForConversion = DecodeJSON(response.body) - foreach (var key, var value in JSONForConversion) { - table test = expect table(value) - globalToneAPIGamemodeData[string(key)] <- test.kills - gamemodeEntries += 1 - } - print(prefix + "Gamemode data has been processed with a total of " + string(gamemodeEntries) + " entries.") - } - - void functionref(HttpRequestFailure) onFailure = void function(HttpRequestFailure failure) - { - print(prefix + "Encountered an error getting gamemode data...") - } - - NSHttpRequest(getGamemodeStats, onSuccess, onFailure) -} - -void function fetchGamemodeStatsFromToneAPI(string mapName) -{ - mapGamemodeEntries = 0 - string mapNameSliced = mapName.slice(3) - HttpRequest getMapGamemodeStats - getMapGamemodeStats.method = HttpRequestMethod.GET - getMapGamemodeStats.url = HTTPrequestURL + "/gamemodes" - getMapGamemodeStats.queryParameters["map"] <- [mapNameSliced] - getMapGamemodeStats.queryParameters["player"] <- [NSGetLocalPlayerUID()] - void functionref(HttpRequestResponse) onSuccess = void function(HttpRequestResponse response):(mapName) - { - table JSONForConversion = DecodeJSON(response.body) - table mapData = {} - foreach (var gamemode, var value in JSONForConversion) { - table test = expect table(value) - mapData[string(gamemode)] <- test.kills - mapGamemodeEntries += 1 - } - - globalToneAPIGamemodeMapData[mapName] <- mapData - - print(prefix + "Map gamemode data has been processed with a total of " + string(mapGamemodeEntries) + " entries.") - } - - void functionref(HttpRequestFailure) onFailure = void function(HttpRequestFailure failure) - { - print(prefix + "Encountered an error getting map gamemode data...") - } - - NSHttpRequest(getMapGamemodeStats, onSuccess, onFailure) -} - -int function getWeaponKillsFromToneAPI(string weaponRef){ - - if(weaponRef in globalToneAPIKillData){ - return expect int(globalToneAPIKillData[weaponRef]) - } - return 0 -} - -int function getNemesisWeaponFromToneAPI(string weaponRef){ - - if(weaponRef in globalToneAPIDeathData){ - return expect int(globalToneAPIDeathData[weaponRef]) - } - return 0 -} - -int function getDWEFromToneAPI(string weaponRef){ - - if(weaponRef in globalToneAPIDWEData){ - return expect int(globalToneAPIDWEData[weaponRef]) - } - return 0 -} - -int function getMapKillFromToneAPI(string mapName){ - - mapName = mapName.slice(3) - if(mapName in globalToneAPIMapKillData){ - return expect int(globalToneAPIMapKillData[mapName]) - } - return 0 -} - -int function getMapDeathFromToneAPI(string mapName){ - - mapName = mapName.slice(3) - if(mapName in globalToneAPIMapDeathData){ - return expect int(globalToneAPIMapDeathData[mapName]) - } - return 0 -} - -int function getMapMDistFromToneAPI(string mapName){ - - mapName = mapName.slice(3) - if(mapName in globalToneAPIMapMDistData){ - return expect int(globalToneAPIMapMDistData[mapName]) - } - return 0 -} - -int function getMapDistFromToneAPI(string mapName){ - - mapName = mapName.slice(3) - if(mapName in globalToneAPIMapDistData){ - return expect int(globalToneAPIMapDistData[mapName]) - } - return 0 -} diff --git a/mod/scripts/vscripts/ui/menu_stats.nut b/mod/scripts/vscripts/ui/menu_stats.nut deleted file mode 100644 index 65bef5e..0000000 --- a/mod/scripts/vscripts/ui/menu_stats.nut +++ /dev/null @@ -1,56 +0,0 @@ - -global function InitViewStatsMenu - -struct{ - array allMaps -} file - -void function InitViewStatsMenu() -{ - var menu = GetMenu( "ViewStatsMenu" ) - - AddMenuEventHandler( menu, eUIEvent.MENU_OPEN, OnViewStats_Open ) - - var button = Hud_GetChild( menu, "BtnOverview" ) - SetButtonRuiText( button, Localize( "#STATS_OVERVIEW" ) ) - AddButtonEventHandler( button, UIE_CLICK, AdvanceMenuEventHandler( GetMenu( "ViewStats_Overview_Menu" ) ) ) - - button = Hud_GetChild( menu, "BtnTime" ) - SetButtonRuiText( button, Localize( "#STATS_TIME" ) ) - AddButtonEventHandler( button, UIE_CLICK, AdvanceMenuEventHandler( GetMenu( "ViewStats_Time_Menu" ) ) ) - - button = Hud_GetChild( menu, "BtnPilotWeapons" ) - SetButtonRuiText( button, Localize( "#STATS_PILOT_WEAPONS" ) ) - AddButtonEventHandler( button, UIE_CLICK, AdvanceMenuEventHandler( GetMenu( "ViewStats_Weapons_Menu" ) ) ) - - button = Hud_GetChild( menu, "BtnTitans" ) - SetButtonRuiText( button, Localize( "#STATS_TITANS" ) ) - AddButtonEventHandler( button, UIE_CLICK, AdvanceMenuEventHandler( GetMenu( "ViewStats_Titans_Menu" ) ) ) - - button = Hud_GetChild( menu, "BtnMaps" ) - SetButtonRuiText( button, Localize( "#STATS_MAPS" ) ) - AddButtonEventHandler( button, UIE_CLICK, AdvanceMenuEventHandler( GetMenu( "ViewStats_Maps_Menu" ) ) ) - - button = Hud_GetChild( menu, "BtnMisc" ) - SetButtonRuiText( button, Localize( "#STATS_MISC" ) ) - AddButtonEventHandler( button, UIE_CLICK, AdvanceMenuEventHandler( GetMenu( "ViewStats_Misc_Menu" ) ) ) - - AddMenuFooterOption( menu, BUTTON_A, "#A_BUTTON_SELECT" ) - AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) -} - -void function OnViewStats_Open() -{ - foreach(elemNum in file.allMaps){ - string mapName = expect string(file.allMaps[ elemNum ]) - fetchGamemodeStatsFromToneAPI(mapName) - } - GetWeaponStatsFromToneAPI() - GetGlobalDataFromToneAPI() - GetMapStatsFromToneAPI() - GetGamemodeStatsFromToneAPI() - UI_SetPresentationType( ePresentationType.DEFAULT ) - - //UpdateViewStatsKillsMenu() - //UpdateViewStatsDistanceMenu() -} diff --git a/mods/ToneAPI.pulse/mod.json b/mods/ToneAPI.pulse/mod.json new file mode 100644 index 0000000..2c652a0 --- /dev/null +++ b/mods/ToneAPI.pulse/mod.json @@ -0,0 +1,28 @@ +{ + "Name": "ToneAPI.pulse", + "Description": "Displays Tone API kill data in the Stats tab.", + "Version": "2.1.1", + "LoadPriority": 1, + "ConVars": [ + { + "Name": "ToneURL", + "DefaultValue": "https://toneapi.ovh/v2/client" + } + ], + "Scripts": [ + { + "Path":"pulse-common-func.gnut", + "RunOn":"UI" + }, + { + "Path": "pulse.gnut", + "RunOn": "UI", + "UICallback": { + "After": "pulseInit" + } + } + ], + "Localisation": [ + "resource/pulse_%language%.txt" + ] +} diff --git a/mods/ToneAPI.pulse/mod/resource/pulse_english.txt b/mods/ToneAPI.pulse/mod/resource/pulse_english.txt new file mode 100644 index 0000000..0d3d712 Binary files /dev/null and b/mods/ToneAPI.pulse/mod/resource/pulse_english.txt differ diff --git a/mods/ToneAPI.pulse/mod/resource/pulse_french.txt b/mods/ToneAPI.pulse/mod/resource/pulse_french.txt new file mode 100644 index 0000000..351f13f Binary files /dev/null and b/mods/ToneAPI.pulse/mod/resource/pulse_french.txt differ diff --git a/mods/ToneAPI.pulse/mod/resource/pulse_german.txt b/mods/ToneAPI.pulse/mod/resource/pulse_german.txt new file mode 100644 index 0000000..9ce43c0 Binary files /dev/null and b/mods/ToneAPI.pulse/mod/resource/pulse_german.txt differ diff --git a/mods/ToneAPI.pulse/mod/resource/pulse_italian.txt b/mods/ToneAPI.pulse/mod/resource/pulse_italian.txt new file mode 100644 index 0000000..e84956d Binary files /dev/null and b/mods/ToneAPI.pulse/mod/resource/pulse_italian.txt differ diff --git a/mods/ToneAPI.pulse/mod/resource/pulse_polish.txt b/mods/ToneAPI.pulse/mod/resource/pulse_polish.txt new file mode 100644 index 0000000..551af7b Binary files /dev/null and b/mods/ToneAPI.pulse/mod/resource/pulse_polish.txt differ diff --git a/mod/resource/ui/menus/viewstats_maps.menu b/mods/ToneAPI.pulse/mod/resource/ui/menus/viewstats_maps.menu similarity index 99% rename from mod/resource/ui/menus/viewstats_maps.menu rename to mods/ToneAPI.pulse/mod/resource/ui/menus/viewstats_maps.menu index c1b505a..10bfa63 100644 --- a/mod/resource/ui/menus/viewstats_maps.menu +++ b/mods/ToneAPI.pulse/mod/resource/ui/menus/viewstats_maps.menu @@ -532,7 +532,7 @@ resource/ui/menus/viewstats_pve.menu visible 1 font Default_23 labelText "--" - allcaps 1 + allcaps 0 textAlignment center fgcolor_override "255 255 255 255" //bgcolor_override "0 255 0 100" diff --git a/mod/resource/ui/menus/viewstats_overview.menu b/mods/ToneAPI.pulse/mod/resource/ui/menus/viewstats_overview.menu similarity index 99% rename from mod/resource/ui/menus/viewstats_overview.menu rename to mods/ToneAPI.pulse/mod/resource/ui/menus/viewstats_overview.menu index fda9289..b85bd1f 100644 --- a/mod/resource/ui/menus/viewstats_overview.menu +++ b/mods/ToneAPI.pulse/mod/resource/ui/menus/viewstats_overview.menu @@ -323,7 +323,7 @@ resource/ui/menus/viewstats_overview.menu tall 45 visible 1 font Default_31 - labelText "NEMESIS WEAPON" + labelText "#NEMESIS_WEAPON" allcaps 1 wrap 1 textAlignment west diff --git a/mod/resource/ui/menus/viewstats_weapons.menu b/mods/ToneAPI.pulse/mod/resource/ui/menus/viewstats_weapons.menu similarity index 99% rename from mod/resource/ui/menus/viewstats_weapons.menu rename to mods/ToneAPI.pulse/mod/resource/ui/menus/viewstats_weapons.menu index 61f8546..9ff1c62 100644 --- a/mod/resource/ui/menus/viewstats_weapons.menu +++ b/mods/ToneAPI.pulse/mod/resource/ui/menus/viewstats_weapons.menu @@ -345,7 +345,7 @@ resource/ui/menus/viewstats_weapons.menu tall 36 visible 1 font Default_23 - labelText "DEATHS WITH WEAPON" + labelText "#DEATHS_WHILE_EQUIPPED" allcaps 1 textAlignment west fgcolor_override "255 255 255 255" diff --git a/mods/ToneAPI.pulse/mod/scripts/vscripts/pulse-common-func.gnut b/mods/ToneAPI.pulse/mod/scripts/vscripts/pulse-common-func.gnut new file mode 100644 index 0000000..0c3d3af --- /dev/null +++ b/mods/ToneAPI.pulse/mod/scripts/vscripts/pulse-common-func.gnut @@ -0,0 +1,74 @@ +globalize_all_functions + + + +global string pulsePrefix +table withMapName = {} +void function pulsePrefixSet() //Sets our prefix +{ + pulsePrefix = format("\x1b[38;2;%i;%i;%im[PULSE]\x1b[0m", 255, 178, 102) +} + +void function pulsePrintt(string content) //Prints whatever we want printed with given prefix (by standard [PULSE]). +{ + printt(format("%s " + content, pulsePrefix)) +} + +bool function pulseRequestData(string givenURL, table parameterTable, string tablepath) //Gets data from API (see ToneURL within mod.json) and puts it into one table for processing. +{ + table > requestTable + void functionref (HttpRequestResponse) onSuccess = void function(HttpRequestResponse response) : (givenURL, parameterTable, requestTable, tablepath) + { + if (NSIsSuccessHttpCode(response.statusCode)) + { + table DecodedJSON = DecodeJSON(response.body) + if ("map" in parameterTable) + { + string mapName = expect string(parameterTable["map"]) + withMapName[mapName] <- DecodedJSON + pulseData[tablepath] <- withMapName + } else { + pulseData[tablepath] <- DecodedJSON + } + } else { + pulsePrintt(format("%s, %s is unreachable.", response.statusCode, givenURL)) + pulseLockStats() + } + } + void functionref (HttpRequestFailure) onFailure = void function(HttpRequestFailure failure) : (givenURL) + { + pulsePrintt(format("Something went wrong, %s is unreachable", givenURL)) + pulseLockStats() + } + foreach (key, value in parameterTable) + { + requestTable[string(key)] <- [string(value)] + } + return NSHttpGet(givenURL, requestTable, onSuccess, onFailure) +} + +int function pulseParse(...) //Returns data from our pulseData table. +{ + table parser = pulseData + int result = 0 + for (int i; i < vargc; i++) { + if (i < expect int(vargc) - 1) { + if (expect string (vargv[i]) in parser) { + parser = expect table(parser[expect string(vargv[i])]) + } else break + } else { + result = expect int(parser[expect string(vargv[i])]) + } + } + return result +} + +void function pulseLockStats() +{ + loebSetLockedButton(Localize("#MENU_TITLE_STATS"), true) +} + +string function HammerToMeterString(float value) +{ + return value > 0 && int((1.905 * value ))/100 > 0 ? string(int((1.905 * value ) )/100) + "m" : "0"; +} \ No newline at end of file diff --git a/mods/ToneAPI.pulse/mod/scripts/vscripts/pulse.gnut b/mods/ToneAPI.pulse/mod/scripts/vscripts/pulse.gnut new file mode 100644 index 0000000..5705721 --- /dev/null +++ b/mods/ToneAPI.pulse/mod/scripts/vscripts/pulse.gnut @@ -0,0 +1,32 @@ +global function pulseInit +global function pulseGetData + +global table pulseData = {} + +struct { + array allMaps +} file + +void function pulseInit() +{ + pulsePrefixSet() + file.allMaps = GetPrivateMatchMaps() + pulsePrintt("Initialized.") + AddUICallback_OnLevelInit( pulseGetData ) +} + +void function pulseGetData() +{ + print("data getter called") + string URL = GetConVarString("ToneURL") + array URLpath = ["/weapons", "/weapons", "/gamemodes", "/gamemodes", "/maps"] + array tablepath = ["weaponsLocal", "weaponsGlobal", "gamemodesAll", "gamemodesSeparated", "maps"] + pulseRequestData(URL + URLpath[0], {["player"] = NSGetLocalPlayerUID()}, tablepath[0]) + pulseRequestData(URL + URLpath[1], {["player"] = "!" + NSGetLocalPlayerUID()}, tablepath[1]) + pulseRequestData(URL + URLpath[2], {["player"] = NSGetLocalPlayerUID()}, tablepath[2]) + foreach (map in file.allMaps) + { + pulseRequestData(URL + URLpath[3], {["player"] = NSGetLocalPlayerUID(), ["map"] = map.slice(3)}, tablepath[3]) + } + pulseRequestData(URL + URLpath[4], {["player"] = NSGetLocalPlayerUID()}, tablepath[4]) +} \ No newline at end of file diff --git a/mod/scripts/vscripts/ui/menu_stats_maps.nut b/mods/ToneAPI.pulse/mod/scripts/vscripts/ui/menu_stats_maps.nut similarity index 85% rename from mod/scripts/vscripts/ui/menu_stats_maps.nut rename to mods/ToneAPI.pulse/mod/scripts/vscripts/ui/menu_stats_maps.nut index e86f05c..0e5f3d1 100644 --- a/mod/scripts/vscripts/ui/menu_stats_maps.nut +++ b/mods/ToneAPI.pulse/mod/scripts/vscripts/ui/menu_stats_maps.nut @@ -140,8 +140,6 @@ void function UpdateStatsForMap( string mapName ) Hud_SetText( Hud_GetChild( file.menu, "WeaponName" ), GetMapDisplayName( mapName ) ) - fetchGamemodeStatsFromToneAPI(mapName) - // Image var imageElem = Hud_GetRui( Hud_GetChild( file.menu, "WeaponImageLarge" ) ) RuiSetImage( imageElem, "basicImage", GetMapImageForMapName( mapName ) ) @@ -154,20 +152,20 @@ void function UpdateStatsForMap( string mapName ) //SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat2" ), Localize( "#STATS_GAMES_PLAYED" ), gamesPlayed ) //SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat3" ), Localize( "#STATS_GAMES_PLAYED" ), gamesPlayed ) - SetStatsLabelValue( file.menu, "KillsLabel0", "KILLS ON MAP" ) - SetStatsLabelValue( file.menu, "KillsValue0", getMapKillFromToneAPI(mapName) ) + SetStatsLabelValue( file.menu, "KillsLabel0", Localize("#MAPS_KILLS") ) + SetStatsLabelValue( file.menu, "KillsValue0", pulseParse("maps", mapName.slice(3), "kills") ) - SetStatsLabelValue( file.menu, "KillsLabel1", "DEATHS ON MAP" ) - SetStatsLabelValue( file.menu, "KillsValue1", getMapDeathFromToneAPI(mapName) ) + SetStatsLabelValue( file.menu, "KillsLabel1", Localize("#MAPS_DEATHS") ) + SetStatsLabelValue( file.menu, "KillsValue1", pulseParse("maps", mapName.slice(3), "deaths") ) - SetStatsLabelValue( file.menu, "KillsLabel2", "TOTAL SHOT DISTANCE" ) - SetStatsLabelValue( file.menu, "KillsValue2", string(int((1.905 * float(getMapDistFromToneAPI(mapName) ) ) )/100) + "m" ) + SetStatsLabelValue( file.menu, "KillsLabel2", Localize("#MAPS_TSD") ) + SetStatsLabelValue( file.menu, "KillsValue2", HammerToMeterString(float(pulseParse("maps", mapName.slice(3), "total_distance")))) - SetStatsLabelValue( file.menu, "KillsLabel3", "MAXIMUM SHOT DISTANCE" ) - SetStatsLabelValue( file.menu, "KillsValue3", string(int((1.905 * float(getMapMDistFromToneAPI(mapName) ) ) )/100) + "m" ) + SetStatsLabelValue( file.menu, "KillsLabel3", Localize("#MAPS_MSD") ) + SetStatsLabelValue( file.menu, "KillsValue3", HammerToMeterString(float(pulseParse("maps", mapName.slice(3), "max_distance")))) - SetStatsLabelValue( file.menu, "KillsLabel4", "--" ) - SetStatsLabelValue( file.menu, "KillsValue4", "--" ) + SetStatsLabelValue( file.menu, "KillsLabel4", Localize("#MAPS_ASD") ) + SetStatsLabelValue( file.menu, "KillsValue4", HammerToMeterString(float(pulseParse("maps", mapName.slice(3), "max_distance")) / float(pulseParse("maps", mapName.slice(3), "kills")))) //var anchorElem = Hud_GetChild( file.menu, "WeaponStatsBackground" ) //printt( Hud_GetX( anchorElem ) ) @@ -185,13 +183,18 @@ void function UpdateStatsForMap( string mapName ) fw = [147, 204, 57, 255], gg = [14, 87, 132, 255] } + table< string, string > customGamemodeNames = { + sns = Localize("#GAMEMODE_sns") + fw = Localize("#GAMEMODE_fw") + gg = Localize("#GAMEMODE_gg") + } for ( int modeId = 0; modeId < enumCount; modeId++ ) { string modeName = PersistenceGetEnumItemNameForIndex( "gameModes", modeId ) - if ( mapName in globalToneAPIGamemodeMapData && modeName in globalToneAPIGamemodeMapData[mapName] ) + if (mapName.slice(3) in pulseData["gamemodesSeparated"]) { float modePlayedTime = 0 - modePlayedTime = float(globalToneAPIGamemodeMapData[mapName][modeName]) + modePlayedTime = float(pulseParse("gamemodesSeparated", mapName.slice(3), modeName, "kills")) if ( modePlayedTime > 0 ) { AddPieChartEntry( modes, GameMode_GetName( modeName ), modePlayedTime, GetGameModeDisplayColor( modeName ) ) } @@ -199,12 +202,12 @@ void function UpdateStatsForMap( string mapName ) } foreach (string key, array value in customGamemodeList) { - if ( mapName in globalToneAPIGamemodeMapData && key in globalToneAPIGamemodeMapData[mapName]) + if (mapName.slice(3) in pulseData["gamemodesSeparated"]) { float modePlayedTime = 0 - modePlayedTime = float(globalToneAPIGamemodeMapData[mapName][key]) + modePlayedTime = float(pulseParse("gamemodesSeparated", mapName.slice(3), key, "kills")) if ( modePlayedTime > 0 ) { - AddPieChartEntry( modes, key, modePlayedTime, value) + AddPieChartEntry( modes, customGamemodeNames[key], modePlayedTime, value) } } } @@ -228,7 +231,7 @@ void function UpdateStatsForMap( string mapName ) PieChartData modesPlayedData modesPlayedData.entries = modes modesPlayedData.labelColor = [ 255, 255, 255, 255 ] - SetPieChartData( file.menu, "ModesPieChart", "KILLS BY GAMEMODE", modesPlayedData ) + SetPieChartData( file.menu, "ModesPieChart", "#KILLS_GAMEMODE", modesPlayedData ) array fdMaps = GetPlaylistMaps( "fd" ) diff --git a/mod/scripts/vscripts/ui/menu_stats_overview.nut b/mods/ToneAPI.pulse/mod/scripts/vscripts/ui/menu_stats_overview.nut similarity index 88% rename from mod/scripts/vscripts/ui/menu_stats_overview.nut rename to mods/ToneAPI.pulse/mod/scripts/vscripts/ui/menu_stats_overview.nut index a2a74c6..8cc6f46 100644 --- a/mod/scripts/vscripts/ui/menu_stats_overview.nut +++ b/mods/ToneAPI.pulse/mod/scripts/vscripts/ui/menu_stats_overview.nut @@ -6,11 +6,13 @@ struct { var menu array allTitans + array allPilotWeapons table > titanStatLoadout } file const MAX_DOTS_ON_GRAPH = 10 table titanKillData = {} +table pilotKillData = {} const IMAGE_TITAN_STRYDER = $"ui/menu/personal_stats/ps_titan_icon_stryder" const IMAGE_TITAN_ATLAS = $"ui/menu/personal_stats/ps_titan_icon_atlas" @@ -30,11 +32,11 @@ void function InitViewStatsOverviewMenu() AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) } -void function GetTitanKills( string titanName ) +void function GetTitanKills() { file.allTitans = GetVisibleItemsOfType( eItemTypes.TITAN ) var dataTable = GetDataTable( $"datatable/titan_properties.rpak" ) - + foreach ( titan in file.allTitans ) { file.titanStatLoadout[ titan.ref ] <- [] @@ -48,24 +50,28 @@ void function GetTitanKills( string titanName ) file.titanStatLoadout[ titan.ref ].append( GetDataTableString( dataTable, row, GetDataTableColumnByName( dataTable, "melee" ) ) ) } - foreach ( weaponRef in file.titanStatLoadout[ titanName ]) + foreach ( titan in file.allTitans) { - titanKillData[weaponRef] <- getWeaponKillsFromToneAPI(weaponRef) + foreach ( weaponRef in file.titanStatLoadout[ titan.ref ]) + { + titanKillData[weaponRef] <- pulseParse("weaponsLocal", weaponRef, "kills") + } } } +void function GetAllPilotWeapons() +{ + file.allPilotWeapons = GetVisibleItemsOfType( eItemTypes.PILOT_PRIMARY) + file.allPilotWeapons.extend(GetVisibleItemsOfType( eItemTypes.PILOT_SECONDARY) ) + file.allPilotWeapons.extend(GetVisibleItemsOfType( eItemTypes.PILOT_ORDNANCE) ) + file.allPilotWeapons.extend( GetVisibleItemsOfType( eItemTypes.PILOT_SPECIAL ) ) +} + + void function OnStatsOverview_Open() { UI_SetPresentationType( ePresentationType.NO_MODELS ) - - GetTitanKills("ion") - GetTitanKills("scorch") - GetTitanKills("northstar") - GetTitanKills("ronin") - GetTitanKills("tone") - GetTitanKills("legion") - GetTitanKills("vanguard") - + GetTitanKills() UpdateViewStatsOverviewMenu() } @@ -207,7 +213,7 @@ function UpdateViewStatsOverviewMenu() Hud_Show( weaponImageElem ) Hud_SetText( weaponNameElem, nemesisWeapon.printName ) Hud_Show( weaponNameElem ) - Hud_SetText( weaponDescElem, nemesisWeapon.val + " DEATHS BY WEAPON" ) + Hud_SetText( weaponDescElem, Localize("#NEMESIS_WEAPON_VALUE"), nemesisWeapon.val) Hud_Show( weaponDescElem ) Hud_Hide( noDataElem ) } @@ -232,7 +238,7 @@ function UpdateViewStatsOverviewMenu() Hud_Show( weaponImageElem ) Hud_SetText( weaponNameElem, highestKPMData.printName ) Hud_Show( weaponNameElem ) - Hud_SetText( weaponDescElem, highestKPMData.val + " K/D") + Hud_SetText( weaponDescElem, "%s1 K/D", highestKPMData.val) Hud_Show( weaponDescElem ) Hud_Hide( noDataElem ) } @@ -288,42 +294,34 @@ function UpdateViewStatsOverviewMenu() //######################### // Lifetime + table playerweaponData = expect table(pulseData["weaponsLocal"]) + table globalweaponData = expect table(pulseData["weaponsGlobal"]) + var totalPilotKills = 0 - - foreach (var key, var value in globalToneAPIKillData) { - totalPilotKills += value + var totalPilotDeaths = 0 + foreach (var key, var value in playerweaponData) { + table values = expect table(value) + totalPilotKills += values["kills"] + totalPilotDeaths += values["deaths"] } var totalGlobalKills = 0 - foreach (var key, var value in globalToneAPIAllPlayerKillData) { - totalGlobalKills += value - } - var totalGlobalDeaths = 0 - foreach (var key, var value in globalToneAPIAllPlayerDeathData) { - totalGlobalDeaths += value + foreach (var key, var value in globalweaponData) { + table values = expect table(value) + totalGlobalKills += values["kills"] + totalGlobalDeaths += values["deaths"] } - var totalPilotDeaths = 0 - - foreach (var key, var value in globalToneAPIDeathData) { - totalPilotDeaths += value - } - - var killsAsPilot = 0 - foreach (var key, var value in globalToneAPIKillData) { - if (key in titanKillData) { - continue - } else { - killsAsPilot += getWeaponKillsFromToneAPI(string(key)) - } - } var killsAsTitan = 0 - foreach (var key, var value in globalToneAPIKillData) { + var killsAsPilot = 0 + foreach (var key, var value in playerweaponData) { if (key in titanKillData) { killsAsTitan += titanKillData[string(key)] + } else { + killsAsPilot += pulseParse("weaponsLocal", string(key), "kills") } } @@ -391,27 +389,27 @@ function UpdateViewStatsOverviewMenu() Hud_SetText( GetElem( file.menu, "KillsAsPilotValue0" ), string( killsAsPilot ) ) 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( pulseParse("weaponsLocal", "pilot_emptyhanded", "kills") + pulseParse("weaponsLocal", "melee_pilot_kunai", "kills") ) ) + Hud_SetText( GetElem( file.menu, "KillsAsPilotValue4" ), string( pulseParse("weaponsLocal", "human_execution", "kills") ) ) // 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") + titanMeleeKills += pulseParse("weaponsLocal", "titan_punch_ion", "kills") + titanMeleeKills += pulseParse("weaponsLocal", "titan_punch_scorch", "kills") + titanMeleeKills += pulseParse("weaponsLocal", "titan_punch_northstar", "kills") + titanMeleeKills += pulseParse("weaponsLocal", "titan_sword", "kills") + titanMeleeKills += pulseParse("weaponsLocal", "titan_punch_tone", "kills") + titanMeleeKills += pulseParse("weaponsLocal", "titan_punch_legion", "kills") + titanMeleeKills += pulseParse("weaponsLocal", "titan_punch_vanguard", "kills") + titanMeleeKills += pulseParse("weaponsLocal", "auto_titan_melee", "kills") - var titanExecutions = getWeaponKillsFromToneAPI("titan_execution") + var titanExecutions = pulseParse("weaponsLocal", "titan_execution", "kills") Hud_SetText( GetElem( file.menu, "KillsAsTitanValue0" ), string( killsAsTitan ) ) Hud_SetText( GetElem( file.menu, "KillsAsTitanValue1" ), string( GetPlayerStatInt( player, "kills_stats", "titanKillsAsTitan" ) ) ) Hud_SetText( GetElem( file.menu, "KillsAsTitanValue2" ), string( titanExecutions ) ) Hud_SetText( GetElem( file.menu, "KillsAsTitanValue3" ), string( titanMeleeKills ) ) - Hud_SetText( GetElem( file.menu, "KillsAsTitanValue4" ), string( getWeaponKillsFromToneAPI("damagedef_titan_step") ) ) + Hud_SetText( GetElem( file.menu, "KillsAsTitanValue4" ), string( pulseParse("weaponsLocal", "damagedef_titan_step", "kills") ) ) } function PlotKDPointsOnGraph( menu, graphIndex, values, dottedAverage ) diff --git a/mod/scripts/vscripts/ui/menu_stats_time.nut b/mods/ToneAPI.pulse/mod/scripts/vscripts/ui/menu_stats_time.nut similarity index 85% rename from mod/scripts/vscripts/ui/menu_stats_time.nut rename to mods/ToneAPI.pulse/mod/scripts/vscripts/ui/menu_stats_time.nut index a12aefa..eb1babc 100644 --- a/mod/scripts/vscripts/ui/menu_stats_time.nut +++ b/mods/ToneAPI.pulse/mod/scripts/vscripts/ui/menu_stats_time.nut @@ -49,7 +49,7 @@ float function GetTitanKills( string titanName) float weaponKills = 0 foreach ( weaponRef in file.titanStatLoadout[ titanName ]) { - weaponKills += float(getWeaponKillsFromToneAPI(weaponRef)) + weaponKills += float(pulseParse("weaponsLocal", weaponRef, "kills")) } return weaponKills } @@ -79,11 +79,13 @@ void function UpdateViewStatsTimeMenu() //######################################### // Time By Class Pie Chart //######################################### - + var totalPilotKills = 0 - - foreach (var key, var value in globalToneAPIKillData) { - totalPilotKills += value + table playerweaponData = expect table(pulseData["weaponsLocal"]) + + foreach (var key, var value in playerweaponData) { + table values = expect table(value) + totalPilotKills += values["kills"] } float hoursAsPilot = float(totalPilotKills) float hoursAsTitan = killsAsTitan @@ -101,7 +103,7 @@ void function UpdateViewStatsTimeMenu() PieChartData classTimeData classTimeData.entries = classes classTimeData.labelColor = [ 255, 255, 255, 255 ] - SetPieChartData( file.menu, "ClassPieChart", "KILLS BY CLASS", classTimeData ) + SetPieChartData( file.menu, "ClassPieChart", Localize("#TIME_KILLS_CLASS"), classTimeData ) //######################################### // Time By Chassis Pie Chart @@ -135,7 +137,7 @@ void function UpdateViewStatsTimeMenu() PieChartData chassisTimeData chassisTimeData.entries = titans chassisTimeData.labelColor = [ 255, 255, 255, 255 ] - SetPieChartData( file.menu, "ChassisPieChart", "KILLS BY TITAN", chassisTimeData ) + SetPieChartData( file.menu, "ChassisPieChart", Localize("#TIME_KILLS_TITAN"), chassisTimeData ) //######################################### // Time By Mode Pie Chart @@ -150,13 +152,18 @@ void function UpdateViewStatsTimeMenu() fw = [147, 204, 57, 255], gg = [14, 87, 132, 255] } + table< string, string > customGamemodeNames = { + sns = Localize("#GAMEMODE_sns") + fw = Localize("#GAMEMODE_fw") + gg = Localize("#GAMEMODE_gg") + } for ( int modeId = 0; modeId < enumCount; modeId++ ) { string modeName = PersistenceGetEnumItemNameForIndex( "gameModes", modeId ) - if ( modeName in globalToneAPIGamemodeData ) + if ( pulseParse("gamemodesAll", modeName, "kills") != 0 ) { float modePlayedTime = 0 - modePlayedTime = float(globalToneAPIGamemodeData[modeName]) + modePlayedTime = float(pulseParse("gamemodesAll", modeName, "kills")) if ( modePlayedTime > 0 ) { AddPieChartEntry( modes, GameMode_GetName( modeName ), modePlayedTime, GetGameModeDisplayColor( modeName ) ) } @@ -164,12 +171,12 @@ void function UpdateViewStatsTimeMenu() } foreach (string key, array value in customGamemodeList) { - if ( key in globalToneAPIGamemodeData) + if ( pulseParse("gamemodesAll", key, "kills") != 0 ) { float modePlayedTime = 0 - modePlayedTime = float(globalToneAPIGamemodeData[key]) + modePlayedTime = float(pulseParse("gamemodesAll", key, "kills")) if ( modePlayedTime > 0 ) { - AddPieChartEntry( modes, key, modePlayedTime, value) + AddPieChartEntry( modes, customGamemodeNames[key], modePlayedTime, value) } } } @@ -177,7 +184,7 @@ void function UpdateViewStatsTimeMenu() PieChartData modesPlayedData modesPlayedData.entries = modes modesPlayedData.labelColor = [ 255, 255, 255, 255 ] - SetPieChartData( file.menu, "ModesPieChart", "KILLS BY GAMEMODE", modesPlayedData ) + SetPieChartData( file.menu, "ModesPieChart", Localize("#KILLS_GAMEMODE"), modesPlayedData ) //######################################### // Time Stats diff --git a/mod/scripts/vscripts/ui/menu_stats_titans.nut b/mods/ToneAPI.pulse/mod/scripts/vscripts/ui/menu_stats_titans.nut similarity index 99% rename from mod/scripts/vscripts/ui/menu_stats_titans.nut rename to mods/ToneAPI.pulse/mod/scripts/vscripts/ui/menu_stats_titans.nut index 33fd156..da87817 100644 --- a/mod/scripts/vscripts/ui/menu_stats_titans.nut +++ b/mods/ToneAPI.pulse/mod/scripts/vscripts/ui/menu_stats_titans.nut @@ -175,7 +175,7 @@ void function UpdateStatsForTitan( string titanRef, int loadoutIndex ) int aiKills foreach ( weaponRef in file.titanStatLoadout[ titanRef ] ) { - totalKills += getWeaponKillsFromToneAPI(weaponRef) + totalKills += pulseParse("weaponsLocal", weaponRef, "kills") pilotKills += GetPlayerStatInt( player, "weapon_kill_stats", "pilots", weaponRef ) titanKills += GetPlayerStatInt( player, "weapon_kill_stats", "titansTotal", weaponRef ) aiKills += GetPlayerStatInt( player, "weapon_kill_stats", "ai", weaponRef ) diff --git a/mod/scripts/vscripts/ui/menu_stats_utility.nut b/mods/ToneAPI.pulse/mod/scripts/vscripts/ui/menu_stats_utility.nut similarity index 97% rename from mod/scripts/vscripts/ui/menu_stats_utility.nut rename to mods/ToneAPI.pulse/mod/scripts/vscripts/ui/menu_stats_utility.nut index 31b271c..bc22ea6 100644 --- a/mod/scripts/vscripts/ui/menu_stats_utility.nut +++ b/mods/ToneAPI.pulse/mod/scripts/vscripts/ui/menu_stats_utility.nut @@ -338,7 +338,7 @@ table function GetOverviewWeaponData() if ( !PersistenceEnumValueIsValid( "loadoutWeaponsAndAbilities", weaponName ) ) continue - int val = getWeaponKillsFromToneAPI(weaponName) + int val = pulseParse("weaponsLocal", weaponName, "kills") if ( val > Table[ "most_kills" ].val ) { Table[ "most_kills" ].ref = weaponName @@ -346,7 +346,7 @@ table function GetOverviewWeaponData() Table[ "most_kills" ].val = val } - int nval = getNemesisWeaponFromToneAPI(weaponName) + int nval = pulseParse("weaponsLocal", weaponName, "deaths") if ( nval > Table[ "nemesis_weapon" ].val ) { Table[ "nemesis_weapon" ].ref = weaponName @@ -357,9 +357,9 @@ table function GetOverviewWeaponData() 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( pulseParse("weaponsLocal", weaponName, "kills") != 0 && pulseParse("weaponsLocal", weaponName, "deaths_while_equipped") != 0){ + kval = float(pulseParse("weaponsLocal", weaponName, "kills")) + dval = float(pulseParse("weaponsLocal", weaponName, "deaths_while_equipped")) if (kval / dval > kdval){ kdval = kval / dval } diff --git a/mod/scripts/vscripts/ui/menu_stats_weapons.nut b/mods/ToneAPI.pulse/mod/scripts/vscripts/ui/menu_stats_weapons.nut similarity index 93% rename from mod/scripts/vscripts/ui/menu_stats_weapons.nut rename to mods/ToneAPI.pulse/mod/scripts/vscripts/ui/menu_stats_weapons.nut index 114f202..6340a5a 100644 --- a/mod/scripts/vscripts/ui/menu_stats_weapons.nut +++ b/mods/ToneAPI.pulse/mod/scripts/vscripts/ui/menu_stats_weapons.nut @@ -180,8 +180,8 @@ void function UpdateStatsForWeapon( string weaponRef ) } // Total Kills Stats - SetStatsLabelValue( file.menu, "KillsValue0", getWeaponKillsFromToneAPI(weaponRef) ) - SetStatsLabelValue( file.menu, "KillsValue1", getWeaponKillsFromToneAPI(weaponRef) ) - SetStatsLabelValue( file.menu, "KillsValue2", GetPlayerStatInt( player, "weapon_kill_stats", "titansTotal", weaponRef ) ) - SetStatsLabelValue( file.menu, "KillsValue3", getDWEFromToneAPI(weaponRef)) + SetStatsLabelValue( file.menu, "KillsValue0", pulseParse("weaponsLocal", weaponRef, "kills") ) //Total kills + SetStatsLabelValue( file.menu, "KillsValue1", pulseParse("weaponsLocal", weaponRef, "kills") ) //Pilots + SetStatsLabelValue( file.menu, "KillsValue2", GetPlayerStatInt( player, "weapon_kill_stats", "titansTotal", weaponRef ) ) //Titans + SetStatsLabelValue( file.menu, "KillsValue3", pulseParse("weaponsLocal", weaponRef, "deaths_while_equipped")) // Deaths with weapon } diff --git a/version.json b/version.json deleted file mode 100644 index 1d6e638..0000000 --- a/version.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Major": "1", - "Minor": "2", - "Patch": "1" -} \ No newline at end of file