Implement Titles

and while doing so...
- decrypted listview.templates - achievemnts, quests, titles
- removed ancient hacks for Opera from JS wich prevented capturing of some Key/Mouse-Events in Opera

Pease note, that the CharTitles.dbc alone doesn't provide enough data to generate these pages.
The script to generate ?_titles and ?_sourceStrings will be provided soon [TM]
This commit is contained in:
Sarjuuk
2013-01-20 00:56:58 +01:00
parent faabdee2a6
commit e65315dd3c
26 changed files with 2214 additions and 789 deletions

View File

@@ -0,0 +1,387 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
class Achievement extends BaseType
{
public $criteria = [];
public $tooltip = '';
protected $setupQuery = "SELECT * FROM ?_achievement WHERE `Id` = ?";
public function __construct($data)
{
parent::__construct($data);
// post processing
if (!$this->template['iconString'])
$this->template['iconString'] = 'INV_Misc_QuestionMark';
}
public function getListviewData()
{
return array(
'id' => $this->Id,
'name' => Util::localizedString($this->template, 'name'),
'description' => Util::localizedString($this->template, 'description'),
'points' => $this->template['points'],
'faction' => $this->template['faction'] + 1,
'category' => $this->template['category'],
'parentCat' => $this->template['parentCat'],
'rewards' => empty($this->template['rewards']) ? NULL : $this->template['rewards'],
'reward' => empty($this->template['reward_loc'.User::$localeId]) ? NULL : Util::localizedString($this->template, 'reward'),
);
}
// hmm, really needed? .. probably .. needs rename? .. also probably
public function getDetailedData()
{
return array(
'id' => $this->Id,
'name' => Util::localizedString($this->template, 'name'),
'description' => Util::localizedString($this->template, 'description'),
'points' => $this->template['points'],
'iconname' => $this->template['iconString'],
'count' => $this->template['reqCriteriaCount'],
'reward' => empty($this->template['reward_loc'.User::$localeId]) ? NULL : Util::localizedString($this->template, 'reward'),
);
}
public function getCriteria($idx = -1)
{
if (empty($this->criteria))
{
$result = DB::Aowow()->Select('SELECT * FROM ?_achievementcriteria WHERE `refAchievement` = ? ORDER BY `order` ASC', $this->Id);
if (!$result)
return array();
if (is_array($result[0]))
$this->criteria = $result;
else
$this->criteria[] = $result;
}
if ($idx < 0)
return $this->criteria;
else
return $this->criteria[$idx];
}
public function addSelfToJScript(&$gAchievements)
{
$gAchievements[$this->Id] = array(
'icon' => $this->template['iconString'],
'name' => Util::localizedString($this->template, 'name'),
);
}
public function addRewardsToJscript(&$gItems, &$gTitles)
{
$rewards = explode(" ", $this->template['rewardIds']);
$lookup = [];
foreach ($rewards as $reward)
{
if ($reward > 0)
$lookup['item'][] = $reward;
else if ($reward < 0)
$lookup['title'][] = -$reward;
}
if (isset($lookup['item']))
{
$rewItems = new ItemList(array(['i.entry', $lookup['item']]));
$rewItems->addSelfToJScript($gItems);
}
if (isset($lookup['title']))
{
$rewTitles = new TitleList(array(['Id', $lookup['title']]));
$rewTitles->addSelfToJScript($gTitles);
}
}
public function createTooltip()
{
if (!empty($this->tooltip))
return $this->tooltip;
$criteria = $this->getCriteria();
$tmp = array();
$rows = array();
$i = 0;
foreach ($criteria as $_row)
{
if($i++ % 2)
$tmp[] = $_row;
else
$rows[] = $_row;
}
if ($tmp)
$rows = array_merge($rows, $tmp);
$description = Util::localizedString($this->template, 'description');
$name = Util::localizedString($this->template, 'name');
$criteria = '';
$i = 0;
foreach ($rows as $crt)
{
// we could show them, but the tooltips are cluttered
if (($crt['complete_flags'] & ACHIEVEMENT_CRITERIA_FLAG_HIDDEN) && User::$perms <= 0)
continue;
$crtName = Util::jsEscape(Util::localizedString($crt, 'name'));
switch ($crt['type'])
{
case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET:
case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2:
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL:
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL:
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
if (!$crtName)
$crtName = Spell::getName($crt['value1']);
break;
case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM:
if (!$crtName)
$crtName = Item::getName($crt['value1']);
break;
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION:
if (!$crtName)
$crtName = Faction::getName($crt['value1']);
$crtName .= ' ('.Lang::getReputationLevelForPoints($crt['value2']).')';
break;
}
if ($crt['complete_flags'] & ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER)
$criteria .= '- '.Util::jsEscape(htmlspecialchars($crtName)).' <span class="moneygold">'.number_format($crt['value2' ] / 10000).'</span><br />';
else
$criteria .= '- '.Util::jsEscape(htmlspecialchars($crtName)).'<br />';
if (++$i == round(count($rows)/2))
$criteria .= '</small></td><th class="q0" style="white-space: nowrap; text-align: left"><small>';
}
$x = '<table><tr><td><b class="q">';
$x .= Util::jsEscape(htmlspecialchars($name));
$x .= '</b></td></tr></table>';
if ($description || $criteria)
$x .= '<table><tr><td>';
if ($description)
$x .= '<br />'.Util::jsEscape(htmlspecialchars($description)).'<br />';
if ($criteria)
{
$x .= '<br /><span class="q">'.Lang::$achievement['criteria'].':</span>';
$x .= '<table width="100%"><tr><td class="q0" style="white-space: nowrap"><small>'.$criteria.'</small></th></tr></table>';
}
if ($description || $criteria)
$x .= '</td></tr></table>';
// Completed
$this->tooltip = $x;
return $this->tooltip;
}
public function getSourceData()
{
return array(
"n" => Util::localizedString($this->template, 'name'),
"s" => $this->template['faction'],
"t" => TYPEID_ACHIEVEMENT,
"ti" => $this->Id
);
}
}
class AchievementList extends BaseTypeList
{
protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM ?_achievement WHERE [filter] [cond] GROUP BY Id ORDER BY `orderInGroup` ASC';
public function __construct($conditions)
{
// may be called without filtering
if (class_exists('AchievementFilter'))
{
$this->filter = new AchievementFilter();
if (($fiData = $this->filter->init()) === false)
return;
}
parent::__construct($conditions);
// post processing
foreach ($this->container as $k => $acv)
{
//"rewards":[[11,137],[3,138]] [what, entry] 3:item; 11:title, 6:spell(unused)
if (!empty($acv->template['rewardIds']))
{
$rewards = array();
$rewIds = explode(" ", $acv->template['rewardIds']);
foreach ($rewIds as $rewId)
$rewards[] = ($rewId > 0 ? "[3,".$rewId."]" : ($rewId < 0 ? "[11,".-$rewId."]" : NULL));
$this->container[$k]->template['rewards'] = "[".implode(",",$rewards)."]";
}
}
}
public function addRewardsToJScript(&$gItems, &$gTitles)
{
// collect Ids to execute in single query
$lookup = [];
foreach ($this->container as $id => $data)
{
$rewards = explode(" ", $data->template['rewardIds']);
foreach ($rewards as $reward)
{
if ($reward > 0)
$lookup['item'][] = $reward;
else if ($reward < 0)
$lookup['title'][] = -$reward;
}
}
if (isset($lookup['item']))
{
$rewItems = new ItemList(array(['i.entry', array_unique($lookup['item'])]));
$rewItems->addSelfToJScript($gItems);
}
if (isset($lookup['title']))
{
$rewTitles = new TitleList(array(['Id', array_unique($lookup['title'])]));
$rewTitles->addSelfToJScript($gTitles);
}
}
// run once
public function setupAchievements()
{
set_time_limit(120);
// add serverside achievements
DB::Aowow()->Query(
"INSERT IGNORE INTO
?_achievement
SELECT
ID,
requiredFaction,
mapID,
0,
0,
0,
points,
0,
0,
'',
flags,
count,
refAchievement,
'',
0x10,
CONCAT('SERVERSIDE (', ID, ')'),
CONCAT('SERVERSIDE (', ID, ')'),
CONCAT('SERVERSIDE (', ID, ')'),
CONCAT('SERVERSIDE (', ID, ')'),
CONCAT('SERVERSIDE (', ID, ')'),
'',
'',
'',
'',
'',
'',
'',
'',
'',
''
FROM
world.achievement_dbc"
);
foreach ($this->container as $acv)
{
// set iconString
$icon = DB::Aowow()->SelectCell('SELECT iconname FROM ?_spellicons WHERE id = ?d', $acv->template['iconId']);
// set parentCat
$parentCat = DB::Aowow()->SelectCell('SELECT parentCategory FROM ?_achievementcategory WHERE Id = ?d', $acv->template['category']);
// series parent(16) << child(16)
$series = $acv->template['parent'] << 16;
$series |= DB::Aowow()->SelectCell('SELECT Id FROM ?_achievement WHERE parent = ?d', $acv->Id);
// set rewards
$rewardIds = array();
if ($rStr = $acv->template['reward_loc0'])
{
// i can haz title?
if (stristr($rStr, 'title reward:') || stristr($rStr, 'title:'))
{
$rStr = explode(':', $rStr); // head-b-gone
$rStr = str_replace('The Grand' ,'Grand', $rStr);
$rStr = explode('.', $rStr[1]); // Crusader + Crap
$rStr = explode('/', $rStr[0]); // Matron & Patron
$rStr = explode(' or ', $rStr[0]); // Alliance & Horde
$rewardIds[] = DB::Aowow()->SelectCell('SELECT -Id FROM ?_titles WHERE name_loc0 LIKE ?s', '%'.trim($rStr[0]).'%');
if (isset($rStr[1]))
$rewardIds[] = DB::Aowow()->SelectCell('SELECT -Id FROM ?_titles WHERE name_loc0 LIKE ?s', '%'.trim($rStr[1]).'%');
}
else if (stristr($rStr, 'reward:')) // i haz item
{
if (in_array($acv->Id, [3656, 3478])) // Pilgrim
{
$rewardIds[] = -168;
$rewardIds[] = 44810;
}
else if (in_array($acv->Id, [1681, 1682])) // Loremaster
{
$rewardIds[] = -125;
$rewardIds[] = 43300;
}
else
{
$rStr = explode(':', $rStr)[1]; // head-b-gone
$rewardIds[] = DB::Aowow()->SelectCell('SELECT entry FROM item_template WHERE name LIKE ?s', '%'.Util::sqlEscape(trim($rStr)));
if ($acv->Id == 1956) // higher learning
$rewardIds[] = 44738; // pet not in description
}
}
}
else
continue;
DB::Aowow()->Query(
'UPDATE
?_achievement
SET
rewardIds = ?s,
series = ?s,
parentCat = ?d,
iconString = ?s
WHERE
Id = ?d',
$series,
isset($rewardIds) ? implode(' ', $rewardIds) : '',
$parentCat,
$icon,
$acv->Id
);
}
}
}
?>

