--
-- AutoBar
-- Item List Database
--
-- Maintained by Azethoth / Toadkiller of Proudmoore.  Original author Saien of Hyjal
-- http://www.wowace.com/wiki/AutoBar
-- http://www.curse-gaming.com/en/wow/addons-4430-1-autobar-toadkiller.html
--

AutoBarItemList = {};

local L = AceLibrary("AceLocale-2.2"):new("AutoBar");
local PT = AceLibrary:GetInstance("PeriodicTable-3.0");
local BS = AceLibrary:GetInstance("Babble-Spell-2.2");


local function sortList(a, b)
	local x = tonumber(a[2]);
	local y = tonumber(b[2]);

	if (x == y) then
		if (a[3]) then
			return false;
		else
			if (b[3]) then
				return true;
			else
				return false;
			end
		end
	else
		return x < y;
	end
end


-- Get set as a simple array of itemIds, ordered by their value in the set
-- If provided, also record the values scaled by downFactor into downHp, downMana
function AutoBarItemList:GetSetItemsArrayPT3(set, downHp, downMana, downFactor)
	local itemArray = {};
	local cacheSet = PT:GetSetTable(set);
	if (cacheSet) then
		local sortedList = {};
		local index = 1;
		for itemId, value in PT:IterateSet(set) do
			if (type(value) == "boolean") then
				value = 0;
			end
			sortedList[index] = { itemId, value };
			index = index + 1;
		end
		table.sort(sortedList, sortList);
		for i, j in ipairs(sortedList) do
			itemArray[i] = j[1];
			if (downHp) then
				downHp[i] = j[2] * downFactor;
			end
			if (downMana) then
				downMana[i] = j[2]* downFactor;
			end
		end
	end
	return itemArray;
end


-- Convert rawList to a simple array of itemIds, ordered by their value in the set, and priority if any
-- If provided, also record the values scaled by downFactor into downHp, downMana
function AutoBarItemList:RawItemsConvert(rawList, downHp, downMana, downFactor)
	local itemArray = {};
	table.sort(rawList, sortList);
	for i, j in ipairs(rawList) do
		itemArray[i] = j[1];
		if (downHp) then
			downHp[i] = j[2] * downFactor;
		end
		if (downMana) then
			downMana[i] = j[2]* downFactor;
		end
	end
	return itemArray;
end


-- Add items from set to rawList
-- If priority is true, the items will have priority over non-priority items with the same values
function AutoBarItemList:RawItemsAdd(rawList, set, priority)
--DEFAULT_CHAT_FRAME:AddMessage("RawItemsAdd set " .. tostring(set).." priority ".. tostring(priority));
	if (not rawList) then
		rawList = {};
	end
	local cacheSet = PT:GetSetTable(set);
	if (cacheSet) then
		local index = table.getn(rawList) + 1;
		for itemId, value in PT:IterateSet(set) do
			if (not value or type(value) == "boolean") then
				value = 0;
			end
			value = tonumber(value);
			rawList[index] = {itemId, value, priority};
			index = index + 1;
		end
	end
	return rawList;
end


