*hyjal update

-small cleanup
-disable loot and reputation gain from trash mobs if players didn't do enough dmg
-added raid damage to instance save
-disable loot for bosses if players do less then 50% damage based on boss' max health
-removed min players workaroud to start the events

--HG--
branch : trunk
This commit is contained in:
Rat
2009-04-10 22:02:52 +02:00
parent 1e61dffc89
commit ce0d9fbe8e
12 changed files with 47 additions and 31 deletions
@@ -110,6 +110,7 @@ struct TRINITY_DLL_DECL boss_anetheronAI : public hyjal_trashAI
void JustDied(Unit *victim) void JustDied(Unit *victim)
{ {
hyjal_trashAI::JustDied(victim);
if(pInstance && IsEvent) if(pInstance && IsEvent)
pInstance->SetData(DATA_ANETHERONEVENT, DONE); pInstance->SetData(DATA_ANETHERONEVENT, DONE);
DoPlaySoundToSet(m_creature, SOUND_ONDEATH); DoPlaySoundToSet(m_creature, SOUND_ONDEATH);
@@ -24,6 +24,7 @@ EndScriptData */
#include "precompiled.h" #include "precompiled.h"
#include "def_hyjal.h" #include "def_hyjal.h"
#include "SpellAuras.h" #include "SpellAuras.h"
#include "hyjal_trash.h"
//text id -1534018 are the text used when previous events complete. Not part of this script. //text id -1534018 are the text used when previous events complete. Not part of this script.
#define SAY_AGGRO -1534019 #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()); pInstance = ((ScriptedInstance*)c->GetInstanceData());
} }
@@ -426,6 +427,7 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI
void JustDied(Unit *victim) void JustDied(Unit *victim)
{ {
hyjal_trashAI::JustDied(victim);
DoScriptText(SAY_DEATH, m_creature); DoScriptText(SAY_DEATH, m_creature);
if(pInstance) if(pInstance)
@@ -693,6 +695,7 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
void WaypointReached(uint32 i){}
}; };
CreatureAI* GetAI_boss_archimonde(Creature *_Creature) CreatureAI* GetAI_boss_archimonde(Creature *_Creature)
@@ -103,6 +103,7 @@ struct TRINITY_DLL_DECL boss_azgalorAI : public hyjal_trashAI
void JustDied(Unit *victim) void JustDied(Unit *victim)
{ {
hyjal_trashAI::JustDied(victim);
if(pInstance && IsEvent) if(pInstance && IsEvent)
pInstance->SetData(DATA_AZGALOREVENT, DONE); pInstance->SetData(DATA_AZGALOREVENT, DONE);
DoPlaySoundToSet(m_creature, SOUND_ONDEATH); DoPlaySoundToSet(m_creature, SOUND_ONDEATH);
@@ -98,6 +98,7 @@ struct TRINITY_DLL_DECL boss_kazrogalAI : public hyjal_trashAI
void JustDied(Unit *victim) void JustDied(Unit *victim)
{ {
hyjal_trashAI::JustDied(victim);
if(pInstance && IsEvent) if(pInstance && IsEvent)
pInstance->SetData(DATA_KAZROGALEVENT, DONE); pInstance->SetData(DATA_KAZROGALEVENT, DONE);
DoPlaySoundToSet(m_creature, SOUND_ONDEATH); DoPlaySoundToSet(m_creature, SOUND_ONDEATH);
@@ -94,6 +94,7 @@ struct TRINITY_DLL_DECL boss_rage_winterchillAI : public hyjal_trashAI
void JustDied(Unit *victim) void JustDied(Unit *victim)
{ {
hyjal_trashAI::JustDied(victim);
if(pInstance && IsEvent) if(pInstance && IsEvent)
pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, DONE); pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, DONE);
DoPlaySoundToSet(m_creature, SOUND_ONDEATH); DoPlaySoundToSet(m_creature, SOUND_ONDEATH);
@@ -26,6 +26,8 @@
#define DATA_RESET_TRASH_COUNT 15 #define DATA_RESET_TRASH_COUNT 15
#define DATA_ALLIANCE_RETREAT 16 #define DATA_ALLIANCE_RETREAT 16
#define DATA_HORDE_RETREAT 17 #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" #define ERROR_INST_DATA "TSCR: Instance data not set properly for Mount Hyjal. Encounters will be buggy"
#endif #endif
@@ -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->ADD_GOSSIP_ITEM(2, "[GM] Toggle Debug Timers", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
player->SEND_GOSSIP_MENU(907, _Creature->GetGUID()); player->SEND_GOSSIP_MENU(907, _Creature->GetGUID());
return true; return true;
} }
bool GossipSelect_npc_jaina_proudmoore(Player *player, Creature *_Creature, uint32 sender, uint32 action) 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()); hyjalAI* ai = ((hyjalAI*)_Creature->AI());
switch(action) 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"); debug_log("SD2: HyjalAI - Debug mode has been toggled");
break; break;
} }
return true; return true;
} }
@@ -138,12 +131,10 @@ CreatureAI* GetAI_npc_thrall(Creature *_Creature)
bool GossipHello_npc_thrall(Player *player, Creature *_Creature) bool GossipHello_npc_thrall(Player *player, Creature *_Creature)
{ {
hyjalAI* ai = ((hyjalAI*)_Creature->AI()); hyjalAI* ai = ((hyjalAI*)_Creature->AI());
if (ai->EventBegun) if (ai->EventBegun)
return false; return false;
uint32 AnetheronEvent = ai->GetInstanceData(DATA_ANETHERONEVENT); uint32 AnetheronEvent = ai->GetInstanceData(DATA_ANETHERONEVENT);
// Only let them start the Horde phases if Anetheron is dead. // Only let them start the Horde phases if Anetheron is dead.
if (AnetheronEvent == DONE && ai->GetInstanceData(DATA_ALLIANCE_RETREAT)) 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->ADD_GOSSIP_ITEM(2, "[GM] Toggle Debug Timers", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
player->SEND_GOSSIP_MENU(907, _Creature->GetGUID()); player->SEND_GOSSIP_MENU(907, _Creature->GetGUID());
return true; return true;
} }
bool GossipSelect_npc_thrall(Player *player, Creature *_Creature, uint32 sender, uint32 action) 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()); hyjalAI* ai = ((hyjalAI*)_Creature->AI());
ai->DeSpawnVeins();//despawn the alliance veins ai->DeSpawnVeins();//despawn the alliance veins
switch(action) 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"); debug_log("SD2: HyjalAI - Debug mode has been toggled");
break; break;
} }
return true; return true;
} }
@@ -201,14 +185,12 @@ CreatureAI* GetAI_npc_tyrande_whisperwind(Creature *_Creature)
hyjalAI* ai = new hyjalAI(_Creature); hyjalAI* ai = new hyjalAI(_Creature);
ai->Reset(); ai->Reset();
ai->EnterEvadeMode(); ai->EnterEvadeMode();
return ai; return ai;
} }
bool GossipHello_npc_tyrande_whisperwind(Player* player, Creature* _Creature) bool GossipHello_npc_tyrande_whisperwind(Player* player, Creature* _Creature)
{ {
hyjalAI* ai = ((hyjalAI*)_Creature->AI()); 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); uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT);
// Only let them get item if Azgalor is dead. // 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()); player->SEND_GOSSIP_MENU(907, _Creature->GetGUID());
hyjalAI* ai = ((hyjalAI*)_Creature->AI()); hyjalAI* ai = ((hyjalAI*)_Creature->AI());
} }
return true; return true;
} }
@@ -498,7 +498,11 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3])
((hyjal_trashAI*)pCreature->AI())->IsEvent = true; ((hyjal_trashAI*)pCreature->AI())->IsEvent = true;
break; break;
} }
if(pInstance)
{
if(pInstance->GetData(DATA_RAIDDAMAGE) < MINRAIDDAMAGE)
pCreature->SetDisableReputationGain(true);//no repu for solo farming
}
// Check if creature is a boss. // Check if creature is a boss.
if (pCreature->isWorldBoss()) if (pCreature->isWorldBoss())
{ {
@@ -971,6 +975,7 @@ void hyjalAI::JustDied(Unit* killer)
pInstance->SetData(DATA_KAZROGALEVENT, NOT_STARTED); pInstance->SetData(DATA_KAZROGALEVENT, NOT_STARTED);
if(pInstance->GetData(DATA_AZGALOREVENT) == IN_PROGRESS) if(pInstance->GetData(DATA_AZGALOREVENT) == IN_PROGRESS)
pInstance->SetData(DATA_AZGALOREVENT, NOT_STARTED); pInstance->SetData(DATA_AZGALOREVENT, NOT_STARTED);
pInstance->SetData(DATA_RESET_RAIDDAMAGE, NULL);//reset damage on die
} }
} }
void hyjalAI::HideNearPos(float x, float y) void hyjalAI::HideNearPos(float x, float y)
@@ -8,10 +8,6 @@
#include "def_hyjal.h" #include "def_hyjal.h"
#include "../../../npc/npc_escortAI.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 // Trash Mobs summoned in waves
#define NECROMANCER 17899//done #define NECROMANCER 17899//done
#define ABOMINATION 17898//done #define ABOMINATION 17898//done
@@ -145,13 +145,18 @@ hyjal_trashAI::hyjal_trashAI(Creature *c) : npc_escortAI(c)
SetupOverrun = false; SetupOverrun = false;
faction = 0; faction = 0;
useFlyPath = false; useFlyPath = false;
damageTaken = 0;
Reset(); Reset();
} }
void hyjal_trashAI::DamageTaken(Unit *done_by, uint32 &damage) 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 if(done_by->GetTypeId() == TYPEID_PLAYER)
damage = 0; {
damageTaken += damage;
if(pInstance)
pInstance->SetData(DATA_RAIDDAMAGE,damage);//store raid's damage
}
} }
void hyjal_trashAI::Aggro(Unit *who){} void hyjal_trashAI::Aggro(Unit *who){}
@@ -328,9 +333,13 @@ void hyjal_trashAI::UpdateAI(const uint32 diff)
void hyjal_trashAI::JustDied(Unit *victim) 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 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) if(IsOverrun)
{ {
float x,y,z,o; float x,y,z,o;
@@ -5,6 +5,8 @@
#include "def_hyjal.h" #include "def_hyjal.h"
#include "../../../npc/npc_escortAI.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 struct TRINITY_DLL_DECL hyjal_trashAI : public npc_escortAI
{ {
hyjal_trashAI(Creature *c); hyjal_trashAI(Creature *c);
@@ -31,6 +33,7 @@ struct TRINITY_DLL_DECL hyjal_trashAI : public npc_escortAI
uint32 OverrunType; uint32 OverrunType;
uint8 faction; uint8 faction;
bool useFlyPath; bool useFlyPath;
uint32 damageTaken;
//private: //private:
}; };
@@ -23,6 +23,7 @@ EndScriptData */
#include "precompiled.h" #include "precompiled.h"
#include "def_hyjal.h" #include "def_hyjal.h"
#include "hyjal_trash.h"
#define ENCOUNTERS 5 #define ENCOUNTERS 5
@@ -56,6 +57,8 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
uint32 allianceRetreat; uint32 allianceRetreat;
bool ArchiYell; bool ArchiYell;
uint32 RaidDamage;
void Initialize() void Initialize()
{ {
RageWinterchill = 0; RageWinterchill = 0;
@@ -69,6 +72,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
HordeGate = 0; HordeGate = 0;
ElfGate = 0; ElfGate = 0;
ArchiYell = false; ArchiYell = false;
RaidDamage = 0;
Trash = 0; Trash = 0;
for(uint8 i = 0; i < ENCOUNTERS; ++i) for(uint8 i = 0; i < ENCOUNTERS; ++i)
@@ -212,6 +216,14 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
OpenDoor(ElfGate,true); OpenDoor(ElfGate,true);
SaveToDB(); SaveToDB();
break; 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); 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_TRASH: return Trash;
case DATA_ALLIANCE_RETREAT: return allianceRetreat; case DATA_ALLIANCE_RETREAT: return allianceRetreat;
case DATA_HORDE_RETREAT: return hordeRetreat; case DATA_HORDE_RETREAT: return hordeRetreat;
case DATA_RAIDDAMAGE: return RaidDamage;
} }
return 0; return 0;
} }
@@ -255,7 +268,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
OUT_SAVE_INST_DATA; OUT_SAVE_INST_DATA;
std::ostringstream stream; std::ostringstream stream;
stream << Encounters[0] << " " << Encounters[1] << " " << Encounters[2] << " " 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]; char* out = new char[stream.str().length() + 1];
strcpy(out, stream.str().c_str()); strcpy(out, stream.str().c_str());
if(out) if(out)
@@ -278,7 +291,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
OUT_LOAD_INST_DATA(in); OUT_LOAD_INST_DATA(in);
std::istringstream loadStream; std::istringstream loadStream;
loadStream.str(in); 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) for(uint8 i = 0; i < ENCOUNTERS; ++i)
if(Encounters[i] == IN_PROGRESS) // Do not load an encounter as IN_PROGRESS - reset it instead. if(Encounters[i] == IN_PROGRESS) // Do not load an encounter as IN_PROGRESS - reset it instead.
Encounters[i] = NOT_STARTED; Encounters[i] = NOT_STARTED;