lotrointerface.com
Search Downloads

LoTROInterface SVN SortPack

[/] [trunk/] [JackdawPlugins/] [SortPack/] [List.lua] - Rev 162

Compare with Previous | Blame | View Log

if ItemCategory==nil then ItemCategory={} end   
if CustomItem==nil then CustomItem={} end

--Trying to fill the holes in Item Category
--Revise this when Turbine fix the ItemCategory enumeration.
ItemCategory[89]="BarterReputation"

ItemCategory[173]= "Special"

ItemCategory[177]= "BarterSkirmish"
ItemCategory[178]= "Barter"
ItemCategory[179]= "ShieldSpikes"
ItemCategory[180]= "OutfitFeet"
ItemCategory[181]= "OutfitShoulder"
ItemCategory[182]= "OutfitUpperbody"
ItemCategory[183]= "OutfitHead"
ItemCategory[184]= "OutfitGloves"
ItemCategory[185]= "OutfitTrousers" -- Thanks Galureth
ItemCategory[186]= "SkillScrolls"
ItemCategory[187]= "ChampionHorns"
ItemCategory[188]= "CraftOptionalIngredient"
ItemCategory[189]= "Perks"
ItemCategory[190]= "TomeOf" --Is it just tome of will?
ItemCategory[191]= "TravelAndMaps"

ItemCategory[194]="RelicScroll"

ItemCategory[195]="WestfoldMetalworkScroll"
ItemCategory[196]="WestfoldJewellerScroll"
ItemCategory[197]="WestfoldWoodworkScroll"
ItemCategory[198]="WestfoldWeaponsmithScroll"
ItemCategory[199]="WestfoldTailorScroll"

ItemCategory[201]="WestfoldForesterScroll"

ItemCategory[203]="WestfoldCookScroll"
ItemCategory[204]="WestfoldScholarScroll"

ItemCategory[205]="FestivalConsumable" --Thanks eloyolo
ItemCategory[207]="Misc 2" --Thanks ralphtro


ItemCategory[208]="EastemnetMetalworkScroll"
ItemCategory[209]="EastemnetJewellerScroll"             --A guess!
ItemCategory[210]="EastemnetWoodworkScroll"             --A guess!
ItemCategory[211]="EastemnetWeaponsmithScroll"
ItemCategory[212]="EastemnetTailorScroll"
--ItemCategory[213]="Eastemnet
ItemCategory[214]="EastemnetForesterScroll"
--ItemCategory[215]="Eastemnet
ItemCategory[216]="EastemnetCookScroll"
ItemCategory[217]="EastemnetScholarScroll"

ItemCategory[218]="Legendary Bridle"

--This next line *could* overwrite the data above, if Turbine ever fix the categories.
for i,v in pairs(Turbine.Gameplay.ItemCategory) do ItemCategory[v]=i end

