aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVincent_Michael <Vincent_Michael@gmx.de>2013-01-02 17:42:22 +0100
committerVincent_Michael <Vincent_Michael@gmx.de>2013-01-02 17:42:22 +0100
commit5bbf7829b21e9a3d7f7c4e068ce779c5975b8c36 (patch)
tree29348917aa683045ce9e6b4d8fbeebe7d28c8c94 /src
parentb873156c3c1654553319158275f29ac2f818f3ce (diff)
parentcc99c739c6278b492a27cd90dc717caf646ee9f8 (diff)
Merge branch 'master' of github.com:TrinityCore/TrinityCore into mmaps
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/CoreAI/PetAI.cpp1
-rw-r--r--src/server/game/AI/CoreAI/UnitAI.cpp22
-rw-r--r--src/server/game/AI/CreatureAI.cpp88
-rw-r--r--src/server/game/AI/CreatureAIImpl.h110
-rw-r--r--src/server/game/Entities/Object/ObjectDefines.h10
-rw-r--r--src/server/game/Spells/Spell.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp11
-rw-r--r--src/server/shared/Database/PreparedStatement.cpp8
-rw-r--r--src/server/shared/Database/PreparedStatement.h2
9 files changed, 132 insertions, 128 deletions
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index 14839196da8..31e49e4b8d3 100644
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -130,7 +130,6 @@ void PetAI::UpdateAI(const uint32 diff)
}
else
HandleReturnMovement();
-
}
// Autocast (casted only in combat or persistent spells in any state)
diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp
index 81e32a2f8b6..a3cb57b3332 100644
--- a/src/server/game/AI/CoreAI/UnitAI.cpp
+++ b/src/server/game/AI/CoreAI/UnitAI.cpp
@@ -162,6 +162,28 @@ void UnitAI::DoCast(uint32 spellId)
me->CastSpell(target, spellId, false);
}
+void UnitAI::DoCast(Unit* victim, uint32 spellId, bool triggered)
+{
+ if (!victim || (me->HasUnitState(UNIT_STATE_CASTING) && !triggered))
+ return;
+
+ me->CastSpell(victim, spellId, triggered);
+}
+
+void UnitAI::DoCastVictim(uint32 spellId, bool triggered)
+{
+ // Why don't we check for casting unit_state and existing target as we do in DoCast(.. ?
+ me->CastSpell(me->getVictim(), spellId, triggered);
+}
+
+void UnitAI::DoCastAOE(uint32 spellId, bool triggered)
+{
+ if (!triggered && me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ me->CastSpell((Unit*)NULL, spellId, triggered);
+}
+
#define UPDATE_TARGET(a) {if (AIInfo->target<a) AIInfo->target=a;}
void UnitAI::FillAISpellInfo()
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp
index 8491a055516..427818fe571 100644
--- a/src/server/game/AI/CreatureAI.cpp
+++ b/src/server/game/AI/CreatureAI.cpp
@@ -174,3 +174,91 @@ void CreatureAI::EnterEvadeMode()
if (!me->getVictim())
AttackStart(attacker);
}*/
+
+void CreatureAI::SetGazeOn(Unit* target)
+{
+ if (me->IsValidAttackTarget(target))
+ {
+ AttackStart(target);
+ me->SetReactState(REACT_PASSIVE);
+ }
+}
+
+bool CreatureAI::UpdateVictimWithGaze()
+{
+ if (!me->isInCombat())
+ return false;
+
+ if (me->HasReactState(REACT_PASSIVE))
+ {
+ if (me->getVictim())
+ return true;
+ else
+ me->SetReactState(REACT_AGGRESSIVE);
+ }
+
+ if (Unit* victim = me->SelectVictim())
+ AttackStart(victim);
+ return me->getVictim();
+}
+
+bool CreatureAI::UpdateVictim()
+{
+ if (!me->isInCombat())
+ return false;
+
+ if (!me->HasReactState(REACT_PASSIVE))
+ {
+ if (Unit* victim = me->SelectVictim())
+ AttackStart(victim);
+ return me->getVictim();
+ }
+ else if (me->getThreatManager().isThreatListEmpty())
+ {
+ EnterEvadeMode();
+ return false;
+ }
+
+ return true;
+}
+
+bool CreatureAI::_EnterEvadeMode()
+{
+ if (!me->isAlive())
+ return false;
+
+ // dont remove vehicle auras, passengers arent supposed to drop off the vehicle
+ me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE);
+
+ // sometimes bosses stuck in combat?
+ me->DeleteThreatList();
+ me->CombatStop(true);
+ me->LoadCreaturesAddon();
+ me->SetLootRecipient(NULL);
+ me->ResetPlayerDamageReq();
+
+ if (me->IsInEvadeMode())
+ return false;
+
+ return true;
+}
+
+Creature* CreatureAI::DoSummon(uint32 entry, const Position& pos, uint32 despawnTime, TempSummonType summonType)
+{
+ return me->SummonCreature(entry, pos, summonType, despawnTime);
+}
+
+Creature* CreatureAI::DoSummon(uint32 entry, WorldObject* obj, float radius, uint32 despawnTime, TempSummonType summonType)
+{
+ Position pos;
+ obj->GetRandomNearPosition(pos, radius);
+ return me->SummonCreature(entry, pos, summonType, despawnTime);
+}
+
+Creature* CreatureAI::DoSummonFlyer(uint32 entry, WorldObject* obj, float flightZ, float radius, uint32 despawnTime, TempSummonType summonType)
+{
+ Position pos;
+ obj->GetRandomNearPosition(pos, radius);
+ pos.m_positionZ += flightZ;
+ return me->SummonCreature(entry, pos, summonType, despawnTime);
+}
diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h
index f3e32b6033d..559240c4a3f 100644
--- a/src/server/game/AI/CreatureAIImpl.h
+++ b/src/server/game/AI/CreatureAIImpl.h
@@ -540,115 +540,5 @@ struct AISpellInfoType
AISpellInfoType* GetAISpellInfo(uint32 i);
-inline void CreatureAI::SetGazeOn(Unit* target)
-{
- if (me->IsValidAttackTarget(target))
- {
- AttackStart(target);
- me->SetReactState(REACT_PASSIVE);
- }
-}
-
-inline bool CreatureAI::UpdateVictimWithGaze()
-{
- if (!me->isInCombat())
- return false;
-
- if (me->HasReactState(REACT_PASSIVE))
- {
- if (me->getVictim())
- return true;
- else
- me->SetReactState(REACT_AGGRESSIVE);
- }
-
- if (Unit* victim = me->SelectVictim())
- AttackStart(victim);
- return me->getVictim();
-}
-
-inline bool CreatureAI::UpdateVictim()
-{
- if (!me->isInCombat())
- return false;
-
- if (!me->HasReactState(REACT_PASSIVE))
- {
- if (Unit* victim = me->SelectVictim())
- AttackStart(victim);
- return me->getVictim();
- }
- else if (me->getThreatManager().isThreatListEmpty())
- {
- EnterEvadeMode();
- return false;
- }
-
- return true;
-}
-
-inline bool CreatureAI::_EnterEvadeMode()
-{
- if (!me->isAlive())
- return false;
-
- // dont remove vehicle auras, passengers arent supposed to drop off the vehicle
- me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE);
-
- // sometimes bosses stuck in combat?
- me->DeleteThreatList();
- me->CombatStop(true);
- me->LoadCreaturesAddon();
- me->SetLootRecipient(NULL);
- me->ResetPlayerDamageReq();
-
- if (me->IsInEvadeMode())
- return false;
-
- return true;
-}
-
-inline void UnitAI::DoCast(Unit* victim, uint32 spellId, bool triggered)
-{
- if (!victim || (me->HasUnitState(UNIT_STATE_CASTING) && !triggered))
- return;
-
- me->CastSpell(victim, spellId, triggered);
-}
-
-inline void UnitAI::DoCastVictim(uint32 spellId, bool triggered)
-{
- // Why don't we check for casting unit_state and existing target as we do in DoCast(.. ?
- me->CastSpell(me->getVictim(), spellId, triggered);
-}
-
-inline void UnitAI::DoCastAOE(uint32 spellId, bool triggered)
-{
- if (!triggered && me->HasUnitState(UNIT_STATE_CASTING))
- return;
-
- me->CastSpell((Unit*)NULL, spellId, triggered);
-}
-
-inline Creature* CreatureAI::DoSummon(uint32 entry, const Position& pos, uint32 despawnTime, TempSummonType summonType)
-{
- return me->SummonCreature(entry, pos, summonType, despawnTime);
-}
-
-inline Creature* CreatureAI::DoSummon(uint32 entry, WorldObject* obj, float radius, uint32 despawnTime, TempSummonType summonType)
-{
- Position pos;
- obj->GetRandomNearPosition(pos, radius);
- return me->SummonCreature(entry, pos, summonType, despawnTime);
-}
-
-inline Creature* CreatureAI::DoSummonFlyer(uint32 entry, WorldObject* obj, float flightZ, float radius, uint32 despawnTime, TempSummonType summonType)
-{
- Position pos;
- obj->GetRandomNearPosition(pos, radius);
- pos.m_positionZ += flightZ;
- return me->SummonCreature(entry, pos, summonType, despawnTime);
-}
-
#endif
diff --git a/src/server/game/Entities/Object/ObjectDefines.h b/src/server/game/Entities/Object/ObjectDefines.h
index 647386e0f75..e41716dde36 100644
--- a/src/server/game/Entities/Object/ObjectDefines.h
+++ b/src/server/game/Entities/Object/ObjectDefines.h
@@ -187,13 +187,12 @@ bool IS_GROUP_GUID(uint64 guid)
uint64 MAKE_NEW_GUID(uint32 l, uint32 e, uint32 h)
{
- return uint64(uint64(l) | (uint64(e) << 32) | (uint64(h) << (h == HIGHGUID_CORPSE) ? 48 : 52));
+ return uint64(uint64(l) | (uint64(e) << 24) | (uint64(h) << 48));
}
uint32 GUID_HIPART(uint64 guid)
{
- uint32 t = ((uint64(guid) >> 48) & 0x0000FFFF);
- return (t == HIGHGUID_CORPSE) ? t : ((t >> 4) & 0x00000FFF);
+ return (uint32)((uint64(guid) >> 48) & 0x0000FFFF);
}
uint32 GUID_ENPART(uint64 x)
@@ -205,8 +204,9 @@ uint32 GUID_ENPART(uint64 x)
uint32 GUID_LOPART(uint64 x)
{
- // _GUID_LOPART_3 and _GUID_LOPART_2 were both equal to PAIR64_LOPART
- return PAIR64_LOPART(x);
+ return IsGuidHaveEnPart(x)
+ ? ((uint32)(x & UI64LIT(0x00000000FFFFFFFF)))
+ : ((uint32)(x & UI64LIT(0x0000000000FFFFFF)));
}
bool IsGuidHaveEnPart(uint64 guid)
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 1a2818c9af2..8732d562bc3 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -820,10 +820,10 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar
for (uint32 j = effIndex + 1; j < MAX_SPELL_EFFECTS; ++j)
{
SpellEffectInfo const* effects = GetSpellInfo()->Effects;
- if (effects[effIndex].TargetA.GetTarget() == effects[j].TargetA.GetTarget()
- && effects[effIndex].TargetB.GetTarget() == effects[j].TargetB.GetTarget()
- && effects[effIndex].ImplicitTargetConditions == effects[j].ImplicitTargetConditions
- && effects[effIndex].CalcRadius(m_caster) == effects[j].CalcRadius(m_caster))
+ if (effects[effIndex].TargetA.GetTarget() == effects[j].TargetA.GetTarget() &&
+ effects[effIndex].TargetB.GetTarget() == effects[j].TargetB.GetTarget() &&
+ effects[effIndex].ImplicitTargetConditions == effects[j].ImplicitTargetConditions &&
+ effects[effIndex].CalcRadius(m_caster) == effects[j].CalcRadius(m_caster))
{
effectMask |= 1 << j;
}
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp
index 19b717fa6ea..85a113ec495 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp
@@ -70,9 +70,9 @@ public:
return new boss_vexallusAI (creature);
};
- struct boss_vexallusAI : public ScriptedAI
+ struct boss_vexallusAI : public BossAI
{
- boss_vexallusAI(Creature* creature) : ScriptedAI(creature)
+ boss_vexallusAI(Creature* creature) : BossAI(creature, DATA_VEXALLUS_EVENT)
{
instance = creature->GetInstanceScript();
}
@@ -87,6 +87,7 @@ public:
void Reset()
{
+ summons.DespawnAll();
ChainLightningTimer = 8000;
ArcaneShockTimer = 5000;
OverloadTimer = 1200;
@@ -104,6 +105,7 @@ public:
void JustDied(Unit* /*killer*/)
{
+ summons.DespawnAll();
if (instance)
instance->SetData(DATA_VEXALLUS_EVENT, DONE);
}
@@ -206,7 +208,10 @@ public:
struct mob_pure_energyAI : public ScriptedAI
{
- mob_pure_energyAI(Creature* creature) : ScriptedAI(creature) {}
+ mob_pure_energyAI(Creature* creature) : ScriptedAI(creature)
+ {
+ me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
+ }
void Reset() {}
diff --git a/src/server/shared/Database/PreparedStatement.cpp b/src/server/shared/Database/PreparedStatement.cpp
index 3256c3c9db3..86010e61686 100644
--- a/src/server/shared/Database/PreparedStatement.cpp
+++ b/src/server/shared/Database/PreparedStatement.cpp
@@ -33,7 +33,7 @@ void PreparedStatement::BindParameters()
{
ASSERT (m_stmt);
- uint32 i = 0;
+ uint8 i = 0;
for (; i < statement_data.size(); i++)
{
switch (statement_data[i].type)
@@ -241,7 +241,7 @@ void MySQLPreparedStatement::ClearParameters()
}
}
-static bool ParementerIndexAssertFail(uint32 stmtIndex, uint8 index, uint32 paramCount)
+static bool ParamenterIndexAssertFail(uint32 stmtIndex, uint8 index, uint32 paramCount)
{
sLog->outError(LOG_FILTER_SQL_DRIVER, "Attempted to bind parameter %u%s on a PreparedStatement %u (statement has only %u parameters)", uint32(index) + 1, (index == 1 ? "st" : (index == 2 ? "nd" : (index == 3 ? "rd" : "nd"))), stmtIndex, paramCount);
return false;
@@ -250,7 +250,7 @@ static bool ParementerIndexAssertFail(uint32 stmtIndex, uint8 index, uint32 para
//- Bind on mysql level
bool MySQLPreparedStatement::CheckValidIndex(uint8 index)
{
- ASSERT(index < m_paramCount || ParementerIndexAssertFail(m_stmt->m_index, index, m_paramCount));
+ ASSERT(index < m_paramCount || ParamenterIndexAssertFail(m_stmt->m_index, index, m_paramCount));
if (m_paramsSet[index])
sLog->outWarn(LOG_FILTER_SQL, "[WARNING] Prepared Statement (id: %u) trying to bind value on already bound index (%u).", m_stmt->m_index, index);
@@ -386,7 +386,7 @@ void MySQLPreparedStatement::setValue(MYSQL_BIND* param, enum_field_types type,
memcpy(param->buffer, value, len);
}
-std::string MySQLPreparedStatement::getQueryString(std::string const &sqlPattern) const
+std::string MySQLPreparedStatement::getQueryString(std::string const& sqlPattern) const
{
std::string queryString = sqlPattern;
diff --git a/src/server/shared/Database/PreparedStatement.h b/src/server/shared/Database/PreparedStatement.h
index 9334bc6dc66..2cab6e40de0 100644
--- a/src/server/shared/Database/PreparedStatement.h
+++ b/src/server/shared/Database/PreparedStatement.h
@@ -135,7 +135,7 @@ class MySQLPreparedStatement
PreparedStatement* m_stmt;
void ClearParameters();
bool CheckValidIndex(uint8 index);
- std::string getQueryString(std::string const &sqlPattern) const;
+ std::string getQueryString(std::string const& sqlPattern) const;
private:
void setValue(MYSQL_BIND* param, enum_field_types type, const void* value, uint32 len, bool isUnsigned);