mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-30 09:34:28 +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);
|
||||
|
||||
@@ -167,8 +167,9 @@ function testSum() {
|
||||
<input type="hidden" name="ft" value="mk3" />
|
||||
<input type="hidden" name="t" value="3" />
|
||||
<?php
|
||||
for($i = 1; $i <= 40; $i++){
|
||||
$wwvillage = $database->getResourceLevel($village->wid);
|
||||
if($wwvillage['f99t']!=40){
|
||||
if($wwvillage['f99t']!=40 and $wwvillage['f'.$i.'t']!=40){
|
||||
?>
|
||||
<table id="npc" cellpadding="1" cellspacing="1">
|
||||
<thead>
|
||||
@@ -260,5 +261,5 @@ function testSum() {
|
||||
<?php }else{ ?>
|
||||
</br></br>
|
||||
<?php echo "You can't use NPC trade in WW village.";
|
||||
}} ?>
|
||||
}}} ?>
|
||||
</div>
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
include("GameEngine/Village.php");
|
||||
$start = $generator->pageLoadTimeStart();
|
||||
$message->procMessage($_POST);
|
||||
if(isset($_GET['t'])){
|
||||
if($_GET['t'] == 1){
|
||||
$automation->isWinner();
|
||||
}
|
||||
if(isset($_GET['newdid'])) {
|
||||
|
||||
+2
-2
@@ -109,7 +109,7 @@ $q = "
|
||||
}
|
||||
|
||||
## Get WW Winner Details
|
||||
$sql = mysql_query("SELECT vref FROM ".TB_PREFIX."fdata WHERE f99 = '100'")or die(mysql_error());
|
||||
$sql = mysql_query("SELECT vref FROM ".TB_PREFIX."fdata WHERE f99 = '100' and f99t = '40' OR f1 = '100' and f1t = '40' OR f2 = '100' and f2t = '40' OR f3 = '100' and f3t = '40' OR f4 = '100' and f4t = '40' OR f5 = '100' and f5t = '40' OR f6 = '100' and f6t = '40' OR f7 = '100' and f7t = '40' OR f8 = '100' and f8t = '40' OR f9 = '100' and f9t = '40' OR f10 = '100' and f10t = '40' OR f11 = '100' and f11t = '40' OR f12 = '100' and f12t = '40' OR f13 = '100' and f13t = '40' OR f14 = '100' and f14t = '40' OR f15 = '100' and f15t = '40' OR f16 = '100' and f16t = '40' OR f17 = '100' and f17t = '40' OR f18 = '100' and f18t = '40' OR f19 = '100' and f19t = '40' OR f20 = '100' and f20t = '40' OR f21 = '100' and f21t = '40' OR f22 = '100' and f22t = '40' OR f23 = '100' and f23t = '40' OR f24 = '100' and f24t = '40' OR f25 = '100' and f25t = '40' OR f26 = '100' and f26t = '40' OR f27 = '100' and f27t = '40' OR f28 = '100' and f28t = '40' OR f29 = '100' and f29t = '40' OR f30 = '100' and f30t = '40' OR f31 = '100' and f31t = '40' OR f32 = '100' and f32t = '40' OR f33 = '100' and f33t = '40' OR f34 = '100' and f34t = '40' OR f35 = '100' and f35t = '40' OR f36 = '100' and f36t = '40' OR f37 = '100' and f37t = '40' OR f38 = '100' and f38t = '40' OR f39 = '100' and f39t = '40' OR f40 = '100' and f40t = '40'")or die(mysql_error());
|
||||
$vref = mysql_result($sql, 0);
|
||||
|
||||
$sql = mysql_query("SELECT name FROM ".TB_PREFIX."vdata WHERE wref = '$vref'")or die(mysql_error());
|
||||
@@ -130,7 +130,7 @@ $q = "
|
||||
$sql = mysql_query("SELECT tag FROM ".TB_PREFIX."alidata WHERE id = '$allianceid'")or die(mysql_error());
|
||||
$winningalliancetag = mysql_result($sql, 0);
|
||||
|
||||
$sql = mysql_query("SELECT vref FROM ".TB_PREFIX."fdata WHERE f99 = '100'")or die(mysql_error());
|
||||
$sql = mysql_query("SELECT vref FROM ".TB_PREFIX."fdata WHERE f99 = '100' and f99t = '40' OR f1 = '100' and f1t = '40' OR f2 = '100' and f2t = '40' OR f3 = '100' and f3t = '40' OR f4 = '100' and f4t = '40' OR f5 = '100' and f5t = '40' OR f6 = '100' and f6t = '40' OR f7 = '100' and f7t = '40' OR f8 = '100' and f8t = '40' OR f9 = '100' and f9t = '40' OR f10 = '100' and f10t = '40' OR f11 = '100' and f11t = '40' OR f12 = '100' and f12t = '40' OR f13 = '100' and f13t = '40' OR f14 = '100' and f14t = '40' OR f15 = '100' and f15t = '40' OR f16 = '100' and f16t = '40' OR f17 = '100' and f17t = '40' OR f18 = '100' and f18t = '40' OR f19 = '100' and f19t = '40' OR f20 = '100' and f20t = '40' OR f21 = '100' and f21t = '40' OR f22 = '100' and f22t = '40' OR f23 = '100' and f23t = '40' OR f24 = '100' and f24t = '40' OR f25 = '100' and f25t = '40' OR f26 = '100' and f26t = '40' OR f27 = '100' and f27t = '40' OR f28 = '100' and f28t = '40' OR f29 = '100' and f29t = '40' OR f30 = '100' and f30t = '40' OR f31 = '100' and f31t = '40' OR f32 = '100' and f32t = '40' OR f33 = '100' and f33t = '40' OR f34 = '100' and f34t = '40' OR f35 = '100' and f35t = '40' OR f36 = '100' and f36t = '40' OR f37 = '100' and f37t = '40' OR f38 = '100' and f38t = '40' OR f39 = '100' and f39t = '40' OR f40 = '100' and f40t = '40'")or die(mysql_error());
|
||||
$winner = mysql_num_rows($sql);
|
||||
|
||||
if($winner!=0){
|
||||
|
||||
Reference in New Issue
Block a user