diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/CoreAI/CombatAI.h | 8 | ||||
-rw-r--r-- | src/server/game/AI/CoreAI/TotemAI.cpp | 2 | ||||
-rw-r--r-- | src/server/game/AI/CoreAI/UnitAI.h | 5 | ||||
-rw-r--r-- | src/server/game/AI/CreatureAIFactory.h | 1 | ||||
-rw-r--r-- | src/server/game/AI/CreatureAISelector.cpp | 1 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartAI.h | 2 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 40 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.h | 4 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.h | 17 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 32 |
10 files changed, 56 insertions, 56 deletions
diff --git a/src/server/game/AI/CoreAI/CombatAI.h b/src/server/game/AI/CoreAI/CombatAI.h index 16167d1be59..3fac2c78962 100644 --- a/src/server/game/AI/CoreAI/CombatAI.h +++ b/src/server/game/AI/CoreAI/CombatAI.h @@ -72,7 +72,7 @@ struct ArcherAI : public CreatureAI void AttackStart(Unit* who); void UpdateAI(uint32 diff); - static int Permissible(const Creature*); + static int Permissible(Creature const*); protected: float m_minRange; }; @@ -81,11 +81,11 @@ struct TurretAI : public CreatureAI { public: explicit TurretAI(Creature* c); - bool CanAIAttack(const Unit* who) const; + bool CanAIAttack(Unit const* who) const; void AttackStart(Unit* who); void UpdateAI(uint32 diff); - static int Permissible(const Creature*); + static int Permissible(Creature const*); protected: float m_minRange; }; @@ -98,7 +98,7 @@ struct VehicleAI : public CreatureAI explicit VehicleAI(Creature* c); void UpdateAI(uint32 diff); - static int Permissible(const Creature*); + static int Permissible(Creature const*); void Reset(); void MoveInLineOfSight(Unit*) { } void AttackStart(Unit*) { } diff --git a/src/server/game/AI/CoreAI/TotemAI.cpp b/src/server/game/AI/CoreAI/TotemAI.cpp index 03ba024384f..6f8452176e5 100644 --- a/src/server/game/AI/CoreAI/TotemAI.cpp +++ b/src/server/game/AI/CoreAI/TotemAI.cpp @@ -104,6 +104,6 @@ void TotemAI::AttackStart(Unit* /*victim*/) data << me->GetGUID(); data << me->GetPositionX(); data << me->GetPositionY(); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } } diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index 71fc86f112b..33a09fd03b0 100644 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -26,7 +26,6 @@ class Player; class Quest; -class Unit; struct AISpellInfoType; //Selection method used by SelectTarget @@ -142,9 +141,9 @@ class UnitAI virtual uint64 GetGUID(int32 /*id*/ = 0) const { return 0; } Unit* SelectTarget(SelectAggroTarget targetType, uint32 position = 0, float dist = 0.0f, bool playerOnly = false, int32 aura = 0); - // Select the targets satifying the predicate. + // Select the targets satisfying the predicate. // predicate shall extend std::unary_function<Unit*, bool> - template <class PREDICATE> Unit* SelectTarget(SelectAggroTarget targetType, uint32 position, PREDICATE const& predicate) + template<class PREDICATE> Unit* SelectTarget(SelectAggroTarget targetType, uint32 position, PREDICATE const& predicate) { ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList(); if (position >= threatlist.size()) diff --git a/src/server/game/AI/CreatureAIFactory.h b/src/server/game/AI/CreatureAIFactory.h index 30576cf28bd..809c17cadb8 100644 --- a/src/server/game/AI/CreatureAIFactory.h +++ b/src/server/game/AI/CreatureAIFactory.h @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ + #ifndef TRINITY_CREATUREAIFACTORY_H #define TRINITY_CREATUREAIFACTORY_H diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp index ec2d3687f5f..597ad24d4e1 100644 --- a/src/server/game/AI/CreatureAISelector.cpp +++ b/src/server/game/AI/CreatureAISelector.cpp @@ -147,4 +147,3 @@ namespace FactorySelector return (ai_factory == NULL ? new NullGameObjectAI(go) : ai_factory->Create(go)); } } - diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index ae6719aa8f3..92637b17f25 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -56,7 +56,7 @@ class SmartAI : public CreatureAI void EndPath(bool fail = false); void ResumePath(); WayPoint* GetNextWayPoint(); - bool HasEscortState(uint32 uiEscortState) { return (mEscortState & uiEscortState); } + bool HasEscortState(uint32 uiEscortState) const { return (mEscortState & uiEscortState) != 0; } void AddEscortState(uint32 uiEscortState) { mEscortState |= uiEscortState; } void RemoveEscortState(uint32 uiEscortState) { mEscortState &= ~uiEscortState; } void SetAutoAttack(bool on) { mCanAutoAttack = on; } diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 09f656e5bf1..d2d5027ce7d 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -168,12 +168,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - if (IsCreature((*itr)) && !(*itr)->ToCreature()->IsPet()) // Prevented sending text to pets. + if (IsCreature(*itr) && !(*itr)->ToCreature()->IsPet()) // Prevented sending text to pets. { talker = (*itr)->ToCreature(); break; } - else if (IsPlayer((*itr))) + else if (IsPlayer(*itr)) { targetPlayer = (*itr)->ToPlayer(); break; @@ -542,17 +542,17 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!IsUnit(*itr)) continue; - if (!(e.action.cast.flags & SMARTCAST_AURA_NOT_PRESENT) || !(*itr)->ToUnit()->HasAura(e.action.cast.spell)) - { - if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS) - tempLastInvoker->InterruptNonMeleeSpells(false); + if (!(e.action.cast.flags & SMARTCAST_AURA_NOT_PRESENT) || !(*itr)->ToUnit()->HasAura(e.action.cast.spell)) + { + if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS) + tempLastInvoker->InterruptNonMeleeSpells(false); - tempLastInvoker->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED)); - TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_INVOKER_CAST: Invoker %u casts spell %u on target %u with castflags %u", - tempLastInvoker->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags); - } - else - TC_LOG_DEBUG("scripts.ai", "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId())); + tempLastInvoker->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED)); + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_INVOKER_CAST: Invoker %u casts spell %u on target %u with castflags %u", + tempLastInvoker->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags); + } + else + TC_LOG_DEBUG("scripts.ai", "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId())); } delete targets; @@ -784,13 +784,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - if (!IsUnit((*itr))) + if (!IsUnit(*itr)) continue; - if (e.action.removeAura.spell == 0) - (*itr)->ToUnit()->RemoveAllAuras(); - else + if (e.action.removeAura.spell) (*itr)->ToUnit()->RemoveAurasDueToSpell(e.action.removeAura.spell); + else + (*itr)->ToUnit()->RemoveAllAuras(); TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_REMOVEAURASFROMSPELL: Unit %u, spell %u", (*itr)->GetGUIDLow(), e.action.removeAura.spell); @@ -810,7 +810,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - if (IsUnit((*itr))) + if (IsUnit(*itr)) { CAST_AI(SmartAI, me->AI())->SetFollow((*itr)->ToUnit(), (float)e.action.follow.dist, (float)e.action.follow.angle, e.action.follow.credit, e.action.follow.entry, e.action.follow.creditType); TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_FOLLOW: Creature %u following target %u", @@ -1674,6 +1674,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!IsUnit(*itr)) continue; + Unit* unit = (*itr)->ToUnit(); + bool interruptedSpell = false; for (ObjectList::const_iterator it = targets->begin(); it != targets->end(); ++it) @@ -1685,11 +1687,11 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (!interruptedSpell && e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS) { - (*itr)->ToUnit()->InterruptNonMeleeSpells(false); + unit->InterruptNonMeleeSpells(false); interruptedSpell = true; } - (*itr)->ToUnit()->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED)); + unit->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED)); } else TC_LOG_DEBUG("scripts.ai", "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*it)->GetGUID(), (*it)->GetEntry(), uint32((*it)->GetTypeId())); diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h index e320e122d0f..f9eff2ec96e 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.h +++ b/src/server/game/AI/SmartScripts/SmartScript.h @@ -244,7 +244,7 @@ class SmartScript SMARTAI_TEMPLATE mTemplate; void InstallEvents(); - void RemoveStoredEvent (uint32 id) + void RemoveStoredEvent(uint32 id) { if (!mStoredEvents.empty()) { @@ -258,7 +258,7 @@ class SmartScript } } } - SmartScriptHolder FindLinkedEvent (uint32 link) + SmartScriptHolder FindLinkedEvent(uint32 link) { if (!mEvents.empty()) { diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 9494d4e7734..35abdcc47f0 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -735,7 +735,7 @@ struct SmartAction } summonGO; struct - { + { uint32 state; } active; @@ -1280,9 +1280,9 @@ enum SmartCastFlags { SMARTCAST_INTERRUPT_PREVIOUS = 0x01, //Interrupt any spell casting SMARTCAST_TRIGGERED = 0x02, //Triggered (this makes spell cost zero mana and have no cast time) - //CAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range - //CAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range - //CAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself + //SMARTCAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range + //SMARTCAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range + //SMARTCAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself SMARTCAST_AURA_NOT_PRESENT = 0x20 //Only casts the spell if the target does not have an aura from the spell }; @@ -1302,11 +1302,10 @@ struct SmartScriptHolder SmartAction action; SmartTarget target; - public: - uint32 GetScriptType() const { return (uint32)source_type; } - uint32 GetEventType() const { return (uint32)event.type; } - uint32 GetActionType() const { return (uint32)action.type; } - uint32 GetTargetType() const { return (uint32)target.type; } + uint32 GetScriptType() const { return (uint32)source_type; } + uint32 GetEventType() const { return (uint32)event.type; } + uint32 GetActionType() const { return (uint32)action.type; } + uint32 GetTargetType() const { return (uint32)target.type; } uint32 timer; bool active; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 4a0b18b1643..8ebcc17df16 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1240,7 +1240,7 @@ void ObjectMgr::LoadLinkedRespawn() const CreatureData* slave = GetCreatureData(guidLow); if (!slave) { - TC_LOG_ERROR("sql.sql", "Couldn't get creature data for GUIDLow %u", guidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature (guid) '%u' not found in creature table", guidLow); error = true; break; } @@ -1248,7 +1248,7 @@ void ObjectMgr::LoadLinkedRespawn() const CreatureData* master = GetCreatureData(linkedGuidLow); if (!master) { - TC_LOG_ERROR("sql.sql", "Couldn't get creature data for GUIDLow %u", linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature (linkedGuid) '%u' not found in creature table", linkedGuidLow); error = true; break; } @@ -1256,14 +1256,14 @@ void ObjectMgr::LoadLinkedRespawn() const MapEntry* const map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { - TC_LOG_ERROR("sql.sql", "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to Creature '%u' on an unpermitted map.", guidLow, linkedGuidLow); error = true; break; } if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) { - TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to Creature '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); error = true; break; } @@ -1277,7 +1277,7 @@ void ObjectMgr::LoadLinkedRespawn() const CreatureData* slave = GetCreatureData(guidLow); if (!slave) { - TC_LOG_ERROR("sql.sql", "Couldn't get creature data for GUIDLow %u", guidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature (guid) '%u' not found in creature table", guidLow); error = true; break; } @@ -1285,7 +1285,7 @@ void ObjectMgr::LoadLinkedRespawn() const GameObjectData* master = GetGOData(linkedGuidLow); if (!master) { - TC_LOG_ERROR("sql.sql", "Couldn't get gameobject data for GUIDLow %u", linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (linkedGuid) '%u' not found in gameobject table", linkedGuidLow); error = true; break; } @@ -1293,14 +1293,14 @@ void ObjectMgr::LoadLinkedRespawn() const MapEntry* const map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { - TC_LOG_ERROR("sql.sql", "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to Gameobject '%u' on an unpermitted map.", guidLow, linkedGuidLow); error = true; break; } if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) { - TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to Gameobject '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); error = true; break; } @@ -1314,7 +1314,7 @@ void ObjectMgr::LoadLinkedRespawn() const GameObjectData* slave = GetGOData(guidLow); if (!slave) { - TC_LOG_ERROR("sql.sql", "Couldn't get gameobject data for GUIDLow %u", guidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (guid) '%u' not found in gameobject table", guidLow); error = true; break; } @@ -1322,7 +1322,7 @@ void ObjectMgr::LoadLinkedRespawn() const GameObjectData* master = GetGOData(linkedGuidLow); if (!master) { - TC_LOG_ERROR("sql.sql", "Couldn't get gameobject data for GUIDLow %u", linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (linkedGuid) '%u' not found in gameobject table", linkedGuidLow); error = true; break; } @@ -1330,14 +1330,14 @@ void ObjectMgr::LoadLinkedRespawn() const MapEntry* const map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { - TC_LOG_ERROR("sql.sql", "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '%u' linking to Gameobject '%u' on an unpermitted map.", guidLow, linkedGuidLow); error = true; break; } if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) { - TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '%u' linking to Gameobject '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); error = true; break; } @@ -1351,7 +1351,7 @@ void ObjectMgr::LoadLinkedRespawn() const GameObjectData* slave = GetGOData(guidLow); if (!slave) { - TC_LOG_ERROR("sql.sql", "Couldn't get gameobject data for GUIDLow %u", guidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (guid) '%u' not found in gameobject table", guidLow); error = true; break; } @@ -1359,7 +1359,7 @@ void ObjectMgr::LoadLinkedRespawn() const CreatureData* master = GetCreatureData(linkedGuidLow); if (!master) { - TC_LOG_ERROR("sql.sql", "Couldn't get creature data for GUIDLow %u", linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature (linkedGuid) '%u' not found in creature table", linkedGuidLow); error = true; break; } @@ -1367,14 +1367,14 @@ void ObjectMgr::LoadLinkedRespawn() const MapEntry* const map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { - TC_LOG_ERROR("sql.sql", "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '%u' linking to Creature '%u' on an unpermitted map.", guidLow, linkedGuidLow); error = true; break; } if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) { - TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '%u' linking to Creature '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); error = true; break; } |