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
+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");