Hello Everyone
Recenty i was using PQR rotation bot for wotlk 3.3.5 and
i liked it and its working structure and i wanted to learn about wow patching and botting stuff
so i started working on making a similar thing or a backport for vanilla and tbc
because we all know PQR is only for WotLK, Cata & MoP
so i started with vanilla first
For WotLK Xelper used 0xBF0F0 this offset as detour for vanilla i used an EndScene offset as detour also corrected other offsets for vanilla
and Coded most of the api those are present in wotlk but not in vanilla
Means right now bot is not throwing any error and mostly things are working like its check if the given buff is present or not and things like that
Zthw3LA.png
[https://i.imgur.com/Zthw3LA.png]
In the above image you can see there is one Buff spell i added for testing
its checking is Demon Skin Buff on our player is present or not and our player is mounted or not
so if we are not mounted and our player dont have Buff Demon Skin
then i will cast spell by id 687 this id is for Demon Skin(Rank 1)
So PQR calls CastSpellByID(687, "player") this function which is present in wotlk but not in vanilla
so i coded a function for this
check image or code given below
Code:
function CastSpellByID(spellID, unit)
if unit == "player" then
print(GetSpellNameFromID(spellID) .." On " ..unit) -- only for debugging
RunScript("CastSpellByName(GetSpellNameFromID("..spellID.."))")
CastSpellByName(GetSpellNameFromID(spellID), 1)
elseif unit == "target" then
CastSpellByName(GetSpellNameFromID(spellID))
end
end
yA4XjAg - Imgur (1).png
[https://imgur.com/yA4XjAg]
In the above code i also added GetSpellNameFromID() function to return spell name as string using spell id , and added spells database from where its retrieving this info
you can also see there is one print statement in above code just to be sure that execution is reaching to this instruction
in the image below you can see messages in in-game chat
now there is just 1 hurdle CastSpellByName() or RunScript("CastSpellByName(GetSpellNameFromID("..spellID.."))") this code is not buffing or triggering spell
in the below image you can see bot keep calling this function with args 687 and player
and its entering in if condition executing print and printing stuff in chat window but CastSpellByName() not working because of this player not getting this buff and its keep calling this again and again
i wanted to know why its failing to work properly
after running pqr bot i tried using this macro : /run CastSpellByID(687, "player")
and it buffed my player
so is there any check in CastSpellByName() which require any user input to work because when same function CastSpellByID() called by lua script present inside wow memory CastSpellByName() stops working but when called by user through macro or chat CastSpellByName() works normally
and if there is any other way to cast spell pls enlighten me with your knowledge
this is the last hurdle before i upload its src
Hxf4Pmg (2).png
[https://imgur.com/Hxf4Pmg]
Edit 1 : After Some testing i minimize the code where its bugged, normal lua functions can call CastSpellByName() and it works properly only when CastSpellByName() is called by
PQR_EventFrame = CreateFrame("Frame")
PQR_EventFrame:SetScript("OnUpdate", PQR_EventFrame_OnUpdate)
PQR_EventFrame_OnUpdate() this function CastSpellByName() stops working
That means there is some restrictions in frames to use CastSpellByName()
Main Code : function PQR_Debug(strText) if PQR_DebugEnabled == true then PQR_W - Pastebin.com