• Dear Guest,

    You're browsing our forum as a Guest meaning you can only see a portion of the forum in read-only mode.
    To view all forum nodes and be able to create threads/posts please register or log-in with your existing account.

    TwinStar team

[Help] Blackblade of Shahram Alert

lanevegame

Authorized
Joined
Jun 18, 2015
I'm looking for an addon (that most likely doesn't exist) able to announce when Blackblade of Shahram procs, something like Nightfall (Axe) Spell Vulnerability Alert. And yes I know it would be completelly useless, but it's all about SWAG!

Anyways I've found something interesting on the official WoW forum (here is the link), someone made this addon to announce when the player gains Bloodlust and some other buff:

Code:
-- The spells to announce.
local SPELLS = {
-- Format:
-- [spellID] = true, -- Spell Name

[2825] = true, -- Bloodlust
[32182] = true, -- Heroism
[80353] = true, -- Time Warp
[90355] = true, -- Ancient Hysteria

}

-- This is either a chatType to send a message to or "self" if it should be printed to the chat frame instead.
-- You can see a list of chatTypes here:
-- http://www.wowpedia.org/ChatTypeId
local OUTPUT_TYPE = "self"

-- This is the channel number for the "CHANNEL" chatType, the player name for the "WHISPER" chatType or nil for everything else.
local OUTPUT_CHANNEL = nil

-- The message to send. Supports the following replacement tokens:
-- %CNAME% = The name of the person who cast the spell
-- %SNAME% = The name of the spell that was cast
-- %SLINK% = The link of the spell that was cast

local MESSAGE = "%CNAME% cast %SLINK%!"

-------------------
-- END OF CONFIG --
-------------------

local SendMessage;
do
local gsubTable = {}

SendMessage = function(spellID, spellName, caster)
gsubTable.CNAME, gsubTable.SNAME = caster, spellName
gsubTable.SLINK = GetSpellLink(spellID)

local message = MESSAGE:gsub("%%(%a+)%%", gsubTable)

if OUTPUT_TYPE == "self" then
print(message)
else
SendChatMessage(message, OUTPUT_TYPE, nil, OUTPUT_CHANNEL)
end
end
end

local PlayerGUID;

local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
f:SetScript("OnEvent", function(self, event, ...)
self[event](self, ...)
end)

function f:PLAYER_ENTERING_WORLD()
PlayerGUID = UnitGUID("player")
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
end

function f:COMBAT_LOG_EVENT_UNFILTERED(timestamp, event, hideCaster,  sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID,  destName, destFlags, destRaidFlags, ...)
if event ~= "SPELL_AURA_APPLIED" or destGUID ~= PlayerGUID then return end

local spellId, spellName, spellSchool, auraType, amount = ...
if SPELLS[spellId] then
SendMessage(spellId, spellName, sourceName)
end
end

