lotrointerface.com
Search Downloads

LoTROInterface SVN SortPack

[/] [trunk/] [JackdawPlugins/] [SortPack/] [List.lua] - Blame information for rev 143

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

Line No. Rev Author Line
1 138 MrJackdaw-1942
if ItemCategory==nil then ItemCategory={} end
2 3 MrJackdaw-1942
 
3 53 MrJackdaw-1942
--Trying to fill the holes in Item Category
4 MrJackdaw-1942
--Revise this when Turbine fix the ItemCategory enumeration.
5 MrJackdaw-1942
ItemCategory[89]="BarterReputation"
6 134 MrJackdaw-1942
 
7 53 MrJackdaw-1942
ItemCategory[173]= "Special"
8 134 MrJackdaw-1942
 
9 53 MrJackdaw-1942
ItemCategory[177]= "BarterSkirmish"
10 MrJackdaw-1942
ItemCategory[178]= "Barter"
11 MrJackdaw-1942
ItemCategory[179]= "ShieldSpikes"
12 MrJackdaw-1942
ItemCategory[180]= "OutfitFeet"
13 70 MrJackdaw-1942
ItemCategory[181]= "OutfitShoulder"
14 53 MrJackdaw-1942
ItemCategory[182]= "OutfitUpperbody"
15 MrJackdaw-1942
ItemCategory[183]= "OutfitHead"
16 70 MrJackdaw-1942
ItemCategory[184]= "OutfitGloves"
17 134 MrJackdaw-1942
ItemCategory[185]= "OutfitTrousers" -- Thanks Galureth
18 53 MrJackdaw-1942
ItemCategory[186]= "SkillScrolls"
19 MrJackdaw-1942
ItemCategory[187]= "ChampionHorns"
20 MrJackdaw-1942
ItemCategory[188]="CraftOptionalIngredient"
21 MrJackdaw-1942
ItemCategory[189]= "Perks"
22 134 MrJackdaw-1942
ItemCategory[190]= "TomeOf" --Is it just tome of will?
23 53 MrJackdaw-1942
ItemCategory[191]= "TravelAndMaps"
24 3 MrJackdaw-1942
 
25 93 MrJackdaw-1942
ItemCategory[194]="RelicScroll"
26 96 MrJackdaw-1942
ItemCategory[195]="WestfoldMetalworkScroll"
27 MrJackdaw-1942
ItemCategory[196]="WestfoldJewellerScroll"
28 90 MrJackdaw-1942
ItemCategory[197]="WestfoldWoodworkScroll"
29 96 MrJackdaw-1942
ItemCategory[198]="WestfoldWeaponsmithScroll"
30 95 MrJackdaw-1942
ItemCategory[199]="WestfoldTailorScroll"
31 134 MrJackdaw-1942
 
32 97 MrJackdaw-1942
ItemCategory[201]="WestfoldForesterScroll"
33 134 MrJackdaw-1942
 
34 94 MrJackdaw-1942
ItemCategory[203]="WestfoldCookScroll"
35 95 MrJackdaw-1942
ItemCategory[204]="WestfoldScholarScroll"
36 90 MrJackdaw-1942
 
37 140 MrJackdaw-1942
ItemCategory[205]="FestivalConsumable" --Thanks eloyolo
38 138 MrJackdaw-1942
 
39 140 MrJackdaw-1942
--This section allows the creation of custom user item categories.
40 137 MrJackdaw-1942
 
41 MrJackdaw-1942
        --First define the categories. Turbine categories finish around 210 so, these start at 900
42 MrJackdaw-1942
 
43 138 MrJackdaw-1942
        --ItemCategory[900]="Ore"
44 MrJackdaw-1942
        --ItemCategory[901]="Ingot"
45 137 MrJackdaw-1942
 
46 138 MrJackdaw-1942
        --[[CustomItem={
47 MrJackdaw-1942
                        ["Ancient Nickel Ore"]={["Cat"]=900,["Name"]="Ancient Nickel Ore"},
48 MrJackdaw-1942
                        ["Chunk of Ancient Iron Ore"]={["Cat"]=900,["Name"]="Chunk of Ancient Iron Ore"}
49 MrJackdaw-1942
        }]]
50 MrJackdaw-1942
 
51 MrJackdaw-1942
        if CustomItem==nil then CustomItem={} end
52 137 MrJackdaw-1942
 
53 MrJackdaw-1942
 
