Setup/Misc

* wrap LEFT JOINed fields in IFNULL() to prevent errors on setup
 * also adapt to changed TC table structure
 * add ORDER to prevent skipping entries, if not already ordered in source table
This commit is contained in:
Sarjuuk
2017-02-12 02:29:21 +01:00
parent b81e1745f6
commit 88e21d8597
4 changed files with 57 additions and 47 deletions

View File

@@ -31,8 +31,8 @@ function creature(array $ids = [])
"" AS textureString, -- textureString "" AS textureString, -- textureString
0 AS modelId, -- modelId 0 AS modelId, -- modelId
"" AS iconString, -- iconString "" AS iconString, -- iconString
ct.name, ctl2.`Name` AS n2, ctl3.`Name` AS n3, ctl6.`Name` AS n6, ctl8.`Name` AS n8, ct.name, IFNULL(ctl2.`Name`, "") AS n2, IFNULL(ctl3.`Name`, "") AS n3, IFNULL(ctl6.`Name`, "") AS n6, IFNULL(ctl8.`Name`, "") AS n8,
subname, ctl2.`Title` AS t2, ctl3.`Title` AS t3, ctl6.`Title` AS t6, ctl8.`Title` AS t8, subname, IFNULL(ctl2.`Title`, "") AS t2, IFNULL(ctl3.`Title`, "") AS t3, IFNULL(ctl6.`Title`, "") AS t6, IFNULL(ctl8.`Title`, "") AS t8,
minLevel, maxLevel, minLevel, maxLevel,
exp, exp,
faction, faction,
@@ -96,6 +96,8 @@ function creature(array $ids = [])
{ {
AND ct.entry IN (?a) AND ct.entry IN (?a)
} }
ORDER BY
ct.entry ASC
LIMIT LIMIT
?d'; ?d';

View File

@@ -34,7 +34,7 @@ function items(array $ids = [])
class, class as classBak, class, class as classBak,
subclass, subclass AS subClassBak, subclass, subclass AS subClassBak,
IFNULL(sg.id, 0) AS subSubClass, IFNULL(sg.id, 0) AS subSubClass,
name, name_loc2, name_loc3, name_loc6, name_loc8, name, IFNULL(li.name_loc2, ""), IFNULL(li.name_loc3, ""), IFNULL(li.name_loc6, ""), IFNULL(li.name_loc8, ""),
displayid, displayid,
Quality, Quality,
Flags, FlagsExtra, Flags, FlagsExtra,
@@ -81,7 +81,7 @@ function items(array $ids = [])
spellid_4, spelltrigger_4, spellcharges_4, spellppmRate_4, spellcooldown_4, spellcategory_4, spellcategorycooldown_4, spellid_4, spelltrigger_4, spellcharges_4, spellppmRate_4, spellcooldown_4, spellcategory_4, spellcategorycooldown_4,
spellid_5, spelltrigger_5, spellcharges_5, spellppmRate_5, spellcooldown_5, spellcategory_5, spellcategorycooldown_5, spellid_5, spelltrigger_5, spellcharges_5, spellppmRate_5, spellcooldown_5, spellcategory_5, spellcategorycooldown_5,
bonding, bonding,
it.description, description_loc2, description_loc3, description_loc6, description_loc8, it.description, IFNULL(li.description_loc2, ""), IFNULL(li.description_loc3, ""), IFNULL(li.description_loc6, ""), IFNULL(li.description_loc8, ""),
PageText, PageText,
LanguageID, LanguageID,
startquest, startquest,
@@ -121,6 +121,8 @@ function items(array $ids = [])
{ {
AND it.entry IN (?a) AND it.entry IN (?a)
} }
ORDER BY
it.entry ASC
LIMIT LIMIT
?d'; ?d';

View File

@@ -31,12 +31,12 @@ function objects(array $ids = [])
0 AS event, -- linked worldevent 0 AS event, -- linked worldevent
displayId, displayId,
go.name, go.name,
gtl2.`name` AS name_loc2, IFNULL(gtl2.`name`, "") AS name_loc2,
gtl3.`name` AS name_loc3, IFNULL(gtl3.`name`, "") AS name_loc3,
gtl6.`name` AS name_loc6, IFNULL(gtl6.`name`, "") AS name_loc6,
gtl8.`name` AS name_loc8, IFNULL(gtl8.`name`, "") AS name_loc8,
faction, IFNULL(goa.faction, 0),
flags, IFNULL(goa.flags, 0),
0 AS cuFlags, -- custom Flags 0 AS cuFlags, -- custom Flags
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
@@ -65,6 +65,8 @@ function objects(array $ids = [])
IF(ScriptName <> "", ScriptName, AIName) IF(ScriptName <> "", ScriptName, AIName)
FROM FROM
gameobject_template go gameobject_template go
LEFT JOIN
gameobject_template_addon goa ON go.entry = goa.entry
LEFT JOIN LEFT JOIN
gameobject_template_locale gtl2 ON go.entry = gtl2.entry AND gtl2.`locale` = "frFR" gameobject_template_locale gtl2 ON go.entry = gtl2.entry AND gtl2.`locale` = "frFR"
LEFT JOIN LEFT JOIN
@@ -82,6 +84,8 @@ function objects(array $ids = [])
} }
GROUP BY GROUP BY
go.entry go.entry
ORDER BY
go.entry ASC
LIMIT LIMIT
?d'; ?d';

