<commit_before>--[[--------------------------------------------------------------------
    Ovale Spell Priority
    Copyright (C) 2012 Sidoine
    Copyright (C) 2012, 2013, 2014 <NAME>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License in the LICENSE
    file accompanying this program.
--]]--------------------------------------------------------------------

--[[
	This addon tracks rune information on death knights.
--]]

local _, Ovale = ...
local OvaleRunes = Ovale:NewModule("OvaleRunes", "AceEvent-3.0")
Ovale.OvaleRunes = OvaleRunes

--<private-static-properties>
-- Forward declarations for module dependencies.
local OvaleData = nil
local OvalePower = nil
local OvaleSpellBook = nil
local OvaleStance = nil
local OvaleState = nil

local ipairs = ipairs
local pairs = pairs
local API_GetRuneCooldown = GetRuneCooldown
local API_GetRuneType = GetRuneType
local API_GetTime = GetTime
local API_UnitClass = UnitClass

-- Player's class.
local _, self_class = API_UnitClass("player")

local BLOOD_RUNE = 1
local UNHOLY_RUNE = 2
local FROST_RUNE = 3
local DEATH_RUNE = 4

local RUNE_TYPE = {
	blood = BLOOD_RUNE,
	unholy = UNHOLY_RUNE,
	frost = FROST_RUNE,
	death = DEATH_RUNE,
}
local RUNE_NAME = {}
do
	for k, v in pairs(RUNE_TYPE) do
		RUNE_NAME[v] = k
	end
end

--[[
	Rune slots are numbered as follows in the default UI:

		blood	frost	unholy
		[1][2]	[5][6]	[3][4]
--]]
local RUNE_SLOTS = {
	[BLOOD_RUNE] =	{ 1, 2 },
	[UNHOLY_RUNE] =	{ 3, 4 },
	[FROST_RUNE] =	{ 5, 6 },
}

--[[
	From SimC:sc_death_knight.cpp:

	If explicitly consuming a death rune, any death runes available are preferred in the order:

		frost > blood > unholy.

	If consuming a non-death rune of a given type and that no rune of that type is available,
	any death runes available are preferred in the order:

		blood > unholy > frost
--]]
local DEATH_RUNE_PRIORITY = { 3, 4, 5, 6, 1, 2 }
local ANY_RUNE_PRIORITY = { 1, 2, 3, 4, 5, 6 }

-- Improved Blood Presence increases rune regenerate rate by 20%.
local IMPROVED_BLOOD_PRESENCE = 50371
--</private-static-properties>

--<public-static-properties>
-- Current rune information, indexed by slot.
OvaleRunes.rune = {}
OvaleRunes.RUNE_TYPE = RUNE_TYPE
--</public-static-properties>

--<public-static-methods>
function OvaleRunes:OnInitialize()
	-- Resolve module dependencies.
	OvaleData = Ovale.OvaleData
	OvalePower = Ovale.OvalePower
	OvaleSpellBook = Ovale.OvaleSpellBook
	OvaleStance = Ovale.OvaleStance
	OvaleState = Ovale.OvaleState<commit_msg>Suppress compiler.pl warning.<commit_after>--[[--------------------------------------------------------------------
    Ovale Spell Priority
    Copyright (C) 2012 Sidoine
    Copyright (C) 2012, 2013, 2014 <NAME>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License in the LICENSE
    file accompanying this program.
--]]--------------------------------------------------------------------

--[[
	This addon tracks rune information on death knights.
--]]

local _, Ovale = ...
local OvaleRunes = Ovale:NewModule("OvaleRunes", "AceEvent-3.0")
Ovale.OvaleRunes = OvaleRunes

--<private-static-properties>
-- Forward declarations for module dependencies.
local OvaleData = nil
local OvalePower = nil
local OvaleSpellBook = nil
local OvaleStance = nil
local OvaleState = nil

local ipairs = ipairs
local pairs = pairs
local API_GetRuneCooldown = GetRuneCooldown
local API_GetRuneType = GetRuneType
local API_GetTime = GetTime
local API_UnitClass = UnitClass

-- Player's class.
local _, self_class = API_UnitClass("player")

local BLOOD_RUNE = 1
local UNHOLY_RUNE = 2
local FROST_RUNE = 3
local DEATH_RUNE = 4

local RUNE_TYPE = {
	blood = BLOOD_RUNE,
	unholy = UNHOLY_RUNE,
	frost = FROST_RUNE,
	death = DEATH_RUNE,
}
local RUNE_NAME = {}
do
	for k, v in pairs(RUNE_TYPE) do
		RUNE_NAME[v] = k
	end
end

--[[
	Rune slots are numbered as follows in the default UI:

		blood	frost	unholy
		[1][2]	[5][6]	[3][4]
--]]
local RUNE_SLOTS = {
	[BLOOD_RUNE] =	{ 1, 2 },
	[UNHOLY_RUNE] =	{ 3, 4 },
	[FROST_RUNE] =	{ 5, 6 },
}

--[[
	From SimulationCraft's sc_death_knight.cpp:

	If explicitly consuming a death rune, any death runes available are preferred in the order:

		frost > blood > unholy.

	If consuming a non-death rune of a given type and that no rune of that type is available,
	any death runes available are preferred in the order:

		blood > unholy > frost
--]]
local DEATH_RUNE_PRIORITY = { 3, 4, 5, 6, 1, 2 }
local ANY_RUNE_PRIORITY = { 1, 2, 3, 4, 5, 6 }

-- Improved Blood Presence increases rune regenerate rate by 20%.
local IMPROVED_BLOOD_PRESENCE = 50371
--</private-static-properties>

--<public-static-properties>
-- Current rune information, indexed by slot.
OvaleRunes.rune = {}
OvaleRunes.RUNE_TYPE = RUNE_TYPE
--</public-static-properties>

--<public-static-methods>
function OvaleRunes:OnInitialize()
	-- Resolve module dependencies.
	OvaleData = Ovale.OvaleData
	OvalePower = Ovale.OvalePower
	OvaleSpellBook = Ovale.OvaleSpellBook
	OvaleStance = Ovale.OvaleStance
	OvaleState = Ovale.OvaleState
{'fraction_non_alphanumeric': 0.14709877741121677, 'fraction_numerical': 0.020570541432175432, 'mean_word_length': 3.1035031847133756, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5673728', 'n_tokens_mistral': 1984, 'n_tokens_neox': 1831, 'n_words': 542}