Core/SAI: Add actions ENTER_VEHICLE, BOARD_PASSENGER and EXIT_VEHICLE
Port From (https://github.com/TrinityCore/TrinityCore/commit/9477209f10bd33611251f38633f28dc5f16103f5)
This commit is contained in:
@@ -391,6 +391,10 @@ namespace Framework.Constants
|
|||||||
DoAction = 151,
|
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)
|
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,
|
CreditQuestObjectiveTalkTo = 153,
|
||||||
|
EnterVehicle = 155, // seat id
|
||||||
|
BoardPassenger = 156, // seat id
|
||||||
|
ExitVehicle = 157,
|
||||||
|
|
||||||
End
|
End
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -821,6 +821,9 @@ namespace Game.AI
|
|||||||
SmartActions.DoAction => Marshal.SizeOf(typeof(SmartAction.DoAction)),
|
SmartActions.DoAction => Marshal.SizeOf(typeof(SmartAction.DoAction)),
|
||||||
SmartActions.CompleteQuest => Marshal.SizeOf(typeof(SmartAction.Quest)),
|
SmartActions.CompleteQuest => Marshal.SizeOf(typeof(SmartAction.Quest)),
|
||||||
SmartActions.CreditQuestObjectiveTalkTo => 0,
|
SmartActions.CreditQuestObjectiveTalkTo => 0,
|
||||||
|
SmartActions.EnterVehicle => Marshal.SizeOf(typeof(SmartAction.EnterVehicle)),
|
||||||
|
SmartActions.BoardPassenger => Marshal.SizeOf(typeof(SmartAction.EnterVehicle)),
|
||||||
|
SmartActions.ExitVehicle => 0,
|
||||||
_ => Marshal.SizeOf(typeof(SmartAction.Raw)),
|
_ => Marshal.SizeOf(typeof(SmartAction.Raw)),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2178,6 +2181,7 @@ namespace Game.AI
|
|||||||
case SmartActions.SpawnSpawngroup:
|
case SmartActions.SpawnSpawngroup:
|
||||||
case SmartActions.AddToStoredTargetList:
|
case SmartActions.AddToStoredTargetList:
|
||||||
case SmartActions.DoAction:
|
case SmartActions.DoAction:
|
||||||
|
case SmartActions.ExitVehicle:
|
||||||
break;
|
break;
|
||||||
case SmartActions.BecomePersonalCloneForPlayer:
|
case SmartActions.BecomePersonalCloneForPlayer:
|
||||||
{
|
{
|
||||||
@@ -2220,6 +2224,16 @@ namespace Game.AI
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SmartActions.EnterVehicle:
|
||||||
|
case SmartActions.BoardPassenger:
|
||||||
|
{
|
||||||
|
if (e.Action.enterVehicle.seatId >= SharedConst.MaxVehicleSeats)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"SmartAIMgr: {e} uses incorrect seat id (out of range 0 - {SharedConst.MaxVehicleSeats - 1}), skipped.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
// No longer supported
|
// No longer supported
|
||||||
case SmartActions.CallAreaexploredoreventhappens:
|
case SmartActions.CallAreaexploredoreventhappens:
|
||||||
case SmartActions.CallGroupeventhappens:
|
case SmartActions.CallGroupeventhappens:
|
||||||
@@ -3262,6 +3276,9 @@ namespace Game.AI
|
|||||||
[FieldOffset(4)]
|
[FieldOffset(4)]
|
||||||
public DoAction doAction;
|
public DoAction doAction;
|
||||||
|
|
||||||
|
[FieldOffset(4)]
|
||||||
|
public EnterVehicle enterVehicle;
|
||||||
|
|
||||||
[FieldOffset(4)]
|
[FieldOffset(4)]
|
||||||
public Raw raw;
|
public Raw raw;
|
||||||
|
|
||||||
@@ -3816,6 +3833,10 @@ namespace Game.AI
|
|||||||
{
|
{
|
||||||
public uint actionId;
|
public uint actionId;
|
||||||
}
|
}
|
||||||
|
public struct EnterVehicle
|
||||||
|
{
|
||||||
|
public uint seatId;
|
||||||
|
}
|
||||||
public struct Raw
|
public struct Raw
|
||||||
{
|
{
|
||||||
public uint param1;
|
public uint param1;
|
||||||
|
|||||||
@@ -2664,6 +2664,50 @@ namespace Game.AI
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SmartActions.EnterVehicle:
|
||||||
|
{
|
||||||
|
if (_me == null)
|
||||||
|
break;
|
||||||
|
|
||||||
|
foreach (WorldObject target in targets)
|
||||||
|
{
|
||||||
|
Unit unitTarget = target.ToUnit();
|
||||||
|
if (unitTarget != null)
|
||||||
|
{
|
||||||
|
_me.EnterVehicle(unitTarget, (sbyte)e.Action.enterVehicle.seatId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SmartActions.BoardPassenger:
|
||||||
|
{
|
||||||
|
if (_me == null)
|
||||||
|
break;
|
||||||
|
|
||||||
|
foreach (WorldObject target in targets)
|
||||||
|
{
|
||||||
|
Unit unitTarget = target.ToUnit();
|
||||||
|
if (unitTarget != null)
|
||||||
|
{
|
||||||
|
unitTarget.EnterVehicle(_me, (sbyte)e.Action.enterVehicle.seatId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SmartActions.ExitVehicle:
|
||||||
|
{
|
||||||
|
foreach (WorldObject target in targets)
|
||||||
|
{
|
||||||
|
Unit unitTarget = target.ToUnit();
|
||||||
|
if (unitTarget != null)
|
||||||
|
{
|
||||||
|
unitTarget.ExitVehicle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
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());
|
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;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user