diff options
Diffstat (limited to 'src')
26 files changed, 288 insertions, 265 deletions
diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp index d18a65f66f5..fdc0483c809 100644 --- a/src/bindings/scripts/include/sc_creature.cpp +++ b/src/bindings/scripts/include/sc_creature.cpp @@ -761,21 +761,25 @@ void ScriptedAI::DoTeleportAll(float x, float y, float z, float o) i_pl->TeleportTo(m_creature->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT); } -Unit* ScriptedAI::FindCreature(uint32 entry, float range) -{ +Unit* FindCreature(uint32 entry, float range, Unit* Finder) +{ + if(!Finder) + return NULL; Creature* target = NULL; - Trinity::AllCreaturesOfEntryInRange check(m_creature, entry, range); + Trinity::AllCreaturesOfEntryInRange check(Finder, entry, range); Trinity::CreatureSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(target, check); - m_creature->VisitNearbyObject(range, searcher); + Finder->VisitNearbyObject(range, searcher); return target; } -GameObject* ScriptedAI::FindGameObject(uint32 entry, float range) +GameObject* FindGameObject(uint32 entry, float range, Unit* Finder) { + if(!Finder) + return NULL; GameObject* target = NULL; Trinity::AllGameObjectsWithEntryInGrid go_check(entry); Trinity::GameObjectSearcher<Trinity::AllGameObjectsWithEntryInGrid> searcher(target, go_check); - m_creature->VisitNearbyGridObject(range, searcher); + Finder->VisitNearbyGridObject(range, searcher); return target; } diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h index cf991baa301..6f60f8cf334 100644 --- a/src/bindings/scripts/include/sc_creature.h +++ b/src/bindings/scripts/include/sc_creature.h @@ -25,6 +25,12 @@ private: Creature *m_creature; }; +//Get a single creature of given entry +Unit* FindCreature(uint32 entry, float range, Unit* Finder); + +//Get a single gameobject of given entry +GameObject* FindGameObject(uint32 entry, float range, Unit* Finder); + struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI { ScriptedAI(Creature* creature) : m_creature(creature), InCombat(false), IsFleeing(false) {} @@ -153,12 +159,6 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI void DoTeleportPlayer(Unit* pUnit, float x, float y, float z, float o); void DoTeleportAll(float x, float y, float z, float o); - //Get a single creature of given entry - Unit* FindCreature(uint32 entry, float range); - - //Get a single gameobject of given entry - GameObject* FindGameObject(uint32 entry, float range); - //Returns friendly unit with the most amount of hp missing from max hp Unit* DoSelectLowestHpFriendly(float range, uint32 MinHPDiff = 1); diff --git a/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp b/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp index 85ce5ea0bea..fcbb931cf06 100644 --- a/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp +++ b/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp @@ -202,7 +202,7 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI { case 0: { m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - GameObject* Cage = FindGameObject(GO_CAGE, 99); + GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature); if(Cage) Cage->SetGoState(0); break;} @@ -232,7 +232,7 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI if (!IsBeingEscorted) m_creature->setFaction(1602); - GameObject* Cage = FindGameObject(GO_CAGE, 99); + GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature); if(Cage) Cage->SetGoState(1); } diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp index 440f233bccf..5f4eae9fbfe 100644 --- a/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp +++ b/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp @@ -241,7 +241,7 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI { DoCast(m_creature->getVictim(),SPELL_ARCANE_BOLT); ArcaneBolt_Timer = 2000 + rand()%2500; - Unit *shaffar = FindCreature(ENTRY_SHAFFAR, 100); + Unit *shaffar = FindCreature(ENTRY_SHAFFAR, 100, m_creature); if(!shaffar || shaffar->isDead()) { m_creature->SetVisibility(VISIBILITY_OFF); diff --git a/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp b/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp index d7049a3b0f4..238918ed973 100644 --- a/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp +++ b/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp @@ -427,7 +427,7 @@ struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI case 10: DoScriptText(SAY_PROGRESS_3, m_creature, player); m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; case 20:{ - Unit* Mercenary = FindCreature(MOB_MERCENARY, 99); + Unit* Mercenary = FindCreature(MOB_MERCENARY, 99, m_creature); if(Mercenary) { DoScriptText(SAY_MERCENARY_4, Mercenary); diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp index 0372bf6ea61..348d21c4959 100644 --- a/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp +++ b/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp @@ -153,7 +153,7 @@ struct TRINITY_DLL_DECL boss_reliquary_of_soulsAI : public ScriptedAI Phase = 0; m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,0); + m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); } void Aggro(Unit* who) @@ -227,18 +227,18 @@ struct TRINITY_DLL_DECL boss_reliquary_of_soulsAI : public ScriptedAI switch(Counter) { case 0: - m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,375); // I R ANNNGRRRY! + m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); // I R ANNNGRRRY! Timer = 3000; break; case 1: Timer = 2800; - m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,374); // Release the cube + m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_SUBMERGE); // Release the cube break; case 2: Timer = 5000; if(Creature* Summon = DoSpawnCreature(23417+Phase, 0, 0, 0, 0, TEMPSUMMON_DEAD_DESPAWN, 0)) { - m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,373); // Ribs: open + m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_SUBMERGED); // Ribs: open Summon->AI()->AttackStart(SelectUnit(SELECT_TARGET_TOPAGGRO, 0)); EssenceGUID = Summon->GetGUID(); }else EnterEvadeMode(); @@ -263,7 +263,7 @@ struct TRINITY_DLL_DECL boss_reliquary_of_soulsAI : public ScriptedAI case 4: Timer = 1500; if(Essence->IsWithinDistInMap(m_creature, 10)) - Essence->SetUInt32Value(UNIT_NPC_EMOTESTATE, 374); //rotate and disappear + Essence->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_SUBMERGE); //rotate and disappear else return; break; @@ -420,7 +420,7 @@ struct TRINITY_DLL_DECL boss_essence_of_sufferingAI : public ScriptedAI if(SoulDrainTimer < diff) { - DoCast(m_creature, SPELL_SOUL_DRAIN); + DoCast(m_creature->getVictim(), SPELL_SOUL_DRAIN); SoulDrainTimer = 60000; }else SoulDrainTimer -= diff; diff --git a/src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp b/src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp index fba1ed20c72..116c08d4b0a 100644 --- a/src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp +++ b/src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp @@ -64,11 +64,11 @@ CreatureAI* GetAI_mobs_bladespire_ogre(Creature *_Creature) ## mobs_nether_drake ######*/ -#define SAY_NIHIL_1 "Muahahahaha! You fool! You've released me from my banishment in the interstices between space and time!" -#define SAY_NIHIL_2 "All of Draenor shall quick beneath my feet! I will destroy this world and reshape it in my image!" -#define SAY_NIHIL_3 "Where shall I begin? I cannot bother myself with a worm such as yourself. There is a world to be conquered!" -#define SAY_NIHIL_4 "No doubt the fools that banished me are long dead. I shall take wing survey my demense. Pray to whatever gods you hold dear that we do not meet again." -#define SAY_NIHIL_INTERRUPT "NOOOOooooooo!" +#define SAY_NIHIL_1 -1000396 +#define SAY_NIHIL_2 -1000397 +#define SAY_NIHIL_3 -1000398 +#define SAY_NIHIL_4 -1000399 +#define SAY_NIHIL_INTERRUPT -1000400 #define ENTRY_WHELP 20021 #define ENTRY_PROTO 21821 @@ -156,7 +156,7 @@ struct TRINITY_DLL_DECL mobs_nether_drakeAI : public ScriptedAI case ENTRY_NIHIL: if( NihilSpeech_Phase ) { - DoYell(SAY_NIHIL_INTERRUPT,LANG_UNIVERSAL,NULL); + DoScriptText(SAY_NIHIL_INTERRUPT, m_creature); IsNihil = false; switch(rand()%3) { @@ -196,19 +196,19 @@ struct TRINITY_DLL_DECL mobs_nether_drakeAI : public ScriptedAI switch( NihilSpeech_Phase ) { case 1: - DoSay(SAY_NIHIL_1,LANG_UNIVERSAL,NULL); + DoScriptText(SAY_NIHIL_1, m_creature); ++NihilSpeech_Phase; break; case 2: - DoSay(SAY_NIHIL_2,LANG_UNIVERSAL,NULL); + DoScriptText(SAY_NIHIL_2, m_creature); ++NihilSpeech_Phase; break; case 3: - DoSay(SAY_NIHIL_3,LANG_UNIVERSAL,NULL); + DoScriptText(SAY_NIHIL_3, m_creature); ++NihilSpeech_Phase; break; case 4: - DoSay(SAY_NIHIL_4,LANG_UNIVERSAL,NULL); + DoScriptText(SAY_NIHIL_4, m_creature); ++NihilSpeech_Phase; break; case 5: @@ -261,6 +261,8 @@ CreatureAI* GetAI_mobs_nether_drake(Creature *_Creature) ## npc_daranelle ######*/ +#define SAY_DARANELLE -1000401 + struct TRINITY_DLL_DECL npc_daranelleAI : public ScriptedAI { npc_daranelleAI(Creature *c) : ScriptedAI(c) {Reset();} @@ -279,7 +281,7 @@ struct TRINITY_DLL_DECL npc_daranelleAI : public ScriptedAI { if(who->HasAura(36904,0)) { - DoSay("Good $N, you are under the spell's influence. I must analyze it quickly, then we can talk.",LANG_COMMON,who); + DoScriptText(SAY_DARANELLE, m_creature, who); //TODO: Move the below to updateAI and run if this statement == true ((Player*)who)->KilledMonster(21511, m_creature->GetGUID()); ((Player*)who)->RemoveAurasDueToSpell(36904); @@ -299,10 +301,12 @@ CreatureAI* GetAI_npc_daranelle(Creature *_Creature) ## npc_overseer_nuaar ######*/ +#define GOSSIP_HON "Overseer, I am here to negotiate on behalf of the Cenarion Expedition." + bool GossipHello_npc_overseer_nuaar(Player *player, Creature *_Creature) { if (player->GetQuestStatus(10682) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, "Overseer, I am here to negotiate on behalf of the Cenarion Expedition.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(10532, _Creature->GetGUID()); @@ -323,10 +327,13 @@ bool GossipSelect_npc_overseer_nuaar(Player *player, Creature *_Creature, uint32 ## npc_saikkal_the_elder ######*/ +#define GOSSIP_HSTE "Yes... yes, it's me." +#define GOSSIP_SSTE "Yes elder. Tell me more of the book." + bool GossipHello_npc_saikkal_the_elder(Player *player, Creature *_Creature) { if (player->GetQuestStatus(10980) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, "Yes... yes, it's me.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HSTE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(10794, _Creature->GetGUID()); @@ -338,7 +345,7 @@ bool GossipSelect_npc_saikkal_the_elder(Player *player, Creature *_Creature, uin switch (action) { case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM( 0, "Yes elder. Tell me more of the book.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SSTE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); player->SEND_GOSSIP_MENU(10795, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+2: diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/def_hyjal.h b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/def_hyjal.h index 1e28156857f..164d26223b9 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/def_hyjal.h +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/def_hyjal.h @@ -5,6 +5,10 @@ #ifndef DEF_HYJAL_H #define DEF_HYJAL_H +#define WORLD_STATE_WAVES 2842 +#define WORLD_STATE_ENEMY 2453 +#define WORLD_STATE_ENEMYCOUNT 2454 + #define DATA_ANETHERON 1 #define DATA_ANETHERONEVENT 2 #define DATA_ARCHIMONDE 3 @@ -21,5 +25,5 @@ #define DATA_TRASH 14 #define DATA_RESET_TRASH_COUNT 15 -#define ERROR_INST_DATA "SD2: Instance data not set properly for Mount Hyjal. Encounters will be buggy" +#define ERROR_INST_DATA "TSCR: Instance data not set properly for Mount Hyjal. Encounters will be buggy" #endif 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 cbb8ce53b91..4e4734f817a 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 @@ -17,13 +17,12 @@ /* ScriptData SDName: HyjalAI SD%Complete: 90 -SDComment: World Packet workaround for World States +SDComment: SDCategory: Caverns of Time, Mount Hyjal EndScriptData */ #include "precompiled.h" #include "hyjalAI.h" -#include "WorldPacket.h" // Locations for summoning waves in Alliance base float AllianceBase[4][3]= @@ -99,9 +98,9 @@ void hyjalAI::Reset() memset(Spell, 0, sizeof(Spell)); //Reset World States - UpdateWorldState(WORLDSTATE_WAVES, 0); - UpdateWorldState(WORLDSTATE_ENEMY, 0); - UpdateWorldState(WORLDSTATE_ENEMYCOUNT, 0); + UpdateWorldState(WORLD_STATE_WAVES, 0); + UpdateWorldState(WORLD_STATE_ENEMY, 0); + UpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0); //Reset Instance Data for trash count if(pInstance) @@ -204,22 +203,24 @@ void hyjalAI::SummonNextWave(Wave wave[18], uint32 Count, float Base[4][3]) uint32 stateValue = Count+1; if(FirstBossDead) stateValue -= 9; // Subtract 9 from it to give the proper wave number if we are greater than 8 - UpdateWorldState(WORLDSTATE_WAVES, stateValue); // Set world state to our current wave number - UpdateWorldState(WORLDSTATE_ENEMY, 1); - //UpdateWorldState(WORLDSTATE_ENEMYCOUNT, EnemyCount); // Let Instance Script handle this - pInstance->SetData(DATA_TRASH, EnemyCount); + UpdateWorldState(WORLD_STATE_WAVES, stateValue); // Set world state to our current wave number + UpdateWorldState(WORLD_STATE_ENEMY, 1); // Enable world state + + pInstance->SetData(DATA_TRASH, EnemyCount); // Send data for instance script to update count + if(!Debug) NextWaveTimer = wave[Count].WaveTimer; else { NextWaveTimer = 15000; - DoTextEmote(": Debug Mode is enabled. Next Wave in 15 seconds", NULL); + debug_log("TSCR: HyjalAI: debug mode is enabled. Next Wave in 15 seconds"); } } else { - UpdateWorldState(WORLDSTATE_WAVES, 0); // Set world state for waves to 0 to disable it. - UpdateWorldState(WORLDSTATE_ENEMYCOUNT, 1); // Set World State for enemies invading to 1. + UpdateWorldState(WORLD_STATE_WAVES, 0); // Set world state for waves to 0 to disable it. + UpdateWorldState(WORLD_STATE_ENEMY, 1); + UpdateWorldState(WORLD_STATE_ENEMYCOUNT, 1); // Set World State for enemies invading to 1. Summon = false; } CheckTimer = 5000; @@ -241,9 +242,9 @@ void hyjalAI::StartEvent(Player* player) m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - UpdateWorldState(WORLDSTATE_WAVES, 0); - UpdateWorldState(WORLDSTATE_ENEMY, 0); - UpdateWorldState(WORLDSTATE_ENEMYCOUNT, 0); + UpdateWorldState(WORLD_STATE_WAVES, 0); + UpdateWorldState(WORLD_STATE_ENEMY, 0); + UpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0); } uint32 hyjalAI::GetInstanceData(uint32 Event) @@ -291,20 +292,25 @@ void hyjalAI::Talk(uint32 id) DoScriptText(YellId, m_creature); } -// Slight workaround for now -void hyjalAI::UpdateWorldState(uint32 field, uint32 value) +void hyjalAI::UpdateWorldState(uint32 id, uint32 state) { Map * map = m_creature->GetMap(); - if(!map->IsDungeon()) return; - - WorldPacket data(SMSG_UPDATE_WORLD_STATE, 8); - - data << field; - data << value; + + if(!map->IsDungeon()) + return; - map->SendToPlayers(&data); + Map::PlayerList const& players = map->GetPlayers(); + + if (!players.isEmpty()) + { + for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* player = itr->getSource()) + player->SendUpdateWorldState(id,state); + } + }else debug_log("TSCR: HyjalAI: UpdateWorldState, but PlayerList is empty"); - // TODO: Uncomment and remove everything above this line only when the core patch for this is accepted + //remove everything above this line only when/if the core patch for this is accepted and needed //m_creature->GetMap()->UpdateWorldState(field, value); } @@ -420,7 +426,7 @@ void hyjalAI::UpdateAI(const uint32 diff) CheckTimer = 0; m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); BossGUID[i] = 0; - UpdateWorldState(WORLDSTATE_ENEMY, 0); // Reset world state for enemies to disable it + UpdateWorldState(WORLD_STATE_ENEMY, 0); // Reset world state for enemies to disable it } } } 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 b89290cd875..0c638385e78 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 @@ -27,10 +27,6 @@ #define SPELL_TELEPORT_VISUAL 41232 -#define WORLDSTATE_WAVES 2842 -#define WORLDSTATE_ENEMY 2453 -#define WORLDSTATE_ENEMYCOUNT 2454 - //Spells for Jaina #define SPELL_BRILLIANCE_AURA 31260 // The database must handle this spell via creature_addon #define SPELL_BLIZZARD 31266 diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp index 92c17f655a3..1d67582927b 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp @@ -23,7 +23,6 @@ EndScriptData */ #include "precompiled.h" #include "def_hyjal.h" -#include "WorldPacket.h" #define ENCOUNTERS 5 @@ -121,7 +120,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance case DATA_TRASH: if(data) Trash = data; else Trash--; - UpdateWorldState(2453, data); + UpdateWorldState(WORLD_STATE_ENEMYCOUNT, Trash); break; } @@ -145,13 +144,18 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance return 0; } - void UpdateWorldState(uint32 field, uint32 value) + void UpdateWorldState(uint32 id, uint32 state) { - WorldPacket data(SMSG_UPDATE_WORLD_STATE, 8); - data << field; - data << value; - - instance->SendToPlayers(&data); + Map::PlayerList const& players = instance->GetPlayers(); + + if (!players.isEmpty()) + { + for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* player = itr->getSource()) + player->SendUpdateWorldState(id,state); + } + }else debug_log("TSCR: Instance Hyjal: UpdateWorldState, but PlayerList is empty!"); } const char* Save() diff --git a/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp b/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp index cf0bce15bae..ecbd37abf2e 100644 --- a/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp +++ b/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp @@ -165,7 +165,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI case 0: { m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - GameObject* Cage = FindGameObject(GO_CAGE, 99); + GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature); if(Cage) Cage->SetGoState(0); DoScriptText(SAY_START, m_creature, player); @@ -200,7 +200,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI case 33: m_creature->SetOrientation(5.858011); DoScriptText(SAY_END2, m_creature, player); - Unit* CaptainHelios = FindCreature(NPC_CAPTAIN_HELIOS, 50); + Unit* CaptainHelios = FindCreature(NPC_CAPTAIN_HELIOS, 50, m_creature); if(CaptainHelios) DoScriptText(SAY_CAPTAIN_ANSWER, CaptainHelios, player); break; @@ -214,7 +214,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI if (!IsBeingEscorted) m_creature->setFaction(1602); - GameObject* Cage = FindGameObject(GO_CAGE, 99); + GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature); if(Cage) Cage->SetGoState(1); } diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp index 94a75db6149..1a01cdab769 100644 --- a/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp +++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp @@ -294,7 +294,7 @@ struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI void Aggro(Unit* who) { - if(Creature *Kelidan = (Creature *)FindCreature(ENTRY_KELIDAN, 100)) + if(Creature *Kelidan = (Creature *)FindCreature(ENTRY_KELIDAN, 100, m_creature)) ((boss_kelidan_the_breakerAI*)Kelidan->AI())->ChannelerEngaged(who); if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(true); @@ -303,7 +303,7 @@ struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI void JustDied(Unit* Killer) { - if(Creature *Kelidan = (Creature *)FindCreature(ENTRY_KELIDAN, 100)) + if(Creature *Kelidan = (Creature *)FindCreature(ENTRY_KELIDAN, 100, m_creature)) ((boss_kelidan_the_breakerAI*)Kelidan->AI())->ChannelerDied(Killer); } @@ -314,7 +314,7 @@ struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI if(check_Timer < diff) { if (!m_creature->IsNonMeleeSpellCasted(false)) - if(Creature *Kelidan = (Creature *)FindCreature(ENTRY_KELIDAN, 100)) + if(Creature *Kelidan = (Creature *)FindCreature(ENTRY_KELIDAN, 100, m_creature)) { uint64 channeler = ((boss_kelidan_the_breakerAI*)Kelidan->AI())->GetChanneled(m_creature); if(Unit *channeled = Unit::GetUnit(*m_creature, channeler)) diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp index a62c4e06217..a89d6d04aa9 100644 --- a/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp +++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp @@ -284,7 +284,7 @@ struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI { Creature *Nazan = (Creature*)Unit::GetUnit(*m_creature, NazanGUID); Creature *Vazruden = (Creature*)Unit::GetUnit(*m_creature, VazrudenGUID); - if(Nazan || (Nazan = (Creature *)FindCreature(ENTRY_NAZAN, 5000))) + if(Nazan || (Nazan = (Creature *)FindCreature(ENTRY_NAZAN, 5000, m_creature))) { Nazan->SetLootRecipient(NULL); Nazan->SetVisibility(VISIBILITY_OFF); @@ -292,7 +292,7 @@ struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI Nazan->RemoveCorpse(); NazanGUID = 0; } - if(Vazruden || (Vazruden = (Creature *)FindCreature(ENTRY_VAZRUDEN, 5000))) + if(Vazruden || (Vazruden = (Creature *)FindCreature(ENTRY_VAZRUDEN, 5000, m_creature))) { Vazruden->SetLootRecipient(NULL); Vazruden->SetVisibility(VISIBILITY_OFF); @@ -424,7 +424,7 @@ struct TRINITY_DLL_DECL mob_hellfire_sentryAI : public ScriptedAI void JustDied(Unit* who) { - if(Creature *herald = (Creature *)FindCreature(ENTRY_VAZRUDEN_HERALD,150)) + if(Creature *herald = (Creature *)FindCreature(ENTRY_VAZRUDEN_HERALD,150, m_creature)) ((boss_vazruden_the_heraldAI *)herald->AI())->SentryDownBy(who); } diff --git a/src/bindings/scripts/scripts/zone/hellfire_peninsula/boss_doomlord_kazzak.cpp b/src/bindings/scripts/scripts/zone/hellfire_peninsula/boss_doomlord_kazzak.cpp index c73fbd22225..1264a72f0cb 100644 --- a/src/bindings/scripts/scripts/zone/hellfire_peninsula/boss_doomlord_kazzak.cpp +++ b/src/bindings/scripts/scripts/zone/hellfire_peninsula/boss_doomlord_kazzak.cpp @@ -23,6 +23,19 @@ EndScriptData */ #include "precompiled.h" +#define SAY_INTRO -1000375 +#define SAY_AGGRO1 -1000376 +#define SAY_AGGRO2 -1000377 +#define SAY_SURPREME1 -1000378 +#define SAY_SURPREME2 -1000379 +#define SAY_KILL1 -1000380 +#define SAY_KILL2 -1000381 +#define SAY_KILL3 -1000382 +#define SAY_DEATH -1000383 +#define EMOTE_FRENZY -1000384 +#define SAY_RAND1 -1000385 +#define SAY_RAND2 -1000386 + #define SPELL_SHADOWVOLLEY 32963 #define SPELL_CLEAVE 31779 #define SPELL_THUNDERCLAP 36706 @@ -55,13 +68,39 @@ struct TRINITY_DLL_DECL boss_doomlordkazzakAI : public ScriptedAI Twisted_Reflection_Timer = 33000; // Timer may be incorrect } - void Aggro(Unit *who) {} + void JustRespawned() + { + DoScriptText(SAY_INTRO, m_creature); + } + + void Aggro(Unit *who) + { + switch(rand()%2) + { + case 0: DoScriptText(SAY_AGGRO1, m_creature); break; + case 1: DoScriptText(SAY_AGGRO2, m_creature); break; + } + } void KilledUnit(Unit* victim) { // When Kazzak kills a player (not pets/totems), he regens some health - if(victim->GetTypeId() == TYPEID_PLAYER) + if (victim->GetTypeId() != TYPEID_PLAYER) + return; + DoCast(m_creature,SPELL_CAPTURESOUL); + + switch(rand()%3) + { + case 0: DoScriptText(SAY_KILL1, m_creature); break; + case 1: DoScriptText(SAY_KILL2, m_creature); break; + case 2: DoScriptText(SAY_KILL3, m_creature); break; + } + } + + void JustDied(Unit *victim) + { + DoScriptText(SAY_DEATH, m_creature); } void UpdateAI(const uint32 diff) @@ -112,6 +151,7 @@ struct TRINITY_DLL_DECL boss_doomlordkazzakAI : public ScriptedAI //Enrage_Timer if (Enrage_Timer < diff) { + DoScriptText(EMOTE_FRENZY, m_creature); DoCast(m_creature,SPELL_ENRAGE); Enrage_Timer = 30000; }else Enrage_Timer -= diff; @@ -126,6 +166,7 @@ struct TRINITY_DLL_DECL boss_doomlordkazzakAI : public ScriptedAI } }; + CreatureAI* GetAI_boss_doomlordkazzak(Creature *_Creature) { return new boss_doomlordkazzakAI (_Creature); diff --git a/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp b/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp index 7cea5685e55..b5fab052181 100644 --- a/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp +++ b/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp @@ -174,7 +174,7 @@ struct TRINITY_DLL_DECL npc_greengill_slaveAI : public ScriptedAI ((Player*)plr)->KilledMonster(25086, m_creature->GetGUID()); } DoCast(m_creature, ENRAGE); - Unit* Myrmidon = FindCreature(DM, 70); + Unit* Myrmidon = FindCreature(DM, 70, m_creature); if(Myrmidon) { m_creature->AddThreat(Myrmidon, 100000.0f); diff --git a/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp b/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp index 1d2760be73c..5b5dd3dabd9 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp @@ -61,9 +61,10 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance uint64 GamesmansExitDoor; // Door after Chess uint64 NetherspaceDoor; // Door at Malchezaar uint64 MastersTerraceDoor[2]; - uint64 ImageGUID; + bool NightbaneSummoned; + void Initialize() { for (uint8 i = 0; i < ENCOUNTERS; ++i) @@ -87,8 +88,9 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance NetherspaceDoor = 0; MastersTerraceDoor[0]= 0; MastersTerraceDoor[1]= 0; - ImageGUID = 0; + + NightbaneSummoned = false; } bool IsEncounterInProgress() const @@ -131,6 +133,9 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance case 17229: KilrekGUID = creature->GetGUID(); break; case 15688: TerestianGUID = creature->GetGUID(); break; case 15687: MoroesGUID = creature->GetGUID(); break; + case 17225: if(NightbaneSummoned)creature->RemoveFromWorld(); + else NightbaneSummoned = true; + break; } } diff --git a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp index eb1da1748a8..9b888365a4e 100644 --- a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp +++ b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp @@ -946,11 +946,11 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI ((Player*)player)->GroupEventHappens(Q_ALMABTRIEB, m_creature); Completed = true; } - {Unit* Thadell = FindCreature(N_THADELL, 30); + {Unit* Thadell = FindCreature(N_THADELL, 30, m_creature); if(Thadell) DoScriptText(SAY_THADELL_1, m_creature);}break; case 13: - {Unit* Thadell = FindCreature(N_THADELL, 30); + {Unit* Thadell = FindCreature(N_THADELL, 30, m_creature); if(Thadell) DoScriptText(SAY_THADELL_2, m_creature, player);}break; } diff --git a/src/bindings/scripts/scripts/zone/shadowmoon_valley/boss_doomwalker.cpp b/src/bindings/scripts/scripts/zone/shadowmoon_valley/boss_doomwalker.cpp index 949d447dcaa..003c7d5bfec 100644 --- a/src/bindings/scripts/scripts/zone/shadowmoon_valley/boss_doomwalker.cpp +++ b/src/bindings/scripts/scripts/zone/shadowmoon_valley/boss_doomwalker.cpp @@ -23,53 +23,31 @@ EndScriptData */ #include "precompiled.h" -//-------------------------------------- -//Spells -#define SPELL_SUNDER_ARMOR 33661 +#define SAY_AGGRO -1000387 +#define SAY_EARTHQUAKE_1 -1000388 +#define SAY_EARTHQUAKE_2 -1000389 +#define SAY_OVERRUN_1 -1000390 +#define SAY_OVERRUN_2 -1000391 +#define SAY_SLAY_1 -1000392 +#define SAY_SLAY_2 -1000393 +#define SAY_SLAY_3 -1000394 +#define SAY_DEATH -1000395 +#define SPELL_EARTHQUAKE 32686 +#define SPELL_SUNDER_ARMOR 33661 #define SPELL_CHAIN_LIGHTNING 33665 - #define SPELL_OVERRUN 32636 -#define SAY_OVERRUN_1 "Trajectory locked." -#define SOUND_OVERRUN_1 11347 -#define SAY_OVERRUN_2 "Engage maximum speed." -#define SOUND_OVERRUN_2 11348 - #define SPELL_ENRAGE 33653 - #define SPELL_MARK_DEATH 37128 -#define SPELL_EARTHQUAKE 32686 -#define SAY_EARTHQUAKE_1 "Tectonic disruption commencing." -#define SOUND_EARTHQUAKE_1 11345 -#define SAY_EARTHQUAKE_2 "Magnitude set. Release." -#define SOUND_EARTHQUAKE_2 11346 -//--------------------------------------- -//Aggro -#define SAY_AGGRO "Do not proceed. You will be eliminated!" -#define SOUND_AGGRO 11344 -//--------------------------------------- -//Slay -#define SAY_SLAY_1 "Threat level zero." -#define SOUND_SLAY_1 11349 -#define SAY_SLAY_2 "Directive accomplished." -#define SOUND_SLAY_2 11350 -#define SAY_SLAY_3 "Target exterminated." -#define SOUND_SLAY_3 11351 -//--------------------------------------- -//Death -#define SAY_DEATH "System failure in five... four..." -#define SOUND_DEATH 11352 - struct TRINITY_DLL_DECL boss_doomwalkerAI : public ScriptedAI { boss_doomwalkerAI(Creature *c) : ScriptedAI(c) {Reset();} - uint32 Chain_Timer; - uint32 Enrage_Timer; + uint32 Enrage_Timer; uint32 Overrun_Timer; - uint32 Quake_Timer; + uint32 Quake_Timer; uint32 Armor_Timer; bool InEnrage; @@ -82,7 +60,7 @@ struct TRINITY_DLL_DECL boss_doomwalkerAI : public ScriptedAI Quake_Timer = 25000 + rand()%10000; Overrun_Timer = 30000 + rand()%15000; - InEnrage = false; + InEnrage = false; } void KilledUnit(Unit* Victim) @@ -92,114 +70,98 @@ struct TRINITY_DLL_DECL boss_doomwalkerAI : public ScriptedAI switch(rand()%3) { - case 0: - DoYell(SAY_SLAY_1, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(m_creature, SOUND_SLAY_1); - break; - case 1: - DoYell(SAY_SLAY_2, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(m_creature, SOUND_SLAY_2); - break; - case 2: - DoYell(SAY_SLAY_3, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(m_creature, SOUND_SLAY_3); - break; + case 0: DoScriptText(SAY_SLAY_1, m_creature); break; + case 1: DoScriptText(SAY_SLAY_2, m_creature); break; + case 2: DoScriptText(SAY_SLAY_3, m_creature); break; } + + DoCast(m_creature->getVictim(), SPELL_MARK_DEATH); } void JustDied(Unit* Killer) { - DoYell(SAY_DEATH, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(m_creature, SOUND_DEATH); + DoScriptText(SAY_DEATH, m_creature); } void Aggro(Unit *who) { - DoYell(SAY_AGGRO, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(m_creature, SOUND_AGGRO); + DoScriptText(SAY_AGGRO, m_creature); } void UpdateAI(const uint32 diff) { - if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) return; - //if (m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) + //Spell Enrage, when hp <= 20% gain enrage + if (((m_creature->GetHealth()*100)/ m_creature->GetMaxHealth()) <= 20) { - //Spell Enrage - if (((m_creature->GetHealth()*100)/ m_creature->GetMaxHealth()) <= 20)//when hp <= 20% gain enrage - { - if(Enrage_Timer < diff) - { - DoCast(m_creature,SPELL_ENRAGE); - Enrage_Timer = 6000; - InEnrage = true; - }else Enrage_Timer -= diff; - } - - //Spell Overrun - if (Overrun_Timer < diff) - { - switch(rand()%2) - { - case 0: - DoYell(SAY_OVERRUN_1, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(m_creature, SOUND_OVERRUN_1); - break; - case 1: - DoYell(SAY_OVERRUN_2, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(m_creature, SOUND_OVERRUN_2); - break; - } - DoCast(m_creature->getVictim(),SPELL_OVERRUN); - Overrun_Timer = 25000 + rand()%15000; - - }else Overrun_Timer -= diff; - - //Spell Earthquake - if (Quake_Timer < diff) + if(Enrage_Timer < diff) { - if (rand()%2) - return; - - switch(rand()%2) - { - case 0: - DoYell(SAY_EARTHQUAKE_1, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(m_creature, SOUND_EARTHQUAKE_1); - break; - case 1: - DoYell(SAY_EARTHQUAKE_2, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(m_creature, SOUND_EARTHQUAKE_2); - break; - } - if(InEnrage) - { - m_creature->RemoveAura(SPELL_ENRAGE, 0);//remove enrage before casting earthquake because enrage + earthquake = 16000dmg over 8sec and all dead - } - DoCast(m_creature,SPELL_EARTHQUAKE); - Quake_Timer = 30000 + rand()%25000; - }else Quake_Timer -= diff; - - //Spell Chain Lightning - if (Chain_Timer < diff) + DoCast(m_creature,SPELL_ENRAGE); + Enrage_Timer = 6000; + InEnrage = true; + }else Enrage_Timer -= diff; + } + + //Spell Overrun + if (Overrun_Timer < diff) + { + switch(rand()%2) { - DoCast(m_creature->getVictim(),SPELL_CHAIN_LIGHTNING); - Chain_Timer = 15000 + rand()%25000; - }else Chain_Timer -= diff; + case 0: DoScriptText(SAY_OVERRUN_1, m_creature); break; + case 1: DoScriptText(SAY_OVERRUN_2, m_creature); break; + } + + DoCast(m_creature->getVictim(),SPELL_OVERRUN); + Overrun_Timer = 25000 + rand()%15000; + }else Overrun_Timer -= diff; + + //Spell Earthquake + if (Quake_Timer < diff) + { + if (rand()%2) + return; - //Spell Sunder Armor - if (Armor_Timer < diff) + switch(rand()%2) { - DoCast(m_creature->getVictim(),SPELL_SUNDER_ARMOR); - Armor_Timer = 15000 + rand()%15000; - }else Armor_Timer -= diff; + case 0: DoScriptText(SAY_EARTHQUAKE_1, m_creature); break; + case 1: DoScriptText(SAY_EARTHQUAKE_2, m_creature); break; + } - DoMeleeAttackIfReady(); - } + //remove enrage before casting earthquake because enrage + earthquake = 16000dmg over 8sec and all dead + if (InEnrage) + m_creature->RemoveAura(SPELL_ENRAGE, 0); + + DoCast(m_creature,SPELL_EARTHQUAKE); + Quake_Timer = 30000 + rand()%25000; + }else Quake_Timer -= diff; + + //Spell Chain Lightning + if (Chain_Timer < diff) + { + Unit* target = NULL; + target = SelectUnit(SELECT_TARGET_RANDOM,1); + + if (!target) + target = m_creature->getVictim(); + + if (target) + DoCast(target,SPELL_CHAIN_LIGHTNING); + + Chain_Timer = 10000 + rand()%25000; + }else Chain_Timer -= diff; + + //Spell Sunder Armor + if (Armor_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_SUNDER_ARMOR); + Armor_Timer = 10000 + rand()%15000; + }else Armor_Timer -= diff; + + DoMeleeAttackIfReady(); } -}; +}; CreatureAI* GetAI_boss_doomwalker(Creature *_Creature) { @@ -210,7 +172,7 @@ void AddSC_boss_doomwalker() { Script *newscript; newscript = new Script; - newscript->Name="boss_doomwalker"; + newscript->Name = "boss_doomwalker"; newscript->GetAI = &GetAI_boss_doomwalker; newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp index 6618620de1e..30056b1e7ae 100644 --- a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp +++ b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp @@ -165,15 +165,6 @@ CreatureAI* GetAI_mob_mature_netherwing_drake(Creature *_creature) # mob_enslaved_netherwing_drake ####*/ -Creature* SelectCreatureInGrid(Unit* pUnit, uint32 entry, float range) -{ - Creature* target = NULL; - Trinity::AllCreaturesOfEntryInRange check(pUnit, entry, range); - Trinity::CreatureSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(target, check); - pUnit->VisitNearbyObject(range, searcher); - return target; -} - #define FACTION_DEFAULT 62 #define FACTION_FRIENDLY 1840 // Not sure if this is correct, it was taken off of Mordenai. @@ -221,7 +212,7 @@ struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI m_creature->setFaction(FACTION_FRIENDLY); DoCast(caster, SPELL_FORCE_OF_NELTHARAKU, true); - Creature* Dragonmaw = SelectCreatureInGrid(m_creature, CREATURE_DRAGONMAW_SUBJUGATOR, 50); + Unit* Dragonmaw = FindCreature(CREATURE_DRAGONMAW_SUBJUGATOR, 50, m_creature); if(Dragonmaw) { @@ -281,7 +272,7 @@ struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI float dx, dy, dz; - Creature* EscapeDummy = SelectCreatureInGrid(m_creature, CREATURE_ESCAPE_DUMMY, 30); + Unit* EscapeDummy = FindCreature(CREATURE_ESCAPE_DUMMY, 30, m_creature); if(EscapeDummy) EscapeDummy->GetPosition(dx, dy, dz); else @@ -637,7 +628,7 @@ bool QuestAccept_npc_karynaku(Player* player, Creature* creature, Quest const* q nodes.resize(2); nodes[0] = 161; // From Karynaku nodes[1] = 162; // To Mordenai - error_log("SD2: Player %s started quest 10870 which has disabled taxi node, need to be fixed in core", player->GetName()); + error_log("TSCR: Player %s started quest 10870 which has disabled taxi node, need to be fixed in core", player->GetName()); //player->ActivateTaxiPathTo(nodes, 20811); } @@ -780,7 +771,7 @@ struct TRINITY_DLL_DECL npc_overlord_morghorAI : public ScriptedAI return 6000; break; case 27: { - Unit* Yarzill = FindCreature(C_YARZILL, 50); + Unit* Yarzill = FindCreature(C_YARZILL, 50, m_creature); if (Yarzill) Yarzill->SetUInt64Value(UNIT_FIELD_TARGET, PlayerGUID); return 500; }break; @@ -792,19 +783,19 @@ struct TRINITY_DLL_DECL npc_overlord_morghorAI : public ScriptedAI return 1000; break; case 29: { - Unit* Yarzill = FindCreature(C_YARZILL, 50); + Unit* Yarzill = FindCreature(C_YARZILL, 50, m_creature); if(Yarzill) DoScriptText(YARZILL_THE_MERC_SAY, Yarzill, plr); return 5000; }break; case 30: { - Unit* Yarzill = FindCreature(C_YARZILL, 50); + Unit* Yarzill = FindCreature(C_YARZILL, 50, m_creature); if (Yarzill) Yarzill->SetUInt64Value(UNIT_FIELD_TARGET, 0); return 5000; }break; case 31: { - Unit* Yarzill = FindCreature(C_YARZILL, 50); + Unit* Yarzill = FindCreature(C_YARZILL, 50, m_creature); if (Yarzill) Yarzill->CastSpell(plr, 41540, true); return 1000;}break; @@ -1128,10 +1119,10 @@ struct WaveData static WaveData WavesInfo[]= { - {9, 0, 22075, 10000, 7000, -1000371},//Illidari Soldier - {2, 9, 22074, 10000, 7000, -1000372},//Illidari Mind Breaker - {4, 11, 19797, 10000, 7000, -1000373},//Illidari Highlord - {1, 15, 22076, 10000, 7000, -1000374} //Torloth The Magnificent + {9, 0, 22075, 10000, 7000, -1000371}, //Illidari Soldier + {2, 9, 22074, 10000, 7000, -1000372}, //Illidari Mind Breaker + {4, 11, 19797, 10000, 7000, -1000373}, //Illidari Highlord + {1, 15, 22076, 10000, 7000, -1000374} //Torloth The Magnificent }; struct SpawnSpells @@ -1141,15 +1132,15 @@ struct SpawnSpells static SpawnSpells SpawnCast[]= { - {10000, 15000, 35871},// Illidari Soldier Cast - Spellbreaker - {10000, 10000, 38985},// Illidari Mind Breake Cast - Focused Bursts - {35000, 35000, 22884},// Illidari Mind Breake Cast - Psychic Scream - {20000, 20000, 17194},// Illidari Mind Breake Cast - Mind Blast - {8000, 15000, 38010},// Illidari Highlord Cast - Curse of Flames - {12000, 20000, 16102},// Illidari Highlord Cast - Flamestrike - {10000, 15000, 15284},// Torloth the Magnificent Cast - Cleave - {18000, 20000, 39082},// Torloth the Magnificent Cast - Shadowfury - {25000, 28000, 33961}// Torloth the Magnificent Cast - Spell Reflection + {10000, 15000, 35871}, // Illidari Soldier Cast - Spellbreaker + {10000, 10000, 38985}, // Illidari Mind Breake Cast - Focused Bursts + {35000, 35000, 22884}, // Illidari Mind Breake Cast - Psychic Scream + {20000, 20000, 17194}, // Illidari Mind Breake Cast - Mind Blast + {8000, 15000, 38010}, // Illidari Highlord Cast - Curse of Flames + {12000, 20000, 16102}, // Illidari Highlord Cast - Flamestrike + {10000, 15000, 15284}, // Torloth the Magnificent Cast - Cleave + {18000, 20000, 39082}, // Torloth the Magnificent Cast - Shadowfury + {25000, 28000, 33961} // Torloth the Magnificent Cast - Spell Reflection }; /*###### @@ -1618,13 +1609,13 @@ bool GOQuestAccept_GO_crystal_prison(Player* plr, GameObject* go, Quest const* q { if(quest->GetQuestId() == QUEST_BATTLE_OF_THE_CRIMSON_WATCH ) { - Creature* Illidan = SelectCreatureInGrid(plr, 22083, 50); + Unit* Illidan = FindCreature(22083, 50, plr); - if(Illidan && !(((npc_lord_illidan_stormrageAI*)Illidan->AI())->EventStarted)) + if(Illidan && !(((npc_lord_illidan_stormrageAI*)((Creature*)Illidan)->AI())->EventStarted)) { - ((npc_lord_illidan_stormrageAI*)Illidan->AI())->PlayerGUID = plr->GetGUID(); - ((npc_lord_illidan_stormrageAI*)Illidan->AI())->LiveCount = 0; - ((npc_lord_illidan_stormrageAI*)Illidan->AI())->EventStarted=true; + ((npc_lord_illidan_stormrageAI*)((Creature*)Illidan)->AI())->PlayerGUID = plr->GetGUID(); + ((npc_lord_illidan_stormrageAI*)((Creature*)Illidan)->AI())->LiveCount = 0; + ((npc_lord_illidan_stormrageAI*)((Creature*)Illidan)->AI())->EventStarted=true; } } return true; diff --git a/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp b/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp index 339f8450c92..22f71e09be0 100644 --- a/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp +++ b/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp @@ -453,13 +453,13 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI Step = 0; m_creature->setFaction(1194); - Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20); + Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature); if(Creepjack) { ((Creature*)Creepjack)->AI()->EnterEvadeMode(); Creepjack->setFaction(1194); } - Unit* Malone = FindCreature(NPC_MALONE, 20); + Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature); if(Malone) { ((Creature*)Malone)->AI()->EnterEvadeMode(); @@ -474,10 +474,10 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI switch(Step) { case 0:{ m_creature->SetInFront(player); - Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20); + Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature); if(Creepjack) Creepjack->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - Unit* Malone = FindCreature(NPC_MALONE, 20); + Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature); if(Malone) Malone->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); }return 2000; @@ -508,14 +508,14 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); if(player) { - Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20); + Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature); if(Creepjack) { Creepjack->Attack(player, true); Creepjack->setFaction(14); Creepjack->GetMotionMaster()->MoveChase(player); } - Unit* Malone = FindCreature(NPC_MALONE, 20); + Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature); if(Malone) { Malone->Attack(player, true); @@ -531,13 +531,13 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI if((m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 1 && !Done) { - Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20); + Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature); if(Creepjack) { ((Creature*)Creepjack)->AI()->EnterEvadeMode(); Creepjack->setFaction(1194); } - Unit* Malone = FindCreature(NPC_MALONE, 20); + Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature); if(Malone) { ((Creature*)Malone)->AI()->EnterEvadeMode(); diff --git a/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp b/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp index a350594d860..3981c63d092 100644 --- a/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp +++ b/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp @@ -130,7 +130,7 @@ struct TRINITY_DLL_DECL npc_deathstalker_erlandAI : public npc_escortAI ((Player*)player)->GroupEventHappens(QUEST_ESCORTING, m_creature);break; case 14: DoScriptText(SAY_THANKS, m_creature, player);break; case 15: { - Unit* Rane = FindCreature(NPC_RANE, 20); + Unit* Rane = FindCreature(NPC_RANE, 20, m_creature); if(Rane) DoScriptText(SAY_RANE, Rane); break;} @@ -138,7 +138,7 @@ struct TRINITY_DLL_DECL npc_deathstalker_erlandAI : public npc_escortAI case 17: DoScriptText(SAY_MOVE_QUINN, m_creature); break; case 24: DoScriptText(SAY_GREETINGS, m_creature);break; case 25: { - Unit* Quinn = FindCreature(NPC_QUINN, 20); + Unit* Quinn = FindCreature(NPC_QUINN, 20, m_creature); if(Quinn) DoScriptText(SAY_QUINN, Quinn); break;} diff --git a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp index 7a68227457f..85621b1963f 100644 --- a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp +++ b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp @@ -405,7 +405,7 @@ struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI m_creature->SummonCreature(SPAWN_SECOND_2, -7515.07, -4797.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); m_creature->SummonCreature(SPAWN_SECOND_2, -7518.07, -4792.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); DoScriptText(SAY_CHICKEN_AMB, m_creature); - {Unit* scoff = FindCreature(SPAWN_SECOND_2, 30); + {Unit* scoff = FindCreature(SPAWN_SECOND_2, 30, m_creature); if(scoff) DoScriptText(SAY_SCOFF, scoff);}break; break; diff --git a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp index aca9d6957cd..4e4c5409911 100644 --- a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp +++ b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp @@ -387,7 +387,7 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI { case 0: { - GameObject* Cage = FindGameObject(GO_CAGE, 99); + GameObject* Cage = FindGameObject(GO_CAGE, 10, m_creature); if(Cage) Cage->SetGoState(0); }break; diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 86c1fa1afe6..0f090c78525 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2170,6 +2170,7 @@ void SpellMgr::LoadSpellCustomAttr() case 37790: //Spread Shot case 46771: //Flame Sear case 45248: //Shadow Blades + case 41303: // Soul Drain spellInfo->MaxAffectedTargets = 3; break; case 38310: //Multi-Shot diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index e635efa0457..9d768454c18 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -557,11 +557,16 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa } } } - } - + } + if (damagetype != NODAMAGE) + { + // interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras) + pVictim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_DAMAGE, spellProto ? spellProto->Id : 0); + pVictim->RemoveSpellbyDamageTaken(damage, spellProto ? spellProto->Id : 0); + } - if(!damage) //when will zero damage? need interrupt aura? + if(!damage) { // Rage from physical damage received . if(cleanDamage && cleanDamage->damage && (damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL) && pVictim->GetTypeId() == TYPEID_PLAYER && (pVictim->getPowerType() == POWER_RAGE)) @@ -893,9 +898,6 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa if (damagetype != NODAMAGE && damage)// && pVictim->GetTypeId() == TYPEID_PLAYER) { - pVictim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_DAMAGE, spellProto ? spellProto->Id : 0); - pVictim->RemoveSpellbyDamageTaken(damage, spellProto ? spellProto->Id : 0); - /*const SpellEntry *se = i->second->GetSpellProto(); next = i; ++next; if (spellProto && spellProto->Id == se->Id) // Not drop auras added by self |