[Classic] 1.13.2.32089 - SpellBook, Cooldowns, WorldToScreen menu

User Tag List

Results 1 to 9 of 9
  1. #1
    NoxiaZ's Avatar Active Member
    Reputation
    23
    Join Date
    May 2019
    Posts
    101
    Thanks G/R
    21/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Classic] 1.13.2.32089 - SpellBook, Cooldowns, WorldToScreen

    Hi,

    I have been working on creating a bot for classic, and want to share what i have created so far (These things that have been hard to find on forum).
    But first i'll like to thank @ChrisIsMe, @charles420 and @DanThePman, that have provided help with the problems i have been facing. - I Couldn't have done it without them.

    The pointers and offsets i have come by is these:
    Code:
    public class SpellHandlerBase
    {
        protected static int COOLDOWNBASE = 0x2178818;
        protected static int SPELLBOOKBASE = 0x2546688; // Might be the wrong spellbook pointer, but its working
        protected static int SPELLBOOKLIST = -0x20; //Dont ask me why its -0x20 :D
        protected static int SPELLBOOKCOUNT = -0x28; //Dont ask me why its -0x28 :D
    }
    
    public class SpellCooldownBase
    {
        protected static int NEXT = 0x0;
        protected static int SPELLID = 0x10;
        protected static int STARTTIME = 0x1C;
        protected static int DURATION1 = 0x20; 
        protected const int DURATION2 = 0x2C; //Duration are found in either 1 or 2 - Depending on the spell (Think there maybe is another location as well, but haven't came by that yet)
    }
    
    public class SpellBookBase : MemoryObject
    {
        protected static int SPELLID = 0x4;
    }
    
    public class CameraBase 
    {
        protected const int CAMERABASE = 0x2546398;
        protected const int OFFSET = 0x3330;
        protected const int POSITION = 0x10;
        protected const int VIEWMATRIX = 0x1C;
        protected const int FOV = 0x40;
        protected const int ASPECT = 0x44;
    }

    Code i use for reading Cooldowns:
    Code:
    var spellCooldownObj = (IntPtr)Read(WowBaseAddress.Add(COOLDOWNS), typeof(IntPtr));
    var start = spellCooldownObj;
    while (spellCooldownObj != IntPtr.Zero)
    {
        var spellCooldown = new SpellCooldownModel(spellCooldownObj);
        spellCooldown.Update();
        if (spellCooldown.SpellID != 0)
        {
            Cooldowns.Add(spellCooldown);
        }
        else
        {
            break;
        }
        spellCooldownObj = (IntPtr)spellCooldown.Next;
        if (spellCooldownObj == start)
        {
            break;
        }
    }
    Code i use for reading SpellBook:

    Code:
    var spellBookObj = (IntPtr)Read(WowBaseAddress.Add(SPELLBOOK).Add(-0x20), typeof(IntPtr));
    var spellBookCount = (int)Read(WowBaseAddress.Add(SPELLBOOK).Add(-0x28), typeof(int));
    for (int i = 0; i < spellBookCount; i++)
    {
        var spellPointer = (IntPtr)Read(spellBookObj, typeof(IntPtr));
        if (spellPointer == IntPtr.Zero)
        {
            break;
        }//22D18943E00
        else
        {
            var spell = new SpellBookModel(spellPointer);
            spell.Update();
            SpellBook.Add(spell);
            spellBookObj = spellBookObj.Add(IntPtr.Size);
        }
    }
    WorldToScreen function: (All credits goes to @ChrisIsMe)

    Code:
    public ScreenModel WorldToScreen(Vector3 pos)
    {
        var model = new ScreenModel();
        var diff = pos - Position;
        Matrix4x4 invertedMatrix;
        Matrix4x4.Invert(ViewMatrix, out invertedMatrix);
        Vector3 difference = new Vector3(pos.X - Position.X, pos.Y - Position.Y, pos.Z - Position.Z);
        float product = difference.X * ViewMatrix.M11 + difference.Y * ViewMatrix.M12 + difference.Z * ViewMatrix.M13;
        if (product < 0) { return model; }
        else
        {
            Vector3 view = new Vector3(
                invertedMatrix.M11 * difference.X + invertedMatrix.M21 * difference.Y + invertedMatrix.M31 * difference.Z,
                invertedMatrix.M12 * difference.X + invertedMatrix.M22 * difference.Y + invertedMatrix.M32 * difference.Z,
                invertedMatrix.M13 * difference.X + invertedMatrix.M23 * difference.Y + invertedMatrix.M33 * difference.Z);
            RECT rc = new RECT() { Left = 0, Top = 0, Right = (int)ScreenSize.X, Bottom = (int)ScreenSize.Y };
            float Deg2Rad = 0.0174532925f;
            Vector3 camera = new Vector3(-view.Y, -view.Z, view.X);
            Vector2 gameScreen = new Vector2((rc.Right - rc.Left) / 2.0f, (rc.Bottom - rc.Top) / 2.0f);
            Vector2 aspect = new Vector2(gameScreen.X / (float)Math.Tan(((Fov * 55.0f) / 2.0f) * Deg2Rad), gameScreen.Y / (float)Math.Tan(((Fov * 35.0f) / 2.0f) * Deg2Rad));
            Vector2 screenPos = new Vector2(gameScreen.X + camera.X * aspect.X / camera.Z, gameScreen.Y + camera.Y * aspect.Y / camera.Z);
            if (screenPos.X < 0 || screenPos.Y < 0 || screenPos.X > rc.Right || screenPos.Y > rc.Bottom)
                return model;
            model.IsBehind = false;
            model.IsInFov = true;
            model.Point = screenPos;
            return model;
        }
    }

    I hope that this can help other people creating their bot
    Last edited by NoxiaZ; 10-22-2019 at 06:23 AM. Reason: Added one more duration memory address

    [Classic] 1.13.2.32089 - SpellBook, Cooldowns, WorldToScreen
  2. Thanks Buntstift, mazer, Corthezz, hacker5510 (4 members gave Thanks to NoxiaZ for this useful post)
  3. #2
    Buntstift's Avatar Member
    Reputation
    10
    Join Date
    Feb 2016
    Posts
    17
    Thanks G/R
    16/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Like the users you mentioned, i look up to you in the way you use ownedcore. This is why the mem-read-section is stay alive.
    Thank you Noxiaz

  4. #3
    NoxiaZ's Avatar Active Member
    Reputation
    23
    Join Date
    May 2019
    Posts
    101
    Thanks G/R
    21/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Buntstift View Post
    Like the users you mentioned, i look up to you in the way you use ownedcore. This is why the mem-read-section is stay alive.
    Thank you Noxiaz
    Thank you for the nice words - And i'm only glad for being able to help others

  5. #4
    mazer's Avatar Member Authenticator enabled
    Reputation
    11
    Join Date
    Sep 2007
    Posts
    69
    Thanks G/R
    7/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the code and your contribution!

    i have one question. currently i am using a world2screen purely based on slimdx operations. it works but has some quirks and flaws (code below for the ones interested).
    i was trying to use your code in hope for better results but there is one problem:

    the matrix invert fails all the time. my guess is that i initialize the matrix in the wrong way (data from memory is fine and so is the viewmatrix imo)
    how i create the matrix:

    Code:
    var bCamera = WowReader.ReadRaw(cam + 0x1C, 36); 
    var viewMatrix = new Matrix4x4();
    viewMatrix.M11 = BitConverter.ToSingle(bCamera, 0);
    viewMatrix.M12 = BitConverter.ToSingle(bCamera, 4);
    viewMatrix.M13 = BitConverter.ToSingle(bCamera, 8);
    viewMatrix.M21 = BitConverter.ToSingle(bCamera, 12);
    viewMatrix.M22 = BitConverter.ToSingle(bCamera, 16);
    viewMatrix.M23 = BitConverter.ToSingle(bCamera, 20);
    viewMatrix.M31 = BitConverter.ToSingle(bCamera, 24);
    viewMatrix.M32 = BitConverter.ToSingle(bCamera, 28);
    viewMatrix.M33 = BitConverter.ToSingle(bCamera, 32);
    the invert afterwards will fail.
    googeling on this topic and reading docs did not help...
    cant figure out whats wrong.
    i have a hard time wrapping my head around this topic reading docs. in the end it is just a "nice to have" feature and there are other parts of the code that are more important, but it annoys me to hell that the w2s im am using is not working as it should...


    here the slimDX version i currently use:
    Code:
    public Vector2 world2screen(Vector3 pos)
    {
    
    
        IntPtr cambase = (IntPtr)WowReader.ReadInt64(basemodule + 0x2546398);
        IntPtr cam = (IntPtr)WowReader.ReadInt64(cambase + 0x3330);
    
    
        float X = WowReader.ReadFloat(cam + 0x10);
        float Y = WowReader.ReadFloat(cam + 0x14);
        float Z = WowReader.ReadFloat(cam + 0x18);
        float FOV = WowReader.ReadFloat(cam + 0x40);
    
    
        //not sure here
        float NearClip = 0.2f;
        float FarClip = 2112f;
        float Aspect = 2.2f;
    
    
        var bCamera = WowReader.ReadRaw(cam + 0x1C, 36);
        var m = new SlimDX.Matrix();
        m[0, 0] = BitConverter.ToSingle(bCamera, 0);
        m[0, 1] = BitConverter.ToSingle(bCamera, 4);
        m[0, 2] = BitConverter.ToSingle(bCamera, 8);
        m[1, 0] = BitConverter.ToSingle(bCamera, 12);
        m[1, 1] = BitConverter.ToSingle(bCamera, 16);
        m[1, 2] = BitConverter.ToSingle(bCamera, 20);
        m[2, 0] = BitConverter.ToSingle(bCamera, 24);
        m[2, 1] = BitConverter.ToSingle(bCamera, 28);
        m[2, 2] = BitConverter.ToSingle(bCamera, 32);
    
    
    
    
        var Projection = SlimDX.Matrix.PerspectiveFovRH(FOV * 0.5f, Aspect, NearClip, FarClip);
    
    
        var eye = new SlimDX.Vector3(X, Y, Z);
        var lookAt = new SlimDX.Vector3(X + m[0, 0], Y + m[0, 1], Z + m[0, 2]);
        var up = new SlimDX.Vector3(0f, 0f, 1f);
    
    
        var View = SlimDX.Matrix.LookAtRH(eye, lookAt, up);
        var World = SlimDX.Matrix.Identity;
    
    
        var WorldPosition = new SlimDX.Vector3(pos.X, pos.Y, pos.Z);
    
    
        var ScreenPosition = SlimDX.Vector3.Project(WorldPosition, 0f, 0f, 2560, 1440, NearClip, FarClip, World * View * Projection);
    
    
        return new Vector2(ScreenPosition.X, ScreenPosition.Y);
    
    
    }

  6. #5
    NoxiaZ's Avatar Active Member
    Reputation
    23
    Join Date
    May 2019
    Posts
    101
    Thanks G/R
    21/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @mazer, Thank you

    I think you are missing the viewMatrix.M44 = 1 - As i understood, when converting a viewmatrix 3x3 to 4x4 you need to set the M44 to 1.
    Also i'm only using classes from the Library "System.Numerics", all the other libraries i have been looking at have not been worked for me.

  7. Thanks mazer (1 members gave Thanks to NoxiaZ for this useful post)
  8. #6
    mazer's Avatar Member Authenticator enabled
    Reputation
    11
    Join Date
    Sep 2007
    Posts
    69
    Thanks G/R
    7/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by NoxiaZ View Post
    @mazer, Thank you

    I think you are missing the viewMatrix.M44 = 1 - As i understood, when converting a viewmatrix 3x3 to 4x4 you need to set the M44 to 1.
    Also i'm only using classes from the Library "System.Numerics", all the other libraries i have been looking at have not been worked for me.
    thanks for the tip. sure enough this was the problem.
    i am using System.Numerics with this code too. just used slimdx for the other because it was part of my small overlay "framework"

  9. #7
    Geneditor's Avatar Member
    Reputation
    2
    Join Date
    Mar 2020
    Posts
    11
    Thanks G/R
    1/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How did you find the COOLDOWNBASE address?

  10. #8
    Bogie's Avatar Member
    Reputation
    11
    Join Date
    Apr 2020
    Posts
    17
    Thanks G/R
    8/3
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I'm having a little trouble with the world to screen projection as well.
    Basically, I'm selecting some non-moving NPC, project their position onto screen coordinates, and move the cursor to those coords.

    Works rather well in general, the cursor lands up very close to the NPC. However, it doesn't appear to be entirely consistent.
    Namely, when I tilt the camera, or when I'm moving around the NPC a bit, it becomes obvious the cursor doesn't always exactly point to the same location. E.g. it may sometimes point so ca. the left foor on the NPC, sometimes to its right foot, and so on. It's always close, but not entirely consistent.

    I've tested this with the implementation from ZzukBot, as well as the World to Screen function from above, however both appear to have similar behaviour.

    Has anyone experienced something similar / any thoughts on what could be going on there?
    The inconsistencies look a little to large to me to just be an issue of float precision or such

  11. #9
    oldmanofmen's Avatar Member
    Reputation
    12
    Join Date
    Jan 2010
    Posts
    104
    Thanks G/R
    4/3
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Bogie View Post
    I'm having a little trouble with the world to screen projection as well.
    Basically, I'm selecting some non-moving NPC, project their position onto screen coordinates, and move the cursor to those coords.

    Works rather well in general, the cursor lands up very close to the NPC. However, it doesn't appear to be entirely consistent.
    Namely, when I tilt the camera, or when I'm moving around the NPC a bit, it becomes obvious the cursor doesn't always exactly point to the same location. E.g. it may sometimes point so ca. the left foor on the NPC, sometimes to its right foot, and so on. It's always close, but not entirely consistent.

    I've tested this with the implementation from ZzukBot, as well as the World to Screen function from above, however both appear to have similar behaviour.

    Has anyone experienced something similar / any thoughts on what could be going on there?
    The inconsistencies look a little to large to me to just be an issue of float precision or such
    It sounds like this could be a field of view issue. I had issues with W2S being ever so slightly out when I was using an incorrect FoV value. What value are you setting it to?

Similar Threads

  1. [Classic] 1.13.2.32089 - WorldToScreen
    By NoxiaZ in forum WoW Memory Editing
    Replies: 5
    Last Post: 07-18-2021, 07:19 AM
  2. [Classic] 1.13.2.32089
    By SatyPardus in forum WoW Memory Editing
    Replies: 24
    Last Post: 11-05-2019, 08:49 PM
  3. [Classic] [Classic] 1.13.2.32089 - Learned Spells
    By NoxiaZ in forum WoW Memory Editing
    Replies: 14
    Last Post: 10-17-2019, 04:32 PM
  4. WoW Classic 1.13 Sandbox
    By raido in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 10-24-2018, 06:23 PM
  5. [Selling] Level 60 Hunter. Classic Rank 13 Warlord
    By Tschaenter in forum WoW-EU Account Buy Sell Trade
    Replies: 1
    Last Post: 11-04-2013, 03:21 PM
All times are GMT -5. The time now is 12:59 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