mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/SmartAI: Improve SMART_EVENT_GOSSIP_HELLO
Add another value to event_param1 for SMART_EVENT_GOSSIP_HELLO to support all cases of OnGossipHello/OnReportUse in GameObjects:
- event_param1 set to 0: execute the action for both OnGossipHello and OnReportUse. This might result in the action being executed twice when clicking the GameObject
- event_param1 set to 1: execute the action for only OnGossipHello
- event_param1 set to 2: execute the action for only OnReportUse
(cherry picked from commit 9e58ef6940)
This commit is contained in:
@@ -3245,8 +3245,24 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
|
||||
ProcessAction(e, unit, var0, var1, bvar, spell, gob);
|
||||
break;
|
||||
case SMART_EVENT_GOSSIP_HELLO:
|
||||
if (e.event.gossipHello.noReportUse && var0)
|
||||
return;
|
||||
switch (e.event.gossipHello.filter)
|
||||
{
|
||||
case 0:
|
||||
// no filter set, always execute action
|
||||
break;
|
||||
case 1:
|
||||
// OnGossipHello only filter set, skip action if OnReportUse
|
||||
if (var0)
|
||||
return;
|
||||
case 2:
|
||||
// OnReportUse only filter set, skip action if OnGossipHello
|
||||
if (!var0)
|
||||
return;
|
||||
default:
|
||||
// Ignore any other value
|
||||
break;
|
||||
}
|
||||
|
||||
ProcessAction(e, unit, var0, var1, bvar, spell, gob);
|
||||
break;
|
||||
case SMART_EVENT_IS_BEHIND_TARGET:
|
||||
|
||||
@@ -366,7 +366,7 @@ struct SmartEvent
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 noReportUse;
|
||||
uint32 filter;
|
||||
} gossipHello;
|
||||
|
||||
struct
|
||||
|
||||
Reference in New Issue
Block a user