mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-19 11:55:43 +00:00
fix(Core/Script): Tomb of 7 in brd (#7991)
This commit is contained in:
@@ -55,9 +55,6 @@ enum DataTypes
|
||||
DATA_GO_BAR_DOOR = 18,
|
||||
DATA_GO_CHALICE = 19,
|
||||
|
||||
DATA_GHOSTKILL = 20,
|
||||
DATA_EVENSTARTER = 21,
|
||||
|
||||
DATA_GOLEM_DOOR_N = 22,
|
||||
DATA_GOLEM_DOOR_S = 23,
|
||||
|
||||
|
||||
@@ -37,6 +37,11 @@ enum Misc
|
||||
DATA_SKILLPOINT_MIN = 230
|
||||
};
|
||||
|
||||
enum Says
|
||||
{
|
||||
SAY_START_FIGHT = 0
|
||||
};
|
||||
|
||||
enum Gossip
|
||||
{
|
||||
GOSSIP_TEXT_CONTINUE = 1828, // Continue...
|
||||
@@ -135,7 +140,10 @@ public:
|
||||
// Start encounter
|
||||
InstanceScript* instance = creature->GetInstanceScript();
|
||||
if (instance)
|
||||
instance->SetGuidData(DATA_EVENSTARTER, player->GetGUID());
|
||||
{
|
||||
instance->SetData(TYPE_TOMB_OF_SEVEN, IN_PROGRESS);
|
||||
}
|
||||
creature->AI()->Talk(SAY_START_FIGHT);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
@@ -170,16 +178,19 @@ public:
|
||||
Voidwalkers = false;
|
||||
// Reset his gossip menu
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
|
||||
me->setFaction(FACTION_FRIEND);
|
||||
|
||||
// was set before event start, so set again
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
|
||||
|
||||
if (instance->GetData(DATA_GHOSTKILL) >= 7)
|
||||
if (instance->GetData(TYPE_TOMB_OF_SEVEN) == DONE) // what is this trying to do? Probably some kind of crash recovery
|
||||
{
|
||||
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
}
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) override
|
||||
@@ -200,12 +211,6 @@ public:
|
||||
if (me->IsAlive())
|
||||
me->GetMotionMaster()->MoveTargetedHome();
|
||||
me->SetLootRecipient(nullptr);
|
||||
instance->SetGuidData(DATA_EVENSTARTER, ObjectGuid::Empty);
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
instance->SetData(DATA_GHOSTKILL, 1);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
|
||||
@@ -16,12 +16,18 @@
|
||||
*/
|
||||
|
||||
#include "blackrock_depths.h"
|
||||
#include "Player.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
#define TIMER_TOMBOFTHESEVEN 30000
|
||||
#define TIMER_TOMB_START 5000
|
||||
#define MAX_ENCOUNTER 6
|
||||
#define MAX_ENCOUNTER 6
|
||||
|
||||
enum Timers
|
||||
{
|
||||
TIMER_TOMBOFTHESEVEN = 30000,
|
||||
TIMER_TOMB_START = 1000,
|
||||
TIMER_TOMB_RESET = 15000
|
||||
};
|
||||
|
||||
enum Creatures
|
||||
{
|
||||
@@ -148,7 +154,7 @@ public:
|
||||
uint32 BarAleCount;
|
||||
uint32 GhostKillCount;
|
||||
ObjectGuid TombBossGUIDs[7];
|
||||
ObjectGuid TombEventStarterGUID;
|
||||
uint32 tombResetTimer;
|
||||
uint32 TombTimer;
|
||||
uint32 TombEventCounter;
|
||||
uint32 OpenedCoofers;
|
||||
@@ -165,6 +171,7 @@ public:
|
||||
TombTimer = TIMER_TOMB_START;
|
||||
TombEventCounter = 0;
|
||||
OpenedCoofers = 0;
|
||||
tombResetTimer = 0;
|
||||
}
|
||||
|
||||
void OnCreatureCreate(Creature* creature) override
|
||||
@@ -310,21 +317,20 @@ public:
|
||||
case NPC_WRATH_HAMMER_CONSTRUCT:
|
||||
ArgelmachAdds.remove(unit->GetGUID());
|
||||
break;
|
||||
default:
|
||||
case NPC_ANGERREL:
|
||||
case NPC_DOPEREL:
|
||||
case NPC_HATEREL:
|
||||
case NPC_VILEREL:
|
||||
case NPC_SEETHREL:
|
||||
case NPC_GLOOMREL:
|
||||
case NPC_DOOMREL:
|
||||
GhostKillCount++;
|
||||
if (GhostKillCount >= 7)
|
||||
{
|
||||
SetData(TYPE_TOMB_OF_SEVEN, DONE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SetGuidData(uint32 type, ObjectGuid data) override
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DATA_EVENSTARTER:
|
||||
TombEventStarterGUID = data;
|
||||
if (!TombEventStarterGUID)
|
||||
TombOfSevenReset();//reset
|
||||
else
|
||||
TombOfSevenStart();//start
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -349,6 +355,18 @@ public:
|
||||
break;
|
||||
case TYPE_TOMB_OF_SEVEN:
|
||||
encounter[3] = data;
|
||||
switch (data)
|
||||
{
|
||||
case IN_PROGRESS:
|
||||
HandleGameObject(GoTombExitGUID, false);
|
||||
HandleGameObject(GoTombEnterGUID, false);
|
||||
break;
|
||||
case DONE:
|
||||
DoRespawnGameObject(GoChestGUID, DAY);
|
||||
HandleGameObject(GoTombExitGUID, true);
|
||||
HandleGameObject(GoTombEnterGUID, true);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case TYPE_LYCEUM:
|
||||
encounter[4] = data;
|
||||
@@ -356,9 +374,6 @@ public:
|
||||
case TYPE_IRON_HALL:
|
||||
encounter[5] = data;
|
||||
break;
|
||||
case DATA_GHOSTKILL:
|
||||
GhostKillCount += data;
|
||||
break;
|
||||
case DATA_OPEN_COFFER_DOORS:
|
||||
OpenedCoofers += 1;
|
||||
if (OpenedCoofers == 12)
|
||||
@@ -477,8 +492,6 @@ public:
|
||||
return encounter[4];
|
||||
case TYPE_IRON_HALL:
|
||||
return encounter[5];
|
||||
case DATA_GHOSTKILL:
|
||||
return GhostKillCount;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -509,8 +522,6 @@ public:
|
||||
return GoBarKegTrapGUID;
|
||||
case DATA_GO_BAR_DOOR:
|
||||
return GoBarDoorGUID;
|
||||
case DATA_EVENSTARTER:
|
||||
return TombEventStarterGUID;
|
||||
case DATA_SF_BRAZIER_N:
|
||||
return GoSFNGUID;
|
||||
case DATA_SF_BRAZIER_S:
|
||||
@@ -568,18 +579,26 @@ public:
|
||||
{
|
||||
if (Creature* boss = instance->GetCreature(TombBossGUIDs[TombEventCounter]))
|
||||
{
|
||||
++TombEventCounter;
|
||||
boss->setFaction(FACTION_HOSTILE);
|
||||
boss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
|
||||
if (Unit* target = boss->SelectNearestTarget(500))
|
||||
|
||||
// find suitable target here.
|
||||
Player* target = boss->SelectNearestPlayer(130);
|
||||
if (target && boss->CanCreatureAttack(target, true))
|
||||
{
|
||||
boss->AI()->AttackStart(target);
|
||||
boss->AI()->DoZoneInCombat();
|
||||
tombResetTimer = TIMER_TOMB_RESET;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TombOfSevenReset()
|
||||
{
|
||||
HandleGameObject(GoTombExitGUID, false);//event reseted, close exit door
|
||||
HandleGameObject(GoTombEnterGUID, true);//event reseted, open entrance door
|
||||
HandleGameObject(GoTombExitGUID, false);// close exit door
|
||||
HandleGameObject(GoTombEnterGUID, true);// open entrance door
|
||||
for (uint8 i = 0; i < 7; ++i)
|
||||
{
|
||||
if (Creature* boss = instance->GetCreature(TombBossGUIDs[i]))
|
||||
@@ -596,54 +615,63 @@ public:
|
||||
boss->SetLootRecipient(nullptr);
|
||||
}
|
||||
boss->setFaction(FACTION_FRIEND);
|
||||
boss->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); // think this is useless
|
||||
if (i == 6) // doomrel needs explicit reset
|
||||
{
|
||||
boss->AI()->Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GhostKillCount = 0;
|
||||
TombEventCounter = 0;
|
||||
TombTimer = TIMER_TOMB_START;
|
||||
SetData(TYPE_TOMB_OF_SEVEN, NOT_STARTED);
|
||||
}
|
||||
|
||||
void TombOfSevenStart()
|
||||
bool CheckTombReset(uint32 diff)
|
||||
{
|
||||
HandleGameObject(GoTombExitGUID, false);//event started, close exit door
|
||||
HandleGameObject(GoTombEnterGUID, false);//event started, close entrance door
|
||||
SetData(TYPE_TOMB_OF_SEVEN, IN_PROGRESS);
|
||||
bool anyBossAlive = false; // status of the bosses up until the current one
|
||||
for (uint8 i = 0; i < TombEventCounter; i++)
|
||||
{
|
||||
Creature* boss = instance->GetCreature(TombBossGUIDs[i]);
|
||||
if (boss)
|
||||
{
|
||||
anyBossAlive |= boss->IsAlive();
|
||||
if (boss->IsAlive() && boss->IsInCombat())
|
||||
{
|
||||
tombResetTimer = TIMER_TOMB_RESET;
|
||||
return false; // any boss in combat means we shouldn't reset.
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!anyBossAlive) // no boss alive, put reset timer back up
|
||||
{
|
||||
tombResetTimer = TIMER_TOMB_RESET;
|
||||
}
|
||||
tombResetTimer -= diff;
|
||||
return tombResetTimer < diff;
|
||||
}
|
||||
|
||||
void TombOfSevenEnd()
|
||||
{
|
||||
DoRespawnGameObject(GoChestGUID, DAY);
|
||||
HandleGameObject(GoTombExitGUID, true);//event done, open exit door
|
||||
HandleGameObject(GoTombEnterGUID, true);//event done, open entrance door
|
||||
TombEventStarterGUID.Clear();
|
||||
SetData(TYPE_TOMB_OF_SEVEN, DONE);
|
||||
}
|
||||
void Update(uint32 diff) override
|
||||
{
|
||||
if (TombEventStarterGUID && GhostKillCount < 7)
|
||||
if ((GetData(TYPE_TOMB_OF_SEVEN) == IN_PROGRESS) && GhostKillCount < 7)
|
||||
{
|
||||
if (TombTimer <= diff)
|
||||
{
|
||||
TombTimer = TIMER_TOMBOFTHESEVEN;
|
||||
TombOfSevenEvent();
|
||||
++TombEventCounter;
|
||||
// Check Killed bosses
|
||||
for (uint8 i = 0; i < 7; ++i)
|
||||
{
|
||||
if (Creature* boss = instance->GetCreature(TombBossGUIDs[i]))
|
||||
{
|
||||
if (!boss->IsAlive())
|
||||
{
|
||||
GhostKillCount = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else TombTimer -= diff;
|
||||
else
|
||||
{
|
||||
TombTimer -= diff;
|
||||
}
|
||||
|
||||
if (CheckTombReset(diff))
|
||||
{
|
||||
TombOfSevenReset();
|
||||
}
|
||||
}
|
||||
if (GhostKillCount >= 7 && TombEventStarterGUID)
|
||||
TombOfSevenEnd();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user