Core/SmartAI: implement SMART_ACTION_OVERRIDE_LIGHT and SMART_ACTION_OVERRIDE_WEATHER
Port From (https://github.com/TrinityCore/TrinityCore/commit/1d08423725141de712290b18739dcc9b3ea3a7c6)
This commit is contained in:
@@ -381,7 +381,7 @@ namespace Framework.Constants
|
|||||||
LoadEquipment = 124, // id
|
LoadEquipment = 124, // id
|
||||||
TriggerRandomTimedEvent = 125, // id min range, id max range
|
TriggerRandomTimedEvent = 125, // id min range, id max range
|
||||||
RemoveAllGameobjects = 126,
|
RemoveAllGameobjects = 126,
|
||||||
RemoveMovement = 127, // movementType, forced
|
PauseMovement = 127, // MovementSlot (default = 0, active = 1, controlled = 2), PauseTime (ms), Force
|
||||||
PlayAnimkit = 128,
|
PlayAnimkit = 128,
|
||||||
ScenePlay = 129, // sceneId
|
ScenePlay = 129, // sceneId
|
||||||
SceneCancel = 130, // sceneId
|
SceneCancel = 130, // sceneId
|
||||||
@@ -392,6 +392,8 @@ namespace Framework.Constants
|
|||||||
PlayCinematic = 135, // entry, cinematic
|
PlayCinematic = 135, // entry, cinematic
|
||||||
SetMovementSpeed = 136, // movementType, speedInteger, speedFraction
|
SetMovementSpeed = 136, // movementType, speedInteger, speedFraction
|
||||||
PlaySpellVisualKit = 137, // spellVisualKitId, kitType (unknown values, copypaste from packet dumps), duration
|
PlaySpellVisualKit = 137, // spellVisualKitId, kitType (unknown values, copypaste from packet dumps), duration
|
||||||
|
OverrideLight = 138, // zoneId, lightId, fadeInTime
|
||||||
|
OverrideWeather = 139, // zoneId, weatherId, weatherGrade
|
||||||
CreateConversation = 143, // conversation_template.id
|
CreateConversation = 143, // conversation_template.id
|
||||||
End = 144
|
End = 144
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1450,6 +1450,46 @@ namespace Game.AI
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SmartActions.OverrideLight:
|
||||||
|
{
|
||||||
|
var areaEntry = CliDB.AreaTableStorage.LookupByKey(e.Action.overrideLight.zoneId);
|
||||||
|
if (areaEntry == null)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"SmartAIMgr: {e} uses non-existent zoneId {e.Action.overrideLight.zoneId}, skipped.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (areaEntry.ParentAreaID != 0)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"SmartAIMgr: {e} uses subzone (ID: {e.Action.overrideLight.zoneId}) instead of zone, skipped.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CliDB.LightStorage.ContainsKey(e.Action.overrideLight.lightId))
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"SmartAIMgr: {e} uses non-existent lightId {e.Action.overrideLight.lightId}, skipped.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SmartActions.OverrideWeather:
|
||||||
|
{
|
||||||
|
var areaEntry = CliDB.AreaTableStorage.LookupByKey(e.Action.overrideWeather.zoneId);
|
||||||
|
if (areaEntry == null)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"SmartAIMgr: {e} uses non-existent zoneId {e.Action.overrideWeather.zoneId}, skipped.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (areaEntry.ParentAreaID != 0)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"SmartAIMgr: {e} uses subzone (ID: {e.Action.overrideWeather.zoneId}) instead of zone, skipped.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SmartActions.CreateConversation:
|
case SmartActions.CreateConversation:
|
||||||
{
|
{
|
||||||
if (Global.ConversationDataStorage.GetConversationTemplate(e.Action.conversation.id) == null)
|
if (Global.ConversationDataStorage.GetConversationTemplate(e.Action.conversation.id) == null)
|
||||||
@@ -2562,6 +2602,12 @@ namespace Game.AI
|
|||||||
[FieldOffset(4)]
|
[FieldOffset(4)]
|
||||||
public SpellVisualKit spellVisualKit;
|
public SpellVisualKit spellVisualKit;
|
||||||
|
|
||||||
|
[FieldOffset(4)]
|
||||||
|
public OverrideLight overrideLight;
|
||||||
|
|
||||||
|
[FieldOffset(4)]
|
||||||
|
public OverrideWeather overrideWeather;
|
||||||
|
|
||||||
[FieldOffset(4)]
|
[FieldOffset(4)]
|
||||||
public Conversation conversation;
|
public Conversation conversation;
|
||||||
|
|
||||||
@@ -3091,6 +3137,18 @@ namespace Game.AI
|
|||||||
public uint kitType;
|
public uint kitType;
|
||||||
public uint duration;
|
public uint duration;
|
||||||
}
|
}
|
||||||
|
public struct OverrideLight
|
||||||
|
{
|
||||||
|
public uint zoneId;
|
||||||
|
public uint lightId;
|
||||||
|
public uint fadeInTime;
|
||||||
|
}
|
||||||
|
public struct OverrideWeather
|
||||||
|
{
|
||||||
|
public uint zoneId;
|
||||||
|
public uint weatherId;
|
||||||
|
public uint weatherGrade;
|
||||||
|
}
|
||||||
public struct Conversation
|
public struct Conversation
|
||||||
{
|
{
|
||||||
public uint id;
|
public uint id;
|
||||||
|
|||||||
@@ -2414,6 +2414,28 @@ namespace Game.AI
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SmartActions.OverrideLight:
|
||||||
|
{
|
||||||
|
WorldObject obj = GetBaseObject();
|
||||||
|
if (obj != null)
|
||||||
|
{
|
||||||
|
obj.GetMap().SetZoneOverrideLight(e.Action.overrideLight.zoneId, e.Action.overrideLight.lightId, e.Action.overrideLight.fadeInTime);
|
||||||
|
Log.outDebug(LogFilter.ScriptsAi, $"SmartScript::ProcessAction: SMART_ACTION_OVERRIDE_LIGHT: {obj.GetGUID()} sets zone override light (zoneId: {e.Action.overrideLight.zoneId}, " +
|
||||||
|
$"lightId: {e.Action.overrideLight.lightId}, fadeInTime: {e.Action.overrideLight.fadeInTime})");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SmartActions.OverrideWeather:
|
||||||
|
{
|
||||||
|
WorldObject obj = GetBaseObject();
|
||||||
|
if (obj != null)
|
||||||
|
{
|
||||||
|
obj.GetMap().SetZoneWeather(e.Action.overrideWeather.zoneId, (WeatherState)e.Action.overrideWeather.weatherId, e.Action.overrideWeather.weatherGrade);
|
||||||
|
Log.outDebug(LogFilter.ScriptsAi, $"SmartScript::ProcessAction: SMART_ACTION_OVERRIDE_WEATHER: {obj.GetGUID()} sets zone weather (zoneId: {e.Action.overrideWeather.zoneId}, " +
|
||||||
|
$"weatherId: {e.Action.overrideWeather.weatherId}, weatherGrade: {e.Action.overrideWeather.weatherGrade})");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SmartActions.PlaySpellVisualKit:
|
case SmartActions.PlaySpellVisualKit:
|
||||||
{
|
{
|
||||||
foreach (var target in targets)
|
foreach (var target in targets)
|
||||||
|
|||||||
Reference in New Issue
Block a user