Core/AI: Kick Gossip functions upstairs, from UnitAI to CreatureAI - they only make sense for Creatures anyway.
Port From (https://github.com/TrinityCore/TrinityCore/commit/0aed5a35efd0305c1c3046430a1b348f2049a1c5)
This commit is contained in:
@@ -387,8 +387,6 @@ namespace Framework.Constants
|
|||||||
CovenantCallingQuest = 0x80000,
|
CovenantCallingQuest = 0x80000,
|
||||||
CovenantCallingRewardCompleteNoPOI = 0x100000,
|
CovenantCallingRewardCompleteNoPOI = 0x100000,
|
||||||
CovenantCallingRewardCompletePOI = 0x200000,
|
CovenantCallingRewardCompletePOI = 0x200000,
|
||||||
|
|
||||||
ScriptedDefault = 0x80000000
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ namespace Game.AI
|
|||||||
{
|
{
|
||||||
bool _moveInLineOfSightLocked;
|
bool _moveInLineOfSightLocked;
|
||||||
List<AreaBoundary> _boundary = new();
|
List<AreaBoundary> _boundary = new();
|
||||||
bool _negateBoundary;
|
bool _negateBoundary;
|
||||||
|
|
||||||
protected new Creature me;
|
protected new Creature me;
|
||||||
|
|
||||||
protected EventMap _events = new();
|
protected EventMap _events = new();
|
||||||
@@ -470,6 +470,36 @@ namespace Game.AI
|
|||||||
// called when the corpse of this creature gets removed
|
// called when the corpse of this creature gets removed
|
||||||
public virtual void CorpseRemoved(long respawnDelay) { }
|
public virtual void CorpseRemoved(long respawnDelay) { }
|
||||||
|
|
||||||
|
/// == Gossip system ================================
|
||||||
|
|
||||||
|
// Called when the dialog status between a player and the creature is requested.
|
||||||
|
public virtual QuestGiverStatus? GetDialogStatus(Player player)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when a player opens a gossip dialog with the creature.
|
||||||
|
public virtual bool GossipHello(Player player) { return false; }
|
||||||
|
|
||||||
|
// Called when a player selects a gossip item in the creature's gossip menu.
|
||||||
|
public virtual bool GossipSelect(Player player, uint menuId, uint gossipListId) { return false; }
|
||||||
|
|
||||||
|
// Called when a player selects a gossip with a code in the creature's gossip menu.
|
||||||
|
public virtual bool GossipSelectCode(Player player, uint menuId, uint gossipListId, string code)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when a player accepts a quest from the creature.
|
||||||
|
public virtual void QuestAccept(Player player, Quest quest) { }
|
||||||
|
|
||||||
|
// Called when a player completes a quest and is rewarded, opt is the selected item's index or 0
|
||||||
|
public virtual void QuestReward(Player player, Quest quest, uint opt)
|
||||||
|
{
|
||||||
|
QuestReward(player, quest, LootItemType.Item, opt);
|
||||||
|
}
|
||||||
|
public virtual void QuestReward(Player player, Quest quest, LootItemType type, uint opt) { }
|
||||||
|
|
||||||
public virtual void PassengerBoarded(Unit passenger, sbyte seatId, bool apply) { }
|
public virtual void PassengerBoarded(Unit passenger, sbyte seatId, bool apply) { }
|
||||||
|
|
||||||
public virtual void OnSpellClick(Unit clicker, ref bool result) { }
|
public virtual void OnSpellClick(Unit clicker, ref bool result) { }
|
||||||
|
|||||||
@@ -47,6 +47,11 @@ namespace Game.AI
|
|||||||
public virtual void SetGUID(ObjectGuid guid, int id = 0) { }
|
public virtual void SetGUID(ObjectGuid guid, int id = 0) { }
|
||||||
public virtual ObjectGuid GetGUID(int id = 0) { return ObjectGuid.Empty; }
|
public virtual ObjectGuid GetGUID(int id = 0) { return ObjectGuid.Empty; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when the dialog status between a player and the gameobject is requested.
|
||||||
|
/// </summary>
|
||||||
|
public virtual QuestGiverStatus? GetDialogStatus(Player player) { return null; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when a player opens a gossip dialog with the gameobject.
|
/// Called when a player opens a gossip dialog with the gameobject.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -76,11 +81,6 @@ namespace Game.AI
|
|||||||
}
|
}
|
||||||
public virtual void QuestReward(Player player, Quest quest, LootItemType type, uint opt) { }
|
public virtual void QuestReward(Player player, Quest quest, LootItemType type, uint opt) { }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when the dialog status between a player and the gameobject is requested.
|
|
||||||
/// </summary>
|
|
||||||
public virtual QuestGiverStatus GetDialogStatus(Player player) { return QuestGiverStatus.ScriptedDefault; }
|
|
||||||
|
|
||||||
// Called when a Player clicks a GameObject, before GossipHello
|
// Called when a Player clicks a GameObject, before GossipHello
|
||||||
// prevents achievement tracking if returning true
|
// prevents achievement tracking if returning true
|
||||||
public virtual bool OnReportUse(Player player) { return false; }
|
public virtual bool OnReportUse(Player player) { return false; }
|
||||||
|
|||||||
@@ -491,43 +491,11 @@ namespace Game.AI
|
|||||||
public virtual void HealDone(Unit to, uint addhealth) { }
|
public virtual void HealDone(Unit to, uint addhealth) { }
|
||||||
public virtual void SpellInterrupted(uint spellId, uint unTimeMs) { }
|
public virtual void SpellInterrupted(uint spellId, uint unTimeMs) { }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when a player opens a gossip dialog with the creature.
|
|
||||||
/// </summary>
|
|
||||||
public virtual bool GossipHello(Player player) { return false; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when a player selects a gossip item in the creature's gossip menu.
|
|
||||||
/// </summary>
|
|
||||||
public virtual bool GossipSelect(Player player, uint menuId, uint gossipListId) { return false; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when a player selects a gossip with a code in the creature's gossip menu.
|
|
||||||
/// </summary>
|
|
||||||
public virtual bool GossipSelectCode(Player player, uint menuId, uint gossipListId, string code) { return false; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when a player accepts a quest from the creature.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void QuestAccept(Player player, Quest quest) { }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when a player completes a quest and is rewarded, opt is the selected item's index or 0
|
|
||||||
/// </summary>
|
|
||||||
public virtual void QuestReward(Player player, Quest quest, uint opt)
|
|
||||||
{
|
|
||||||
QuestReward(player, quest, LootItemType.Item, opt);
|
|
||||||
}
|
|
||||||
public virtual void QuestReward(Player player, Quest quest, LootItemType type, uint opt) { }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when a game event starts or ends
|
/// Called when a game event starts or ends
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void OnGameEvent(bool start, ushort eventId) { }
|
public virtual void OnGameEvent(bool start, ushort eventId) { }
|
||||||
|
|
||||||
// Called when the dialog status between a player and the creature is requested.
|
|
||||||
public virtual QuestGiverStatus GetDialogStatus(Player player) { return QuestGiverStatus.ScriptedDefault; }
|
|
||||||
|
|
||||||
public virtual void WaypointPathStarted(uint nodeId, uint pathId) { }
|
public virtual void WaypointPathStarted(uint nodeId, uint pathId) { }
|
||||||
|
|
||||||
public virtual void WaypointStarted(uint nodeId, uint pathId) { }
|
public virtual void WaypointStarted(uint nodeId, uint pathId) { }
|
||||||
|
|||||||
@@ -1854,18 +1854,20 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
case TypeId.GameObject:
|
case TypeId.GameObject:
|
||||||
{
|
{
|
||||||
QuestGiverStatus questStatus = questgiver.ToGameObject().GetAI().GetDialogStatus(this);
|
QuestGiverStatus? questStatus = questgiver.ToGameObject().GetAI().GetDialogStatus(this);
|
||||||
if (questStatus != QuestGiverStatus.ScriptedDefault)
|
if (questStatus.HasValue)
|
||||||
return questStatus;
|
return questStatus.Value;
|
||||||
|
|
||||||
qr = Global.ObjectMgr.GetGOQuestRelationBounds(questgiver.GetEntry());
|
qr = Global.ObjectMgr.GetGOQuestRelationBounds(questgiver.GetEntry());
|
||||||
qir = Global.ObjectMgr.GetGOQuestInvolvedRelationBounds(questgiver.GetEntry());
|
qir = Global.ObjectMgr.GetGOQuestInvolvedRelationBounds(questgiver.GetEntry());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TypeId.Unit:
|
case TypeId.Unit:
|
||||||
{
|
{
|
||||||
QuestGiverStatus questStatus = questgiver.ToCreature().GetAI().GetDialogStatus(this);
|
QuestGiverStatus? questStatus = questgiver.ToCreature().GetAI().GetDialogStatus(this);
|
||||||
if (questStatus != QuestGiverStatus.ScriptedDefault)
|
if (questStatus.HasValue)
|
||||||
return questStatus;
|
return questStatus.Value;
|
||||||
|
|
||||||
qr = Global.ObjectMgr.GetCreatureQuestRelationBounds(questgiver.GetEntry());
|
qr = Global.ObjectMgr.GetCreatureQuestRelationBounds(questgiver.GetEntry());
|
||||||
qir = Global.ObjectMgr.GetCreatureQuestInvolvedRelationBounds(questgiver.GetEntry());
|
qir = Global.ObjectMgr.GetCreatureQuestInvolvedRelationBounds(questgiver.GetEntry());
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -360,7 +360,6 @@ namespace Game
|
|||||||
case TypeId.Player:
|
case TypeId.Player:
|
||||||
{
|
{
|
||||||
//For AutoSubmition was added plr case there as it almost same exclute AI script cases.
|
//For AutoSubmition was added plr case there as it almost same exclute AI script cases.
|
||||||
Unit unitQGiver = obj.ToUnit();
|
|
||||||
// Send next quest
|
// Send next quest
|
||||||
Quest nextQuest = _player.GetNextQuest(packet.QuestGiverGUID, quest);
|
Quest nextQuest = _player.GetNextQuest(packet.QuestGiverGUID, quest);
|
||||||
if (nextQuest != null)
|
if (nextQuest != null)
|
||||||
@@ -376,9 +375,9 @@ namespace Game
|
|||||||
}
|
}
|
||||||
|
|
||||||
_player.PlayerTalkClass.ClearMenus();
|
_player.PlayerTalkClass.ClearMenus();
|
||||||
var qGiverAI = unitQGiver.GetAI();
|
Creature creatureQGiver = obj.ToCreature();
|
||||||
if (qGiverAI != null)
|
if (creatureQGiver != null)
|
||||||
qGiverAI.QuestReward(_player, quest, packet.Choice.LootItemType, packet.Choice.Item.ItemID);
|
creatureQGiver.GetAI().QuestReward(_player, quest, packet.Choice.LootItemType, packet.Choice.Item.ItemID);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TypeId.GameObject:
|
case TypeId.GameObject:
|
||||||
|
|||||||
Reference in New Issue
Block a user