diff options
12 files changed, 47 insertions, 31 deletions
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_anetheron.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_anetheron.cpp index 5fb5577960b..25e22f8f391 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_anetheron.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_anetheron.cpp @@ -110,6 +110,7 @@ struct TRINITY_DLL_DECL boss_anetheronAI : public hyjal_trashAI void JustDied(Unit *victim) { + hyjal_trashAI::JustDied(victim); if(pInstance && IsEvent) pInstance->SetData(DATA_ANETHERONEVENT, DONE); DoPlaySoundToSet(m_creature, SOUND_ONDEATH); diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp index 4095ef9ca23..89585b039fd 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp @@ -24,6 +24,7 @@ EndScriptData */ #include "precompiled.h" #include "def_hyjal.h" #include "SpellAuras.h" +#include "hyjal_trash.h" //text id -1534018 are the text used when previous events complete. Not part of this script. #define SAY_AGGRO -1534019 @@ -323,9 +324,9 @@ struct TargetDistanceOrder : public std::binary_function<const Unit, const Unit, } }; -struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI +struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI { - boss_archimondeAI(Creature *c) : ScriptedAI(c) + boss_archimondeAI(Creature *c) : hyjal_trashAI(c) { pInstance = ((ScriptedInstance*)c->GetInstanceData()); } @@ -426,6 +427,7 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI void JustDied(Unit *victim) { + hyjal_trashAI::JustDied(victim); DoScriptText(SAY_DEATH, m_creature); if(pInstance) @@ -693,6 +695,7 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI DoMeleeAttackIfReady(); } + void WaypointReached(uint32 i){} }; CreatureAI* GetAI_boss_archimonde(Creature *_Creature) diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_azgalor.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_azgalor.cpp index 3228566c6e8..85948706145 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_azgalor.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_azgalor.cpp @@ -103,6 +103,7 @@ struct TRINITY_DLL_DECL boss_azgalorAI : public hyjal_trashAI void JustDied(Unit *victim) { + hyjal_trashAI::JustDied(victim); if(pInstance && IsEvent) pInstance->SetData(DATA_AZGALOREVENT, DONE); DoPlaySoundToSet(m_creature, SOUND_ONDEATH); diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_kazrogal.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_kazrogal.cpp index 29674dac0ff..6bd24fca7a4 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_kazrogal.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_kazrogal.cpp @@ -98,6 +98,7 @@ struct TRINITY_DLL_DECL boss_kazrogalAI : public hyjal_trashAI void JustDied(Unit *victim) { + hyjal_trashAI::JustDied(victim); if(pInstance && IsEvent) pInstance->SetData(DATA_KAZROGALEVENT, DONE); DoPlaySoundToSet(m_creature, SOUND_ONDEATH); diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_rage_winterchill.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_rage_winterchill.cpp index 1bc8823d3e6..b125668947c 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_rage_winterchill.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_rage_winterchill.cpp @@ -94,6 +94,7 @@ struct TRINITY_DLL_DECL boss_rage_winterchillAI : public hyjal_trashAI void JustDied(Unit *victim) { + hyjal_trashAI::JustDied(victim); if(pInstance && IsEvent) pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, DONE); DoPlaySoundToSet(m_creature, SOUND_ONDEATH); 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 f6a77174e5d..ed02258cd9f 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 @@ -26,6 +26,8 @@ #define DATA_RESET_TRASH_COUNT 15 #define DATA_ALLIANCE_RETREAT 16 #define DATA_HORDE_RETREAT 17 +#define DATA_RAIDDAMAGE 18 +#define DATA_RESET_RAIDDAMAGE 19 #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/hyjal.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal.cpp index 9664fe6bf5f..312aa90a686 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal.cpp @@ -83,17 +83,11 @@ bool GossipHello_npc_jaina_proudmoore(Player *player, Creature *_Creature) player->ADD_GOSSIP_ITEM(2, "[GM] Toggle Debug Timers", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->SEND_GOSSIP_MENU(907, _Creature->GetGUID()); - return true; } bool GossipSelect_npc_jaina_proudmoore(Player *player, Creature *_Creature, uint32 sender, uint32 action) { - if(_Creature->GetMap()->GetPlayersCountExceptGMs() < MINPLAYERS && !player->isGameMaster()) - { - _Creature->Say("Did you come to die with me?",0,0); - return true; - } hyjalAI* ai = ((hyjalAI*)_Creature->AI()); switch(action) { @@ -113,7 +107,6 @@ bool GossipSelect_npc_jaina_proudmoore(Player *player, Creature *_Creature, uint debug_log("SD2: HyjalAI - Debug mode has been toggled"); break; } - return true; } @@ -138,12 +131,10 @@ CreatureAI* GetAI_npc_thrall(Creature *_Creature) bool GossipHello_npc_thrall(Player *player, Creature *_Creature) { hyjalAI* ai = ((hyjalAI*)_Creature->AI()); - if (ai->EventBegun) return false; uint32 AnetheronEvent = ai->GetInstanceData(DATA_ANETHERONEVENT); - // Only let them start the Horde phases if Anetheron is dead. if (AnetheronEvent == DONE && ai->GetInstanceData(DATA_ALLIANCE_RETREAT)) { @@ -161,17 +152,11 @@ bool GossipHello_npc_thrall(Player *player, Creature *_Creature) player->ADD_GOSSIP_ITEM(2, "[GM] Toggle Debug Timers", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->SEND_GOSSIP_MENU(907, _Creature->GetGUID()); - return true; } bool GossipSelect_npc_thrall(Player *player, Creature *_Creature, uint32 sender, uint32 action) { - if(_Creature->GetMap()->GetPlayersCountExceptGMs() < MINPLAYERS && !player->isGameMaster())//to stop idiot farmers - { - _Creature->Say("Did you come to die with me?",0,0); - return true; - } hyjalAI* ai = ((hyjalAI*)_Creature->AI()); ai->DeSpawnVeins();//despawn the alliance veins switch(action) @@ -192,7 +177,6 @@ bool GossipSelect_npc_thrall(Player *player, Creature *_Creature, uint32 sender, debug_log("SD2: HyjalAI - Debug mode has been toggled"); break; } - return true; } @@ -201,14 +185,12 @@ CreatureAI* GetAI_npc_tyrande_whisperwind(Creature *_Creature) hyjalAI* ai = new hyjalAI(_Creature); ai->Reset(); ai->EnterEvadeMode(); - return ai; } bool GossipHello_npc_tyrande_whisperwind(Player* player, Creature* _Creature) { hyjalAI* ai = ((hyjalAI*)_Creature->AI()); - //ai->DeSpawnVeins();//dont despawn the horde veins if someone takes the item from Tyrande uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT); // Only let them get item if Azgalor is dead. @@ -233,7 +215,6 @@ bool GossipSelect_npc_tyrande_whisperwind(Player *player, Creature *_Creature, u player->SEND_GOSSIP_MENU(907, _Creature->GetGUID()); hyjalAI* ai = ((hyjalAI*)_Creature->AI()); } - return true; } 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 582cab0e290..f0112fe22f5 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 @@ -498,7 +498,11 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3]) ((hyjal_trashAI*)pCreature->AI())->IsEvent = true; break; } - + if(pInstance) + { + if(pInstance->GetData(DATA_RAIDDAMAGE) < MINRAIDDAMAGE) + pCreature->SetDisableReputationGain(true);//no repu for solo farming + } // Check if creature is a boss. if (pCreature->isWorldBoss()) { @@ -971,6 +975,7 @@ void hyjalAI::JustDied(Unit* killer) pInstance->SetData(DATA_KAZROGALEVENT, NOT_STARTED); if(pInstance->GetData(DATA_AZGALOREVENT) == IN_PROGRESS) pInstance->SetData(DATA_AZGALOREVENT, NOT_STARTED); + pInstance->SetData(DATA_RESET_RAIDDAMAGE, NULL);//reset damage on die } } void hyjalAI::HideNearPos(float x, float y) 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 ba74c248707..4a2fbd6494e 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 @@ -8,10 +8,6 @@ #include "def_hyjal.h" #include "../../../npc/npc_escortAI.h" - -#define MINPLAYERS 1//min players on the map (except gms) to start the events, to prevent one player farming - - // Trash Mobs summoned in waves #define NECROMANCER 17899//done #define ABOMINATION 17898//done diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.cpp index f9f4f68fb42..3f6fd1044ff 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.cpp @@ -145,13 +145,18 @@ hyjal_trashAI::hyjal_trashAI(Creature *c) : npc_escortAI(c) SetupOverrun = false; faction = 0; useFlyPath = false; + damageTaken = 0; Reset(); } void hyjal_trashAI::DamageTaken(Unit *done_by, uint32 &damage) { - if(IsOverrun && done_by->GetTypeId() == TYPEID_UNIT && ((Creature*)done_by)->GetEntry() == 17931)//don't take dmg from the dummy target - damage = 0; + if(done_by->GetTypeId() == TYPEID_PLAYER) + { + damageTaken += damage; + if(pInstance) + pInstance->SetData(DATA_RAIDDAMAGE,damage);//store raid's damage + } } void hyjal_trashAI::Aggro(Unit *who){} @@ -328,9 +333,13 @@ void hyjal_trashAI::UpdateAI(const uint32 diff) void hyjal_trashAI::JustDied(Unit *victim) { - if(pInstance && IsEvent) + if(!pInstance)return; + if(IsEvent && !m_creature->isWorldBoss()) pInstance->SetData(DATA_TRASH, 0);//signal trash is dead + if((pInstance->GetData(DATA_RAIDDAMAGE) < MINRAIDDAMAGE && !m_creature->isWorldBoss()) || (damageTaken < m_creature->GetMaxHealth()/2 && m_creature->isWorldBoss())) + m_creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);//no loot + if(IsOverrun) { float x,y,z,o; diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.h b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.h index 2473184dc87..3ea12038436 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.h +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.h @@ -5,6 +5,8 @@ #include "def_hyjal.h" #include "../../../npc/npc_escortAI.h" +#define MINRAIDDAMAGE 1000000//minimal damage before trash can drop loot and reputation + struct TRINITY_DLL_DECL hyjal_trashAI : public npc_escortAI { hyjal_trashAI(Creature *c); @@ -31,6 +33,7 @@ struct TRINITY_DLL_DECL hyjal_trashAI : public npc_escortAI uint32 OverrunType; uint8 faction; bool useFlyPath; + uint32 damageTaken; //private: }; 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 1a0aaafb35b..b4fc3a65222 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,6 +23,7 @@ EndScriptData */ #include "precompiled.h" #include "def_hyjal.h" +#include "hyjal_trash.h" #define ENCOUNTERS 5 @@ -56,6 +57,8 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance uint32 allianceRetreat; bool ArchiYell; + uint32 RaidDamage; + void Initialize() { RageWinterchill = 0; @@ -69,6 +72,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance HordeGate = 0; ElfGate = 0; ArchiYell = false; + RaidDamage = 0; Trash = 0; for(uint8 i = 0; i < ENCOUNTERS; ++i) @@ -212,6 +216,14 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance OpenDoor(ElfGate,true); SaveToDB(); break; + case DATA_RAIDDAMAGE: + RaidDamage += data; + if(RaidDamage >= MINRAIDDAMAGE) + RaidDamage = MINRAIDDAMAGE; + break; + case DATA_RESET_RAIDDAMAGE: + RaidDamage = 0; + break; } debug_log("SD2: Instance Hyjal: Instance data updated for event %u (Data=%u)",type,data); @@ -232,6 +244,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance case DATA_TRASH: return Trash; case DATA_ALLIANCE_RETREAT: return allianceRetreat; case DATA_HORDE_RETREAT: return hordeRetreat; + case DATA_RAIDDAMAGE: return RaidDamage; } return 0; } @@ -255,7 +268,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance OUT_SAVE_INST_DATA; std::ostringstream stream; stream << Encounters[0] << " " << Encounters[1] << " " << Encounters[2] << " " - << Encounters[3] << " " << Encounters[4] << " " << allianceRetreat << " " << hordeRetreat; + << Encounters[3] << " " << Encounters[4] << " " << allianceRetreat << " " << hordeRetreat << " " << RaidDamage; char* out = new char[stream.str().length() + 1]; strcpy(out, stream.str().c_str()); if(out) @@ -278,7 +291,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance OUT_LOAD_INST_DATA(in); std::istringstream loadStream; loadStream.str(in); - loadStream >> Encounters[0] >> Encounters[1] >> Encounters[2] >> Encounters[3] >> Encounters[4] >> allianceRetreat >> hordeRetreat; + loadStream >> Encounters[0] >> Encounters[1] >> Encounters[2] >> Encounters[3] >> Encounters[4] >> allianceRetreat >> hordeRetreat >> RaidDamage; for(uint8 i = 0; i < ENCOUNTERS; ++i) if(Encounters[i] == IN_PROGRESS) // Do not load an encounter as IN_PROGRESS - reset it instead. Encounters[i] = NOT_STARTED; |