From 73ec2d50fab29032ec3ed3a5e9a0e497e97e5716 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 8 Apr 2009 12:36:01 -0500 Subject: *Only clear spellcontainer when current spell is cancelled spell. --HG-- branch : trunk --- src/game/Spell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index e8a5724dfb0..4396c2f94f1 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2134,7 +2134,7 @@ void Spell::cancel() return; SetReferencedFromCurrent(false); - if(m_selfContainer) + if(m_selfContainer && *m_selfContainer == this) *m_selfContainer = NULL; uint32 oldState = m_spellState; -- cgit v1.2.3 From 0c2dd85c2c79dbeca289b8d420e573efe41cbc0b Mon Sep 17 00:00:00 2001 From: Rat Date: Wed, 8 Apr 2009 19:55:47 +0200 Subject: *fix Jaina stucking bug after evade *small fixes to retreat events (spell visuals) --HG-- branch : trunk --- src/bindings/scripts/scripts/npc/npc_escortAI.h | 1 + .../scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp | 55 +++++++++++++++++++--- .../scripts/zone/caverns_of_time/hyjal/hyjalAI.h | 11 +++-- 3 files changed, 58 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/bindings/scripts/scripts/npc/npc_escortAI.h b/src/bindings/scripts/scripts/npc/npc_escortAI.h index 79365f7129b..a2ec7fc50ed 100644 --- a/src/bindings/scripts/scripts/npc/npc_escortAI.h +++ b/src/bindings/scripts/scripts/npc/npc_escortAI.h @@ -66,6 +66,7 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI void SetCanMelee(bool usemelee) { CanMelee = usemelee; } void SetDespawnAtEnd(bool despawn) { DespawnAtEnd = despawn; } void SetDespawnAtFar(bool despawn) { DespawnAtFar = despawn; } + bool GetAttack() { return Attack; }//used in EnterEvadeMode override // EscortAI variables protected: diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp index c3b23b69080..582cab0e290 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp @@ -299,6 +299,8 @@ hyjalAI::hyjalAI(Creature *c) : npc_escortAI(c), Summons(m_creature) RespawnTimer = 10000; DoRespawn = false; DoHide = false; + MassTeleportTimer = 0; + DoMassTeleport = false; } void hyjalAI::JustSummoned(Creature *summoned) @@ -388,7 +390,8 @@ void hyjalAI::Reset() void hyjalAI::EnterEvadeMode() { m_creature->InterruptNonMeleeSpells(true); - m_creature->RemoveAllAuras(); + if(m_creature->GetEntry() != JAINA) + m_creature->RemoveAllAuras(); m_creature->DeleteThreatList(); m_creature->CombatStop(); m_creature->LoadCreaturesAddon(); @@ -403,6 +406,7 @@ void hyjalAI::EnterEvadeMode() void hyjalAI::Aggro(Unit *who) { + if(IsDummy)return; for(uint8 i = 0; i < 2; ++i) if(Spell[i].Cooldown) SpellTimer[i] = Spell[i].Cooldown; @@ -410,6 +414,18 @@ void hyjalAI::Aggro(Unit *who) Talk(ATTACKED); } +void hyjalAI::MoveInLineOfSight(Unit *who) +{ + if(IsDummy)return; + if (IsBeingEscorted && !GetAttack()) + return; + + if(m_creature->getVictim() || !m_creature->canStartAttack(who)) + return; + + AttackStart(who); +} + void hyjalAI::SummonCreature(uint32 entry, float Base[4][3]) { uint32 random = rand()%4; @@ -682,7 +698,9 @@ void hyjalAI::Retreat() { JainaDummy->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); ((hyjalAI*)JainaDummy->AI())->IsDummy = true; - JainaDummy->CastSpell(JainaDummy, SPELL_TELEPORT_VISUAL, true); + DummyGuid = JainaDummy->GetGUID(); + //((hyjalAI*)JainaDummy->AI())->MassTeleportTimer = 20000; + //((hyjalAI*)JainaDummy->AI())->DoMassTeleport = true; } AddWaypoint(0,JainaDummySpawn[1][0],JainaDummySpawn[1][1],JainaDummySpawn[1][2]); Start(false, false, false); @@ -754,6 +772,11 @@ void hyjalAI::UpdateAI(const uint32 diff) { if(IsDummy) { + if(MassTeleportTimer < diff && DoMassTeleport) + { + m_creature->CastSpell(m_creature,SPELL_MASS_TELEPORT,false); + DoMassTeleport = false; + }else MassTeleportTimer -= diff; return; } if(DoHide) @@ -780,6 +803,9 @@ void hyjalAI::UpdateAI(const uint32 diff) HideNearPos(m_creature->GetPositionX(), m_creature->GetPositionY()); HideNearPos(5563, -2763.19); HideNearPos(5542.2, -2629.36); + for(uint8 i = 0; i < 65; i++)//summon fires + m_creature->SummonGameObject(FLAMEOBJECT,HordeFirePos[i][0],HordeFirePos[i][1],HordeFirePos[i][2],HordeFirePos[i][3],HordeFirePos[i][4],HordeFirePos[i][5],HordeFirePos[i][6],HordeFirePos[i][7],0); + } else m_creature->SetVisibility(VISIBILITY_ON); break; @@ -808,15 +834,16 @@ void hyjalAI::UpdateAI(const uint32 diff) } if(Overrun) DoOverrun(Faction, diff); - if(m_creature->GetEntry() == 17772) + /* if(m_creature->GetEntry() == 17772) { if(!m_creature->HasAura(SPELL_BRILLIANCE_AURA,0)) DoCast(m_creature, SPELL_BRILLIANCE_AURA, true); - } + }*/ if(bRetreat) { if(RetreatTimer < diff) { + IsDummy = true; bRetreat = false; HideNearPos(m_creature->GetPositionX(), m_creature->GetPositionY()); switch(m_creature->GetEntry()) @@ -995,7 +1022,19 @@ void hyjalAI::WaypointReached(uint32 i) { m_creature->Yell("Hurry, we don't have much time",0,0); WaitForTeleport = true; - TeleportTimer = 15000; + TeleportTimer = 20000; + if(m_creature->GetEntry() == JAINA) + m_creature->CastSpell(m_creature,SPELL_MASS_TELEPORT,false); + if(m_creature->GetEntry() == THRALL && DummyGuid) + { + Unit* Dummy = Unit::GetUnit((*m_creature),DummyGuid); + if(Dummy) + { + ((hyjalAI*)((Creature*)Dummy)->AI())->DoMassTeleport = true; + ((hyjalAI*)((Creature*)Dummy)->AI())->MassTeleportTimer = 20000; + Dummy->CastSpell(m_creature,SPELL_MASS_TELEPORT,false); + } + } //do some talking //all alive guards walk near here CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); @@ -1064,6 +1103,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) { (*itr)->CastSpell(*itr, SPELL_TELEPORT_VISUAL, true); (*itr)->setFaction(35);//make them friendly so mobs won't attack them + (*itr)->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } } DoCast(m_creature, SPELL_TELEPORT_VISUAL); @@ -1121,7 +1161,10 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) } } break; - case 1://horde + case 1://horde + for(uint8 i = 0; i < 65; i++)//summon fires + m_creature->SummonGameObject(FLAMEOBJECT,HordeFirePos[i][0],HordeFirePos[i][1],HordeFirePos[i][2],HordeFirePos[i][3],HordeFirePos[i][4],HordeFirePos[i][5],HordeFirePos[i][6],HordeFirePos[i][7],0); + break; } } \ No newline at end of file diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h index d54fe2fb1a8..ba74c248707 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h @@ -28,7 +28,7 @@ #define TYRANDE 17948 #define ANCIENT_VEIN 185557 -#define FLAMEOBJECT 182592 +#define FLAMEOBJECT 182592 // Bosses summoned after every 8 waves #define RAGE_WINTERCHILL 17767 @@ -37,10 +37,11 @@ #define AZGALOR 17842 #define ARCHIMONDE 17968 -#define SPELL_TELEPORT_VISUAL 41232 +#define SPELL_TELEPORT_VISUAL 41232 +#define SPELL_MASS_TELEPORT 16807 //Spells for Jaina -#define SPELL_BRILLIANCE_AURA 31260 // The database must handle this spell via creature_addon +#define SPELL_BRILLIANCE_AURA 31260 // The database must handle this spell via creature_addon(it should, but is removed in evade..) #define SPELL_BLIZZARD 31266 #define SPELL_PYROBLAST 31263 #define SPELL_SUMMON_ELEMENTALS 31264 @@ -185,6 +186,7 @@ struct TRINITY_DLL_DECL hyjalAI : public npc_escortAI void RespawnNearPos(float x, float y); void WaypointReached(uint32 i); void DoOverrun(uint32 faction, const uint32 diff); + void MoveInLineOfSight(Unit *who); void SummonCreature(uint32 entry, float Base[4][3]); // Summons a creature for that wave in that base @@ -232,6 +234,9 @@ struct TRINITY_DLL_DECL hyjalAI : public npc_escortAI bool DoRespawn; bool DoHide; bool IsDummy; + uint32 MassTeleportTimer; + bool DoMassTeleport; + uint64 DummyGuid; struct Spell { -- cgit v1.2.3 From a7e04a252fc04988dea2072241ad8825db747e58 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 8 Apr 2009 17:23:57 -0500 Subject: *Add unit to notify when unit is add to world (including load grid case). *Add some check in remove object function. --HG-- branch : trunk --- src/game/BattleGround.cpp | 2 +- src/game/Map.cpp | 4 ++-- src/game/Object.cpp | 6 +++++- src/game/Unit.cpp | 15 ++++++++++----- 4 files changed, 18 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 6849a9ca90c..2538bd3434e 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -1216,7 +1216,7 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float data.go_state = 1; */ // add to world, so it can be later looked up from HashMapHolder - go->AddToWorld(); + map->Add(go); m_BgObjects[type] = go->GetGUID(); return true; } diff --git a/src/game/Map.cpp b/src/game/Map.cpp index fbe4f32d5b1..b7e0fd59f61 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -485,7 +485,7 @@ bool Map::Add(Player *player) SendInitTransports(player); player->m_clientGUIDs.clear(); - AddNotifier(player); + //AddNotifier(player); return true; } @@ -523,7 +523,7 @@ Map::Add(T *obj) UpdateObjectVisibility(obj,cell,p); - AddNotifier(obj); + //AddNotifier(obj); } void Map::MessageBroadcast(Player *player, WorldPacket *msg, bool to_self, bool to_possessor) diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 4159f05d4b8..4a485f9c489 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -97,6 +97,8 @@ Object::~Object( ) //DEBUG_LOG("Object desctr 1 check (%p)",(void*)this); delete [] m_uint32Values; delete [] m_uint32Values_mirror; + m_uint32Values = NULL; + m_uint32Values_mirror = NULL; //DEBUG_LOG("Object desctr 2 check (%p)",(void*)this); } } @@ -1567,7 +1569,9 @@ Map const* WorldObject::GetBaseMap() const void WorldObject::AddObjectToRemoveList() { - Map* map = MapManager::Instance().FindMap(GetMapId(), GetInstanceId()); + assert(m_uint32Values); + + Map* map = FindMap(); if(!map) { sLog.outError("Object (TypeId: %u Entry: %u GUID: %u) at attempt add to move list not have valid map (Id: %u).",GetTypeId(),GetEntry(),GetGUIDLow(),GetMapId()); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index fb0aee82654..beabc0e8668 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -66,11 +66,6 @@ float baseMoveSpeed[MAX_MOVE_TYPE] = void InitTriggerAuraData(); -void Unit::AddToWorld() -{ - WorldObject::AddToWorld(); -} - // auraTypes contains attacker auras capable of proc'ing cast auras static Unit::AuraTypeSet GenerateAttakerProcCastAuraTypes() { @@ -10853,6 +10848,16 @@ uint32 Unit::GetCreatePowers( Powers power ) const return 0; } +void Unit::AddToWorld() +{ + if(!IsInWorld()) + { + m_Notified = false; + m_IsInNotifyList = false; + SetToNotify(); + } +} + void Unit::RemoveFromWorld() { // cleanup -- cgit v1.2.3