Profiler/Regions

* add Asia regions
 * fixed some typos
This commit is contained in:
Sarjuuk
2022-02-19 13:01:29 +01:00
parent a24e8594fb
commit 10805a1f70
17 changed files with 92 additions and 46 deletions

View File

@@ -183,7 +183,24 @@ class Profiler
{
if (DB::isConnectable(DB_AUTH) && !self::$realms)
{
self::$realms = DB::Auth()->select('SELECT id AS ARRAY_KEY, name, IF(timezone IN (8, 9, 10, 11, 12), "eu", "us") AS region FROM realmlist WHERE allowedSecurityLevel = 0 AND gamebuild = ?d', WOW_BUILD);
self::$realms = DB::Auth()->select('SELECT
id AS ARRAY_KEY,
`name`,
CASE
WHEN timezone IN (2, 3, 4) THEN "us"
WHEN timezone IN (8, 9, 10, 11, 12) THEN "eu"
WHEN timezone = 6 THEN "kr"
WHEN timezone = 14 THEN "tw"
WHEN timezone = 16 THEN "cn"
END AS region
FROM
realmlist
WHERE
allowedSecurityLevel = 0 AND
gamebuild = ?d',
WOW_BUILD
);
foreach (self::$realms as $rId => $rData)
{
if (DB::isConnectable(DB_CHARACTERS . $rId))

View File

@@ -88,7 +88,7 @@ class ArenaTeamListFilter extends Filter
protected function cbRegionCheck(&$v)
{
if ($v == 'eu' || $v == 'us')
if (in_array($v, Util::$regions))
{
$this->parentCats[0] = $v; // directly redirect onto this region
$v = ''; // remove from filter

View File

@@ -126,7 +126,7 @@ class GuildListFilter extends Filter
protected function cbRegionCheck(&$v)
{
if ($v == 'eu' || $v == 'us')
if (in_array($v, Util::$regions))
{
$this->parentCats[0] = $v; // directly redirect onto this region
$v = ''; // remove from filter

View File

@@ -379,7 +379,7 @@ class ProfileListFilter extends Filter
protected function cbRegionCheck(&$v)
{
if ($v == 'eu' || $v == 'us')
if (in_array($v, Util::$regions))
{
$this->parentCats[0] = $v; // directly redirect onto this region
$v = ''; // remove from filter

View File

@@ -326,6 +326,10 @@ class Util
'www', null, 'fr', 'de', 'cn', null, 'es', null, 'ru'
);
public static $regions = array(
'us', 'eu', 'kr', 'tw', 'cn'
);
public static $typeClasses = array(
null, 'CreatureList', 'GameObjectList', 'ItemList', 'ItemsetList', 'QuestList', 'SpellList',
'ZoneList', 'FactionList', 'PetList', 'AchievementList', 'TitleList', 'WorldEventList', 'CharClassList',

View File

@@ -52,13 +52,6 @@ class Lang
// *cough* .. reuse-hacks (because copy-pastaing text for 5 locales sucks)
self::$item['cat'][2] = [self::$item['cat'][2], self::$spell['weaponSubClass']];
self::$item['cat'][2][1][14] .= ' ('.self::$item['cat'][2][0].')';
// not localized .. for whatever reason
self::$profiler['regions'] = array(
'eu' => "Europe",
'us' => "US & Oceanic"
);
self::$main['moreTitles']['privilege'] = self::$privileges['_privileges'];
}

View File

@@ -112,7 +112,6 @@ $lang = array(
// search
'search' => "Suche",
'searchButton' => "Suche",
'foundResult' => "Suchergebnisse für",
'noResult' => "Keine Ergebnisse für",
'tryAgain' => "Bitte versucht es mit anderen Suchbegriffen oder überprüft deren Schreibweise.",
@@ -175,6 +174,13 @@ $lang = array(
'arenateam' => "Dieses Arena Team existiert nicht oder wurde noch nicht in die Datenbank übernommen.",
'profile' => "Dieser Charakter existiert nicht oder wurde noch nicht in die Datenbank übernommen."
),
'regions' => array(
'us' => "Americas",
'eu' => "Europa",
'kr' => "Korea",
'tw' => "Taiwan",
'cn' => "China"
),
'encounterNames'=> array(
243 => "Die Sieben",
334 => "Großchampions",

View File

@@ -112,7 +112,6 @@ $lang = array(
// search
'search' => "Search",
'searchButton' => "Search",
'foundResult' => "Search Results for",
'noResult' => "No Results for",
'tryAgain' => "Please try some different keywords or check your spelling.",
@@ -175,6 +174,13 @@ $lang = array(
'arenateam' => "This Arena Team doesn't exist or is not yet in the database.",
'profile' => "This character doesn't exist or is not yet in the database."
),
'regions' => array(
'us' => "Americas",
'eu' => "Europe",
'kr' => "Korea",
'tw' => "Taiwan",
'cn' => "China"
),
'encounterNames'=> array( // from dungeonencounter.dbc
243 => "The Seven",
334 => "Grand Champions",

View File

@@ -112,7 +112,6 @@ $lang = array(
// search
'search' => "Búsqueda",
'searchButton' => "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.",
@@ -154,7 +153,7 @@ $lang = array(
'profiler' => array(
'realm' => "Reino",
'region' => "Región",
'viewCharacter' => "View Character",
'viewCharacter' => "Ver personaje",
'_cpHint' => "l <b>Gestor de perfiles</b> te permite editar tu personaje, encontrar mejoras de equipo, comprobar tu gearscore, ¡y más!",
'_cpHelp' => "Para comenzar, sigue los pasos abajo indicados. Si quieres más información, revisa nuestra amplia <a href=\"?help=profiler\">página de ayuda</a>.",
'_cpFooter' => "Si quieres una búsqueda más refinada, prueba con nuestras opciones de <a href=\"?profiles\">búsqueda avanzada</a>. También puedes crear un <a href=\"?profile&amp;new\">perfil nuevo personalizado</a>.",
@@ -175,6 +174,13 @@ $lang = array(
'arenateam' => "[This Arena Team doesn't exist or is not yet in the database.]",
'profile' => "Este personaje no existe o no está aun en la base de datos.",
),
'regions' => array(
'us' => "Américas",
'eu' => "Europa",
'kr' => "Corea",
'tw' => "Taiwán",
'cn' => "China"
),
'encounterNames'=> array(
243 => "Los Siete",
334 => "Grandes Campeones",

View File

@@ -112,7 +112,6 @@ $lang = array(
// search
'search' => "Recherche",
'searchButton' => "Rechercher",
'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.",
@@ -175,6 +174,13 @@ $lang = array(
'arenateam' => "[This Arena Team doesn't exist or is not yet in the database.]",
'profile' => "[This character doesn't exist or is not yet in the database.]"
),
'regions' => array(
'us' => "Amériques",
'eu' => "L'Europe",
'kr' => "Corée",
'tw' => "Taïwan",
'cn' => "Chine"
),
'encounterNames'=> array(
243 => "Les Sept",
334 => "Grands champions",

View File

@@ -112,7 +112,6 @@ $lang = array(
// search
'search' => "Поиск",
'searchButton' => "Поиск",
'foundResult' => "Результаты поиска для",
'noResult' => "Ничего не найдено для",
'tryAgain' => "Пожалуйста, попробуйте другие ключевые слова или проверьте правильность запроса.",
@@ -175,6 +174,13 @@ $lang = array(
'arenateam' => "[This Arena Team doesn't exist or is not yet in the database.]",
'guild' => "Такая гильдия не существует, или еще не добавлена в базу данных."
),
'regions' => array(
'us' => "Америка",
'eu' => "Европа",
'kr' => "Корея",
'tw' => "Тайвань",
'cn' => "Китай"
),
'encounterNames'=> array(
243 => "Семеро",
334 => "Абсолютные чемпионы",

View File

@@ -112,7 +112,6 @@ $lang = array(
// search
'search' => "搜索",
'searchButton' => "搜索",
'foundResult' => "搜索结果关于",
'noResult' => "没有搜索结果关于",
'tryAgain' => "请尝试不同的关键词或检查你的拼写。",
@@ -175,6 +174,13 @@ $lang = array(
'arenateam' => "This Arena Team doesn't exist or is not yet in the database.",
'profile' => "This character doesn't exist or is not yet in the database."
),
'regions' => array(
'us' => "美洲地区",
'eu' => "欧洲",
'kr' => "韩国",
'tw' => "台湾",
'cn' => "中国"
),
'encounterNames'=> array(
243 => "黑铁七贤",
334 => "总冠军",

View File

@@ -108,7 +108,7 @@ trait TrProfiler
$cat = array_map('urldecode', $cat);
if ($cat[0] !== 'eu' && $cat[0] !== 'us')
if (array_search($cat[0], Util::$regions) === false)
return;
$this->region = $cat[0];

View File

@@ -102,7 +102,7 @@ class ProfilePage extends GenericPage
$char['cuFlags'] = PROFILER_CU_NEEDS_RESYNC;
if ($char['at_login'] & 0x1)
$char['renameItr'] = DB::Aowow()->selectCell('SELECT MAX(renameItr) FROM ?_profiler_profiles WHERE realm = ?d AND realmGUID IS NOT NULL AND name = ?', $realmId, $char['name']);
$char['renameItr'] = DB::Aowow()->selectCell('SELECT MAX(renameItr) FROM ?_profiler_profiles WHERE realm = ?d AND realmGUID IS NOT NULL AND name = ?', $this->realmId, $char['name']);
if ($char['guildGUID'])
{

View File

@@ -109,7 +109,7 @@ class CLISetup
// alternative data source (no quotes, use forward slash)
if (isset(self::$opts['mpqDataDir']))
self::$srcDir = CLI::nicePath($self::$opts['mpqDataDir']);
self::$srcDir = CLI::nicePath(self::$opts['mpqDataDir']);
// optional limit handled locales
if (isset(self::$opts['locales']))

View File

@@ -38,41 +38,34 @@ if (!CLI)
function realmMenu()
{
$subEU = [];
$subUS = [];
$set = 0x0;
$menu = [
$subs = [];
$set = 0x0;
$menu = [
// skip usage of battlegroup
// ['us', Lang::profiler('regions', 'us'), null,[[Profiler::urlize(CFG_BATTLEGROUP), CFG_BATTLEGROUP, null, &$subUS]]],
// ['eu', Lang::profiler('regions', 'eu'), null,[[Profiler::urlize(CFG_BATTLEGROUP), CFG_BATTLEGROUP, null, &$subEU]]]
['us', Lang::profiler('regions', 'us'), null, &$subUS],
['eu', Lang::profiler('regions', 'eu'), null, &$subEU]
];
foreach (Util::$regions as $idx => $n)
$subs[$idx] = [];
foreach (Profiler::getRealms() as $row)
{
if ($row['region'] == 'eu')
$idx = array_search($row['region'], Util::$regions);
if ($idx !== false)
{
$set |= 0x1;
$subEU[] = [Profiler::urlize($row['name'], true), $row['name']];
}
else if ($row['region'] == 'us')
{
$set |= 0x2;
$subUS[] = [Profiler::urlize($row['name'], true), $row['name']];
$set |= (1 << $idx);
$subs[$idx][] = [Profiler::urlize($row['name'], true), $row['name']];
}
}
if (!$set)
CLI::write(' - realmMenu: Auth-DB not set up .. menu will be empty', CLI::LOG_WARN);
CLI::write(' - realmMenu: Auth-DB not set up .. realm menu will be empty', CLI::LOG_WARN);
if (!($set & 0x1))
array_pop($menu);
if (!($set & 0x2))
array_shift($menu);
foreach (Util::$regions as $idx => $n)
if ($set & (1 << $idx))
$menu[] = [$n, Lang::profiler('regions', $n), null, &$subs[$idx]];
return Util::toJSON($menu);
}
?>

View File

@@ -27,8 +27,11 @@
<div>
<h2><?=Lang::profiler('region').Lang::main('colon'); ?></h2>
<input type="radio" name="rg" value="us" id="rg-1" checked="checked" /><label for="rg-1" class="profiler-button profiler-option-left selected"><em><i>US &amp; Oceanic</i></em></label>
<input type="radio" name="rg" value="eu" id="rg-2" /><label for="rg-2" class="profiler-button profiler-option-right"><em><i>Europe</i></em></label>
<?php
foreach (Util::$regions as $idx => $n):
echo ' <input type="radio" name="rg" value="'.$n.'" id="rg-'.($idx+1).'" '.(!$idx ? 'checked="checked" ' : '').'/><label for="rg-'.($idx+1).'" class="profiler-button profiler-option-left'.(!$idx ? ' selected' : '').'"><em><i>'.Lang::profiler('regions', $n).'</i></em></label>';
endforeach;
?>
</div>
<div>
@@ -39,7 +42,7 @@
<div class="profiler-buttons">
<a href="javascript:;" class="profiler-button" id="profiler-lookup"><em><?=Lang::profiler('viewCharacter'); ?></em></a>
<a href="javascript:;" class="profiler-button" id="profiler-search"><em><?=Lang::main('searchButton'); ?></em></a>
<a href="javascript:;" class="profiler-button" id="profiler-search"><em><?=Lang::main('search'); ?></em></a>
</div>
</div>