mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
fix regenrate oasis troops
This commit is contained in:
@@ -4341,11 +4341,12 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
|
||||
private function regenerateOasisTroops() {
|
||||
global $database;
|
||||
$time = time();
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "odata where conqured = 0 and $time - lastupdated > 3600";
|
||||
$time2 = NATURE_REGTIME;
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "odata where conqured = 0 and $time - lastupdated2 > $time2";
|
||||
$array = $database->query_return($q);
|
||||
foreach($array as $oasis) {
|
||||
$database->populateOasisUnits($oasis['wref'],$oasis['high']);
|
||||
$database->updateOasis($oasis['wref']);
|
||||
$database->updateOasis2($oasis['wref']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1461,12 +1461,18 @@ class MYSQL_DB {
|
||||
$q = "UPDATE " . TB_PREFIX . "vdata set lastupdate = $time where wref = $vid";
|
||||
return mysql_query($q, $this->connection);
|
||||
}
|
||||
|
||||
function updateOasis($vid) {
|
||||
$time = time();
|
||||
$q = "UPDATE " . TB_PREFIX . "odata set lastupdated = $time where wref = $vid";
|
||||
return mysql_query($q, $this->connection);
|
||||
}
|
||||
|
||||
|
||||
function updateOasis2($vid) {
|
||||
$time = time();
|
||||
$q = "UPDATE " . TB_PREFIX . "odata set lastupdated2 = $time where wref = $vid";
|
||||
return mysql_query($q, $this->connection);
|
||||
}
|
||||
|
||||
function setVillageName($vid, $name) {
|
||||
if(!empty($name))
|
||||
@@ -2823,7 +2829,7 @@ class MYSQL_DB {
|
||||
$wid = $row['id'];
|
||||
$basearray = $this->getOMInfo($wid);
|
||||
//We switch type of oasis and instert record with apropriate infomation.
|
||||
$q = "INSERT into " . TB_PREFIX . "odata VALUES ('" . $basearray['id'] . "'," . $basearray['oasistype'] . ",0,800,800,800,800,800,800," . time() . ",100,2,'Unoccupied Oasis',".rand(0,2).")";
|
||||
$q = "INSERT into " . TB_PREFIX . "odata VALUES ('" . $basearray['id'] . "'," . $basearray['oasistype'] . ",0,800,800,800,800,800,800," . time() . "," . time() . ",100,2,'Unoccupied Oasis',".rand(0,2).")";
|
||||
$result = mysql_query($q, $this->connection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1464,12 +1464,18 @@ class MYSQLi_DB {
|
||||
$q = "UPDATE " . TB_PREFIX . "vdata set lastupdate = $time where wref = $vid";
|
||||
return mysqli_query($this->connection, $q);
|
||||
}
|
||||
|
||||
function updateOasis($vid) {
|
||||
$time = time();
|
||||
$q = "UPDATE " . TB_PREFIX . "odata set lastupdated = $time where wref = $vid";
|
||||
return mysqli_query($this->connection, $q);
|
||||
}
|
||||
|
||||
|
||||
function updateOasis2($vid) {
|
||||
$time = time();
|
||||
$q = "UPDATE " . TB_PREFIX . "odata set lastupdated2 = $time where wref = $vid";
|
||||
return mysqli_query($this->connection, $q);
|
||||
}
|
||||
|
||||
function setVillageName($vid, $name) {
|
||||
if(!empty($name))
|
||||
@@ -2826,7 +2832,7 @@ class MYSQLi_DB {
|
||||
$wid = $row['id'];
|
||||
$basearray = $this->getOMInfo($wid);
|
||||
//We switch type of oasis and instert record with apropriate infomation.
|
||||
$q = "INSERT into " . TB_PREFIX . "odata VALUES ('" . $basearray['id'] . "'," . $basearray['oasistype'] . ",0,800,800,800,800,800,800," . time() . ",100,2,'Unoccupied Oasis',".rand(0,2).")";
|
||||
$q = "INSERT into " . TB_PREFIX . "odata VALUES ('" . $basearray['id'] . "'," . $basearray['oasistype'] . ",0,800,800,800,800,800,800," . time() . "," . time() . ",100,2,'Unoccupied Oasis',".rand(0,2).")";
|
||||
$result = mysqli_query($this->connection, $q);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1036,6 +1036,7 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%odata` (
|
||||
`crop` int(11) unsigned NOT NULL,
|
||||
`maxcrop` int(11) unsigned NOT NULL,
|
||||
`lastupdated` int(11) unsigned NOT NULL,
|
||||
`lastupdated2` int(11) unsigned NOT NULL,
|
||||
`loyalty` int(11) NOT NULL DEFAULT '100',
|
||||
`owner` int(11) unsigned NOT NULL DEFAULT '2',
|
||||
`name` varchar(32) NOT NULL DEFAULT 'Unoccupied Oasis',
|
||||
|
||||
Reference in New Issue
Block a user