54 134 MrJackdaw-1942
--This next line *could* overwrite the data above, if Turbine ever fix the categories.
55 54 MrJackdaw-1942
for i,v in pairs(Turbine.Gameplay.ItemCategory) do ItemCategory[v]=i end
56 3 MrJackdaw-1942
 
57 100 MrJackdaw-1942
if Groups==nil then
58 66 MrJackdaw-1942
        Turbine.Shell.WriteLine("<rgb=#00FF00>SortPack loaded. /Sort to sort the backpack, /SortOption to change the order</rgb>")
59 98 MrJackdaw-1942
 
60 54 MrJackdaw-1942
        CraftScroll={
61 MrJackdaw-1942
        "ApprenticeCookScroll",
62 MrJackdaw-1942
        "ApprenticeFarmerScroll",
63 MrJackdaw-1942
        "ApprenticeForestryScroll",
64 MrJackdaw-1942
        "ApprenticeJewellerScroll",
65 MrJackdaw-1942
        "ApprenticeMetalworkScroll",
66 MrJackdaw-1942
        "ApprenticeProspectingScroll",
67 MrJackdaw-1942
        "ApprenticeScholarScroll",
68 MrJackdaw-1942
        "ApprenticeTailorScroll",
69 MrJackdaw-1942
        "ApprenticeWeaponsmithScroll",
70 MrJackdaw-1942
        "ApprenticeWoodworkScroll",
71 MrJackdaw-1942
        "ArtisanCookScroll",
72 MrJackdaw-1942
        "ArtisanFarmerScroll",
73 MrJackdaw-1942
        "ArtisanForestryScroll",
74 MrJackdaw-1942
        "ArtisanJewellerScroll",
75 MrJackdaw-1942
        "ArtisanMetalworkScroll",
76 MrJackdaw-1942
        "ArtisanProspectingScroll",
77 MrJackdaw-1942
        "ArtisanScholarScroll",
78 MrJackdaw-1942
        "ArtisanTailorScroll",
79 MrJackdaw-1942
        "ArtisanWeaponsmithScroll",
80 MrJackdaw-1942
        "ArtisanWoodworkScroll",
81 MrJackdaw-1942
        "ExpertCookScroll",
82 MrJackdaw-1942
        "ExpertFarmerScroll",
83 MrJackdaw-1942
        "ExpertForestryScroll",
84 MrJackdaw-1942
        "ExpertJewellerScroll",
85 MrJackdaw-1942
        "ExpertMetalworkScroll",
86 MrJackdaw-1942
        "ExpertProspectingScroll",
87 MrJackdaw-1942
        "ExpertScholarScroll",
88 MrJackdaw-1942
        "ExpertTailorScroll",
89 MrJackdaw-1942
        "ExpertWeaponsmithScroll",
90 MrJackdaw-1942
        "ExpertWoodworkScroll",
91 MrJackdaw-1942
        "JourneymanCookScroll",
92 MrJackdaw-1942
        "JourneymanFarmerScroll",
93 MrJackdaw-1942
        "JourneymanForestryScroll",
94 MrJackdaw-1942
        "JourneymanJewellerScroll",
95 MrJackdaw-1942
        "JourneymanMetalworkScroll",
96 MrJackdaw-1942
        "JourneymanProspectingScroll",
97 MrJackdaw-1942
        "JourneymanScholarScroll",
98 MrJackdaw-1942
        "JourneymanTailorScroll",
99 MrJackdaw-1942
        "JourneymanWeaponsmithScroll",
100 MrJackdaw-1942
        "JourneymanWoodworkScroll",
101 MrJackdaw-1942
        "MasterCookScroll",
102 MrJackdaw-1942
        "MasterFarmerScroll",
103 MrJackdaw-1942
        "MasterForestryScroll",
104 MrJackdaw-1942
        "MasterJewellerScroll",
105 MrJackdaw-1942
        "MasterMetalworkScroll",
106 MrJackdaw-1942
        "MasterProspectingScroll",
107 MrJackdaw-1942
        "MasterScholarScroll",
108 MrJackdaw-1942
        "MasterTailorScroll",
109 MrJackdaw-1942
        "MasterWeaponsmithScroll",
110 MrJackdaw-1942
        "MasterWoodworkScroll",
111 MrJackdaw-1942
        "SupremeCookScroll",
112 MrJackdaw-1942
        "SupremeFarmerScroll",
113 MrJackdaw-1942
        "SupremeForestryScroll",
114 MrJackdaw-1942
        "SupremeJewellerScroll",
115 MrJackdaw-1942
        "SupremeMetalworkScroll",
116 MrJackdaw-1942
        "SupremeProspectingScroll",
117 MrJackdaw-1942
        "SupremeScholarScroll",
118 MrJackdaw-1942
        "SupremeTailorScroll",
119 MrJackdaw-1942
        "SupremeWeaponsmithScroll",
120 MrJackdaw-1942
        "SupremeWoodworkScroll"}
