Merge branch 'develop' into feature/phpstan

This commit is contained in:
slawkens 2024-02-03 21:13:44 +01:00
commit dbae1ccd04
59 changed files with 620 additions and 555 deletions

View File

@ -1,6 +1,6 @@
# Changelog
## [1.0-beta - 28.01.2024]
## [1.0-beta - 02.02.2024]
Minimum PHP version for this release is 8.1.
@ -57,7 +57,7 @@ Minimum PHP version for this release is 8.1.
* Highscores
* frags works for TFS 1.x
* cached
* creatures
* Monsters
* moved pages to Twig:
* experience stages
* update player_deaths entries on name change

View File

@ -8,7 +8,11 @@ Fernando Matos <fernando@pixele.com.br>
Lee <42119604+Leesneaks@users.noreply.github.com>
caio <caio.zucoli@gmail.com>
slawkens <slawkens@gmail.com>
tobi132 <52947952+tobi132@users.noreply.github.com>
tobi132 <tobi132@gmx.net>
vankk <nwtr.otland@hotmail.com>
whiteblXK <krzys16001@gmail.com>
xitobuh <jonas.hockert92@gmail.com>
Danilo Pucci <dnlps@hotmail.com>
gpedro <gpedro831@gmail.com>
Matheus Collier <matheuscollier@gmail.com>
SRNT-GG <95472530+SRNT-GG@users.noreply.github.com>

View File

