- display if realm first achievement is still available on Achievement detail page

- --siteconfig now asks for the realmId when adding a new character DBs
  ( old entries should be set manually or deleted and then set anew)
This commit is contained in:
Sarjuuk
2015-05-14 02:02:53 +02:00
parent 929cb95bcd
commit 8ca173bb33
11 changed files with 56 additions and 28 deletions

View File

@@ -4,6 +4,8 @@ if (!defined('AOWOW_REVISION'))
die('illegal access'); die('illegal access');
// use as example. File is generated from setup.
// -- Aowow Database -- // -- Aowow Database --
// contains world-data, user-data and logs // contains world-data, user-data and logs
$AoWoWconf['aowow'] = array( $AoWoWconf['aowow'] = array(
@@ -36,14 +38,12 @@ $AoWoWconf['auth'] = array(
// -- Characters Database -- // -- Characters Database --
// used to display profiles // used to display profiles
$AoWoWconf['characters'][0] = array( $AoWoWconf['characters'][<realmId>] = array(
'host' => '127.0.0.1', 'host' => '127.0.0.1',
'user' => '<user>', 'user' => '<user>',
'pass' => '<pass>', 'pass' => '<pass>',
'db' => 'characters', 'db' => 'characters',
'prefix' => '' 'prefix' => ''
); );
// add other realms if necessary
// $AoWoWconf['characters'][] = [];
?> ?>

View File

@@ -250,6 +250,7 @@ define('QUEST_CU_AUTO_ACCEPT', 0x20);
define('QUEST_CU_PVP_ENABLED', 0x40); define('QUEST_CU_PVP_ENABLED', 0x40);
define('MAX_LEVEL', 80); define('MAX_LEVEL', 80);
define('WOW_BUILD', 12340);
// Loot handles // Loot handles
define('LOOT_FISHING', 'fishing_loot_template'); define('LOOT_FISHING', 'fishing_loot_template');

View File

@@ -437,6 +437,7 @@ $lang = array(
'titleReward' => 'Euch wird der Titel "<a href="?title=%d">%s</a>" verliehen', 'titleReward' => 'Euch wird der Titel "<a href="?title=%d">%s</a>" verliehen',
'slain' => "getötet", 'slain' => "getötet",
'reqNumCrt' => "Benötigt", 'reqNumCrt' => "Benötigt",
'rfAvailable' => "Verfügbar auf Realm:",
'_transfer' => 'Dieser Erfolg wird mit <a href="?achievement=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a> vertauscht, wenn Ihr zur <span class="icon-%s">%s</span> wechselt.', '_transfer' => 'Dieser Erfolg wird mit <a href="?achievement=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a> vertauscht, wenn Ihr zur <span class="icon-%s">%s</span> wechselt.',
), ),
'race' => array( 'race' => array(

View File

@@ -432,6 +432,7 @@ $lang = array(
'titleReward' => 'You shall be granted the title "<a href="?title=%d">%s</a>"', 'titleReward' => 'You shall be granted the title "<a href="?title=%d">%s</a>"',
'slain' => "slain", 'slain' => "slain",
'reqNumCrt' => "Requires", 'reqNumCrt' => "Requires",
'rfAvailable' => "Available on realm:",
'_transfer' => 'This achievement will be converted to <a href="?achievement=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a> if you transfer to <span class="icon-%s">%s</span>.', '_transfer' => 'This achievement will be converted to <a href="?achievement=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a> if you transfer to <span class="icon-%s">%s</span>.',
), ),
'race' => array( 'race' => array(

View File

@@ -436,6 +436,7 @@ $lang = array(
'titleReward' => 'Deberías obtener el título "<a href="?title=%d">%s</a>"', 'titleReward' => 'Deberías obtener el título "<a href="?title=%d">%s</a>"',
'slain' => "matado", 'slain' => "matado",
'reqNumCrt' => "Requiere", 'reqNumCrt' => "Requiere",
'rfAvailable' => "Disponible en reino:",
'_transfer' => 'Este logro será convertido a <a href="?achievement=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a> si lo transfieres a la <span class="icon-%s">%s</span>.', '_transfer' => 'Este logro será convertido a <a href="?achievement=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a> si lo transfieres a la <span class="icon-%s">%s</span>.',
), ),
'race' => array( 'race' => array(

View File

@@ -60,7 +60,7 @@ $lang = array(
'oneFilter' => "Au moins un", 'oneFilter' => "Au moins un",
'applyFilter' => "Appliquer le filtre", 'applyFilter' => "Appliquer le filtre",
'resetForm' => "Rétablir", 'resetForm' => "Rétablir",
'refineSearch' => "Astuce : Affinez votre recherche en utilisant une <a href=\"javascript:;\" id=\"fi_subcat\">sous-catégorie</a>.", 'refineSearch' => "Astuce : Affinez votre recherche en utilisant une <a href=\"javascript:;\" id=\"fi_subcat\">sous-catégorie</a>.",
'clear' => "effacer", 'clear' => "effacer",
'exactMatch' => "Concordance exacte", 'exactMatch' => "Concordance exacte",
'_reqLevel' => "Niveau requis", '_reqLevel' => "Niveau requis",
@@ -119,7 +119,7 @@ $lang = array(
// help // help
'help' => "Aide", 'help' => "Aide",
'helpTopics' => array( 'helpTopics' => array(
"Le guide du commentaire", "Visionneuse 3D", "Captures d'écran : Trucs et astuces", "Échelles de valeurs", "Le guide du commentaire", "Visionneuse 3D", "Captures d'écran : Trucs et astuces", "Échelles de valeurs",
"Calculateur de talents", "Comparaison d'objets", "Profiler", "Markup Guide" "Calculateur de talents", "Comparaison d'objets", "Profiler", "Markup Guide"
), ),
@@ -129,7 +129,7 @@ $lang = array(
'foundResult' => "Résultats de recherche pour", 'foundResult' => "Résultats de recherche pour",
'noResult' => "Aucun résultat pour malordawsne", 'noResult' => "Aucun résultat pour malordawsne",
'tryAgain' => "Veuillez essayer d'autres mots ou vérifiez l'orthographe des termes de recherche.", 'tryAgain' => "Veuillez essayer d'autres mots ou vérifiez l'orthographe des termes de recherche.",
'ignoredTerms' => "Les mots suivants ont été ignorés dans votre recherches : %s", 'ignoredTerms' => "Les mots suivants ont été ignorés dans votre recherches : %s",
// formating // formating
'colon' => ' : ', 'colon' => ' : ',
@@ -317,11 +317,11 @@ $lang = array(
// recovery // recovery
'recoverUser' => "Demande de nom d'utilisateur", 'recoverUser' => "Demande de nom d'utilisateur",
'recoverPass' => "Changement de mot de passe : Étape %s de 2", 'recoverPass' => "Changement de mot de passe : Étape %s de 2",
'newPass' => "New Password", 'newPass' => "New Password",
// creation // creation
'register' => "Enregistrement : Étape %s de 2", 'register' => "Enregistrement : Étape %s de 2",
'passConfirm' => "Confirmez", 'passConfirm' => "Confirmez",
// dashboard // dashboard
@@ -430,11 +430,12 @@ $lang = array(
'points' => "Points", 'points' => "Points",
'series' => "Série", 'series' => "Série",
'outOf' => "sur", 'outOf' => "sur",
'criteriaType' => "Criterium Type-Id:", 'criteriaType' => "Criterium Type-Id : ",
'itemReward' => "Vous recevrez", 'itemReward' => "Vous recevrez",
'titleReward' => "Vous devriez recevoir le titre \"<a href=\"?title=%d\">%s</a>\"", 'titleReward' => "Vous devriez recevoir le titre \"<a href=\"?title=%d\">%s</a>\"",
'slain' => "tué", 'slain' => "tué",
'reqNumCrt' => "Nécessite", 'reqNumCrt' => "Nécessite",
'rfAvailable' => "Disponibles sur les royaumes : ",
'_transfer' => 'Cet haut fait sera converti en <a href="?achievement=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a> si vous transférez en <span class="icon-%s">%s</span>.', '_transfer' => 'Cet haut fait sera converti en <a href="?achievement=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a> si vous transférez en <span class="icon-%s">%s</span>.',
), ),
'race' => array( 'race' => array(
@@ -546,7 +547,7 @@ $lang = array(
1 => "Dun Morogh", 41 => "Défilé de Deuillevent", 1537 => "Forgefer", 12 => "Forêt d'Elwynn", 130 => "Forêt des Pins argentés", 1 => "Dun Morogh", 41 => "Défilé de Deuillevent", 1537 => "Forgefer", 12 => "Forêt d'Elwynn", 130 => "Forêt des Pins argentés",
1497 => "Fossoyeuse", 51 => "Gorge des Vents brûlants", 45 => "Hautes-terres d'Arathi", 1519 => "Hurlevent", 44 => "Les Carmines", 1497 => "Fossoyeuse", 51 => "Gorge des Vents brûlants", 45 => "Hautes-terres d'Arathi", 1519 => "Hurlevent", 44 => "Les Carmines",
47 => "Les Hinterlands", 11 => "Les Paluns", 3433 => "Les Terres fantômes", 38 => "Loch Modan", 3487 => "Lune-d'argent", 47 => "Les Hinterlands", 11 => "Les Paluns", 3433 => "Les Terres fantômes", 38 => "Loch Modan", 3487 => "Lune-d'argent",
139 => "Maleterres de l'est", 28 => "Maleterres de l'ouest", 4298 => "Maleterres : l'enclave Écarlate", 8 => "Marais des Chagrins", 40 => "Marche de l'Ouest", 139 => "Maleterres de l'est", 28 => "Maleterres de l'ouest", 4298 => "Maleterres : l'enclave Écarlate", 8 => "Marais des Chagrins", 40 => "Marche de l'Ouest",
25 => "Mont Rochenoire", 36 => "Montagnes d'Alterac", 46 => "Steppes ardentes", 4 => "Terres foudroyées", 3 => "Terres ingrates", 25 => "Mont Rochenoire", 36 => "Montagnes d'Alterac", 46 => "Steppes ardentes", 4 => "Terres foudroyées", 3 => "Terres ingrates",
2257 => "Tram des profondeurs", 33 => "Vallée de Strangleronce", 4080 => "Île de Quel'Danas" 2257 => "Tram des profondeurs", 33 => "Vallée de Strangleronce", 4080 => "Île de Quel'Danas"
), ),
@@ -575,7 +576,7 @@ $lang = array(
-81 => "Guerrier", -161 => "Mage", -141 => "Paladin", -262 => "Prêtre", -162 => "Voleur" -81 => "Guerrier", -161 => "Mage", -141 => "Paladin", -262 => "Prêtre", -162 => "Voleur"
), ),
2 => array( "Donjons", 2 => array( "Donjons",
4494 => "Ahn'kahet : l'Ancien royaume", 4277 => "Azjol-Nérub", 718 => "Cavernes des lamentations", 1196 => "Cime d'Utgarde", 2367 => "Contreforts de Hautebrande d'antan", 4494 => "Ahn'kahet : l'Ancien royaume", 4277 => "Azjol-Nérub", 718 => "Cavernes des lamentations", 1196 => "Cime d'Utgarde", 2367 => "Contreforts de Hautebrande d'antan",
3790 => "Cryptes Auchenaï", 209 => "Donjon d'Ombrecroc", 206 => "Donjon d'Utgarde", 4196 => "Donjon de Drak'Tharon", 3845 => "Donjon de la Tempête", 3790 => "Cryptes Auchenaï", 209 => "Donjon d'Ombrecroc", 206 => "Donjon d'Utgarde", 4196 => "Donjon de Drak'Tharon", 3845 => "Donjon de la Tempête",
4813 => "Fosse de Saron", 721 => "Gnomeregan", 2437 => "Gouffre de Ragefeu", 1941 => "Grottes du temps", 4416 => "Gundrak", 4813 => "Fosse de Saron", 721 => "Gnomeregan", 2437 => "Gouffre de Ragefeu", 1941 => "Grottes du temps", 4416 => "Gundrak",
2557 => "Hache-tripes", 491 => "Kraal de Tranchebauge", 3848 => "L'Arcatraz", 4228 => "L'Oculus", 4100 => "L'Épuration de Stratholme", 2557 => "Hache-tripes", 491 => "Kraal de Tranchebauge", 3848 => "L'Arcatraz", 4228 => "L'Oculus", 4100 => "L'Épuration de Stratholme",
@@ -893,7 +894,7 @@ $lang = array(
"Épique", "Légendaire", "Artefact", "Héritage" "Épique", "Légendaire", "Artefact", "Héritage"
), ),
'trigger' => array( 'trigger' => array(
"Utilise : ", "Équipé : ", "Chances quand vous touchez : ", null, null, "Utilise : ", "Équipé : ", "Chances quand vous touchez : ", null, null,
null, null null, null
), ),
'bonding' => array( 'bonding' => array(

View File

@@ -435,6 +435,7 @@ $lang = array(
'titleReward' => 'Наградное звание: "<a href="?title=%d">%s</a>"', 'titleReward' => 'Наградное звание: "<a href="?title=%d">%s</a>"',
'slain' => "убито", 'slain' => "убито",
'reqNumCrt' => "Требуется", 'reqNumCrt' => "Требуется",
'rfAvailable' => "[Available on realm]:",
'_transfer' => 'Этот предмет превратится в <a href="?achievement=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a>, если вы перейдете за <span class="icon-%s">%s</span>.', '_transfer' => 'Этот предмет превратится в <a href="?achievement=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a>, если вы перейдете за <span class="icon-%s">%s</span>.',
), ),
'race' => array( 'race' => array(

View File

@@ -99,9 +99,22 @@ class AchievementPage extends GenericPage
$infobox[] = Lang::main('side').Lang::main('colon').Lang::game('si', SIDE_BOTH); $infobox[] = Lang::main('side').Lang::main('colon').Lang::game('si', SIDE_BOTH);
} }
// todo (low): crosslink with charactersDB to check if realmFirsts are still available // realm first available?
if ($this->subject->getField('flags') & 0x100 && DB::isConnectable(DB_AUTH))
{
$avlb = [];
foreach (DB::Auth()->selectCol('SELECT id AS ARRAY_KEY, name FROM realmlist WHERE allowedSecurityLevel = 0 AND gamebuild = ?d', WOW_VERSION) AS $rId => $name)
{
if (!DB::isConnectable(DB_CHARACTERS . $rId))
continue;
$infobox = array_merge($infobox, Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'))); if (!DB::Characters($rId)->selectCell('SELECT 1 FROM character_achievement WHERE achievement = ?d LIMIT 1', $this->typeId))
$avlb[] = $name;
}
if ($avlb)
$infobox[] = Lang::achievement('rfAvailable').implode(', ', $avlb);
}
/**********/ /**********/
/* Series */ /* Series */

View File

@@ -24,7 +24,7 @@ function dbconfig()
); );
$testDB = function($idx, $name, $dbInfo) $testDB = function($idx, $name, $dbInfo)
{ {
$buff = '['.CLISetup::bold($idx).'] '.str_pad($name, 12); $buff = '['.CLISetup::bold($idx).'] '.str_pad($name, 17);
$errStr = ''; $errStr = '';
if ($dbInfo['host']) if ($dbInfo['host'])
@@ -50,9 +50,7 @@ function dbconfig()
foreach ($databases as $idx => $name) foreach ($databases as $idx => $name)
{ {
if ($name == 'characters' && empty($AoWoWconf[$name][0])) if (empty($AoWoWconf[$name]) && $name != 'characters' )
$AoWoWconf[$name][0] = array_combine(array_keys($dbFields), ['', '', '', '', '']);
else if (empty($AoWoWconf[$name]))
$AoWoWconf[$name] = array_combine(array_keys($dbFields), ['', '', '', '', '']); $AoWoWconf[$name] = array_combine(array_keys($dbFields), ['', '', '', '', '']);
} }
@@ -61,39 +59,50 @@ function dbconfig()
CLISetup::log(); CLISetup::log();
CLISetup::log("select a numerical index to use the corresponding entry"); CLISetup::log("select a numerical index to use the corresponding entry");
$charOffset = 0; $nCharDBs = 0;
foreach ($databases as $idx => $name) foreach ($databases as $idx => $name)
{ {
if ($idx != 3) if ($idx != 3)
CLISetup::log($testDB($idx, $name, $AoWoWconf[$name])); CLISetup::log($testDB($idx, $name, $AoWoWconf[$name]));
else else
foreach ($AoWoWconf[$name] as $charIdx => $dbInfo) foreach ($AoWoWconf[$name] as $charIdx => $dbInfo)
CLISetup::log($testDB($idx + $charOffset++, $name, $AoWoWconf[$name][$charIdx])); CLISetup::log($testDB($idx + $nCharDBs++, $name.' ['.$charIdx.']', $AoWoWconf[$name][$charIdx]));
} }
CLISetup::log("[".CLISetup::bold(3 + $charOffset)."] add an additional Character DB"); CLISetup::log("[".CLISetup::bold(3 + $nCharDBs)."] add an additional Character DB");
while (true) while (true)
{ {
$inp = ['idx' => ['', true, '/\d/']]; $inp = ['idx' => ['', true, '/\d/']];
if (CLISetup::readInput($inp, true) && $inp) if (CLISetup::readInput($inp, true) && $inp)
{ {
if (is_numeric($inp['idx']) && $inp['idx'] >= 0 && $inp['idx'] <= (3 + $charOffset)) if ($inp['idx'] >= 0 && $inp['idx'] <= (3 + $nCharDBs))
{ {
$curFields = $dbFields; $curFields = $dbFields;
if ($inp['idx'] == 3 + $nCharDBs) // add new realmDB
$curFields['realmId'] = ['Realm Id', false, '/[1-9][0-9]*/'];
if (CLISetup::readInput($curFields)) if (CLISetup::readInput($curFields))
{ {
// auth, world or aowow
if ($inp['idx'] < 3) if ($inp['idx'] < 3)
$AoWoWconf[$databases[$inp['idx']]] = $curFields ?: array_combine(array_keys($dbFields), ['', '', '', '', '']); $AoWoWconf[$databases[$inp['idx']]] = $curFields ?: array_combine(array_keys($dbFields), ['', '', '', '', '']);
else if ($inp['idx'] == 3 + $charOffset) // new char DB
else if ($inp['idx'] == 3 + $nCharDBs)
{ {
if ($curFields) if ($curFields)
$AoWoWconf[$databases[3]][] = $curFields; {
$_ = $curFields['realmId'];
unset($curFields['realmId']);
$AoWoWconf[$databases[3]][$_] = $curFields;
} }
}
// existing char DB
else else
{ {
$i = 0; $i = 0;
foreach ($AoWoWconf[$databases[3]] as $offset => &$dbInfo) foreach ($AoWoWconf[$databases[3]] as $realmId => &$dbInfo)
{ {
if ($inp['idx'] - 3 != $i++) if ($inp['idx'] - 3 != $i++)
continue; continue;
@@ -101,7 +110,7 @@ function dbconfig()
if ($curFields) if ($curFields)
$dbInfo = $curFields; $dbInfo = $curFields;
else else
unset($AoWoWconf[$databases[3]][$offset]); unset($AoWoWconf[$databases[3]][$realmId]);
} }
} }

View File

@@ -48,7 +48,7 @@ if (!CLI)
if (DB::isConnectable(DB_AUTH)) if (DB::isConnectable(DB_AUTH))
{ {
$rows = DB::Auth()->select('SELECT name, IF(timezone IN (8, 9, 10, 11, 12), "eu", "us") AS region FROM realmlist WHERE allowedSecurityLevel = 0'); $rows = DB::Auth()->select('SELECT name, IF(timezone IN (8, 9, 10, 11, 12), "eu", "us") AS region FROM realmlist WHERE allowedSecurityLevel = 0 AND gamebuild = ?d', WOW_VERSION);
foreach ($rows as $row) foreach ($rows as $row)
{ {

View File

@@ -30,7 +30,7 @@ if (!CLI)
{ {
$realms = []; $realms = [];
if (DB::isConnectable(DB_AUTH)) if (DB::isConnectable(DB_AUTH))
$realms = DB::Auth()->select('SELECT id AS ARRAY_KEY, name, ? AS battlegroup, IF(timezone IN (8, 9, 10, 11, 12), "eu", "us") AS region FROM realmlist WHERE allowedSecurityLevel = 0', CFG_BATTLEGROUP); $realms = DB::Auth()->select('SELECT id AS ARRAY_KEY, name, ? AS battlegroup, IF(timezone IN (8, 9, 10, 11, 12), "eu", "us") AS region FROM realmlist WHERE allowedSecurityLevel = 0 AND gamebuild = ?d', CFG_BATTLEGROUP, WOW_VERSION);
else else
CLISetup::log(' - realms: Auth-DB not set up .. static data g_realms will be empty', CLISetup::LOG_WARN); CLISetup::log(' - realms: Auth-DB not set up .. static data g_realms will be empty', CLISetup::LOG_WARN);