View File

@@ -28,37 +28,37 @@ function quests(array $ids = [])
QuestType, -- Method QuestType, -- Method
QuestLevel, QuestLevel,
MinLevel, MinLevel,
MaxLevel, IFNULL(qa.MaxLevel, 0),
QuestSortID, QuestSortID,
QuestSortID AS zoneOrSortBak, -- ZoneOrSortBak QuestSortID AS zoneOrSortBak, -- ZoneOrSortBak
QuestInfoID, -- QuestType QuestInfoID, -- QuestType
SuggestedGroupNum, SuggestedGroupNum,
TimeAllowed, TimeAllowed,
IFNULL(gesqr.eventEntry, 0) AS eventId, IFNULL(gesqr.eventEntry, 0) AS eventId,
PrevQuestId, IFNULL(qa.PrevQuestId, 0),
NextQuestId, IFNULL(qa.NextQuestId, 0),
ExclusiveGroup, IFNULL(qa.ExclusiveGroup, 0),
RewardNextQuest, RewardNextQuest,
Flags, Flags,
SpecialFlags, IFNULL(qa.SpecialFlags, 0),
0 AS cuFlags, -- cuFlags 0 AS cuFlags, -- cuFlags
AllowableClasses, IFNULL(qa.AllowableClasses, 0),
AllowableRaces, AllowableRaces,
RequiredSkillId, RequiredSkillPoints, IFNULL(qa.RequiredSkillId, 0), IFNULL(qa.RequiredSkillPoints, 0),
RequiredFactionId1, RequiredFactionId2, RequiredFactionId1, RequiredFactionId2,
RequiredFactionValue1, RequiredFactionValue2, RequiredFactionValue1, RequiredFactionValue2,
RequiredMinRepFaction, RequiredMaxRepFaction, IFNULL(qa.RequiredMinRepFaction, 0),IFNULL(qa.RequiredMaxRepFaction, 0),
RequiredMinRepValue, RequiredMaxRepValue, IFNULL(qa.RequiredMinRepValue, 0), IFNULL(qa.RequiredMaxRepValue, 0),
RequiredPlayerKills, RequiredPlayerKills,
StartItem, StartItem,
ProvidedItemCount, IFNULL(qa.ProvidedItemCount, 0),
SourceSpellId, IFNULL(qa.SourceSpellId, 0),
RewardXPDifficulty, -- QuestXP.dbc x level RewardXPDifficulty, -- QuestXP.dbc x level
RewardMoney, RewardMoney,
RewardBonusMoney, RewardBonusMoney,
RewardDisplaySpell, RewardSpell, RewardDisplaySpell, RewardSpell,
RewardHonor * 124 * RewardKillHonor, -- alt calculation in QuestDef.cpp -> Quest::CalculateHonorGain(playerLevel) RewardHonor * 124 * RewardKillHonor, -- alt calculation in QuestDef.cpp -> Quest::CalculateHonorGain(playerLevel)
RewardMailTemplateId, RewardMailDelay, IFNULL(qa.RewardMailTemplateId, 0), IFNULL(qa.RewardMailDelay, 0),
RewardTitle, RewardTitle,
RewardTalents, RewardTalents,
RewardArenaPoints, RewardArenaPoints,
@@ -72,23 +72,23 @@ function quests(array $ids = [])
IF (RewardFactionOverride3 <> 0, RewardFactionOverride3 / 100, RewardFactionValue3), IF (RewardFactionOverride3 <> 0, RewardFactionOverride3 / 100, RewardFactionValue3),
IF (RewardFactionOverride4 <> 0, RewardFactionOverride4 / 100, RewardFactionValue4), IF (RewardFactionOverride4 <> 0, RewardFactionOverride4 / 100, RewardFactionValue4),
IF (RewardFactionOverride5 <> 0, RewardFactionOverride5 / 100, RewardFactionValue5), IF (RewardFactionOverride5 <> 0, RewardFactionOverride5 / 100, RewardFactionValue5),
LogTitle, Title_loc2, Title_loc3, Title_loc6, Title_loc8, LogTitle, IFNULL(lq.Title_loc2, ""), IFNULL(lq.Title_loc3, ""), IFNULL(lq.Title_loc6, ""), IFNULL(lq.Title_loc8, ""),
LogDescription, Objectives_loc2, Objectives_loc3, Objectives_loc6, Objectives_loc8, LogDescription, IFNULL(lq.Objectives_loc2, ""), IFNULL(lq.Objectives_loc3, ""), IFNULL(lq.Objectives_loc6, ""), IFNULL(lq.Objectives_loc8, ""),
QuestDescription, Details_loc2, Details_loc3, Details_loc6, Details_loc8, QuestDescription, IFNULL(lq.Details_loc2, ""), IFNULL(lq.Details_loc3, ""), IFNULL(lq.Details_loc6, ""), IFNULL(lq.Details_loc8, ""),
AreaDescription, EndText_loc2, EndText_loc3, EndText_loc6, EndText_loc8, AreaDescription, IFNULL(lq.EndText_loc2, ""), IFNULL(lq.EndText_loc3, ""), IFNULL(lq.EndText_loc6, ""), IFNULL(lq.EndText_loc8, ""),
qor.RewardText, OfferRewardText_loc2, OfferRewardText_loc3, OfferRewardText_loc6, OfferRewardText_loc8, IFNULL(qor.RewardText, ""), IFNULL(lq.OfferRewardText_loc2, ""), IFNULL(lq.OfferRewardText_loc3, ""), IFNULL(lq.OfferRewardText_loc6, ""), IFNULL(lq.OfferRewardText_loc8, ""),
qri.CompletionText, RequestItemsText_loc2, RequestItemsText_loc3, RequestItemsText_loc6, RequestItemsText_loc8, IFNULL(qri.CompletionText, ""), IFNULL(lq.RequestItemsText_loc2, ""), IFNULL(lq.RequestItemsText_loc3, ""), IFNULL(lq.RequestItemsText_loc6, ""), IFNULL(lq.RequestItemsText_loc8, ""),
QuestCompletionLog, CompletedText_loc2, CompletedText_loc3, CompletedText_loc6, CompletedText_loc8, QuestCompletionLog, IFNULL(lq.CompletedText_loc2, ""), IFNULL(lq.CompletedText_loc3, ""), IFNULL(lq.CompletedText_loc6, ""), IFNULL(lq.CompletedText_loc8, ""),
RequiredNpcOrGo1, RequiredNpcOrGo2, RequiredNpcOrGo3, RequiredNpcOrGo4, RequiredNpcOrGo1, RequiredNpcOrGo2, RequiredNpcOrGo3, RequiredNpcOrGo4,
RequiredNpcOrGoCount1, RequiredNpcOrGoCount2, RequiredNpcOrGoCount3, RequiredNpcOrGoCount4, RequiredNpcOrGoCount1, RequiredNpcOrGoCount2, RequiredNpcOrGoCount3, RequiredNpcOrGoCount4,
ItemDrop1, ItemDrop2, ItemDrop3, ItemDrop4, ItemDrop1, ItemDrop2, ItemDrop3, ItemDrop4,
ItemDropQuantity1, ItemDropQuantity2, ItemDropQuantity3, ItemDropQuantity4, ItemDropQuantity1, ItemDropQuantity2, ItemDropQuantity3, ItemDropQuantity4,
RequiredItemId1, RequiredItemId2, RequiredItemId3, RequiredItemId4, RequiredItemId5, RequiredItemId6, RequiredItemId1, RequiredItemId2, RequiredItemId3, RequiredItemId4, RequiredItemId5, RequiredItemId6,
RequiredItemCount1, RequiredItemCount2, RequiredItemCount3, RequiredItemCount4, RequiredItemCount5, RequiredItemCount6, RequiredItemCount1, RequiredItemCount2, RequiredItemCount3, RequiredItemCount4, RequiredItemCount5, RequiredItemCount6,
ObjectiveText1, ObjectiveText1_loc2, ObjectiveText1_loc3, ObjectiveText1_loc6, ObjectiveText1_loc8, ObjectiveText1, IFNULL(lq.ObjectiveText1_loc2, ""), IFNULL(lq.ObjectiveText1_loc3, ""), IFNULL(lq.ObjectiveText1_loc6, ""), IFNULL(lq.ObjectiveText1_loc8, ""),
ObjectiveText2, ObjectiveText2_loc2, ObjectiveText2_loc3, ObjectiveText2_loc6, ObjectiveText2_loc8, ObjectiveText2, IFNULL(lq.ObjectiveText2_loc2, ""), IFNULL(lq.ObjectiveText2_loc3, ""), IFNULL(lq.ObjectiveText2_loc6, ""), IFNULL(lq.ObjectiveText2_loc8, ""),
ObjectiveText3, ObjectiveText3_loc2, ObjectiveText3_loc3, ObjectiveText3_loc6, ObjectiveText3_loc8, ObjectiveText3, IFNULL(lq.ObjectiveText3_loc2, ""), IFNULL(lq.ObjectiveText3_loc3, ""), IFNULL(lq.ObjectiveText3_loc6, ""), IFNULL(lq.ObjectiveText3_loc8, ""),
ObjectiveText4, ObjectiveText4_loc2, ObjectiveText4_loc3, ObjectiveText4_loc6, ObjectiveText4_loc8 ObjectiveText4, IFNULL(lq.ObjectiveText4_loc2, ""), IFNULL(lq.ObjectiveText4_loc3, ""), IFNULL(lq.ObjectiveText4_loc6, ""), IFNULL(lq.ObjectiveText4_loc8, "")
FROM FROM
quest_template q quest_template q
LEFT JOIN LEFT JOIN
@@ -106,6 +106,8 @@ function quests(array $ids = [])
{ {
AND q.Id IN (?a) AND q.Id IN (?a)
} }
ORDER BY
q.ID ASC
LIMIT LIMIT
?d'; ?d';