From aede02f5f100f4896bb46982b19b9605e020eb8d Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 5 Jun 2012 20:14:34 +0300 Subject: [PATCH] fix ww buildingplans, fix pop and cp of ww and buildingplan villages, fix dissapering of chief when conquer village and add select password for create natars --- GameEngine/Admin/Mods/natarbuildingplan.php | 7 +- GameEngine/Admin/Mods/natarend.php | 6 +- GameEngine/Automation.php | 34 +++++- Templates/Build/wwupgrade.tpl | 11 +- create_account.php | 111 ++++++++++++++++++-- 5 files changed, 152 insertions(+), 17 deletions(-) diff --git a/GameEngine/Admin/Mods/natarbuildingplan.php b/GameEngine/Admin/Mods/natarbuildingplan.php index ea335298..acc3aed9 100644 --- a/GameEngine/Admin/Mods/natarbuildingplan.php +++ b/GameEngine/Admin/Mods/natarbuildingplan.php @@ -20,16 +20,15 @@ $amt = $_POST['vill_amount']; for($i=1;$i<=$amt;$i++) { $kid = rand(1,4); - $wid = $database->generateBase($kid); $database->setFieldTaken($wid); $time = time(); - $pop = rand(50,233); - $cp = $pop-1; - $q = "insert into ".TB_PREFIX."vdata (`wref`,`owner`,`name`,`capital`,`pop`,`cp`,`celebration`,`type`,`wood`,`clay`,`iron`,`maxstore`,`crop`,`maxcrop`,`lastupdate`,`loyalty`,`exp1`,`exp2`,`exp3`,`created`) values ('$wid','3','WW Buildingplan',0,$pop,$cp,0,0,80000.00,80000.00,80000.00,80000,80000.00,80000,1314974534,100,0,0,0,1314968914)"; + $q = "insert into ".TB_PREFIX."vdata (`wref`,`owner`,`name`,`capital`,`pop`,`cp`,`celebration`,`type`,`wood`,`clay`,`iron`,`maxstore`,`crop`,`maxcrop`,`lastupdate`,`loyalty`,`exp1`,`exp2`,`exp3`,`created`) values ('$wid','3','WW Buildingplan',0,0,0,0,0,80000.00,80000.00,80000.00,80000,80000.00,80000,1314974534,100,0,0,0,1314968914)"; mysql_query($q) or die(mysql_error()); $q = "insert into ".TB_PREFIX."fdata (`vref`,`f1`,`f1t`,`f2`,`f2t`,`f3`,`f3t`,`f4`,`f4t`,`f5`,`f5t`,`f6`,`f6t`,`f7`,`f7t`,`f8`,`f8t`,`f9`,`f9t`,`f10`,`f10t`,`f11`,`f11t`,`f12`,`f12t`,`f13`,`f13t`,`f14`,`f14t`,`f15`,`f15t`,`f16`,`f16t`,`f17`,`f17t`,`f18`,`f18t`,`f19`,`f19t`,`f20`,`f20t`,`f21`,`f21t`,`f22`,`f22t`,`f23`,`f23t`,`f24`,`f24t`,`f25`,`f25t`,`f26`,`f26t`,`f27`,`f27t`,`f28`,`f28t`,`f29`,`f29t`,`f30`,`f30t`,`f31`,`f31t`,`f32`,`f32t`,`f33`,`f33t`,`f34`,`f34t`,`f35`,`f35t`,`f36`,`f36t`,`f37`,`f37t`,`f38`,`f38t`,`f39`,`f39t`,`f40`,`f40t`,`f99`,`f99t`,`wwname`) values ($wid,0,1,0,4,0,1,0,3,0,2,0,2,0,3,0,4,0,4,0,3,0,3,0,4,0,4,0,1,0,4,0,2,0,1,0,2,20,17,20,11,10,27,20,10,10,22,10,25,0,0,20,15,10,19,0,0,0,0,0,0,10,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,16,0,0,0,0,'World Wonder')"; mysql_query($q); + $pop = $automation->recountPop($wid); + $cp = $automation->recountPop($wid); $database->addUnits($wid); $database->addTech($wid); $database->addABTech($wid); diff --git a/GameEngine/Admin/Mods/natarend.php b/GameEngine/Admin/Mods/natarend.php index 475a3a8c..ff492ea7 100644 --- a/GameEngine/Admin/Mods/natarend.php +++ b/GameEngine/Admin/Mods/natarend.php @@ -24,12 +24,12 @@ for($i=1;$i<=$amt;$i++) { $wid = $database->generateBase($kid); $database->setFieldTaken($wid); $time = time(); - $pop = rand(50,233); - $cp = $pop-1; - $q = "insert into ".TB_PREFIX."vdata (`wref`,`owner`,`name`,`capital`,`pop`,`cp`,`celebration`,`type`,`wood`,`clay`,`iron`,`maxstore`,`crop`,`maxcrop`,`lastupdate`,`loyalty`,`exp1`,`exp2`,`exp3`,`created`,`natar`) values ('$wid','3','WW village',0,$pop,$cp,0,0,80000.00,80000.00,80000.00,80000,80000.00,80000,1314974534,100,0,0,0,$time,1)"; + $q = "insert into ".TB_PREFIX."vdata (`wref`,`owner`,`name`,`capital`,`pop`,`cp`,`celebration`,`type`,`wood`,`clay`,`iron`,`maxstore`,`crop`,`maxcrop`,`lastupdate`,`loyalty`,`exp1`,`exp2`,`exp3`,`created`,`natar`) values ('$wid','3','WW village',0,0,0,0,0,80000.00,80000.00,80000.00,80000,80000.00,80000,1314974534,100,0,0,0,$time,1)"; mysql_query($q) or die(mysql_error()); $q = "insert into ".TB_PREFIX."fdata (`vref`,`f1`,`f1t`,`f2`,`f2t`,`f3`,`f3t`,`f4`,`f4t`,`f5`,`f5t`,`f6`,`f6t`,`f7`,`f7t`,`f8`,`f8t`,`f9`,`f9t`,`f10`,`f10t`,`f11`,`f11t`,`f12`,`f12t`,`f13`,`f13t`,`f14`,`f14t`,`f15`,`f15t`,`f16`,`f16t`,`f17`,`f17t`,`f18`,`f18t`,`f19`,`f19t`,`f20`,`f20t`,`f21`,`f21t`,`f22`,`f22t`,`f23`,`f23t`,`f24`,`f24t`,`f25`,`f25t`,`f26`,`f26t`,`f27`,`f27t`,`f28`,`f28t`,`f29`,`f29t`,`f30`,`f30t`,`f31`,`f31t`,`f32`,`f32t`,`f33`,`f33t`,`f34`,`f34t`,`f35`,`f35t`,`f36`,`f36t`,`f37`,`f37t`,`f38`,`f38t`,`f39`,`f39t`,`f40`,`f40t`,`f99`,`f99t`,`wwname`) values ($wid,0,1,0,4,0,1,0,3,0,2,0,2,0,3,0,4,0,4,0,3,0,3,0,4,0,4,0,1,0,4,0,2,0,1,0,2,20,17,20,11,20,15,20,10,10,22,10,25,0,0,0,0,10,19,0,0,0,0,0,0,10,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,16,0,0,0,40,'World Wonder')"; mysql_query($q); + $pop = $automation->recountPop($wid); + $cp = $automation->recountPop($wid); $database->addUnits($wid); $database->addTech($wid); $database->addABTech($wid); diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 966d4722..895d0927 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -98,6 +98,26 @@ class Automation { return $popTot; } + + function recountCP($vid){ + global $database; + $fdata = $database->getResourceLevel($vid); + $popTot = 0; + + for ($i = 1; $i <= 40; $i++) { + $lvl = $fdata["f".$i]; + $building = $fdata["f".$i."t"]; + if($building){ + $popTot += $this->buildingCP($building,$lvl); + } + } + + $q = "UPDATE ".TB_PREFIX."vdata set pop = $popTot where wref = $vid"; + mysql_query($q); + + return $popTot; + + } function buildingPOP($f,$lvl){ $name = "bid".$f; @@ -109,6 +129,18 @@ class Automation { $popT += $dataarray[$i]['pop']; } return $popT; + } + + function buildingCP($f,$lvl){ + $name = "bid".$f; + global $$name; + $popT = 0; + $dataarray = $$name; + + for ($i = 0; $i <= $lvl; $i++) { + $popT += $dataarray[$i]['cp']; + } + return $popT; } public function Automation() { @@ -1122,7 +1154,7 @@ class Automation { $troopsdead6 = $dead6; $troopsdead7 = $dead7; $troopsdead8 = $dead8; - $troopsdead9 = $dead9-1; + $troopsdead9 = $dead9+1; $troopsdead10 = $dead10; $troopsdead11 = $dead11; for($i=1;$i<=50;$i++) { diff --git a/Templates/Build/wwupgrade.tpl b/Templates/Build/wwupgrade.tpl index be3419e2..ac88fbf7 100644 --- a/Templates/Build/wwupgrade.tpl +++ b/Templates/Build/wwupgrade.tpl @@ -7,9 +7,9 @@ $needed_plan = 1; }else{ $needed_plan = 0; } +if($session->alliance != 0){ $alli_users = $database->getUserByAlliance($session->alliance); $wwbuildingplan = 0; - foreach($alli_users as $users){ $villages = $database->getVillagesID($users['id']); foreach($villages as $village1){ @@ -19,6 +19,15 @@ $wwbuildingplan += 1; } } } +}else{ +$villages = $database->getVillagesID($session->uid); +foreach($villages as $village1){ +$plan = count($database->getOwnArtefactInfoByType2($village1,11)); +if($plan > 0){ +$wwbuildingplan += 1; +} +} +} if($wwbuildingplan > $needed_plan){ if($bindicate == 1) { diff --git a/create_account.php b/create_account.php index 974d4166..01ff4e81 100644 --- a/create_account.php +++ b/create_account.php @@ -1,4 +1,4 @@ -access < ADMIN) + if($session->access < ADMIN){ die("Access Denied: You are not Admin!"); + }else{ +$start = $generator->pageLoadTimeStart(); + +?> + + + + <?php echo SERVER_NAME ?> + + + + + + + + + + + + gpack == null || GP_ENABLE == false) { + echo " + + "; + } else { + echo " + + "; + } + ?> + + + + + +
+ +
+
+ +
+ +
+ +
+ +

+ Choose Password + + +
Password:
+

+ +
+
+
+ +
+
+ +
+
+
+ +
+ + +
+
+
+ pageLoadTimeEnd()-$start)*1000); +?> ms + +
+
+
+
+ +
+ + + \ No newline at end of file