local MAJOR_VERSION = "ItemBonusLib-1.0"
local MINOR_VERSION = "$Revision: 30451 $"

if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end

if not AceLibrary:HasInstance("AceLocale-2.2") then error(MAJOR_VERSION .. " requires AceLocale-2.2") end
if not AceLibrary:HasInstance("Gratuity-2.0") then error(MAJOR_VERSION .. " requires Gratuity-2.0") end
if not AceLibrary:HasInstance("Deformat-2.0") then error(MAJOR_VERSION .. " requires Deformat-2.0") end

local DEBUG = false

local GetBonus, GetFriendlyBonus
do
	local CombatRatingMap = {
		CR_WEAPON = 2.5,
		CR_WEAPON_DAGGER = 2.5,
		CR_WEAPON_SWORD = 2.5,
		CR_WEAPON_SWORD_2H = 2.5,
		CR_WEAPON_AXE = 2.5,
		CR_WEAPON_AXE_2H = 2.5,
		CR_WEAPON_MACE = 2.5,
		CR_WEAPON_MACE_2H = 2.5,
		CR_WEAPON_BOW = 2.5,
		CR_WEAPON_XBOW = 2.5,
		CR_WEAPON_GUN = 2.5,
		CR_WEAPON_UNARMED = 2.5,
		CR_WEAPON_STAFF = 2.5,
		CR_WEAPON_POLEARM = 2.5,

		CR_DEFENSE = 1.5,
		CR_DODGE = 12,
		CR_PARRY = 20,
		CR_BLOCK = 5,
		CR_HIT = 10,
		CR_CRIT = 14,
		CR_RANGEDHIT = 10,
		CR_HASTE = 10,
		CR_SPELLHIT = 8,
		CR_SPELLCRIT = 14,
		CR_SPELLHASTE = 10,
		CR_RESILIENCE = 25,
		CR_RANGEDHASTE = 10,
	}

	local BonusRatingMap = {
		DEFENSE = "CR_DEFENSE",
		DODGE = "CR_DODGE",
		PARRY = "CR_PARRY",
		TOHIT = "CR_HIT",
		CRIT = "CR_CRIT",
		SPELLTOHIT = "CR_SPELLHIT",
		SPELLCRIT = "CR_SPELLCRIT",
		BLOCK = "CR_BLOCK",
	}

	local InverseBonusRatingMap = {}
	for k, v in pairs(BonusRatingMap) do
		InverseBonusRatingMap[v] = k
	end

	--[[
	The following calculations are based on Whitetooth's calculations:
	http://www.wowinterface.com/downloads/info5819-Rating_Buster.html
	]]
	local function GetRatingMultiplier(level)
		level = level or UnitLevel("player")
		if level < 9 then
			return 52
		elseif level <= 60 then
			return 52 / (level - 8)
		elseif level <= 70 then
			-- return 1 - (level - 60) * 3 / 82
			return 3.1951219512195124 - 0.036585365853658534 * level
		end
	end

	local function GetRatingBonus(type, value, level)
		local F = CombatRatingMap[type]
		if not F then
			return nil
		end
		return value / F * GetRatingMultiplier(level)
	end

	function GetBonus(type, map, level)
		local value = map[type]
		if not value then
			local rating = BonusRatingMap[type]
			if rating then
				value = map[rating]
				if value then
					value = GetRatingBonus(rating, value, level)
				end
			end
		end
		return value or 0
	end

	function GetFriendlyBonus(type, map, level)
		local rev = InverseBonusRatingMap[type]
		if not rev then
			return type, map[type]
		end
		return rev, GetRatingBonus(type, map[type], level)
	end
end

local ItemBonusLib = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceConsole-2.0", "AceDebug-2.0")
ItemBonusLib:SetDebugging(DEBUG)

local Gratuity = AceLibrary("Gratuity-2.0")
local Deformat = AceLibrary("Deformat-2.0")

local CHAT_COMMANDS = { "/ibonus" }
local ABOUT_ADDON = "An addon to get information about bonus from equipped items"
local SHOW_CMD = "show"
local SHOW_ABOUT = "Show all bonuses from the current equipment"
local SHOW_INFO = "Current equipment bonuses:"
local DETAILS_CMD = "details"
local DETAILS_ABOUT = "Shows bonuses with slot distribution"
local DETAILS_INFO = "Current equipment bonus details:"
local ITEM_CMD = "item"
local ITEM_ABOUT = "show bonuses of given itemlink"
local ITEM_USAGE = "<itemlink>"
local ITEM_INFO = "Bonuses for %s:"
local ITEM_SET = "Item is part of set [%s]"
local SET_BONUS = " %sBonus for %d pieces :"
local SLOT_CMD = "slot"
local SLOT_ABOUT = "show bonuses of given slot"
local SLOT_USAGE = "<slotname>"
local SLOT_INFO = "Bonuses of slot %s:"
local INSPECT_CMD = "inspect"
local INSPECT_ABOUT = "show bonuses of the equipment of the given unit (must be able to inspect the unit)"
local INSPECT_USAGE = "<unit>"
local INSPECT_ERROR = "Unable to inspect unit \"%s\""
local INSPECT_INFO = "Bonuses of \"%s\":"
local L
do
	local locale = GetLocale()
	if locale == "frFR" then
		-- CHAT_COMMANDS = { "/ibonus" }
		ABOUT_ADDON = "Un addon pour obtenir les bonus concernant les items équipés"
		-- SHOW_CMD = "show"
		SHOW_ABOUT = "Afficher tous les bonus de l'équipement actuel"
		SHOW_INFO = "Bonus de l'équipement actuel :"
		-- DETAILS_CMD = "details"
		DETAILS_ABOUT = "Afficher les détails des bonus par emplacement d'inventaire"
		DETAILS_INFO = "Détails des bonus de l'équipement :"
		-- ITEM_CMD = "item"
		 ITEM_ABOUT = "Afficher les bonus détectés sur l'objet donnée"
		-- ITEM_USAGE = "<itemlink>"
		ITEM_INFO = "Bonus de %s :"
		ITEM_SET = "L'objet fait partie du set [%s]"
		SET_BONUS = " %sBonus pour %d pièces :"
		-- SLOT_CMD = "slot"
		SLOT_ABOUT = "Afficher les bonus de l'emplacement spécifié"
		SLOT_USAGE = "<emplacement>"
		SLOT_INFO = "Bonus de l'emplacement %s:"
		-- INSPECT_CMD = "inspect"
		INSPECT_ABOUT = "Afficher les bonus de l'équipement de l'unité donnée (vous devez être en mesure d'inspecter l'unité"
		INSPECT_USAGE = "<unité>"
		INSPECT_ERROR = "Impossible d'inspecter l'unité \"%s\""
		INSPECT_INFO = "Bonus de \"%s\" :"
	elseif locale == "deDE" then
		 -- CHAT_COMMANDS = { "/ibonus" }
		 -- ABOUT_ADDON = "An addon to get information about bonus from equipped items"
		 -- SHOW_CMD = "show"
		 -- SHOW_ABOUT = "Show all bonuses from the current equipment"
		 -- SHOW_INFO = "Current equipment bonuses:"
		 -- DETAILS_CMD = "details"
		 -- DETAILS_ABOUT = "Shows bonuses with slot distribution"
		 -- DETAILS_INFO = "Current equipment bonus details:"
		 -- ITEM_CMD = "item"
		 -- ITEM_ABOUT = "show bonuses of given itemlink"
		 -- ITEM_USAGE = "<itemlink>"
		 -- ITEM_INFO = "Bonuses for %s:"
		 -- ITEM_SET = "Item is part of set [%s]"
		 -- SET_BONUS = " %sBonus for %d pieces :"
		 -- SLOT_CMD = "slot"
		 -- SLOT_ABOUT = "show bonuses of given slot"
		 -- SLOT_USAGE = "<slotname>"
		 -- SLOT_INFO = "Bonuses of slot %s:"
		 -- INSPECT_CMD = "inspect"
		 -- INSPECT_ABOUT = "show bonuses of the equipment of the given unit (must be able to inspect the unit)"
		 -- INSPECT_USAGE = "<unit>"
		 -- INSPECT_ERROR = "Unable to scan unit \"%s\""
		 -- INSPECT_INFO = "Bonuses of \"%s\":"
	elseif locale == "koKR" then
		ABOUT_ADDON = "착용 장비의 보너스 효과에 대한 정보를 작성하는 애드온입니다"
		SHOW_CMD = "표시"
		SHOW_ABOUT = "현재 착용 장비의 모든 보너스 표시"
		SHOW_INFO = "현재 착용 장비 보너스:"
		DETAILS_CMD = "상세정보"
		DETAILS_ABOUT = "슬롯 부위별 보너스를 표시합니다"
		DETAILS_INFO = "현재 착용 보너스 상세정보:"
		ITEM_CMD = "아이템"
		ITEM_ABOUT = "주어진 아이템 링크에 대한 보너스를 표시합니다."
		ITEM_USAGE = "<아이템링크>"
		ITEM_INFO = "%s의 보너스 효과:"
		ITEM_SET = "[%s] 세트의 부분 아이템"
		SET_BONUS = "%d 피스 %s 보너스 효과"
		SLOT_CMD = "슬롯"
		SLOT_ABOUT = "주어진 슬롯에 대한 보너스 효과 표시"
		SLOT_USAGE = "<슬롯명칭>"
		SLOT_INFO = "%s 슬롯의 보너스 효과:"
		INSPECT_CMD = "살펴보기"
		INSPECT_ABOUT = "주어진 대상의 장비에 대한 보너스 효과 표시(대상 살펴보기가 가능해야 합니다)"
		INSPECT_USAGE = "<대상>"
		INSPECT_ERROR = "\"%s\" 대상을 조사할 수 없습니다."
		INSPECT_INFO = "\"%s\"의 보너스 효과:"
	end
end

-- bonuses[BONUS] = VALUE
local bonuses = {}

-- details[BONUS][SLOT] = VALUE
local details = {}

-- items[LINK].bonuses[BONUS] = VALUE
-- items[LINK].set = SETNAME
-- items[LINK].set_line = number
local items = {}

-- sets[SETNAME].bonuses[NUM][BONUS] = VALUE
-- sets[SETNAME].scan_count = COUNT
-- sets[SETNAME].scan_bonuses = COUNT
local sets = {}

local slots = {
	["Head"] = true,
	["Neck"] = true,
	["Shoulder"] = true,
	["Shirt"] = true,
	["Chest"] = true,
	["Waist"] = true,
	["Legs"] = true,
	["Feet"] = true,
	["Wrist"] = true,
	["Hands"] = true,
	["Finger0"] = true,
	["Finger1"] = true,
	["Trinket0"] = true,
	["Trinket1"] = true,
	["Back"] = true,
	["MainHand"] = true,
	["SecondaryHand"] = true,
	["Ranged"] = true,
	["Tabard"] = true,
}

function ItemBonusLib:OnInitialize()
	self:RegisterEvent("PLAYER_ENTERING_WORLD")
	self:RegisterEvent("PLAYER_LEAVING_WORLD")
	for s in pairs(slots) do
		slots[s] = GetInventorySlotInfo (s.."Slot")
	end

	local options = {
		type = "group",
		desc = ABOUT_ADDON,
		args = {
			show = {
				type = "execute",
				name = SHOW_CMD,
				desc = SHOW_ABOUT,
				func = function ()
					self:Print(SHOW_INFO)
					for bonus in pairs(bonuses) do
						local type, value = GetFriendlyBonus(bonus, bonuses)
						self:Print("%s : %f", self:GetBonusFriendlyName(type), value)
					end
				end
			},
			details = {
				type = "execute",
				name = DETAILS_CMD,
				desc = DETAILS_ABOUT,
				func = function ()
					self:Print(DETAILS_INFO)
					for bonus, detail in pairs(details) do
						local s = {}
						for slot, value in pairs(detail) do
							table.insert(s, string.format("%s : %d", slot, value))
						end
						local type, value = GetFriendlyBonus(bonus, bonuses)
						if type ~= bonus then
							value = string.format("%s (%s : %d)", tostring(bonuses[bonus]), self:GetBonusFriendlyName(type), value)
						else
							value = tostring(bonuses[bonus])
						end
						self:Print("%s : %s (%s)", self:GetBonusFriendlyName(bonus), value, table.concat(s, ", "))
					end
				end
			},
			item = {
				type = "text",
				name = ITEM_CMD,
				desc = ITEM_ABOUT,
				usage = ITEM_USAGE,
				get = false,
				set = function (link)
					local info = self:ScanItemLink(link)
					self:Print(ITEM_INFO, link)
					for bonus, value in pairs(info.bonuses) do
						self:Print("%s : %d", self:GetBonusFriendlyName(bonus), value)
					end
					if info.set then
						self:Print(ITEM_SET, info.set)
						local set = sets[info.set]
						for number, bonuses in pairs(set.bonuses) do
							local has_bonus = number <= set.count and "*" or " "
							self:Print(SET_BONUS, has_bonus, number)
							for bonus, value in pairs(bonuses) do
								self:Print(" %s : %d", self:GetBonusFriendlyName(bonus), value)
							end
						end
					end
				end
			},
			slot = {
				type = "text",
				name = SLOT_CMD,
				desc = SLOT_ABOUT,
				usage = SLOT_USAGE,
				get = false,
				set = function (slot)
					self:Print(SLOT_INFO, slot)
					for bonus, detail in pairs(details) do
						if detail[slot] then
							self:Print("%s : %d", self:GetBonusFriendlyName(bonus), detail[slot])
						end
					end
				end
			},
			inspect = {
				type = "text",
				name = INSPECT_CMD,
				desc = INSPECT_ABOUT,
				usage = INSPECT_USAGE,
				get = false,
				set = function (unit)
					local eq = self:GetUnitEquipment(unit)
					if not eq then
						self:Print(string.format(INSPECT_ERROR, unit))
						return
					end
					local b = self:MergeDetails(self:BuildBonusSet(eq))
					local n = UnitName(unit)
					local level = UnitLevel(unit)
					if n then
						n = string.format("|Hplayer:%s|h[%s]|h", n, n)
					else
						n = unit
					end
					self:Print(string.format(INSPECT_INFO, n))
					for bonus in pairs(b) do
						local type, value = GetFriendlyBonus(bonus, b, level)
						self:Print("%s : %d", self:GetBonusFriendlyName(type), value)
					end
				end
			},
		},
	}

	self:RegisterChatCommand(CHAT_COMMANDS, options)

