mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-07 05:14:31 +00:00
Merge branch 'master' of https://github.com/Shadowss/TravianZ
This commit is contained in:
+14
-64
@@ -12,6 +12,7 @@
|
||||
#################################################################################
|
||||
|
||||
include_once("../../Account.php");
|
||||
include_once("../../Technology.php");
|
||||
|
||||
if (!isset($_SESSION)) session_start();
|
||||
if($_SESSION['access'] < ADMIN) die("Access Denied: You are not Admin!");
|
||||
@@ -29,80 +30,29 @@ foreach ($_POST as $key => $value) {
|
||||
$_POST[$key] = (int) $value;
|
||||
}
|
||||
|
||||
$u1 = $_POST['u1'];
|
||||
$u2 = $_POST['u2'];
|
||||
$u3 = $_POST['u3'];
|
||||
$u4 = $_POST['u4'];
|
||||
$u5 = $_POST['u5'];
|
||||
$u6 = $_POST['u6'];
|
||||
$u7 = $_POST['u7'];
|
||||
$u8 = $_POST['u8'];
|
||||
$u9 = $_POST['u9'];
|
||||
$u10 = $_POST['u10'];
|
||||
////////////////////
|
||||
$u11 = $_POST['u11'];
|
||||
$u12 = $_POST['u12'];
|
||||
$u13 = $_POST['u13'];
|
||||
$u14 = $_POST['u14'];
|
||||
$u15 = $_POST['u15'];
|
||||
$u16 = $_POST['u16'];
|
||||
$u17 = $_POST['u17'];
|
||||
$u18 = $_POST['u18'];
|
||||
$u19 = $_POST['u19'];
|
||||
$u20 = $_POST['u20'];
|
||||
////////////////////
|
||||
$u21 = $_POST['u21'];
|
||||
$u22 = $_POST['u22'];
|
||||
$u23 = $_POST['u23'];
|
||||
$u24 = $_POST['u24'];
|
||||
$u25 = $_POST['u25'];
|
||||
$u26 = $_POST['u26'];
|
||||
$u27 = $_POST['u27'];
|
||||
$u28 = $_POST['u28'];
|
||||
$u29 = $_POST['u29'];
|
||||
$u30 = $_POST['u30'];
|
||||
////////////////////
|
||||
$u31 = $_POST['u31'];
|
||||
$u32 = $_POST['u32'];
|
||||
$u33 = $_POST['u33'];
|
||||
$u34 = $_POST['u34'];
|
||||
$u35 = $_POST['u35'];
|
||||
$u36 = $_POST['u36'];
|
||||
$u37 = $_POST['u37'];
|
||||
$u38 = $_POST['u38'];
|
||||
$u39 = $_POST['u39'];
|
||||
$u40 = $_POST['u40'];
|
||||
////////////////////
|
||||
$u41 = $_POST['u41'];
|
||||
$u42 = $_POST['u42'];
|
||||
$u43 = $_POST['u43'];
|
||||
$u44 = $_POST['u44'];
|
||||
$u45 = $_POST['u45'];
|
||||
$u46 = $_POST['u46'];
|
||||
$u47 = $_POST['u47'];
|
||||
$u48 = $_POST['u48'];
|
||||
$u49 = $_POST['u49'];
|
||||
$u50 = $_POST['u50'];
|
||||
for($i = 1; $i <= 50; $i++) ${"u".$i} = $_POST['u'.$i];
|
||||
|
||||
if($user['tribe'] == 1){
|
||||
$q = "UPDATE ".TB_PREFIX."units SET u1 = $u1, u2 = $u2, u3 = $u3, u4 = $u4, u5 = $u5, u6 = $u6, u7 = $u7, u8 = $u8, u9 = $u9, u10 = $u10 WHERE vref = $id";
|
||||
mysqli_query($GLOBALS["link"], $q);
|
||||
$q = "UPDATE ".TB_PREFIX."units SET u1 = $u1, u2 = $u2, u3 = $u3, u4 = $u4, u5 = $u5, u6 = $u6, u7 = $u7, u8 = $u8, u9 = $u9, u10 = $u10 WHERE vref = $id";
|
||||
mysqli_query($GLOBALS["link"], $q);
|
||||
} else if($user['tribe'] == 2){
|
||||
$q = "UPDATE ".TB_PREFIX."units SET u11 = '$u11', u12 = '$u12', u13 = '$u13', u14 = '$u14', u15 = '$u15', u16 = '$u16', u17 = '$u17', u18 = '$u18', u19 = '$u19', u20 = '$u20' WHERE vref = $id";
|
||||
mysqli_query($GLOBALS["link"], $q);
|
||||
$q = "UPDATE ".TB_PREFIX."units SET u11 = '$u11', u12 = '$u12', u13 = '$u13', u14 = '$u14', u15 = '$u15', u16 = '$u16', u17 = '$u17', u18 = '$u18', u19 = '$u19', u20 = '$u20' WHERE vref = $id";
|
||||
mysqli_query($GLOBALS["link"], $q);
|
||||
} else if($user['tribe'] == 3){
|
||||
$q = "UPDATE ".TB_PREFIX."units SET u21 = '$u21', u22 = '$u22', u23 = '$u23', u24 = '$u24', u25 = '$u25', u26 = '$u26', u27 = '$u27', u28 = '$u28', u29 = '$u29', u30 = '$u30' WHERE vref = $id";
|
||||
mysqli_query($GLOBALS["link"], $q);
|
||||
$q = "UPDATE ".TB_PREFIX."units SET u21 = '$u21', u22 = '$u22', u23 = '$u23', u24 = '$u24', u25 = '$u25', u26 = '$u26', u27 = '$u27', u28 = '$u28', u29 = '$u29', u30 = '$u30' WHERE vref = $id";
|
||||
mysqli_query($GLOBALS["link"], $q);
|
||||
} else if($user['tribe'] == 4){
|
||||
$q = "UPDATE ".TB_PREFIX."units SET u31 = '$u31', u32 = '$u32', u33 = '$u33', u34 = '$u34', u35 = '$u35', u36 = '$u36', u37 = '$u37', u38 = '$u38', u39 = '$u39', u40 = '$u40' WHERE vref = $id";
|
||||
mysqli_query($GLOBALS["link"], $q);
|
||||
$q = "UPDATE ".TB_PREFIX."units SET u31 = '$u31', u32 = '$u32', u33 = '$u33', u34 = '$u34', u35 = '$u35', u36 = '$u36', u37 = '$u37', u38 = '$u38', u39 = '$u39', u40 = '$u40' WHERE vref = $id";
|
||||
mysqli_query($GLOBALS["link"], $q);
|
||||
} else if($user['tribe'] == 5){
|
||||
$q = "UPDATE ".TB_PREFIX."units SET u41 = '$u41', u42 = '$u42', u43 = '$u43', u44 = '$u44', u45 = '$u45', u46 = '$u46', u47 = '$u47', u48 = '$u48', u49 = '$u49', u50 = '$u50' WHERE vref = $id";
|
||||
mysqli_query($GLOBALS["link"], $q);
|
||||
$q = "UPDATE ".TB_PREFIX."units SET u41 = '$u41', u42 = '$u42', u43 = '$u43', u44 = '$u44', u45 = '$u45', u46 = '$u46', u47 = '$u47', u48 = '$u48', u49 = '$u49', u50 = '$u50' WHERE vref = $id";
|
||||
mysqli_query($GLOBALS["link"], $q);
|
||||
}
|
||||
|
||||
mysqli_query($GLOBALS["link"], "Insert into ".TB_PREFIX."admin_log values (0,".(int) $_SESSION['id'].",'Changed troop anmount in village <a href=\'admin.php?p=village&did=$id\'>$id</a> ',".time().")");
|
||||
|
||||
$database->addStarvationData($village['wref']);
|
||||
|
||||
header("Location: ../../../Admin/admin.php?p=addTroops&did=".$id."&d");
|
||||
|
||||
?>
|
||||
@@ -9,7 +9,7 @@
|
||||
## Copyright: TravianZ (c) 2010-2014. All rights reserved. ##
|
||||
## ##
|
||||
#################################################################################
|
||||
$unarray = array(1=>U1,U2,U3,U4,U5,U6,U7,U8,U9,U10,U11,U12,U13,U14,U15,U16,U17,U18,U19,U20,U21,U22,U23,U24,U25,U26,U27,U28,U29,U30,U31,U32,U33,U34,U35,U36,U37,U38,U39,U40,U41,U42,U43,U44,U45,U46,U47,U48,U49,U50,U99,U0);
|
||||
$unarray = [1=>U1,U2,U3,U4,U5,U6,U7,U8,U9,U10,U11,U12,U13,U14,U15,U16,U17,U18,U19,U20,U21,U22,U23,U24,U25,U26,U27,U28,U29,U30,U31,U32,U33,U34,U35,U36,U37,U38,U39,U40,U41,U42,U43,U44,U45,U46,U47,U48,U49,U50,U99,U0];
|
||||
if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
|
||||
$id = $_GET['did'];
|
||||
if(isset($id))
|
||||
@@ -17,12 +17,8 @@ if(isset($id))
|
||||
$units = $database->getUnit($village['wref']);
|
||||
$coor = $database->getCoor($village['wref']);
|
||||
$tribe = $user['tribe'];
|
||||
if($tribe ==1){ $img = 0;}
|
||||
if($tribe ==2){ $img = 10;}
|
||||
if($tribe ==3){ $img = 20;}
|
||||
if($tribe ==4){ $img = 30;}
|
||||
if($tribe ==5){ $img = 40;}
|
||||
if($tribe ==6){ $img = 50;}
|
||||
$img = ($tribe - 1) * 10;
|
||||
|
||||
include("search2.tpl");
|
||||
?>
|
||||
<form action="../GameEngine/Admin/Mods/addTroops.php" method="POST">
|
||||
@@ -34,7 +30,7 @@ if(isset($id))
|
||||
<th colspan="2">Edit troops</th>
|
||||
</tr></thead><tbody>
|
||||
<?php
|
||||
for($i=1; $i<11; $i++) {
|
||||
for($i = 1; $i < 11; $i++) {
|
||||
echo '<tr>
|
||||
<td class="addTroops"><img src="../img/un/u/'.($img+$i).'.gif"></img> '.$unarray[$img+$i].'</td>
|
||||
<td class="addTroops"><input class="addTroops" name="u'.($img+$i).'" id="u'.($img+$i).'" value="'.$units["u".($img+$i)].'" maxlength="10">
|
||||
|
||||
@@ -5,7 +5,7 @@ $deletedArtifacts = $database->getDeletedArtifacts();
|
||||
<link href="../<?php echo GP_LOCATE; ?>lang/en/lang.css?f4b7d" rel="stylesheet" type="text/css">
|
||||
<link href="../<?php echo GP_LOCATE; ?>lang/en/compact.css?f4b7i" rel="stylesheet" type="text/css">
|
||||
|
||||
<h1>Artifacts</h1>
|
||||
<h1>Artifacts management</h1>
|
||||
<form method="post" action="../Admin/admin.php?action=addArtifacts">
|
||||
<table id="member">
|
||||
<thead>
|
||||
@@ -28,8 +28,7 @@ $deletedArtifacts = $database->getDeletedArtifacts();
|
||||
$artifactArrays = array_merge(Artifacts::NATARS_ARTIFACTS, Artifacts::NATARS_WW_BUILDING_PLANS);
|
||||
foreach($artifactArrays as $desc => $artifactType){
|
||||
foreach($artifactType as $artifact){
|
||||
echo '
|
||||
<option value="'.$artifact['type'].':'.$artifact['size'].':'.$desc.'">'.$artifact['name'].'</option>';
|
||||
echo '<option value="'.$artifact['type'].':'.$artifact['size'].':'.$desc.'">'.$artifact['name'].'</option>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,8 +116,39 @@ $deletedArtifacts = $database->getDeletedArtifacts();
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</table><br />
|
||||
|
||||
<h1>WW villages management</h1>
|
||||
<form method="post" action="../Admin/admin.php?action=addWWVillages">
|
||||
<table id="member">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">Add WW village(s)</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Number of village(s)</td>
|
||||
<td>Player id</td>
|
||||
</tr>
|
||||
</thead>
|
||||
</tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="text-align: center">
|
||||
<input type="number" value="1" min="1" max="999" name="numberOfVillages">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div style="text-align: center">
|
||||
<input type="text" value="<?php echo Artifacts::NATARS_UID; ?>" name="playerId">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><div style="text-align: center"><button id="addWWVillages" class="trav_buttons" value="add" name="addWWVillages" onclick="this.disabled=true;this.form.submit();"> Add </button></div></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
function changeArtifactImage(){
|
||||
@@ -253,7 +253,7 @@ if(isset($id)){
|
||||
foreach($newResult as $row){
|
||||
echo "
|
||||
<tr>
|
||||
<td><a href=\"?action=delOas&oid=".$row['wref']."\" onClick=\"return del('oas',".$row['wref'].")\"><img src=\"../img/admin/del.gif\"></a></td>
|
||||
<td><a href=\"?action=delOas&oid=".$row['wref']."&did=".$_GET['did']."\" onClick=\"return del('oas',".$row['wref'].")\"><img src=\"../img/admin/del.gif\"></a></td>
|
||||
<td class=\"hab\">".$row['name']."</td>
|
||||
<td class=\"hab\"><a href=\"../karte.php?d=".$row['wref']."&c=".$generator->getMapCheck($row['wref'])."\" target=\"blank\">(".$row['x']."|".$row['y'].")</a></td>
|
||||
<td class=\"hab\">".round($row['loyalty'])."%</td>
|
||||
|
||||
@@ -13,25 +13,23 @@
|
||||
if(!isset($_SESSION)) session_start();
|
||||
if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
|
||||
include_once("../../Database.php");
|
||||
include_once("../../Technology.php");
|
||||
include_once("../../Data/unitdata.php");
|
||||
|
||||
$id = $_POST['id'];
|
||||
$id = (int)$_POST['id'];
|
||||
$village = $database->getVillage($id);
|
||||
$user = $database->getUserArray($village['owner'],1);
|
||||
$units="";
|
||||
$tribe = $user['tribe'];
|
||||
if($tribe ==1){ $u = 0;}
|
||||
if($tribe ==2){ $u = 10;}
|
||||
if($tribe ==3){ $u = 20;}
|
||||
if($tribe ==4){ $u = 30;}
|
||||
if($tribe ==5){ $u = 40;}
|
||||
if($tribe ==6){ $u = 50;}
|
||||
$user = $database->getUserArray($village['owner'],1);
|
||||
$units = "";
|
||||
$tribe = $user['tribe'];
|
||||
$u = ($tribe - 1) * 10;
|
||||
|
||||
for($i=1; $i<11; $i++) {
|
||||
$units.="u".($u+$i)."=".$database->escape($_POST['u'.($u+$i)].(($i < 10) ? ", " : ""));
|
||||
for($i = 1; $i < 11; $i++) {
|
||||
$units.="u".($u + $i)."=".$database->escape($_POST['u'.($u + $i)].(($i < 10) ? ", " : ""));
|
||||
}
|
||||
$q = "UPDATE ".TB_PREFIX."units SET ".$units." WHERE vref = ".(int) $id;
|
||||
|
||||
$q = "UPDATE ".TB_PREFIX."units SET ".$units." WHERE vref = ".$id;
|
||||
$database->query($q);
|
||||
$database->query("Insert into ".TB_PREFIX."admin_log values (0,".(int) $_SESSION['id'].",'Changed troop amounts in village <a href=\'admin.php?p=village&did=$id\'>$id</a> ',".time().")");
|
||||
|
||||
$database->addStarvationData($id);
|
||||
header("Location: ../../../Admin/admin.php?p=village&did=".$id."&d");
|
||||
?>
|
||||
@@ -24,57 +24,24 @@ for ($i = 0; $i < 5; $i++) {
|
||||
|
||||
include_once($autoprefix."GameEngine/Database.php");
|
||||
|
||||
$session = (int) $_POST['admid'];
|
||||
$id = (int) $_POST['id'];
|
||||
|
||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
||||
$access = mysqli_fetch_array($sql);
|
||||
$sessionaccess = $access['access'];
|
||||
$bonusDuration = [];
|
||||
$time = time();
|
||||
$bonusDuration['plus'] = (int) $_POST['plus'] * 86400; //Plus
|
||||
$bonusDuration['b1'] = (int) $_POST['wood'] * 86400; //+25% Wood
|
||||
$bonusDuration['b2'] = (int) $_POST['clay'] * 86400; //+25% Clay
|
||||
$bonusDuration['b3'] = (int) $_POST['iron'] * 86400; //+25% Iron
|
||||
$bonusDuration['b4'] = (int) $_POST['crop'] * 86400; //+25% Crop
|
||||
|
||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
||||
$user = $database->getUserArray($id, 1);
|
||||
|
||||
$pdur = (int) $_POST['plus'] * 86400;
|
||||
$b1dur = (int) $_POST['wood'] * 86400;
|
||||
$b2dur = (int) $_POST['clay'] * 86400;
|
||||
$b3dur = (int) $_POST['iron'] * 86400;
|
||||
$b4dur = (int) $_POST['crop'] * 86400;
|
||||
|
||||
$sql1 = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$id."");
|
||||
$user = mysqli_fetch_array($sql1);
|
||||
|
||||
if($user['plus'] < time()){
|
||||
if($pdur > 1){ $plus = (time() + $pdur); } else { $plus = time(); }
|
||||
}else{
|
||||
if($pdur > 1){ $plus = ($user['plus'] + $pdur); } else { $plus = $user['plus']; }
|
||||
}
|
||||
if($user['b1'] < time()){
|
||||
if($b1dur > 1){ $wood = (time() + $b1dur); } else { $wood = time(); }
|
||||
}else{
|
||||
if($b1dur > 1){ $wood = ($user['b1'] + $b1dur); } else { $wood = $user['b1']; }
|
||||
}
|
||||
if($user['b2'] < time()){
|
||||
if($b2dur > 1){ $clay = (time() + $b2dur); } else { $clay = time(); }
|
||||
}else{
|
||||
if($b2dur > 1){ $clay = ($user['b2'] + $b2dur); } else { $clay = $user['b2']; }
|
||||
}
|
||||
if($user['b3'] < time()){
|
||||
if($b3dur > 1){ $iron = (time() + $b3dur); } else { $iron = time(); }
|
||||
}else{
|
||||
if($b3dur > 1){ $iron = ($user['b3'] + $b3dur); } else { $iron = $user['b3']; }
|
||||
}
|
||||
if($user['b4'] < time()){
|
||||
if($b4dur > 1){ $crop = (time() + $b4dur); } else { $crop = time(); }
|
||||
}else{
|
||||
if($b4dur > 1){ $crop = ($user['b4'] + $b4dur); } else { $crop = $user['b4']; }
|
||||
foreach($bonusDuration as $index => $bonus){
|
||||
$bonusDuration[$index] = $bonusDuration[$index] + ($user[$index] < $time ? $time : $user[$index]);
|
||||
if($bonusDuration[$index] < $time) $bonusDuration[$index] = 0;
|
||||
}
|
||||
|
||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."users SET
|
||||
plus = '".$plus."',
|
||||
b1 = '".$wood."',
|
||||
b2 = '".$clay."',
|
||||
b3 = '".$iron."',
|
||||
b4 = '".$crop."'
|
||||
WHERE id = $id") or die(mysqli_error($database->dblink));
|
||||
$database->updateUserField($id, array_keys($bonusDuration), array_values($bonusDuration), 1);
|
||||
|
||||
header("Location: ../../../Admin/admin.php?p=player&uid=".$id."");
|
||||
?>
|
||||
@@ -30,14 +30,6 @@ for ($i = 0; $i < 5; $i++) {
|
||||
|
||||
include_once($autoprefix."GameEngine/Database.php");
|
||||
|
||||
$session = (int) $_POST['admid'];
|
||||
|
||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
||||
$access = mysqli_fetch_array($sql);
|
||||
$sessionaccess = $access['access'];
|
||||
|
||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
||||
|
||||
$sql = "SELECT id FROM ".TB_PREFIX."users ORDER BY ID DESC LIMIT 1";
|
||||
$loops = mysqli_result(mysqli_query($GLOBALS["link"], $sql), 0);
|
||||
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
// # ##
|
||||
// ################################################################################
|
||||
include_once("../GameEngine/Artifacts.php");
|
||||
include_once("../GameEngine/Units.php");
|
||||
include_once("../GameEngine/Generator.php");
|
||||
|
||||
class funct
|
||||
{
|
||||
|
||||
@@ -28,7 +31,7 @@ class funct
|
||||
|
||||
function Act($get)
|
||||
{
|
||||
global $admin, $database;
|
||||
global $admin, $database, $units, $generator;
|
||||
|
||||
$artifact = new Artifacts();
|
||||
|
||||
@@ -71,8 +74,8 @@ class funct
|
||||
// add ban
|
||||
break;
|
||||
case "delOas":
|
||||
$database->query('UPDATE ' . TB_PREFIX . 'odata SET conqured = 0, owner = 2, name = "Unoccupied Oasis" WHERE wref = ' . $get['oid']);
|
||||
// oaza
|
||||
$units->returnTroops($get['did'], 1);
|
||||
$database->removeOases($get['oid']);
|
||||
break;
|
||||
case "logout":
|
||||
$this->LogOut();
|
||||
@@ -93,25 +96,30 @@ class funct
|
||||
$artifactInfo = $database->getArtefactDetails($_GET['artid'], $_GET['del']);
|
||||
|
||||
//Check if the artifact exists
|
||||
if(empty($artifactInfo) || $artifactInfo['owner'] == Artifacts::NATARS_UID) {
|
||||
if(empty($artifactInfo)) {
|
||||
header("location: admin.php");
|
||||
exit;
|
||||
}elseif($artifactInfo['owner'] == Artifacts::NATARS_UID){
|
||||
$database->updateArtifactDetails($_GET['artid'], ['del' => 0]);
|
||||
header("location: admin.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
//Return the artifacts to the Natars' account
|
||||
$artifact->returnArtifactToNatars($artifactInfo);
|
||||
break;
|
||||
|
||||
case "addArtifacts":
|
||||
|
||||
$selectedArtifact = $_POST['selectedArtifact'];
|
||||
$artifactQuantity = $_POST['artifactQuantity'];
|
||||
$playerId = $_POST['playerId'];
|
||||
$artifactQuantity = (int)$_POST['artifactQuantity'];
|
||||
$playerId = (int)$_POST['playerId'];
|
||||
|
||||
//Check if the inputs are valid
|
||||
if(!isset($selectedArtifact) || !isset($artifactQuantity) || !isset($playerId) || empty($selectedArtifact) ||
|
||||
!is_numeric($artifactQuantity) || !is_numeric($playerId) || strpos($selectedArtifact, ':') === false ||
|
||||
$database->getUserField($playerId, "username", 0) == "[?]"){
|
||||
header("location: admin.php");
|
||||
!is_numeric($artifactQuantity) || $artifactQuantity <= 0 || $artifactQuantity > 999 || !is_numeric($playerId) ||
|
||||
strpos($selectedArtifact, ':') === false || $database->getUserField($playerId, "username", 0) == "[?]"){
|
||||
header("location: admin.php?p=natars&error=0");
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -125,7 +133,7 @@ class funct
|
||||
|
||||
//Check if the artifact has been found or if doesn't exist
|
||||
if(empty($chosenArtifact)){
|
||||
header("location: admin.php");
|
||||
header("location: admin.php?p=natars&error=1");
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -134,9 +142,24 @@ class funct
|
||||
$artifactArrays[$selectedArtifact[2]][] = $chosenArtifact;
|
||||
|
||||
//Add the artifacts
|
||||
$artifact->addArtifactVillages($artifactArrays, $playerId);
|
||||
$artifact->addArtifactVillages($artifactArrays, $playerId, $playerId == Artifacts::NATARS_UID);
|
||||
break;
|
||||
|
||||
case "addWWVillages":
|
||||
|
||||
$numberOfVillages = (int)$_POST['numberOfVillages'];
|
||||
$playerId = (int)$_POST['playerId'];
|
||||
|
||||
//Check if the inserted values are valid
|
||||
if(!is_numeric($numberOfVillages) || $numberOfVillages <= 0 || $numberOfVillages > 999
|
||||
|| !is_numeric($playerId) || $database->getUserField($playerId, "username", 0) == "[?]"){
|
||||
header("location: admin.php?p=natars&error=2");
|
||||
}
|
||||
|
||||
//Create the desired WW villages
|
||||
$artifact->createWWVillages($numberOfVillages, $playerId, $playerId == Artifacts::NATARS_UID);
|
||||
break;
|
||||
|
||||
case "killHero":
|
||||
$varray = $database->getProfileVillages($get['uid']);
|
||||
$killhero = false;
|
||||
|
||||
+41
-35
@@ -2,16 +2,16 @@
|
||||
class Artifacts
|
||||
{
|
||||
|
||||
public const
|
||||
const
|
||||
|
||||
/**
|
||||
* @var integer Default Natars' uid
|
||||
* @var int Default Natars' uid
|
||||
*/
|
||||
|
||||
NATARS_UID = 3,
|
||||
|
||||
/**
|
||||
* @var integer Default Natars' tribe
|
||||
* @var int Default Natars' tribe
|
||||
*/
|
||||
|
||||
NATARS_TRIBE = 5,
|
||||
@@ -35,23 +35,18 @@ class Artifacts
|
||||
*/
|
||||
|
||||
NATARS_CAPITAL_COORDINATES = [[WORLD_MAX, WORLD_MAX],
|
||||
[WORLD_MAX, 0],
|
||||
[WORLD_MAX, -WORLD_MAX],
|
||||
[0, -WORLD_MAX],
|
||||
[-WORLD_MAX, -WORLD_MAX],
|
||||
[WORLD_MAX - 1, WORLD_MAX],
|
||||
[WORLD_MAX, WORLD_MAX - 1],
|
||||
[-WORLD_MAX, WORLD_MAX - 1],
|
||||
[WORLD_MAX - 1, -WORLD_MAX],
|
||||
[WORLD_MAX - 1, WORLD_MAX - 1],
|
||||
[WORLD_MAX, -WORLD_MAX + 1],
|
||||
[WORLD_MAX - 1, -WORLD_MAX + 1],
|
||||
[-WORLD_MAX + 1, -WORLD_MAX + 1],
|
||||
[WORLD_MAX - 2, WORLD_MAX],
|
||||
[WORLD_MAX - 2, -WORLD_MAX],
|
||||
[WORLD_MAX - 2, WORLD_MAX - 1],
|
||||
[WORLD_MAX - 1, WORLD_MAX - 2],
|
||||
[-WORLD_MAX + 2, WORLD_MAX],
|
||||
[-WORLD_MAX + 2, WORLD_MAX - 1],
|
||||
[-WORLD_MAX + 2, -WORLD_MAX + 2]],
|
||||
[-WORLD_MAX, 0],
|
||||
[-WORLD_MAX, WORLD_MAX],
|
||||
[0, WORLD_MAX],
|
||||
[WORLD_MAX / 10, WORLD_MAX / 20],
|
||||
[WORLD_MAX / 10, -WORLD_MAX / 10],
|
||||
[-WORLD_MAX / 20, -WORLD_MAX / 10],
|
||||
[-WORLD_MAX / 10, 0],
|
||||
[-WORLD_MAX / 20, WORLD_MAX / 10]],
|
||||
|
||||
/**
|
||||
* @var array Normal Natars' artifacts
|
||||
@@ -91,7 +86,7 @@ class Artifacts
|
||||
* @var array WW building plans Natars' artifacts
|
||||
*/
|
||||
|
||||
NATARS_WW_BUILDING_PLANS = [PLAN_DESC => [["type" => 11, "size" => 1, "name" => PLAN,"vname" => PLANVILLAGE, "effect" => "", "quantity" => 13, "img" => 1]]],
|
||||
NATARS_WW_BUILDING_PLANS = [PLAN_DESC => [["type" => 11, "size" => 1, "name" => PLAN, "vname" => PLANVILLAGE, "effect" => "", "quantity" => 13, "img" => 1]]],
|
||||
|
||||
/**
|
||||
* @var array Natars' normal artifacts buildings
|
||||
@@ -128,11 +123,17 @@ class Artifacts
|
||||
"f2" => 6, "f8" => 6, "f9" => 6, "f12" => 6, "f13" => 6, "f15" => 6],
|
||||
|
||||
/**
|
||||
* @var integer The base amount of Natars' spying units, used when Natars account is created
|
||||
* @var int The base amount of Natars' spying units, used when Natars account is created
|
||||
*/
|
||||
|
||||
NATARS_BASE_SPY = 1500;
|
||||
NATARS_BASE_SPY = 1500,
|
||||
|
||||
/**
|
||||
* @var int the base amount of Natars' WW villages
|
||||
*/
|
||||
|
||||
NATARS_BASE_WW_VILLAGES = 13;
|
||||
|
||||
public
|
||||
|
||||
/**
|
||||
@@ -178,7 +179,7 @@ class Artifacts
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when Natars account need to be created, creates his account and capital village
|
||||
* Called when Natars account needs to be created, creates his account and capital village
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -263,9 +264,10 @@ class Artifacts
|
||||
*
|
||||
* @param array $artifactArrays The array containing the artifacts to insert
|
||||
* @param int $uid The owner's user ID (Natars)
|
||||
* @param bool $addTroops Add troops to the village if true, and vice versa if false
|
||||
*/
|
||||
|
||||
public function addArtifactVillages($artifactArrays, $uid = self::NATARS_UID) {
|
||||
public function addArtifactVillages($artifactArrays, $uid = self::NATARS_UID, $addTroops = true) {
|
||||
global $database;
|
||||
|
||||
//Variables initialization
|
||||
@@ -284,7 +286,7 @@ class Artifacts
|
||||
$unitArrays = ($this->natarsArtifactsUnits)($multiplier);
|
||||
|
||||
//Generate the unit arrays
|
||||
$artifactTroops[1][] = array_values($unitArrays);
|
||||
if($addTroops) $artifactTroops[1][] = array_values($unitArrays);
|
||||
$artifactBuildings[1][] = array_values(self::NATARS_ARTIFACTS_BUILDINGS);
|
||||
|
||||
//Generate the artifacts array
|
||||
@@ -296,11 +298,11 @@ class Artifacts
|
||||
}
|
||||
|
||||
//Set the unit types by using the last $unitArrays
|
||||
$artifactTroops[0] = array_keys($unitArrays);
|
||||
if($addTroops) $artifactTroops[0] = array_keys($unitArrays);
|
||||
$artifactBuildings[0] = array_keys(self::NATARS_ARTIFACTS_BUILDINGS);
|
||||
|
||||
//Generate the wids
|
||||
$wids = array_merge($wids, (array)$database->generateVillages($artifactVillages, $uid, TRIBE5, $artifactTroops, $artifactBuildings));
|
||||
$wids = array_merge($wids, (array)$database->generateVillages($artifactVillages, $uid, TRIBE5, $addTroops ? $artifactTroops : null, $artifactBuildings));
|
||||
|
||||
//Create the artifacts for the generated wids
|
||||
$database->addArtefacts($wids, $artifactsToAdd);
|
||||
@@ -309,22 +311,25 @@ class Artifacts
|
||||
/**
|
||||
* Called when WW villages need to be created
|
||||
*
|
||||
* @param int $numberOfVillages The number of villages that have to be added
|
||||
* @param int $uid The player ID
|
||||
* @param bool $addTroops Add troops to the village if true, and vice versa if false
|
||||
*/
|
||||
|
||||
public function createWWVillages(){
|
||||
public function createWWVillages($numberOfVillages = self::NATARS_BASE_WW_VILLAGES, $uid = self::NATARS_UID, $addTroops = true){
|
||||
global $database;
|
||||
|
||||
$villageArrays = $troopArrays = $buildingArrays = $wids = [];
|
||||
for($i = 1; $i <= 13; $i++){
|
||||
$villageArrays[] = ['wid' => 0, 'mode' => 5, 'type' => 3, 'kid' => ($i == 13 ? rand(1, 4) : ($i % 4) + 1), 'capital' => 0, 'pop' => 233, 'name' => WWVILLAGE, 'natar' => 1];
|
||||
$troopArrays[1][] = array_values(($this->natarsWWVillagesUnits)());
|
||||
for($i = 1; $i <= $numberOfVillages; $i++){
|
||||
$villageArrays[] = ['wid' => 0, 'mode' => 5, 'type' => 3, 'kid' => ($i == $numberOfVillages ? rand(1, 4) : ($i % 4) + 1), 'capital' => 0, 'pop' => 233, 'name' => WWVILLAGE, 'natar' => 1];
|
||||
if($addTroops) $troopArrays[1][] = array_values(($this->natarsWWVillagesUnits)());
|
||||
$buildingArrays[1][] = array_values(self::NATARS_WW_VILLAGES_BUILDINGS);
|
||||
}
|
||||
|
||||
$troopArrays[0] = array_keys(($this->natarsWWVillagesUnits)());
|
||||
if($addTroops) $troopArrays[0] = array_keys(($this->natarsWWVillagesUnits)());
|
||||
$buildingArrays[0] = array_keys(self::NATARS_WW_VILLAGES_BUILDINGS);
|
||||
|
||||
$wids = $database->generateVillages($villageArrays, self::NATARS_UID, TRIBE5, $troopArrays, $buildingArrays);
|
||||
$wids = $database->generateVillages($villageArrays, $uid, null, $addTroops ? $troopArrays : null, $buildingArrays);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -411,10 +416,11 @@ class Artifacts
|
||||
global $database;
|
||||
|
||||
//Set the village arrays
|
||||
$artifactArrays = array_merge(self::NATARS_ARTIFACTS, self::NATARS_WW_BUILDING_PLANS);
|
||||
$villageArrays = [['wid' => 0, 'mode' => $artifactArray['size'] + 1, 'type' => 3,
|
||||
'kid' => rand(1, 4), 'capital' => 0, 'pop' => 163,
|
||||
'name' => self::NATARS_ARTIFACTS[$artifactArray['desc']][$artifactArray['size'] - 1]['vname'],
|
||||
'natar' => $artifactArray['type'] != 11 ? 0 : 1]];
|
||||
'name' => $artifactArrays[$artifactArray['desc']][$artifactArray['size'] - 1]['vname'],
|
||||
'natar' => 0]];
|
||||
|
||||
//Set the unit arrays
|
||||
$multiplier = $artifactArray['size'] == 3 ? 4 : $artifactArray['size'];
|
||||
@@ -427,7 +433,7 @@ class Artifacts
|
||||
//Set the buildings array
|
||||
$artifactBuildings[1][] = array_values(self::NATARS_ARTIFACTS_BUILDINGS);
|
||||
$artifactBuildings[0] = array_keys(self::NATARS_ARTIFACTS_BUILDINGS);
|
||||
|
||||
|
||||
//Generate the village
|
||||
$wid = $database->generateVillages($villageArrays, self::NATARS_UID, TRIBE5, $artifactTroops, $artifactBuildings);
|
||||
|
||||
|
||||
Executable → Regular
+50
-72
@@ -383,7 +383,7 @@ class Automation {
|
||||
}
|
||||
|
||||
private function buildComplete() {
|
||||
global $database, $bid18, $bid10, $bid11, $bid38, $bid39;
|
||||
global $database, $technology, $bid18, $bid10, $bid11, $bid38, $bid39;
|
||||
|
||||
$time = time();
|
||||
// IDs of villages that were affected by this building completion update,
|
||||
@@ -476,7 +476,7 @@ class Automation {
|
||||
}
|
||||
|
||||
//Update starvation data
|
||||
$this->addStarvationData($indi['wid']);
|
||||
$database->addStarvationData($indi['wid']);
|
||||
|
||||
// update the requested fields, all at once
|
||||
$database->setVillageFields($indi['wid'], array_keys($fieldsToSet), array_values($fieldsToSet));
|
||||
@@ -711,27 +711,33 @@ class Automation {
|
||||
|
||||
if(isset($catapultTarget))
|
||||
{
|
||||
// currently targeted building/field level
|
||||
//Currently targeted building/field level
|
||||
$tblevel = (int) $bdo['f'.$catapultTarget];
|
||||
// currently targetet building/field GID (ID of the building/field type - woodcutter, cropland, embassy...)
|
||||
//Currently targetet building/field GID (ID of the building/field type - woodcutter, cropland, embassy...)
|
||||
$tbgid = (int) $bdo['f'.$catapultTarget.'t'];
|
||||
// currently targeted building/field ID in the database (fdata, the fID field, e.g. f1, f2, f3...)
|
||||
//Currently targeted building/field ID in the database (fdata, the fID field, e.g. f1, f2, f3...)
|
||||
$tbid = (int) $catapultTarget;
|
||||
|
||||
$newLevel = $battle->CalculateNewBuildingLevel($battlepart['catapults']['moral'],
|
||||
$battlepart['catapults']['upgrades'],
|
||||
$battlepart['catapults']['downgrades'],
|
||||
$tblevel,
|
||||
$battlepart['catapults']['realAttackers'] / ($twoRowsCatapultSetup ? 2 : 1),
|
||||
$data['t8'] / ($twoRowsCatapultSetup ? 2 : 1),
|
||||
($catapultTarget == 40 ? 1 : $battlepart['catapults']['strongerBuildings']));
|
||||
//If we're targeting the WW
|
||||
if($catapultTarget == 40){
|
||||
$battlepart['catapults']['strongerBuildings'] = 1;
|
||||
$battlepart['catapults']['moraleBonus'] = 1;
|
||||
}
|
||||
|
||||
$catapultsDamage = $battle->calculateCatapultsDamage($data['t8'],
|
||||
$battlepart['catapults']['upgrades'],
|
||||
$battlepart['catapults']['durability'],
|
||||
$battlepart['catapults']['attackDefenseRatio'],
|
||||
$battlepart['catapults']['strongerBuildings'],
|
||||
$battlepart['catapults']['moraleBonus']);
|
||||
|
||||
$newLevel = $battle->calculateNewBuildingLevel($tblevel, $catapultsDamage / ($twoRowsCatapultSetup ? 2 : 1));
|
||||
|
||||
//If that building was present in the building queue, we have to modify his level or remove it
|
||||
$database->modifyBData($data['to'], $tbid, [$newLevel, $tblevel], $tribe);
|
||||
|
||||
// building/field destroyed
|
||||
if ($newLevel == 0)
|
||||
{
|
||||
if ($newLevel == 0){
|
||||
// prepare data to be updated
|
||||
$fieldsToSet = ["f".$tbid];
|
||||
$fieldValuesToSet = [0];
|
||||
@@ -1266,11 +1272,8 @@ class Automation {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//to battle.php
|
||||
|
||||
//fix by ronix
|
||||
//MUST TO BE FIX : You need to filter these values
|
||||
//filter_input_array($battlepart = $battle->calculateBattle($Attacker,$Defender,$def_wall,$att_tribe,$def_tribe,$residence,$attpop,$defpop,$type,$def_ab,$att_ab1,$att_ab2,$att_ab3,$att_ab4,$att_ab5,$att_ab6,$att_ab7,$att_ab8,$tblevel,$stonemason,$walllevel,0,0,0,$AttackerID,$DefenderID,$AttackerWref,$DefenderWref,$conqureby));
|
||||
if (!isset($walllevel)) $walllevel = 0;
|
||||
|
||||
$battlepart = $battle->calculateBattle($Attacker, $Defender, $def_wall, $att_tribe, $def_tribe, $residence, $attpop, $defpop, $type, $def_ab, $att_ab1, $att_ab2, $att_ab3, $att_ab4, $att_ab5, $att_ab6, $att_ab7, $att_ab8, $tblevel, $stonemason, $walllevel, 0, 0, 0, $AttackerID, $DefenderID, $AttackerWref, $DefenderWref, $conqureby, $enforcementarray);
|
||||
@@ -1286,17 +1289,18 @@ class Automation {
|
||||
else $can_destroy = 0;
|
||||
|
||||
//Catapults and rams management
|
||||
//TODO: Move this in Battle.php
|
||||
if($isoasis == 0){
|
||||
if ($type == 3){
|
||||
if (($data['t7'] - $traped7) > 0){
|
||||
if($walllevel > 0){
|
||||
$newLevel = $battle->CalculateNewBuildingLevel($battlepart['rams']['moral'],
|
||||
$battlepart['rams']['upgrades'],
|
||||
$battlepart['rams']['downgrades'],
|
||||
$walllevel,
|
||||
$battlepart['rams']['realAttackers'],
|
||||
$data['t7'],
|
||||
$battlepart['rams']['strongerBuildings']);
|
||||
$ramsDamage = $battle->calculateCatapultsDamage($data['t7'],
|
||||
$battlepart['rams']['upgrades'],
|
||||
$battlepart['rams']['durability'],
|
||||
$battlepart['rams']['attackDefenseRatio'],
|
||||
$battlepart['rams']['strongerBuildings'],
|
||||
$battlepart['rams']['moraleBonus']);
|
||||
$newLevel = $battle->calculateNewBuildingLevel($walllevel, $ramsDamage);
|
||||
|
||||
if ($newLevel == 0){
|
||||
$info_ram = "".$ram_pic.",Wall <b>destroyed</b>.";
|
||||
@@ -2184,7 +2188,7 @@ class Automation {
|
||||
// if the defender pop is 0 with no artefact, then destroy the village
|
||||
if($database->getVillageField($data['to'], "pop") == 0 || $targettribe == 5){
|
||||
$can_destroy = $village_destroyed = 1;
|
||||
$info_hero .= " The village has been destroyed.";
|
||||
if(strpos($info_cat, "The village has") === false) $info_hero .= " The village has been destroyed.";
|
||||
}
|
||||
}
|
||||
else $info_hero = $hero_pic.",".$artifactError.$xp;
|
||||
@@ -2233,7 +2237,7 @@ class Automation {
|
||||
}else{
|
||||
if(isset($village_destroyed) && $village_destroyed == 1 && $can_destroy==1){
|
||||
//check if village pop=0 and no info destroy
|
||||
if (strpos($info_cat,"The village has") === false) {
|
||||
if (strpos($info_cat, "The village has") === false) {
|
||||
$info_cat .= "<tbody class=\"goods\"><tr><th>Information</th><td colspan=\"11\">
|
||||
<img class=\"unit u".$catp_pic."\" src=\"img/x.gif\" alt=\"Catapult\" title=\"Catapult\" /> The village has been destroyed.</td></tr></tbody>";
|
||||
}
|
||||
@@ -2488,7 +2492,7 @@ class Automation {
|
||||
}
|
||||
|
||||
//Update starvation data
|
||||
$this->addStarvationData($to['wref']);
|
||||
$database->addStarvationData($to['wref']);
|
||||
|
||||
//Returning units back to village is not necessary because it will be taken care when processing movement
|
||||
// Fix by AL-Kateb
|
||||
@@ -2579,7 +2583,7 @@ class Automation {
|
||||
}
|
||||
|
||||
private function sendreinfunitsComplete() {
|
||||
global $bid23, $database, $battle;
|
||||
global $bid23, $database, $technology, $battle;
|
||||
|
||||
$time = time();
|
||||
$q = "
|
||||
@@ -2717,7 +2721,7 @@ class Automation {
|
||||
}
|
||||
|
||||
//Update starvation data
|
||||
$this->addStarvationData($data['to']);
|
||||
$database->addStarvationData($data['to']);
|
||||
|
||||
//check empty reinforcement in rally point
|
||||
$e_units = '';
|
||||
@@ -2733,7 +2737,7 @@ class Automation {
|
||||
}
|
||||
|
||||
private function returnunitsComplete() {
|
||||
global $database;
|
||||
global $database, $technology;
|
||||
|
||||
$time = time();
|
||||
$q = "
|
||||
@@ -2783,7 +2787,7 @@ class Automation {
|
||||
$movementProcIDs[] = $data['moveid'];
|
||||
|
||||
//Update starvation data
|
||||
$this->addStarvationData($data['to']);
|
||||
$database->addStarvationData($data['to']);
|
||||
}
|
||||
|
||||
$database->setMovementProc(implode(', ', $movementProcIDs));
|
||||
@@ -3233,7 +3237,7 @@ class Automation {
|
||||
}
|
||||
|
||||
private function trainingComplete() {
|
||||
global $database;
|
||||
global $database, $technology;
|
||||
|
||||
$time = time();
|
||||
$trainlist = $database->getTrainingList();
|
||||
@@ -3287,7 +3291,7 @@ class Automation {
|
||||
if ($valuesUpdated) call_user_func(get_class($database).'::clearUnitsCache');
|
||||
|
||||
//Update starvation data
|
||||
$this->addStarvationData($train['vref']);
|
||||
$database->addStarvationData($train['vref']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3677,30 +3681,6 @@ class Automation {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the starvation data in villages with a negative value of crop
|
||||
*
|
||||
* @param int $wref The village ID where the crop is negative
|
||||
*/
|
||||
|
||||
private function addStarvationData($wref){
|
||||
global $database, $technology;
|
||||
|
||||
$getVillage = $database->getVillage($wref);
|
||||
|
||||
//Exlude Support, Nature, Natars, TaskMaster and Multihunter
|
||||
if ($getVillage['owner'] > 5){
|
||||
$crop = $database->getCropProdstarv($wref, false);
|
||||
$unitArrays = $this->getAllUnits($wref, false);
|
||||
$villageUpkeep = $getVillage['pop'] + $technology->getUpkeep($unitArrays, 0, $wref);
|
||||
$starv = $getVillage['starv'];
|
||||
if ($crop < $villageUpkeep){
|
||||
//Add starvation data
|
||||
$database->setVillageFields($wref, ['starv'], [$villageUpkeep]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for starvation - by brainiacX and Shadow
|
||||
@@ -3712,23 +3692,23 @@ class Automation {
|
||||
private function starvation() {
|
||||
global $database, $technology;
|
||||
|
||||
//starvation is disabled during Easter/Holidays/Christmas
|
||||
//Starvation is disabled during Easter/Holidays/Christmas
|
||||
if(PEACE) return;
|
||||
|
||||
$time = time();
|
||||
|
||||
//update starvation in every village
|
||||
//Update starvation in every village
|
||||
$starvarray = $database->getProfileVillages(0, 7);
|
||||
foreach($starvarray as $starv) $this->addStarvationData($starv['wref']);
|
||||
foreach($starvarray as $starv) $database->addStarvationData($starv['wref']);
|
||||
|
||||
// load villages with minus prod
|
||||
//Load villages with minus prod
|
||||
$starvarray = [];
|
||||
$starvarray = $database->getStarvation();
|
||||
|
||||
$vilIDs = [];
|
||||
foreach ($starvarray as $starv) $vilIDs[] = $starv['wref'];
|
||||
|
||||
// cache
|
||||
//Cache
|
||||
$database->getEnforceVillage($vilIDs, 0);
|
||||
$database->getOasisEnforce($vilIDs, 2);
|
||||
$database->getOasisEnforce($vilIDs, 3);
|
||||
@@ -3758,7 +3738,7 @@ class Automation {
|
||||
|
||||
$allTroopsArray = [$enforceArrays, $prisonerArrays, $unitArrays, $attackArrays];
|
||||
|
||||
// find the first not-empty array
|
||||
//Find the first not-empty array
|
||||
foreach($allTroopsArray as $type => $allTroops)
|
||||
{
|
||||
if(!empty($allTroops)){
|
||||
@@ -3771,10 +3751,10 @@ class Automation {
|
||||
}
|
||||
}
|
||||
|
||||
// if the player has no troops, then skip the next instructions
|
||||
//If the player has no troops, then skip the next instructions
|
||||
if(empty($starvingTroops)) continue;
|
||||
|
||||
// counting
|
||||
//Counting
|
||||
$timedif = $time - $starv['starvupdate'];
|
||||
$cropProd = $database->getCropProdstarv($starv['wref']) - $starv['starv'];
|
||||
if($cropProd < 0){
|
||||
@@ -3783,7 +3763,7 @@ class Automation {
|
||||
$newcrop = 0;
|
||||
$oldcrop = $database->getVillageField($starv['wref'], 'crop');
|
||||
|
||||
//if the grain is then tries to send all
|
||||
//If the grain is then tries to send all
|
||||
if ($oldcrop > 100){
|
||||
$difcrop = $difcrop - $oldcrop;
|
||||
if($difcrop < 0){
|
||||
@@ -3804,7 +3784,7 @@ class Automation {
|
||||
$counting = true;
|
||||
while($difcrop > 0)
|
||||
{
|
||||
// search the highest troop
|
||||
//S earch the highest troop
|
||||
$maxcount = $maxtype = 0;
|
||||
for($i = $start ; $i <= $end ; $i++)
|
||||
{
|
||||
@@ -3837,10 +3817,8 @@ class Automation {
|
||||
else if($maxtype == 0) $newCrop = 0;
|
||||
else $newCrop = $GLOBALS['u'.$maxtype]['crop'];
|
||||
|
||||
if($totalKilledUnits > 0)
|
||||
{
|
||||
switch($type)
|
||||
{
|
||||
if($totalKilledUnits > 0){
|
||||
switch($type){
|
||||
case 0:
|
||||
if($totalKilledUnits < $totalUnits){
|
||||
$database->modifyEnforce($starvingTroops['id'], array_keys($killedUnits), array_values($killedUnits), 0);
|
||||
|
||||
+72
-65
@@ -8,7 +8,7 @@
|
||||
## Filename Battle.php ##
|
||||
## Developed by: Dzoki & Dixie ##
|
||||
## Fixed by: Shadow ##
|
||||
## Thanks to: Akakori & Elmar ##
|
||||
## Thanks to: Akakori, Elmar & Kirilloid ##
|
||||
## Reworked and Fix by: ronix ##
|
||||
## Fixed by: InCube - double troops ##
|
||||
## License: TravianZ Project ##
|
||||
@@ -21,6 +21,21 @@
|
||||
|
||||
class Battle {
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Kirilloid --> https://github.com/kirilloid/travian/blob/master/src/model/base/combat.ts
|
||||
* @var double The number of attacking catapults: 1 = 100%, 0 = 0%
|
||||
*
|
||||
*/
|
||||
|
||||
private $sigma;
|
||||
|
||||
public function __construct(){
|
||||
|
||||
$this->sigma = function($x) { return ($x > 1 ? 2 - $x ** -1.5 : $x ** 1.5) / 2; };
|
||||
|
||||
}
|
||||
|
||||
public function procSim($post) {
|
||||
global $form;
|
||||
|
||||
@@ -374,10 +389,10 @@ class Battle {
|
||||
$abcount += 1;
|
||||
|
||||
// Points catapult the attacker
|
||||
if(in_array($i,$catapult)) $catp += (int) $Attacker['u'.$i];
|
||||
if(in_array($i, $catapult)) $catp += (int) $Attacker['u'.$i];
|
||||
|
||||
// Points of the Rams attacker
|
||||
if(in_array($i,$rams)) $ram += (int) $Attacker['u'.$i];
|
||||
if(in_array($i, $rams)) $ram += (int) $Attacker['u'.$i];
|
||||
|
||||
$involve += (int) $Attacker['u'.$i];
|
||||
$units['Att_unit'][$i] = (int) $Attacker['u'.$i];
|
||||
@@ -459,7 +474,7 @@ class Battle {
|
||||
$result['Defend_points'] = $rdp;
|
||||
$winner = ($rap > $rdp);
|
||||
|
||||
// Formula for calculating the Moral
|
||||
// Formula for calculating the Morale bonus
|
||||
// WW villages aren't affected by this bonus
|
||||
if($attpop > $defpop && !$isWWVillage) {
|
||||
$moralbonus = 1 / round(max(0.667, pow($defpop / $attpop, 0.2 * min(1, $rap / ($rdp > 0 ? $rdp : 1)))), 3);
|
||||
@@ -533,57 +548,54 @@ class Battle {
|
||||
}
|
||||
$result['hero_fealthy'] = $fealthy;
|
||||
}
|
||||
|
||||
$ram -= ($winner) ? round($ram * $result[1] / 100) : round($ram * $result[2] / 100);
|
||||
$catp -= ($winner) ? round($catp * $result[1] / 100) : round($catp * $result[2] / 100);
|
||||
}
|
||||
// Formula for the calculation of catapults needed
|
||||
|
||||
if($catp > 0 && $tblevel != 0) {
|
||||
|
||||
//catapults upgrades
|
||||
$upgrades = round(200 * pow(1.0205, $att_ab8) ) / 200;
|
||||
//Catapults blacksmith upgrades
|
||||
$upgrades = round(200 * pow(1.0205, $att_ab8)) / 200;
|
||||
|
||||
$wctp = pow(($rap / $rdp), 1.5);
|
||||
$wctp = ($wctp >= 1) ? 1 - 0.5 / $wctp : 0.5 * $wctp;
|
||||
$wctp *= ($catp + $upgrades);
|
||||
|
||||
//catapults downgrades
|
||||
$downgrades = ($stonemason > 0 ? $bid34[$stonemason]['attri'] / 100 : 1);
|
||||
|
||||
//catapults moral
|
||||
$catpMoral = pow($attpop / ($defpop > 0 ? $defpop : 1) , 0.3);
|
||||
|
||||
// New level of the building (only for warsim.php)
|
||||
$result[3] = $this->calculateNewBuildingLevel($catpMoral, $upgrades, $downgrades, $tblevel, $wctp, $catp, $strongerbuildings);
|
||||
//Buildings durability
|
||||
$durability = ($stonemason > 0 ? $bid34[$stonemason]['attri'] / 100 : 1);
|
||||
|
||||
//Calculates the catapults morale bonus
|
||||
$catpMoraleBonus = min(max(($attpop / ($defpop > 0 ? $defpop : 1)) ** 0.3, 1), 3);
|
||||
|
||||
//New level of the building (only for warsim.php)
|
||||
$catapultsDamage = $this->calculateCatapultsDamage($catp, $upgrades, $durability, $rap / $rdp, $strongerbuildings, $catpMoraleBonus);
|
||||
$result[3] = $this->calculateNewBuildingLevel($tblevel, $catapultsDamage);
|
||||
$result[4] = $tblevel;
|
||||
|
||||
// Results for Automation.php
|
||||
$result['catapults']['moral'] = $catpMoral;
|
||||
//Results for Automation.php
|
||||
$result['catapults']['upgrades'] = $upgrades;
|
||||
$result['catapults']['downgrades'] = $downgrades;
|
||||
$result['catapults']['realAttackers'] = $wctp;
|
||||
$result['catapults']['durability'] = $durability;
|
||||
$result['catapults']['attackDefenseRatio'] = $rap / $rdp;
|
||||
$result['catapults']['strongerBuildings'] = $strongerbuildings;
|
||||
$result['catapults']['moraleBonus'] = $catpMoraleBonus;
|
||||
}
|
||||
|
||||
if($ram > 0 && $walllevel != 0) {
|
||||
|
||||
//Rams blacksmith upgrades
|
||||
$upgrades = round(200 * pow(1.0205, $att_ab7)) / 200;
|
||||
|
||||
$wctp = pow(($rap / $rdp), 1.5);
|
||||
$wctp = ($wctp >= 1) ? 1 - 0.5 / $wctp : 0.5 * $wctp;
|
||||
$wctp *= ($ram) + $upgrades;
|
||||
|
||||
$downgrades = ($stonemason > 0 ? $bid34[$stonemason]['attri'] / 100 : 1);
|
||||
//Building durability
|
||||
$durability = ($stonemason > 0 ? $bid34[$stonemason]['attri'] / 100 : 1);
|
||||
|
||||
// New level of the building (only for warsim.php)
|
||||
$result[7] = $this->calculateNewBuildingLevel(1, $upgrades, $downgrades, $walllevel, $wctp, $ram, $strongerbuildings * 5);
|
||||
$ramsDamage = $this->calculateCatapultsDamage($ram, $upgrades, $durability, $rap / $rdp, $strongerbuildings, 1);
|
||||
$result[7] = $this->calculateNewBuildingLevel($walllevel, $ramsDamage);
|
||||
$result[8] = $walllevel;
|
||||
|
||||
// Results for Automation.php
|
||||
$result['rams']['moral'] = 1;
|
||||
$result['rams']['upgrades'] = $upgrades;
|
||||
$result['rams']['downgrades'] = $downgrades;
|
||||
$result['rams']['realAttackers'] = $wctp;
|
||||
$result['rams']['strongerBuildings'] = $strongerbuildings * 5;
|
||||
$result['rams']['durability'] = $durability;
|
||||
$result['rams']['attackDefenseRatio'] = $rap / $rdp;
|
||||
$result['rams']['strongerBuildings'] = $strongerbuildings;
|
||||
$result['rams']['moraleBonus'] = 1;
|
||||
}
|
||||
|
||||
$result[6] = pow($rap / ($rdp * $moralbonus > 0 ? $rdp * $moralbonus : 1), $Mfactor);
|
||||
@@ -608,7 +620,7 @@ class Battle {
|
||||
|
||||
if ($hero_health <= $damage_health || $damage_health > 90){
|
||||
//hero die
|
||||
$result['casualties_attacker']['11'] = 1;
|
||||
$result['casualties_attacker'][11] = 1;
|
||||
mysqli_query($database->dblink,"update " . TB_PREFIX . "hero set `dead` = 1, `health` = 0 where `heroid`=".(int) $hero_id);
|
||||
}else{
|
||||
mysqli_query($database->dblink,"update " . TB_PREFIX . "hero set `health`=`health`-".(int) $damage_health." where `heroid`=".(int) $hero_id);
|
||||
@@ -735,46 +747,41 @@ class Battle {
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the new building level, after catapults/rams have damaged it
|
||||
* @author Kirilloid --> https://github.com/kirilloid/travian/blob/master/src/model/base/combat.ts
|
||||
*
|
||||
* @param float $moral The catapults/rams battle moral, 1 < moral < 3 => (Total attacker points / Total defender points)^3
|
||||
* @param int $upgrades Upgrades of catapults/rams made in the blacksmith
|
||||
* @param int $downgrades Defender bonuses, such as the stonemason's lodge
|
||||
* @param int $actualLevel The level of the building before the battle
|
||||
* @param int $realAttackers Effective catapults/rams involved in the building damage
|
||||
* @param int $totalAttackers Total catapults/rams sent in the attack
|
||||
* @param int $strongerBuildings Indicates the defender artifacts bonus against catapults
|
||||
* @return int Returns the new level of the damaged building
|
||||
* Calculates the new building level, after damaging it
|
||||
*
|
||||
* @param int $oldLevel The old building level
|
||||
* @param float $damage The damage done by catapults
|
||||
* @return int Returns the new building level
|
||||
*/
|
||||
|
||||
public function CalculateNewBuildingLevel($moral, $upgrades, $downgrades, $actualLevel, $realAttackers, $totalAttackers, $strongerBuildings)
|
||||
{
|
||||
if($moral < 1) $moral = 1;
|
||||
elseif($moral > 3) $moral = 3;
|
||||
|
||||
$needMax = round($this->CalculateNeededCatapults($moral, $upgrades / ($downgrades * $strongerBuildings), $actualLevel));
|
||||
if($needMax <= $realAttackers) return 0;
|
||||
for($i = $actualLevel - 1; $i >= 1; $i--)
|
||||
{
|
||||
$need = $this->CalculateNeededCatapults($moral, $upgrades / ($downgrades * $strongerBuildings), $i);
|
||||
if(min($realAttackers, $totalAttackers) / ($needMax - $need) <= 1) return ++$i;
|
||||
}
|
||||
|
||||
return $actualLevel;
|
||||
public function calculateNewBuildingLevel($oldLevel, $damage){
|
||||
$damage -= 0.5;
|
||||
if ($damage < 0) return $oldLevel;
|
||||
|
||||
while ($damage >= $oldLevel && $oldLevel) $damage -= $oldLevel--;
|
||||
|
||||
return $oldLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the needed catapults/rams to completely destroy a building/wall
|
||||
* @author Kirilloid --> https://github.com/kirilloid/travian/blob/master/src/model/base/combat.ts
|
||||
*
|
||||
* @param float $moral The catapults/rams battle moral
|
||||
* @param int $upDown (Upgrades / Downgrades / Stronger buildings) ratio of catapults/rams
|
||||
* @param int $actualLevel The level of the building before the battle
|
||||
* @return float Returns the needed catapults/rams to destroy a building/wall
|
||||
* Calculates the damage done by catapults
|
||||
*
|
||||
* @param int $catapultsQuantity The quantity of catapults which take part in the attack
|
||||
* @param double $catapultsUpgrade The catapults upgrade multiplier, affected by the cataputls level in the blacksmith
|
||||
* @param double $durability The building durability, affected by the stonemason's lodge
|
||||
* @param double $ADRatio The attack points / defensive points ratio
|
||||
* @param double $strongerBuildings The artifacts multiplier, which strengthens the building, affected by durability artifacts
|
||||
* @param double $moraleBonus The defender morale bonus
|
||||
* @return double Returns the damage done by catapults
|
||||
*/
|
||||
|
||||
public function CalculateNeededCatapults($moral, $upDown, $actualLevel)
|
||||
{
|
||||
return ($moral * (pow($actualLevel, 2) + $actualLevel + 1) / ($upDown == 0 ? 1 : 8 * $upDown)) + 0.5;
|
||||
public function calculateCatapultsDamage($catapultsQuantity, $catapultsUpgrade, $durability, $ADRatio, $strongerBuildings, $moraleBonus){
|
||||
$catapultsEfficiency = floor($catapultsQuantity / ($durability * $strongerBuildings));
|
||||
return 4 * ($this->sigma)($ADRatio) * $catapultsEfficiency * $catapultsUpgrade / $moraleBonus;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+55
-24
@@ -808,11 +808,8 @@ class MYSQLi_DB implements IDbConnection {
|
||||
$pairs[] = $this->escape($fieldName) . ' = ' . (Math::isInt($value[$index]) ? $value[$index] : '"'.$this->escape($value[$index]).'"');
|
||||
}
|
||||
|
||||
if(!$switch) {
|
||||
$q = "UPDATE " . TB_PREFIX . "users SET ".implode(', ', $pairs)." where username = '$ref'";
|
||||
} else {
|
||||
$q = "UPDATE " . TB_PREFIX . "users SET ".implode(', ', $pairs)." where id = " . (int) $ref;
|
||||
}
|
||||
if(!$switch) $q = "UPDATE " . TB_PREFIX . "users SET ".implode(', ', $pairs)." where username = '$ref'";
|
||||
else $q = "UPDATE " . TB_PREFIX . "users SET ".implode(', ', $pairs)." where id = " . (int) $ref;
|
||||
|
||||
// update cached values
|
||||
if ($ret = mysqli_query($this->dblink,$q)) {
|
||||
@@ -858,7 +855,9 @@ class MYSQLi_DB implements IDbConnection {
|
||||
if(!is_array($coordinatesArray[0])) $coordinatesArray = [$coordinatesArray];
|
||||
|
||||
$conditions = [];
|
||||
foreach($coordinatesArray as $coordinate) $conditions[] = "(x = ".$coordinate[0]." AND y = ".$coordinate[1].")";
|
||||
foreach($coordinatesArray as $coordinate){
|
||||
$conditions[] = "(x = ".round($coordinate[0])." AND y = ".round($coordinate[1]).")";
|
||||
}
|
||||
|
||||
$q = "SELECT id FROM " . TB_PREFIX . "wdata WHERE ".implode(" OR ", $conditions);
|
||||
$result = mysqli_query($this->dblink, $q);
|
||||
@@ -1138,20 +1137,20 @@ class MYSQLi_DB implements IDbConnection {
|
||||
function modifyGold($userid, $amt, $mode) {
|
||||
list($userid, $amt, $mode) = $this->escape_input((int) $userid, (int) $amt, $mode);
|
||||
|
||||
if(!$mode) {
|
||||
$q = "UPDATE " . TB_PREFIX . "users set gold = gold - $amt where id = $userid";
|
||||
} else {
|
||||
$q = "UPDATE " . TB_PREFIX . "users set gold = gold + $amt where id = $userid";
|
||||
}
|
||||
if(!$mode) $q = "UPDATE " . TB_PREFIX . "users set gold = gold - $amt where id = $userid";
|
||||
else $q = "UPDATE " . TB_PREFIX . "users set gold = gold + $amt where id = $userid";
|
||||
|
||||
return mysqli_query($this->dblink,$q);
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
Function to retrieve user array via Username or ID
|
||||
Mode 0: Search by Username
|
||||
Mode 1: Search by ID
|
||||
References: Alliance ID
|
||||
*****************************************/
|
||||
/**
|
||||
* Retrieves the user array via Username or ID
|
||||
*
|
||||
* @param int $ref The user ID or the username
|
||||
* @param int $mode 0 --> Search by username, 1 --> Search by user ID
|
||||
* @param bool $use_cache Will use the cache if true
|
||||
* @return array Returns the user array
|
||||
*/
|
||||
|
||||
function getUserArray($ref, $mode, $use_cache = true) {
|
||||
list($ref, $mode) = $this->escape_input($ref, $mode);
|
||||
@@ -1162,11 +1161,9 @@ class MYSQLi_DB implements IDbConnection {
|
||||
return $cachedValue;
|
||||
}
|
||||
|
||||
if(!$mode) {
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "users where username = '$ref' LIMIT 1";
|
||||
} else {
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "users where id = " . (int) $ref . " LIMIT 1";
|
||||
}
|
||||
if(!$mode) $q = "SELECT * FROM " . TB_PREFIX . "users where username = '$ref' LIMIT 1";
|
||||
else $q = "SELECT * FROM " . TB_PREFIX . "users where id = " . (int) $ref . " LIMIT 1";
|
||||
|
||||
$result = mysqli_query($this->dblink,$q);
|
||||
|
||||
self::$fieldsCache[$ref.$mode] = mysqli_fetch_array($result);
|
||||
@@ -7697,7 +7694,6 @@ References: User ID/Message ID, Mode
|
||||
foreach($detailsArray as $field => $value) $values[] = $field."=".$value;
|
||||
|
||||
$q = "UPDATE ".TB_PREFIX."artefacts SET ".implode(",", $values)." WHERE id = $id";
|
||||
echo $q;
|
||||
return mysqli_query($this->dblink, $q);
|
||||
}
|
||||
|
||||
@@ -7858,7 +7854,7 @@ References: User ID/Message ID, Mode
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
$cropo ++;
|
||||
$cropo++;
|
||||
break;
|
||||
case 12:
|
||||
$cropo += 2;
|
||||
@@ -7883,6 +7879,41 @@ References: User ID/Message ID, Mode
|
||||
return self::$cropProductionStarvationValueCache[$wref];
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the starvation data in villages with a negative value of crop
|
||||
*
|
||||
* @param int $wref The village ID where the crop is negative
|
||||
*/
|
||||
|
||||
public function addStarvationData($wref){
|
||||
global $technology;
|
||||
|
||||
$getVillage = $this->getVillage($wref);
|
||||
|
||||
//Exlude Support, Nature, Natars, TaskMaster and Multihunter
|
||||
if ($getVillage['owner'] > 5){
|
||||
$crop = $this->getCropProdstarv($wref, false);
|
||||
$unitArrays = $technology->getAllUnits($wref, false, 0, false);
|
||||
$villageUpkeep = $getVillage['pop'] + $technology->getUpkeep($unitArrays, 0, $wref);
|
||||
$starv = $getVillage['starv'];
|
||||
|
||||
if ($crop < $villageUpkeep){
|
||||
//Add starvation data
|
||||
$fields = ['starv'];
|
||||
$values = [$villageUpkeep];
|
||||
|
||||
//Update the starvupdate if it's set to 0
|
||||
if($getVillage['starvupdate'] == 0) {
|
||||
$fields[] = 'starvupdate';
|
||||
$values[] = time();
|
||||
}
|
||||
|
||||
//Update the starvation datas
|
||||
$this->setVillageFields($wref, $fields, $values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//general statistics
|
||||
|
||||
function addGeneralAttack($casualties) {
|
||||
|
||||
@@ -1031,6 +1031,7 @@ define("YOU_CONSTRUCT","You can construct ");
|
||||
define("CRANNY_INCREASED","Cranny capacity is increased by");
|
||||
define("CRANNY_DECRESE","Cranny capacity is decrese by");
|
||||
define("WW_BUILDING_PLAN","You can build the Wonder of the World");
|
||||
define("NO_WW","There are no Wonders of the World");
|
||||
define("NO_PREVIOUS_OWNERS","There are no previous owners.");
|
||||
define("TREASURY_DESC","The riches of your empire are kept in the treasury. The treasury has room for one treasure. After you have captured an artefact it takes 24 hours on a normal server or 12 hours on a thrice speed server to be effective.");
|
||||
|
||||
|
||||
+26
-33
@@ -11,7 +11,7 @@
|
||||
|
||||
class Ranking {
|
||||
|
||||
public $rankarray = array();
|
||||
public $rankarray = [];
|
||||
private $rlastupdate;
|
||||
|
||||
public function getRank() {
|
||||
@@ -20,14 +20,15 @@
|
||||
|
||||
public function getUserRank($id) {
|
||||
global $database;
|
||||
|
||||
$ranking = $this->getRank();
|
||||
$users = "SELECT Count(*) as Total FROM " . TB_PREFIX . "users WHERE access < " . (INCLUDE_ADMIN ? "10" : "8");
|
||||
$users2 = mysqli_fetch_array(mysqli_query($database->dblink,$users), MYSQLI_ASSOC);
|
||||
$users2 = $users2['Total'];
|
||||
$users3 = $users2+1;
|
||||
$users3 = $users2 + 1;
|
||||
$myrank = 0;
|
||||
if(count($ranking) > 0) {
|
||||
for($i=0;$i<($users3);$i++) {
|
||||
for($i = 0;$i < $users3; $i++) {
|
||||
if( isset( $ranking[$i]['userid'] ) ) {
|
||||
if($ranking[$i]['userid'] == $id && $ranking[$i] != "pad") {
|
||||
$myrank = $i;
|
||||
@@ -197,31 +198,25 @@
|
||||
}
|
||||
|
||||
public function searchRank($name, $field) {
|
||||
while(1) {
|
||||
//$key = key($this->rankarray);
|
||||
for($key=0;$key<count($this->rankarray);$key++){
|
||||
if($this->rankarray[$key]!="pad") {
|
||||
if($this->rankarray[$key][$field] == $name) {
|
||||
return $key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!next($this->rankarray)) {
|
||||
if($field != "userid"){
|
||||
return $name;
|
||||
break;
|
||||
}else{
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
while(1) {
|
||||
//$key = key($this->rankarray);
|
||||
for($key = 0; $key < count($this->rankarray); $key++){
|
||||
if($this->rankarray[$key]!="pad") {
|
||||
if($this->rankarray[$key][$field] == $name) return $key;
|
||||
}
|
||||
}
|
||||
if(!next($this->rankarray)) {
|
||||
if($field != "userid") return $name;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function procRankArray() {
|
||||
global $multisort, $database;
|
||||
|
||||
if($GLOBALS['db']->countUser() > 0){
|
||||
$holder = array();
|
||||
if(SHOW_NATARS == True){
|
||||
@@ -272,12 +267,10 @@
|
||||
ORDER BY totalpop DESC, totalvillages DESC, userid DESC";
|
||||
}
|
||||
|
||||
$datas = array();
|
||||
$datas = [];
|
||||
|
||||
$result = (mysqli_query($database->dblink,$q));
|
||||
while($row = mysqli_fetch_assoc($result)) {
|
||||
$datas[] = $row;
|
||||
}
|
||||
while($row = mysqli_fetch_assoc($result)) $datas[] = $row;
|
||||
|
||||
if (count($datas)) {
|
||||
foreach($datas as $result) {
|
||||
@@ -292,12 +285,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
$newholder = array("pad");
|
||||
foreach($holder as $key) {
|
||||
array_push($newholder, $key);
|
||||
}
|
||||
$newholder = ["pad"];
|
||||
foreach($holder as $key) array_push($newholder, $key);
|
||||
|
||||
$this->rankarray = $newholder;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function procRankRaceArray($race) {
|
||||
|
||||
@@ -236,13 +236,13 @@ class Technology {
|
||||
return $ownunit;
|
||||
}
|
||||
|
||||
function getAllUnits($base, $InVillageOnly = false, $mode=0) {
|
||||
function getAllUnits($base, $InVillageOnly = false, $mode = 0, $useCache = true) {
|
||||
global $database;
|
||||
|
||||
$ownunit = $database->getUnit($base);
|
||||
$ownunit = $database->getUnit($base, $useCache);
|
||||
$ownunit['u99'] -= $ownunit['u99'];
|
||||
$ownunit['u99o'] -= $ownunit['u99o'];
|
||||
$enforcementarray = $database->getEnforceVillage($base, 0);
|
||||
$enforcementarray = $database->getEnforceVillage($base, 0, $useCache);
|
||||
if(count($enforcementarray) > 0){
|
||||
foreach($enforcementarray as $enforce){
|
||||
for($i = 1; $i <= 50; $i++){
|
||||
@@ -252,7 +252,7 @@ class Technology {
|
||||
}
|
||||
}
|
||||
if($mode == 0){
|
||||
$enforceoasis = $database->getOasisEnforce($base, 0);
|
||||
$enforceoasis = $database->getOasisEnforce($base, 0, $useCache);
|
||||
if(count($enforceoasis) > 0){
|
||||
foreach($enforceoasis as $enforce){
|
||||
for($i = 1; $i <= 50; $i++){
|
||||
@@ -261,7 +261,7 @@ class Technology {
|
||||
$ownunit['hero'] += $enforce['hero'];
|
||||
}
|
||||
}
|
||||
$enforceoasis1 = $database->getOasisEnforce($base, 1);
|
||||
$enforceoasis1 = $database->getOasisEnforce($base, 1, $useCache);
|
||||
if(count($enforceoasis1) > 0){
|
||||
foreach($enforceoasis1 as $enforce){
|
||||
for($i = 1; $i <= 50; $i++){
|
||||
@@ -271,7 +271,7 @@ class Technology {
|
||||
}
|
||||
}
|
||||
|
||||
$prisoners = $database->getPrisoners($base, 1);
|
||||
$prisoners = $database->getPrisoners($base, 1, $useCache);
|
||||
if(!empty($prisoners)){
|
||||
foreach($prisoners as $prisoner){
|
||||
$owner = $database->getVillageField($base, "owner");
|
||||
|
||||
@@ -224,6 +224,7 @@ class Units {
|
||||
|
||||
$to = $database->getVillage($enforce['from']);
|
||||
$tribe = $database->getUserField($to['owner'], 'tribe', 0);
|
||||
$start = ($tribe - 1) * 10 + 1;
|
||||
|
||||
$troopsTime = $this->getWalkingTroopsTime($enforce['from'], $enforce['vref'], $to['owner'], $tribe, $enforce, 1);
|
||||
$time = $database->getArtifactsValueInfluence($from['owner'], $enforce['from'], 2, $troopsTime);
|
||||
|
||||
@@ -61,6 +61,7 @@ or you have a feature request to be included in the play.
|
||||
|
||||
**Thanks**
|
||||
|
||||
A big thanks to [Kirilloid](https://github.com/kirilloid) who helped us a lot with the Battle System formulas.
|
||||
Many thanks to all those who recently played around with the project and tested it both, locally and on their
|
||||
own servers. This includes [ZZJHONS](https://github.com/ZZJHONS), [DracoMilesX](https://github.com/DracoMilesX),
|
||||
[phaze1G](https://github.com/phaze1G) and many others who were too shy to let us know that they use and enjoy
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
$oasisarray = $database->getOasis($village->wid);
|
||||
if(isset($_GET['gid']) && $_GET['gid'] == 37 && isset($_GET['del']) && $database->getOasisField($_GET['del'], 'owner') == $session->uid){
|
||||
$database->removeOases($_GET['del']);
|
||||
$units->returnTroops($village->wid, 1);
|
||||
$database->removeOases($_GET['del']);
|
||||
header("Location: build.php?id=".$id."&land");
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,7 @@ if(!is_numeric($_SESSION['search'])) {
|
||||
<?php
|
||||
$search = 0;
|
||||
}
|
||||
else {
|
||||
$search = $_SESSION['search'];
|
||||
}
|
||||
else $search = $_SESSION['search'];
|
||||
?>
|
||||
<table cellpadding="1" cellspacing="1" id="alliance" class="row_table_data">
|
||||
<thead>
|
||||
@@ -19,36 +17,34 @@ $search = $_SESSION['search'];
|
||||
<tr><td></td><td>Alliance</td><td>Player</td><td>Ø</td><td>Points</td></tr>
|
||||
</thead><tbody>
|
||||
<?php
|
||||
$rankArray = $ranking->getRank();
|
||||
if(isset($_GET['rank'])){
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($ranking->getRank())) {
|
||||
$_GET['rank'] = count($ranking->getRank())-1;
|
||||
}
|
||||
while($_GET['rank'] > (20*$multiplier)) {
|
||||
$multiplier +=1;
|
||||
}
|
||||
$start = 20*$multiplier-19;
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
if(count($ranking->getRank()) > 0) {
|
||||
$ranking = $ranking->getRank();
|
||||
for($i=$start;$i<($start+20);$i++) {
|
||||
if(isset($ranking[$i]['name']) && $ranking[$i] != "pad") {
|
||||
if($i == $search) {
|
||||
echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
}
|
||||
else {
|
||||
echo "<tr><td class=\"ra \" >";
|
||||
}
|
||||
echo $i.".</td><td class=\"al \" ><a href=\"allianz.php?aid=".$ranking[$i]['id']."\">".$ranking[$i]['tag']."</a></td><td class=\"pla \" >";
|
||||
echo $ranking[$i]['players']."</td><td class=\"av \" >".$ranking[$i]['avg']."</td><td class=\"po \">".$ranking[$i]['totalpop']."</td></tr>";
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($rankArray)) {
|
||||
$_GET['rank'] = count($rankArray) - 1;
|
||||
}
|
||||
|
||||
while($_GET['rank'] > (20*$multiplier)) $multiplier++;
|
||||
|
||||
$start = 20 * $multiplier - 19;
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
|
||||
if(count($rankArray) > 1) {
|
||||
for($i = $start; $i < $start + 20; $i++) {
|
||||
if(isset($rankArray[$i]['name']) && $rankArray[$i] != "pad") {
|
||||
if($i == $search) echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
else echo "<tr><td class=\"ra \" >";
|
||||
|
||||
echo $i.".</td><td class=\"al \" ><a href=\"allianz.php?aid=".$rankArray[$i]['id']."\">".$rankArray[$i]['tag']."</a></td><td class=\"pla \" >";
|
||||
echo $rankArray[$i]['players']."</td><td class=\"av \" >".$rankArray[$i]['avg']."</td><td class=\"po \">".$rankArray[$i]['totalpop']."</td></tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "<td class=\"none\" colspan=\"5\">No alliance's found</td>";
|
||||
}
|
||||
else echo "<td class=\"none\" colspan=\"5\">No alliances found</td>";
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -5,9 +5,7 @@ if(!is_numeric($_SESSION['search'])) {
|
||||
<?php
|
||||
$search = 0;
|
||||
}
|
||||
else {
|
||||
$search = $_SESSION['search'];
|
||||
}
|
||||
else $search = $_SESSION['search'];
|
||||
?>
|
||||
<table cellpadding="1" cellspacing="1" id="alliance_off" class="row_table_data">
|
||||
<thead>
|
||||
@@ -19,36 +17,34 @@ $search = $_SESSION['search'];
|
||||
<tr><td></td><td>Alliance</td><td>Player</td><td>Points</td></tr>
|
||||
</thead><tbody>
|
||||
<?php
|
||||
$rankArray = $ranking->getRank();
|
||||
if(isset($_GET['rank'])){
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($ranking->getRank())) {
|
||||
$_GET['rank'] = count($ranking->getRank())-1;
|
||||
}
|
||||
while($_GET['rank'] > (20*$multiplier)) {
|
||||
$multiplier +=1;
|
||||
}
|
||||
$start = 20*$multiplier-19;
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
if(count($ranking->getRank()) > 0) {
|
||||
$ranking = $ranking->getRank();
|
||||
for($i=$start;$i<($start+20);$i++) {
|
||||
if(isset($ranking[$i]['name']) && $ranking[$i] != "pad") {
|
||||
if($i == $search) {
|
||||
echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
}
|
||||
else {
|
||||
echo "<tr><td class=\"ra \" >";
|
||||
}
|
||||
echo $i.".</td><td class=\"al \" ><a href=\"allianz.php?aid=".$ranking[$i]['id']."\">".$ranking[$i]['tag']."</a></td><td class=\"pla \" >";
|
||||
echo $ranking[$i]['players']."</td><td class=\"po \">".$ranking[$i]['Aap']."</td></tr>";
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($rankArray)) {
|
||||
$_GET['rank'] = count($rankArray) - 1;
|
||||
}
|
||||
|
||||
while($_GET['rank'] > (20*$multiplier)) $multiplier++;
|
||||
|
||||
$start = 20 * $multiplier - 19;
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
|
||||
if(count($rankArray) > 1) {
|
||||
for($i = $start; $i < $start + 20; $i++) {
|
||||
if(isset($rankArray[$i]['name']) && $rankArray[$i] != "pad") {
|
||||
if($i == $search) echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
else echo "<tr><td class=\"ra \" >";
|
||||
|
||||
echo $i.".</td><td class=\"al \" ><a href=\"allianz.php?aid=".$rankArray[$i]['id']."\">".$rankArray[$i]['tag']."</a></td><td class=\"pla \" >";
|
||||
echo $rankArray[$i]['players']."</td><td class=\"po \">".$rankArray[$i]['Aap']."</td></tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "<td class=\"none\" colspan=\"5\">No users found</td>";
|
||||
}
|
||||
else echo "<td class=\"none\" colspan=\"5\">No alliances found</td>";
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -5,9 +5,7 @@ if(!is_numeric($_SESSION['search'])) {
|
||||
<?php
|
||||
$search = 0;
|
||||
}
|
||||
else {
|
||||
$search = $_SESSION['search'];
|
||||
}
|
||||
else $search = $_SESSION['search'];
|
||||
?>
|
||||
<table cellpadding="1" cellspacing="1" id="alliance_def" class="row_table_data">
|
||||
<thead>
|
||||
@@ -19,36 +17,34 @@ $search = $_SESSION['search'];
|
||||
<tr><td></td><td>Alliance</td><td>Player</td><td>Points</td></tr>
|
||||
</thead><tbody>
|
||||
<?php
|
||||
$rankArray = $ranking->getRank();
|
||||
if(isset($_GET['rank'])){
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($ranking->getRank())) {
|
||||
$_GET['rank'] = count($ranking->getRank())-1;
|
||||
}
|
||||
while($_GET['rank'] > (20*$multiplier)) {
|
||||
$multiplier +=1;
|
||||
}
|
||||
$start = 20*$multiplier-19;
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
if(count($ranking->getRank()) > 0) {
|
||||
$ranking = $ranking->getRank();
|
||||
for($i=$start;$i<($start+20);$i++) {
|
||||
if(isset($ranking[$i]['name']) && $ranking[$i] != "pad") {
|
||||
if($i == $search) {
|
||||
echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
}
|
||||
else {
|
||||
echo "<tr><td class=\"ra \" >";
|
||||
}
|
||||
echo $i.".</td><td class=\"al \" ><a href=\"allianz.php?aid=".$ranking[$i]['id']."\">".$ranking[$i]['tag']."</a></td><td class=\"pla \" >";
|
||||
echo $ranking[$i]['players']."</td><td class=\"po \">".$ranking[$i]['Adp']."</td></tr>";
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($rankArray)) {
|
||||
$_GET['rank'] = count($rankArray) - 1;
|
||||
}
|
||||
|
||||
while($_GET['rank'] > (20*$multiplier)) $multiplier++;
|
||||
|
||||
$start = 20 * $multiplier - 19;
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
|
||||
if(count($rankArray) > 1) {
|
||||
for($i = $start; $i < $start + 20; $i++) {
|
||||
if(isset($rankArray[$i]['name']) && $rankArray[$i] != "pad") {
|
||||
if($i == $search) echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
else echo "<tr><td class=\"ra \" >";
|
||||
|
||||
echo $i.".</td><td class=\"al \" ><a href=\"allianz.php?aid=".$rankArray[$i]['id']."\">".$rankArray[$i]['tag']."</a></td><td class=\"pla \" >";
|
||||
echo $rankArray[$i]['players']."</td><td class=\"po \">".$rankArray[$i]['Adp']."</td></tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "<td class=\"none\" colspan=\"5\">No users found</td>";
|
||||
}
|
||||
else echo "<td class=\"none\" colspan=\"5\">No alliances found</td>";
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
$tribe1 = mysqli_fetch_array(mysqli_query($database->dblink,"SELECT Count(*) as Total FROM ".TB_PREFIX."users WHERE tribe = 1"), MYSQLI_ASSOC);
|
||||
$tribe2 = mysqli_fetch_array(mysqli_query($database->dblink,"SELECT Count(*) as Total FROM ".TB_PREFIX."users WHERE tribe = 2"), MYSQLI_ASSOC);
|
||||
$tribe3 = mysqli_fetch_array(mysqli_query($database->dblink,"SELECT Count(*) as Total FROM ".TB_PREFIX."users WHERE tribe = 3"), MYSQLI_ASSOC);
|
||||
$tribes = array($tribe1['Total'], $tribe2['Total'], $tribe3['Total']);
|
||||
$tribes = [$tribe1['Total'], $tribe2['Total'], $tribe3['Total']];
|
||||
$users = mysqli_fetch_array(mysqli_query($database->dblink,"SELECT Count(*) as Total FROM " . TB_PREFIX . "users WHERE tribe > 0 AND tribe < 4"), MYSQLI_ASSOC);
|
||||
$users = $users['Total'];
|
||||
?>
|
||||
|
||||
@@ -26,44 +26,40 @@
|
||||
<tr><td></td><td>Hero</td><td>Player</td><td>Level</td><td>Experience</td></tr>
|
||||
</thead><tbody>
|
||||
<?php
|
||||
if(isset($_GET['rank'])) {
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($ranking->getRank())) {
|
||||
$_GET['rank'] = count($ranking->getRank()) - 1;
|
||||
}
|
||||
while($_GET['rank'] > (20 * $multiplier)) {
|
||||
$multiplier += 1;
|
||||
}
|
||||
$start = 20 * $multiplier - 19;
|
||||
} else {
|
||||
$start = ($_SESSION['start'] + 1);
|
||||
}
|
||||
} else {
|
||||
$start = ($_SESSION['start'] + 1);
|
||||
$rankArray = $ranking->getRank();
|
||||
if(isset($_GET['rank'])){
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($rankArray)) {
|
||||
$_GET['rank'] = count($rankArray) - 1;
|
||||
}
|
||||
|
||||
while($_GET['rank'] > (20 * $multiplier)) $multiplier++;
|
||||
|
||||
$start = 20 * $multiplier - 19;
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
}
|
||||
if(count($ranking->getRank()) > 0) {
|
||||
$ranking = $ranking->getRank();
|
||||
for($i = $start; $i < ($start + 20); $i++) {
|
||||
if(isset($ranking[$i]['name']) && $ranking[$i] != "pad") {
|
||||
if($i == $search) {
|
||||
echo "<tr class=\"hl \"><td class=\"ra fc\" >";
|
||||
} else {
|
||||
echo "<tr><td class=\"ra \" >";
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
|
||||
if(count($rankArray) > 1) {
|
||||
for($i = $start; $i < $start + 20; $i++) {
|
||||
if(isset($rankArray[$i]['name']) && $rankArray[$i] != "pad") {
|
||||
if($i == $search) echo "<tr class=\"hl \"><td class=\"ra fc\" >";
|
||||
else echo "<tr><td class=\"ra \" >";
|
||||
|
||||
echo $i . ".</td>
|
||||
<td class=\"hero \">
|
||||
<img class=\"unit u" . $ranking[$i]['unit'] . "\" alt=\"\" title=\"\" src=\"img/x.gif\"> " . $ranking[$i]['name'] . "</td>
|
||||
<td class=\"pla \"><center><a href=\"spieler.php?uid=" . $ranking[$i]['uid'] . "\">" . $ranking[$i]['owner'] . "</a></center></td>
|
||||
<td class=\"lev \">" . $ranking[$i]['level'] . "</td>
|
||||
<td class=\"xp \">" . $ranking[$i]['experience'] . "</td>
|
||||
<img class=\"unit u" . $rankArray[$i]['unit'] . "\" alt=\"\" title=\"\" src=\"img/x.gif\"> " . $rankArray[$i]['name'] . "</td>
|
||||
<td class=\"pla \"><center><a href=\"spieler.php?uid=" . $rankArray[$i]['uid'] . "\">" . $rankArray[$i]['owner'] . "</a></center></td>
|
||||
<td class=\"lev \">" . $rankArray[$i]['level'] . "</td>
|
||||
<td class=\"xp \">" . $rankArray[$i]['experience'] . "</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "<td class=\"none\" colspan=\"5\">No heros found</td>";
|
||||
}
|
||||
else echo "<td class=\"none\" colspan=\"5\">No heros found</td>";
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
@@ -19,48 +19,43 @@ $search = $_SESSION['search'];
|
||||
<tr><td></td><td>Player</td><td>Alliance</td><td>Population</td><td>Villages</td></tr>
|
||||
</thead><tbody>
|
||||
<?php
|
||||
$rankArray = $ranking->getRank();
|
||||
if(isset($_GET['rank'])){
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($ranking->getRank())) {
|
||||
$_GET['rank'] = count($ranking->getRank())-1;
|
||||
}
|
||||
while($_GET['rank'] > (20*$multiplier)) {
|
||||
$multiplier +=1;
|
||||
}
|
||||
$start = 20*$multiplier-19;
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
if(count($ranking->getRank()) > 0) {
|
||||
$ranking = $ranking->getRank();
|
||||
for($i=$start;$i<($start+20);$i++) {
|
||||
if(isset($ranking[$i]['username']) && $ranking[$i] != "pad") {
|
||||
if($i == $search) {
|
||||
echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
}
|
||||
else {
|
||||
echo "<tr><td class=\"ra \" >";
|
||||
}
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($rankArray)) {
|
||||
$_GET['rank'] = count($rankArray) - 1;
|
||||
}
|
||||
while($_GET['rank'] > (20 * $multiplier)) $multiplier++;
|
||||
|
||||
$start = 20 * $multiplier - 19;
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
|
||||
if(count($rankArray) > 1) {
|
||||
for($i = $start; $i < $start + 20; $i++) {
|
||||
if(isset($rankArray[$i]['username']) && $rankArray[$i] != "pad") {
|
||||
if($i == $search) echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
else echo "<tr><td class=\"ra \" >";
|
||||
|
||||
echo $i.".</td><td class=\"pla \" >";
|
||||
if(isset($ranking[$i]['access']) && $ranking[$i]['access'] > 2){
|
||||
echo"<u><a href=\"spieler.php?uid=".$ranking[$i]['userid']."\">".$ranking[$i]['username']."</a></u>";
|
||||
} else {
|
||||
echo"<a href=\"spieler.php?uid=".$ranking[$i]['userid']."\">".$ranking[$i]['username']."</a>";
|
||||
}
|
||||
echo"</td><td class=\"al\" >";
|
||||
if($ranking[$i]['aname'] != "") {
|
||||
echo "<a href=\"allianz.php?aid=".$ranking[$i]['alliance']."\">".$ranking[$i]['aname']."</a>";
|
||||
if(isset($rankArray[$i]['access']) && $rankArray[$i]['access'] > 2){
|
||||
echo"<u><a href=\"spieler.php?uid=".$rankArray[$i]['userid']."\">".$rankArray[$i]['username']."</a></u>";
|
||||
} else {
|
||||
echo"<a href=\"spieler.php?uid=".$rankArray[$i]['userid']."\">".$rankArray[$i]['username']."</a>";
|
||||
}
|
||||
else {
|
||||
echo "-";
|
||||
echo"</td><td class=\"al\" >";
|
||||
if($rankArray[$i]['aname'] != "") {
|
||||
echo "<a href=\"allianz.php?aid=".$rankArray[$i]['alliance']."\">".$rankArray[$i]['aname']."</a>";
|
||||
}
|
||||
echo "</td><td class=\"pop\" >".$ranking[$i]['totalpop']."</td><td class=\"vil\">".$ranking[$i]['totalvillage']."</td></tr>";
|
||||
else echo "-";
|
||||
echo "</td><td class=\"pop\" >".$rankArray[$i]['totalpop']."</td><td class=\"vil\">".$rankArray[$i]['totalvillage']."</td></tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "<td class=\"none\" colspan=\"5\">No users found</td>";
|
||||
}
|
||||
else echo "<td class=\"none\" colspan=\"5\">No users found</td>";
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -19,48 +19,44 @@ $search = $_SESSION['search'];
|
||||
<tr><td></td><td>Player</td><td>Alliance</td><td>Population</td><td>Villages</td></tr>
|
||||
</thead><tbody>
|
||||
<?php
|
||||
$rankArray = $ranking->getRank();
|
||||
if(isset($_GET['rank'])){
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($ranking->getRank())) {
|
||||
$_GET['rank'] = count($ranking->getRank())-1;
|
||||
}
|
||||
while($_GET['rank'] > (20*$multiplier)) {
|
||||
$multiplier +=1;
|
||||
}
|
||||
$start = 20*$multiplier-19;
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($rankArray)) {
|
||||
$_GET['rank'] = count($rankArray) - 1;
|
||||
}
|
||||
while($_GET['rank'] > (20 * $multiplier)) $multiplier++;
|
||||
|
||||
$start = 20 * $multiplier - 19;
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
|
||||
if(count($database->getUserByTribe(1)) > 0) {
|
||||
$ranking = $ranking->getRank();
|
||||
for($i=$start;$i<($start+20);$i++) {
|
||||
if(isset($ranking[$i]['username']) && $ranking[$i] != "pad") {
|
||||
if($i == $search) {
|
||||
echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
}
|
||||
else {
|
||||
echo "<tr><td class=\"ra \" >";
|
||||
}
|
||||
for($i = $start; $i< $start + 20; $i++) {
|
||||
if(isset($rankArray[$i]['username']) && $rankArray[$i] != "pad") {
|
||||
if($i == $search) echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
else echo "<tr><td class=\"ra \" >";
|
||||
|
||||
echo $i.".</td><td class=\"pla \" >";
|
||||
if(isset($ranking[$i]['access']) && $ranking[$i]['access'] > 2){
|
||||
echo"<u><a href=\"spieler.php?uid=".$ranking[$i]['userid']."\">".$ranking[$i]['username']."</a></u>";
|
||||
if(isset($rankArray[$i]['access']) && $rankArray[$i]['access'] > 2){
|
||||
echo"<u><a href=\"spieler.php?uid=".$rankArray[$i]['userid']."\">".$rankArray[$i]['username']."</a></u>";
|
||||
} else {
|
||||
echo"<a href=\"spieler.php?uid=".$ranking[$i]['userid']."\">".$ranking[$i]['username']."</a>";
|
||||
echo"<a href=\"spieler.php?uid=".$rankArray[$i]['userid']."\">".$rankArray[$i]['username']."</a>";
|
||||
}
|
||||
echo"</td><td class=\"al\" >";
|
||||
if($ranking[$i]['alliance'] != 0) {
|
||||
echo "<a href=\"allianz.php?aid=".$ranking[$i]['alliance']."\">".$ranking[$i]['aname']."</a>";
|
||||
if($rankArray[$i]['alliance'] > 0) {
|
||||
echo "<a href=\"allianz.php?aid=".$rankArray[$i]['alliance']."\">".$rankArray[$i]['aname']."</a>";
|
||||
}
|
||||
else {
|
||||
echo "-";
|
||||
}
|
||||
echo "</td><td class=\"pop\" >".$ranking[$i]['totalpop']."</td><td class=\"vil\">".$ranking[$i]['totalvillage']."</td></tr>";
|
||||
else echo "-";
|
||||
|
||||
echo "</td><td class=\"pop\" >".$rankArray[$i]['totalpop']."</td><td class=\"vil\">".$rankArray[$i]['totalvillage']."</td></tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "<td class=\"none\" colspan=\"5\">No users found</td>";
|
||||
}
|
||||
else echo "<td class=\"none\" colspan=\"5\">No users found</td>";
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -19,48 +19,44 @@ $search = $_SESSION['search'];
|
||||
<tr><td></td><td>Player</td><td>Alliance</td><td>Population</td><td>Villages</td></tr>
|
||||
</thead><tbody>
|
||||
<?php
|
||||
$rankArray = $ranking->getRank();
|
||||
if(isset($_GET['rank'])){
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($ranking->getRank())) {
|
||||
$_GET['rank'] = count($ranking->getRank())-1;
|
||||
}
|
||||
while($_GET['rank'] > (20*$multiplier)) {
|
||||
$multiplier +=1;
|
||||
}
|
||||
$start = 20*$multiplier-19;
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($rankArray)) {
|
||||
$_GET['rank'] = count($rankArray) - 1;
|
||||
}
|
||||
while($_GET['rank'] > (20 * $multiplier)) $multiplier++;
|
||||
|
||||
$start = 20 * $multiplier - 19;
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
|
||||
if(count($database->getUserByTribe(2)) > 0) {
|
||||
$ranking = $ranking->getRank();
|
||||
for($i=$start;$i<($start+20);$i++) {
|
||||
if(isset($ranking[$i]['username']) && $ranking[$i] != "pad") {
|
||||
if($i == $search) {
|
||||
echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
}
|
||||
else {
|
||||
echo "<tr><td class=\"ra \" >";
|
||||
}
|
||||
for($i = $start; $i< $start + 20; $i++) {
|
||||
if(isset($rankArray[$i]['username']) && $rankArray[$i] != "pad") {
|
||||
if($i == $search) echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
else echo "<tr><td class=\"ra \" >";
|
||||
|
||||
echo $i.".</td><td class=\"pla \" >";
|
||||
if($ranking[$i]['access'] > 2){
|
||||
echo"<u><a href=\"spieler.php?uid=".$ranking[$i]['userid']."\">".$ranking[$i]['username']."</a></u>";
|
||||
} else {
|
||||
echo"<a href=\"spieler.php?uid=".$ranking[$i]['userid']."\">".$ranking[$i]['username']."</a>";
|
||||
}
|
||||
echo"</td><td class=\"al\" >";
|
||||
if($ranking[$i]['alliance'] != 0) {
|
||||
echo "<a href=\"allianz.php?aid=".$ranking[$i]['alliance']."\">".$ranking[$i]['aname']."</a>";
|
||||
if(isset($rankArray[$i]['access']) && $rankArray[$i]['access'] > 2){
|
||||
echo"<u><a href=\"spieler.php?uid=".$rankArray[$i]['userid']."\">".$rankArray[$i]['username']."</a></u>";
|
||||
} else {
|
||||
echo"<a href=\"spieler.php?uid=".$rankArray[$i]['userid']."\">".$rankArray[$i]['username']."</a>";
|
||||
}
|
||||
else {
|
||||
echo "-";
|
||||
echo"</td><td class=\"al\" >";
|
||||
if($rankArray[$i]['alliance'] > 0) {
|
||||
echo "<a href=\"allianz.php?aid=".$rankArray[$i]['alliance']."\">".$rankArray[$i]['aname']."</a>";
|
||||
}
|
||||
echo "</td><td class=\"pop\" >".$ranking[$i]['totalpop']."</td><td class=\"vil\">".$ranking[$i]['totalvillage']."</td></tr>";
|
||||
else echo "-";
|
||||
|
||||
echo "</td><td class=\"pop\" >".$rankArray[$i]['totalpop']."</td><td class=\"vil\">".$rankArray[$i]['totalvillage']."</td></tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "<td class=\"none\" colspan=\"5\">No users found</td>";
|
||||
}
|
||||
else echo "<td class=\"none\" colspan=\"5\">No users found</td>";
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -19,48 +19,44 @@ $search = $_SESSION['search'];
|
||||
<tr><td></td><td>Player</td><td>Alliance</td><td>Population</td><td>Villages</td></tr>
|
||||
</thead><tbody>
|
||||
<?php
|
||||
$rankArray = $ranking->getRank();
|
||||
if(isset($_GET['rank'])){
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($ranking->getRank())) {
|
||||
$_GET['rank'] = count($ranking->getRank())-1;
|
||||
}
|
||||
while($_GET['rank'] > (20*$multiplier)) {
|
||||
$multiplier +=1;
|
||||
}
|
||||
$start = 20*$multiplier-19;
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($rankArray)) {
|
||||
$_GET['rank'] = count($rankArray) - 1;
|
||||
}
|
||||
while($_GET['rank'] > (20 * $multiplier)) $multiplier++;
|
||||
|
||||
$start = 20 * $multiplier - 19;
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
|
||||
if(count($database->getUserByTribe(3)) > 0) {
|
||||
$ranking = $ranking->getRank();
|
||||
for($i=$start;$i<($start+20);$i++) {
|
||||
if(isset($ranking[$i]['username']) && $ranking[$i] != "pad") {
|
||||
if($i == $search) {
|
||||
echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
}
|
||||
else {
|
||||
echo "<tr><td class=\"ra \" >";
|
||||
}
|
||||
for($i = $start; $i< $start + 20; $i++) {
|
||||
if(isset($rankArray[$i]['username']) && $rankArray[$i] != "pad") {
|
||||
if($i == $search) echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
else echo "<tr><td class=\"ra \" >";
|
||||
|
||||
echo $i.".</td><td class=\"pla \" >";
|
||||
if($ranking[$i]['access'] > 2){
|
||||
echo"<u><a href=\"spieler.php?uid=".$ranking[$i]['userid']."\">".$ranking[$i]['username']."</a></u>";
|
||||
} else {
|
||||
echo"<a href=\"spieler.php?uid=".$ranking[$i]['userid']."\">".$ranking[$i]['username']."</a>";
|
||||
}
|
||||
echo"</td><td class=\"al\" >";
|
||||
if($ranking[$i]['alliance'] != 0) {
|
||||
echo "<a href=\"allianz.php?aid=".$ranking[$i]['alliance']."\">".$ranking[$i]['aname']."</a>";
|
||||
if(isset($rankArray[$i]['access']) && $rankArray[$i]['access'] > 2){
|
||||
echo"<u><a href=\"spieler.php?uid=".$rankArray[$i]['userid']."\">".$rankArray[$i]['username']."</a></u>";
|
||||
} else {
|
||||
echo"<a href=\"spieler.php?uid=".$rankArray[$i]['userid']."\">".$rankArray[$i]['username']."</a>";
|
||||
}
|
||||
else {
|
||||
echo "-";
|
||||
echo"</td><td class=\"al\" >";
|
||||
if($rankArray[$i]['alliance'] > 0) {
|
||||
echo "<a href=\"allianz.php?aid=".$rankArray[$i]['alliance']."\">".$rankArray[$i]['aname']."</a>";
|
||||
}
|
||||
echo "</td><td class=\"pop\" >".$ranking[$i]['totalpop']."</td><td class=\"vil\">".$ranking[$i]['totalvillage']."</td></tr>";
|
||||
else echo "-";
|
||||
|
||||
echo "</td><td class=\"pop\" >".$rankArray[$i]['totalpop']."</td><td class=\"vil\">".$rankArray[$i]['totalvillage']."</td></tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "<td class=\"none\" colspan=\"5\">No users found</td>";
|
||||
}
|
||||
else echo "<td class=\"none\" colspan=\"5\">No users found</td>";
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -19,43 +19,42 @@ $search = $_SESSION['search'];
|
||||
<tr><td></td><td>Player</td><td>Population</td><td>Villages</td><td>Points</td></tr>
|
||||
</thead><tbody>
|
||||
<?php
|
||||
$rankArray = $ranking->getRank();
|
||||
if(isset($_GET['rank'])){
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($ranking->getRank())) {
|
||||
$_GET['rank'] = count($ranking->getRank())-1;
|
||||
}
|
||||
while($_GET['rank'] > (20*$multiplier)) {
|
||||
$multiplier +=1;
|
||||
}
|
||||
$start = 20*$multiplier-19;
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
if(count($ranking->getRank()) > 0) {
|
||||
$ranking = $ranking->getRank();
|
||||
for($i=$start;$i<($start+20);$i++) {
|
||||
if(isset($ranking[$i]['username']) && $ranking[$i] != "pad") {
|
||||
if($i == $search){
|
||||
echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
}
|
||||
else {
|
||||
echo "<tr><td class=\"ra \" >";
|
||||
}
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($rankArray)) {
|
||||
$_GET['rank'] = count($rankArray) - 1;
|
||||
}
|
||||
while($_GET['rank'] > (20 * $multiplier)) $multiplier++;
|
||||
|
||||
$start = 20 * $multiplier - 19;
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
|
||||
if(count($rankArray) > 1) {
|
||||
for($i = $start; $i < $start + 20; $i++) {
|
||||
if(isset($rankArray[$i]['username']) && $rankArray[$i] != "pad") {
|
||||
if($i == $search) echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
else echo "<tr><td class=\"ra \" >";
|
||||
|
||||
echo $i.".</td><td class=\"pla \" >";
|
||||
if($ranking[$i]['access'] > 2){
|
||||
echo"<u><a href=\"spieler.php?uid=".$ranking[$i]['id']."\">".$ranking[$i]['username']."</a></u>";
|
||||
} else {
|
||||
echo"<a href=\"spieler.php?uid=".$ranking[$i]['id']."\">".$ranking[$i]['username']."</a>";
|
||||
}
|
||||
echo"</td><td class=\"pop \" >".$ranking[$i]['totalpop']."";
|
||||
echo "</td><td class=\"vil\">".$ranking[$i]['totalvillages']."</td><td class=\"po \" >".$ranking[$i]['apall']."</td></tr>";
|
||||
if($rankArray[$i]['access'] > 2){
|
||||
echo"<u><a href=\"spieler.php?uid=".$rankArray[$i]['id']."\">".$rankArray[$i]['username']."</a></u>";
|
||||
} else {
|
||||
echo"<a href=\"spieler.php?uid=".$rankArray[$i]['id']."\">".$rankArray[$i]['username']."</a>";
|
||||
}
|
||||
echo"</td><td class=\"pop \" >".$rankArray[$i]['totalpop']."";
|
||||
echo "</td><td class=\"vil\">".$rankArray[$i]['totalvillages']."</td><td class=\"po \" >".$rankArray[$i]['apall']."</td></tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "<td class=\"none\" colspan=\"5\">No users found</td>";
|
||||
}
|
||||
else echo "<td class=\"none\" colspan=\"5\">No users found</td>";
|
||||
?>
|
||||
<?php
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
include("ranksearch.tpl");
|
||||
?>
|
||||
|
||||
@@ -19,42 +19,39 @@ $search = $_SESSION['search'];
|
||||
<tr><td></td><td>Player</td><td>Population</td><td>Villages</td><td>Points</td></tr>
|
||||
</thead><tbody>
|
||||
<?php
|
||||
$rankArray = $ranking->getRank();
|
||||
if(isset($_GET['rank'])){
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($ranking->getRank())) {
|
||||
$_GET['rank'] = count($ranking->getRank())-1;
|
||||
}
|
||||
while($_GET['rank'] > (20*$multiplier)) {
|
||||
$multiplier +=1;
|
||||
}
|
||||
$start = 20*$multiplier-19;
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
if(count($ranking->getRank()) > 0) {
|
||||
$ranking = $ranking->getRank();
|
||||
for($i=$start;$i<($start+20);$i++) {
|
||||
if(isset($ranking[$i]['username']) && $ranking[$i] != "pad") {
|
||||
if($i == $search){
|
||||
echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
}
|
||||
else {
|
||||
echo "<tr><td class=\"ra \" >";
|
||||
}
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($rankArray)) {
|
||||
$_GET['rank'] = count($rankArray) - 1;
|
||||
}
|
||||
while($_GET['rank'] > (20 * $multiplier)) $multiplier++;
|
||||
|
||||
$start = 20 * $multiplier - 19;
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
|
||||
if(count($rankArray) > 1) {
|
||||
for($i = $start; $i < $start + 20; $i++) {
|
||||
if(isset($rankArray[$i]['username']) && $rankArray[$i] != "pad") {
|
||||
if($i == $search) echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
else echo "<tr><td class=\"ra \" >";
|
||||
|
||||
echo $i.".</td><td class=\"pla \" >";
|
||||
if($ranking[$i]['access'] > 2){
|
||||
echo"<u><a href=\"spieler.php?uid=".$ranking[$i]['id']."\">".$ranking[$i]['username']."</a></u>";
|
||||
} else {
|
||||
echo"<a href=\"spieler.php?uid=".$ranking[$i]['id']."\">".$ranking[$i]['username']."</a>";
|
||||
}
|
||||
echo"</td><td class=\"pop \" >".$ranking[$i]['totalpop'];
|
||||
echo "</td><td class=\"vil\">".$ranking[$i]['totalvillages']."</td><td class=\"po \" >".$ranking[$i]['dpall']."</td></tr>";
|
||||
if($rankArray[$i]['access'] > 2){
|
||||
echo"<u><a href=\"spieler.php?uid=".$rankArray[$i]['id']."\">".$rankArray[$i]['username']."</a></u>";
|
||||
} else {
|
||||
echo"<a href=\"spieler.php?uid=".$rankArray[$i]['id']."\">".$rankArray[$i]['username']."</a>";
|
||||
}
|
||||
echo"</td><td class=\"pop \" >".$rankArray[$i]['totalpop']."";
|
||||
echo "</td><td class=\"vil\">".$rankArray[$i]['totalvillages']."</td><td class=\"po \" >".$rankArray[$i]['dpall']."</td></tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "<td class=\"none\" colspan=\"5\">No users found</td>";
|
||||
}
|
||||
else echo "<td class=\"none\" colspan=\"5\">No users found</td>";
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -15,16 +15,13 @@ if(!isset($_GET['id'])){ $_GET['id']='1'; }
|
||||
</form>
|
||||
<div class="navi">
|
||||
<?php
|
||||
if($start != 1 && $start+20 < count($ranking)) {
|
||||
echo "<a href=\"statistiken.php?id=".$_GET['id']."&rank=".($start-20)."\">« back</a> | <a href=\"statistiken.php?id=".$_GET['id']."&rank=".($start+20)."\">forward »</a>";
|
||||
if(count($rankArray) < 22){
|
||||
echo "« back | forward »";
|
||||
}else if($start != 1 && $start + 20 < count($rankArray)) {
|
||||
echo "<a href=\"statistiken.php?id=".$_GET['id']."&rank=".($start - 20)."\">« back</a> | <a href=\"statistiken.php?id=".$_GET['id']."&rank=".($start + 20)."\">forward »</a>";
|
||||
}else if($start == 1 && $start + 20 < count($rankArray)) {
|
||||
echo "« back | <a href=\"statistiken.php?id=".$_GET['id']."&rank=".($start + 20)."\">forward »</a>";
|
||||
}else if($start != 1 && $start - 20 < count($rankArray)) {
|
||||
echo "<a href=\"statistiken.php?id=".$_GET['id']."&rank=".($start - 20)."\">« back</a> | forward »";
|
||||
}
|
||||
else if($start == 1 && $start+20 < count($ranking)) {
|
||||
echo "« back | <a href=\"statistiken.php?id=".$_GET['id']."&rank=".($start+20)."\">forward »</a>";
|
||||
}
|
||||
else if($start != 1 && $start-20 < count($ranking)) {
|
||||
echo "<a href=\"statistiken.php?id=".$_GET['id']."&rank=".($start-20)."\">« back</a> | forward »";
|
||||
}
|
||||
else {
|
||||
echo "« back | forward »";
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -5,9 +5,7 @@ if(!is_numeric($_SESSION['search'])) {
|
||||
<?php
|
||||
$search = 0;
|
||||
}
|
||||
else {
|
||||
$search = $_SESSION['search'];
|
||||
}
|
||||
else $search = $_SESSION['search'];
|
||||
?>
|
||||
<table cellpadding="1" cellspacing="1" id="villages" class="row_table_data">
|
||||
<thead>
|
||||
@@ -19,38 +17,35 @@ else {
|
||||
<tr><td></td><td>Village</td><td>Player</td><td>Inhabitants</td><td>Coordinates</td></tr>
|
||||
</thead><tbody>
|
||||
<?php
|
||||
if(isset($_GET['rank'])){
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($ranking->getRank())) {
|
||||
$_GET['rank'] = count($ranking->getRank())-1;
|
||||
}
|
||||
while($_GET['rank'] > (20*$multiplier)) {
|
||||
$multiplier +=1;
|
||||
}
|
||||
$start = 20*$multiplier-19;
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
} else { $start = ($_SESSION['start']+1); }
|
||||
if(count($ranking->getRank()) > 0) {
|
||||
$ranking = $ranking->getRank();
|
||||
for($i=$start;$i<($start+20);$i++) {
|
||||
if(isset($ranking[$i]['wref']) && $ranking[$i] != "pad") {
|
||||
if($i == $search) {
|
||||
echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
}
|
||||
else {
|
||||
echo "<tr><td class=\"ra \" >";
|
||||
}
|
||||
echo $i.".</td><td class=\"vil \" ><a href=\"karte.php?d=".$ranking[$i]['wref']."&c=".$generator->getMapCheck($ranking[$i]['wref'])."\">".$ranking[$i]['name']."</a></td>";
|
||||
echo "<td class=\"pla \" ><a href=\"spieler.php?uid=".$ranking[$i]['owner']."\">".$ranking[$i]['user']."</a></td>";
|
||||
echo "<td class=\"hab\">".$ranking[$i]['pop']."</td><td class=\"aligned_coords \" ><div class=\"cox\">(".$ranking[$i]['x']."</div><div class=\"pi\">|</div><div class=\"coy\">".$ranking[$i]['y'].")</div></td></tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "<td class=\"none\" colspan=\"5\">No villages found</td>";
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
$rankArray = $ranking->getRank();
|
||||
if(isset($_GET['rank'])){
|
||||
$multiplier = 1;
|
||||
if(is_numeric($_GET['rank'])) {
|
||||
if($_GET['rank'] > count($rankArray)) {
|
||||
$_GET['rank'] = count($rankArray) - 1;
|
||||
}
|
||||
|
||||
while($_GET['rank'] > (20*$multiplier)) $multiplier++;
|
||||
|
||||
$start = 20 * $multiplier - 19;
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
}
|
||||
else $start = ($_SESSION['start'] + 1);
|
||||
|
||||
if(count($rankArray) > 1) {
|
||||
for($i = $start; $i < $start + 20; $i++) {
|
||||
if(isset($rankArray[$i]['wref']) && $rankArray[$i] != "pad") {
|
||||
if($i == $search) echo "<tr class=\"hl\"><td class=\"ra fc\" >";
|
||||
else echo "<tr><td class=\"ra \" >";
|
||||
|
||||
echo $i.".</td><td class=\"vil \" ><a href=\"karte.php?d=".$rankArray[$i]['wref']."&c=".$generator->getMapCheck($rankArray[$i]['wref'])."\">".$rankArray[$i]['name']."</a></td>";
|
||||
echo "<td class=\"pla \" ><a href=\"spieler.php?uid=".$rankArray[$i]['owner']."\">".$rankArray[$i]['user']."</a></td>";
|
||||
echo "<td class=\"hab\">".$rankArray[$i]['pop']."</td><td class=\"aligned_coords \" ><div class=\"cox\">(".$rankArray[$i]['x']."</div><div class=\"pi\">|</div><div class=\"coy\">".$rankArray[$i]['y'].")</div></td></tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
else echo "<td class=\"none\" colspan=\"5\">No villages found</td>";
|
||||
include("ranksearch.tpl");
|
||||
?>
|
||||
?>
|
||||
</tbody></table>
|
||||
+21
-13
@@ -14,16 +14,16 @@ if (WW == True)
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>Player</td>
|
||||
<td>Name</td>
|
||||
<td>Alliance</td>
|
||||
<td>Level</td>
|
||||
<td><?php echo PLAYER; ?></td>
|
||||
<td><?php echo NAME; ?></td>
|
||||
<td><?php echo ALLIANCE; ?></td>
|
||||
<td><?php echo LEVEL; ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$cont = 1;
|
||||
$count = 0;
|
||||
while ($row = mysqli_fetch_array($result))
|
||||
{
|
||||
$ally = $database->getAlliance($row['alliance']);
|
||||
@@ -31,7 +31,7 @@ if (WW == True)
|
||||
$row2 = @mysqli_fetch_assoc($query);
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $cont; $cont++; ?>.</td>
|
||||
<td><?php echo ++$count; ?>.</td>
|
||||
<td><?php echo "<a href=\"karte.php?d=" . $row['vref'] . "&c=" . $generator->getMapCheck($row['vref']) . "\">"; ?><?php echo $row['username']; ?></a></td>
|
||||
<td><?php echo $row['wwname']; ?></td>
|
||||
<td><a href="allianz.php?aid=<?php echo $ally['id']; ?>"><?php echo $ally['tag']; ?></a></td>
|
||||
@@ -44,10 +44,18 @@ if (WW == True)
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: statistiken.php");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
if($count == 0){
|
||||
?>
|
||||
<tr>
|
||||
<td class="none" colspan="7"><?php echo NO_WW; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: statistiken.php");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
@@ -52,18 +52,18 @@
|
||||
mysqli_query($database->dblink, "INSERT INTO " . TB_PREFIX . "users SET username = '".$database->escape($_POST['aname'])."', password = '" . password_hash($_POST['apass'], PASSWORD_BCRYPT, ['cost' => 12]) . "', email = '".$database->escape($_POST['aemail'])."', tribe = ".(int) $_POST['atribe'].", access = 9, is_bcrypt = 1") OR DIE (mysqli_error($database->dblink));
|
||||
$uid = mysqli_insert_id($database->dblink);
|
||||
$admin_village_created = false;
|
||||
$xcoor = 50;
|
||||
$xcoor = round(WORLD_MAX / 2);
|
||||
$addUnitsWrefs = [];
|
||||
$addTechWrefs = [];
|
||||
$addABTechWrefs = [];
|
||||
|
||||
while (!$admin_village_created) {
|
||||
$wid = $admin->getWref($xcoor++, 50);
|
||||
$wid = $admin->getWref($xcoor++, round(WORLD_MAX / 2));
|
||||
$status = $database->getVillageState($wid);
|
||||
if($status == 0) {
|
||||
$database->setFieldTaken($wid);
|
||||
$database->addVillage($wid, $uid, $_POST['aname'], 1);
|
||||
$database->addResourceFields($wid, $database->getVillageType($wid));
|
||||
$database->addResourceFields($wid, $database->getVillageType($wid, false));
|
||||
$addUnitsWrefs[] = $wid;
|
||||
$addTechWrefs[] = $wid;
|
||||
$addABTechWrefs[] = $wid;
|
||||
@@ -84,8 +84,8 @@
|
||||
$status = $database->getVillageState($wid);
|
||||
if($status == 0) {
|
||||
$database->setFieldTaken($wid);
|
||||
$database->addVillage($wid, $uid, 'Multihunter', '0');
|
||||
$database->addResourceFields($wid, $database->getVillageType($wid));
|
||||
$database->addVillage($wid, $uid, 'Multihunter', 0);
|
||||
$database->addResourceFields($wid, $database->getVillageType($wid, false));
|
||||
$database->addUnits($wid);
|
||||
$database->addTech($wid);
|
||||
$database->addABTech($wid);
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ if(isset($_POST['result'])) {
|
||||
include("Templates/Simulator/res_d".$tar.".tpl");
|
||||
}
|
||||
echo "<p>Type of attack: <b>";
|
||||
echo $form->getValue('ktyp') == 0? "Normal" : "Raid";
|
||||
echo $form->getValue('ktyp') == 0 ? "Normal" : "Raid";
|
||||
echo "</b></p>";
|
||||
echo "<p>";
|
||||
if (isset($_POST['result'][7]) && isset($_POST['result'][8])){
|
||||
|
||||
Reference in New Issue
Block a user