Главная » Статьи » Xnova MoD

Зал Славы для xgp
Версия 0.1-Нормальный xnova
Версия 0,2-Адаптирован для 2.9.3
Версия 0,3-Адаптирован missioncaseattake.php для 2.9.3
Версия 0,4-Работоспособен для 2.9.3

Добавляем в базу запрос, создаём "game_topkb"

Code
CREATE TABLE IF NOT EXISTS `game_topkb` (
  `id` bigint(11) unsigned NOT NULL auto_increment,
  `id_owner1` bigint(20) NOT NULL default '0',
  `angreifer` varchar(64) NOT NULL default '',
  `id_owner2` bigint(20) NOT NULL default '0',
  `defender` varchar(64) NOT NULL default '',
  `gesamtunits` bigint(20) NOT NULL default '0',
  `gesamttruemmer` bigint(20) NOT NULL default '0',
  `rid` varchar(72) NOT NULL default '',
  `raport` text NOT NULL,
  `fleetresult` varchar(64) NOT NULL default '',
  `a_zestrzelona` tinyint(3) unsigned NOT NULL default '0',
  `time` int(10) unsigned NOT NULL default '0',
  KEY `id_owner1` (`id_owner1`,`rid`),
  KEY `id_owner2` (`id_owner2`,`rid`),
  KEY `time` (`time`),
  FULLTEXT KEY `raport` (`raport`),
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Добавляем в базу запрос, создаём таблицы
Code
ALTER TABLE game_users ADD `hof` int( 1 ) NOT NULL Default '1';
ALTER TABLE game_users ADD `wons` bigint(20) NOT NULL default '0';
ALTER TABLE game_users ADD `loos` bigint(20) NOT NULL default '0';
ALTER TABLE game_users ADD `draws` bigint(20) NOT NULL default '0';
ALTER TABLE game_users ADD `kbmetal` bigint(20) NOT NULL default '0';
ALTER TABLE game_users ADD `kbcrystal` bigint(20) NOT NULL default '0';
ALTER TABLE game_users ADD `lostunits` bigint(20) NOT NULL default '0';
ALTER TABLE game_users ADD `desunits` bigint(20) NOT NULL default '0';

Открываем includes/classes/class.FlyingFleetHandler.php
Ищем строчку

Code
$raport = $formatted_cr['html'];

заменить на...

Code
foreach($attackFleets as $fleetID => $attackeruser)
  {
  $Attacker['id'][] = $attackeruser['user']['id'];
  $Attacker['name'][] = $attackeruser['user']['username'];
  }

  foreach($defense as $fleetID => $defenderuser)
  {
  $Defender['id'][] = $defenderuser['user']['id'];
  $Defender['name'][] = $defenderuser['user']['username'];
  }
   
  $Attacker['id'] = array_unique($Attacker['id'], SORT_NUMERIC);
  $Attacker['name'] = array_unique($Attacker['name'], SORT_NUMERIC);
  $Defender['id'] = array_unique($Defender['id'], SORT_NUMERIC);
  $Defender['name'] = array_unique($Defender['name'], SORT_NUMERIC);
   
  $WhereAtt = "";
  $WhereDef = "";
   
  foreach($Attacker['id'] as $id)
  {
  $WhereAtt .= "`id` = '".$id."' OR ";
  }
   
  foreach($Defender['id'] as $id)
  {
  $WhereDef .= "`id` = '".$id."' OR ";
  }

  $Won = 0;
  $Lose = 0;  
  $Draw = 0;
  switch($result['won'])
  {
  case "a":
  $Won = 1;
  break;
  case "w":
  $Draw = 1;
  break;
  case "r":
  $Lose = 1;
  break;
  }
  $raport = $formatted_cr['html'];

Ищем далее...
Code
doquery($QryInsertRapport,'rw') or die("Error inserting CR to database".mysql_error()."

Trying to execute:".mysql_query());

Добовляем после (e logo a seguir colocamos isto)

Code
$QryInserttopkb = "INSERT INTO {{table}} SET ";
  $QryInserttopkb .= "`time` = UNIX_TIMESTAMP(), ";
  $QryInserttopkb .= "`id_owner1` = '".implode(',', $Attacker['id'])."', ";
  $QryInserttopkb .= "`angreifer` = '".implode(' & ', $Attacker['name'])."', ";
  $QryInserttopkb .= "`id_owner2` = '".implode(',', $Defender['id'])."', ";
  $QryInserttopkb .= "`defender` = '".implode(' & ', $Defender['name'])."', ";
  $QryInserttopkb .= "`gesamtunits` = '".($result['lost']['att'] + $result['lost']['def'])."', ";
  $QryInserttopkb .= "`gesamttruemmer` = '".$FleetDebris."', ";
  $QryInserttopkb .= "`rid` = '". $rid ."', ";
  $QryInserttopkb .= "`a_zestrzelona` = '".count($result['rounds'])."', ";
  $QryInserttopkb .= "`raport` = '". mysql_real_escape_string( $raport ) ."',";
  $QryInserttopkb .= "`fleetresult` = '". $result['won'] ."';";  
  doquery("LOCK TABLE {{table}} WRITE", 'topkb');
  doquery( $QryInserttopkb , 'topkb');
  doquery("UNLOCK TABLES", '');  

  $QryUpdateuserstat = "UPDATE {{table}} SET ";
  $QryUpdateuserstat .= "`wons` = wons + ".$Won.", ";
  $QryUpdateuserstat .= "`loos` = loos + ".$Lose.", ";
  $QryUpdateuserstat .= "`draws` = draws + ".$Draw.", ";
  $QryUpdateuserstat .= "`kbmetal` = kbmetal + ".($result['debree']['att'][0]+$result['debree']['def'][0]).", ";
  $QryUpdateuserstat .= "`kbcrystal` = kbcrystal + ".($result['debree']['att'][1]+$result['debree']['def'][1]).", ";
  $QryUpdateuserstat .= "`lostunits` = lostunits + ".$result['lost']['att'].", ";
  $QryUpdateuserstat .= "`desunits` = desunits + ".$result['lost']['def']." ";
  $QryUpdateuserstat .= "WHERE ";
  $QryUpdateuserstat .= substr($WhereAtt, 0, -4).";";
  doquery ( $QryUpdateuserstat , 'users');
   
  $QryUpdateuserstat = "UPDATE {{table}} SET ";
  $QryUpdateuserstat .= "`wons` = wons + ". $Lose .", ";
  $QryUpdateuserstat .= "`loos` = loos + ". $Won .", ";
  $QryUpdateuserstat .= "`draws` = draws + ". $Draw .", ";
  $QryUpdateuserstat .= "`kbmetal` = kbmetal + ".($result['debree']['att'][0]+$result['debree']['def'][0]).", ";
  $QryUpdateuserstat .= "`kbcrystal` = kbcrystal + ".($result['debree']['att'][1]+$result['debree']['def'][1]).", ";
  $QryUpdateuserstat .= "`lostunits` = lostunits + ".$result['lost']['def'].", ";
  $QryUpdateuserstat .= "`desunits` = desunits + ".$result['lost']['att']." ";
  $QryUpdateuserstat .= "WHERE ";
  $QryUpdateuserstat .= substr($WhereDef, 0, -4).";";
  doquery ( $QryUpdateuserstat , 'users');

http://vel3evul.ucoz.ru/Files/mod_topkb.rar
Категория: Xnova MoD | Добавил: Cerberus (16.04.2010)
Просмотров: 1820 | Теги: Xnova MoD | Рейтинг: 0.0/0