View File

@@ -0,0 +1,71 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
/************
* get Community Content
************/
class CommunityContent
{
/* todo: administration of content */
private function getComments($type, $typeId)
{
// comments
return array();
}
private function getVideos($type, $typeId)
{
return DB::Aowow()->Query("
SELECT
v.Id,
a.displayName AS user,
v.date,
v.videoId,
v.caption,
IF(v.status & 0x4, 1, 0) AS 'sticky'
FROM
?_videos v,
?_account a
WHERE
v.type = ? AND v.typeId = ? AND v.status & 0x2",
$type,
$typeId
);
}
private function getScreenshots($type, $typeId)
{
return DB::Aowow()->Query("
SELECT
s.Id,
a.displayName AS user,
s.date,
s.width,
s.height,
s.caption,
IF(s.status & 0x4, 1, 0) AS 'sticky'
FROM
?_screenshots s,
?_account a
WHERE
s.type = ? AND s.typeId = ? AND s.status & 0x2",
$type,
$typeId
);
}
public function getAll($type, $typeId)
{
return array(
'vi' => self::getVideos($type, $typeId),
'sc' => self::getScreenshots($type, $typeId),
'co' => self::getComments($type, $typeId)
);
}
}
?>

214
includes/class.quest.php Normal file
View File

@@ -0,0 +1,214 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
class Quest extends BaseType
{
public $cat1 = 0;
public $cat2 = 0;
protected $setupQuery = 'SELECT * FROM quest_template a LEFT JOIN locales_quest b ON a.Id = b.entry WHERE a.Id = ?';
public function __construct($data)
{
parent::__construct($data);
// post process
$this->cat1 = $this->template['ZoneOrSort']; // should probably be in a method...
foreach (Util::$questClasses as $k => $arr)
{
if (in_array($this->cat1, $arr))
{
$this->cat2 = $k;
break;
}
}
}
public static function getName($id)
{
$n = DB::Aowow()->SelectRow('
SELECT
title,
title_loc2,
title_loc3,
title_loc6,
title_loc8
FROM
quest_template q,
locales_quest l
WHERE
q.id = l.entry AND
q.id = ?d',
$id
);
return Util::localizedString($n, 'title');
}
public static function RewardXP($QuestLevel, $XPId)
{
if ($xp = DB::Aowow()->SelectCell('SELECT Field?d FROM ?_questxp WHERE Id = ?d', $XPId, $QuestLevel)) {
return $xp;
}
else
return 0;
}
public function getSourceData()
{
return array(
"n" => Util::localizedString($this->template, 'Title'),
"t" => TYPEID_QUEST,
"ti" => $this->Id,
"c" => $this->cat1,
"c2" => $this->cat2
);
}
public function getListviewData()
{
$data = array(
'category' => $this->cat1,
'category2' => $this->cat2,
'id' => $this->Id,
'level' => $this->template['Level'],
'reqlevel' => $this->template['MinLevel'],
'name' => Util::localizedString($this->template, 'Title'),
'side' => Util::sideByRaceMask($this->template['RequiredRaces'])
);
$rewards = [];
for ($i = 1; $i < 5; $i++)
if ($this->template['RewardItemId'.$i])
$rewards[] = [$this->template['RewardItemId'.$i], $this->template['RewardItemCount'.$i]];
$choices = [];
for ($i = 1; $i < 7; $i++)
if ($this->template['RewardChoiceItemId'.$i])
$choices[] = [$this->template['RewardChoiceItemId'.$i], $this->template['RewardChoiceItemCount'.$i]];
if (!empty($rewards))
$data['itemrewards'] = $rewards;
if (!empty($choices))
$data['itemchoices'] = $choices;
if ($this->template['RewardTitleId'])
$data['titlereward'] = $this->template['RewardTitleId'];
// todo reprewards .. accesses QuestFactionReward.dbc
return $data;
}
public function addRewardsToJscript(&$gItems, &$gSpells, &$gTitles)
{
// items
$items = [];
for ($i = 1; $i < 5; $i++)
if ($this->template['RewardItemId'.$i])
$items[] = $this->template['RewardItemId'.$i];
for ($i = 1; $i < 7; $i++)
if ($this->template['RewardChoiceItemId'.$i])
$items[] = $this->template['RewardChoiceItemId'.$i];
if (!empty($items))
{
$items = new ItemList(array(['entry', $items]));
$items->addSelfToJScipt($gItems);
}
// spells
$spells = [];
if ($this->template['RewardSpell'])
$spells[] = $this->template['RewardSpell'];
if ($this->template['RewardSpellCast'])
$spells[] = $this->template['RewardSpellCast'];
if (!empty($spells))
{
$spells = new SpellList(array(['id', $spells]));
$spells->addSelfToJScipt($gSpells);
}
// titles
if ($tId = $this->template['RewardTitleId'])
{
$title = new Title($tId);
$title->addSelfToJScript($gTitles);
}
}
}
class QuestList extends BaseTypeList
{
protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM quest_template a LEFT JOIN locales_quest b ON a.Id = b.entry WHERE [filter] [cond] ORDER BY Id ASC';
public function __construct($conditions)
{
// may be called without filtering
if (class_exists('QuestFilter'))
{
$this->filter = new QuestFilter();
if (($fiData = $this->filter->init()) === false)
return;
}
parent::__construct($conditions);
}
public function addRewardsToJscript(&$gItems, &$gSpells, &$gTitles)
{
$items = [];
$spells = [];
$titles = [];
foreach ($this->container as $quest)
{
// items
for ($i = 1; $i < 5; $i++)
if ($quest->template['RewardItemId'.$i])
$items[] = $quest->template['RewardItemId'.$i];
for ($i = 1; $i < 7; $i++)
if ($quest->template['RewardChoiceItemId'.$i])
$items[] = $quest->template['RewardChoiceItemId'.$i];
// spells
if ($quest->template['RewardSpell'])
$spells[] = $quest->template['RewardSpell'];
if ($quest->template['RewardSpellCast'])
$spells[] = $quest->template['RewardSpellCast'];
// titles
if ($quest->template['RewardTitleId'])
$titles[] = $quest->template['RewardTitleId'];
}
if (!empty($items))
{
$items = new ItemList(array(['i.entry', $items]));
$items->addSelfToJScript($gItems);
}
if (!empty($spells))
{
$spells = new SpellList(array(['id', $spells]));
$spells->addSelfToJScript($gSpells);
}
if (!empty($titles))
{
$titles = new TitleList(array(['id', $titles]));
$titles->addSelfToJScript($gTitles);
}
}
}
?>

