Exemple #1
0
 /**
  * @return WotClan the static model class
  */
 public static function currentClan()
 {
     if (empty(self::$_clan)) {
         if (!isset(Yii::app()->params['clan'])) {
             throw new CException('You need specify clan in config params');
         }
         self::$_clan = self::model()->findByPk(Yii::app()->params['clan']);
     }
     return self::$_clan;
 }
Exemple #2
0
$cs->registerScriptFile('/scripts/index.js', CClientScript::POS_END);
$cs->registerScript($this->getId() . 'Index', 'Index.initPeityElements();', CClientScript::POS_READY);
?>
<!-- BEGIN OVERVIEW STATISTIC BARS-->
<div class="row stats-overview-cont">
	<?php 
$historyValues = WotClan::currentClan()->historyValues('ivanner_pos');
foreach ($historyValues as &$value) {
    $value = (1 - $value / 400) * 100;
}
$this->renderPartial('_stat_block', array('increment' => -1 * WotClan::currentClan()->increment('ivanner_pos'), 'historyValues' => $historyValues, 'tittle' => 'Рейтинг клана (Ivanner)', 'position' => (1 - WotClan::currentClan()->ivanner_pos / 400) * 100, 'number' => WotClan::currentClan()->ivanner_pos));
$this->renderPartial('_stat_block', array('increment' => WotClan::currentClan()->increment('ivanner_strength'), 'historyValues' => WotClan::currentClan()->historyValues('ivanner_strength'), 'tittle' => 'Сила клана (Ivanner)', 'position' => WotClan::currentClan()->ivanner_strength / 10, 'number' => WotClan::currentClan()->ivanner_strength));
$this->renderPartial('_stat_block', array('increment' => WotClan::currentClan()->increment('ivanner_firepower'), 'historyValues' => WotClan::currentClan()->historyValues('ivanner_firepower'), 'tittle' => 'Огневая мощь (Ivanner)', 'position' => WotClan::currentClan()->ivanner_firepower, 'number' => WotClan::currentClan()->ivanner_firepower));
$this->renderPartial('_stat_block', array('increment' => WotClan::currentClan()->increment('ivanner_skill'), 'historyValues' => WotClan::currentClan()->historyValues('ivanner_skill'), 'position' => WotClan::currentClan()->ivanner_skill, 'tittle' => 'Скил (Ivanner)', 'number' => WotClan::currentClan()->ivanner_skill));
$this->renderPartial('_stat_block', array('increment' => WotClan::currentClan()->increment('players_count'), 'historyValues' => WotClan::currentClan()->historyValues('players_count'), 'position' => WotClan::currentClan()->players_count, 'tittle' => 'Кол-во игроков', 'number' => WotClan::currentClan()->players_count));
$this->renderPartial('_stat_block', array('increment' => number_format(WotClan::currentClan()->increment('players_wn8'), 2), 'historyValues' => WotClan::currentClan()->historyValues('players_wn8', 2900), 'position' => WotClan::currentClan()->players_wn8 / 2900 * 100, 'tittle' => 'Wn8 клана', 'number' => WotClan::currentClan()->players_wn8));
?>
	
</div>
<div class="clearfix">
</div>
<!-- END OVERVIEW STATISTIC BARS-->
<div class="row-fluid">
	<div class="col-md-4">
		<!-- BEGIN SAMPLE TABLE widget-->
		<div class="portlet">
			<div class="portlet-title">
				<div class="caption">
					<i class="fa fa-cogs"></i>Топ 5 по эффективности
				</div>
			</div>
Exemple #3
0
 public static function getDefaultParams()
 {
     $userId = Yii::app()->user->id;
     return array('clan' => WotClan::currentClan()->clan_id, 'player' => Yii::app()->user->id);
 }
 public static function scanClan($clanId)
 {
     self::updateTanks();
     $clan = WotClan::model()->findByPk($clanId);
     if (empty($clan)) {
         $clan = new WotClan();
         $clan->clan_id = $clanId;
     }
     self::updateClanInfo($clan);
     self::updateClanPlayersInfo($clan);
     $clan->refresh();
     foreach ($clan->players as $player) {
         self::updatePlayerTanks($player);
         self::updatePlayerGlory($player);
     }
     WotPlayer::calcRating();
 }
