oRA2

22 - Patch to allow other addons to query oRA2 for durability

Patch to allow other addons to query oRA2 for durability

Please apply this patch or give me permission to apply it for you.  It allows other addons to send SendAddonMessage("CTRA", "DURC", "RAID") without causing errors in oRA2.  These other addons can then read the results and use them.  I specifically would like the change so RaidBuffStatus can read durability.

Thank you for your time.

Index: Core.lua

===================================================================

--- Core.lua  (revision 659)

+++ Core.lua  (working copy)

@@ -869,6 +869,9 @@

 end
 
 function oRA:UpdateWindow()
+    if not scrollcontents then
+        return  -- oRA:UpdateWindow() can be called when no window is open yet so we need to handle this
+    end
     local entries = #scrollcontents
     FauxScrollFrame_Update(sframe, entries, 18, 16)
     for i = 1, 18 do
Index: Leader/Durability.lua

===================================================================

--- Leader/Durability.lua  (revision 659)

+++ Leader/Durability.lua  (working copy)

@@ -133,7 +133,7 @@

 --      Initialization      --
 ------------------------------
 
-local durability = nil
+local durability = {} -- need to initialise to something in case another addon sends a durability request before the user initiates one
 
 function mod:OnEnable()
     self:RegisterCheck("DUR", "oRA_DurabilityResponse")
@@ -173,6 +173,12 @@

 end
 
 function mod:AddPlayer(nick, perc, broken)
+    local nom = self.coloredNames[nick]
+    for i, v in ipairs(durability) do
+        if v[1] == nom then
+            table.remove(durability, i) -- another addon must be requesting durability and we don't want the table to grow too large so remove dups
+        end
+    end
     table.insert(durability, self:new(self.coloredNames[nick], perc, broken or 0))
 end

User When Change
Ammo Sun, 31 May 2009 09:40:35 Changed status from New to Fixed
danielbarron Thu, 28 May 2009 22:10:06 Create

You must login to post a comment. Don't have an account? Register to get one!

  • 1 comment
  • Avatar of danielbarron danielbarron Sun, 31 May 2009 09:23:37

    Committed with permission. Revisions 660.

  • 1 comment

Facts

Last updated on
31 May 2009
Reported on
28 May 2009
Status
Fixed - Developer made requested changes. QA should verify.
Type
Patch - Source code patch for review
Priority
Medium - Normal priority.

Reported by

Possible assignees

Votes (Total: +21, Average: +3.0)