mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-06 21:04:20 +00:00
improve ww system (include end game screen)
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user