-- Fill in category item lists with the raw data from PeriodicTable.
-- Unless AutoBar is drastically restructured thats the most use we can get from PeriodicTable
function AutoBarItemList:Initialize()
	local rawList;	--TODO: Recycle it

	AutoBar_Category_Info["ANTI_VENOM"]["items"] = self:GetSetItemsArrayPT3("Consumable.Anti-Venom");
	AutoBar_Category_Info["ARROWS"]["items"] = self:GetSetItemsArrayPT3("Reagent.Ammo.Arrow");
	AutoBar_Category_Info["BULLETS"]["items"] = self:GetSetItemsArrayPT3("Reagent.Ammo.Bullet");
	AutoBar_Category_Info["THROWN"]["items"] = self:GetSetItemsArrayPT3("Reagent.Ammo.Thrown");
	AutoBar_Category_Info["BANDAGES"]["items"] = self:GetSetItemsArrayPT3("Consumable.Bandage.Basic");
	AutoBar_Category_Info["ALTERAC_BANDAGES"]["items"] = self:GetSetItemsArrayPT3("Consumable.Bandage.Battleground.Alterac Valley");
	AutoBar_Category_Info["ARATHI_BANDAGES"]["items"] = self:GetSetItemsArrayPT3("Consumable.Bandage.Battleground.Arathi Basin");
	AutoBar_Category_Info["WARSONG_BANDAGES"]["items"] = self:GetSetItemsArrayPT3("Consumable.Bandage.Battleground.Warsong Gulch");
	AutoBar_Category_Info["EXPLOSIVES"]["items"] = self:GetSetItemsArrayPT3("Misc.Engineering.Explosives");
	AutoBar_Category_Info["FISHING_GEAR"]["items"] = self:GetSetItemsArrayPT3("Tradeskill.Tool.Fishing.Gear");
	AutoBar_Category_Info["FISHING_LURES"]["items"] = self:GetSetItemsArrayPT3("Tradeskill.Tool.Fishing.Lure");
	AutoBar_Category_Info["FISHING_POLES"]["items"] = self:GetSetItemsArrayPT3("Tradeskill.Tool.Fishing.Tool");
	AutoBar_Category_Info["FOOD"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Edible.Basic.Non-Conjured");
	AutoBar_Category_Info["FOOD_ARATHI"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Edible.Battleground.Arathi Basin.Basic");
	AutoBar_Category_Info["FOOD_WARSONG"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Edible.Battleground.Warsong Gulch.Basic");
	AutoBar_Category_Info["FOOD_COMBO"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Combo Health");
	AutoBar_Category_Info["FOOD_CONJURED"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Edible.Bread.Conjured");
	AutoBar_Category_Info["FOOD_PERCENT"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Percent.Basic");
	AutoBar_Category_Info["FOOD_PERCENT_BONUS"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Percent.Bonus");
	AutoBar_Category_Info["FOOD_PERCENT_COMBO"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Combo Percent");

	rawList = self:RawItemsAdd(nil, "Consumable.Food.Edible.Bread.Basic", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Food.Edible.Bread.Conjured", true);
	AutoBar_Category_Info["FOOD_PET_BREAD"]["items"] = self:RawItemsConvert(rawList);

	AutoBar_Category_Info["FOOD_PET_CHEESE"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Edible.Cheese.Basic");

	rawList = self:RawItemsAdd(nil, "Consumable.Food.Inedible.Fish", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Food.Edible.Fish.Basic", true);
	AutoBar_Category_Info["FOOD_PET_FISH"]["items"] = self:RawItemsConvert(rawList);

	AutoBar_Category_Info["FOOD_PET_FRUIT"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Edible.Fruit.Basic");
	AutoBar_Category_Info["FOOD_PET_FUNGUS"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Edible.Fungus.Basic");	-- Now includes senjin combo ;-(

	rawList = self:RawItemsAdd(nil, "Consumable.Food.Inedible.Meat", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Food.Edible.Meat.Basic", true);
	AutoBar_Category_Info["FOOD_PET_MEAT"]["items"] = self:RawItemsConvert(rawList);

	AutoBar_Category_Info["FOOD_BUFF"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Bonus");

	AutoBar_Category_Info["FOOD_AGILITY"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Buff.Agility");
	AutoBar_Category_Info["FOOD_ATTACK_POWER"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Buff.Attack Power");
	AutoBar_Category_Info["FOOD_HEALING"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Buff.Healing");
	AutoBar_Category_Info["FOOD_HPREGEN"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Buff.HP Regen");
	AutoBar_Category_Info["FOOD_INTELLECT"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Buff.Intellect");
	AutoBar_Category_Info["FOOD_MANAREGEN"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Buff.Mana Regen");
	AutoBar_Category_Info["FOOD_STAMINA"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Buff.Stamina");
	AutoBar_Category_Info["FOOD_SPELL_DAMAGE"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Buff.Spell Damage");
	AutoBar_Category_Info["FOOD_SPIRIT"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Buff.Spirit");
	AutoBar_Category_Info["FOOD_STRENGTH"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Buff.Strength");

	AutoBar_Category_Info["FOOD_OTHER"]["items"] = self:GetSetItemsArrayPT3("Consumable.Food.Buff.Other");

	AutoBar_Category_Info["HEALPOTIONS"]["limit"] = { ["downhp"] = {} }
	AutoBar_Category_Info["HEALPOTIONS"]["items"] = self:GetSetItemsArrayPT3("Consumable.Potion.Recovery.Healing.Basic",
			AutoBar_Category_Info["HEALPOTIONS"]["limit"]["downhp"],
			nil,
			0.75);

	AutoBar_Category_Info["HEALPOTIONS_BG"]["limit"] = { ["downhp"] = {} }
	AutoBar_Category_Info["HEALPOTIONS_BG"]["items"] = self:GetSetItemsArrayPT3("Consumable.Potion.Recovery.Healing.PvP",
			AutoBar_Category_Info["HEALPOTIONS_BG"]["limit"]["downhp"],
			nil, 0.75);

	AutoBar_Category_Info["HEALTHSTONE"]["items"] = self:GetSetItemsArrayPT3("Consumable.Warlock.Healthstone");
	AutoBar_Category_Info["MINI_PET"]["items"] = self:GetSetItemsArrayPT3("Misc.Minipet.Normal");
	AutoBar_Category_Info["MINI_PET_HOLIDAY"]["items"] = self:GetSetItemsArrayPT3("Misc.Minipet.Snowball");
	AutoBar_Category_Info["MOUNTS"]["items"] = self:GetSetItemsArrayPT3("Misc.Mount.Normal");
	AutoBar_Category_Info["MOUNTS_QIRAJI"]["items"] = self:GetSetItemsArrayPT3("Misc.Mount.Ahn'Qiraj");
	AutoBar_Category_Info["MOUNTS_FLYING"]["items"] = self:GetSetItemsArrayPT3("Misc.Mount.Flying");

	AutoBar_Category_Info["MANAPOTIONS"]["limit"] = { ["downmana"] = {},  }
	AutoBar_Category_Info["MANAPOTIONS"]["items"] = self:GetSetItemsArrayPT3("Consumable.Potion.Recovery.Mana.Basic",
			nil,
			AutoBar_Category_Info["MANAPOTIONS"]["limit"]["downmana"],
			0.75);

	AutoBar_Category_Info["MANAPOTIONS_BG"]["items"] = self:GetSetItemsArrayPT3("Consumable.Potion.Recovery.Mana.Pvp");

	AutoBar_Category_Info["REJUVENATION_POTIONS"]["limit"] = { ["downhp"] = {}, ["downmana"] = {},  }
	AutoBar_Category_Info["REJUVENATION_POTIONS"]["items"] = self:GetSetItemsArrayPT3("Consumable.Potion.Recovery.Rejuvenation",
			AutoBar_Category_Info["REJUVENATION_POTIONS"]["limit"]["downhp"],
			AutoBar_Category_Info["REJUVENATION_POTIONS"]["limit"]["downmana"],
			1.1);

	AutoBar_Category_Info["STONE_STATUES"]["items"] = self:GetSetItemsArrayPT3("Consumable.Jeweler.Statue");
	AutoBar_Category_Info["DREAMLESS_SLEEP"]["items"] = self:GetSetItemsArrayPT3("Consumable.Potion.Recovery.Dreamless Sleep");
	AutoBar_Category_Info["MANASTONE"]["items"] = self:GetSetItemsArrayPT3("Consumable.Mage.Mana Stone");
	AutoBar_Category_Info["OIL_MANA"]["items"] = self:GetSetItemsArrayPT3("Consumable.Weapon Buff.Oil.Mana");
	AutoBar_Category_Info["OIL_WIZARD"]["items"] = self:GetSetItemsArrayPT3("Consumable.Weapon Buff.Oil.Wizard");
	AutoBar_Category_Info["POISON-CRIPPLING"]["items"] = self:GetSetItemsArrayPT3("Consumable.Weapon Buff.Poison.Crippling");
	AutoBar_Category_Info["POISON-DEADLY"]["items"] = self:GetSetItemsArrayPT3("Consumable.Weapon Buff.Poison.Deadly");

	rawList = self:RawItemsAdd(nil, "Consumable.Weapon Buff.Poison.Anesthetic", true);
	rawList = self:RawItemsAdd(rawList, "Consumable.Weapon Buff.Poison.Instant", false);
	AutoBar_Category_Info["POISON-INSTANT"]["items"] = self:RawItemsConvert(rawList);

	AutoBar_Category_Info["POISON-MINDNUMBING"]["items"] = self:GetSetItemsArrayPT3("Consumable.Weapon Buff.Poison.Mind Numbing");
	AutoBar_Category_Info["POISON-WOUND"]["items"] = self:GetSetItemsArrayPT3("Consumable.Weapon Buff.Poison.Wound");
	AutoBar_Category_Info["RAGEPOTIONS"]["items"] = self:GetSetItemsArrayPT3("Consumable.Buff.Rage.Self");

	rawList = self:RawItemsAdd(nil, "Consumable.Water.Basic", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Water.Conjured", true);
	AutoBar_Category_Info["WATER"]["items"] = self:RawItemsConvert(rawList);

	AutoBar_Category_Info["WATER_SPIRIT"]["items"] = self:GetSetItemsArrayPT3("Consumable.Water.Buff.Spirit");

	rawList = self:RawItemsAdd(nil, "Consumable.Buff.Health.Self", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Regen Health.Self", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Spirit.Self", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Stamina.Self", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Dodge.Self", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Resistance.Self", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Absorb.Self", false);
	AutoBar_Category_Info["BUFF_GENERAL"]["items"] = self:RawItemsConvert(rawList);

	rawList = self:RawItemsAdd(nil, "Consumable.Buff.Health.Target", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Regen Health.Target", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Spirit.Target", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Stamina.Target", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Dodge.Target", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Resistance.Target", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Absorb.Target", false);
	AutoBar_Category_Info["BUFF_GENERAL_TARGET"]["items"] = self:RawItemsConvert(rawList);

	rawList = self:RawItemsAdd(nil, "Consumable.Buff.Healing.Self", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Intellect.Self", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Mana.Self", true);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Regen Mana.Self", true);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Spell Crit.Self", true);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Spell Damage.Self", true);
	AutoBar_Category_Info["BUFF_CASTER"]["items"] = self:RawItemsConvert(rawList);

	rawList = self:RawItemsAdd(nil, "Consumable.Buff.Intellect.Target", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Agility.Target", true);
	AutoBar_Category_Info["BUFF_CASTER_TARGET"]["items"] = self:RawItemsConvert(rawList);

	rawList = self:RawItemsAdd(nil, "Consumable.Buff.Armor.Self", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Agility.Self", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Attack Power.Self", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Attack Speed.Self", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Strength.Self", false);
	AutoBar_Category_Info["BUFF_MELEE"]["items"] = self:RawItemsConvert(rawList);

	rawList = self:RawItemsAdd(nil, "Consumable.Buff.Armor.Target", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Agility.Target", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Attack Power.Target", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Attack Speed.Target", false);
	rawList = self:RawItemsAdd(rawList, "Consumable.Buff.Strength.Target", false);
	AutoBar_Category_Info["BUFF_MELEE_TARGET"]["items"] = self:RawItemsConvert(rawList);

	AutoBar_Category_Info["BUFF_OTHER"]["items"] = self:GetSetItemsArrayPT3("Consumable.Buff.Other.Self");
	AutoBar_Category_Info["BUFF_OTHER_TARGET"]["items"] = self:GetSetItemsArrayPT3("Consumable.Buff.Other.Target");

	AutoBar_Category_Info["SHARPENINGSTONES"]["items"] = self:GetSetItemsArrayPT3("Consumable.Weapon Buff.Stone.Sharpening Stone");
	AutoBar_Category_Info["WEIGHTSTONES"]["items"] = self:GetSetItemsArrayPT3("Consumable.Weapon Buff.Stone.Weight Stone");
	AutoBar_Category_Info["BUFF_CHEST"]["items"] = self:GetSetItemsArrayPT3("Consumable.Buff.Chest");
	AutoBar_Category_Info["BUFF_SHIELD"]["items"] = self:GetSetItemsArrayPT3("Consumable.Buff.Shield");

	AutoBar_Category_Info["BUFF_HEALTH"]["items"] = self:GetSetItemsArrayPT3("Consumable.Buff.Health");
	AutoBar_Category_Info["BUFF_ARMOR"]["items"] = self:GetSetItemsArrayPT3("Consumable.Buff.Armor");
	AutoBar_Category_Info["BUFF_REGENHEALTH"]["items"] = self:GetSetItemsArrayPT3("Consumable.Buff.Regen Health");
	AutoBar_Category_Info["BUFF_AGILITY"]["items"] = self:GetSetItemsArrayPT3("Consumable.Buff.Agility");
	AutoBar_Category_Info["BUFF_INTELLECT"]["items"] = self:GetSetItemsArrayPT3("Consumable.Buff.Intellect");
	AutoBar_Category_Info["BUFF_SPIRIT"]["items"] = self:GetSetItemsArrayPT3("Consumable.Buff.Spirit");
	AutoBar_Category_Info["BUFF_STAMINA"]["items"] = self:GetSetItemsArrayPT3("Consumable.Buff.Stamina");
	AutoBar_Category_Info["BUFF_STRENGTH"]["items"] = self:GetSetItemsArrayPT3("Consumable.Buff.Strength");
	AutoBar_Category_Info["BUFF_ATTACKPOWER"]["items"] = self:GetSetItemsArrayPT3("Consumable.Buff.Attack Power");
	AutoBar_Category_Info["BUFF_ATTACKSPEED"]["items"] = self:GetSetItemsArrayPT3("Consumable.Buff.Attack Speed");
	AutoBar_Category_Info["BUFF_DODGE"]["items"] = self:GetSetItemsArrayPT3("Consumable.Buff.Dodge");
	AutoBar_Category_Info["BUFF_RESISTANCE"]["items"] = self:GetSetItemsArrayPT3("Consumable.Buff.Resistance.Self");
	AutoBar_Category_Info["BUFF_RESISTANCE_TARGET"]["items"] = self:GetSetItemsArrayPT3("Consumable.Buff.Resistance.Target");
end


AutoBar_Category_Info = {
	["CUSTOM"] = {
		["description"] = AUTOBAR_CLASS_CUSTOM;
		["texture"] = "INV_Misc_Bandage_12",
		["custom"] = true;
		["items"] = { 19307 },
	},
	["MINI_PET"] = {
		["description"] = AUTOBAR_CLASS_MINI_PET;
		["texture"] = "Ability_Creature_Poison_05";
		["arrangeOnUse"] = true,
	},
	["MINI_PET_HOLIDAY"] = {
		["description"] = AUTOBAR_CLASS_MINI_PET_HOLIDAY;
		["texture"] = "INV_Misc_Bag_17";
		["arrangeOnUse"] = true,
	},
	["Fireworks"] = {
		["description"] = L["Fireworks"];
		["texture"] = "INV_Misc_MissileSmall_Red";
		["arrangeOnUse"] = true,
	},
	["AAACLEAR"] = {
		["description"] = AUTOBAR_CLASS_CLEAR;
		["texture"] = "INV_Misc_Fork&Knife";
		["items"] = {},
	},
	["BANDAGES"] = {
		["description"] = AUTOBAR_CLASS_BANDAGES;
		["texture"] = "INV_Misc_Bandage_12";
		["targetted"] = true;
	},
	["ALTERAC_BANDAGES"] = {
		["description"] = AUTOBAR_CLASS_ALTERAC_BANDAGE;
		["texture"] = "INV_Misc_Bandage_12";
		["targetted"] = true;
		["location"] = AUTOBAR_ALTERACVALLEY;
	},
	["WARSONG_BANDAGES"] = {
		["description"] = AUTOBAR_CLASS_WARSONG_BANDAGE;
		["texture"] = "INV_Misc_Bandage_12";
		["targetted"] = true;
		["location"] = AUTOBAR_WARSONGGULCH;
	},
	["ARATHI_BANDAGES"] = {
		["description"] = AUTOBAR_CLASS_ARATHI_BANDAGE;
		["texture"] = "INV_Misc_Bandage_12";
		["targetted"] = true;
		["location"] = AUTOBAR_ARATHIBASIN;
	},
	["UNGORO_RESTORE"] = {
		["description"] = AUTOBAR_CLASS_UNGORORESTORE;
		["texture"] = "INV_Misc_Gem_Diamond_02";
		["targetted"] = true;
		["limit"] = { ["downhp"] = { 670 } },
		["items"] = { 11562 },
	},
	["ANTI_VENOM"] = {
		["description"] = AUTOBAR_CLASS_ANTIVENOM;
		["texture"] = "INV_Drink_14";
		["targetted"] = true;
	},
	----------------
	["BUFF_GENERAL"] = {
		["texture"] = "INV_Potion_80",
		["description"] = AUTOBAR_CLASS_BUFF_GENERAL,
	},
	["BUFF_GENERAL_TARGET"] = {
		["texture"] = "INV_Potion_80",
		["description"] = AUTOBAR_CLASS_BUFF_GENERAL_TARGET,
		["targetted"] = true,
	},
	["BUFF_CASTER"] = {
		["texture"] = "INV_Potion_66",
		["description"] = AUTOBAR_CLASS_BUFF_CASTER,
	},
	["BUFF_CASTER_TARGET"] = {
		["texture"] = "INV_Potion_66",
		["description"] = AUTOBAR_CLASS_BUFF_CASTER_TARGET,
		["targetted"] = true,
	},
	["BUFF_MELEE"] = {
		["texture"] = "INV_Potion_43",
		["description"] = AUTOBAR_CLASS_BUFF_MELEE,
	},
	["BUFF_MELEE_TARGET"] = {
		["texture"] = "INV_Potion_43",
		["description"] = AUTOBAR_CLASS_BUFF_MELEE_TARGET,
		["targetted"] = true,
	},
	["BUFF_OTHER"] = {
		["texture"] = "INV_Potion_80",
		["description"] = AUTOBAR_CLASS_BUFF_OTHER,
	},
	["BUFF_OTHER_TARGET"] = {
		["texture"] = "INV_Potion_80",
		["description"] = AUTOBAR_CLASS_BUFF_OTHER_TARGET,
		["targetted"] = true,
	},
	----------------
	["BUFF_HEALTH"] = {
		["texture"] = "INV_Potion_43",
		["description"] = AUTOBAR_CLASS_BUFF_HEALTH,
	},
	["BUFF_ARMOR"] = {
		["texture"] = "INV_Potion_66",
		["description"] = AUTOBAR_CLASS_BUFF_ARMOR,
	},
	["BUFF_REGENHEALTH"] = {
		["texture"] = "INV_Potion_80",
		["description"] = AUTOBAR_CLASS_BUFF_REGENHEALTH,
	},
	["BUFF_AGILITY"] = {
		["texture"] = "INV_Scroll_02",
		["targetted"] = true,
		["description"] = AUTOBAR_CLASS_BUFF_AGILITY,
	},
	["BUFF_INTELLECT"] = {
		["texture"] = "INV_Scroll_01",
		["targetted"] = true,
		["description"] = AUTOBAR_CLASS_BUFF_INTELLECT,
	},
	["BUFF_PROTECTION"] = {
		["texture"] = "INV_Scroll_07",
		["targetted"] = true,
		["description"] = AUTOBAR_CLASS_BUFF_PROTECTION,
	},
	["BUFF_SPIRIT"] = {
		["texture"] = "INV_Scroll_01",
		["targetted"] = true,
		["description"] = AUTOBAR_CLASS_BUFF_SPIRIT,
	},
	["BUFF_STAMINA"] = {
		["texture"] = "INV_Scroll_07",
		["targetted"] = true,
		["description"] = AUTOBAR_CLASS_BUFF_STAMINA,
	},
	["BUFF_STRENGTH"] = {
		["texture"] = "INV_Scroll_02",
		["targetted"] = true,
		["description"] = AUTOBAR_CLASS_BUFF_STRENGTH,
	},
	["BUFF_ATTACKPOWER"] = {
		["texture"] = "INV_Misc_MonsterScales_07",
		["targetted"] = true,
		["description"] = AUTOBAR_CLASS_BUFF_ATTACKPOWER,
	},
	["BUFF_ATTACKSPEED"] = {
		["texture"] = "INV_Misc_MonsterScales_17",
		["targetted"] = true,
		["description"] = AUTOBAR_CLASS_BUFF_ATTACKSPEED,
	},
	["BUFF_DODGE"] = {
		["texture"] = "INV_Misc_MonsterScales_17",
		["targetted"] = true,
		["description"] = AUTOBAR_CLASS_BUFF_DODGE,
	},
	["BUFF_RESISTANCE"] = {
		["texture"] = "INV_Misc_MonsterScales_15",
		["targetted"] = true,
		["description"] = AUTOBAR_CLASS_BUFF_RESISTANCE,
	},
	["BUFF_RESISTANCE_TARGET"] = {
		["texture"] = "INV_Misc_MonsterScales_15",
		["targetted"] = true,
		["description"] = AUTOBAR_CLASS_BUFF_RESISTANCE,
	},
	----------------
	["FISHING_LURES"] = {
		["texture"] = "INV_Misc_Food_26",
		["targetted"] = "WEAPON",
		["description"] = L["FISHING_LURES"],
	},
	["FISHING_GEAR"] = {
		["texture"] = "INV_Helmet_31",
		["description"] = L["FISHING_GEAR"],
	},
	["FISHING_POLES"] = {
		["texture"] = "INV_Fishingpole_01",
		["description"] = L["FISHING_POLES"],
	},
	----------------
	["HEALPOTIONS"] = {
		["description"] = AUTOBAR_CLASS_HEALPOTIONS;
		["texture"] = "INV_Potion_54";
	},
	["HEALTHSTONE"] = {
		["description"] = AUTOBAR_CLASS_HEALTHSTONE;
		["texture"] = "INV_Stone_04";
		["castList"] = {"WARLOCK", BS["Create Healthstone"]};
	},
	["WHIPPER_ROOT"] = {
		["description"] = AUTOBAR_CLASS_WHIPPER_ROOT;
		["texture"] = "INV_Misc_Food_55";
		["items"] = { 11951 },
		["limit"] = { ["downhp"] = { 700 } },
	},
	["HEALPOTIONS_BG"] = {
		["description"] = AUTOBAR_CLASS_BATTLEGROUNDHEALPOTIONS;
		["texture"] = "INV_Potion_39";
		["battleground"] = true;
	},
	----------------
	["MANAPOTIONS"] = {
		["description"] = AUTOBAR_CLASS_MANAPOTIONS;
		["texture"] = "INV_Potion_76";
	},
	["MANASTONE"] = {
		["description"] = AUTOBAR_CLASS_MANASTONE;
		["texture"] = "INV_Misc_Gem_Emerald_01";
	},
	["MANASTONE_CONJURE"] = {
		["description"] = AUTOBAR_CLASS_MANASTONE_CONJURE;
		["texture"] = "INV_Misc_Gem_Emerald_01";
	},
	["MANAPOTIONS_BG"] = {
		["description"] = AUTOBAR_CLASS_BATTLEGROUNDMANAPOTIONS;
		["texture"] = "INV_Potion_81";
		["battleground"] = true;
	},
	["DREAMLESS_SLEEP"] = {
		["description"] = AUTOBAR_CLASS_DREAMLESS_SLEEP;
		["texture"] = "INV_Potion_83";
	},
	----------------
	["NIGHT_DRAGONS_BREATH"] = {
		["description"] = AUTOBAR_CLASS_NIGHT_DRAGONS_BREATH;
		["texture"] = "INV_Misc_Food_45";
		["limit"] = { ["downhp"] = { 456 }, ["downmana"] = { 456 }, },
		["items"] = { 11952 },
	},
	["REJUVENATION_POTIONS"] = {
		["description"] = AUTOBAR_CLASS_REJUVENATION_POTIONS;
		["texture"] = "INV_Potion_47";
	},
	["STONE_STATUES"] = {
		["description"] = AUTOBAR_CLASS_STONE_STATUES;
		["texture"] = "INV_Misc_Statue_10";
	},
	----------------
	["BATTLE_STANDARD"] = {
		["description"] = AUTOBAR_CLASS_BATTLESTANDARD;
		["texture"] = "INV_BannerPVP_01";
		["battleground"] = true;
		["items"] = {
			18606,	-- Alliance Battle Standard
			18607,	-- Horde Battle Standard
		},
	},
	["BATTLE_STANDARD_AV"] = {
		["description"] = AUTOBAR_CLASS_BATTLESTANDARDAV;
		["texture"] = "INV_BannerPVP_02";
		["location"] = AUTOBAR_ALTERACVALLEY;
		["items"] = {
			19045,	-- Stormpike Battle Standard
			19046,	-- Frostwolf Battle Standard
		},
	},
	["HOURGLASS_SAND"] = {
		["description"] = AUTOBAR_CLASS_BATTLESTANDARDAV;
		["texture"] = "INV_BannerPVP_02";
		["location"] = AUTOBAR_BWL;
		["items"] = {
			19183,	-- Hourglass Sand
		},
	},
	["QUEST_ITEMS"] = {
		["description"] = AUTOBAR_CLASS_QUEST_ITEMS;
		["texture"] = "INV_BannerPVP_02";
		["arrangeOnUse"] = true;
		["items"] = {
			13892,	-- Kodo Kombobulator
			9466,	-- Orwin's Spade
			10699,	-- Bramble
			9618,	-- Muisek
			9619,	-- Muisek
			9620,	-- Muisek
			9621,	-- Muisek
			9606,	-- Muisek
			19036,	-- Final Message
			8584,	-- Dowsing
			9978,
			10687,
			10688,
			10689,
			10690,
			9437,
			9439,
			9442,
			12288,
			12566,
			11132,
			12922,
			12565,
			12906,
			11141,
			12472,
			12807,
			12815,
			11522,
			15454,
			12928,
			12627,
			18904,
			23691,
			28038,
			28132,
			31769,
			24501,

			11020,
			24538,
		},
	},
	----------------
	["RUNES"] = {
		["description"] = AUTOBAR_CLASS_DEMONIC_DARK_RUNES;
		["texture"] = "Spell_Shadow_SealOfKings";
		["limit"] = { ["downmana"] = { 900, 900 }, },
		["items"] = {
			20520,	-- Dark Rune
			12662,	-- Demonic Rune
		},
	},
	----------------
	["PROTECTION_ARCANE"] = {
		["description"] = AUTOBAR_CLASS_ARCANE_PROTECTION;
		["texture"] = "INV_Potion_83";
		["items"] = { 13461 },
	},
	["PROTECTION_FIRE"] = {
		["description"] = AUTOBAR_CLASS_FIRE_PROTECTION;
		["texture"] = "INV_Potion_24";
		["items"] = { 6049, 13457 },
	},
	["PROTECTION_FROST"] = {
		["description"] = AUTOBAR_CLASS_FROST_PROTECTION;
		["texture"] = "INV_Potion_20";
		["items"] = { 6050, 13456 },
	},
	["PROTECTION_NATURE"] = {
		["description"] = AUTOBAR_CLASS_NATURE_PROTECTION;
		["texture"] = "INV_Potion_22";
		["items"] = { 6052, 13458 },
	},
	["PROTECTION_SHADOW"] = {
		["description"] = AUTOBAR_CLASS_SHADOW_PROTECTION;
		["texture"] = "INV_Potion_23";
		["items"] = { 6048, 13459 },
	},
	["PROTECTION_SPELLS"] = {
		["description"] = AUTOBAR_CLASS_SPELL_PROTECTION;
		["texture"] = "INV_Potion_29";
		["items"] = {
			20080	-- Sheen of Zanza
		},
	},
	["PROTECTION_HOLY"] = {
		["description"] = AUTOBAR_CLASS_HOLY_PROTECTION;
		["texture"] = "INV_Potion_09";
		["items"] = { 6051 },
		["noncombat"] = false,
	},
	["PROTECTION_DAMAGE"] = {
		["description"] = AUTOBAR_CLASS_INVULNERABILITY_POTIONS;
		["texture"] = "INV_Potion_62";
		["items"] = { 3387 },
		["noncombat"] = false,
	},
	["ACTION_POTIONS"] = {
		["description"] = AUTOBAR_CLASS_FREE_ACTION_POTION;
		["texture"] = "INV_Potion_04";
		["items"] = {
			20008,		-- Living Action Potion
			5634,		-- Free Action Potion
		},
	},
	----------------
	["HEARTHSTONE"] = {
		["description"] = AUTOBAR_CLASS_HEARTHSTONE;
		["texture"] = "INV_Misc_Rune_01";
		["items"] = {
			6948,			-- HearthStone
		},
	},
	----------------
	["BOOZE"] = {
		["description"] = AUTOBAR_CLASS_BOOZE;
		["texture"] = "INV_Drink_03";
		["noncombat"] = true,
	},
	["WATER"] = {
		["description"] = AUTOBAR_CLASS_WATER;
		["texture"] = "INV_Drink_10";
		["noncombat"] = true,
		["castList"] = {"MAGE", BS["Conjure Water"],},
	},
	["WATER_PERCENT"] = {
		["description"] = AUTOBAR_CLASS_WATER_PERCENT;
		["texture"] = "INV_Drink_04";
		["noncombat"] = true,
	},
	["WATER_CONJURED"] = {
		["description"] = AUTOBAR_CLASS_WATER_CONJURED;
		["texture"] = "INV_Drink_18";
		["noncombat"] = true,
	},
	["WATER_SPIRIT"] = {
		["description"] = AUTOBAR_CLASS_WATER_SPIRIT;
		["texture"] = "INV_Drink_16";
		["noncombat"] = true,
	},
	["RAGEPOTIONS"] = {
		["description"] = AUTOBAR_CLASS_RAGEPOTIONS;
		["texture"] = "INV_Potion_24";
	},
	["ENERGYPOTIONS"] = {
		["description"] = AUTOBAR_CLASS_ENERGYPOTIONS;
		["texture"] = "INV_Drink_Milk_05";
		["items"] = { 7676 },
	},
	["SWIFTNESSPOTIONS"] = {
		["description"] = AUTOBAR_CLASS_SWIFTNESSPOTIONS;
		["texture"] = "INV_Potion_95";
		["items"] = { 20081, 2459, },
	},
	["SOULSHARDS"] = {
		["description"] = AUTOBAR_CLASS_SOULSHARDS;
		["texture"] = "INV_Misc_Gem_Amethyst_02";
		["notusable"] = true;
		["items"] = { 6265 },
	},
	--------------
	["ARROWS"] = {
		["description"] = AUTOBAR_CLASS_ARROWS;
		["texture"] = "INV_Ammo_Arrow_02";
		["notusable"] = true;
	},
	["BULLETS"] = {
		["description"] = AUTOBAR_CLASS_BULLETS;
		["texture"] = "INV_Ammo_Bullet_02";
		["notusable"] = true;
	},
	["THROWN"] = {
		["description"] = AUTOBAR_CLASS_THROWNWEAPON;
		["texture"] = "INV_Axe_19";
		["notusable"] = true;
	},
	--------------
	["FOOD"] = {
		["description"] = AUTOBAR_CLASS_FOOD;
		["texture"] = "INV_Misc_Food_23";
		["noncombat"] = true,
	},
	["FOOD_PERCENT"] = {
		["description"] = AUTOBAR_CLASS_FOOD_PERCENT;
		["texture"] = "INV_Misc_Food_60",
		["custom"] = true;
	},
	["FOOD_PERCENT_BONUS"] = {
		["description"] = AUTOBAR_CLASS_FOOD_PERCENT_BONUS;
		["texture"] = "INV_Misc_Food_62",
		["custom"] = true;
	},
	["FOOD_PERCENT_COMBO"] = {
		["description"] = AUTOBAR_CLASS_FOOD_PERCENT_COMBO;
		["texture"] = "INV_Food_ChristmasFruitCake_01",
		["custom"] = true;
	},
	["FOOD_PET_BREAD"] = {
		["description"] = AUTOBAR_CLASS_FOOD_PET_BREAD;
		["texture"] = "INV_Misc_Food_35";
		["noncombat"] = true,
		["targetted"] = "PET";
		["castSpell"] = BS["Feed Pet"];
	},
	["FOOD_PET_CHEESE"] = {
		["description"] = AUTOBAR_CLASS_FOOD_PET_CHEESE;
		["texture"] = "INV_Misc_Food_37";
		["noncombat"] = true,
		["targetted"] = "PET";
		["castSpell"] = BS["Feed Pet"];
	},
	["FOOD_PET_FISH"] = {
		["description"] = AUTOBAR_CLASS_FOOD_PET_FISH;
		["texture"] = "INV_Misc_Fish_22";
		["noncombat"] = true,
		["targetted"] = "PET";
		["castSpell"] = BS["Feed Pet"];
	},
	["FOOD_PET_FRUIT"] = {
		["description"] = AUTOBAR_CLASS_FOOD_PET_FRUIT;
		["texture"] = "INV_Misc_Food_19";
		["noncombat"] = true,
		["targetted"] = "PET";
		["castSpell"] = BS["Feed Pet"];
	},
	["FOOD_PET_FUNGUS"] = {
		["description"] = AUTOBAR_CLASS_FOOD_PET_FUNGUS;
		["texture"] = "INV_Mushroom_05";
		["noncombat"] = true,
		["targetted"] = "PET";
		["castSpell"] = BS["Feed Pet"];
	},
	["FOOD_PET_MEAT"] = {
		["description"] = AUTOBAR_CLASS_FOOD_PET_MEAT;
		["texture"] = "INV_Misc_Food_14";
		["noncombat"] = true,
		["targetted"] = "PET";
		["castSpell"] = BS["Feed Pet"];
	},
	["FOOD_COMBO"] = {
		["description"] = AUTOBAR_CLASS_FOOD_COMBO;
		["texture"] = "INV_Misc_Food_33";
		["noncombat"] = true,
	},
	["FOOD_CONJURED"] = {
		["description"] = AUTOBAR_CLASS_FOOD_CONJURED;
		["texture"] = "INV_Misc_Food_73CinnamonRoll";
		["noncombat"] = true,
		["castList"] = {"MAGE", BS["Conjure Food"],},
	},
	["FOOD_BUFF"] = {
		["description"] = L["FOOD_BUFF"];
		["texture"] = "INV_Misc_Food_47";
		["noncombat"] = true,
	},
	["FOOD_AGILITY"] = {
		["description"] = L["FOOD_AGILITY"];
		["texture"] = "INV_Misc_Fish_13";
		["noncombat"] = true,
	},
	["FOOD_ATTACK_POWER"] = {
		["description"] = L["FOOD_ATTACK_POWER"];
		["texture"] = "INV_Misc_Fish_13";
		["noncombat"] = true,
	},
	["FOOD_HEALING"] = {
		["description"] = L["FOOD_HEALING"];
		["texture"] = "INV_Misc_Fish_13";
		["noncombat"] = true,
	},
	["FOOD_HPREGEN"] = {
		["description"] = L["FOOD_HPREGEN"];
		["texture"] = "INV_Misc_Fish_19";
		["noncombat"] = true,
	},
	["FOOD_INTELLECT"] = {
		["description"] = L["FOOD_INTELLECT"];
		["texture"] = "INV_Misc_Food_63";
		["noncombat"] = true,
	},
	["FOOD_MANAREGEN"] = {
		["description"] = L["FOOD_MANAREGEN"];
		["texture"] = "INV_Drink_17";
		["noncombat"] = true,
	},
	["FOOD_SPELL_DAMAGE"] = {
		["description"] = L["FOOD_SPELL_DAMAGE"];
		["texture"] = "INV_Misc_Food_65";
		["noncombat"] = true,
	},
	["FOOD_SPIRIT"] = {
		["description"] = L["FOOD_SPIRIT"];
		["texture"] = "INV_Misc_Fish_03";
		["noncombat"] = true,
	},
	["FOOD_STAMINA"] = {
		["description"] = L["FOOD_STAMINA"];
		["texture"] = "INV_Misc_Food_65";
		["noncombat"] = true,
	},
	["FOOD_STRENGTH"] = {
		["description"] = L["FOOD_STRENGTH"];
		["texture"] = "INV_Misc_Food_41";
		["noncombat"] = true,
	},
	["FOOD_OTHER"] = {
		["description"] = L["FOOD_OTHER"];
		["texture"] = "INV_Drink_17";
		["noncombat"] = true,
	},
	["FOOD_ARATHI"] = {
		["description"] = AUTOBAR_CLASS_FOOD_ARATHI;
		["texture"] = "INV_Misc_Food_33";
		["noncombat"] = true,
		["location"] = AUTOBAR_ARATHIBASIN;
	},
	["FOOD_WARSONG"] = {
		["description"] = AUTOBAR_CLASS_FOOD_WARSONG;
		["texture"] = "INV_Misc_Food_33";
		["noncombat"] = true,
		["location"] = AUTOBAR_WARSONGGULCH;
	},
	--------------
	["SHARPENINGSTONES"] = {
		["description"] = AUTOBAR_CLASS_SHARPENINGSTONES;
		["texture"] = "INV_Stone_SharpeningStone_01";
		["targetted"] = "WEAPON";
	},
	["WEIGHTSTONES"] = {
		["description"] = AUTOBAR_CLASS_WEIGHTSTONE;
		["texture"] = "INV_Stone_WeightStone_02";
		["targetted"] = "WEAPON";
	},
	["BUFF_CHEST"] = {
		["description"] = AUTOBAR_CLASS_BUFF_CHEST;
		["texture"] = "INV_Misc_Rune_10";
		["targetted"] = "CHEST";
	},
	["BUFF_SHIELD"] = {
		["description"] = AUTOBAR_CLASS_BUFF_SHIELD;
		["texture"] = "INV_Misc_Rune_13";
		["targetted"] = "SHIELD";
	},
	--------------
	["POISON-CRIPPLING"] = {
		["description"] = AUTOBAR_CLASS_POISON_CRIPPLING;
		["texture"] = "INV_Potion_19";
		["targetted"] = "WEAPON";
	},
	["POISON-DEADLY"] = {
		["description"] = AUTOBAR_CLASS_POISON_DEADLY;
		["texture"] = "Ability_Rogue_DualWeild";
		["targetted"] = "WEAPON";
	},
	["POISON-INSTANT"] = {
		["description"] = AUTOBAR_CLASS_POISON_INSTANT;
		["texture"] = "Ability_Poisons";
		["targetted"] = "WEAPON";
	},
	["POISON-MINDNUMBING"] = {
		["description"] = AUTOBAR_CLASS_POISON_MINDNUMBING;
		["texture"] = "Spell_Nature_NullifyDisease";
		["targetted"] = "WEAPON";
	},
	["POISON-WOUND"] = {
		["description"] = AUTOBAR_CLASS_POISON_WOUND;
		["texture"] = "Ability_PoisonSting";
		["targetted"] = "WEAPON";
	},
	--------------
	["EXPLOSIVES"] = {
		["description"] = AUTOBAR_CLASS_EXPLOSIVES;
		["texture"] = "INV_Misc_Bomb_08";
		["noselfcast"] = true;	--TODO: add this
		["targetted"] = true;
	},
	--------------
	["MOUNTS"] = {
		["description"] = AUTOBAR_CLASS_MOUNTS;
		["texture"] = "Ability_Mount_JungleTiger";
		["noncombat"] = true,
		["arrangeOnUse"] = true,
	},
	["MOUNTS_SUMMONED"] = {
		["description"] = AUTOBAR_CLASS_MOUNTS_SUMMONED;
		["texture"] = "Ability_Mount_JungleTiger";
		["noncombat"] = true,
		["arrangeOnUse"] = true,
		["spell"] = true,
		["castList"] = {"PALADIN", BS["Summon Charger"], "WARLOCK", BS["Summon Dreadsteed"], "DRUID", BS["Travel Form"], "DRUID", BS["Flight Form"], "SHAMAN", BS["Ghost Wolf"],},
	},
	["MOUNTS_QIRAJI"] = {
		["description"] = AUTOBAR_CLASS_MOUNTS_QIRAJI;
		["texture"] = "INV_Misc_QirajiCrystal_05";
		["noncombat"] = true,
		["arrangeOnUse"] = true,
		["location"] = AUTOBAR_AHN_QIRAJ;
	},
	["MOUNTS_FLYING"] = {
		["description"] = AUTOBAR_CLASS_MOUNTS_FLYING;
		["texture"] = "Ability_Mount_Wyvern_01";
		["noncombat"] = true,
		["arrangeOnUse"] = true,
--		["location"] = AUTOBAR_OUTLAND;  TODO: can fly check
	},
	--------------
	["OIL_MANA"] = {
		["texture"] = "INV_Potion_100";
		["targetted"] = "WEAPON";
		["description"] = AUTOBAR_CLASS_MANA_OIL;
	},
	["OIL_WIZARD"] = {
		["texture"] = "INV_Potion_105";
		["targetted"] = "WEAPON";
		["description"] = AUTOBAR_CLASS_WIZARD_OIL;
	},
};

-- /dump AutoBar_Category_Info["MOUNTS_SUMMONED"]
