Compare commits
44
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
586fa32b69 | ||
|
|
fb6963f86e | ||
|
|
4e0192d2ce | ||
|
|
979f463367 | ||
|
|
373c469abb | ||
|
|
5c11623ecb | ||
|
|
47d91497dd | ||
|
|
b28fb1e6c7 | ||
|
|
3c28ab0fb3 | ||
|
|
186692f198 | ||
|
|
7287d0d1f2 | ||
|
|
890fffc7e3 | ||
|
|
90bd196886 | ||
|
|
db1d4d115c | ||
|
|
44d4f3351f | ||
|
|
33def04dda | ||
|
|
2a7d5d3ac6 | ||
|
|
354d23d991 | ||
|
|
d2b5482e89 | ||
|
|
eefff5d5f3 | ||
|
|
dcc569ea44 | ||
|
|
3938b4830f | ||
|
|
326e39555d | ||
|
|
0b10707830 | ||
|
|
12233a4f8a | ||
|
|
dbf3d84a83 | ||
|
|
3976247376 | ||
|
|
e67df127f4 | ||
|
|
707f469917 | ||
|
|
a831471184 | ||
|
|
4a50d26111 | ||
|
|
79dbab8fcb | ||
|
|
b2df433810 | ||
|
|
0f80026a94 | ||
|
|
9701fa5559 | ||
|
|
1c2244e10d | ||
|
|
f71255e55b | ||
|
|
3268f5b75c | ||
|
|
7dce384024 | ||
|
|
4c45bc233a | ||
|
|
a18faecd0a | ||
|
|
5bfe63f1c5 | ||
|
|
66dfb9d53a | ||
|
|
e8cbfeb3cc |
@@ -1,6 +1,80 @@
|
||||
# Pulse
|
||||
## This repository is currently W.I.P.
|
||||
Pulse is (or, will be someday) a clientside Titanfall 2 mod that allows players to view statistics saved in the Tone API using the currently nonfunctional `Stats` tab.
|
||||
|
||||
Currently to do:
|
||||
- the entire repository
|
||||
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,
|
||||
- functional `Time` tab,
|
||||
- Pilot weapon data displayed in `Pilot Weapons` tab,
|
||||
- Titan kills displayed in `Titans` tab,
|
||||
- functional `Maps` tab,
|
||||
- real-time updates.
|
||||
|
||||
Want to know what we have planned for future updates? See [here.](https://github.com/ToneAPI/pulse/projects?query=is%3Aopen)
|
||||
|
||||
Found a bug? Make an issue on GitHub [here.](https://github.com/ToneAPI/pulse/issues/new)
|
||||
|
||||
<details>
|
||||
<summary>Features, more in-depth:</summary>
|
||||
|
||||
### `Overview`
|
||||
- Most Kills - shows the weapon with most accumulated kills.
|
||||
- Nemesis Weapon - shows the weapon that has killed you the most.
|
||||
- Most Effective - shows weapon with the highest K/D ratio.
|
||||
- Kill/Death Ratio - shows the overall K/D ratio of player. (the two line graphs "Lifetime Avg." and "Lifetime Avg. vs. Players" don't work.)
|
||||
- Kills as Pilot - shows general kill data for player as Pilot, visualised in the table below:
|
||||
|
||||
| Name | Description |
|
||||
|--------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| Pilots |Shows **ALL KILLS** accumulated by player as Pilot. Differentiating Pilot and Titan kills will come in a later Tone API update.|
|
||||
| Titans |Non-functional, see line above.|
|
||||
| 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 |
|
||||
|--------------------|------------------------------------------------------|
|
||||
| Pilots |Shows **ALL KILLS** accumulated by player as Titan. Differentiating Pilot and Titan kills will come in a later Tone API update.|
|
||||
| Titans |Non-functional, see line above.|
|
||||
| Titan executions |Shows only executions accumulated by player as Titan.|
|
||||
| Pilots meleed |Shows only melee kills accumulated by player as Titan.|
|
||||
| Pilot roadkills |Shows only roadkills accumulated by player as Titan.|
|
||||
|
||||
- Upper statbox values have been zeroed out, these don't yet work and are set to 0 to avoid confusion.
|
||||
|
||||
### `Time`
|
||||
|
||||
- Kills by Class shows kills by Pilot and Titan on a piechart.
|
||||
- Kills by Titan shows kills by all Titan classes on a piechart.
|
||||
- Kills by Gamemode shows kills on each gamemode played on a piechart.
|
||||
|
||||
### `Pilot Weapons`
|
||||
|
||||
- shows total accumulated kills per weapon under Total Kills.
|
||||
- shows deaths with given weapon equipped under Deaths with Weapon.
|
||||
|
||||
### `Titans`
|
||||
|
||||
- shows total accumulated kills per Titan under Total Kills.
|
||||
|
||||
### `Maps`
|
||||
|
||||
- Player Map Stats - shows general data for player on chosen map, visualised in the table below:
|
||||
|
||||
| Name | Description |
|
||||
|-----------------------|------------------------------------------------------- |
|
||||
| Kills on Map |Shows all kills accumulated by player on chosen map.|
|
||||
| Deaths on Map |Shows all deaths accumulated by player on chosen map.|
|
||||
| Total Shot Distance |Shows total distance of kills accumulated by player on chosen map.|
|
||||
| Maximum Shot Distance |Shows highest distance kill by player on chosen map.|
|
||||
|
||||
- Kills by Gamemode - piechart showing all kills (in percent) on chosen map by gamemode.
|
||||
</details>
|
||||
|
||||
## DISCLAIMER
|
||||
|
||||
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.
|
||||
|
||||
@@ -1,6 +1,37 @@
|
||||
{
|
||||
"Name": "ToneAPI.pulse",
|
||||
"Description": "placeholder text",
|
||||
"Version": "0.0.1",
|
||||
"LoadPriority": 2
|
||||
"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"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,508 @@
|
||||
resource/ui/menus/viewstats_weapons.menu
|
||||
{
|
||||
menu
|
||||
{
|
||||
ControlName Frame
|
||||
xpos 0
|
||||
ypos 0
|
||||
zpos 3
|
||||
wide f0
|
||||
tall f0
|
||||
autoResize 0
|
||||
pinCorner 0
|
||||
visible 1
|
||||
enabled 1
|
||||
PaintBackgroundType 0
|
||||
infocus_bgcolor_overridep "0 0 0 0"
|
||||
outoffocus_bgcolor_override "0 0 0 0"
|
||||
|
||||
Vignette
|
||||
{
|
||||
ControlName ImagePanel
|
||||
InheritProperties MenuVignette
|
||||
}
|
||||
|
||||
MenuTitle
|
||||
{
|
||||
ControlName Label
|
||||
InheritProperties MenuTitle
|
||||
labelText "#STATS_PILOT_WEAPONS"
|
||||
}
|
||||
|
||||
MenuCommon
|
||||
{
|
||||
ControlName CNestedPanel
|
||||
xpos 0
|
||||
ypos 0
|
||||
wide f0
|
||||
tall f0
|
||||
visible 1
|
||||
controlSettingsFile "resource/ui/menus/panels/menu_common.res"
|
||||
}
|
||||
|
||||
MatchmakingStatus
|
||||
{
|
||||
ControlName CNestedPanel
|
||||
xpos 0
|
||||
ypos 0
|
||||
wide f0
|
||||
tall f0
|
||||
visible 1
|
||||
controlSettingsFile "resource/ui/menus/panels/matchmaking_status.res"
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GridPanel
|
||||
{
|
||||
ControlName CNestedPanel
|
||||
xpos 96
|
||||
ypos 193
|
||||
zpos 99
|
||||
wide 224
|
||||
tall 702
|
||||
visible 1
|
||||
tabPosition 1
|
||||
controlSettingsFile "Resource/UI/menus/panels/weapon_stats_grid.res"
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Screen
|
||||
{
|
||||
ControlName Label
|
||||
xpos 0
|
||||
ypos 0
|
||||
wide f0
|
||||
tall f0
|
||||
labelText ""
|
||||
//bgcolor_override "100 100 100 100"
|
||||
//paintbackground 1
|
||||
//visible 1
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
WeaponName
|
||||
{
|
||||
ControlName Label
|
||||
xpos -516
|
||||
ypos -366
|
||||
zpos 101
|
||||
auto_wide_tocontents 1
|
||||
auto_tall_tocontents 1
|
||||
visible 1
|
||||
font DefaultBold_44
|
||||
labelText "WEAPON NAME"
|
||||
allcaps 1
|
||||
fgcolor_override "255 255 255 255"
|
||||
//bgcolor_override "0 255 0 100"
|
||||
|
||||
pin_to_sibling Screen
|
||||
pin_corner_to_sibling TOP_LEFT
|
||||
pin_to_sibling_corner BOTTOM
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
KillsHeader
|
||||
{
|
||||
ControlName RuiPanel
|
||||
rui "ui/stats_background.rpak"
|
||||
zpos 101
|
||||
wide 500
|
||||
tall 194
|
||||
visible 1
|
||||
scaleImage 1
|
||||
|
||||
pin_to_sibling WeaponName
|
||||
pin_corner_to_sibling TOP_LEFT
|
||||
pin_to_sibling_corner BOTTOM_LEFT
|
||||
}
|
||||
|
||||
KillsHeaderLabel
|
||||
{
|
||||
ControlName Label
|
||||
xpos -18
|
||||
ypos -6
|
||||
zpos 102
|
||||
wide 400
|
||||
tall 36
|
||||
visible 1
|
||||
font Default_31
|
||||
labelText "#STATS_HEADER_KILL_HISTORY"
|
||||
allcaps 1
|
||||
textAlignment west
|
||||
fgcolor_override "255 255 255 255"
|
||||
//bgcolor_override "255 255 0 100"
|
||||
|
||||
pin_to_sibling KillsHeader
|
||||
pin_corner_to_sibling TOP_LEFT
|
||||
pin_to_sibling_corner TOP_LEFT
|
||||
}
|
||||
|
||||
KillsLineBackground0
|
||||
{
|
||||
ControlName RuiPanel
|
||||
rui "ui/stats_line_background.rpak"
|
||||
xpos 0
|
||||
ypos -48
|
||||
zpos 101
|
||||
wide 500
|
||||
tall 36
|
||||
visible 1
|
||||
scaleImage 1
|
||||
|
||||
pin_to_sibling KillsHeader
|
||||
pin_corner_to_sibling TOP_LEFT
|
||||
pin_to_sibling_corner TOP_LEFT
|
||||
}
|
||||
|
||||
KillsLabel0
|
||||
{
|
||||
ControlName Label
|
||||
xpos -18
|
||||
ypos 0
|
||||
zpos 102
|
||||
wide 308
|
||||
tall 36
|
||||
visible 1
|
||||
font Default_23
|
||||
labelText "#STATS_HEADER_TOTAL_KILLS"
|
||||
allcaps 1
|
||||
textAlignment west
|
||||
fgcolor_override "255 255 255 255"
|
||||
//bgcolor_override "255 255 0 100"
|
||||
|
||||
pin_to_sibling KillsLineBackground0
|
||||
pin_corner_to_sibling LEFT
|
||||
pin_to_sibling_corner LEFT
|
||||
}
|
||||
|
||||
KillsValue0
|
||||
{
|
||||
ControlName Label
|
||||
xpos 0
|
||||
ypos 0
|
||||
zpos 102
|
||||
wide 94
|
||||
tall 36
|
||||
visible 1
|
||||
font Default_23
|
||||
labelText "--"
|
||||
allcaps 1
|
||||
textAlignment center
|
||||
fgcolor_override "255 255 255 255"
|
||||
//bgcolor_override "0 255 0 100"
|
||||
|
||||
pin_to_sibling KillsLineBackground0
|
||||
pin_corner_to_sibling RIGHT
|
||||
pin_to_sibling_corner RIGHT
|
||||
}
|
||||
|
||||
KillsLineBackground1
|
||||
{
|
||||
ControlName RuiPanel
|
||||
rui "ui/stats_line_background.rpak"
|
||||
xpos 0
|
||||
ypos 0
|
||||
zpos 101
|
||||
wide 500
|
||||
tall 36
|
||||
visible 0
|
||||
scaleImage 1
|
||||
|
||||
pin_to_sibling KillsLineBackground0
|
||||
pin_corner_to_sibling TOP_LEFT
|
||||
pin_to_sibling_corner BOTTOM_LEFT
|
||||
}
|
||||
|
||||
KillsLabel1
|
||||
{
|
||||
ControlName Label
|
||||
xpos -18
|
||||
ypos 0
|
||||
zpos 102
|
||||
wide 308
|
||||
tall 36
|
||||
visible 1
|
||||
font Default_23
|
||||
labelText "#STATS_KILLS_PILOTS"
|
||||
allcaps 1
|
||||
textAlignment west
|
||||
fgcolor_override "255 255 255 255"
|
||||
//bgcolor_override "255 255 0 100"
|
||||
|
||||
pin_to_sibling KillsLineBackground1
|
||||
pin_corner_to_sibling LEFT
|
||||
pin_to_sibling_corner LEFT
|
||||
}
|
||||
|
||||
KillsValue1
|
||||
{
|
||||
ControlName Label
|
||||
xpos 0
|
||||
ypos 0
|
||||
zpos 102
|
||||
wide 94
|
||||
tall 36
|
||||
visible 1
|
||||
font Default_23
|
||||
labelText "--"
|
||||
allcaps 1
|
||||
textAlignment center
|
||||
fgcolor_override "255 255 255 255"
|
||||
//bgcolor_override "0 255 0 100"
|
||||
|
||||
pin_to_sibling KillsLineBackground1
|
||||
pin_corner_to_sibling RIGHT
|
||||
pin_to_sibling_corner RIGHT
|
||||
}
|
||||
|
||||
KillsLineBackground2
|
||||
{
|
||||
ControlName RuiPanel
|
||||
rui "ui/stats_line_background.rpak"
|
||||
xpos 0
|
||||
ypos 0
|
||||
zpos 101
|
||||
wide 500
|
||||
tall 36
|
||||
visible 1
|
||||
scaleImage 1
|
||||
|
||||
pin_to_sibling KillsLineBackground1
|
||||
pin_corner_to_sibling TOP_LEFT
|
||||
pin_to_sibling_corner BOTTOM_LEFT
|
||||
}
|
||||
|
||||
KillsLabel2
|
||||
{
|
||||
ControlName Label
|
||||
xpos -18
|
||||
ypos 0
|
||||
zpos 102
|
||||
wide 308
|
||||
tall 36
|
||||
visible 1
|
||||
font Default_23
|
||||
labelText "#STATS_KILLS_TITANS"
|
||||
allcaps 1
|
||||
textAlignment west
|
||||
fgcolor_override "255 255 255 255"
|
||||
//bgcolor_override "255 255 0 100"
|
||||
|
||||
pin_to_sibling KillsLineBackground2
|
||||
pin_corner_to_sibling LEFT
|
||||
pin_to_sibling_corner LEFT
|
||||
}
|
||||
|
||||
KillsValue2
|
||||
{
|
||||
ControlName Label
|
||||
xpos 0
|
||||
ypos 0
|
||||
zpos 102
|
||||
wide 94
|
||||
tall 36
|
||||
visible 1
|
||||
font Default_23
|
||||
labelText "--"
|
||||
allcaps 1
|
||||
textAlignment center
|
||||
fgcolor_override "255 255 255 255"
|
||||
//bgcolor_override "0 255 0 100"
|
||||
|
||||
pin_to_sibling KillsLineBackground2
|
||||
pin_corner_to_sibling RIGHT
|
||||
pin_to_sibling_corner RIGHT
|
||||
}
|
||||
|
||||
KillsLineBackground3
|
||||
{
|
||||
ControlName RuiPanel
|
||||
rui "ui/stats_line_background.rpak"
|
||||
xpos 0
|
||||
ypos 0
|
||||
zpos 101
|
||||
wide 500
|
||||
tall 36
|
||||
visible 0
|
||||
scaleImage 1
|
||||
|
||||
pin_to_sibling KillsLineBackground2
|
||||
pin_corner_to_sibling TOP_LEFT
|
||||
pin_to_sibling_corner BOTTOM_LEFT
|
||||
}
|
||||
|
||||
KillsLabel3
|
||||
{
|
||||
ControlName Label
|
||||
xpos -18
|
||||
ypos 0
|
||||
zpos 102
|
||||
wide 308
|
||||
tall 36
|
||||
visible 1
|
||||
font Default_23
|
||||
labelText "DEATHS WITH WEAPON"
|
||||
allcaps 1
|
||||
textAlignment west
|
||||
fgcolor_override "255 255 255 255"
|
||||
//bgcolor_override "255 255 0 100"
|
||||
|
||||
pin_to_sibling KillsLineBackground3
|
||||
pin_corner_to_sibling LEFT
|
||||
pin_to_sibling_corner LEFT
|
||||
}
|
||||
|
||||
KillsValue3
|
||||
{
|
||||
ControlName Label
|
||||
xpos 0
|
||||
ypos 0
|
||||
zpos 102
|
||||
wide 94
|
||||
tall 36
|
||||
visible 1
|
||||
font Default_23
|
||||
labelText "--"
|
||||
allcaps 1
|
||||
textAlignment center
|
||||
fgcolor_override "255 255 255 255"
|
||||
//bgcolor_override "0 255 0 100"
|
||||
|
||||
pin_to_sibling KillsLineBackground3
|
||||
pin_corner_to_sibling RIGHT
|
||||
pin_to_sibling_corner RIGHT
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Stat0
|
||||
{
|
||||
ControlName RuiPanel
|
||||
rui "ui/stat_box_e.rpak"
|
||||
xpos 8
|
||||
zpos 100
|
||||
wide 210
|
||||
tall 93
|
||||
visible 1
|
||||
|
||||
pin_to_sibling KillsHeader
|
||||
pin_corner_to_sibling TOP_LEFT
|
||||
pin_to_sibling_corner TOP_RIGHT
|
||||
}
|
||||
|
||||
Stat1
|
||||
{
|
||||
ControlName RuiPanel
|
||||
rui "ui/stat_box_e.rpak"
|
||||
xpos 8
|
||||
zpos 100
|
||||
wide 210
|
||||
tall 93
|
||||
visible 1
|
||||
|
||||
pin_to_sibling Stat0
|
||||
pin_corner_to_sibling LEFT
|
||||
pin_to_sibling_corner RIGHT
|
||||
}
|
||||
|
||||
Stat2
|
||||
{
|
||||
ControlName RuiPanel
|
||||
rui "ui/stat_box_e.rpak"
|
||||
ypos 8
|
||||
zpos 100
|
||||
wide 210
|
||||
tall 93
|
||||
visible 1
|
||||
|
||||
pin_to_sibling Stat0
|
||||
pin_corner_to_sibling TOP_LEFT
|
||||
pin_to_sibling_corner BOTTOM_LEFT
|
||||
}
|
||||
|
||||
Stat3
|
||||
{
|
||||
ControlName RuiPanel
|
||||
rui "ui/stat_box_e.rpak"
|
||||
xpos 8
|
||||
zpos 100
|
||||
wide 210
|
||||
tall 93
|
||||
visible 1
|
||||
|
||||
pin_to_sibling Stat2
|
||||
pin_corner_to_sibling LEFT
|
||||
pin_to_sibling_corner RIGHT
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NextUnlock
|
||||
{
|
||||
ControlName RuiPanel
|
||||
rui "ui/stats_next_unlock.rpak"
|
||||
xpos 8
|
||||
zpos 90
|
||||
wide 356
|
||||
tall 194
|
||||
visible 1
|
||||
scaleImage 1
|
||||
|
||||
pin_to_sibling Stat1
|
||||
pin_corner_to_sibling TOP_LEFT
|
||||
pin_to_sibling_corner TOP_RIGHT
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ModelRotateMouseCapture
|
||||
{
|
||||
ControlName CMouseMovementCapturePanel
|
||||
xpos 580
|
||||
zpos 12
|
||||
wide 1340
|
||||
tall %100
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
LblWeaponLocked
|
||||
{
|
||||
ControlName Label
|
||||
classname LblWeaponLocked
|
||||
xpos -650
|
||||
ypos 142
|
||||
zpos 102
|
||||
wide 474
|
||||
auto_tall_tocontents 1
|
||||
visible 1
|
||||
font Default_27_DropShadow
|
||||
allcaps 1
|
||||
textAlignment center
|
||||
labelText "UNLOCK INFO"
|
||||
fgcolor_override "153 61 61 255"
|
||||
bgcolor_override "51 20 20 240"
|
||||
pin_to_sibling KillsHeader
|
||||
pin_corner_to_sibling BOTTOM
|
||||
pin_to_sibling_corner TOP_LEFT
|
||||
paintbackground 1
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
FooterButtons
|
||||
{
|
||||
ControlName CNestedPanel
|
||||
xpos 0
|
||||
ypos r119
|
||||
wide f0
|
||||
tall 36
|
||||
visible 1
|
||||
controlSettingsFile "resource/ui/menus/panels/footer_buttons.res"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,267 @@
|
||||
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
|
||||
}
|
||||
@@ -1,522 +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", "#" )
|
||||
|
||||
//##############################################
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
|
||||
global function InitViewStatsMenu
|
||||
|
||||
struct{
|
||||
array<string> 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()
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
global function InitViewStatsMapsMenu
|
||||
global function setit
|
||||
|
||||
struct
|
||||
{
|
||||
var menu
|
||||
GridMenuData gridData
|
||||
bool isGridInitialized = false
|
||||
array<string> allMaps
|
||||
} file
|
||||
|
||||
void function InitViewStatsMapsMenu()
|
||||
{
|
||||
var menu = GetMenu( "ViewStats_Maps_Menu" )
|
||||
file.menu = menu
|
||||
|
||||
Hud_SetText( Hud_GetChild( file.menu, "MenuTitle" ), "#STATS_MAPS" )
|
||||
|
||||
file.gridData.rows = 5
|
||||
file.gridData.columns = 1
|
||||
//file.gridData.numElements // Set in OnViewStatsWeapons_Open after itemdata exists
|
||||
file.gridData.pageType = eGridPageType.VERTICAL
|
||||
file.gridData.tileWidth = 224
|
||||
file.gridData.tileHeight = 112
|
||||
file.gridData.paddingVert = 6
|
||||
file.gridData.paddingHorz = 6
|
||||
|
||||
Grid_AutoAspectSettings( menu, file.gridData )
|
||||
|
||||
file.gridData.initCallback = MapButton_Init
|
||||
file.gridData.getFocusCallback = MapButton_GetFocus
|
||||
file.gridData.clickCallback = MapButton_Activate
|
||||
|
||||
AddMenuEventHandler( file.menu, eUIEvent.MENU_OPEN, OnViewStatsWeapons_Open )
|
||||
|
||||
AddMenuFooterOption( file.menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" )
|
||||
}
|
||||
|
||||
void function OnViewStatsWeapons_Open()
|
||||
{
|
||||
UI_SetPresentationType( ePresentationType.NO_MODELS )
|
||||
|
||||
file.allMaps = GetPrivateMatchMaps()
|
||||
|
||||
file.gridData.numElements = file.allMaps.len()
|
||||
|
||||
if ( !file.isGridInitialized )
|
||||
{
|
||||
GridMenuInit( file.menu, file.gridData )
|
||||
file.isGridInitialized = true
|
||||
}
|
||||
|
||||
file.gridData.currentPage = 0
|
||||
|
||||
Grid_InitPage( file.menu, file.gridData )
|
||||
Hud_SetFocused( Grid_GetButtonForElementNumber( file.menu, 0 ) )
|
||||
}
|
||||
|
||||
bool function MapButton_Init( var button, int elemNum )
|
||||
{
|
||||
string mapName = file.allMaps[ elemNum ]
|
||||
UpdateStatsForMap( mapName )
|
||||
asset mapImage = GetMapImageForMapName( mapName )
|
||||
|
||||
var rui = Hud_GetRui( button )
|
||||
RuiSetImage( rui, "buttonImage", mapImage )
|
||||
|
||||
Hud_SetEnabled( button, true )
|
||||
Hud_SetVisible( button, true )
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
void function MapButton_GetFocus( var button, int elemNum )
|
||||
{
|
||||
if ( IsControllerModeActive() )
|
||||
UpdateStatsForMap( file.allMaps[ elemNum ] )
|
||||
}
|
||||
|
||||
void function MapButton_Activate( var button, int elemNum )
|
||||
{
|
||||
if ( !IsControllerModeActive() )
|
||||
UpdateStatsForMap( file.allMaps[ elemNum ] )
|
||||
}
|
||||
|
||||
int function GetGameStatForMapInt( string gameStat, string mapName )
|
||||
{
|
||||
array<string> privateMatchModes = GetPrivateMatchModes()
|
||||
|
||||
int totalStat = 0
|
||||
int enumCount = PersistenceGetEnumCount( "gameModes" )
|
||||
for ( int modeId = 0; modeId < enumCount; modeId++ )
|
||||
{
|
||||
string modeName = PersistenceGetEnumItemNameForIndex( "gameModes", modeId )
|
||||
|
||||
totalStat += GetGameStatForMapAndModeInt( gameStat, mapName, modeName )
|
||||
}
|
||||
|
||||
return totalStat
|
||||
}
|
||||
|
||||
int function GetGameStatForMapAndModeInt( string gameStat, string mapName, string modeName, string difficulty = "1" )
|
||||
{
|
||||
string statString = GetStatVar( "game_stats", gameStat, "" )
|
||||
string persistentVar = Stats_GetFixedSaveVar( statString, mapName, modeName, difficulty )
|
||||
|
||||
return GetUIPlayer().GetPersistentVarAsInt( persistentVar )
|
||||
}
|
||||
|
||||
float function GetGameStatForMapFloat( string gameStat, string mapName )
|
||||
{
|
||||
array<string> privateMatchModes = GetPrivateMatchModes()
|
||||
|
||||
float totalStat = 0
|
||||
int enumCount = PersistenceGetEnumCount( "gameModes" )
|
||||
for ( int modeId = 0; modeId < enumCount; modeId++ )
|
||||
{
|
||||
string modeName = PersistenceGetEnumItemNameForIndex( "gameModes", modeId )
|
||||
|
||||
totalStat += GetGameStatForMapAndModeFloat( gameStat, mapName, modeName )
|
||||
}
|
||||
|
||||
return totalStat
|
||||
}
|
||||
|
||||
float function GetGameStatForMapAndModeFloat( string gameStat, string mapName, string modeName )
|
||||
{
|
||||
string statString = GetStatVar( "game_stats", gameStat, "" )
|
||||
string persistentVar = Stats_GetFixedSaveVar( statString, mapName, modeName, "1" )
|
||||
|
||||
return expect float( GetUIPlayer().GetPersistentVar( persistentVar ) )
|
||||
}
|
||||
|
||||
|
||||
void function UpdateStatsForMap( string mapName )
|
||||
{
|
||||
entity player = GetUIPlayer()
|
||||
if ( player == null )
|
||||
return
|
||||
|
||||
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 ) )
|
||||
|
||||
string timePlayed = "null"
|
||||
string gamesPlayed = "null"
|
||||
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat0" ), Localize( "#STATS_HEADER_TIME_PLAYED" ), timePlayed )
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat1" ), Localize( "#STATS_GAMES_PLAYED" ), gamesPlayed )
|
||||
//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, "KillsLabel1", "DEATHS ON MAP" )
|
||||
SetStatsLabelValue( file.menu, "KillsValue1", getMapDeathFromToneAPI(mapName) )
|
||||
|
||||
SetStatsLabelValue( file.menu, "KillsLabel2", "TOTAL SHOT DISTANCE" )
|
||||
SetStatsLabelValue( file.menu, "KillsValue2", string(int((1.905 * float(getMapDistFromToneAPI(mapName) ) ) )/100) + "m" )
|
||||
|
||||
SetStatsLabelValue( file.menu, "KillsLabel3", "MAXIMUM SHOT DISTANCE" )
|
||||
SetStatsLabelValue( file.menu, "KillsValue3", string(int((1.905 * float(getMapMDistFromToneAPI(mapName) ) ) )/100) + "m" )
|
||||
|
||||
SetStatsLabelValue( file.menu, "KillsLabel4", "--" )
|
||||
SetStatsLabelValue( file.menu, "KillsValue4", "--" )
|
||||
|
||||
//var anchorElem = Hud_GetChild( file.menu, "WeaponStatsBackground" )
|
||||
//printt( Hud_GetX( anchorElem ) )
|
||||
//printt( Hud_GetX( anchorElem ) )
|
||||
//printt( Hud_GetX( anchorElem ) )
|
||||
//printt( Hud_GetX( anchorElem ) )
|
||||
//Hud_SetX( anchorElem, 0 )
|
||||
//
|
||||
array<string> gameModesArray = GetPersistenceEnumAsArray( "gameModes" )
|
||||
|
||||
array<PieChartEntry> modes
|
||||
int enumCount = PersistenceGetEnumCount( "gameModes" )
|
||||
table< string, array<int> > customGamemodeList = {
|
||||
sns = [255, 178, 102, 255],
|
||||
fw = [147, 204, 57, 255],
|
||||
gg = [14, 87, 132, 255]
|
||||
}
|
||||
for ( int modeId = 0; modeId < enumCount; modeId++ )
|
||||
{
|
||||
string modeName = PersistenceGetEnumItemNameForIndex( "gameModes", modeId )
|
||||
if ( mapName in globalToneAPIGamemodeMapData && modeName in globalToneAPIGamemodeMapData[mapName] )
|
||||
{
|
||||
float modePlayedTime = 0
|
||||
modePlayedTime = float(globalToneAPIGamemodeMapData[mapName][modeName])
|
||||
if ( modePlayedTime > 0 ) {
|
||||
AddPieChartEntry( modes, GameMode_GetName( modeName ), modePlayedTime, GetGameModeDisplayColor( modeName ) )
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (string key, array<int> value in customGamemodeList)
|
||||
{
|
||||
if ( mapName in globalToneAPIGamemodeMapData && key in globalToneAPIGamemodeMapData[mapName])
|
||||
{
|
||||
float modePlayedTime = 0
|
||||
modePlayedTime = float(globalToneAPIGamemodeMapData[mapName][key])
|
||||
if ( modePlayedTime > 0 ) {
|
||||
AddPieChartEntry( modes, key, modePlayedTime, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
const MAX_MODE_ROWS = 8
|
||||
|
||||
if ( modes.len() > 0 )
|
||||
{
|
||||
modes.sort( ComparePieChartEntryValues )
|
||||
|
||||
if ( modes.len() > MAX_MODE_ROWS )
|
||||
{
|
||||
float otherValue
|
||||
for ( int i = MAX_MODE_ROWS-1; i < modes.len() ; i++ )
|
||||
otherValue += modes[i].numValue
|
||||
|
||||
modes.resize( MAX_MODE_ROWS-1 )
|
||||
AddPieChartEntry( modes, "#GAMEMODE_OTHER", otherValue, [127, 127, 127, 255] )
|
||||
}
|
||||
}
|
||||
|
||||
PieChartData modesPlayedData
|
||||
modesPlayedData.entries = modes
|
||||
modesPlayedData.labelColor = [ 255, 255, 255, 255 ]
|
||||
SetPieChartData( file.menu, "ModesPieChart", "KILLS BY GAMEMODE", modesPlayedData )
|
||||
|
||||
array<string> fdMaps = GetPlaylistMaps( "fd" )
|
||||
|
||||
if ( 0 == 1 ) // maybe work later on some FD servers
|
||||
{
|
||||
array<var> pveElems = GetElementsByClassname( file.menu, "PvEGroup" )
|
||||
foreach ( elem in pveElems )
|
||||
{
|
||||
Hud_Show( elem )
|
||||
}
|
||||
|
||||
vector perfectColor = TEAM_COLOR_FRIENDLY / 219.0
|
||||
|
||||
var iconLegendRui = Hud_GetRui( Hud_GetChild( file.menu, "PvEIconLegend" ) )
|
||||
RuiSetImage( iconLegendRui, "basicImage", $"rui/menu/gametype_select/playlist_fd_normal" )
|
||||
RuiSetFloat3( iconLegendRui, "basicImageColor", perfectColor )
|
||||
|
||||
var icon0Rui = Hud_GetRui( Hud_GetChild( file.menu, "PvEIcon0" ) )
|
||||
RuiSetImage( icon0Rui, "basicImage", $"rui/menu/gametype_select/playlist_fd_easy" )
|
||||
int easyWins = GetGameStatForMapAndModeInt( "games_completed_fd", mapName, "fd", "0" )
|
||||
SetStatsLabelValue( file.menu, "PvELabel0", "#FD_DIFFICULTY_EASY" )
|
||||
SetStatsLabelValue( file.menu, "PvEValueA0", easyWins )
|
||||
if ( GetGameStatForMapAndModeInt( "perfectMatches", mapName, "fd", "0" ) )
|
||||
RuiSetFloat3( icon0Rui, "basicImageColor", perfectColor )
|
||||
else
|
||||
RuiSetFloat3( icon0Rui, "basicImageColor", easyWins > 0 ? <1, 1, 1> : <0.15, 0.15, 0.15> )
|
||||
|
||||
var icon1Rui = Hud_GetRui( Hud_GetChild( file.menu, "PvEIcon1" ) )
|
||||
RuiSetImage( icon1Rui, "basicImage", $"rui/menu/gametype_select/playlist_fd_normal" )
|
||||
int normalWins = GetGameStatForMapAndModeInt( "games_completed_fd", mapName, "fd", "1" )
|
||||
SetStatsLabelValue( file.menu, "PvELabel1", "#FD_DIFFICULTY_NORMAL" )
|
||||
SetStatsLabelValue( file.menu, "PvEValueA1", normalWins )
|
||||
if ( GetGameStatForMapAndModeInt( "perfectMatches", mapName, "fd", "1" ) )
|
||||
RuiSetFloat3( icon1Rui, "basicImageColor", perfectColor )
|
||||
else
|
||||
RuiSetFloat3( icon1Rui, "basicImageColor", normalWins > 0 ? <1, 1, 1> : <0.15, 0.15, 0.15> )
|
||||
|
||||
var icon2Rui = Hud_GetRui( Hud_GetChild( file.menu, "PvEIcon2" ) )
|
||||
RuiSetImage( icon2Rui, "basicImage", $"rui/menu/gametype_select/playlist_fd_hard" )
|
||||
int hardWins = GetGameStatForMapAndModeInt( "games_completed_fd", mapName, "fd", "2" )
|
||||
SetStatsLabelValue( file.menu, "PvELabel2", "#FD_DIFFICULTY_HARD" )
|
||||
SetStatsLabelValue( file.menu, "PvEValueA2", hardWins )
|
||||
if ( GetGameStatForMapAndModeInt( "perfectMatches", mapName, "fd", "2" ) )
|
||||
RuiSetFloat3( icon2Rui, "basicImageColor", perfectColor )
|
||||
else
|
||||
RuiSetFloat3( icon2Rui, "basicImageColor", hardWins > 0 ? <1, 1, 1> : <0.15, 0.15, 0.15> )
|
||||
|
||||
var icon3Rui = Hud_GetRui( Hud_GetChild( file.menu, "PvEIcon3" ) )
|
||||
RuiSetImage( icon3Rui, "basicImage", $"rui/menu/gametype_select/playlist_fd_master" )
|
||||
int masterWins = GetGameStatForMapAndModeInt( "games_completed_fd", mapName, "fd", "3" )
|
||||
SetStatsLabelValue( file.menu, "PvELabel3", "#FD_DIFFICULTY_MASTER" )
|
||||
SetStatsLabelValue( file.menu, "PvEValueA3", masterWins )
|
||||
if ( GetGameStatForMapAndModeInt( "perfectMatches", mapName, "fd", "3" ) )
|
||||
RuiSetFloat3( icon3Rui, "basicImageColor", perfectColor )
|
||||
else
|
||||
RuiSetFloat3( icon3Rui, "basicImageColor", masterWins > 0 ? <1, 1, 1> : <0.15, 0.15, 0.15> )
|
||||
|
||||
var icon4Rui = Hud_GetRui( Hud_GetChild( file.menu, "PvEIcon4" ) )
|
||||
RuiSetImage( icon4Rui, "basicImage", $"rui/menu/gametype_select/playlist_fd_insane" )
|
||||
int insaneWins = GetGameStatForMapAndModeInt( "games_completed_fd", mapName, "fd", "4" )
|
||||
SetStatsLabelValue( file.menu, "PvELabel4", "#FD_DIFFICULTY_INSANE" )
|
||||
SetStatsLabelValue( file.menu, "PvEValueA4", insaneWins )
|
||||
if ( GetGameStatForMapAndModeInt( "perfectMatches", mapName, "fd", "4" ) )
|
||||
RuiSetFloat3( icon4Rui, "basicImageColor", perfectColor )
|
||||
else
|
||||
RuiSetFloat3( icon4Rui, "basicImageColor", insaneWins > 0 ? <1, 1, 1> : <0.15, 0.15, 0.15> )
|
||||
}
|
||||
else
|
||||
{
|
||||
array<var> pveElems = GetElementsByClassname( file.menu, "PvEGroup" )
|
||||
foreach ( elem in pveElems )
|
||||
{
|
||||
Hud_Hide( elem )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var function setit( vector color )
|
||||
{
|
||||
var iconLegendRui = Hud_GetRui( Hud_GetChild( file.menu, "PvEIconLegend" ) )
|
||||
RuiSetImage( iconLegendRui, "basicImage", $"rui/menu/gametype_select/playlist_fd_normal" )
|
||||
RuiSetFloat3( iconLegendRui, "basicImageColor", color )
|
||||
}
|
||||
@@ -0,0 +1,531 @@
|
||||
untyped
|
||||
|
||||
global function InitViewStatsOverviewMenu
|
||||
|
||||
struct
|
||||
{
|
||||
var menu
|
||||
array<ItemDisplayData> allTitans
|
||||
table<string, array<string> > titanStatLoadout
|
||||
} file
|
||||
|
||||
const MAX_DOTS_ON_GRAPH = 10
|
||||
table <string, int> titanKillData = {}
|
||||
|
||||
const IMAGE_TITAN_STRYDER = $"ui/menu/personal_stats/ps_titan_icon_stryder"
|
||||
const IMAGE_TITAN_ATLAS = $"ui/menu/personal_stats/ps_titan_icon_atlas"
|
||||
const IMAGE_TITAN_OGRE = $"ui/menu/personal_stats/ps_titan_icon_ogre"
|
||||
|
||||
void function InitViewStatsOverviewMenu()
|
||||
{
|
||||
PrecacheHUDMaterial( IMAGE_TITAN_STRYDER )
|
||||
PrecacheHUDMaterial( IMAGE_TITAN_ATLAS )
|
||||
PrecacheHUDMaterial( IMAGE_TITAN_OGRE )
|
||||
|
||||
var menu = GetMenu( "ViewStats_Overview_Menu" )
|
||||
file.menu = menu
|
||||
|
||||
AddMenuEventHandler( menu, eUIEvent.MENU_OPEN, OnStatsOverview_Open )
|
||||
|
||||
AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" )
|
||||
}
|
||||
|
||||
void function GetTitanKills( string titanName )
|
||||
{
|
||||
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" ) ) )
|
||||
}
|
||||
|
||||
foreach ( weaponRef in file.titanStatLoadout[ titanName ])
|
||||
{
|
||||
titanKillData[weaponRef] <- getWeaponKillsFromToneAPI(weaponRef)
|
||||
}
|
||||
}
|
||||
|
||||
void function OnStatsOverview_Open()
|
||||
{
|
||||
UI_SetPresentationType( ePresentationType.NO_MODELS )
|
||||
|
||||
GetTitanKills("ion")
|
||||
GetTitanKills("scorch")
|
||||
GetTitanKills("northstar")
|
||||
GetTitanKills("ronin")
|
||||
GetTitanKills("tone")
|
||||
GetTitanKills("legion")
|
||||
GetTitanKills("vanguard")
|
||||
|
||||
UpdateViewStatsOverviewMenu()
|
||||
}
|
||||
|
||||
function UpdateViewStatsOverviewMenu()
|
||||
{
|
||||
entity player = GetUIPlayer()
|
||||
if ( player == null )
|
||||
return
|
||||
|
||||
//#########################
|
||||
// Games
|
||||
//#########################
|
||||
|
||||
string timePlayed = StatToTimeString( "time_stats", "hours_total" )
|
||||
int gamesPlayed = GetPlayerStat_AllCompetitiveModesAndMapsInt( player, "game_stats", "game_completed" )
|
||||
int gamesWon = GetPlayerStat_AllCompetitiveModesAndMapsInt( player, "game_stats", "game_won" )
|
||||
string winPercent = GetPercent( float( gamesWon ), float( gamesPlayed ), 0 )
|
||||
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 ) )
|
||||
|
||||
//#########################
|
||||
// Modes
|
||||
//#########################
|
||||
|
||||
/*local gameModePlayedVar = GetStatVar( "game_stats", "mode_played" )
|
||||
local basicModes = [ "tdm", "cp", "at", "lts", "ctf" ]
|
||||
|
||||
local timesPlayedArray = []
|
||||
local gameModeNamesArray = []
|
||||
local otherGameModesPlayed = 0
|
||||
array<string> gameModesArray = GetPersistenceEnumAsArray( "gameModes" )
|
||||
|
||||
foreach ( modeName in gameModesArray )
|
||||
{
|
||||
local gameModePlaysVar = StringReplace( expect string( gameModePlayedVar ), "%gamemode%", modeName )
|
||||
local timesPlayed = player.GetPersistentVar( gameModePlaysVar )
|
||||
|
||||
if ( basicModes.contains( modeName ) ) //Don't really like doing ArrayContains, but Chad prefers not storing a separate enum in persistence that contains the "other" gamemodes
|
||||
{
|
||||
timesPlayedArray.append( timesPlayed )
|
||||
gameModeNamesArray.append( GAMETYPE_TEXT[ modeName] )
|
||||
}
|
||||
else
|
||||
{
|
||||
otherGameModesPlayed += timesPlayed
|
||||
}
|
||||
}
|
||||
|
||||
//Add Other game modes' data to the end of the arrays
|
||||
gameModeNamesArray.append( "#GAMEMODE_OTHER" )
|
||||
timesPlayedArray.append( otherGameModesPlayed )
|
||||
|
||||
local data = {}
|
||||
data.names <- gameModeNamesArray
|
||||
data.values <- timesPlayedArray
|
||||
|
||||
SetPieChartData( menu, "ModesPieChart", "#GAME_MODES_PLAYED", data )*/
|
||||
|
||||
//#########################
|
||||
// Completion
|
||||
//#########################
|
||||
|
||||
// Challenges complete
|
||||
//local challengeData = GetChallengeCompleteData()
|
||||
//SetStatsBarValues( menu, "CompletionBar0", "#STATS_COMPLETION_CHALLENGES", 0, challengeData.total, challengeData.complete )
|
||||
|
||||
// Item unlocks
|
||||
//local itemUnlockData = GetItemUnlockCountData()
|
||||
//SetStatsBarValues( menu, "CompletionBar1", "#STATS_COMPLETION_WEAPONS", 0, itemUnlockData["weapons"].total, itemUnlockData["weapons"].unlocked )
|
||||
//SetStatsBarValues( menu, "CompletionBar2", "#STATS_COMPLETION_ATTACHMENTS", 0, itemUnlockData["attachments"].total, itemUnlockData["attachments"].unlocked )
|
||||
//SetStatsBarValues( menu, "CompletionBar3", "#STATS_COMPLETION_MODS", 0, itemUnlockData["mods"].total, itemUnlockData["mods"].unlocked )
|
||||
//SetStatsBarValues( menu, "CompletionBar4", "#STATS_COMPLETION_ABILITIES", 0, itemUnlockData["abilities"].total, itemUnlockData["abilities"].unlocked )
|
||||
//SetStatsBarValues( menu, "CompletionBar5", "#STATS_COMPLETION_GEAR", 0, itemUnlockData["gear"].total, itemUnlockData["gear"].unlocked )
|
||||
|
||||
//#########################
|
||||
// Weapons
|
||||
//#########################
|
||||
|
||||
table<string, table> weaponData = GetOverviewWeaponData()
|
||||
table mostKillsData = weaponData[ "most_kills" ]
|
||||
table nemesisWeapon = weaponData[ "nemesis_weapon" ]
|
||||
table highestKPMData = weaponData[ "highest_kpm" ]
|
||||
|
||||
var weaponImageElem
|
||||
var weaponRui
|
||||
var weaponNameElem
|
||||
var weaponDescElem
|
||||
var noDataElem
|
||||
|
||||
// Weapon with most kills
|
||||
weaponImageElem = Hud_GetChild( file.menu, "WeaponImage0" )
|
||||
weaponRui = Hud_GetRui( weaponImageElem )
|
||||
weaponNameElem = Hud_GetChild( file.menu, "WeaponName0" )
|
||||
weaponDescElem = Hud_GetChild( file.menu, "WeaponDesc0" )
|
||||
noDataElem = Hud_GetChild( file.menu, "WeaponImageTextOverlay0" )
|
||||
if ( mostKillsData.ref != "" )
|
||||
{
|
||||
SetItemImageWidth( weaponImageElem, expect string( mostKillsData.ref ) )
|
||||
RuiSetImage( weaponRui, "buttonImage", GetItemImage( expect string( mostKillsData.ref ) ) )
|
||||
Hud_Show( weaponImageElem )
|
||||
Hud_SetText( weaponNameElem, mostKillsData.printName )
|
||||
Hud_Show( weaponNameElem )
|
||||
Hud_SetText( weaponDescElem, "#STATS_MOST_KILLS_VALUE", mostKillsData.val )
|
||||
Hud_Show( weaponDescElem )
|
||||
Hud_Hide( noDataElem )
|
||||
}
|
||||
else
|
||||
{
|
||||
Hud_Hide( weaponImageElem )
|
||||
Hud_Hide( weaponNameElem )
|
||||
Hud_Hide( weaponDescElem )
|
||||
Hud_Show( noDataElem )
|
||||
}
|
||||
|
||||
// Most Used Weapon
|
||||
weaponImageElem = Hud_GetChild( file.menu, "WeaponImage1" )
|
||||
weaponRui = Hud_GetRui( weaponImageElem )
|
||||
weaponNameElem = Hud_GetChild( file.menu, "WeaponName1" )
|
||||
weaponDescElem = Hud_GetChild( file.menu, "WeaponDesc1" )
|
||||
noDataElem = Hud_GetChild( file.menu, "WeaponImageTextOverlay1" )
|
||||
if ( nemesisWeapon.ref != "" )
|
||||
{
|
||||
SetItemImageWidth( weaponImageElem, expect string( nemesisWeapon.ref ) )
|
||||
RuiSetImage( weaponRui, "buttonImage", GetItemImage( expect string( nemesisWeapon.ref ) ) )
|
||||
Hud_Show( weaponImageElem )
|
||||
Hud_SetText( weaponNameElem, nemesisWeapon.printName )
|
||||
Hud_Show( weaponNameElem )
|
||||
Hud_SetText( weaponDescElem, nemesisWeapon.val + " DEATHS BY WEAPON" )
|
||||
Hud_Show( weaponDescElem )
|
||||
Hud_Hide( noDataElem )
|
||||
}
|
||||
else
|
||||
{
|
||||
Hud_Hide( weaponImageElem )
|
||||
Hud_Hide( weaponNameElem )
|
||||
Hud_Hide( weaponDescElem )
|
||||
Hud_Show( noDataElem )
|
||||
}
|
||||
|
||||
// Weapon with highest KPM
|
||||
weaponImageElem = Hud_GetChild( file.menu, "WeaponImage2" )
|
||||
weaponRui = Hud_GetRui( weaponImageElem )
|
||||
weaponNameElem = Hud_GetChild( file.menu, "WeaponName2" )
|
||||
weaponDescElem = Hud_GetChild( file.menu, "WeaponDesc2" )
|
||||
noDataElem = Hud_GetChild( file.menu, "WeaponImageTextOverlay2" )
|
||||
if ( highestKPMData.ref != "" )
|
||||
{
|
||||
SetItemImageWidth( weaponImageElem, expect string( highestKPMData.ref ) )
|
||||
RuiSetImage( weaponRui, "buttonImage", GetItemImage( expect string( highestKPMData.ref ) ) )
|
||||
Hud_Show( weaponImageElem )
|
||||
Hud_SetText( weaponNameElem, highestKPMData.printName )
|
||||
Hud_Show( weaponNameElem )
|
||||
Hud_SetText( weaponDescElem, highestKPMData.val + " K/D")
|
||||
Hud_Show( weaponDescElem )
|
||||
Hud_Hide( noDataElem )
|
||||
}
|
||||
else
|
||||
{
|
||||
Hud_Hide( weaponImageElem )
|
||||
Hud_Hide( weaponNameElem )
|
||||
Hud_Hide( weaponDescElem )
|
||||
Hud_Show( noDataElem )
|
||||
}
|
||||
|
||||
//#########################
|
||||
// Titan Unlocks
|
||||
//#########################
|
||||
|
||||
Assert( player == GetUIPlayer() )
|
||||
Assert( player != null )
|
||||
|
||||
int unlockedCount = 0
|
||||
|
||||
//var imageLabel = GetElem( menu, "TitanUnlockImage0" )
|
||||
//if ( !IsItemLocked( player, "titan_stryder" ) )
|
||||
//{
|
||||
// imageLabel.SetImage( IMAGE_TITAN_STRYDER )
|
||||
// unlockedCount++
|
||||
//}
|
||||
//else
|
||||
// imageLabel.SetImage( $"ui/menu/personal_stats/ps_titan_icon_locked" )
|
||||
//
|
||||
//imageLabel = GetElem( menu, "TitanUnlockImage1" )
|
||||
//if ( !IsItemLocked( player, "titan_atlas" ) )
|
||||
//{
|
||||
// imageLabel.SetImage( IMAGE_TITAN_ATLAS )
|
||||
// unlockedCount++
|
||||
//}
|
||||
//else
|
||||
// imageLabel.SetImage( $"ui/menu/personal_stats/ps_titan_icon_locked" )
|
||||
//
|
||||
//imageLabel = GetElem( menu, "TitanUnlockImage2" )
|
||||
//if ( !IsItemLocked( player, "titan_ogre" ) )
|
||||
//{
|
||||
// imageLabel.SetImage( IMAGE_TITAN_OGRE )
|
||||
// unlockedCount++
|
||||
//}
|
||||
//else
|
||||
// imageLabel.SetImage( $"ui/menu/personal_stats/ps_titan_icon_locked" )
|
||||
//
|
||||
//var unlockCountLabel = GetElem( menu, "TitanUnlocksCount" )
|
||||
//Hud_SetText( unlockCountLabel, "#STATS_CHASSIS_UNLOCK_COUNT", string( unlockedCount ) )
|
||||
|
||||
//#########################
|
||||
// K/D Ratios
|
||||
//#########################
|
||||
|
||||
// Lifetime
|
||||
|
||||
var totalPilotKills = 0
|
||||
|
||||
foreach (var key, var value in globalToneAPIKillData) {
|
||||
totalPilotKills += value
|
||||
}
|
||||
|
||||
var totalGlobalKills = 0
|
||||
foreach (var key, var value in globalToneAPIAllPlayerKillData) {
|
||||
totalGlobalKills += value
|
||||
}
|
||||
|
||||
var totalGlobalDeaths = 0
|
||||
foreach (var key, var value in globalToneAPIAllPlayerDeathData) {
|
||||
totalGlobalDeaths += value
|
||||
}
|
||||
|
||||
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) {
|
||||
if (key in titanKillData) {
|
||||
killsAsTitan += titanKillData[string(key)]
|
||||
}
|
||||
}
|
||||
|
||||
float kval = float(totalPilotKills)
|
||||
float dval = float(totalPilotDeaths)
|
||||
float kdval = float(int((kval / dval)*100))/100
|
||||
|
||||
float gkval = float(totalGlobalKills)
|
||||
float gdval = float(totalGlobalDeaths)
|
||||
float gkdval = float(int((gkval / gdval)*100))/100
|
||||
|
||||
SetStatsLabelValue( file.menu, "LifetimeAverageValue", [ "#STATS_KD_VALUE", kdval ] )
|
||||
|
||||
SetStatsLabelValue( file.menu, "LifetimePVPAverageValue", [ "#STATS_KD_VALUE", gkdval ] )
|
||||
|
||||
bool last10GamesStatsVisible = gamesPlayed >= NUM_GAMES_TRACK_KDRATIO ? true : false
|
||||
SetLast10GamesStatVisibility( file.menu, last10GamesStatsVisible )
|
||||
|
||||
// Last 10 Matches
|
||||
local kdratio_match = []
|
||||
local kdratiopvp_match = []
|
||||
for ( int i = NUM_GAMES_TRACK_KDRATIO - 1 ; i >= 0 ; i-- )
|
||||
{
|
||||
kdratio_match.append( player.GetPersistentVar( "kdratio_match[" + i + "]" ) )
|
||||
kdratiopvp_match.append( player.GetPersistentVar( "kdratiopvp_match[" + i + "]" ) )
|
||||
}
|
||||
|
||||
// Last 10
|
||||
local kdratio_match_sum = 0
|
||||
local count = 0
|
||||
foreach( value in kdratio_match )
|
||||
{
|
||||
if ( value == 0 )
|
||||
continue
|
||||
kdratio_match_sum += value
|
||||
count++
|
||||
}
|
||||
local kdratio_match_average = count > 0 ? kdratio_match_sum / count : kdratio_match_sum
|
||||
if ( kdratio_match_average % 1 == 0 )
|
||||
kdratio_match_average = format( "%.0f", kdratio_match_average )
|
||||
else
|
||||
kdratio_match_average = format( "%.1f", kdratio_match_average )
|
||||
SetStatsLabelValue( file.menu, "Last10GamesValue", [ "#STATS_KD_VALUE", kdratio_match_average ] )
|
||||
PlotKDPointsOnGraph( file.menu, 0, kdratio_match, kdval )
|
||||
|
||||
// Last 10 (PVP)
|
||||
local kdratiopvp_match_sum = 0
|
||||
count = 0
|
||||
foreach( value in kdratiopvp_match )
|
||||
{
|
||||
if ( value == 0 )
|
||||
continue
|
||||
kdratiopvp_match_sum += value
|
||||
count++
|
||||
}
|
||||
local kdratiopvp_match_average = count > 0 ? kdratiopvp_match_sum / count : kdratiopvp_match_sum
|
||||
if ( kdratiopvp_match_average % 1 == 0 )
|
||||
kdratiopvp_match_average = format( "%.0f", kdratiopvp_match_average )
|
||||
else
|
||||
kdratiopvp_match_average = format( "%.1f", kdratiopvp_match_average )
|
||||
SetStatsLabelValue( file.menu, "Last10GamesPVPValue", [ "#STATS_KD_VALUE", kdratiopvp_match_average ] )
|
||||
PlotKDPointsOnGraph( file.menu, 1, kdratiopvp_match, gkdval )
|
||||
|
||||
/////////////////////////
|
||||
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, "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")
|
||||
|
||||
var titanExecutions = getWeaponKillsFromToneAPI("titan_execution")
|
||||
|
||||
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") ) )
|
||||
}
|
||||
|
||||
function PlotKDPointsOnGraph( menu, graphIndex, values, dottedAverage )
|
||||
{
|
||||
//printt( "values:" )
|
||||
//PrintTable( values )
|
||||
|
||||
var background = GetElem( menu, "KDRatioLast10Graph" + graphIndex )
|
||||
local graphHeight = Hud_GetBaseHeight( background )
|
||||
local graphOrigin = Hud_GetAbsPos( background )
|
||||
graphOrigin[1] += graphHeight
|
||||
local dotSpacing = Hud_GetBaseWidth( background ) / 9.0
|
||||
local dotPositions = []
|
||||
|
||||
// Calculate min/max for the graph
|
||||
local graphMin = 0.0
|
||||
local graphMax = max( dottedAverage, 1.0 )
|
||||
foreach( value in values )
|
||||
{
|
||||
if ( value > graphMax )
|
||||
graphMax = value
|
||||
}
|
||||
graphMax += graphMax * 0.1
|
||||
|
||||
var maxLabel = GetElem( menu, "Graph" + graphIndex + "ValueMax" )
|
||||
local maxValueString = format( "%.1f", graphMax )
|
||||
Hud_SetText( maxLabel, maxValueString )
|
||||
|
||||
// Plot the dots
|
||||
for ( int i = 0; i < MAX_DOTS_ON_GRAPH; i++ )
|
||||
{
|
||||
var dot = GetElem( menu, "Graph" + graphIndex + "Dot" + i )
|
||||
|
||||
if ( i >= values.len() )
|
||||
{
|
||||
Hud_Hide( dot )
|
||||
continue
|
||||
}
|
||||
|
||||
float dotOffset = GraphCapped( values[i], graphMin, graphMax, 0, graphHeight )
|
||||
|
||||
local posX = graphOrigin[0] - ( Hud_GetBaseWidth( dot ) * 0.5 ) + ( dotSpacing * i )
|
||||
local posY = graphOrigin[1] - ( Hud_GetBaseHeight( dot ) * 0.5 ) - dotOffset
|
||||
Hud_SetPos( dot, posX, posY )
|
||||
Hud_Show( dot )
|
||||
|
||||
dotPositions.append( [ posX + ( Hud_GetBaseWidth( dot ) * 0.5 ), posY + ( Hud_GetBaseHeight( dot ) * 0.5 ) ] )
|
||||
}
|
||||
|
||||
{
|
||||
// Place the dotted lifetime average line
|
||||
var dottedLine = GetElem( menu, "KDRatioLast10Graph" + graphIndex + "DottedLine0" )
|
||||
float dottedLineOffset = GraphCapped( dottedAverage, graphMin, graphMax, 0, graphHeight )
|
||||
local posX = graphOrigin[0]
|
||||
local posY = graphOrigin[1] - ( Hud_GetBaseHeight( dottedLine ) * 0.5 ) - dottedLineOffset
|
||||
Hud_SetPos( dottedLine, posX, posY )
|
||||
Hud_Show( dottedLine )
|
||||
}
|
||||
|
||||
{
|
||||
// Place the dotted zero line
|
||||
var dottedLine = GetElem( menu, "KDRatioLast10Graph" + graphIndex + "DottedLine1" )
|
||||
float dottedLineOffset = GraphCapped( 0.0, graphMin, graphMax, 0, graphHeight )
|
||||
local posX = graphOrigin[0]
|
||||
local posY = graphOrigin[1] - ( Hud_GetBaseHeight( dottedLine ) * 0.5 ) - dottedLineOffset
|
||||
Hud_SetPos( dottedLine, posX, posY )
|
||||
Hud_Show( dottedLine )
|
||||
}
|
||||
|
||||
// Connect the dots with lines
|
||||
for ( int i = 1; i < MAX_DOTS_ON_GRAPH; i++ )
|
||||
{
|
||||
var line = GetElem( menu, "Graph" + graphIndex + "Line" + i )
|
||||
|
||||
if ( i >= values.len() )
|
||||
{
|
||||
Hud_Hide( line )
|
||||
continue
|
||||
}
|
||||
|
||||
// Get angle from previous dot to this dot
|
||||
local startPos = dotPositions[i-1]
|
||||
local endPos = dotPositions[i]
|
||||
local offsetX = endPos[0] - startPos[0]
|
||||
local offsetY = endPos[1] - startPos[1]
|
||||
local angle = ( atan( offsetX / offsetY ) * ( 180 / PI ) )
|
||||
|
||||
// Get line length
|
||||
local length = sqrt( offsetX * offsetX + offsetY * offsetY )
|
||||
|
||||
// Calculate where the line should be positioned
|
||||
local posX = endPos[0] - ( offsetX / 2.0 ) - ( length / 2.0 )
|
||||
local posY = endPos[1] - ( offsetY / 2.0 ) - ( Hud_GetBaseHeight( line ) / 2.0 )
|
||||
|
||||
//line.SetHeight( 2.0 )
|
||||
Hud_SetWidth( line, length )
|
||||
Hud_SetRotation( line, angle + 90.0 )
|
||||
Hud_SetPos( line, posX, posY )
|
||||
Hud_Show( line )
|
||||
}
|
||||
}
|
||||
|
||||
void function SetLast10GamesStatVisibility( var menu, bool visible )
|
||||
{
|
||||
Hud_SetVisible( Hud_GetChild( menu, "Last10GamesLabel" ), visible )
|
||||
Hud_SetVisible( Hud_GetChild( menu, "Last10GamesValue" ), visible )
|
||||
Hud_SetVisible( Hud_GetChild( menu, "Last10GamesPVPLabel" ), visible )
|
||||
Hud_SetVisible( Hud_GetChild( menu, "Last10GamesPVPValue" ), visible )
|
||||
}
|
||||
|
||||
void function SetItemImageWidth( var imageElem, string ref )
|
||||
{
|
||||
vector vec = GetItemImageAspect( ref )
|
||||
float aspectRatio = vec.x / vec.y
|
||||
int imageWidth = int( Hud_GetHeight( imageElem ) * aspectRatio )
|
||||
Hud_SetWidth( imageElem, imageWidth )
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
|
||||
global function InitViewStatsTimeMenu
|
||||
global function AddPieChartEntry
|
||||
|
||||
const MAX_MODE_ROWS = 8
|
||||
|
||||
struct
|
||||
{
|
||||
var menu
|
||||
array<ItemDisplayData> allTitans
|
||||
table<string, array<string> > titanStatLoadout
|
||||
} file
|
||||
|
||||
void function InitViewStatsTimeMenu()
|
||||
{
|
||||
var menu = GetMenu( "ViewStats_Time_Menu" )
|
||||
file.menu = menu
|
||||
|
||||
AddMenuEventHandler( menu, eUIEvent.MENU_OPEN, OnStatsTime_Open )
|
||||
|
||||
AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" )
|
||||
}
|
||||
|
||||
void function OnStatsTime_Open()
|
||||
{
|
||||
UI_SetPresentationType( ePresentationType.NO_MODELS )
|
||||
|
||||
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" ) ) )
|
||||
}
|
||||
|
||||
UpdateViewStatsTimeMenu()
|
||||
}
|
||||
|
||||
float function GetTitanKills( string titanName)
|
||||
{
|
||||
float weaponKills = 0
|
||||
foreach ( weaponRef in file.titanStatLoadout[ titanName ])
|
||||
{
|
||||
weaponKills += float(getWeaponKillsFromToneAPI(weaponRef))
|
||||
}
|
||||
return weaponKills
|
||||
}
|
||||
|
||||
void function UpdateViewStatsTimeMenu()
|
||||
{
|
||||
entity player = GetUIPlayer()
|
||||
if ( player == null )
|
||||
return
|
||||
|
||||
//#########################################
|
||||
float killsAsTitan = 0
|
||||
float killsAsIon = GetTitanKills( "ion" )
|
||||
killsAsTitan += killsAsIon
|
||||
float killsAsScorch = GetTitanKills( "scorch" )
|
||||
killsAsTitan += killsAsScorch
|
||||
float killsAsNorthstar = GetTitanKills( "northstar" )
|
||||
killsAsTitan += killsAsNorthstar
|
||||
float killsAsRonin = GetTitanKills( "ronin" )
|
||||
killsAsTitan += killsAsRonin
|
||||
float killsAsTone = GetTitanKills( "tone" )
|
||||
killsAsTitan += killsAsTone
|
||||
float killsAsLegion = GetTitanKills( "legion" )
|
||||
killsAsTitan += killsAsLegion
|
||||
float killsAsMonarch = GetTitanKills( "vanguard" )
|
||||
killsAsTitan += killsAsMonarch
|
||||
//#########################################
|
||||
// Time By Class Pie Chart
|
||||
//#########################################
|
||||
|
||||
var totalPilotKills = 0
|
||||
|
||||
foreach (var key, var value in globalToneAPIKillData) {
|
||||
totalPilotKills += value
|
||||
}
|
||||
float hoursAsPilot = float(totalPilotKills)
|
||||
float hoursAsTitan = killsAsTitan
|
||||
|
||||
array<PieChartEntry> classes
|
||||
|
||||
if ( hoursAsPilot > 0 )
|
||||
AddPieChartEntry( classes, "#STATS_HEADER_PILOT", hoursAsPilot, [61, 117, 193, 255] )
|
||||
|
||||
if ( hoursAsTitan > 0 )
|
||||
AddPieChartEntry( classes, "#STATS_HEADER_TITAN", hoursAsTitan, [223, 94, 0, 255] )
|
||||
|
||||
classes.sort( ComparePieChartEntryValues )
|
||||
|
||||
PieChartData classTimeData
|
||||
classTimeData.entries = classes
|
||||
classTimeData.labelColor = [ 255, 255, 255, 255 ]
|
||||
SetPieChartData( file.menu, "ClassPieChart", "KILLS BY CLASS", classTimeData )
|
||||
|
||||
//#########################################
|
||||
// Time By Chassis Pie Chart
|
||||
//#########################################
|
||||
|
||||
array<PieChartEntry> titans
|
||||
|
||||
if ( killsAsIon > 0 )
|
||||
AddPieChartEntry( titans, "#TITAN_ION", killsAsIon, [200, 40, 40, 255] )
|
||||
|
||||
if ( killsAsScorch > 0 )
|
||||
AddPieChartEntry( titans, "#TITAN_SCORCH", killsAsScorch, [223, 94, 0, 255] )
|
||||
|
||||
if ( killsAsNorthstar > 0 )
|
||||
AddPieChartEntry( titans, "#TITAN_NORTHSTAR", killsAsNorthstar, [61, 117, 193, 255] )
|
||||
|
||||
if ( killsAsRonin > 0 )
|
||||
AddPieChartEntry( titans, "#TITAN_RONIN", killsAsRonin, [207, 191, 59, 255] )
|
||||
|
||||
if ( killsAsTone > 0 )
|
||||
AddPieChartEntry( titans, "#TITAN_TONE", killsAsTone, [88, 172, 67, 255] )
|
||||
|
||||
if ( killsAsLegion > 0 )
|
||||
AddPieChartEntry( titans, "#TITAN_LEGION", killsAsLegion, [46, 188, 180, 255] )
|
||||
|
||||
if ( killsAsMonarch > 0 )
|
||||
AddPieChartEntry( titans, "#TITAN_VANGUARD", killsAsMonarch, [151, 71, 175, 255] )
|
||||
|
||||
titans.sort( ComparePieChartEntryValues )
|
||||
|
||||
PieChartData chassisTimeData
|
||||
chassisTimeData.entries = titans
|
||||
chassisTimeData.labelColor = [ 255, 255, 255, 255 ]
|
||||
SetPieChartData( file.menu, "ChassisPieChart", "KILLS BY TITAN", chassisTimeData )
|
||||
|
||||
//#########################################
|
||||
// Time By Mode Pie Chart
|
||||
//#########################################
|
||||
|
||||
array<string> gameModesArray = GetPersistenceEnumAsArray( "gameModes" )
|
||||
|
||||
array<PieChartEntry> modes
|
||||
int enumCount = PersistenceGetEnumCount( "gameModes" )
|
||||
table< string, array<int> > customGamemodeList = {
|
||||
sns = [255, 178, 102, 255],
|
||||
fw = [147, 204, 57, 255],
|
||||
gg = [14, 87, 132, 255]
|
||||
}
|
||||
for ( int modeId = 0; modeId < enumCount; modeId++ )
|
||||
{
|
||||
string modeName = PersistenceGetEnumItemNameForIndex( "gameModes", modeId )
|
||||
if ( modeName in globalToneAPIGamemodeData )
|
||||
{
|
||||
float modePlayedTime = 0
|
||||
modePlayedTime = float(globalToneAPIGamemodeData[modeName])
|
||||
if ( modePlayedTime > 0 ) {
|
||||
AddPieChartEntry( modes, GameMode_GetName( modeName ), modePlayedTime, GetGameModeDisplayColor( modeName ) )
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (string key, array<int> value in customGamemodeList)
|
||||
{
|
||||
if ( key in globalToneAPIGamemodeData)
|
||||
{
|
||||
float modePlayedTime = 0
|
||||
modePlayedTime = float(globalToneAPIGamemodeData[key])
|
||||
if ( modePlayedTime > 0 ) {
|
||||
AddPieChartEntry( modes, key, modePlayedTime, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PieChartData modesPlayedData
|
||||
modesPlayedData.entries = modes
|
||||
modesPlayedData.labelColor = [ 255, 255, 255, 255 ]
|
||||
SetPieChartData( file.menu, "ModesPieChart", "KILLS BY GAMEMODE", modesPlayedData )
|
||||
|
||||
//#########################################
|
||||
// Time Stats
|
||||
//#########################################
|
||||
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat0" ), Localize( "#STATS_HEADER_TIME_PLAYED" ), StatToTimeString( "time_stats", "hours_total" ) )
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat1" ), Localize( "#STATS_HEADER_TIME_IN_AIR" ), StatToTimeString( "time_stats", "hours_inAir" ) )
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat2" ), Localize( "#STATS_HEADER_TIME_WALLRUNNING" ), StatToTimeString( "time_stats", "hours_wallrunning" ) )
|
||||
}
|
||||
|
||||
void function AddPieChartEntry( array<PieChartEntry> entries, string displayName, float numValue, array<int> color )
|
||||
{
|
||||
PieChartEntry newEntry
|
||||
newEntry.displayName = displayName
|
||||
newEntry.numValue = numValue
|
||||
newEntry.color = color
|
||||
|
||||
entries.append( newEntry )
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
//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
|
||||
}
|
||||
@@ -0,0 +1,558 @@
|
||||
untyped
|
||||
|
||||
|
||||
global function SetPieChartData
|
||||
global function SetStatsBarValues
|
||||
global function SetStatsValueInfo
|
||||
global function SetStatsLabelValue
|
||||
global function GetPercent
|
||||
//global function GetChallengeCompleteData
|
||||
global function GetItemUnlockCountData
|
||||
global function GetOverviewWeaponData
|
||||
global function StatToTimeString
|
||||
global function HoursToTimeString
|
||||
global function StatToDistanceString
|
||||
global function ComparePieChartEntryValues
|
||||
global function SetStatBoxDisplay
|
||||
global function SetMedalStatBoxDisplay
|
||||
|
||||
void function SetPieChartData( var menu, string panelName, string titleString, PieChartData data )
|
||||
{
|
||||
Assert( data.entries.len() <= 8 )
|
||||
|
||||
// Get nested panel
|
||||
var piePanel = GetElem( menu, panelName )
|
||||
|
||||
// Create background
|
||||
var background = Hud_GetChild( piePanel, "BarBG" )
|
||||
Hud_SetBarProgress( background, 1.0 )
|
||||
Hud_SetColor( background, [190, 190, 190, 255] )
|
||||
|
||||
// Calculate total of all values combined
|
||||
foreach ( entry in data.entries )
|
||||
data.sum += entry.numValue
|
||||
|
||||
// Calculate bar fraction for each value
|
||||
foreach ( entry in data.entries )
|
||||
{
|
||||
if ( data.sum > 0 )
|
||||
entry.fracValue = entry.numValue / data.sum
|
||||
else
|
||||
entry.fracValue = 0.0
|
||||
}
|
||||
|
||||
// Set slice sizes and text data
|
||||
var titleLabel = Hud_GetChild( piePanel, "Title" )
|
||||
Hud_SetText( titleLabel, titleString )
|
||||
Hud_SetColor( titleLabel, data.labelColor )
|
||||
|
||||
var noDataLabel = Hud_GetChild( piePanel, "NoData" )
|
||||
|
||||
for ( int index = 0; index < 8; index++ )
|
||||
{
|
||||
var barColorGuide = Hud_GetChild( piePanel, "BarColorGuide" + index )
|
||||
// Hud_SetColor( barColorGuide, entry.color )
|
||||
Hud_Hide( barColorGuide )
|
||||
|
||||
var barColorGuideFrame = Hud_GetChild( piePanel, "BarColorGuideFrame" + index )
|
||||
Hud_Hide( barColorGuideFrame )
|
||||
|
||||
var barName = Hud_GetChild( piePanel, "BarName" + index )
|
||||
Hud_SetColor( barName, data.labelColor )
|
||||
Hud_SetText( barName, "" )
|
||||
|
||||
var bar = Hud_GetChild( piePanel, "Bar" + index )
|
||||
//Hud_SetBarProgress( bar, combinedFrac )
|
||||
//Hud_SetColor( bar, entry.color )
|
||||
Hud_Hide( bar )
|
||||
}
|
||||
|
||||
if ( data.entries.len() > 0 )
|
||||
{
|
||||
Hud_Hide( noDataLabel )
|
||||
|
||||
float combinedFrac = 0.0
|
||||
int largestTextWidth = 0
|
||||
|
||||
foreach ( index, entry in data.entries )
|
||||
{
|
||||
var barColorGuide = Hud_GetChild( piePanel, "BarColorGuide" + index )
|
||||
Hud_SetColor( barColorGuide, entry.color )
|
||||
Hud_Show( barColorGuide )
|
||||
|
||||
var barColorGuideFrame = Hud_GetChild( piePanel, "BarColorGuideFrame" + index )
|
||||
Hud_Show( barColorGuideFrame )
|
||||
|
||||
string percent = GetPercent( entry.fracValue, 1.0, 0, true )
|
||||
var barName = Hud_GetChild( piePanel, "BarName" + index )
|
||||
Hud_SetColor( barName, data.labelColor )
|
||||
|
||||
if ( data.timeBased )
|
||||
Hud_SetText( barName, PieChartHoursToTimeString( entry.numValue, entry.displayName, percent ) )
|
||||
else
|
||||
Hud_SetText( barName, "#STATS_TEXT_AND_PERCENTAGE", entry.displayName, percent )
|
||||
|
||||
int currentTextWidth = Hud_GetTextWidth( barName )
|
||||
if ( currentTextWidth > largestTextWidth )
|
||||
largestTextWidth = currentTextWidth
|
||||
|
||||
Hud_Show( barName )
|
||||
|
||||
combinedFrac += entry.fracValue
|
||||
var bar = Hud_GetChild( piePanel, "Bar" + index )
|
||||
Hud_SetBarProgress( bar, combinedFrac )
|
||||
Hud_SetColor( bar, entry.color )
|
||||
Hud_Show( bar )
|
||||
}
|
||||
|
||||
// Position the list
|
||||
int xOffset = int( ( largestTextWidth / -2 ) + ContentScaledX( 18 ) )
|
||||
Hud_SetX( Hud_GetChild( piePanel, "BarName0" ), xOffset )
|
||||
}
|
||||
else
|
||||
{
|
||||
Hud_Show( noDataLabel )
|
||||
for ( int index = 0; index < 8; index++ )
|
||||
{
|
||||
var barColorGuide = Hud_GetChild( piePanel, "BarColorGuide" + index )
|
||||
// Hud_SetColor( barColorGuide, entry.color )
|
||||
Hud_Hide( barColorGuide )
|
||||
|
||||
var barColorGuideFrame = Hud_GetChild( piePanel, "BarColorGuideFrame" + index )
|
||||
Hud_Hide( barColorGuideFrame )
|
||||
|
||||
var barName = Hud_GetChild( piePanel, "BarName" + index )
|
||||
Hud_SetColor( barName, data.labelColor )
|
||||
Hud_SetText( barName, "" )
|
||||
|
||||
var bar = Hud_GetChild( piePanel, "Bar" + index )
|
||||
//Hud_SetBarProgress( bar, combinedFrac )
|
||||
//Hud_SetColor( bar, entry.color )
|
||||
Hud_Hide( bar )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function SetStatsBarValues( menu, panelName, titleString, startValue, endValue, currentValue )
|
||||
{
|
||||
Assert( endValue > startValue )
|
||||
Assert( currentValue >= startValue && currentValue <= endValue )
|
||||
|
||||
// Get nested panel
|
||||
var panel = GetElem( menu, panelName )
|
||||
|
||||
// Update titel
|
||||
var title = Hud_GetChild( panel, "Title" )
|
||||
Hud_SetText( title, titleString )
|
||||
|
||||
// Update progress text
|
||||
var progressText = Hud_GetChild( panel, "ProgressText" )
|
||||
Hud_SetText( progressText, "#STATS_PROGRESS_BAR_VALUE", currentValue, endValue )
|
||||
|
||||
// Update bar progress
|
||||
float frac = GraphCapped( currentValue, startValue, endValue, 0.0, 1.0 )
|
||||
|
||||
var barFill = Hud_GetChild( panel, "BarFill" )
|
||||
Hud_SetScaleX( barFill, frac )
|
||||
|
||||
var barFillShadow = Hud_GetChild( panel, "BarFillShadow" )
|
||||
Hud_SetScaleX( barFillShadow, frac )
|
||||
}
|
||||
|
||||
void function SetStatsValueInfo( var menu, valueID, labelText, textString )
|
||||
{
|
||||
var elem = GetElem( menu, "Column0Label" + valueID )
|
||||
Assert( elem != null )
|
||||
Hud_SetText( elem, labelText )
|
||||
|
||||
elem = GetElem( menu, "Column0Value" + valueID )
|
||||
Assert( elem != null )
|
||||
SetStatsLabelValueOnLabel( elem, textString )
|
||||
}
|
||||
|
||||
void function SetStatsLabelValue( var menu, labelName, textString )
|
||||
{
|
||||
var elem = GetElem( menu, labelName )
|
||||
Assert( elem != null)
|
||||
SetStatsLabelValueOnLabel( elem, textString )
|
||||
}
|
||||
|
||||
void function SetStatsLabelValueOnLabel( elem, textString )
|
||||
{
|
||||
if ( type( textString ) == "array" )
|
||||
{
|
||||
if ( textString.len() == 6 )
|
||||
Hud_SetText( elem, string( textString[0] ), textString[1], textString[2], textString[3], textString[4], textString[5] )
|
||||
if ( textString.len() == 5 )
|
||||
Hud_SetText( elem, string( textString[0] ), textString[1], textString[2], textString[3], textString[4] )
|
||||
if ( textString.len() == 4 )
|
||||
Hud_SetText( elem, string( textString[0] ), textString[1], textString[2], textString[3] )
|
||||
if ( textString.len() == 3 )
|
||||
Hud_SetText( elem, string( textString[0] ), textString[1], textString[2] )
|
||||
if ( textString.len() == 2 )
|
||||
Hud_SetText( elem, string( textString[0] ), textString[1] )
|
||||
if ( textString.len() == 1 )
|
||||
Hud_SetText( elem, string( textString[0] ) )
|
||||
}
|
||||
else
|
||||
{
|
||||
Hud_SetText( elem, string( textString ) )
|
||||
}
|
||||
}
|
||||
|
||||
string function GetPercent( float val, float total, float defaultPercent, bool doClamp = true )
|
||||
{
|
||||
float percent = defaultPercent
|
||||
if ( total > 0 )
|
||||
{
|
||||
percent = val / total
|
||||
percent *= 100
|
||||
}
|
||||
|
||||
if ( doClamp )
|
||||
percent = clamp( percent, 0, 100 )
|
||||
|
||||
string formattedPercent
|
||||
if ( int( percent * 10 ) % 10 == 0 )
|
||||
formattedPercent = format( "%.0f", percent )
|
||||
else
|
||||
formattedPercent = format( "%.1f", percent )
|
||||
|
||||
return formattedPercent
|
||||
}
|
||||
|
||||
//function GetChallengeCompleteData()
|
||||
//{
|
||||
// local Table = {}
|
||||
// Table.total <- 0
|
||||
// Table.complete <- 0
|
||||
//
|
||||
// UI_GetAllChallengesProgress()
|
||||
// var allChallenges = GetLocalChallengeTable()
|
||||
//
|
||||
// foreach( challengeRef, val in allChallenges )
|
||||
// {
|
||||
// if ( IsDailyChallenge( challengeRef ) )
|
||||
// continue
|
||||
// local tierCount = GetChallengeTierCount( challengeRef )
|
||||
// Table.total += tierCount
|
||||
// for ( int i = 0; i < tierCount; i++ )
|
||||
// {
|
||||
// if ( IsChallengeTierComplete( challengeRef, i ) )
|
||||
// Table.complete++
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return Table
|
||||
//}
|
||||
|
||||
function GetItemUnlockCountData()
|
||||
{
|
||||
entity player = GetUIPlayer()
|
||||
if ( player == null )
|
||||
return {}
|
||||
|
||||
local Table = {}
|
||||
Table[ "weapons" ] <- {}
|
||||
Table[ "weapons" ].total <- 0
|
||||
Table[ "weapons" ].unlocked <- 0
|
||||
Table[ "attachments" ] <- {}
|
||||
Table[ "attachments" ].total <- 0
|
||||
Table[ "attachments" ].unlocked <- 0
|
||||
Table[ "mods" ] <- {}
|
||||
Table[ "mods" ].total <- 0
|
||||
Table[ "mods" ].unlocked <- 0
|
||||
Table[ "abilities" ] <- {}
|
||||
Table[ "abilities" ].total <- 0
|
||||
Table[ "abilities" ].unlocked <- 0
|
||||
Table[ "gear" ] <- {}
|
||||
Table[ "gear" ].total <- 0
|
||||
Table[ "gear" ].unlocked <- 0
|
||||
/*
|
||||
local tableMapping = {}
|
||||
|
||||
tableMapping[ eItemTypes.PILOT_PRIMARY ] <- "weapons"
|
||||
tableMapping[ eItemTypes.PILOT_SECONDARY ] <- "weapons"
|
||||
tableMapping[ eItemTypes.PILOT_ORDNANCE ] <- "weapons"
|
||||
tableMapping[ eItemTypes.TITAN_PRIMARY ] <- "weapons"
|
||||
tableMapping[ eItemTypes.TITAN_ORDNANCE ] <- "weapons"
|
||||
tableMapping[ eItemTypes.PILOT_PRIMARY_ATTACHMENT ] <- "attachments"
|
||||
tableMapping[ eItemTypes.PILOT_PRIMARY_MOD ] <- "mods"
|
||||
tableMapping[ eItemTypes.PILOT_SECONDARY_MOD ] <- "mods"
|
||||
tableMapping[ eItemTypes.TITAN_PRIMARY_MOD ] <- "mods"
|
||||
tableMapping[ eItemTypes.PILOT_SPECIAL_MOD ] <- "mods"
|
||||
tableMapping[ eItemTypes.TITAN_SPECIAL_MOD ] <- "mods"
|
||||
tableMapping[ eItemTypes.PILOT_SPECIAL ] <- "abilities"
|
||||
tableMapping[ eItemTypes.TITAN_SPECIAL ] <- "abilities"
|
||||
|
||||
local itemRefs = GetAllItemRefs()
|
||||
foreach ( data in itemRefs )
|
||||
{
|
||||
if ( !( data.Type in tableMapping ) )
|
||||
continue
|
||||
Table[ tableMapping[ data.Type ] ].total++
|
||||
|
||||
if ( !IsItemLocked( player, expect string( data.childRef ), expect string( data.ref ) ) )
|
||||
Table[ tableMapping[ data.Type ] ].unlocked++
|
||||
}
|
||||
*/
|
||||
return Table
|
||||
}
|
||||
|
||||
table<string, table> function GetOverviewWeaponData()
|
||||
{
|
||||
table<string, table> Table = {}
|
||||
Table[ "most_kills" ] <- {}
|
||||
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[ "highest_kpm" ] <- {}
|
||||
Table[ "highest_kpm" ].ref <- ""
|
||||
Table[ "highest_kpm" ].printName <- ""
|
||||
Table[ "highest_kpm" ].val <- 0
|
||||
|
||||
entity player = GetUIPlayer()
|
||||
if ( player == null )
|
||||
return Table
|
||||
|
||||
array<ItemDisplayData> allWeapons = []
|
||||
|
||||
allWeapons.extend( GetVisibleItemsOfType( eItemTypes.PILOT_PRIMARY ) )
|
||||
allWeapons.extend( GetVisibleItemsOfType( eItemTypes.PILOT_SECONDARY ) )
|
||||
//allWeapons.extend( GetVisibleItemsOfType( eItemTypes.PILOT_ORDNANCE ) ) // art looks bad
|
||||
allWeapons.extend( GetVisibleItemsOfType( eItemTypes.TITAN_PRIMARY ) )
|
||||
allWeapons.extend( GetVisibleItemsOfType( eItemTypes.TITAN_ORDNANCE ) )
|
||||
allWeapons.extend( GetVisibleItemsOfType( eItemTypes.TITAN_ANTIRODEO ) )
|
||||
allWeapons.extend( GetVisibleItemsOfType( eItemTypes.TITAN_SPECIAL ) )
|
||||
//allWeapons.extend( GetVisibleItemsOfType( eItemTypes.BURN_METER_REWARD ) ) // script errors
|
||||
|
||||
foreach ( weapon in allWeapons )
|
||||
{
|
||||
string weaponName = weapon.ref
|
||||
string weaponDisplayName = expect string( GetWeaponInfoFileKeyField_Global( weaponName, "printname" ) )
|
||||
|
||||
if ( !PersistenceEnumValueIsValid( "loadoutWeaponsAndAbilities", weaponName ) )
|
||||
continue
|
||||
|
||||
int val = getWeaponKillsFromToneAPI(weaponName)
|
||||
if ( val > Table[ "most_kills" ].val )
|
||||
{
|
||||
Table[ "most_kills" ].ref = weaponName
|
||||
Table[ "most_kills" ].printName = weaponDisplayName
|
||||
Table[ "most_kills" ].val = val
|
||||
}
|
||||
|
||||
int nval = getNemesisWeaponFromToneAPI(weaponName)
|
||||
if ( nval > Table[ "nemesis_weapon" ].val )
|
||||
{
|
||||
Table[ "nemesis_weapon" ].ref = weaponName
|
||||
Table[ "nemesis_weapon" ].printName = weaponDisplayName
|
||||
Table[ "nemesis_weapon" ].val = nval
|
||||
}
|
||||
|
||||
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() )
|
||||
{
|
||||
Table[ "highest_kpm" ].ref = weaponName
|
||||
Table[ "highest_kpm" ].printName = weaponDisplayName
|
||||
Table[ "highest_kpm" ].val = kdval
|
||||
}
|
||||
}
|
||||
|
||||
return Table
|
||||
}
|
||||
|
||||
string function StatToTimeString( string category, string alias, string weapon = "" )
|
||||
{
|
||||
entity player = GetUIPlayer()
|
||||
if ( player == null )
|
||||
return "0"
|
||||
|
||||
string statString = GetStatVar( category, alias, weapon )
|
||||
float savedHours = expect float( player.GetPersistentVar( statString ) )
|
||||
|
||||
return HoursToTimeString( savedHours )
|
||||
}
|
||||
|
||||
string function HoursToTimeString( float savedHours )
|
||||
{
|
||||
string timeString
|
||||
local minutes = floor( savedHours * 60.0 )
|
||||
|
||||
if ( minutes < 0 )
|
||||
minutes = 0
|
||||
|
||||
int days = 0
|
||||
int hours = 0
|
||||
|
||||
while ( minutes >= 1440 )
|
||||
{
|
||||
minutes -= 1440
|
||||
days++
|
||||
}
|
||||
|
||||
while ( minutes >= 60 )
|
||||
{
|
||||
minutes -= 60
|
||||
hours++
|
||||
}
|
||||
|
||||
if ( days > 0 && hours > 0 && minutes > 0 )
|
||||
{
|
||||
timeString = Localize( "#STATS_TIME_STRING_D_H_M", days, hours, minutes )
|
||||
}
|
||||
else if ( days > 0 && hours == 0 && minutes == 0 )
|
||||
{
|
||||
timeString = Localize( "#STATS_TIME_STRING_D", days )
|
||||
}
|
||||
else if ( days == 0 && hours > 0 && minutes == 0 )
|
||||
{
|
||||
timeString = Localize( "#STATS_TIME_STRING_H", hours )
|
||||
}
|
||||
else if ( days == 0 && hours == 0 && minutes >= 0 )
|
||||
{
|
||||
timeString = Localize( "#STATS_TIME_STRING_M", minutes )
|
||||
}
|
||||
else if ( days > 0 && hours > 0 && minutes == 0 )
|
||||
{
|
||||
timeString = Localize( "#STATS_TIME_STRING_D_H", days, hours )
|
||||
}
|
||||
else if ( days == 0 && hours > 0 && minutes > 0 )
|
||||
{
|
||||
timeString = Localize( "#STATS_TIME_STRING_H_M", hours, minutes )
|
||||
}
|
||||
else if ( days > 0 && hours == 0 && minutes > 0 )
|
||||
{
|
||||
timeString = Localize( "#STATS_TIME_STRING_D_M", days, minutes )
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert( 0, "Unhandled time string creation case" )
|
||||
}
|
||||
|
||||
return timeString
|
||||
}
|
||||
|
||||
string function PieChartHoursToTimeString( float savedHours, string pieChartHeader, string pieChartPercent )
|
||||
{
|
||||
string timeString
|
||||
local minutes = floor( savedHours * 60.0 )
|
||||
|
||||
if ( minutes < 0 )
|
||||
minutes = 0
|
||||
|
||||
int days = 0
|
||||
int hours = 0
|
||||
|
||||
while ( minutes >= 1440 )
|
||||
{
|
||||
minutes -= 1440
|
||||
days++
|
||||
}
|
||||
|
||||
while ( minutes >= 60 )
|
||||
{
|
||||
minutes -= 60
|
||||
hours++
|
||||
}
|
||||
|
||||
if ( days > 0 && hours > 0 && minutes > 0 )
|
||||
{
|
||||
timeString = Localize( "#STATS_TIME_STRING_D_H_M_PIECHART", days, hours, minutes, Localize( pieChartHeader ), pieChartPercent )
|
||||
}
|
||||
else if ( days > 0 && hours == 0 && minutes == 0 )
|
||||
{
|
||||
timeString = Localize( "#STATS_TIME_STRING_D_PIECHART", days, Localize( pieChartHeader ), pieChartPercent )
|
||||
}
|
||||
else if ( days == 0 && hours > 0 && minutes == 0 )
|
||||
{
|
||||
timeString = Localize( "#STATS_TIME_STRING_H_PIECHART", hours, Localize( pieChartHeader ), pieChartPercent )
|
||||
}
|
||||
else if ( days == 0 && hours == 0 && minutes >= 0 )
|
||||
{
|
||||
timeString = Localize( "#STATS_TIME_STRING_M_PIECHART", minutes, Localize( pieChartHeader ), pieChartPercent )
|
||||
}
|
||||
else if ( days > 0 && hours > 0 && minutes == 0 )
|
||||
{
|
||||
timeString = Localize( "#STATS_TIME_STRING_D_H_PIECHART", days, hours, Localize( pieChartHeader ), pieChartPercent )
|
||||
}
|
||||
else if ( days == 0 && hours > 0 && minutes > 0 )
|
||||
{
|
||||
timeString = Localize( "#STATS_TIME_STRING_H_M_PIECHART", hours, minutes, Localize( pieChartHeader ), pieChartPercent )
|
||||
}
|
||||
else if ( days > 0 && hours == 0 && minutes > 0 )
|
||||
{
|
||||
timeString = Localize( "#STATS_TIME_STRING_D_M_PIECHART", days, minutes, Localize( pieChartHeader ), pieChartPercent )
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert( 0, "Unhandled time string creation case" )
|
||||
}
|
||||
|
||||
return timeString
|
||||
}
|
||||
|
||||
string function StatToDistanceString( string category, string alias, string weapon = "" )
|
||||
{
|
||||
entity player = GetUIPlayer()
|
||||
if ( player == null )
|
||||
return ""
|
||||
|
||||
string statString = GetStatVar( category, alias, weapon )
|
||||
float kilometers = expect float( player.GetPersistentVar( statString ) )
|
||||
|
||||
string formattedNum
|
||||
if ( kilometers % 1 == 0 )
|
||||
formattedNum = format( "%.0f", kilometers )
|
||||
else
|
||||
formattedNum = format( "%.2f", kilometers )
|
||||
|
||||
string distString = Localize( "#STATS_KILOMETERS_ABBREVIATION", formattedNum )
|
||||
|
||||
return distString
|
||||
}
|
||||
|
||||
int function ComparePieChartEntryValues( PieChartEntry a, PieChartEntry b )
|
||||
{
|
||||
float aVal = a.numValue
|
||||
float bVal = b.numValue
|
||||
|
||||
if ( aVal < bVal )
|
||||
return 1
|
||||
else if ( aVal > bVal )
|
||||
return -1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
void function SetStatBoxDisplay( var vguiElem, string text, string value )
|
||||
{
|
||||
var rui = Hud_GetRui( vguiElem )
|
||||
|
||||
RuiSetString( rui, "statText", text )
|
||||
RuiSetString( rui, "statValue", value )
|
||||
}
|
||||
|
||||
void function SetMedalStatBoxDisplay( var vguiElem, string text, asset image, int value )
|
||||
{
|
||||
var rui = Hud_GetRui( vguiElem )
|
||||
|
||||
RuiSetString( rui, "statText", text )
|
||||
RuiSetString( rui, "statValue", string( value ) )
|
||||
RuiSetImage( rui, "statImage", image )
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
//TODO: Kills Per Minute stat
|
||||
|
||||
global function InitViewStatsWeaponsMenu
|
||||
|
||||
struct
|
||||
{
|
||||
var menu
|
||||
GridMenuData gridData
|
||||
bool isGridInitialized = false
|
||||
array<ItemDisplayData> allPilotWeapons
|
||||
} file
|
||||
|
||||
void function InitViewStatsWeaponsMenu()
|
||||
{
|
||||
var menu = GetMenu( "ViewStats_Weapons_Menu" )
|
||||
file.menu = menu
|
||||
|
||||
Hud_SetText( Hud_GetChild( file.menu, "MenuTitle" ), "#STATS_PILOT_WEAPONS" )
|
||||
|
||||
file.gridData.rows = 5
|
||||
file.gridData.columns = 1
|
||||
//file.gridData.numElements // Set in OnViewStatsWeapons_Open after itemdata exists
|
||||
file.gridData.pageType = eGridPageType.VERTICAL
|
||||
file.gridData.tileWidth = 224
|
||||
file.gridData.tileHeight = 112
|
||||
file.gridData.paddingVert = 6
|
||||
file.gridData.paddingHorz = 6
|
||||
|
||||
Grid_AutoAspectSettings( menu, file.gridData )
|
||||
|
||||
file.gridData.initCallback = WeaponButton_Init
|
||||
file.gridData.getFocusCallback = WeaponButton_GetFocus
|
||||
//file.gridData.clickCallback = WeaponButton_Activate
|
||||
|
||||
AddMenuEventHandler( file.menu, eUIEvent.MENU_OPEN, OnViewStatsWeapons_Open )
|
||||
|
||||
AddMenuFooterOption( file.menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" )
|
||||
}
|
||||
|
||||
void function OnViewStatsWeapons_Open()
|
||||
{
|
||||
//UI_SetPresentationType( ePresentationType.NO_MODELS )
|
||||
UI_SetPresentationType( ePresentationType.STORE_WEAPON_SKINS )
|
||||
|
||||
// Get Pilot weapon list
|
||||
file.allPilotWeapons = GetVisibleItemsOfType( eItemTypes.PILOT_PRIMARY )
|
||||
file.allPilotWeapons.extend( GetVisibleItemsOfType( eItemTypes.PILOT_SECONDARY ) )
|
||||
file.allPilotWeapons.sort( SortItemsAlphabetically )
|
||||
//file.allPilotWeapons.extend( GetVisibleItemsOfType( eItemTypes.PILOT_ORDNANCE ) )
|
||||
//file.allPilotWeapons.extend( GetVisibleItemsOfType( eItemTypes.PILOT_SPECIAL ) )
|
||||
|
||||
file.gridData.numElements = file.allPilotWeapons.len()
|
||||
|
||||
if ( !file.isGridInitialized )
|
||||
{
|
||||
GridMenuInit( file.menu, file.gridData )
|
||||
file.isGridInitialized = true
|
||||
}
|
||||
|
||||
file.gridData.currentPage = 0
|
||||
|
||||
Grid_InitPage( file.menu, file.gridData )
|
||||
Hud_SetFocused( Grid_GetButtonForElementNumber( file.menu, 0 ) )
|
||||
UpdateStatsForWeapon( file.allPilotWeapons[ 0 ].ref )
|
||||
}
|
||||
|
||||
bool function WeaponButton_Init( var button, int elemNum )
|
||||
{
|
||||
string ref = file.allPilotWeapons[ elemNum ].ref
|
||||
int itemType = GetItemType( ref )
|
||||
|
||||
var rui = Hud_GetRui( button )
|
||||
asset image = GetImage( itemType, ref )
|
||||
RuiSetImage( rui, "buttonImage", image )
|
||||
|
||||
Hud_SetEnabled( button, true )
|
||||
Hud_SetVisible( button, true )
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
void function WeaponButton_GetFocus( var button, int elemNum )
|
||||
{
|
||||
//if ( IsControllerModeActive() )
|
||||
UpdateStatsForWeapon( file.allPilotWeapons[ elemNum ].ref )
|
||||
}
|
||||
|
||||
//void function WeaponButton_Activate( var button, int elemNum )
|
||||
//{
|
||||
// if ( !IsControllerModeActive() )
|
||||
// UpdateStatsForWeapon( file.allPilotWeapons[ elemNum ].ref )
|
||||
//}
|
||||
|
||||
void function UpdateStatsForWeapon( string weaponRef )
|
||||
{
|
||||
//Sliced names are to be removed afterwards
|
||||
string slicedName = ""
|
||||
if(weaponRef.find("mp_weapon")){
|
||||
slicedName = weaponRef.slice(10)
|
||||
}
|
||||
entity player = GetUIPlayer()
|
||||
if ( player == null )
|
||||
return
|
||||
|
||||
RunMenuClientFunction( "UpdateStoreWeaponModelSkin", weaponRef, 0 )
|
||||
|
||||
// Name
|
||||
Hud_SetText( Hud_GetChild( file.menu, "WeaponName" ), GetItemName( weaponRef ) )
|
||||
|
||||
// Locked info
|
||||
var lockLabel = GetElementsByClassname( file.menu, "LblWeaponLocked" )[0]
|
||||
|
||||
if ( IsItemLocked( player, weaponRef ) )
|
||||
{
|
||||
Hud_SetText( lockLabel, "#LOUADOUT_UNLOCK_REQUIREMENT_LEVEL", GetUnlockLevelReq( weaponRef ) )
|
||||
Hud_Show( lockLabel )
|
||||
}
|
||||
else
|
||||
{
|
||||
Hud_Hide( lockLabel )
|
||||
}
|
||||
|
||||
// Get required data needed for some calculations
|
||||
//float hoursUsed = GetPlayerStatFloat( player, "weapon_stats", "hoursUsed", weaponRef )
|
||||
string timeUsed = StatToTimeString( "weapon_stats", "hoursUsed", weaponRef )
|
||||
int shotsHit = GetPlayerStatInt( player, "weapon_stats", "shotsHit", weaponRef )
|
||||
int headshots = GetPlayerStatInt( player, "weapon_stats", "headshots", weaponRef )
|
||||
int crits = GetPlayerStatInt( player, "weapon_stats", "critHits", weaponRef )
|
||||
|
||||
string headShotsValue = Localize( "#STATS_NOT_APPLICABLE" )
|
||||
bool headshotWeapon = GetWeaponInfoFileKeyField_Global( weaponRef, "allow_headshots" ) == true
|
||||
if ( headshotWeapon )
|
||||
headShotsValue = string( headshots )
|
||||
|
||||
string critHitsValue = Localize( "#STATS_NOT_APPLICABLE" )
|
||||
bool critHitWeapon = GetWeaponInfoFileKeyField_Global( weaponRef, "critical_hit" ) == true
|
||||
if ( critHitWeapon )
|
||||
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_HEADSHOTS" ), headShotsValue )
|
||||
SetStatBoxDisplay( Hud_GetChild( file.menu, "Stat3" ), Localize( "#STATS_HEADER_CRITICAL_HITS" ), critHitsValue )
|
||||
|
||||
string nextUnlockRef = GetNextUnlockForWeaponLevel( player, weaponRef, WeaponGetRawLevel( player, weaponRef ) + 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, weaponRef )
|
||||
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 )
|
||||
}
|
||||
//printt( displayData.image )
|
||||
}
|
||||
|
||||
// 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))
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"Major": "1",
|
||||
"Minor": "2",
|
||||
"Patch": "1"
|
||||
}
|
||||
Reference in New Issue
Block a user