mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
DB/Structure
* implemented changed from 309a7f7e2a (achievement reward mail localization)
This commit is contained in:
@@ -530,7 +530,7 @@ class Loot
|
|||||||
|
|
||||||
// achievement part
|
// achievement part
|
||||||
$conditions = array(['itemExtra', $this->entry]);
|
$conditions = array(['itemExtra', $this->entry]);
|
||||||
if ($ar = DB::World()->selectCol('SELECT entry FROM achievement_reward WHERE item = ?d{ OR mailTemplate IN (?a)}', $this->entry, $ids ?: DBSIMPLE_SKIP))
|
if ($ar = DB::World()->selectCol('SELECT ID FROM achievement_reward WHERE ItemID = ?d{ OR MailTemplateID IN (?a)}', $this->entry, $ids ?: DBSIMPLE_SKIP))
|
||||||
array_push($conditions, ['id', $ar], 'OR');
|
array_push($conditions, ['id', $ar], 'OR');
|
||||||
|
|
||||||
$srcObj = new AchievementList($conditions);
|
$srcObj = new AchievementList($conditions);
|
||||||
|
|||||||
@@ -34,7 +34,22 @@ class AchievementList extends BaseType
|
|||||||
|
|
||||||
// post processing
|
// post processing
|
||||||
$rewards = DB::World()->select('
|
$rewards = DB::World()->select('
|
||||||
SELECT ar.entry AS ARRAY_KEY, ar.*, lar.* FROM achievement_reward ar LEFT JOIN locales_achievement_reward lar ON lar.entry = ar.entry WHERE ar.entry IN (?a)',
|
SELECT
|
||||||
|
ar.ID AS ARRAY_KEY, ar.TitleA, ar.TitleH, ar.ItemID, ar.Sender AS sender, ar.MailTemplateID,
|
||||||
|
ar.Subject AS subject_loc0, IFNULL(arl2.Subject, "") AS subject_loc2, IFNULL(arl3.Subject, "") AS subject_loc3, IFNULL(arl6.Subject, "") AS subject_loc6, IFNULL(arl8.Subject, "") AS subject_loc8,
|
||||||
|
ar.Text AS text_loc0, IFNULL(arl2.Text, "") AS text_loc2, IFNULL(arl3.Text, "") AS text_loc3, IFNULL(arl6.Text, "") AS text_loc6, IFNULL(arl8.Text, "") AS text_loc8
|
||||||
|
FROM
|
||||||
|
achievement_reward ar
|
||||||
|
LEFT JOIN
|
||||||
|
achievement_reward_locale arl2 ON arl2.ID = ar.ID AND arl2.Locale = "frFR"
|
||||||
|
LEFT JOIN
|
||||||
|
achievement_reward_locale arl3 ON arl3.ID = ar.ID AND arl3.Locale = "deDE"
|
||||||
|
LEFT JOIN
|
||||||
|
achievement_reward_locale arl6 ON arl6.ID = ar.ID AND arl6.Locale = "esES"
|
||||||
|
LEFT JOIN
|
||||||
|
achievement_reward_locale arl8 ON arl8.ID = ar.ID AND arl8.Locale = "ruRU"
|
||||||
|
WHERE
|
||||||
|
ar.ID IN (?a)',
|
||||||
$this->getFoundIDs()
|
$this->getFoundIDs()
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -46,7 +61,7 @@ class AchievementList extends BaseType
|
|||||||
{
|
{
|
||||||
$_curTpl = array_merge($rewards[$_id], $_curTpl);
|
$_curTpl = array_merge($rewards[$_id], $_curTpl);
|
||||||
|
|
||||||
if ($rewards[$_id]['mailTemplate'])
|
if ($rewards[$_id]['MailTemplateID'])
|
||||||
{
|
{
|
||||||
// using class Loot creates an inifinite loop cirling between Loot, ItemList and SpellList or something
|
// using class Loot creates an inifinite loop cirling between Loot, ItemList and SpellList or something
|
||||||
// $mailSrc = new Loot();
|
// $mailSrc = new Loot();
|
||||||
@@ -55,22 +70,22 @@ class AchievementList extends BaseType
|
|||||||
// $_curTpl['rewards'][] = [TYPE_ITEM, $loot['id']];
|
// $_curTpl['rewards'][] = [TYPE_ITEM, $loot['id']];
|
||||||
|
|
||||||
// lets just assume for now, that mailRewards for achievements do not contain references
|
// lets just assume for now, that mailRewards for achievements do not contain references
|
||||||
$mailRew = DB::World()->selectCol('SELECT Item FROM mail_loot_template WHERE Reference <= 0 AND entry = ?d', $rewards[$_id]['mailTemplate']);
|
$mailRew = DB::World()->selectCol('SELECT Item FROM mail_loot_template WHERE Reference <= 0 AND entry = ?d', $rewards[$_id]['MailTemplateID']);
|
||||||
foreach ($mailRew AS $mr)
|
foreach ($mailRew AS $mr)
|
||||||
$_curTpl['rewards'][] = [TYPE_ITEM, $mr];
|
$_curTpl['rewards'][] = [TYPE_ITEM, $mr];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//"rewards":[[11,137],[3,138]] [type, typeId]
|
//"rewards":[[11,137],[3,138]] [type, typeId]
|
||||||
if (!empty($_curTpl['item']))
|
if (!empty($_curTpl['ItemID']))
|
||||||
$_curTpl['rewards'][] = [TYPE_ITEM, $_curTpl['item']];
|
$_curTpl['rewards'][] = [TYPE_ITEM, $_curTpl['ItemID']];
|
||||||
if (!empty($_curTpl['itemExtra']))
|
if (!empty($_curTpl['itemExtra']))
|
||||||
$_curTpl['rewards'][] = [TYPE_ITEM, $_curTpl['itemExtra']];
|
$_curTpl['rewards'][] = [TYPE_ITEM, $_curTpl['itemExtra']];
|
||||||
if (!empty($_curTpl['title_A']))
|
if (!empty($_curTpl['TitleA']))
|
||||||
$_curTpl['rewards'][] = [TYPE_TITLE, $_curTpl['title_A']];
|
$_curTpl['rewards'][] = [TYPE_TITLE, $_curTpl['TitleA']];
|
||||||
if (!empty($_curTpl['title_H']))
|
if (!empty($_curTpl['TitleH']))
|
||||||
if (empty($_curTpl['title_A']) || $_curTpl['title_A'] != $_curTpl['title_H'])
|
if (empty($_curTpl['TitleA']) || $_curTpl['TitleA'] != $_curTpl['TitleH'])
|
||||||
$_curTpl['rewards'][] = [TYPE_TITLE, $_curTpl['title_H']];
|
$_curTpl['rewards'][] = [TYPE_TITLE, $_curTpl['TitleH']];
|
||||||
|
|
||||||
// icon
|
// icon
|
||||||
$_curTpl['iconString'] = $_curTpl['iconString'] ?: 'trade_engineering';
|
$_curTpl['iconString'] = $_curTpl['iconString'] ?: 'trade_engineering';
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ class TitlePage extends GenericPage
|
|||||||
}
|
}
|
||||||
|
|
||||||
// tab: achievement source
|
// tab: achievement source
|
||||||
if ($aIds = DB::World()->selectCol('SELECT entry FROM achievement_reward WHERE title_A = ?d OR title_H = ?d', $this->typeId, $this->typeId))
|
if ($aIds = DB::World()->selectCol('SELECT ID FROM achievement_reward WHERE TitleA = ?d OR TitleH = ?d', $this->typeId, $this->typeId))
|
||||||
{
|
{
|
||||||
$acvs = new AchievementList(array(['id', $aIds]));
|
$acvs = new AchievementList(array(['id', $aIds]));
|
||||||
if (!$acvs->error)
|
if (!$acvs->error)
|
||||||
|
|||||||
@@ -531,9 +531,9 @@ function source(array $ids = [])
|
|||||||
it.class, it.subclass, it.spellid_1, it.spelltrigger_1, it.spellid_2, it.spelltrigger_2,
|
it.class, it.subclass, it.spellid_1, it.spelltrigger_1, it.spellid_2, it.spelltrigger_2,
|
||||||
COUNT(1) AS qty
|
COUNT(1) AS qty
|
||||||
FROM (
|
FROM (
|
||||||
SELECT IFNULL(IF(mlt.Reference > 0, -mlt.Reference, mlt.Item), ar.item) AS item, ar.entry
|
SELECT IFNULL(IF(mlt.Reference > 0, -mlt.Reference, mlt.Item), ar.ItemID) AS item, ar.ID AS entry
|
||||||
FROM achievement_reward ar LEFT JOIN mail_loot_template mlt ON mlt.entry = ar.mailTemplate
|
FROM achievement_reward ar LEFT JOIN mail_loot_template mlt ON mlt.entry = ar.MailTemplateID
|
||||||
WHERE ar.mailTemplate > 0 OR ar.item > 0
|
WHERE ar.MailTemplateID > 0 OR ar.ItemID > 0
|
||||||
) src
|
) src
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
item_template it ON src.item = it.entry
|
item_template it ON src.item = it.entry
|
||||||
@@ -1186,10 +1186,10 @@ function source(array $ids = [])
|
|||||||
# 12: Achievement
|
# 12: Achievement
|
||||||
CLISetup::log(' * #12 Achievement');
|
CLISetup::log(' * #12 Achievement');
|
||||||
$sets = DB::World()->select('
|
$sets = DB::World()->select('
|
||||||
SELECT titleId AS ARRAY_KEY, MIN(entry) AS srcId, NULLIF(MAX(entry), MIN(entry)) AS altSrcId FROM (
|
SELECT titleId AS ARRAY_KEY, MIN(ID) AS srcId, NULLIF(MAX(ID), MIN(ID)) AS altSrcId FROM (
|
||||||
SELECT title_A as `titleId`, entry FROM achievement_reward WHERE title_A <> 0
|
SELECT TitleA AS `titleId`, ID FROM achievement_reward WHERE TitleA <> 0
|
||||||
UNION
|
UNION
|
||||||
SELECT title_H as `titleId`, entry FROM achievement_reward WHERE title_H <> 0
|
SELECT TitleH AS `titleId`, ID FROM achievement_reward WHERE TitleH <> 0
|
||||||
) AS x GROUP BY titleId'
|
) AS x GROUP BY titleId'
|
||||||
);
|
);
|
||||||
foreach ($sets as $tId => $set)
|
foreach ($sets as $tId => $set)
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ function titles()
|
|||||||
|
|
||||||
// update side
|
// update side
|
||||||
$questInfo = DB::World()->select($questQuery);
|
$questInfo = DB::World()->select($questQuery);
|
||||||
$sideUpd = DB::World()->selectCol('SELECT IF (title_A, title_A, title_H) AS ARRAY_KEY, BIT_OR(IF(title_A, 1, 2)) AS side FROM achievement_reward WHERE (title_A <> 0 AND title_H = 0) OR (title_H <> 0 AND title_A = 0) GROUP BY ARRAY_KEY HAVING side <> 3');
|
$sideUpd = DB::World()->selectCol('SELECT IF(TitleA, TitleA, TitleH) AS ARRAY_KEY, BIT_OR(IF(TitleA, 1, 2)) AS side FROM achievement_reward WHERE (TitleA <> 0 AND TitleH = 0) OR (TitleH <> 0 AND TitleA = 0) GROUP BY ARRAY_KEY HAVING side <> 3');
|
||||||
foreach ($questInfo as $tId => $data)
|
foreach ($questInfo as $tId => $data)
|
||||||
{
|
{
|
||||||
if ($data['eventEntry'])
|
if ($data['eventEntry'])
|
||||||
|
|||||||
1
setup/updates/1493924184_01.sql
Normal file
1
setup/updates/1493924184_01.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
UPDATE aowow_dbversion SET `sql` = CONCAT(IFNULL(`sql`, ''), ' source titles');
|
||||||
Reference in New Issue
Block a user