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:
@@ -1450,6 +1450,46 @@ namespace Game.AI
|
||||
|
||||
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:
|
||||
{
|
||||
if (Global.ConversationDataStorage.GetConversationTemplate(e.Action.conversation.id) == null)
|
||||
@@ -2562,6 +2602,12 @@ namespace Game.AI
|
||||
[FieldOffset(4)]
|
||||
public SpellVisualKit spellVisualKit;
|
||||
|
||||
[FieldOffset(4)]
|
||||
public OverrideLight overrideLight;
|
||||
|
||||
[FieldOffset(4)]
|
||||
public OverrideWeather overrideWeather;
|
||||
|
||||
[FieldOffset(4)]
|
||||
public Conversation conversation;
|
||||
|
||||
@@ -3091,6 +3137,18 @@ namespace Game.AI
|
||||
public uint kitType;
|
||||
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 uint id;
|
||||
|
||||
Reference in New Issue
Block a user