mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 10:00:28 +00:00
feat(Core/SmartAI): Add more smart events (#16642)
* init * :) * Update rev_1687966694240866600.sql * >:) change name from unit -> target fix typo Co-Authored-By: Angelo Venturini <nefertum.dev@protonmail.com> * Update data/sql/updates/pending_db_world/rev_1687966694240866600.sql Co-authored-by: Francesco Borzì <borzifrancesco@gmail.com> * more_events * Update SmartScriptMgr.cpp --------- Co-authored-by: Angelo Venturini <nefertum.dev@protonmail.com> Co-authored-by: Francesco Borzì <borzifrancesco@gmail.com>
This commit is contained in:
@@ -280,6 +280,10 @@ void SmartAIMgr::LoadSmartAIFromDB()
|
||||
if (temp.event.minMaxRepeat.min == 0 && temp.event.minMaxRepeat.max == 0)
|
||||
temp.event.event_flags |= SMART_EVENT_FLAG_NOT_REPEATABLE;
|
||||
break;
|
||||
case SMART_EVENT_AREA_CASTING:
|
||||
if (temp.event.areaCasting.repeatMin == 0 && temp.event.areaCasting.repeatMax == 0)
|
||||
temp.event.event_flags |= SMART_EVENT_FLAG_NOT_REPEATABLE;
|
||||
break;
|
||||
case SMART_EVENT_FRIENDLY_IS_CC:
|
||||
if (temp.event.friendlyCC.repeatMin == 0 && temp.event.friendlyCC.repeatMax == 0)
|
||||
temp.event.event_flags |= SMART_EVENT_FLAG_NOT_REPEATABLE;
|
||||
@@ -346,10 +350,12 @@ void SmartAIMgr::LoadSmartAIFromDB()
|
||||
case SMART_EVENT_TARGET_MANA_PCT:
|
||||
case SMART_EVENT_RANGE:
|
||||
case SMART_EVENT_VICTIM_CASTING:
|
||||
case SMART_EVENT_AREA_CASTING:
|
||||
case SMART_EVENT_TARGET_BUFFED:
|
||||
case SMART_EVENT_IS_BEHIND_TARGET:
|
||||
case SMART_EVENT_INSTANCE_PLAYER_ENTER:
|
||||
case SMART_EVENT_TRANSPORT_ADDCREATURE:
|
||||
case SMART_EVENT_NEAR_PLAYERS:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -572,6 +578,8 @@ bool SmartAIMgr::CheckUnusedEventParams(SmartScriptHolder const& e)
|
||||
case SMART_EVENT_SUMMONED_UNIT_DIES: return sizeof(SmartEvent::summoned);
|
||||
case SMART_EVENT_NEAR_PLAYERS: return sizeof(SmartEvent::nearPlayer);
|
||||
case SMART_EVENT_NEAR_PLAYERS_NEGATION: return sizeof(SmartEvent::nearPlayerNegation);
|
||||
case SMART_EVENT_NEAR_UNIT: return sizeof(SmartEvent::nearUnit);
|
||||
case SMART_EVENT_AREA_CASTING: return sizeof(SmartEvent::areaCasting);
|
||||
default:
|
||||
LOG_WARN("sql.sql", "SmartAIMgr: entryorguid {} source_type {} id {} action_type {} is using an event {} with no unused params specified in SmartAIMgr::CheckUnusedEventParams(), please report this.",
|
||||
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetEventType());
|
||||
@@ -1043,6 +1051,16 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
if (!IsMinMaxValid(e, e.event.targetCasting.repeatMin, e.event.targetCasting.repeatMax))
|
||||
return false;
|
||||
break;
|
||||
case SMART_EVENT_AREA_CASTING:
|
||||
if (e.event.areaCasting.spellId > 0 && !sSpellMgr->GetSpellInfo(e.event.areaCasting.spellId))
|
||||
{
|
||||
LOG_ERROR("scripts.ai.sai", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Spell entry {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsMinMaxValid(e, e.event.areaCasting.repeatMin, e.event.areaCasting.repeatMax))
|
||||
return false;
|
||||
break;
|
||||
case SMART_EVENT_PASSENGER_BOARDED:
|
||||
case SMART_EVENT_PASSENGER_REMOVED:
|
||||
if (!IsMinMaxValid(e, e.event.minMax.repeatMin, e.event.minMax.repeatMax))
|
||||
@@ -1272,6 +1290,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
case SMART_EVENT_GO_EVENT_INFORM:
|
||||
case SMART_EVENT_NEAR_PLAYERS:
|
||||
case SMART_EVENT_NEAR_PLAYERS_NEGATION:
|
||||
case SMART_EVENT_NEAR_UNIT:
|
||||
case SMART_EVENT_TIMED_EVENT_TRIGGERED:
|
||||
case SMART_EVENT_INSTANCE_PLAYER_ENTER:
|
||||
case SMART_EVENT_TRANSPORT_RELOCATE:
|
||||
|
||||
Reference in New Issue
Block a user