1. #1

    Lf addon developer

    Hey guys,

    I put my hand up to make a few changes to an addon thinking it would be pretty cruisy after fiddling for several hours I seem to have made no progress, would really love someone who could help me out with this. The addon is fully functional as is and I'm fairly certain it would be easy to add in what I need from the existing code, it's just a little above my knowledge.

    Cheers

    - - - Updated - - -

    Okay, so, for the moment I'd be happy with a minor tweak to the addon, http://i.imgur.com/nNLexe7.png (Sorry for terrible size) essentially I'd be happy with sorting by boss instead of it sorting by alphabetical order, from what research I've done this is the code that does the ordering of the table

    Code:
     local function foreachinorder(t,f)
      local keys = {}
      for k,_ in pairs(t) do
        keys[#keys+1] = k
      end
      table.sort(keys,function (a,b)
       return string.lower(a) < string.lower(b)
      end)
      for _,k in ipairs(keys) do
       f(k,t[k])
      end
     end
    The problem I have is that it's using the names of the items as the item to sort and I can't seem to find the code for the bosses, help please?

  2. #2
    What's the addon name, where exactly did you get that code from, what is sorting alphabetically, what is using the names of the items?

  3. #3
    Quote Originally Posted by pnutbutter View Post
    What's the addon name, where exactly did you get that code from, what is sorting alphabetically, what is using the names of the items?
    The name of the addon is prioritylist, the code is in the itemlist LUA file, the items are sorting alphabetically as opposed to the bosses which is what I want and I believe the table is using the names of the items, although I may be wrong. Sorry for being vague >_<

  4. #4
    Well we'll need to check where foreachinorder() is used so we can find out how it's used.

    Looking at the image you provided, it doesn't look like it's in alphabetical order unless I'm completely missing something.

    edit: Alright, this might work.
    Interface\AddOns\PriorityList\options_itemlist.lua:539-547

    change
    Code:
      table.foreach(mainlist,
       function(k,v)
        if not result then result = true end
        if type(k) == "string" then
          InsertChar(k,v)
        elseif type(k) == "number" then
         InsertItem(k,v)
        end
       end)
    to
    Code:
      local itemorder={}
      table.foreach(mainlist,
       function(k,v)
        if not result then result = true end
        if type(k) == "string" then
          InsertChar(k,v)
        elseif type(k) == "number" then
    	 local bossnum=tonumber((gsub(strsub(addon:MatchBossDrop(k),1,2),"#","",1)))
    	 itemorder[bossnum]=itemorder[bossnum] or {}
    	 tinsert(itemorder[bossnum],k)
        end
       end)
       for i=1,20 do --assume total bosses in an instance is <=20
        if itemorder[i] then
    	 for _,v in ipairs(itemorder[i]) do
          InsertItem(v,mainlist[v])
    	 end
    	end
       end
    Last edited by pnutbutter; 2013-08-02 at 03:04 PM.

  5. #5
    Exactly what I want, works perfectly, thank you so, so much.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •