From fdc11a8408b3242007bb7623a09264b7ada96b20 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 2 Sep 2012 21:25:47 +0300 Subject: [PATCH] more updates --- GameEngine/Automation.php | 2 ++ GameEngine/Database/db_MYSQL.php | 61 +++++++++++++++++++++++++++++++- install/include/oasis.php | 2 +- 3 files changed, 63 insertions(+), 2 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index a26e7e9a..cfc574b5 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -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")) { diff --git a/GameEngine/Database/db_MYSQL.php b/GameEngine/Database/db_MYSQL.php index 5812666d..c64d4c45 100644 --- a/GameEngine/Database/db_MYSQL.php +++ b/GameEngine/Database/db_MYSQL.php @@ -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)) { diff --git a/install/include/oasis.php b/install/include/oasis.php index 030298d2..c11472cd 100644 --- a/install/include/oasis.php +++ b/install/include/oasis.php @@ -11,7 +11,7 @@ $database->populateOasisdata(); $database->populateOasis(); - $database->populateOasisUnits(); + $database->populateOasisUnits2();