From 003bd9366630732236b78c36f232fcc8f0bd9706 Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Tue, 6 Dec 2022 16:47:43 +0100 Subject: [PATCH] =?UTF-8?q?fix(DB/Conditions):=20Pint-Sized=20Pink=20Pachy?= =?UTF-8?q?derm=20and=20Wolpertinger=20should=E2=80=A6=20(#13946)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix(DB/Conditions): Pint-Sized Pink Pachyderm and Wolpertinger should be visible only to party members or drunk players. Fixes #13900 --- .../rev_1669454417149643100.sql | 8 +++++ src/server/game/Conditions/ConditionMgr.cpp | 31 ++++++++++--------- src/server/game/Entities/Object/Object.cpp | 11 ++++--- 3 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1669454417149643100.sql diff --git a/data/sql/updates/pending_db_world/rev_1669454417149643100.sql b/data/sql/updates/pending_db_world/rev_1669454417149643100.sql new file mode 100644 index 000000000..324acb44c --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1669454417149643100.sql @@ -0,0 +1,8 @@ +-- +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=30 AND `SourceEntry` IN (24753,22943); +INSERT INTO `conditions` VALUES +(30,0,24753,0,0,33,0,1,2,0,0,0,0,'','Pint-Sized Pink Pachyderm visible only if target is in party with its owner'), +(30,0,24753,0,1,10,0,2,0,0,0,0,0,'','Pint-Sized Pink Pachyderm visible only if target is drunk'), + +(30,0,22943,0,0,33,0,1,2,0,0,0,0,'','Pint-Sized Pink Pachyderm visible only if target is in party with its owner'), +(30,0,22943,0,1,10,0,2,0,0,0,0,0,'','Pint-Sized Pink Pachyderm visible only if target is drunk'); diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index c6e79b5bc..e246d2a30 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -768,21 +768,24 @@ uint32 Condition::GetMaxAvailableConditionTargets() // returns number of targets which are available for given source type switch (SourceType) { - case CONDITION_SOURCE_TYPE_SMART_EVENT: - return 3; - case CONDITION_SOURCE_TYPE_SPELL: - case CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET: - case CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE: - case CONDITION_SOURCE_TYPE_VEHICLE_SPELL: - case CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT: - case CONDITION_SOURCE_TYPE_GOSSIP_MENU: - case CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION: - case CONDITION_SOURCE_TYPE_NPC_VENDOR: - case CONDITION_SOURCE_TYPE_SPELL_PROC: - return 2; - default: - return 1; + case CONDITION_SOURCE_TYPE_SMART_EVENT: + return 3; + case CONDITION_SOURCE_TYPE_SPELL: + case CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET: + case CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE: + case CONDITION_SOURCE_TYPE_VEHICLE_SPELL: + case CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT: + case CONDITION_SOURCE_TYPE_GOSSIP_MENU: + case CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION: + case CONDITION_SOURCE_TYPE_NPC_VENDOR: + case CONDITION_SOURCE_TYPE_SPELL_PROC: + case CONDITION_SOURCE_TYPE_CREATURE_VISIBILITY: + return 2; + default: + break; } + + return 1; } ConditionMgr::ConditionMgr() {} diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 45f001630..d44f10f2d 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1737,7 +1737,7 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo // Creature scripts if (Creature const* cObj = obj->ToCreature()) { - if (Player const* player = this->ToPlayer()) + if (Player const* player = ToPlayer()) { if (cObj->IsAIEnabled && !cObj->AI()->CanBeSeen(player)) { @@ -1745,8 +1745,7 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo } ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_VISIBILITY, cObj->GetEntry()); - - if (!sConditionMgr->IsObjectMeetToConditions((WorldObject*)this, conditions)) + if (!sConditionMgr->IsObjectMeetToConditions((WorldObject*)this, (WorldObject*)obj, conditions)) { return false; } @@ -1755,8 +1754,12 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo // Gameobject scripts if (GameObject const* goObj = obj->ToGameObject()) - if (this->ToPlayer() && !goObj->AI()->CanBeSeen(this->ToPlayer())) + { + if (ToPlayer() && !goObj->AI()->CanBeSeen(ToPlayer())) + { return false; + } + } // pussywizard: arena spectator if (obj->GetTypeId() == TYPEID_PLAYER)