Compare commits

...

9 Commits

5 changed files with 111 additions and 79 deletions

View File

@ -0,0 +1,34 @@
-- Declare variables for item IDs
SET @item_severed_arm = 45323;
SET @item_bloated_slippery_eel = 45328;
SET @quest_disarmed = 13836;
-- Delete Severed Arm from fish loot
DELETE FROM `fishing_loot_template`
WHERE `entry` = 4567 AND `item` = @item_severed_arm;
-- Delete Bloated Slippery Eel from fish loot (water outside of Dalaran, where Quest Item was before patch 3.3.3)
DELETE FROM `fishing_loot_template`
WHERE `entry` = 3979 AND `item` = @item_bloated_slippery_eel;
-- Delete Bloated Slippery Eel from gameobject loot (fishing holes outside of Dalaran, where Quest Item was before patch 3.3.3)
DELETE FROM `gameobject_loot_template`
WHERE `entry` = 25671 AND `item` = @item_bloated_slippery_eel;
-- Update Bloated Slippery Eel entry in reference loot (the quest fish already exists in loot table but is in "wrong" water; move it to outside of the prison)
UPDATE `reference_loot_template`
SET `entry` = 11024
WHERE `entry` = 11026 AND `item` = @item_bloated_slippery_eel;
-- Update conditions according to the changed entry in `reference_loot_template`
UPDATE `conditions`
SET `sourceGroup` = 11024
WHERE `sourceGroup` = 11026 AND `sourceEntry` = @item_bloated_slippery_eel AND `conditionValue1` = @quest_disarmed;
-- Delete outdated condition
DELETE FROM `conditions`
WHERE `sourceGroup` = 25671 AND `sourceEntry` = @item_bloated_slippery_eel AND `conditionValue1` = @quest_disarmed;
-- Delete duplicated Corroded Jewelry from fish loot
DELETE FROM `fishing_loot_template`
WHERE `entry` = 4560 AND `item` = 45903;

View File

@ -633,6 +633,7 @@ void BossAI::_Reset()
me->ResetLootMode();
events.Reset();
scheduler.CancelAll();
me->m_Events.KillAllEvents(false);
summons.DespawnAll();
ClearUniqueTimedEventsDone();
_healthCheckEvents.clear();
@ -787,6 +788,20 @@ void BossAI::ScheduleHealthCheckEvent(std::initializer_list<uint8> healthPct, st
_nextHealthCheck = _healthCheckEvents.front();
}
void BossAI::ScheduleEnrageTimer(uint32 spellId, Milliseconds timer, uint8 textId /*= 0*/)
{
me->m_Events.AddEventAtOffset([this, spellId, textId]
{
if (!me->IsAlive())
return;
if (textId)
Talk(textId);
DoCastSelf(spellId, true);
}, timer);
}
// WorldBossAI - for non-instanced bosses
WorldBossAI::WorldBossAI(Creature* creature) :

View File

@ -485,6 +485,12 @@ public:
void ScheduleHealthCheckEvent(uint32 healthPct, std::function<void()> exec);
void ScheduleHealthCheckEvent(std::initializer_list<uint8> healthPct, std::function<void()> exec);
// @brief Casts the spell after the fixed time and says the text id if provided. Timer will run even if the creature is casting or out of combat.
// @param spellId The spell to cast.
// @param timer The time to wait before casting the spell.
// @param textId The text id to say.
void ScheduleEnrageTimer(uint32 spellId, Milliseconds timer, uint8 textId = 0);
// Hook used to execute events scheduled into EventMap without the need
// to override UpdateAI
// note: You must re-schedule the event within this method if the event

View File