end

function ItemBonusLib:PLAYER_ENTERING_WORLD()
	self:RegisterBucketEvent("UNIT_INVENTORY_CHANGED", 0.5)
	self:ScheduleEvent(function() self:ScanEquipment() end, 1)
end

function ItemBonusLib:PLAYER_LEAVING_WORLD()
	self:UnregisterBucketEvent("UNIT_INVENTORY_CHANGED")
end

function ItemBonusLib:UNIT_INVENTORY_CHANGED(units)
	if units.player then
		self:ScanEquipment()
	end
end

local cleanItemLink
do -- AddValue & line scanning
	local strstrim = strtrim
	local trim = function (str)
		return strstrim (str, "\t \194\160"):gsub("%.$", "")
	end

	local equip = ITEM_SPELL_TRIGGER_ONEQUIP
	local l_equip = equip:len()

	function cleanItemLink(itemLink)
		local _, _, link = itemLink:find("|H(item[%d:]*)|")
		return link or itemLink
	end

	function ItemBonusLib:AddValue(bonuses, effect, value)
		if type(effect) == "string" then
			bonuses[effect] = (bonuses[effect] or 0) + value
		elseif type(value) == "table" then
			for i, e in ipairs(effect) do
				self:AddValue (bonuses, e, value[i])
			end
		else
			for _, e in ipairs(effect) do
				self:AddValue (bonuses, e, value)
			end
		end
	end

	function ItemBonusLib:CheckPassive(bonuses, line)
		for _, p in pairs(L.PATTERNS_PASSIVE) do
			local _, _, value1, value2 = line:find (p.pattern)
			if value1 then
				if value2 and type(p.effect) == "table" then
					self:AddValue (bonuses, p.effect[1], value1)
					self:AddValue (bonuses, p.effect[2], value2)
				else
					self:AddValue (bonuses, p.effect, value1)
				end
				return true
			end
		end
	end

	function ItemBonusLib:CheckToken(bonuses, token, value)
		local t = L.PATTERNS_GENERIC_LOOKUP[token]
		if t then
			self:AddValue (bonuses, t, value)
			return true
		else
			local s1, s2

			for _, p in ipairs(L.PATTERNS_GENERIC_STAGE1) do
				if token:find (p.pattern, 1, 1) then
					s1 = p.effect
					break
				end
			end
			for _, p in ipairs(L.PATTERNS_GENERIC_STAGE2) do
				if token:find(p.pattern, 1, 1) then
					s2 = p.effect
					break
				end
			end
			if s1 and s2 then
				self:AddValue (bonuses, s1..s2, value)
				return true
			end
		end
		self:Debug("CheckToken failed for \"%s\" (%d)", token, value)
	end

	function ItemBonusLib:CheckSingleGeneric(bonuses, line)
		line = trim (line)

		local _, _, value, token = line:find("^%+?(%d+)%%?(.*)$")
		if not value then
			_, _, token, value = line:find("^(.*)%+(%d+)%%?$")
			if not token then
				_, _, token, value = line:find("^(.*): ?(%d+)$")
			end
		end
		if token and value then
			token = trim (token)
			if self:CheckToken (bonuses, token, value) then
				return true
			end
		end
	end

	function ItemBonusLib:CheckGeneric(bonuses, line)
		local found

		while line:len() > 0 do
			local tmpStr
			for _, sep in ipairs(L.SEPARATORS) do
				local lstart, lend  = line:find(sep, 1, true)
				if lstart then
					tmpStr = line:sub(1, lstart - 1)
					line = line:sub(lend + 1)
					break
				end
			end
			if tmpStr then
				found = self:CheckSingleGeneric(bonuses, tmpStr) or found
			else
				found = self:CheckSingleGeneric(bonuses, line) or found
				break
			end
		end
		return found
	end

	function ItemBonusLib:CheckOther(bonuses, line)
		for _, p in ipairs(L.PATTERNS_OTHER) do
			local start, _, value = line:find ("^" .. p.pattern)
			if start then
				if p.value then
					self:AddValue(bonuses, p.effect, p.value)
				elseif value then
					self:AddValue (bonuses, p.effect, value)
				end
				return true
			end
		end
	end

	function ItemBonusLib:AddBonusInfo(bonuses, line)
		local found
		line = strtrim(line)
		if line:sub(0, 2) == "|c" then
			-- fix for white enchants
			line = strtrim(line:sub(11, -3))
		end
		if line:sub(0, l_equip) == equip then
			line = strtrim(line:sub(l_equip + 2))
		end
		found = self:CheckPassive (bonuses, line)
		if not found then
			found = self:CheckGeneric(bonuses, line)
			if not found then
				found = self:CheckOther(bonuses, line)
				if not found then
					self:Debug("Unmatched bonus line \"%s\"", line)
				end
			end
		end
	end
end

do -- Item scanning
	local ITEM_SET_NAME = ITEM_SET_NAME
	local ITEM_SET_BONUS = ITEM_SET_BONUS
	local ITEM_SET_BONUS_GRAY = ITEM_SET_BONUS_GRAY
	local ITEM_SOCKET_BONUS = ITEM_SOCKET_BONUS
	local DAMAGE_TEMPLATE_WITH_SCHOOL = DAMAGE_TEMPLATE_WITH_SCHOOL

	function ItemBonusLib:ScanItemLink(link)
		link = cleanItemLink(link)
		local info = items[link]
		local scan_set
		local set_name, set_count, set_total
		if not info then
			info = { bonuses = {} }
			Gratuity:SetHyperlink(link)
			for i = 2, Gratuity:NumLines() do
				local line = Gratuity:GetLine(i)
				set_name, set_count, set_total = Deformat(line, ITEM_SET_NAME)
				if set_name then
					info.set = set_name
					info.set_line = i
					local set = sets[set_name]
					if not set or set.scan_count > set_count and set.scan_bonuses > 1 then
						scan_set = true
					end
					break
				end
				local bonus = Deformat(line, ITEM_SOCKET_BONUS)
				if bonus then
					-- evil hack, I need to check the color of the string to know
					-- if the bonus is active or not.
					local frame = Gratuity.vars.Llines[i]
					local r, g, b = frame:GetTextColor()
					self:Debug("Found Gem Bonus line \"%s\" : color = %f, %f, %f", bonus, r, g, b)
					if r <= 0.1 and g >= 0.9 and b <= 0.1 then
						self:AddBonusInfo(info.bonuses, bonus)
					end
				else
					if not Deformat(line, DAMAGE_TEMPLATE_WITH_SCHOOL) then
						self:AddBonusInfo(info.bonuses, line)
					end
				end
			end
			items[link] = info
		elseif info.set then
			Gratuity:SetHyperlink(link)
			set_name, set_count, set_total = Deformat(Gratuity:GetLine(info.set_line), ITEM_SET_NAME)
			local set = sets[set_name]
			if set.scan_count > set_count and set.scan_bonuses > 1 then
				scan_set = true
			end
		end
		if scan_set then
			self:Debug("Scanning set \"%s\"", set_name)
			local set = { count = 0, bonuses = {}, scan_count = set_count, scan_bonuses = 0 }
			for i = info.set_line + set_total + 2, Gratuity:NumLines() do
				local line = Gratuity:GetLine(i)
				local count, bonus
				local bonus = Deformat(line, ITEM_SET_BONUS)
				if bonus then
					set.scan_bonuses = set.scan_bonuses + 1
					count = set_count
				else
					count, bonus = Deformat(line, ITEM_SET_BONUS_GRAY)
				end
				if not bonus then
					self:Debug("Invalid set line \"%s\"", line)
					-- break
				else
					local bonuses = set.bonuses[count] or {}
					self:AddBonusInfo(bonuses, bonus, true)
					set.bonuses[count] = bonuses
				end
			end
			sets[set_name] = set
		end
		return info
	end
end

function ItemBonusLib:GetUnitEquipment(unit)
	local inspect
	if unit ~= "player" then
		if not CheckInteractDistance(unit, 1) or
				not CanInspect(unit, true) then
			return nil
		end
		HideUIPanel(InspectFrame)
		NotifyInspect(unit)
		inspect = true
	end
	local eq = {}
	for slot, id in pairs(slots) do
		eq[slot] = GetInventoryItemLink(unit, id)
	end
	if inspect then
		ClearInspectPlayer()
	end
	return eq
end

local function mergeBonusTable(result, operand)
	for k, v in pairs(operand) do
		result[k] = (result[k] or 0) + v
	end
end

function ItemBonusLib:BuildBonusSet(eq)
	local details = {}
	local set_count = {}
	for slot, link in pairs(eq) do
		local info = self:ScanItemLink(link)
		local set = info.set
		if set then
			set_count[set] = (set_count[set] or 0) + 1
		end
		for bonus, value in pairs(info.bonuses) do
			local b = details[bonus]
			if not b then
				b = {}
				details[bonus] = b
			end
			b[slot] = value
		end
	end
	for set, count in pairs(set_count) do
		local info = sets[set]
		for i = 2, count do
			local bonuses = info.bonuses[i]
			if bonuses then
				for bonus, value in pairs(bonuses) do
					local b = details[bonus]
					if not b then
						b = {}
						details[bonus] = b
					end
					b.Set = (b.Set or 0) + value
				end
			end
		end
	end
	return details
end

function ItemBonusLib:MergeDetails(details)
	local bonuses = {}
	for bonus, slots in pairs(details) do
		for slot, value in pairs(slots) do
			bonuses[bonus] = (bonuses[bonus] or 0) + value
		end
	end
	return bonuses
end

function ItemBonusLib:ScanEquipment()
	local eq = self:GetUnitEquipment("player")
	details = self:BuildBonusSet(eq)
	bonuses = self:MergeDetails(details)

	self:TriggerEvent("ItemBonusLib_Update")
end

-- DEBUG
if DEBUG then
	ItemBonusLib.patterns = L

	if DevTools_Dump then
		function ItemBonusLib:DumpCachedItems(clear)
			DevTools_Dump(items)
		end

		function ItemBonusLib:DumpCachedSets(clear)
			DevTools_Dump(sets)
		end

		function ItemBonusLib:DumpBonuses()
			DevTools_Dump(bonuses)
		end

		function ItemBonusLib:DumpDetails()
			DevTools_Dump(details)
		end
	end

	function ItemBonusLib:Reload()
		items = {}
		sets = {}
		self:ScanEquipment()
	end
end

function ItemBonusLib:GetSetBonuses(set)
	local info = sets[set]
	if info then
		return info.bonuses
	end
end

-- BonusScanner compatible API
function ItemBonusLib:GetBonus(bonus)
	return GetBonus(bonus, bonuses)
end

function ItemBonusLib:GetSlotBonuses (slotname)
	local bonuses = {}
	for bonus, detail in pairs(details) do
		if detail[slotname] then
			bonuses[bonus] = detail[slotname]
		end
	end
	return bonuses
end

function ItemBonusLib:GetBonusDetails (bonus)
	return details[bonus] or {}
end

function ItemBonusLib:GetSlotBonus (bonus, slotname)
	local detail = details[bonus]
	return detail and detail[slotname] or 0
end

function ItemBonusLib:GetBonusFriendlyName (bonus)
	return L.NAMES[bonus] or bonus
