mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
Artifacts update and optimizations
+Added the "Artifacts" section in the Admin Panel, which contains two options: return a deleted artifact to the Natars and create new Artifacts, assigned to a specified player +Return to Natars coded, in the village section of the Admin Panel +Moved a lot of functions and costants from Automation.php to the "new" class Artifacts.php +Optimized a lot the whole Natars creation process, decreased the number of query of about 600 +Optimized a lot the function which deletes a player's account, it's now executed almost instantly, even with players with a lot of villages +Redesigned the map spawn system, using a more Travian-like village distribution +Fixed a bug that did show a broken village in the artifact chronology, if that village was destroyed +Reduced the amount of redundant code (about 230 lines) for 27_1.tpl/27_2.tpl and 27_3.tpl +Fixed a bug that permitted to build the Great Granary and the Great Warehouse in the whole account, with only a village effect artifact +Fixed a bug in the Admin Panel map that didn't permit to show village informations, if that village contained single quotes in its name
This commit is contained in:
@@ -32,7 +32,7 @@ $artifactInfo = Artifacts::getArtifactInfo($artifact);
|
||||
</tr>
|
||||
<?php }else{ ?>
|
||||
<tr>
|
||||
<td><a href="?action=delArtifact&artid=<?php echo $artifact['id']; ?>" onClick="return del('arti', <?php echo $artifact['id']; ?>)"><img src="../img/admin/del.gif"></a></td>
|
||||
<td><a href="?action=delArtifact&artid=<?php echo $artifact['id']; ?>&del=0" onClick="return del('arti', <?php echo $artifact['id']; ?>)"><img src="../img/admin/del.gif"></a></td>
|
||||
<td class="icon"><img class="artefact_icon_<?php echo $artifact['type']; ?>" src="../img/x.gif"></td>
|
||||
<td colspan="1"><div style="text-align: center"><?php echo $artifact['name']; ?></div></td>
|
||||
<td colspan="1"><div style="text-align: center"><?php echo $artifactInfo['bonus']; ?></div></td>
|
||||
@@ -48,6 +48,6 @@ $artifactInfo = Artifacts::getArtifactInfo($artifact);
|
||||
</table>
|
||||
<?php
|
||||
|
||||
if($village['owner'] != 3) echo '<a href="admin.php?action=returnArtifact&artid='.$artifact['id'].'">Return to Natars</a>';
|
||||
if($village['owner'] != 3 && !empty($artifact)) echo '<a href="admin.php?action=returnArtifact&artid='.$artifact['id'].'">Return to Natars</a>';
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
$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>
|
||||
<form method="post" action="../Admin/admin.php?action=addArtifacts">
|
||||
<table id="member">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="4">Add artifact(s)</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="ra"></td>
|
||||
<td>Type</td>
|
||||
<td>Quantity</td>
|
||||
<td>Player id</td>
|
||||
</tr>
|
||||
</thead>
|
||||
</tbody>
|
||||
<tr>
|
||||
<td class="icon"><img id="artifactImage" class="artefact_icon_1" src="../img/x.gif"></td>
|
||||
<td>
|
||||
<select name="selectedArtifact" id="selectedArtifact" onchange="changeArtifactImage()">
|
||||
<?php
|
||||
$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>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<td><input type="number" value="1" min="1" max="999" name="artifactQuantity"></td>
|
||||
<td><input type="text" value="<?php echo Artifacts::NATARS_UID; ?>" name="playerId"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4"><div style="text-align: center"><button id="addArtifacts" class="trav_buttons" value="add" name="addArtifacts" onclick="this.disabled=true;this.form.submit();"> Add </button></div></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<table id="member">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="8">Deleted artifact(s)</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="ra"></td>
|
||||
<td class="ra"></td>
|
||||
<td colspan="1">Name</td>
|
||||
<td colspan="1">Bonus</td>
|
||||
<td colspan="1">Area of effect</td>
|
||||
<td colspan="1">Time of conquer</td>
|
||||
<td colspan="1">Old owner</td>
|
||||
<td colspan="1">Old village</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
if(empty($deletedArtifacts)){
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="8"><div style="text-align: center"><?php echo NO_ARTIFACTS; ?></div></td>
|
||||
</tr>
|
||||
<?php }else{
|
||||
|
||||
foreach($deletedArtifacts as $artifact){
|
||||
$artifactInfo = Artifacts::getArtifactInfo($artifact);
|
||||
?>
|
||||
<tr>
|
||||
<td><a href="?action=returnArtifact&artid=<?php echo $artifact['id']; ?>&del=1" title="Return to Natars">
|
||||
<img src="../../img/admin/acc.gif">
|
||||
</a></td>
|
||||
|
||||
<td class="icon"><img class="artefact_icon_<?php echo $artifact['type']; ?>" src="../img/x.gif"></td>
|
||||
<td colspan="1"><div style="text-align: center"><?php echo $artifact['name']; ?></div></td>
|
||||
<td colspan="1"><div style="text-align: center"><?php echo $artifactInfo['bonus']; ?></div></td>
|
||||
<td colspan="1"><div style="text-align: center"><?php echo $artifactInfo['effectInfluence']; ?></div></td>
|
||||
<td colspan="1"><div style="text-align: center"><?php echo date("d.m.Y H:i:s", $artifact['conquered']); ?></div></td>
|
||||
|
||||
<td colspan="1"><div style="text-align: center">
|
||||
<?php
|
||||
$oldOwnerName = $database->getUserField($artifact['owner'], "username", 0);
|
||||
if($oldOwnerName != "[?]"){
|
||||
?>
|
||||
<a href="?p=player&uid=<?php echo $artifact['owner']; ?>"><?php echo $oldOwnerName; ?></a>
|
||||
<?php
|
||||
}else{
|
||||
?>
|
||||
<span><font color="grey"><?php echo $oldOwnerName; ?></font></span>
|
||||
<?php }?>
|
||||
</div></td>
|
||||
|
||||
<td colspan="1"><div style="text-align: center">
|
||||
<?php
|
||||
$oldVillageName = $database->getVillageField($artifact['vref'], "name");
|
||||
if($oldVillageName != "[?]"){
|
||||
?>
|
||||
<a href="?p=village&did=<?php echo $artifact['vref']; ?>"><?php echo $oldVillageName; ?></a>
|
||||
<?php
|
||||
}else{
|
||||
?>
|
||||
<span><font color="grey"><?php echo $oldVillageName; ?></font></span>
|
||||
<?php }?>
|
||||
</div></td>
|
||||
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
function changeArtifactImage(){
|
||||
var selectedItem = document.getElementById("selectedArtifact").value.split(":")[0];
|
||||
|
||||
document.getElementById("artifactImage").className = "artefact_icon_" + selectedItem;
|
||||
}
|
||||
</script>
|
||||
+10
-9
@@ -96,21 +96,22 @@ if ($check1 == "" && $check2 == "" && $check3 == "") $criteria = "";
|
||||
$player_info = $database->query_return($q);
|
||||
|
||||
foreach($player_info as $p_array) {
|
||||
$p_name = $p_array['username'];
|
||||
$p_village = mysqli_real_escape_string($database->dblink, $p_array['name']);
|
||||
$p_name = htmlspecialchars(mysqli_escape_string($database->dblink, $p_array['username']));
|
||||
$p_village = htmlspecialchars(mysqli_escape_string($database->dblink, $p_array['name']));
|
||||
$p_coor = "(".$p_array['x']."|".$p_array['y'].")";
|
||||
$p_pop = $p_array['pop'];
|
||||
$p_tribe = $array_tribe[$p_array['tribe']];
|
||||
|
||||
$p_info ="<a href=\"?p=village&did=".$p_array['wref']."\" target=\"_blank\"><img src=\"../img/admin/map_".(isset($p_array['size']) ? "1".$p_array['size'] : ($p_array['access'] != ADMIN ? $p_array['tribe'] : 0)).".gif\" border=\"0\" onmouseout=\"med_closeDescription()\" onmousemove=\"med_mouseMoveHandler(arguments[0],'<ul class=\'p_info\'><li>Player name: <b>$p_name</b></li><li>Village name : <b>$p_village</b></li><li>Coordinate: <b>$p_coor</b></li><li>Population: <b>$p_pop</b></li><li>Tribe: <b>$p_tribe</b></li>".($check3 != "" && isset($p_array['size']) ? "<li>Artifact effect: <b>".$artifactsEffect[$p_array['size']]."</b></li>" : "")."</ul>')\"></a>";
|
||||
|
||||
//250px = 0
|
||||
$xdiv = 250 / WORLD_MAX;
|
||||
if($p_array['x'] < 0) $p_x = 250 - intval(abs($p_array['x']) * $xdiv); //-
|
||||
elseif($p_array['x'] > 0) $p_x = 250 + intval(abs($p_array['x']) * $xdiv); //+
|
||||
if($p_array['y'] < 0) $p_y = 250 + intval(abs($p_array['y']) * $xdiv); //-
|
||||
elseif($p_array['y'] > 0) $p_y = 250 - intval(abs($p_array['y']) * $xdiv); //+
|
||||
if($p_array['x'] == 0 && $p_array['y'] == 0) $p_x = $p_y = 250; //multihunter
|
||||
//245px = 0
|
||||
$pixelDiv = 245;
|
||||
$xdiv = $pixelDiv / WORLD_MAX;
|
||||
if($p_array['x'] <= 0) $p_x = $pixelDiv - intval(abs($p_array['x']) * $xdiv); //-x
|
||||
elseif($p_array['x'] >= 0) $p_x = $pixelDiv + intval(abs($p_array['x']) * $xdiv); //+x
|
||||
|
||||
if($p_array['y'] <= 0) $p_y = $pixelDiv + intval(abs($p_array['y']) * $xdiv); //-y
|
||||
elseif($p_array['y'] >= 0) $p_y = $pixelDiv - intval(abs($p_array['y']) * $xdiv); //+y
|
||||
|
||||
echo '<div style="left:'.$p_x.'px; top:'.$p_y.'px; position:absolute">'.$p_info.'</div>';
|
||||
}
|
||||
|
||||
+7
-9
@@ -23,6 +23,7 @@ include_once("../GameEngine/Database.php");
|
||||
include_once ("../GameEngine/Lang/" . LANG . ".php");
|
||||
include_once("../GameEngine/Admin/database.php");
|
||||
include_once("../GameEngine/Data/buidata.php");
|
||||
include_once("../GameEngine/Artifacts.php");
|
||||
|
||||
include('Templates/ver.tpl');
|
||||
include('Templates/update_latest.tpl');
|
||||
@@ -59,6 +60,10 @@ if (!empty($_GET['p'])) {
|
||||
case 'map':
|
||||
$subpage = 'Map';
|
||||
break;
|
||||
|
||||
case 'artifacts':
|
||||
$subpage = 'Artifacts';
|
||||
break;
|
||||
|
||||
case 'search':
|
||||
$subpage = 'General Search';
|
||||
@@ -120,14 +125,6 @@ if (!empty($_GET['p'])) {
|
||||
$subpage = 'Create Users';
|
||||
break;
|
||||
|
||||
case 'natarend':
|
||||
$subpage = 'Add WW Villages';
|
||||
break;
|
||||
|
||||
case 'natarbuildingplan':
|
||||
$subpage = 'Add WW Building Plan Villages';
|
||||
break;
|
||||
|
||||
case 'admin_log':
|
||||
$subpage = 'Admin Log';
|
||||
break;
|
||||
@@ -498,7 +495,7 @@ if (!empty($_GET['p'])) {
|
||||
<li><a href="<?php echo HOMEPAGE; ?>">Server Homepage</a></li>
|
||||
<li><a href="admin.php">Control Panel Home</a></li>
|
||||
<li><a href="<?php echo rtrim(SERVER, '/'); ?>/dorf1.php">Return to the server</a></li>
|
||||
<li><a href="?p=update"><font color="Red"><b>Server Update (<?php echo $up_avl; ?>)</font></b></a></li>
|
||||
<li><a href="?p=update"><font color="Red"><b>Server Update (<?php echo $up_avl; ?>)</b></font></a></li>
|
||||
<li><a href="?action=logout">Logout</a></li>
|
||||
<li class="sub"><a href="#">Server Info</a>
|
||||
<ul>
|
||||
@@ -509,6 +506,7 @@ if (!empty($_GET['p'])) {
|
||||
<li><a href="?p=report">Players Report</a></li>
|
||||
<li><a href="?p=msg">Players Message</a></li>
|
||||
<li><a href="?p=map">Map</a></li>
|
||||
<li><a href="?p=artifacts">Artifacts</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="sub"><a href="#">Search</a>
|
||||
|
||||
+33
-32
@@ -134,10 +134,10 @@ class Account {
|
||||
}
|
||||
}
|
||||
else {
|
||||
$uid = $database->register($_POST['name'],password_hash($_POST['pw'], PASSWORD_BCRYPT,['cost' => 12]),$_POST['email'],$_POST['vid'],$act);
|
||||
$uid = $database->register($_POST['name'], password_hash($_POST['pw'], PASSWORD_BCRYPT, ['cost' => 12]), $_POST['email'], $_POST['vid'], $act);
|
||||
if($uid) {
|
||||
setcookie("COOKUSR",$_POST['name'],time()+COOKIE_EXPIRE,COOKIE_PATH);
|
||||
setcookie("COOKEMAIL",$_POST['email'],time()+COOKIE_EXPIRE,COOKIE_PATH);
|
||||
setcookie("COOKUSR" , $_POST['name'], time() + COOKIE_EXPIRE,COOKIE_PATH);
|
||||
setcookie("COOKEMAIL" , $_POST['email'], time() + COOKIE_EXPIRE,COOKIE_PATH);
|
||||
$database->updateUserField(
|
||||
$uid,
|
||||
["act", "invited"],
|
||||
@@ -145,7 +145,7 @@ class Account {
|
||||
1
|
||||
);
|
||||
|
||||
$this->generateBase($_POST['kid'],$uid,$_POST['name']);
|
||||
$this->generateBase($_POST['kid'], $uid, $_POST['name']);
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}
|
||||
@@ -154,37 +154,38 @@ class Account {
|
||||
}
|
||||
|
||||
private function Activate() {
|
||||
if(START_DATE < date('d.m.Y') or START_DATE == date('d.m.Y') && START_TIME <= date('H:i'))
|
||||
{
|
||||
global $database;
|
||||
$q = "SELECT act, username, password, email, tribe, location FROM ".TB_PREFIX."activate where act = '".$database->escape($_POST['id'])."'";
|
||||
$result = mysqli_query($database->dblink,$q);
|
||||
$dbarray = mysqli_fetch_array($result);
|
||||
if($dbarray['act'] == $_POST['id']) {
|
||||
$uid = $database->register($dbarray['username'],$dbarray['password'],$dbarray['email'],$dbarray['tribe'],"");
|
||||
if($uid) {
|
||||
$database->unreg($dbarray['username']);
|
||||
$this->generateBase($dbarray['location'],$uid,$dbarray['username']);
|
||||
header("Location: activate.php?e=2");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: activate.php?e=3");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: activate.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
global $database;
|
||||
|
||||
if(START_DATE < date('d.m.Y') or START_DATE == date('d.m.Y') && START_TIME <= date('H:i'))
|
||||
{
|
||||
$q = "SELECT act, username, password, email, tribe, location FROM ".TB_PREFIX."activate where act = '".$database->escape($_POST['id'])."'";
|
||||
$result = mysqli_query($database->dblink,$q);
|
||||
$dbarray = mysqli_fetch_array($result);
|
||||
if($dbarray['act'] == $_POST['id']) {
|
||||
$uid = $database->register($dbarray['username'], $dbarray['password'], $dbarray['email'], $dbarray['tribe'], "");
|
||||
if($uid) {
|
||||
$database->unreg($dbarray['username']);
|
||||
$this->generateBase($dbarray['location'],$uid,$dbarray['username']);
|
||||
header("Location: activate.php?e=2");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: activate.php?e=3");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: activate.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
private function Unreg() {
|
||||
global $database;
|
||||
|
||||
$q = "SELECT password, username FROM ".TB_PREFIX."activate where id = ".(int) $_POST['id'];
|
||||
$result = mysqli_query($database->dblink,$q);
|
||||
$dbarray = mysqli_fetch_array($result);
|
||||
@@ -271,7 +272,7 @@ class Account {
|
||||
if($kid == 0) $kid = rand(1,4);
|
||||
else $kid = $_POST['kid'];
|
||||
|
||||
$database->generateVillages([['wid' => 0, 'kid' => $kid, 'capital' => 1]], $uid, $username);
|
||||
$database->generateVillages([['wid' => 0, 'mode' => 0, 'type' => 3, 'kid' => $kid, 'capital' => 1, 'pop' => 2, 'name' => null, 'natar' => 0]], $uid, $username);
|
||||
$message->sendWelcome($uid, $username);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -100,11 +100,11 @@ else
|
||||
else
|
||||
{
|
||||
// Register them and build the village
|
||||
$uid = $database->register($userName, password_hash($password, PASSWORD_BCRYPT, ['cost' => 12]), $email, $tribe ,$act);
|
||||
$uid = $database->register($userName, password_hash($password, PASSWORD_BCRYPT, ['cost' => 12]), $email, $tribe, $act);
|
||||
if($uid)
|
||||
{
|
||||
/*
|
||||
* [MENTION=6887]Tod[/MENTION]O
|
||||
* [MENTION=6887]Todo[/MENTION]
|
||||
*
|
||||
* Allow option to create (random) bigger villages,
|
||||
* upgrade fields, granary, warehouse, wall etc
|
||||
@@ -130,12 +130,12 @@ else
|
||||
// already exists
|
||||
$protection = time();
|
||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."users SET
|
||||
protect = '".$protection."'
|
||||
WHERE id = ".(int) $uid) or die(mysqli_error($database->dblink));
|
||||
protect = '".$protection."'
|
||||
WHERE id = ".(int) $uid) or die(mysqli_error($database->dblink));
|
||||
}
|
||||
|
||||
$database->updateUserField($uid,"act","",1);
|
||||
$wid = $database->generateBase($kid);
|
||||
$wid = $database->generateBase($kid, 1);
|
||||
$database->setFieldTaken($wid);
|
||||
|
||||
//calculate random generate value and level building
|
||||
|
||||
+14
-22
@@ -42,10 +42,10 @@ function aktiv() {this.srcElement.className='fl1'; }
|
||||
function inaktiv() {event.srcElement.className='fl2'; }
|
||||
|
||||
function del(e,id){
|
||||
if(e == 'did'){ var conf = confirm('Dou you really want delete village id '+id+'?'); }
|
||||
if(e == 'arti'){ var conf = confirm('Dou you really want delete artifact id '+id+'?'); }
|
||||
if(e == 'unban'){ var conf = confirm('Dou you really want unban player '+id+'?'); }
|
||||
if(e == 'stopDel'){ var conf = confirm('Dou you really want stop deleting user '+id+'?'); }
|
||||
if(e == 'did'){ var conf = confirm('Do you really want to delete village id '+id+'?'); }
|
||||
if(e == 'arti'){ var conf = confirm('Do you really want to delete artifact id '+id+'?'); }
|
||||
if(e == 'unban'){ var conf = confirm('Do you really want to unban player '+id+'?'); }
|
||||
if(e == 'stopDel'){ var conf = confirm('Do you really want to stop deleting user '+id+'?'); }
|
||||
return conf;
|
||||
}
|
||||
|
||||
@@ -86,30 +86,22 @@ return conf;
|
||||
|
||||
if($funct->CheckLogin()){
|
||||
if($_POST or $_GET){
|
||||
if($_GET['p'] and $_GET['p']!="search"){
|
||||
if($_GET['p'] && $_GET['p'] != "search"){
|
||||
$filename = '../Templates/Admin/'.$_GET['p'].'.tpl';
|
||||
if(file_exists($filename)){
|
||||
include($filename);
|
||||
}else{
|
||||
include('../Templates/Admin/404.tpl');
|
||||
}
|
||||
}else{
|
||||
include('../Templates/Admin/search.tpl');
|
||||
if(file_exists($filename)) include($filename);
|
||||
else include('../Templates/Admin/404.tpl');
|
||||
}
|
||||
if($_POST['p'] and $_POST['s']){
|
||||
else include('../Templates/Admin/search.tpl');
|
||||
|
||||
if($_POST['p'] && $_POST['s']){
|
||||
$filename = '../Templates/Admin/results_'.$_POST['p'].'.tpl';
|
||||
if(file_exists($filename)){
|
||||
include($filename);
|
||||
}else{
|
||||
include('../Templates/Admin/404.tpl');
|
||||
}
|
||||
if(file_exists($filename)) include($filename);
|
||||
else include('../Templates/Admin/404.tpl');
|
||||
}
|
||||
}else{
|
||||
include('../Templates/Admin/home.tpl');
|
||||
}
|
||||
}else{
|
||||
include('../Templates/Admin/login.tpl');
|
||||
else include('../Templates/Admin/home.tpl');
|
||||
}
|
||||
else include('../Templates/Admin/login.tpl');
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
// # Source code: https://github.com/Shadowss/TravianZ ##
|
||||
// # ##
|
||||
// ################################################################################
|
||||
include_once("../GameEngine/Artifacts.php");
|
||||
class funct
|
||||
{
|
||||
|
||||
@@ -29,6 +30,8 @@ class funct
|
||||
{
|
||||
global $admin, $database;
|
||||
|
||||
$artifact = new Artifacts();
|
||||
|
||||
switch ($get['action']) {
|
||||
case "recountPop":
|
||||
$admin->recountPop($get['did']);
|
||||
@@ -74,12 +77,66 @@ class funct
|
||||
case "logout":
|
||||
$this->LogOut();
|
||||
break;
|
||||
case "delArtifact":
|
||||
if(isset($_GET['artid']) && is_numeric($_GET['artid'])) $database->deleteArtifact($_GET['artid']);
|
||||
break;
|
||||
case "returnArtifact":
|
||||
|
||||
case "delArtifact":
|
||||
if(isset($_GET['artid']) && is_numeric($_GET['artid'])) $database->updateArtifactDetails($_GET['artid'], ['del' => 1]);
|
||||
break;
|
||||
|
||||
case "returnArtifact":
|
||||
//Check if the artifact id is valid
|
||||
if(!isset($_GET['artid']) || !is_numeric($_GET['artid'])){
|
||||
header("location: admin.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
//Get the informations of the artifact
|
||||
$artifactInfo = $database->getArtefactDetails($_GET['artid'], $_GET['del']);
|
||||
|
||||
//Check if the artifact exists
|
||||
if(empty($artifactInfo) || $artifactInfo['owner'] == Artifacts::NATARS_UID) {
|
||||
header("location: admin.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$artifact->returnArtifactToNatars($artifactInfo);
|
||||
break;
|
||||
|
||||
case "addArtifacts":
|
||||
|
||||
$selectedArtifact = $_POST['selectedArtifact'];
|
||||
$artifactQuantity = $_POST['artifactQuantity'];
|
||||
$playerId = $_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");
|
||||
exit;
|
||||
}
|
||||
|
||||
//The first element [0] is the type of the artifact, the second one [1] is the size of it
|
||||
//and the third one, is the artifact description
|
||||
$selectedArtifact = explode(":", $selectedArtifact);
|
||||
|
||||
//Add the chosen artifact(s)
|
||||
$artifactsArray = array_merge(Artifacts::NATARS_ARTIFACTS, Artifacts::NATARS_WW_BUILDING_PLANS);
|
||||
$chosenArtifact = $artifactsArray[$selectedArtifact[2]][$selectedArtifact[1] - 1];
|
||||
|
||||
//Check if the artifact has been found or if doesn't exist
|
||||
if(empty($chosenArtifact)){
|
||||
header("location: admin.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
//Create the artifacts array
|
||||
$chosenArtifact['quantity'] = $artifactQuantity;
|
||||
$artifactArrays[$selectedArtifact[2]][] = $chosenArtifact;
|
||||
|
||||
//Add the artifacts
|
||||
$artifact->addArtifactVillages($artifactArrays, $playerId);
|
||||
break;
|
||||
|
||||
case "killHero":
|
||||
$varray = $database->getProfileVillages($get['uid']);
|
||||
$killhero = false;
|
||||
|
||||
+435
-1
@@ -1,5 +1,439 @@
|
||||
<?php
|
||||
class Artifacts{
|
||||
class Artifacts
|
||||
{
|
||||
|
||||
public const
|
||||
|
||||
/**
|
||||
* @var integer Default Natars' uid
|
||||
*/
|
||||
|
||||
NATARS_UID = 3,
|
||||
|
||||
/**
|
||||
* @var integer Default Natars' tribe
|
||||
*/
|
||||
|
||||
NATARS_TRIBE = 5,
|
||||
|
||||
/**
|
||||
* @var string Default Natars' email
|
||||
*/
|
||||
|
||||
NATARS_EMAIL = TRIBE5."@noreply.com",
|
||||
|
||||
/**
|
||||
* @var string Default Natars' description
|
||||
*/
|
||||
|
||||
NATARS_DESC = "**************************
|
||||
[#natars]
|
||||
**************************",
|
||||
|
||||
/**
|
||||
* @var array Possible Natars' capital locations
|
||||
*/
|
||||
|
||||
NATARS_CAPITAL_COORDINATES = [[WORLD_MAX, WORLD_MAX],
|
||||
[WORLD_MAX, -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]],
|
||||
|
||||
/**
|
||||
* @var array Normal Natars' artifacts
|
||||
*/
|
||||
|
||||
NATARS_ARTIFACTS = [ARCHITECTS_DESC => [["type" => 1, "size" => 1, "name" => ARCHITECTS_SMALL, "vname" => ARCHITECTS_SMALLVILLAGE, "effect" => "(4x)", "quantity" => 6, "img" => 2],
|
||||
["type" => 1, "size" => 2, "name" => ARCHITECTS_LARGE, "vname" => ARCHITECTS_LARGEVILLAGE, "effect" => "(3x)", "quantity" => 4, "img" => 2],
|
||||
["type" => 1, "size" => 3, "name" => ARCHITECTS_UNIQUE,"vname" => ARCHITECTS_UNIQUEVILLAGE, "effect" => "(5x)", "quantity" => 1, "img" => 2]],
|
||||
|
||||
HASTE_DESC => [["type" => 2, "size" => 1, "name" => HASTE_SMALL, "vname" => HASTE_SMALLVILLAGE, "effect" => "(2x)", "quantity" => 6, "img" => 4],
|
||||
["type" => 2, "size" => 2, "name" => HASTE_LARGE, "vname" => HASTE_LARGEVILLAGE, "effect" => "(1.5x)", "quantity" => 4, "img" => 4],
|
||||
["type" => 2, "size" => 3, "name" => HASTE_UNIQUE, "vname" => HASTE_UNIQUEVILLAGE, "effect" => "(3x)", "quantity" => 1, "img" => 4]],
|
||||
|
||||
EYESIGHT_DESC => [["type" => 3, "size" => 1, "name" => EYESIGHT_SMALL, "vname" => EYESIGHT_SMALLVILLAGE, "effect" => "(5x)", "quantity" => 6, "img" => 5],
|
||||
["type" => 3, "size" => 2, "name" => EYESIGHT_LARGE, "vname" => EYESIGHT_LARGEVILLAGE, "effect" => "(3x)", "quantity" => 4, "img" => 5],
|
||||
["type" => 3, "size" => 3, "name" => EYESIGHT_UNIQUE, "vname" => EYESIGHT_UNIQUEVILLAGE, "effect" => "(10x)", "quantity" => 1, "img" => 5]],
|
||||
|
||||
DIET_DESC => [["type" => 4, "size" => 1, "name" => DIET_SMALL, "vname" => DIET_SMALLVILLAGE, "effect" => "(50%)", "quantity" => 6, "img" => 6],
|
||||
["type" => 4, "size" => 2, "name" => DIET_LARGE, "vname" => DIET_LARGEVILLAGE, "effect" => "(25%)", "quantity" => 4, "img" => 6],
|
||||
["type" => 4, "size" => 3, "name" => DIET_UNIQUE, "vname" => DIET_UNIQUEVILLAGE, "effect" => "(50%)", "quantity" => 1, "img" => 6]],
|
||||
|
||||
ACADEMIC_DESC => [["type" => 5, "size" => 1, "name" => ACADEMIC_SMALL, "vname" => ACADEMIC_SMALLVILLAGE, "effect" => "(50%)", "quantity" => 6, "img" => 8],
|
||||
["type" => 5, "size" => 2, "name" => ACADEMIC_LARGE, "vname" => ACADEMIC_LARGEVILLAGE, "effect" => "(25%)", "quantity" => 4, "img" => 8],
|
||||
["type" => 5, "size" => 3, "name" => ACADEMIC_UNIQUE, "vname" => ACADEMIC_UNIQUEVILLAGE, "effect" => "(50%)", "quantity" => 1, "img" => 8]],
|
||||
|
||||
STORAGE_DESC => [["type" => 6, "size" => 1, "name" => STORAGE_SMALL, "vname" => STORAGE_SMALLVILLAGE, "effect" => "(50%)", "quantity" => 6, "img" => 9],
|
||||
["type" => 6, "size" => 2, "name" => STORAGE_LARGE, "vname" => STORAGE_LARGEVILLAGE, "effect" => "(25%)", "quantity" => 4, "img" => 9]],
|
||||
|
||||
CONFUSION_DESC => [["type" => 7, "size" => 1, "name" => CONFUSION_SMALL, "vname" => CONFUSION_SMALLVILLAGE, "effect" => "(200)", "quantity" => 6, "img" => 10],
|
||||
["type" => 7, "size" => 2, "name" => CONFUSION_LARGE, "vname" => CONFUSION_LARGEVILLAGE, "effect" => "(100)", "quantity" => 4, "img" => 10],
|
||||
["type" => 7, "size" => 3, "name" => CONFUSION_UNIQUE, "vname" => CONFUSION_UNIQUEVILLAGE, "effect" => "(500)", "quantity" => 1, "img" => 10]],
|
||||
|
||||
FOOL_DESC => [["type" => 8, "size" => 1, "name" => FOOL_SMALL, "vname" => FOOL_SMALLVILLAGE, "effect" => "", "quantity" => 10, "img" => "fool"],
|
||||
2 => ["type" => 8, "size" => 3, "name" => FOOL_UNIQUE, "vname" => FOOL_UNIQUEVILLAGE, "effect" => "", "quantity" => 1, "img" => "fool"]]],
|
||||
|
||||
/**
|
||||
* @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]]],
|
||||
|
||||
/**
|
||||
* @var array Natars' normal artifacts buildings
|
||||
*/
|
||||
|
||||
NATARS_ARTIFACTS_BUILDINGS = [
|
||||
//Treasury of the 20th level, Residence of the 10th level, Rally Point of the 1th level
|
||||
"f22t" => 27, "f22" => 20, "f28t" => 25, "f28" => 10, "f39t" => 16, "f39" => 1,
|
||||
//18 Cranny of the 10th level
|
||||
"f19t" => 23, "f19" => 10, "f20t" => 23, "f20" => 10, "f21t" => 23, "f21" => 10,
|
||||
"f23t" => 23, "f23" => 10, "f24t" => 23, "f24" => 10, "f25t" => 23, "f25" => 10,
|
||||
"f26t" => 23, "f26" => 10, "f27t" => 23, "f27" => 10, "f29t" => 23, "f29" => 10,
|
||||
"f30t" => 23, "f30" => 10, "f31t" => 23, "f31" => 10, "f32t" => 23, "f32" => 10,
|
||||
"f33t" => 23, "f33" => 10, "f34t" => 23, "f34" => 10, "f35t" => 23, "f35" => 10,
|
||||
"f36t" => 23, "f36" => 10, "f37t" => 23, "f37" => 10, "f38t" => 23, "f38" => 10],
|
||||
|
||||
|
||||
/**
|
||||
* @var array Natars' WW villages buildings
|
||||
*/
|
||||
|
||||
NATARS_WW_VILLAGES_BUILDINGS = [
|
||||
//WW of the 0th level, Main Building of the 10th level, Marketplace of the 1th level
|
||||
"f99t" => 40, "f99" => 0, "f22t" => 15, "f22" => 10, "f34t" => 17, "f34" => 1,
|
||||
//Warehouse of the 20th & 10th level, Granary of the 20th & 10th level
|
||||
"f20t" => 10, "f20" => 20, "f19t" => 10, "f19" => 10, "f23t" => 11, "f23" => 20, "f27t" => 11, "f27" => 10,
|
||||
//All Woodcutter of the 5th level
|
||||
"f1" => 5, "f3" => 5, "f14" => 5, "f17" => 5,
|
||||
//All Clay Pit of the 5th level
|
||||
"f5" => 5, "f6" => 5, "f16" => 5, "f18" => 5,
|
||||
//All Iron Mine of the 5th level
|
||||
"f4" => 5, "f7" => 5, "f10" => 5, "f11" => 5,
|
||||
//All Cropland of the 6th level
|
||||
"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
|
||||
*/
|
||||
|
||||
NATARS_BASE_SPY = 1500;
|
||||
|
||||
public
|
||||
|
||||
/**
|
||||
* @var funct Natars' troops for normal artifact
|
||||
*/
|
||||
|
||||
$natarsArtifactsUnits,
|
||||
|
||||
/**
|
||||
* @var funct WW villages Natars' troops
|
||||
*/
|
||||
|
||||
$natarsWWVillagesUnits;
|
||||
|
||||
public function __construct(){
|
||||
|
||||
$this->natarsArtifactsUnits = function($multiplier){
|
||||
return [41 => rand(1000 * $multiplier, 2000 * $multiplier) * NATARS_UNITS,
|
||||
42 => rand(1500 * $multiplier, 2000 * $multiplier) * NATARS_UNITS,
|
||||
43 => rand(2300 * $multiplier, 2800 * $multiplier) * NATARS_UNITS,
|
||||
44 => rand(25 * $multiplier, 75 * $multiplier) * NATARS_UNITS,
|
||||
45 => rand(1200 * $multiplier, 1900 * $multiplier) * NATARS_UNITS,
|
||||
46 => rand(1500 * $multiplier, 2000 * $multiplier) * NATARS_UNITS,
|
||||
47 => rand(500 * $multiplier, 900 * $multiplier) * NATARS_UNITS,
|
||||
48 => rand(100 * $multiplier, 300 * $multiplier) * NATARS_UNITS,
|
||||
49 => rand(1 * $multiplier, 5 * $multiplier) * NATARS_UNITS,
|
||||
50 => rand(1 * $multiplier, 5 * $multiplier) * NATARS_UNITS];
|
||||
};
|
||||
|
||||
$this->natarsWWVillagesUnits = function(){
|
||||
return [41 => rand(500, 12000) * NATARS_UNITS,
|
||||
42 => rand(1000 , 14000) * NATARS_UNITS,
|
||||
43 => rand(2000, 16000) * NATARS_UNITS,
|
||||
44 => rand(100, 500) * NATARS_UNITS,
|
||||
45 => rand(480, 17000) * NATARS_UNITS,
|
||||
46 => rand(600, 18000) * NATARS_UNITS,
|
||||
47 => rand(2000, 16000) * NATARS_UNITS,
|
||||
48 => rand(400, 2000) * NATARS_UNITS,
|
||||
49 => rand(40, 200) * NATARS_UNITS,
|
||||
50 => rand(50, 250) * NATARS_UNITS];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when Natars account need to be created, creates his account and capital village
|
||||
*
|
||||
*/
|
||||
|
||||
public function createNatars(){
|
||||
global $database;
|
||||
|
||||
//Register the Natars account, the Natars' password is the same as the MH's one
|
||||
$password = $database->getUserField(5, 'password', 0);
|
||||
$database->register(TRIBE5, $password, self::NATARS_EMAIL, self::NATARS_TRIBE, null, self::NATARS_UID, self::NATARS_DESC);
|
||||
|
||||
//Convert from coordinates to village IDs
|
||||
$possibleWids = $database->getVilWrefs(self::NATARS_CAPITAL_COORDINATES);
|
||||
|
||||
//Check if the villages aren't already taken
|
||||
$wid = $database->getFreeVillage($possibleWids);
|
||||
|
||||
//Generate the Natars' capital
|
||||
$wid = $database->generateVillages([['wid' => $wid, 'mode' => 2, 'type' => 3, 'kid' => 0, 'capital' => 1, 'pop' => 834, 'name' => null, 'natar' => 0]], self::NATARS_UID, TRIBE5);
|
||||
|
||||
//Scouts all players
|
||||
$this->scoutAllPlayers($wid);
|
||||
|
||||
//Add artifacts
|
||||
$this->addArtifactVillages(self::NATARS_ARTIFACTS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when Natars account has been created
|
||||
*
|
||||
* @param int $wid The village ID of the Natars' capital
|
||||
*/
|
||||
|
||||
public function scoutAllPlayers($wid){
|
||||
global $database;
|
||||
|
||||
$array = $database->getProfileVillages(0, 1);
|
||||
$refs = [];
|
||||
$vils = [];
|
||||
|
||||
foreach($array as $vill){
|
||||
$refs[] = $database->addAttack($wid, 0, 0, 0, self::NATARS_BASE_SPY * NATARS_UNITS, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 20, 0, 0, 0, 0);
|
||||
$vils[] = $vill['wref'];
|
||||
}
|
||||
|
||||
$type = [];
|
||||
$from = [];
|
||||
$to = [];
|
||||
$ref = [];
|
||||
$time = [];
|
||||
$timeValue = time();
|
||||
$endtime = [];
|
||||
$endtimeValue = $timeValue + round(10000 / SPEED);
|
||||
$counter = 0;
|
||||
|
||||
foreach ($refs as $index => $refID) {
|
||||
$type[] = 3;
|
||||
$from[] = $wid;
|
||||
$to[] = $vils[$index];
|
||||
$ref[] = $refID;
|
||||
$time[] = $timeValue;
|
||||
$endtime[] = $endtimeValue;
|
||||
|
||||
// limit the insert, so it can push through any reasonable network limits imposed
|
||||
if (++$counter > 25) {
|
||||
$database->addMovement($type, $from, $to, $ref, $time, $endtime);
|
||||
|
||||
$type = [];
|
||||
$from = [];
|
||||
$to = [];
|
||||
$ref = [];
|
||||
$time = [];
|
||||
$endtime = [];
|
||||
$counter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ($counter > 0) $database->addMovement($type, $from, $to, $ref, $time, $endtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates villages and puts the desired artifacts in it
|
||||
*
|
||||
* @param array $artifactArrays The array containing the artifacts to insert
|
||||
* @param int $uid The owner's user ID (Natars)
|
||||
*/
|
||||
|
||||
public function addArtifactVillages($artifactArrays, $uid = self::NATARS_UID) {
|
||||
global $database;
|
||||
|
||||
//Variables initialization
|
||||
$artifactNumber = 0;
|
||||
$artifactVillages = $artifactTroops = $artifactBuildings = $artifactsToAdd = $wids = [];
|
||||
|
||||
//Create the artifact villages array
|
||||
foreach($artifactArrays as $desc => $artifactType){
|
||||
foreach($artifactType as $artifact){
|
||||
for($i = 0; $i < $artifact['quantity']; $i++){
|
||||
//Generate the villages array
|
||||
$artifactVillages[] = ['wid' => 0, 'mode' => $artifact['size'] + 1, 'type' => 3, 'kid' => rand(1, 4), 'capital' => 0, 'pop' => 163, 'name' => $artifact['vname'], 'natar' => 0];
|
||||
|
||||
//Set the unit arrays (1, 2 or 4)
|
||||
$multiplier = $artifact['size'] == 3 ? 4 : $artifact['size'];
|
||||
$unitArrays = ($this->natarsArtifactsUnits)($multiplier);
|
||||
|
||||
//Generate the unit arrays
|
||||
$artifactTroops[1][] = array_values($unitArrays);
|
||||
$artifactBuildings[1][] = array_values(self::NATARS_ARTIFACTS_BUILDINGS);
|
||||
|
||||
//Generate the artifacts array
|
||||
$artifactsToAdd[] = ['owner' => $uid, 'type' => $artifact['type'], 'size' => $artifact['size'],
|
||||
'name' => $artifact['name'], 'desc' => $desc, 'effect' => $artifact['effect'],
|
||||
'img' => "type".$artifact['img'].".gif"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Set the unit types by using the last $unitArrays
|
||||
$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));
|
||||
|
||||
//Create the artifacts for the generated wids
|
||||
$database->addArtefacts($wids, $artifactsToAdd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when WW villages need to be created
|
||||
*
|
||||
*/
|
||||
|
||||
public function createWWVillages(){
|
||||
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)());
|
||||
$buildingArrays[1][] = array_values(self::NATARS_WW_VILLAGES_BUILDINGS);
|
||||
}
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when WW building plans need to be created
|
||||
*
|
||||
*/
|
||||
|
||||
public function createWWBuildingPlans(){
|
||||
|
||||
//Add the artifacts and villages
|
||||
$this->addArtifactVillages(self::NATARS_WW_BUILDING_PLANS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatically activate all artifacts that need to be activated
|
||||
*
|
||||
*/
|
||||
|
||||
public function activateArtifacts(){
|
||||
global $database;
|
||||
|
||||
//Get all inactive artifacts that have to be activated --> (24 hours / Speed of the server)
|
||||
$time = time();
|
||||
$artifacts = $database->getInactiveArtifacts(round($time - (86400 / (SPEED == 2 ? 1.5 : (SPEED == 3 ? 2 : SPEED)))));
|
||||
|
||||
if(!empty($artifacts)){
|
||||
|
||||
//Cache inactive artifacts by owner
|
||||
$inactiveArtifactsCache = [];
|
||||
foreach($artifacts as $artifact) $inactiveArtifactsCache[$artifact['owner']][] = $artifact;
|
||||
|
||||
foreach($inactiveArtifactsCache as $owner => $inactiveArtifacts){
|
||||
|
||||
//Initialize the array
|
||||
$activeArtifacts = [];
|
||||
|
||||
//Get cached active artifacts
|
||||
$ownArtifacts = $database->getOwnArtifactsSum($owner, true);
|
||||
|
||||
//Activate activable artifacts
|
||||
foreach($inactiveArtifacts as $artifact){
|
||||
if($ownArtifacts['totals'] < 3){
|
||||
if($artifact['size'] == 1){ //Village effect
|
||||
$database->activateArtifact($artifact['id']);
|
||||
$ownArtifacts['totals']++;
|
||||
$ownArtifacts['small']++;
|
||||
}elseif($artifact['size'] == 2 && !$ownArtifacts['unique'] && !$ownArtifacts['great']){ //Account effect
|
||||
$database->activateArtifact($artifact['id']);
|
||||
$ownArtifacts['totals']++;
|
||||
$ownArtifacts['great']++;
|
||||
}elseif($artifact['size'] == 3 && !$ownArtifacts['unique'] && !$ownArtifacts['great']){ //Unique effect
|
||||
$database->activateArtifact($artifact['id']);
|
||||
$ownArtifacts['totals']++;
|
||||
$ownArtifacts['unique']++;
|
||||
}
|
||||
}elseif($ownArtifacts['small'] == 3 && $artifact['size'] > 1){
|
||||
//If we've 3 village effect artifacts activated and at least one account/unique effect not activated
|
||||
//then we need to deactivate the most recent village effect artifact and activate the oldest account
|
||||
//or unique effect artifact
|
||||
|
||||
//Deactivate the most recent village effect artifact
|
||||
$database->activateArtifact($database->getNewestArtifactBySize($owner, 1)['id'], 0);
|
||||
|
||||
//Activate the great/unique artifact
|
||||
$database->activateArtifact($artifact['id']);
|
||||
|
||||
$ownArtifacts['small']--;
|
||||
$ownArtifacts['totals']++;
|
||||
if($artifact['size'] == 2) $ownArtifacts['great']++;
|
||||
else $ownArtifacts['unique']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Return the selected artifact, to the Natars account, by creating a new village and
|
||||
* by moving the artifact into it
|
||||
*
|
||||
* @param array $artifact The artifact array
|
||||
*/
|
||||
|
||||
public function returnArtifactToNatars($artifactArray){
|
||||
global $database;
|
||||
|
||||
//Set the village arrays
|
||||
$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]];
|
||||
|
||||
//Set the unit arrays
|
||||
$multiplier = $artifactArray['size'] == 3 ? 4 : $artifactArray['size'];
|
||||
$unitsArray = ($this->natarsArtifactsUnits)($multiplier);
|
||||
|
||||
//Set the unit types
|
||||
$artifactTroops[1][] = array_values($unitsArray);
|
||||
$artifactTroops[0] = array_keys($unitsArray);
|
||||
|
||||
//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);
|
||||
|
||||
//Update the artifact with the new village id and owner
|
||||
$database->updateArtifactDetails($artifactArray['id'], ['vref' => $wid, 'owner' => self::NATARS_UID, 'active' => 0, 'del' => 0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the artifact informations in plain text
|
||||
|
||||
+31
-235
@@ -27,11 +27,21 @@ include_once("Ranking.php");
|
||||
include_once("Generator.php");
|
||||
include_once("Multisort.php");
|
||||
include_once("Building.php");
|
||||
include_once("Artifacts.php");
|
||||
|
||||
class Automation {
|
||||
|
||||
/**
|
||||
* @var object The artifacts class, used to create Natars, artifacts and obtaining info about them
|
||||
*/
|
||||
|
||||
private $artifacts;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
//Classes initialization
|
||||
$this->artifacts = new Artifacts();
|
||||
|
||||
$autoprefix = "";
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$autoprefix = str_repeat('../', $i);
|
||||
@@ -238,13 +248,16 @@ class Automation {
|
||||
@set_time_limit(0);
|
||||
|
||||
foreach($needDelete as $need) {
|
||||
$needVillage = $database->getVillagesID($need['uid']);
|
||||
$need['uid'] = (int) $need['uid'];
|
||||
|
||||
//Get the villages which have to be deleted
|
||||
$needVillages = $database->getVillagesID($need['uid']);
|
||||
|
||||
//Delete all villages
|
||||
foreach($needVillage as $village) $this->DelVillage((int) $village);
|
||||
$database->DelVillage($needVillages);
|
||||
|
||||
for($i = 0;$i < 20; $i++){
|
||||
$q = "SELECT id FROM ".TB_PREFIX."users where friend".$i." = ".(int) $need['uid']." or friend".$i."wait = ".(int) $need['uid']."";
|
||||
$q = "SELECT id FROM ".TB_PREFIX."users where friend".$i." = ".$need['uid']." or friend".$i."wait = ".$need['uid']."";
|
||||
$array = $database->query_return($q);
|
||||
foreach($array as $friend){
|
||||
$database->deleteFriend($friend['id'],"friend".$i);
|
||||
@@ -264,25 +277,21 @@ class Automation {
|
||||
Automation::updateMax($newleader);
|
||||
}
|
||||
|
||||
if (isset($alliance)) {
|
||||
$database->deleteAlliance($alliance);
|
||||
}
|
||||
$q = "UPDATE ".TB_PREFIX."artefacts where owner = ".(int) $need['uid']." SET del = 1";
|
||||
$database->query($q);
|
||||
if (isset($alliance)) $database->deleteAlliance($alliance);
|
||||
|
||||
$q = "DELETE FROM ".TB_PREFIX."hero where uid = ".(int) $need['uid'];
|
||||
$q = "DELETE FROM ".TB_PREFIX."hero where uid = ".$need['uid'];
|
||||
$database->query($q);
|
||||
|
||||
$q = "DELETE FROM ".TB_PREFIX."mdata where target = ".(int) $need['uid']." or owner = ".(int) $need['uid'];
|
||||
$q = "DELETE FROM ".TB_PREFIX."mdata where target = ".$need['uid']." or owner = ".$need['uid'];
|
||||
$database->query($q);
|
||||
|
||||
$q = "DELETE FROM ".TB_PREFIX."ndata where uid = ".(int) $need['uid'];
|
||||
$q = "DELETE FROM ".TB_PREFIX."ndata where uid = ".$need['uid'];
|
||||
$database->query($q);
|
||||
|
||||
$q = "DELETE FROM ".TB_PREFIX."users where id = ".(int) $need['uid'];
|
||||
$q = "DELETE FROM ".TB_PREFIX."users where id = ".$need['uid'];
|
||||
$database->query($q);
|
||||
|
||||
$q = "DELETE FROM ".TB_PREFIX."deleting where uid = ".(int) $need['uid'];
|
||||
$q = "DELETE FROM ".TB_PREFIX."deleting where uid = ".$need['uid'];
|
||||
$database->query($q);
|
||||
}
|
||||
}
|
||||
@@ -2454,7 +2463,7 @@ class Automation {
|
||||
}
|
||||
|
||||
//Delete the village
|
||||
$this->DelVillage($data['to']);
|
||||
$database->DelVillage($data['to']);
|
||||
|
||||
//Reassign the hero, if dead and assigned to the deleted village
|
||||
$database->reassignHero($data['to']);
|
||||
@@ -2569,96 +2578,6 @@ class Automation {
|
||||
}
|
||||
}
|
||||
|
||||
function DelVillage($wref){
|
||||
global $database, $units;
|
||||
|
||||
$database->clearExpansionSlot($wref);
|
||||
$wref = (int) $wref;
|
||||
$q = "DELETE FROM ".TB_PREFIX."abdata where vref = $wref";
|
||||
$database->query($q);
|
||||
$q = "DELETE FROM ".TB_PREFIX."bdata where wid = $wref";
|
||||
$database->query($q);
|
||||
$q = "DELETE FROM ".TB_PREFIX."market where vref = $wref";
|
||||
$database->query($q);
|
||||
$q = "DELETE FROM ".TB_PREFIX."research where vref = $wref";
|
||||
$database->query($q);
|
||||
$q = "DELETE FROM ".TB_PREFIX."tdata where vref = $wref";
|
||||
$database->query($q);
|
||||
$q = "DELETE FROM ".TB_PREFIX."fdata where vref = $wref";
|
||||
$database->query($q);
|
||||
$q = "DELETE FROM ".TB_PREFIX."training where vref = $wref";
|
||||
$database->query($q);
|
||||
$q = "DELETE FROM ".TB_PREFIX."units where vref = $wref";
|
||||
$database->query($q);
|
||||
$q = "DELETE FROM ".TB_PREFIX."farmlist where wref = $wref";
|
||||
$database->query($q);
|
||||
$q = "DELETE FROM ".TB_PREFIX."raidlist where towref = $wref";
|
||||
$database->query($q);
|
||||
$q = "DELETE FROM ".TB_PREFIX."route where wid = $wref OR `from` = $wref";
|
||||
$database->query($q);
|
||||
$q = "DELETE FROM ".TB_PREFIX."movement where proc = 0 AND ((`to` = $wref AND sort_type=4) OR (`from` = $wref AND sort_type=3))";
|
||||
$database->query($q);
|
||||
$database->removeOases($wref, 1);
|
||||
|
||||
$getmovement = $database->getMovement(3, $wref, 1);
|
||||
|
||||
$moveIDs = [];
|
||||
$time = microtime(true);
|
||||
$types = [];
|
||||
$froms = [];
|
||||
$tos = [];
|
||||
$refs = [];
|
||||
$times = [];
|
||||
$endtimes = [];
|
||||
|
||||
foreach($getmovement as $movedata) {
|
||||
$time2 = $time - $movedata['starttime'];
|
||||
$moveIDs[] = $movedata['moveid'];
|
||||
$types[] = 4;
|
||||
$froms[] = $movedata['to'];
|
||||
$tos[] = $movedata['from'];
|
||||
$refs[] = $movedata['ref'];
|
||||
$times[] = $time;
|
||||
$endtimes[] = $time+$time2;
|
||||
}
|
||||
|
||||
$database->setMovementProc(implode(', ', $moveIDs));
|
||||
$database->addMovement($types, $froms, $tos, $refs, $times, $endtimes);
|
||||
|
||||
$q = "DELETE FROM ".TB_PREFIX."enforcement WHERE `from` = $wref";
|
||||
$database->query($q);
|
||||
|
||||
//check return enforcement from del village
|
||||
$units->returnTroops($wref);
|
||||
|
||||
$q = "DELETE FROM ".TB_PREFIX."vdata WHERE `wref` = $wref";
|
||||
$database->query($q);
|
||||
|
||||
if (mysqli_affected_rows($database->dblink) > 0) {
|
||||
$q = "UPDATE ".TB_PREFIX."wdata set occupied = 0 where id = $wref";
|
||||
$database->query($q);
|
||||
|
||||
// clear expansion slots, if this village is an expansion of any other village
|
||||
$database->clearExpansionSlot($wref, 1);
|
||||
|
||||
$getprisoners = $database->getPrisoners($wref);
|
||||
foreach($getprisoners as $pris) {
|
||||
$troops = 0;
|
||||
for($i = 1; $i < 12; $i++) $troops += $pris['t'.$i];
|
||||
$database->modifyUnit($pris['wref'], ["99o"], [$troops], [0]);
|
||||
$database->deletePrisoners($pris['id']);
|
||||
}
|
||||
|
||||
$getprisoners = $database->getPrisoners3($wref);
|
||||
foreach($getprisoners as $pris) {
|
||||
$troops = 0;
|
||||
for($i = 1;$i < 12; $i++) $troops += $pris['t'.$i];
|
||||
$database->modifyUnit($pris['wref'], ["99o"], [$troops], [0]);
|
||||
$database->deletePrisoners($pris['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function sendreinfunitsComplete() {
|
||||
global $bid23, $database, $battle;
|
||||
|
||||
@@ -2983,41 +2902,7 @@ class Automation {
|
||||
if($database->areArtifactsSpawned() || strtotime(START_DATE) + (NATARS_SPAWN_TIME * 86400) > time()) return;
|
||||
|
||||
//Create the Natars account and his capital
|
||||
$database->createNatars();
|
||||
|
||||
//Artifacts constants
|
||||
$artifactArrays = [ARCHITECTS_DESC => [["type" => 1, "size" => 1, "name" => ARCHITECTS_SMALL, "vname" => ARCHITECTS_SMALLVILLAGE, "effect" => "(4x)", "quantity" => 6, "img" => 2],
|
||||
["type" => 1, "size" => 2, "name" => ARCHITECTS_LARGE, "vname" => ARCHITECTS_LARGEVILLAGE, "effect" => "(3x)", "quantity" => 4, "img" => 2],
|
||||
["type" => 1, "size" => 3, "name" => ARCHITECTS_UNIQUE,"vname" => ARCHITECTS_UNIQUEVILLAGE, "effect" => "(5x)", "quantity" => 1, "img" => 2]],
|
||||
|
||||
HASTE_DESC => [["type" => 2, "size" => 1, "name" => HASTE_SMALL, "vname" => HASTE_SMALLVILLAGE, "effect" => "(2x)", "quantity" => 6, "img" => 4],
|
||||
["type" => 2, "size" => 2, "name" => HASTE_LARGE, "vname" => HASTE_LARGEVILLAGE, "effect" => "(1.5x)", "quantity" => 4, "img" => 4],
|
||||
["type" => 2, "size" => 3, "name" => HASTE_UNIQUE, "vname" => HASTE_UNIQUEVILLAGE, "effect" => "(3x)", "quantity" => 1, "img" => 4]],
|
||||
|
||||
EYESIGHT_DESC => [["type" => 3, "size" => 1, "name" => EYESIGHT_SMALL, "vname" => EYESIGHT_SMALLVILLAGE, "effect" => "(5x)", "quantity" => 6, "img" => 5],
|
||||
["type" => 3, "size" => 2, "name" => EYESIGHT_LARGE, "vname" => EYESIGHT_LARGEVILLAGE, "effect" => "(3x)", "quantity" => 4, "img" => 5],
|
||||
["type" => 3, "size" => 3, "name" => EYESIGHT_UNIQUE, "vname" => EYESIGHT_UNIQUEVILLAGE, "effect" => "(10x)", "quantity" => 1, "img" => 5]],
|
||||
|
||||
DIET_DESC => [["type" => 4, "size" => 1, "name" => DIET_SMALL, "vname" => DIET_SMALLVILLAGE, "effect" => "(50%)", "quantity" => 6, "img" => 6],
|
||||
["type" => 4, "size" => 2, "name" => DIET_LARGE, "vname" => DIET_LARGEVILLAGE, "effect" => "(25%)", "quantity" => 4, "img" => 6],
|
||||
["type" => 4, "size" => 3, "name" => DIET_UNIQUE, "vname" => DIET_UNIQUEVILLAGE, "effect" => "(50%)", "quantity" => 1, "img" => 6]],
|
||||
|
||||
ACADEMIC_DESC => [["type" => 5, "size" => 1, "name" => ACADEMIC_SMALL, "vname" => ACADEMIC_SMALLVILLAGE, "effect" => "(50%)", "quantity" => 6, "img" => 8],
|
||||
["type" => 5, "size" => 2, "name" => ACADEMIC_LARGE, "vname" => ACADEMIC_LARGEVILLAGE, "effect" => "(25%)", "quantity" => 4, "img" => 8],
|
||||
["type" => 5, "size" => 3, "name" => ACADEMIC_UNIQUE, "vname" => ACADEMIC_UNIQUEVILLAGE, "effect" => "(50%)", "quantity" => 1, "img" => 8]],
|
||||
|
||||
STORAGE_DESC => [["type" => 6, "size" => 1, "name" => STORAGE_SMALL, "vname" => STORAGE_SMALLVILLAGE, "effect" => "(50%)", "quantity" => 6, "img" => 9],
|
||||
["type" => 6, "size" => 2, "name" => STORAGE_LARGE, "vname" => STORAGE_LARGEVILLAGE, "effect" => "(25%)", "quantity" => 4, "img" => 9]],
|
||||
|
||||
CONFUSION_DESC => [["type" => 7, "size" => 1, "name" => CONFUSION_SMALL, "vname" => CONFUSION_SMALLVILLAGE, "effect" => "(200)", "quantity" => 6, "img" => 10],
|
||||
["type" => 7, "size" => 2, "name" => CONFUSION_LARGE, "vname" => CONFUSION_LARGEVILLAGE, "effect" => "(100)", "quantity" => 4, "img" => 10],
|
||||
["type" => 7, "size" => 3, "name" => CONFUSION_UNIQUE, "vname" => CONFUSION_UNIQUEVILLAGE, "effect" => "(500)", "quantity" => 1, "img" => 10]],
|
||||
|
||||
FOOL_DESC => [["type" => 8, "size" => 1, "name" => FOOL_SMALL, "vname" => FOOL_SMALLVILLAGE, "effect" => "", "quantity" => 10, "img" => "fool"],
|
||||
["type" => 8, "size" => 3, "name" => FOOL_UNIQUE, "vname" => FOOL_UNIQUEVILLAGE, "effect" => "", "quantity" => 1, "img" => "fool"]]];
|
||||
|
||||
//Add artifacts and their villages
|
||||
$database->addArtifactVillages($artifactArrays);
|
||||
$this->artifacts->createNatars();
|
||||
|
||||
//Write the system message
|
||||
$database->displaySystemMessage(ARTEFACT);
|
||||
@@ -3035,44 +2920,8 @@ class Automation {
|
||||
//and if it's the time to spawn them or not
|
||||
if(!$database->areArtifactsSpawned() || $database->areWWVillagesSpawned() || strtotime(START_DATE) + (NATARS_WW_SPAWN_TIME * 86400) > time()) return;
|
||||
|
||||
//WW village Natars' troops
|
||||
$unitArrays = [41 => rand(500, 12000) * NATARS_UNITS,
|
||||
42 => rand(1000 , 14000) * NATARS_UNITS,
|
||||
43 => rand(2000, 16000) * NATARS_UNITS,
|
||||
44 => rand(100, 500) * NATARS_UNITS,
|
||||
45 => rand(480, 17000) * NATARS_UNITS,
|
||||
46 => rand(600, 18000) * NATARS_UNITS,
|
||||
47 => rand(2000, 16000) * NATARS_UNITS,
|
||||
48 => rand(400, 2000) * NATARS_UNITS,
|
||||
49 => rand(40, 200) * NATARS_UNITS,
|
||||
50 => rand(50, 250) * NATARS_UNITS];
|
||||
|
||||
//WW village buildings
|
||||
$buildingArrays = [
|
||||
//WW of the 0th level, Main Building of the 10th level, Marketplace of the 1th level, Delete Main Building of the 1th level
|
||||
"f99t" => 40, "f99" => 0, "f22t" => 15, "f22" => 10, "f34t" => 17, "f34" => 1, "f26t" => 0, "f26" => 0,
|
||||
//Warehouse of the 20th & 10th level, Granary of the 20th & 10th level
|
||||
"f20t" => 10, "f20" => 20, "f19t" => 10, "f19" => 10, "f23t" => 11, "f23" => 20, "f27t" => 11, "f27" => 10,
|
||||
//All Woodcutter of the 5th level
|
||||
"f1t" => 1, "f1" => 5, "f3t" => 1, "f3" => 5, "f14t" => 1, "f14" => 5, "f17t" => 1, "f17" => 5,
|
||||
//All Clay Pit of the 5th level
|
||||
"f5t" => 2, "f5" => 5, "f6t" => 2, "f6" => 5, "f16t" => 2, "f16" => 5, "f18t" => 2, "f18" => 5,
|
||||
//All Iron Mine of the 5th level
|
||||
"f4t" => 3, "f4" => 5, "f7t" => 3, "f7" => 5, "f10t" => 3, "f10" => 5, "f11t" => 3, "f11" => 5,
|
||||
//All Cropland of the 6th level
|
||||
"f2t" => 4, "f2" => 6, "f8t" => 4, "f8" => 6, "f9t" => 4, "f9" => 6, "f12t" => 4, "f12" => 6, "f13t" => 4, "f13" => 6, "f15t" => 4, "f15" => 6];
|
||||
|
||||
$villageArrays = $wids = [];
|
||||
for($i = 1; $i <= 13; $i++) $villageArrays[] = ['wid' => 0, 'kid' => ($i == 13 ? rand(1, 4) : ($i % 4) + 1), 'capital' => 0];
|
||||
|
||||
$wids = $database->generateVillages($villageArrays, 3, "Natars");
|
||||
|
||||
foreach($wids as $wid){
|
||||
$database->modifyUnit($wid, array_keys($unitArrays), array_values($unitArrays), [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
$database->setVillageLevel($wid, array_keys($buildingArrays), array_values($buildingArrays));
|
||||
$database->setVillageFields($wid, ['natar', 'pop', 'name'], [1, 233, WWVILLAGE]);
|
||||
// $this->recountPop($wid); //it is necessary to comment out otherwise the population will be 198
|
||||
}
|
||||
//Create WW villages
|
||||
$this->artifacts->createWWVillages();
|
||||
|
||||
//Write the system message
|
||||
$database->displaySystemMessage(WWVILLAGEMSG);
|
||||
@@ -3090,10 +2939,8 @@ class Automation {
|
||||
//and if it's the time to spawn them or not
|
||||
if(!$database->areArtifactsSpawned() || $database->areArtifactsSpawned(true) || strtotime(START_DATE) + (NATARS_WW_BUILDING_PLAN_SPAWN_TIME * 86400) > time()) return;
|
||||
|
||||
$artifactArrays = [PLAN_DESC => [["type" => 11, "size" => 1, "name" => PLAN,"vname" => PLANVILLAGE, "effect" => "", "quantity" => 13, "img" => 1]]];
|
||||
|
||||
//Add the artifacts and villages
|
||||
$database->addArtifactVillages($artifactArrays);
|
||||
//Create WW building plans
|
||||
$this->artifacts->createWWBuildingPlans();
|
||||
|
||||
//Set the system message to contain the infos of the WW building plans
|
||||
$database->displaySystemMessage(PLAN_INFO);
|
||||
@@ -3110,59 +2957,8 @@ class Automation {
|
||||
//Check if there's at least one artifact, if not, return
|
||||
if(!$database->areArtifactsSpawned()) return;
|
||||
|
||||
//Get all inactive artifacts that have to be activated --> (24 hours / Speed of the server)
|
||||
$time = time();
|
||||
$artifacts = $database->getInactiveArtifacts(round($time - (86400 / (SPEED == 2 ? 1.5 : (SPEED == 3 ? 2 : SPEED)))));
|
||||
|
||||
if(!empty($artifacts)){
|
||||
|
||||
//Cache inactive artifacts by owner
|
||||
$inactiveArtifactsCache = [];
|
||||
foreach($artifacts as $artifact) $inactiveArtifactsCache[$artifact['owner']][] = $artifact;
|
||||
|
||||
foreach($inactiveArtifactsCache as $owner => $inactiveArtifacts){
|
||||
|
||||
//Initialize the array
|
||||
$activeArtifacts = [];
|
||||
|
||||
//Get cached active artifacts
|
||||
$ownArtifacts = $database->getOwnArtifactsSum($owner, true);
|
||||
|
||||
//Activate activable artifacts
|
||||
foreach($inactiveArtifacts as $artifact){
|
||||
if($ownArtifacts['totals'] < 3){
|
||||
if($artifact['size'] == 1){ //Village effect
|
||||
$database->activateArtifact($artifact['id']);
|
||||
$ownArtifacts['totals']++;
|
||||
$ownArtifacts['small']++;
|
||||
}elseif($artifact['size'] == 2 && !$ownArtifacts['unique'] && !$ownArtifacts['great']){ //Account effect
|
||||
$database->activateArtifact($artifact['id']);
|
||||
$ownArtifacts['totals']++;
|
||||
$ownArtifacts['great']++;
|
||||
}elseif($artifact['size'] == 3 && !$ownArtifacts['unique'] && !$ownArtifacts['great']){ //Unique effect
|
||||
$database->activateArtifact($artifact['id']);
|
||||
$ownArtifacts['totals']++;
|
||||
$ownArtifacts['unique']++;
|
||||
}
|
||||
}elseif($ownArtifacts['small'] == 3 && $artifact['size'] > 1){
|
||||
//If we've 3 village effect artifacts activated and at least one account/unique effect not activated
|
||||
//then we need to deactivate the most recent village effect artifact and activate the oldest account
|
||||
//or unique effect artifact
|
||||
|
||||
//Deactivate the most recent village effect artifact
|
||||
$database->activateArtifact($database->getNewestArtifactBySize($owner, 1)['id'], 0);
|
||||
|
||||
//Activate the great/unique artifact
|
||||
$database->activateArtifact($artifact['id']);
|
||||
|
||||
$ownArtifacts['small']--;
|
||||
$ownArtifacts['totals']++;
|
||||
if($artifact['size'] == 2) $ownArtifacts['great']++;
|
||||
else $ownArtifacts['unique']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//Activate the artifacts that need to be activated
|
||||
$this->artifacts->activateArtifacts();
|
||||
}
|
||||
|
||||
private function researchComplete() {
|
||||
@@ -4837,7 +4633,7 @@ class Automation {
|
||||
global $database;
|
||||
|
||||
$time = time();
|
||||
$q = "SELECT id, size FROM " . TB_PREFIX . "artefacts where type = 8 AND active = 1 AND lastupdate <= ".($time - (86400 / (SPEED == 2 ? 1.5 : (SPEED == 3 ? 2 : SPEED))));
|
||||
$q = "SELECT id, size FROM " . TB_PREFIX . "artefacts where type = 8 AND active = 1 AND del = 0 AND lastupdate <= ".($time - (86400 / (SPEED == 2 ? 1.5 : (SPEED == 3 ? 2 : SPEED))));
|
||||
$array = $database->query_return($q);
|
||||
if ($array) {
|
||||
foreach($array as $artefact) {
|
||||
|
||||
@@ -537,10 +537,10 @@ class Building {
|
||||
case 37: return $this->getTypeLevel(15) >= 3 && $this->getTypeLevel(16) >= 1 && !$isBuilt;
|
||||
|
||||
// great warehouse can only be built with artefact or in Natar villages
|
||||
case 38: return $this->getTypeLevel(15) >= 10 && (!$isBuilt || $this->getTypeLevel($id) == 20) && ($village->natar == 1 || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 1, 0)) || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 2, 0)));
|
||||
case 38: return $this->getTypeLevel(15) >= 10 && (!$isBuilt || $this->getTypeLevel($id) == 20) && ($village->natar == 1 || count($database->getOwnUniqueArtefactInfo2($village->wid, 6, 1, 0)) || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 2, 0)));
|
||||
|
||||
// great granary can only be built with artefact or in Natar villages
|
||||
case 39: return $this->getTypeLevel(15) >= 10 && (!$isBuilt || $this->getTypeLevel($id) == 20) && ($village->natar == 1 || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 1, 0)) || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 2, 0)));
|
||||
case 39: return $this->getTypeLevel(15) >= 10 && (!$isBuilt || $this->getTypeLevel($id) == 20) && ($village->natar == 1 || count($database->getOwnUniqueArtefactInfo2($village->wid, 6, 1, 0)) || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 2, 0)));
|
||||
|
||||
case 40: return $this->allowWwUpgrade();
|
||||
case 41: return $this->getTypeLevel(16) >= 10 && $this->getTypeLevel(20) == 20 && $session->tribe == 1 && !$isBuilt;
|
||||
|
||||
+483
-403
File diff suppressed because it is too large
Load Diff
+42
-55
@@ -1,7 +1,10 @@
|
||||
<?php
|
||||
$artefact1 = $database->getOwnArtefactInfo3($session->uid);
|
||||
include_once("GameEngine/Artifacts.php");
|
||||
|
||||
$ownArtifacts = $database->getOwnArtefactsInfo($session->uid);
|
||||
$wref = $village->wid;
|
||||
$coor = $database->getCoor($wref);
|
||||
|
||||
?>
|
||||
<body>
|
||||
<div class="gid27">
|
||||
@@ -21,31 +24,21 @@ $coor = $database->getCoor($wref);
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
if (empty($artefact1)) echo '<tr><td colspan="4" class="none">'.ANY_ARTIFACTS.'</td></tr>';
|
||||
if (empty($ownArtifacts)) echo '<tr><td colspan="4" class="none">'.ANY_ARTIFACTS.'</td></tr>';
|
||||
else
|
||||
{
|
||||
foreach($artefact1 as $artefact){
|
||||
$coor2 = $database->getCoor($artefact['vref']);
|
||||
if($artefact['size'] == 1 && $artefact['type'] != 11){
|
||||
$reqlvl = 10;
|
||||
$effect = "village";
|
||||
}else{
|
||||
if($artefact['type'] != 11){
|
||||
$reqlvl = 20;
|
||||
}else{
|
||||
$reqlvl = 10;
|
||||
}
|
||||
$effect = "account";
|
||||
}
|
||||
echo '<tr><td class="icon"><img class="artefact_icon_' . $artefact['type'] . '" src="img/x.gif"></td>';
|
||||
foreach($ownArtifacts as $ownArtifact){
|
||||
$coor2 = $database->getCoor($ownArtifact['vref']);
|
||||
$ownArtifactInfo = Artifacts::getArtifactInfo($ownArtifact);
|
||||
echo '<tr><td class="icon"><img class="artefact_icon_' . $ownArtifact['type'] . '" src="img/x.gif"></td>';
|
||||
echo '<td class="nam">
|
||||
<a href="build.php?id=' . $id . '&show='.$artefact['id'].'">' . $artefact['name'] . '</a> <span class="bon">' . $artefact['effect'] . '</span>
|
||||
<div class="info">
|
||||
Treasury <b>' . $reqlvl . '</b>, Effect <b>' . $effect . '</b>
|
||||
</div>
|
||||
</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $artefact['vref'] . '&c=' . $generator->getMapCheck($artefact['vref']) . '">' . $database->getVillageField($artefact['vref'], "name") . '</a></td>';
|
||||
echo '<td class="dist">' . date("d.m.Y H:i", $artefact['conquered']) . '</td></tr>';
|
||||
<a href="build.php?id='.$id . '&show='.$ownArtifact['id'].'">' . $ownArtifact['name'] . '</a> <span class="bon">' . $ownArtifact['effect'] . '</span>
|
||||
<div class="info">
|
||||
Treasury <b>'.$ownArtifactInfo['requiredLevel'].'</b>, Effect <b>'.$ownArtifactInfo['effectInfluence'].'</b>
|
||||
</div>
|
||||
</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $ownArtifact['vref'] . '&c=' . $generator->getMapCheck($ownArtifact['vref']) . '">' . $database->getVillageField($ownArtifact['vref'], "name") . '</a></td>';
|
||||
echo '<td class="dist">'.date("d.m.Y H:i", $ownArtifact['conquered']) . '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,41 +65,35 @@ Treasury <b>' . $reqlvl . '</b>, Effect <b>' . $effect . '</b>
|
||||
|
||||
<tbody>
|
||||
<?php
|
||||
$count = mysqli_fetch_array(mysqli_query($database->dblink,"SELECT Count(*) as Total FROM " . TB_PREFIX . "artefacts WHERE del = 0"), MYSQLI_ASSOC);
|
||||
$count = $count['Total'];
|
||||
if($count == 0) echo '<td colspan="4" class="none">'.NO_ARTIFACTS_AREA.'</td>';
|
||||
else
|
||||
{
|
||||
$arts = mysqli_query($database->dblink,"SELECT type, vref, id, name, size, owner, effect FROM " . TB_PREFIX . "artefacts WHERE del = 0");
|
||||
$artifacts = $database->getArtifactsBysize([1, 2, 3]);
|
||||
if(count($artifacts) == 0) echo '<td colspan="4" class="none">'.NO_ARTIFACTS_AREA.'</td>';
|
||||
else
|
||||
{
|
||||
$rows = [];
|
||||
while($row = mysqli_fetch_array($arts)) {
|
||||
$query = mysqli_query($database->dblink,'SELECT x, y FROM `' . TB_PREFIX . 'wdata` WHERE `id` = ' . (int) $row['vref']);
|
||||
$coor2 = mysqli_fetch_assoc($query);
|
||||
$dist = $database->getDistance($coor['x'], $coor['y'], $coor2['x'], $coor2['y']);
|
||||
$rows[$dist] = $row;
|
||||
foreach($artifacts as $artifact){
|
||||
$coordinates = $database->getCoor($artifact['vref']);
|
||||
|
||||
$distance = $database->getDistance($village->coor['x'], $village->coor['y'], $coordinates['x'], $coordinates['y']);
|
||||
$rows[(string)$distance] = $artifact;
|
||||
}
|
||||
|
||||
ksort($rows);
|
||||
foreach($rows as $row) {
|
||||
$wref = $village->wid;
|
||||
$coor = $database->getCoor($wref);
|
||||
$wref2 = $row['vref'];
|
||||
$coor2 = $database->getCoor($wref2);
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span>';
|
||||
echo '<div class="info">';
|
||||
if($row['size'] == 1 && $row['type'] != 11){
|
||||
$reqlvl = 10;
|
||||
$effect = VILLAGE;
|
||||
}else{
|
||||
$reqlvl = $row['type'] != 11 ? 20 : 10;
|
||||
$effect = ACCOUNT;
|
||||
}
|
||||
echo '<div class="info">'.TREASURY.' <b>' . $reqlvl . '</b>, '.EFFECT.' <b>' . $effect . '</b>';
|
||||
echo '</div></td><td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="dist">'.$database->getDistance($coor['x'], $coor['y'], $coor2['x'], $coor2['y']).'</td>';
|
||||
echo '</tr>';
|
||||
|
||||
foreach($rows as $distance => $row) {
|
||||
echo '<tr>
|
||||
<td class="icon"><img class="artefact_icon_'.$row['type'].'" src="img/x.gif" alt="" title=""></td>
|
||||
<td class="nam">
|
||||
<a href="build.php?id='.$id.'&show='.$row['id'].'">'.$row['name'].'</a> <span class="bon">'.$row['effect'].'</span>
|
||||
<div class="info">';
|
||||
|
||||
$artifactInfo = Artifacts::getArtifactInfo($row);
|
||||
|
||||
echo '<div class="info">'.TREASURY.' <b>'.$artifactInfo['requiredLevel'] . '</b>, '.EFFECT.' <b>'.$artifactInfo['effectInfluence'].'</b>
|
||||
</div></td><td class="pla">
|
||||
<a href="karte.php?d='.$row['vref'].'&c='.$generator->getMapCheck($row['vref']).'">'.$database->getUserField($row['owner'], "username", 0).'</a>
|
||||
</td>
|
||||
<td class="dist">'.$distance.'</td>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+20
-154
@@ -30,161 +30,27 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
//TODO: Merge this in a unique foreach
|
||||
$count = mysqli_fetch_array(mysqli_query($database->dblink,"SELECT Count(*) as Total FROM " . TB_PREFIX . "artefacts WHERE del = 0"), MYSQLI_ASSOC);
|
||||
$count = $count['Total'];
|
||||
if($count == 0) echo '<td colspan="4" class="none">'.NO_ARTIFACTS.'</td>';
|
||||
else
|
||||
{
|
||||
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 1 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>10</b>, '.EFFECT.' <b>'.VILLAGE.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
<tr><td colspan="4"></td></tr>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 2 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>10</b>, '.EFFECT.' <b>'.VILLAGE.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
<tr><td colspan="4"></td></tr>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 3 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>10</b>, '.EFFECT.' <b>'.VILLAGE.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
<tr><td colspan="4"></td></tr>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 4 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>10</b>, '.EFFECT.' <b>'.VILLAGE.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
<tr><td colspan="4"></td></tr>
|
||||
|
||||
<?php
|
||||
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 5 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>10</b>, '.EFFECT.' <b>'.VILLAGE.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
<tr><td colspan="4"></td></tr>
|
||||
|
||||
<?php
|
||||
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 6 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>10</b>, '.EFFECT.' <b>'.VILLAGE.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
<tr><td colspan="4"></td></tr>
|
||||
|
||||
<?php
|
||||
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 7 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>10</b>, '.EFFECT.' <b>'.VILLAGE.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
<tr><td colspan="4"></td></tr>
|
||||
|
||||
<?php
|
||||
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 8 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>10</b>, '.EFFECT.' <b>'.VILLAGE.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
<tr><td colspan="4"></td></tr>
|
||||
<?php
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE type = 11 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>10</b>, '.EFFECT.' <b>'.VILLAGE.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
$artifactsArray = $database->getArtifactsBysize(1);
|
||||
if(count($artifactsArray) == 0) {
|
||||
echo '<td colspan="4" class="none">'.NO_ARTIFACTS.'</td>';
|
||||
} else {
|
||||
$previous = "";
|
||||
foreach($artifactsArray as $artifact){
|
||||
|
||||
if($previous != "" && $previous != $artifact['type']) echo '<tr><td colspan="4"></td></tr>';
|
||||
$previous = $artifact['type'];
|
||||
|
||||
echo '<tr>
|
||||
<td class="icon"><img class="artefact_icon_'.$artifact['type'].'" src="img/x.gif" alt="" title=""></td>
|
||||
<td class="nam">
|
||||
<a href="build.php?id='.$id.'&show='.$artifact['id'].'">'.$artifact['name'] . '</a> <span class="bon">'.$artifact['effect'].'</span><div class="info">'.TREASURY.' <b>10</b>, '.EFFECT.' <b>'.ACCOUNT.'</b></div>
|
||||
</td>
|
||||
<td class="pla"><a href="karte.php?d='.$artifact['vref'].'&c='.$generator->getMapCheck($artifact['vref']).'">'.$database->getUserField($artifact['owner'], "username", 0).'</a></td>
|
||||
<td class="al"><a href="allianz.php?aid='.$database->getUserField($artifact['owner'], "alliance", 0).'">'.$database->getAllianceName($database->getUserField($artifact['owner'], "alliance", 0)).'</a></td>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</tbody></table>
|
||||
|
||||
+20
-253
@@ -31,260 +31,27 @@
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
$count = mysqli_fetch_array(mysqli_query($database->dblink,"SELECT Count(*) as Total FROM " . TB_PREFIX . "artefacts WHERE del = 0"), MYSQLI_ASSOC);
|
||||
$count = $count['Total'];
|
||||
if($count == 0) {
|
||||
echo '<td colspan="4" class="none">'.NO_ARTIFACTS.'</td>';
|
||||
} else {
|
||||
//TODO: Merge this in a unique foreach
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 1 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>20</b>, '.EFFECT.' <b>'.ACCOUNT.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 1 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>20</b>, '.EFFECT.' <b>'.ACCOUNT.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
$artifactsArray = $database->getArtifactsBysize([2, 3]);
|
||||
if(count($artifactsArray) == 0) {
|
||||
echo '<td colspan="4" class="none">'.NO_ARTIFACTS.'</td>';
|
||||
} else {
|
||||
$previous = "";
|
||||
foreach($artifactsArray as $artifact){
|
||||
|
||||
if($previous != "" && $previous != $artifact['type']) echo '<tr><td colspan="4"></td></tr>';
|
||||
$previous = $artifact['type'];
|
||||
|
||||
echo '<tr>
|
||||
<td class="icon"><img class="artefact_icon_'.$artifact['type'].'" src="img/x.gif" alt="" title=""></td>
|
||||
<td class="nam">
|
||||
<a href="build.php?id='.$id.'&show='.$artifact['id'].'">'.$artifact['name'] . '</a> <span class="bon">'.$artifact['effect'].'</span><div class="info">'.TREASURY.' <b>20</b>, '.EFFECT.' <b>'.ACCOUNT.'</b></div>
|
||||
</td>
|
||||
<td class="pla"><a href="karte.php?d='.$artifact['vref'].'&c='.$generator->getMapCheck($artifact['vref']).'">'.$database->getUserField($artifact['owner'], "username", 0).'</a></td>
|
||||
<td class="al"><a href="allianz.php?aid='.$database->getUserField($artifact['owner'], "alliance", 0).'">'.$database->getAllianceName($database->getUserField($artifact['owner'], "alliance", 0)).'</a></td>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr><td colspan="4"></td></tr>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 2 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>20</b>, '.EFFECT.' <b>'.ACCOUNT.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 2 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>20</b>, '.EFFECT.' <b>'.ACCOUNT.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
<tr><td colspan="4"></td></tr>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 3 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>20</b>, '.EFFECT.' <b>'.ACCOUNT.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 3 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>20</b>, '.EFFECT.' <b>'.ACCOUNT.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
<tr><td colspan="4"></td></tr>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 4 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>20</b>, '.EFFECT.' <b>'.ACCOUNT.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 4 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>20</b>, '.EFFECT.' <b>'.ACCOUNT.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
<tr><td colspan="4"></td></tr>
|
||||
|
||||
<?php
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 5 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>20</b>, '.EFFECT.' <b>'.ACCOUNT.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 5 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>20</b>, '.EFFECT.' <b>'.ACCOUNT.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
<tr><td colspan="4"></td></tr>
|
||||
|
||||
<?php
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 6 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>20</b>, '.EFFECT.' <b>'.ACCOUNT.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 6 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>20</b>, '.EFFECT.' <b>'.ACCOUNT.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
<tr><td colspan="4"></td></tr>
|
||||
|
||||
<?php
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 7 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>20</b>, '.EFFECT.' <b>'.ACCOUNT.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 7 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>20</b>, '.EFFECT.' <b>'.ACCOUNT.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
<tr><td colspan="4"></td></tr>
|
||||
|
||||
<?php
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 8 AND del = 0");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>20</b>, '.EFFECT.' <b>'.ACCOUNT.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</tbody></table>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -29,7 +29,11 @@ $artifactInfo = Artifacts::getArtifactInfo($artifact);
|
||||
<tr>
|
||||
<th><?php echo OWNER; ?></th>
|
||||
<td>
|
||||
<a href="spieler.php?uid=<?php echo $artifact['owner'];?>"><?php echo $database->getUserField($artifact['owner'], "username", 0);?></a>
|
||||
<?php if(($artifactOwnerUsername = $database->getUserField($artifact['owner'], "username", 0)) != "[?]"){?>
|
||||
<a href="spieler.php?uid=<?php echo $artifact['owner'];?>"><?php echo $artifactOwnerUsername; ?></a>
|
||||
<?php }else{?>
|
||||
<font color="grey"><span>[?]</span></font>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -38,7 +42,7 @@ $artifactInfo = Artifacts::getArtifactInfo($artifact);
|
||||
<?php if($database->checkVilExist($artifact['vref'])){?>
|
||||
<a href="karte.php?d=<?php echo $artifact['vref'];?>&c=<?php echo $generator->getMapCheck($artifact['vref']);?>"><?php echo $database->getVillageField($artifact['vref'], "name");?> </a>
|
||||
<?php }else{?>
|
||||
<span>[?]</span>
|
||||
<font color="grey"><span>[?]</span></font>
|
||||
<?php }?>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -103,7 +107,13 @@ if(!empty($owners)){
|
||||
foreach($owners as $owner){
|
||||
?>
|
||||
<tr>
|
||||
<td><span class="none"><a href="spieler.php?uid=<?php echo $owner['uid'];?>"><?php echo $database->getUserField($owner['uid'], "username", 0);?></a></span></td>
|
||||
<td>
|
||||
<?php if(($artifactChronoOwnerUsername = $database->getUserField($owner['uid'], "username", 0)) != "[?]"){?>
|
||||
<span class="none"><a href="spieler.php?uid=<?php echo $owner['uid'];?>"><?php echo $artifactChronoOwnerUsername;?></a></span>
|
||||
<?php }else{?>
|
||||
<span class="none">[?]</span>
|
||||
<?php }?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if($database->checkVilExist($owner['vref'])){?>
|
||||
<span class="none"><a href="karte.php?d=<?php echo $owner['vref'];?>&c=<?php echo $generator->getMapCheck($owner['vref']);?>"><?php echo $database->getVillageField($owner['vref'], "name");?></a></span>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
$normalA = $database->getOwnArtefactInfoByType($village->wid,6);
|
||||
$largeA = $database->getOwnUniqueArtefactInfo($session->uid,6,2);
|
||||
$artifactsSum = $database->getArtifactsSumByKind($session->uid, $village->wid, 6);
|
||||
$GreatGranaryWarehouseBuildable = $artifactsSum['small'] > 0 || $artifactsSum['large'] > 0;
|
||||
|
||||
$mainbuilding = $building->getTypeLevel(15);
|
||||
$cranny = $building->getTypeLevel(23);
|
||||
@@ -130,10 +130,10 @@ if($wall == 0 && $wall1 == 0) {
|
||||
if((($warehouse == 0 && $warehouse1 == 0) || $warehouse == 20) && $mainbuilding >= 1 && $id != 39 && $id != 40) {
|
||||
include("avaliable/warehouse.tpl");
|
||||
}
|
||||
if((($greatwarehouse == 0 && $greatwarehouse1 == 0) || $greatwarehouse == 20) && $mainbuilding >= 10 && ($largeA['owner'] == $session->uid || $normalA['vref'] == $village->wid || $village->natar==1) && ($id != 39 && $id != 40)) {
|
||||
if((($greatwarehouse == 0 && $greatwarehouse1 == 0) || $greatwarehouse == 20) && $mainbuilding >= 10 && ($GreatGranaryWarehouseBuildable || $village->natar == 1) && ($id != 39 && $id != 40)) {
|
||||
include("avaliable/greatwarehouse.tpl");
|
||||
}
|
||||
if((($greatgranary == 0 && $greatgranary1 == 0) || $greatgranary == 20) && $mainbuilding >= 10 && ($largeA['owner'] == $session->uid || $normalA['vref'] == $village->wid || $village->natar==1) && ($id != 39 && $id != 40)) {
|
||||
if((($greatgranary == 0 && $greatgranary1 == 0) || $greatgranary == 20) && $mainbuilding >= 10 && ($GreatGranaryWarehouseBuildable || $village->natar == 1) && ($id != 39 && $id != 40)) {
|
||||
include("avaliable/greatgranary.tpl");
|
||||
}
|
||||
if((($trapper == 0 && $trapper1 == 0) || $trapper == 20) && $rallypoint >= 1 && $session->tribe == 3 && $id != 39 && $id != 40) {
|
||||
@@ -232,10 +232,10 @@ if($id != 39 && $id != 40) {
|
||||
if($rallypoint == 0 && $session->tribe == 3 && $trapper == 0 ) {
|
||||
include("soon/trapper.tpl");
|
||||
}
|
||||
if($mainbuilding < 10 && $warehouse < 10 && $village->capital == 0 && $largeA['owner'] == $session->uid || $normalA['vref'] == $village->wid ) {
|
||||
if($mainbuilding < 10 && $warehouse < 10 && $village->capital == 0 && $GreatGranaryWarehouseBuildable) {
|
||||
include("soon/greatwarehouse.tpl");
|
||||
}
|
||||
if($mainbuilding < 10 && $granary < 10 && $village->capital == 0 && $largeA['owner'] == $session->uid || $normalA['vref'] == $village->wid ) {
|
||||
if($mainbuilding < 10 && $granary < 10 && $village->capital == 0 && $GreatGranaryWarehouseBuildable) {
|
||||
include("soon/greatgranary.tpl");
|
||||
}
|
||||
if($hero == 0 && ($mainbuilding <= 2 || $rallypoint == 0)){
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 77 B |
Reference in New Issue
Block a user