@ -588,16 +588,20 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
if (t_diff)
_dynamicTree.update(t_diff);
/// update worldsessions for existing players
// Update world sessions and players
for (m_mapRefIter = m_mapRefMgr.begin(); m_mapRefIter != m_mapRefMgr.end(); ++m_mapRefIter)
{
Player* player = m_mapRefIter->GetSource();
if (player && player->IsInWorld())
{
//player->Update(t_diff);
// Update session
WorldSession* session = player->GetSession();
MapSessionFilter updater(session);
session->Update(s_diff, updater);
// update players at tick
if (!t_diff)
player->Update(s_diff);
}
}
@ -605,17 +609,6 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
if (!t_diff)
{
for (m_mapRefIter = m_mapRefMgr.begin(); m_mapRefIter != m_mapRefMgr.end(); ++m_mapRefIter)
{
Player* player = m_mapRefIter->GetSource();
if (!player || !player->IsInWorld())
continue;
// update players at tick
player->Update(s_diff);
}
HandleDelayedVisibility();
return;
}
@ -624,36 +617,35 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
resetMarkedCells();
resetMarkedCellsLarge();
// Prepare object updaters
Acore::ObjectUpdater updater(t_diff, false);
// for creature
TypeContainerVisitor<Acore::ObjectUpdater, GridTypeMapContainer > grid_object_update(updater);
// for pets
TypeContainerVisitor<Acore::ObjectUpdater, WorldTypeMapContainer > world_object_update(updater);
// For creature
TypeContainerVisitor<Acore::ObjectUpdater, GridTypeMapContainer> grid_object_update(updater);
// for large creatures
// For pets
TypeContainerVisitor<Acore::ObjectUpdater, WorldTypeMapContainer> world_object_update(updater);
// For large creatures
Acore::ObjectUpdater largeObjectUpdater(t_diff, true);
TypeContainerVisitor<Acore::ObjectUpdater, GridTypeMapContainer > grid_large_object_update(largeObjectUpdater);
TypeContainerVisitor<Acore::ObjectUpdater, WorldTypeMapContainer > world_large_object_update(largeObjectUpdater);
TypeContainerVisitor<Acore::ObjectUpdater, GridTypeMapContainer> grid_large_object_update(largeObjectUpdater);
TypeContainerVisitor<Acore::ObjectUpdater, WorldTypeMapContainer> world_large_object_update(largeObjectUpdater);
// pussywizard: container for far creatures in combat with players
std::vector<Creature*> updateList;
updateList.reserve(10);
// non-player active objects, increasing iterator in the loop in case of object removal
// Update non-player active objects
for (m_activeNonPlayersIter = m_activeNonPlayers.begin(); m_activeNonPlayersIter != m_activeNonPlayers.end();)
{
WorldObject* obj = *m_activeNonPlayersIter;
++m_activeNonPlayersIter;
if (!obj || !obj->IsInWorld())
continue;
VisitNearbyCellsOf(obj, grid_object_update, world_object_update, grid_large_object_update, world_large_object_update);
if (obj && obj->IsInWorld())
VisitNearbyCellsOf(obj, grid_object_update, world_object_update, grid_large_object_update, world_large_object_update);
}
// the player iterator is stored in the map object
// to make sure calls to Map::Remove don't invalidate it
// Update players and their associated objects
for (m_mapRefIter = m_mapRefMgr.begin(); m_mapRefIter != m_mapRefMgr.end(); ++m_mapRefIter)
{
Player* player = m_mapRefIter->GetSource();
@ -661,12 +653,10 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
if (!player || !player->IsInWorld())
continue;
// update players at tick
player->Update(s_diff);
VisitNearbyCellsOfPlayer(player, grid_object_update, world_object_update, grid_large_object_update, world_large_object_update);
// If player is using far sight, visit that object too
// If player is using far sight, update viewpoint
if (WorldObject* viewPoint = player->GetViewpoint())
{
if (Creature* viewCreature = viewPoint->ToCreature())
@ -684,7 +674,8 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
{
updateList.clear();
float rangeSq = player->GetGridActivationRange() - 1.0f;
rangeSq = rangeSq * rangeSq;
rangeSq *= rangeSq;
HostileReference* ref = player->getHostileRefMgr().getFirst();
while (ref)
{
@ -694,20 +685,20 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
updateList.push_back(cre);
ref = ref->next();
}
for (std::vector<Creature*>::const_iterator itr = updateList.begin(); itr != updateList.end(); ++itr)
VisitNearbyCellsOf(*itr, grid_object_update, world_object_update, grid_large_object_update, world_large_object_update);
for (Creature* cre : updateList)
VisitNearbyCellsOf(cre, grid_object_update, world_object_update, grid_large_object_update, world_large_object_update);
}
}
for (_transportsUpdateIter = _transports.begin(); _transportsUpdateIter != _transports.end();) // pussywizard: transports updated after VisitNearbyCellsOf, grids around are loaded, everything ok
// Update transports - pussywizard: transports updated after VisitNearbyCellsOf, grids around are loaded, everything ok
for (_transportsUpdateIter = _transports.begin(); _transportsUpdateIter != _transports.end();)
{
MotionTransport* transport = *_transportsUpdateIter;
++_transportsUpdateIter;
if (!transport->IsInWorld())
continue;
transport->Update(t_diff);
if (transport->IsInWorld())
transport->Update(t_diff);
}
SendObjectUpdates();
@ -1674,14 +1665,16 @@ bool Map::IsUnderWater(uint32 phaseMask, float x, float y, float z, float collis
bool Map::HasEnoughWater(WorldObject const* searcher, float x, float y, float z) const
{
LiquidData const& liquidData = const_cast<Map*>(this)->GetLiquidData(searcher->GetPhaseMask(), x, y, z, searcher->GetCollisionHeight(), MAP_ALL_LIQUIDS);
return (liquidData.Status & MAP_LIQUID_STATUS_SWIMMING) != 0 && HasEnoughWater(searcher, liquidData);
}
LiquidData const& liquidData = const_cast<Map*>(this)->GetLiquidData(
searcher->GetPhaseMask(), x, y, z, searcher->GetCollisionHeight(), MAP_ALL_LIQUIDS);
if ((liquidData.Status & MAP_LIQUID_STATUS_SWIMMING) == 0)
return false;
bool Map::HasEnoughWater(WorldObject const* searcher, LiquidData const& liquidData) const
{
float minHeightInWater = searcher->GetMinHeightInWater();
return liquidData.Level > INVALID_HEIGHT && liquidData.Level > liquidData.DepthLevel && liquidData.Level - liquidData.DepthLevel >= minHeightInWater;
return liquidData.Level > INVALID_HEIGHT &&
liquidData.Level > liquidData.DepthLevel &&
liquidData.Level - liquidData.DepthLevel >= minHeightInWater;
}
char const* Map::GetMapName() const

View File

@ -22,6 +22,7 @@
#include "SpellInfo.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "SpellAuraEffects.h"
#include "sunwell_plateau.h"
enum Quotes
@ -83,7 +84,10 @@ struct boss_sacrolash : public BossAI
_isSisterDead = false;
BossAI::Reset();
me->SetLootMode(0);
me->m_Events.KillAllEvents(false);
if (Creature* alythess = instance->GetCreature(DATA_ALYTHESS))
if (!alythess->IsAlive())
alythess->Respawn(true);
}
void DoAction(int32 param) override
@ -105,18 +109,6 @@ struct boss_sacrolash : public BossAI
}
}
void EnterEvadeMode(EvadeReason why) override
{
BossAI::EnterEvadeMode(why);
if (Creature* alythess = instance->GetCreature(DATA_ALYTHESS))
{
if (!alythess->IsAlive())
alythess->Respawn(true);
else if (!alythess->IsInEvadeMode())
alythess->AI()->EnterEvadeMode(why);
}
}
void JustEngagedWith(Unit* who) override
{
BossAI::JustEngagedWith(who);
@ -124,10 +116,7 @@ struct boss_sacrolash : public BossAI
if (alythess->IsAlive() && !alythess->IsInCombat())
alythess->AI()->AttackStart(who);
me->m_Events.AddEventAtOffset([&] {
Talk(YELL_BERSERK);
DoCastSelf(SPELL_ENRAGE, true);
}, 6min);
ScheduleEnrageTimer(SPELL_ENRAGE, 6min, YELL_BERSERK);
ScheduleTimedEvent(10s, [&] {
DoCastSelf(SPELL_SHADOW_BLADES);
@ -195,7 +184,10 @@ struct boss_alythess : public BossAI
_isSisterDead = false;
BossAI::Reset();
me->SetLootMode(0);
me->m_Events.KillAllEvents(false);
if (Creature* sacrolash = instance->GetCreature(DATA_SACROLASH))
if (!sacrolash->IsAlive())
sacrolash->Respawn(true);
}
void DoAction(int32 param) override
@ -217,18 +209,6 @@ struct boss_alythess : public BossAI
}
}
void EnterEvadeMode(EvadeReason why) override
{
BossAI::EnterEvadeMode(why);
if (Creature* sacrolash = instance->GetCreature(DATA_SACROLASH))
{
if (!sacrolash->IsAlive())
sacrolash->Respawn(true);
else if (!sacrolash->IsInEvadeMode())
sacrolash->AI()->EnterEvadeMode(why);
}
}
void JustEngagedWith(Unit* who) override
{
BossAI::JustEngagedWith(who);
@ -236,10 +216,7 @@ struct boss_alythess : public BossAI
if (sacrolash->IsAlive() && !sacrolash->IsInCombat())
sacrolash->AI()->AttackStart(who);
me->m_Events.AddEventAtOffset([&] {
Talk(YELL_BERSERK);
DoCastSelf(SPELL_ENRAGE, true);
}, 6min);
ScheduleEnrageTimer(SPELL_ENRAGE, 6min, YELL_BERSERK);
ScheduleTimedEvent(1s, [&] {
DoCastVictim(SPELL_BLAZE);
@ -389,8 +366,15 @@ public:
return ValidateSpellInfo({ _touchSpell });
}
void OnPeriodic(AuraEffect const* /*aurEff*/)
void OnPeriodic(AuraEffect const* aurEff)
{
if (aurEff->GetId() == SPELL_FLAME_SEAR)
{
uint32 tick = aurEff->GetTickNumber();
if (tick % 2 != 0 || tick > 10)
return;
}
if (Unit* owner = GetOwner()->ToUnit())
owner->CastSpell(owner, _touchSpell, true);
}