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:
@@ -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) { }
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user