lotrointerface.com
Search Downloads

LoTROInterface SVN SortPack

[/] [trunk/] [JackdawPlugins/] [SortPack/] [functions.LUA] - Blame information for rev 111

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

Line No. Rev Author Line
1 3 MrJackdaw-1942
function mergetable(table1,list)
2 53 MrJackdaw-1942
        --Appends tables from list on the end of table1
3 MrJackdaw-1942
        for i=1,#list do
4 MrJackdaw-1942
                table2=list[i]
5 MrJackdaw-1942
                        local LenTable1=#table1
6 MrJackdaw-1942
                        for a =LenTable1+1,#table1+#table2 do
7 MrJackdaw-1942
                                table1[a]=table2[a-LenTable1]
8 MrJackdaw-1942
                        end
9 MrJackdaw-1942
        end
10 100 MrJackdaw-1942
end
11 MrJackdaw-1942
 
12 MrJackdaw-1942
 
13 MrJackdaw-1942
--Frame control - Gives a nice border to the window.
14 MrJackdaw-1942
Frame=class(Turbine.UI.Control)
15 MrJackdaw-1942
 
16 MrJackdaw-1942
function Frame:Constructor()
17 MrJackdaw-1942
Turbine.UI.Control.Constructor( self );
18 MrJackdaw-1942
        self.base=Turbine.UI.Control()
19 MrJackdaw-1942
        self.base:SetBackColor(Turbine.UI.Color(1,1,1,1))
20 MrJackdaw-1942
        self.base:SetParent(self)
21 MrJackdaw-1942
        self.high=Turbine.UI.Control()
22 MrJackdaw-1942
        self.high:SetBackColor(Turbine.UI.Color(1,0,0,0))
23 MrJackdaw-1942
        self.high:SetPosition(1,1)
24 MrJackdaw-1942
        self.high:SetParent(self.base)
25 MrJackdaw-1942
        self:SetVisible(true)
26 MrJackdaw-1942
 
27 MrJackdaw-1942
        self.SizeChanged=function()
28 MrJackdaw-1942
                for i=1,#self.SizeChange do
29 MrJackdaw-1942
                        self.SizeChange[i]()
30 MrJackdaw-1942
                end
31 MrJackdaw-1942
        end
32 MrJackdaw-1942
        self.SizeChange={}
33 MrJackdaw-1942
        table.insert(self.SizeChange,function()
34 MrJackdaw-1942
                local x,y=self:GetSize()
35 MrJackdaw-1942
                self.base:SetSize(x,y)
36 MrJackdaw-1942
                self.high:SetSize(x-2,y-2)
37 MrJackdaw-1942
        end)
38 MrJackdaw-1942
end
39 111 MrJackdaw-1942
 
40 MrJackdaw-1942
--Here follow various experiments for fixing the "empty slot" backpack bug.
41 MrJackdaw-1942
 
42 MrJackdaw-1942
--[[Notes: Manually swopping the items in the players actual backpack fixes the bug, but programmatically doing it doesn't]]
43 MrJackdaw-1942
 
44 MrJackdaw-1942
 
45 MrJackdaw-1942
--[[
46 MrJackdaw-1942
This one didn't work either
47 MrJackdaw-1942
function Experiment()
48 MrJackdaw-1942
--Does reversing the sort order fix the bug?
49 MrJackdaw-1942
        revorder=not revorder
50 MrJackdaw-1942
        Sort()
51 MrJackdaw-1942
end]]
52 MrJackdaw-1942
 
53 MrJackdaw-1942
--[[
54 MrJackdaw-1942
function Experiment()
55 MrJackdaw-1942
--This does not work as I get the "item invalid" bug.
56 MrJackdaw-1942
 
57 MrJackdaw-1942
 
58 MrJackdaw-1942
--Does swopping "empty" slots fix the bug?
59 MrJackdaw-1942
--1. Find the last empty slot
60 MrJackdaw-1942
        local empty=-1
61 MrJackdaw-1942
        for i=1,size do
62 MrJackdaw-1942
                item=backpack:GetItem(i)
63 MrJackdaw-1942
                if item==nil then empty=i end
64 MrJackdaw-1942
        end
65 MrJackdaw-1942
        --Catch an error with full packs.
66 MrJackdaw-1942
        if empty==-1 then return end
67 MrJackdaw-1942
 
68 MrJackdaw-1942
        --Now, swop all the empty slots with that slot. Each empty will have at least one swop.
69 MrJackdaw-1942
        for i=1,size do
70 MrJackdaw-1942
                item=backpack:GetItem(i)
71 MrJackdaw-1942
                if item==nil then
72 MrJackdaw-1942
                        backpack:PerformItemDrop(item,empty, false)
73 MrJackdaw-1942
                end
74 MrJackdaw-1942
        end
75 MrJackdaw-1942
end]]
76 MrJackdaw-1942
 
77 MrJackdaw-1942
--[[
78 MrJackdaw-1942
function Experiment()
79 MrJackdaw-1942
--This doesn't work as the function runs too fast.
80 MrJackdaw-1942
 
81 MrJackdaw-1942
--Does swopping "empty" slots fix the bug?
82 MrJackdaw-1942
--1. Use the item from the very first bag slot.
83 MrJackdaw-1942
                local swopitem=backpack:GetItem(1)
84 MrJackdaw-1942
        --Catch an error with empty swop slot
85 MrJackdaw-1942
        if swopitem==nil then Turbine.Shell.WriteLine("Put something in bag slot 1 before running!") return end
86 MrJackdaw-1942
 
87 MrJackdaw-1942
        --Now, swop all the empty slots with that slot. Each empty will have at least one swop.
88 MrJackdaw-1942
        for i=1,size do
89 MrJackdaw-1942
                local item=backpack:GetItem(i)
90 MrJackdaw-1942
                if item==nil then
91 MrJackdaw-1942
                        backpack:PerformItemDrop(swopitem,i, false)
92 MrJackdaw-1942
                end
93 MrJackdaw-1942
        end
94 MrJackdaw-1942
end]]

All times are GMT -5. The time now is 06:26 PM.


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