75
includes/class.title.php Normal file
View File

@@ -0,0 +1,75 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
class Title extends BaseType
{
public $name = [];
public $source = [];
protected $setupQuery = "SELECT * FROM ?_titles WHERE `Id` = ?";
public function __construct($data)
{
parent::__construct($data);
// post processing
$this->name[GENDER_MALE] = Util::localizedString($this->template, 'male');
if ($this->template['female_loc0'] || $this->template['female_loc'.User::$localeId])
$this->name[GENDER_FEMALE] = Util::localizedString($this->template, 'female');
// preparse sources
if (!empty($this->template['source']))
{
$sources = explode(' ', $this->template['source']);
foreach ($sources as $src)
{
$src = explode(':', $src);
$this->source[$src[0]][] = $src[1];
}
}
}
public function getListviewData()
{
$data = array(
'id' => $this->Id,
'name' => $this->name[GENDER_MALE],
'side' => $this->template['side'],
'gender' => $this->template['gender'],
'expansion' => $this->template['expansion'],
'category' => $this->template['category'],
'source' => $this->source
);
if (isset($this->name[GENDER_FEMALE]))
$data['namefemale'] = $this->name[GENDER_FEMALE];
return $data;
}
public function addSelfToJScript(&$gTitles)
{
$gTitles[$this->Id] = ['name' => Util::jsEscape($this->name[GENDER_MALE])];
if (isset($this->name[GENDER_FEMALE]))
$gTitles[$this->Id]['namefemale'] = Util::jsEscape($this->name[GENDER_FEMALE]);
return true;
}
public function getHtmlizedName($gender = GENDER_MALE)
{
return str_replace('%s', '<span class="q0">&lt;Name&gt;</span>', $this->name[$gender]);
}
}
class TitleList extends BaseTypeList
{
protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM ?_titles WHERE [cond] ORDER BY Id ASC';
}
?>

