Created a rotation addon, but game freezes after combat / when I turn off addon menu

User Tag List

Results 1 to 1 of 1
  1. #1
    Chas3down's Avatar Member
    Reputation
    2
    Join Date
    Feb 2012
    Posts
    41
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Created a rotation addon, but game freezes after combat / when I turn off addon

    Whenever I turn off the rotation or when combat ends, my game freezes for like 5 seconds. if I was in combat for a longer period of time, it freezes for longer.

    Code:
    HunterRotation = LibStub("AceAddon-3.0"):NewAddon("HunterRotation", "AceConsole-3.0", "AceEvent-3.0")
    
    local doRotation = false;
    
    local blackArrowID = 3674;
    local killCommandID = 34026;
    local chimShotID = 53209;
    local explShotID = 60053;
    local multiShotID = 49048;
    local killShotID = 61006;
    local rapidFireID = 3045;
    local readinessID = 23989;
    local bestWrathID = 19574;
    
    local blackArrowName = "Black Arrow";
    local killCommandName = "Kill Command";
    local chimShotName = "Chimera Shot";
    local explShotName = "Explosive Shot";
    local multiShotName = "Multi-Shot";
    local steadyShotName = "Steady Shot";
    local serpStingName = "Serpent Sting";
    local huntMarkName = "Hunter's Mark";
    local killShotName = "Kill Shot";
    local rapidFireName = "Rapid Fire";
    local readinessName = "Readiness";
    local bestWrathName = "Bestial Wrath";
    local bloodFuryName = "Blood Fury";
    
    function HunterRotation:OnInitialize()
    	self:RegisterEvent("COMBAT_LOG_EVENT");	
    	HunterRotation:RegisterChatCommand("on", "On");
    	HunterRotation:RegisterChatCommand("off", "Off");
    end
    
    function HunterRotation:On(input)
    	print("On");
    	doRotation = true;
      -- Process the slash command ('input' contains whatever follows the slash command)
    end
    
    function HunterRotation:Off(input)
    	print("Off");
    	doRotation = false;
      -- Process the slash command ('input' contains whatever follows the slash command)
    end
    
    function IsOnCD(spellID)
    	local a, cd = GetSpellCooldown(spellID);
    	
    	if (cd > 1.5) then
    		return true;
    	end
    	
    	return false;
    end
    
    function TargetDebuff(spellName, onlyMe)
    	local name;
    	if onlyMe then
    		name = UnitDebuff("target", spellName,nil,'PLAYER');
    	else
    		name = UnitDebuff("target", spellName);
    	end
    	
    	if (name == nil) then
    		return false;
    	end
    
    	return true;
    	
    end
    
    
    function HunterRotation:COMBAT_LOG_EVENT()
    
    	if UnitAffectingCombat("player") and UnitExists("target") then
    		--if doRotation and (UnitHealthMax("target") - UnitHealth("target") > 0) then
    		if doRotation then
    			if not TargetDebuff(huntMarkName, false) then
    				CastSpellByName("!Auto Shot");
    				CastSpellByName(huntMarkName);
    				return;
    			elseif IsShiftKeyDown() and not IsOnCD(rapidFireID) and UnitBuff("player","Rapid Fire") == nil then
    				CastSpellByName("!Auto Shot");
    				CastSpell(5, "pet");
    				CastSpellByName(bloodFuryName);
    				CastSpellByName(rapidFireName);
    				return;
    			elseif IsShiftKeyDown() and not IsOnCD(readinessID) and IsOnCD(rapidFireID) and IsOnCD(multiShotID)and IsOnCD(explShotID) and IsOnCD(chimShotID) and IsOnCD(killCommandID) and IsOnCD(bestWrathID) then
    				CastSpellByName("!Auto Shot");
    				CastSpellByName(readinessName);
    				return;
    			elseif not TargetDebuff(serpStingName, true) then
    				CastSpellByName("!Auto Shot");
    				CastSpellByName(serpStingName);
    				return;
    			elseif not IsOnCD(blackArrowID) then
    				CastSpellByName("!Auto Shot");
    				CastSpellByName(blackArrowName);
    				return;
    			elseif UnitExists("pet") and IsShiftKeyDown() and not IsOnCD(bestWrathID) and not IsOnCD(killCommandID) then
    				CastSpellByName("!Auto Shot");
    				CastSpell(5, "pet");
    				CastSpellByName(bloodFuryName);
    				CastSpellByName(bestWrathName);
    				return;
    			elseif UnitExists("pet") and not IsOnCD(killCommandID) then
    				CastSpellByName("!Auto Shot");
    				CastSpell(5, "pet");
    				CastSpellByName(killCommandName);
    				return;
    			elseif not IsOnCD(chimShotID) then
    				CastSpellByName("!Auto Shot");
    				CastSpellByName(chimShotName);
    				return;
    			elseif not IsOnCD(killShotID) and UnitHealth("target")/UnitHealthMax("target") <= .20 then
    				CastSpellByName("!Auto Shot");
    				CastSpellByName(killShotName);
    				return;
    			elseif not IsOnCD(explShotID) and not TargetDebuff(explShotName, true) then
    				CastSpellByName("!Auto Shot");
    				CastSpellByName(explShotName);
    				return;
    			elseif not IsOnCD(multiShotID) then
    				CastSpellByName("!Auto Shot");
    				CastSpellByName(multiShotName);
    				return;
    			else
    				CastSpellByName("!Auto Shot");
    				CastSpellByName(steadyShotName);
    			end
    		end
    	end
    end
    Any ideas how to fix?

    Created a rotation addon, but game freezes after combat / when I turn off addon

Similar Threads

  1. Rotation addon autocast.
    By BasketCase209 in forum WoW Bots Questions & Requests
    Replies: 4
    Last Post: 06-10-2011, 09:03 AM
  2. Game Freezing
    By Kasrkin in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 03-13-2009, 07:06 PM
  3. [Question] Loading Screen freezes after fully loaded, How Do I fix this?
    By hiroyuki in forum WoW EMU Questions & Requests
    Replies: 1
    Last Post: 02-13-2009, 10:16 AM
  4. Game close after "enter world"
    By hurrbull in forum World of Warcraft General
    Replies: 1
    Last Post: 10-21-2007, 08:06 PM
All times are GMT -5. The time now is 01:47 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