Castspell? menu

User Tag List

Thread: Castspell?

Results 1 to 7 of 7
  1. #1
    xzidez's Avatar Member
    Reputation
    12
    Join Date
    Dec 2007
    Posts
    135
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Castspell?

    Hmm it feels like Im spamming this forum with noobish questions.. but.

    Im trying to get rid of my "press key" when casting spells. Kinda sucks when you change bindings etc etc. So Im trying to use the CastSpellByName method.

    Code:
    [UnmanagedFunctionPointer(CallingConvention.ThisCall, CharSet = CharSet.Ansi)]
    private delegate void CastSpellByNameDelegate(string name);
    
    private CastSpellByNameDelegate _CastSpellById;
    
    public void Run()
    {
                if (_CastSpellById == null)
                {
                    _CastSpellById = Utilities.RegisterDelegate<CastSpellByNameDelegate>((IntPtr)0x004EDAF0);
                }
    
                _CastSpellById("Fel Armor");
    }
    Guess what. It doesnt work. Anyone with decent asm knowledge who can help me get the Method at 4EDAF0 right?

    please...

    (perhaps its time to buy hexrays soon... )

    Castspell?
  2. #2
    Robske's Avatar Contributor
    Reputation
    305
    Join Date
    May 2007
    Posts
    1,062
    Thanks G/R
    3/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First, You use the ThisCall calling convention but do not supply an object pointer? At any rate, the calling convention is not ThisCall, it's Cdecl. You don't need hexrays to see this.

    It's a regular lua function, so if you want to call it manually you'll have to handle the lua stack manually. If you want to avoid all this, use Framescript__Execute and pass string.Format("CastSpellByName(\"{0}\"), Spellname)

    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
    "I cried a little earlier when I had to poop" - Sku

  3. #3
    xzidez's Avatar Member
    Reputation
    12
    Join Date
    Dec 2007
    Posts
    135
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm. Id spose getting the underlying CastSpellByAnyThing would be a better solution than calling the lua function.

    Or.. Any suggestions?

  4. #4
    Robske's Avatar Contributor
    Reputation
    305
    Join Date
    May 2007
    Posts
    1,062
    Thanks G/R
    3/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by xzidez View Post
    Hmm. Id spose getting the underlying CastSpellByAnyThing would be a better solution than calling the lua function.

    Or.. Any suggestions?

    If memory serves, the lua function CastSpellByName looks up the passed string in the DBC tables to get it's SpellId, then calls CastSpellById. Which is what you are looking for. (Not to be mistaken with your inappropriately named member)
    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
    "I cried a little earlier when I had to poop" - Sku

  5. #5
    xzidez's Avatar Member
    Reputation
    12
    Join Date
    Dec 2007
    Posts
    135
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hehe.. gawd. I did try lots of different. Without changing the names : P.

    Im now trying the method at 0x007C4640 .. Which should be CastSpellById..
    Calling it with the int value of 28189.. Which should be fel armor. But it silently fails No errormessage.. no nothing.

    Gawd.. And this one should be ThisCall / Ansi?
    I feel so damn lost right now..

    Edit: Cdecl gives me a crash.. And ThisCall with player as object ptr also... I really have to learn ASM. Just trying aint a very good solution

    Edit2:

    It's a regular lua function, so if you want to call it manually you'll have to handle the lua stack manually. If you want to avoid all this, use Framescript__Execute and pass string.Format("CastSpellByName(\"{0}\"), Spellname)
    This actually works.. Better.. My Spell in the spellbar gets fancy highlighted... With a crash ofcourse. But progress :P
    Last edited by xzidez; 10-25-2009 at 07:12 AM.

  6. #6
    MaiN's Avatar Elite User
    Reputation
    335
    Join Date
    Sep 2006
    Posts
    1,047
    Thanks G/R
    0/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by xzidez View Post
    hehe.. gawd. I did try lots of different. Without changing the names : P.

    Im now trying the method at 0x007C4640 .. Which should be CastSpellById..
    Calling it with the int value of 28189.. Which should be fel armor. But it silently fails No errormessage.. no nothing.

    Gawd.. And this one should be ThisCall / Ansi?
    I feel so damn lost right now..

    Edit: Cdecl gives me a crash.. And ThisCall with player as object ptr also... I really have to learn ASM. Just trying aint a very good solution

    Edit2:

    This actually works.. Better.. My Spell in the spellbar gets fancy highlighted... With a crash ofcourse. But progress :P
    You need to do it from the main thread to circumvent the protection check. CastSpellByName is protected.
    I advice that you reverse lua_CastSpellByID at 0x4EBE30 if you want to call the engine function.
    [16:15:41] Cypher: caus the CPU is a dick
    [16:16:07] kynox: CPU is mad
    [16:16:15] Cypher: CPU is all like
    [16:16:16] Cypher: whatever, i do what i want

  7. #7
    xzidez's Avatar Member
    Reputation
    12
    Join Date
    Dec 2007
    Posts
    135
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by MaiN View Post
    You need to do it from the main thread to circumvent the protection check. CastSpellByName is protected.
    I advice that you reverse lua_CastSpellByID at 0x4EBE30 if you want to call the engine function.
    Im doing it from the main thread.. Otherwise id spose it wouldnt get highlighted.. Ok it doesnt crash wow.. but its failing

Similar Threads

  1. CleanCore CastSpell Issue Resolved.... Sort of....
    By counted in forum WoW Memory Editing
    Replies: 2
    Last Post: 10-02-2012, 02:54 AM
  2. [SourceCode & Question] CastSpell by ID with SendPacket
    By RivaLfr in forum WoW Memory Editing
    Replies: 3
    Last Post: 02-05-2011, 08:11 PM
  3. CastSpell Madness
    By Sillyboy72 in forum WoW Memory Editing
    Replies: 12
    Last Post: 01-14-2009, 11:18 AM
All times are GMT -5. The time now is 06:18 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search