Thread Tools Display Modes
06-26-06, 10:07 AM   #1
Chef_de_Loup
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Apr 2006
Posts: 12
suggestions for raidtargets

I miss a function where i can get a list raidtargets what is set and what not.

list = GetRaidTargets();

list is a table with 8 entries by setting 1 or nil if index is a raidtarget

{nil, nil, nil, 1, nil, 1, 1, nil};

So you know what index are used and what are free to use.



Also it will be very usefull to include UnitIDs for raidtargets like:
raidtarget1 to raidtarget8

Last edited by Chef_de_Loup : 06-26-06 at 10:18 AM.
  Reply With Quote
06-26-06, 10:25 AM   #2
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
You can keep track of what is tagged manually, no need for an API function for that. As for the unitid's, I suspect as people use them more they'll continue requesting this feature-- we'll see if it pans out or not.
__________________
"There's only one thing that I know how to do well and I've often been told that you only can do what you know how to do well, and that's be you-- be what you're like-- be like yourself. And so I'm having a wonderful time, but I'd rather be whistling in the dark..."
  Reply With Quote
06-26-06, 11:22 AM   #3
mikk
A Deviate Faerie Dragon
 
mikk's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 11
Originally Posted by Chef_de_Loup
Also it will be very usefull to include UnitIDs for raidtargets like:
raidtarget1 to raidtarget8
I highly doubt you'll ever see that one, since it'd be unambiguous saving and restoring of targets, something which Blizzard clearly doesn't want.
  Reply With Quote
06-27-06, 12:22 AM   #4
Chef_de_Loup
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Apr 2006
Posts: 12
@Cladhaire: I didnt understand what you ment by keep tracking. The only functions for raidtargets i found was GetRaidTargetIndex("unit") and SetRaidTarget("unit", index) but both functions are not usable to target a raidtarget by index or to resolve the list of used index.
Hope you can give an examples how to track.

Edit: Something about my suggestions
1. i want to check what index is free to set the selected target as raidtarget on first available free index

2. i want to show some kinds of frames about the status of the raidtargets set.

So i searched for a function to check what index is used and what is free but didnt found. To check by searching threw the raidmemberstargets is odd and will also have a chance to ignore raidtargets because no one have to target a raidtarget to let it a constant.
Also i cant resolve the status of the raidtargets when no one must target it. Blizzard must save it to know what unit have to show what icon without getting targetted. So i think it will be easy for them to give us an alternative to resolve the raidtarget by unitid.
This raidtarget system for now is abolutely half-baked in my opinion.

Last edited by Chef_de_Loup : 06-27-06 at 12:49 AM.
  Reply With Quote
06-27-06, 07:34 AM   #5
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
Its half baked only because you're limiting yourself, and thinking Blizzard is giving us more than they are. I haven't played much with anything other than the API (do the target marks go away when the unit is dead?) but you just have to do it manually. [b]Blizzard is not currently giving us a method to make "saving" targets a reality-- you still have to manually target the unit or find it within your range in order to re-acquire the unit. I've written some code that makes the raid targeting system a little smarter (i.e. it can tell you which targets you've ASSIGNED).

The following code should handle close to what you're looking for. I haven't tested this in game, but its syntactically correct and it should work-- and possibly extend the functionality of the command a bit more. The code is primitive, but I want to make sure it works before I provide anything more optimized. In the case that a raid target is lost upon death, then we'd need to monitor that event and clear the flag there as well, but for now you can just manuall call RaidTarget:Reset() to reset the internal table. This package provides the following functions:

RaidTarget:Set("unit" [,index]) - Sets the raid target index of unit
success = RaidTarget:SmartSet("unit") - Sets the unit to the first available raid target.
RaidTarget:Get("unit") - Returns the raid target index if it exists for unit
RaidTarget:Clear("unit") - An alias to SetRaidTargetIndex("unit", nil)
RaidTarget:Reset() - Resets the internal counter
RaidTarget:ClearAllTargets() - Attempts to clear ALL targets currently set, may not be successful but it tries
statusTable = RaidTarget:Status() - Returns the internal status table

where statusTable is of the form {true,false,true,true,false,false,false,false}

Code:
RaidTarget = {
   tbl = {false, false, false, false, false, false, false, false},
   
   Set = function(self, unit, index)
      local index = tonumber(index)
      if index then
         self.tbl[index] = true
      else
         local oldIndex = GetRaidTargetIndex(unit)
         if oldIndex then
            self.tbl[oldIndex] = false
         end
      end
   end,
   
   SmartSet = function(self, unit)
      for i=1,8 do
         if not self.tbl[i] then
            self:Set(unit, i)
            return true
         end
      end
   end,
   
   Get = function(self, unit)
      return GetRaidTargetIndex(unit)
   end,
   
   Clear = function(self, unit)
      local index = self:Get(unit)
      if index then
         tbl[index] = false
         SetRaidTargetIndex(unit, nil)
      end
   end,
   
   Status = function(self)
      return self.tbl
   end,
   
   Reset = function(self)
      for i=1,8 do
         self.tbl[i] = false
      end
   end,
   
   ClearAllTargets = function(self)
      -- Check if we're in a raid
      local num = GetNumRaidMembers()
      if num > 0 then
         for i=1,num do
            local player = "raid"..i
            local pet = "raidpet"..i
            local playertarget = "raid"..i.."target"
            local pettarget = "raidpet"..i.."target"
            
            if GetRaidTargetIndex(player) then self:Clear(player) end
            if GetRaidTargetIndex(pet) then self:Clear(pet) end
            if GetRaidTargetIndex(playertarget) then self:Clear(playertarget) end
            if GetRaidTargetIndex(pettarget) then self:Clear(pettarget) end
         end
      end
   end,
}
__________________
"There's only one thing that I know how to do well and I've often been told that you only can do what you know how to do well, and that's be you-- be what you're like-- be like yourself. And so I'm having a wonderful time, but I'd rather be whistling in the dark..."

Last edited by Cladhaire : 06-27-06 at 07:37 AM.
  Reply With Quote
06-28-06, 01:12 AM   #6
Chef_de_Loup
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Apr 2006
Posts: 12
Thanks for the code is 100% what i searched for.
  Reply With Quote

WoWInterface » Developer Discussions » Wish List » Get list of raidtargets

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off