if ItemCategory==nil then ItemCategory={} 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"
--This section allows the creation of custom user item categories.
--Currently these are hand-entered. Later I will add an option box etc.
--And yes, as of now only some of the ore and ingots.
--Issue the "a" with an umlat in Khazad gets very funkily coded when it is turned into a variable name.
--This could be a huge problem for non-english clients.
--What I could do is add a second table that contains the names as text, but it seems a waste...
--For now I will forge on with one table.
--First define the categories. Turbine categories finish around 210 so, these start at 900
--ItemCategory[900]="Ore"
--ItemCategory[901]="Ingot"
--[[CustomItem={
["Ancient Nickel Ore"]={["Cat"]=900,["Name"]="Ancient Nickel Ore"},
["Chunk of Ancient Iron Ore"]={["Cat"]=900,["Name"]="Chunk of Ancient Iron Ore"}
}]]
if CustomItem==nil then CustomItem={} end
--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"}
CraftScroll.Name="CraftScroll"
Tool={
"Tool"}
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",
"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"}
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"}
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()