lotrointerface.com
Search Downloads

LoTROInterface SVN SortPack

[/] [trunk/] [JackdawPlugins/] [SortPack/] [functions.LUA] - Rev 111

Go to most recent revision | Compare with Previous | Blame | View Log

function mergetable(table1,list)
        --Appends tables from list on the end of table1
        for i=1,#list do
                table2=list[i]
                        local LenTable1=#table1
                        for a =LenTable1+1,#table1+#table2 do
                                table1[a]=table2[a-LenTable1]
                        end
        end
end


--Frame control - Gives a nice border to the window.
Frame=class(Turbine.UI.Control)

function Frame:Constructor()
Turbine.UI.Control.Constructor( self );
        self.base=Turbine.UI.Control()
        self.base:SetBackColor(Turbine.UI.Color(1,1,1,1))
        self.base:SetParent(self)
        self.high=Turbine.UI.Control()
        self.high:SetBackColor(Turbine.UI.Color(1,0,0,0))
        self.high:SetPosition(1,1)
        self.high:SetParent(self.base)
        self:SetVisible(true)

        self.SizeChanged=function()
                for i=1,#self.SizeChange do
                        self.SizeChange[i]()
                end
        end
        self.SizeChange={}
        table.insert(self.SizeChange,function()
                local x,y=self:GetSize()
                self.base:SetSize(x,y)
                self.high:SetSize(x-2,y-2)
        end)
end

--Here follow various experiments for fixing the "empty slot" backpack bug.

--[[Notes: Manually swopping the items in the players actual backpack fixes the bug, but programmatically doing it doesn't]]


--[[
This one didn't work either
function Experiment()
--Does reversing the sort order fix the bug?
        revorder=not revorder
        Sort()
end]]

--[[
function Experiment()
--This does not work as I get the "item invalid" bug.


--Does swopping "empty" slots fix the bug?
--1. Find the last empty slot
        local empty=-1
        for i=1,size do
                item=backpack:GetItem(i)
                if item==nil then empty=i end
        end
        --Catch an error with full packs.
        if empty==-1 then return end

        --Now, swop all the empty slots with that slot. Each empty will have at least one swop.
        for i=1,size do
                item=backpack:GetItem(i)
                if item==nil then 
                        backpack:PerformItemDrop(item,empty, false)
                end
        end
end]]

--[[
function Experiment()
--This doesn't work as the function runs too fast.

--Does swopping "empty" slots fix the bug?
--1. Use the item from the very first bag slot.
                local swopitem=backpack:GetItem(1)
        --Catch an error with empty swop slot
        if swopitem==nil then Turbine.Shell.WriteLine("Put something in bag slot 1 before running!") return end

        --Now, swop all the empty slots with that slot. Each empty will have at least one swop.
        for i=1,size do
                local item=backpack:GetItem(i)
                if item==nil then 
                        backpack:PerformItemDrop(swopitem,i, false)
                end
        end
end]]

Go to most recent revision | Compare with Previous | Blame


All times are GMT -5. The time now is 05:56 PM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui