DB/Structure (thx @Carbenium for the heads up & suggestions)

* adapted structure to TDB 335.59
  * dropped questItem[1-6] fields from ?_creature and ?_object (why were they even there)

 - removed a function-stub from Util (already forgot, what it was supposed to achieve)
This commit is contained in:
Sarjuuk
2015-07-19 19:36:46 +02:00
parent 11ab3e0f19
commit 5b8a862df9
18 changed files with 163 additions and 167 deletions

BIN
README.md

Binary file not shown.

View File

@@ -1,6 +1,6 @@
<?php <?php
define('AOWOW_REVISION', 5); define('AOWOW_REVISION', 6);
define('CLI', PHP_SAPI === 'cli'); define('CLI', PHP_SAPI === 'cli');

View File

@@ -1541,16 +1541,6 @@ class Util
} }
} }
public static function createShowOnMap()
{
/*
quest: "Quest Givers",
daily: "Quest Givers (Daily)",
alliancequests: "Quest Givers",
hordequests: "Quest Givers",
*/
}
public static function getServerConditions($srcType, $srcGroup = null, $srcEntry = null) public static function getServerConditions($srcType, $srcGroup = null, $srcEntry = null)
{ {
if (!$srcGroup && !$srcEntry) if (!$srcGroup && !$srcEntry)

View File

@@ -348,9 +348,9 @@ class ItemPage extends genericPage
{ {
while ($next) while ($next)
{ {
if ($row = DB::World()->selectRow('SELECT *, text as Text_loc0 FROM page_text pt LEFT JOIN locales_page_text lpt ON pt.entry = lpt.entry WHERE pt.entry = ?d', $next)) if ($row = DB::World()->selectRow('SELECT *, Text as Text_loc0 FROM page_text pt LEFT JOIN locales_page_text lpt ON pt.ID = lpt.entry WHERE pt.ID = ?d', $next))
{ {
$next = $row['next_page']; $next = $row['NextPageID'];
$this->pageText[] = Util::parseHtmlText(Util::localizedString($row, 'Text')); $this->pageText[] = Util::parseHtmlText(Util::localizedString($row, 'Text'));
} }
else else

View File

@@ -451,14 +451,14 @@ class NpcPage extends GenericPage
if ($this->subject->getField('npcflag') & NPC_FLAG_TRAINER) if ($this->subject->getField('npcflag') & NPC_FLAG_TRAINER)
{ {
$teachQuery = ' $teachQuery = '
SELECT IFNULL(t2.spell, t1.spell) AS ARRAY_KEY, SELECT IFNULL(t2.SpellID, t1.SpellID) AS ARRAY_KEY,
IFNULL(t2.spellcost, t1.spellcost) AS cost, IFNULL(t2.MoneyCost, t1.MoneyCost) AS cost,
IFNULL(t2.reqskill, t1.reqskill) AS reqSkillId, IFNULL(t2.ReqSkillLine, t1.ReqSkillLine) AS reqSkillId,
IFNULL(t2.reqskillvalue, t1.reqskillvalue) AS reqSkillValue, IFNULL(t2.ReqSkillRank, t1.ReqSkillRank) AS reqSkillValue,
IFNULL(t2.reqlevel, t1.reqlevel) AS reqLevel IFNULL(t2.ReqLevel, t1.ReqLevel) AS reqLevel
FROM npc_trainer t1 FROM npc_trainer t1
LEFT JOIN npc_trainer t2 ON t2.entry = IF(t1.spell < 0, -t1.spell, null) LEFT JOIN npc_trainer t2 ON t2.ID = IF(t1.SpellID < 0, -t1.SpellID, null)
WHERE t1.entry = ?d WHERE t1.ID = ?d
'; ';
if ($tSpells = DB::World()->select($teachQuery, $this->typeId)) if ($tSpells = DB::World()->select($teachQuery, $this->typeId))

View File

@@ -206,9 +206,9 @@ class ObjectPage extends GenericPage
{ {
while ($next) while ($next)
{ {
if ($row = DB::World()->selectRow('SELECT *, text as Text_loc0 FROM page_text pt LEFT JOIN locales_page_text lpt ON pt.entry = lpt.entry WHERE pt.entry = ?d', $next)) if ($row = DB::World()->selectRow('SELECT *, Text as Text_loc0 FROM page_text pt LEFT JOIN locales_page_text lpt ON pt.ID = lpt.entry WHERE pt.ID = ?d', $next))
{ {
$next = $row['next_page']; $next = $row['NextPageID'];
$pageText[] = Util::parseHtmlText(Util::localizedString($row, 'Text')); $pageText[] = Util::parseHtmlText(Util::localizedString($row, 'Text'));
} }
else else

View File

@@ -250,7 +250,7 @@ class SkillPage extends GenericPage
{ {
$list = []; $list = [];
if (!empty(Util::$trainerTemplates[TYPE_SKILL][$this->typeId])) if (!empty(Util::$trainerTemplates[TYPE_SKILL][$this->typeId]))
$list = DB::World()->selectCol('SELECT DISTINCT entry FROM npc_trainer WHERE spell IN (?a) AND entry < 200000', Util::$trainerTemplates[TYPE_SKILL][$this->typeId]); $list = DB::World()->selectCol('SELECT DISTINCT ID FROM npc_trainer WHERE SpellID IN (?a) AND ID < 200000', Util::$trainerTemplates[TYPE_SKILL][$this->typeId]);
else else
{ {
$mask = 0; $mask = 0;
@@ -266,10 +266,10 @@ class SkillPage extends GenericPage
); );
$list = $spellIds ? DB::World()->selectCol(' $list = $spellIds ? DB::World()->selectCol('
SELECT IF(t1.entry > 200000, t2.entry, t1.entry) SELECT IF(t1.ID > 200000, t2.ID, t1.ID)
FROM npc_trainer t1 FROM npc_trainer t1
LEFT JOIN npc_trainer t2 ON t2.spell = -t1.entry LEFT JOIN npc_trainer t2 ON t2.SpellID = -t1.ID
WHERE t1.spell IN (?a)', WHERE t1.SpellID IN (?a)',
$spellIds $spellIds
) : []; ) : [];
} }

View File

@@ -1010,7 +1010,7 @@ class SpellPage extends GenericPage
} }
if ($tt) if ($tt)
$list = DB::World()->selectCol('SELECT DISTINCT entry FROM npc_trainer WHERE spell IN (?a) AND entry < 200000', $tt); $list = DB::World()->selectCol('SELECT DISTINCT ID FROM npc_trainer WHERE SpellID IN (?a) AND ID < 200000', $tt);
else else
{ {
$mask = 0; $mask = 0;
@@ -1019,10 +1019,10 @@ class SpellPage extends GenericPage
$mask |= 1 << $idx; $mask |= 1 << $idx;
$list = DB::World()->selectCol(' $list = DB::World()->selectCol('
SELECT IF(t1.entry > 200000, t2.entry, t1.entry) SELECT IF(t1.ID > 200000, t2.ID, t1.ID)
FROM npc_trainer t1 FROM npc_trainer t1
LEFT JOIN npc_trainer t2 ON t2.spell = -t1.entry LEFT JOIN npc_trainer t2 ON t2.SpellID = -t1.ID
WHERE t1.spell = ?d', WHERE t1.SpellID IN (?a)',
$this->typeId $this->typeId
); );
} }

View File

@@ -468,12 +468,6 @@ CREATE TABLE `aowow_creature` (
`armorMin` mediumint(8) unsigned NOT NULL DEFAULT '1', `armorMin` mediumint(8) unsigned NOT NULL DEFAULT '1',
`armorMax` mediumint(8) unsigned NOT NULL DEFAULT '1', `armorMax` mediumint(8) unsigned NOT NULL DEFAULT '1',
`racialLeader` tinyint(3) unsigned NOT NULL DEFAULT '0', `racialLeader` tinyint(3) unsigned NOT NULL DEFAULT '0',
`questItem1` int(10) unsigned NOT NULL DEFAULT '0',
`questItem2` int(10) unsigned NOT NULL DEFAULT '0',
`questItem3` int(10) unsigned NOT NULL DEFAULT '0',
`questItem4` int(10) unsigned NOT NULL DEFAULT '0',
`questItem5` int(10) unsigned NOT NULL DEFAULT '0',
`questItem6` int(10) unsigned NOT NULL DEFAULT '0',
`mechanicImmuneMask` int(10) unsigned NOT NULL DEFAULT '0', `mechanicImmuneMask` int(10) unsigned NOT NULL DEFAULT '0',
`flagsExtra` int(10) unsigned NOT NULL DEFAULT '0', `flagsExtra` int(10) unsigned NOT NULL DEFAULT '0',
`scriptName` varchar(50) NOT NULL DEFAULT '', `scriptName` varchar(50) NOT NULL DEFAULT '',
@@ -1273,12 +1267,6 @@ CREATE TABLE `aowow_objects` (
`faction` smallint(5) unsigned NOT NULL DEFAULT '0', `faction` smallint(5) unsigned NOT NULL DEFAULT '0',
`flags` int(10) unsigned NOT NULL DEFAULT '0', `flags` int(10) unsigned NOT NULL DEFAULT '0',
`cuFlags` int(10) unsigned NOT NULL DEFAULT '0', `cuFlags` int(10) unsigned NOT NULL DEFAULT '0',
`questItem1` int(11) unsigned NOT NULL DEFAULT '0',
`questItem2` int(11) unsigned NOT NULL DEFAULT '0',
`questItem3` int(11) unsigned NOT NULL DEFAULT '0',
`questItem4` int(11) unsigned NOT NULL DEFAULT '0',
`questItem5` int(11) unsigned NOT NULL DEFAULT '0',
`questItem6` int(11) unsigned NOT NULL DEFAULT '0',
`lootId` mediumint(8) unsigned NOT NULL DEFAULT '0', `lootId` mediumint(8) unsigned NOT NULL DEFAULT '0',
`lockId` smallint(5) unsigned NOT NULL DEFAULT '0', `lockId` smallint(5) unsigned NOT NULL DEFAULT '0',
`reqSkill` smallint(5) unsigned NOT NULL DEFAULT '0', `reqSkill` smallint(5) unsigned NOT NULL DEFAULT '0',

View File

@@ -49,7 +49,7 @@ class SqlGen
'creature' => [null, null, null, ['creature_template', 'locales_creature', 'creature_classlevelstats', 'instance_encounters']], 'creature' => [null, null, null, ['creature_template', 'locales_creature', 'creature_classlevelstats', 'instance_encounters']],
'currencies' => [null, null, null, ['item_template', 'locales_item']], 'currencies' => [null, null, null, ['item_template', 'locales_item']],
'events' => [null, null, null, ['game_event', 'game_event_prerequisite']], 'events' => [null, null, null, ['game_event', 'game_event_prerequisite']],
'objects' => [null, null, null, ['gameobject_template', 'locales_gameobject']], 'objects' => [null, null, null, ['gameobject_template', 'locales_gameobject', 'gameobject_questitem']],
'pet' => [null, null, null, ['creature_template', 'creature']], 'pet' => [null, null, null, ['creature_template', 'creature']],
'quests' => [null, null, null, ['quest_template', 'locales_quest', 'game_event', 'game_event_seasonal_questrelation']], 'quests' => [null, null, null, ['quest_template', 'locales_quest', 'game_event', 'game_event_seasonal_questrelation']],
'quests_startend' => [null, null, null, ['creature_queststarter', 'creature_questender', 'game_event_creature_quest', 'gameobject_queststarter', 'gameobject_questender', 'game_event_gameobject_quest', 'item_template']], 'quests_startend' => [null, null, null, ['creature_queststarter', 'creature_questender', 'game_event_creature_quest', 'gameobject_queststarter', 'gameobject_questender', 'game_event_gameobject_quest', 'item_template']],

View File

@@ -72,7 +72,6 @@ function creature(array $ids = [])
min.basearmor * ct.ArmorModifier AS armorMin, min.basearmor * ct.ArmorModifier AS armorMin,
max.basearmor * ct.ArmorModifier AS armorMax, max.basearmor * ct.ArmorModifier AS armorMax,
RacialLeader, RacialLeader,
questItem1, questItem2, questItem3, questItem4, questItem5, questItem6,
mechanic_immune_mask, mechanic_immune_mask,
flags_extra, flags_extra,
ScriptName ScriptName

View File

@@ -10,6 +10,7 @@ if (!CLI)
/* deps: /* deps:
* gameobject_template * gameobject_template
* locales_gameobject * locales_gameobject
* gameobject_questitem
*/ */
@@ -24,8 +25,8 @@ function objects(array $ids = [])
go.entry, go.entry,
`type`, `type`,
IF(`type` = 2, -2, -- quests 1 IF(`type` = 2, -2, -- quests 1
IF(`type` = 8 AND data0 IN (1, 2, 3, 4, 1552), -6, -- tools IF(`type` = 8 AND Data0 IN (1, 2, 3, 4, 1552), -6, -- tools
IF(`type` = 3 AND questitem1 <> 0, -2, -- quests 2 IF(`type` = 3 AND IFNULL(gqi.ItemId, 0) <> 0, -2, -- quests 2
IF(`type` IN (3, 9, 25), `type`, 0)))), -- regular chests, books, pools IF(`type` IN (3, 9, 25), `type`, 0)))), -- regular chests, books, pools
0 AS event, -- linked worldevent 0 AS event, -- linked worldevent
displayId, displayId,
@@ -33,40 +34,43 @@ function objects(array $ids = [])
faction, faction,
flags, flags,
0 AS cuFlags, -- custom Flags 0 AS cuFlags, -- custom Flags
questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, IF(`type` IN (3, 25), Data1, 0), -- lootId
IF(`type` IN (3, 25), data1, 0), -- lootId IF(`type` IN (2, 3, 6, 10, 13, 24, 26), Data0, IF(`type` IN (0, 1), Data1, 0)), -- lockId
IF(`type` IN (2, 3, 6, 10, 13, 24, 26), data0, IF(`type` IN (0, 1), data1, 0)), -- lockId
0 AS reqSkill, -- reqSkill 0 AS reqSkill, -- reqSkill
IF(`type` = 9, data0, IF(`type` = 10, data7, 0)), -- pageTextId IF(`type` = 9, Data0, IF(`type` = 10, Data7, 0)), -- pageTextId
IF(`type` = 1, data3, -- linkedTrapIds IF(`type` = 1, Data3, -- linkedTrapIds
IF(`type` = 3, data7, IF(`type` = 3, Data7,
IF(`type` = 10, data12, IF(`type` = 10, Data12,
IF(`type` = 8, data2, 0)))), IF(`type` = 8, Data2, 0)))),
IF(`type` = 5, data5, -- reqQuest IF(`type` = 5, Data5, -- reqQuest
IF(`type` = 3, data8, IF(`type` = 3, Data8,
IF(`type` = 10, data1, IF(`type` = 10, Data1,
IF(`type` = 8, data4, 0)))), IF(`type` = 8, Data4, 0)))),
IF(`type` = 8, data0, 0), -- spellFocusId IF(`type` = 8, Data0, 0), -- spellFocusId
IF(`type` = 10, data10, -- onUseSpell IF(`type` = 10, Data10, -- onUseSpell
IF(`type` IN (18, 24), data1, IF(`type` IN (18, 24), Data1,
IF(`type` = 26, data2, IF(`type` = 26, Data2,
IF(`type` = 22, data0, 0)))), IF(`type` = 22, Data0, 0)))),
IF(`type` = 18, data4, 0), -- onSuccessSpell IF(`type` = 18, Data4, 0), -- onSuccessSpell
IF(`type` = 18, data2, IF(`type` = 24, data3, 0)), -- auraSpell IF(`type` = 18, Data2, IF(`type` = 24, Data3, 0)), -- auraSpell
IF(`type` = 30, data2, IF(`type` = 24, data4, IF(`type` = 6, data3, 0))), -- triggeredSpell IF(`type` = 30, Data2, IF(`type` = 24, Data4, IF(`type` = 6, Data3, 0))), -- triggeredSpell
IF(`type` = 29, CONCAT_WS(" ", data14, data15, data16, data17, data0), -- miscInfo: capturePoint IF(`type` = 29, CONCAT_WS(" ", Data14, Data15, Data16, Data17, Data0), -- miscInfo: capturePoint
IF(`type` = 3, CONCAT_WS(" ", data4, data5, data2), -- miscInfo: loot v IF(`type` = 3, CONCAT_WS(" ", Data4, Data5, Data2), -- miscInfo: loot v
IF(`type` = 25, CONCAT_WS(" ", data2, data3, 0), IF(`type` = 25, CONCAT_WS(" ", Data2, Data3, 0),
IF(`type` = 23, CONCAT_WS(" ", data0, data1, data2), "")))), -- miscInfo: meetingStone IF(`type` = 23, CONCAT_WS(" ", Data0, Data1, Data2), "")))), -- miscInfo: meetingStone
IF(ScriptName <> "", ScriptName, AIName) IF(ScriptName <> "", ScriptName, AIName)
FROM FROM
gameobject_template go gameobject_template go
LEFT JOIN LEFT JOIN
locales_gameobject lgo ON go.entry = lgo.entry locales_gameobject lgo ON go.entry = lgo.entry
LEFT JOIN
gameobject_questitem gqi ON gqi.GameObjectEntry = go.entry
{ {
WHERE WHERE
go.entry IN (?a) go.entry IN (?a)
} }
GROUP BY
go.entry
LIMIT LIMIT
?d, ?d'; ?d, ?d';

View File

@@ -23,15 +23,15 @@ function quests(array $ids = [])
{ {
$baseQuery = ' $baseQuery = '
SELECT SELECT
q.Id, q.ID,
Method, Method,
Level, QuestLevel,
MinLevel, MinLevel,
MaxLevel, MaxLevel,
ZoneOrSort, QuestSortID,
ZoneOrSort AS zoneOrSortBak, -- ZoneOrSortBak QuestSortID AS zoneOrSortBak, -- ZoneOrSortBak
Type, QuestType,
SuggestedPlayers, SuggestedGroupNum,
LimitTime, LimitTime,
IFNULL(gesqr.eventEntry, 0) AS eventId, IFNULL(gesqr.eventEntry, 0) AS eventId,
PrevQuestId, PrevQuestId,
@@ -56,26 +56,26 @@ function quests(array $ids = [])
RewardSpell, RewardSpellCast, RewardSpell, RewardSpellCast,
RewardHonor * 124 * RewardHonorMultiplier, -- alt calculation in QuestDef.cpp -> Quest::CalculateHonorGain(playerLevel) RewardHonor * 124 * RewardHonorMultiplier, -- alt calculation in QuestDef.cpp -> Quest::CalculateHonorGain(playerLevel)
RewardMailTemplateId, RewardMailDelay, RewardMailTemplateId, RewardMailDelay,
RewardTitleId, RewardTitle,
RewardTalents, RewardTalents,
RewardArenaPoints, RewardArenaPoints,
RewardItemId1, RewardItemId2, RewardItemId3, RewardItemId4, RewardItem1, RewardItem2, RewardItem3, RewardItem4,
RewardItemCount1, RewardItemCount2, RewardItemCount3, RewardItemCount4, RewardAmount1, RewardAmount2, RewardAmount3, RewardAmount4,
RewardChoiceItemId1, RewardChoiceItemId2, RewardChoiceItemId3, RewardChoiceItemId4, RewardChoiceItemId5, RewardChoiceItemId6, RewardChoiceItemID1, RewardChoiceItemID2, RewardChoiceItemID3, RewardChoiceItemID4, RewardChoiceItemID5, RewardChoiceItemID6,
RewardChoiceItemCount1, RewardChoiceItemCount2, RewardChoiceItemCount3, RewardChoiceItemCount4, RewardChoiceItemCount5, RewardChoiceItemCount6, RewardChoiceItemQuantity1, RewardChoiceItemQuantity2, RewardChoiceItemQuantity3, RewardChoiceItemQuantity4, RewardChoiceItemQuantity5, RewardChoiceItemQuantity6,
RewardFactionId1, RewardFactionId2, RewardFactionId3, RewardFactionId4, RewardFactionId5, RewardFactionID1, RewardFactionID2, RewardFactionID3, RewardFactionID4, RewardFactionID5,
IF (RewardFactionValueIdOverride1 <> 0, RewardFactionValueIdOverride1 / 100, RewardFactionValueId1), IF (RewardFactionOverride1 <> 0, RewardFactionOverride1 / 100, RewardFactionValue1),
IF (RewardFactionValueIdOverride2 <> 0, RewardFactionValueIdOverride2 / 100, RewardFactionValueId2), IF (RewardFactionOverride2 <> 0, RewardFactionOverride2 / 100, RewardFactionValue2),
IF (RewardFactionValueIdOverride3 <> 0, RewardFactionValueIdOverride3 / 100, RewardFactionValueId3), IF (RewardFactionOverride3 <> 0, RewardFactionOverride3 / 100, RewardFactionValue3),
IF (RewardFactionValueIdOverride4 <> 0, RewardFactionValueIdOverride4 / 100, RewardFactionValueId4), IF (RewardFactionOverride4 <> 0, RewardFactionOverride4 / 100, RewardFactionValue4),
IF (RewardFactionValueIdOverride5 <> 0, RewardFactionValueIdOverride5 / 100, RewardFactionValueId5), IF (RewardFactionOverride5 <> 0, RewardFactionOverride5 / 100, RewardFactionValue5),
Title, Title_loc2, Title_loc3, Title_loc6, Title_loc8, LogTitle, Title_loc2, Title_loc3, Title_loc6, Title_loc8,
Objectives, Objectives_loc2, Objectives_loc3, Objectives_loc6, Objectives_loc8, LogDescription, Objectives_loc2, Objectives_loc3, Objectives_loc6, Objectives_loc8,
Details, Details_loc2, Details_loc3, Details_loc6, Details_loc8, QuestDescription, Details_loc2, Details_loc3, Details_loc6, Details_loc8,
EndText, EndText_loc2, EndText_loc3, EndText_loc6, EndText_loc8, EndText, EndText_loc2, EndText_loc3, EndText_loc6, EndText_loc8,
OfferRewardText, OfferRewardText_loc2, OfferRewardText_loc3, OfferRewardText_loc6, OfferRewardText_loc8, OfferRewardText, OfferRewardText_loc2, OfferRewardText_loc3, OfferRewardText_loc6, OfferRewardText_loc8,
RequestItemsText, RequestItemsText_loc2, RequestItemsText_loc3, RequestItemsText_loc6, RequestItemsText_loc8, RequestItemsText, RequestItemsText_loc2, RequestItemsText_loc3, RequestItemsText_loc6, RequestItemsText_loc8,
CompletedText, CompletedText_loc2, CompletedText_loc3, CompletedText_loc6, CompletedText_loc8, QuestCompletionLog, CompletedText_loc2, CompletedText_loc3, CompletedText_loc6, CompletedText_loc8,
RequiredNpcOrGo1, RequiredNpcOrGo2, RequiredNpcOrGo3, RequiredNpcOrGo4, RequiredNpcOrGo1, RequiredNpcOrGo2, RequiredNpcOrGo3, RequiredNpcOrGo4,
RequiredNpcOrGoCount1, RequiredNpcOrGoCount2, RequiredNpcOrGoCount3, RequiredNpcOrGoCount4, RequiredNpcOrGoCount1, RequiredNpcOrGoCount2, RequiredNpcOrGoCount3, RequiredNpcOrGoCount4,
RequiredSourceItemId1, RequiredSourceItemId2, RequiredSourceItemId3, RequiredSourceItemId4, RequiredSourceItemId1, RequiredSourceItemId2, RequiredSourceItemId3, RequiredSourceItemId4,
@@ -89,12 +89,12 @@ function quests(array $ids = [])
FROM FROM
quest_template q quest_template q
LEFT JOIN LEFT JOIN
locales_quest lq ON q.Id = lq.Id locales_quest lq ON q.ID = lq.Id
LEFT JOIN LEFT JOIN
game_event_seasonal_questrelation gesqr ON gesqr.questId = q.Id game_event_seasonal_questrelation gesqr ON gesqr.questId = q.ID
{ {
WHERE WHERE
q.Id IN (?a) q.ID IN (?a)
} }
LIMIT LIMIT
?d, ?d'; ?d, ?d';
@@ -156,7 +156,7 @@ function quests(array $ids = [])
for ($i = 1; $i < 6; $i++) for ($i = 1; $i < 6; $i++)
DB::Aowow()->query($repQuery, $i, $i, $i, $i, $ids ?: DBSIMPLE_SKIP); DB::Aowow()->query($repQuery, $i, $i, $i, $i, $ids ?: DBSIMPLE_SKIP);
// update zoneOrSort .. well .. now "not documenting" bites me in the ass .. ~700 quests were changed, i don't know by what method // update zoneOrSort/QuestSortID .. well .. now "not documenting" bites me in the ass .. ~700 quests were changed, i don't know by what method
$eventSet = DB::World()->selectCol('SELECT holiday AS ARRAY_KEY, eventEntry FROM game_event WHERE holiday <> 0'); $eventSet = DB::World()->selectCol('SELECT holiday AS ARRAY_KEY, eventEntry FROM game_event WHERE holiday <> 0');
$holidaySorts = array( $holidaySorts = array(
141 => -1001, 181 => -374, 201 => -1002, 141 => -1001, 181 => -374, 201 => -1002,

View File

@@ -250,11 +250,11 @@ function source(array $ids = [])
FROM FROM
gameobject_loot_template glt gameobject_loot_template glt
JOIN JOIN
gameobject_template gt ON glt.entry = gt.data1 gameobject_template gt ON glt.entry = gt.Data1
LEFT JOIN LEFT JOIN
item_template it ON it.entry = glt.Item AND glt.Reference <= 0 item_template it ON it.entry = glt.Item AND glt.Reference <= 0
WHERE WHERE
`type` = 3 AND gt.data1 > 0 AND gt.data0 NOT IN (?a) `type` = 3 AND gt.Data1 > 0 AND gt.Data0 NOT IN (?a)
GROUP BY GROUP BY
ARRAY_KEY', ARRAY_KEY',
$exclLocks $exclLocks
@@ -388,17 +388,17 @@ function source(array $ids = [])
$spellBuff = []; $spellBuff = [];
$itemBuff = []; $itemBuff = [];
$quests = DB::World()->select( $quests = DB::World()->select(
'SELECT n.item AS ARRAY_KEY, n.Id AS quest, SUM(n.qty) AS qty, BIT_OR(n.side) AS side, it.class, it.subclass, it.spellid_1, it.spelltrigger_1, it.spellid_2, it.spelltrigger_2 FROM ( 'SELECT n.item AS ARRAY_KEY, n.ID AS quest, SUM(n.qty) AS qty, BIT_OR(n.side) AS side, it.class, it.subclass, it.spellid_1, it.spelltrigger_1, it.spellid_2, it.spelltrigger_2 FROM (
SELECT rewardChoiceItemId1 AS item, Id, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE rewardChoiceItemId1 > 0 GROUP BY item UNION SELECT RewardChoiceItemID1 AS item, ID, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE RewardChoiceItemID1 > 0 GROUP BY item UNION
SELECT rewardChoiceItemId2 AS item, Id, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE rewardChoiceItemId2 > 0 GROUP BY item UNION SELECT RewardChoiceItemID2 AS item, ID, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE RewardChoiceItemID2 > 0 GROUP BY item UNION
SELECT rewardChoiceItemId3 AS item, Id, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE rewardChoiceItemId3 > 0 GROUP BY item UNION SELECT RewardChoiceItemID3 AS item, ID, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE RewardChoiceItemID3 > 0 GROUP BY item UNION
SELECT rewardChoiceItemId4 AS item, Id, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE rewardChoiceItemId4 > 0 GROUP BY item UNION SELECT RewardChoiceItemID4 AS item, ID, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE RewardChoiceItemID4 > 0 GROUP BY item UNION
SELECT rewardChoiceItemId5 AS item, Id, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE rewardChoiceItemId5 > 0 GROUP BY item UNION SELECT RewardChoiceItemID5 AS item, ID, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE RewardChoiceItemID5 > 0 GROUP BY item UNION
SELECT rewardChoiceItemId6 AS item, Id, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE rewardChoiceItemId6 > 0 GROUP BY item UNION SELECT RewardChoiceItemID6 AS item, ID, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE RewardChoiceItemID6 > 0 GROUP BY item UNION
SELECT rewardItemId1 AS item, Id, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE rewardItemId1 > 0 GROUP BY item UNION SELECT RewardItem1 AS item, ID, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE RewardItem1 > 0 GROUP BY item UNION
SELECT rewardItemId2 AS item, Id, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE rewardItemId2 > 0 GROUP BY item UNION SELECT RewardItem2 AS item, ID, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE RewardItem2 > 0 GROUP BY item UNION
SELECT rewardItemId3 AS item, Id, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE rewardItemId3 > 0 GROUP BY item UNION SELECT RewardItem3 AS item, ID, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE RewardItem3 > 0 GROUP BY item UNION
SELECT rewardItemId4 AS item, Id, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE rewardItemId4 > 0 GROUP BY item SELECT RewardItem4 AS item, ID, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE RewardItem4 > 0 GROUP BY item
) n JOIN item_template it ON it.entry = n.item ) n JOIN item_template it ON it.entry = n.item
GROUP BY item' GROUP BY item'
); );
@@ -413,7 +413,7 @@ function source(array $ids = [])
$mailLoot = DB::World()->select(' $mailLoot = DB::World()->select('
SELECT SELECT
IF(mlt.Reference > 0, -mlt.Reference, mlt.Item) AS ARRAY_KEY, IF(mlt.Reference > 0, -mlt.Reference, mlt.Item) AS ARRAY_KEY,
qt.Id AS entry, qt.ID AS entry,
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,
BIT_OR(IF(qt.RequiredRaces & 0x2B2 AND !(qt.RequiredRaces & 0x44D), 2, IF(qt.RequiredRaces & 0x44D AND !(qt.RequiredRaces & 0x2B2), 1, 3))) AS side BIT_OR(IF(qt.RequiredRaces & 0x2B2 AND !(qt.RequiredRaces & 0x44D), 2, IF(qt.RequiredRaces & 0x44D AND !(qt.RequiredRaces & 0x2B2), 1, 3))) AS side
@@ -635,7 +635,7 @@ function source(array $ids = [])
count(1) AS qty count(1) AS qty
FROM ( FROM (
SELECT 0 AS entry, IF(flt.Reference > 0, -flt.Reference, flt.Item) itemOrRef FROM fishing_loot_template flt UNION SELECT 0 AS entry, IF(flt.Reference > 0, -flt.Reference, flt.Item) itemOrRef FROM fishing_loot_template flt UNION
SELECT gt.entry, IF(glt.Reference > 0, -glt.Reference, glt.Item) itemOrRef FROM gameobject_template gt JOIN gameobject_loot_template glt ON glt.entry = gt.data1 WHERE `type` = 25 AND gt.data1 > 0 SELECT gt.entry, IF(glt.Reference > 0, -glt.Reference, glt.Item) itemOrRef FROM gameobject_template gt JOIN gameobject_loot_template glt ON glt.entry = gt.Data1 WHERE `type` = 25 AND gt.Data1 > 0
) src ) src
LEFT JOIN LEFT JOIN
item_template it ON src.itemOrRef > 0 AND src.itemOrRef = it.entry item_template it ON src.itemOrRef > 0 AND src.itemOrRef = it.entry
@@ -688,7 +688,7 @@ function source(array $ids = [])
src.srcType src.srcType
FROM ( FROM (
SELECT ct.entry, IF(slt.Reference > 0, -slt.Reference, slt.Item) itemOrRef, ?d AS srcType FROM creature_template ct JOIN skinning_loot_template slt ON slt.entry = ct.skinloot WHERE (type_flags & ?d) AND ct.skinloot > 0 UNION SELECT ct.entry, IF(slt.Reference > 0, -slt.Reference, slt.Item) itemOrRef, ?d AS srcType FROM creature_template ct JOIN skinning_loot_template slt ON slt.entry = ct.skinloot WHERE (type_flags & ?d) AND ct.skinloot > 0 UNION
SELECT gt.entry, IF(glt.Reference > 0, -glt.Reference, glt.Item) itemOrRef, ?d AS srcType FROM gameobject_template gt JOIN gameobject_loot_template glt ON glt.entry = gt.data1 WHERE gt.`type` = 3 AND gt.data1 > 0 AND data0 IN (?a) SELECT gt.entry, IF(glt.Reference > 0, -glt.Reference, glt.Item) itemOrRef, ?d AS srcType FROM gameobject_template gt JOIN gameobject_loot_template glt ON glt.entry = gt.Data1 WHERE gt.`type` = 3 AND gt.Data1 > 0 AND Data0 IN (?a)
) src ) src
LEFT JOIN LEFT JOIN
item_template it ON src.itemOrRef > 0 AND src.itemOrRef = it.entry item_template it ON src.itemOrRef > 0 AND src.itemOrRef = it.entry
@@ -794,7 +794,7 @@ function source(array $ids = [])
src.srcType src.srcType
FROM ( FROM (
SELECT ct.entry, IF(slt.Reference > 0, -slt.Reference, slt.Item) itemOrRef, ?d AS srcType FROM creature_template ct JOIN skinning_loot_template slt ON slt.entry = ct.skinloot WHERE (type_flags & ?d) AND ct.skinloot > 0 UNION SELECT ct.entry, IF(slt.Reference > 0, -slt.Reference, slt.Item) itemOrRef, ?d AS srcType FROM creature_template ct JOIN skinning_loot_template slt ON slt.entry = ct.skinloot WHERE (type_flags & ?d) AND ct.skinloot > 0 UNION
SELECT gt.entry, IF(glt.Reference > 0, -glt.Reference, glt.Item) itemOrRef, ?d AS srcType FROM gameobject_template gt JOIN gameobject_loot_template glt ON glt.entry = gt.data1 WHERE gt.`type` = 3 AND gt.data1 > 0 AND data0 IN (?a) SELECT gt.entry, IF(glt.Reference > 0, -glt.Reference, glt.Item) itemOrRef, ?d AS srcType FROM gameobject_template gt JOIN gameobject_loot_template glt ON glt.entry = gt.Data1 WHERE gt.`type` = 3 AND gt.Data1 > 0 AND Data0 IN (?a)
) src ) src
LEFT JOIN LEFT JOIN
item_template it ON src.itemOrRef > 0 AND src.itemOrRef = it.entry item_template it ON src.itemOrRef > 0 AND src.itemOrRef = it.entry
@@ -1045,9 +1045,9 @@ function source(array $ids = [])
CLISetup::log(' * #4 Quest'); CLISetup::log(' * #4 Quest');
$quests = DB::World()->select(' $quests = DB::World()->select('
SELECT spell AS ARRAY_KEY, id, SUM(qty) AS qty, BIT_OR(side) AS side FROM ( SELECT spell AS ARRAY_KEY, id, SUM(qty) AS qty, BIT_OR(side) AS side FROM (
SELECT IF(rewardSpellCast = 0, rewardSpell, rewardSpellCast) AS spell, Id, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE IF(rewardSpellCast = 0, rewardSpell, rewardSpellCast) > 0 GROUP BY spell SELECT IF(rewardSpellCast = 0, rewardSpell, rewardSpellCast) AS spell, ID, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE IF(rewardSpellCast = 0, rewardSpell, rewardSpellCast) > 0 GROUP BY spell
UNION UNION
SELECT SourceSpellId AS spell, Id, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE SourceSpellId > 0 GROUP BY spell SELECT SourceSpellId AS spell, ID, COUNT(1) AS qty, IF(RequiredRaces & 0x2B2 AND !(RequiredRaces & 0x44D), 2, IF(RequiredRaces & 0x44D AND !(RequiredRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE SourceSpellId > 0 GROUP BY spell
) t GROUP BY spell'); ) t GROUP BY spell');
if ($quests) if ($quests)
@@ -1071,7 +1071,7 @@ function source(array $ids = [])
# 6: Trainer # 6: Trainer
CLISetup::log(' * #6 Trainer'); CLISetup::log(' * #6 Trainer');
if ($tNpcs = DB::World()->select('SELECT spell AS ARRAY_KEY, entry, COUNT(1) AS qty FROM npc_trainer WHERE spell > 0 GROUP BY ARRAY_KEY')) if ($tNpcs = DB::World()->select('SELECT SpellID AS ARRAY_KEY, ID AS entry, COUNT(1) AS qty FROM npc_trainer WHERE SpellID > 0 GROUP BY ARRAY_KEY'))
{ {
$tSpells = DB::Aowow()->select('SELECT Id AS ARRAY_KEY, effect1Id, effect2Id, effect3Id, effect1TriggerSpell, effect2TriggerSpell, effect3TriggerSpell FROM dbc_spell WHERE Id IN (?a)', array_keys($tNpcs)); $tSpells = DB::Aowow()->select('SELECT Id AS ARRAY_KEY, effect1Id, effect2Id, effect3Id, effect1TriggerSpell, effect2TriggerSpell, effect3TriggerSpell FROM dbc_spell WHERE Id IN (?a)', array_keys($tNpcs));
$buff = []; $buff = [];
@@ -1167,7 +1167,7 @@ function source(array $ids = [])
# 4: Quest # 4: Quest
CLISetup::log(' * #4 Quest'); CLISetup::log(' * #4 Quest');
if ($quests = DB::World()->select('SELECT ?d, RewardTitleId, 1, ?d, Id FROM quest_template WHERE RewardTitleId > 0', TYPE_TITLE, TYPE_QUEST)) if ($quests = DB::World()->select('SELECT ?d, RewardTitle, 1, ?d, ID FROM quest_template WHERE RewardTitle > 0', TYPE_TITLE, TYPE_QUEST))
DB::Aowow()->query(queryfy('[V]', $quests, $insMore), 4, 4, 4); DB::Aowow()->query(queryfy('[V]', $quests, $insMore), 4, 4, 4);
# 12: Achievement # 12: Achievement

View File

@@ -134,7 +134,7 @@ function spawns() // and waypoints
/* offsets for transports */ /* offsets for transports */
/**************************/ /**************************/
$transports = DB::World()->selectCol('SELECT data0 AS pathId, data6 AS ARRAY_KEY FROM gameobject_template WHERE type = 15 AND data6 <> 0'); $transports = DB::World()->selectCol('SELECT Data0 AS pathId, Data6 AS ARRAY_KEY FROM gameobject_template WHERE type = 15 AND Data6 <> 0');
foreach ($transports as &$t) foreach ($transports as &$t)
$t = DB::Aowow()->selectRow('SELECT posX, posY, mapId FROM dbc_taxipathnode tpn WHERE tpn.pathId = ?d AND nodeIdx = 0', $t); $t = DB::Aowow()->selectRow('SELECT posX, posY, mapId FROM dbc_taxipathnode tpn WHERE tpn.pathId = ?d AND nodeIdx = 0', $t);

View File

@@ -353,7 +353,7 @@ function spell()
} }
// fill learnedAt, trainingCost from trainer // fill learnedAt, trainingCost from trainer
if ($trainer = DB::World()->select('SELECT spell AS ARRAY_KEY, MIN(reqskillvalue) AS reqSkill, MIN(spellcost) AS cost, COUNT(*) as count FROM npc_trainer GROUP BY spell')) if ($trainer = DB::World()->select('SELECT SpellID AS ARRAY_KEY, MIN(ReqSkillRank) AS reqSkill, MIN(MoneyCost) AS cost, COUNT(*) AS count FROM npc_trainer GROUP BY SpellID'))
{ {
$spells = DB::Aowow()->select('SELECT Id AS ARRAY_KEY, effect1Id, effect2Id, effect3Id, effect1TriggerSpell, effect2TriggerSpell, effect3TriggerSpell FROM dbc_spell WHERE Id IN (?a)', array_keys($trainer)); $spells = DB::Aowow()->select('SELECT Id AS ARRAY_KEY, effect1Id, effect2Id, effect3Id, effect1TriggerSpell, effect2TriggerSpell, effect3TriggerSpell FROM dbc_spell WHERE Id IN (?a)', array_keys($trainer));
$links = []; $links = [];
@@ -489,7 +489,7 @@ function spell()
201032 => 10658 201032 => 10658
); );
foreach ($specs as $tt => $req) foreach ($specs as $tt => $req)
if ($spells = DB::World()->selectCol('SELECT spell FROM npc_trainer WHERE entry = ?d', $tt)) if ($spells = DB::World()->selectCol('SELECT SpellID FROM npc_trainer WHERE ID = ?d', $tt))
DB::Aowow()->query('UPDATE ?_spell SET reqSpellId = ?d WHERE id IN (?a)', $req, $spells); DB::Aowow()->query('UPDATE ?_spell SET reqSpellId = ?d WHERE id IN (?a)', $req, $spells);
$itemReqs = DB::World()->selectCol('SELECT entry AS ARRAY_KEY, requiredSpell FROM item_template WHERE requiredSpell NOT IN (?a)', [0, 34090, 34091]); // not riding $itemReqs = DB::World()->selectCol('SELECT entry AS ARRAY_KEY, requiredSpell FROM item_template WHERE requiredSpell NOT IN (?a)', [0, 34090, 34091]); // not riding

View File

@@ -37,17 +37,17 @@ function titles()
$questQuery = ' $questQuery = '
SELECT SELECT
qt.RewardTitleId AS ARRAY_KEY, qt.RewardTitle AS ARRAY_KEY,
qt.RequiredRaces, qt.RequiredRaces,
ge.eventEntry ge.eventEntry
FROM FROM
quest_template qt quest_template qt
LEFT JOIN LEFT JOIN
game_event_seasonal_questrelation sq ON sq.questId = qt.id game_event_seasonal_questrelation sq ON sq.questId = qt.ID
LEFT JOIN LEFT JOIN
game_event ge ON ge.eventEntry = sq.eventEntry game_event ge ON ge.eventEntry = sq.eventEntry
WHERE WHERE
qt.RewardTitleId <> 0'; qt.RewardTitle <> 0';
DB::Aowow()->query('REPLACE INTO ?_titles SELECT Id, 0, 0, 0, 0, 0, 0, 0, male_loc0, male_loc2, male_loc3, male_loc6, male_loc8, female_loc0, female_loc2, female_loc3, female_loc6, female_loc8 FROM dbc_chartitles'); DB::Aowow()->query('REPLACE INTO ?_titles SELECT Id, 0, 0, 0, 0, 0, 0, 0, male_loc0, male_loc2, male_loc3, male_loc6, male_loc8, female_loc0, female_loc2, female_loc3, female_loc6, female_loc8 FROM dbc_chartitles');

View File

@@ -0,0 +1,15 @@
ALTER TABLE `aowow_objects`
DROP COLUMN `questItem1`,
DROP COLUMN `questItem2`,
DROP COLUMN `questItem3`,
DROP COLUMN `questItem4`,
DROP COLUMN `questItem5`,
DROP COLUMN `questItem6`;
ALTER TABLE `aowow_creature`
DROP COLUMN `questItem1`,
DROP COLUMN `questItem2`,
DROP COLUMN `questItem3`,
DROP COLUMN `questItem4`,
DROP COLUMN `questItem5`,
DROP COLUMN `questItem6`;