- implemented tooltips for NPCs

- global STATIC_URL defined to be also usable in script
This commit is contained in:
Sarjuuk
2013-06-01 16:56:05 +02:00
parent 8a11a3d459
commit aef069e919
16 changed files with 185 additions and 85 deletions

View File

@@ -6,6 +6,11 @@ if (!defined('AOWOW_REVISION'))
class CreatureList extends BaseType
{
public $tooltips = [];
protected $setupQuery = 'SELECT *, ct.entry AS ARRAY_KEY, ct.entry AS id FROM creature_template ct LEFT JOIN locales_creature lc ON lc.entry = ct.entry LEFT JOIN creature_template_addon cta on cta.entry = ct.entry WHERE [filter] [cond]';
protected $matchQuery = 'SELECT COUNT(*) FROM creature_template ct WHERE [filter] [cond]';
public static function getName($id)
{
$n = DB::Aowow()->SelectRow('
@@ -28,10 +33,58 @@ class CreatureList extends BaseType
return Util::localizedString($n, 'name');
}
public function renderTooltip()
{
if (!$this->curTpl)
return null;
if (isset($this->tooltips[$this->id]))
return $this->tooltips[$this->id];
$level = '??';
$type = $this->curTpl['type'];
$row3 = [Lang::$game['level']];
$fam = $this->curTpl['family'];
// todo (low): rework, when factions are implemented
$fac = DB::Aowow()->selectRow('SELECT * FROM dbc.faction f JOIN dbc.factionTemplate ft ON f.id = ft.factionId WHERE ft.id = ?d AND NOT f.reputationFlags1 & 0x4 AND f.reputationIndex <> -1', $this->curTpl['faction_A']);
if (!($this->curTpl['type_flags'] & 0x4))
{
$level = $this->curTpl['minlevel'];
if ($level != $this->curTpl['maxlevel'])
$level .= ' - '.$this->curTpl['maxlevel'];
}
$row3[] = $level;
if ($type)
$row3[] = Lang::$game['ct'][$type];
$row3[] = '('.Lang::$npc['rank'][$this->curTpl['rank']].')';
$x = '<table>';
$x .= '<tr><td><b class="q">'.$this->getField('name', true).'</b></td></tr>';
if ($sn = $this->getField('subname', true))
$x .= '<tr><td>'.$sn.'</td></tr>';
$x .= '<tr><td>'.implode(' ', $row3).'</td></tr>';
if ($type == 1 && $fam) // 1: Beast
$x .= '<tr><td>'.Lang::$game['fa'][$fam].'</td></tr>';
if ($fac)
$x .= '<tr><td>'.Util::localizedString($fac, 'name').'</td></tr>';
$x .= '</table>';
$this->tooltips[$this->id] = $x;
return $x;
}
public function getListviewData() { }
public function addGlobalsToJScript(&$refs) { }
public function addRewardsToJScript(&$refs) { }
public function renderTooltip() { }
}

View File

@@ -228,7 +228,7 @@ abstract class Filter
// if called with POST-data, convert to GET request and call self
private function redirect($get)
{
header('Location: http://'.$_SERVER['SERVER_NAME'].str_replace('index.php', '', $_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING'].'='.$get);
header('Location: '.STATIC_URL.'?'.$_SERVER['QUERY_STRING'].'='.$get);
}
// TODO: wrong wrong wrong!!

View File

@@ -446,7 +446,7 @@ class ItemList extends BaseType
$pop = array_pop($enhance['gems']);
$col = $pop ? 1 : 0;
$hasMatch &= $pop ? (($gems[$pop]['colorMask'] & (1 << $colorId)) ? 1 : 0) : 0;
$icon = $pop ? sprintf(Util::$bgImagePath['tiny'], strtolower($gems[$pop]['icon'])) : null;
$icon = $pop ? sprintf(Util::$bgImagePath['tiny'], STATIC_URL, strtolower($gems[$pop]['icon'])) : null;
$text = $pop ? Util::localizedString($gems[$pop], 'text') : Lang::$item['socket'][$colorId];
if ($interactive)
@@ -460,7 +460,7 @@ class ItemList extends BaseType
{
$pop = array_pop($enhance['gems']);
$col = $pop ? 1 : 0;
$icon = $pop ? sprintf(Util::$bgImagePath['tiny'], strtolower($gems[$pop]['icon'])) : null;
$icon = $pop ? sprintf(Util::$bgImagePath['tiny'], STATIC_URL, strtolower($gems[$pop]['icon'])) : null;
$text = $pop ? Util::localizedString($gems[$pop], 'text') : Lang::$item['socket'][-1];
if ($interactive)
@@ -611,7 +611,7 @@ class ItemList extends BaseType
if ($itemset['skillId']) // bonus requires skill to activate
{
$name = DB::Aowow()->selectRow('SELECT * FROM ?_skill WHERE skillId=?d', $itemset['skillId']);
$name = DB::Aowow()->selectRow('SELECT * FROM ?_skillline WHERE Id=?d', $itemset['skillId']);
$xSet .= '<br />'.sprintf(Lang::$game['requires'], '<a href="?skills='.$itemset['skillId'].'" class="q1">'.Util::localizedString($name, 'name').'</a>');
if ($itemset['skillLevel'])

View File

@@ -12,6 +12,8 @@ require 'config/config.php';
$e = !!$AoWoWconf['debug'] ? (E_ALL & ~(E_DEPRECATED|E_USER_DEPRECATED|E_STRICT)) : 0;
error_reporting($e);
define('STATIC_URL', substr('http://'.$_SERVER['SERVER_NAME'].strtr($_SERVER['SCRIPT_NAME'], ['index.php' => '']), 0, -1));
require 'includes/Smarty-2.6.26/libs/Smarty.class.php'; // Libraray: http://www.smarty.net/
require 'includes/DbSimple/Generic.php'; // Libraray: http://en.dklab.ru/lib/DbSimple
require 'includes/utilities.php';

View File

@@ -321,8 +321,9 @@ class Lang
public static $event;
public static $item;
public static $itemset;
public static $pet;
public static $maps;
public static $npc;
public static $pet;
public static $spell;
public static $talent;
public static $title;
@@ -332,7 +333,7 @@ class Lang
public static function load($loc)
{
if (@(require 'localization/locale_'.$loc.'.php') !== 1)
if ((require 'localization/locale_'.$loc.'.php') !== 1)
die('File for localization '.$loc.' not found.');
foreach ($lang as $k => $v)
@@ -530,8 +531,7 @@ class SmartyAoWoW extends Smarty
'tab' => null, // [int] # of tab to highlight in the menu
'type' => null, // [int] numCode for spell, npc, object, ect
'typeId' => null, // [int] entry to display
'path' => '[]', // [string] (js:array) path to preselect in the menu
'gStaticUrl' => substr('http://'.$_SERVER['SERVER_NAME'].strtr($_SERVER['SCRIPT_NAME'], ['index.php' => '']), 0, -1)
'path' => '[]' // [string] (js:array) path to preselect in the menu
);
}
@@ -1329,10 +1329,10 @@ class Util
);
public static $bgImagePath = array (
'tiny' => 'style="background-image: url(images/icons/tiny/%s.gif)"',
'small' => 'style="background-image: url(images/icons/small/%s.jpg)"',
'medium' => 'style="background-image: url(images/icons/medium/%s.jpg)"',
'large' => 'style="background-image: url(images/icons/large/%s.jpg)"',
'tiny' => 'style="background-image: url(%s/images/icons/tiny/%s.gif)"',
'small' => 'style="background-image: url(%s/images/icons/small/%s.jpg)"',
'medium' => 'style="background-image: url(%s/images/icons/medium/%s.jpg)"',
'large' => 'style="background-image: url(%s/images/icons/large/%s.jpg)"',
);
private static $execTime = 0.0;

View File

@@ -147,13 +147,14 @@ $lang = array(
"Entsetzt", "Unverwundbar", "Unterbrochen", "Benommen", "Entdeckung", "Unverwundbar", "Kopfnuss", "Wütend"
),
'ct' => array(
null, "Wildtier", "Drachkin", "Dämon", "Elementar",
"Riese", "Untoter", "Humanoid", "Tier", "Mechanisch",
"Nicht kategorisiert", "Totem", "Haustier", "Gas Wolke"
"Nicht kategorisiert", "Wildtier", "Drachkin", "Dämon", "Elementar", "Riese", "Untoter", "Humanoid",
"Tier", "Mechanisch", "Nicht spezifiziert", "Totem", "Haustier", "Gas Wolke"
),
'professions' => array(
171 => "Alchemie", 164 => "Schmiedekunst", 333 => "Verzauberkunst", 202 => "Ingenieurskunst", 773 => "Inschriftenkunde", 755 => "Juwelenschleifen",
165 => "Lederverarbeitung", 186 => "Bergbau", 197 => "Schneiderei", 185 => "Kochkunst", 129 => "Erste Hilfe", 356 => "Angeln"
'fa' => array(
1 => "Wolf", 2 => "Katze", 3 => "Spinne", 4 => "Bär", 5 => "Eber", 6 => "Krokilisk", 7 => "Aasvogel", 8 => "Krebs",
9 => "Gorilla", 11 => "Raptor", 12 => "Weitschreiter", 20 => "Skorpid", 21 => "Schildkröte", 24 => "Fledermaus", 25 => "Hyäne", 26 => "Raubvogel",
27 => "Windnatter", 30 => "Drachenfalke", 31 => "Felshetzer", 32 => "Sphärenjäger", 33 => "Sporensegler", 34 => "Netherrochen", 35 => "Schlange", 37 => "Motte",
38 => "Schimäre", 39 => "Teufelssaurier", 41 => "Silithid", 42 => "Wurm", 43 => "Rhinozeros", 44 => "Wespe", 45 => "Kernhund", 46 => "Geisterbestie"
),
'pvpRank' => array(
null, "Gefreiter / Späher", "Fußknecht / Grunzer",
@@ -213,6 +214,9 @@ $lang = array(
'event' => array(
'category' => array("Nicht kategorisiert", "Feiertage", "Wiederkehrend", "Spieler vs. Spieler")
),
'npc' => array(
'rank' => ['Normal', 'Elite', 'Rar Elite', 'Boss', 'Rar']
),
'achievement' => array(
'achievements' => "Erfolge",
'criteria' => "Kriterien",

View File

@@ -142,9 +142,14 @@ $lang = array(
"Horrified", "Invulnerable", "Interrupted", "Dazed", "Discovery", "Invulnerable", "Sapped", "Enraged"
),
'ct' => array(
null, "Beast", "Dragonkin", "Demon", "Elemental",
"Giant", "Undead", "Humanoid", "Critter", "Mechanical",
"Uncategorized", "Totem", "Non-combat Pet", "Gas Cloud"
"Uncategorized", "Beast", "Dragonkin", "Demon", "Elemental", "Giant", "Undead", "Humanoid",
"Critter", "Mechanical", "Not specified", "Totem", "Non-combat Pet", "Gas Cloud"
),
'fa' => array(
1 => "Wolf", 2 => "Cat", 3 => "Spider", 4 => "Bear", 5 => "Boar", 6 => "Crocolisk", 7 => "Carrion Bird", 8 => "Crab",
9 => "Gorilla", 11 => "Raptor", 12 => "Tallstrider", 20 => "Scorpid", 21 => "Turtle", 24 => "Bat", 25 => "Hyena", 26 => "Bird of Prey",
27 => "Wind Serpent", 30 => "Dragonhawk", 31 => "Ravager", 32 => "Warp Stalker", 33 => "Sporebat", 34 => "Nether Ray", 35 => "Serpent", 37 => "Moth",
38 => "Chimaera", 39 => "Devilsaur", 41 => "Silithid", 42 => "Worm", 43 => "Rhino", 44 => "Wasp", 45 => "Core Hound", 46 => "Spirit Beast"
),
'pvpRank' => array(
null, "Private / Scout", "Corporal / Grunt",
@@ -201,6 +206,9 @@ $lang = array(
// Sign_in_to_your_Game_Account = Enter your game account:
// Please_enter_your_confirm_password = Please enter your confirm password
),
'npc' => array(
'rank' => ['Normal', 'Elite', 'Rare Elite', 'Boss', 'Rare']
),
'event' => array(
'category' => array("Uncategorized", "Holidays", "Recurring", "Player vs. Player")
),

View File

@@ -139,13 +139,15 @@ $lang = array(
"Horrorizado", "Invulnerable", "Interrumpido", "Atontado", "Descubierto", "Invulnerable", "Aporreado", "Iracundo"
),
'ct' => array(
null, "Bestia", "Dragonante", "Demonio", "Elemental",
"Gigante", "No-muerto", "Humanoide", "Alimaña", "Mecánico",
"Sin categoría", "Tótem", "Mascota mansa", "Nube de gas"
"Sin categoría", "Bestia", "Dragonante", "Demonio", "Elemental", "Gigante", "No-muerto", "Humanoide",
"Alimaña", "Mecánico", "Sin especificar", "Tótem", "Mascota mansa", "Nube de gas"
),
'professions' => array(
171 => "Alquimia", 164 => "Herrería", 333 => "Encantamiento", 202 => "Ingeniería", 773 => "Inscripción", 755 => "Joyería",
165 => "Peletería", 186 => "Minería", 197 => "Sastrería", 185 => "Cocina", 129 => "Primeros auxilios", 356 => "Pesca"
'fa' => array(
1 => "Lobo", 2 => "Felino", 3 => "Araña", 4 => "Oso", 5 => "Jabalí", 6 => "Crocolisco", 7 => "Carroñero", 8 => "Cangrejo",
9 => "Gorila", 11 => "Raptor", 12 => "Zancaalta", 20 => "Escórpido", 21 => "Tortuga", 24 => "Murciélago", 25 => "Hiena", 26 => "Ave rapaz",
27 => "Serpiente alada", 30 => "Dracohalcón", 31 => "Devastador", 32 => "Acechador deformado",33 => "Esporiélago", 34 => "Raya abisal", 35 => "Serpiente", 37 => "Palomilla",
38 => "Quimera", 39 => "Demosaurio", 41 => "Silítido", 42 => "Gusano", 43 => "Rinoceronte", 44 => "Avispa", 45 => "Can del Núcleo", 46 => "Bestia espíritu"
),
'pvpRank' => array(
null, "Private / Scout", "Corporal / Grunt",
@@ -165,6 +167,9 @@ $lang = array(
'event' => array(
'category' => array("Sin categoría", "Vacacionales", "Periódicos", "Jugador contra Jugador")
),
'npc' => array(
'rank' => ['Normal', 'Élite', 'Élite raro', 'Jefe', 'Raro']
),
'achievement' => array(
'achievements' => "logros",
'criteria' => "Requisitos",

View File

@@ -139,13 +139,14 @@ $lang = array(
"Horrifié", "Invulnérable", "Interrompu", "Hébété", "Découverte", "Invulnérable", "Assommé", "Enragé"
),
'ct' => array(
null, "Bête", "Draconien", "Démon", "Élémentaire",
"Géant", "Mort-vivant", "Humanoïde", "Bestiole", "Mécanique",
"Non classés", "Totem", "Familier pacifique", "Nuage de gaz"
"Non classés", "Bête", "Draconien", "Démon", "Élémentaire", "Géant", "Mort-vivant", "Humanoïde",
"Bestiole", "Mécanique", "Non spécifié", "Totem", "Familier pacifique", "Nuage de gaz"
),
'professions' => array(
171 => "Alchimie", 164 => "Forge", 333 => "Enchantement", 202 => "Ingénierie", 773 => "Calligraphie", 755 => "Joaillerie",
165 => "Travail du cuir", 186 => "Minage", 197 => "Couture", 185 => "Cuisine", 129 => "Secourisme", 356 => "Pêche"
'fa' => array(
1 => "Loup", 2 => "Félin", 3 => "Araignée", 4 => "Ours", 5 => "Sanglier", 6 => "Crocilisque", 7 => "Charognard", 8 => "Crabe",
9 => "Gorille", 11 => "Raptor", 12 => "Haut-trotteur", 20 => "Scorpide", 21 => "Tortue", 24 => "Chauve-souris", 25 => "Hyène", 26 => "Oiseau de proie",
27 => "Serpent des vents", 30 => "Faucon-dragon", 31 => "Ravageur", 32 => "Traqueur dim.", 33 => "Sporoptère", 34 => "Raie du Néant", 35 => "Serpent", 37 => "Phalène",
38 => "Chimère", 39 => "Diablosaure", 41 => "Silithide", 42 => "Ver", 43 => "Rhinocéros", 44 => "Guêpe", 45 => "Chien du Magma", 46 => "Esprit de bête"
),
'pvpRank' => array(
null, "Private / Scout", "Corporal / Grunt",
@@ -165,6 +166,9 @@ $lang = array(
'event' => array(
'category' => array("Non classés", "Vacances", "Récurrent", "Joueur ctr. Joueur")
),
'npc' => array(
'rank' => ['Standard', 'Élite', 'Élite rare', 'Boss', 'Rare']
),
'achievement' => array(
'achievements' => "hauts faits",
'criteria' => "Critères",
@@ -349,8 +353,8 @@ $lang = array(
)
),
'item' => array(
'armor' => "Armure :",
'block' => "Bloquer :",
'armor' => "Armure",
'block' => "Bloquer",
'charges' => "Charges",
'expend' => "expendable",
'locked' => "Verrouillé",

View File

@@ -139,13 +139,14 @@ $lang = array(
"Испуганный", "Неуязвимый", "Прервано", "Замедленный", "Открытие", "Неуязвимый", "Ошеломлён", "Исступление"
),
'ct' => array(
null, "Животное", "Дракон", "Демон", "Элементаль",
"Великан", "Нежить", "Гуманоид", "Существо", "Механизм",
"Разное", "Тотем", "Спутник", "Облако газа"
"Разное", "Животное", "Дракон", "Демон", "Элементаль", "Великан", "Нежить", "Гуманоид",
"Существо", "Механизм", "Не указано", "Тотем", "Спутник", "Облако газа"
),
'professions' => array(
171 => "Алхимия", 164 => "Кузнечное дело", 333 => "Наложение чар", 202 => "Инженерное дело", 773 => "Начертание", 755 => "Ювелирное дело",
165 => "Кожевничество", 186 => "Горное дело", 197 => "Портняжное дело", 185 => "Кулинария", 129 => "Первая помощь", 356 => "Рыбная ловля",
'fa' => array(
1 => "Волк", 2 => "Кошка", 3 => "Паук", 4 => "Медведь", 5 => "Вепрь", 6 => "Кроколиск", 7 => "Падальщик", 8 => "Краб",
9 => "Горилла", 11 => "Ящер", 12 => "Долгоног", 20 => "Скорпид", 21 => "Черепаха", 24 => "Летучая мышь", 25 => "Гиена", 26 => "Сова",
27 => "Крылатый змей", 30 => "Дракондор", 31 => "Опустошитель", 32 => "Прыгуана", 33 => "Спороскат", 34 => "Скат Пустоты", 35 => "Змей", 37 => "Мотылек",
38 => "Химера", 39 => "Дьявозавр", 41 => "Силитид", 42 => "Червь", 43 => "Люторог", 44 => "Оса", 45 => "Гончая Недр", 46 => "Дух зверя"
),
'pvpRank' => array(
null, "Private / Scout", "Corporal / Grunt",
@@ -165,6 +166,9 @@ $lang = array(
'event' => array(
'category' => array("Разное", "Праздники", "Периодические", "PvP")
),
'npc' => array(
'rank' => ['Обычный', 'Элитный', 'Редкий элитный', 'Босс', 'Редкий']
),
'achievement' => array(
'achievements' => "достижения",
'criteria' => "Критерий",

View File

@@ -19,7 +19,7 @@
{/foreach}
<script type="text/javascript">
var g_serverTime = new Date('{$smarty.now|date_format:"%Y/%m/%d %H:%M:%S"}');
var g_staticUrl = "{$page.gStaticUrl}";
var g_staticUrl = "{$smarty.const.STATIC_URL}";
</script>
<script src="template/js/basic.js?{$AOWOW_REVISION}" type="text/javascript"></script>
<script src="power/aowowPower.js?lang={$user.language|substr:2}" type="text/javascript"></script>

View File

@@ -1204,16 +1204,20 @@ var g_npc_classifications = {
};
var g_npc_types = {
0: 'Nicht kategorisiert',
1: 'Wildtier',
8: 'Tier',
2: 'Drachkin',
3: 'Dämon',
4: 'Elementar',
2: 'Drachkin',
5: 'Riese',
7: 'Humanoid',
9: 'Mechanisch',
6: 'Untot',
10: 'Nicht kategorisiert'
7: 'Humanoid',
8: 'Tier',
9: 'Mechanisch',
10: 'Nicht spezifiziert',
11: 'Totem',
12: 'Haustier',
13: 'Gaswolke'
};
var g_pet_families = {

View File

@@ -1250,6 +1250,7 @@ var g_npc_classifications = {
};
var g_npc_types = {
0: 'Uncategorized',
1: 'Beast',
8: 'Critter',
3: 'Demon',
@@ -1257,9 +1258,12 @@ var g_npc_types = {
2: 'Dragonkin',
5: 'Giant',
7: 'Humanoid',
9: 'Mechanical',
6: 'Undead',
10: 'Uncategorized'
9: 'Mechanical',
10: 'Not specified',
11: 'Totem',
12: 'Non-combat Pet',
13: 'Gas Cloud'
};
var g_pet_families = {

View File

@@ -1204,16 +1204,20 @@ var g_npc_classifications = {
};
var g_npc_types = {
0: 'Sin categoría',
1: 'Bestia',
8: 'Alimaña',
2: 'Dragonante',
3: 'Demonio',
4: 'Elemental',
2: 'Dragonante',
5: 'Gigante',
7: 'Humanoide',
9: 'Mecánico',
6: 'No-muerto',
10: 'Sin categoría'
7: 'Humanoide',
8: 'Alimaña',
9: 'Mecánico',
10: 'Sin especificar',
11: 'Tótem',
12: 'Mascota mansa',
13: 'Nube de gas'
};
var g_pet_families = {

View File

@@ -1204,16 +1204,20 @@ var g_npc_classifications = {
};
var g_npc_types = {
0: 'Non classés',
1: 'Bête',
8: 'Bestiole',
2: 'Draconien',
3: 'Démon',
4: 'Élémentaire',
2: 'Draconien',
5: 'Géant',
7: 'Humanoïde',
9: 'Mécanique',
6: 'Mort-vivant',
10: 'Non classés'
7: 'Humanoïde',
8: 'Bestiole',
9: 'Mécanique',
10: 'Non spécifié',
11: 'Totem',
12: 'Familier pacifique',
13: 'Nuage de gaz'
};
var g_pet_families = {

View File

@@ -1204,16 +1204,20 @@ var g_npc_classifications = {
};
var g_npc_types = {
0: 'Разное',
1: 'Животное',
8: 'Существо',
2: 'Дракон',
3: 'Демон',
4: 'Элементаль',
2: 'Дракон',
5: 'Великан',
7: 'Гуманоид',
9: 'Механизм',
6: 'Нежить',
10: 'Разное'
7: 'Гуманоид',
8: 'Существо',
9: 'Механизм',
10: 'Не указано',
11: 'Тотем',
12: 'Спутник',
13: 'Облако газа'
};
var g_pet_families = {