mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
Creature page overhaul
Updates the creature pages to show more information. You will need to reload your creatures. -modifies database with migration 31 -small customisations are allowed via config file. -functions added, getMonsterLink, getItemRarity, getCreatureImgPath, left, right, -added functions to twig. -view elements, immunities, summons, voices, loot, pushables, canpush, canwalk, runonhealth,hostile,attackable,rewardboss,defense,armor -filter bosses -show list as picture preview or names list
This commit is contained in:
parent
7e0fded595
commit
8e6bc73ca6
@ -28,7 +28,7 @@ session_start();
|
|||||||
|
|
||||||
define('MYAAC', true);
|
define('MYAAC', true);
|
||||||
define('MYAAC_VERSION', '0.9.0-dev');
|
define('MYAAC_VERSION', '0.9.0-dev');
|
||||||
define('DATABASE_VERSION', 30);
|
define('DATABASE_VERSION', 31);
|
||||||
define('TABLE_PREFIX', 'myaac_');
|
define('TABLE_PREFIX', 'myaac_');
|
||||||
define('START_TIME', microtime(true));
|
define('START_TIME', microtime(true));
|
||||||
define('MYAAC_OS', stripos(PHP_OS, 'WIN') === 0 ? 'WINDOWS' : (strtoupper(PHP_OS) === 'DARWIN' ? 'MAC' : 'LINUX'));
|
define('MYAAC_OS', stripos(PHP_OS, 'WIN') === 0 ? 'WINDOWS' : (strtoupper(PHP_OS) === 'DARWIN' ? 'MAC' : 'LINUX'));
|
||||||
|
11
config.php
11
config.php
@ -84,12 +84,23 @@ $config = array(
|
|||||||
//'2' => 'Your Second World Name'
|
//'2' => 'Your Second World Name'
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// loot
|
||||||
|
'loot_show_percentage' => true, // to true to show tooltip percent
|
||||||
|
|
||||||
|
// links
|
||||||
|
'items_url' => 'https://tibia.fandom.com/wiki/', // set to website which shows details about items.
|
||||||
|
|
||||||
// images
|
// images
|
||||||
'outfit_images_url' => 'https://outfit-images.ots.me/outfit.php', // set to animoutfit.php for animated outfit
|
'outfit_images_url' => 'https://outfit-images.ots.me/outfit.php', // set to animoutfit.php for animated outfit
|
||||||
'outfit_images_wrong_looktypes' => [75, 126, 127, 266, 302], // this looktypes needs to have different margin-top and margin-left because they are wrong positioned
|
'outfit_images_wrong_looktypes' => [75, 126, 127, 266, 302], // this looktypes needs to have different margin-top and margin-left because they are wrong positioned
|
||||||
'item_images_url' => 'https://item-images.ots.me/1092/', // set to images/items if you host your own items in images folder
|
'item_images_url' => 'https://item-images.ots.me/1092/', // set to images/items if you host your own items in images folder
|
||||||
'item_images_extension' => '.gif',
|
'item_images_extension' => '.gif',
|
||||||
|
|
||||||
|
// creatures
|
||||||
|
'creature_images_url' => 'images/monsters/', // set to images/monsters if you host your own creatures in images folder
|
||||||
|
'creature_images_extension' => '.gif',
|
||||||
|
'creature_images_preview' => false, // set to true to allow picture previews for creatures
|
||||||
|
|
||||||
// account
|
// account
|
||||||
'account_management' => true, // disable if you're using other method to manage users (fe. tfs account manager)
|
'account_management' => true, // disable if you're using other method to manage users (fe. tfs account manager)
|
||||||
'account_create_auto_login' => false, // auto login after creating account?
|
'account_create_auto_login' => false, // auto login after creating account?
|
||||||
|
@ -102,6 +102,7 @@ else {
|
|||||||
'/^changelog\/[0-9]+\/?$/' => array('subtopic' => 'changelog', 'page' => '$1'),
|
'/^changelog\/[0-9]+\/?$/' => array('subtopic' => 'changelog', 'page' => '$1'),
|
||||||
'/^commands\/add\/?$/' => array('subtopic' => 'commands', 'action' => 'add'),
|
'/^commands\/add\/?$/' => array('subtopic' => 'commands', 'action' => 'add'),
|
||||||
'/^commands\/edit\/?$/' => array('subtopic' => 'commands', 'action' => 'edit'),
|
'/^commands\/edit\/?$/' => array('subtopic' => 'commands', 'action' => 'edit'),
|
||||||
|
'/^creatures\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'creatures', 'creature' => '$1'),
|
||||||
'/^faq\/add\/?$/' => array('subtopic' => 'faq', 'action' => 'add'),
|
'/^faq\/add\/?$/' => array('subtopic' => 'faq', 'action' => 'add'),
|
||||||
'/^faq\/edit\/?$/' => array('subtopic' => 'faq', 'action' => 'edit'),
|
'/^faq\/edit\/?$/' => array('subtopic' => 'faq', 'action' => 'edit'),
|
||||||
'/^forum\/add_board\/?$/' => array('subtopic' => 'forum', 'action' => 'add_board'),#
|
'/^forum\/add_board\/?$/' => array('subtopic' => 'forum', 'action' => 'add_board'),#
|
||||||
|
@ -95,6 +95,16 @@ function getPlayerLink($name, $generate = true)
|
|||||||
return generateLink($url, $name);
|
return generateLink($url, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getMonsterLink($name, $generate = true)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$url = BASE_URL . ($config['friendly_urls'] ? '' : '?') . 'creatures/' . urlencode($name);
|
||||||
|
|
||||||
|
if(!$generate) return $url;
|
||||||
|
return generateLink($url, $name);
|
||||||
|
}
|
||||||
|
|
||||||
function getHouseLink($name, $generate = true)
|
function getHouseLink($name, $generate = true)
|
||||||
{
|
{
|
||||||
global $db, $config;
|
global $db, $config;
|
||||||
@ -154,6 +164,23 @@ function getItemImage($id, $count = 1)
|
|||||||
return '<img src="' . $config['item_images_url'] . $file_name . config('item_images_extension') . '"' . $tooltip . ' width="32" height="32" border="0" alt="' .$id . '" />';
|
return '<img src="' . $config['item_images_url'] . $file_name . config('item_images_extension') . '"' . $tooltip . ' width="32" height="32" border="0" alt="' .$id . '" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getItemRarity($chance) {
|
||||||
|
if ($chance >= 21) {
|
||||||
|
return "common";
|
||||||
|
} elseif (between($chance, 8, 21)) {
|
||||||
|
return "uncommon";
|
||||||
|
} elseif (between($chance, 1.1, 8)) {
|
||||||
|
return "semi rare";
|
||||||
|
} elseif (between($chance, 0.4, 1.1)) {
|
||||||
|
return "rare";
|
||||||
|
} elseif (between($chance, 0.8, 0.4)) {
|
||||||
|
return "very rare";
|
||||||
|
} elseif ($chance <= 0.8) {
|
||||||
|
return "extremely rare";
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
function getFlagImage($country)
|
function getFlagImage($country)
|
||||||
{
|
{
|
||||||
if(!isset($country[0]))
|
if(!isset($country[0]))
|
||||||
@ -1309,6 +1336,7 @@ function getPlayerNameByAccount($id)
|
|||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function echo_success($message)
|
function echo_success($message)
|
||||||
{
|
{
|
||||||
echo '<div class="col-12 success mb-2">' . $message . '</div>';
|
echo '<div class="col-12 success mb-2">' . $message . '</div>';
|
||||||
@ -1357,6 +1385,29 @@ function Outfits_loadfromXML()
|
|||||||
return array('id' => $looktype, 'type' => $type, 'name' => $lookname, 'premium' => $premium, 'unlocked' => $unlocked, 'enabled' => $enabled);
|
return array('id' => $looktype, 'type' => $type, 'name' => $lookname, 'premium' => $premium, 'unlocked' => $unlocked, 'enabled' => $enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function left($str, $length) {
|
||||||
|
return substr($str, 0, $length);
|
||||||
|
}
|
||||||
|
|
||||||
|
function right($str, $length) {
|
||||||
|
return substr($str, -$length);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCreatureImgPath($creature){
|
||||||
|
$creature_path = config('creature_images_url');
|
||||||
|
$creature_gfx_name = trim(strtolower($creature)) . config('creature_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;
|
||||||
|
} else {
|
||||||
|
return $creature_path . 'nophoto.png';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $creature_path . $creature_gfx_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// validator functions
|
// validator functions
|
||||||
require_once LIBS . 'validator.php';
|
require_once LIBS . 'validator.php';
|
||||||
require_once SYSTEM . 'compat.php';
|
require_once SYSTEM . 'compat.php';
|
||||||
|
@ -79,6 +79,8 @@ class Creatures {
|
|||||||
|
|
||||||
//load race
|
//load race
|
||||||
$race = $monster->getRace();
|
$race = $monster->getRace();
|
||||||
|
$armor = $monster->getArmor();
|
||||||
|
$defensev = $monster->getDefense();
|
||||||
|
|
||||||
//load monster flags
|
//load monster flags
|
||||||
$flags = $monster->getFlags();
|
$flags = $monster->getFlags();
|
||||||
@ -87,6 +89,28 @@ class Creatures {
|
|||||||
if(!isset($flags['convinceable']))
|
if(!isset($flags['convinceable']))
|
||||||
$flags['convinceable'] = '0';
|
$flags['convinceable'] = '0';
|
||||||
|
|
||||||
|
if(!isset($flags['pushable']))
|
||||||
|
$flags['pushable'] = '0';
|
||||||
|
if(!isset($flags['canpushitems']))
|
||||||
|
$flags['canpushitems'] = '0';
|
||||||
|
if(!isset($flags['canpushcreatures']))
|
||||||
|
$flags['canpushcreatures'] = '0';
|
||||||
|
if(!isset($flags['runonhealth']))
|
||||||
|
$flags['runonhealth'] = '0';
|
||||||
|
if(!isset($flags['canwalkonenergy']))
|
||||||
|
$flags['canwalkonenergy'] = '0';
|
||||||
|
if(!isset($flags['canwalkonpoison']))
|
||||||
|
$flags['canwalkonpoison'] = '0';
|
||||||
|
if(!isset($flags['canwalkonfire']))
|
||||||
|
$flags['canwalkonfire'] = '0';
|
||||||
|
if(!isset($flags['hostile']))
|
||||||
|
$flags['hostile'] = '0';
|
||||||
|
if(!isset($flags['attackable']))
|
||||||
|
$flags['attackable'] = '0';
|
||||||
|
if(!isset($flags['rewardboss']))
|
||||||
|
$flags['rewardboss'] = '0';
|
||||||
|
|
||||||
|
$summons = $monster->getSummons();
|
||||||
$loot = $monster->getLoot();
|
$loot = $monster->getLoot();
|
||||||
foreach($loot as &$item) {
|
foreach($loot as &$item) {
|
||||||
if(!Validator::number($item['id'])) {
|
if(!Validator::number($item['id'])) {
|
||||||
@ -105,11 +129,25 @@ class Creatures {
|
|||||||
'speed_lvl' => $speed_lvl,
|
'speed_lvl' => $speed_lvl,
|
||||||
'use_haste' => $use_haste,
|
'use_haste' => $use_haste,
|
||||||
'voices' => json_encode($monster->getVoices()),
|
'voices' => json_encode($monster->getVoices()),
|
||||||
'immunities' => json_encode($monster->getImmunities()),
|
'immunities' => json_encode($monster->getImmunities()),
|
||||||
|
'elements' => json_encode($monster->getElements()),
|
||||||
'summonable' => $flags['summonable'] > 0 ? 1 : 0,
|
'summonable' => $flags['summonable'] > 0 ? 1 : 0,
|
||||||
'convinceable' => $flags['convinceable'] > 0 ? 1 : 0,
|
'convinceable' => $flags['convinceable'] > 0 ? 1 : 0,
|
||||||
|
'pushable' => $flags['pushable'] > 0 ? 1 : 0,
|
||||||
|
'canpushitems' => $flags['canpushitems'] > 0 ? 1 : 0,
|
||||||
|
'canpushcreatures' => $flags['canpushcreatures'] > 0 ? 1 : 0,
|
||||||
|
'runonhealth' => $flags['runonhealth'] > 0 ? 1 : 0,
|
||||||
|
'canwalkonenergy' => $flags['canwalkonenergy'] > 0 ? 1 : 0,
|
||||||
|
'canwalkonpoison' => $flags['canwalkonpoison'] > 0 ? 1 : 0,
|
||||||
|
'canwalkonfire' => $flags['canwalkonfire'] > 0 ? 1 : 0,
|
||||||
|
'hostile' => $flags['hostile'] > 0 ? 1 : 0,
|
||||||
|
'attackable' => $flags['attackable'] > 0 ? 1 : 0,
|
||||||
|
'rewardboss' => $flags['rewardboss'] > 0 ? 1 : 0,
|
||||||
|
'defense' => $defensev,
|
||||||
|
'armor' => $armor,
|
||||||
'race' => $race,
|
'race' => $race,
|
||||||
'loot' => json_encode($loot)
|
'loot' => json_encode($loot),
|
||||||
|
'summons' => json_encode($summons)
|
||||||
));
|
));
|
||||||
|
|
||||||
if($show) {
|
if($show) {
|
||||||
@ -136,4 +174,4 @@ class Creatures {
|
|||||||
public static function getLastError() {
|
public static function getLastError() {
|
||||||
return self::$lastError;
|
return self::$lastError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for monsters files DOMDocument.
|
* Wrapper for monsters files DOMDocument.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Note: as this class extends {@link http://www.php.net/manual/en/ref.dom.php DOMDocument class} and contains exacly file XML tree you can work on it as on normal DOM tree.
|
* Note: as this class extends {@link http://www.php.net/manual/en/ref.dom.php DOMDocument class} and contains exacly file XML tree you can work on it as on normal DOM tree.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @package POT
|
* @package POT
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @property-read string $name Monster name.
|
* @property-read string $name Monster name.
|
||||||
@ -44,14 +44,14 @@ class OTS_Monster extends DOMDocument
|
|||||||
{
|
{
|
||||||
$this->loaded = parent::loadXML($source, $options);
|
$this->loaded = parent::loadXML($source, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function loaded()
|
public function loaded()
|
||||||
{
|
{
|
||||||
return $this->loaded;
|
return $this->loaded;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns monster name.
|
* Returns monster name.
|
||||||
*
|
*
|
||||||
* @return string Name.
|
* @return string Name.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
@ -62,7 +62,7 @@ class OTS_Monster extends DOMDocument
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns monster race.
|
* Returns monster race.
|
||||||
*
|
*
|
||||||
* @return string Race.
|
* @return string Race.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
@ -73,7 +73,7 @@ class OTS_Monster extends DOMDocument
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns amount of experience for killing this monster.
|
* Returns amount of experience for killing this monster.
|
||||||
*
|
*
|
||||||
* @return int Experience points.
|
* @return int Experience points.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
@ -84,7 +84,7 @@ class OTS_Monster extends DOMDocument
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns monster speed.
|
* Returns monster speed.
|
||||||
*
|
*
|
||||||
* @return int Speed.
|
* @return int Speed.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
@ -95,7 +95,7 @@ class OTS_Monster extends DOMDocument
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns amount of mana required to summon this monster.
|
* Returns amount of mana required to summon this monster.
|
||||||
*
|
*
|
||||||
* @return int|bool Mana required (false if not possible).
|
* @return int|bool Mana required (false if not possible).
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
@ -114,7 +114,7 @@ class OTS_Monster extends DOMDocument
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns monster HP.
|
* Returns monster HP.
|
||||||
*
|
*
|
||||||
* @return int Hit points.
|
* @return int Hit points.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
@ -125,7 +125,7 @@ class OTS_Monster extends DOMDocument
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all monster flags (in format flagname => value).
|
* Returns all monster flags (in format flagname => value).
|
||||||
*
|
*
|
||||||
* @return array Flags.
|
* @return array Flags.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
@ -146,7 +146,7 @@ class OTS_Monster extends DOMDocument
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns specified flag value.
|
* Returns specified flag value.
|
||||||
*
|
*
|
||||||
* @param string $flag Flag.
|
* @param string $flag Flag.
|
||||||
* @return int|bool Flag value (false if not set).
|
* @return int|bool Flag value (false if not set).
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
@ -169,7 +169,7 @@ class OTS_Monster extends DOMDocument
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns voices that monster can sound.
|
* Returns voices that monster can sound.
|
||||||
*
|
*
|
||||||
* @return array List of voices.
|
* @return array List of voices.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
@ -214,17 +214,17 @@ class OTS_Monster extends DOMDocument
|
|||||||
$chance = 100000;
|
$chance = 100000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$count = $item->getAttribute('countmax');
|
$count = $item->getAttribute('countmax');
|
||||||
if(empty($count)) {
|
if(empty($count)) {
|
||||||
$count = 1;
|
$count = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = $item->getAttribute('id');
|
$id = $item->getAttribute('id');
|
||||||
if(empty($id)) {
|
if(empty($id)) {
|
||||||
$id = $item->getAttribute('name');
|
$id = $item->getAttribute('name');
|
||||||
}
|
}
|
||||||
|
|
||||||
$loot[] = array('id' => $id, 'count' => $count, 'chance' => $chance);
|
$loot[] = array('id' => $id, 'count' => $count, 'chance' => $chance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -234,11 +234,11 @@ class OTS_Monster extends DOMDocument
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all possible loot.
|
* Returns all possible loot.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* In order to use this method you have to have global items list loaded.
|
* In order to use this method you have to have global items list loaded.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @return array List of item types.
|
* @return array List of item types.
|
||||||
@ -273,9 +273,95 @@ class OTS_Monster extends DOMDocument
|
|||||||
return $loot;
|
return $loot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all monster summons.
|
||||||
|
*
|
||||||
|
* @return array elements.
|
||||||
|
* @throws DOMException On DOM operation error.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getSummons()
|
||||||
|
{
|
||||||
|
$summons = array();
|
||||||
|
|
||||||
|
$element = $this->documentElement->getElementsByTagName('summons')->item(0);
|
||||||
|
|
||||||
|
// checks if it has any Summons
|
||||||
|
if( isset($element) )
|
||||||
|
{
|
||||||
|
// adds all summons
|
||||||
|
foreach( $element->getElementsByTagName('summon') as $item)
|
||||||
|
{
|
||||||
|
$chance = $item->getAttribute('chance');
|
||||||
|
$id = $item->getAttribute('name');
|
||||||
|
$summons[] = array('name' => $id, 'chance' => $chance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $summons;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all monster elements.
|
||||||
|
*
|
||||||
|
* @return array elements.
|
||||||
|
* @throws DOMException On DOM operation error.
|
||||||
|
*/
|
||||||
|
public function getElements()
|
||||||
|
{
|
||||||
|
$elements = array();
|
||||||
|
|
||||||
|
$element = $this->documentElement->getElementsByTagName('elements')->item(0);
|
||||||
|
|
||||||
|
// checks if it has any elements
|
||||||
|
if( isset($element) )
|
||||||
|
{
|
||||||
|
// read all elements
|
||||||
|
foreach( $element->getElementsByTagName('element') as $elementv)
|
||||||
|
{
|
||||||
|
$elementv = $elementv->attributes->item(0);
|
||||||
|
|
||||||
|
// checks if element is set
|
||||||
|
if($elementv->nodeValue > 0)
|
||||||
|
{
|
||||||
|
$elements[] = array('name' => ucfirst(str_replace('Percent', '', $elementv->nodeName)), 'percent' => $elementv->nodeValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if monster has given element.
|
||||||
|
*
|
||||||
|
* @param string $name element to check.
|
||||||
|
* @return bool element state.
|
||||||
|
* @throws DOMException On DOM operation error.
|
||||||
|
*/
|
||||||
|
public function hasElement($name)
|
||||||
|
{
|
||||||
|
$element = $this->documentElement->getElementsByTagName('elements')->item(0);
|
||||||
|
|
||||||
|
// if doesn't have any elements obviously doesn't have this one too
|
||||||
|
if( isset($element) )
|
||||||
|
{
|
||||||
|
// read all elements
|
||||||
|
foreach( $element->getElementsByTagName('element') as $element)
|
||||||
|
{
|
||||||
|
// checks if this is what we are searching for
|
||||||
|
if( $element->hasAttribute($name) )
|
||||||
|
{
|
||||||
|
return $element->getAttribute($name) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all monster immunities.
|
* Returns all monster immunities.
|
||||||
*
|
*
|
||||||
* @return array Immunities.
|
* @return array Immunities.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
@ -306,7 +392,7 @@ class OTS_Monster extends DOMDocument
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if monster has given immunity.
|
* Checks if monster has given immunity.
|
||||||
*
|
*
|
||||||
* @param string $name Immunity to check.
|
* @param string $name Immunity to check.
|
||||||
* @return bool Immunity state.
|
* @return bool Immunity state.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
@ -334,7 +420,7 @@ class OTS_Monster extends DOMDocument
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns monster defense rate.
|
* Returns monster defense rate.
|
||||||
*
|
*
|
||||||
* @return int Defense rate.
|
* @return int Defense rate.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
@ -353,7 +439,7 @@ class OTS_Monster extends DOMDocument
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns monster armor.
|
* Returns monster armor.
|
||||||
*
|
*
|
||||||
* @return int Armor rate.
|
* @return int Armor rate.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
@ -372,7 +458,7 @@ class OTS_Monster extends DOMDocument
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of special defenses.
|
* Returns list of special defenses.
|
||||||
*
|
*
|
||||||
* @return array List of defense effects.
|
* @return array List of defense effects.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
@ -396,7 +482,7 @@ class OTS_Monster extends DOMDocument
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of monster attacks.
|
* Returns list of monster attacks.
|
||||||
*
|
*
|
||||||
* @return array List of attafck effects.
|
* @return array List of attafck effects.
|
||||||
* @throws DOMException On DOM operation error.
|
* @throws DOMException On DOM operation error.
|
||||||
*/
|
*/
|
||||||
@ -420,7 +506,7 @@ class OTS_Monster extends DOMDocument
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic PHP5 method.
|
* Magic PHP5 method.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @param string $name Property name.
|
* @param string $name Property name.
|
||||||
@ -481,11 +567,11 @@ class OTS_Monster extends DOMDocument
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns string representation of XML.
|
* Returns string representation of XML.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* If any display driver is currently loaded then it uses it's method. Otherwise just returns monster XML content.
|
* If any display driver is currently loaded then it uses it's method. Otherwise just returns monster XML content.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @return string String representation of object.
|
* @return string String representation of object.
|
||||||
|
18
system/migrations/31.php
Normal file
18
system/migrations/31.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if(!$db->hasColumn(TABLE_PREFIX . 'monsters', 'elements')) {
|
||||||
|
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `elements` TEXT NOT NULL DEFAULT '' AFTER `immunities`;");
|
||||||
|
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `pushable` TINYINT(1) NOT NULL DEFAULT '0' AFTER `convinceable`;");
|
||||||
|
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `canpushitems` TINYINT(1) NOT NULL DEFAULT '0' AFTER `pushable`;");
|
||||||
|
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `canpushcreatures` TINYINT(1) NOT NULL DEFAULT '0' AFTER `canpushitems`;");
|
||||||
|
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `canwalkonenergy` TINYINT(1) NOT NULL DEFAULT '0' AFTER `canpushitems`;");
|
||||||
|
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `canwalkonpoison` TINYINT(1) NOT NULL DEFAULT '0' AFTER `canwalkonenergy`;");
|
||||||
|
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `canwalkonfire` TINYINT(1) NOT NULL DEFAULT '0' AFTER `canwalkonpoison`;");
|
||||||
|
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `runonhealth` TINYINT(1) NOT NULL DEFAULT '0' AFTER `canwalkonfire`;");
|
||||||
|
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `hostile` TINYINT(1) NOT NULL DEFAULT '0' AFTER `runonhealth`;");
|
||||||
|
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `attackable` TINYINT(1) NOT NULL DEFAULT '0' AFTER `hostile`;");
|
||||||
|
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `rewardboss` TINYINT(1) NOT NULL DEFAULT '0' AFTER `attackable`;");
|
||||||
|
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `defense` INT(11) NOT NULL DEFAULT '0' AFTER `rewardboss`;");
|
||||||
|
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `armor` INT(11) NOT NULL DEFAULT '0' AFTER `defense`;");
|
||||||
|
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `summons` TEXT NOT NULL DEFAULT '' AFTER `loot`;");
|
||||||
|
}
|
@ -5,149 +5,71 @@
|
|||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Gesior <jerzyskalski@wp.pl>
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
* @copyright 2019 MyAAC
|
* @author Lee
|
||||||
|
* @copyright 2020 MyAAC
|
||||||
* @link https://my-aac.org
|
* @link https://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
$title = "Creatures";
|
$title = "Creatures";
|
||||||
|
|
||||||
?>
|
|
||||||
<script type="text/javascript" src="tools/js/tipped.js"></script>
|
|
||||||
<link rel="stylesheet" type="text/css" href="tools/css/tipped.css"/>
|
|
||||||
<link rel="stylesheet" href="<?php echo BASE_URL; ?>tools/css/datatables.min.css">
|
|
||||||
|
|
||||||
<script>
|
|
||||||
$(document).ready(function () {
|
|
||||||
Tipped.create('.item_image');
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
if (empty($_REQUEST['creature'])) {
|
if (empty($_REQUEST['creature'])) {
|
||||||
//send query to database
|
$creatures = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 '.(empty($_REQUEST['boss']) ? '': 'AND `rewardboss` = 1').' ORDER BY name asc');
|
||||||
$monsters = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 ORDER BY name asc');
|
$twig->display('creatures.html.twig', array(
|
||||||
echo '<table id="creaturestb" class=""><thead>
|
'creatures' => $creatures->fetchAll(),
|
||||||
<tr role="row"><th>Name</th><th>Health</th><th>Experience</th>
|
'preview' => config('creature_images_preview'),
|
||||||
<th>Summonable Mana</th><th>Convinceable Mana</th><th>Race</th></tr>
|
));
|
||||||
</thead><tbody>';
|
|
||||||
|
|
||||||
foreach ($monsters as $monster) {
|
|
||||||
echo '<tr><td><a href="?subtopic=creatures&creature=' . urlencode($monster['name']) . '">' . $monster['name'] . '</a></td>
|
|
||||||
<td>' . $monster['health'] . '</td>
|
|
||||||
<td>' . $monster['exp'] . '</td>
|
|
||||||
<td>' . ($monster['summonable'] ? $monster['mana'] : "---") . '</td>
|
|
||||||
<td>' . ($monster['convinceable'] ? $monster['mana'] : "---") . '</td>
|
|
||||||
<td>' . ucwords($monster['race']) . '</td></tr>';
|
|
||||||
}
|
|
||||||
echo '</tbody></table>';
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$monster_name = stripslashes(trim(ucwords($_REQUEST['creature'])));
|
$creature_name = urldecode(stripslashes(ucwords(strtolower($_REQUEST['creature']))));
|
||||||
$monster = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 AND `name` = ' . $db->quote($monster_name) . ';')->fetch();
|
$prep = $db->prepare('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 AND `name` = ? LIMIT 1;');
|
||||||
if (isset($monster['name'])) {
|
$prep->execute([$creature_name]);
|
||||||
$title = $monster['name'] . " - Creatures";
|
$creature = $prep->fetch();
|
||||||
|
|
||||||
echo '<div style="text-align:center"><h2>' . $monster['name'] . '</h2></div>';
|
if (isset($creature['name'])) {
|
||||||
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><tr><td>
|
function sort_by_chance($a, $b)
|
||||||
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=60%>';
|
{
|
||||||
$number_of_rows = 0;
|
if ($a['chance'] == $b['chance']) {
|
||||||
echo '<tr BGCOLOR="' . getStyle($number_of_rows) . '"><td width="100"><b>Health: </b></td><td>' . $monster['health'] . '</td></tr>';
|
return 0;
|
||||||
$number_of_rows++;
|
|
||||||
echo '<tr BGCOLOR="' . getStyle($number_of_rows) . '"><td width="100"><b>Experience: </b></td><td>' . $monster['exp'] . '</td></tr>';
|
|
||||||
$number_of_rows++;
|
|
||||||
echo '<tr BGCOLOR="' . getStyle($number_of_rows) . '"><td width="100"><b>Speed like: </b></td><td>' . $monster['speed_lvl'] . ' level';
|
|
||||||
$number_of_rows++;
|
|
||||||
if ($monster['use_haste'])
|
|
||||||
echo ' (Can use haste)';
|
|
||||||
|
|
||||||
echo '</td></tr>';
|
|
||||||
|
|
||||||
$number_of_rows++;
|
|
||||||
if ($monster['summonable'] == 1)
|
|
||||||
echo '<tr BGCOLOR="' . getStyle($number_of_rows) . '"><td width="100"><b>Summon: </b></td><td>' . $monster['mana'] . ' mana</td></tr>';
|
|
||||||
else {
|
|
||||||
echo '<tr BGCOLOR="' . getStyle($number_of_rows) . '"><td width="100"><b>Summon: </b></td><td>Impossible</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$number_of_rows++;
|
|
||||||
if ($monster['convinceable'] == 1)
|
|
||||||
echo '<tr BGCOLOR="' . getStyle($number_of_rows) . '"><td width="100"><b>Convince: </b></td><td>' . $monster['mana'] . ' mana</td></tr>';
|
|
||||||
else
|
|
||||||
echo '<tr BGCOLOR="' . getStyle($number_of_rows) . '"><td width="100"><b>Convince: </b></td><td>Impossible</td></tr>';
|
|
||||||
|
|
||||||
echo '</TABLE></td><td align=left>
|
|
||||||
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=40%>
|
|
||||||
<tr><td align=left>';
|
|
||||||
$monster['gfx_name'] = trim(strtolower($monster['name'])) . ".gif";
|
|
||||||
if (!file_exists('images/monsters/' . $monster['gfx_name'])) {
|
|
||||||
$gfx_name = str_replace(" ", "", $monster['gfx_name']);
|
|
||||||
if (file_exists('images/monsters/' . $gfx_name))
|
|
||||||
echo '<img src="images/monsters/' . $gfx_name . '" height="128" width="128">';
|
|
||||||
else
|
|
||||||
echo '<img src="images/monsters/nophoto.png" height="128" width="128">';
|
|
||||||
} else
|
|
||||||
echo '<img src="images/monsters/' . $monster['gfx_name'] . '" height="128" width="128">';
|
|
||||||
|
|
||||||
echo '</td></tr>
|
|
||||||
</TABLE></td></tr><tr><td>
|
|
||||||
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>';
|
|
||||||
$immunities = json_decode($monster['immunities'], true);
|
|
||||||
if (count($immunities) > 0) {
|
|
||||||
$number_of_rows++;
|
|
||||||
echo '<tr BGCOLOR="' . getStyle($number_of_rows) . '"><td width="100"><b>Immunities: </b></td><td width="100%">' . implode(', ', $immunities) . '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$voices = json_decode($monster['voices'], true);
|
|
||||||
if (count($voices) > 0) {
|
|
||||||
foreach ($voices as &$voice) {
|
|
||||||
$voice = '"' . $voice . '"';
|
|
||||||
}
|
}
|
||||||
|
return ($a['chance'] > $b['chance']) ? -1 : 1;
|
||||||
$number_of_rows++;
|
|
||||||
echo '<tr BGCOLOR="' . getStyle($number_of_rows) . '"><td width="100"><b>Voices: </b></td><td width="100%">' . implode(', ', $voices) . '</td></tr>';
|
|
||||||
}
|
|
||||||
echo '</TABLE></td></tr>';
|
|
||||||
|
|
||||||
$loot = json_decode($monster['loot'], true);
|
|
||||||
if ($loot) {
|
|
||||||
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><tr><td style="display: block;">';
|
|
||||||
function sort_by_chance($a, $b)
|
|
||||||
{
|
|
||||||
if ($a['chance'] == $b['chance']) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return ($a['chance'] > $b['chance']) ? -1 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
usort($loot, 'sort_by_chance');
|
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
foreach ($loot as $item) {
|
|
||||||
$name = getItemNameById($item['id']);
|
|
||||||
$tooltip = $name . '<br/>Chance: ' . round($item['chance'] / 1000, 2) . '%<br/>Max count: ' . $item['count'];
|
|
||||||
|
|
||||||
echo '<img src="' . $config['item_images_url'] . $item['id'] . config('item_images_extension') . '" class="item_image" title="' . $tooltip . '" width="32" height="32" border="0" alt=" ' . $name . '" />';
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</td></tr></TABLE>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</td></tr>';
|
$title = $creature['name'] . " - Creatures";
|
||||||
echo '</TABLE>';
|
|
||||||
|
$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');
|
||||||
|
|
||||||
|
$loot_list = [];
|
||||||
|
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'] . (config('loot_show_percentage') ? ' ('. $item['rarity_chance'] .'%)' : '') . '<br/>Max count: ' . $item['count'];
|
||||||
|
$loot_list[] = $item;
|
||||||
|
}
|
||||||
|
|
||||||
|
$creature['loot'] = isset($loot_list) ? $loot_list : 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 {
|
} else {
|
||||||
echo "Monster with name <b>" . $monster_name . "</b> doesn't exist.";
|
echo "Creature with name <b>" . $creature_name . "</b> doesn't exist.";
|
||||||
}
|
}
|
||||||
|
|
||||||
//back button
|
//back button
|
||||||
$twig->display('creatures.back_button.html.twig');
|
$twig->display('creatures.back_button.html.twig');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<script>
|
|
||||||
$(document).ready(function () {
|
|
||||||
$('#creaturestb').DataTable();
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script src="<?php echo BASE_URL; ?>tools/js/datatables.min.js"></script>
|
|
||||||
|
164
system/templates/creature.html.twig
Normal file
164
system/templates/creature.html.twig
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
<script type="text/javascript" src="tools/js/tipped.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="tools/css/tipped.css"/>
|
||||||
|
<style>
|
||||||
|
.creature_img {
|
||||||
|
background-position: center center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
width: 64px;
|
||||||
|
height: 64px;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.creature_name {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: bold;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
float: left;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.creature_voice {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 8pt;
|
||||||
|
color: #FE6500;
|
||||||
|
text-shadow: rgb(0, 0, 0) 1px 0px 0px, rgb(0, 0, 0) 0.540302px 0.841471px 0px, rgb(0, 0, 0) -0.416147px 0.909297px 0px, rgb(0, 0, 0) -0.989992px 0.14112px 0px, rgb(0, 0, 0) -0.653644px -0.756802px 0px, rgb(0, 0, 0) 0.283662px -0.958924px 0px, rgb(0, 0, 0) 0.96017px -0.279415px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loot_image {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
border: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loot_amount {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
right: 2px;
|
||||||
|
color: white;
|
||||||
|
font-size: 8pt;
|
||||||
|
font-weight: bold;
|
||||||
|
text-shadow: 0.1em 0.1em black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loot_bg {
|
||||||
|
margin: 2px;
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
float: left;
|
||||||
|
background-image: url('{{ constant('BASE_URL') }}images/items/empty.gif');
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loot_bg:hover {
|
||||||
|
opacity: 1.0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
Tipped.create('.loot_image');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="creature_name">{{ creature.name }}</div>
|
||||||
|
<table class="CreatureInfo" border="0" cellspacing="0" cellpadding="4" width="100%">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th align="center" colspan="4"><b>General information</b></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td width="10%">
|
||||||
|
<div class="creature_img" style="background-image: url({{ creature.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)' : '' }}
|
||||||
|
</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' }}
|
||||||
|
</td>
|
||||||
|
<td width="30%" align="center">
|
||||||
|
<strong>Armor:</strong> {{ creature.armor }}<br>
|
||||||
|
<strong>Defense:</strong> {{ creature.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%">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
{% if ( creature.summons is not empty) %}
|
||||||
|
<th width="50%"><b>Summons</b></th>
|
||||||
|
{% endif %}
|
||||||
|
{% if ( creature.voices is not empty) %}
|
||||||
|
<th width="50%"><b>Voices</b></th>
|
||||||
|
{% endif %}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
{% if ( creature.summons is not empty) %}
|
||||||
|
<td>
|
||||||
|
{% for summon in creature.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) %}
|
||||||
|
<td align="center">
|
||||||
|
<span class="creature_voice">
|
||||||
|
{% for voice in creature.voices %}
|
||||||
|
"{{ voice }}"<br/>
|
||||||
|
{% endfor %}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table><br/>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if (creature.elements|length > 0 or creature.immunities|length > 0 ) %}
|
||||||
|
<table class="CreatureElements" border="0" cellspacing="0" cellpadding="4" width="100%">
|
||||||
|
<tr>
|
||||||
|
<th colspan="{{ creature.elements|length }}">Elements and Immunities</th>
|
||||||
|
</tr>
|
||||||
|
{% if (creature.elements|length > 0) %}
|
||||||
|
<tr>{% for element in creature.elements %}
|
||||||
|
<td align="center"><b> {{ element.name }}</b><br/>{{ element.percent }}%</td>
|
||||||
|
{% endfor %}</tr>
|
||||||
|
{% endif %}
|
||||||
|
{% if (creature.immunities|length > 0 ) %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="{{ creature.elements|length }}"><b>Immunities:</b> {{ creature.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%">
|
||||||
|
<tr><th>Loot</th></tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{% for item in creature.loot %}
|
||||||
|
<span class="loot_bg">
|
||||||
|
{% if (item.count > 1) %}
|
||||||
|
<span class="loot_amount">{{ item.count }}</span>
|
||||||
|
{% endif %}
|
||||||
|
<a href="{{ config.items_url }}{{ item.name|title }}"><img title="{{ item.tooltip }}" src="{{ config.item_images_url }}{{ item.id }}{{ config.item_images_extension }}" class="loot_image"/></a>
|
||||||
|
</span>
|
||||||
|
{% endfor %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
{% endif %}
|
97
system/templates/creatures.html.twig
Normal file
97
system/templates/creatures.html.twig
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
{% if creatures is not empty %}
|
||||||
|
|
||||||
|
{% if preview %}
|
||||||
|
<style>
|
||||||
|
.creatureImages {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
margin: 0px;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.creatureBoss {
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 1px rgba(179, 179, 179, 0.50) solid;
|
||||||
|
background-color: rgba(235, 235, 235, 0.50);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function () {
|
||||||
|
$("#ciSearch").on("keyup", function () {
|
||||||
|
var value = $(this).val().toLowerCase();
|
||||||
|
$("#creatureiTable div").filter(function () {
|
||||||
|
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</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 %}
|
||||||
|
{% 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="{{ getCreatureImgPath(creature.name) }}" border="0"/>
|
||||||
|
</a>
|
||||||
|
<div>{{ creature.name }}</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function () {
|
||||||
|
$("#cSearch").on("keyup", function () {
|
||||||
|
var value = $(this).val().toLowerCase();
|
||||||
|
$("#creatureTable tr").filter(function () {
|
||||||
|
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{{ generateLink('?creatures', 'All', false)|raw }} - <a href="?subtopic=creatures&boss=view">Bosses</a>
|
||||||
|
<div style="float: right;"><input id="cSearch" type="text" placeholder="Search.."></div>
|
||||||
|
<table width="100%">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Boss</th>
|
||||||
|
<th>Health</th>
|
||||||
|
<th>Experience</th>
|
||||||
|
<th>Summonable Mana</th>
|
||||||
|
<th>Convinceable Mana</th>
|
||||||
|
<th>Race</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="creatureTable">
|
||||||
|
{% set i = 0 %}
|
||||||
|
{% for creature in creatures %}
|
||||||
|
{% 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>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% endif %}
|
||||||
|
<script src="tools/js/jquery.min.js"></script>
|
||||||
|
{% else %}
|
||||||
|
<table width="100%">
|
||||||
|
<tr>
|
||||||
|
<th>Creatures</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>No Creatures on the server.</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
{% endif %}
|
||||||
|
|
@ -24,16 +24,31 @@ $function = new TwigFunction('getStyle', function ($i) {
|
|||||||
});
|
});
|
||||||
$twig->addFunction($function);
|
$twig->addFunction($function);
|
||||||
|
|
||||||
|
$function = new TwigFunction('getCreatureImgPath', function ($i) {
|
||||||
|
return getCreatureImgPath($i);
|
||||||
|
});
|
||||||
|
$twig->addFunction($function);
|
||||||
|
|
||||||
$function = new TwigFunction('getLink', function ($s) {
|
$function = new TwigFunction('getLink', function ($s) {
|
||||||
return getLink($s);
|
return getLink($s);
|
||||||
});
|
});
|
||||||
$twig->addFunction($function);
|
$twig->addFunction($function);
|
||||||
|
|
||||||
|
$function = new TwigFunction('generateLink', function ($s, $n, $b = false) {
|
||||||
|
return generateLink($s, $n, $b);
|
||||||
|
});
|
||||||
|
$twig->addFunction($function);
|
||||||
|
|
||||||
$function = new TwigFunction('getPlayerLink', function ($s, $p) {
|
$function = new TwigFunction('getPlayerLink', function ($s, $p) {
|
||||||
return getPlayerLink($s, $p);
|
return getPlayerLink($s, $p);
|
||||||
});
|
});
|
||||||
$twig->addFunction($function);
|
$twig->addFunction($function);
|
||||||
|
|
||||||
|
$function = new TwigFunction('getMonsterLink', function ($s, $p) {
|
||||||
|
return getMonsterLink($s, $p);
|
||||||
|
});
|
||||||
|
$twig->addFunction($function);
|
||||||
|
|
||||||
$function = new TwigFunction('getGuildLink', function ($s, $p) {
|
$function = new TwigFunction('getGuildLink', function ($s, $p) {
|
||||||
return getGuildLink($s, $p);
|
return getGuildLink($s, $p);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user