I have a challenge where dealing with macros the calls go down to GetSpellByName(value) where it doesnt accept SPellID but rather localised spell name.
I have had a look at GetSpellInfo but it doesnt give me a static value that I can call. For example GetClassInfo returns a localised value (Death Knight) and a static english version (DEATHKNIGHT).
WHat i need to be able to do is pass in an English spell name and replace it with a French/Spanish/etc version of that same ability name. For example I want to be able to get from "Consecration" to "Consagración" and back again.
LibBabble-Spell-3.0 hasn't been maintained since 2.4 and while resurrecting it is not a prospect I would like to take on might be my solution.
Unfortunately I cant rethink my approach as I am limited by what I can provide SecureButtonActionTemplate. It calls to CastSpellByName so the localised name is what I have to provide it. (This is Blizzard Code that I cant override)
So my problem is I have a string that is "/cast Consecration". Now on an english client I can go GetSpellInfo("Consecration") and get a SpellID. So far so good. I can then take that SpellID and on a French client GetSpellInfo(SpellID) and get "Consagración". The problem is I need to give the French Client "Consecration" and get from there to "Consagración"
Its all because Button Type = macro and /cast and /use call down to CastSpellByName and this ignores SpellID
and attempt to put it onto the same button.macro = Macroset["MyMacro"]
I get spell not found errors. I need to translate the SpellId's back to English. This is a limitation of the Macro Interface.
To test this Grab any spell and make a macro with its spell ID eg (this example is Paladin Consecration
/cast 26573
When I was testing this earlier it did nothing.
I then need to translate it back to English to put into the Button. That's also achievable and is not a performance hit or anything like that but the string is not sharable or transportable. The output is not understandable by people.
I currently have people translating 100's of kbs of this kind of code. The downside is anytime I make a change they have to retranslate.
-------------------------
This the culprit code from FrameXML\ChatFrame.lua line 1104
-- We want to prefer spells for /cast and items for /use but we can use either
SecureCmdList["CAST"] = function(msg)
local action, target = SecureCmdOptionParse(msg);
if ( action ) then
local spell = GetSpellInfo(action)
local name, bag, slot = SecureCmdItemParse(action);
if ( spell ) then
CastSpellByName(action, target);
elseif ( slot or GetItemInfo(name) ) then
SecureCmdUseItem(name, bag, slot, target);
end
end
end
SecureCmdList["USE"] = function(msg)
local action, target = SecureCmdOptionParse(msg);
if ( action ) then
local name, bag, slot = SecureCmdItemParse(action);
if ( slot or GetItemInfo(name) ) then
SecureCmdUseItem(name, bag, slot, target);
else
CastSpellByName(action, target);
end
end
end
The value of Action is the localized string of the spell name. Even though local spell = GetSpellInfo(action) will work with the passed in SpellID it is knocked out by CastSpellByName(action, target) which wont resolve a spellid back to a spell.
This hasn't changed since Vanilla where SpellID at the time wasn't static but was relational to where it appeared in your spell book.
Its almost like, short of a translation library, I need to create a structure that accepts the localized name but exports both and if it sees the spellid version processes that if it cant understand the localized one that looks something like:
Sounds like you just have UI issues. Just store it internally with Spell IDs and translate to spell names in the local language whenever its shown to a user, or send to the game.
In code, you can always use comments to explain what the IDs are.
A spell database is just a bad idea, and Babble-Spell will not be coming back. It has always been notoriously out of date, both in spell availability in general and the localizations of those spells.
I have a challenge where dealing with macros the calls go down to GetSpellByName(value) where it doesnt accept SPellID but rather localised spell name.
I have had a look at GetSpellInfo but it doesnt give me a static value that I can call. For example GetClassInfo returns a localised value (Death Knight) and a static english version (DEATHKNIGHT).
WHat i need to be able to do is pass in an English spell name and replace it with a French/Spanish/etc version of that same ability name. For example I want to be able to get from "Consecration" to "Consagración" and back again.
LibBabble-Spell-3.0 hasn't been maintained since 2.4 and while resurrecting it is not a prospect I would like to take on might be my solution.
Anyone have any ideas?
Kind Regards,
TimothyLuke
It's best to deal with IDs or fully localized strings if you must, but translating between languages is bad.
So my problem is I have a string that is "/cast Consecration". Now on an english client I can go GetSpellInfo("Consecration") and get a SpellID. So far so good. I can then take that SpellID and on a French client GetSpellInfo(SpellID) and get "Consagración". The problem is I need to give the French Client "Consecration" and get from there to "Consagración"
Its all because Button Type = macro and /cast and /use call down to CastSpellByName and this ignores SpellID
In your macro or code, it would be something like
What you are describing is what I have already tried. The problem is that in this scenario,
is converted by Blizzard's SecureButtonActionTemplate : CastSpellByName() to be
To better describe what I need to do
start with this:
This is bound as a string to the Button. Button Parameters are type="macro". button.macro = Macroset["MyMacro"]
On an English client this works are the input is Localized English. This is readable and understandable.
If i take the same code and replace it with spell ID's lke this:
and attempt to put it onto the same button.macro = Macroset["MyMacro"]
I get spell not found errors. I need to translate the SpellId's back to English. This is a limitation of the Macro Interface.
To test this Grab any spell and make a macro with its spell ID eg (this example is Paladin Consecration
When I was testing this earlier it did nothing.
I then need to translate it back to English to put into the Button. That's also achievable and is not a performance hit or anything like that but the string is not sharable or transportable. The output is not understandable by people.
I currently have people translating 100's of kbs of this kind of code. The downside is anytime I make a change they have to retranslate.
-------------------------
This the culprit code from FrameXML\ChatFrame.lua line 1104
(https://github.com/tekkub/wow-ui-source/blob/live/FrameXML/ChatFrame.lua#L1104)
The value of Action is the localized string of the spell name. Even though local spell = GetSpellInfo(action) will work with the passed in SpellID it is knocked out by CastSpellByName(action, target) which wont resolve a spellid back to a spell.
This hasn't changed since Vanilla where SpellID at the time wasn't static but was relational to where it appeared in your spell book.
Its almost like, short of a translation library, I need to create a structure that accepts the localized name but exports both and if it sees the spellid version processes that if it cant understand the localized one that looks something like:
In code, you can always use comments to explain what the IDs are.
A spell database is just a bad idea, and Babble-Spell will not be coming back. It has always been notoriously out of date, both in spell availability in general and the localizations of those spells.