Skip to content

Commit

Permalink
refactor to use onleave and onenter instead of spell_area
Browse files Browse the repository at this point in the history
allows players to right click remove adal's buff
  • Loading branch information
sogladev committed Oct 6, 2024
1 parent 755e106 commit 880a99a
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 150 deletions.
127 changes: 0 additions & 127 deletions data/sql/updates/pending_db_world/rev_1727679643827269473.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,133 +27,6 @@ DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 22) AND (`SourceGrou
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(22, 4, 3230, 3, 0, 103, 0, 39913, 0, 0, 1, 0, 0, '', 'if Gameobject \'Magtheridon\'s Head\' Horde is not already spawned');

-- Apply zone wide buff in these areas
DELETE FROM `spell_area` WHERE `spell` IN (39911, 39913, 39953);
INSERT INTO `spell_area` (`spell`, `area`, `quest_start`, `quest_end`, `aura_spell`, `racemask`, `gender`, `autocast`, `quest_start_status`, `quest_end_status`) VALUES
(39953, 3847, 0, 0, 0, 0, 2, 1, 74, 11), -- Botanica
(39953, 3848, 0, 0, 0, 0, 2, 1, 74, 11), -- Arcatraz
(39953, 3849, 0, 0, 0, 0, 2, 1, 74, 11), -- Mechanar
(39953, 3703, 0, 0, 0, 0, 2, 1, 74, 11), -- Shattrath
(39953, 3896, 0, 0, 0, 0, 2, 1, 74, 11), -- Aldor's Rise
(39953, 3898, 0, 0, 0, 0, 2, 1, 74, 11), -- Scryer's Tier
(39953, 3899, 0, 0, 0, 0, 2, 1, 74, 11), -- Lower City
(39911, 3562, 0, 0, 0, 1101, 2, 1, 74, 11), -- Ramparts (Alliance)
(39911, 3713, 0, 0, 0, 1101, 2, 1, 74, 11), -- The Blood Furnace (Alliance)
(39911, 3714, 0, 0, 0, 1101, 2, 1, 74, 11), -- The Shattered Halls (Alliance)
(39911, 3836, 0, 0, 0, 1101, 2, 1, 74, 11), -- Magtheridon's Lair (Alliance)
(39913, 3562, 0, 0, 0, 690, 2, 1, 74, 11), -- Ramparts (Horde)
(39913, 3713, 0, 0, 0, 690, 2, 1, 74, 11), -- The Blood Furnace (Horde)
(39913, 3714, 0, 0, 0, 690, 2, 1, 74, 11), -- The Shattered Halls (Horde)
(39913, 3836, 0, 0, 0, 690, 2, 1, 74, 11), -- Magtheridon's Lair (Horde)
-- Hellfire Peninsula (Alliance)
(39911, 3483, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3536, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3538, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3539, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3541, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3542, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3543, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3544, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3545, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3546, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3547, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3548, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3549, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3550, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3551, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3552, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3553, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3554, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3555, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3556, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3582, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3669, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3670, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3671, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3765, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3793, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3794, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3795, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3796, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3797, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3798, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3799, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3800, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3801, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3802, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3803, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3804, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3806, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3807, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3808, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3809, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3810, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3811, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3812, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3813, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3814, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3815, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3816, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3835, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3838, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3884, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3920, 0, 0, 0, 1101, 2, 1, 74, 11),
(39911, 3955, 0, 0, 0, 1101, 2, 1, 74, 11),
-- Hellfire Peninsula (Horde)
(39913, 3483, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3536, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3538, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3539, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3541, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3542, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3543, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3544, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3545, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3546, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3547, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3548, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3549, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3550, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3551, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3552, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3553, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3554, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3555, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3556, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3582, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3669, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3670, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3671, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3765, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3793, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3794, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3795, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3796, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3797, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3798, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3799, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3800, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3801, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3802, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3803, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3804, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3806, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3807, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3808, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3809, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3810, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3811, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3812, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3813, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3814, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3815, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3816, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3835, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3838, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3884, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3920, 0, 0, 0, 690, 2, 1, 74, 11),
(39913, 3955, 0, 0, 0, 690, 2, 1, 74, 11);

-- Zeppelin transports
SET @RADIUS:=24; -- radius unknown
-- arrival events, play zeppelin horn
Expand Down
7 changes: 0 additions & 7 deletions src/server/game/Spells/SpellMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "Spell.h"
#include "SpellAuraDefines.h"
#include "SpellInfo.h"
#include "WorldState.h"
#include "World.h"

bool IsPrimaryProfessionSkill(uint32 skill)
Expand Down Expand Up @@ -1216,12 +1215,6 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
return s->GetData(251 /*DATA_BUFF_AVAILABLE*/) != 0;
return false;
break;
case 39953: // Ad'al Song of Battle
return sWorldState->IsConditionFulfilled(CONDITION_ADAL_SONG_OF_BATTLE);
case 39911: // Trollbane's Command
return sWorldState->IsConditionFulfilled(CONDITION_TROLLBANES_COMMAND);
case 39913: // Nazgrel's Fervor
return sWorldState->IsConditionFulfilled(CONDITION_NAZGRELS_FAVOR);
}

return true;
Expand Down
92 changes: 76 additions & 16 deletions src/server/game/World/WorldState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,60 @@ void WorldState::Update(uint32 diff)
}
}

void WorldState::HandlePlayerEnterZone(Player* player, uint32 zoneId) {};
void WorldState::HandlePlayerLeaveZone(Player* player, uint32 zoneId) {};
void WorldState::HandlePlayerEnterZone(Player* player, uint32 zoneId)
{
std::lock_guard<std::mutex> guard(_mutex);
switch (zoneId)
{
case ZONEID_SHATTRATH:
case ZONEID_BOTANICA:
case ZONEID_MECHANAR:
case ZONEID_ARCATRAZ:
if (_adalSongOfBattleTimer)
player->CastSpell(player, SPELL_ADAL_SONG_OF_BATTLE, true);
break;
case ZONEID_HELLFIRE_PENINSULA:
case ZONEID_HELLFIRE_RAMPARTS:
case ZONEID_HELLFIRE_CITADEL:
case ZONEID_BLOOD_FURNACE:
case ZONEID_SHATTERED_HALLS:
case ZONEID_MAGTHERIDON_LAIR:
if (_isMagtheridonHeadSpawnedAlliance && player->GetTeamId() == TEAM_ALLIANCE)
player->CastSpell(player, SPELL_TROLLBANES_COMMAND, true);
else if (_isMagtheridonHeadSpawnedHorde && player->GetTeamId() == TEAM_HORDE)
player->CastSpell(player, SPELL_NAZGRELS_FAVOR, true);
break;
default:
break;
}
};
void WorldState::HandlePlayerLeaveZone(Player* player, uint32 zoneId)
{
std::lock_guard<std::mutex> guard(_mutex);
switch (zoneId)
{
case ZONEID_SHATTRATH:
case ZONEID_BOTANICA:
case ZONEID_MECHANAR:
case ZONEID_ARCATRAZ:
if (!_adalSongOfBattleTimer)
player->RemoveAurasDueToSpell(SPELL_ADAL_SONG_OF_BATTLE);
break;
case ZONEID_HELLFIRE_PENINSULA:
case ZONEID_HELLFIRE_RAMPARTS:
case ZONEID_HELLFIRE_CITADEL:
case ZONEID_BLOOD_FURNACE:
case ZONEID_SHATTERED_HALLS:
case ZONEID_MAGTHERIDON_LAIR:
if (player->GetTeamId() == TEAM_ALLIANCE)
player->RemoveAurasDueToSpell(SPELL_TROLLBANES_COMMAND);
else if (player->GetTeamId() == TEAM_HORDE)
player->RemoveAurasDueToSpell(SPELL_NAZGRELS_FAVOR);
break;
default:
break;
}
};

void WorldState::BuffMagtheridonTeam(TeamId team)
{
Expand All @@ -124,8 +176,10 @@ void WorldState::BuffMagtheridonTeam(TeamId team)
case 530: // Outland
map->DoForAllPlayers([&](Player* player)
{
if (player->GetZoneId() == 3483 && player->GetTeamId() == team) // Hellfire Peninsula
player->UpdateZoneDependentAuras(player->GetZoneId());
if (player->GetZoneId() == ZONEID_HELLFIRE_PENINSULA && player->GetTeamId() == TEAM_ALLIANCE && team == TEAM_ALLIANCE)
player->CastSpell(player, SPELL_TROLLBANES_COMMAND, true);
else if (player->GetZoneId() == ZONEID_HELLFIRE_PENINSULA && player->GetTeamId() == TEAM_HORDE && team == TEAM_HORDE)
player->CastSpell(player, SPELL_NAZGRELS_FAVOR, true);
});
break;
case 540: // The Shattered Halls
Expand All @@ -134,8 +188,10 @@ void WorldState::BuffMagtheridonTeam(TeamId team)
case 544: // Magtheridon's Lair
map->DoForAllPlayers([&](Player* player)
{
if (player->GetTeamId() == team)
player->UpdateZoneDependentAuras(player->GetZoneId());
if (player->GetTeamId() == TEAM_ALLIANCE && team == TEAM_ALLIANCE)
player->CastSpell(player, SPELL_TROLLBANES_COMMAND, true);
else if (player->GetTeamId() == TEAM_HORDE && team == TEAM_HORDE)
player->CastSpell(player, SPELL_NAZGRELS_FAVOR, true);
});
break;
default:
Expand All @@ -153,8 +209,10 @@ void WorldState::DispelMagtheridonTeam(TeamId team)
case 530: // Outland
map->DoForAllPlayers([&](Player* player)
{
if (player->GetZoneId() == 3483 && player->GetTeamId() == team) // Hellfire Peninsula
player->UpdateAreaDependentAuras(player->GetAreaId());
if (player->GetZoneId() == ZONEID_HELLFIRE_PENINSULA && player->GetTeamId() == TEAM_ALLIANCE && team == TEAM_ALLIANCE)
player->RemoveAurasDueToSpell(SPELL_TROLLBANES_COMMAND);
else if (player->GetZoneId() == ZONEID_HELLFIRE_PENINSULA && player->GetTeamId() == TEAM_HORDE && team == TEAM_HORDE)
player->RemoveAurasDueToSpell(SPELL_NAZGRELS_FAVOR);
});
break;
case 540: // The Shattered Halls
Expand All @@ -163,8 +221,10 @@ void WorldState::DispelMagtheridonTeam(TeamId team)
case 544: // Magtheridon's Lair
map->DoForAllPlayers([&](Player* player)
{
if (player->GetTeamId() == team)
player->UpdateAreaDependentAuras(player->GetAreaId());
if (player->GetTeamId() == TEAM_ALLIANCE && team == TEAM_ALLIANCE)
player->RemoveAurasDueToSpell(SPELL_TROLLBANES_COMMAND);
else if (player->GetTeamId() == TEAM_HORDE && team == TEAM_HORDE)
player->RemoveAurasDueToSpell(SPELL_NAZGRELS_FAVOR);
});
break;
default:
Expand All @@ -182,16 +242,16 @@ void WorldState::BuffAdalsSongOfBattle()
case 530: // Outland
map->DoForAllPlayers([&](Player* player)
{
if (player->GetZoneId() == 3703) // Shattrath
player->UpdateZoneDependentAuras(player->GetZoneId());
if (player->GetZoneId() == ZONEID_SHATTRATH)
player->CastSpell(player, SPELL_ADAL_SONG_OF_BATTLE, true);
});
break;
case 552: // Arcatraz
case 553: // Botanica
case 554: // Mechanar
map->DoForAllPlayers([&](Player* player)
{
player->UpdateZoneDependentAuras(player->GetZoneId());
player->CastSpell(player, SPELL_ADAL_SONG_OF_BATTLE, true);
});
break;
default:
Expand All @@ -209,16 +269,16 @@ void WorldState::DispelAdalsSongOfBattle()
case 530: // Outland
map->DoForAllPlayers([&](Player* player)
{
if (player->GetZoneId() == 3703) // Shattrath
player->UpdateAreaDependentAuras(player->GetAreaId());
if (player->GetZoneId() == ZONEID_SHATTRATH)
player->RemoveAurasDueToSpell(SPELL_ADAL_SONG_OF_BATTLE);
});
break;
case 552: // Arcatraz
case 553: // Botanica
case 554: // Mechanar
map->DoForAllPlayers([&](Player* player)
{
player->UpdateAreaDependentAuras(player->GetAreaId());
player->RemoveAurasDueToSpell(SPELL_ADAL_SONG_OF_BATTLE);
});
break;
default:
Expand Down
23 changes: 23 additions & 0 deletions src/server/game/World/WorldState.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,29 @@ enum Events
CUSTOM_EVENT_MAGTHERIDON_HEAD_DESPAWN = 184641,
};

enum ZoneIds
{
ZONEID_SHATTRATH = 3703,
ZONEID_BOTANICA = 3847,
ZONEID_ARCATRAZ = 3848,
ZONEID_MECHANAR = 3849,

ZONEID_HELLFIRE_PENINSULA = 3483,
ZONEID_HELLFIRE_RAMPARTS = 3562,
ZONEID_HELLFIRE_CITADEL = 3563,
ZONEID_BLOOD_FURNACE = 3713,
ZONEID_SHATTERED_HALLS = 3714,
ZONEID_MAGTHERIDON_LAIR = 3836,
};

enum SpellId
{
SPELL_TROLLBANES_COMMAND = 39911,
SPELL_NAZGRELS_FAVOR = 39913,

SPELL_ADAL_SONG_OF_BATTLE = 39953,
};

enum Misc
{
ZEPPELIN_STATE_UNKOWN = 0,
Expand Down

0 comments on commit 880a99a

Please sign in to comment.