diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/CoreAI/GameObjectAI.h | 9 | ||||
-rw-r--r-- | src/server/game/AI/CoreAI/UnitAI.cpp | 5 | ||||
-rw-r--r-- | src/server/game/AI/CoreAI/UnitAI.h | 18 | ||||
-rw-r--r-- | src/server/game/AI/CreatureAI.h | 22 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 10 | ||||
-rw-r--r-- | src/server/game/Quests/QuestDef.h | 3 |
6 files changed, 31 insertions, 36 deletions
diff --git a/src/server/game/AI/CoreAI/GameObjectAI.h b/src/server/game/AI/CoreAI/GameObjectAI.h index 147dd1a4b2c..3c33dac40db 100644 --- a/src/server/game/AI/CoreAI/GameObjectAI.h +++ b/src/server/game/AI/CoreAI/GameObjectAI.h @@ -20,8 +20,9 @@ #define TRINITY_GAMEOBJECTAI_H #include "Define.h" -#include "QuestDef.h" #include "ObjectGuid.h" +#include "Optional.h" +#include "QuestDef.h" class GameObject; class Unit; @@ -48,6 +49,9 @@ class TC_GAME_API GameObjectAI static int32 Permissible(GameObject const* go); + // Called when the dialog status between a player and the gameobject is requested. + virtual Optional<QuestGiverStatus> GetDialogStatus(Player* /*player*/) { return boost::none; } + // Called when a player opens a gossip dialog with the gameobject. virtual bool GossipHello(Player* /*player*/) { return false; } @@ -63,9 +67,6 @@ class TC_GAME_API GameObjectAI // Called when a player completes a quest and is rewarded, opt is the selected item's index or 0 virtual void QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) { } - // Called when the dialog status between a player and the gameobject is requested. - virtual uint32 GetDialogStatus(Player* /*player*/) { return DIALOG_STATUS_SCRIPTED_NO_STATUS; } - // Called when a Player clicks a GameObject, before GossipHello // prevents achievement tracking if returning true virtual bool OnReportUse(Player* /*player*/) { return false; } diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp index 2c587bffcc5..c36db401f59 100644 --- a/src/server/game/AI/CoreAI/UnitAI.cpp +++ b/src/server/game/AI/CoreAI/UnitAI.cpp @@ -183,11 +183,6 @@ void UnitAI::DoCastVictim(uint32 spellId, CastSpellExtraArgs const& args) DoCast(victim, spellId, args); } -uint32 UnitAI::GetDialogStatus(Player* /*player*/) -{ - return DIALOG_STATUS_SCRIPTED_NO_STATUS; -} - #define UPDATE_TARGET(a) {if (AIInfo->target<a) AIInfo->target=a;} void UnitAI::FillAISpellInfo() diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index f0baa446336..2c7eb65b5cf 100644 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -317,27 +317,9 @@ class TC_GAME_API UnitAI static AISpellInfoType* AISpellInfo; static void FillAISpellInfo(); - // Called when a player opens a gossip dialog with the creature. - virtual bool GossipHello(Player* /*player*/) { return false; } - - // Called when a player selects a gossip item in the creature's gossip menu. - virtual bool GossipSelect(Player* /*player*/, uint32 /*menuId*/, uint32 /*gossipListId*/) { return false; } - - // Called when a player selects a gossip with a code in the creature's gossip menu. - virtual bool GossipSelectCode(Player* /*player*/, uint32 /*menuId*/, uint32 /*gossipListId*/, char const* /*code*/) { return false; } - - // Called when a player accepts a quest from the creature. - virtual void QuestAccept(Player* /*player*/, Quest const* /*quest*/) { } - - // Called when a player completes a quest and is rewarded, opt is the selected item's index or 0 - virtual void QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) { } - // Called when a game event starts or ends virtual void OnGameEvent(bool /*start*/, uint16 /*eventId*/) { } - // Called when the dialog status between a player and the creature is requested. - virtual uint32 GetDialogStatus(Player* /*player*/); - virtual void WaypointPathStarted(uint32 /*nodeId*/, uint32 /*pathId*/) { } virtual void WaypointStarted(uint32 /*nodeId*/, uint32 /*pathId*/) { } virtual void WaypointReached(uint32 /*nodeId*/, uint32 /*pathId*/) { } diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index fcb0d08a040..a918ecb0559 100644 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -22,6 +22,8 @@ #include "UnitAI.h" #include "Common.h" #include "ObjectDefines.h" +#include "Optional.h" +#include "QuestDef.h" class AreaBoundary; class Creature; @@ -175,6 +177,26 @@ class TC_GAME_API CreatureAI : public UnitAI // Called when victim entered water and creature can not enter water //virtual bool CanReachByRangeAttack(Unit*) { return false; } + /// == Gossip system ================================ + + // Called when the dialog status between a player and the creature is requested. + virtual Optional<QuestGiverStatus> GetDialogStatus(Player* /*player*/) { return boost::none; } + + // Called when a player opens a gossip dialog with the creature. + virtual bool GossipHello(Player* /*player*/) { return false; } + + // Called when a player selects a gossip item in the creature's gossip menu. + virtual bool GossipSelect(Player* /*player*/, uint32 /*menuId*/, uint32 /*gossipListId*/) { return false; } + + // Called when a player selects a gossip with a code in the creature's gossip menu. + virtual bool GossipSelectCode(Player* /*player*/, uint32 /*menuId*/, uint32 /*gossipListId*/, char const* /*code*/) { return false; } + + // Called when a player accepts a quest from the creature. + virtual void QuestAccept(Player* /*player*/, Quest const* /*quest*/) { } + + // Called when a player completes a quest and is rewarded, opt is the selected item's index or 0 + virtual void QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) { } + /// == Fields ======================================= virtual void PassengerBoarded(Unit* /*passenger*/, int8 /*seatId*/, bool /*apply*/) { } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index f8cd9e489f6..c757645606d 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -15872,18 +15872,16 @@ QuestGiverStatus Player::GetQuestDialogStatus(Object* questgiver) { case TYPEID_GAMEOBJECT: { - QuestGiverStatus questStatus = QuestGiverStatus(questgiver->ToGameObject()->AI()->GetDialogStatus(this)); - if (questStatus != DIALOG_STATUS_SCRIPTED_NO_STATUS) - return questStatus; + if (auto questStatus = questgiver->ToGameObject()->AI()->GetDialogStatus(this)) + return *questStatus; qr = sObjectMgr->GetGOQuestRelationBounds(questgiver->GetEntry()); qir = sObjectMgr->GetGOQuestInvolvedRelationBounds(questgiver->GetEntry()); break; } case TYPEID_UNIT: { - QuestGiverStatus questStatus = QuestGiverStatus(questgiver->ToCreature()->AI()->GetDialogStatus(this)); - if (questStatus != DIALOG_STATUS_SCRIPTED_NO_STATUS) - return questStatus; + if (auto questStatus = questgiver->ToCreature()->AI()->GetDialogStatus(this)) + return *questStatus; qr = sObjectMgr->GetCreatureQuestRelationBounds(questgiver->GetEntry()); qir = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(questgiver->GetEntry()); break; diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h index 54d647aae10..2fd8ba454a7 100644 --- a/src/server/game/Quests/QuestDef.h +++ b/src/server/game/Quests/QuestDef.h @@ -117,9 +117,6 @@ enum QuestGiverStatus DIALOG_STATUS_AVAILABLE = 8, DIALOG_STATUS_REWARD2 = 9, // no yellow dot on minimap DIALOG_STATUS_REWARD = 10, // yellow dot on minimap - - // Custom value meaning that script call did not return any valid quest status - DIALOG_STATUS_SCRIPTED_NO_STATUS = 0x1000, }; enum QuestFlags |