Core/AI: segregate GameObject ReportUse from normal Use (lock open/normal click)

Port From (https://github.com/TrinityCore/TrinityCore/commit/5903a10a834b1198702b024182581799648540ff)
This commit is contained in:
hondacrx
2020-07-22 14:21:29 -04:00
parent 0ece69bf90
commit 61b6606dce
13 changed files with 58 additions and 50 deletions
+6 -1
View File
@@ -45,7 +45,7 @@ namespace Game.AI
/// <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 GossipHello(Player player) { return false; }
/// <summary>
/// Called when a player selects a gossip item in the gameobject's gossip menu.
@@ -71,6 +71,11 @@ namespace Game.AI
/// Called when the dialog status between a player and the gameobject is requested.
/// </summary>
public virtual uint GetDialogStatus(Player player) { return 100; }
// Called when a Player clicks a GameObject, before GossipHello
// prevents achievement tracking if returning true
public virtual bool OnReportUse(Player player) { return false; }
public virtual void Destroyed(Player player, uint eventId) { }
public virtual void Damaged(Player player, uint eventId) { }
+9 -2
View File
@@ -1069,10 +1069,17 @@ namespace Game.AI
GetScript().OnReset();
}
public override bool GossipHello(Player player, bool reportUse)
public override bool GossipHello(Player player)
{
_gossipReturn = false;
GetScript().ProcessEventsFor(SmartEvents.GossipHello, player, reportUse ? 1 : 0u, 0, false, null, me);
GetScript().ProcessEventsFor(SmartEvents.GossipHello, player, 0, 0, false, null, me);
return _gossipReturn;
}
public override bool OnReportUse(Player player)
{
_gossipReturn = false;
GetScript().ProcessEventsFor(SmartEvents.GossipHello, player, 1, 0, false, null, me);
return _gossipReturn;
}
+1 -2
View File
@@ -2228,9 +2228,8 @@ namespace Game.AI
// We may want to execute action rarely and because of this if condition is not fulfilled the action will be rechecked in a long time
if (Global.ConditionMgr.IsObjectMeetingSmartEventConditions(e.entryOrGuid, e.event_id, e.source_type, unit, GetBaseObject()))
{
ProcessAction(e, unit, var0, var1, bvar, spell, gob, varString);
RecalcTimer(e, min, max);
ProcessAction(e, unit, var0, var1, bvar, spell, gob, varString);
}
else
RecalcTimer(e, Math.Min(min, 5000), Math.Min(min, 5000));
@@ -1306,7 +1306,7 @@ namespace Game.Entities
if (playerUser != null)
{
playerUser.PlayerTalkClass.ClearMenus();
if (GetAI().GossipHello(playerUser, false))
if (GetAI().GossipHello(playerUser))
return;
}
+1 -1
View File
@@ -259,7 +259,7 @@ namespace Game
GameObject go = GetPlayer().GetGameObjectIfCanInteractWith(packet.Guid);
if (go)
{
if (go.GetAI().GossipHello(GetPlayer(), true))
if (go.GetAI().GossipHello(GetPlayer()))
return;
GetPlayer().UpdateCriteria(CriteriaTypes.UseGameobject, go.GetEntry());
+1 -1
View File
@@ -1322,7 +1322,7 @@ namespace Game.Spells
}
player.PlayerTalkClass.ClearMenus();
if (gameObjTarget.GetAI().GossipHello(player, false))
if (gameObjTarget.GetAI().GossipHello(player))
return;
switch (gameObjTarget.GetGoType())