function player_left_column_mod(&$plr, &$theme) { global $cms; $tpl = 'player_left_column_mod'; if ($theme->template_found($tpl, false)) { $actions = array(); $joined = $plr['joinedalien'] + $plr['joinedmarine']; if ($joined) { $pct1 = sprintf('%0.02f', $plr['joinedalien'] / $joined * 100); $pct2 = sprintf('%0.02f', $plr['joinedmarine'] / $joined * 100); } else { $pct1 = $pct2 = 0; } $actions['joined'] = array('label' => $cms->trans("Alien / Marine Joins"), 'type' => 'dual_bar', 'value' => array('pct1' => $pct1, 'pct2' => $pct2, 'title1' => $plr['joinedalien'] . ' ' . $cms->trans('Alien') . ' (' . $pct1 . '%)', 'title2' => $plr['joinedmarine'] . ' ' . $cms->trans('Marine') . ' (' . $pct2 . '%)', 'color1' => 'cc0000', 'color2' => '00cc00', 'width' => 130)); $actions['won'] = array('label' => $cms->trans("Alien / Marine Wins"), 'type' => 'dual_bar', 'value' => array('pct1' => $plr['alienwonpct'], 'pct2' => $plr['marinewonpct'], 'title1' => $plr['alienwon'] . ' ' . $cms->trans('Alien') . ' (' . $plr['alienwonpct'] . '%)', 'title2' => $plr['marinewon'] . ' ' . $cms->trans('Marine') . ' (' . $plr['marinewonpct'] . '%)', 'color1' => 'cc0000', 'color2' => '00cc00', 'width' => 130)); $cms->filter('left_column_actions', $actions); foreach (array_keys($actions) as $i) { if ($actions[$i]['type'] == 'dual_bar') { $actions[$i]['value'] = dual_bar($actions[$i]['value']); } else { $actions[$i]['value'] = pct_bar($actions[$i]['value']); } } $theme->assign(array('mod_actions' => $actions, 'mod_actions_title' => $cms->trans("Team / Action Profile"))); $output = $theme->parse($tpl); $theme->assign('player_left_column_mod', $output); } }
function player_left_column_mod(&$plr, &$theme) { global $cms; $tpl = 'player_left_column_mod'; if ($theme->template_found($tpl, false)) { $actions = array(); $joined = $plr['joinedterrorist'] + $plr['joinedct']; if ($joined) { $pct1 = sprintf('%0.02f', $plr['joinedterrorist'] / $joined * 100); $pct2 = sprintf('%0.02f', $plr['joinedct'] / $joined * 100); } else { $pct1 = $pct2 = 0; } $actions['joined'] = array('label' => $cms->trans("T / CT Joins"), 'type' => 'dual_bar', 'value' => array('pct1' => $pct1, 'pct2' => $pct2, 'title1' => $plr['joinedterrorist'] . ' ' . $cms->trans('Terrorists') . ' (' . $pct1 . '%)', 'title2' => $plr['joinedct'] . ' ' . $cms->trans('CT') . ' (' . $pct2 . '%)', 'color1' => 'cc0000', 'color2' => '00cc00', 'width' => 130)); $actions['won'] = array('label' => $cms->trans("T / CT Wins"), 'type' => 'dual_bar', 'value' => array('pct1' => $plr['terroristwonpct'], 'pct2' => $plr['ctwonpct'], 'title1' => $plr['terroristwon'] . ' ' . $cms->trans('Terrorist') . ' (' . $plr['terroristwonpct'] . '%)', 'title2' => $plr['ctwon'] . ' ' . $cms->trans('CT') . ' (' . $plr['ctwonpct'] . '%)', 'color1' => 'cc0000', 'color2' => '00cc00', 'width' => 130)); $actions['bombexploded'] = array('label' => $cms->trans("Bombs Exploded"), 'type' => 'dual_bar', 'value' => array('pct1' => $plr['bombexplodedpct'], 'pct2' => $plr['bombplantedpct'], 'title1' => $plr['bombexploded'] . ' ' . $cms->trans('exploded') . ' (' . $plr['bombexplodedpct'] . '%)', 'title2' => $plr['bombplanted'] . ' ' . $cms->trans('planted'), 'color1' => 'cc0000', 'color2' => '00cc00', 'width' => 130)); $actions['bombdefused'] = array('label' => $cms->trans("Bombs Defused %"), 'type' => 'pct_bar', 'value' => array('pct' => $plr['bombdefusedpct'], 'title' => $plr['bombdefused'] . ' ' . $cms->trans('bombs defused') . ' (' . $plr['bombdefusedpct'] . '%)', 'color1' => 'cc0000', 'color2' => '00cc00', 'width' => 130)); $actions['rescuedhostages'] = array('label' => $cms->trans("Rescued Hostages"), 'type' => 'pct_bar', 'value' => array('pct' => $plr['rescuedhostagespct'], 'title' => $plr['rescuedhostages'] . ' ' . $cms->trans('hostages saved') . ' (' . $plr['rescuedhostagespct'] . '%)', 'color1' => 'cc0000', 'color2' => '00cc00', 'width' => 130)); $cms->filter('left_column_actions', $actions); foreach (array_keys($actions) as $i) { if ($actions[$i]['type'] == 'dual_bar') { $actions[$i]['value'] = dual_bar($actions[$i]['value']); } else { $actions[$i]['value'] = pct_bar($actions[$i]['value']); } } $theme->assign(array('mod_actions' => $actions, 'mod_actions_title' => $cms->trans("Team / Action Profile"))); $output = $theme->parse($tpl, false); $theme->assign('player_left_column_mod', $output); } }
function player_left_column_mod(&$plr, &$theme) { global $cms; static $strings = array(); if (!$strings) { $strings = array('won' => $cms->trans("Bravo / Alpha Wins"), 'flagscaptured' => $cms->trans("Flags Captured"), 'flagsdefended' => $cms->trans("Flags Recovered")); } $tpl = 'player_left_column_mod'; if ($theme->template_found($tpl, false)) { $actions = array(); foreach (array_keys($strings) as $var) { $actions[$var] = array('what' => $var, 'label' => $strings[$var], 'type' => 'dual_bar', 'value' => array('pct1' => $plr['bravo' . $var . 'pct'], 'pct2' => $plr['alpha' . $var . 'pct'], 'title1' => $plr['bravo' . $var] . ' ' . $cms->trans('Bravo') . ' (' . $plr['bravo' . $var . 'pct'] . '%)', 'title2' => $plr['alpha' . $var] . ' ' . $cms->trans('Alpha') . ' (' . $plr['alpha' . $var . 'pct'] . '%)', 'color1' => 'cc0000', 'color2' => '0000cc', 'width' => 130)); } $cms->filter('left_column_actions', $actions); foreach (array_keys($actions) as $i) { if ($actions[$i]['type'] == 'dual_bar') { $actions[$i]['value'] = dual_bar($actions[$i]['value']); } else { $actions[$i]['value'] = pct_bar($actions[$i]['value']); } } $theme->assign(array('mod_actions' => $actions, 'mod_actions_title' => $cms->trans("Team / Action Profile"))); $output = $theme->parse($tpl); $theme->assign('player_left_column_mod', $output); } }
function player_left_column_mod(&$plr, &$theme) { global $cms; $tpl = 'player_left_column_mod'; if ($theme->template_found($tpl, false)) { $actions = array(); $joined = $plr['joinedaxis'] + $plr['joinedallies']; if ($joined) { $pct1 = sprintf('%0.02f', $plr['joinedaxis'] / $joined * 100); $pct2 = sprintf('%0.02f', $plr['joinedallies'] / $joined * 100); } else { $pct1 = $pct2 = 0; } $actions['kills'] = array('label' => $cms->trans("Axis / Ally Kills"), 'type' => 'dual_bar', 'value' => array('pct1' => $plr['axiskillspct'], 'pct2' => $plr['allieskillspct'], 'title1' => commify($plr['axiskills']) . ' ' . $cms->trans('axis') . ' (' . $plr['axiskillspct'] . '%)', 'title2' => commify($plr['allieskills']) . ' ' . $cms->trans('ally') . ' (' . $plr['allieskillspct'] . '%)', 'width' => 130)); $cms->filter('left_column_actions', $actions); foreach (array_keys($actions) as $i) { if ($actions[$i]['type'] == 'dual_bar') { $actions[$i]['value'] = dual_bar($actions[$i]['value']); } else { $actions[$i]['value'] = pct_bar($actions[$i]['value']); } } $theme->assign(array('mod_actions' => $actions, 'mod_actions_title' => $cms->trans("Team / Action Profile"))); $output = $theme->parse($tpl); $theme->assign('player_left_column_mod', $output); } }
function headshotkills_pct($name, $weapon) { global $cms, $max; return pct_bar(array('pct' => $weapon['scaledheadshotkillspct'], 'title' => $cms->trans('Overall headshot kills percentage') . ' (' . $weapon['realheadshotkillspct'] . '%)', 'color1' => 'cc0000', 'color2' => '00cc00')); }
function activity_bar($pct) { $out = pct_bar(array('pct' => $pct)); return $out; }
/** Creates a non-image percentage bar with defined width and color. color can scale from two colors depending on the percentage value. **/ function smarty_function_pctbar($args, &$smarty) { return pct_bar($args); }
function player_left_column_mod(&$plr, &$theme) { global $cms; parent::player_left_column_mod($plr, $theme); $tpl = 'player_left_column_mod'; if ($theme->template_found($tpl, false)) { $actions = $theme->get_template_vars('mod_actions'); if (!is_array($actions)) { $actions = array(); } // remove actions that are not relevant to GG //unset($actions['bombexploded'], $actions['bombdefused'],$actions['rescuedhostages'],...); $actions['winsgained'] = array('label' => $cms->trans("Wins Gained"), 'type' => 'pct_bar', 'value' => array('pct' => $plr['winsgainedpct'], 'title' => $plr['winsgained'] . ' ' . $cms->trans('wins gained') . ' (' . $plr['winsgainedpct'] . '%)', 'color1' => 'cc0000', 'color2' => '00cc00', 'width' => 130)); $cms->filter('left_column_actions', $actions); foreach (array_keys($actions) as $i) { // if the value is not an array then it's been processed // already from the sub-class. if (!is_array($actions[$i]['value'])) { continue; } if ($actions[$i]['type'] == 'dual_bar') { $actions[$i]['value'] = dual_bar($actions[$i]['value']); } else { $actions[$i]['value'] = pct_bar($actions[$i]['value']); } } $theme->assign(array('mod_actions' => $actions)); $output = $theme->parse($tpl, false); $theme->assign('player_left_column_mod', $output); } }