Spell Cooldowns menu

User Tag List

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

    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.

    Spell Cooldowns
  2. #2
    ChrisIsMe's Avatar Contributor
    Reputation
    164
    Join Date
    Apr 2017
    Posts
    210
    Thanks G/R
    67/100
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Look further down in the SpellHistoryEntry struct, there's another duration length offset that some spells trigger.

  3. #3
    provirus's Avatar Member
    Reputation
    3
    Join Date
    Mar 2012
    Posts
    16
    Thanks G/R
    5/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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 Authenticator enabled
    Reputation
    203
    Join Date
    Mar 2008
    Posts
    183
    Thanks G/R
    11/108
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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
    Reputation
    3
    Join Date
    Mar 2012
    Posts
    16
    Thanks G/R
    5/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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
    Reputation
    65
    Join Date
    Feb 2009
    Posts
    60
    Thanks G/R
    2/28
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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; 10-24-2019 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 04:13 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