CastSpellByID by UnitGUID menu

User Tag List

Results 1 to 4 of 4
  1. #1
    NightlyBlooD's Avatar Member
    Reputation
    2
    Join Date
    Sep 2012
    Posts
    26
    Thanks G/R
    6/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CastSpellByID by UnitGUID

    Hi guys, please tell me how to solve the problem?
    Code:
     
    public void CastSpellById(int id, ulong GUID = 0)
    {
                        string[] code = new string[]
                        {
                        "fs mov eax, [0x2C]",
                        "mov eax, [eax]",
                        "add eax, 0x8",
                        "mov dword [eax], " + (uint)СMgr,
                        "push 0",
                        "push "+ GUID,
                        "push 0",
                        "push "+ id,
                        "call "+ (uint)CastSpell, //0x0084DF20
                        "add esp,0x14",
                        "retn"
    
                        }
    };
    This code works only with players, when using MobGUID, gives an error.
    error 120: size 4 bites.
    I understand that it is necessary to increase the volume of the cell, but I don’t know.

    Im sorry for my bad English, I study it using Google Translate =)

    CastSpellByID by UnitGUID
  2. #2
    boipus's Avatar Active Member
    Reputation
    25
    Join Date
    Apr 2018
    Posts
    4
    Thanks G/R
    2/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Edit- Read the post after just waking up, what I had here before was totally wrong

    Ok so let's break this down.

    The problem you have is that you are trying to push 8 bytes where you only have room for 4 bytes. The code you posted hints at the solution.
    Code:
                        "push 0",
                        "push "+ GUID,
    I dont know what patch you are looking at, but this looks like the solution. The function is expecting 8 bytes, here it is pushing 4 bytes twice.

    So instead of

    Code:
                        "push 0", // Room for 4 bytes
                        "push "+ GUID(8 bytes), // Room for 4 bytes
    you should be doing

    Code:
                        "push " + (1st half of GUID), // Room for 4 bytes
                        "push "+ (2nd half of GUID), // Room for 4 bytes
    Below is my code to generate ASM for OnRightClick for 2.4.3
    Code:
            internal static string[] RightClick(uint guidAddr)
            {
                return new string[]
                {
                    "mov eax, " + guidAddr,
                    "mov ecx, [eax + 4]",
                    "mov edx, [eax] ",
                    "push ecx",
                    "push edx",
                    "call 0x4A7980",
                    "add esp, 8",
                    "retn"
                };
            }
    The parameter 'guidAddr' is a pointer(4 bytes) to 8 bytes of memory where the GUID is stored. So to break it down
    1. I get a pointer (4 bytes) to your GUID (8 bytes)
    2. I move the pointer(4 bytes) into eax
    3. Read the value at eax +4 (the first 4 bytes of our GUID) and store into ecx
    4. Read the value at eax (the last 4 bytes of our GUID) and store into edx
    5. Push ecx (the first 4 bytes of our GUID)
    6. Push eax (the last 4 bytes of our GUID)
    Last edited by boipus; 04-18-2019 at 10:41 PM. Reason: First post was wrong

  3. Thanks Corthezz, NightlyBlooD, stoneharry (3 members gave Thanks to boipus for this useful post)
  4. #3
    NightlyBlooD's Avatar Member
    Reputation
    2
    Join Date
    Sep 2012
    Posts
    26
    Thanks G/R
    6/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've been puzzling for two days how to divide UInt64 into 2 UInt32 turned out to be so simple
    very big thank you!!!
    You my god))

  5. #4
    tutrakan's Avatar Contributor
    Reputation
    134
    Join Date
    Feb 2013
    Posts
    175
    Thanks G/R
    124/52
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A bit simpler option:
    Code:
    internal static string[] RightClick(ulong guid)
            {
                var low  = (uint)(guid & 0xFFFFFFFF);
                var high = (uint)((guid >> 32) & 0xFFFFFFFF);
    
                return new string[]
                {
                    "push " + high,
                    "push " + low,
                    "call 0x4A7980",         //int __cdecl CGGameUI::OnSpriteRightClick(__int64 guid)
                    "add esp, 8",
                    "retn"
                };
            }
    Here the dividing ulong into two uints SO link.
    Last edited by tutrakan; 04-22-2019 at 12:40 PM.

Similar Threads

  1. THE ULTIMATE DRUID MODEL CHANGES version 2 by Bloodofwar
    By bloodofwar in forum World of Warcraft Model Editing
    Replies: 3
    Last Post: 08-17-2006, 10:04 AM
  2. MMowned Private Server - Hosted by Tenser
    By Tenche in forum World of Warcraft General
    Replies: 21
    Last Post: 08-11-2006, 01:50 PM
  3. Lastest Idea By Amedis!
    By Amedis in forum Suggestions
    Replies: 7
    Last Post: 07-30-2006, 03:49 PM
  4. Step-By-Step Create Your Own AFK Bot! MMOwned Exclusive!
    By =sinister= in forum World of Warcraft Guides
    Replies: 6
    Last Post: 07-26-2006, 09:04 PM
  5. Scholo, room by room!!
    By Krazzee in forum World of Warcraft Guides
    Replies: 1
    Last Post: 06-11-2006, 01:36 AM
All times are GMT -5. The time now is 01:51 AM. 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