From d9cbf60fd1ba076b48a02c7313fda585f47f43da Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Mon, 21 Jun 2021 22:10:58 +0200 Subject: [PATCH] Core/Quests: kick AllowableRaces and TimeAllowed from quest_template over to quest_template_addon as these fields no longer are being sent in quest query packets --- .../world/4.3.4/2021_06_21_02_world.sql | 13 ++ src/server/game/Globals/ObjectMgr.cpp | 36 +++--- src/server/game/Quests/QuestDef.cpp | 121 +++++++++--------- src/server/game/Quests/QuestDef.h | 4 +- 4 files changed, 94 insertions(+), 80 deletions(-) create mode 100644 sql/updates/world/4.3.4/2021_06_21_02_world.sql diff --git a/sql/updates/world/4.3.4/2021_06_21_02_world.sql b/sql/updates/world/4.3.4/2021_06_21_02_world.sql new file mode 100644 index 00000000000..21bd6b19dde --- /dev/null +++ b/sql/updates/world/4.3.4/2021_06_21_02_world.sql @@ -0,0 +1,13 @@ +ALTER TABLE `quest_template_addon` +ADD COLUMN `AllowableRaces` MEDIUMINT UNSIGNED NOT NULL DEFAULT 0 AFTER `SpecialFlags`, +ADD COLUMN `TimeAllowed` INT UNSIGNED NOT NULL DEFAULT 0 AFTER `AllowableRaces`; + +INSERT IGNORE INTO `quest_template_addon` (`ID`) (SELECT `ID` FROM `quest_template` WHERE `AllowableRaces` != 0 OR `TimeAllowed` != 0); + +UPDATE `quest_template_addon` AS qta +INNER JOIN `quest_template` AS qt ON (qta.ID = qt.ID) +SET qta.AllowableRaces = qt.AllowableRaces, qta.TimeAllowed = qt.TimeAllowed; + +ALTER TABLE `quest_template` +DROP COLUMN `AllowableRaces`, +DROP COLUMN `TimeAllowed`; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 1a946ef5ece..e2efe7ad5e2 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -4047,35 +4047,35 @@ void ObjectMgr::LoadQuests() _exclusiveQuestGroups.clear(); QueryResult result = WorldDatabase.Query("SELECT " - //0 1 2 3 4 5 6 7 8 - "ID, QuestType, QuestLevel, MinLevel, QuestSortID, QuestInfoID, SuggestedGroupNum, TimeAllowed, AllowableRaces, " - //9 10 11 12 + //0 1 2 3 4 5 6 + "ID, QuestType, QuestLevel, MinLevel, QuestSortID, QuestInfoID, SuggestedGroupNum, " + //7 8 9 10 "RequiredFactionId1, RequiredFactionId2, RequiredFactionValue1, RequiredFactionValue2, " - //13 14 15 16 17 18 19 20 + //11 12 13 14 15 16 17 18 "RewardNextQuest, RewardXPDifficulty, RewardMoney, RewardBonusMoney, RewardDisplaySpell, RewardSpell, RewardHonor, RewardKillHonor, " - //21 22 23 24 25 26 + //19 20 21 22 23 24 "StartItem, Flags, MinimapTargetMark, RewardTitle, RequiredPlayerKills, RewardTalents, " - //27 28 29 30 31 32 + //25 26 27 28 29 30 "RewardArenaPoints, RewardSkillId, RewardSkillPoints, RewardReputationMask, QuestGiverPortrait, QuestTurnInPortrait, " - //33 34 35 36 37 38 39 40 + //31 32 33 34 35 36 37 38 "RewardItem1, RewardAmount1, RewardItem2, RewardAmount2, RewardItem3, RewardAmount3, RewardItem4, RewardAmount4, " - //41 42 43 44 45 46 47 48 49 50 51 52 + //39 40 41 42 43 44 45 46 47 48 49 50 "RewardChoiceItemID1, RewardChoiceItemQuantity1, RewardChoiceItemID2, RewardChoiceItemQuantity2, RewardChoiceItemID3, RewardChoiceItemQuantity3, RewardChoiceItemID4, RewardChoiceItemQuantity4, RewardChoiceItemID5, RewardChoiceItemQuantity5, RewardChoiceItemID6, RewardChoiceItemQuantity6, " - //53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 + //51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 "RewardFactionID1, RewardFactionValue1, RewardFactionOverride1, RewardFactionID2, RewardFactionValue2, RewardFactionOverride2, RewardFactionID3, RewardFactionValue3, RewardFactionOverride3, RewardFactionID4, RewardFactionValue4, RewardFactionOverride4, RewardFactionID5, RewardFactionValue5, RewardFactionOverride5, " - //68 69 70 71 72 73 74 75 76 + //66 67 68 69 70 71 72 73 74 "POIContinent, POIx, POIy, POIPriority, LogTitle, LogDescription, QuestDescription, AreaDescription, QuestCompletionLog, " - //77 78 79 80 81 82 83 84 + //75 76 77 78 79 80 81 82 "RequiredNpcOrGo1, RequiredNpcOrGo2, RequiredNpcOrGo3, RequiredNpcOrGo4, RequiredNpcOrGoCount1, RequiredNpcOrGoCount2, RequiredNpcOrGoCount3, RequiredNpcOrGoCount4, " - //85 86 87 88 89 90 91 92 + //83 84 85 86 87 88 89 90 "ItemDrop1, ItemDrop2, ItemDrop3, ItemDrop4, ItemDropQuantity1, ItemDropQuantity2, ItemDropQuantity3, ItemDropQuantity4, " - //93 94 95 96 97 98 99 100 101 102 103 104 + //91 92 93 94 95 96 97 98 99 100 101 102 "RequiredItemId1, RequiredItemId2, RequiredItemId3, RequiredItemId4, RequiredItemId5, RequiredItemId6, RequiredItemCount1, RequiredItemCount2, RequiredItemCount3, RequiredItemCount4, RequiredItemCount5, RequiredItemCount6, " - //105 106 107 108 109 110 111 112 113 114 115 116 117 + //103 104 105 106 107 108 109 110 111 112 113 114 115 "RequiredSpell, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4, RewardCurrencyId1, RewardCurrencyId2, RewardCurrencyId3, RewardCurrencyId4, RewardCurrencyCount1, RewardCurrencyCount2, RewardCurrencyCount3, RewardCurrencyCount4, " - //118 119 120 121 122 123 124 125 + //116 117 118 119 120 121 122 123 "RequiredCurrencyId1, RequiredCurrencyId2, RequiredCurrencyId3, RequiredCurrencyId4, RequiredCurrencyCount1, RequiredCurrencyCount2, RequiredCurrencyCount3, RequiredCurrencyCount4, " - //126 127 128 129 130 131 + //124 125 126 127 128 129 "QuestGiverTextWindow, QuestGiverTargetName, QuestTurnTextWindow, QuestTurnTargetName, SoundAccept, SoundTurnIn" " FROM quest_template"); if (!result) @@ -4122,8 +4122,8 @@ void ObjectMgr::LoadQuests() // 0 1 2 3 4 5 6 7 8 9 { "ID, MaxLevel, AllowableClasses, SourceSpellID, PrevQuestID, NextQuestID, ExclusiveGroup, BreadcrumbForQuestId, RewardMailTemplateID, RewardMailDelay," - // 10 11 12 13 14 15 16 17 - " RequiredSkillID, RequiredSkillPoints, RequiredMinRepFaction, RequiredMaxRepFaction, RequiredMinRepValue, RequiredMaxRepValue, ProvidedItemCount, SpecialFlags", "quest_template_addon", "template addons", &Quest::LoadQuestTemplateAddon }, + // 10 11 12 13 14 15 16 17 18 19 + " RequiredSkillID, RequiredSkillPoints, RequiredMinRepFaction, RequiredMaxRepFaction, RequiredMinRepValue, RequiredMaxRepValue, ProvidedItemCount, SpecialFlags, AllowableRaces, TimeAllowed", "quest_template_addon", "template addons", &Quest::LoadQuestTemplateAddon }, // 0 1 { "QuestId, RewardMailSenderEntry", "quest_mail_sender", "mail sender entries", &Quest::LoadQuestMailSender } diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index c43594f4856..0cb24566d8b 100644 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -35,37 +35,35 @@ Quest::Quest(Field* questRecord) _zoneOrSort = questRecord[4].GetInt16(); _type = questRecord[5].GetUInt16(); _suggestedPlayers = questRecord[6].GetUInt8(); - _timeAllowed = questRecord[7].GetUInt32(); - _allowableRaces = questRecord[8].GetUInt32(); - _requiredFactionId1 = questRecord[9].GetUInt16(); - _requiredFactionId2 = questRecord[10].GetUInt16(); - _requiredFactionValue1 = questRecord[11].GetInt32(); - _requiredFactionValue2 = questRecord[12].GetInt32(); - _rewardNextQuest = questRecord[13].GetUInt32(); - _rewardXPDifficulty = questRecord[14].GetUInt8(); - _rewardMoney = questRecord[15].GetInt32(); - _rewardBonusMoney = questRecord[16].GetUInt32(); - _rewardDisplaySpell = questRecord[17].GetUInt32(); - _rewardSpell = questRecord[18].GetInt32(); - _rewardHonor = questRecord[19].GetUInt32(); - _rewardKillHonor = questRecord[20].GetFloat(); - _startItem = questRecord[21].GetUInt32(); - _flags = questRecord[22].GetUInt32(); - _minimapTargetMark = questRecord[23].GetUInt8(); - _rewardTitleId = questRecord[24].GetUInt8(); - _requiredPlayerKills = questRecord[25].GetUInt8(); - _rewardTalents = questRecord[26].GetUInt8(); - _rewardArenaPoints = questRecord[27].GetUInt16(); - _rewardSkillId = questRecord[28].GetUInt16(); - _rewardSkillPoints = questRecord[29].GetUInt8(); - _rewardReputationMask = questRecord[30].GetUInt8(); - _questGiverPortrait = questRecord[31].GetUInt32(); - _questTurnInPortrait = questRecord[32].GetUInt32(); + _requiredFactionId1 = questRecord[7].GetUInt16(); + _requiredFactionId2 = questRecord[8].GetUInt16(); + _requiredFactionValue1 = questRecord[9].GetInt32(); + _requiredFactionValue2 = questRecord[10].GetInt32(); + _rewardNextQuest = questRecord[11].GetUInt32(); + _rewardXPDifficulty = questRecord[12].GetUInt8(); + _rewardMoney = questRecord[13].GetInt32(); + _rewardBonusMoney = questRecord[14].GetUInt32(); + _rewardDisplaySpell = questRecord[15].GetUInt32(); + _rewardSpell = questRecord[16].GetInt32(); + _rewardHonor = questRecord[17].GetUInt32(); + _rewardKillHonor = questRecord[18].GetFloat(); + _startItem = questRecord[19].GetUInt32(); + _flags = questRecord[20].GetUInt32(); + _minimapTargetMark = questRecord[21].GetUInt8(); + _rewardTitleId = questRecord[22].GetUInt8(); + _requiredPlayerKills = questRecord[23].GetUInt8(); + _rewardTalents = questRecord[24].GetUInt8(); + _rewardArenaPoints = questRecord[25].GetUInt16(); + _rewardSkillId = questRecord[26].GetUInt16(); + _rewardSkillPoints = questRecord[27].GetUInt8(); + _rewardReputationMask = questRecord[28].GetUInt8(); + _questGiverPortrait = questRecord[29].GetUInt32(); + _questTurnInPortrait = questRecord[30].GetUInt32(); for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i) { - RewardItemId[i] = questRecord[33 + i * 2].GetUInt32(); - RewardItemIdCount[i] = questRecord[34 + i * 2].GetUInt16(); + RewardItemId[i] = questRecord[31 + i * 2].GetUInt32(); + RewardItemIdCount[i] = questRecord[32 + i * 2].GetUInt16(); if (RewardItemId[i]) ++_rewItemsCount; @@ -73,8 +71,8 @@ Quest::Quest(Field* questRecord) for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) { - RewardChoiceItemId[i] = questRecord[41 + i * 2].GetUInt32(); - RewardChoiceItemCount[i] = questRecord[42 + i * 2].GetUInt16(); + RewardChoiceItemId[i] = questRecord[39 + i * 2].GetUInt32(); + RewardChoiceItemCount[i] = questRecord[40 + i * 2].GetUInt16(); if (RewardChoiceItemId[i]) ++_rewChoiceItemsCount; @@ -82,26 +80,26 @@ Quest::Quest(Field* questRecord) for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) { - RewardFactionId[i] = questRecord[53 + i * 3].GetUInt16(); - RewardFactionValueId[i] = questRecord[54 + i * 3].GetInt32(); - RewardFactionValueIdOverride[i] = questRecord[55 + i * 3].GetInt32(); + RewardFactionId[i] = questRecord[51 + i * 3].GetUInt16(); + RewardFactionValueId[i] = questRecord[52 + i * 3].GetInt32(); + RewardFactionValueIdOverride[i] = questRecord[53 + i * 3].GetInt32(); } - _poiContinent = questRecord[68].GetUInt16(); - _poiX = questRecord[69].GetFloat(); - _poiY = questRecord[70].GetFloat(); - _poiPriority = questRecord[71].GetUInt32(); - _title = questRecord[72].GetString(); - _objectives = questRecord[73].GetString(); - _details = questRecord[74].GetString(); - _areaDescription = questRecord[75].GetString(); - _completedText = questRecord[76].GetString(); + _poiContinent = questRecord[66].GetUInt16(); + _poiX = questRecord[67].GetFloat(); + _poiY = questRecord[68].GetFloat(); + _poiPriority = questRecord[69].GetUInt32(); + _title = questRecord[70].GetString(); + _objectives = questRecord[71].GetString(); + _details = questRecord[72].GetString(); + _areaDescription = questRecord[73].GetString(); + _completedText = questRecord[74].GetString(); for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) { - RequiredNpcOrGo[i] = questRecord[77 + i].GetInt32(); - RequiredNpcOrGoCount[i] = questRecord[81 + i].GetUInt16(); - ObjectiveText[i] = questRecord[106 + i].GetString(); + RequiredNpcOrGo[i] = questRecord[75 + i].GetInt32(); + RequiredNpcOrGoCount[i] = questRecord[79 + i].GetUInt16(); + ObjectiveText[i] = questRecord[104 + i].GetString(); if (RequiredNpcOrGo[i]) ++_reqNpcOrGoCount; @@ -109,14 +107,14 @@ Quest::Quest(Field* questRecord) for (uint32 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) { - ItemDrop[i] = questRecord[85 + i].GetUInt32(); - ItemDropQuantity[i] = questRecord[89 + i].GetUInt16(); + ItemDrop[i] = questRecord[83 + i].GetUInt32(); + ItemDropQuantity[i] = questRecord[87 + i].GetUInt16(); } for (uint32 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) { - RequiredItemId[i] = questRecord[93 + i].GetUInt32(); - RequiredItemCount[i] = questRecord[99 + i].GetUInt16(); + RequiredItemId[i] = questRecord[91 + i].GetUInt32(); + RequiredItemCount[i] = questRecord[97 + i].GetUInt16(); if (RequiredItemId[i]) ++_reqItemsCount; @@ -132,12 +130,12 @@ Quest::Quest(Field* questRecord) OfferRewardEmoteDelay[i] = 0; } - _requiredSpell = questRecord[105].GetUInt32(); + _requiredSpell = questRecord[103].GetUInt32(); for (uint32 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i) { - RewardCurrencyId[i] = questRecord[110 + i].GetUInt16(); - RewardCurrencyCount[i] = questRecord[114 + i].GetUInt32(); + RewardCurrencyId[i] = questRecord[108 + i].GetUInt16(); + RewardCurrencyCount[i] = questRecord[112 + i].GetUInt32(); if (RewardCurrencyId[i]) ++_rewCurrencyCount; @@ -145,19 +143,19 @@ Quest::Quest(Field* questRecord) for (uint32 i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i) { - RequiredCurrencyId[i] = questRecord[118 + i].GetUInt16(); - RequiredCurrencyCount[i] = questRecord[122 + i].GetUInt32(); + RequiredCurrencyId[i] = questRecord[116 + i].GetUInt16(); + RequiredCurrencyCount[i] = questRecord[120 + i].GetUInt32(); if (RequiredCurrencyId[i]) ++_reqCurrencyCount; } - _questGiverTextWindow = questRecord[126].GetString(); - _questGiverTargetName = questRecord[127].GetString(); - _questTurnTextWindow = questRecord[128].GetString(); - _questTurnTargetName = questRecord[129].GetString(); - _soundAccept = questRecord[130].GetUInt16(); - _soundTurnIn = questRecord[131].GetUInt16(); + _questGiverTextWindow = questRecord[124].GetString(); + _questGiverTargetName = questRecord[125].GetString(); + _questTurnTextWindow = questRecord[126].GetString(); + _questTurnTargetName = questRecord[127].GetString(); + _soundAccept = questRecord[128].GetUInt16(); + _soundTurnIn = questRecord[129].GetUInt16(); } void Quest::LoadQuestDetails(Field* fields) @@ -232,6 +230,9 @@ void Quest::LoadQuestTemplateAddon(Field* fields) if (_specialFlags & QUEST_SPECIAL_FLAGS_AUTO_ACCEPT) _flags |= QUEST_FLAGS_AUTO_ACCEPT; + + _allowableRaces = fields[18].GetUInt16(); + _timeAllowed = fields[19].GetInt32(); } void Quest::LoadQuestMailSender(Field* fields) diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h index d0491a7bafd..7ea1022fa56 100644 --- a/src/server/game/Quests/QuestDef.h +++ b/src/server/game/Quests/QuestDef.h @@ -397,13 +397,11 @@ class TC_GAME_API Quest uint32 _minLevel = 0; int32 _level = 0; uint32 _type = 0; - uint32 _allowableRaces = 0; uint32 _requiredFactionId1 = 0; int32 _requiredFactionValue1 = 0; uint32 _requiredFactionId2 = 0; int32 _requiredFactionValue2 = 0; uint32 _suggestedPlayers = 0; - uint32 _timeAllowed = 0; uint32 _flags = 0; uint32 _rewardTitleId = 0; uint32 _requiredPlayerKills = 0; @@ -468,6 +466,8 @@ class TC_GAME_API Quest uint32 _startItemCount = 0; uint32 _rewardMailSenderEntry = 0; uint32 _specialFlags = 0; // custom flags, not sniffed/WDB + uint32 _allowableRaces = 0; + uint32 _timeAllowed = 0; // Helpers static uint32 RoundXPValue(uint32 xp);