mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-09-03 17:07:17 +00:00
Update db_MYSQL.php
This commit is contained in:
@@ -367,40 +367,20 @@ class MYSQL_DB {
|
|||||||
return mysql_query($q, $this->connection);
|
return mysql_query($q, $this->connection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
function generateBase($sector) {
|
|
||||||
switch($sector) {
|
|
||||||
case 1:
|
|
||||||
$q = "Select * from ".TB_PREFIX."wdata where fieldtype = 3 and x < 0 and y > 0 and occupied = 0";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
$q = "Select * from ".TB_PREFIX."wdata where fieldtype = 3 and x > 0 and y > 0 and occupied = 0";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
$q = "Select * from ".TB_PREFIX."wdata where fieldtype = 3 and x < 0 and y < 0 and occupied = 0";
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
$q = "Select * from ".TB_PREFIX."wdata where fieldtype = 3 and x > 0 and y < 0 and occupied = 0";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$result = mysql_query($q, $this->connection);
|
|
||||||
$num_rows = mysql_num_rows($result);
|
|
||||||
$result = $this->mysql_fetch_all($result);
|
|
||||||
$base = rand(0, ($num_rows-1));
|
|
||||||
return $result[$base]['id'];
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
function generateBase($sector, $mode=1) {
|
function generateBase($sector, $mode=1) {
|
||||||
|
$num_rows = 0;
|
||||||
|
$count_while = 0;
|
||||||
|
while (!$num_rows){
|
||||||
if (!$mode) {
|
if (!$mode) {
|
||||||
$gamesday=time()-COMMENCE;
|
$gamesday=time()-COMMENCE;
|
||||||
if ($gamesday<3600*24*10) { //10 day
|
if ($gamesday<3600*24*10 && $count_while==0) { //10 day
|
||||||
$wide1=1;
|
$wide1=1;
|
||||||
$wide2=20;
|
$wide2=20;
|
||||||
} elseif ($gamesday<3600*24*20) { //20 day
|
} elseif ($gamesday<3600*24*20 && $count_while==1) { //20 day
|
||||||
$wide1=20;
|
$wide1=20;
|
||||||
$wide2=40;
|
$wide2=40;
|
||||||
} elseif ($gamesday<3600*24*30) { //30 day
|
} elseif ($gamesday<3600*24*30 && $count_while==2) { //30 day
|
||||||
$wide1=40;
|
$wide1=40;
|
||||||
$wide2=80;
|
$wide2=80;
|
||||||
} else { // over 30 day
|
} else { // over 30 day
|
||||||
@@ -428,6 +408,8 @@ class MYSQL_DB {
|
|||||||
}
|
}
|
||||||
$result = mysql_query($q, $this->connection);
|
$result = mysql_query($q, $this->connection);
|
||||||
$num_rows = mysql_num_rows($result);
|
$num_rows = mysql_num_rows($result);
|
||||||
|
$count_while++;
|
||||||
|
}
|
||||||
$result = $this->mysql_fetch_all($result);
|
$result = $this->mysql_fetch_all($result);
|
||||||
$base = rand(0, ($num_rows-1));
|
$base = rand(0, ($num_rows-1));
|
||||||
return $result[$base]['id'];
|
return $result[$base]['id'];
|
||||||
|
|||||||
Reference in New Issue
Block a user