end

function ItemBonusLib:IsActive ()
	return true
end

function ItemBonusLib:ScanItem (itemlink, excludeSet)
	if not excludeSet then
		self:error("excludeSet can't be false on BonusScanner compatible API")
	end
	local name, link = GetItemInfo(itemlink)
	if not name then
		return
	end
	return self:ScanItemLink(link).bonuses
end

function ItemBonusLib:ScanTooltipFrame (frame, excludeSet)
	self:error("BonusScanner:ScanTooltipFrame() is not available")
end

AceLibrary:Register(ItemBonusLib, MAJOR_VERSION, MINOR_VERSION)


do -- localisation of regexp
	local ALL_RESISTS = {"ARCANERES", "FIRERES", "FROSTRES", "NATURERES", "SHADOWRES"}
	local ALL_STATS = {"STR", "AGI", "STA", "INT", "SPI"}
	local HEAL_AND_DMG = {"HEAL", "DMG"}
	local locale = GetLocale()
	if locale == "enUS" or locale == "enGB" then
		L = {
			NAMES = {
				STR = "Strength",
				AGI = "Agility",
				STA = "Stamina",
				INT = "Intellect",
				SPI = "Spirit",
				ARMOR = "Reinforced Armor",

				ARCANERES = "Arcane Resistance",
				FIRERES = "Fire Resistance",
				NATURERES = "Nature Resistance",
				FROSTRES = "Frost Resistance",
				SHADOWRES = "Shadow Resistance",

				FISHING = "Fishing",
				MINING = "Mining",
				HERBALISM = "Herbalism",
				SKINNING = "Skinning",
				DEFENSE = "Defense",

				BLOCK = "Chance to Block",
				BLOCKVALUE = "Block value",
				DODGE = "Dodge",
				PARRY = "Parry",
				ATTACKPOWER = "Attack Power",
				ATTACKPOWERUNDEAD = "Attack Power against Undead",
				ATTACKPOWERFERAL = "Attack Power in feral form",
				CRIT = "Crit. hits",
				RANGEDATTACKPOWER = "Ranged Attack Power",
				RANGEDCRIT = "Crit. Shots",
				TOHIT = "Chance to Hit",

				DMG = "Spell Damage",
				DMGUNDEAD = "Spell Damage against Undead",
				ARCANEDMG = "Arcane Damage",
				FIREDMG = "Fire Damage",
				FROSTDMG = "Frost Damage",
				HOLYDMG = "Holy Damage",
				NATUREDMG = "Nature Damage",
				SHADOWDMG = "Shadow Damage",
				SPELLCRIT = "Crit. Spell",
				SPELLTOHIT = "Chance to Hit with spells",
				SPELLPEN = "Spell Penetration",
				HEAL = "Healing",
				HOLYCRIT = "Crit. Holy Spell",

				HEALTHREG = "Life Regeneration",
				MANAREG = "Mana Regeneration",
				HEALTH = "Life Points",
				MANA = "Mana Points",

				CR_WEAPON = "Weapon rating",
				CR_DEFENSE = "Defense rating",
				CR_DODGE = "Dodge rating",
				CR_PARRY = "Parry rating",
				CR_BLOCK = "Block rating",
				CR_HIT = "Hit rating",
				CR_CRIT = "Critical strike rating",
				CR_HASTE = "Haste rating",
				CR_SPELLHIT = "Hit with spell rating",
				CR_SPELLCRIT = "Critical strike with spell rating",
				CR_SPELLHASTE = "Spell haste rating",
				CR_RESILIENCE = "Resilience",
				CR_WEAPON_AXE = "Axe skill rating",
				CR_WEAPON_DAGGER = "Dagger skill rating",
				CR_WEAPON_MACE = "Mace skill rating",
				CR_WEAPON_SWORD = "Sword skill rating",
				CR_WEAPON_SWORD_2H = "Two-Handed Swords skill rating"
			},


			PATTERNS_PASSIVE = {
				{ pattern = "+(%d+) ranged Attack Power%.", effect = "RANGEDATTACKPOWER" },
				{ pattern = "Increases your chance to block attacks with a shield by (%d+)%%%.", effect = "BLOCK" },
				{ pattern = "Increases the block value of your shield by (%d+)%.", effect = "BLOCKVALUE" },
				{ pattern = "Increases your chance to dodge an attack by (%d+)%%%.", effect = "DODGE" },
				{ pattern = "Increases your chance to parry an attack by (%d+)%%%.", effect = "PARRY" },
				{ pattern = "Improves your chance to get a critical strike with spells by (%d+)%%%.", effect = "SPELLCRIT" },
				{ pattern = "Improves your chance to get a critical strike with Holy spells by (%d+)%%%.", effect = "HOLYCRIT" },
				{ pattern = "Increases the critical effect chance of your Holy spells by (%d+)%%%.", effect = "HOLYCRIT" },
				{ pattern = "Improves your chance to get a critical strike by (%d+)%%%.", effect = "CRIT" },
				{ pattern = "Improves your chance to get a critical strike with missile weapons by (%d+)%%%.", effect = "RANGEDCRIT" },
				{ pattern = "Increases damage done by Arcane spells and effects by up to (%d+)%.", effect = "ARCANEDMG" },
				{ pattern = "Increases damage done by Fire spells and effects by up to (%d+)%.", effect = "FIREDMG" },
				{ pattern = "Increases damage done by Frost spells and effects by up to (%d+)%.", effect = "FROSTDMG" },
				{ pattern = "Increases damage done by Holy spells and effects by up to (%d+)%.", effect = "HOLYDMG" },
				{ pattern = "Increases damage done by Nature spells and effects by up to (%d+)%.", effect = "NATUREDMG" },
				{ pattern = "Increases damage done by Shadow spells and effects by up to (%d+)%.", effect = "SHADOWDMG" },
				{ pattern = "Increases healing done by spells and effects by up to (%d+)%.", effect = "HEAL" },
				{ pattern = "Increases damage and healing done by magical spells and effects by up to (%d+)%.", effect = HEAL_AND_DMG },
				{ pattern = "Increases damage done to Undead by magical spells and effects by up to (%d+)%.", effect = "DMGUNDEAD", nofinish = true },
				{ pattern = "+(%d+) Attack Power when fighting Undead%.", effect = "ATTACKPOWERUNDEAD", nofinish = true },
				{ pattern = "Restores (%d+) health per 5 sec%.", effect = "HEALTHREG" },
				{ pattern = "Restores (%d+) health every 5 sec%.", effect = "HEALTHREG" }, -- both versions ('per' and 'every') seem to be used
				{ pattern = "Restores (%d+) mana per 5 sec%.", effect = "MANAREG" },
				{ pattern = "Restores (%d+) mana every 5 sec%.", effect = "MANAREG" },
				{ pattern = "Improves your chance to hit by (%d+)%%%.", effect = "TOHIT" },
				{ pattern = "Improves your chance to hit with spells by (%d+)%%%.", effect = "SPELLTOHIT" },
				{ pattern = "Decreases the magical resistances of your spell targets by (%d+)%.", effect = "SPELLPEN" },
				-- Atiesh related patterns
				{ pattern = "Increases your spell damage by up to (%d+) and your healing by up to (%d+)%.", effect = {"DMG", "HEAL"} },
				{ pattern = "Increases healing done by magical spells and effects of all party members within %d+ yards by up to (%d+)%.", effect = "HEAL" },
				{ pattern = "Increases damage and healing done by magical spells and effects of all party members within %d+ yards by up to (%d+)%.", effect = HEAL_AND_DMG },
				{ pattern = "Restores (%d+) mana per 5 seconds to all party members within %d+ yards%.", effect = "MANAREG" },
				{ pattern = "Increases the spell critical chance of all party members within %d+ yards by (%d+)%%%.", effect = "SPELLCRIT" },

				-- Added for HealPoints
				{ pattern = "Allows (%d+)%% of your Mana regeneration to continue while casting%.", effect = "CASTINGREG"},
				{ pattern = "Improves your chance to get a critical strike with Nature spells by (%d+)%%%.", effect = "NATURECRIT"},
				{ pattern = "Reduces the casting time of your Regrowth spell by 0%.(%d+) sec%.", effect = "CASTINGREGROWTH"},
				{ pattern = "Reduces the casting time of your Holy Light spell by 0%.(%d+) sec%.", effect = "CASTINGHOLYLIGHT"},
				{ pattern = "Reduces the casting time of your Healing Touch spell by 0%.(%d+) sec%.", effect = "CASTINGHEALINGTOUCH"},
				{ pattern = "%-0%.(%d+) sec to the casting time of your Flash Heal spell%.", effect = "CASTINGFLASHHEAL"},
				{ pattern = "%-0%.(%d+) seconds on the casting time of your Chain Heal spell%.", effect = "CASTINGCHAINHEAL"},
				{ pattern = "Increases the duration of your Rejuvenation spell by (%d+) sec%.", effect = "DURATIONREJUV"},
				{ pattern = "Increases the duration of your Renew spell by (%d+) sec%.", effect = "DURATIONRENEW"},
				{ pattern = "Increases your normal health and mana regeneration by (%d+)%.", effect = "MANAREGNORMAL"},
				{ pattern = "Increases the amount healed by Chain Heal to targets beyond the first by (%d+)%%%.", effect = "IMPCHAINHEAL"},
				{ pattern = "Increases healing done by Rejuvenation by up to (%d+)%.", effect = "IMPREJUVENATION"},
				{ pattern = "Increases healing done by Lesser Healing Wave by up to (%d+)%.", effect = "IMPLESSERHEALINGWAVE"},
				{ pattern = "Increases healing done by Flash of Light by up to (%d+)%.", effect = "IMPFLASHOFLIGHT"},
				{ pattern = "After casting your Healing Wave or Lesser Healing Wave spell%, gives you a 25%% chance to gain Mana equal to (%d+)%% of the base cost of the spell%.", effect = "REFUNDHEALINGWAVE"},
				{ pattern = "Your Healing Wave will now jump to additional nearby targets%. Each jump reduces the effectiveness of the heal by (%d+)%%%, and the spell will jump to up to two additional targets%.", effect = "JUMPHEALINGWAVE"},
				{ pattern = "Reduces the mana cost of your Healing Touch%, Regrowth%, Rejuvenation and Tranquility spells by (%d+)%%%.", effect = "CHEAPERDRUID"},
				{ pattern = "On Healing Touch critical hits%, you regain (%d+)%% of the mana cost of the spell%.", effect = "REFUNDHTCRIT"},
				{ pattern = "Reduces the mana cost of your Renew spell by (%d+)%%%.", effect = "CHEAPERRENEW"},

				-- Combat Rating
				{ pattern = "Increases your hit rating by (%d+)%.", effect = "CR_HIT" },
				{ pattern = "Increases your critical strike rating by (%d+)%.", effect = "CR_CRIT" },
				{ pattern = "Increases defense rating by (%d+)%.", effect = "CR_DEFENSE" },
				{ pattern = "Increases your spell critical strike rating by (%d+)%.", effect = "CR_SPELLCRIT" },
				{ pattern = "Improves your resilience rating by (%d+)%.", effect = "CR_RESILIENCE" },
				{ pattern = "Increases your spell hit rating by (%d+)%.", effect = "CR_SPELLHIT" },
				{ pattern = "Increases your dodge rating by (%d+)%.", effect = "CR_DODGE" },
				{ pattern = "Increases your block rating by (%d+)%.", effect = "CR_BLOCK" },
				{ pattern = "Increases your parry rating by (%d+)%.", effect = "CR_PARRY" },
				{ pattern = "Increases axe skill rating by (%d+)%.", effect = "CR_WEAPON_AXE" },
				{ pattern = "Increases dagger skill rating by (%d+)%.", effect = "CR_WEAPON_DAGGER" },
				{ pattern = "Increases mace skill rating by (%d+)%.", effect = "CR_WEAPON_MACE" },
				{ pattern = "Increases sword skill rating by (%d+)%.", effect = "CR_WEAPON_SWORD" },
				{ pattern = "Increases Two-Handed Swords skill rating by (%d+)%.", effect = "CR_WEAPON_SWORD_2H" },

				-- Updated Patterns (in 2.0)
				{ pattern = "Increases your spell penetration by (%d+)%.", effect = "SPELLPEN" },
				{ pattern = "Increases attack power by (%d+)%.", effect = "ATTACKPOWER" },
				{ pattern = "Increases attack power by (%d+) in Cat, Bear, Dire Bear, and Moonkin forms only%.", effect = "ATTACKPOWERFERAL" },

				{ pattern = "Improves hit rating by (%d+)%.", effect = "CR_HIT" },
				{ pattern = "Improves critical strike rating by (%d+)%.", effect = "CR_CRIT" },
				{ pattern = "Improves spell critical strike rating by (%d+)%.", effect = "CR_SPELLCRIT" },
				{ pattern = "Increases your spell penetration by (%d+)%.", effect = "SPELLPEN" },
				{ pattern = "Improves spell hit rating by (%d+)%.", effect = "CR_SPELLHIT" },
				{ pattern = "Increases ranged attack power by (%d+)%.", effect = "RANGEDATTACKPOWER" },
			},

			SEPARATORS = { "/", ",", "&", " and " },
	
			PATTERNS_GENERIC_LOOKUP = {
				["All Stats"] = ALL_STATS,
				["Strength"] = "STR",
				["Agility"] = "AGI",
				["Stamina"] = "STA",
				["Intellect"] = "INT",
				["Spirit"] = "SPI",

				["All Resistances"] = ALL_RESISTS,

				["Fishing"] = "FISHING",
				["Fishing Lure"] = "FISHING",
				["Increased Fishing"] = "FISHING",
				["Mining"] = "MINING",
				["Herbalism"] = "HERBALISM",
				["Skinning"] = "SKINNING",
				["Defense"] = "DEFENSE",
				["Increased Defense"] = "DEFENSE",

				["Attack Power"] = "ATTACKPOWER",
				["Attack Power when fighting Undead"] = "ATTACKPOWERUNDEAD",
				["Attack Power in Cat, Bear, and Dire Bear forms only"] = "ATTACKPOWERFERAL",

				["Dodge"] = "DODGE",
				["Block"] = "BLOCK",
				["Block Value"] = "BLOCKVALUE",
				["Hit"] = "TOHIT",
				["Spell Hit"] = "SPELLTOHIT",
				["Blocking"] = "BLOCK",
				["Ranged Attack Power"] = "RANGEDATTACKPOWER",
				["health every 5 sec"] = "HEALTHREG",
				["Healing Spells"] = "HEAL",
				["Increases Healing"] = "HEAL",
				["Healing"] = "HEAL",
				["Healing and Spell Damage"] = HEAL_AND_DMG,
				["Damage and Healing Spells"] = HEAL_AND_DMG,
				["Spell Damage and Healing"] = HEAL_AND_DMG,
				["mana every 5 sec"] = "MANAREG",
				["Mana Regen"] = "MANAREG",
				["Spell Damage"] = HEAL_AND_DMG,
				["Critical"] = "CRIT",
				["Critical Hit"] = "CRIT",
				["Damage"] = "DMG",
				["Health"] = "HEALTH",
				["HP"] = "HEALTH",
				["Mana"] = "MANA",
				["Armor"] = "ARMOR",
				["Reinforced Armor"] = "ARMOR",
				["Resilience"] = "CR_RESILIENCE",
				["Spell Critical strike rating"] = "CR_SPELLCRIT",
				["Spell Penetration"] = "SPELLPEN",
				["Hit Rating"] = "CR_HIT",
				["Defense Rating"] = "CR_DEFENSE",
				["Resilience Rating"] = "CR_RESILIENCE",
				["Crit Rating"] = "CR_CRIT",
				["Critical Rating"] = "CR_CRIT",
				["Critical Strike Rating"] = "CR_CRIT",
				["Dodge Rating"] = "CR_DODGE",
				["Parry Rating"] = "CR_PARRY",
				["Spell Critical Strike Rating"] = "CR_SPELLCRIT",
				["Spell Critical Rating"] = "CR_SPELLCRIT",
				["Spell Crit Rating"] = "CR_SPELLCRIT",
				["Spell Hit Rating"] = "CR_SPELLHIT",
				["Mana every 5 Sec"] = "MANAREG",
				["Mana per 5 Seconds"] = "MANAREG",
				["Mana every 5 seconds"] = "MANAREG",
				["Mana Per 5 sec"] = "MANAREG",
				["healing Spells"] = "HEAL",
				["Melee Damage"] = "MELEEDMG",
				["Resist All"] = ALL_RESISTS,
			},

			PATTERNS_GENERIC_STAGE1 = {
				{ pattern = "Arcane", 	effect = "ARCANE" },
				{ pattern = "Fire", 	effect = "FIRE" },
				{ pattern = "Frost", 	effect = "FROST" },
				{ pattern = "Holy", 	effect = "HOLY" },
				{ pattern = "Shadow",	effect = "SHADOW" },
				{ pattern = "Nature", 	effect = "NATURE" }
			},

			PATTERNS_GENERIC_STAGE2 = {
				{ pattern = "Resist", 	effect = "RES" },
				{ pattern = "Damage", 	effect = "DMG" },
				{ pattern = "Effects", 	effect = "DMG" },
			},

			PATTERNS_OTHER = {
				{ pattern = "Reinforced %(%+(%d+) Armor%)", effect = "ARMOR" },
				{ pattern = "Mana Regen (%d+) per 5 sec%.", effect = "MANAREG" },

				{ pattern = "Minor Wizard Oil", effect = HEAL_AND_DMG, value = 8 },
				{ pattern = "Lesser Wizard Oil", effect = HEAL_AND_DMG, value = 16 },
				{ pattern = "Wizard Oil", effect = HEAL_AND_DMG, value = 24 },
				{ pattern = "Brilliant Wizard Oil", effect = {"DMG", "HEAL", "SPELLCRIT"}, value = {36, 36, 1} },

				{ pattern = "Minor Mana Oil", effect = "MANAREG", value = 4 },
				{ pattern = "Lesser Mana Oil", effect = "MANAREG", value = 8 },
				{ pattern = "Brilliant Mana Oil", effect = { "MANAREG", "HEAL"}, value = {12, 25} },

				{ pattern = "Eternium Line", effect = "FISHING", value = 5 },
				{ pattern = "Vitality", effect = {"MANAREG", "HEALTHREG"}, value = {4, 4} },
				{ pattern = "Soulfrost", effect = {"FROSTDMG", "SHADOWDMG"}, value = {54, 54} },
				{ pattern = "Sunfire", effect = {"ARCANEDMG", "FIREDMG"}, value = {50, 50} },
			},
		}
	elseif locale == "frFR" then
		L = {
			NAMES = {
				STR = "Force",
				AGI = "Agilité",
				STA = "Endurance",
				INT = "Intelligence",
				SPI = "Esprit",
				ARMOR = "Armure",

				ARCANERES = "Arcane",
				FIRERES = "Feu",
				NATURERES = "Nature",
				FROSTRES = "Givre",
				SHADOWRES = "Ombre",

				FISHING = "Pêche",
				MINING = "Minage",
				HERBALISM = "Herborisme",
				SKINNING = "Dépeçage",
				DEFENSE = "Défense",

				BLOCK = "Chance de Bloquer",
				BLOCKVALUE = "Valeur de blocage",
				DODGE = "Esquive",
				PARRY = "Parade",
				ATTACKPOWER = "Puissance d'attaque",
				ATTACKPOWERUNDEAD = "Puissance d'attaque contre les morts-vivants",
				ATTACKPOWERFERAL = "Puissance d'attaque en forme férale",
				CRIT = "Coups Critiques",
				RANGEDATTACKPOWER = "Puissance d'attaque à distance",
				RANGEDCRIT = "Tirs Critiques",
				TOHIT = "Chances de toucher",

				DMG = "Dégâts",
				DMGUNDEAD = "Dégâts des sorts contre les morts-vivants",
				ARCANEDMG = "Dégâts d'Arcanes",
				FIREDMG = "Dégâts de Feu",
				FROSTDMG = "Dégâts de Givre",
				HOLYDMG = "Dégâts Sacrés",
				NATUREDMG = "Dégâts de Nature",
				SHADOWDMG = "Dégâts des Ombres",
				SPELLCRIT = "Critiques",
				HEAL = "Soins",
				HOLYCRIT = "Soins Crit.",
				SPELLTOHIT = "Chance de toucher avec les sorts",
				SPELLPEN = "Diminue les résistances",

				HEALTHREG = "Régeneration Vie",
				MANAREG = "Régeneration Mana",
				HEALTH = "Points de Vie",
				MANA = "Points de Mana",

				CR_WEAPON = "Score d'arme",
				CR_DEFENSE = "Score de défense",
				CR_DODGE = "Score d'esquive",
				CR_PARRY = "Score de parade",
				CR_BLOCK = "Score de blocage",
				CR_HIT = "Score de toucher",
				CR_CRIT = "Score de coups critiques",
				-- CR_HASTE = "Score de vitesse",
				CR_SPELLHIT = "Score de toucher avec les sorts",
				CR_SPELLCRIT = "Score de coups critiques avec les sorts",
				-- CR_SPELLHASTE = "Score de vitesse avec les sorts",
				CR_RESILIENCE = "Résilience",

			},

			PATTERNS_PASSIVE = {
				{ pattern = "Augmente de (%d+) la puissance d'attaque%.", effect = "ATTACKPOWER" },
				{ pattern = "Augmente de (%d+) la puissance d'attaque lorsque vous combattez des morts%-vivants%.", effect = "ATTACKPOWERUNDEAD", nofinish = true },
				{ pattern = "Augmente la puissance des attaques à distance de (%d+)%.", effect = "RANGEDATTACKPOWER" },
				{ pattern = "Augmente vos chances de bloquer les attaques avec un bouclier de (%d+)%%%.", effect = "BLOCK" },
				{ pattern = "Augmente le score de blocage de votre bouclier de (%d+)%.", effect = "BLOCKVALUE" },
				{ pattern = "Augmente vos chances d'esquiver une attaque de (%d+)%%%.", effect = "DODGE" },
				{ pattern = "Augmente vos chances de parer une attaque de (%d+)%%%.", effect = "PARRY" },
				{ pattern = "Augmente vos chances d'infliger un coup critique avec vos sorts de (%d+)%%%.", effect = "SPELLCRIT" },
				{ pattern = "Augmente vos chances d'infliger un coup critique de (%d+)%%%.", effect = "CRIT" },
				{ pattern = "Augmente vos chances d'infliger un coup critique avec une arme à feu par (%d+)%%%.", effect = "RANGEDCRIT" },
				{ pattern = "Augmente vos chances de lancer un soin critique par (%d+)%%%.", effect = "HEALCRIT" },
				{ pattern = "Augmente les dégâts infligés par les effets et les sorts des Arcanes de (%d+)% au maximum%.", effect = "ARCANEDMG" },
				{ pattern = "Augmente les dégâts infligés par les sorts et effets de Feu de (%d+)% au maximum%.", effect = "FIREDMG" },
				{ pattern = "Augmente les dégâts infligés par les sorts et effets de Givre de (%d+)% au maximum%.", effect = "FROSTDMG" },
				{ pattern = "Augmente les dégâts infligés par les sorts et effets de Nature de (%d+)% au maximum%.", effect = "NATUREDMG" },
				{ pattern = "Augmente les dégâts infligés par les sorts et effets d'Ombre de (%d+)% au maximum%.", effect = "SHADOWDMG" },
				{ pattern = "Augmente les dommages realises par les sorts Sacrés de (%d+)%.", effect = "HOLYDMG" },
				{ pattern = "(%d+)% aux dégâts des sorts d'ombres%.", effect = "SHADOWDMG" },
				{ pattern = "Augmente les effets des sorts de soins de (%d+)% au maximum%.", effect = "HEAL" },
				{ pattern = "Augmente les soins prodigués par les sorts et effets de (%d+)% au maximum%.", effect = "HEAL"},
				{ pattern = "Augmente les soins et dégâts produits par les sorts et effets magiques de (%d+) au maximum%.", effect = HEAL_AND_DMG},
				{ pattern = "Augmente les dégâts et les soins produits par les sorts et effets magiques de (%d+) au maximum%.", effect = HEAL_AND_DMG},
				{ pattern = "Augmente les dégâts infligés aux morts%-vivants par les sorts et effets magiques d'un maximum de (%d+)%.", effect = "DMGUNDEAD", nofinish = true },
				{ pattern = "Rend (%d+) points de vie toutes les 5 sec%.", effect = "HEALTHREG" },
				{ pattern = "Rend (%d+) points de mana toutes les 5 secondes%.", effect = "MANAREG" },
				{ pattern = "Rend (%d+) points de mana toutes les 5 sec%.", effect = "MANAREG" },
				{ pattern = "Augmente vos chances de toucher de (%d+)%%%.", effect = "TOHIT" },
				{ pattern = "Augmente vos chances de toucher avec des sorts de (%d+)%%%.", effect = "SPELLTOHIT" },
				{ pattern = "Diminue les résistances magiques des cibles de vos sorts de (%d+)%.", effect = "SPELLPEN" },
				{ pattern = "Pêche augmentée de (%d+).", effect = "FISHING" },
				{ pattern = "Défense augmentée de (%d+).", effect = "DEFENSE"},
				{ pattern = "+(%d+) à l'Armure", effect = "ARMOR"},
				{ pattern = "Augmente de +(%d+) la puissance d'attaque pour les formes de félin, d'ours, d'ours redoutable et de sélénien uniquement%.", effect = "ATTACKPOWERFERAL"},
				{ pattern = "+(%d+) à toutes les résistances%.", effect = { "ARCANERES", "FIRERES", "FROSTRES", "NATURERES", "SHADOWRES"}},
				-- Atiesh related patterns
				{ pattern = "Augmente les dégâts infligés par vos sorts d'un maximum de (%d+) et vos soins d'un maximum de (%d+).", effect = {"DMG", "HEAL"} },
				{ pattern = "Augmente de (%d+) au maximum les soins prodigués par les sorts et effets magiques de tous les membres du groupe situés à moins de %d+ mètres%.", effect = "HEAL" },
				{ pattern = "Augmente de (%d+) au maximum les dégâts et les soins produits par les sorts et effets magiques de tous les membres du groupe situés à moins de %d+ mètres%.", effect = HEAL_AND_DMG },
				-- { pattern = "Restores (%d+) mana per 5 seconds to all party members within %d+ yards%.", effect = "MANAREG" },
				-- { pattern = "Increases the spell critical chance of all party members within %d+ yards by (%d+)%%%.", effect = "SPELLCRIT" },

				-- Added
				{ pattern = "(%d+)%% de votre vitesse de récupération du Mana sont actifs lorsque vous incantez%.", effect = "CASTINGREG"},
				{ pattern = "Vous confère (%d+)%% de votre vitesse normale de récupération du mana pendant l'incantation%.", effect = "CASTINGREG"},
				{ pattern = "Augmente vos chances d'infliger un coup critique avec les sorts de Nature de (%d+)%%%.", effect = "NATURECRIT"},
				{ pattern = "Réduit le temps d'incantation de votre sort Rétablissement de 0.(%d+) sec%.", effect = "CASTINGREGROWTH"},
				{ pattern = "Réduit le temps d'incantation de votre sort Lumière sacrée de 0.(%d+) sec%.", effect = "CASTINGHOLYLIGHT"},
				{ pattern = "-0.(%d+) sec. au temps d'incantation de votre sort Soins rapides%.", effect = "CASTINGFLASHHEAL"},
				{ pattern = "-0.(%d+) secondes au temps d'incantation de votre sort Salve de guérison%.", effect = "CASTINGCHAINHEAL"},
				{ pattern = "Réduit le temps de lancement de Toucher Guérisseur de 0.(%d+) secondes%.", effect = "CASTINGHEALINGTOUCH"},
				{ pattern = "Augmente la durée de votre sort Récupération de (%d+) sec%.", effect = "DURATIONREJUV"},
				{ pattern = "Augmente la durée de votre sort Rénovation de (%d+) sec%.", effect = "DURATIONRENEW"},
				{ pattern = "Augmente la régénération des points de vie et de mana de (%d+)%.", effect = "MANAREGNORMAL"},
				{ pattern = "Augmente de (%d+)%% le montant de points de vie rendus par Salve de guérison aux cibles qui suivent la première%.", effect = "IMPCHAINHEAL"},
				{ pattern = "Augmente les soins prodigués par Récupération de (%d+) au maximum%.", effect = "IMPREJUVENATION"},
				{ pattern = "Augmente les soins prodigués par votre Vague de Soins Inférieurs de (%d+)%.", effect = "IMPLESSERHEALINGWAVE"},
				{ pattern = "Augmente les soins prodigués par votre Eclair lumineux de (%d+)%.", effect = "IMPFLASHOFLIGHT"},
				{ pattern = "Après avoir lancé un sort de Vague de soins ou de Vague de soins inférieurs, vous avez 25%% de chances de gagner un nombre de points de mana égal à (%d+)%% du coût de base du sort%.", effect = "REFUNDHEALINGWAVE"},
				{ pattern = "Votre Vague de soins soigne aussi des cibles proches supplémentaires. Chaque nouveau soin perd (%d+)%% d'efficacité, et le sort soigne jusqu'à deux cibles supplémentaires%.", effect = "JUMPHEALINGWAVE"},
				{ pattern = "Réduit de (%d+)%% le coût en mana de vos sorts Toucher guérisseur% Rétablissement% Récupération et Tranquillité%.", effect = "CHEAPERDRUID"},
				{ pattern = "En cas de réussite critique sur un Toucher guérisseur, vous récupérez (%d+)%% du coût en mana du sort%.", effect = "REFUNDHTCRIT"},
				{ pattern = "Reduit le coût en mana de votre sort Rénovation de (%d+)%%%.", effect = "CHEAPERRENEW"},

				-- Combat Rating
				{ pattern = "Augmente votre score de toucher de (%d+)%.", effect = "CR_HIT" },
				{ pattern = "Augmente votre score de coup critique de (%d+)%.", effect = "CR_CRIT" },
				{ pattern = "Score de défense augmenté de (%d+)%.", effect = "CR_DEFENSE" },
				{ pattern = "Augmente le score de coup critique des sorts de (%d+)%.", effect = "CR_SPELLCRIT" },
-- 				{ pattern = "Improves your resilience rating by (%d+)%.", effect = "CR_RESILIENCE" },
				{ pattern = "Augmente le score de toucher des sorts de (%d+)%.", effect = "CR_SPELLHIT" },
				{ pattern = "Augmente votre score d'esquive de (%d+)%.", effect = "CR_DODGE" },
				{ pattern = "Augmente votre score de blocage de (%d+)%.", effect = "CR_BLOCK" },
				{ pattern = "Augmente votre score de parade de (%d+)%.", effect = "CR_PARRY" },
-- 				{ pattern = "Increases axe skill rating by (%d+)%.", effect = "CR_WEAPON_AXE" },
				{ pattern = "Augmente le score de la compétence Dagues de (%d+)%.", effect = "CR_WEAPON_DAGGER" },
-- 				{ pattern = "Increases mace skill rating by (%d+)%.", effect = "CR_WEAPON_MACE" },
-- 				{ pattern = "Increases sword skill rating by (%d+)%.", effect = "CR_WEAPON_SWORD" },
-- 				{ pattern = "Increases Two-Handed Swords skill rating by (%d+)%.", effect = "CR_WEAPON_SWORD_2H" },

				-- Updated Patterns (in 2.0)
-- 				{ pattern = "Increases your spell penetration by (%d+)%.", effect = "SPELLPEN" },
				{ pattern = "Augmente de (%d+) la puissance d'attaque%.", effect = "ATTACKPOWER" },
			},

			SEPARATORS = { "/", ",", "&", " et " },

			PATTERNS_GENERIC_LOOKUP = {
				["Toutes les caractéristiques"] = ALL_STATS,
				["Force"] = "STR",
				["Agilité"] = "AGI",
				["Endurance"] = "STA",
				["en Endurance"] = "STA",
				["Intelligence"] = "INT",
				["Esprit"] = "SPI",
				["à toutes les résistances"] = ALL_RESISTS,
				["Pêche"] = "FISHING",
				["Minage"] = "MINING",
				["Herborisme"] = "HERBALISM",
				["Dépeçage"] = "SKINNING",
				["Défense"] = "DEFENSE",
				["puissance d'Attaque"] = "ATTACKPOWER",
				["à la puissance d'attaque"] = "ATTACKPOWER",
				["Puissance d'attaque contre les morts%-vivants"] = "ATTACKPOWERUNDEAD",
				["Esquive"] = "DODGE",
				["Blocage"] = "BLOCK",
				["Score de blocage"] = "BLOCKVALUE",
				["au score de toucher"] = "CR_HIT",
				["à la puissance d'attaque à distance"] = "RANGEDATTACKPOWER",
				["Puissance d'Attaque à distance"] = "RANGEDATTACKPOWER",
				["Soins chaque 5 sec."] = "HEALTHREG",
				["Sorts de Soins"] = "HEAL",
				["Sorts de soin"] = "HEAL",
				["Sorts de soins"] = "HEAL",
				["aux sorts de soins"] = "HEAL",
				["aux soins"] = "HEAL",
				["Mana chaque 5 sec."] = "MANAREG",
				["Sorts de Dommages"] = "DMG",
				["dégâts des sorts"] = HEAL_AND_DMG,
				["dégâts et les effets des sorts"] = "DMG",
				["aux dégâts des sorts et aux soins"] = HEAL_AND_DMG,
				["points de mana toutes les 5 sec"] = "MANAREG",
				["Armure"] = "ARMOR",
				["Bloquer"] = "BLOCKVALUE",
				["Coup Critique"] = "CRIT",
				["Dommage"] = "DMG",
				["points de vie"] = "HEALTH",
				["points de mana"] = "MANA",
				["Mana"] = "MANA",
				["à l'Armure"] = "ARMOR",
				["Armure renforcée"] = "ARMOR",
			},

			PATTERNS_GENERIC_STAGE1 = {
				{ pattern = "Arcane", effect = "ARCANE" },
				{ pattern = "Feu", effect = "FIRE" },
				{ pattern = "Givre", effect = "FROST" },
				{ pattern = "Sacré", effect = "HOLY" },
				{ pattern = "Ombre", effect = "SHADOW" },
				{ pattern = "Nature", effect = "NATURE" },
				{ pattern = "arcanes", effect = "ARCANE" },
				{ pattern = "feu", effect = "FIRE" },
				{ pattern = "givre", effect = "FROST" },
				{ pattern = "ombre", effect = "SHADOW" },
				{ pattern = "nature", effect = "NATURE" }
			},

			PATTERNS_GENERIC_STAGE2 = {
				{ pattern = "résistance", effect = "RES" },
				{ pattern = "dégâts", effect = "DMG" },
				{ pattern = "effets", effect = "DMG" }
			},

			PATTERNS_OTHER = {
				{ pattern = "Renforcé %(%+(%d+) Armure%)", effect = "ARMOR" },
				{ pattern = "(%d+) Mana chaque 5 sec%.", effect = "MANAREG" },
				{ pattern = "Récup. mana (%d+)/5 sec%.", effect = "MANAREG" },
				{ pattern = "Cachet de mojo zandalar", effect = "HEAL", value = 18 },
				{ pattern = "Cachet de sérénité zandalar", effect = "HEAL", value = 33 },

				{ pattern = "Huile de sorcier mineure", effect = "HEAL", value = 8 },
				{ pattern = "Huile de sorcier inférieure", effect = "HEAL", value = 16 },
				{ pattern = "Huile de sorcier", effect = "HEAL", value = 24 },
				{ pattern = "Huile de sorcier brillante", effect = {"HEAL", "SPELLCRIT"}, value = {36, 1} },

				{ pattern = "Huile de mana mineure", effect = "MANAREG", value = 4 },
				{ pattern = "Huile de mana inférieure", effect = "MANAREG", value = 8 },
				{ pattern = "Huile de mana brillante", effect = { "MANAREG", "HEAL"}, value = {12, 25} },
			}
		}
	elseif locale == "deDE" then
		L = {
			NAMES = {
				STR = "Stärke",
				AGI = "Beweglichkeit",
				STA = "Ausdauer",
				INT = "Intelligenz",
				SPI = "Willenskraft",
				ARMOR = "Verstärkte Rüstung",

				ARCANERES = "Arkanwiderstand",
				FIRERES = "Feuerwiderstand",
				NATURERES = "Naturwiderstand",
				FROSTRES = "Frostwiderstand",
				SHADOWRES = "Schattenwiderstand",

				FISHING = "Angeln",
				MINING = "Bergbau",
				HERBALISM = "Kräuterkunde",
				SKINNING = "Kürschnerei",
				DEFENSE = "Verteidigung",

				BLOCK = "Blockchance",
				BLOCKVALUE = "Blockwert",
				DODGE = "Ausweichen",
				PARRY = "Parieren",
				ATTACKPOWER = "Angriffskraft",
				ATTACKPOWERUNDEAD = "Angriffskraft gegen Untote",
				ATTACKPOWERFERAL = "Angriffskraft in Tierform",
				CRIT = "krit. Treffer",
				RANGEDATTACKPOWER = "Distanzangriffskraft",
				RANGEDCRIT = "krit. Schuss",
				TOHIT = "Trefferchance",
				DMG = "Zauberschaden",
				DMGUNDEAD = "Zauberschaden gegen Untote",
				ARCANEDMG = "Arkanschaden",
				FIREDMG = "Feuerschaden",
				FROSTDMG = "Frostschaden",
				HOLYDMG = "Heiligschaden",
				NATUREDMG = "Naturschaden",
				SHADOWDMG = "Schattenschaden",
				HOLYCRIT = "krit. Heiligzauber",
				SPELLCRIT = "krit. Zauber",
				SPELLTOHIT = "Zaubertrefferchance",
				SPELLPEN = "Zauberdurchschlag",
				HEAL = "Heilung",
				HEALTHREG = "Lebensregeneration",
				MANAREG = "Manaregeneration",
				HEALTH = "Lebenspunkte",
				MANA = "Manapunkte",

				CR_WEAPON = "Waffenwertung",
				CR_DEFENSE = "Verteidigungswertung",
				CR_DODGE = "Ausweichwertung",
				CR_PARRY = "Parrierwertung",
				CR_BLOCK = "Blockwertung",
				CR_HIT = "Trefferwertung",
				CR_RANGEDHIT = "Distanztrefferwertung",
				CR_CRIT = "kritische Trefferwertung",
				CR_HASTE = "Angriffsgeschwindigkeit",
				CR_SPELLHIT = "Zaubertrefferwertung",
				CR_SPELLCRIT = "kritische Zaubertrefferwertung",
				CR_SPELLHASTE = "Zaubergeschwindigkeit",
				CR_RANGEDHASTE = "Fernkampfgeschwindigkeit",
				CR_RESILIENCE = "Abhärtungswertung",
			},

			PATTERNS_PASSIVE = {
				{ pattern = "%+(%d+) bei allen Widerstandsarten%.", effect = ALL_RESISTS },
				{ pattern = "+(%d+) Distanzangriffskraft.", effect = "RANGEDATTACKPOWER" },
				{ pattern = "Erhöht Eure Chance, Angriffe mit einem Schild zu blocken, um (%d+)%%%.", effect = "BLOCK" },
				{ pattern = "Erhöht den Blockwert Eures Schildes um (%d+)%.", effect = "BLOCKVALUE" },
				{ pattern = "Erhöht Eure Chance, einem Angriff auszuweichen, um (%d+)%%%.", effect = "DODGE" },
				{ pattern = "Erhöht Eure Chance, einen Angriff zu parieren, um (%d+)%%%.", effect = "PARRY" },
				{ pattern = "Erhöht Eure Chance, einen kritischen Treffer durch Zauber zu erzielen, um (%d+)%%%.", effect = "SPELLCRIT" },
				{ pattern = "Erhöht Eure Chance, einen kritischen Treffer durch Heiligzauber zu erzielen, um (%d+)%%%.", effect = "HOLYCRIT" },
				{ pattern = "Erhöht Eure Chance, einen kritischen Treffer zu erzielen, um (%d+)%%%.", effect = "CRIT" },
				{ pattern = "Erhöht Eure Chance, mit Fernkampfwaffen einen kritischen Treffer zu erzielen, um (%d+)%.", effect = "RANGEDCRIT" },
				{ pattern = "Erhöht durch Arkanzauber und Arkaneffekte zugefügten Schaden um bis zu (%d+)%.", effect = "ARCANEDMG" },
				{ pattern = "Erhöht durch Feuerzauber und Feuereffekte zugefügten Schaden um bis zu (%d+)%.", effect = "FIREDMG" },
				{ pattern = "Erhöht durch Frostzauber und Frosteffekte zugefügten Schaden um bis zu (%d+)%.", effect = "FROSTDMG" },
				{ pattern = "Erhöht durch Heiligzauber und Heiligeffekte zugefügten Schaden um bis zu (%d+)%.", effect = "HOLYDMG" },
				{ pattern = "Erhöht durch Naturzauber und Natureffekte zugefügten Schaden um bis zu (%d+)%.", effect = "NATUREDMG" },
				{ pattern = "Erhöht durch Schattenzauber und Schatteneffekte zugefügten Schaden um bis zu (%d+)%.", effect = "SHADOWDMG" },
				{ pattern = "Erhöht durch Zauber und Effekte verursachte Heilung um bis zu (%d+)%.", effect = "HEAL" },
				{ pattern = "Erhöht durch Zauber und magische Effekte zugefügten Schaden und Heilung um bis zu (%d+)%.", effect = HEAL_AND_DMG },
				{ pattern = "Erhöht durch Zauber und magische Effekte verursachten Schaden und Heilung um bis zu (%d+)%.", effect = HEAL_AND_DMG },
				{ pattern = "Erhöht den durch magische Zauber und magische Effekte zugefügten Schaden gegen Untote um bis zu (%d+)%.", effect = "DMGUNDEAD", nofinish = true },
				{ pattern = "Erhöht die Angriffskraft im Kampf gegen Untote um (%d+)%.", effect = "ATTACKPOWERUNDEAD", nofinish = true },
				{ pattern = "Erhöht die Angriffskraft im Kampf gegen Untote um (%d+)%. Ermöglicht das Einsammeln von Geißelsteinen im Namen der Agentumdämmerung", effect = "ATTACKPOWERUNDEAD" },
				{ pattern = "Stellt alle 5 Sek%. (%d+) Gesundheit wieder her%.", effect = "HEALTHREG" },
				{ pattern = "Stellt alle 5 Sek%. (%d+) Mana wieder her%.", effect = "MANAREG" },
				{ pattern = "Verbessert Eure Trefferchance um (%d+)%%%.", effect = "TOHIT" },
				{ pattern = "Reduziert die Magiewiderstände der Ziele Eurer Zauber um (%d+)%.", effect = "SPELLPEN" },

				{ pattern = ".+ Angriffstempowertung um (%d+)", effect = "CR_HASTE"},	
				{ pattern = "Erhöht Eure Angriffstempowertung %d Sek%. lang um (%d+)%.", effect = "CR_HASTE"},
				{ pattern = ".+ Zaubertempowertung um (%d+)", effect = "CR_SPELLHASTE"},
				{ pattern = ".+ Distanztempowertung um (%d+)%.", effect = "CR_RANGEDHASTE"},	

				-- Atiesh related patterns
				{ pattern = "Erhöht Euren Zauberschaden um bis zu (%d+) und Eure Heilung um bis zu (%d+)%.", effect = {"DMG","HEAL"} },
				{ pattern = "Erhöht durch Zauber und magische Effekte verursachte Heilung aller Gruppenmitglieder, die sich im Umkreis von %d+ Metern befinden, um bis zu (%d+)%.", effect = "HEAL" },
				{ pattern = "Erhöht durch Zauber und magische Effekte verursachte Schaden und Heilung aller Gruppenmitglieder, die sich im Umkreis von %d+ Metern befinden, um bis zu (%d+)%.", effect = HEAL_AND_DMG },
				{ pattern = "Stellt alle 5 Sek. (%d+) Mana bei allen Gruppenmitgliedern, die sich im Umkreis von %d+ Metern befinden, wieder her.", effect = "MANAREG" },
				{ pattern = "Erhöht die kritische Zaubertrefferwertung aller Gruppenmitglieder innerhalb von %d+ Metern um (%d+)%.", effect = "SPELLCRIT" },

				-- Added for HealPoints
				{ pattern = "Ermöglicht, das (%d+)%% Eurer Manaregeneration während des Zauberwirkens weiter läuft%.", effect = "CASTINGREG"},
				-- { pattern = "Improves your chance to get a critical strike with Nature spells by (%d+)%%%.", effect = "NATURECRIT"},
				-- { pattern = "Reduces the casting time of your Regrowth spell by 0%.(%d+) sec%.", effect = "CASTINGREGROWTH"},
				-- { pattern = "Reduces the casting time of your Holy Light spell by 0%.(%d+) sec%.", effect = "CASTINGHOLYLIGHT"},
				-- { pattern = "Reduces the casting time of your Healing Touch spell by 0%.(%d+) sec%.", effect = "CASTINGHEALINGTOUCH"},
				-- { pattern = "%-0%.(%d+) sec to the casting time of your Flash Heal spell%.", effect = "CASTINGFLASHHEAL"},
				-- { pattern = "%-0%.(%d+) seconds on the casting time of your Chain Heal spell%.", effect = "CASTINGCHAINHEAL"},
				-- { pattern = "Increases the duration of your Rejuvenation spell by (%d+) sec%.", effect = "DURATIONREJUV"},
				-- { pattern = "Increases the duration of your Renew spell by (%d+) sec%.", effect = "DURATIONRENEW"},
				-- { pattern = "Increases your normal health and mana regeneration by (%d+)%.", effect = "MANAREGNORMAL"},
				-- { pattern = "Increases the amount healed by Chain Heal to targets beyond the first by (%d+)%%%.", effect = "IMPCHAINHEAL"},
				{ pattern = "Erhöht den Effekt eures Zaubers Verjüngung um (%d+)%.", effect = "IMPREJUVENATION"},
				-- { pattern = "Increases healing done by Lesser Healing Wave by up to (%d+)%.", effect = "IMPLESSERHEALINGWAVE"},
				{ pattern = "Erhöht den durch Eure Zauber Heiliges Licht und Lichtblitz geheilten Wert um (%d+)%.", effect = "IMPFLASHOFLIGHT"},
				-- { pattern = "After casting your Healing Wave or Lesser Healing Wave spell%, gives you a 25%% chance to gain Mana equal to (%d+)%% of the base cost of the spell%.", effect = "REFUNDHEALINGWAVE"},
				-- { pattern = "Your Healing Wave will now jump to additional nearby targets%. Each jump reduces the effectiveness of the heal by (%d+)%%%, and the spell will jump to up to two additional targets%.", effect = "JUMPHEALINGWAVE"},
				-- { pattern = "Reduces the mana cost of your Healing Touch%, Regrowth%, Rejuvenation and Tranquility spells by (%d+)%%%.", effect = "CHEAPERDRUID"},
				-- { pattern = "On Healing Touch critical hits%, you regain (%d+)%% of the mana cost of the spell%.", effect = "REFUNDHTCRIT"},
				{ pattern = "Erhöht den durch euren Zauber Erneuerung geheilten Wert um (%d+)%%%.", effect = "CHEAPERRENEW"},

				-- Combat Rating
				{ pattern = "Erhöht Eure Trefferwertung um (%d+)%.", effect = "CR_HIT" },
				{ pattern = "Erhöht Eure kritische Trefferwertung um (%d+)%.", effect = "CR_CRIT" },
				{ pattern = "Erhöht Eure Distanztrefferwertung um (%d+)%.", effect = "CR_RANGEDHIT" },
				{ pattern = "Erhöht Verteidigungswertung um (%d+)%.", effect = "CR_DEFENSE" },
				{ pattern = "Erhöht Eure kritische Zaubertrefferwertung um (%d+)%.", effect = "CR_SPELLCRIT" },
				{ pattern = "Erhöht Eure Abhärtungswertung um (%d+)%.", effect = "CR_RESILIENCE" },
				{ pattern = "Erhöht Eure Zaubertrefferwertung um (%d+)%.", effect = "CR_SPELLHIT" },
				{ pattern = "Erhöht Trefferwertung um (%d+)%.", effect = "CR_HIT" },
				{ pattern = "Erhöht kritische Trefferwertung um (%d+)%.", effect = "CR_CRIT" },
				{ pattern = "Erhöht Eure Ausweichwertung um (%d+)%.", effect = "CR_DODGE" },
				{ pattern = "Erhöht Eure Blockwertung um (%d+)%.", effect = "CR_BLOCK" },
				{ pattern = "Erhöht Eure Parrierwertung um (%d+)%.", effect = "CR_PARRY" },
				{ pattern = "Erhöht die Fertigkeitswertung für Äxte um (%d+)%.", effect = "CR_WEAPON_AXE" },
				{ pattern = "Erhöht die Fertigkeitswertung für Dolche um (%d+)%.", effect = "CR_WEAPON_DAGGER" },
				{ pattern = "Erhöht die Fertigkeitswertung für Streitkolben um (%d+)%.", effect = "CR_WEAPON_MACE" },
				{ pattern = "Erhöht die Fertigkeitswertung für Schwerter um(%d+)%.", effect = "CR_WEAPON_SWORD" },
				{ pattern = "Erhöht die Fertigkeitswertung für Zweihandschwerter um (%d+)%.", effect = "CR_WEAPON_SWORD_2H" },
				{ pattern = "Erhöht die Fertigkeitswertung für Bögen um (%d+)%.", effect = "CR_WEAPON_BOW" },
				{ pattern = "Erhöht die Fertigkeitswertung für Armbrüste um (%d+)%.", effect = "CR_WEAPON_XBOW" },
				{ pattern = "Erhöht die Fertigkeitswertung für Schusswaffen um (%d+)%.", effect = "CR_WEAPON_GUN" },
				{ pattern = "Erhöht die Fertigkeitswertung für unbewaffneten Kampf um (%d+)%.", effect = "CR_WEAPON_UNARMED" },
				{ pattern = "Erhöht die Fertigkeitswertung für Stäbe um (%d+)%.", effect = "CR_WEAPON_STAFF" },
				{ pattern = "Erhöht die Fertigkeitswertung für Zweihandäxte um (%d+)%.", effect = "CR_WEAPON_AXE_2H" },
				{ pattern = "Erhöht die Fertigkeitswertung für Zweihandstreitkolben um (%d+)%.", effect = "CR_WEAPON_MACE_2H" },
				{ pattern = "Erhöht die Fertigkeitswertung für Stangenwaffen um (%d+)%.", effect = "CR_WEAPON_POLEARM" },


				-- Updated Patterns (in 2.0)
				{ pattern = "Verringert den Widerstand des Ziels gegen Eure Zauber um (%d+)%.", effect = "SPELLPEN" },
				{ pattern = "Verbessert Eure Angriffskraft um (%d+)%.", effect = "ATTACKPOWER" },
				{ pattern = "Erhöht die Angriffskraft um (%d+)%.", effect = "ATTACKPOWER" },
				{ pattern = "Erhöht die Angriffskraft in Katzengestalt, Bärengestalt, Terrorbärengestalt oder Mondkingestalt um (%d+)%.", effect = "ATTACKPOWERFERAL" },
			},

			SEPARATORS = { "/", ",", "&", " und " },

			PATTERNS_GENERIC_LOOKUP = {
				["Alle Werte"] = ALL_STATS,
				["Stärke"] = "STR",
				["Beweglichkeit"] = "AGI",
				["Ausdauer"] = "STA",
				["Intelligenz"] = "INT",
				["Willenskraft"] = "SPI",

				["Alle Widerstandsarten"] = ALL_RESISTS,

				["Angeln"] = "FISHING",
				["Angelköder"] = "FISHING",
				["Bergbau"] = "MINING",
				["Kräuterkunde"] = "HERBALISM",
				["Kürschnerei"] = "SKINNING",
				["Verteidigung"] = "DEFENSE",
				["Verteidigungsfertigkeit"] = "DEFENSE",

				["Angriffskraft"] = "ATTACKPOWER",
				["Angriffskraft gegen Untote"] = "ATTACKPOWERUNDEAD",
				["Angriffskraft in Katzengestalt, Bärengestalt oder Terrorbärengestalt"] = "ATTACKPOWERFERAL",
				["Ausweichen"] = "DODGE",
				["Blocken"] = "BLOCK",
				["Blockwert"] = "BLOCKVALUE",
				["Trefferchance"] = "TOHIT",
				["Distanzangriffskraft"] = "RANGEDATTACKPOWER",
				["Gesundheit alle 5 Sek"] = "HEALTHREG",
				["Heilzauber"] = "HEAL",
				["Erhöht Heilung"] = "HEAL", 
				["Mana alle 5 Sek"] = "MANAREG",
				["Manaregeneration"] = "MANAREG",
				["Zauberschaden erhöhen"]= "DMG",
				["Kritischer Treffer"] = "CRIT",
				["Zauberschaden"] = HEAL_AND_DMG,
				["Blocken"] = "BLOCK",
				["Gesundheit"] = "HEALTH",
				["HP"] = "HEALTH",
				["Heilung und Zauberschaden"] = HEAL_AND_DMG,
				["Zauberschaden und Heilung"] = HEAL_AND_DMG,
				["Schadenszauber und Heilzauber"] = HEAL_AND_DMG,
				["Schadens- und Heilzauber"] = HEAL_AND_DMG,
				["Zaubertrefferchance"] = "SPELLTOHIT",
				["Mana"] = "MANA",
				["Rüstung"] = "ARMOR",
				["Verstärkte Rüstung"]= "ARMOR"
			},

			PATTERNS_GENERIC_STAGE1 = {
				{ pattern = "Arkan", effect = "ARCANE" },
				{ pattern = "Feuer", effect = "FIRE" },
				{ pattern = "Frost", effect = "FROST" },
				{ pattern = "Heilig", effect = "HOLY" },
				{ pattern = "Schatten", effect = "SHADOW" },
				{ pattern = "Natur", effect = "NATURE" },
			},

			PATTERNS_GENERIC_STAGE2 = {
				{ pattern = "widerst", effect = "RES" },
				{ pattern = "schaden", effect = "DMG" },
				{ pattern = "effekte", effect = "DMG" },
			},

			PATTERNS_OTHER = {
				{ pattern = "Manaregeneration (%d+) pro 5 Sek%.", effect = "MANAREG" },

				{ pattern = "Zandalarianisches Siegel der Macht", effect = "ATTACKPOWER", value = 30 },
				{ pattern = "Zandalarianisches Siegel des Mojo", effect = HEAL_AND_DMG, value = 18 },
				{ pattern = "Zandalarianisches Siegel der Inneren Ruhe", effect = "HEAL", value = 33 },

				{ pattern = "Schwaches Zauberöl", effect = HEAL_AND_DMG, value = 8 },
				{ pattern = "Geringes Zauberöl", effect = HEAL_AND_DMG, value = 16 },
				{ pattern = "Zauberöl", effect = HEAL_AND_DMG, value = 24 },
				{ pattern = "Hervorragendes Zauberöl", effect = {"DMG", "HEAL", "SPELLCRIT"}, value = {36, 36, 1} },

				{ pattern = "Schwaches Manaöl", effect = "MANAREG", value = 4 },
				{ pattern = "Geringes Manaöl", effect = "MANAREG", value = 8 },
				{ pattern = "Hervorragendes Manaöl", effect = { "MANAREG", "HEAL"}, value = {12, 25} },

				{ pattern = "Eterniumangelschnur", effect = "FISHING", value = 5 },
				{ pattern = "%+30 Distanztrefferwertung", effect = "CR_RANGEDHIT", value = 30 }, --Biznicks 247x128 Accurascope
			
			}
		}
	elseif locale == "koKR" then
		L = {
			NAMES = {
				STR = "힘",
				AGI = "민첩성",
				STA = "체력",
				INT = "지능",
				SPI = "정신력",
				ARMOR = "방어도",

				ARCANERES = "비전 저항력",
				FIRERES = "화염 저항력",
				NATURERES = "자연 저항력",
				FROSTRES = "냉기 저항력",
				SHADOWRES = "암흑 저항력",

				FISHING = "낚시",
				MINING = "채광",
				HERBALISM = "약초 채집",
				SKINNING = "무두질",
				DEFENSE = "방어 숙련",

				BLOCK = "방어율",
				BLOCKVALUE = "방패 피해 흡수량",
				DODGE = "회피",
				PARRY = "무기 막기",
				ATTACKPOWER = "전투력",
				ATTACKPOWERUNDEAD = "언데드에 대한 전투력",
				ATTACKPOWERFERAL = "야수 변신시 전투력",
				CRIT = "치명타 적중률",
				RANGEDATTACKPOWER = "원거리 전투력",
				RANGEDCRIT = "원거리 치명타 적중률",
				TOHIT = "적중률",

				DMG = "주문 공격력",
				DMGUNDEAD = "언데드에 대한 주문 공격력",
				ARCANEDMG = "비전계 주문 공격력",
				FIREDMG = "화염계 주문 공격력",
				FROSTDMG = "냉기계 주문 공격력",
				HOLYDMG = "신성계 주문 공격력",
				NATUREDMG = "자연계 주문 공격력",
				SHADOWDMG = "암흑계 주문 공격력",
				SPELLCRIT = "주문 극대화율",
				SPELLTOHIT = "주문 적중율",
				SPELLPEN = "대상 저항 감소",
				HEAL = "치유량",
				HOLYCRIT = "신성계 주문 극대화율",

				HEALTHREG = "생명력 회복",
				MANAREG = "마나 회복",
				HEALTH = "생명력",
				MANA = "마나",

				CR_WEAPON = "무기 숙련도",
				CR_DEFENSE = "방어 숙련도",
				CR_DODGE = "회피 숙련도",
				CR_PARRY = "무기 막기 숙련도",
				CR_BLOCK = "방패 막기 숙련도",
				CR_HIT = "적중도",
				CR_CRIT = "치명타 적중도",
				CR_HASTE = "가속도",
				CR_SPELLHIT = "주문 적중도",
				CR_SPELLCRIT = "주문 극대화 적중도",
				CR_SPELLHASTE = "주문 가속도",
				CR_RESILIENCE = "탄력도",
				CR_WEAPON_AXE = "도끼류 숙련도",
				CR_WEAPON_DAGGER = "단검류 숙련도",
				CR_WEAPON_MACE = "둔기류 숙련도",
				CR_WEAPON_SWORD = "도검류 숙련도",
				CR_WEAPON_SWORD_2H = "양손 도검류 숙련도"
			},


			PATTERNS_PASSIVE = {
				{ pattern = "방어 숙련도 ++(%d+)", effect = "DEFENSE" },
				{ pattern = "전투력 ++(%d+)", effect = "ATTACKPOWER" },
				{ pattern = "원거리 전투력 ++(%d+)", effect = "RANGEDATTACKPOWER" },
				{ pattern = "방패로 적의 공격을 방어할 확률이 (%d+)%%만큼 증가합니다%.", effect = "BLOCK" },
				{ pattern = "방패의 피해 방어량이 (%d+)만큼 증가합니다%.", effect = "BLOCKVALUE" },
				{ pattern = "공격을 회피할 확률이 (%d+)%%만큼 증가합니다%.", effect = "DODGE" },
				{ pattern = "무기 막기 확률이 (%d+)%%만큼 증가합니다%.", effect = "PARRY" },
				{ pattern = "주문이 극대화 효과를 낼 확률이 (%d+)%%만큼 증가합니다%.", effect = "SPELLCRIT" },
				{ pattern = "신성 주문으로 극대화 효과를 발휘할 확률이 (%d+)%%만큼 증가합니다%.", effect = "HOLYCRIT" },
				{ pattern = "신성 주문이 극대화 효과를 발휘할 확률이 (%d+)%%만큼 증가합니다%.", effect = "HOLYCRIT" },
				{ pattern = "치명타를 적중시킬 확률이 (%d+)%%만큼 증가합니다%.", effect = "CRIT" },
				{ pattern = "원거리 무기로 치명타를 적중시킬 확률이 (%d+)%%만큼 증가합니다%.", effect = "RANGEDCRIT" },
				{ pattern = "비전 계열의 주문과 효과의 공격력이 최대 (%d+)만큼 증가합니다%.", effect = "ARCANEDMG" },
				{ pattern = "화염 계열의 주문과 효과의 공격력이 최대 (%d+)만큼 증가합니다%.", effect = "FIREDMG" },
				{ pattern = "냉기 계열의 주문과 효과의 공격력이 최대 (%d+)만큼 증가합니다%.", effect = "FROSTDMG" },
				{ pattern = "신성 계열의 주문과 효과의 공격력이 최대 (%d+)만큼 증가합니다%.", effect = "HOLYDMG" },
				{ pattern = "자연 계열의 주문과 효과의 공격력이 최대 (%d+)만큼 증가합니다%.", effect = "NATUREDMG" },
				{ pattern = "암흑 계열의 주문과 효과의 공격력이 최대 (%d+)만큼 증가합니다%.", effect = "SHADOWDMG" },
				{ pattern = "모든 주문 및 효과에 의한 치유량이 최대 (%d+)만큼 증가합니다%.", effect = "HEAL" },
				{ pattern = "모든 주문 및 효과의 공격력과 치유량이 최대 (%d+)만큼 증가합니다%.", effect = HEAL_AND_DMG },
				{ pattern = "언데드에 대한 주문 및 효과에 의한 공격력이 최대 (%d+)만큼 증가합니다%.", effect = "DMGUNDEAD", nofinish = true },
				{ pattern = "언데드에 대한 효과나 주문에 의한 피해가 최대 (%d+)만큼 증가합니다%.", effect = "DMGUNDEAD", nofinish = true },
				{ pattern = "언데드 공격 시 전투력이 (%d+)만큼 증가합니다%.", effect = "ATTACKPOWERUNDEAD", nofinish = true },
				{ pattern = "매 5초마다 (%d+)의 생명력이 회복됩니다%.", effect = "HEALTHREG" },
				{ pattern = "매 5초마다 (%d+)의 마나가 회복됩니다%.", effect = "MANAREG" },
--				{ pattern = "Restores (%d+) mana per 5 sec%.", effect = "MANAREG" },
--				{ pattern = "Restores (%d+) mana every 5 sec%.", effect = "MANAREG" },
				{ pattern = "무기의 적중률이 (%d+)%%만큼 증가합니다%.", effect = "TOHIT" },
				{ pattern = "주문의 적중률이 (%d+)%%만큼 증가합니다%.", effect = "SPELLTOHIT" },
				{ pattern = "자신의 주문에 대한 대상의 마법 저항력을 (%d+)만큼 감소시킵니다%.", effect = "SPELLPEN" },
				{ pattern = "표범, 광포한 곰, 곰 변신 상태일 때 전투력이 (%d+)만큼 증가합니다%.", effect = "ATTACKPOWERFERAL" },
				-- Atiesh related patterns
				{ pattern = "주문의 공격력이 최대 (%d+)만큼 치유량을 최대 (%d+)만큼 증가합니다%.", effect = {"DMG", "HEAL"} },
				{ pattern = "주위 %d+미터 반경에 있는 모든 파티원의 모든 주문 및 효과에 의한 치유량이 최대 (%d+)만큼 증가합니다%.", effect = "HEAL" },
--				{ pattern = "주위 %d+미터 반경에 있는 모든 파티원의 모든 주문 및 효과에 의한 공격력과 치유량이 최대 (%d+)만큼 증가합니다%.", effect = HEAL_AND_DMG },
				{ pattern = "주위 %d+미터 반경 내에 있는 모든 파티원의 마나가 매 5초마다 (%d+)만큼 회복됩니다%.", effect = "MANAREG" },
				{ pattern = "주위 %d+미터 반경에 있는 모든 파티원의 주문 극대화 확률이 (%d+)%%만큼 증가합니다%.", effect = "SPELLCRIT" },

				-- Added for HealPoints
				{ pattern = "시전 중에도 평소의 (%d+)%%에 달하는 속도로 마나가 회복됩니다%.", effect = "CASTINGREG"},
				{ pattern = "자연 계열 주문이 치명타로 적중할 확률이 (%d+)%%만큼 증가합니다%.", effect = "NATURECRIT"},
				{ pattern = "재생의 시전 시간이 0%.(%d+)초만큼 단축됩니다%.", effect = "CASTINGREGROWTH"},
--				{ pattern = "성스러운 빛의 시전 시간이 0%.(%d+)초 만큼 단축됩니다%.", effect = "CASTINGHOLYLIGHT"},
--				{ pattern = "치유의 손길의 시전 시간이 0%.(%d+)초 만큼 단축됩니다%.", effect = "CASTINGHEALINGTOUCH"},
				{ pattern = "순간 치유의 시전 시간이 0%.(%d+)초만큼 단축됩니다%.", effect = "CASTINGFLASHHEAL"},
				{ pattern = "연쇄 치유의 시전 시간이 0%.(%d+)초만큼 단축됩니다%.", effect = "CASTINGCHAINHEAL"},
				{ pattern = "회복의 지속시간이 (%d+)만큼 증가합니다%.", effect = "DURATIONREJUV"},
				{ pattern = "소생의 지속시간이 (%d+)초만큼 증가합니다%.", effect = "DURATIONRENEW"},
				{ pattern = "평상시 생명력과 마나의 회복 속도를 (%d+)만큼 향상시킵니다%.", effect = "MANAREGNORMAL" },
				{ pattern = "연쇄 치유 사용 시 처음 회복되는 대상 외에 치유되는 생명력이 각각 (%d+)%%만큼 증가합니다%.", effect = "IMPCHAINHEAL"},
				{ pattern = "회복에 의한 치유량이 최대 (%d+)까지 증가합니다%.", effect = "IMPREJUVENATION"},
				{ pattern = "하급 치유의 물결에 의한 치유량이 최대 (%d+)까지 증가합니다%.", effect = "IMPLESSERHEALINGWAVE"},
				{ pattern = "빛의 섬광에 의한 치유량이 최대 (%d+)만큼 증가합니다%.", effect = "IMPFLASHOFLIGHT"},
				{ pattern = "치유의 물결이나 하급 치유의 물결 시전 후 25%%의 확률로 소비된 마나의 (%d+)%%를 다시 회복합니다%.", effect = "REFUNDHEALINGWAVE"},
				{ pattern = "치유의 물결 사용 시 추가로 주위 아군을 연쇄적으로 회복시킵니다%. 대상이 바뀔 때마다 치유 효과는 (%d+)%%씩 감소됩니다%. 최대 2명의 추가 대상에게 효력을 미칩니다%.", effect = "JUMPHEALINGWAVE"},
				{ pattern = "치유의 손길%, 재생%, 회복%, 평온에 소비되는 마나가 (%d+)%%만큼 감소합니다%.", effect = "CHEAPERDRUID"},
				{ pattern = "치유의 손길이 극대화 효과를 발휘할 시 주문에 소비된 마나의 (%d+)%%만큼을 회복합니다%.", effect = "REFUNDHTCRIT"},
				{ pattern = "소생에 소비되는 마나가 (%d+)%%만큼 감소합니다%.", effect = "CHEAPERRENEW"},

				-- Combat Rating
				{ pattern = "적중도가 (%d+)만큼 증가합니다%.", effect = "CR_HIT" },
				{ pattern = "치명타 적중도가 (%d+)만큼 증가합니다%.", effect = "CR_CRIT" },
				{ pattern = "방어 숙련도가 (%d+)만큼 증가합니다%.", effect = "CR_DEFENSE" },
				{ pattern = "주문의 극대화 적중도가 (%d+)만큼 증가합니다%.", effect = "CR_SPELLCRIT" },
				{ pattern = "탄력도가 (%d+)만큼 증가합니다%.", effect = "CR_RESILIENCE" },
				{ pattern = "주문의 적중도가 (%d+)만큼 증가합니다%.", effect = "CR_SPELLHIT" },
				{ pattern = "회피 숙련도가 (%d+)만큼 증가합니다%.", effect = "CR_DODGE" },
				{ pattern = "방패 막기 숙련도가 (%d+)만큼 증가합니다%.", effect = "CR_BLOCK" },
				{ pattern = "무기 막기 숙련도가 (%d+)만큼 증가합니다%.", effect = "CR_PARRY" },
				{ pattern = "도끼류 숙련도가 (%d+)만큼 증가합니다%.", effect = "CR_WEAPON_AXE" },
				{ pattern = "단검류 숙련도가 (%d+)만큼 증가합니다%.", effect = "CR_WEAPON_DAGGER" },
				{ pattern = "둔기류 숙련도가 (%d+)만큼 증가합니다%.", effect = "CR_WEAPON_MACE" },
				{ pattern = "도검류 숙련도가 (%d+)만큼 증가합니다%.", effect = "CR_WEAPON_SWORD" },
				{ pattern = "양손 도검류 숙련도가 (%d+)만큼 증가합니다%.", effect = "CR_WEAPON_SWORD_2H" },

				-- Updated Patterns (in 2.0)
				{ pattern = "관통력이 (%d+)만큼 증가합니다%.", effect = "SPELLPEN" },
				{ pattern = "전투력이 (%d+)만큼 증가합니다%.", effect = "ATTACKPOWER" },
				{ pattern = "표범, 곰, 광포한 곰, 생명의 나무 변신 상태일 때 전투력이 (%d+)만큼 증가합니다%.", effect = "ATTACKPOWERFERAL" },

				{ pattern = "적중도가 (%d+)만큼 증가합니다%.", effect = "CR_HIT" },
				{ pattern = "치명타 적중도가 (%d+)만큼 증가합니다%.", effect = "CR_CRIT" },
				{ pattern = "주문 극대화 적중도가 (%d+)만큼 증가합니다%.", effect = "CR_SPELLCRIT" },
				{ pattern = "주문 적중도가 (%d+)만큼 증가합니다%.", effect = "CR_SPELLHIT" },
				{ pattern = "주문 관통력이 (%d+)만큼 증가합니다%.", effect = "SPELLPEN" },
--				{ pattern = "Improves spell hit rating by (%d+)%.", effect = "CR_SPELLHIT" },
			},

			SEPARATORS = { "/", ",", "&" },
	
			PATTERNS_GENERIC_LOOKUP = {
				["모든 능력치"] = ALL_STATS,
				["힘"] = "STR",
				["민첩성"] = "AGI",
				["체력"] = "STA",
				["지능"] = "INT",
				["정신력"] = "SPI",

				["모든 저항력"] = ALL_RESISTS,

				["낚시"] = "FISHING",
				["낚시용 미끼"] = "FISHING",
				["낚시 숙련도"] = "FISHING",
				["채광"] = "MINING",
				["약초 채집"] = "HERBALISM",
				["무두질"] = "SKINNING",
				["방어 숙련도"] = "DEFENSE",
				["방어 숙련도 증가"] = "DEFENSE",

				["전투력"] = "ATTACKPOWER",
				["언데드 공격 시 전투력"] = "ATTACKPOWERUNDEAD",
				["표범, 광포한 곰, 곰 변신 상태일 때 전투력"] = "ATTACKPOWERFERAL",

				["회피율"] = "DODGE",
				["방어율"] = "BLOCK",
				["방패 피해 방어량"] = "BLOCKVALUE",
				["적중률"] = "TOHIT",
				["주문 적중률"] = "SPELLTOHIT",
--				["Blocking"] = "BLOCK",
				["원거리 전투력"] = "RANGEDATTACKPOWER",
				["5초당 생명력 회복"] = "HEALTHREG",
				["주문 치유량"] = "HEAL",
				["치유량 증가"] = "HEAL",
				["치유량"] = "HEAL",
				["치유 및 주문 공격력"] = HEAL_AND_DMG,
				["공격력 및 주문 치유량"] = HEAL_AND_DMG,
				["주문 공격력 및 치유량"] = HEAL_AND_DMG,
				["5초당 마나 회복"] = "MANAREG",
				["마나 회복량"] = "MANAREG",
				["주문 공격력"] = HEAL_AND_DMG,
				["치명타"] = "CRIT",
--				["Critical Hit"] = "CRIT",
				["공격력"] = "DMG",
				["생명력"] = "HEALTH",
				["HP"] = "HEALTH",
				["마나"] = "MANA",
				["방어도"] = "ARMOR",
				["방어도 보강"] = "ARMOR",
				["탄력성"] = "CR_RESILIENCE",
				["주문 극대화 적중도"] = "CR_SPELLCRIT",
				["주문 관통력"] = "SPELLPEN",
				["적중도"] = "CR_HIT",
				["방어 숙련도"] = "CR_DEFENSE",
				["탄력도"] = "CR_RESILIENCE",
--				["Crit Rating"] = "CR_CRIT",
--				["Critical Rating"] = "CR_CRIT",
				["치명타 적중도"] = "CR_CRIT",
				["회피 숙련도"] = "CR_DODGE",
				["무기 막기 숙련도"] = "CR_PARRY",
				["주문 극대화 적중도"] = "CR_SPELLCRIT",
--				["Spell Critical Rating"] = "CR_SPELLCRIT",
--				["Spell Crit Rating"] = "CR_SPELLCRIT",
				["주문 적중도"] = "CR_SPELLHIT",
				["5초당 마나 회복"] = "MANAREG",
--				["Mana per 5 Seconds"] = "MANAREG",
--				["Mana every 5 seconds"] = "MANAREG",
				["치유 주문"] = "HEAL",
				["근접 공격력"] = "MELEEDMG",
				["모든 저항"] = ALL_RESISTS,
			},

			PATTERNS_GENERIC_STAGE1 = {
				{ pattern = "비전", 	effect = "ARCANE" },
				{ pattern = "화염", 	effect = "FIRE" },
				{ pattern = "냉기", 	effect = "FROST" },
				{ pattern = "신성", 	effect = "HOLY" },
				{ pattern = "암흑", 	effect = "SHADOW" },
				{ pattern = "자연", 	effect = "NATURE" }
			},

			PATTERNS_GENERIC_STAGE2 = {
				{ pattern = "저항",	 	effect = "RES" },
				{ pattern = "피해", 		effect = "DMG" },
				{ pattern = "주문 공격력",	effect = "DMG" },
			},

			PATTERNS_OTHER = {
--				{ pattern = "Reinforced %(%+(%d+) Armor%)", effect = "ARMOR" },
--				{ pattern = "Mana Regen (%d+) per 5 sec%.", effect = "MANAREG" },

				{ pattern = "최하급 마술사 오일", effect = HEAL_AND_DMG, value = 8 },
				{ pattern = "하급 마술사 오일", effect = HEAL_AND_DMG, value = 16 },
				{ pattern = "마술사 오일", effect = HEAL_AND_DMG, value = 24 },
				{ pattern = "반짝이는 마술사 오일", effect = {"DMG", "HEAL", "SPELLCRIT"}, value = {36, 36, 1} },

				{ pattern = "최하급 마나 오일", effect = "MANAREG", value = 4 },
				{ pattern = "하급 마나 오일", effect = "MANAREG", value = 8 },
				{ pattern = "반짝이는 마나 오일", effect = { "MANAREG", "HEAL"}, value = {12, 25} },

--				{ pattern = "Eternium Line", effect = "FISHING", value = 5 },
--				{ pattern = "Vitality", effect = {"MANAREG", "HEALTHREG"}, value = {4, 4} },
--				{ pattern = "Soulfrost", effect = {"FROSTDMG", "SHADOWDMG"}, value = {54, 54} },
--				{ pattern = "Sunfire", effect = {"ARCANEDMG", "FIREDMG"}, value = {50, 50} },
			},
		}
	else
		ItemBonusLib:Print("ItemBonusLib does not support your locale.")
	end

	for _, p in ipairs(L.PATTERNS_PASSIVE) do
		if not p.nofinish then
			p.pattern = "^" .. p.pattern .. "$"
		else
			p.pattern = "^" .. p.pattern
			p.nofinish = nil
		end
	end
end
