* added quests to search

* added forgotten localizations
This commit is contained in:
Sarjuuk
2013-08-03 21:10:49 +02:00
parent e834f1aee3
commit 06e5fb7278
12 changed files with 160 additions and 43 deletions

View File

@@ -5,6 +5,8 @@ if (!defined('AOWOW_REVISION'))
class ItemList extends BaseType
{
use ListviewHelper;
public static $type = TYPE_ITEM;
public $tooltip = '';
@@ -34,6 +36,15 @@ class ItemList extends BaseType
// readdress itemset .. is wrong for virtual sets
if ($pieceToSet && isset($pieceToSet[$this->id]))
$this->json[$this->id]['itemset'] = $pieceToSet[$this->id];
// unify those pesky masks
$_ = $this->curTpl['AllowableClass'];
if ($_ < 0 || ($_ & CLASS_MASK_ALL) == CLASS_MASK_ALL)
$this->templates[$this->id]['AllowableClass'] = 0;
$_ = $this->curTpl['AllowableRace'];
if ($_ < 0 || ($_ & RACE_MASK_ALL) == RACE_MASK_ALL)
$this->templates[$this->id]['AllowableRace'] = 0;
}
$this->reset(); // restore 'iterator'
@@ -134,13 +145,15 @@ class ItemList extends BaseType
if ($x = $this->curTpl['ContainerSlots'])
$data[$this->id]['nslots'] = $x;
$_ = $this->curTpl['AllowableRace'];
if ($_ && $_ & RACE_MASK_ALLIANCE != RACE_MASK_ALLIANCE && $_ & RACE_MASK_HORDE != RACE_MASK_HORDE)
$data[$this->id]['reqrace'] = $_;
if (!in_array($this->curTpl['AllowableRace'], [-1, 0]) && $this->curTpl['AllowableRace'] & RACE_MASK_ALL != RACE_MASK_ALL &&
$this->curTpl['AllowableRace'] & RACE_MASK_ALLIANCE != RACE_MASK_ALLIANCE && $this->curTpl['AllowableRace'] & RACE_MASK_HORDE != RACE_MASK_HORDE)
$data[$this->id]['reqrace'] = $this->curTpl['AllowableRace'];
if ($_ = $this->curTpl['AllowableClass'])
$data[$this->id]['reqclass'] = $_; // $data[$this->id]['classes'] ??
if (!in_array($this->curTpl['AllowableClass'], [-1, 0]) && $this->curTpl['AllowableClass'] & CLASS_MASK_ALL != CLASS_MASK_ALL)
$data[$this->id]['reqclass'] = $this->curTpl['AllowableClass']; // $data[$this->id]['classes'] ??
if ($this->curTpl['Flags'] & ITEM_FLAG_HEROIC)
$data[$this->id]['heroic'] = true;
}
/* even more complicated crap
@@ -486,6 +499,7 @@ class ItemList extends BaseType
// required races
if ($races = Lang::getRaceString($this->curTpl['AllowableRace']))
if ($races['side'] != SIDE_BOTH)
$x .= Lang::$game['races'].Lang::$colon.$races['name'].'<br />';
// required honorRank (not used anymore)
@@ -876,7 +890,7 @@ class ItemList extends BaseType
}
foreach ($this->json[$this->id] as $k => $v)
if (!isset($v) || $v === "false" || (!in_array($k, ['classs', 'subclass', 'quality']) && $v == "0"))
if (!isset($v) || $v === "false" || (!in_array($k, ['classs', 'subclass', 'quality', 'side']) && $v == "0"))
unset($this->json[$this->id][$k]);
}
@@ -1049,7 +1063,7 @@ class ItemList extends BaseType
// clear zero-values afterwards
foreach ($json as $k => $v)
if (!isset($v) || $v === "false" || (!in_array($k, ['classs', 'subclass', 'quality']) && $v == "0"))
if (!isset($v) || $v === "false" || (!in_array($k, ['classs', 'subclass', 'quality', 'side']) && $v == "0"))
unset($json[$k]);
$this->json[$json['id']] = $json;

View File

@@ -11,7 +11,7 @@ class QuestList extends BaseType
public $cat2 = 0;
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM quest_template qt LEFT JOIN locales_quest lq ON qt.Id = lq.entry WHERE [filter] [cond] ORDER BY Id ASC';
protected $matchQuery = 'SELECT COUNT(1) FROM quest_template WHERE [filter] [cond]';
protected $matchQuery = 'SELECT COUNT(1) FROM quest_template qt LEFT JOIN locales_quest lq ON qt.Id = lq.entry WHERE [filter] [cond]';
// parent::__construct does the job
@@ -61,11 +61,13 @@ class QuestList extends BaseType
return Util::localizedString($n, 'title');
}
public static function RewardXP($QuestLevel, $XPId)
public static function getXPReward($questLevel, $xpId)
{
if ($xp = DB::Aowow()->SelectCell('SELECT Field?d FROM ?_questxp WHERE Id = ?d', $XPId, $QuestLevel)) {
if (!is_numeric($xpId) || $xpId < 0 || $xpId > 8)
return 0;
if ($xp = DB::Aowow()->selectCell('SELECT Field?d FROM ?_questxp WHERE Id = ?d', $xpId, $questLevel))
return $xp;
}
else
return 0;
}
@@ -102,7 +104,9 @@ class QuestList extends BaseType
'level' => $this->curTpl['Level'],
'reqlevel' => $this->curTpl['MinLevel'],
'name' => $this->getField('Title', true),
'side' => Util::sideByRaceMask($this->curTpl['RequiredRaces'])
'side' => Util::sideByRaceMask($this->curTpl['RequiredRaces']),
'wflags' => 0x0,
'xp' => self::getXPReward($this->curTpl['Level'], $this->curTpl['RewardXPId'])
);
$rewards = [];
@@ -121,8 +125,37 @@ class QuestList extends BaseType
if ($choices)
$data[$this->id]['itemchoices'] = $choices;
if ($this->curTpl['RewardTitleId'])
$data[$this->id]['titlereward'] = $this->curTpl['RewardTitleId'];
if ($_ = $this->curTpl['RewardTitleId'])
$data[$this->id]['titlereward'] = $_;
if ($_ = $this->curTpl['Type'])
$data[$this->id]['type'] = $_;
if ($_ = $this->curTpl['RequiredClasses'])
$data[$this->id]['reqclass'] = $_;
if ($_ = $this->curTpl['RequiredRaces'])
$data[$this->id]['reqrace'] = $_;
if ($_ = $this->curTpl['RewardOrRequiredMoney'])
if ($_ > 0)
$data[$this->id]['money'] = $_;
if ($this->curTpl['Flags'] & 0x1000)
$data[$this->id]['daily'] = true;
if ($this->curTpl['Flags'] & 0x8000)
$data[$this->id]['weekly'] = true;
// flags & 64: Hostile - there are quests, that flag the player for pvp when taken .. where is that set..?
if ($this->curTpl['Flags'] & 0x4000) // Unavailable (todo (med): get disables)
{
$data[$this->id]['historical'] = true; // post 5.0
$data[$this->id]['wflags'] |= 0x1; // pre 5.0
}
if ($this->curTpl['Flags'] & 0x80000) // Auto Accept
$data[$this->id]['wflags'] |= 0x20;
// todo reprewards .. accesses QuestFactionReward.dbc
}

View File

@@ -400,6 +400,7 @@ class Lang
public static $error;
public static $search;
public static $profiler;
public static $compare;
public static $talent;
@@ -1722,16 +1723,19 @@ class Util
public static function sideByRaceMask($race)
{
if (!$race || $race == RACE_MASK_ALL) // Any
// Any
if (!$race || ($race & RACE_MASK_ALL) == RACE_MASK_ALL)
return 3;
if ($race & RACE_MASK_HORDE) // Horde
// Horde
if ($race & RACE_MASK_HORDE && !($race & RACE_MASK_ALLIANCE))
return 2;
if ($race & RACE_MASK_ALLIANCE) // Alliance
// Alliance
if ($race & RACE_MASK_ALLIANCE && !($race & RACE_MASK_HORDE))
return 1;
return 0;
return 3;
}
public static function asHex($val)

View File

@@ -68,6 +68,8 @@ $lang = array(
'applyFilter' => "Filter anwenden",
'resetForm' => "Formular zurücksetzen",
'refineSearch' => "Tipp: Präzisiere deine Suche mit Durchsuchen einer <a href=\"javascript:;\" id=\"fi_subcat\">Unterkategorie</a>.",
'clear' => "leeren",
'exactMatch' => "Exakt passend",
// infobox
'unavailable' => "Nicht für Spieler verfügbar",
@@ -116,6 +118,8 @@ $lang = array(
'pets' => "Begleiter",
'petCalc' => "Begleiterrechner",
'requires' => "Benötigt %s",
'profile' => "",
'profiles' => "Profile",
'requires2' => "Benötigt",
'reqLevel' => "Benötigt Stufe %s",
'reqLevelHlm' => "Benötigt Stufe %s",
@@ -297,8 +301,8 @@ $lang = array(
'_conveyBonus' => "Das Tragen mehrerer Gegenstände aus diesem Set gewährt Eurem Charakter Boni.",
'_pieces' => "Teile",
'_unavailable' => "Dieses Ausrüstungsset ist nicht für Spieler verfügbar.",
'_type' => "Art",
'_tag' => "Tag",
'_type' => "Art",
'notes' => array(
null, "Dungeon-Set 1", "Dungeon-Set 2", "Tier 1 Raid-Set",

View File

@@ -16,7 +16,7 @@ $lang = array(
'numSQL' => "Number of MySQL queries",
'timeSQL' => "Time of MySQL queries",
'noJScript' => "<b>This site makes extensive use of JavaScript.</b><br />Please <a href=\"https://www.google.com/support/adsense/bin/answer.py?answer=12654\" target=\"_blank\">enable JavaScript</a> in your browser.",
'profiles' => "Your Characters",
'profiles' => "My Profiles",
'pageNotFound' => "This %s doesn't exist.",
'gender' => "Gender",
'sex' => [null, 'Male', 'Female'],
@@ -63,6 +63,8 @@ $lang = array(
'applyFilter' => "Apply filter",
'resetForm' => "Reset Form",
'refineSearch' => "Tip: Refine your search by browsing a <a href=\"javascript:;\" id=\"fi_subcat\">subcategory</a>.",
'clear' => "clear",
'exactMatch' => "Exact match",
// infobox
'unavailable' => "Not available to players",
@@ -110,6 +112,8 @@ $lang = array(
'pet' => "Pet",
'pets' => "Hunter Pets",
'petCalc' => "Hunter Pet Calculator",
'profile' => "profile",
'profiles' => "Profiles",
'requires' => "Requires %s",
'requires2' => "Requires",
'reqLevel' => "Requires Level %s",
@@ -119,7 +123,6 @@ $lang = array(
'school' => "School",
'spell' => "spell",
'spells' => "Spells",
'type' => "Type",
'valueDelim' => " to ",
'zone' => "zone",
'zones' => "Zones",
@@ -294,6 +297,7 @@ $lang = array(
'_pieces' => "pieces",
'_unavailable' => "This item set is not available to players.",
'_tag' => "Tag",
'_type' => "Type",
'notes' => array(
null, "Dungeon Set 1", "Dungeon Set 2", "Tier 1 Raid Set",

View File

@@ -60,6 +60,8 @@ $lang = array(
'applyFilter' => "Aplicar filtro",
'resetForm' => "Reiniciar formulario",
'refineSearch' => "Sugerencia: Refina tu búsqueda llendo a una <a href=\"javascript:;\" id=\"fi_subcat\">subcategoría</a>.",
'clear' => "borrar",
'exactMatch' => "Coincidencia exacta",
// infobox
'unavailable' => "No está disponible a los jugadores",
@@ -107,6 +109,8 @@ $lang = array(
'pet' => "Mascota",
'pets' => "Mascotas de cazador",
'petCalc' => "Calculadora de mascotas",
'profile' => "",
'profiles' => "Perfiles",
'requires' => "Requiere %s",
'requires2' => "Requiere",
'reqLevel' => "Necesitas ser de nivel %s",
@@ -116,7 +120,6 @@ $lang = array(
'school' => "Escuela",
'spell' => "hechizo",
'spells' => "Hechizos",
'type' => "Tipo",
'valueDelim' => " - ",
'zone' => "zona",
'zones' => "Zonas",
@@ -252,6 +255,7 @@ $lang = array(
'_pieces' => "piezas",
'_unavailable' => "Este conjunto de objetos no está disponible para jugadores.",
'_tag' => "Etiqueta",
'_type' => "Tipo",
'notes' => array(
null, "Set de mazmorra 1", "Set de mazmorra 2", "Set de banda tier 1",

View File

@@ -60,6 +60,8 @@ $lang = array(
'applyFilter' => "Appliquer le filtre",
'resetForm' => "Rétablir",
'refineSearch' => "Astuce : Affinez votre recherche en utilisant une <a href=\"javascript:;\" id=\"fi_subcat\">sous-catégorie</a>.",
'clear' => "effacer",
'exactMatch' => "Concordance exacte",
// infobox
'unavailable' => "Non disponible aux joueurs",
@@ -107,6 +109,8 @@ $lang = array(
'pet' => "Familier",
'pets' => "Familiers de chasseur",
'petCalc' => "Calculateur de familiers",
'profile' => "",
'profiles' => "Profils",
'requires' => "%s requis",
'requires2' => "Requiert",
'reqLevel' => "Niveau %s requis",
@@ -116,7 +120,6 @@ $lang = array(
'school' => "École",
'spell' => "sort",
'spells' => "Sorts",
'type' => "Type",
'valueDelim' => " - ",
'zone' => "zone",
'zones' => "Zones",
@@ -251,6 +254,7 @@ $lang = array(
'_pieces' => "pièces",
'_unavailable' => "Cet objet n'est plus disponible aux joueurs.",
'_tag' => "Étiquette",
'_type' => "Type",
'notes' => array(
null, "Ensemble de donjon 1", "Ensemble de donjon 2", "Ensemble de raid palier 1",

View File

@@ -60,6 +60,8 @@ $lang = array(
'applyFilter' => "Применить фильтр",
'resetForm' => "Очистить форму",
'refineSearch' => "Совет: Уточните поиск, добавив <a href=\"javascript:;\" id=\"fi_subcat\">подкатегорию</a>.",
'clear' => "Очистить",
'exactMatch' => "Полное совпадение",
// infobox
'unavailable' => "Недоступно игрокам",
@@ -106,6 +108,8 @@ $lang = array(
'mechAbbr' => "Механика",
'pet' => "Питомец",
'pets' => "Питомцы охотников",
'profile' => "",
'profiles' => "Профили",
'petCalc' => "Расчёт умений питомцев",
'requires' => "Требует %s",
'requires2' => "Требуется:",
@@ -116,7 +120,6 @@ $lang = array(
'school' => "Школа",
'spell' => "заклинание",
'spells' => "Заклинания",
'type' => "Тип",
'valueDelim' => " - ",
'zone' => "игровая зона",
'zones' => "Местности",
@@ -251,6 +254,7 @@ $lang = array(
'_pieces' => "частей",
'_unavailable' => "Этот набор предметов не доступен игрокам.",
'_tag' => "Тэг",
'_type' => "Тип",
'notes' => array(
null, "Комплект подземелий 1", "Комплект подземелий 2", "Рейдовый комплект Tier 1",

View File

@@ -68,7 +68,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
// type
if ($ty)
$infobox[] = Lang::$game['type'].lang::$colon.Lang::$itemset['types'][$ty];
$infobox[] = Lang::$itemset['_type'].lang::$colon.Lang::$itemset['types'][$ty];
// tag
if ($ta)

View File

@@ -34,7 +34,7 @@ if (!defined('AOWOW_REVISION'))
13: Listview - template: 'spell', id: 'companions', name: LANG.tab_companions,
14: Listview - template: 'spell', id: 'mounts', name: LANG.tab_mounts,
todo 15: Listview - template: 'npc', id: 'npcs', name: LANG.tab_npcs,
todo 16: Listview - template: 'quest', id: 'quests', name: LANG.tab_quests,
16: Listview - template: 'quest', id: 'quests', name: LANG.tab_quests,
17: Listview - template: 'achievement', id: 'achievements', name: LANG.tab_achievements,
18: Listview - template: 'achievement', id: 'statistics', name: LANG.tab_statistics,
todo 19: Listview - template: 'zone', id: 'zones', name: LANG.tab_zones,
@@ -698,7 +698,36 @@ if ($searchMask & 0x4000)
}
// 16 Quests
// if ($searchMask & 0x8000)
if ($searchMask & 0x8000)
{
$conditions = array(
// [['cuFlags', MASK, '&'], 0], // todo (med): identify disabled quests
[User::$localeId ? 'Title_loc'.User::$localeId : 'Title', $query], // todo (high): unify name-fields
$maxResults
);
$quests = new QuestList($conditions);
if ($data = $quests->getListviewData())
{
$quests->addGlobalsToJScript($smarty);
$found['quest'] = array(
'type' => TYPE_QUEST,
'appendix' => ' (Quest)',
'matches' => $quests->getMatches(),
'file' => 'quest',
'data' => $data,
'params' => ['tabs' => '$myTabs']
);
}
if ($quests->getMatches() > $maxResults)
{
$found['quest']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_questsfound', $quests->getMatches(), $maxResults);
$found['quest']['params']['_truncated'] = 1;
}
}
// 17 Achievements
if ($searchMask & 0x10000)
@@ -726,7 +755,7 @@ if ($searchMask & 0x10000)
'data' => $data,
'params' => [
'tabs' => '$myTabs',
'visibleCols' => "\$['category']"
'visibleCols' => "$['category']"
]
);
@@ -760,8 +789,8 @@ if ($searchMask & 0x20000)
'data' => $data,
'params' => [
'tabs' => '$myTabs',
'visibleCols' => "\$['category']",
'hiddenCols' => "\$['side', 'points', 'rewards']",
'visibleCols' => "$['category']",
'hiddenCols' => "$['side', 'points', 'rewards']",
'name' => '$LANG.tab_statistics',
'id' => 'statistics'
]
@@ -803,9 +832,7 @@ if ($searchMask & 0x400000)
'matches' => $pets->getMatches(),
'file' => 'pet',
'data' => $data,
'params' => [
'tabs' => '$myTabs',
]
'params' => ['tabs' => '$myTabs']
);
if ($pets->getMatches() > $maxResults)
@@ -960,7 +987,7 @@ if ($searchMask & SEARCH_TYPE_JSON)
}
else if ($searchMask & SEARCH_TYPE_OPEN)
{
// this one is funny: we want 10 results, ideally equally destributed over each type
// this one is funny: we want 10 results, ideally equally distributed over each type
$foundTotal = 0;
$maxResults = 10;
$names = [];

View File

@@ -23,6 +23,16 @@
{/if}
classs:{$curr.classs},
subclass:{$curr.subclass},
side:{$curr.side},
{if isset($curr.reqclass)}
reqclass:{$curr.reqclass},
{/if}
{if isset($curr.reqrace)}
reqrace:{$curr.reqrace},
{/if}
{if isset($curr.heroic)}
heroic:1,
{/if}
{if isset($curr.maxcount)}
{if $curr.maxcount > 1}
stack:[{$curr.mincount},{$curr.maxcount}],

View File

@@ -17,9 +17,15 @@
id:'{$curr.id}',
name:'{$curr.name|escape:"quotes"}',
level:'{$curr.level}',
{if ($curr.reqlevel)}
{if isset($curr.reqlevel)}
reqlevel:{$curr.reqlevel},
{/if}
{if isset($curr.reqclass)}
reqclass:{$curr.reqclass},
{/if}
{if isset($curr.reqrace)}
reqrace:{$curr.reqrace},
{/if}
side:'{$curr.side}'
{if isset($curr.itemrewards)}
,itemrewards:[
@@ -37,7 +43,7 @@
{/section}
]
{/if}
{if isset($curr.xp)}
{if $curr.xp}
,xp:{$curr.xp}
{/if}
{if isset($curr.titlereward)}
@@ -55,11 +61,14 @@
{if isset($curr.type)}
,type:{$curr.type}
{/if}
{if isset($curr.Daily)}
{if isset($curr.daily)}
,daily:1
{/if}
{if isset($curr.flags)}
,wflags:$curr.flags {* wflags: &1: disabled/historical; &32: AutoAccept; &64: Hostile(?) *}
{if isset($curr.weekly)}
,weekly:1
{/if}
{if $curr.wflags}
,wflags:{$curr.wflags} {* wflags: &1: disabled/historical; &32: AutoAccept; &64: Hostile(?) *}
{/if}
{rdelim}
{if $smarty.foreach.i.last}{else},{/if}