VB2005/Math logic question menu

Shout-Out

User Tag List

Results 1 to 10 of 10
  1. #1
    katnegermis's Avatar Member
    Reputation
    1
    Join Date
    Mar 2009
    Posts
    7
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    VB2005/Math logic question

    Hey guys!

    I've recently begun having some fun, making a wow-radar.
    The radar was easily made in AutoIt, but very flickery.

    So I've got two questions for you guys:

    1) How do you draw mobs/npcs etc. on your radar?
    I managed to draw mine with some GDI code, but I get an overflow error most of the time
    Here's a link to my project: http://katnegermis.dk/lektier/wow_fun.rar

    2) How do you read a string from the memory, using ReadProcessMemory call?

    I know the code I wrote isn't very pretty, but I really hope you can help me out!

    Thanks in advance!

    VB2005/Math logic question
  2. #2
    lanman92's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2007
    Posts
    1,033
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've had problems with GDI(+) as well. I avoid it. But to read a string, pass a char* as a reference for the buffer i think. Oh, you're using VB... Not sure.

    EDIT: Use Blackmagic to get started. If you feel that you would rather write your own, have at it. Blackmagic has pretty much everything you need for out of process though. Could be improved though.
    Last edited by lanman92; 05-29-2009 at 12:21 PM.

  3. #3
    katnegermis's Avatar Member
    Reputation
    1
    Join Date
    Mar 2009
    Posts
    7
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by lanman92 View Post
    I've had problems with GDI(+) as well. I avoid it. But to read a string, pass a char* as a reference for the buffer i think. Oh, you're using VB... Not sure.

    EDIT: Use Blackmagic to get started. If you feel that you would rather write your own, have at it. Blackmagic has pretty much everything you need for out of process though. Could be improved though.
    Thanks for the quick answer
    Is there anywhere with references on how to actualy use BlackMagic in VB?
    I've just downloaded it, but I don't really know which functions to call in the dll

    <3

  4. #4
    lanman92's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2007
    Posts
    1,033
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Add it as a reference to your project and start exploring. Create a new instance and just look. It's simple, use SProcess.Get***() to grab PID and then create instance with new BlackMagic(PIDHERE). Pretty simple. Just read the help file or browse some of the code that ppl using it have posted here.

  5. #5
    Shynd's Avatar Contributor
    Reputation
    97
    Join Date
    May 2008
    Posts
    393
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First things first, I don't know shit about VB.NET, so if some of this cannot be converted from C#, I apologize.

    To use BlackMagic, you need to instantiate a new BlackMagic class object. Magic.BlackMagic bm = new Magic.BlackMagic

    From there, you can use its static methods to find the window or process of Wow.exe and open it, thus: bm.Open(SProcess.GetProcessFromProcessName("wow"))

    Now you can use bm.ReadUInt(Address) and the like to read from memory.


    If you're using GDI+, you're going to want to render your radar onto a panel control, so add one to your form and call it whatever you want; I called mine panelRadar.

    Use the System.Runtime.InteropServices namespace to import user32.PeekMessage, like so:
    <DllImport("User32.dll")> _
    Public Shared Function PeekMessage(<Out> ByRef msg As Message, ByVal hWnd As IntPtr, ByVal messageFilterMin As UInt32, ByVal messageFilterMax As UInt32, ByVal flags As UInt32) As Boolean


    In your form constructor, the one where it calls InitializeComponent();, set up a new event handler for the Application.Idle event. AddHandler Application.Idle, New EventHandler(AddressOf Me.Application_Idle)

    Code:
        Private brush As Brush
        Private font As Font
        Private fps As Single = 30!
        Private img As Image
        Private lastTick As Integer
    
    
        Public Sub New()
            AddHandler Application.Idle, New EventHandler(AddressOf Me.Application_Idle)
    
            Me.InitializeComponent
    
            Me.brush = New SolidBrush(Color.White)
            Me.pen = New Pen(Color.White, 2!)
            Me.font = New Font(FontFamily.GenericSansSerif, 8!)
            Me.img = New Bitmap(Me.panelRadar.Width, Me.panelRadar.Height)
    
            Me.DoubleBuffered = True
    
            Try
                Me.bm = New BlackMagic
            Catch ex As Exception
                MessageBox.Show(ex.Message)
                MyBase.Close
            End Try
        End Sub
    
    
    
       Private Sub Application_Idle(ByVal sender As Object, ByVal e As EventArgs)
            Dim msg As Message
            Dim g As Graphics = panelRadar.CreateGraphics
    
            Do While Not frmMain.PeekMessage(msg, IntPtr.Zero, 0, 0, 0)
                If ((Environment.TickCount - Me.lastTick) > CInt((1000! / Me.fps))) Then
                    Me.lastTick = Environment.TickCount
    
                    Me.Render(g, Me.img)
                Else
                    Thread.Sleep(1)
                End If
            Loop
    
            g.Dispose
        End Sub
    
    
        Private Sub Render(ByVal renderer As Graphics, ByVal img As Image)
            '//refresh all object location and shit here
    
            Dim size As Size = Me.panelRadar.Size
            Dim g As Graphics = Graphics.FromImage(img)
    
            g.Clear(Color.Black)
            g.SmoothingMode = SmoothingMode.HighQuality
    
            Dim obj As WoWObject
            For Each obj In Me.Objects '//Me.Objects should be a list of all currently loaded objects
                Me.DrawObject(Me.LocalPlayer, obj, size, g, Me.pen, Me.brush, Me.font)
            Next
    
            renderer.DrawImageUnscaled(img, 0, 0)
    
            g.Dispose
        End Sub
    
    
        Private Sub DrawObject(ByVal player As WoWObject, ByVal obj As WoWObject, ByVal size As Size, ByVal g As Graphics, ByVal p As Pen, ByVal b As Brush, ByVal font As Font)
            Try 
                obj.RefreshPosition
    
                Dim pos As New RectangleF
    
                pos.X = ((-player.Position.X + obj.Position.X) + ((size.Width / 2) - 3))
                pos.Y = ((player.Position.Z - obj.Position.Z) + ((size.Height / 2) - 3))
                pos.Width = 6!
                pos.Height = 6!
    
                g.TranslateTransform((-pos.X - 3!), (-pos.Y - 3!), MatrixOrder.Append)
                g.RotateTransform(obj.Rotation, MatrixOrder.Append) '//obj.Rotation should be in degrees, not radians
                g.TranslateTransform((pos.X + 3!), (pos.Y + 3!), MatrixOrder.Append)
    
                g.DrawEllipse(p, pos)
                g.DrawLine(p, (pos.X + 3!), pos.Y, (pos.X + 3!), (pos.Y - 6!))
    
                g.ResetTransform
                g.DrawString(obj.Name, font, b, CSng((pos.X + 3!)), CSng((pos.Y + 6!)))
    
            Catch obj1 As Object
            End Try
        End Sub
    A lot of this you will probably change with your own code, like how you store objects and their locations and rotation, but this is, as far as I can tell, the correct way to use GDI+ to draw on a panel control. Do not use Me.Invalidate() and override the OnPaint method; that is a terrible way of forcing redraw.

    You should also set an event handler for panelRadar.OnResize that will dispose of the current Me.img and create a new Bitmap object that is the new size of panelRadar.

    Hopefully it helps. You should be able to find everything else you need, like iterating through loaded objects and getting their positional information, on these forums.

    Final disclaimer: I used .NET Reflector to convert code I had written for a radar program for a different game (Runes of Magic) from C# to VB.NET. If something is wrong or stupid, it's not my fault; I don't know anything about VB.NET.

  6. #6
    Dombo's Avatar Banned
    Reputation
    622
    Join Date
    Nov 2008
    Posts
    1,421
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I advice you to post your questions in the VB section from now on:

    VB - MMOwned - World of Warcraft Exploits, Hacks, Bots and Guides

  7. #7
    SKU's Avatar Contributor
    Reputation
    306
    Join Date
    May 2007
    Posts
    565
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Dombo View Post
    I advice you to post your questions in the VB section from now on:

    VB - MMOwned - World of Warcraft Exploits, Hacks, Bots and Guides
    Go away please.

  8. #8
    obox's Avatar Contributor
    Reputation
    134
    Join Date
    Aug 2008
    Posts
    532
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Dombo View Post
    I advice you to post your questions in the VB section from now on:

    VB - MMOwned - World of Warcraft Exploits, Hacks, Bots and Guides
    lol please dont flame..

  9. #9
    katnegermis's Avatar Member
    Reputation
    1
    Join Date
    Mar 2009
    Posts
    7
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks guys - will have a look at it!!

  10. #10
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by SKU View Post
    Go away please.
    He's right. This thread really has nothing to do with WoW in specific. Moreso, just a general question about programming. We have forums for that.

Similar Threads

  1. [Question] Wow radar math?
    By gononono64 in forum WoW Memory Editing
    Replies: 14
    Last Post: 03-08-2011, 07:36 PM
  2. Rather math question...
    By nerexis in forum WoW Memory Editing
    Replies: 14
    Last Post: 01-10-2011, 01:54 AM
  3. VB2005/Math logic question
    By katnegermis in forum WoW Memory Editing
    Replies: 9
    Last Post: 05-29-2009, 10:18 PM
  4. Question..
    By janzi9 in forum Community Chat
    Replies: 3
    Last Post: 04-02-2006, 10:20 AM
  5. A GALB question
    By bassman in forum World of Warcraft General
    Replies: 4
    Last Post: 03-28-2006, 09:49 AM
All times are GMT -5. The time now is 05:48 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search