mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/AI: Kick Gossip functions upstairs, from UnitAI to CreatureAI - they only make sense for Creatures anyway.
Also change a very ugly hack in GetDialogStatus. Ew.
This commit is contained in:
@@ -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; }
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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*/) { }
|
||||
|
||||
@@ -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*/) { }
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user