///////////////////////////////////////////////////////////////////////////////
//  Personal Stats                                                           //
///////////////////////////////////////////////////////////////////////////////
stats = [showui player_stats]

UImenu "player_stats" [
   uitable 0 0 [
      uitablerow [
         uifill 0.10 0
         uifill 0.13 0 [uitext "^f4Total" 0.57]
         uifill 0.13 0 [uitext "^f4rDM"  0.57]
         uifill 0.13 0 [uitext "^f4rTDM" 0.57]
         uifill 0.13 0 [uitext "^f4rCTF" 0.57]
         uifill 0.13 0 [uitext "^f4pDM"  0.57]
         uifill 0.13 0 [uitext "^f4pTDM" 0.57]
         uifill 0.13 0 [uitext "^f4pCTF" 0.57]
         uifill 0.13 0 [uitext "^f4EDIT" 0.57]
      ] [uicolor 0x99323232 0 0 [uiclamp 1 1 1 1]]
      uitablerow [
         uitext "^f4Score" 0.57 [uialign 1]
         uicolortext $stat_x_total 0x62B370 0.57
         uitext "^f4-" 0.57
         uitext "^f4-" 0.57
         uicolortext $stat_x_rctf 0x62B370 0.57
         uitext "^f4-" 0.57
         uitext "^f4-" 0.57
         uicolortext $stat_x_pctf 0x62B370 0.57
         uitext "^f4-" 0.57
      ] [uicolor 0x99262626 0 0 [uiclamp 1 1 1 1]]
      uitablerow [
         uitext "^f4Kill" 0.57 [uialign 1]
         uicolortext $stat_k_total 0xBBCC8B 0.57
         uicolortext $stat_k_rdm  0xBBCC8B 0.57
         uicolortext $stat_k_rtdm 0xBBCC8B 0.57
         uicolortext $stat_k_rctf 0xBBCC8B 0.57
         uicolortext $stat_k_pdm  0xBBCC8B 0.57
         uicolortext $stat_k_ptdm 0xBBCC8B 0.57
         uicolortext $stat_k_pctf 0xBBCC8B 0.57
         uitext "^f4-" 0.57
      ] [uicolor 0x99323232 0 0 [uiclamp 1 1 1 1]]
      uitablerow [
         uitext "^f4Death" 0.57 [uialign 1]
         uicolortext $stat_d_total 0xE56767 0.57
         uicolortext $stat_d_rdm  0xE56767 0.57
         uicolortext $stat_d_rtdm 0xE56767 0.57
         uicolortext $stat_d_rctf 0xE56767 0.57
         uicolortext $stat_d_pdm  0xE56767 0.57
         uicolortext $stat_d_ptdm 0xE56767 0.57
         uicolortext $stat_d_pctf 0xE56767 0.57
         uitext "^f4-" 0.57
      ] [uicolor 0x99262626 0 0 [uiclamp 1 1 1 1]]
      uitablerow [
         uitext "^f4Suicide" 0.57 [uialign 1]
         uicolortext $stat_s_total 0xE56767 0.57
         uicolortext $stat_s_rdm  0xE56767 0.57
         uicolortext $stat_s_rtdm 0xE56767 0.57
         uicolortext $stat_s_rctf 0xE56767 0.57
         uicolortext $stat_s_pdm  0xE56767 0.57
         uicolortext $stat_s_ptdm 0xE56767 0.57
         uicolortext $stat_s_pctf 0xE56767 0.57
         uitext "^f4-" 0.57
      ] [uicolor 0x99323232 0 0 [uiclamp 1 1 1 1]]
      uitablerow [
         uitext "^f4TeamKill" 0.57 [uialign 1]
         uicolortext $stat_tk_total 0xE56767 0.57
         uitext "^f4-" 0.57
         uicolortext $stat_tk_rtdm 0xE56767 0.57
         uicolortext $stat_tk_rctf 0xE56767 0.57
         uitext "^f4-" 0.57
         uicolortext $stat_tk_ptdm 0xE56767 0.57
         uicolortext $stat_tk_pctf 0xE56767 0.57
         uitext "^f4-" 0.57
      ] [uicolor 0x99262626 0 0 [uiclamp 1 1 1 1]]
      uitablerow [
         uitext "^f4KD Ratio" 0.57 [uialign 1]  // (K-TK)/(D+S)
         uicolortext $stat_r_avg  0xBBCC8B 0.57
         uicolortext $stat_r_rdm  0xBBCC8B 0.57
         uicolortext $stat_r_rtdm 0xBBCC8B 0.57
         uicolortext $stat_r_rctf 0xBBCC8B 0.57
         uicolortext $stat_r_pdm  0xBBCC8B 0.57
         uicolortext $stat_r_ptdm 0xBBCC8B 0.57
         uicolortext $stat_r_pctf 0xBBCC8B 0.57
         uitext "^f4-" 0.57
      ] [uicolor 0x99323232 0 0 [uiclamp 1 1 1 1]]
      uitablerow [
         uitext "^f4Time" 0.57 [uialign 1]
         uicolortext "HHHH:MM:SS" 0x77A1D9 0.57
         uicolortext $stat_time_rdm  0x77A1D9 0.57
         uicolortext $stat_time_rtdm 0x77A1D9 0.57
         uicolortext $stat_time_rctf 0x77A1D9 0.57
         uicolortext $stat_time_pdm  0x77A1D9 0.57
         uicolortext $stat_time_ptdm 0x77A1D9 0.57
         uicolortext $stat_time_pctf 0x77A1D9 0.57
         uicolortext $stat_time_edit 0x77A1D9 0.57
      ] [uicolor 0x99262626 0 0 [uiclamp 1 1 1 1]]
   ]
] [] [] [] "Personal Statistics"

