Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions sql/migrations/20250813174400_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
DROP PROCEDURE IF EXISTS add_migration;
DELIMITER ??
CREATE PROCEDURE `add_migration`()
BEGIN
DECLARE v INT DEFAULT 1;
SET v = (SELECT COUNT(*) FROM `migrations` WHERE `id`='20250813174400');
IF v = 0 THEN
INSERT INTO `migrations` VALUES ('20250813174400');
-- Add your query below.


UPDATE spell_template SET `script_name` = 'spell_rogue_sap'
WHERE entry IN (6770, 2070, 11297);


-- End of migration.
END IF;
END??
DELIMITER ;
CALL add_migration();
DROP PROCEDURE IF EXISTS add_migration;
11 changes: 11 additions & 0 deletions src/game/PlayerBots/BattleBotAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,17 @@ void BattleBotAI::UpdateAI(uint32 const diff)
me->ClearTarget();

Unit* pVictim = me->GetVictim();

// Prevent battelbot from chasing target entered stealth mode
if (pVictim && !pVictim->IsVisibleForOrDetect(me, me, false))
{
me->AttackStop();
me->ClearTarget();
me->StopMoving();
if (pVictim = SelectAttackTarget(pVictim))
AttackStart(pVictim);
return;
}

if (!me->IsInCombat())
{
Expand Down
6 changes: 4 additions & 2 deletions src/game/Spells/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3598,7 +3598,8 @@ SpellCastResult Spell::prepare(Aura* triggeredByAura, uint32 chance)
// set timer base at cast time
ReSetTimer();

if (!m_IsTriggeredSpell && m_casterUnit)
// rogue's sap will be handled in spell script 'OnSuccessfulFinish'
if (!m_IsTriggeredSpell && m_casterUnit && m_spellInfo->SpellIconID != 249)
{
uint32 interruptFlags = AURA_INTERRUPT_ACTION_CANCELS;

Expand Down Expand Up @@ -3932,7 +3933,8 @@ void Spell::cast(bool skipCheck)
SendSpellCooldown();

// Remove any remaining invis auras on cast completion, should only be gnomish cloaking device
if (!m_IsTriggeredSpell && m_casterUnit)
// excepting rogue's sap which will be handled in 'OnSuccessfulFinish' spell script
if (!m_IsTriggeredSpell && m_casterUnit && m_spellInfo->SpellIconID != 249)
{
uint32 interruptFlags = AURA_INTERRUPT_ACTION_CANCELS_LATE;

Expand Down
30 changes: 30 additions & 0 deletions src/scripts/spells/spell_rogue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,31 @@ SpellScript* GetScript_RogueVanish(SpellEntry const*)
return new RogueVanishScript();
}

// 6770, 2070, 11297 - Sap
struct RogueSapScript : SpellScript
{
void OnSuccessfulFinish(Spell* spell) const
{
Unit* pTarget = spell->GetUnitTarget();
if (pTarget)
{
if (spell->ShouldRemoveStealthAuras())
{
spell->GetCaster()->ToUnit()->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
if (pTarget->AI())
pTarget->AI()->AttackStart(spell->GetCaster()->ToUnit());
}

}

}
};

SpellScript* GetScript_RogueSap(SpellEntry const*)
{
return new RogueSapScript();
}

void AddSC_rogue_spell_scripts()
{
Script* newscript;
Expand All @@ -90,4 +115,9 @@ void AddSC_rogue_spell_scripts()
newscript->Name = "spell_rogue_vanish";
newscript->GetSpellScript = &GetScript_RogueVanish;
newscript->RegisterSelf();

newscript = new Script;
newscript->Name = "spell_rogue_sap";
newscript->GetSpellScript = &GetScript_RogueSap;
newscript->RegisterSelf();
}