more updates

This commit is contained in:
unknown
2012-09-02 21:25:47 +03:00
parent 11a3cdae35
commit fdc11a8408
3 changed files with 63 additions and 2 deletions
+2
View File
@@ -402,6 +402,8 @@ class Automation {
$database->query($q);
$q = "DELETE FROM ".TB_PREFIX."users where id = ".$need['uid'];
$database->query($q);
$q = "DELETE FROM ".TB_PREFIX."deleting where uid = ".$need['uid'];
$database->query($q);
}
}
if(file_exists("GameEngine/Prevention/cleardeleting.txt")) {
+60 -1
View File
@@ -508,7 +508,66 @@ class MYSQL_DB {
}
}
function populateOasisUnits() {
function populateOasisUnits($wid, $high) {
$basearray = $this->getMInfo($wid);
$basearray = $this->getOasisInfo($wid);
if($basearray2['high'] == 0){
$max = rand(15,30);
}elseif($basearray2['high'] == 1){
$max = rand(70,90);
}elseif($basearray2['high'] == 2){
$max = rand(100,140);
}
//each Troop is a Set for oasis type like mountains have rats spiders and snakes fields tigers elphants clay wolves so on stonger one more not so less
switch($basearray['oasistype']) {
case 1:
case 2:
//+25% lumber per hour
$q = "UPDATE " . TB_PREFIX . "units SET u35 = u35 + '".rand(0,5)."', u36 = u36 + '".rand(0,5)."', u37 = u37 + '".rand(0,5)."' WHERE vref = '" . $wid . "' AND (u36 <= ".$max." OR u37 <= ".$max.")";
$result = mysql_query($q, $this->connection);
break;
case 3:
//+25% lumber and +25% crop per hour
$q = "UPDATE " . TB_PREFIX . "units SET u35 = u35 + '".rand(0,5)."', u36 = u36 + '".rand(0,5)."', u37 = u37 + '".rand(0,5)."', u38 = u38 + '".rand(0,5)."' WHERE vref = '" . $wid . "' AND (u36 <= ".$max." OR u37 <= ".$max." OR u38 <= ".$max.")";
$result = mysql_query($q, $this->connection);
break;
case 4:
case 5:
//+25% clay per hour
$q = "UPDATE " . TB_PREFIX . "units SET u36 = u36 + '".rand(0,5)."', u37 = u37 + '".rand(0,5)."' WHERE vref = '" . $wid . "' AND (u36 <= ".$max." OR u37 <= ".$max.")";
$result = mysql_query($q, $this->connection);
break;
case 6:
//+25% clay and +25% crop per hour
$q = "UPDATE " . TB_PREFIX . "units SET u36 = u36 + '".rand(0,5)."', u37 = u37 + '".rand(0,5)."', u38 = u38 + '".rand(0,5)."' WHERE vref = '" . $wid . "' AND (u36 <= ".$max." OR u37 <= ".$max." OR u38 <= ".$max.")";
$result = mysql_query($q, $this->connection);
break;
case 7:
case 8:
//+25% iron per hour
$q = "UPDATE " . TB_PREFIX . "units SET u31 = u31 + '".rand(0,5)."', u32 = u32 + '".rand(0,5)."', u34 = u34 + '".rand(0,5)."' WHERE vref = '" . $wid . "' AND (u31 <= ".$max." OR u32 <= ".$max.")";
$result = mysql_query($q, $this->connection);
break;
case 9:
//+25% iron and +25% crop
$q = "UPDATE " . TB_PREFIX . "units SET u31 = u31 + '".rand(0,5)."', u32 = u32 + '".rand(0,5)."', u34 = u34 + '".rand(0,5)."' WHERE vref = '" . $wid . "' AND (u31 <= ".$max." OR u32 <= ".$max." OR u34 <= ".$max.")";
$result = mysql_query($q, $this->connection);
break;
case 10:
case 11:
//+25% crop per hour
$q = "UPDATE " . TB_PREFIX . "units SET u33 = u33 + '".rand(0,5)."', u37 = u37 + '".rand(0,5)."', u38 = u38 + '".rand(0,5)."' WHERE vref = '" . $wid . "' AND (u33 <= ".$max." OR u37 <= ".$max." OR u38 <= ".$max.")";
$result = mysql_query($q, $this->connection);
break;
case 12:
//+50% crop per hour
$q = "UPDATE " . TB_PREFIX . "units SET u33 = u33 + '".rand(0,5)."', u37 = u37 + '".rand(0,5)."', u38 = u38 + '".rand(0,5)."', u39 = u39 + '".rand(0,5)."' WHERE vref = '" . $wid . "' AND (u33 <= ".$max." OR u37 <= ".$max." OR u38 <= ".$max.")";
$result = mysql_query($q, $this->connection);
break;
}
}
function populateOasisUnits2() {
$q2 = "SELECT * FROM " . TB_PREFIX . "wdata where oasistype != 0";
$result2 = mysql_query($q2, $this->connection);
while($row = mysql_fetch_array($result2)) {
+1 -1
View File
@@ -11,7 +11,7 @@
$database->populateOasisdata();
$database->populateOasis();
$database->populateOasisUnits();
$database->populateOasisUnits2();