enhance readability and correct numbers

This commit is contained in:
Evildead666 2015-03-28 14:29:20 +01:00
parent dfe72e4234
commit 93f6f9953a
2 changed files with 64 additions and 64 deletions

View File

@ -511,7 +511,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 rnd, uint32 EventId, Unit* pActionInvoker, Creature* pAIEventSender)
{
if (action.type == ACTION_T_NONE)
if (action.type == ACTION_T_NONE) //0
{ return; }
DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: Process action %u (script %u) triggered for %s (invoked by %s)",
@ -520,8 +520,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
bool reportTargetError = false;
switch (action.type)
{
case ACTION_T_TEXT:
case ACTION_T_CHANCED_TEXT:
case ACTION_T_TEXT: //1
case ACTION_T_CHANCED_TEXT: //44
{
if (!action.text.TextId[0])
{ return; }
@ -573,7 +573,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
break;
}
case ACTION_T_SET_FACTION:
case ACTION_T_SET_FACTION: //2
{
if (action.set_faction.factionId)
{ m_creature->SetFactionTemporary(action.set_faction.factionId, action.set_faction.factionFlags); }
@ -582,7 +582,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
}
case ACTION_T_MORPH_TO_ENTRY_OR_MODEL:
case ACTION_T_MORPH_TO_ENTRY_OR_MODEL: //3
{
if (action.morph.creatureId || action.morph.modelId)
{
@ -603,27 +603,27 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
{ m_creature->DeMorph(); }
break;
}
case ACTION_T_SOUND:
case ACTION_T_SOUND: //4
m_creature->PlayDirectSound(action.sound.soundId);
break;
case ACTION_T_EMOTE:
case ACTION_T_EMOTE: //5
m_creature->HandleEmote(action.emote.emoteId);
break;
case ACTION_T_RANDOM_SOUND:
case ACTION_T_RANDOM_SOUND: //9
{
int32 temp = GetRandActionParam(rnd, action.random_sound.soundId1, action.random_sound.soundId2, action.random_sound.soundId3);
if (temp >= 0)
{ m_creature->PlayDirectSound(temp); }
break;
}
case ACTION_T_RANDOM_EMOTE:
case ACTION_T_RANDOM_EMOTE: //10
{
int32 temp = GetRandActionParam(rnd, action.random_emote.emoteId1, action.random_emote.emoteId2, action.random_emote.emoteId3);
if (temp >= 0)
{ m_creature->HandleEmote(temp); }
break;
}
case ACTION_T_CAST:
case ACTION_T_CAST: //11
{
uint32 selectFlags = 0;
uint32 spellId = 0;
@ -673,7 +673,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
}
case ACTION_T_SUMMON:
case ACTION_T_SUMMON: //12
{
Unit* target = GetTargetByType(action.summon.target, pActionInvoker, pAIEventSender, reportTargetError);
if (!target && reportTargetError)
@ -692,13 +692,13 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
{ pCreature->AI()->AttackStart(target); }
break;
}
case ACTION_T_THREAT_SINGLE_PCT:
case ACTION_T_THREAT_SINGLE_PCT: //13
if (Unit* target = GetTargetByType(action.threat_single_pct.target, pActionInvoker, pAIEventSender, reportTargetError))
{ m_creature->GetThreatManager().modifyThreatPercent(target, action.threat_single_pct.percent); }
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_THREAT_SINGLE_PCT(%u), target-type %u", EventId, action.type, action.threat_single_pct.target); }
break;
case ACTION_T_THREAT_ALL_PCT:
case ACTION_T_THREAT_ALL_PCT: //14
{
ThreatList const& threatList = m_creature->GetThreatManager().getThreatList();
for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
@ -706,7 +706,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
{ m_creature->GetThreatManager().modifyThreatPercent(Temp, action.threat_all_pct.percent); }
break;
}
case ACTION_T_QUEST_EVENT:
case ACTION_T_QUEST_EVENT: //15
if (Unit* target = GetTargetByType(action.quest_event.target, pActionInvoker, pAIEventSender, reportTargetError))
{
if (target->GetTypeId() == TYPEID_PLAYER)
@ -715,7 +715,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_QUEST_EVENT(%u), target-type %u", EventId, action.type, action.quest_event.target); }
break;
case ACTION_T_CAST_EVENT:
case ACTION_T_CAST_EVENT: //16
if (Unit* target = GetTargetByType(action.cast_event.target, pActionInvoker, pAIEventSender, reportTargetError, 0, SELECT_FLAG_PLAYER))
{
if (target->GetTypeId() == TYPEID_PLAYER)
@ -724,7 +724,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_CST_EVENT(%u), target-type %u", EventId, action.type, action.cast_event.target); }
break;
case ACTION_T_SET_UNIT_FIELD:
case ACTION_T_SET_UNIT_FIELD: //17
{
Unit* target = GetTargetByType(action.set_unit_field.target, pActionInvoker, pAIEventSender, reportTargetError);
@ -739,22 +739,22 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
}
case ACTION_T_SET_UNIT_FLAG:
case ACTION_T_SET_UNIT_FLAG: //18
if (Unit* target = GetTargetByType(action.unit_flag.target, pActionInvoker, pAIEventSender, reportTargetError))
{ target->SetFlag(UNIT_FIELD_FLAGS, action.unit_flag.value); }
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SET_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target); }
break;
case ACTION_T_REMOVE_UNIT_FLAG:
case ACTION_T_REMOVE_UNIT_FLAG: //19
if (Unit* target = GetTargetByType(action.unit_flag.target, pActionInvoker, pAIEventSender, reportTargetError))
{ target->RemoveFlag(UNIT_FIELD_FLAGS, action.unit_flag.value); }
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVE_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target); }
break;
case ACTION_T_AUTO_ATTACK:
case ACTION_T_AUTO_ATTACK: //20
m_MeleeEnabled = action.auto_attack.state != 0;
break;
case ACTION_T_COMBAT_MOVEMENT:
case ACTION_T_COMBAT_MOVEMENT: //21
// ignore no affect case
if (m_isCombatMovement == (action.combat_movement.state != 0) || m_creature->IsNonMeleeSpellCasted(false))
{ return; }
@ -766,11 +766,11 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
else if (action.combat_movement.melee && m_creature->IsInCombat() && m_creature->getVictim())
{ m_creature->SendMeleeAttackStop(m_creature->getVictim()); }
break;
case ACTION_T_SET_PHASE:
case ACTION_T_SET_PHASE: //22
m_Phase = action.set_phase.phase;
DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: ACTION_T_SET_PHASE - script %u for %s, phase is now %u", EventId, m_creature->GetGuidStr().c_str(), m_Phase);
break;
case ACTION_T_INC_PHASE:
case ACTION_T_INC_PHASE: //23
{
int32 new_phase = int32(m_Phase) + action.set_inc_phase.step;
if (new_phase < 0)
@ -789,17 +789,17 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: ACTION_T_INC_PHASE - script %u for %s, phase is now %u", EventId, m_creature->GetGuidStr().c_str(), m_Phase);
break;
}
case ACTION_T_EVADE:
case ACTION_T_EVADE: //24
EnterEvadeMode();
break;
case ACTION_T_FLEE_FOR_ASSIST:
case ACTION_T_FLEE_FOR_ASSIST: //25
m_creature->DoFleeToGetAssistance();
break;
case ACTION_T_QUEST_EVENT_ALL:
case ACTION_T_QUEST_EVENT_ALL: //26
if (pActionInvoker && pActionInvoker->GetTypeId() == TYPEID_PLAYER)
{ ((Player*)pActionInvoker)->GroupEventHappens(action.quest_event_all.questId, m_creature); }
break;
case ACTION_T_CAST_EVENT_ALL:
case ACTION_T_CAST_EVENT_ALL: //27
{
ThreatList const& threatList = m_creature->GetThreatManager().getThreatList();
for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
@ -807,13 +807,13 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
{ temp->CastedCreatureOrGO(action.cast_event_all.creatureId, m_creature->GetObjectGuid(), action.cast_event_all.spellId); }
break;
}
case ACTION_T_REMOVEAURASFROMSPELL:
case ACTION_T_REMOVEAURASFROMSPELL: //28
if (Unit* target = GetTargetByType(action.remove_aura.target, pActionInvoker, pAIEventSender, reportTargetError))
{ target->RemoveAurasDueToSpell(action.remove_aura.spellId); }
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVEAURASFROMSPELL(%u), target-type %u", EventId, action.type, action.remove_aura.target); }
break;
case ACTION_T_RANGED_MOVEMENT:
case ACTION_T_RANGED_MOVEMENT: //29
m_attackDistance = (float)action.ranged_movement.distance;
m_attackAngle = action.ranged_movement.angle / 180.0f * M_PI_F;
@ -827,17 +827,17 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
}
break;
case ACTION_T_RANDOM_PHASE:
case ACTION_T_RANDOM_PHASE: //30
m_Phase = GetRandActionParam(rnd, action.random_phase.phase1, action.random_phase.phase2, action.random_phase.phase3);
DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: ACTION_T_RANDOM_PHASE - script %u for %s, phase is now %u", EventId, m_creature->GetGuidStr().c_str(), m_Phase);
break;
case ACTION_T_RANDOM_PHASE_RANGE:
case ACTION_T_RANDOM_PHASE_RANGE: //31
if (action.random_phase_range.phaseMax > action.random_phase_range.phaseMin)
{ m_Phase = action.random_phase_range.phaseMin + (rnd % (action.random_phase_range.phaseMax - action.random_phase_range.phaseMin)); }
else
{ sLog.outErrorEventAI("ACTION_T_RANDOM_PHASE_RANGE can not have Param2 <= Param1. Divide by Zero. Event = %d. CreatureEntry = %d", EventId, m_creature->GetEntry()); }
break;
case ACTION_T_SUMMON_ID:
case ACTION_T_SUMMON_ID: //32
{
Unit* target = GetTargetByType(action.summon_id.target, pActionInvoker, pAIEventSender, reportTargetError);
if (!target && reportTargetError)
@ -863,7 +863,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
}
case ACTION_T_KILLED_MONSTER:
case ACTION_T_KILLED_MONSTER: //33
// first attempt player/group who tapped creature
if (Player* pPlayer = m_creature->GetLootRecipient())
{ pPlayer->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, m_creature); }
@ -879,7 +879,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_KILLED_MONSTER(%u), target-type %u", EventId, action.type, action.killed_monster.target); }
}
break;
case ACTION_T_SET_INST_DATA:
case ACTION_T_SET_INST_DATA: //34
{
InstanceData* pInst = m_creature->GetInstanceData();
if (!pInst)
@ -891,7 +891,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
pInst->SetData(action.set_inst_data.field, action.set_inst_data.value);
break;
}
case ACTION_T_SET_INST_DATA64:
case ACTION_T_SET_INST_DATA64: //35
{
Unit* target = GetTargetByType(action.set_inst_data64.target, pActionInvoker, pAIEventSender, reportTargetError);
if (!target)
@ -911,7 +911,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
pInst->SetData64(action.set_inst_data64.field, target->GetObjectGuid().GetRawValue());
break;
}
case ACTION_T_UPDATE_TEMPLATE:
case ACTION_T_UPDATE_TEMPLATE: //36
if (m_creature->GetEntry() == action.update_template.creatureId)
{
sLog.outErrorEventAI("Event %d ACTION_T_UPDATE_TEMPLATE call with param1 == current entry. Creature %d", EventId, m_creature->GetEntry());
@ -920,7 +920,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_creature->UpdateEntry(action.update_template.creatureId, action.update_template.team ? HORDE : ALLIANCE);
break;
case ACTION_T_DIE:
case ACTION_T_DIE: //37
if (m_creature->IsDead())
{
sLog.outErrorEventAI("Event %d ACTION_T_DIE on dead creature. Creature %d", EventId, m_creature->GetEntry());
@ -928,27 +928,27 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
break;
case ACTION_T_ZONE_COMBAT_PULSE:
case ACTION_T_ZONE_COMBAT_PULSE: //38
{
m_creature->SetInCombatWithZone();
break;
}
case ACTION_T_CALL_FOR_HELP:
case ACTION_T_CALL_FOR_HELP: //39
{
m_creature->CallForHelp((float)action.call_for_help.radius);
break;
}
case ACTION_T_SET_SHEATH:
case ACTION_T_SET_SHEATH: //40
{
m_creature->SetSheath(SheathState(action.set_sheath.sheath));
break;
}
case ACTION_T_FORCE_DESPAWN:
case ACTION_T_FORCE_DESPAWN: //41
{
m_creature->ForcedDespawn(action.forced_despawn.msDelay);
break;
}
case ACTION_T_SET_INVINCIBILITY_HP_LEVEL:
case ACTION_T_SET_INVINCIBILITY_HP_LEVEL: //42
{
if (action.invincibility_hp_level.is_percent)
{ m_InvinceabilityHpLevel = m_creature->GetMaxHealth() * action.invincibility_hp_level.hp_level / 100; }
@ -956,7 +956,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
{ m_InvinceabilityHpLevel = action.invincibility_hp_level.hp_level; }
break;
}
case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL:
case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL: //43
{
if (action.mount.creatureId || action.mount.modelId)
{
@ -978,22 +978,38 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
}
case ACTION_T_THROW_AI_EVENT:
case ACTION_T_THROW_AI_EVENT: //45
{
SendAIEventAround(AIEventType(action.throwEvent.eventType), pActionInvoker, 0, action.throwEvent.radius);
break;
}
case ACTION_T_SET_THROW_MASK:
case ACTION_T_SET_THROW_MASK: //46
{
m_throwAIEventMask = action.setThrowMask.eventTypeMask;
break;
}
case ACTION_T_SET_STAND_STATE:
case ACTION_T_SET_STAND_STATE: //47
{
m_creature->SetStandState(action.setStandState.standState);
break;
}
case ACTION_T_SUMMON_UNIQUE: //47
case ACTION_T_CHANGE_MOVEMENT: //48
{
switch (action.changeMovement.movementType)
{
case IDLE_MOTION_TYPE:
m_creature->GetMotionMaster()->MoveIdle();
break;
case RANDOM_MOTION_TYPE:
m_creature->GetMotionMaster()->MoveRandomAroundPoint(m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), float(action.changeMovement.wanderDistance));
break;
case WAYPOINT_MOTION_TYPE:
m_creature->GetMotionMaster()->MoveWaypoint();
break;
}
break;
}
case ACTION_T_SUMMON_UNIQUE: //49
{
Creature* pCreature = NULL;
@ -1036,7 +1052,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
}
case ACTION_T_EMOTE_TARGET:
case ACTION_T_EMOTE_TARGET: //50
{
Unit* pCreature = m_creature->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, action.emoteTarget.targetGuid));
if (!pCreature)
@ -1050,22 +1066,6 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_creature->HandleEmote(action.emoteTarget.emoteId);
break;
}
case ACTION_T_CHANGE_MOVEMENT:
{
switch (action.changeMovement.movementType)
{
case IDLE_MOTION_TYPE:
m_creature->GetMotionMaster()->MoveIdle();
break;
case RANDOM_MOTION_TYPE:
m_creature->GetMotionMaster()->MoveRandomAroundPoint(m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), float(action.changeMovement.wanderDistance));
break;
case WAYPOINT_MOTION_TYPE:
m_creature->GetMotionMaster()->MoveWaypoint();
break;
}
break;
}
}
}

View File

@ -881,7 +881,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
}
break;
case ACTION_T_SUMMON_UNIQUE: //47
case ACTION_T_SUMMON_UNIQUE: //49
if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.summon_unique.creatureId))
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.summon_unique.creatureId); }
IsValidTargetType(temp.event_type, action.type, action.summon_unique.target, i, j + 1);