mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-17 05:29:43 -04:00
Core/SmartAI: implement SMART_ACTION_OVERRIDE_LIGHT and SMART_ACTION_OVERRIDE_WEATHER (#24146)
* Core\SmartAI: implement SMART_ACTION_OVERRIDE_LIGHT and SMART_ACTION_OVERRIDE_WEATHER
* Change the invoker of action to any worldobject
* Revert "Change the invoker of action to any worldobject"
This reverts commit 2e15f7258553b7057c3e8f67c54efc77fb6d75b8.
* Add dbc-validations for new actions
* Use GetBaseObject() instead of Creature* for new actions. Add debug-logging
(cherry picked from commit c65ba35269)
This commit is contained in:
@@ -1700,6 +1700,46 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_OVERRIDE_LIGHT:
|
||||
{
|
||||
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(e.action.overrideLight.zoneId);
|
||||
if (!areaEntry)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent zoneId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.overrideLight.zoneId);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (areaEntry->ParentAreaID != 0)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses subzone (ID: %u) instead of zone, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.overrideLight.zoneId);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sLightStore.LookupEntry(e.action.overrideLight.lightId))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent lightId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.overrideLight.lightId);
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_OVERRIDE_WEATHER:
|
||||
{
|
||||
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(e.action.overrideWeather.zoneId);
|
||||
if (!areaEntry)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent zoneId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.overrideWeather.zoneId);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (areaEntry->ParentAreaID != 0)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses subzone (ID: %u) instead of zone, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.overrideWeather.zoneId);
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_CREATE_CONVERSATION:
|
||||
{
|
||||
if (!sConversationDataStore->GetConversationTemplate(e.action.conversation.id))
|
||||
|
||||
Reference in New Issue
Block a user