looplist s [
   stat_x_rctf
   stat_x_pctf

   stat_k_rdm
   stat_k_rtdm
   stat_k_rctf
   stat_k_pdm
   stat_k_ptdm
   stat_k_pctf

   stat_d_rdm
   stat_d_rtdm
   stat_d_rctf
   stat_d_pdm
   stat_d_ptdm
   stat_d_pctf

   stat_s_rdm
   stat_s_rtdm
   stat_s_rctf
   stat_s_pdm
   stat_s_ptdm
   stat_s_pctf

   stat_tk_rtdm
   stat_tk_rctf
   stat_tk_ptdm
   stat_tk_pctf

   stat_time_edit
   stat_time_rdm
   stat_time_rtdm
   stat_time_rctf
   stat_time_pdm
   stat_time_ptdm
   stat_time_pctf
] [
   $s = 0
]

stat_r_rdm  = (divf $stat_k_rdm                     (+f $stat_d_rdm  $stat_s_rdm ))
stat_r_rtdm = (divf (-f $stat_k_rtdm $stat_tk_rtdm) (+f $stat_d_rtdm $stat_s_rtdm))
stat_r_rctf = (divf (-f $stat_k_rctf $stat_tk_rctf) (+f $stat_d_rctf $stat_s_rctf))
stat_r_pdm  = (divf $stat_k_pdm                     (+f $stat_d_pctf $stat_s_pdm ))
stat_r_ptdm = (divf (-f $stat_k_ptdm $stat_tk_ptdm) (+f $stat_d_ptdm $stat_s_ptdm))
stat_r_pctf = (divf (-f $stat_k_pctf $stat_tk_pctf) (+f $stat_d_pctf $stat_s_pctf))

stat_x_total  = (+ $stat_x_rctf $stat_x_pctf)
stat_k_total  = (+ $stat_k_rdm $stat_k_rtdm $stat_k_rctf $stat_k_pdm $stat_k_ptdm $stat_k_pctf)
stat_d_total  = (+ $stat_d_rdm $stat_d_rtdm $stat_d_rctf $stat_d_pdm $stat_d_ptdm $stat_d_pctf)
stat_s_total  = (+ $stat_s_rdm $stat_s_rtdm $stat_s_rctf $stat_s_pdm $stat_s_ptdm $stat_s_pctf)
stat_tk_total = (+ $stat_tk_rtdm $stat_tk_rctf $stat_tk_ptdm $stat_tk_pctf)

stat_r_avg  = (divf (-f $stat_k_total $stat_tk_total) (+f $stat_d_total $stat_s_total))
