Skip to content

Commit

Permalink
General fixes
Browse files Browse the repository at this point in the history
+Fixed a bug that didn't delete artifacts when a player deleted his
account
+Added "(artifact)" if a village has an artifact in the village overview
+Added the artifact section in the multihunter panel (return to natars
doesn't work yet)

NOTE: To play this version of the game, you have to run this query first
(where "s1_" is the prefix of your server):

ALTER TABLE `s1_artefacts` ADD `del` TINYINT(1) NULL DEFAULT '0' AFTER
`lastupdate`;
ALTER TABLE `testtravian`.`s1_artefacts` ADD INDEX
`active-owner-conquered-del` (`active`, `owner`, `conquered`, `del`);
  • Loading branch information
iopietro committed Jun 21, 2018
1 parent 8861a57 commit c574a71
Show file tree
Hide file tree
Showing 13 changed files with 583 additions and 416 deletions.
53 changes: 53 additions & 0 deletions Admin/Templates/artifact.tpl
@@ -0,0 +1,53 @@
<?php
include_once("../GameEngine/Artifacts.php");

$artifact = reset($database->getOwnArtefactInfo($_GET['did']));
$artifactOfTheFool = !empty($artifact) && $artifact['type'] == 8;
$artifactInfo = Artifacts::getArtifactInfo($artifact);
?>
<table id="member">
<thead>
<tr>
<th colspan="8">Artifact</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">Time of activation</td>
<?php if($artifactOfTheFool){?>
<td colspan="1">Next activation</td>
<?php } ?>
</tr>
</thead>
<tbody>
<?php
if(empty($artifact)){
?>
<tr>
<td colspan="8"><div style="text-align: center"><?php echo NO_ARTIFACTS; ?></div></td>
</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 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 echo $artifactInfo['active']; ?></div></td>
<?php if($artifactOfTheFool){?>
<td colspan="1"><div style="text-align: center"><?php echo $artifactInfo['nextEffect']; ?></div></td>
<?php } ?>
</tr>
<?php } ?>
</tbody>
</table>
<?php

if($village['owner'] != 3) echo '<a href="admin.php?p=returnArtifact&artid='.$artifact['id'].'">Return to Natars</a>';
?>

45 changes: 13 additions & 32 deletions Admin/Templates/troopUpgrades.tpl
@@ -1,6 +1,3 @@
<?php
if($_SESSION['access'] < MULTIHUNTER) die("Access Denied: You are not Admin!");
?>
<table id="member">
<thead>
<tr>
Expand All @@ -15,50 +12,34 @@ if($_SESSION['access'] < MULTIHUNTER) die("Access Denied: You are not Admin!");
<tr>
<?php
$tribe = $user['tribe'];
if($tribe ==1){ $img = ""; }
if($tribe ==2){ $img = "1";}
if($tribe ==3){ $img = "2";}
if($tribe ==4){ $img = "3";}
if($tribe ==5){ $img = "4";}
if($tribe ==6){ $img = "5";}
$img = $tribe == 1 ? "" : $tribe - 1;

for($i=1; $i<9; $i++)
{
echo '<td><center><img src="../img/un/u/'.$img.''.$i.'.gif"></center></td>';
}
for($i=1; $i<9; $i++)
{
echo '<td><center><img src="../img/un/u/'.$img.''.$i.'.gif"></center></td>';
}
for($i = 1; $i < 9; $i++) echo '<td><center><img src="../img/un/u/'.$img.''.$i.'.gif"></center></td>';
for($i = 1; $i < 9; $i++) echo '<td><center><img src="../img/un/u/'.$img.''.$i.'.gif"></center></td>';
?>
</tr>
</tbody>
<tfoot>
<tr>
<?php
##A
for($i=1; $i<9; $i++)
{
//Armoury
for($i = 1; $i < 9; $i++){
if($tribe==5) { $abtech['a'.$i]="<font color=\"grey\">?</font>"; $abtech['b'.$i]="<font color=\"grey\">?</font>";}
echo '<td><center>'.$abtech['a'.$i].'</center></td>';
} ##B
for($i=1; $i<9; $i++)
{
echo '<td><center>'.$abtech['b'.$i].'</center></td>';
}

//Blacksmith
for($i = 1; $i < 9; $i++) echo '<td><center>'.$abtech['b'.$i].'</center></td>';
?>
</tr>
</tfoot>
</table>
<?php
if($_SESSION['access'] == ADMIN)
{
if($tribe==5) { echo '<span class="none">Upgrades Troops</span>';}
else { echo '<a href="admin.php?p=addABTroops&did='.$_GET['did'].'">Upgrades Troops</a><a href="admin.php?p=techlog&did='.$_GET['did'].'" style="float: right">Research Log</a>';}
}
if(isset($_GET['ab'])){
echo '<div align="right"><font color="Red"><b>AB Tech Troops upgrades</font></b></div>';
}

if($tribe == 5) echo '<span class="none">Upgrades Troops</span>';
else echo '<a href="admin.php?p=addABTroops&did='.$_GET['did'].'">Upgrades Troops</a><a href="admin.php?p=techlog&did='.$_GET['did'].'" style="float: right">Research Log</a>';

if(isset($_GET['ab'])) echo '<div align="right"><font color="Red"><b>AB Tech Troops upgrades</font></b></div>';
?>


49 changes: 23 additions & 26 deletions Admin/Templates/village.tpl
Expand Up @@ -10,7 +10,7 @@
## Copyright: TravianZ (c) 2010-2014. All rights reserved. ##
## Improved: aggenkeech ##
#################################################################################
if($_SESSION['access'] < 8) die("Access Denied: You are not Admin!");
include_once("../GameEngine/Generator.php");

$id = $_GET['did'];
if(isset($id)){
Expand All @@ -21,26 +21,29 @@ if(isset($id)){
$fdata = $database->getResourceLevel($village['wref']);
$units = $database->getUnit($village['wref']);
$abtech = $database->getABTech($id); // Armory/blacksmith level
if($type == 1){ $typ = array(3,3,3,9); }
elseif($type == 2){ $typ = array(3,4,5,6); }
elseif($type == 3){ $typ = array(4,4,4,6); }
elseif($type == 4){ $typ = array(4,5,3,6); }
elseif($type == 5){ $typ = array(5,3,4,6); }
elseif($type == 6){ $typ = array(1,1,1,15); }
elseif($type == 7){ $typ = array(4,4,3,7); }
elseif($type == 8){ $typ = array(3,4,4,7); }
elseif($type == 9){ $typ = array(4,3,4,7); }
elseif($type == 10){ $typ = array(3,5,4,6); }
elseif($type == 11){ $typ = array(4,5,3,6); }
elseif($type == 12){ $typ = array(5,4,3,6); }
switch($type){
case 1: $typ = [3, 3, 3, 9]; break;
case 2: $typ = [3, 4, 5, 6]; break;
case 3: $typ = [4, 4, 4, 6]; break;
case 4: $typ = [4, 5, 3, 6]; break;
case 5: $typ = [5, 3, 4, 6]; break;
case 6: $typ = [1, 1, 1, 15]; break;
case 7: $typ = [4, 4, 3, 7]; break;
case 8: $typ = [3, 4, 4, 7]; break;
case 9: $typ = [4, 3, 4, 7]; break;
case 10: $typ = [3, 5, 4, 6]; break;
case 11: $typ = [4, 5, 3, 6]; break;
case 12: $typ = [5, 4, 3, 6]; break;
}

$ocounter = [];
$wood = $clay = $iron =$crop = 0;
$q = "SELECT o.*, w.x, w.y FROM ".TB_PREFIX."odata AS o LEFT JOIN ".TB_PREFIX."wdata AS w ON o.wref=w.id WHERE conqured = ".(int) $village['wref'];
$result = $database->query_return($q);
if(!empty($result) > 0){
if(!empty($result)){
$newResult = [];
foreach($result as $row)
{
foreach($result as $row){
$type = $row['type'];
if ( $type == 1 ) {
$row['type'] = '<img src="../img/admin/r/1.gif"> + 25%';
Expand Down Expand Up @@ -91,15 +94,6 @@ if(isset($id)){
$refreshiconfrm = "../img/admin/refresh.png";
$refreshicon = "<img src=\"".$refreshiconfrm."\">";

class MyGenerator
{
public function getMapCheck($wref)
{
return substr(md5($wref), 5, 2);
}
};
$generator = new MyGenerator;

if($village && $user){
include("search2.tpl"); ?>
<style>
Expand Down Expand Up @@ -280,7 +274,10 @@ if(isset($id)){
include('troopUpgrades.tpl');
?>


<?php
include('artifact.tpl');
?>

<a href="admin.php?p=editVillage&did=<?php echo $_GET['did']; ?>" title="Edit Village">
<div id="content" class="village1" style="min-height: 264px;">
<div id="village_map" class="f<?php echo $database->getVillageType($village['wref']); ?>" style="float: left;">
Expand Down

0 comments on commit c574a71

Please sign in to comment.