mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 09:44:55 +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:
@@ -95,6 +95,16 @@ function getPlayerLink($name, $generate = true)
|
||||
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)
|
||||
{
|
||||
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 . '" />';
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if(!isset($country[0]))
|
||||
@@ -1309,6 +1336,7 @@ function getPlayerNameByAccount($id)
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function echo_success($message)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
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
|
||||
require_once LIBS . 'validator.php';
|
||||
require_once SYSTEM . 'compat.php';
|
||||
|
Reference in New Issue
Block a user