Update db_MYSQL.php

This commit is contained in:
Shadow
2013-12-13 17:09:21 +02:00
parent 901915a22b
commit 1fee200d1e
+8 -26
View File
@@ -367,40 +367,20 @@ class MYSQL_DB {
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) {
$num_rows = 0;
$count_while = 0;
while (!$num_rows){
if (!$mode) {
$gamesday=time()-COMMENCE;
if ($gamesday<3600*24*10) { //10 day
if ($gamesday<3600*24*10 && $count_while==0) { //10 day
$wide1=1;
$wide2=20;
} elseif ($gamesday<3600*24*20) { //20 day
} elseif ($gamesday<3600*24*20 && $count_while==1) { //20 day
$wide1=20;
$wide2=40;
} elseif ($gamesday<3600*24*30) { //30 day
} elseif ($gamesday<3600*24*30 && $count_while==2) { //30 day
$wide1=40;
$wide2=80;
} else { // over 30 day
@@ -428,6 +408,8 @@ class MYSQL_DB {
}
$result = mysql_query($q, $this->connection);
$num_rows = mysql_num_rows($result);
$count_while++;
}
$result = $this->mysql_fetch_all($result);
$base = rand(0, ($num_rows-1));
return $result[$base]['id'];