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

https://github.com/txdv/psychostats4 · PHP · 254 lines · 210 code · 18 blank · 26 comment · 1 complexity · 448f7524c754d14c3fa28018507908e3 MD5 · raw file

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