diff options
| author | Kudlaty <none@none> | 2009-08-10 23:24:40 +0200 |
|---|---|---|
| committer | Kudlaty <none@none> | 2009-08-10 23:24:40 +0200 |
| commit | 1594f0381fad4733ccb2a83a5181204624c9f810 (patch) | |
| tree | 1db92f7ccad15d87d569b2ffcf2c2c2c32b0f7e7 | |
| parent | f2a24c215c66993bfff7f9c5f9b1538078fa6037 (diff) | |
Merge [SD2]
r1172 Replace some DealDamage() with ForcedDespawn()
r1173 Added a few more texts for quest 12733
r1174 Allow escortAI to continue run for as long as at least one member of party is in range (in case original player who start escort is in party).
r1175 Correct gossip text, wrong in rev 1173.
r1176 Correcting a bug for script related to quest 11129. Also use explicit boolean as check if still moving to location.
r1177 Adjusting tempsummon time for Opera event bosses and also despawn if creatures evade.
r1178 Remove not needed code (already called from escortAI::UpdateAI)
--HG--
branch : trunk
14 files changed, 166 insertions, 131 deletions
diff --git a/sql/FULL/world_script_texts.sql b/sql/FULL/world_script_texts.sql index dc2638a057e..89a56e44fc1 100644 --- a/sql/FULL/world_script_texts.sql +++ b/sql/FULL/world_script_texts.sql @@ -1,4 +1,4 @@ --- Up to TC2 4748 +-- Up to TC2 4748 -- -- trinityscript_script_texts.sql Contains data for table `script_texts` mainly used in C++ parts. -- valid entries for table are between -1000000 and -1999999 @@ -1873,12 +1873,6 @@ INSERT INTO `script_texts` (`entry`, `content_default`, `content_loc1`, `content (-1609014, 'Sate your hunger on cold steel\, $R', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_ATTACK_7'), (-1609015, 'It ends here!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_ATTACK_8'), (-1609016, 'Death is the only cure!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_ATTACK_9'), -(-1609017,'No potions!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_A'), -(-1609018,'Remember this day, $n, for it is the day that you will be thoroughly owned.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_B'), -(-1609019,'I\'m going to tear your heart out, cupcake!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_C'), -(-1609020,'Don\'t make me laugh.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_D'), -(-1609021,'Here come the tears...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_E'), -(-1609022,'You have challenged death itself!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_F'), (-1609025,'Come to finish the job, have you?', NULL,NULL, NULL,NULL, NULL,NULL, NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_START_1'), (-1609026,'Come to finish the job, have ye?', NULL,NULL, NULL,NULL, NULL,NULL, NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_START_2'), (-1609027,'Come ta finish da job, mon?', NULL,NULL, NULL,NULL, NULL,NULL, NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_START_3'), @@ -1932,7 +1926,16 @@ INSERT INTO `script_texts` (`entry`, `content_default`, `content_loc1`, `content (-1609075,'There... There\'s no more time for me. I\'m done for. Finish me off, $N. Do it or they\'ll kill us both. $N... Remember Mulgore. This world is worth saving.', NULL,NULL, NULL,NULL, NULL,NULL, NULL,NULL,0,0,0,18,'special_surprise SAY_EXEC_TIME_9'), (-1609076,'Der... Der\'s no more time for me. I be done for. Finish me off $N. Do it or they\'ll kill us both. $N... Remember Sen\'jin Village, mon! Dis world be worth saving!', NULL,NULL, NULL,NULL, NULL,NULL, NULL,NULL,0,0,0,18,'special_surprise SAY_EXEC_TIME_10'), (-1609077,'Do it, $N! Put me out of my misery!', NULL,NULL, NULL,NULL, NULL,NULL, NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_WAITING'), -(-1609078,'dies from his wounds.', NULL,NULL, NULL,NULL, NULL,NULL, NULL,NULL,0,2,0,0,'special_surprise EMOTE_DIES'); +(-1609078,'dies from his wounds.', NULL,NULL, NULL,NULL, NULL,NULL, NULL,NULL,0,2,0,0,'special_surprise EMOTE_DIES'), +(-1609080,'No potions!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_A'), +(-1609081,'Remember this day, $n, for it is the day that you will be thoroughly owned.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_B'), +(-1609082,'I\'m going to tear your heart out, cupcake!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_C'), +(-1609083,'Don\'t make me laugh.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_D'), +(-1609084,'Here come the tears...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_E'), +(-1609085,'You have challenged death itself!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_F'), +(-1609086,'The Lich King will see his true champion on this day!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_G'), +(-1609087,'You\'re going down!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_H'), +(-1609088,'You don\'t stand a chance, $n', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_I'); -- -- Below just for beautiful view in table, run at own desire diff --git a/sql/updates/4879_world_script_texts.sql b/sql/updates/4879_world_script_texts.sql new file mode 100644 index 00000000000..e300e3c1bf9 --- /dev/null +++ b/sql/updates/4879_world_script_texts.sql @@ -0,0 +1,12 @@ +UPDATE script_texts SET entry=-1609080 WHERE entry=-1609017; +UPDATE script_texts SET entry=-1609081 WHERE entry=-1609018; +UPDATE script_texts SET entry=-1609082 WHERE entry=-1609019; +UPDATE script_texts SET entry=-1609083 WHERE entry=-1609020; +UPDATE script_texts SET entry=-1609084 WHERE entry=-1609021; +UPDATE script_texts SET entry=-1609085 WHERE entry=-1609022; + +DELETE FROM script_texts WHERE entry IN (-1609086,-1609087,-1609088); +INSERT INTO `script_texts` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1609086,'The Lich King will see his true champion on this day!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_G'), +(-1609087,'You\'re going down!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_H'), +(-1609088,'You don\'t stand a chance, $n', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_I'); diff --git a/src/bindings/scripts/scripts/npc/npc_escortAI.cpp b/src/bindings/scripts/scripts/npc/npc_escortAI.cpp index b74f0858515..5e9dd7e3141 100644 --- a/src/bindings/scripts/scripts/npc/npc_escortAI.cpp +++ b/src/bindings/scripts/scripts/npc/npc_escortAI.cpp @@ -147,34 +147,53 @@ void npc_escortAI::UpdateAI(const uint32 diff) }else WaitTimer -= diff; } - //Check if player is within range - if (IsBeingEscorted && !m_creature->isInCombat() && PlayerGUID) + //Check if player or any member of his group is within range + if (IsBeingEscorted && PlayerGUID && !m_creature->getVictim() && !m_creature->IsInEvadeMode()) { if (PlayerTimer < diff) - { - Unit* p = Unit::GetUnit(*m_creature, PlayerGUID); - - if (DespawnAtFar && (!p || !m_creature->IsWithinDist(p,GetMaxPlayerDistance()))) { - JustDied(m_creature); - IsBeingEscorted = false; + bool bIsMaxRangeExceeded = true; + + if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + { + if (Group* pGroup = pPlayer->GetGroup()) + { + for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + { + Player* pMember = pRef->getSource(); + + if (pMember && m_creature->IsWithinDistInMap(pMember, GetMaxPlayerDistance())) + { + bIsMaxRangeExceeded = false; + break; + } + } + } + else + { + if (m_creature->IsWithinDistInMap(pPlayer, GetMaxPlayerDistance())) + bIsMaxRangeExceeded = false; + } + } - debug_log("TSCR: EscortAI Evaded back to spawn point because player was to far away or not found"); + if (DespawnAtFar && bIsMaxRangeExceeded) + { + JustDied(m_creature); + IsBeingEscorted = false; - m_creature->setDeathState(JUST_DIED); - m_creature->SetHealth(0); - m_creature->CombatStop(true); - m_creature->DeleteThreatList(); - m_creature->Respawn(); - m_creature->GetMotionMaster()->Clear(true); + debug_log("TSCR: EscortAI Evaded back to spawn point because player/group was to far away or not found"); - //Restore original NpcFlags - m_creature->SetUInt32Value(UNIT_NPC_FLAGS, m_uiNpcFlags); + m_creature->setDeathState(JUST_DIED); - } + //TODO: add option to set instant respawn? Then use db respawn value as default + m_creature->Respawn(); + + //Restore original NpcFlags + m_creature->SetUInt32Value(UNIT_NPC_FLAGS, m_creature->GetCreatureInfo()->npcflag); + } PlayerTimer = 1000; - }else PlayerTimer -= diff; + }else PlayerTimer -= diff; } if(CanMelee && UpdateVictim()) diff --git a/src/bindings/scripts/scripts/zone/azshara/azshara.cpp b/src/bindings/scripts/scripts/zone/azshara/azshara.cpp index 4ddabcb7c71..bf4db24d305 100644 --- a/src/bindings/scripts/scripts/zone/azshara/azshara.cpp +++ b/src/bindings/scripts/scripts/zone/azshara/azshara.cpp @@ -68,9 +68,7 @@ struct TRINITY_DLL_DECL mobs_spitelashesAI : public ScriptedAI // we mustn't remove the creature in the same round in which we cast the summon spell, otherwise there will be no summons if( spellhit && morphtimer>=5000 ) { - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - m_creature->RemoveCorpse(); //you don't see any corpse on off. - EnterEvadeMode(); //spellhit will be set to false + m_creature->ForcedDespawn(); return; } // walk 5 seconds before summoning @@ -271,18 +269,12 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI Reached = false; } - void Despawn() - { - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - m_creature->RemoveCorpse(); - } - void UpdateAI(const uint32 diff) { if(Must_Die) if(Must_Die_Timer < diff) { - Despawn(); + m_creature->ForcedDespawn(); return; } else Must_Die_Timer -= diff; @@ -342,7 +334,7 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI Player *player = Unit::GetPlayer(PlayerGUID); if(!player) { - Despawn(); + m_creature->ForcedDespawn(); return; } @@ -392,7 +384,7 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI if(id == 57) { - Despawn(); + m_creature->ForcedDespawn(); return; } @@ -452,8 +444,7 @@ struct TRINITY_DLL_DECL mob_depth_chargeAI : public ScriptedAI if(we_must_die) if(must_die_timer < diff) { - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - m_creature->RemoveCorpse(); + m_creature->ForcedDespawn(); } else must_die_timer -= diff; return; } 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 66f4d3b4c63..98f060baff5 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 @@ -142,10 +142,9 @@ struct TRINITY_DLL_DECL boss_reliquary_of_soulsAI : public ScriptedAI if(EssenceGUID) { - if(Unit* Essence = Unit::GetUnit(*m_creature, EssenceGUID)) + if(Creature* Essence = Unit::GetCreature(*m_creature, EssenceGUID)) { - Essence->SetVisibility(VISIBILITY_OFF); - Essence->setDeathState(DEAD); + Essence->ForcedDespawn(); } EssenceGUID = 0; } @@ -302,8 +301,7 @@ struct TRINITY_DLL_DECL boss_reliquary_of_soulsAI : public ScriptedAI { DoScriptText(DESI_SAY_AFTER, Essence); } - Essence->SetVisibility(VISIBILITY_OFF); - Essence->setDeathState(JUST_DIED); + Essence->ForcedDespawn(); m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,0); EssenceGUID = 0; SoulCount = 0; diff --git a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_victor_nefarius.cpp b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_victor_nefarius.cpp index 5bfa881ed3e..4391a748b8c 100644 --- a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_victor_nefarius.cpp +++ b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_victor_nefarius.cpp @@ -329,15 +329,14 @@ struct TRINITY_DLL_DECL boss_victor_nefariusAI : public ScriptedAI { if (NefCheckTime < diff) { - Unit* Nefarian = NULL; - Nefarian = Unit::GetUnit((*m_creature),NefarianGUID); + Unit* Nefarian = (Creature*)Unit::GetUnit((*m_creature),NefarianGUID); //If nef is dead then we die to so the players get out of combat //and cannot repeat the event if (!Nefarian || !Nefarian->isAlive()) { NefarianGUID = 0; - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->ForcedDespawn(); } NefCheckTime = 2000; diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp index 243cf223157..582129fe3c2 100644 --- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp +++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp @@ -312,10 +312,10 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI if(InnderDemon[i]) { //delete creature - Unit* pUnit = Unit::GetUnit((*m_creature), InnderDemon[i]); - if (pUnit && pUnit->isAlive()) + Creature* pCreature = Unit::GetCreature((*m_creature), InnderDemon[i]); + if (pCreature && pCreature->isAlive()) { - pUnit->DealDamage(pUnit, pUnit->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + pCreature->ForcedDespawn(); } InnderDemon[i] = 0; } @@ -376,11 +376,8 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI //despawn copy if (Demon) { - Unit *pUnit = NULL; - pUnit = Unit::GetUnit((*m_creature), Demon); - - if (pUnit) - pUnit->DealDamage(pUnit, pUnit->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + if (Creature* pDemon = Unit::GetCreature(*m_creature, Demon)) + pDemon->ForcedDespawn(); } if (pInstance) pInstance->SetData(DATA_LEOTHERASTHEBLINDEVENT, DONE); diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp index b014b4b1e45..2ba3579eb7b 100644 --- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp +++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp @@ -336,7 +336,8 @@ struct TRINITY_DLL_DECL mob_water_globuleAI : public ScriptedAI DoCast(m_creature->getVictim(), SPELL_GLOBULE_EXPLOSION); //despawn - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->ForcedDespawn(); + return; } Check_Timer = 500; }else Check_Timer -= diff; diff --git a/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp b/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp index c3782b7666a..898041f0194 100644 --- a/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp +++ b/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp @@ -791,16 +791,19 @@ bool GOHello_go_acherus_soul_prison(Player *player, GameObject* _GO) ## npc_death_knight_initiate ######*/ -#define GOSSIP_ACCEPT_DUEL "[PH] I challenge you!" +#define GOSSIP_ACCEPT_DUEL "I challenge you, death knight!" enum { - SAY_DUEL_A = -1609017, - SAY_DUEL_B = -1609018, - SAY_DUEL_C = -1609019, - SAY_DUEL_D = -1609020, - SAY_DUEL_E = -1609021, - SAY_DUEL_F = -1609022, + SAY_DUEL_A = -1609080, + SAY_DUEL_B = -1609081, + SAY_DUEL_C = -1609082, + SAY_DUEL_D = -1609083, + SAY_DUEL_E = -1609084, + SAY_DUEL_F = -1609085, + SAY_DUEL_G = -1609086, + SAY_DUEL_H = -1609087, + SAY_DUEL_I = -1609088, SPELL_DUEL = 52996, SPELL_DUEL_TRIGGERED = 52990, @@ -813,7 +816,7 @@ enum int32 m_auiRandomSay[] = { - SAY_DUEL_A, SAY_DUEL_B, SAY_DUEL_C, SAY_DUEL_D, SAY_DUEL_E, SAY_DUEL_F + SAY_DUEL_A, SAY_DUEL_B, SAY_DUEL_C, SAY_DUEL_D, SAY_DUEL_E, SAY_DUEL_F, SAY_DUEL_G, SAY_DUEL_H, SAY_DUEL_I }; struct TRINITY_DLL_DECL npc_death_knight_initiateAI : public ScriptedAI diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp index fcdac62f183..d7118f039a7 100644 --- a/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp +++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp @@ -149,8 +149,7 @@ struct TRINITY_DLL_DECL mob_abyssalAI : public ScriptedAI if(Despawn_Timer < diff) { - m_creature->SetVisibility(VISIBILITY_OFF); - m_creature->setDeathState(JUST_DIED); + m_creature->ForcedDespawn(); }else Despawn_Timer -= diff; if(!UpdateVictim()) diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp index 96ba0b146b4..185891a7bbd 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp @@ -182,9 +182,8 @@ struct TRINITY_DLL_DECL boss_terestianAI : public ScriptedAI { if(PortalGUID[i]) { - Unit* Portal = Unit::GetUnit((*m_creature), PortalGUID[i]); - if(Portal) - Portal->DealDamage(Portal, Portal->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + if(Creature* pPortal = Unit::GetCreature(*m_creature, PortalGUID[i])) + pPortal->ForcedDespawn(); PortalGUID[i] = 0; } @@ -240,9 +239,8 @@ struct TRINITY_DLL_DECL boss_terestianAI : public ScriptedAI { if(PortalGUID[i]) { - Unit* Portal = Unit::GetUnit((*m_creature), PortalGUID[i]); - if(Portal) - Portal->DealDamage(Portal, Portal->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + if(Creature* pPortal = Unit::GetCreature((*m_creature), PortalGUID[i])) + pPortal->ForcedDespawn(); PortalGUID[i] = 0; } diff --git a/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp b/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp index 55933b8854b..45874e4a83e 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp @@ -86,16 +86,15 @@ EndScriptData */ #define CREATURE_CYCLONE 18412 #define CREATURE_CRONE 18168 -void SummonCroneIfReady(ScriptedInstance* pInstance, Creature *_Creature) +void SummonCroneIfReady(ScriptedInstance* pInstance, Creature* pCreature) { pInstance->SetData(DATA_OPERA_OZ_DEATHCOUNT, 0); // Increment DeathCount if(pInstance->GetData(DATA_OPERA_OZ_DEATHCOUNT) == 4) { - Creature* Crone = _Creature->SummonCreature(CREATURE_CRONE, -10891.96, -1755.95, _Creature->GetPositionZ(), 4.64, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - if(Crone) + if (Creature* pCrone = pCreature->SummonCreature(CREATURE_CRONE, -10891.96, -1755.95, pCreature->GetPositionZ(), 4.64, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILISECONDS)) { - if(_Creature->getVictim()) - Crone->AI()->AttackStart(_Creature->getVictim()); + if(pCreature->getVictim()) + pCrone->AI()->AttackStart(pCreature->getVictim()); } } }; @@ -135,6 +134,11 @@ struct TRINITY_DLL_DECL boss_dorotheeAI : public ScriptedAI DoScriptText(SAY_DOROTHEE_AGGRO, m_creature); } + void JustReachedHome() + { + m_creature->ForcedDespawn(); + } + void SummonTito(); // See below void JustDied(Unit* killer) @@ -294,6 +298,11 @@ struct TRINITY_DLL_DECL boss_strawmanAI : public ScriptedAI DoScriptText(SAY_STRAWMAN_AGGRO, m_creature); } + void JustReachedHome() + { + m_creature->ForcedDespawn(); + } + void SpellHit(Unit* caster, const SpellEntry *Spell) { if ((Spell->SchoolMask == SPELL_SCHOOL_MASK_FIRE) && (!(rand()%10))) @@ -379,6 +388,11 @@ struct TRINITY_DLL_DECL boss_tinheadAI : public ScriptedAI DoScriptText(SAY_TINHEAD_AGGRO, m_creature); } + void JustReachedHome() + { + m_creature->ForcedDespawn(); + } + void AttackStart(Unit* who) { if(m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) @@ -486,6 +500,11 @@ struct TRINITY_DLL_DECL boss_roarAI : public ScriptedAI DoScriptText(SAY_ROAR_AGGRO, m_creature); } + void JustReachedHome() + { + m_creature->ForcedDespawn(); + } + void JustDied(Unit* killer) { DoScriptText(SAY_ROAR_DEATH, m_creature); @@ -553,6 +572,11 @@ struct TRINITY_DLL_DECL boss_croneAI : public ScriptedAI ChainLightningTimer = 10000; } + void JustReachedHome() + { + m_creature->ForcedDespawn(); + } + void EnterCombat(Unit* who) { switch(rand()%2) @@ -702,21 +726,14 @@ bool GossipHello_npc_grandmother(Player* player, Creature* _Creature) return true; } -bool GossipSelect_npc_grandmother(Player* player, Creature* _Creature, uint32 sender, uint32 action) +bool GossipSelect_npc_grandmother(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action) { if(action == GOSSIP_ACTION_INFO_DEF) { - _Creature->SetVisibility(VISIBILITY_OFF); - float x,y,z; - _Creature->GetPosition(x,y,z); - Creature* BigBadWolf = _Creature->SummonCreature(CREATURE_BIG_BAD_WOLF, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - if(BigBadWolf) - { - BigBadWolf->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - BigBadWolf->AI()->AttackStart(player); - } + if (Creature* pBigBadWolf = pCreature->SummonCreature(CREATURE_BIG_BAD_WOLF, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILISECONDS)) + pBigBadWolf->AI()->AttackStart(pPlayer); - _Creature->setDeathState(JUST_DIED); + pCreature->ForcedDespawn(); } return true; @@ -757,6 +774,11 @@ struct TRINITY_DLL_DECL boss_bigbadwolfAI : public ScriptedAI DoScriptText(SAY_WOLF_AGGRO, m_creature); } + void JustReachedHome() + { + m_creature->ForcedDespawn(); + } + void JustDied(Unit* killer) { DoPlaySoundToSet(m_creature, SOUND_WOLF_DEATH); @@ -918,6 +940,7 @@ struct TRINITY_DLL_DECL boss_julianneAI : public ScriptedAI pInstance = c->GetInstanceData(); EntryYellTimer = 1000; AggroYellTimer = 10000; + IsFakingDeath = false; } ScriptedInstance* pInstance; @@ -944,16 +967,6 @@ struct TRINITY_DLL_DECL boss_julianneAI : public ScriptedAI void Reset() { - if(RomuloGUID) - { - if(Unit* Romulo = Unit::GetUnit(*m_creature, RomuloGUID)) - { - Romulo->SetVisibility(VISIBILITY_OFF); - Romulo->DealDamage(Romulo, Romulo->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } - - } - RomuloGUID = 0; Phase = PHASE_JULIANNE; @@ -966,9 +979,11 @@ struct TRINITY_DLL_DECL boss_julianneAI : public ScriptedAI ResurrectSelfTimer = 0; if(IsFakingDeath) + { Resurrect(m_creature); + IsFakingDeath = false; + } - IsFakingDeath = false; SummonedRomulo = false; RomuloDead = false; } @@ -991,6 +1006,11 @@ struct TRINITY_DLL_DECL boss_julianneAI : public ScriptedAI ScriptedAI::MoveInLineOfSight(who); } + void JustReachedHome() + { + m_creature->ForcedDespawn(); + } + void SpellHit(Unit* caster, const SpellEntry *Spell) { if (Spell->Id == SPELL_DRINK_POISON) @@ -1064,6 +1084,11 @@ struct TRINITY_DLL_DECL boss_romuloAI : public ScriptedAI JulianneDead = false; } + void JustReachedHome() + { + m_creature->ForcedDespawn(); + } + void DamageTaken(Unit* done_by, uint32 &damage); void EnterCombat(Unit* who) @@ -1265,19 +1290,14 @@ void boss_julianneAI::UpdateAI(const uint32 diff) { if(SummonRomuloTimer < diff) { - Creature* Romulo = m_creature->SummonCreature(CREATURE_ROMULO, ROMULO_X, ROMULO_Y, m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - if(Romulo) + if (Creature* pRomulo = m_creature->SummonCreature(CREATURE_ROMULO, ROMULO_X, ROMULO_Y, m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILISECONDS)) { - RomuloGUID = Romulo->GetGUID(); - CAST_AI(boss_romuloAI, Romulo->AI())->JulianneGUID = m_creature->GetGUID(); - CAST_AI(boss_romuloAI, Romulo->AI())->Phase = PHASE_ROMULO; - Romulo->setFaction(16); - - if(m_creature->getVictim()) - { - Romulo->AddThreat(m_creature->getVictim(), 0.0f); - } - DoZoneInCombat(Romulo); + RomuloGUID = pRomulo->GetGUID(); + CAST_AI(boss_romuloAI, pRomulo->AI())->JulianneGUID = m_creature->GetGUID(); + CAST_AI(boss_romuloAI, pRomulo->AI())->Phase = PHASE_ROMULO; + DoZoneInCombat(pRomulo); + + pRomulo->setFaction(16); } SummonedRomulo = true; }else SummonRomuloTimer -= diff; diff --git a/src/bindings/scripts/scripts/zone/karazhan/karazhan.cpp b/src/bindings/scripts/scripts/zone/karazhan/karazhan.cpp index 10e2a54cbaa..8156e8fff9c 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/karazhan.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/karazhan.cpp @@ -296,11 +296,6 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI } } - - if(!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); } void StartEvent() @@ -344,7 +339,7 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI { uint32 entry = ((uint32)Spawns[index][0]); float PosX = Spawns[index][1]; - if (Creature* pCreature = m_creature->SummonCreature(entry, PosX, SPAWN_Y, SPAWN_Z, SPAWN_O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000)) + if (Creature* pCreature = m_creature->SummonCreature(entry, PosX, SPAWN_Y, SPAWN_Z, SPAWN_O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILISECONDS)) { // In case database has bad flags pCreature->SetUInt32Value(UNIT_FIELD_FLAGS, 0); diff --git a/src/bindings/scripts/scripts/zone/mulgore/mulgore.cpp b/src/bindings/scripts/scripts/zone/mulgore/mulgore.cpp index dd9a8ec3049..0b84ba0a8b8 100644 --- a/src/bindings/scripts/scripts/zone/mulgore/mulgore.cpp +++ b/src/bindings/scripts/scripts/zone/mulgore/mulgore.cpp @@ -78,6 +78,7 @@ struct TRINITY_DLL_DECL npc_kyle_frenziedAI : public ScriptedAI npc_kyle_frenziedAI(Creature *c) : ScriptedAI(c) {} bool bEvent; + bool m_bIsMovingToLunch; uint64 uiPlayerGUID; uint32 uiEventTimer; uint8 uiEventPhase; @@ -85,9 +86,10 @@ struct TRINITY_DLL_DECL npc_kyle_frenziedAI : public ScriptedAI void Reset() { bEvent = false; + m_bIsMovingToLunch = false; uiPlayerGUID = 0; uiEventTimer = 5000; - uiEventPhase = 1; + uiEventPhase = 0; if (m_creature->GetEntry() == NPC_KYLE_FRIENDLY) m_creature->UpdateEntry(NPC_KYLE_FRENZIED); @@ -95,7 +97,7 @@ struct TRINITY_DLL_DECL npc_kyle_frenziedAI : public ScriptedAI void SpellHit(Unit* pCaster, SpellEntry const* pSpell) { - if (!m_creature->isInCombat() && !bEvent && pSpell->Id == SPELL_LUNCH) + if (!m_creature->getVictim() && !bEvent && pSpell->Id == SPELL_LUNCH) { if (pCaster->GetTypeId() == TYPEID_PLAYER) uiPlayerGUID = pCaster->GetGUID(); @@ -119,37 +121,38 @@ struct TRINITY_DLL_DECL npc_kyle_frenziedAI : public ScriptedAI return; if (uiPointId == POINT_ID) - uiEventTimer = 5000; + m_bIsMovingToLunch = false; } void UpdateAI(const uint32 diff) { if (bEvent) { - if (!uiEventTimer) + if (m_bIsMovingToLunch) return; if (uiEventTimer < diff) { + uiEventTimer = 5000; + ++uiEventPhase; + switch(uiEventPhase) { case 1: - uiEventTimer = 0; - if (Unit* pUnit = Unit::GetUnit(*m_creature,uiPlayerGUID)) { if (GameObject* pGo = pUnit->GetGameObject(SPELL_LUNCH)) + { + m_bIsMovingToLunch = true; m_creature->GetMotionMaster()->MovePoint(POINT_ID, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ()); + } } break; case 2: - uiEventTimer = 5000; DoScriptText(EMOTE_EAT_LUNCH, m_creature); m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USESTANDING); break; case 3: - uiEventTimer = 5000; - if (Player* pUnit = Unit::GetPlayer(uiPlayerGUID)) pUnit->TalkedToCreature(m_creature->GetEntry(), m_creature->GetGUID()); @@ -166,9 +169,6 @@ struct TRINITY_DLL_DECL npc_kyle_frenziedAI : public ScriptedAI m_creature->GetMotionMaster()->Clear(); break; } - - if (uiEventPhase != 5) - ++uiEventPhase; } else uiEventTimer -= diff; |
