local AddName, Ns = ...
local L = Ns.L

------------------------------
--		Stat Options		--
------------------------------
local Both, Enhanced, Damage, DamageTaken, Percentage, Rating, MainHand, OffHand, World, Realm, Heroism, Valor, Equipped, Honor, Arena, Player, Mood, Static = 3, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 1
local SameLevel, BossLevel, Regen, Casting, Critical, CritDamage, Total, Max, Average, Auto, Chance, Reduction, Bags, StoneKeeper, Marks, Pet, Damage, Live = 1, 2, 1, 2, 1, 2, 1, 1, 2, 3, 1, 2, 3, 1, 2, 2, 2, 1
local Basic, Base, Modifiers, Complete, Points, Value, Normal, Special = 2, 2, 3, 1, 1, 1, 1, 2


Ns.ConfigWidth = 950
Ns.ConfigHeight = 550 --700
if GetLocale() == "frFR" then
	Ns.ConfigWidth = 960
end
Ns.targetLevel, Ns.ohID = 0, 0

local honorIcon = 73824
local faction = UnitFactionGroup("player")

if faction == "Horde" then honorIcon = 59641 end

------------------------------
--		Display Order		--
------------------------------
Ns.DefaultOrder = {
	{ stat="AP", onupdate=true, events={}, spell=46909, spellclass="Melee", widget={ type="CheckBox" }, options={ Enhanced_Base=true, }, subgroup=true, activeonload=true, },
	{ stat="RAP", onupdate=true, events={}, spell=56342, spellclass="Ranged", widget={ type="CheckBox" }, options={ Enhanced_Base=true, }, subgroup=true, activeonload=true, },
	{ stat="DMG", onupdate=true, events={}, spell=1329, spellclass="Melee", widget={ type="CheckBox" }, options={ Main_Off_Auto=true, Display_Average=true }, subgroup=true },
	{ stat="mDPS", onupdate=true, events={}, spell=35542, spellclass="Melee", widget={ type="CheckBox" }, options={ Main_Off_Auto=true, Display_Average=true }, subgroup=true },
	{ stat="RDMG", onupdate=true, events={}, spell=53228, spellclass="Ranged", widget={ type="CheckBox" }, options={ Max_Average_Damage=true, }, subgroup=true },
	{ stat="rDPS", onupdate=true, events={}, spell=19418, spellclass="Ranged", widget={ type="CheckBox" }, options={ Max_Average_Damage=true, }, subgroup=true },
	{ stat="Fire", onupdate=true, events={}, spell=86948, spellclass="Spell", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Dec_Spell_Fire=true }, subgroup=true, activeonload=true, },
	{ stat="Frost", onupdate=true, events={}, spell=83157, spellclass="Spell", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Dec_Spell_Frost=true }, subgroup=true },
	{ stat="Arcane", onupdate=true, events={}, spell=31572, spellclass="Spell", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Dec_Spell_Arcane=true }, subgroup=true },
	{ stat="Shadow", onupdate=true, events={}, spell=47230, spellclass="Spell", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Dec_Spell_Shadow=true }, subgroup=true },
	{ stat="Nature", onupdate=true, events={}, spell=48514, spellclass="Spell", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Dec_Spell_Nature=true }, subgroup=true },
	{ stat="Holy", onupdate=true, events={}, spell=63542, spellclass="Spell", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Dec_Spell_Holy=true }, subgroup=true },
	{ stat="Healing", onupdate=true, events={}, spell=26022, spellclass="Spell", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Dec_Spell_Healing=true }, subgroup=true },
	{ stat="Mastery", onupdate=true, events={}, spell=86479, spellclass="Attributes", widget={ type="CheckBox" }, options={ Point_Rating=true, Decimals_Mastery=true, Cap_Mastery=true }, subgroup=true, activeonload=true, },
	{ stat="Strength", onupdate=true, events={}, spell=46917, spellclass="Attributes", widget={ type="CheckBox" }, options={ Show=true, Dec_Melee_Str=true }, subgroup=true },
	{ stat="Agility", onupdate=true, events={}, spell=51723, spellclass="Attributes", widget={ type="CheckBox" }, options={ Show=true, Dec_Melee_Agi=true }, subgroup=true },
	{ stat="Crit", onupdate=true, events={}, spell=29859, spellclass="Melee", widget={ type="CheckBox" }, options={ Percent_Rating=true, Display_Basic=true, Dec_Melee_Crit=true, Display_Simulate=true, Cap_Melee_Crit=true }, subgroup=true },
	{ stat="CritBoss", onupdate=true, events={}, spell=58426, spellclass="Melee", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Dec_Melee_Boss=true, Cap_Melee_CritBoss=true }, subgroup=true },
	{ stat="CritCap", onupdate=true, events={}, spell=51690, spellclass="Melee", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Dec_Melee_Cap=true }, subgroup=true },
	{ stat="RangedCrit", onupdate=true, events={}, spell=53241, spellclass="Ranged", widget={ type="CheckBox" }, options={ Percent_Rating=true, Dec_Ranged_Crit=true, Cap_Ranged_Crit=true, Display_Simulate=true }, subgroup=true },
	{ stat="RangedCritBoss", onupdate=true, events={}, spell=76577, spellclass="Ranged", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Dec_Ranged_CritBoss=true, Cap_Ranged_CritBoss=true }, subgroup=true },
	{ stat="Intellect", onupdate=true, events={}, spell=81206, spellclass="Attributes", widget={ type="CheckBox" }, options={ Show=true, Dec_Spell_Int=true }, subgroup=true },
	{ stat="SpellCrit", onupdate=true, events={}, spell=44445, spellclass="Spell", widget={ type="CheckBox" }, options={ Percent_Rating=true, Display_Basic=true, Dec_Spell_Crit=true, Cap_Spell_Crit=true, Display_Simulate=true }, subgroup=true },
	{ stat="SpellCritBoss", onupdate=true, events={}, spell=44745, spellclass="Spell", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Dec_Spell_Crit_Boss=true, Cap_Spell_CritBoss=true }, subgroup=true },
	{ stat="Hit", onupdate=true, events={}, spell=82925, spellclass="Melee", widget={ type="CheckBox" }, options={ Percent_Rating=true, Display_Decimals=true, Dec_Melee_Hit=true, Cap_Melee_Hit=true, }, subgroup=true },
	{ stat="RangedHit", onupdate=true, events={}, spell=35030, spellclass="Ranged", widget={ type="CheckBox" }, options={ Percent_Rating=true, Dec_Ranged_Hit=true, Cap_Ranged_Hit=true }, subgroup=true },
	{ stat="SpellHit", onupdate=true, events={}, spell=47573, spellclass="Spell", widget={ type="CheckBox" }, options={ Percent_Rating=true, Dec_Spell_Hit=true, Cap_Spell_Hit=true }, subgroup=true },
	{ stat="HasteMelee", onupdate=true, events={}, spell=63150, spellclass="Melee", widget={ type="CheckBox" }, options={ Percent_Rating=true, Display_Basic=true, Dec_Melee_Haste=true, Cap_Melee_Haste=true }, subgroup=true },
	{ stat="HasteRanged", onupdate=true, events={}, spell=23989, spellclass="Ranged", widget={ type="CheckBox" }, options={ Percent_Rating=true, Display_Basic=true, Dec_Ranged_Haste=true, Cap_Ranged_Haste=true }, subgroup=true },
	{ stat="HasteCaster", onupdate=true, events={}, spell=30060, spellclass="Spell", widget={ type="CheckBox" }, options={ Percent_Rating=true, Display_Basic=true, Dec_Spell_Haste=true }, subgroup=true },
	{ stat="ArmorPen", onupdate=true, events={}, spell=84963, spellclass="Melee", widget={ type="CheckBox" }, options={ Percent_Rating=true, Display_Basic=true, Dec_Melee_Pen=true }, subgroup=true },
	{ stat="RangedPen", onupdate=true, events={}, spell=53238, spellclass="Ranged", widget={ type="CheckBox" }, options={ Percent_Rating=true, Dec_Ranged_Pen=true, Cap_Ranged_ArP=true }, subgroup=true },
	{ stat="SpellPenetration", onupdate=true, events={}, spell=44404, spellclass="Spell", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Dec_Spell_Pen=true }, subgroup=true },
	{ stat="Expertise", onupdate=true, events={}, spell=30920, spellclass="Melee", widget={ type="CheckBox" }, options={ Value_Rating=true, Display_Expertise=true, Dec_Melee_Exp=true, Cap_Melee_Exp=true, Display_Simulate=true }, subgroup=true },
	{ stat="MeleeMiss", onupdate=true, events={}, spell=79133, spellclass="Melee", widget={ type="CheckBox" }, options={ Level_Same_Boss=true, Dec_Melee_Miss=true, Display_Special=true, Display_Simulate=true }, subgroup=true },
	{ stat="RangedMiss", onupdate=true, events={}, spell=49018, spellclass="Ranged", widget={ type="CheckBox" }, options={ Level_Same_Boss=true, Dec_Ranged_Miss=true, Display_Simulate=true }, subgroup=true },
	{ stat="SpellMiss", onupdate=true, events={}, spell=85222, spellclass="Spell", widget={ type="CheckBox" }, options={ Level_Same_Boss=true, Dec_Spell_Miss=true, Display_Simulate=true }, subgroup=true },
	{ stat="Avoidance", onupdate=true, events={}, spell=61221, spellclass="Defense", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Dec_Def_Avoidance=true, Cap_Def_Avo=true, Add_Block=true }, subgroup=true, activeonload=true, },
 	{ stat="NPCArmor", onupdate=true, events={}, spell=44520, spellclass="Melee", widget={ type="CheckBox" }, options={ Enhanced_Base=true, }, subgroup=true },
	{ stat="BossReduc", onupdate=true, events={}, spell=48792, spellclass="Melee", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Dec_Melee_Dmg=true }, subgroup=true },
	{ stat="weaponSpeed", onupdate=true, events={}, spell=109935, spellclass="Melee", widget={ type="CheckBox" }, options={ Main_Off_Auto=true, Dec_Melee_AttSp=true }, subgroup=true },
	{ stat="CritReceived", onupdate=true, events={}, spell=46867, spellclass="Defense", widget={ type="CheckBox" }, options={ Chance_Reduction=true, Dec_Def_Crit=true, Display_Simulate=true }, subgroup=true },
	{ stat="rangedSpeed", onupdate=true, events={}, spell=34482, spellclass="Ranged", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Dec_Ranged_AttSp=true }, subgroup=true },
	{ stat="Spirit", onupdate=true, events={}, spell=48104, spellclass="Attributes", widget={ type="CheckBox" }, options={ Show=true, Dec_Spell_Spir=true }, subgroup=true },
	{ stat="ManaRegen", onupdate=true, events={}, spell=45234, spellclass="Spell", widget={ type="CheckBox" }, options={ Regen_Normal_Casting=true, Display_Basic=true, Dec_Spell_MP2=true }, subgroup=true },
	{ stat="MP5", onupdate=true, events={}, spell=47585, spellclass="Spell", widget={ type="CheckBox" }, options={ Regen_Normal_Casting=true, Display_Basic=true, Dec_Spell_MP5=true }, subgroup=true },
	{ stat="Mitigation", onupdate=true, events={}, spell=46945, spellclass="Defense", widget={ type="CheckBox" }, options={ Total_Modifiers=true, Dec_Def_Mit=true, Cap_Def_Mit=true }, subgroup=true },
	{ stat="EHP", onupdate=true, events={}, spell=85696, spellclass="Defense", widget={ type="CheckBox" }, options={ Show=true }, subgroup=true },
	{ stat="Resilience", onupdate=true, events={}, spell=74001, spellclass="Defense", widget={ type="CheckBox" }, options={ Dec_Def_Res=true }, subgroup=true },
	{ stat="Stamina", onupdate=true, events={}, spell=85730, spellclass="Attributes", widget={ type="CheckBox" }, options={ Show=true, Dec_Def_Stamina=true  }, subgroup=true },
	{ stat="Armor", onupdate=true, events={}, spell=86894, spellclass="Defense", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Dec_Def_Armor=true, Cap_Def_Armor=true }, subgroup=true },
	{ stat="Dodge", onupdate=true, events={}, spell=13981, spellclass="Defense", widget={ type="CheckBox" }, options={ Percent_Rating=true, Dec_Def_Dodge=true, Display_Simulate=true }, subgroup=true },
	{ stat="Parry", onupdate=true, events={}, spell=3127, spellclass="Defense", widget={ type="CheckBox" }, options={ Percent_Rating=true, Dec_Def_Parry=true, Display_Simulate=true }, subgroup=true },
	{ stat="Block", onupdate=true, events={}, spell=52127, spellclass="Defense", widget={ type="CheckBox" }, options={ Percent_Rating=true, Dec_Def_Block=true, Block_Damage=true, Display_Simulate=true }, subgroup=true },
	{ stat="petAP", onupdate=true, events={}, spell=53270, spellclass="Pet", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true, activeonload=true, },
	{ stat="petDMG", onupdate=true, events={}, spell=80553, spellclass="Pet", widget={ type="CheckBox" }, options={ Max_Average_Damage=true, }, subgroup=true },
	{ stat="petDPS", onupdate=true, events={}, spell=19623, spellclass="Pet", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
	{ stat="petSpell", onupdate=true, events={}, spell=3716, spellclass="Pet", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
	{ stat="petCrit", onupdate=true, events={}, spell=50334, spellclass="Pet", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
	{ stat="petAtkSpeed", onupdate=true, events={}, spell=78893, spellclass="Pet", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
	{ stat="petArmor", onupdate=true, events={}, spell=60114, spellclass="Pet", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
	{ stat="FireResist", events={ UNIT_RESISTANCES={ "player", }, }, spell=64353, spellclass="Resistance", widget={ type="CheckBox" }, options={ Player_Pet=true, }, subgroup=true, activeonload=true, },
	{ stat="FrostResist", events={ UNIT_RESISTANCES={ "player", }, }, spell=11175, spellclass="Resistance", widget={ type="CheckBox" }, options={ Player_Pet=true, }, subgroup=true },
	{ stat="ShadowResist", events={ UNIT_RESISTANCES={ "player", }, }, spell=63117, spellclass="Resistance", widget={ type="CheckBox" }, options={ Player_Pet=true, }, subgroup=true },
	{ stat="ArcaneResist", events={ UNIT_RESISTANCES={ "player", }, }, spell=44400, spellclass="Resistance", widget={ type="CheckBox" }, options={ Player_Pet=true, }, subgroup=true },
	{ stat="NatureResist", events={ UNIT_RESISTANCES={ "player", }, }, spell=63373, spellclass="Resistance", widget={ type="CheckBox" }, options={ Player_Pet=true, }, subgroup=true },
	{ stat="ValorPoints", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=396, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true, activeonload=true, },
	{ stat="JusticePoints", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=395, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
	{ stat="ScourgeStone", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=2711, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
	{ stat="Sidereal", events={ CURRENCY_DISPLAY_UPDATE=true, }, item=41266, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
	{ stat="PvP", events={ CURRENCY_DISPLAY_UPDATE=true, }, spell=honorIcon, spellclass="Currency", widget={ type="CheckBox" }, options={ Honor_Arena=true, }, subgroup=true },	
	{ stat="Money", events={ PLAYER_MONEY=true, }, spell=67368, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Display_Gold=true, Decimals_Default=true, }, subgroup=true },
	{ stat="WowToken", onupdate=true, events={}, item=122284, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Display_Short=true, }, subgroup=true },	
	{ stat="Speed", onupdate=true, events={}, updatespeed=1, spell=31641, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, Speed_Static=true }, subgroup=true, activeonload=true, },
	{ stat="TargetSpeed", onupdate=true, events={}, spell=52358, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
	{ stat="Threat", onupdate=true, events={}, spell=355, spellclass="Misc", widget={ type="CheckBox" }, options={ Percent_Rating=true, }, subgroup=true },
	{ stat="GearScore", events={ PLAYER_EQUIPMENT_CHANGED=true }, item=51902, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, Score_Color=true }, subgroup=true },
	{ stat="ItemLevel", onupdate=true, events={}, spell=66666, spellclass="Misc", widget={ type="CheckBox" }, options={ Equip_Max=true, Dec_Misc_Ilvl=true }, subgroup=true },
	{ stat="GlobalCD", events={ UNIT_SPELLCAST_SUCCEEDED={ "player" }, }, spell=71328, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, Dec_Misc_Gcd=true }, subgroup=true },
	{ stat="Durability", events={ UPDATE_INVENTORY_DURABILITY=true, }, spell=3100, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, AutoColorOff=true }, subgroup=true },
	{ stat="RepairCost", events={ UPDATE_INVENTORY_DURABILITY=true, }, spell=11209, spellclass="Misc", widget={ type="CheckBox" }, options={ Total_Equipped_Bags=true, }, subgroup=true },
	{ stat="Lag", onupdate=true, events={}, spell=33592, spellclass="Misc", widget={ type="CheckBox" }, options={ World_Realm=true, }, subgroup=true },
	{ stat="FPS", onupdate=true, events={}, updatespeed=1, spell=62695, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
	{ stat="BuffCounter", onupdate=true, events={}, spell=22888, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
	{ stat="DebuffCounter", onupdate=true, events={}, spell=23154, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
}

------------------------------
--		Global Events		--
------------------------------
Ns.GlobalEvents = {
	UNIT_AURA={ "player", "target", "pet"},
	UNIT_INVENTORY_CHANGED={ "player", },
	UNIT_STATS={ "player", },
	UNIT_DEFENSE={ "player", },
	BAG_CLOSED=true,
	BIND_ENCHANT=true,
	CHARACTER_POINTS_CHANGED=true,
	COMBAT_LOG_EVENT_UNFILTERED=true,
	PLAYER_REGEN_DISABLED=true,
	PLAYER_LEVEL_UP=true,
	PLAYER_TARGET_CHANGED=true,
	REPLACE_ENCHANT=true,
	GLYPH_ADDED=true,
	GLYPH_REMOVED=true,
	GLYPH_UPDATED=true,
	PLAYER_TALENT_UPDATE=true,
}

------------------------------
--		Settings Groups		--
------------------------------
Ns.SpellClass = {
	[0] = { stat="Settings", grp=Ns.SettingsGroupOrder, order=Ns.SettingsDisplayOrder, icon="Settings", },
	[1] = { stat="Attributes", icon="Attributes", },
	[2] = { stat="Melee", icon="Melee", },
	[3] = { stat="Defense", icon="Defense", },
	[4] = { stat="Ranged", icon="Ranged", },
	[5] = { stat="Spell", icon="Spell", },
	[6] = { stat="Pet", icon="Pet", },
	[7] = { stat="Resistance", icon="Resistance", },
	[8] = { stat="Currency", icon="Currency", },
	[9] = { stat="Misc", icon="Misc", },
}

------------------------------
--		Stat Options		--
------------------------------
Ns.Options = {
	-- stat options
	{ stat="Show", widget={ type="CheckBox", } },
	{ stat="Enhanced_Base", spellclass="Enhanced_Base", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Enhanced", "Basic", "Both"}, },
	{ stat="Total_Modifiers", spellclass="Total_Modifiers", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Complete", "Base", "Modifiers"}, },
	{ stat="Percent_Rating", spellclass="Percent_Rating", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Percentage", "Rating", "Both"}, },
	{ stat="Point_Rating", spellclass="Point_Rating", widget={ type="Radio", }, tooltip=false, default=1, labels={ "Points", "Rating", "Both"}, },
	{ stat="Main_Off_Hand", spellclass="Main_Off_Hand", widget={ type="Radio", }, tooltip=true, default=1, labels={ "MainHand", "OffHand", "Both"}, },
	{ stat="Level_Same_Boss", spellclass="Level_Same_Boss", widget={ type="Radio", }, tooltip=true, default=1, labels={ "SameLevel", "BossLevel", "Both"}, },
	{ stat="Regen_Normal_Casting", spellclass="Regen_Normal_Casting", widget={ type="Radio", }, tooltip=true, default=1, labels={ "OutOfCombat", "Casting", "Both"}, },
	{ stat="Crit_Damage_Taken", spellclass="Crit_Damage_Taken", widget={ type="Radio", }, tooltip=true, default=1, labels={ "CritTaken", "DamageTaken", "Both"}, },
	{ stat="Total_Rating", spellclass="Total_Rating", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Total", "Rating", "Both"}, },
	{ stat="Max_Average_Damage", spellclass="Max_Average_Damage", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Max", "Average", "Both"}, },
	{ stat="Main_Off_Auto", spellclass="Main_Off_Auto", widget={ type="Radio", }, tooltip=true, default=1, labels={ "MainHand", "OffHand", "Auto"}, },
	{ stat="Value_Rating", spellclass="Value_Rating", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Value", "Rating", "Both"}, },
	{ stat="World_Realm", spellclass="World_Realm", widget={ type="Radio", }, tooltip=true, default=1, labels={ "World", "Realm", "Both"}, },
	{ stat="Total_Equipped_Bags", spellclass="Total_Equipped_Bags", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Total", "Equipped", "Bags"}, },
	{ stat="Heroism_Valor", spellclass="Heroism_Valor", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Heroism", "Valor", "Both"}, },
	{ stat="Shards_Marks", spellclass="Shards_Marks", widget={ type="Radio", }, tooltip=true, default=1, labels={ "StoneKeeper", "Marks", "Both"}, },
	{ stat="Honor_Arena", spellclass="Honor_Arena", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Honor", "Arena", "Both"}, },
	{ stat="Player_Pet", spellclass="Player_Pet", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Player", "Pet", "Both"}, },
	{ stat="Mood_Damage", spellclass="Mood_Damage", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Mood", "Damage", "Both"}, },
	{ stat="Chance_Reduction", spellclass="Chance_Reduction", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Chance", "Reduction", "Both"}, },
	{ stat="Equip_Max", spellclass="Equip_Max", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Equipped", "Max", "Both"}, },
	--
	{ stat="Display_Average", spellclass="Display_Average", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "Display_Average"}, },
	{ stat="Display_Basic", spellclass="Display_Basic", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "Display_Basic"}, },
	{ stat="Display_MainHand", spellclass="Display_MainHand", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "Display_MainHand"}, },
	{ stat="Display_Expertise", spellclass="Display_Expertise", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "Display_Expertise"}, },
	{ stat="Display_Short", spellclass="Display_Short", widget={ type="CheckBox", }, tooltip=false,  default=false, labels={ "Display_Short"}, },
	{ stat="Speed_Static", spellclass="Speed_Static", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Live", "Static", "Both"}, },
	{ stat="Score_Color", spellclass="Score_Color", widget={ type="CheckBox", }, tooltip=false, default=true, labels={ "Score_Color"}, },
	{ stat="Add_Block", spellclass="Add_Block", widget={ type="CheckBox", }, tooltip=false, default=false, labels={ "Add_Block"}, },
	{ stat="Block_Damage", spellclass="Block_Damage", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "Block_Damage"}, },
	{ stat="Display_Special", spellclass="Display_Special", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "Display_Special"}, },
	{ stat="Display_Gold", spellclass="Display_Gold", widget={ type="CheckBox", }, tooltip=false, default=false, labels={ "Display_Gold"}, },
	{ stat="AutoColorOff", spellclass="AutoColorOff", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "AutoColorOff"}, newline=true, },
	-- Spell decimals sliders
	{ stat="Dec_Spell_Int", spellclass="Dec_Spell_Int", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Spell_Spir", spellclass="Dec_Spell_Spir", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Spell_Crit", spellclass="Dec_Spell_Crit", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Spell_Crit_Boss", spellclass="Dec_Spell_Crit_Boss", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Spell_Haste", spellclass="Dec_Spell_Haste", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Spell_Hit", spellclass="Dec_Spell_Hit", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Spell_Fire", spellclass="Dec_Spell_Fire", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Spell_Frost", spellclass="Dec_Spell_Frost", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Spell_Arcane", spellclass="Dec_Spell_Arcane", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Spell_Shadow", spellclass="Dec_Spell_Shadow", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Spell_Nature", spellclass="Dec_Spell_Nature", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Spell_Holy", spellclass="Dec_Spell_Holy", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Spell_Healing", spellclass="Dec_Spell_Healing", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Spell_Miss", spellclass="Dec_Spell_Miss", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Spell_MP2", spellclass="Dec_Spell_MP2", default=1, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Spell_MP5", spellclass="Dec_Spell_MP5", default=1, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Spell_Pen", spellclass="Dec_Spell_Pen", default=1, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Decimals_Default", spellclass="Decimals_Default", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	-- Misc decimals sliders
	{ stat="Dec_Misc_Ilvl", spellclass="Dec_Misc_Ilvl", default=1, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Misc_Gcd", spellclass="Dec_Misc_Gcd", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	-- Ranged decimals sliders
	{ stat="Dec_Ranged_Crit", spellclass="Dec_Ranged_Crit", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Ranged_CritBoss", spellclass="Dec_Ranged_CritBoss", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Ranged_Hit", spellclass="Dec_Ranged_Hit", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Ranged_Haste", spellclass="Dec_Ranged_Haste", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Ranged_Pen", spellclass="Dec_Ranged_Pen", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Ranged_Miss", spellclass="Dec_Ranged_Miss", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Ranged_AttSp", spellclass="Dec_Ranged_AttSp", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	-- Defense decimals sliders
	{ stat="Dec_Def_Stamina", spellclass="Dec_Def_Stamina", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Def_Armor", spellclass="Dec_Def_Armor", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Def_Avoidance", spellclass="Dec_Def_Avoidance", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Def_Crush", spellclass="Dec_Def_Crush", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Def_Miss", spellclass="Dec_Def_Miss", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Def_Crit", spellclass="Dec_Def_Crit", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Def_Def", spellclass="Dec_Def_Def", default=1, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Def_Mit", spellclass="Dec_Def_Mit", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Def_Res", spellclass="Dec_Def_Res", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Def_Hit", spellclass="Dec_Def_Hit", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Def_Dodge", spellclass="Dec_Def_Dodge", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Def_Parry", spellclass="Dec_Def_Parry", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Def_Block", spellclass="Dec_Def_Block", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	-- Melee decimals sliders
	{ stat="Dec_Melee_DPS", spellclass="Dec_Melee_DPS", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Melee_Crit", spellclass="Dec_Melee_Crit", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Melee_Boss", spellclass="Dec_Melee_Boss", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Melee_Cap", spellclass="Dec_Melee_Cap", default=1, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Melee_Hit", spellclass="Dec_Melee_Hit", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Melee_Haste", spellclass="Dec_Melee_Haste", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Melee_Pen", spellclass="Dec_Melee_Pen", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Melee_Exp", spellclass="Dec_Melee_Exp", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Melee_Miss", spellclass="Dec_Melee_Miss", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Melee_Dmg", spellclass="Dec_Melee_Dmg", default=1, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Melee_AttSp", spellclass="Dec_Melee_AttSp", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Melee_Str", spellclass="Dec_Melee_Str", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Dec_Melee_Agi", spellclass="Dec_Melee_Agi", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Decimals_Mastery", spellclass="Decimals_Mastery", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	-- Melee cap boxes
	{ stat="Cap_Melee_Crit", spellclass="Cap_Melee_Crit", default=100, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	{ stat="Cap_Melee_CritBoss", spellclass="Cap_Melee_CritBoss", default=100, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	{ stat="Cap_Melee_Hit", spellclass="Cap_Melee_Hit", default=8, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	{ stat="Cap_Melee_Haste", spellclass="Cap_Melee_Haste", default=200, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	{ stat="Cap_Melee_Exp", spellclass="Cap_Melee_Exp", default=26, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f", }, },
	{ stat="Cap_Mastery", spellclass="Cap_Mastery", default=100, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	-- Defense cap boxes
	{ stat="Cap_Def_Def", spellclass="Cap_Def_Def", default=540, tooltip=true, widget={ type="EditBox", width=50, height=20, numeric=true, format="%.2f", }, },
	{ stat="Cap_Def_Armor", spellclass="Cap_Def_Armor", default=49905, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.0f", }, },
	{ stat="Cap_Def_Mit", spellclass="Cap_Def_Mit", default=75, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.0f%%", }, },
	{ stat="Cap_Def_Avo", spellclass="Cap_Def_Avo", default=102.4, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	-- Ranged cap boxes
	{ stat="Cap_Ranged_Haste", spellclass="Cap_Ranged_Haste", default=200, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	{ stat="Cap_Ranged_Crit", spellclass="Cap_Ranged_Crit", default=104.8, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.1f%%", }, },
	{ stat="Cap_Ranged_CritBoss", spellclass="Cap_Ranged_CritBoss", default=104.8, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.1f%%", }, },
	{ stat="Cap_Ranged_Hit", spellclass="Cap_Ranged_Hit", default=8, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	{ stat="Cap_Ranged_ArP", spellclass="Cap_Ranged_ArP", default=1440, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.0f", }, },
	-- Spell cap boxes
	{ stat="Cap_Spell_Crit", spellclass="Cap_Spell_Crit", default=100, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	{ stat="Cap_Spell_CritBoss", spellclass="Cap_Spell_CritBoss", default=100, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	{ stat="Cap_Spell_Hit", spellclass="Cap_Spell_Hit", default=17, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	-- Other options
	{ stat="Display_Simulate", spellclass="Display_Simulate", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "Display_Simulate"}, },
	{ stat="Add_Speed", spellclass="Add_Speed", widget={ type="CheckBox", }, tooltip=true, default=true, labels={ "Add_Speed"}, },
	{ stat="Add_AtkSpeed", spellclass="Add_AtkSpeed", widget={ type="CheckBox", }, tooltip=true, default=true, labels={ "Add_AtkSpeed"}, },
}

--------------------------
--		Class & ID		--
--------------------------
Ns.byPlayerClass = {
	["DEATHKNIGHT"] = 6,
	["DRUID"] = 11,
	["HUNTER"] = 3,
	["MAGE"] = 8,
	["PALADIN"] = 2,
	["PRIEST"] = 5,
	["ROGUE"] = 4,
	["SHAMAN"] = 7,
	["WARLOCK"] = 9,
	["WARRIOR"] = 1,
}

------------------------------
--		Class defaults		--
------------------------------
function Ns:GetClassDefaults(class)
	local defaults = {
		DEATHKNIGHT = {
			AP = true,
			DMG = true,
			Crit = true,
			Hit = true,
			HasteMelee = true,
			MeleeMiss = true,
			Armor = true,
			ArmorPen = true,
			Defense = true,
			BossReduc = true,
			GearScore = true,
			Speed = true,
			Durability = true,
		},
		DRUID = {
			AP = true,
			Nature = true,
			Healing = true,
			MP5 = true,
			Crit = true,
			SpellCrit = true,
			SpellHit = true,
			SpellMiss = true,
			Mitigation = true,
			GearScore = true,
			Speed = true,
			Durability = true,
		},
		HUNTER = {
			RAP = true,
			RDMG = true,
			rDPS = true,
			RangedCrit = true,
			RangedHit = true,
			HasteRanged = true,
			RangedMiss = true,
			RangedPen = true,
			MP2 = true,
			GearScore = true,
			Speed = true,
			Durability = true,
		},
		MAGE = {
			Frost = true,
			Fire = true,
			SpellCrit = true,
			SpellHit = true,
			SpellPenetration = true,
			SpellMiss = true,
			HasteCaster = true,
			ManaRegen = true,
			GearScore = true,
			Speed = true,
			Durability = true,
		},
		PALADIN = {
			AP = true,
			Holy = true,
			Healing = true,
			MP5 = true,
			Crit = true,
			HasteMelee = true,
			Armor = true,
			SpellCrit = true,
			Mitigation = true,
			Avoidance = true,
			GearScore = true,
			Speed = true,
			Durability = true,
		},
		PRIEST = {
			Healing = true,
			Shadow = true,
			SpellCrit = true,
			SpellHit = true,
			SpellPenetration = true,
			SpellMiss = true,
			HasteCaster = true,
			ManaRegen = true,
			GearScore = true,
			Speed = true,
			Durability = true,
		},
		ROGUE = {
			AP = true,
			DMG = true,
			mDPS = true,
			weaponSpeed = true,
			Crit = true,
			CritCap = true,
			Hit = true,
			HasteMelee = true,
			Expertise = true,
			ArmorPen = true,
			GearScore = true,
			Speed = true,
			Durability = true,
		},
		SHAMAN = {
			AP = true,
			Nature = true,
			Healing = true,
			MP5 = true,
			Crit = true,
			SpellCrit = true,
			SpellHit = true,
			SpellMiss = true,
			GearScore = true,
			Speed = true,
			Durability = true,
		},
		WARLOCK = {
			Shadow = true,
			SpellCrit = true,
			SpellHit = true,
			SpellPenetration = true,
			SpellMiss = true,
			HasteCaster = true,
			ManaRegen = true,
			GearScore = true,
			Speed = true,
			Durability = true,
		},
		WARRIOR = {
			AP = true,
			DMG = true,
			mDPS = true,
			Mitigation = true,
			Crit = true,
			CritCap = true,
			Hit = true,
			HasteMelee = true,
			Defense = true,
			BossReduc = true,
			Resilience = true,
			GearScore = true,
			Speed = true,
			Durability = true,
		},
	}
	return class and defaults[strupper(class)] or defaults
end