121 100 MrJackdaw-1942
        CraftScroll.Name="CraftScroll"
122 MrJackdaw-1942
 
123 54 MrJackdaw-1942
        Tool={
124 MrJackdaw-1942
        "Tool"}
125 100 MrJackdaw-1942
        Tool.Name="Tool"
126 3 MrJackdaw-1942
 
127 54 MrJackdaw-1942
        Weapons={
128 MrJackdaw-1942
        "Axe",
129 MrJackdaw-1942
        "Bow",
130 MrJackdaw-1942
        "Club",
131 MrJackdaw-1942
        "Crossbow",
132 MrJackdaw-1942
        "Dagger",
133 MrJackdaw-1942
        "Book",
134 MrJackdaw-1942
        "Halberd",
135 MrJackdaw-1942
        "Hammer",
136 MrJackdaw-1942
        "Instrument",
137 MrJackdaw-1942
        "Javelin",
138 MrJackdaw-1942
        "Mace",
139 MrJackdaw-1942
        "Minstrel",
140 MrJackdaw-1942
        "Spear",
141 MrJackdaw-1942
        "Shield",
142 MrJackdaw-1942
        "Staff",
143 MrJackdaw-1942
        "Sword",
144 MrJackdaw-1942
        "Thrown",
145 MrJackdaw-1942
        "Weapon"}
146 100 MrJackdaw-1942
        Weapons.Name="Weapons"
147 MrJackdaw-1942
 
148 54 MrJackdaw-1942
        Armor={
149 MrJackdaw-1942
        "Armor",
150 MrJackdaw-1942
        "GuardianBelt",
151 MrJackdaw-1942
        "Back",
152 MrJackdaw-1942
        "Chest",
153 MrJackdaw-1942
        "Clothing",
154 MrJackdaw-1942
        "CosmeticBack",
155 MrJackdaw-1942
        "CosmeticHeld",
156 MrJackdaw-1942
        "Feet",
157 MrJackdaw-1942
        "Hands",
158 MrJackdaw-1942
        "Head",
159 MrJackdaw-1942
        "Jewelry",
160 MrJackdaw-1942
        "Legs",
161 MrJackdaw-1942
        "MinstrelBook",
162 MrJackdaw-1942
        "Shoulders",
163 MrJackdaw-1942
        "OutfitFeet",                                                                   --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
164 70 MrJackdaw-1942
        "OutfitUpperbody",                                                      --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
165 MrJackdaw-1942
        "OutfitHead",                                                                   --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
166 MrJackdaw-1942
        "OutfitShoulder",                                                               --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
167 MrJackdaw-1942
        "OutfitGloves"                                                                  --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
168 54 MrJackdaw-1942
        }
169 100 MrJackdaw-1942
        Armor.Name="Armor"
170 MrJackdaw-1942
 
171 54 MrJackdaw-1942
        Dye={
172 MrJackdaw-1942
        "Dye"}
173 100 MrJackdaw-1942
        Dye.Name="Dye"
174 MrJackdaw-1942
 
175 54 MrJackdaw-1942
        Fishing={
176 MrJackdaw-1942
        "Fish",
177 MrJackdaw-1942
        "FishingBait",
178 MrJackdaw-1942
        "FishingOther",
179 MrJackdaw-1942
        "FishingPole"}
180 100 MrJackdaw-1942
        Fishing.Name="Fishing"
181 MrJackdaw-1942
 
182 54 MrJackdaw-1942
        Class={
183 MrJackdaw-1942
        "Runekeeper",
184 MrJackdaw-1942
        "Burglar",
185 MrJackdaw-1942
        "Captain",
186 MrJackdaw-1942
        "Guardian",
187 MrJackdaw-1942
        "Champion",
188 70 MrJackdaw-1942
         "ChampionHorns",                                                       --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
189 54 MrJackdaw-1942
        "Loremaster",
190 MrJackdaw-1942
        "Hunter",
191 MrJackdaw-1942
        "Warden"}
192 100 MrJackdaw-1942
        Class.Name="Class"
193 MrJackdaw-1942
 
194 54 MrJackdaw-1942
        Food={
195 MrJackdaw-1942
        "Food",
196 MrJackdaw-1942
        "LoremasterFood"}
