Core/Scripts: unified scripted gossip/quest api

Port From (https://github.com/TrinityCore/TrinityCore/commit/6604849716bc73d82a4cdbf8c66bb188086ceae4)
This commit is contained in:
hondacrx
2020-05-22 13:28:20 -04:00
parent 87b63b0975
commit c2aee387a8
30 changed files with 1642 additions and 1367 deletions
+34 -7
View File
@@ -18,14 +18,15 @@
using Framework.Dynamic;
using Game.Entities;
using Game.Spells;
using Framework.Constants;
namespace Game.AI
{
public class GameObjectAI
{
public GameObjectAI(GameObject g)
public GameObjectAI(GameObject gameObject)
{
go = g;
me = gameObject;
_scheduler = new TaskScheduler();
_events = new EventMap();
}
@@ -41,27 +42,53 @@ namespace Game.AI
public virtual void SetGUID(ulong guid, int id = 0) { }
public virtual ulong GetGUID(int id = 0) { return 0; }
/// <summary>
/// Called when a player opens a gossip dialog with the gameobject.
/// </summary>
public virtual bool GossipHello(Player player, bool reportUse) { return false; }
public virtual bool GossipSelect(Player player, uint sender, uint action) { return false; }
/// <summary>
/// Called when a player selects a gossip item in the gameobject'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 gameobject's gossip menu.
/// </summary>
public virtual bool GossipSelectCode(Player player, uint sender, uint action, string code) { return false; }
public virtual bool QuestAccept(Player player, Quest quest) { return false; }
public virtual bool QuestReward(Player player, Quest quest, uint opt) { return false; }
/// <summary>
/// Called when a player accepts a quest from the gameobject.
/// </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) { }
/// <summary>
/// Called when the dialog status between a player and the gameobject is requested.
/// </summary>
public virtual uint GetDialogStatus(Player player) { return 100; }
public virtual void Destroyed(Player player, uint eventId) { }
public virtual void Damaged(Player player, uint eventId) { }
public virtual void SetData64(uint id, ulong value) { }
public virtual ulong GetData64(uint id) { return 0; }
public virtual uint GetData(uint id) { return 0; }
public virtual void SetData(uint id, uint value) { }
public virtual void OnGameEvent(bool start, ushort eventId) { }
public virtual void OnStateChanged(uint state, Unit unit) { }
public virtual void OnLootStateChanged(uint state, Unit unit) { }
public virtual void OnStateChanged(GameObjectState state) { }
public virtual void EventInform(uint eventId) { }
public virtual void SpellHit(Unit unit, SpellInfo spellInfo) { }
protected TaskScheduler _scheduler;
protected EventMap _events;
public GameObject go;
public GameObject me;
}
public class NullGameObjectAI : GameObjectAI