mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 10:00:28 +00:00
feat(Core/SmartAI): Implement a few more stuff (#17090)
* init * init2 * attempt to fix WP delays * init3 * init4 * buildfix * Create rev_1693093120417899200.sql * workflow * Underbat * castflag power mana * did not work * Update SmartScriptMgr.cpp * ugly * port range to new system * attempt * simplify cast simplify cast add iteration for aura_not_present recalc timer if already castig spell * Update SmartScript.cpp * attempt * attempts * HP PCT * missing aura to targetselector * Update rev_1693093120417899200.sql * Update SmartScriptMgr.h * Update SmartScriptMgr.h * Update SmartScript.cpp * remove not_attacking, fix behind_me * revert is_behind_me * Update SmartScriptMgr.h * Update underbog.cpp * Update underbog.cpp
This commit is contained in:
@@ -264,29 +264,14 @@ void SmartAIMgr::LoadSmartAIFromDB()
|
||||
case SMART_EVENT_FRIENDLY_MISSING_BUFF:
|
||||
case SMART_EVENT_HAS_AURA:
|
||||
case SMART_EVENT_TARGET_BUFFED:
|
||||
case SMART_EVENT_RANGE:
|
||||
case SMART_EVENT_AREA_RANGE:
|
||||
case SMART_EVENT_AREA_CASTING:
|
||||
case SMART_EVENT_IS_BEHIND_TARGET:
|
||||
if (temp.event.minMaxRepeat.repeatMin == 0 && temp.event.minMaxRepeat.repeatMax == 0)
|
||||
temp.event.event_flags |= SMART_EVENT_FLAG_NOT_REPEATABLE;
|
||||
break;
|
||||
case SMART_EVENT_RANGE:
|
||||
if (temp.event.rangeRepeat.repeatMin == 0 && temp.event.rangeRepeat.repeatMax == 0)
|
||||
temp.event.event_flags |= SMART_EVENT_FLAG_NOT_REPEATABLE;
|
||||
// Will only work properly if value is 0 or 1
|
||||
if (temp.event.rangeRepeat.onlyFireOnRepeat > 1)
|
||||
temp.event.rangeRepeat.onlyFireOnRepeat = 1;
|
||||
break;
|
||||
case SMART_EVENT_AREA_RANGE:
|
||||
if (temp.event.areaRange.repeatMin == 0 && temp.event.areaRange.repeatMax == 0)
|
||||
temp.event.event_flags |= SMART_EVENT_FLAG_NOT_REPEATABLE;
|
||||
break;
|
||||
case SMART_EVENT_VICTIM_CASTING:
|
||||
case SMART_EVENT_IS_BEHIND_TARGET:
|
||||
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;
|
||||
@@ -506,7 +491,7 @@ bool SmartAIMgr::CheckUnusedEventParams(SmartScriptHolder const& e)
|
||||
case SMART_EVENT_DEATH: return NO_PARAMS;
|
||||
case SMART_EVENT_EVADE: return NO_PARAMS;
|
||||
case SMART_EVENT_SPELLHIT: return sizeof(SmartEvent::spellHit);
|
||||
case SMART_EVENT_RANGE: return sizeof(SmartEvent::rangeRepeat);
|
||||
case SMART_EVENT_RANGE: return sizeof(SmartEvent::minMaxRepeat);
|
||||
case SMART_EVENT_OOC_LOS: return sizeof(SmartEvent::los);
|
||||
case SMART_EVENT_RESPAWN: return sizeof(SmartEvent::respawn);
|
||||
case SMART_EVENT_TARGET_HEALTH_PCT: return sizeof(SmartEvent::minMaxRepeat);
|
||||
@@ -564,7 +549,7 @@ bool SmartAIMgr::CheckUnusedEventParams(SmartScriptHolder const& e)
|
||||
case SMART_EVENT_GOSSIP_HELLO: return sizeof(SmartEvent::gossipHello);
|
||||
case SMART_EVENT_FOLLOW_COMPLETED: return NO_PARAMS;
|
||||
case SMART_EVENT_EVENT_PHASE_CHANGE: return sizeof(SmartEvent::eventPhaseChange);
|
||||
case SMART_EVENT_IS_BEHIND_TARGET: return sizeof(SmartEvent::behindTarget);
|
||||
case SMART_EVENT_IS_BEHIND_TARGET: return sizeof(SmartEvent::minMaxRepeat);
|
||||
case SMART_EVENT_GAME_EVENT_START: return sizeof(SmartEvent::gameEvent);
|
||||
case SMART_EVENT_GAME_EVENT_END: return sizeof(SmartEvent::gameEvent);
|
||||
case SMART_EVENT_GO_STATE_CHANGED: return sizeof(SmartEvent::goStateChanged);
|
||||
@@ -584,8 +569,8 @@ bool SmartAIMgr::CheckUnusedEventParams(SmartScriptHolder const& e)
|
||||
case SMART_EVENT_NEAR_PLAYERS_NEGATION: return sizeof(SmartEvent::nearPlayerNegation);
|
||||
case SMART_EVENT_NEAR_UNIT: return sizeof(SmartEvent::nearUnit);
|
||||
case SMART_EVENT_NEAR_UNIT_NEGATION: return sizeof(SmartEvent::nearUnitNegation);
|
||||
case SMART_EVENT_AREA_CASTING: return sizeof(SmartEvent::areaCasting);
|
||||
case SMART_EVENT_AREA_RANGE: return sizeof(SmartEvent::areaRange);
|
||||
case SMART_EVENT_AREA_CASTING: return sizeof(SmartEvent::minMaxRepeat);
|
||||
case SMART_EVENT_AREA_RANGE: return sizeof(SmartEvent::minMaxRepeat);
|
||||
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());
|
||||
@@ -781,6 +766,7 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e)
|
||||
case SMART_ACTION_SUMMON_RADIAL: return sizeof(SmartAction::radialSummon);
|
||||
case SMART_ACTION_PLAY_SPELL_VISUAL: return sizeof(SmartAction::spellVisual);
|
||||
case SMART_ACTION_FOLLOW_GROUP: return sizeof(SmartAction::followGroup);
|
||||
case SMART_ACTION_SET_ORIENTATION_TARGET: return sizeof(SmartAction::orientationTarget);
|
||||
default:
|
||||
LOG_WARN("sql.sql", "SmartAIMgr: entryorguid {} source_type {} id {} action_type {} is using an action with no unused params specified in SmartAIMgr::CheckUnusedActionParams(), please report this.",
|
||||
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
@@ -963,21 +949,17 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
if (!IsMinMaxValid(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax))
|
||||
return false;
|
||||
break;
|
||||
case SMART_EVENT_RANGE:
|
||||
if (!IsMinMaxValid(e, e.event.rangeRepeat.minRange, e.event.rangeRepeat.maxRange))
|
||||
return false;
|
||||
|
||||
if (!IsMinMaxValid(e, e.event.rangeRepeat.repeatMin, e.event.rangeRepeat.repeatMax))
|
||||
return false;
|
||||
break;
|
||||
case SMART_EVENT_AREA_RANGE:
|
||||
if (!IsMinMaxValid(e, e.event.areaRange.min, e.event.areaRange.max))
|
||||
case SMART_EVENT_AREA_CASTING:
|
||||
case SMART_EVENT_IS_BEHIND_TARGET:
|
||||
case SMART_EVENT_RANGE:
|
||||
if (!IsMinMaxValid(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max))
|
||||
return false;
|
||||
|
||||
if (!IsMinMaxValid(e, e.event.areaRange.repeatMin, e.event.areaRange.repeatMax))
|
||||
if (!IsMinMaxValid(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax))
|
||||
return false;
|
||||
|
||||
if (!IsMinMaxValid(e, e.event.areaRange.rangeMin, e.event.areaRange.rangeMax))
|
||||
if (!IsMinMaxValid(e, e.event.minMaxRepeat.rangeMin, e.event.minMaxRepeat.rangeMax))
|
||||
return false;
|
||||
|
||||
break;
|
||||
@@ -1070,16 +1052,6 @@ 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 (!IsMinMaxValid(e, e.event.areaCasting.min, e.event.areaCasting.max))
|
||||
return false;
|
||||
|
||||
if (!IsMinMaxValid(e, e.event.areaCasting.repeatMin, e.event.areaCasting.repeatMax))
|
||||
return false;
|
||||
|
||||
if (!IsMinMaxValid(e, e.event.areaCasting.rangeMin, e.event.areaCasting.rangeMax))
|
||||
return false;
|
||||
break;
|
||||
case SMART_EVENT_PASSENGER_BOARDED:
|
||||
case SMART_EVENT_PASSENGER_REMOVED:
|
||||
if (!IsMinMaxValid(e, e.event.minMax.repeatMin, e.event.minMax.repeatMax))
|
||||
@@ -1185,10 +1157,6 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_IS_BEHIND_TARGET:
|
||||
if (!IsMinMaxValid(e, e.event.behindTarget.cooldownMin, e.event.behindTarget.cooldownMax))
|
||||
return false;
|
||||
break;
|
||||
case SMART_EVENT_GAME_EVENT_START:
|
||||
case SMART_EVENT_GAME_EVENT_END:
|
||||
{
|
||||
@@ -1207,10 +1175,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_FRIENDLY_HEALTH_PCT:
|
||||
if (!IsMinMaxValid(e, e.event.friendlyHealthPct.min, e.event.friendlyHealthPct.max))
|
||||
return false;
|
||||
|
||||
if (!IsMinMaxValid(e, e.event.friendlyHealthPct.repeatMin, e.event.friendlyHealthPct.repeatMax))
|
||||
return false;
|
||||
|
||||
if (e.event.friendlyHealthPct.maxHpPct > 100 || e.event.friendlyHealthPct.minHpPct > 100)
|
||||
if (e.event.friendlyHealthPct.hpPct > 100)
|
||||
{
|
||||
LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} has pct value above 100, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
return false;
|
||||
@@ -1971,6 +1942,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
case SMART_ACTION_SUMMON_RADIAL:
|
||||
case SMART_ACTION_PLAY_SPELL_VISUAL:
|
||||
case SMART_ACTION_FOLLOW_GROUP:
|
||||
case SMART_ACTION_SET_ORIENTATION_TARGET:
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR("sql.sql", "SmartAIMgr: Not handled action_type({}), event_type({}), Entry {} SourceType {} Event {}, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
|
||||
|
||||
Reference in New Issue
Block a user