mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-18 14:10:18 -04:00
Core/SAI: Warn when an unused parameter is set in the database (#26628)
* Core/SAI: Warn when an unused parameter is set in the database
* Warn when an unused parameter is set in the database as all unused parameters are supposed to be set to 0.
* Remove unused struct from union.
* Add a new struct simpleTalk for SMART_ACTION_SIMPLE_TALK instead of reusing only some fields of struct talk from SMART_ACTION_TALK
* Add addAura and flag structs to be used instead of generic ones to match the parameters used by actions
* Add randRangeTimedActionList struct to be used instead of generic ones to match the parameters used by actions.
* Remove unused action structs.
(cherry picked from commit aa7279df09)
This commit is contained in:
@@ -328,14 +328,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
for (WorldObject* target : targets)
|
||||
{
|
||||
if (IsCreature(target))
|
||||
sCreatureTextMgr->SendChat(target->ToCreature(), uint8(e.action.talk.textGroupID), IsPlayer(GetLastInvoker()) ? GetLastInvoker() : nullptr);
|
||||
sCreatureTextMgr->SendChat(target->ToCreature(), uint8(e.action.simpleTalk.textGroupID), IsPlayer(GetLastInvoker()) ? GetLastInvoker() : nullptr);
|
||||
else if (IsPlayer(target) && me)
|
||||
{
|
||||
Unit* templastInvoker = GetLastInvoker();
|
||||
sCreatureTextMgr->SendChat(me, uint8(e.action.talk.textGroupID), IsPlayer(templastInvoker) ? templastInvoker : nullptr, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, SoundKitPlayType::Normal, TEAM_OTHER, false, target->ToPlayer());
|
||||
sCreatureTextMgr->SendChat(me, uint8(e.action.simpleTalk.textGroupID), IsPlayer(templastInvoker) ? templastInvoker : nullptr, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, SoundKitPlayType::Normal, TEAM_OTHER, false, target->ToPlayer());
|
||||
}
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SIMPLE_TALK: talker: %s %s, textGroupId: %u",
|
||||
target->GetName().c_str(), target->GetGUID().ToString().c_str(), uint8(e.action.talk.textGroupID));
|
||||
target->GetName().c_str(), target->GetGUID().ToString().c_str(), uint8(e.action.simpleTalk.textGroupID));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -704,9 +704,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
{
|
||||
if (IsUnit(target))
|
||||
{
|
||||
target->ToUnit()->AddAura(e.action.cast.spell, target->ToUnit());
|
||||
target->ToUnit()->AddAura(e.action.addAura.spell, target->ToUnit());
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_ADD_AURA: Adding aura %u to unit %s",
|
||||
e.action.cast.spell, target->GetGUID().ToString().c_str());
|
||||
e.action.addAura.spell, target->GetGUID().ToString().c_str());
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1757,21 +1757,21 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
{
|
||||
for (WorldObject* target : targets)
|
||||
if (IsCreature(target))
|
||||
target->ToUnit()->SetNpcFlags(NPCFlags(e.action.unitFlag.flag));
|
||||
target->ToUnit()->SetNpcFlags(NPCFlags(e.action.flag.flag));
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_ADD_NPC_FLAG:
|
||||
{
|
||||
for (WorldObject* target : targets)
|
||||
if (IsCreature(target))
|
||||
target->ToUnit()->AddNpcFlag(NPCFlags(e.action.unitFlag.flag));
|
||||
target->ToUnit()->AddNpcFlag(NPCFlags(e.action.flag.flag));
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_REMOVE_NPC_FLAG:
|
||||
{
|
||||
for (WorldObject* target : targets)
|
||||
if (IsCreature(target))
|
||||
target->ToUnit()->RemoveNpcFlag(NPCFlags(e.action.unitFlag.flag));
|
||||
target->ToUnit()->RemoveNpcFlag(NPCFlags(e.action.flag.flag));
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_CROSS_CAST:
|
||||
@@ -1845,7 +1845,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
}
|
||||
case SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST:
|
||||
{
|
||||
uint32 id = urand(e.action.randTimedActionList.actionLists[0], e.action.randTimedActionList.actionLists[1]);
|
||||
uint32 id = urand(e.action.randRangeTimedActionList.idMin, e.action.randRangeTimedActionList.idMax);
|
||||
if (e.GetTargetType() == SMART_TARGET_NONE)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartScript: Entry " SI64FMTD " SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
|
||||
@@ -1966,21 +1966,21 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
case SMART_ACTION_SET_DYNAMIC_FLAG:
|
||||
{
|
||||
for (WorldObject* target : targets)
|
||||
target->SetDynamicFlags(e.action.unitFlag.flag);
|
||||
target->SetDynamicFlags(e.action.flag.flag);
|
||||
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_ADD_DYNAMIC_FLAG:
|
||||
{
|
||||
for (WorldObject* target : targets)
|
||||
target->AddDynamicFlag(e.action.unitFlag.flag);
|
||||
target->AddDynamicFlag(e.action.flag.flag);
|
||||
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_REMOVE_DYNAMIC_FLAG:
|
||||
{
|
||||
for (WorldObject* target : targets)
|
||||
target->RemoveDynamicFlag(e.action.unitFlag.flag);
|
||||
target->RemoveDynamicFlag(e.action.flag.flag);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -2374,7 +2374,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
break;
|
||||
for (WorldObject* const target : targets)
|
||||
if (IsUnit(target))
|
||||
me->GetThreatManager().AddThreat(target->ToUnit(), float(e.action.threatPCT.threatINC) - float(e.action.threatPCT.threatDEC), nullptr, true, true);
|
||||
me->GetThreatManager().AddThreat(target->ToUnit(), float(e.action.threat.threatINC) - float(e.action.threat.threatDEC), nullptr, true, true);
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_LOAD_EQUIPMENT:
|
||||
@@ -3020,7 +3020,7 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
|
||||
break;
|
||||
}
|
||||
|
||||
if (Creature* target = ref->FindNearestCreature(e.target.closest.entry, float(e.target.closest.dist ? e.target.closest.dist : 100), !e.target.closest.dead))
|
||||
if (Creature* target = ref->FindNearestCreature(e.target.unitClosest.entry, float(e.target.unitClosest.dist ? e.target.unitClosest.dist : 100), !e.target.unitClosest.dead))
|
||||
targets.push_back(target);
|
||||
break;
|
||||
}
|
||||
@@ -3037,7 +3037,7 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
|
||||
break;
|
||||
}
|
||||
|
||||
if (GameObject* target = ref->FindNearestGameObject(e.target.closest.entry, float(e.target.closest.dist ? e.target.closest.dist : 100)))
|
||||
if (GameObject* target = ref->FindNearestGameObject(e.target.goClosest.entry, float(e.target.goClosest.dist ? e.target.goClosest.dist : 100)))
|
||||
targets.push_back(target);
|
||||
break;
|
||||
}
|
||||
@@ -3096,7 +3096,7 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
|
||||
{
|
||||
if (me && me->CanHaveThreatList())
|
||||
for (auto* ref : me->GetThreatManager().GetUnsortedThreatList())
|
||||
if (!e.target.hostilRandom.maxDist || me->IsWithinCombatRange(ref->GetVictim(), float(e.target.hostilRandom.maxDist)))
|
||||
if (!e.target.threatList.maxDist || me->IsWithinCombatRange(ref->GetVictim(), float(e.target.threatList.maxDist)))
|
||||
targets.push_back(ref->GetVictim());
|
||||
break;
|
||||
}
|
||||
@@ -3144,7 +3144,7 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
|
||||
}
|
||||
case SMART_TARGET_CLOSEST_UNSPAWNED_GAMEOBJECT:
|
||||
{
|
||||
if (GameObject* target = baseObject->FindNearestUnspawnedGameObject(e.target.closest.entry, float(e.target.closest.dist ? e.target.closest.dist : 100)))
|
||||
if (GameObject* target = baseObject->FindNearestUnspawnedGameObject(e.target.goClosest.entry, float(e.target.goClosest.dist ? e.target.goClosest.dist : 100)))
|
||||
targets.push_back(target);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user