197 100 MrJackdaw-1942
        Food.Name="Food"
198 MrJackdaw-1942
 
199 54 MrJackdaw-1942
        Decoration={
200 MrJackdaw-1942
        "CeilingDecoration",
201 MrJackdaw-1942
        "Decoration",
202 MrJackdaw-1942
        "FloorDecoration",
203 MrJackdaw-1942
        "FurnitureDecoration",
204 MrJackdaw-1942
        "MusicDecoration",
205 MrJackdaw-1942
        "SpecialDecoration",
206 MrJackdaw-1942
        "Trophy",
207 MrJackdaw-1942
        "TrophyDecoration",
208 MrJackdaw-1942
        "YardDecoration",
209 MrJackdaw-1942
        "WallDecoration",
210 MrJackdaw-1942
        "SurfacePaintDecoration"}
211 100 MrJackdaw-1942
        Decoration.Name="Decoration"
212 MrJackdaw-1942
 
213 54 MrJackdaw-1942
        Legend={
214 MrJackdaw-1942
        "LegendaryWeaponExperience",
215 MrJackdaw-1942
        "LegendaryWeaponIncreaseMaxLevel",
216 MrJackdaw-1942
        "LegendaryWeaponReplaceLegacy",
217 MrJackdaw-1942
        "LegendaryWeaponReset",
218 MrJackdaw-1942
        "LegendaryWeaponUpgradeLegacy"}
219 100 MrJackdaw-1942
        Legend.Name="Legend"
220 MrJackdaw-1942
 
221 54 MrJackdaw-1942
        Potion={
222 MrJackdaw-1942
        "Potion"}
223 100 MrJackdaw-1942
        Potion.Name="Potion"
224 MrJackdaw-1942
 
225 54 MrJackdaw-1942
        Device={
226 MrJackdaw-1942
        "Device"}
227 100 MrJackdaw-1942
        Device.Name="Device"
228 MrJackdaw-1942
 
229 54 MrJackdaw-1942
        Craft={
230 MrJackdaw-1942
        "Component",
231 MrJackdaw-1942
        "Crafting",
232 MrJackdaw-1942
        "Ingredient",
233 MrJackdaw-1942
        "CraftOptionalIngredient"                               --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
234 MrJackdaw-1942
        }
235 100 MrJackdaw-1942
        Craft.Name="Craft"
236 MrJackdaw-1942
 
237 54 MrJackdaw-1942
        BuffItem={
238 MrJackdaw-1942
        "Scroll",
239 MrJackdaw-1942
        "Trap",
240 MrJackdaw-1942
        "ShieldSpikes",                                                         --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
241 MrJackdaw-1942
        "Oil"}
242 100 MrJackdaw-1942
        BuffItem.Name="BuffItem"
243 MrJackdaw-1942
 
244 54 MrJackdaw-1942
        Misc={
245 40 Hazado-481
 
246 54 MrJackdaw-1942
        "CraftingTrophy",
247 MrJackdaw-1942
        "Deconstructable",
248 MrJackdaw-1942
        "Effect",
249 MrJackdaw-1942
        "Healing",
250 MrJackdaw-1942
        "Implement",
251 40 Hazado-481
 
252 54 MrJackdaw-1942
        "Key",
253 MrJackdaw-1942
        "KinshipCharter",
254 3 MrJackdaw-1942
 
255 54 MrJackdaw-1942
        "Mounts",
256 MrJackdaw-1942
        "NonInventory",
257 8 Hazado-481
 
258 54 MrJackdaw-1942
        "Orb",
259 MrJackdaw-1942
        "Pennant",
260 MrJackdaw-1942
        "Quest",
261 MrJackdaw-1942
        "Relic",
262 MrJackdaw-1942
        "Resource",
263 3 MrJackdaw-1942
 
264 54 MrJackdaw-1942
        "SpecialTrophy",
265 3 MrJackdaw-1942
 
266 5 MrJackdaw-1942
 
267 54 MrJackdaw-1942
        "Treasure",
268 MrJackdaw-1942
        "Undefined",
269 3 MrJackdaw-1942
 
270 54 MrJackdaw-1942
        "BarterReputation",                                             --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
271 MrJackdaw-1942
         "Special",                                                                             --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
272 MrJackdaw-1942
        "BarterSkirmish",                                                       --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
273 MrJackdaw-1942
         "Barter",                                                                                      --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
274 MrJackdaw-1942
        "SkillScrolls",                                                                 --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
275 MrJackdaw-1942
 
276 MrJackdaw-1942
         "Perks",                                                                                       --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
277 MrJackdaw-1942
         "TravelAndMaps",                                                       --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
278 MrJackdaw-1942
         "Misc"
279 MrJackdaw-1942
        }
