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

View File

@@ -34,7 +34,7 @@ function items(array $ids = [])
class, class as classBak,
subclass, subclass AS subClassBak,
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,
Quality,
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_5, spelltrigger_5, spellcharges_5, spellppmRate_5, spellcooldown_5, spellcategory_5, spellcategorycooldown_5,
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,
LanguageID,
startquest,
@@ -121,6 +121,8 @@ function items(array $ids = [])
{
AND it.entry IN (?a)
}
ORDER BY
it.entry ASC
LIMIT
?d';

View File

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

View File

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