SpellIDs, 'morphed SpellNames' and whatever it's been called overtime by users of PQR.
It's as simple as using this function
fawGetGlobalSpellID(spell) in conjuction with, uhmm whats it called in PQR?? I don't use PQR myself.
CastSpellByName(fawGetGlobalSpellID(spell))
spell beeing the NAME of the spell you want to cast.
--------------------------------------------------
-- Courtesy of Wopak -
http://www.ownedcore.com/forums/memb...249-wopak.html
-- Is the code hard to understand, well tough luck, just use it.
-- This function does not require any PLUA unlocker or any other kind of hack
-- Get the Global SpellID of a Spell, also checks Pets spellbook (if the Player has a Pet)
-- Signature
---- globalSpellID = fawGetGlobalSpellID("spell")
-- Arguments:
---- spell - Name of the Spell to Query
-- Returns:
---- globalSpellID: Global SpellID of the Spell (numeric); nil if the spell is unknown (numeric;nil)
PHP Code:
function fawGetGlobalSpellID(spell)
if spell == nil then return 0; end
local globalSpellID = nil;
local spellIndex, bookType = fawGetSpellIndex(spell);
if spellIndex and bookType then
globalSpellID = select(2, GetSpellBookItemInfo(spellIndex, bookType));
end
return globalSpellID;
end
-- Courtesy of Wopak -
http://www.ownedcore.com/forums/memb...249-wopak.html
-- Is the code hard to understand, well tough luck, just use it.
-- This function does not require any PLUA unlocker or any other kind of hack
-- Get the Global SpellID of a Spell, also checks Pets spellbook (if the Player has a Pet)
-- Signature
---- spellIndex, bookType = fawGetSpellIndex("spell")
-- Arguments:
---- spell - Name of the Spell to Query
-- Returns:
---- spellIndex: The index of the spell in the Player or Pet spellbook. nil if the spell is unknown (numeric;nil)
---- bookType: "spell" if it's a player spell, "pet" if it's a pet spell, nil if the spell is unknown (string;nil)
PHP Code:
function fawGetSpellIndex(spell)
if spell == nil then return 0; end
local myIndex = nil;
local myBook = nil;
-- Looping thru the Spellbook and trying to match the Spell name passed
-- to the function with the Spells name in the Spellbook.
-- If there's a match, get the GLOBAL SpellID (not to be confused with the SpellID)
-- using the info returned when quering the Index in te Spellbook.
local _, _, offset, numSpells, _, _ = GetSpellTabInfo(2);
for thisIndex = offset+1, numSpells+offset do
-- Get the Global Spell ID from the Player's spellbook
if spell == GetSpellBookItemName(thisIndex, "spell") then
myIndex = thisIndex;
myBook = "spell";
break; -- Breaking out of the for/do loop, because we have a match
end
end
-- If the Spell was not found, check if there is a Pet Spellbook
-- If a Pet Spellbook is found, do the same as above
local numPetSpells = HasPetSpells();
if not myIndex and numPetSpells then
for thisIndex = 1, numPetSpells do
-- Get the Global Spell ID from the Pet's spellbook
if spell == GetSpellBookItemName(thisIndex, "pet") then
myIndex = thisIndex;
myBook = "pet";
break; -- Breaking out of the for/do loop, because we have a match
end
end
end
return myIndex, myBook;
end