280 100 MrJackdaw-1942
        Misc.Name="Misc"
281 MrJackdaw-1942
 
282 MrJackdaw-1942
        Groups={Tool,Device,Potion,BuffItem,Food,Legend,Weapons,Armor,Class,Craft,Dye,Fishing,Decoration,CraftScroll,Misc}
283 MrJackdaw-1942
 
284 MrJackdaw-1942
end
285 5 MrJackdaw-1942
 
286 110 MrJackdaw-1942
if Groups[0]==nil then Groups[0]={} end
287 MrJackdaw-1942
Groups[0].Name="Empty Slots"
288 MrJackdaw-1942
 
289 100 MrJackdaw-1942
function BuildList()
290 MrJackdaw-1942
        --Builds the list from the groups
291 MrJackdaw-1942
 
292 MrJackdaw-1942
        --Reset First
293 MrJackdaw-1942
        list=nil
294 MrJackdaw-1942
        list={}
295 54 MrJackdaw-1942
 
296 100 MrJackdaw-1942
        --Merge from current groups
297 MrJackdaw-1942
        mergetable(list,Groups)
298 MrJackdaw-1942
 
299 MrJackdaw-1942
        listtonum()
300 105 MrJackdaw-1942
 
301 MrJackdaw-1942
        --Create a new list - this matches itemcategory to group so, ItemGroup["ForestersAxe"]="Tool"
302 MrJackdaw-1942
        ItemGroup={}
303 MrJackdaw-1942
        for i=1,#Groups do
304 MrJackdaw-1942
                for j=1,#Groups[i] do
305 MrJackdaw-1942
                        ItemGroup[Groups[i][j]]=i
306 MrJackdaw-1942
                end
307 MrJackdaw-1942
        end
308 54 MrJackdaw-1942
end
309 MrJackdaw-1942
 
310 53 MrJackdaw-1942
--Now, change the way the table works.
311 MrJackdaw-1942
--This changes the text list to a numbered list. so, for example, value["Tool"] would equal 150 or whatever.
312 54 MrJackdaw-1942
function listtonum()
313 MrJackdaw-1942
        value={}
314 MrJackdaw-1942
        for i,v in pairs(list) do
315 55 MrJackdaw-1942
                value[v]=i                                      --This converts say, list[1]="Geoff" to value[Geoff]=1 Nice huh?
316 54 MrJackdaw-1942
        end
317 MrJackdaw-1942
end
318 8 Hazado-481
 
319 138 MrJackdaw-1942
function RepairList()
320 MrJackdaw-1942
        --Repair function if any new item categories have been added
321 MrJackdaw-1942
        local changed=false
322 MrJackdaw-1942
        for i,v in pairs(ItemCategory) do
323 MrJackdaw-1942
                if value[ItemCategory[i]]==nil then
324 MrJackdaw-1942
                        local found=false
325 MrJackdaw-1942
                        local target
326 MrJackdaw-1942
                        for j=1,#Groups do
327 MrJackdaw-1942
                                if Groups[j].Name=="Unknown" then found=true target=j end
328 MrJackdaw-1942
                        end
329 MrJackdaw-1942
                        if found==false then
330 MrJackdaw-1942
                                Groups[#Groups+1]={["Name"]="Unknown"}
331 MrJackdaw-1942
                                target=#Groups
332 MrJackdaw-1942
                        end
333 MrJackdaw-1942
                        changed=true
334 MrJackdaw-1942
                        table.insert(Groups[target],ItemCategory[i])
335 MrJackdaw-1942
                        listtonum()
336 137 MrJackdaw-1942
                end
337 70 MrJackdaw-1942
        end
338 138 MrJackdaw-1942
        if changed then Turbine.Shell.WriteLine("Adding missing Categories to the 'Unknown' group ") end
339 70 MrJackdaw-1942
end
340 100 MrJackdaw-1942
 
341 138 MrJackdaw-1942
--Get the list; Pass 1
342 MrJackdaw-1942
        BuildList()
343 MrJackdaw-1942
--Repair function if any new item categories have been added
344 MrJackdaw-1942
        RepairList()
345 100 MrJackdaw-1942
--Get the list; Pass 2 Rebuild the list after now adding the items in the "Unknown" category
346 138 MrJackdaw-1942
        BuildList()
347 MrJackdaw-1942
 

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


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