mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-09-05 01:47:16 +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:
+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>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user