enderalse/source/scripts/_sag_pc_statstrack_playerscript.psc

106 lines
3.7 KiB
Plaintext

Scriptname _SAG_PC_StatsTrack_PlayerScript extends ReferenceAlias
ObjectReference Property LastKnown Auto
GlobalVariable Property ExAequo Auto
GlobalVariable Property WonGames Auto
GlobalVariable Property LostGames Auto
GlobalVariable Property LostBets Auto
GlobalVariable Property WonBets Auto
String sWonGamesValue
String sLostGamesValue
String sWonBetsValue
String sLostBetsValue
Event OnInit()
RegisterForMenu("Journal Menu")
endEvent
Event OnPlayerLoadGame()
OnInit()
EndEvent
event OnMenuOpen(string a_menuName)
; won games
sWonGamesValue =WonGames.Value as string
string[] WGargs = new string[4]
WGargs[0] = "Card Game: won games" ; Stat name
WGargs[1] = sWonGamesValue as INT
WGargs[2] = "0" ; stat category index as string 0 = "General"
WGargs[3] = ""
UI.InvokeStringA("Journal Menu", "_root.QuestJournalFader.Menu_mc.StatsFader.Page_mc.PopulateStatsList", WGargs)
; lost games
sLostGamesValue =LostGames.Value as string
string[] LGargs = new string[4]
LGargs[0] = "Card Game: lost games" ; Stat name
LGargs[1] = sLostGamesValue as INT
LGargs[2] = "0" ; stat category index as string 0 = "General"
LGargs[3] = ""
UI.InvokeStringA("Journal Menu", "_root.QuestJournalFader.Menu_mc.StatsFader.Page_mc.PopulateStatsList", LGargs)
; ex aequo
string sExAequoValue = ExAequo.Value as string
string[] EAargs = new string[4]
EAargs[0] = "Card Game: ex aequo" ; Stat name
EAargs[1] = sExAequoValue as INT
EAargs[2] = "0" ; stat category index as string 0 = "General"
EAargs[3] = ""
UI.InvokeStringA("Journal Menu", "_root.QuestJournalFader.Menu_mc.StatsFader.Page_mc.PopulateStatsList", EAargs)
; lost bets
GetOwningQuest().UpdateCurrentInstanceGlobal(LostBets) ; Not sure if this is necessary?
sLostBetsValue =LostBets.Value as string
string[] LBargs = new string[4]
LBargs[0] = "Card Game: total lost gold" ; Stat name
LBargs[1] = sLostBetsValue as INT
LBargs[2] = "0" ; stat category index as string 0 = "General"
LBargs[3] = ""
UI.InvokeStringA("Journal Menu", "_root.QuestJournalFader.Menu_mc.StatsFader.Page_mc.PopulateStatsList", LBargs)
; won bets
sWonBetsValue =WonBets.Value as string
string[] WBargs = new string[4]
WBargs[0] = "Card Game: total won gold" ; Stat name
WBargs[1] = sWonBetsValue as INT
WBargs[2] = "0" ; stat category index as string 0 = "General"
WBargs[3] = ""
UI.InvokeStringA("Journal Menu", "_root.QuestJournalFader.Menu_mc.StatsFader.Page_mc.PopulateStatsList", WBargs)
; all games
string Sallgames = (WonGames.Value + LostGames.Value + ExAequo.Value) as string
string[] AGargs = new string[4]
AGargs[0] = "Card Game: total games played" ; Stat name
AGargs[1] = Sallgames as INT
AGargs[2] = "0" ; stat category index as string 0 = "General"
AGargs[3] = ""
UI.InvokeStringA("Journal Menu", "_root.QuestJournalFader.Menu_mc.StatsFader.Page_mc.PopulateStatsList", AGargs)
; last known opponent
; string SLastknown = LastKnown.GetDisplayName()
; string[] LKargs = new string[4]
; LKargs[0] = "Card Game: last opponent" ; Stat name
; if sAllGames != 0
; LKargs[1] = SLastKnown
; else
; LKArgs[1] = ""
; endif
; LKargs[2] = "0" ; stat category index as string 0 = "General"
; LKargs[3] = ""
; UI.InvokeStringA("Journal Menu", "_root.QuestJournalFader.Menu_mc.StatsFader.Page_mc.PopulateStatsList", LKargs)
; victoryRatio
String VictoryRatio
if( WonGames.Value + LostGames.Value + ExAequo.Value != 0 )
VictoryRatio = ((WonGames.Value/(WonGames.Value + LostGames.Value + ExAequo.Value)*100) as int) as string +"%"
else
VictoryRatio = "0%"
endif
string[] VRargs = new string[4]
VRargs[0] = "Card Game: victory ratio"
VRargs[1] = VictoryRatio
AGargs[2] = "0"
AGargs[3] = ""
UI.InvokeStringA("Journal Menu", "_root.QuestJournalFader.Menu_mc.StatsFader.Page_mc.PopulateStatsList", VRargs)
endEvent