Core/SAI: Implemented new action SMART_ACTION_CREDIT_QUEST_OBJECTIVE_TALK_TO
Port From (https://github.com/TrinityCore/TrinityCore/commit/9261140c9ddc5b15bc2e0abe9d8755552ae74d82)
This commit is contained in:
@@ -390,6 +390,7 @@ namespace Framework.Constants
|
||||
TriggerGameEvent = 150, // eventId, useSaiTargetAsGameEventSource
|
||||
DoAction = 151,
|
||||
CompleteQuest = 152, // QuestId. Regular quests with objectives can't be completed with this action (only quests with QUEST_FLAGS_COMPLETION_EVENT, QUEST_FLAGS_COMPLETION_AREA_TRIGGER or QUEST_FLAGS_TRACKING_EVENT)
|
||||
CreditQuestObjectiveTalkTo = 153,
|
||||
End
|
||||
}
|
||||
|
||||
|
||||
@@ -816,6 +816,7 @@ namespace Game.AI
|
||||
SmartActions.TriggerGameEvent => Marshal.SizeOf(typeof(SmartAction.TriggerGameEvent)),
|
||||
SmartActions.DoAction => Marshal.SizeOf(typeof(SmartAction.DoAction)),
|
||||
SmartActions.CompleteQuest => Marshal.SizeOf(typeof(SmartAction.Quest)),
|
||||
SmartActions.CreditQuestObjectiveTalkTo => 0,
|
||||
_ => Marshal.SizeOf(typeof(SmartAction.Raw)),
|
||||
};
|
||||
|
||||
@@ -2189,6 +2190,7 @@ namespace Game.AI
|
||||
break;
|
||||
}
|
||||
case SmartActions.CompleteQuest:
|
||||
{
|
||||
Quest quest = Global.ObjectMgr.GetQuestTemplate(e.Action.quest.questId);
|
||||
if (quest != null)
|
||||
{
|
||||
@@ -2204,6 +2206,16 @@ namespace Game.AI
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SmartActions.CreditQuestObjectiveTalkTo:
|
||||
{
|
||||
if (e.GetScriptType() != SmartScriptType.Creature)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, $"SmartAIMgr: {e} uses non-valid SourceType (only valid for SourceType {SmartScriptType.Creature}), skipped.");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// No longer supported
|
||||
case SmartActions.CallAreaexploredoreventhappens:
|
||||
case SmartActions.CallGroupeventhappens:
|
||||
|
||||
@@ -2559,6 +2559,21 @@ namespace Game.AI
|
||||
|
||||
break;
|
||||
}
|
||||
case SmartActions.CreditQuestObjectiveTalkTo:
|
||||
{
|
||||
if (_me == null)
|
||||
break;
|
||||
|
||||
foreach (WorldObject target in targets)
|
||||
{
|
||||
Player player = target?.ToPlayer();
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
player.TalkedToCreature(_me.GetEntry(), _me.GetGUID());
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Log.outError(LogFilter.Sql, "SmartScript.ProcessAction: Entry {0} SourceType {1}, Event {2}, Unhandled Action type {3}", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType());
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user