if Groups==nil then
        Turbine.Shell.WriteLine("<rgb=#00FF00>SortPack loaded. /Sort to sort the backpack, /SortOption to change the order</rgb>")
        
        CraftScroll={
        "ApprenticeCookScroll",
        "ApprenticeFarmerScroll",
        "ApprenticeForestryScroll",
        "ApprenticeJewellerScroll",
        "ApprenticeMetalworkScroll",
        "ApprenticeProspectingScroll",
        "ApprenticeScholarScroll",
        "ApprenticeTailorScroll",
        "ApprenticeWeaponsmithScroll",
        "ApprenticeWoodworkScroll",
        "ArtisanCookScroll",
        "ArtisanFarmerScroll",
        "ArtisanForestryScroll",
        "ArtisanJewellerScroll",
        "ArtisanMetalworkScroll",
        "ArtisanProspectingScroll",
        "ArtisanScholarScroll",
        "ArtisanTailorScroll",
        "ArtisanWeaponsmithScroll",
        "ArtisanWoodworkScroll",
        "ExpertCookScroll",
        "ExpertFarmerScroll",
        "ExpertForestryScroll",
        "ExpertJewellerScroll",
        "ExpertMetalworkScroll",
        "ExpertProspectingScroll",
        "ExpertScholarScroll",
        "ExpertTailorScroll",
        "ExpertWeaponsmithScroll",
        "ExpertWoodworkScroll",
        "JourneymanCookScroll",
        "JourneymanFarmerScroll",
        "JourneymanForestryScroll",
        "JourneymanJewellerScroll",
        "JourneymanMetalworkScroll",
        "JourneymanProspectingScroll",
        "JourneymanScholarScroll",
        "JourneymanTailorScroll",
        "JourneymanWeaponsmithScroll",
        "JourneymanWoodworkScroll",
        "MasterCookScroll",
        "MasterFarmerScroll",
        "MasterForestryScroll",
        "MasterJewellerScroll",
        "MasterMetalworkScroll",
        "MasterProspectingScroll",
        "MasterScholarScroll",
        "MasterTailorScroll",
        "MasterWeaponsmithScroll",
        "MasterWoodworkScroll",
        "SupremeCookScroll",
        "SupremeFarmerScroll",
        "SupremeForestryScroll",
        "SupremeJewellerScroll",
        "SupremeMetalworkScroll",
        "SupremeProspectingScroll",
        "SupremeScholarScroll",
        "SupremeTailorScroll",
        "SupremeWeaponsmithScroll",
        "SupremeWoodworkScroll",
        "WestFoldCookScroll",
        "WestFoldFarmerScroll",
        "WestFoldForestryScroll",
        "WestFoldJewellerScroll",
        "WestFoldMetalworkScroll",
        "WestFoldProspectingScroll",
        "WestFoldScholarScroll",
        "WestFoldTailorScroll",
        "WestFoldWeaponsmithScroll",
        "WestFoldWoodworkScroll",
        "EastemnetCookScroll",
        "EastemnetFarmerScroll",
        "EastemnetForestryScroll",
        "EastemnetJewellerScroll",
        "EastemnetMetalworkScroll",
        "EastemnetProspectingScroll",
        "EastemnetScholarScroll",
        "EastemnetTailorScroll",
        "EastemnetWeaponsmithScroll",
        "EastemnetWoodworkScroll"}
        CraftScroll.Name="CraftScroll"
        
        Tool={
        "Tool",
        "Festival"}
        Tool.Name="Tool"

        Weapons={
        "Axe",
        "Bow",
        "Club",
        "Crossbow",
        "Dagger",
        "Book",
        "Halberd",
        "Hammer",
        "Instrument",
        "Javelin",
        "Mace",
        "Minstrel",
        "Spear",
        "Shield",
        "Staff",
        "Sword",
        "Thrown",
        "Weapon"}
        Weapons.Name="Weapons"
        
        Armor={
        "Armor",
        "GuardianBelt",
        "Back",
        "Chest",
        "Clothing",
        "CosmeticBack",
        "CosmeticHeld",
        "CosmeticFeet",
        "CosmeticHands",
        "CosmeticShoulders",
        "CosmeticHead",
        "Feet",
        "Hands",
        "Head",
        "Jewelry",
        "Legs",
        "MinstrelBook",
        "Shoulders",
        "OutfitFeet",                                                                   --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
        "OutfitUpperbody",                                                              --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
        "OutfitHead",                                                                   --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
        "OutfitShoulder",                                                               --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
        "OutfitGloves"                                                                  --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
        }
        Armor.Name="Armor"
        
        Dye={
        "Dye"}
        Dye.Name="Dye"
        
        Fishing={
        "Fish",
        "FishingBait",
        "FishingOther",
        "FishingPole"}
        Fishing.Name="Fishing"
        
        Class={
        "Runekeeper",
        "Burglar",
        "Captain",
        "Guardian",
        "Champion",
         "ChampionHorns",                                                       --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
        "Loremaster",
        "Hunter",
        "Warden"}
        Class.Name="Class"
        
        Food={
        "Food",
        "LoremasterFood"}
        Food.Name="Food"
        
        Decoration={
        "CeilingDecoration",
        "Decoration",
        "FloorDecoration",
        "FurnitureDecoration",
        "MusicDecoration",
        "SpecialDecoration",
        "Trophy",
        "TrophyDecoration",
        "YardDecoration",
        "WallDecoration",
        "SurfacePaintDecoration"}
        Decoration.Name="Decoration"
        
        Legend={
        "LegendaryWeaponExperience",
        "LegendaryWeaponIncreaseMaxLevel",
        "LegendaryWeaponReplaceLegacy",
        "LegendaryWeaponReset",
        "LegendaryWeaponUpgradeLegacy",
        "Legendary Bridle"}
        Legend.Name="Legend"
        
        Potion={
        "Potion"}
        Potion.Name="Potion"
        
        Device={
        "Device"}
        Device.Name="Device"
        
        Craft={
        "Component",
        "Crafting",
        "Ingredient",
        "CraftOptionalIngredient"                               --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
        }
        Craft.Name="Craft"
        
        BuffItem={
        "Scroll",
        "Trap",
        "ShieldSpikes",                                                         --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
        "Oil",
        "Perk",
        "Travel"}
        BuffItem.Name="BuffItem"
        
        Misc={

        "CraftingTrophy",
        "Deconstructable",
        "Effect",
        "Healing",
        "Implement",

        "Key",
        "KinshipCharter",

        "Mounts",
        "NonInventory",

        "Orb",
        "Pennant",
        "Quest",
        "Relic",
        "Resource",

        "SpecialTrophy",


        "Treasure",
        "Undefined",

        "BarterReputation",                                             --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
         "Special",                                                                             --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
        "BarterSkirmish",                                                       --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
         "Barter",                                                                                      --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
        "SkillScrolls",                                                                 --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
         
         "Perks",                                                                                       --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
         "TravelAndMaps",                                                       --CUSTOM! Remove when Turbine fix the ItemCategory Enumeration
         "Misc"
        }
        Misc.Name="Misc"
        
        Groups={Tool,Device,Potion,BuffItem,Food,Legend,Weapons,Armor,Class,Craft,Dye,Fishing,Decoration,CraftScroll,Misc}
        