But this addon was made for WoW 5.0 and I wasn't able to make it work for 1.12.1 client, there's probably some function not available for this client (I tried to replace the spell IDs with some other buffs but it still doesn't work). Also I'm not a programmer so I have no clue what might be wrong and if this code might be adapted to my needs.

So here is my request, is there anyone able to make such addon? Or maybe is there something I can use for this purpose?

Let me add some more details. Blackblade of Shahram has a chance to summon Shahram, he will cast a random spell out of six available, and then disappear. He can cast the following spells:

Curse of Shahram: AE Slow Enemies
Might of Shahram: AE Stun Enemies (~5 sec)
Fist of Shahram: Group Haste - 25% (~8 sec)
Blessing of Shahram: Group restore life/mana (20 sec)
Will of Shahram: Self +50 all stats (20 sec)
Flames of Shahram: Flamestrike enemies (~100-150 damage)

So every time one of these spells trigger my character should say something like "Might of Shahram has been casted!" and so on. I tried to do something by myself but since I'm not a programmer it's kinda hard for me to understand the Lua language.

I've found a nice simple basic guide, but this is all I was able to do:

Code:
local WillOfShahram_EventFrame = CreateFrame("Frame")
WillOfShahram_EventFrame:RegisterEvent("UNIT_AURA")
WillOfShahram_EventFrame:SetScript("OnEvent",
    function(self, event, ...)
        print('Will Of Shahram has been casted!')
    end)

But as you can see this is incomplete, from what I understand this should trigger every time my character or any mob/player around me (?) gets a new buff. I wasn't able to figure out how to make it trigger only when Will of Shahram has been casted, or any of the other Shahram spells.

That's it, so any help would be much appreciated!
 
Last edited:
I'd personally go with the TNE_Nightfall addon for warlocks Shadow Trance and modify some code details here and there.

1. In the localization file changing

TNE_Nightfall_String_ShadowTrance = "Shadow Trance"
to
TNE_Nightfall_String_ShadowTrance = "Whatever spell name"

2. And then in the Nightfall.lua file add some kind of

frame:RegisterEvent("CHAT_MSG_SPELL_CAST") [or the right spell cast event, I don't know the name]
and adding some kind of
SendChatMessage("Shazam whatever!!!","SAY",nil)
after
PlaySoundFile("Interface\\AddOns\\TNE_Nightfall\\sounds\\ShadowTrance.mp3")
 
It may be obvious, but to test the addon go with a spell easy to get like a shout or such. :p (I know in the rush of things I could forget that)
 
So I downloaded Izus-TNE_Nightfall and looked at the code, to see if there was something I could use, and I noticed these events "CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS", "CHAT_MSG_SPELL_AURA_GONE_SELF". For some reason I couldn't find them on WoWWiki list, but looks like they might be the key to make such addon, even though I couldn't figure out how...
 
I've found this article on the official WoW forum, and someone posted this macro:
Code:
/run Z=Z or CreateFrame("Frame")Z:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")Z:SetScript("OnEvent",function(...)local s=select if s(4,...)=="SPELL_CAST_SUCCESS"and s(15,...)=="abilityName"then SendChatMessage("someone just cast abilityName!")end end)

That basically mimic an addon, but I wasn't able to make it work. Maybe becouse "COMBAT_LOG_EVENT_UNFILTERED" doesn't work with 1.12.1 client (?).

I've also found this addon code on GitHub:

Code:
if cfg.rez then
local frame = CreateFrame("Frame", nil, UIParent);
function DoOnSpellCast(self, event, ...)
local unitID, spell, rank, target = ...;
local inInstance, instanceType = IsInInstance();
if (spell == "Revive" or spell == "Mass Resurrection" or spell == "Raise Ally" or spell == "Rebirth" or spell == "Ancestral Spirit" or spell == "Resurrection" or spell == "Redemption") then
local correctedtarget = target;
if (target == "Unknown" or target == nil) then
correctedtarget = getglobal("GameTooltipTextLeft1"):GetText();
end
if (spell == "Mass Resurrection") then
correctedtarget = "all the dead people.";
end
SendChatMessage("Casting " .. spell .. " on " .. correctedtarget .. ".", cfg.channelannounce);
end
end
frame:RegisterEvent("UNIT_SPELLCAST_SENT");
frame:SetScript("OnEvent", DoOnSpellCast);
end

And then I tried to adapt it to my needs:

Code:
local Shahram_EventFrame = CreateFrame("Frame")

Shahram_EventFrame:RegisterEvent("COMBAT_TEXT_UPDATE")

Shahram_EventFrame:SetScript("OnEvent",
    function(self, event, ...)
    if (arg2 == "Shadowform" or arg2 == "Shadowmeld") then SendChatMessage(arg2)
    end
end)

But still doesn't work. All I could do was this one:

Code:
local Shahram_EventFrame = CreateFrame("Frame")

Shahram_EventFrame:RegisterEvent("COMBAT_TEXT_UPDATE")

Shahram_EventFrame:SetScript("OnEvent",
    function(self, event, ...)
    SendChatMessage(arg2)
end)

This one announces everytime you gain or lose a buff/debuff. But what I was trying to add was something like "only if the spell is called Shadowform then SendChatMessage".

PLEASE HALP!

___________________

I think I've found the right addon that will do the trick! It's called SpellEmote, and it basically let you say/emote something when you cast a spell or gain a buff, with an intuitive command like this:

Code:
/spellemote add spell='Fist of Shahram' spelltype='buff' text='Fist of Shahram!' emotetype='say' chance='100'

So I tested it with the three different buffs that Shahram casts (Fist of Shahram, Blessing of Shahram, Will of Shahram) and it works like a charm! But unfortunately it doesnt work with the other three offensive spells (Flames of Shahram, Curse of Shahram, Might of Shahram), since they are not directly casted or received by the player, but by Shahram himself!

Now I'm trying to figure out how to modify SpellEmote to make it work with these spells too. Again, any help would be greatly appreciated!
 
Last edited by a moderator:
What if you try :

Code:
local Shahram_EventFrame = CreateFrame("Frame")

Shahram_EventFrame:RegisterEvent("COMBAT_TEXT_UPDATE")

Shahram_EventFrame:SetScript("OnEvent",
    function(self, event, ...)
        if (arg2 == "Shadowform" or arg2 == "Shadowmeld") then 
            SendChatMessage(arg2);
        end
    end
end)

Otherwise the error log can help you.
 
Re: Blackblade of Shahram Alert

Thank you again tekai, I'm gonna test it as soon as possible! And yes I'm trying to follow the error log too to fix some problems.

OK! I removed one "end" and it's working!!!

Code:
local Shahram_EventFrame = CreateFrame("Frame")

Shahram_EventFrame:RegisterEvent("COMBAT_TEXT_UPDATE")

Shahram_EventFrame:SetScript("OnEvent",
    function(self, event, ...)
        if (arg2 == "Shadowform" or arg2 == "Shadowmeld") then 
            SendChatMessage(arg2);
        end
end)

Later I will try it with Shahram :D
 
Last edited by a moderator:
I'm guessing my second "end" wasn't needed because I put ";" right after the Sendmessage.

Maybe for the next part go with

Code:
local Shahram_EventFrame = CreateFrame("Frame")

Shahram_EventFrame:RegisterEvent("COMBAT_TEXT_UPDATE")
Shahram_EventFrame:RegisterEvent("SPELLCAST_START")
Shahram_EventFrame:RegisterEvent("SPELLCAST_CHANNEL_START")

Shahram_EventFrame:SetScript("OnEvent",

    function(self, event, ...)
        if (event == "SPELLCAST_START") then
            if (arg1 == "Cast spell name") then
                SendChatMessage(arg1)
            end
        end

        if (event == "SPELLCAST_CHANNEL_START") then
            if (arg2 == "Channeled spell name") then
                SendChatMessage(arg2)
            end
        end

        if (event == "COMBAT_TEXT_UPDATE") then
            if (arg2 == "Aura or buff name") then
                SendChatMessage(arg2)
            end
        end
end)

(100% sure you can make it plenty shorter but it's been a long time since I programmed anything.
 
Last edited:
EUREKA!!! I finally did it, my first addon ever!

I had to split the code in two different lua files (becouse I'm not a programmer and I wasn't able to merge them all in one file!). One lua is for Shahram's buffs and one is for the debuffs.

So the one for the buffs is:

Code:
local ShahramBuff_EventFrame = CreateFrame("Frame")

ShahramBuff_EventFrame:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS")

ShahramBuff_EventFrame:SetScript("OnEvent",
    function(self, event, ...)
        if (arg1 == "You gain Blessing of Shahram.") then 
            SendChatMessage('Blessing of Shahram - My party gain 50 health and mana every 5 seconds!');
        end
        if (arg1 == "You gain Will of Shahram.") then 
            SendChatMessage('Will of Shahram - All my stats are increased by 50!');
        end
        if (arg1 == "You gain Fist of Shahram.") then 
            SendChatMessage('Fist of Shahram - My party gain 25% attack speed!');
        end
end)

And the one for debuffs is:

Code:
local ShahramDamage_EventFrame = CreateFrame("Frame")

ShahramDamage_EventFrame:RegisterEvent("CHAT_MSG_SPELL_PET_DAMAGE")

ShahramDamage_EventFrame:SetScript("OnEvent",
    function(self, event, ...)
        if (arg1 == "Shahram begins to cast Curse of Shahram.") then 
            SendChatMessage('Curse of Shahram - All enemies around me are slowed!');
        end
        if (arg1 == "Shahram begins to cast Might of Shahram.") then 
            SendChatMessage('Might of Shahram - All enemies around me are stunned!');
        end
        for spell, creatureName, damage in string.gfind(arg1, "Shahram's (.+) hits (.+) for (%d+).") do 
            SendChatMessage('Flames of Shahram - All enemies around me receive ' .. damage .. ' fire damage!');
        end
        for spell, creatureName, damage in string.gfind(arg1, "Shahram's (.+) crits (.+) for (%d+).") do
            SendChatMessage('Flames of Shahram - All enemies around me receive ' .. damage .. ' fire damage!');
        end
end)

The flame strike spell was the trickiest for me, but in the end I was able to make it work too, thanks to the authors of SpellEmote! It also says how much damage the Flames of Shahram do! The only problem is that it might spam a bit when there are many mobs around... I couldn't test it with more than one target, we'll see...

Anyways, my life is complete now! Big thanks to tekai for the support :)
 
Last edited:
Top Bottom