Exemple #5
0
    public static function calcRating()
    {
        $sql = <<<SQL
UPDATE wot_player wp
  JOIN 
(SELECT 
  wps.player_id, 
  (1240-1040/POWER(LEAST(a.midl,6),0.164))*wps.frags/wps.battles
  +wps.damage_dealt/wps.battles*530/(184*EXP(0.24*a.midl)+130)
  +wps.spotted/wps.battles*125
  +LEAST(wps.dropped_capture_points/wps.battles,2.2)*100
  +((185/(0.17+EXP((wps.wins/wps.battles*100-35)*-0.134)))-500)*0.45
  +(6-LEAST(a.midl,6))*-60 wn6,

  (1240-1040/POWER(LEAST(a.midl,6),0.164))*wps.frags/wps.battles
  +wps.damage_dealt/wps.battles*530/(184*EXP(0.24*a.midl)+130)
  +wps.spotted/wps.battles*125*LEAST(a.midl,3)/3
  +LEAST(wps.dropped_capture_points/wps.battles,2.2)*100
  +((185/(0.17+EXP((wps.wins/wps.battles*100-35)*-0.134)))-500)*0.45
  -((5-LEAST(a.midl,5))*125)/(1+EXP((a.midl-POWER(wps.battles/220,3/a.midl))*1.5)) wn7,
       
  wps.damage_dealt/wps.battles*(10/(a.midl+2))*(0.23+2*a.midl/100)
  +250*wps.frags/wps.battles
  +wps.spotted/wps.battles*150
  +log(1.732,wps.capture_points/wps.battles+1)*150
  +wps.dropped_capture_points/wps.battles*150 effect,
  
  980*a.rDAMAGEc + 210*a.rDAMAGEc*a.rFRAGc + 155*a.rFRAGc*a.rSPOTc + 75*a.rDEFc*a.rFRAGc + 145*LEAST(1.8,a.rWINc) wn8

  FROM wot_player_statistic wps
  JOIN (SELECT
      wpt.player_id,
      SUM(wt.tank_level * wpt.battles)/wps.battles midl,
      GREATEST(0,(wps.damage_dealt/SUM(etv.dmg*wpt.battles)-0.22)/(1-0.22)) rDAMAGEc,
      GREATEST(0,LEAST(wps.damage_dealt/SUM(etv.dmg*wpt.battles)+0.2,(wps.frags/SUM(etv.frag*wpt.battles)-0.12)/(1-0.12))) rFRAGc,
      GREATEST(0,LEAST(wps.damage_dealt/SUM(etv.dmg*wpt.battles)+0.1,(wps.spotted/SUM(etv.spot*wpt.battles)-0.38)/(1-0.38))) rSPOTc,
      GREATEST(0,LEAST(wps.damage_dealt/SUM(etv.dmg*wpt.battles)+0.1,(wps.dropped_capture_points/SUM(etv.def*wpt.battles)-0.10)/(1-0.10))) rDEFc,
      GREATEST(0,(wps.wins/SUM(etv.win/100*wpt.battles)-0.71)/(1-0.71)) rWINc
    FROM wot_player_tank wpt
    JOIN wot_player_statistic wps ON wpt.player_id = wps.player_id AND wps.statistic_id=1
    JOIN wot_tank wt ON wt.tank_id = wpt.tank_id
    LEFT JOIN wot_wn8_etv etv ON etv.IDNum=wpt.tank_id
    JOIN wot_player_clan wpc ON wpt.player_id = wpc.player_id AND wpc.escape_date IS NULL AND wpc.clan_id=:clan
    GROUP BY wpt.player_id) a ON a.player_id = wps.player_id
    WHERE wps.statistic_id=1) a ON a.player_id=wp.player_id
  SET wp.wn6=a.wn6, wp.wn7=a.wn7, wp.wn8=a.wn8, wp.effect=a.effect
SQL;
        Yii::app()->db->createCommand($sql)->execute(array('clan' => WotClan::currentClan()->clan_id));
    }
Exemple #6
0
<link href="/css/themes/default.css" rel="stylesheet" type="text/css" id="style_color"/>
<link href="/css/custom.css" rel="stylesheet" type="text/css"/>
<!-- END THEME STYLES -->
<!--  link rel="shortcut icon" href="/favicon.ico"/ -->
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body class="page-header-fixed">
<!-- BEGIN HEADER -->
<div class="header navbar navbar-inverse navbar-fixed-top">
	<!-- BEGIN TOP NAVIGATION BAR -->
	<div class="header-inner">
		<!-- BEGIN LOGO -->
		<a class="navbar-brand" href="/">
		<img src="<?php 
echo WotClan::currentClan()->clan_ico;
?>
" alt="logo" class="img-responsive"/>
		</a>
		<!-- END LOGO -->
		<!-- BEGIN RESPONSIVE MENU TOGGLER -->
		<a href="javascript:;" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
		<img src="/img/menu-toggler.png" alt=""/>
		</a>
		<!-- END RESPONSIVE MENU TOGGLER -->		
		<!-- BEGIN TOP NAVIGATION MENU -->
		<ul class="nav navbar-nav pull-right">			
			<li class="devider">
				 &nbsp;
			</li>
			<?php 
    public function actionClanStat()
    {
        $sql = <<<SQL
UPDATE wot_clan wc
  JOIN (SELECT wpc.clan_id, SUM(wps.wins)/SUM(wps.battles)*100 players_pp, SUM(wp.wn8)/COUNT(wp.player_id) players_wn8, count(1) players_count
          FROM wot_player wp
          JOIN wot_player_clan wpc ON wp.player_id = wpc.player_id AND wpc.escape_date IS NULL AND wpc.clan_id=:clan
          JOIN wot_player_statistic wps ON wp.player_id = wps.player_id AND wps.statistic_id=1
          GROUP BY wpc.clan_id) a ON a.clan_id=wc.clan_id
  SET wc.players_pp=a.players_pp, wc.players_wn8=a.players_wn8, wc.players_count=a.players_count
SQL;
        Yii::app()->db->createCommand($sql)->execute(array('clan' => WotClan::currentClan()->clan_id));
    }
 public function actionGk()
 {
     WotService::updateClanProvinces(WotClan::currentClan());
 }