PageRenderTime 50ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/upload/ci/application/models/psychostats/halflife/tf/method.nav_blocks_player.php

https://github.com/txdv/psychostats4
PHP | 282 lines | 238 code | 18 blank | 26 comment | 1 complexity | 31ee29fbe65ff88646aea1bcc2b8b159 MD5 | raw file
  1. <?php
  2. /**
  3. * PsychoStats method Nav_Blocks_Player()
  4. * $Id$
  5. *
  6. *
  7. */
  8. include dirname(__FILE__) . '/../' . basename(__FILE__);
  9. class Psychostats_Method_Nav_Blocks_Player_Halflife_Tf
  10. extends Psychostats_Method_Nav_Blocks_Player_Halflife {
  11. public function execute(&$blocks, &$plr, &$stats) {
  12. parent::execute($blocks, $plr, $stats);
  13. // dual_bar defaults
  14. $bar = array(
  15. 'color1' => '0000CC',
  16. 'color2' => 'CC0000',
  17. );
  18. if (!array_key_exists('player_actions', $blocks)) {
  19. array_push_after($blocks, 'player_kill_profile', array(
  20. 'title' => trans('Player Actions'),
  21. 'rows' => array(),
  22. ), 'player_actions');
  23. }
  24. $blocks['player_actions']['rows'] += array(
  25. 'games' => array(
  26. 'row_class' => 'hdr',
  27. 'label' => trans('Games'),
  28. ),
  29. 'team_wins' => array(
  30. 'row_class' => 'sub',
  31. 'label' => trans('Wins'),
  32. 'value' => sprintf('<div class="pct-stat">%s</div>%s',
  33. $stats['wins'] ? dual_bar($bar + array(
  34. 'pct1' => $stats['blue_wins'] / $stats['wins'] * 100,
  35. 'pct2' => $stats['red_wins'] / $stats['wins'] * 100,
  36. 'title1'=> trans('%s Blu wins', number_format($stats['blue_wins'])),
  37. 'title2'=> trans('%s Red wins', number_format($stats['red_wins'])),
  38. )) : '',
  39. number_format($stats['wins'])),
  40. ),
  41. 'team_losses' => array(
  42. 'row_class' => 'sub',
  43. 'label' => trans('Losses'),
  44. 'value' => sprintf('<div class="pct-stat">%s</div>%s',
  45. $stats['losses'] ? dual_bar($bar + array(
  46. 'pct1' => $stats['blue_losses'] / $stats['losses'] * 100,
  47. 'pct2' => $stats['red_losses'] / $stats['losses'] * 100,
  48. 'title1'=> trans('%s Blu losses', number_format($stats['blue_losses'])),
  49. 'title2'=> trans('%s Red losses', number_format($stats['red_losses'])),
  50. )) : '',
  51. number_format($stats['losses'])),
  52. ),
  53. 'flags' => array(
  54. 'row_class' => 'hdr',
  55. 'label' => trans('Flags'),
  56. ),
  57. 'flag_captured' => array(
  58. 'row_class' => 'sub',
  59. 'label' => trans('Captured'),
  60. 'value' => sprintf('<div class="pct-stat">%s</div>%s',
  61. $stats['flag_captured'] ? dual_bar($bar + array(
  62. 'pct1' => $stats['blue_flag_captured'] / $stats['flag_captured'] * 100,
  63. 'pct2' => $stats['red_flag_captured'] / $stats['flag_captured'] * 100,
  64. 'title1'=> trans('%s Blu captures', number_format($stats['blue_flag_captured'])),
  65. 'title2'=> trans('%s Red captures', number_format($stats['red_flag_captured'])),
  66. )) : '',
  67. number_format($stats['flag_captured'])),
  68. ),
  69. 'flag_defended' => array(
  70. 'row_class' => 'sub',
  71. 'label' => trans('Defended'),
  72. 'value' => sprintf('<div class="pct-stat">%s</div>%s',
  73. $stats['flag_defended'] ? dual_bar($bar + array(
  74. 'pct1' => $stats['blue_flag_defended'] / $stats['flag_defended'] * 100,
  75. 'pct2' => $stats['red_flag_defended'] / $stats['flag_defended'] * 100,
  76. 'title1'=> trans('%s Blu defends', number_format($stats['blue_flag_defended'])),
  77. 'title2'=> trans('%s Red defends', number_format($stats['red_flag_defended'])),
  78. )) : '',
  79. number_format($stats['flag_defended'])),
  80. ),
  81. 'flag_pickedup' => array(
  82. 'row_class' => 'sub',
  83. 'label' => trans('Picked Up'),
  84. 'value' => number_format($stats['flag_pickedup']),
  85. ),
  86. 'flag_dropped' => array(
  87. 'row_class' => 'sub',
  88. 'label' => trans('Dropped'),
  89. 'value' => number_format($stats['flag_dropped']),
  90. ),
  91. 'points' => array(
  92. 'row_class' => 'hdr',
  93. 'label' => trans('Control Points'),
  94. ),
  95. 'point_captured' => array(
  96. 'row_class' => 'sub',
  97. 'label' => trans('Captured'),
  98. 'value' => number_format($stats['point_captured']),
  99. //'value' => sprintf('<div class="pct-stat">%s</div>%s',
  100. // $stats['point_captured'] ? dual_bar($bar + array(
  101. // 'pct1' => $stats['blue_point_captured'] / $stats['point_captured'] * 100,
  102. // 'pct2' => $stats['red_point_captured'] / $stats['point_captured'] * 100,
  103. // 'title1'=> trans('%s Blu captures', number_format($stats['blue_point_captured'])),
  104. // 'title2'=> trans('%s Red captures', number_format($stats['red_point_captured'])),
  105. // )) : '',
  106. // number_format($stats['point_captured'])),
  107. ),
  108. 'blocked_capture' => array(
  109. 'row_class' => 'sub',
  110. 'label' => trans('Blocked'),
  111. 'value' => number_format($stats['blocked_capture']),
  112. //'value' => sprintf('<div class="pct-stat">%s</div>%s',
  113. // $stats['blocked_capture'] ? dual_bar($bar + array(
  114. // 'pct1' => $stats['blue_blocked_capture'] / $stats['blocked_capture'] * 100,
  115. // 'pct2' => $stats['red_blocked_capture'] / $stats['blocked_capture'] * 100,
  116. // 'title1'=> trans('%s Blu defends', number_format($stats['blue_blocked_capture'])),
  117. // 'title2'=> trans('%s Red defends', number_format($stats['red_blocked_capture'])),
  118. // )) : '',
  119. // number_format($stats['blocked_capture'])),
  120. ),
  121. 'built_objects' => array(
  122. 'row_class' => 'hdr',
  123. 'label' => trans('Built'),
  124. 'value' => number_format($stats['built_objects'])
  125. ),
  126. 'built_attachment_sapper' => array(
  127. 'row_class' => 'sub',
  128. 'label' => trans('Sappers'),
  129. 'value' => number_format($stats['built_attachment_sapper']),
  130. ),
  131. 'built_dispenser' => array(
  132. 'row_class' => 'sub',
  133. 'label' => trans('Dispensers'),
  134. 'value' => number_format($stats['built_dispenser']),
  135. ),
  136. 'built_sentrygun' => array(
  137. 'row_class' => 'sub',
  138. 'label' => trans('Sentry Guns'),
  139. 'value' => number_format($stats['built_sentrygun']),
  140. ),
  141. 'built_teleporter_entrance' => array(
  142. 'row_class' => 'sub',
  143. 'label' => trans('Teleporter Entry'),
  144. 'value' => number_format($stats['built_teleporter_entrance']),
  145. ),
  146. 'built_teleporter_exit' => array(
  147. 'row_class' => 'sub',
  148. 'label' => trans('Teleporter Exit'),
  149. 'value' => number_format($stats['built_teleporter_exit']),
  150. ),
  151. 'destroyed_objects' => array(
  152. 'row_class' => 'hdr',
  153. 'label' => trans('Destroyed'),
  154. 'value' => number_format($stats['destroyed_objects'])
  155. ),
  156. 'destroyed_attachment_sapper' => array(
  157. 'row_class' => 'sub',
  158. 'label' => trans('Sappers'),
  159. 'value' => number_format($stats['destroyed_attachment_sapper']),
  160. ),
  161. 'destroyed_dispenser' => array(
  162. 'row_class' => 'sub',
  163. 'label' => trans('Dispensers'),
  164. 'value' => number_format($stats['destroyed_dispenser']),
  165. ),
  166. 'destroyed_sentrygun' => array(
  167. 'row_class' => 'sub',
  168. 'label' => trans('Sentry Guns'),
  169. 'value' => number_format($stats['destroyed_sentrygun']),
  170. ),
  171. 'destroyed_teleporter_entrance' => array(
  172. 'row_class' => 'sub',
  173. 'label' => trans('Teleporter Entry'),
  174. 'value' => number_format($stats['destroyed_teleporter_entrance']),
  175. ),
  176. 'destroyed_teleporter_exit' => array(
  177. 'row_class' => 'sub',
  178. 'label' => trans('Teleporter Exit'),
  179. 'value' => number_format($stats['destroyed_teleporter_exit']),
  180. ),
  181. );
  182. array_push_after($blocks['player_kill_profile']['rows'],
  183. 'kills',
  184. array(
  185. 'row_class' => 'sub',
  186. 'label' => trans('Killed'),
  187. 'value' => sprintf('<div class="pct-stat">%s</div>&nbsp;',
  188. $stats['kills'] ? dual_bar($bar + array(
  189. 'pct1' => $stats['killed_blue'] / $stats['kills'] * 100,
  190. 'pct2' => $stats['killed_red'] / $stats['kills'] * 100,
  191. 'title1'=> trans('%s Blu kills', number_format($stats['killed_blue'])),
  192. 'title2'=> trans('%s Red kills', number_format($stats['killed_red'])),
  193. )) : ''
  194. ),
  195. ),
  196. 'killed'
  197. );
  198. array_push_after($blocks['player_kill_profile']['rows'],
  199. 'killed',
  200. array(
  201. 'row_class' => 'sub',
  202. 'label' => trans('Assists'),
  203. 'value' => sprintf('<div class="pct-stat">%s</div>%s', pct_bar($stats['assisted_kills_pct']), number_format($stats['assisted_kills'])),
  204. ),
  205. 'assisted_kills'
  206. );
  207. array_push_after($blocks['player_kill_profile']['rows'],
  208. 'headshot_kills',
  209. array(
  210. 'row_class' => 'sub',
  211. 'label' => trans('Dominations'),
  212. 'value' => number_format($stats['domination']),
  213. //'value' => sprintf('<div class="pct-stat">%s</div>%s', pct_bar($stats['assisted_kills_pct']), number_format($stats['assisted_kills'])),
  214. ),
  215. 'domination'
  216. );
  217. array_push_after($blocks['player_kill_profile']['rows'],
  218. 'headshot_kills',
  219. array(
  220. 'row_class' => 'sub',
  221. 'label' => trans('Revenges'),
  222. 'value' => number_format($stats['revenge']),
  223. //'value' => sprintf('<div class="pct-stat">%s</div>%s', pct_bar($stats['assisted_kills_pct']), number_format($stats['assisted_kills'])),
  224. ),
  225. 'revenge'
  226. );
  227. array_push_after($blocks['player_kill_profile']['rows'],
  228. 'headshot_kills',
  229. array(
  230. 'row_class' => 'sub',
  231. 'label' => trans('Backstabs'),
  232. 'value' => sprintf('<div class="pct-stat">%s</div>%s', pct_bar($stats['backstab_kills_pct']), number_format($stats['backstab_kills'])),
  233. ),
  234. 'backstab_kills'
  235. );
  236. // deaths
  237. array_push_after($blocks['player_kill_profile']['rows'],
  238. 'deaths',
  239. array(
  240. 'row_class' => 'sub',
  241. 'label' => trans('Deaths From'),
  242. 'value' => sprintf('<div class="pct-stat">%s</div>&nbsp;',
  243. $stats['deaths'] ? dual_bar($bar + array(
  244. 'pct1' => $stats['deathsby_blue'] / $stats['deaths'] * 100,
  245. 'pct2' => $stats['deathsby_red'] / $stats['deaths'] * 100,
  246. 'title1'=> trans('%s deaths from Blu', number_format($stats['deathsby_blue'])),
  247. 'title2'=> trans('%s deaths from Red', number_format($stats['deathsby_red'])),
  248. )) : ''
  249. ),
  250. ),
  251. 'deathsby'
  252. );
  253. array_push_after($blocks['player_kill_profile']['rows'],
  254. 'headshot_deaths',
  255. array(
  256. 'row_class' => 'sub',
  257. 'label' => trans('Backstabs'),
  258. 'value' => sprintf('<div class="pct-stat">%s</div>%s', pct_bar($stats['backstab_deaths_pct']), number_format($stats['backstab_deaths'])),
  259. ),
  260. 'backstab_deaths'
  261. );
  262. }
  263. }
  264. ?>