From 00a807756083aca31b2bb8758946ed8577ab7b98 Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Mon, 21 Nov 2022 22:52:16 +0100 Subject: [PATCH] =?UTF-8?q?fix(DB/Conditions):=20Grub=20should=20sell=20it?= =?UTF-8?q?s=20items=20only=20to=20players=20who=20co=E2=80=A6=20(#13803)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...mpleted "Dig Rat Stew" quest. --- .../rev_1668354557117380900.sql | 18 +++++++++ .../game/Entities/Player/PlayerUpdates.cpp | 37 +++++++++++-------- 2 files changed, 39 insertions(+), 16 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1668354557117380900.sql diff --git a/data/sql/updates/pending_db_world/rev_1668354557117380900.sql b/data/sql/updates/pending_db_world/rev_1668354557117380900.sql new file mode 100644 index 000000000..942bf9d4a --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1668354557117380900.sql @@ -0,0 +1,18 @@ +-- +UPDATE `creature_template` SET `npcflag`=130, `type_flags`=`type_flags`|0x08000000, `flags_extra`=`flags_extra`|0x01000000 WHERE `entry`=3443; + +DELETE FROM `gossip_menu_option` WHERE `MenuId`=10311; +INSERT INTO `gossip_menu_option` VALUES +(10311,0,1,'I want to browse your goods',3370,3,128,0,0,0,0,'',0,0); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=10311; +INSERT INTO `conditions` VALUES +(15,10311,0,0,0,7,0,185,15,0,0,0,0,'','Show vendor flag if player has cooking'), +(15,10311,0,0,0,8,0,862,0,0,0,0,0,'','Show vendor flag if player player has quest Dig Rat Stew rewarded'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=23 AND `SourceGroup`=3443; +INSERT INTO `conditions` VALUES +(23,3443,0,0,0,7,0,185,15,0,0,0,0,'','Show vendor flag if player has cooking'), +(23,3443,0,0,0,8,0,862,0,0,0,0,0,'','Show vendor flag if player player has quest Dig Rat Stew rewarded'); + +UPDATE `quest_template_addon` SET `RequiredSkillPoints`=15 WHERE `id`=862; diff --git a/src/server/game/Entities/Player/PlayerUpdates.cpp b/src/server/game/Entities/Player/PlayerUpdates.cpp index 06f20494a..cefebfec9 100644 --- a/src/server/game/Entities/Player/PlayerUpdates.cpp +++ b/src/server/game/Entities/Player/PlayerUpdates.cpp @@ -1761,28 +1761,33 @@ void Player::UpdateForQuestWorldObjects() continue; // check if this unit requires quest specific flags - if (!obj->HasNpcFlag(UNIT_NPC_FLAG_SPELLCLICK)) - continue; - - SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(obj->GetEntry()); - for (SpellClickInfoContainer::const_iterator _itr = clickPair.first; _itr != clickPair.second; ++_itr) + if (obj->HasNpcFlag(UNIT_NPC_FLAG_SPELLCLICK)) { - //! This code doesn't look right, but it was logically converted to condition system to do the exact - //! same thing it did before. It definitely needs to be overlooked for intended functionality. - ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(obj->GetEntry(), _itr->second.spellId); - bool buildUpdateBlock = false; - for (ConditionList::const_iterator jtr = conds.begin(); jtr != conds.end() && !buildUpdateBlock; ++jtr) - if ((*jtr)->ConditionType == CONDITION_QUESTREWARDED || (*jtr)->ConditionType == CONDITION_QUESTTAKEN) - buildUpdateBlock = true; - - if (buildUpdateBlock) + SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(obj->GetEntry()); + for (SpellClickInfoContainer::const_iterator _itr = clickPair.first; _itr != clickPair.second; ++_itr) { - obj->BuildValuesUpdateBlockForPlayer(&udata, this); - break; + //! This code doesn't look right, but it was logically converted to condition system to do the exact + //! same thing it did before. It definitely needs to be overlooked for intended functionality. + ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(obj->GetEntry(), _itr->second.spellId); + bool buildUpdateBlock = false; + for (ConditionList::const_iterator jtr = conds.begin(); jtr != conds.end() && !buildUpdateBlock; ++jtr) + if ((*jtr)->ConditionType == CONDITION_QUESTREWARDED || (*jtr)->ConditionType == CONDITION_QUESTTAKEN) + buildUpdateBlock = true; + + if (buildUpdateBlock) + { + obj->BuildValuesUpdateBlockForPlayer(&udata, this); + break; + } } } + else if (obj->HasNpcFlag(UNIT_NPC_FLAG_VENDOR_MASK | UNIT_NPC_FLAG_TRAINER)) + { + obj->BuildValuesUpdateBlockForPlayer(&udata, this); + } } } + udata.BuildPacket(&packet); GetSession()->SendPacket(&packet); }