[PQR] Cokx - Unit Tracking menu

Shout-Out

User Tag List

Results 1 to 12 of 12
  1. #1
    cokx's Avatar Banned
    Reputation
    92
    Join Date
    Dec 2008
    Posts
    896
    Thanks G/R
    0/0
    Trade Feedback
    4 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [PQR] Cokx - Unit Tracking

    Hey there,
    this is a little piece of code I wrote yesterday.

    It tracks up to 50 Units around you and returns their position + facing

    Code:
    function CokxCheck()
    if rangeGUID == nil then rangeGUID ={GUID=0,Name=0, Enemy=0, Neutral=0, Friendly=0, Mask=0} end
    if guidTable == nil then guidTable ={} end
    if #rangeGUID > 50 then rangeGUID={GUID=0,Name=0, Enemy=0, Neutral=0, Friendly=0, Mask=0} guidTable ={} end
    if not WhereAreYou then
    	WhereAreYou = CreateFrame("FRAME", nil, UIParent)
    	WhereAreYou:Hide()
    end
    
    function WhereAreYou_OnEvent(self, event, ...)
    	local type, _, sourceGUID, sourceNAME, UnitFlag, _, destGUID, destNAME = select(2, ...)
    	if event == "COMBAT_LOG_EVENT_UNFILTERED" then
    		
    		table.insert(guidTable,{GUID=sourceGUID,Name=sourceName, Enemy=bit.band(UnitFlag, COMBATLOG_OBJECT_REACTION_HOSTILE), Neutral=bit.band(UnitFlag, COMBATLOG_OBJECT_REACTION_NEUTRAL), Friendly=bit.band(UnitFlag, COMBATLOG_OBJECT_REACTION_FRIENDLY), Mask=bit.band(UnitFlag, COMBATLOG_OBJECT_AFFILIATION_MASK)})
    		table.insert(guidTable,{GUID=destGUID,Name=destNAME, Enemy=bit.band(UnitFlag, COMBATLOG_OBJECT_REACTION_HOSTILE), Neutral=bit.band(UnitFlag, COMBATLOG_OBJECT_REACTION_NEUTRAL), Friendly=bit.band(UnitFlag, COMBATLOG_OBJECT_REACTION_FRIENDLY),Mask=bit.band(UnitFlag, COMBATLOG_OBJECT_AFFILIATION_MASK)})
    
    
    	end
    end
    WhereAreYou:SetScript("OnEvent", WhereAreYou_OnEvent)
    WhereAreYou:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    
    for j=1,#guidTable do
    guidExists = 0
    for i = 1, #rangeGUID do
    if guidTable[j].GUID == rangeGUID[i].GUID  then
    guidExists = 1
    break
    end
    end
    if guidExists == 0 then
    table.insert(rangeGUID,{GUID=guidTable[j].GUID, Time=GetTime(),Range=PQR_UnitDistance("player",guidTable[j].GUID),Name = guidTable[j].Name,Enemy= guidTable[j].Enemy,Friendly= guidTable[j].Friendly,Neutral= guidTable[j].Neutral,Mask= guidTable[j].Mask})
    end
    end
    
    if not dieBitch then
    	dieBitch = CreateFrame("FRAME", nil, UIParent)
    	dieBitch:Hide()
    end
    
    function dieBitch_OnEvent(self, event, ...)
    	local type, _, sourceGUID, sourceNAME, _, _, destGUID, destNAME = select(2, ...)
    	if event == "COMBAT_LOG_EVENT_UNFILTERED" then
    		if type == "UNIT_DIED"
    			 then
    			 for i=1,#rangeGUID do
    			if destGUID == rangeGUID[i].GUID then
    			table.remove(rangeGUID,i)
    			end
    			end
    		end
    	end
    end
    dieBitch:SetScript("OnEvent", dieBitch_OnEvent)
    dieBitch:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    
    for i = 1, #rangeGUID do
    if GetTime() - rangeGUID[i].Time > 1 then
    local lguid =rangeGUID[i].GUID
    local lname =rangeGUID[i].Name
    local lenemy =rangeGUID[i].Enemy
    local lfriendly =rangeGUID[i].Friendly
    local lneutral =rangeGUID[i].Neutral
    local lmask =rangeGUID[i].Mask
    table.remove(rangeGUID,i)
    table.insert(rangeGUID,i,{GUID=lguid, Time=GetTime(),Range=PQR_UnitDistance("player",lguid), Name = lname, Enemy = lenemy, Friendly = lfriendly, Neutral = lneutral, Mask = lmask})
    end
    end
    
    end
    
    
    function CokxRange(unit,guid)
    for i=1,#rangeGUID do
    	if guid == nil then
    		if UnitGUID(unit) == rangeGUID[i].GUID
    		and rangeGUID[i].Range ~= nil
    		then return rangeGUID[i].Range
    		end
    	end
    	if unit == nil then
    		if guid == rangeGUID[i].GUID
    		and rangeGUID[i].Range ~= nil
    		then return rangeGUID[i].Range
    		end
    	end
    end
    end
    
    function getCokxFacing()
    if not tCokxFacing then tCokxFacing = {} end
    tCokxFacing = {}
    for i=1,#rangeGUID do
    table.insert(tCokxFacing,{Facing = PQR_UnitFacing("player",rangeGUID[i].GUID),Time = GetTime(), GUID = rangeGUID[i].GUID})
    end
    
    end
    
    function CokxFacing(unit,guid)
    for i=1,#tCokxFacing do
    
    		if tCokxFacing[i].GUID == UnitGUID(unit) or guid
    		then return tCokxFacing[i].Facing 
    		
    		end
    	end
    end

    [PQR] Cokx - Unit Tracking
  2. #2
    MrHeroe's Avatar Member
    Reputation
    3
    Join Date
    May 2013
    Posts
    67
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow... and this works? Thank you very much for sharing this - +rep

    P.S.: i made the code a bit more readable =)

    Code:
    function CokxCheck()
    	if rangeGUID == nil then 
    		rangeGUID ={GUID=0,Name=0, Enemy=0, Neutral=0, Friendly=0, Mask=0} 
    	end
    
    	if guidTable == nil then 
    		guidTable ={} 
    	end
    	
    	if #rangeGUID > 50 then 
    		rangeGUID={GUID=0,Name=0, Enemy=0, Neutral=0, Friendly=0, Mask=0} guidTable ={} 
    	end
    
    	if not WhereAreYou then
    		WhereAreYou = CreateFrame("FRAME", nil, UIParent)
    		WhereAreYou:Hide()
    	end
    
    	function WhereAreYou_OnEvent(self, event, ...)
    		local type, _, sourceGUID, sourceNAME, UnitFlag, _, destGUID, destNAME = select(2, ...)
    		
    		if event == "COMBAT_LOG_EVENT_UNFILTERED" then
    			table.insert(guidTable,{GUID=sourceGUID,Name=sourceName, 
    			  Enemy=bit.band(UnitFlag, COMBATLOG_OBJECT_REACTION_HOSTILE), 
    			  Neutral=bit.band(UnitFlag, COMBATLOG_OBJECT_REACTION_NEUTRAL), 
    			  Friendly=bit.band(UnitFlag, COMBATLOG_OBJECT_REACTION_FRIENDLY), 
    			  Mask=bit.band(UnitFlag, COMBATLOG_OBJECT_AFFILIATION_MASK)}
    			)
    			
    			table.insert(guidTable,{GUID=destGUID,Name=destNAME, 
    			  Enemy=bit.band(UnitFlag, COMBATLOG_OBJECT_REACTION_HOSTILE), 
    			  Neutral=bit.band(UnitFlag, COMBATLOG_OBJECT_REACTION_NEUTRAL), 
    			  Friendly=bit.band(UnitFlag, COMBATLOG_OBJECT_REACTION_FRIENDLY),
    			  Mask=bit.band(UnitFlag, COMBATLOG_OBJECT_AFFILIATION_MASK)}
    			)
    		end
    	end
    	
    	WhereAreYou:SetScript("OnEvent", WhereAreYou_OnEvent)
    	WhereAreYou:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    
    	for j=1,#guidTable do
    		
    		guidExists = 0
    		
    		for i = 1, #rangeGUID do
    			if guidTable[j].GUID == rangeGUID[i].GUID  then
    				guidExists = 1
    				break
    			end
    		end
    		
    		if guidExists == 0 then
    			table.insert(rangeGUID,{GUID=guidTable[j].GUID, Time=GetTime(),
    			  Range=PQR_UnitDistance("player",guidTable[j].GUID),
    			  Name = guidTable[j].Name,Enemy= guidTable[j].Enemy,
    			  Friendly= guidTable[j].Friendly,
    			  Neutral= guidTable[j].Neutral,Mask= guidTable[j].Mask}
    			)
    		end
    	end
    
    	if not dieBitch then
    		dieBitch = CreateFrame("FRAME", nil, UIParent)
    		dieBitch:Hide()
    	end
    
    	function dieBitch_OnEvent(self, event, ...)
    		local type, _, sourceGUID, sourceNAME, _, _, destGUID, destNAME = select(2, ...)
    		
    		if event == "COMBAT_LOG_EVENT_UNFILTERED" then
    			if type == "UNIT_DIED" then
    				for i=1,#rangeGUID do
    					if destGUID == rangeGUID[i].GUID then
    						table.remove(rangeGUID,i)
    					end
    				end
    			end
    		end
    	end
    	
    	dieBitch:SetScript("OnEvent", dieBitch_OnEvent)
    	dieBitch:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    
    	for i = 1, #rangeGUID do
    		if GetTime() - rangeGUID[i].Time > 1 then
    			local lguid =rangeGUID[i].GUID
    			local lname =rangeGUID[i].Name
    			local lenemy =rangeGUID[i].Enemy
    			local lfriendly =rangeGUID[i].Friendly
    			local lneutral =rangeGUID[i].Neutral
    			local lmask =rangeGUID[i].Mask
    			table.remove(rangeGUID,i)
    			
    			table.insert(rangeGUID,i,{GUID=lguid, Time=GetTime(),
    			  Range=PQR_UnitDistance("player",lguid), Name = lname, 
    			  Enemy = lenemy, Friendly = lfriendly, Neutral = lneutral, Mask = lmask}
    			)
    		end
    	end
    end
    
    
    function CokxRange(unit,guid)
    	for i=1,#rangeGUID do
    		
    		if guid == nil then
    			if UnitGUID(unit) == rangeGUID[i].GUID
    			and rangeGUID[i].Range ~= nil then 
    				return rangeGUID[i].Range
    			end
    		end
    	
    		if unit == nil then
    			if guid == rangeGUID[i].GUID
    			and rangeGUID[i].Range ~= nil then 
    				return rangeGUID[i].Range
    			end
    		end
    	end
    end
    
    function getCokxFacing()
    	if not tCokxFacing then 
    		tCokxFacing = {} 
    	end
    	
    	tCokxFacing = {}
    	
    	for i=1,#rangeGUID do
    		table.insert(tCokxFacing,{Facing = PQR_UnitFacing("player",rangeGUID[i].GUID),
    		  Time = GetTime(), 
    		  GUID = rangeGUID[i].GUID}
    		)
    	end
    end
    
    function CokxFacing(unit,guid)
    	for i=1,#tCokxFacing do
    		
    		if tCokxFacing[i].GUID == UnitGUID(unit) or guid then 
    			return tCokxFacing[i].Facing 
    		end
    	end
    end
    EDIT: Can you tell me why you do this operation twice?

    Code:
    	if event == "COMBAT_LOG_EVENT_UNFILTERED" then
    		table.insert(guidTable,{GUID=sourceGUID,Name=sourceName, 
    		  Enemy=bit.band(UnitFlag, COMBATLOG_OBJECT_REACTION_HOSTILE), 
    		  Neutral=bit.band(UnitFlag, COMBATLOG_OBJECT_REACTION_NEUTRAL), 
    		  Friendly=bit.band(UnitFlag, COMBATLOG_OBJECT_REACTION_FRIENDLY), 
    		  Mask=bit.band(UnitFlag, COMBATLOG_OBJECT_AFFILIATION_MASK)}
    		)
    		
    		table.insert(guidTable,{GUID=destGUID,Name=destNAME, 
    		  Enemy=bit.band(UnitFlag, COMBATLOG_OBJECT_REACTION_HOSTILE), 
    		  Neutral=bit.band(UnitFlag, COMBATLOG_OBJECT_REACTION_NEUTRAL), 
    		  Friendly=bit.band(UnitFlag, COMBATLOG_OBJECT_REACTION_FRIENDLY),
    		  Mask=bit.band(UnitFlag, COMBATLOG_OBJECT_AFFILIATION_MASK)}
    		)
    	end
    ... And can you explain how the bitwise compare works and what it returns?
    Code:
    bit.band(UnitFlag, COMBATLOG_OBJECT_REACTION_HOSTILE),
    I know the difference between the Mask and the Event Flag but why you dont use:
    CombatLog_Object_IsA(evtFlag,COMBATLOG_FILTER_HOSTILE_PLAYERS) ?
    Last edited by MrHeroe; 10-26-2013 at 03:36 AM.

  3. #3
    xLegendx's Avatar Member
    Reputation
    14
    Join Date
    Sep 2011
    Posts
    827
    Thanks G/R
    3/3
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is all Chinese to me lol

  4. #4
    jshookz's Avatar Member
    Reputation
    1
    Join Date
    Aug 2013
    Posts
    203
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    haha yeah still fun to look at though and amazed at how smart you guys are :P

  5. #5
    cokx's Avatar Banned
    Reputation
    92
    Join Date
    Dec 2008
    Posts
    896
    Thanks G/R
    0/0
    Trade Feedback
    4 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by MrHeroe View Post
    Wow... and this works? Thank you very much for sharing this - +rep

    1. I know the difference between the Mask and the Event Flag but why you dont use:
    CombatLog_Object_IsA(evtFlag,COMBATLOG_FILTER_HOSTILE_PLAYERS) ?
    2.EDIT: Can you tell me why you do this operation twice?

    Short:
    1.Didnt know it exists.
    Enemy value = 64
    Neutral value = 32
    Friendly value = 16

    2. We have a source and a destination GUID.

    bit.band = Hex -> Decimal


    Falls du weitere Fragen hast kannst mich auch gerne anschreiben

  6. #6
    G0tha's Avatar Member
    Reputation
    9
    Join Date
    Jul 2013
    Posts
    76
    Thanks G/R
    4/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess it's not possible to track their buffs/debuffs/hp without spam setting them on focus/target?

  7. #7
    cokx's Avatar Banned
    Reputation
    92
    Join Date
    Dec 2008
    Posts
    896
    Thanks G/R
    0/0
    Trade Feedback
    4 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could track buffs/debuffs with combat log too.

  8. #8
    rootlsuer's Avatar Active Member
    Reputation
    30
    Join Date
    Jul 2013
    Posts
    38
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did something similar; store ranges/facing in table for valid units (player, target, mouseover, boss) but not guid - if i could cast by guid i might have a use for this i think. I mostly only did it to cleanly avoid the empty return on non-movement.

  9. #9
    G0tha's Avatar Member
    Reputation
    9
    Join Date
    Jul 2013
    Posts
    76
    Thanks G/R
    4/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Damn i just wanna usable destGUID table to track everyone's CC dimnishing returns
    Last edited by G0tha; 10-29-2013 at 03:46 PM.

  10. #10
    bu_ba_911's Avatar Elite User
    Reputation
    552
    Join Date
    May 2006
    Posts
    1,638
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by G0tha View Post
    Damn i just wanna usable destGUID table to track everyone's CC dimnishing returns
    tracking by GUID is a piece of cake for something like this, and if you wanted to try and find a UnitID to cast on in RBG's or Arenas, I have a snippet I use for that.

    PHP Code:
    function cTarFinder(tarGUIDreturncTar)
        
    local IsInRaidIsInGroupUnitExistsUnitGUIDtabinsertUnitIsDead IsInRaidIsInGroupUnitExistsUnitGUIDtable.insertUnitIsDead
        local cTar 
    = {"target""mouseover""focus" }
        -- For 
    Raid/Party Targets
        
    if UnitExists("pet"then
            tabinsert
    (cTar"pettarget")
        
    end
        
    if IsInRaid() then
            i 
    1
            
    while UnitExists("raid"..i) do
                
    tabinsert(cTar"raid"..i.."target")
                if 
    UnitExists("raidpet"..ithen
                    tabinsert
    (cTar"raidpet"..i.."target")
                
    end
                i
    =i+1
            end
        
    elseif IsInGroup() then
            i
    =1
            
    while UnitExists("party"..i) do
                
    tabinsert(cTar"party"..i.."target")
                if 
    UnitExists("partypet"..ithen
                    tabinsert
    (cTar"partypet"..i.."target")
                
    end
                i
    =i+1
            end
        end
        
    -- For Arena Targets
        
    if IsInInstance() and IsActiveBattlefieldArena() then
            
    for i=1do
                
    tabinsert(cTar"arena"..i)
                
    tabinsert(cTar"arenapet"..i)
            
    end
        end

        
    if tarGUID then
            
    for i=1#cTar do
                
    if UnitExists(cTar[i]) then
                    
    if UnitGUID(cTar[i]) == tarGUID then
                        
    return cTar[i]
                    
    end
                end
            end
        
    elseif returncTar == true then
            local y
    =#cTar
            
    while y>do
                if 
    not UnitExists(cTar[y])
                        or 
    UnitIsDead(cTar[y]) then
                    table
    .remove(cTary)
                
    end
                y
    =y-1
            end
            
    return cTar
        end

        
    return nil
    end 
    I use this in my own DoT Tracker to find a Unit ID for them if it exists

    just put a GUID in the first function arg and it'll return nil/UnitID depending on if it could find a match
    ^0^Team Nova's PQR NCC ^0^

    If you think someone did something good, take the time to show your appreciation!

  11. #11
    G0tha's Avatar Member
    Reputation
    9
    Join Date
    Jul 2013
    Posts
    76
    Thanks G/R
    4/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    local    disorients = {
        
    49203, -- Hungering Cold
         6770
    , -- Sap
         1776
    , -- Gouge
        51514
    , -- Hex
         9484
    , -- Shackle Undead
          118
    , -- Polymorph
        28272
    , -- Polymorph (pig)
        
    28271, -- Polymorph (turtle)
        
    61305, -- Polymorph (black cat)
        
    61025, -- Polymorph (serpent) -- FIXMEgone ?
        
    61721, -- Polymorph (rabbit)
        
    61780, -- Polymorph (turkey)
         
    3355, -- Freezing Trap
        19386
    , -- Wyvern Sting
        20066
    , -- Repentance
        90337
    , -- Bad Manner (Monkey) -- FIXMEto check
         2637
    , -- Hibernate
        82676
    , -- Ring of Frost

    PHP Code:
    if not tdr then tdr={} end
    if not fdr then fdr=CreateFrame("Frame"end

        
    function Disorientondr(target)
            
    local drfadesafter=18
            fdr
    :RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
            function 
    fdrOnEvent(self,event,...)
                if 
    event=="COMBAT_LOG_EVENT_UNFILTERED" then
                
                    local cLOG
    ={...}
                    if 
    cLOG[2]=="SPELL_AURA_REMOVED" then
                    
    for k=1#disorients do 
                        
    if cLOG[8]==target
                        
    and cLOG[12]==disorients[k]--1776
                        then 
                            
    print(cLOG[8])
                            
    tinsert(tdr,{unit=target,time=GetTime()})
                        
    end
                    end
                    
    else
                        
    table.sort(tdr,function(x,y) return x.time>y.time end)
                        for 
    i=1,#tdr do
                            
    local time=tdr[i].time or GetTime()
                            if 
    GetTime()>time+drfadesafter then
                                tremove
    (tdr,i)
                            
    end
                        end
                    end
                end
            end
            fdr
    :SetScript("OnEvent",fdrOnEvent)
            for 
    i=1,#tdr do
                
    if tdr[i].unit==target then
                    
    return true
                end
            end
        end 
    PHP Code:
    local guidd UnitGUID("target")
    if 
    not Disorientondr(guidd)
    then return true end 
    Something like this, but with choice of DR category and including if you wanna cast cc without DRs at 0.5 dr 0.25dr and time left to reset DR timer to not cast 2 second cc when in next 3 seconds you'd cast the full fear

    This one checks only if you can cast full duration disorient on the target
    Last edited by G0tha; 10-30-2013 at 03:07 PM.

  12. #12
    royoneal213's Avatar Sergeant
    Reputation
    7
    Join Date
    Mar 2012
    Posts
    49
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is it me, or is this something that could exponentially increase the value of pqr in PvE? I know profiles have done finite amounts of tracking before (e.g. Crane Kick detecting # of nearby targets), but being able to automatically calculate if an aoe would hit that extra mob making it worth it, or get that perfect drop placement on a rain of fire to tick on 2 extra without having to stop and check your mouseover projected texture!

Similar Threads

  1. [Trading] [PQR] Cokx - PVP Profiles
    By cokx in forum World of Warcraft Buy Sell Trade
    Replies: 1721
    Last Post: 03-31-2023, 04:28 AM
  2. [PQR] Need gladiator profile for PQR
    By Esdescon in forum World of Warcraft Bots and Programs
    Replies: 0
    Last Post: 12-14-2015, 12:52 PM
  3. Tracking a Player/Unit
    By fvicaria in forum WoW Memory Editing
    Replies: 4
    Last Post: 11-03-2014, 02:26 PM
  4. [PQR] Cokx - PVP Profiles
    By cokx in forum WoW Bot Maps And Profiles
    Replies: 62
    Last Post: 02-01-2014, 07:41 PM
  5. minimap unit tracking in game [release]
    By MindChild in forum World of Warcraft Bots and Programs
    Replies: 33
    Last Post: 12-12-2008, 06:23 PM
All times are GMT -5. The time now is 11:17 PM. 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