@ -27,7 +27,7 @@ if (version_compare(phpversion(), '8.1', '<')) die('PHP version 8.1 or higher is
const MYAAC = true;
const MYAAC_VERSION = '1.0-beta';
const DATABASE_VERSION = 39;
const DATABASE_VERSION = 40;
const TABLE_PREFIX = 'myaac_';
define('START_TIME', microtime(true));
define('MYAAC_OS', stripos(PHP_OS, 'WIN') === 0 ? 'WINDOWS' : (strtoupper(PHP_OS) === 'DARWIN' ? 'MAC' : 'LINUX'));

View File

@ -1,4 +1,4 @@
SET @myaac_database_version = 39;
SET @myaac_database_version = 40;
CREATE TABLE `myaac_account_actions`
(

View File

@ -38,7 +38,7 @@ if [ $1 = "prepare" ]; then
cd $dir || exit
# dependencies
composer install --no-dev --prefer-dist --optimize-autoloader
composer install --prefer-dist --optimize-autoloader
echo "Now you can make changes to $dir. When you are ready, type 'release.sh pack'"
exit

View File

@ -74,4 +74,7 @@ function fieldExist($field, $table)
global $db;
return $db->hasColumn($table, $field);
}
?>
function getCreatureImgPath($creature): string {
return getMonsterImgPath($creature);
}

View File

@ -105,7 +105,7 @@ function getPlayerLink($name, $generate = true): string
function getMonsterLink($name, $generate = true): string
{
$url = BASE_URL . (setting('core.friendly_urls') ? '' : 'index.php/') . 'creatures/' . urlencode($name);
$url = BASE_URL . (setting('core.friendly_urls') ? '' : 'index.php/') . 'monsters/' . urlencode($name);
if(!$generate) return $url;
return generateLink($url, $name);
@ -1559,18 +1559,19 @@ function right($str, $length) {
return substr($str, -$length);
}
function getCreatureImgPath($creature){
$creature_path = setting('core.monsters_images_url');
$creature_gfx_name = trim(strtolower($creature)) . setting('core.monsters_images_extension');
if (!file_exists($creature_path . $creature_gfx_name)) {
$creature_gfx_name = str_replace(" ", "", $creature_gfx_name);
if (file_exists($creature_path . $creature_gfx_name)) {
return $creature_path . $creature_gfx_name;
function getMonsterImgPath($monster): string
{
$monster_path = setting('core.monsters_images_url');
$monster_gfx_name = trim(strtolower($monster)) . setting('core.monsters_images_extension');
if (!file_exists($monster_path . $monster_gfx_name)) {
$monster_gfx_name = str_replace(" ", "", $monster_gfx_name);
if (file_exists($monster_path . $monster_gfx_name)) {
return $monster_path . $monster_gfx_name;
} else {
return $creature_path . 'nophoto.png';
return $monster_path . 'nophoto.png';
}
} else {
return $creature_path . $creature_gfx_name;
return $monster_path . $monster_gfx_name;
}
}

12
system/migrations/40.php Normal file
View File

@ -0,0 +1,12 @@
<?php
// 2024-02-03
// update pages links
use MyAAC\Models\Menu;
Menu::where('link', 'lastkills')->update(['link' => 'last-kills']);
Menu::where('link', 'serverInfo')->update(['link' => 'server-info']);
Menu::where('link', 'experienceStages')->update(['link' => 'exp-stages']);
Menu::where('link', 'experienceTable')->update(['link' => 'exp-table']);
Menu::where('link', 'creatures')->update(['link' => 'monsters']);

View File

@ -106,7 +106,7 @@ else
</form>
</td>
<td align=right>
<form action="?subtopic=accountmanagement" method="post" >
<form action="' . getLink('account/manage') . '" method="post" >
' . csrf(true) . '
' . $twig->render('buttons.back.html.twig') . '
</form>
@ -164,7 +164,7 @@ if(isset($_POST['emailchangecancel']) && $_POST['emailchangecancel'] == 1) {
$account_logged->setCustomField("email_new", "");
$account_logged->setCustomField("email_new_time", 0);
$custom_buttons = '<div style="text-align:center"><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement" method="post" ><tr><td style="border:0px;" >' . $twig->render('buttons.back.html.twig') . '</td></tr></form></table></div>';
$custom_buttons = '<div style="text-align:center"><table border="0" cellspacing="0" cellpadding="0" ><form action="' . getLink('account/manage') . '" method="post" ><tr><td style="border:0px;" >' . $twig->render('buttons.back.html.twig') . '</td></tr></form></table></div>';
$twig->display('success.html.twig', array(
'title' => 'Email Address Change Cancelled',

View File

@ -304,7 +304,7 @@ elseif($action == 'step3')
$account->setCustomField('salt', $salt);
echo 'Your account name, new password and new e-mail.<BR>
<FORM ACTION="?subtopic=accountmanagement" onsubmit="return validate_form(this)" METHOD=post>
<FORM ACTION="' . getLink('account/manage') . '" onsubmit="return validate_form(this)" METHOD=post>
<INPUT TYPE=hidden NAME="character" VALUE="">
<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%>
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Your account name, new password and new e-mail</B></TD></TR>
@ -518,7 +518,7 @@ elseif($action == 'setnewpassword')
</TABLE>
<BR>
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><div style="text-align:center">
<FORM ACTION="?subtopic=accountmanagement" METHOD=post>
<FORM ACTION="' . getLink('account/manage') . '" METHOD=post>
<INPUT TYPE=image NAME="Login" ALT="Login" SRC="'.$template_path.'/images/global/buttons/sbutton_login.gif" BORDER=0 WIDTH=120 HEIGHT=18></div>
</TD></TR></FORM></TABLE></TABLE>';
}

View File

@ -1,86 +1,3 @@
<?php
/**
* Creatures
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @author Lee
* @copyright 2020 MyAAC
* @link https://my-aac.org
*/
use MyAAC\Models\Monster;
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Creatures';
if (empty($_REQUEST['name'])) {
// display list of monsters
$preview = setting('core.monsters_images_preview');
$creatures = Monster::where('hide', '!=', 1)->when(!empty($_REQUEST['boss']), function ($query) {
$query->where('rewardboss', 1);
})->get()->toArray();
if ($preview) {
foreach($creatures as $key => &$creature)
{
$creature['img_link'] = getCreatureImgPath($creature['name']);
}
}
$twig->display('creatures.html.twig', array(
'creatures' => $creatures,
'preview' => $preview
));
return;
}
// display monster
$creature_name = urldecode(stripslashes(ucwords(strtolower($_REQUEST['name']))));
$creature = Monster::where('hide', '!=', 1)->where('name', $creature_name)->first()->toArray();
if (isset($creature['name'])) {
function sort_by_chance($a, $b)
{
if ($a['chance'] == $b['chance']) {
return 0;
}
return ($a['chance'] > $b['chance']) ? -1 : 1;
}
$title = $creature['name'] . " - Creatures";
$creature['img_link']= getCreatureImgPath($creature_name);
$voices = json_decode($creature['voices'], true);
$summons = json_decode($creature['summons'], true);
$elements = json_decode($creature['elements'], true);
$immunities = json_decode($creature['immunities'], true);
$loot = json_decode($creature['loot'], true);
usort($loot, 'sort_by_chance');
foreach ($loot as &$item) {
$item['name'] = getItemNameById($item['id']);
$item['rarity_chance'] = round($item['chance'] / 1000, 2);
$item['rarity'] = getItemRarity($item['chance']);
$item['tooltip'] = ucfirst($item['name']) . '<br/>Chance: ' . $item['rarity'] . (setting('core.monsters_loot_percentage') ? ' ('. $item['rarity_chance'] .'%)' : '') . '<br/>Max count: ' . $item['count'];
}
$creature['loot'] = isset($loot) ? $loot : null;
$creature['voices'] = isset($voices) ? $voices : null;
$creature['summons'] = isset($summons) ? $summons : null;
$creature['elements'] = isset($elements) ? $elements : null;
$creature['immunities'] = isset($immunities) ? $immunities : null;
$twig->display('creature.html.twig', array(
'creature' => $creature,
));
} else {
echo "Creature with name <b>" . $creature_name . "</b> doesn't exist.";
}
// back button
$twig->display('creatures.back_button.html.twig');
require 'monsters.php';

View File

@ -13,90 +13,107 @@ use MyAAC\Forum;
defined('MYAAC') or exit('Direct access not allowed!');
$canEdit = Forum::isModerator();
if($canEdit) {
$groups = new OTS_Groups_List();
if(!$canEdit) {
return;
}
if(!empty($action)) {
if($action == 'delete_board' || $action == 'edit_board' || $action == 'hide_board' || $action == 'moveup_board' || $action == 'movedown_board')
$id = $_REQUEST['id'];
$groupsList = new OTS_Groups_List();
$groups = [
['id' => 0, 'name' => 'Guest'],
];
if(isset($_REQUEST['access'])) {
$access = $_REQUEST['access'];
}
foreach ($groupsList as $group) {
$groups[] = [
'id' => $group->getId(),
'name' => $group->getName()
];
}
if(isset($_REQUEST['guild'])) {
$guild = $_REQUEST['guild'];
}
if(!empty($action)) {
if($action == 'delete_board' || $action == 'edit_board' || $action == 'hide_board' || $action == 'moveup_board' || $action == 'movedown_board')
$id = $_REQUEST['id'];
if(isset($_REQUEST['name'])) {
$name = $_REQUEST['name'];
}
if(isset($_REQUEST['description'])) {
$description = stripslashes($_REQUEST['description']);
}
$errors = [];
if($action == 'add_board') {
if(Forum::add_board($name, $description, $access, $guild, $errors)) {
$action = $name = $description = '';
}
}
else if($action == 'delete_board') {
Forum::delete_board($id, $errors);
$action = '';
}
else if($action == 'edit_board')
{
if(isset($id) && !isset($name)) {
$board = Forum::get_board($id);
$name = $board['name'];
$access = $board['access'];
$guild = $board['guild'];
$description = $board['description'];
}
else {
Forum::update_board($id, $name, $access, $guild, $description);
$action = $name = $description = '';
$access = $guild = 0;
}
}
else if($action == 'hide_board') {
Forum::toggleHide_board($id, $errors);
$action = '';
}
else if($action == 'moveup_board') {
Forum::move_board($id, -1, $errors);
$action = '';
}
else if($action == 'movedown_board') {
Forum::move_board($id, 1, $errors);
$action = '';
}
if(!empty($errors)) {
$twig->display('error_box.html.twig', array('errors' => $errors));
$action = '';
}
if(isset($_REQUEST['access'])) {
$access = $_REQUEST['access'];
}
if(empty($action) || $action == 'edit_board') {
$guilds = $db->query('SELECT `id`, `name` FROM `guilds`')->fetchAll();
$twig->display('forum.add_board.html.twig', array(
'link' => getLink('forum', ($action == 'edit_board' ? 'edit_board' : 'add_board')),
'action' => $action,
'id' => isset($id) ? $id : null,
'name' => isset($name) ? $name : null,
'description' => isset($description) ? $description : null,
'access' => isset($access) ? $access : 0,
'guild' => isset($guild) ? $guild : null,
'groups' => $groups,
'guilds' => $guilds
));
if(isset($_REQUEST['guild'])) {
$guild = $_REQUEST['guild'];
}
if($action == 'edit_board')
$action = '';
if(isset($_REQUEST['name'])) {
$name = $_REQUEST['name'];
}
if(isset($_REQUEST['description'])) {
$description = stripslashes($_REQUEST['description']);
}
$errors = [];
if($action == 'add_board') {
if(Forum::add_board($name, $description, $access, $guild, $errors)) {
$action = $name = $description = '';
header('Location: ' . getLink('forum'));
}
}
else if($action == 'delete_board') {
Forum::delete_board($id, $errors);
header('Location: ' . getLink('forum'));
$action = '';
}
else if($action == 'edit_board')
{
if(isset($id) && !isset($name)) {
$board = Forum::get_board($id);
$name = $board['name'];
$access = $board['access'];
$guild = $board['guild'];
$description = $board['description'];
}
else {
Forum::update_board($id, $name, $access, $guild, $description);
header('Location: ' . getLink('forum'));
$action = $name = $description = '';
$access = $guild = 0;
}
}
else if($action == 'hide_board') {
Forum::toggleHide_board($id, $errors);
header('Location: ' . getLink('forum'));
$action = '';
}
else if($action == 'moveup_board') {
Forum::move_board($id, -1, $errors);
header('Location: ' . getLink('forum'));
$action = '';
}
else if($action == 'movedown_board') {
Forum::move_board($id, 1, $errors);
header('Location: ' . getLink('forum'));
$action = '';
}
if(!empty($errors)) {
$twig->display('error_box.html.twig', array('errors' => $errors));
$action = '';
}
}
if(empty($action) || $action == 'edit_board') {
$guilds = $db->query('SELECT `id`, `name` FROM `guilds`')->fetchAll();
$twig->display('forum.add_board.html.twig', array(
'link' => getLink('forum', ($action == 'edit_board' ? 'edit_board' : 'add_board')),
'action' => $action,
'id' => $id ?? null,
'name' => $name ?? null,
'description' => $description ?? null,
'access' => $access ?? 0,
'guild' => $guild ?? null,
'groups' => $groups,
'guilds' => $guilds
));
if($action == 'edit_board')
$action = '';
}

View File

@ -8,6 +8,9 @@
* @copyright 2021 MyAAC
* @link https://my-aac.org
*/
use MyAAC\Forum;
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Forum';
@ -24,10 +27,7 @@ if(strtolower($forumSetting) != 'site') {
return false;
}
if(!$logged) {
echo 'You are not logged in. <a href="?subtopic=accountmanagement&redirect=' . BASE_URL . urlencode('?subtopic=forum') . '">Log in</a> to post on the forum.<br /><br />';
return false;
}
$canEdit = Forum::isModerator();
$sections = array();
foreach(getForumBoards() as $section) {

View File

@ -18,6 +18,11 @@ if ($ret === false) {
return;
}
if(!$logged) {
echo 'You are not logged in. <a href="' . getLink('account/manage') . '?redirect=' . BASE_URL . urlencode(getLink('forum')) . '">Log in</a> to post on the forum.<br /><br />';
return;
}
if(Forum::canPost($account_logged))
{
$post_id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : false;

View File

@ -18,6 +18,11 @@ if ($ret === false) {
return;
}
if(!$logged) {
echo 'You are not logged in. <a href="' . getLink('account/manage') . '?redirect=' . BASE_URL . urlencode(getLink('forum')) . '">Log in</a> to post on the forum.<br /><br />';
return;
}
if(!Forum::isModerator()) {
echo 'You are not logged in or you are not moderator.';
}

View File

@ -21,10 +21,10 @@ if ($ret === false) {
if(!$logged) {
$extra_url = '';
if(isset($_GET['thread_id'])) {
$extra_url = '&action=new_post&thread_id=' . $_GET['thread_id'];
$extra_url = '?action=new_post&thread_id=' . $_GET['thread_id'];
}
header('Location: ' . BASE_URL . '?subtopic=accountmanagement&redirect=' . BASE_URL . urlencode('?subtopic=forum' . $extra_url));
echo 'You are not logged in. <a href="' . getLink('account/manage') . '?redirect=' . BASE_URL . urlencode(getLink('forum') . $extra_url) . '">Log in</a> to post on the forum.<br /><br />';
return;
}

View File

@ -18,6 +18,16 @@ if ($ret === false) {
return;
}
if(!$logged) {
$extra_url = '';
if(isset($_GET['section_id'])) {
$extra_url = '?action=new_thread&section_id=' . $_GET['section_id'];
}
echo 'You are not logged in. <a href="' . getLink('account/manage') . '?redirect=' . BASE_URL . urlencode(getLink('forum') . $extra_url) . '">Log in</a> to post on the forum.<br /><br />';
return;
}
if(Forum::canPost($account_logged)) {
$players_from_account = $db->query('SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = '.(int) $account_logged->getId())->fetchAll();
$section_id = $_REQUEST['section_id'] ?? null;

View File

@ -18,6 +18,11 @@ if ($ret === false) {
return;
}
if(!$logged) {
echo 'You are not logged in. <a href="' . getLink('account/manage') . '?redirect=' . BASE_URL . urlencode(getLink('forum')) . '">Log in</a> to post on the forum.<br /><br />';
return;
}
if(Forum::isModerator()) {
$id = (int) $_REQUEST['id'];
$post = $db->query("SELECT `id`, `first_post`, `section` FROM `" . FORUM_TABLE_PREFIX . "forum` WHERE `id` = ".$id." LIMIT 1")->fetch();

View File

@ -46,7 +46,7 @@ echo '<a href="' . getLink('forum') . '">Boards</a> >> <b>'.$sections[$section_i
if(!$sections[$section_id]['closed'] || Forum::isModerator()) {
echo '<br /><br />
<a href="?subtopic=forum&action=new_thread&section_id='.$section_id.'"><img src="images/forum/topic.gif" border="0" /></a>';
<a href="' . getLink('forum') . '?action=new_thread&section_id='.$section_id.'"><img src="images/forum/topic.gif" border="0" /></a>';
}
echo '<br /><br />Page: '.$links_to_pages.'<br />';
@ -67,8 +67,8 @@ if(isset($last_threads[0])) {
foreach($last_threads as $thread) {
echo '<tr bgcolor="' . getStyle($number_of_rows++) . '"><td>';
if(Forum::isModerator()) {
echo '<a href="?subtopic=forum&action=move_thread&id='.$thread['id'].'"\')"><span style="color:darkgreen">[MOVE]</span></a>';
echo '<a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove thread > '.$thread['post_topic'].' <?\')"><span style="color: red">[REMOVE]</span></a> ';
echo '<a href="' . getLink('forum') . '?action=move_thread&id='.$thread['id'].'"\')"><span style="color:darkgreen">[MOVE]</span></a>';
echo '<a href="' . getLink('forum') . '?action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove thread > '.$thread['post_topic'].' <?\')"><span style="color: red">[REMOVE]</span></a> ';
}
$player->load($thread['player_id']);
@ -95,7 +95,7 @@ if(isset($last_threads[0])) {
echo '</table>';
if(!$sections[$section_id]['closed'] || Forum::isModerator()) {
echo '<br /><a href="?subtopic=forum&action=new_thread&section_id=' . $section_id . '"><img src="images/forum/topic.gif" border="0" /></a>';
echo '<br /><a href="' . getLink('forum') . '?action=new_thread&section_id=' . $section_id . '"><img src="images/forum/topic.gif" border="0" /></a>';
}
}
else {

View File

@ -49,7 +49,7 @@ if(empty($errors)) {
$new_rank->setLevel(1);
$new_rank->setName($rank_name);
$new_rank->save();
header("Location: ?subtopic=guilds&guild=".$guild->getName()."&action=manager");
header("Location: " . getLink('guilds') . "?guild=".$guild->getName()."&action=manager");
echo 'New rank added. Redirecting...';
}
else {
@ -61,7 +61,7 @@ if(empty($errors)) {
$twig->display('guilds.back_button.html.twig', array(
'new_line' => true,
'action' => '?subtopic=guilds&guild='.$guild_name.'&action=show'
'action' => getLink('guilds') . '?guild='.$guild_name.'&action=show'
));
}
}

View File

@ -69,6 +69,6 @@ if(!empty($errors)) {
$twig->display('guilds.back_button.html.twig', array(
'new_line' => true,
'action' => '?subtopic=guilds'
'action' => getLink('guilds')
));
}

View File

@ -121,7 +121,7 @@ if(!empty($errors)) {
$twig->display('guilds.back_button.html.twig', array(
'new_line' => true,
'action' => '?subtopic=guilds'
'action' => getLink('guilds')
));
}
?>

View File

@ -72,6 +72,6 @@ if(!empty($errors)) {
$twig->display('guilds.back_button.html.twig', array(
'new_line' => true,
'action' => '?subtopic=guilds'
'action' => getLink('guilds')
));
}

View File

@ -45,7 +45,7 @@ if(empty($errors)) {
$twig->display('success.html.twig', array(
'title' => 'Delete Guild',
'description' => 'Are you sure you want delete guild <b>' . $guild_name . '</b>?<br/>
<form action="?subtopic=guilds&guild=' . $guild->getName() . '&action=delete_by_admin" METHOD="post"><input type="hidden" name="todo" value="save"><input type="submit" value="Yes, delete"></form>',
<form action="' . getLink('guilds') . '?guild=' . $guild->getName() . '&action=delete_by_admin" METHOD="post"><input type="hidden" name="todo" value="save"><input type="submit" value="Yes, delete"></form>',
'custom_buttons' => $twig->render('guilds.back_button.html.twig')
));
}
@ -63,6 +63,6 @@ if(!empty($errors)) {
$twig->display('guilds.back_button.html.twig', array(
'new_line' => true,
'action' => '?subtopic=guilds'
'action' => getLink('guilds')
));
}

View File

@ -96,7 +96,7 @@ if(!empty($errors))
{
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('guilds.back_button.html.twig', array('action' => '?subtopic=guilds&action=show&guild=' . $guild_name));
$twig->display('guilds.back_button.html.twig', array('action' => getLink('guilds') . '?action=show&guild=' . $guild_name));
}
else
{
@ -106,7 +106,7 @@ else
$twig->display('success.html.twig', array(
'title' => 'Deleted player invitation',
'description' => 'Player with name <b>' . $player->getName() . '</b> has been deleted from invites list.',
'custom_buttons' => $twig->render('guilds.back_button.html.twig', array('action' => '?subtopic=guilds&action=show&guild=' . $guild_name))
'custom_buttons' => $twig->render('guilds.back_button.html.twig', array('action' => getLink('guilds') . '?action=show&guild=' . $guild_name))
));
}
else {

View File

@ -104,7 +104,7 @@ if(empty($guild_errors)) {
$twig->display('guilds.back_button.html.twig', array(
'new_line' => true,
'action' => '?subtopic=guilds&guild='.$guild->getName().'&action=manager'
'action' => getLink('guilds') . '?guild='.$guild->getName().'&action=manager'
));
}
else
@ -122,6 +122,6 @@ if(!empty($guild_errors)) {
$twig->display('guilds.back_button.html.twig', array(
'new_line' => true,
'action' => '?subtopic=guilds'
'action' => getLink('guilds')
));
}

View File

@ -109,7 +109,7 @@ if(empty($guild_errors) && empty($guild_errors2)) {
if(empty($guild_errors) && !empty($guild_errors2)) {
$twig->display('error_box.html.twig', array('errors' => $guild_errors2));
echo '<br/><div style="text-align:center"><form action="?subtopic=guilds&guild='.$guild->getName().'&action=pass_leadership" method="post">' . $twig->render('buttons.back.html.twig') . '</form></div>';
echo '<br/><div style="text-align:center"><form action="' . getLink('guilds') . '?guild='.$guild->getName().'&action=pass_leadership" method="post">' . $twig->render('buttons.back.html.twig') . '</form></div>';
}
if(!empty($guild_errors)) {
if(!empty($guild_errors2)) {
@ -117,5 +117,5 @@ if(!empty($guild_errors)) {
}
$twig->display('error_box.html.twig', array('errors' => $guild_errors));
echo '<br/><div style="text-align:center"><form action="?subtopic=guilds" method="post">' . $twig->render('buttons.back.html.twig') . '</form></div>';
echo '<br/><div style="text-align:center"><form action="' . getLink('guilds') . '" method="post">' . $twig->render('buttons.back.html.twig') . '</form></div>';
}

View File

@ -63,7 +63,7 @@ if(empty($errors)) {
}
//show errors or redirect
if(empty($errors)) {
header("Location: ?subtopic=guilds&action=manager&guild=".$guild->getName());
header("Location: " . getLink('guilds') . "?action=manager&guild=".$guild->getName());
}
}
else

86
system/pages/monsters.php Normal file
View File

@ -0,0 +1,86 @@
<?php
/**
* Monsters
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @author Lee
* @copyright 2020 MyAAC
* @link https://my-aac.org
*/
use MyAAC\Models\Monster;
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Monsters';
if (empty($_REQUEST['name'])) {
// display list of monsters
$preview = setting('core.monsters_images_preview');
$monsters = Monster::where('hide', '!=', 1)->when(!empty($_REQUEST['boss']), function ($query) {
$query->where('rewardboss', 1);
})->get()->toArray();
if ($preview) {
foreach($monsters as $key => &$monster)
{
$monster['img_link'] = getMonsterImgPath($monster['name']);
}
}
$twig->display('monsters.html.twig', array(
'monsters' => $monsters,
'preview' => $preview
));
return;
}
// display monster
$monster_name = urldecode(stripslashes(ucwords(strtolower($_REQUEST['name']))));
$monster = Monster::where('hide', '!=', 1)->where('name', $monster_name)->first()->toArray();
if (isset($monster['name'])) {
function sort_by_chance($a, $b)
{
if ($a['chance'] == $b['chance']) {
return 0;
}
return ($a['chance'] > $b['chance']) ? -1 : 1;
}
$title = $monster['name'] . " - Monsters";
$monster['img_link']= getMonsterImgPath($monster_name);
$voices = json_decode($monster['voices'], true);
$summons = json_decode($monster['summons'], true);
$elements = json_decode($monster['elements'], true);
$immunities = json_decode($monster['immunities'], true);
$loot = json_decode($monster['loot'], true);
usort($loot, 'sort_by_chance');
foreach ($loot as &$item) {
$item['name'] = getItemNameById($item['id']);
$item['rarity_chance'] = round($item['chance'] / 1000, 2);
$item['rarity'] = getItemRarity($item['chance']);
$item['tooltip'] = ucfirst($item['name']) . '<br/>Chance: ' . $item['rarity'] . (setting('core.monsters_loot_percentage') ? ' ('. $item['rarity_chance'] .'%)' : '') . '<br/>Max count: ' . $item['count'];
}
$monster['loot'] = $loot ?? null;
$monster['voices'] = $voices ?? null;
$monster['summons'] = $summons ?? null;
$monster['elements'] = $elements ?? null;
$monster['immunities'] = $immunities ?? null;
$twig->display('monster.html.twig', array(
'monster' => $monster,
));
} else {
echo "Monster with name <b>" . $monster_name . "</b> doesn't exist.";
}
// back button
$twig->display('monsters.back_button.html.twig');

View File

@ -26,77 +26,77 @@ function getColorByPercent($percent)
}
$number_of_rows = 0;
$showed = false;
$link = "polls"; // your link to polls in index.php
$dark = $config['darkborder'];
$light = $config['lightborder'];
$time = time();
$POLLS = $db->query('SELECT * FROM '.$db->tableName('z_polls').'');
$level = 20; // need level to vote
$link = getLink('polls'); // your link to polls in index.php
$dark = $config['darkborder'];
$light = $config['lightborder'];
$time = time();
$POLLS = $db->query('SELECT * FROM '.$db->tableName('z_polls').'');
$level = 20; // need level to vote
if(empty($_REQUEST['id']) and (!isset($_REQUEST['control']) || $_REQUEST['control'] != "true")) // list of polls
{
$active = $db->query('SELECT * FROM `z_polls` where `end` > '.$time.''); // active polls
$closed = $db->query('SELECT * FROM `z_polls` where `end` < '.$time.' order by `end` desc'); // closed polls
/* Active Polls */
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 class=white><B>Active Polls</B></TD></TR>';
echo '<TR BGCOLOR="' . getStyle($number_of_rows++) . '"><td width=75%><b>Topic</b></td><td><b>End</b></td></tr>';
$bgcolor = getStyle($number_of_rows++);
if(empty($_REQUEST['id']) and (!isset($_REQUEST['control']) || $_REQUEST['control'] != "true")) // list of polls
{
$active = $db->query('SELECT * FROM `z_polls` where `end` > '.$time.''); // active polls
$closed = $db->query('SELECT * FROM `z_polls` where `end` < '.$time.' order by `end` desc'); // closed polls
/* Active Polls */
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 class=white><B>Active Polls</B></TD></TR>';
echo '<TR BGCOLOR="' . getStyle($number_of_rows++) . '"><td width=75%><b>Topic</b></td><td><b>End</b></td></tr>';
$bgcolor = getStyle($number_of_rows++);
$empty_active = false;
foreach($active as $poll)
{
echo '
<tr BGCOLOR="'.$bgcolor.'">
foreach($active as $poll)
{
echo '
<tr BGCOLOR="'.$bgcolor.'">
<td>
<a href="';
if($logged)
echo '?subtopic='.$link.'&id='.$poll['id'];
echo $link.'?id='.$poll['id'];
else
echo '?subtopic=accountmanagement&redirect=' . BASE_URL . urlencode('?subtopic='.$link.'&id='.$poll['id']);
echo getLink('account/manage') . '?redirect=' . BASE_URL . urlencode($link.'?id='.$poll['id']);
echo '">'.$poll['question'] . '</a>
</td>
<td>'.date("M j Y", $poll['end']).'</td>
</tr>';
$empty_active = true;
}
$empty_active = true;
}
if(!$empty_active)
{
echo '<tr BGCOLOR="'.$bgcolor.'"><td colspan=2><div style="text-align:center"><i>There are no active polls.</i></div></td></tr>';
}
if(!$empty_active)
{
echo '<tr BGCOLOR="'.$bgcolor.'"><td colspan=2><div style="text-align:center"><i>There are no active polls.</i></div></td></tr>';
}
echo "</table><br><br>";
/* Closed Polls */
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 class=white><B>Closed Polls</B></TD></TR>';
echo '<TR BGCOLOR="' . getStyle($number_of_rows++) . '"><td width=75%><b>Topic</b></td><td><b>End</b></td></tr>';
echo "</table><br><br>";
/* Closed Polls */
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 class=white><B>Closed Polls</B></TD></TR>';
echo '<TR BGCOLOR="' . getStyle($number_of_rows++) . '"><td width=75%><b>Topic</b></td><td><b>End</b></td></tr>';
$bgcolor = getStyle($number_of_rows++);
$empty_closed = false;
foreach($closed as $poll)
{
echo '
<tr BGCOLOR="'.$bgcolor.'">
foreach($closed as $poll)
{
echo '
<tr BGCOLOR="'.$bgcolor.'">
<td>
<a href="';
if($logged)
echo '?subtopic='.$link.'&id='.$poll['id'];
echo $link.'?id='.$poll['id'];
else
echo '?subtopic=accountmanagement&redirect=' . BASE_URL . urlencode('?subtopic='.$link.'&id='.$poll['id']);
echo getLink('account/manage') . '?redirect=' . BASE_URL . urlencode($link.'?id='.$poll['id']);
echo '">'.$poll['question'] . '</a>
</td>
<td>'.date("M j Y", $poll['end']).'</td>
</tr>';
$empty_closed = true;
}
$empty_closed = true;
}
if(!$empty_closed)
{
echo '<tr BGCOLOR="'.$bgcolor.'"><td colspan=2><div style="text-align:center"><i>There are no closed polls.</i></div></td></tr>';
}
if(!$empty_closed)
{
echo '<tr BGCOLOR="'.$bgcolor.'"><td colspan=2><div style="text-align:center"><i>There are no closed polls.</i></div></td></tr>';
}
echo "</table>";
$showed=true;
}
echo "</table>";
$showed=true;
}
if(!$logged)
{
@ -104,43 +104,43 @@ function getColorByPercent($percent)
return;
}
/* Checking Account */
/* Checking Account */
$allow = false;
$account_players = $account_logged->getPlayers();
foreach($account_players as $player)
{
$player = $player->getLevel();
if($player >= $level)
$allow=true;
}
$account_players = $account_logged->getPlayers();
foreach($account_players as $player)
{
$player = $player->getLevel();
if($player >= $level)
$allow=true;
}
if(!empty($_REQUEST['id']) and (!isset($_REQUEST['control']) || $_REQUEST['control'] != "true"))
{
foreach($POLLS as $POLL)
{
if($_REQUEST['id'] == $POLL['id'])
{
$ANSWERS = $db->query('SELECT * FROM '.$db->tableName('z_polls_answers').' where `poll_id` = '.addslashes(htmlspecialchars(trim($_REQUEST['id']))).' order by `answer_id`');
$votes_all = $POLL['votes_all'];
if(!empty($_REQUEST['id']) and (!isset($_REQUEST['control']) || $_REQUEST['control'] != "true"))
{
foreach($POLLS as $POLL)
{
if($_REQUEST['id'] == $POLL['id'])
{
$ANSWERS = $db->query('SELECT * FROM '.$db->tableName('z_polls_answers').' where `poll_id` = '.addslashes(htmlspecialchars(trim($_REQUEST['id']))).' order by `answer_id`');
$votes_all = $POLL['votes_all'];
if($votes_all == 0)
{
$i=1;
foreach($ANSWERS as $answer)
{
$percent[$i] = 0;
$i++;
}
}
else
{
$i=1;
foreach($ANSWERS as $answer)
{
$percent[$i] = round(((100*$answer['votes'])/$votes_all),2);
$i++;
}
}
if($votes_all == 0)
{
$i=1;
foreach($ANSWERS as $answer)
{
$percent[$i] = 0;
$i++;
}
}
else
{
$i=1;
foreach($ANSWERS as $answer)
{
$percent[$i] = round(((100*$answer['votes'])/$votes_all),2);
$i++;
}
}
?>
<style type="text/css" media="screen">
div.progress-container {
@ -166,51 +166,51 @@ function getColorByPercent($percent)
</div>';
}
if($POLL['end'] > $time) // active poll
{
if(isset($_REQUEST['vote']) && $_REQUEST['vote'] == true and $allow == true)
{
if($account_logged->getCustomField('vote') < $_REQUEST['id'] and !empty($_POST['answer']))
{
if(isset($_POST['continue']))
{
$vote = addslashes(htmlspecialchars(trim($_REQUEST['id'])));
$account_logged->setCustomField("vote", $vote);
$UPDATE_poll = $db->query('UPDATE `z_polls` SET `votes_all` = `votes_all` + 1 where `id` = '.addslashes(htmlspecialchars(trim($_REQUEST['id']))).'');
$UPDATE_answer = $db->query('UPDATE `z_polls_answers` SET `votes` = `votes` + 1 where `answer_id` = '.addslashes(htmlspecialchars($_POST['answer'])).' and`poll_id` = '.addslashes(htmlspecialchars(trim($_REQUEST['id']))).'');
header('Location: ?subtopic='.$link.'&id='.$_REQUEST['id'].'');
}
}
else
{
header('Location: ?subtopic='.$link.'&id='.$_REQUEST['id'].'');
}
}
if($POLL['end'] > $time) // active poll
{
if(isset($_REQUEST['vote']) && $_REQUEST['vote'] == true and $allow == true)
{
if($account_logged->getCustomField('vote') < $_REQUEST['id'] and !empty($_POST['answer']))
{
if(isset($_POST['continue']))
{
$vote = addslashes(htmlspecialchars(trim($_REQUEST['id'])));
$account_logged->setCustomField("vote", $vote);
$UPDATE_poll = $db->query('UPDATE `z_polls` SET `votes_all` = `votes_all` + 1 where `id` = '.addslashes(htmlspecialchars(trim($_REQUEST['id']))).'');
$UPDATE_answer = $db->query('UPDATE `z_polls_answers` SET `votes` = `votes` + 1 where `answer_id` = '.addslashes(htmlspecialchars($_POST['answer'])).' and`poll_id` = '.addslashes(htmlspecialchars(trim($_REQUEST['id']))).'');
header('Location: ' . $link.'?id='.$_REQUEST['id'].'');
}
}
else
{
header('Location: ' . $link.'?id='.$_REQUEST['id'].'');
}
}
if($account_logged->getCustomField('vote') < $_REQUEST['id'] and $allow == true)
{
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 class=white><B>Vote</B></TD></TR>';
echo '<TR BGCOLOR="'.$dark.'"><td COLSPAN=2><b>'.$POLL['question'].'</b><br/>' . $POLL['description'] . '</td></tr>
<form action="?subtopic='.$link.'&id='.$_REQUEST['id'].'&vote=true" method="POST"> ';
$ANSWERS_input = $db->query('SELECT * FROM '.$db->tableName('z_polls_answers').' where `poll_id` = '.$_REQUEST['id'].' order by `answer_id`');
$i=1;
foreach($ANSWERS_input as $answer)
{
if(is_int($i / 2)) {
$bgcolor = $dark;
}
else
{
$bgcolor = $light;
}
echo '<tr BGCOLOR="'.$bgcolor.'"><td><input type=radio name=answer value="'.$i.'">'.$answer['answer'].'</td></tr>';
$i++;
}
echo '</table><input type="submit" name="continue" value="Submit" class="input2" /></form><br><br>';
}
elseif($account_logged->getCustomField('vote') >= $_REQUEST['id'])
{
$result[] = '<br><b>You have already voted.</b><br>';
if($account_logged->getCustomField('vote') < $_REQUEST['id'] and $allow == true)
{
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 class=white><B>Vote</B></TD></TR>';
echo '<TR BGCOLOR="'.$dark.'"><td COLSPAN=2><b>'.$POLL['question'].'</b><br/>' . $POLL['description'] . '</td></tr>
<form action="' . $link . '?id='.$_REQUEST['id'].'&vote=true" method="POST"> ';
$ANSWERS_input = $db->query('SELECT * FROM '.$db->tableName('z_polls_answers').' where `poll_id` = '.$_REQUEST['id'].' order by `answer_id`');
$i=1;
foreach($ANSWERS_input as $answer)
{
if(is_int($i / 2)) {
$bgcolor = $dark;
}
else
{
$bgcolor = $light;
}
echo '<tr BGCOLOR="'.$bgcolor.'"><td><input type=radio name=answer value="'.$i.'">'.$answer['answer'].'</td></tr>';
$i++;
}
echo '</table><input type="submit" name="continue" value="Submit" class="input2" /></form><br><br>';
}
elseif($account_logged->getCustomField('vote') >= $_REQUEST['id'])
{
$result[] = '<br><b>You have already voted.</b><br>';
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=3 class=white><B>Results</B></TD></TR>';
echo '<TR BGCOLOR="'.$dark.'"><td COLSPAN=3><b>'.$POLL['question'].'</b><br/>' . $POLL['description'] . '</td></tr>';
@ -239,31 +239,31 @@ function getColorByPercent($percent)
}
$result[] = '<br>All players with a character of at least level ' . $level . ' may vote.<br>';
foreach($result as $error)
{
echo $error;
}
foreach($result as $error)
{
echo $error;
}
echo '<br>The poll started at '.date("M j Y", $POLL['start']).'<br>';
echo 'The poll will end at '.date("M j Y", $POLL['end']).'<br>';
echo '<br>Total votes <b>'.$POLL['votes_all'].'</b><br>';
echo '<br>The poll started at '.date("M j Y", $POLL['start']).'<br>';
echo 'The poll will end at '.date("M j Y", $POLL['end']).'<br>';
echo '<br>Total votes <b>'.$POLL['votes_all'].'</b><br>';
}
else // closed poll
{
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=3 class=white><B>Results</B></TD></TR>';
echo '<TR BGCOLOR="'.$dark.'"><td COLSPAN=3><b>'.$POLL['question'].'</b></td></tr>';
$ANSWERS_show = $db->query('SELECT * FROM '.$db->tableName('z_polls_answers').' where `poll_id` = '.$_REQUEST['id'].' order by `answer_id`');
$i=1;
foreach($ANSWERS_show as $answer)
{
if(is_int($i / 2)) {
$bgcolor = $dark;
}
else
{
$bgcolor = $light;
}
}
else // closed poll
{
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=3 class=white><B>Results</B></TD></TR>';
echo '<TR BGCOLOR="'.$dark.'"><td COLSPAN=3><b>'.$POLL['question'].'</b></td></tr>';
$ANSWERS_show = $db->query('SELECT * FROM '.$db->tableName('z_polls_answers').' where `poll_id` = '.$_REQUEST['id'].' order by `answer_id`');
$i=1;
foreach($ANSWERS_show as $answer)
{
if(is_int($i / 2)) {
$bgcolor = $dark;
}
else
{
$bgcolor = $light;
}
echo '<TR BGCOLOR="'.$bgcolor.'">
<td width=60%>'.$answer['answer'].'</td>
@ -272,64 +272,64 @@ function getColorByPercent($percent)
</td>
<td>' . $answer['votes'] . '(<span style="color:' . getColorByPercent($percent[$i]) . '"><b>' . $percent[$i] . '%</b></span>)</td>
</tr>';
$i++;
}
echo '</table><br><br>';
$i++;
}
echo '</table><br><br>';
echo '<br>The poll started at '.date("M j Y", $POLL['start']).'<br>';
echo 'The poll ended at '.date("M j Y", $POLL['end']).'<br>';
echo '<br>Total votes <b>'.$POLL['votes_all'].'</b><br>';
echo '<br>The poll started at '.date("M j Y", $POLL['start']).'<br>';
echo 'The poll ended at '.date("M j Y", $POLL['end']).'<br>';
echo '<br>Total votes <b>'.$POLL['votes_all'].'</b><br>';
}
$showed=true;
echo '<div class=\'hr1\'></div><a href="?subtopic='.$link.'"><span style="font-size: 13px"><b>Go to list of polls</b></span></a>';
}
}
}
}
$showed=true;
echo '<div class=\'hr1\'></div><a href="'.$link.'"><span style="font-size: 13px"><b>Go to list of polls</b></span></a>';
}
}
}
if(admin() && (!isset($_REQUEST['control']) || $_REQUEST['control'] != "true"))
{
echo '<br><a href="?subtopic='.$link.'&control=true"><b>Panel Control</b></a><br><br>';
}
if(admin() && (!isset($_REQUEST['control']) || $_REQUEST['control'] != "true"))
{
echo '<br><a href="'.$link.'?control=true"><b>Panel Control</b></a><br><br>';
}
/* Control Panel - Only Add Poll Function */
/* Control Panel - Only Add Poll Function */
if(admin() && isset($_REQUEST['control']) && $_REQUEST['control'] == "true")
{
if(admin() && isset($_REQUEST['control']) && $_REQUEST['control'] == "true")
{
$show = false;
if(isset($_POST['submit']))
{
setSession('answers', $_POST['answers']);
echo '<form method="post" action=""><b><span style="font-size: 16px">Adding Poll</span></b><br><br>
<input type=text name=question value="" /> Question<br>
<input type=text name=description value="" /> Description<br>
<input type=text name=end value="" /> Time to end, in days<br>';
if(isset($_POST['submit']))
{
setSession('answers', $_POST['answers']);
echo '<form method="post" action=""><b><span style="font-size: 16px">Adding Poll</span></b><br><br>
<input type=text name=question value="" /> Question<br>
<input type=text name=description value="" /> Description<br>
<input type=text name=end value="" /> Time to end, in days<br>';
for( $x = 1; $x <= getSession('answers'); $x++ )
{
echo '<input type=text name='.$x.' value="" /> Answer no. '.$x.'<br>';
}
echo '<input type="submit" name="finish" value="Submit" class="input2"/></form><br><br>';
$show=true;
}
for( $x = 1; $x <= getSession('answers'); $x++ )
{
echo '<input type=text name='.$x.' value="" /> Answer no. '.$x.'<br>';
}
echo '<input type="submit" name="finish" value="Submit" class="input2"/></form><br><br>';
$show=true;
}
if(isset($_POST['finish']))
{
$id = $db->query('SELECT MAX(id) FROM `z_polls`')->fetch();
$id_next = $id[0] + 1;
if(isset($_POST['finish']))
{
$id = $db->query('SELECT MAX(id) FROM `z_polls`')->fetch();
$id_next = $id[0] + 1;
for( $x = 1; $x <= getSession('answers'); $x++ )
{
$db->insert('z_polls_answers', array(
'poll_id' => $id_next,
for( $x = 1; $x <= getSession('answers'); $x++ )
{
$db->insert('z_polls_answers', array(
'poll_id' => $id_next,
'answer_id' => $x,
'answer' => $_POST[$x],
'votes' => 0
));
}
$end = $time+24*60*60*$_POST['end'];
$db->insert('z_polls', array(
'id' => $id_next,
}
$end = $time+24*60*60*$_POST['end'];
$db->insert('z_polls', array(
'id' => $id_next,
'question' => $_POST['question'],
'description' => $_POST['description'],
'end' => $end,
@ -337,35 +337,35 @@ function getColorByPercent($percent)
'start' => $time,
'votes_all' => 0
));
}
}
$POLLS_check = $db->query('SELECT MAX(end) FROM '.$db->tableName('z_polls').'');
foreach($POLLS_check as $checked)
{
if($checked[0] > $time)
$check=true;
else
$check=false;
}
if(!$show)
{
if(!$check)
{
echo '<form method="post" action=""><b><span style="font-size: 16px">Adding Poll</span></b><br><br>
<input type=text name=answers value="" /> Number of Answers<br>
<input type="submit" name="submit" value="Submit" class="input2"/></form><br><br>';
}
else
{
echo '<b><span style="font-size: 16px"><br>Cannot be two and more active polls.<br><br></span></b>';
}
}
$showed=true;
echo '<br><div class=\'hr1\'></div><a href="?subtopic='.$link.'"><span style="font-size: 13px"><b>Go to list of polls</b></span></a>';
}
$POLLS_check = $db->query('SELECT MAX(end) FROM '.$db->tableName('z_polls').'');
foreach($POLLS_check as $checked)
{
if($checked[0] > $time)
$check=true;
else
$check=false;
}
if(!$show)
{
if(!$check)
{
echo '<form method="post" action=""><b><span style="font-size: 16px">Adding Poll</span></b><br><br>
<input type=text name=answers value="" /> Number of Answers<br>
<input type="submit" name="submit" value="Submit" class="input2"/></form><br><br>';
}
else
{
echo '<b><span style="font-size: 16px"><br>Cannot be two and more active polls.<br><br></span></b>';
}
}
$showed=true;
echo '<br><div class=\'hr1\'></div><a href="'.$link.'"><span style="font-size: 13px"><b>Go to list of polls</b></span></a>';
}
if(!$showed)
{
echo 'This poll doesn\'t exist.<br>';
echo '<div class=\'hr1\'></div><a href="?subtopic='.$link.'"><span style="font-size: 13px"><b>Go to list of polls</b></span></a>';
}
if(!$showed)
{
echo 'This poll doesn\'t exist.<br>';
echo '<div class=\'hr1\'></div><a href="'.$link.'"><span style="font-size: 13px"><b>Go to list of polls</b></span></a>';
}

View File

@ -33,7 +33,7 @@ return [
['GET', 'bans/{page:int}[/]', 'bans.php'],
[['GET', 'POST'], 'characters[/{name:string}]', 'characters.php'],
['GET', 'changelog[/{page:int}]', 'changelog.php'],
[['GET', 'POST'], 'creatures[/{name:string}]', 'creatures.php'],
[['GET', 'POST'], 'monsters[/{name:string}]', 'monsters.php'],
[['GET', 'POST'], 'faq[/{action:string}]', 'faq.php'],

View File

@ -46,16 +46,16 @@ class DataLoader
self::$startTime = microtime(true);
if(Creatures::loadFromXML()) {
if(Monsters::loadFromXML()) {
success(self::$locale['step_database_loaded_monsters'] . self::getLoadedTime());
if(Creatures::getMonstersList()->hasErrors()) {
if(Monsters::getMonstersList()->hasErrors()) {
self::$locale['step_database_error_monsters'] = str_replace('$LOG$', 'system/logs/error.log', self::$locale['step_database_error_monsters']);
warning(self::$locale['step_database_error_monsters']);
}
}
else {
error(Creatures::getLastError());
error(Monsters::getLastError());
}
self::$startTime = microtime(true);

View File

@ -13,7 +13,7 @@ namespace MyAAC;
use MyAAC\Models\Monster;
class Creatures {
class Monsters {
/**
* @var \OTS_MonstersList
*/

View File

@ -114,7 +114,7 @@ $template['link_account_logout'] = getLink('account/logout');
$template['link_news_archive'] = getLink('news/archive');
$links = array('news', 'changelog', 'rules', 'downloads', 'characters', 'online', 'highscores', 'powergamers', 'lastkills' => 'last-kills', 'houses', 'guilds', 'wars', 'polls', 'bans', 'team', 'creatures', 'spells', 'commands', 'exp-stages', 'freeHouses', 'serverInfo', 'exp-table', 'faq', 'points', 'gifts', 'bugtracker', 'gallery');
$links = array('news', 'changelog', 'rules', 'downloads', 'characters', 'online', 'highscores', 'powergamers', 'lastkills' => 'last-kills', 'houses', 'guilds', 'wars', 'polls', 'bans', 'team', 'creatures' => 'monsters', 'monsters', 'spells', 'commands', 'exp-stages', 'freeHouses', 'serverInfo', 'exp-table', 'faq', 'points', 'gifts', 'bugtracker', 'gallery');
foreach($links as $key => $value) {
$key = is_string($key) ? $key : $value;
$template['link_' . $key] = getLink($value);

View File

@ -29,7 +29,7 @@ Please enter your account {{ account|lower }} and your password.<br/><a href="{{
<td class="LabelV" >
<span{% if error is not null %} class="red"{% endif %}>{{ account_login_by }}:</span>
</td>
<td style="width:100%;" ><input type="text" name="account_login" size="30" maxlength="30" autofocus/></td>
<td style="width:100%;" ><input type="text" name="account_login" size="30" maxlength="{{ setting('core.account_login_by_email') ? '255' : '30' }}" autofocus/></td>
</tr>
{{ hook('HOOK_ACCOUNT_LOGIN_AFTER_ACCOUNT') }}
<tr>

View File

@ -24,7 +24,7 @@
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-lock"></i></span>
</div>
<input type="text" class="form-control" id="account-name-input" name="account_login" placeholder="{{ account_login_by }}" required autofocus>
<input type="text" class="form-control" id="account-name-input" name="account_login" maxlength="{{ setting('core.account_login_by_email') ? '255' : '30' }}" placeholder="{{ account_login_by }}" required autofocus>
</div>
{{ hook('HOOK_ADMIN_LOGIN_AFTER_ACCOUNT') }}
<div class="input-group mb-3">

View File

@ -22,7 +22,7 @@
<td>
<select name="access">
{% for id, group in groups %}
<option value="{{ group.getId() }}"{% if access == group.getId() %} selected{% endif %}>{{ group.getName() }}</option>
<option value="{{ group.id }}"{% if access == group.id %} selected{% endif %}>{{ group.name }}</option>
{% endfor %}
</select>
</td>

View File

@ -37,22 +37,22 @@
</td>
{% if canEdit %}
<td>
<a href="?subtopic=forum&action=edit_board&id={{ board.id }}" title="Edit">
<a href="{{ getLink('forum') }}?action=edit_board&id={{ board.id }}" title="Edit">
<img src="images/edit.png"/>Edit
</a>
<a id="delete" href="?subtopic=forum&action=delete_board&id={{ board.id }}" onclick="return confirm('Are you sure?');" title="Delete">
<a id="delete" href="{{ getLink('forum') }}?action=delete_board&id={{ board.id }}" onclick="return confirm('Are you sure?');" title="Delete">
<img src="images/del.png"/>Delete
</a>
<a href="?subtopic=forum&action=hide_board&id={{ board.id }}" title="{% if board.hide != 1 %}Hide{% else %}Show{% endif %}">
<a href="{{ getLink('forum') }}?action=hide_board&id={{ board.id }}" title="{% if board.hide != 1 %}Hide{% else %}Show{% endif %}">
<img src="images/{% if board.hide != 1 %}success{% else %}error{% endif %}.png"/>{% if board.hide != 1 %}Hide{% else %}Show{% endif %}
</a>
{% if i != 1 %}
<a href="?subtopic=forum&action=moveup_board&id={{ board.id }}" title="Move up">
<a href="{{ getLink('forum') }}?action=moveup_board&id={{ board.id }}" title="Move up">
<img src="images/icons/arrow_up.gif"/>Move up
</a>
{% endif %}
{% if i != last %}
<a href="?subtopic=forum&action=movedown_board&id={{ board.id }}" title="Move down">
<a href="{{ getLink('forum') }}?action=movedown_board&id={{ board.id }}" title="Move down">
<img src="images/icons/arrow_down.gif"/>Move down
</a>
{% endif %}

View File

@ -24,7 +24,7 @@
</select>
<input type="submit" value="Move Thread">
</form>
<form action="{{ section_link }}" method="post">
<form action="{{ section_link }}">
{{ csrf() }}
<input type="submit" value="Cancel">
</form>

View File

@ -1,6 +1,6 @@
<a href="{{ getLink('forum') }}">Boards</a> >> <a href="{{ getLink('forum/board/' ~ section.id) }}">{{ section.name }}</a> >> <b>{{ thread_starter.post_topic }}</b>
<br/><br/>
<a href="?subtopic=forum&action=new_post&thread_id={{ thread_id }}"><img src="images/forum/post.gif" border="0" /></a><br/>
<a href="{{ getLink('forum') }}?action=new_post&thread_id={{ thread_id }}"><img src="images/forum/post.gif" border="0" /></a><br/>
<br/>
Page: {{ links_to_pages|raw }}<br/>
<table width="100%">
@ -53,18 +53,18 @@ Page: {{ links_to_pages|raw }}<br/>
<td>
{% if is_moderator %}
{% if post.first_post != post.id %}
<a href="?subtopic=forum&action=remove_post&id={{ post.id }}" title="Remove Post" onclick="return confirm('Are you sure you want remove post of {{ post.player.getName() }}?')"><img src="images/del.png"/></a>
<a href="{{ getLink('forum') }}?action=remove_post&id={{ post.id }}" title="Remove Post" onclick="return confirm('Are you sure you want remove post of {{ post.player.getName() }}?')"><img src="images/del.png"/></a>
{% else %}
<a href="?subtopic=forum&action=move_thread&id={{ post.id }}" title="Move Thread"><img src="images/icons/arrow_right.gif"/></a>
<a href="?subtopic=forum&action=remove_post&id={{ post.id }}" title="Remove Thread" target="_blank" onclick="return confirm('Are you sure you want remove thread > {{ post.post_topic}} <?')"><img src="images/del.png"/></a>
<a href="{{ getLink('forum') }}?action=move_thread&id={{ post.id }}" title="Move Thread"><img src="images/icons/arrow_right.gif"/></a>
<a href="{{ getLink('forum') }}?action=remove_post&id={{ post.id }}" title="Remove Thread" target="_blank" onclick="return confirm('Are you sure you want remove thread > {{ post.post_topic}} <?')"><img src="images/del.png"/></a>
{% endif %}
{% endif %}
{% if logged and (post.player.getAccount().getId() == account_logged.getId() or is_moderator) %}
<a href="?subtopic=forum&action=edit_post&id={{ post.id }}" title="Edit Post" target="_blank">
<a href="{{ getLink('forum') }}?action=edit_post&id={{ post.id }}" title="Edit Post" target="_blank">
<img src="images/edit.png"/></a>
{% endif %}
{% if logged %}
<a href="?subtopic=forum&action=new_post&thread_id={{ thread_id }}&quote={{ post.id }}" title="Quote Post"><img src="images/icons/comment_add.png"/></a>
<a href="{{ getLink('forum') }}?action=new_post&thread_id={{ thread_id }}&quote={{ post.id }}" title="Quote Post"><img src="images/icons/comment_add.png"/></a>
{% endif %}
</td>
</tr>
@ -72,4 +72,4 @@ Page: {{ links_to_pages|raw }}<br/>
{% endfor %}
</table>
<br/>
<a href="?subtopic=forum&action=new_post&thread_id={{ thread_id }}"><img src="images/forum/post.gif" border="0" /></a>
<a href="{{ getLink('forum') }}?action=new_post&thread_id={{ thread_id }}"><img src="images/forum/post.gif" border="0" /></a>

View File

@ -7,7 +7,7 @@
</tr>
<tr bgcolor="{{ config.darkborder }}">
<td>
<form action="?subtopic=guilds&action=accept_invite&guild={{ guild_name }}&todo=save" method="post">
<form action="{{ getLink('guilds') }}?action=accept_invite&guild={{ guild_name }}&todo=save" method="post">
{{ csrf() }}
{% set i = 0 %}
{% for player in invited_players %}

View File

@ -1,13 +1,13 @@
<div style="text-align:center"><h2>Change guild description</h2></div>
Here you can change description of your guild.<br/>
<form enctype="multipart/form-data" action="?subtopic=guilds&guild={{ guild.getName() }}&action=change_description" method="post">
<form enctype="multipart/form-data" action="{{ getLink('guilds') }}?guild={{ guild.getName() }}&action=change_description" method="post">
{{ csrf() }}
<input type="hidden" name="todo" value="save"/>
<textarea name="description" cols="60" rows="{{ setting('core.guild_description_lines_limit') - 1 }}">{{ guild.getCustomField('description')|raw }}</textarea><br>
(max. {{ setting('core.guild_description_lines_limit') }} lines, max. {{ setting('core.guild_description_chars_limit') }} chars) <input type="submit" value="Save description"/></form><br/>
<br/>
<div style="text-align:center">
<form action="?subtopic=guilds&guild={{ guild.getName() }}&action=manager" method="post">
<form action="{{ getLink('guilds') }}?guild={{ guild.getName() }}&action=manager" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }}
</form>

View File

@ -1,6 +1,6 @@
<div style="text-align:center"><h2>Change guild logo</h2></div>
Here you can change logo of your guild.<br/>Actuall logo: <img src="{{ constant('GUILD_IMAGES_DIR') }}{{ guild_logo }}" height="64" width="64"><br/><br/>
<form enctype="multipart/form-data" action="?subtopic=guilds&guild={{ guild.getName() }}&action=change_logo" method="post" id="upload_form">
<form enctype="multipart/form-data" action="{{ getLink('guilds') }}?guild={{ guild.getName() }}&action=change_logo" method="post" id="upload_form">
{{ csrf() }}
<input type="hidden" name="todo" value="save" />
<input type="hidden" name="MAX_FILE_SIZE" value="{{ max_image_size_b }}" />
@ -10,7 +10,7 @@ Here you can change logo of your guild.<br/>Actuall logo: <img src="{{ constant(
Only <b>jpg, gif, png, bmp</b> pictures. Max. size: <b>{{ setting('core.guild_image_size_kb') }} KB</b><br>
<br/>
<div style="text-align:center">
<form action="?subtopic=guilds&guild={{ guild.getName() }}&action=manager" method="post">
<form action="{{ getLink('guilds') }}?guild={{ guild.getName() }}&action=manager" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }}
</form>

View File

@ -1,13 +1,13 @@
<div style="text-align:center"><h2>Change guild MOTD</h2></div>
Here you can change MOTD (Message of the Day, showed in game!) of your guild.<br/>
<form enctype="multipart/form-data" action="?subtopic=guilds&guild={{ guild.getName() }}&action=change_motd" method="post">
<form enctype="multipart/form-data" action="{{ getLink('guilds') }}?guild={{ guild.getName() }}&action=change_motd" method="post">
{{ csrf() }}
<input type="hidden" name="todo" value="save"/>
<textarea name="motd" cols="60" rows="3">{{ guild.getCustomField('motd')|raw }}</textarea><br/>
(max. {{ setting('core.guild_motd_chars_limit') }} chars) <input type="submit" value="Save MOTD" /></form><br/>
<br/>
<div style="text-align:center">
<form action="?subtopic=guilds&guild={{ guild.getName() }}&action=manager" method="post">
<form action="{{ getLink('guilds') }}?guild={{ guild.getName() }}&action=manager" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }}
</form>

View File

@ -1,4 +1,4 @@
<form action="?subtopic=guilds&action=change_rank&guild={{ guild_name }}&todo=save" method="post">
<form action="{{ getLink('guilds') }}?action=change_rank&guild={{ guild_name }}&todo=save" method="post">
{{ csrf() }}
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="{{ config.vdarkborder }}"><td class="white"><b>Change Rank</b></td></tr>
@ -29,7 +29,7 @@
<tr>
<td>
<div style="text-align:center">
<form action="?subtopic=guilds&action=show&guild={{ guild_name }}" method="post">
<form action="{{ getLink('guilds') }}?action=show&guild={{ guild_name }}" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }}
</form>

View File

@ -1,4 +1,4 @@
<form action="?subtopic=guilds&action=create&todo=save" method="post">
<form action="{{ getLink('guilds') }}?action=create&todo=save" method="post">
{{ csrf() }}
<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
@ -47,7 +47,7 @@
</form>
</td>
<td align="center">
<form action="?subtopic=guilds" method="post">
<form action="{{ getLink('guilds') }}" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }}
</form>

View File

@ -19,7 +19,7 @@
<table style="width:100%;" >
<tr>
<td>Are you sure you want delete guild <b>{{ guild.getName() }}</b>?<br/>
<form action="?subtopic=guilds&guild={{ guild.getName() }}&action=delete_guild" method="post">
<form action="{{ getLink('guilds') }}?guild={{ guild.getName() }}&action=delete_guild" method="post">
{{ csrf() }}
<input type="hidden" name="todo" value="save"/>
<input type="submit" value="Yes, delete"/>
@ -34,7 +34,7 @@
</div>
<br/>
<div style="text-align:center">
<form action="?subtopic=guilds&guild={{ guild.getName() }}&action=manager" method="post">
<form action="{{ getLink('guilds') }}?guild={{ guild.getName() }}&action=manager" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }}
</form>

View File

@ -7,14 +7,14 @@
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td align="right" width="50%">
<form action="?subtopic=guilds&action=delete_invite&guild={{ guild_name }}&name={{ player_name }}&todo=save" method="post">
<form action="{{ getLink('guilds') }}?action=delete_invite&guild={{ guild_name }}&name={{ player_name }}&todo=save" method="post">
{{ csrf() }}
{{ include('buttons.submit.html.twig') }}
</form>
</td>
<td style="width: 10px; "></td>
<td>
<form action="?subtopic=guilds&action=show&guild={{ guild_name }}" method="post">
<form action="{{ getLink('guilds') }}?action=show&guild={{ guild_name }}" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }}
</form>

View File

@ -1,4 +1,4 @@
<form action="?subtopic=guilds&action=invite&guild={{ guild_name }}&todo=save" method="post">
<form action="{{ getLink('guilds') }}?action=invite&guild={{ guild_name }}&todo=save" method="post">
{{ csrf() }}
Invite player with name:&nbsp;&nbsp;<input type="text" name="name">&nbsp;&nbsp;&nbsp;&nbsp;
{{ include('buttons.submit.html.twig') }}

View File

@ -7,7 +7,7 @@
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td align="right" width="50%">
<form action="?subtopic=guilds&action=kick_player&guild={{ guild_name }}&name={{ player_name }}&todo=save" method="post">
<form action="{{ getLink('guilds') }}?action=kick_player&guild={{ guild_name }}&name={{ player_name }}&todo=save" method="post">
{{ csrf() }}
{{ include('buttons.submit.html.twig') }}
</form>

View File

@ -1,4 +1,4 @@
<form action="?subtopic=guilds&action=leave&guild={{ guild_name }}&todo=save" METHOD="post">
<form action="{{ getLink('guilds') }}?action=leave&guild={{ guild_name }}&todo=save" METHOD="post">
{{ csrf() }}
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="{{ config.vdarkborder }}">
@ -27,7 +27,7 @@
{% endif %}
</form>
<td>
<form action="?subtopic=guilds&action=show&guild={{ guild_name }}" method="post">
<form action="{{ getLink('guilds') }}?action=show&guild={{ guild_name }}" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }}
</form>

View File

@ -46,7 +46,7 @@
<td style="word-break: break-all">
<span{% if guild.description is not empty %} valign="top"{% endif %}>
<b>{{ guild.name }}</b>{% if isAdmin %}<a href="?subtopic=guilds&action=delete_by_admin&guild={{ guild.name }}"> - Delete this guild (for ADMIN only!)</a>{% endif %}
<b>{{ guild.name }}</b>{% if isAdmin %}<a href="{{ getLink('guilds') }}?action=delete_by_admin&guild={{ guild.name }}"> - Delete this guild (for ADMIN only!)</a>{% endif %}
</span>
{% if guild.description is not empty %}
@ -82,7 +82,7 @@
{% if logged %}
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<form action="?subtopic=guilds&action=create" method="post">
<form action="{{ getLink('guilds') }}?action=create" method="post">
{{ csrf() }}
{% set button_name = 'Found Guild' %}
{% set button_image = '_sbutton_foundguild' %}
@ -127,7 +127,7 @@
<tbody>
{% if logged %}
No guild found that suits your needs?
<form action="?subtopic=guilds&action=create" method="post">
<form action="{{ getLink('guilds') }}?action=create" method="post">
{{ csrf() }}
{% set button_name = 'Found Guild' %}
{% set button_image = '_sbutton_foundguild' %}
@ -148,9 +148,9 @@
<br/>
If you have any problem with guilds try:
<br/>
<a href="?subtopic=guilds&action=cleanup_players">Cleanup players</a> - can't join guild/be invited? Can't create guild? Try cleanup players.
<a href="{{ getLink('guilds') }}?action=cleanup_players">Cleanup players</a> - can't join guild/be invited? Can't create guild? Try cleanup players.
<br/>
<a href="?subtopic=guilds&action=cleanup_guilds">Cleanup guilds</a> - made guild, you are a leader, but you are not on players list? Cleanup guilds!
<a href="{{ getLink('guilds') }}?action=cleanup_guilds">Cleanup guilds</a> - made guild, you are a leader, but you are not on players list? Cleanup guilds!
{% endif %}
</td>

View File

@ -12,7 +12,7 @@ Here you can change names of ranks, delete and add ranks, pass leadership to oth
</tr>
<tr bgcolor="{{ config.lightborder }}">
<td width="170">
<b><a href="?subtopic=guilds&guild={{ guild.getName() }}&action=pass_leadership">Pass Leadership</a></b>
<b><a href="{{ getLink('guilds') }}?guild={{ guild.getName() }}&action=pass_leadership">Pass Leadership</a></b>
</td>
<td>
<b>Pass leadership of guild to other guild member.</b>
@ -20,7 +20,7 @@ Here you can change names of ranks, delete and add ranks, pass leadership to oth
</tr>
<tr bgcolor="{{ config.darkborder }}">
<td width="170">
<b><a href="?subtopic=guilds&guild={{ guild.getName() }}&action=delete_guild">Delete Guild</a></b>
<b><a href="{{ getLink('guilds') }}?guild={{ guild.getName() }}&action=delete_guild">Delete Guild</a></b>
</td>
<td>
<b>Delete guild, kick all members.</b>
@ -28,7 +28,7 @@ Here you can change names of ranks, delete and add ranks, pass leadership to oth
</tr>
<tr bgcolor="{{ config.lightborder }}">
<td width="170">
<b><a href="?subtopic=guilds&guild={{ guild.getName() }}&action=change_description">Change Description</a></b>
<b><a href="{{ getLink('guilds') }}?guild={{ guild.getName() }}&action=change_description">Change Description</a></b>
</td>
<td>
<b>Change description of guild.</b>
@ -37,7 +37,7 @@ Here you can change names of ranks, delete and add ranks, pass leadership to oth
{% if constant('MOTD_EXISTS') %}
<tr bgcolor="{{ config.darkborder }}">
<td width="170">
<b><a href="?subtopic=guilds&guild={{ guild.getName() }}&action=change_motd">Change MOTD</a></b>
<b><a href="{{ getLink('guilds') }}?guild={{ guild.getName() }}&action=change_motd">Change MOTD</a></b>
</td>
<td>
<b>Change MOTD of guild.</b>
@ -46,7 +46,7 @@ Here you can change names of ranks, delete and add ranks, pass leadership to oth
{% endif %}
<tr bgcolor="{{ config.lightborder }}">
<td width="170">
<b><a href="?subtopic=guilds&guild={{ guild.getName() }}&action=change_logo">Change guild logo</a></b>
<b><a href="{{ getLink('guilds') }}?guild={{ guild.getName() }}&action=change_logo">Change guild logo</a></b>
</td>
<td>
<b>Upload new guild logo.</b>
@ -75,7 +75,7 @@ Here you can change names of ranks, delete and add ranks, pass leadership to oth
<tr>
<td width="120" valign="top">New rank name:</td>
<td>
<form action="?subtopic=guilds&guild={{ guild.getName() }}&action=add_rank" method="post">
<form action="{{ getLink('guilds') }}?guild={{ guild.getName() }}&action=add_rank" method="post">
{{ csrf() }}
<input type="text" name="rank_name" size="20"/>
<input type="submit" value="Add"/>
@ -89,7 +89,7 @@ Here you can change names of ranks, delete and add ranks, pass leadership to oth
</table>
</div>
<div style="text-align:center"><h3>Change rank names and levels</h3></div>
<form action="?subtopic=guilds&action=save_ranks&guild={{ guild.getName() }}" method="post">
<form action="{{ getLink('guilds') }}?action=save_ranks&guild={{ guild.getName() }}" method="post">
{{ csrf() }}
<table style="clear:both" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="{{ config.vdarkborder }}">
@ -117,7 +117,7 @@ Here you can change names of ranks, delete and add ranks, pass leadership to oth
{% set i = 0 %}
{% for rank in rank_list %}
<tr bgcolor="{{ getStyle(i) }}">
<td align="center">{{ rank.getId() }} // <a href="?subtopic=guilds&guild={{ guild.getName() }}&action=delete_rank&rankid={{ rank.getId() }}" border="0"><img src="/images/news/delete.png" border="0" alt="Delete Rank"></a>
<td align="center">{{ rank.getId() }} // <a href="{{ getLink('guilds') }}?guild={{ guild.getName() }}&action=delete_rank&rankid={{ rank.getId() }}" border="0"><img src="/images/news/delete.png" border="0" alt="Delete Rank"></a>
</td>
<td>
<input type="text" name="{{ rank.getId() }}_name" value="{{ rank.getName() }}" size="35"/>
@ -164,7 +164,7 @@ Here you can change names of ranks, delete and add ranks, pass leadership to oth
<li>Be a member of guild
<br/>
<div style="text-align:center">
<form action="?subtopic=guilds&action=show&guild={{ guild.getName() }}" method="post">
<form action="{{ getLink('guilds') }}?action=show&guild={{ guild.getName() }}" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }}
</form>

View File

@ -19,7 +19,7 @@
<table style="width:100%;">
<tr>
<td>Pass leadership to: </b><br>
<form action="?subtopic=guilds&guild={{ guild.getName() }}&action=pass_leadership" method="post">
<form action="{{ getLink('guilds') }}?guild={{ guild.getName() }}&action=pass_leadership" method="post">
{{ csrf() }}
<input type="hidden" name="todo" value="save"/>
<input type="text" size="40" name="player"/>
@ -35,7 +35,7 @@
</div>
<br/>
<div style="text-align:center">
<form action="?subtopic=guilds&guild={{ guild.getName() }}&action=manager" method="post">
<form action="{{ getLink('guilds') }}?guild={{ guild.getName() }}&action=manager" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }}
</form>

View File

@ -67,7 +67,7 @@
The guild was founded on {{ config.lua.serverName }} on {{ guild_creation_date|date("j F Y") }}.
{% if isLeader %}
<a href="?subtopic=guilds&action=manager&guild={{ guild_name }}" style="float: right;">
<a href="{{ getLink('guilds') }}?action=manager&guild={{ guild_name }}" style="float: right;">
<img src="{{ template_path }}/images/global/buttons/sbutton_manageguild.png" style="width: 120px; height: 20px;" alt="Manage Guild">
</a>
{% endif %}
@ -141,7 +141,7 @@
<td>
{% set playerName = player.getName() %}
<form action="?subtopic=guilds&action=change_nick&name={{ playerName }}&guild={{ guild_name }}" method="post">
<form action="{{ getLink('guilds') }}?action=change_nick&name={{ playerName }}&guild={{ guild_name }}" method="post">
{{ csrf() }}
{{ getPlayerLink(playerName, true)|raw }}
@ -161,7 +161,7 @@
{% if level_in_guild > rank.rank_level or isLeader %}
{% if guildOwnerName != playerName %}
<span style="font-size: 10px; float: right">
{<a href="?subtopic=guilds&action=kick_player&guild={{ guild_name|url_encode }}&name={{ playerName|url_encode }}">KICK</a>}
{<a href="{{ getLink('guilds') }}?action=kick_player&guild={{ guild_name|url_encode }}&name={{ playerName|url_encode }}">KICK</a>}
</span>
{% endif %}
{% endif %}
@ -245,7 +245,7 @@
{% if isVice %}
<div style="float: right">
{<a href="?subtopic=guilds&action=delete_invite&guild={{ guild_name|url_encode }}&name={{ invited_player.getName()|url_encode }}">Cancel Invitation</a>}
{<a href="{{ getLink('guilds') }}?action=delete_invite&guild={{ guild_name|url_encode }}&name={{ invited_player.getName()|url_encode }}">Cancel Invitation</a>}
</div>
{% endif %}
</td>
@ -298,7 +298,7 @@
</form>
{% else %}
{% if show_accept_invite > 0 %}
<form action="?subtopic=guilds&action=accept_invite&guild={{ guild_name|url_encode }}" method="post">
<form action="{{ getLink('guilds') }}?action=accept_invite&guild={{ guild_name|url_encode }}" method="post">
{{ csrf() }}
<td>
<input type="image" name="Accept Invite" alt="Accept Invite" src="{{ template_path }}/images/global/buttons/sbutton_acceptinvite.png" style="width: 120px; height: 20px;">
@ -307,7 +307,7 @@
{% endif %}
{% if isVice %}
<form action="?subtopic=guilds&action=invite&guild={{ guild_name|url_encode }}" method="post">
<form action="{{ getLink('guilds') }}?action=invite&guild={{ guild_name|url_encode }}" method="post">
{{ csrf() }}
<td>
{% set button_name = 'Invite Character' %}
@ -316,7 +316,7 @@
</td>
</form>
<form action="?subtopic=guilds&action=change_rank&guild={{ guild_name|url_encode }}" method="post">
<form action="{{ getLink('guilds') }}?action=change_rank&guild={{ guild_name|url_encode }}" method="post">
{{ csrf() }}
<td>
{% set button_name = 'Edit Ranks' %}
@ -327,7 +327,7 @@
{% endif %}
{% if players_from_account_in_guild|length > 0 %}
<form action="?subtopic=guilds&action=leave&guild={{ guild_name|url_encode }}" method="post">
<form action="{{ getLink('guilds') }}?action=leave&guild={{ guild_name|url_encode }}" method="post">
{{ csrf() }}
<td>
{% set button_name = 'Leave Guild' %}

View File

@ -1,7 +1,7 @@
<script type="text/javascript" src="tools/js/tipped.js"></script>
<link rel="stylesheet" type="text/css" href="tools/css/tipped.css"/>
<style>
.creature_img {
.monster_img {
background-position: center center;
background-repeat: no-repeat;
width: 64px;
@ -9,7 +9,7 @@
padding: 5px;
}
.creature_name {
.monster_name {
font-size: 18px;
font-weight: bold;
width: 100%;
@ -20,7 +20,7 @@
padding-bottom: 15px;
}
.creature_voice {
.monster_voice {
font-weight: bold;
font-size: 8pt;
color: #FE6500;
@ -63,8 +63,8 @@
});
</script>
<div class="creature_name">{{ creature.name }}</div>
<table class="CreatureInfo" border="0" cellspacing="0" cellpadding="4" width="100%">
<div class="monster_name">{{ monster.name }}</div>
<table class="MonsterInfo" border="0" cellspacing="0" cellpadding="4" width="100%">
<thead>
<tr>
<th align="center" colspan="4"><b>General information</b></th>
@ -73,50 +73,50 @@
<tbody>
<tr>
<td width="10%">
<div class="creature_img" style="background-image: url({{ creature.img_link }}"></div>
<div class="monster_img" style="background-image: url({{ monster.img_link }}"></div>
</td>
<td align="center" width="30%">
<strong>Health:</strong> {{ creature.health }}<br>
<strong>Experience:</strong> {{ creature.exp }}<br>
<strong>Speed:</strong> {{ creature.speed_lvl }} {{ (creature.use_haste) ? ' (+haste)' : '' }}
<strong>Health:</strong> {{ monster.health }}<br>
<strong>Experience:</strong> {{ monster.exp }}<br>
<strong>Speed:</strong> {{ monster.speed_lvl }} {{ (monster.use_haste) ? ' (+haste)' : '' }}
</td>
<td align="center" width="30%">
<b>Summonable:</b> {{ (creature.summonable) ? creature.mana ~ ' mana' : 'Impossible' }}<br>
<b>Convinceable:</b> {{ (creature.convinceable) ? creature.mana ~ ' mana' : 'Impossible' }}
<b>Summonable:</b> {{ (monster.summonable) ? monster.mana ~ ' mana' : 'Impossible' }}<br>
<b>Convinceable:</b> {{ (monster.convinceable) ? monster.mana ~ ' mana' : 'Impossible' }}
</td>
<td width="30%" align="center">
<strong>Armor:</strong> {{ creature.armor }}<br>
<strong>Defense:</strong> {{ creature.defense }}
<strong>Armor:</strong> {{ monster.armor }}<br>
<strong>Defense:</strong> {{ monster.defense }}
</td>
</tr>
</tbody>
</table><br>
{% if ( creature.voices is not empty or creature.summons is not empty) %}
<table class="CreatureVoice" border="0" cellspacing="0" cellpadding="4" width="100%">
{% if ( monster.voices is not empty or monster.summons is not empty) %}
<table class="MonsterVoice" border="0" cellspacing="0" cellpadding="4" width="100%">
<thead>
<tr>
{% if ( creature.summons is not empty) %}
{% if ( monster.summons is not empty) %}
<th width="50%"><b>Summons</b></th>
{% endif %}
{% if ( creature.voices is not empty) %}
{% if ( monster.voices is not empty) %}
<th width="50%"><b>Voices</b></th>
{% endif %}
</tr>
</thead>
<tbody>
<tr>
{% if ( creature.summons is not empty) %}
{% if ( monster.summons is not empty) %}
<td>
{% for summon in creature.summons %}
{% for summon in monster.summons %}
<span>{{ summon.chance }}% chance to summon a <b>{{ getMonsterLink(summon.name, true)|raw }}</b><br/></span>
{% endfor %}
</td>
{% endif %}
{% if ( creature.voices is not empty) %}
{% if ( monster.voices is not empty) %}
<td align="center">
<span class="creature_voice">
{% for voice in creature.voices %}
<span class="monster_voice">
{% for voice in monster.voices %}
"{{ voice }}"<br/>
{% endfor %}
</span>
@ -127,30 +127,30 @@
</table><br/>
{% endif %}
{% if (creature.elements|length > 0 or creature.immunities|length > 0 ) %}
<table class="CreatureElements" border="0" cellspacing="0" cellpadding="4" width="100%">
{% if (monster.elements|length > 0 or monster.immunities|length > 0 ) %}
<table class="MonsterElements" border="0" cellspacing="0" cellpadding="4" width="100%">
<tr>
<th colspan="{{ creature.elements|length }}">Elements and Immunities</th>
<th colspan="{{ monster.elements|length }}">Elements and Immunities</th>
</tr>
{% if (creature.elements|length > 0) %}
<tr>{% for element in creature.elements %}
{% if (monster.elements|length > 0) %}
<tr>{% for element in monster.elements %}
<td align="center"><b> {{ element.name }}</b><br/>{{ element.percent }}%</td>
{% endfor %}</tr>
{% endif %}
{% if (creature.immunities|length > 0 ) %}
{% if (monster.immunities|length > 0 ) %}
<tr>
<td colspan="{{ creature.elements|length }}"><b>Immunities:</b> {{ creature.immunities|join(' | ') }}</td>
<td colspan="{{ monster.elements|length }}"><b>Immunities:</b> {{ monster.immunities|join(' | ') }}</td>
</tr>
{% endif %}
</table><br/>
{% endif %}
{% if (not creature.loot is empty) %}
<table class="CreatureLoot" border="0" cellspacing="0" cellpadding="4" width="100%">
{% if (not monster.loot is empty) %}
<table class="MonsterLoot" border="0" cellspacing="0" cellpadding="4" width="100%">
<tr><th>Loot</th></tr>
<tr>
<td>
{% for item in creature.loot %}
{% for item in monster.loot %}
<span class="loot_bg">
{% if (item.count > 1) %}
<span class="loot_amount">{{ item.count }}</span>

View File

@ -1,6 +1,6 @@
<br/></br>
<br/><br/>
<div style="text-align:center">
<form action="{{ getLink('creatures') }}" method="post">
<form action="{{ getLink('monsters') }}" method="post">
{{ include('buttons.back.html.twig') }}
</form>
</div>
</div>

View File

@ -1,15 +1,15 @@
{% if creatures is not empty %}
{% if monsters is not empty %}
{% if preview %}
<style>
.creatureImages {
.monsterImages {
width: 100px;
height: 100px;
margin: 0px;
float: left;
}
.creatureBoss {
.monsterBoss {
box-sizing: border-box;
border-radius: 10px;
border: 1px rgba(179, 179, 179, 0.50) solid;
@ -20,7 +20,7 @@
$(document).ready(function () {
$("#ciSearch").on("keyup", function () {
var value = $(this).val().toLowerCase();
$("#creatureiTable div").filter(function () {
$("#monsteriTable div").filter(function () {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
@ -28,15 +28,15 @@
</script>
<div style="float: right;"><input id="ciSearch" type="text" placeholder="Search.."></div>
<div style="display: table; width: 100%; ">
<div style="text-align: center; " id="creatureiTable">
{% for creature in creatures %}
<div style="text-align: center; " id="monsteriTable">
{% for monster in monsters %}
{% set i = i + 1 %}
<div class="creatureImages">
<a href="{{ getMonsterLink(creature.name, false)|raw }}">
<div class="creature_img " style="background-image: url({{ creature.img_link }}"></div>
<img class=" {{ (creature.rewardboss ? 'creatureBoss' : '') }}" src="{{ creature.img_link }}" border="0"/>
<div class="monsterImages">
<a href="{{ getMonsterLink(monster.name, false)|raw }}">
<div class="monster_img " style="background-image: url({{ monster.img_link }}"></div>
<img class=" {{ (monster.rewardboss ? 'monsterBoss' : '') }}" src="{{ monster.img_link }}" border="0"/>
</a>
<div>{{ creature.name }}</div>
<div>{{ monster.name }}</div>
</div>
{% endfor %}
</div>
@ -46,14 +46,14 @@
$(document).ready(function () {
$("#cSearch").on("keyup", function () {
var value = $(this).val().toLowerCase();
$("#creatureTable tr").filter(function () {
$("#monsterTable tr").filter(function () {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
</script>
{{ generateLink(getLink('creatures'), 'All', false)|raw }} - <a href="?subtopic=creatures&boss=view">Bosses</a>
<table width="100%" id="creaturestb">
{{ generateLink(getLink('monsters'), 'All', false)|raw }} - <a href="{{ getLink('monsters') }}?boss=view">Bosses</a>
<table width="100%" id="monsters_datatable">
<thead>
<tr>
<th>Name</th>
@ -65,18 +65,18 @@
<th>Race</th>
</tr>
</thead>
<tbody id="creatureTable">
<tbody id="monsterTable">
{% set i = 0 %}
{% for creature in creatures %}
{% for monster in monsters %}
{% set i = i + 1 %}
<tr>
<td>{{ getMonsterLink(creature.name, true)|raw }}</td>
<td>{{ (creature.rewardboss) ? 'Yes' : '---' }}</td>
<td>{{ creature.health|number_format(0, '.', ',') }}</td>
<td>{{ creature.exp|number_format(0, '.', ',') }}</td>
<td>{{ (creature.convinceable) ? creature.mana : '---' }} </td>
<td>{{ (creature.summonable) ? creature.mana : '---' }} </td>
<td>{{ creature.race|title }}</td>
<td>{{ getMonsterLink(monster.name, true)|raw }}</td>
<td>{{ (monster.rewardboss) ? 'Yes' : '---' }}</td>
<td>{{ monster.health|number_format(0, '.', ',') }}</td>
<td>{{ monster.exp|number_format(0, '.', ',') }}</td>
<td>{{ (monster.convinceable) ? monster.mana : '---' }} </td>
<td>{{ (monster.summonable) ? monster.mana : '---' }} </td>
<td>{{ monster.race|title }}</td>
</tr>
{% endfor %}
</tbody>
@ -84,7 +84,7 @@
{% endif %}
<script>
$(document).ready(function () {
$('#creaturestb').DataTable();
$('#monsters_datatable').DataTable();
});
</script>
@ -94,10 +94,10 @@
{% else %}
<table width="100%">
<tr>
<th>Creatures</th>
<th>Monsters</th>
</tr>
<tr>
<td>No Creatures on the server.</td>
<td>No Monsters on the server.</td>
</tr>
</table>
{% endif %}

View File

@ -38,7 +38,7 @@
<td class="LabelV">
<span{% if error is not null %} class="red"{% endif %}>{{ account_login_by }}:</span>
</td>
<td><input type="text" name="account_login" size="35" maxlength="30" autofocus /></td>
<td><input type="text" name="account_login" size="35" maxlength="{{ setting('core.account_login_by_email') ? '255' : '30' }}" autofocus /></td>
</tr>
{{ hook('HOOK_ACCOUNT_LOGIN_AFTER_ACCOUNT') }}
<tr>