end

if Groups[0]==nil then Groups[0]={} end
Groups[0].Name="Empty Slots"

function BuildList()
        --Builds the list from the groups
        
        --Reset First
        list=nil
        list={}

        --Merge from current groups
        mergetable(list,Groups)

        listtonum()
        
        --Create a new list - this matches itemcategory to group so, ItemGroup["ForestersAxe"]="Tool"
        ItemGroup={}
        for i=1,#Groups do
                for j=1,#Groups[i] do
                        ItemGroup[Groups[i][j]]=i
                end
        end             
end

--Now, change the way the table works.
--This changes the text list to a numbered list. so, for example, value["Tool"] would equal 150 or whatever.
function listtonum()
        value={}
        for i,v in pairs(list) do 
                value[v]=i                                      --This converts say, list[1]="Geoff" to value[Geoff]=1 Nice huh?
        end
end

function RepairList()
        --Repair function if any new item categories have been added
        local changed=false
        for i,v in pairs(ItemCategory) do
                if value[ItemCategory[i]]==nil then
                        local found=false
                        local target
                        for j=1,#Groups do
                                if Groups[j].Name=="Unknown" then found=true target=j end
                        end
                        if found==false then 
                                Groups[#Groups+1]={["Name"]="Unknown"}
                                target=#Groups
                        end
                        changed=true
                        table.insert(Groups[target],ItemCategory[i])
                        listtonum()
                end
        end
        if changed then Turbine.Shell.WriteLine("Adding missing Categories to the 'Unknown' group ") end
end

--Get the list; Pass 1
        BuildList()
--Repair function if any new item categories have been added
        RepairList()
--Get the list; Pass 2 Rebuild the list after now adding the items in the "Unknown" category
        BuildList()

Compare with Previous | Blame


All times are GMT -5. The time now is 01:49 AM.


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