Spell Cooldowns menu

These ads disappear when you log in.

Results 1 to 6 of 6
  1. #1
    provirus's Avatar Member CoreCoins User
    Reputation
    3
    Join Date
    Mar 2012
    Posts
    16
    Thanks G/R
    5/2
    Trade Feedback
    0 (0%)

    Spell Cooldowns

    Hello everyone!
    I'm trying to implement spell cooldown info for my bot, and I've got stuck. My code below returns values for ~50% of my spells only. It happens because for some spells duration is 0. For example, for shaman, this code returns valid numbers for Earthbind Totem, but for Spirit Link Totem it returns nothing because duration in WoW memory is 0. Any help please?

    Code:
    // WoW build 32028
    [DllImport("kernel32.dll", SetLastError = true)]
    static extern bool QueryPerformanceFrequency(out long frequency);
    
    [DllImport("kernel32.dll", SetLastError = true)]
    static extern bool QueryPerformanceCounter(out long lpPerformanceCount);
    
    [StructLayout(LayoutKind.Explicit)]
    internal struct SpellCooldownInfo
    {
    	[FieldOffset(0x8)]
    	internal IntPtr NextAddress;
    
    	[FieldOffset(0x10)]
    	internal int SpellID;
    
    	[FieldOffset(0x1C)]
    	internal int StartTime;
    
    	[FieldOffset(0x20)]
    	internal int Duration;
    
    }
    
    private long GetCurrentTime()
    {
    	QueryPerformanceFrequency(out long frequency);
    	QueryPerformanceCounter(out long counter);
    	long currentTime = (counter * 1000) / frequency;
    	return currentTime;
    }
    
    private long GetSpellCooldown(int spellID)
    {
    	textBox1.AppendText($"NEW CALL: {spellID}\r\n");
    	long currentTime = GetCurrentTime();
    	IntPtr spellObj = game.Memory.Read<IntPtr>(game.Memory.ImageBase + 0x2824F60 + 0x10);
    	int startTime = 0;
    	long cooldown = 0;
    	while (((ulong)spellObj & 1) == 0 && spellObj != IntPtr.Zero)
    	{
    		SpellCooldownInfo spellCooldownInfo = game.Memory.Read<SpellCooldownInfo>(spellObj);
    		if (spellCooldownInfo.SpellID == spellID && spellCooldownInfo.Duration > 0)
    		{
    			if (spellCooldownInfo.StartTime > startTime)
    			{
    				startTime = spellCooldownInfo.StartTime;
    				cooldown = spellCooldownInfo.Duration - (currentTime - spellCooldownInfo.StartTime);
    			}
    		}
    		spellObj = spellCooldownInfo.NextAddress;
    	}
    
    	return cooldown < 0 ? 0 : cooldown;
    }
    Last edited by provirus; 10-12-2019 at 09:50 AM.

  2. #2
    ChrisIsMe's Avatar Active Member CoreCoins User
    Reputation
    59
    Join Date
    Apr 2017
    Posts
    72
    Thanks G/R
    35/21
    Trade Feedback
    0 (0%)
    Look further down in the SpellHistoryEntry struct, there's another duration length offset that some spells trigger.

  3. #3
    provirus's Avatar Member CoreCoins User
    Reputation
    3
    Join Date
    Mar 2012
    Posts
    16
    Thanks G/R
    5/2
    Trade Feedback
    0 (0%)
    Originally Posted by ChrisIsMe View Post
    Look further down in the SpellHistoryEntry struct, there's another duration length offset that some spells trigger.
    How far is it? I've checked every byte until spellEntry + 0x100, there are not any duration value.

  4. #4
    counted's Avatar Contributor CoreCoins User Authenticator enabled
    Reputation
    180
    Join Date
    Mar 2008
    Posts
    154
    Thanks G/R
    10/87
    Trade Feedback
    0 (0%)
    You need to reverse SpellHistory:GetCooldown. There are three cool downs in the spell entry struct. CD1, CD2, and Global Cooldown. CD1 is generally the individual cool down, CD2 is genearlly the common cool down, and Global Cooldown is well the global cooldown. The common cool down is for things like trinkets, so if you have two on use trinkets and you use trinket A, trinket B CD2 will start at 30 secs and count down. You have to wait at least 30 sec in between trinkets.

    You can find SpellHistory:GetCooldown by looking at the Script_GetSpellCooldown sub_1161F90 in the 32028 binary. From that sub the sub_B42F40 has all of the offsets you need for the complete spellentry struct.
    Last edited by counted; 10-13-2019 at 10:00 AM.

  5. Thanks ChrisIsMe, DanThePman (2 members gave Thanks to counted for this useful post)
  6. #5
    provirus's Avatar Member CoreCoins User
    Reputation
    3
    Join Date
    Mar 2012
    Posts
    16
    Thanks G/R
    5/2
    Trade Feedback
    0 (0%)
    Originally Posted by counted View Post
    You need to reverse SpellHistory:GetCooldown. There are three cool downs in the spell entry struct. CD1, CD2, and Global Cooldown. CD1 is generally the individual cool down, CD2 is genearlly the common cool down, and Global Cooldown is well the global cooldown. The common cool down is for things like trinkets, so if you have two on use trinkets and you use trinket A, trinket B CD2 will start at 30 secs and count down. You have to wait at least 30 sec in between trinkets.

    You can find SpellHistory:GetCooldown by looking at the Script_GetSpellCooldown sub_1161F90 in the 32028 binary. From that sub the sub_B42F40 has all of the offsets you need for the complete spellentry struct.
    Sorry for late reply.
    Maybe I've explained myself wrong. I've found this function when I was searching for offsets; that was quite obvious. But 'CD1' offset returns 0 for certain spells on cooldown. 'GetCooldown' function is big, and I'm not good in reversing, so I cannot fully understand it. Can you please point me more precisely? Should I look at the start or end, or specific 'if' statement...

  7. #6
    shauren's Avatar Established Member CoreCoins User
    Reputation
    64
    Join Date
    Feb 2009
    Posts
    56
    Thanks G/R
    2/27
    Trade Feedback
    0 (0%)
    There is also a fourth type of cooldown, spell charges, stored in a separate list in spellhistory global - there are spells that don't have multiple charges but still use that system and Spirit Link is such a spell, their entry in regular cooldown struct is for GCD only
    Last edited by shauren; 3 Weeks Ago at 08:57 AM.

Similar Threads

  1. And again spell Cooldowns question
    By HexNeo in forum WoW Memory Editing
    Replies: 20
    Last Post: 04-20-2012, 02:24 PM
  2. [3.1.3] [Info] Getting Spell Cooldowns
    By Oowafas in forum WoW Memory Editing
    Replies: 37
    Last Post: 02-20-2011, 05:56 AM
  3. Spell Cooldown-List
    By rafalsk in forum WoW Memory Editing
    Replies: 1
    Last Post: 08-06-2010, 02:12 PM
  4. Spell cooldowns and Spell.dbc edititng
    By RYUchan in forum WoW EMU Questions & Requests
    Replies: 1
    Last Post: 06-11-2009, 11:53 AM
  5. Remove all spell cooldowns faster after a duel
    By falarious in forum World of Warcraft Exploits
    Replies: 17
    Last Post: 07-20-2008, 08:58 AM
All times are GMT -5. The time now is 11:47 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved. Digital Point modules: Sphinx-based search