WoW:API RollOnLoot: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Starts or passes on a Loot roll started by WoW.)
 
m (Edited Example, was "bad" coding style and wrong function name)
Line 28: Line 28:


:Run the new function
:Run the new function
  function PartyLootCompanion_RollOnLoot(Rollid, roll)
  function YourAddon_RollOnLoot(Rollid, roll)
   if (roll ~= nil) then
   if (roll ~= nil) then
  DEFAULT_CHAT_FRAME:AddMessage("You rolled on the item with id: " .. Rollid );
    DEFAULT_CHAT_FRAME:AddMessage("You rolled on the item with id: " .. Rollid );
  Pre_WoW_Rollonloot(id, roll);
   else
   else
     DEFAULT_CHAT_FRAME:AddMessage("You passed on the item with id: " .. Rollid );
     DEFAULT_CHAT_FRAME:AddMessage("You passed on the item with id: " .. Rollid );
    Pre_WoW_Rollonloot(id, roll);
   end
   end
  Pre_WoW_Rollonloot(id, roll);
  end
  end



Revision as of 09:59, 1 May 2005

RollOnLoot
RollOnLoot(RollID{,roll});

Roll on the Loot roll identified with Rollid, roll is nil when passing, otherwise it uses 1 to roll on loot.


Arguments
(required)
Rollid
Number - The number increases with every roll you have in a party. Till how high it counts is currently unknown.


(Optional)
roll
Number/nil - Is the roll a pass on the item or a real roll? send nil to pass on the item, send 1 to roll.

Returns
Nothing

Example
Hooks the function
Pre_WoW_Rollonloot = RollOnLoot;
RollOnLoot = YourAddon_RollOnLoot;
Run the new function
function YourAddon_RollOnLoot(Rollid, roll)
 if (roll ~= nil) then
   DEFAULT_CHAT_FRAME:AddMessage("You rolled on the item with id: " .. Rollid );
 else
   DEFAULT_CHAT_FRAME:AddMessage("You passed on the item with id: " .. Rollid );
 end
 Pre_WoW_Rollonloot(id, roll);
end
Result
Will display a message when you roll or pass on a roll. This could easily be changed to record how many times you roll on loot.

-Documentation by --Wiebbe 12:29, 23 Apr 2005 (EDT)

Template:WoW API