mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-08 21:56:09 +00:00
add attacks and casualties statistics
This commit is contained in:
@@ -2908,7 +2908,38 @@
|
||||
$crop *= SPEED;
|
||||
return $crop;
|
||||
}
|
||||
|
||||
//general statistics
|
||||
|
||||
function addGeneralAttack($casualties) {
|
||||
$time = time();
|
||||
$q = "INSERT INTO " . TB_PREFIX . "general values (0,'$casualties','$time',1)";
|
||||
return mysql_query($q, $this->connection) or die(mysql_error());
|
||||
}
|
||||
|
||||
function getAttackByDate($time) {
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "general where shown = 1";
|
||||
$result = $this->query_return($q);
|
||||
$attack = 0;
|
||||
foreach($result as $general){
|
||||
if(date("j. M",$time) == date("j. M",$general['time'])){
|
||||
$attack += 1;
|
||||
}
|
||||
}
|
||||
return $attack;
|
||||
}
|
||||
|
||||
function getAttackCasualties($time) {
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "general where shown = 1";
|
||||
$result = $this->query_return($q);
|
||||
$casualties = 0;
|
||||
foreach($result as $general){
|
||||
if(date("j. M",$time) == date("j. M",$general['time'])){
|
||||
$casualties += $general['casualties'];
|
||||
}
|
||||
}
|
||||
return $casualties;
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user