feat: combat simulator link for non-empty oasis

This commit is contained in:
Martin Ambrus
2017-10-21 23:35:43 +02:00
parent a7cd9c8a0c
commit 09f44c9846
4 changed files with 53 additions and 10 deletions
+4
View File
@@ -51,6 +51,10 @@ class Form {
return "";
}
}
public function setValue($field, $value) {
$this->valuearray[$field] = $value;
}
public function getDiff($field,$cookie) {
if(array_key_exists($field,$this->valuearray) && $this->valuearray[$field] != $cookie) {
+31 -8
View File
@@ -5,6 +5,7 @@ $uinfo = $database->getVillage($basearray['id']);
$oasis1 = mysqli_query($GLOBALS['link'],'SELECT * FROM `' . TB_PREFIX . 'odata` WHERE `wref` = ' . mysqli_real_escape_string($GLOBALS['link'],$_GET['d']));
$oasis = mysqli_fetch_assoc($oasis1);
$access=$session->access;
$oasislink = '';
?>
<h1><?php if($basearray['fieldtype']!=0){
echo !$basearray['occupied']? ABANDVALLEY : $basearray['name']; echo " (".$basearray['x']."|".$basearray['y'].")";
@@ -128,6 +129,13 @@ if($oasis['owner'] == 2){
$a = 0;
for ($i = 31; $i <= 40; $i++) {
if($unit['u'.$i]){
// assemble oasis warsim link
if ($basearray['fieldtype'] == 0) {
if (!$oasislink) {
$oasislink = rtrim(HOMEPAGE, '/').'/warsim.php?target=4';
}
$oasislink .= '&amp;u'.$i.'='.$unit['u'.$i];
}
echo '<tr>';
echo '<td class="ico"><img class="unit u'.$i.'" src="img/x.gif" alt="'.$unarray[$i].'" title="'.$unarray[$i].'" /></td>';
echo '<td class="val">'.$unit['u'.$i].'</td>';
@@ -469,14 +477,29 @@ if($type==18 or $type==19 or $type==20 or $type==21){
$test = "&raquo; ".FNEWVILLAGE." (".$village->unitarray['u'.$session->tribe.'0']."/3 ".SETTLERSAVAIL.")";
}
echo ($basearray['fieldtype']==0)?
($village->resarray['f39']==0)?
($basearray['owner'] == $session->uid)?
"<a href=\"build.php?id=39\">&raquo; ".RAID." $otext ".OASIS." (".BUILDRALLY.")</a>" :
"&raquo; ".RAID." $otext ".OASIS." (".BUILDRALLY.")" :
"<a href=\"a2b.php?z=".$_GET['d']."&o\">&raquo; ".RAID." $otext</a>" :
"$test"
if ($basearray['fieldtype']==0) {
if ($village->resarray['f39']==0) {
if ($basearray['owner'] == $session->uid) {
echo "<a href=\"build.php?id=39\">&raquo; ".RAID." $otext ".OASIS." (".BUILDRALLY.")</a>";
} else {
echo "&raquo; ".RAID." $otext ".OASIS." (".BUILDRALLY.")";
}
} else {
echo "<a href=\"a2b.php?z=".$_GET['d']."&o\">&raquo; ".RAID." $otext</a>";
}
if ($oasislink) {
?>
</tr>
<tr>
<td>
<a href="<?php echo $oasislink; ?>">&raquo; Combat Simulator</a>
</td>
<?php
}
} else {
echo "$test";
}
?>
</tr>
<?php }
-1
View File
@@ -1,4 +1,3 @@
- add combat Simulator link to options for a village/oasis (Centre map, Raid, Send Troops...)
- don't show Support & Taskmaster in stats
- add Support login possibility into Admin (ask for password during installation, create Support messages section)
- allow sending Mass Message + System Message from Admin
+18 -1
View File
@@ -101,7 +101,24 @@ if(isset($_POST['result'])) {
}
}
}
$target = isset($_POST['target'])? $_POST['target'] : array();
if (!empty($_GET['target'])) {
// this only works for Nature, as GET links like this one will come from an oasis
if (!$_GET['target'] != 4) {
$_GET['target'] = 4;
}
// fill-in session value-array data
foreach ($_GET as $key => $value) {
if ($key[0] === 'u' && is_numeric($value)) {
$form->setValue('a2_' . substr($key, 1), $value);
}
}
}
$target = isset($_POST['target'])? $_POST['target'] : (!empty($_GET['target']) ? array((int) $_GET['target']) : array());
$tribe = isset($_POST['mytribe'])? $_POST['mytribe'] : $session->tribe;
if(count($target) > 0) {
include("Templates/Simulator/att_".preg_replace("/[^a-zA-Z0-9_-]/","",$tribe).".tpl");