improve ww system (include end game screen)

This commit is contained in:
unknown
2012-05-05 20:11:38 +03:00
parent 6b3e6b9968
commit db4770e82d
5 changed files with 43 additions and 8 deletions
+34 -2
View File
@@ -19,8 +19,8 @@ class Automation {
private $bountyOpop = 1;
public function isWinner() {
global $database, $technology;
$q = mysql_query("SELECT vref FROM ".TB_PREFIX."fdata WHERE f99 = '100'");
for ($i = 1; $i <= 40; $i++) {
$q = mysql_query("SELECT vref FROM ".TB_PREFIX."fdata WHERE f99 = '100' and f99t = '40' or f".$i." = '100' and f".$i."t = '40'");
$isThere = mysql_num_rows($q);
if($isThere > 0)
{
@@ -28,8 +28,40 @@ class Automation {
}else{
## there is no winner
}
}
}
public function gameWinner() {
for ($i = 1; $i <= 40; $i++) {
$q = mysql_query("SELECT vref FROM ".TB_PREFIX."fdata WHERE f99 = '100' and f99t = '40' or f".$i." = '100' and f".$i."t = '40'");
$vref = mysql_result($q, 0);
}
$q = mysql_query("SELECT name FROM ".TB_PREFIX."vdata WHERE wref = '$vref'")or die(mysql_error());
$winningvillagename = mysql_result($q, 0);
$q = mysql_query("SELECT owner FROM ".TB_PREFIX."vdata WHERE wref = '$vref'")or die(mysql_error());
$owner = mysql_result($q, 0);
$q = mysql_query("SELECT username FROM ".TB_PREFIX."users WHERE id = '$owner'")or die(mysql_error());
$username = mysql_result($q, 0);
$q = mysql_query("SELECT alliance FROM ".TB_PREFIX."users WHERE id = '$owner'")or die(mysql_error());
$allianceid = mysql_result($q, 0);
$q = mysql_query("SELECT name, tag FROM ".TB_PREFIX."alidata WHERE id = '$allianceid'")or die(mysql_error());
$winningalliance = mysql_result($q, 0);
$q = mysql_query("SELECT tag FROM ".TB_PREFIX."alidata WHERE id = '$allianceid'")or die(mysql_error());
$winningalliancetag = mysql_result($q, 0);
for ($i = 1; $i <= 40; $i++) {
$q = mysql_query("SELECT vref FROM ".TB_PREFIX."fdata WHERE f99 = '100' and f99t = '40' or f".$i." = '100' and f".$i."t = '40'");
$winner = mysql_num_rows($q);
}
}
public function procResType($ref) {
global $session;
switch($ref) {
+3 -1
View File
@@ -624,8 +624,9 @@ class Building {
if($session->gold >= 2){
foreach($this->buildArray as $jobs) {
if($jobs['wid']==$village->wid){
for ($i = 1; $i <= 40; $i++) {
$wwvillage = $database->getResourceLevel($jobs['wid']);
if($wwvillage['f99t']!=40){
if($wwvillage['f99t']!=40 and $wwvillage['f'.$i.'t']!=40){
$level = $database->getFieldLevel($jobs['wid'],$jobs['field']);
$level = ($level == -1) ? 0 : $level;
if($jobs['type'] != 25 AND $jobs['type'] != 26 AND $jobs['type'] != 40) {
@@ -680,6 +681,7 @@ class Building {
}
}
}
}
$technology->finishTech();
$logging->goldFinLog($village->wid);
$database->modifyGold($session->uid,0,0);