View File

@@ -0,0 +1,18 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
class WorldEvent
{
public static function getName($id)
{
$row = DB::Aowow()->SelectRow('SELECT * FROM ?_holidays WHERE Id = ?d', intVal($id));
return Util::localizedString($row, 'name');
}
}
?>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -18,9 +18,9 @@ $lang = array(
'profiles' => "Tus personajes", // translate.google :x
'links' => "Enlaces",
'pageNotFound' => "Este %s no existe.",
'alliance' => "Alianza",
'horde' => "Horda",
'both' => "Ambos",
'gender' => "Género",
'sex' => [null, 'Hombre', 'Mujer'],
'quickFacts' => "Notas rápidas",
'screenshots' => "Capturas de pantalla",
'videos' => "Videos",
@@ -33,7 +33,6 @@ $lang = array(
'rewards' => "Recompensas",
'gains' => "Ganancias",
'login' => "[Login]",
'class' => "clase",
'forum' => "[Forum]",
'days' => "dias",
'hours' => "horas",
@@ -52,11 +51,26 @@ $lang = array(
'serverside' => "[Serverside]",
'serversideHint' => "[These informations are not in the Client and have been provided by sniffing and/or guessing.]",
),
'search' => array(
'search' => "Búsqueda",
'foundResult' => "Resultados de busqueda para",
'noResult' => "Ningún resultado para",
'tryAgain' => "Por favor, introduzca otras palabras claves o verifique el término ingresado.",
),
'game' => array(
'requires' => "Requiere",
'cooldown' => "%s de reutilización",
'alliance' => "Alianza",
'horde' => "Horda",
'class' => "clase",
'classes' => "Clases",
'races' => "Razas",
'title' => "Título",
'titles' => "Títulos",
'eventShort' => "Evento",
'event' => "Suceso mundial ",
'events' => "Eventos del mundo",
'cooldown' => "%s cooldown",
'cooldown' => "%s de reutilización",
'requires' => "Requiere",
'reqLevel' => "Necesitas ser de nivel %s",
'reqLevelHlm' => "Necesitas ser de nivel %s",
'valueDelim' => " - ",
@@ -139,6 +153,11 @@ $lang = array(
'zone' => "Zone",
'zonePartOf' => "Cette zone fait partie de la zone",
),
'title' => array(
'cat' => array(
'General', 'Jugador contra Jugador', 'Reputación', 'Mazmorras y bandas', 'Misiones', 'Profesiones', 'Eventos del mundo'
)
),
'spell' => array(
'remaining' => "%s restantes",
'castIn' => "Hechizo de %s seg",

View File

@@ -18,9 +18,9 @@ $lang = array(
'profiles' => "Vos personnages", // translate.google :x
'links' => "Liens",
'pageNotFound' => "Ce %s n'existe pas.",
'alliance' => "Alliance",
'horde' => "Horde",
'both' => "Les deux",
'gender' => "Genre",
'sex' => [null, 'Homme', 'Femme'],
'quickFacts' => "En bref",
'screenshots' => "Captures d'écran",
'videos' => "Vidéos",
@@ -33,7 +33,6 @@ $lang = array(
'rewards' => "Récompenses",
'gains' => "Gains",
'login' => "[Login]",
'class' => "classe",
'forum' => "[Forum]",
'days' => "jours",
'hours' => "heures",
@@ -52,11 +51,25 @@ $lang = array(
'serverside' => "[Serverside]",
'serversideHint' => "[These informations are not in the Client and have been provided by sniffing and/or guessing.]",
),
'search' => array(
'search' => "Recherche",
'foundResult' => "Résultats de recherche pour",
'noResult' => "Aucun résultat pour malordawsne",
'tryAgain' => "Veuillez essayer d'autres mots ou vérifiez l'orthographe des termes de recherche.",
),
'game' => array (
'requires' => "Requiert",
'cooldown' => "%s de recharge",
'alliance' => "Alliance",
'horde' => "Horde",
'class' => "classe",
'classes' => "Classes",
'races' => "Races",
'title' => "Titre",
'titles' => "Titres",
'eventShort' => "Évènement",
'event' => "Évènement mondial",
'events' => "Évènements mondiaux",
'cooldown' => "%s de recharge",
'requires' => "Requiert",
'reqLevel' => "Niveau %s requis",
'reqLevelHlm' => "Requiert Niveau %s",
'valueDelim' => " - ",
@@ -144,6 +157,11 @@ $lang = array(
'zone' => "Zone",
'zonePartOf' => "Cette zone fait partie de la zone",
),
'title' => array(
'cat' => array(
'Général', 'Joueur ctr. Joueur', 'Réputation', 'Donjons & raids', 'Quêtes', 'Métiers', 'Évènements mondiaux'
)
),
'spell' => array(
'remaining' => "%s restantes",
'castIn' => "%s s d'incantation",

View File

@@ -18,9 +18,9 @@ $lang = array(
'profiles' => "Ваши персонажи", // translate.google :x
'links' => "Ссылки",
'pageNotFound' => "Такое %s не существует.",
'alliance' => "Альянс",
'horde' => "Орда",
'both' => "Обе",
'gender' => "Пол",
'sex' => [null, 'Мужчина', 'Женщина'],
'quickFacts' => "Краткая информация",
'screenshots' => "Изображения",
'videos' => "Видео",
@@ -33,7 +33,6 @@ $lang = array(
'rewards' => "Награды",
'gains' => "Бонус",
'login' => "[Login]",
'class' => "класс",
'forum' => "[Forum]",
'days' => "дн",
'hours' => "часы",
@@ -52,11 +51,25 @@ $lang = array(
'serverside' => "[Serverside]",
'serversideHint' => "[These informations are not in the Client and have been provided by sniffing and/or guessing.]",
),
'search' => array(
'search' => "Поиск",
'foundResult' => "Результаты поиска для",
'noResult' => "Ничего не найдено для",
'tryAgain' => "Пожалуйста, попробуйте другие ключевые слова или проверьте правильность запроса.",
),
'game' => array(
'requires' => "Требует:",
'cooldown' => "Восстановление: %s",
'alliance' => "Альянс",
'horde' => "Орда",
'class' => "класс",
'classes' => "Классы",
'races' => "Расы",
'title' => "Звание",
'titles' => "Звания",
'eventShort' => "Игровое событие",
'event' => "Событие",
'events' => "Игровые события",
'cooldown' => "Восстановление: %s",
'requires' => "Требует:",
'reqLevel' => "Требуется уровень: %s",
'reqLevelHlm' => "Требуется уровень: %s",
'valueDelim' => " - ",
@@ -144,6 +157,11 @@ $lang = array(
'zone' => "Игровая зона",
'zonePartOf' => "Эта игровая локация является частью локации",
),
'title' => array(
'cat' => array(
'Общее', 'PvP', 'Репутация', 'Подземелья и рейды', 'Задания', 'Профессии', 'Игровые события'
)
),
'spell' => array(
'remaining' => "Осталось: %s",
'castIn' => "Применение: %s сек.",

113
pages/title.php Normal file
View File

@@ -0,0 +1,113 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
require('includes/class.title.php');
require('includes/class.spell.php');
require('includes/class.achievement.php');
require('includes/class.item.php');
require('includes/class.quest.php');
require('includes/class.worldevent.php');
require('includes/class.community.php');
$Id = intval($pageParam);
if (!$smarty->loadCache(array('achievement', $Id), $pageData))
{
$title = new Title($Id);
if ($title->template)
{
$title->addSelfToJscript($pageData['gTitles']);
$infobox = [];
$colon = User::$localeId == LOCALE_FR ? ' : ' : ': '; // Je suis un prick! <_<
if ($title->template['side'] == 1)
$infobox[] = Lang::$main['side'].$colon.'[span class=alliance-icon]'.Lang::$game['alliance'].'[/span]';
else if ($title->template['side'] == 2)
$infobox[] = Lang::$main['side'].$colon.'[span class=horde-icon]'.Lang::$game['horde'].'[/span]';
else
$infobox[] = Lang::$main['side'].$colon.Lang::$main['both'];
if ($title->template['gender'])
$infobox[] = Lang::$main['gender'].$colon.'[span class='.($title->template['gender'] == 2 ? 'female' : 'male').'-icon]'.Lang::$main['sex'][$title->template['gender']].'[/span]';
if ($title->template['eventId'])
$infobox[] = Lang::$game['eventShort'].$colon.'[url=?event='.$title->template['eventId'].']'.WorldEvent::getName($title->template['eventId']).'[/url]';
$pageData = array(
'page' => array(
'name' => $title->getHtmlizedName(),
'id' => $title->Id,
'expansion' => Util::$expansionString[$title->template['expansion']]
),
'infobox' => '[li][ul]'.implode('[/ul][ul]', $infobox).'[/ul][/li]',
);
foreach ($title->source as $type => $entries)
{
// todo: hidden-/visibleCols by actual use
switch ($type)
{
case 4:
$quests = new QuestList(array(['id', $entries]));
$quests->addRewardsToJscript($pageData['gItems'], $pageData['gSpells'], $pageData['gTitles']);
$pageData['page']['questReward'] = $quests->getListviewData();
$pageData['page']['questParams'] = array(
'id' => 'reward-from-quest',
'name' => '$LANG.tab_rewardfrom',
'hiddenCols' => "$['side']",
'visibleCols' => "$['category']"
);
break;
case 12:
$acvs = new AchievementList(array(['id', $entries]));
$acvs->addSelfToJscript($pageData['gAchievements']);
$acvs->addRewardsToJscript($pageData['gItems'], $pageData['gTitles']);
$pageData['page']['acvReward'] = $acvs->getListviewData();
$pageData['page']['acvParams'] = array(
'id' => 'reward-from-achievement',
'name' => '$LANG.tab_rewardfrom',
'visibleCols' => "$['category']",
'sort' => "$['reqlevel', 'name']"
);
break;
case 13:
// not displayed
}
}
$pageData['title'] = ucFirst(trim(str_replace('%s', '', str_replace(',', '', $title->name[0]))));
$smarty->saveCache(array('spell', $Id), $pageData);
}
else
{
$smarty->updatePageVars(array(
'subject' => ucfirst(Lang::$main['class']),
'id' => $Id,
'notFound' => sprintf(Lang::$main['pageNotFound'], Lang::$main['class']),
));
$smarty->assign('lang', Lang::$main);
$smarty->display('404.tpl');
exit();
}
}
$smarty->updatePageVars(array(
'title' => $pageData['title']." - ".Lang::$game['title'],
'path' => "[0, 10, ".$title->template['category']."]",
'tab' => 0, // for g_initHeader($tab)
'type' => TYPEID_TITLE, // 11:Titles
'typeId' => $Id
));
$smarty->assign('community', CommunityContent::getAll(TYPEID_TITLE, $Id)); // comments, screenshots, videos
$smarty->assign('lang', array_merge(Lang::$main));
$smarty->assign('data', $pageData);
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->display('title.tpl');
?>

105
pages/titles.php Normal file
View File

@@ -0,0 +1,105 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
require_once('includes/class.title.php');
require_once('includes/class.achievement.php');
require_once('includes/class.quest.php');
$cat = Util::extractURLParams($pageParam)[0];
$path = [0, 10];
$cacheKey = implode(':', [CACHETYPE_PAGE, TYPEID_TITLE, -1, $cat || 0, User::$localeId]);
$title = [ucFirst(Lang::$game['titles'])];
$path[] = $cat; // should be only one parameter anyway
if (isset($cat))
array_unshift($title, Lang::$title['cat'][$cat]);
if (!$smarty->loadCache($cacheKey, $pageData))
{
$titles = new TitleList(isset($cat) ? array(['category', (int)$cat]) : []);
$listview = $titles->getListviewData();
$sources = array(
4 => [], // Quest
12 => [], // Achievement
13 => [] // DB-Text
);
// parse sources
foreach ($listview as $lvTitle)
{
if(!isset($lvTitle['source']))
continue;
if (isset($lvTitle['source'][4]))
$sources[4] = array_merge($sources[4], $lvTitle['source'][4]);
if (isset($lvTitle['source'][12]))
$sources[12] = array_merge($sources[12], $lvTitle['source'][12]);
if (isset($lvTitle['source'][13]))
$sources[13] = array_merge($sources[13], $lvTitle['source'][13]);
}
// replace with suitable objects
if (!empty($sources[4]))
$sources[4] = new QuestList(array(['Id', $sources[4]]));
if (!empty($sources[12]))
$sources[12] = new AchievementList(array(['Id', $sources[12]]));
if (!empty($sources[13]))
$sources[13] = DB::Aowow()->SELECT('SELECT *, Id AS ARRAY_KEY FROM ?_sourceStrings WHERE Id IN (?a)', $sources[13]);
foreach ($listview as $k => $lvTitle)
{
if(!isset($lvTitle['source']))
continue;
// Quest-source
if (isset($lvTitle['source'][4]))
{
$ids = $lvTitle['source'][4];
$listview[$k]['source'][4] = [];
foreach ($ids as $id)
$listview[$k]['source'][4][] = $sources[4]->container[$id]->getSourceData();
}
// Achievement-source
if (isset($lvTitle['source'][12]))
{
$ids = $lvTitle['source'][12];
$listview[$k]['source'][12] = [];
foreach ($ids as $id)
$listview[$k]['source'][12][] = $sources[12]->container[$id]->getSourceData();
}
// other source (only one item possible, so no iteration needed)
if (isset($lvTitle['source'][13]))
$listview[$k]['source'][13] = [$sources[13][$lvTitle['source'][13][0]]];
$listview[$k]['source'] = json_encode($listview[$k]['source']);
}
$pageData['page'] = $listview;
$smarty->saveCache($cacheKey, $pageData);
}
$page = array(
'tab' => 0, // for g_initHeader($tab)
'title' => implode(" - ", $title),
'path' => "[".implode(", ", $path)."]",
);
$smarty->updatePageVars($page);
$smarty->assign('lang', Lang::$main);
$smarty->assign('data', $pageData);
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->display('titles.tpl');
?>

View File

@@ -0,0 +1,33 @@
{strip}
new Listview({ldelim}
template:'achievement',
{if !isset($params.id)}id:'achievements',{/if}
{if !isset($params.tabs)}tabs:tabsRelated,{/if}
{if !isset($params.name)}name:LANG.tab_achievements,{/if}
{if !isset($params.parent)}parent:'listview-generic',{/if}
{if isset($params.note)}_truncated: 1,{/if}
{foreach from=$params key=k item=v}
{if $v[0] == '$'}
{$k}:{$v|substr:1},
{else if $v}
{$k}:'{$v}',
{/if}
{/foreach}
data:[
{foreach name=i from=$data item=curr}
{ldelim}
id:{$curr.id},
name:'{$curr.name|escape:"javascript"}',
description:'{$curr.description|escape:"javascript"}',
side:{$curr.faction},
points:{$curr.points},
category:{$curr.category},
parentcat:{$curr.parentCat}
{if isset($curr.rewards)}, rewards:{$curr.rewards}{/if}
{if isset($curr.reward)}, reward:'{$curr.reward|escape:"javascript"}'{/if}
{rdelim}
{if $smarty.foreach.i.last}{else},{/if}
{/foreach}
]
{rdelim});
{/strip}

View File

@@ -0,0 +1,6 @@
var _ = g_achievements;
{strip}
{foreach from=$data key=id item=item}
_[{$id}]={ldelim}icon:'{$item.icon|escape:"javascript"}',name_{$user.language}:'{$item.name|escape:"javascript"}'{rdelim};
{/foreach}
{/strip}

View File

@@ -0,0 +1,9 @@
var _ = g_titles;
{strip}
{foreach from=$data key=id item=item}
_[{$id}]={ldelim}
name_{$user.language}:'{$item.name|escape:"javascript"}'
{if isset($item.namefemale)}, namefemale_{$user.language}:'{$item.namefemale|escape:"javascript"}'{/if}
{rdelim};
{/foreach}
{/strip}

View File

@@ -0,0 +1,68 @@
{strip}
var lv_comments = [
{foreach name=forCo from=$community.co key=number item=co}
{ldelim}
number:{$co.number},
user:'{$co.user}',
body:'{$co.body|escape:"javascript"}',
date:'{$co.date|date_format:"%Y/%m/%d %H:%M:%S"}',
{if $co.roles!=0}
roles:{$co.roles},
{/if}
{if $co.indent!=0}
indent:{$co.indent},
{/if}
rating:{$co.rating},
replyTo:{$co.replyto},
purged:{$co.purged},
deleted:0,
raters:[{foreach name=foo2 key=id from=$co.raters item=rater}[{$rater.userid},{$rater.rate}]{if $smarty.foreach.foo2.last}{else},{/if}{/foreach}],
id:{$co.id}
,sticky:{$co.sticky}
,userRating:{$co.userRating}
{rdelim}
{if $smarty.foreach.forCo.last}{else},{/if}
{/foreach}
];
{/strip}
{strip}
var lv_screenshots = [
{foreach name=forSc from=$community.sc key=number item=sc}
{ldelim}
id:{$sc.Id},
user:'{$sc.user}',
date:'{$sc.date|date_format:"%Y/%m/%d %H:%M:%S"}',
width:{$sc.width},
height:{$sc.height},
type:{$page.type},
typeId:{$page.typeId},
{if isset($sc.sticky)}
sticky:{$sc.sticky},
{/if}
caption:'{$sc.caption|escape:"javascript"}'
{rdelim}
{if $smarty.foreach.forSc.last}{else},{/if}
{/foreach}
];
{/strip}
{strip}
var lv_videos = [
{foreach name=forVi from=$community.vi key=number item=vi}
{ldelim}
id:{$vi.Id},
user:'{$vi.user}',
date:'{$vi.date|date_format:"%Y/%m/%d %H:%M:%S"}',
videoType:1, {* there is only youtube *}
videoId:'{$vi.videoId}',
type:{$page.type},
typeId:{$page.typeId},
{if isset($vi.sticky)}
sticky:{$vi.sticky},
{/if}
caption:'{$vi.caption|escape:"javascript"}'
{rdelim}
{if $smarty.foreach.forVi.last}{else},{/if}
{/foreach}
];
{/strip}

View File

@@ -0,0 +1,13 @@
<table class="infobox">
<tr><th id="infobox-quick-facts">{$lang.quickFacts}</th></tr>
<tr><td><div class="infobox-spacer"></div><div id="infobox-contents0"></div></td></tr>
<tr><th id="infobox-screenshots">{$lang.screenshots}</th></tr>
<tr><td><div class="infobox-spacer"></div><div id="infobox-sticky-ss"></div></td></tr>
<tr><th id="infobox-videos">{$lang.videos}</th></tr>
<tr><td><div class="infobox-spacer"></div><div id="infobox-sticky-vi"></div></td></tr>
</table>
<script type="text/javascript">ss_appendSticky()</script>
<script type="text/javascript">vi_appendSticky()</script>
<script type="text/javascript">
Markup.printHtml("{$data.infobox}", "infobox-contents0", {ldelim}mode:Markup.MODE_QUICKFACTS{rdelim});
</script>

View File

@@ -0,0 +1,71 @@
{strip}
new Listview({ldelim}
template:'quest',
{if !isset($params.id)}id:'quests',{/if}
{if !isset($params.tabs)}tabs:tabsRelated,{/if}
{if !isset($params.name)}name:LANG.tab_quests,{/if}
{if !isset($params.parent)}parent:'listview-generic',{/if}
{if isset($params.note)}_truncated: 1,{/if}
{foreach from=$params key=k item=v}
{if $v[0] == '$'}
{$k}:{$v|substr:1},
{else if $v}
{$k}:'{$v}',
{/if}
{/foreach}
data:[
{foreach name=i from=$data item=curr}
{ldelim}
id:'{$curr.id}',
name:'{$curr.name|escape:"quotes"}',
level:'{$curr.level}',
{if ($curr.reqlevel)}
reqlevel:{$curr.reqlevel},
{/if}
side:'{$curr.side}'
{if isset($curr.itemrewards)}
,itemrewards:[
{section name=j loop=$curr.itemrewards}
[{$curr.itemrewards[j][0]},{$curr.itemrewards[j][1]}]
{if $smarty.section.j.last}{else},{/if}
{/section}
]
{/if}
{if isset($curr.itemchoices)}
,itemchoices:[
{section name=j loop=$curr.itemchoices}
[{$curr.itemchoices[j][0]},{$curr.itemchoices[j][1]}]
{if $smarty.section.j.last}{else},{/if}
{/section}
]
{/if}
{if isset($curr.xp)}
,xp:{$curr.xp}
{/if}
{if isset($curr.titlereward)}
,titlereward:{$curr.titlereward}
{/if}
{if isset($curr.money)}
,money:{$curr.money}
{/if}
{if isset($curr.category)}
,category:{$curr.category}
{/if}
{if isset($curr.category2)}
,category2:{$curr.category2}
{/if}
{if isset($curr.type)}
,type:{$curr.type}
{/if}
{if isset($curr.Daily)}
,daily:1
{/if}
{if isset($curr.flags)}
,wflags:$curr.flags {* wflags: &1: disabled/historical; &32: AutoAccept; &64: Hostile(?) *}
{/if}
{rdelim}
{if $smarty.foreach.i.last}{else},{/if}
{/foreach}
]
{rdelim});
{/strip}

View File

@@ -0,0 +1,33 @@
{strip}
new Listview({ldelim}
template:'title',
{if !isset($params.id)}id:'titles',{/if}
{if isset($params.note)}_truncated: 1,{/if}
{foreach from=$params key=k item=v}
{if $v[0] == '$'}
{$k}:{$v|substr:1},
{else if $v}
{$k}:'{$v}',
{/if}
{/foreach}
data:[
{foreach name=i from=$data item=curr}
{ldelim}
category:{$curr.category},
expansion:{$curr.expansion},
gender:{$curr.gender},
id:{$curr.id},
side:{$curr.side},
name:'{$curr.name|escape:"javascript"}'
{if isset($curr.namefemale)}
, namefemale:'{$curr.namefemale|escape:"javascript"}'
{/if}
{if isset($curr.source)}
, source:{$curr.source}
{/if}
{rdelim}
{if $smarty.foreach.i.last}{else},{/if}
{/foreach}
]
{rdelim});
{/strip}

View File

@@ -1291,6 +1291,12 @@ a.star-icon-right span
padding-right: 34px !important;
}
.bc-icon-right
{
background: url(../../images/icons/bc_icon.gif) right center no-repeat;
padding-right: 34px !important;
}
.wotlk-icon
{
background: url(../../images/icons/wotlk_icon.gif) right center no-repeat;
@@ -1299,7 +1305,7 @@ a.star-icon-right span
.wotlk-icon-right
{
background: url(../../images/icons/wotlk.gif) right center no-repeat;
background: url(../../images/icons/wotlk_icon.gif) right center no-repeat;
padding-right: 41px !important;
}
@@ -2428,11 +2434,18 @@ div.live-search-icon
div.live-search-icon div
{
background-image: url(../images/border_small.png);
background-image: url(../../images/icons/border_small.png);
background-position: left center;
background-repeat: no-repeat;
}
div.live-search-icon-boss
{
background-image: url(../../images/icons/boss.gif);
background-position: 8px center;
background-repeat: no-repeat;
}
div.live-search-icon-quest-alliance
{
background-image: url(../../images/icons/alliance-icon.gif);
@@ -2961,10 +2974,12 @@ a:hover, a.open, .text b, .text ol li div, .text li div, .infobox li div, .minib
text-decoration: underline;
}
/* probably unnessecary
#wrapper.nosidebar #main, #wrapper.nosidebar
{
min-height: 0;
}
*/
#footer a, #beyondfooter a
{

View File

@@ -1710,7 +1710,7 @@ Summary.prototype = {
this.searchName = ce("input");
this.searchName.type = "text";
aE(this.searchName, "keyup", this.onSearchKeyUp.bind(this));
aE(this.searchName, Browser.opera ? "keypress": "keydown", this.onSearchKeyDown.bind(this));
aE(this.searchName, "keydown", this.onSearchKeyDown.bind(this));
ae(d, this.searchName);
this.searchMsg = ce("span");
this.searchMsg.style.fontWeight = "bold";

File diff suppressed because it is too large Load Diff

View File

@@ -2113,6 +2113,7 @@ var LANG = {
exp: "Erf.",
faction: "Fraktion",
gains: "Belohnungen",
gender: "Geschlecht",
gems: "Edelsteine",
gearscore: "Ausr\u00fcstung",
glyphtype: "Glyphenart",

View File

@@ -2158,6 +2158,7 @@ var LANG = {
exp: "Exp.",
faction: "Faction",
gains: "Gains",
gender: "Gender",
gems: "Gems",
gearscore: "Gear",
glyphtype: "Glyph type",

47
template/title.tpl Normal file
View File

@@ -0,0 +1,47 @@
{include file='header.tpl'}
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
{if !empty($announcements)}
{foreach from=$announcements item=item}
{include file='bricks/announcement.tpl' an=$item}
{/foreach}
{/if}
<script type="text/javascript">
{include file='bricks/community.tpl'}
var g_pageInfo = {ldelim}type: {$page.type}, typeId: {$page.typeId}, name: '{$data.page.name|escape:"quotes"}'{rdelim};
g_initPath({$page.path});
</script>
{include file='bricks/infobox.tpl'}
<div class="text">
<a href="javascript:;" id="open-links-button" class="button-red" onclick="this.blur(); Links.show({ldelim} type: 11, typeId: {$data.page.id} {rdelim});">
<em><b><i>{$lang.link}</i></b><span>{$lang.link}</span></em>
</a>
<a href="http://old.wowhead.com/?{$query}" class="button-red"><em><b><i>Wowhead</i></b><span>Wowhead</span></em></a>
<h1 class="h1-icon">{if isset($data.page.expansion)}<span class="{$data.page.expansion}-icon-right">{$data.page.name}</span>{else}{$data.page.name}{/if}</h1>
<h2 class="clear">{$lang.related}</h2>
</div>
<div id="tabs-generic"></div>
<div id="listview-generic" class="listview"></div>
<script type="text/javascript">//<![CDATA[
var tabsRelated = new Tabs({ldelim}parent: ge('tabs-generic'){rdelim});
{if isset($data.page.acvReward)} {include file='bricks/achievement_table.tpl' data=$data.page.acvReward params=$data.page.acvParams } {/if}
{if isset($data.page.questReward)} {include file='bricks/quest_table.tpl' data=$data.page.questReward params=$data.page.questParams} {/if}
new Listview({ldelim}template: 'comment', id: 'comments', name: LANG.tab_comments, tabs: tabsRelated, parent: 'listview-generic', data: lv_comments{rdelim});
new Listview({ldelim}template: 'screenshot', id: 'screenshots', name: LANG.tab_screenshots, tabs: tabsRelated, parent: 'listview-generic', data: lv_screenshots{rdelim});
if (lv_videos.length || (g_user && g_user.roles & (U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_VIDEO)))
new Listview({ldelim}template: 'video', id: 'videos', name: LANG.tab_videos, tabs: tabsRelated, parent: 'listview-generic', data: lv_videos{rdelim});
tabsRelated.flush();
//]]></script>
{include file='bricks/contribute.tpl'}
</div><!-- main-contents -->
</div><!-- main -->
{include file='footer.tpl'}

20
template/titles.tpl Normal file
View File

@@ -0,0 +1,20 @@
{include file='header.tpl'}
<div id="main">
<div id="main-precontents"></div>
<div id="main-contents" class="main-contents">
<script type="text/javascript">
g_initPath({$page.path});
</script>
<div id="lv-titles" class="listview"></div>
<script type="text/javascript">
{include file='bricks/title_table.tpl' data=$data.page params=null}
</script>
<div class="clear"></div>
</div>
</div>
{include file='footer.tpl'}