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


------------------------------
--		Stat Options		--
------------------------------
local Both, Enhanced, Base, Damage, DamageTaken, Melee, Ranged, World, Realm, Equipped, Overall, Level, Honor, Max, Live, Enchanted, Ingenuity = 3, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 2
local Percentage, Rating, MainHand, OffHand, SameLevel, BossLevel, Regen, Casting, Critical, CritDamage, Average, Low, Static, Normal, Shadowflame = 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 3, 2, 1, 1
local Season, Expansion, Spark, Splinter, Gigantic, Plump, Current, Earned, Empty, Vintage = 1, 2, 1, 2, 1, 2, 1, 2, 1, 2

Ns.ConfigWidth = 975
Ns.ConfigHeight = 540
if GetLocale() == "frFR" or GetLocale() == "zhCN" or GetLocale() == "zhTW" or GetLocale() == "koKR" then
	Ns.ConfigWidth = 960
end

--local honorIcon = 73824
--local faction = UnitFactionGroup("player")
--if faction == "Horde" then honorIcon = 59641 end

------------------------------
--		Global Updater		--
------------------------------
function Ns.MeleeUpdate() end
function Ns.DefenseUpdate() end
function Ns.RangedUpdate() end
function Ns.SpellUpdate() end

------------------------------
--		Display Order		--
------------------------------
Ns.DefaultOrder = {
{ stat="AP", onupdate=true, events={}, spell=29834, spellclass="Melee", widget={ type="CheckBox" }, options={ Show=true, Dec_Def_Armor=true, Cap_Rating=true, WithBar=true, }, subgroup=true, activeonload=true, },
{ stat="RAP", onupdate=true, events={}, spell=34497, spellclass="Ranged", widget={ type="CheckBox" }, options={ Show=true, Dec_Def_Armor=true, Cap_Rating=true, WithBar=true, }, subgroup=true, activeonload=true, },
{ stat="DMG", onupdate=true, events={}, spell=29801, spellclass="Melee", widget={ type="CheckBox" }, options={ Show=true, Dec_Def_Armor=true, Color_Effect=true, }, subgroup=true },
{ stat="mDPS", onupdate=true, events={}, spell=29623, spellclass="Melee", widget={ type="CheckBox" }, options={ Show=true, Dec_Melee_DPS=true, Color_Effect=true, }, subgroup=true },
{ stat="RDMG", onupdate=true, events={}, spell=34482, spellclass="Ranged", widget={ type="CheckBox" }, options={ Show=true, Dec_Def_Armor=true, Color_Effect=true, }, subgroup=true },
{ stat="rDPS", onupdate=true, events={}, spell=36554, spellclass="Ranged", widget={ type="CheckBox" }, options={ Show=true, Dec_Ranged_DPS=true, Color_Effect=true, }, subgroup=true },
{ stat="Fire", onupdate=true, events={}, updatespeed=1, spell=34293, spellclass="Spell", widget={ type="CheckBox" }, options={ Show=true, Enhanced_Base=true, Dec_Def_Armor=true, }, subgroup=true, activeonload=true, },
{ stat="Frost", onupdate=true, events={}, spell=31674, spellclass="Spell", widget={ type="CheckBox" }, options={ Show=true, Enhanced_Base=true, Dec_Def_Armor=true, }, subgroup=true, },
{ stat="Arcane", onupdate=true, events={}, spell=31571, spellclass="Spell", widget={ type="CheckBox" }, options={ Show=true, Enhanced_Base=true, Dec_Def_Armor=true, }, subgroup=true },
{ stat="Shadow", onupdate=true, events={}, spell=30293, spellclass="Spell", widget={ type="CheckBox" }, options={ Show=true, Enhanced_Base=true, Dec_Def_Armor=true, }, subgroup=true, },
{ stat="Nature", onupdate=true, events={}, spell=16578, spellclass="Spell", widget={ type="CheckBox" }, options={ Show=true, Enhanced_Base=true, Dec_Def_Armor=true, }, subgroup=true },
{ stat="Healing", onupdate=true, events={}, spell=26022, spellclass="Spell", widget={ type="CheckBox" }, options={ Show=true, Enhanced_Base=true, Dec_Def_Armor=true, }, subgroup=true },
{ stat="Holy", onupdate=true, events={}, spell=31837, spellclass="Spell", widget={ type="CheckBox" }, options={ Show=true, Enhanced_Base=true, Dec_Def_Armor=true, }, subgroup=true },
{ stat="Crit", onupdate=true, events={}, spell=29859, spellclass="Melee", widget={ type="CheckBox" }, options={ Show=true, WithBar=true, Level_Same_Boss=true, Dec_Melee_Crit=true, Cap_Melee_Crit=true, Display_Rating=true, Display_Simulate=true, }, subgroup=true },
{ stat="CritCap", onupdate=true, events={}, spell=30819, spellclass="Melee", widget={ type="CheckBox" }, options={ Show=true, Dec_Melee_CritCap=true, Color_Effect=true, }, subgroup=true },
{ stat="RangedCrit", onupdate=true, events={}, spell=34506, spellclass="Ranged", widget={ type="CheckBox" }, options={ Show=true, WithBar=true, Level_Same_Boss=true, Dec_Ranged_Crit=true, Cap_Ranged_Crit=true, Display_Rating=true, Display_Simulate=true}, subgroup=true },
{ stat="SpellCrit", onupdate=true, events={}, spell=30288, spellclass="Spell", widget={ type="CheckBox" }, options={ Show=true, WithBar=true, Level_Same_Boss=true, Dec_Spell_Crit=true, Cap_Spell_Crit=true, Display_Rating=true, Display_Simulate=true }, subgroup=true },
{ stat="Hit", onupdate=true, events={}, spell=31241, spellclass="Melee", widget={ type="CheckBox" }, options={ Show=true, WithBar=true, Percent_Rating=true, Dec_Melee_Hit=true, Cap_Melee_Hit=true, }, subgroup=true },
{ stat="RangedHit", onupdate=true, events={}, spell=34485, spellclass="Ranged", widget={ type="CheckBox" }, options={ Show=true, WithBar=true, Percent_Rating=true, Dec_Ranged_Hit=true, Cap_Ranged_Hit=true, }, subgroup=true },
{ stat="SpellHit", onupdate=true, events={}, spell=34935, spellclass="Spell", widget={ type="CheckBox" }, options={ Show=true, WithBar=true, Percent_Rating=true, Dec_Spell_Hit=true, Cap_Spell_Hit=true, }, subgroup=true },
{ stat="HasteMelee", onupdate=true, events={}, spell=31244, spellclass="Melee", widget={ type="CheckBox" }, options={ Show=true, WithBar=true, Percent_Rating=true, Dec_Melee_Haste=true, Cap_Melee_Haste=true, }, subgroup=true },
{ stat="weaponSpeed", onupdate=true, events={}, spell=30664, spellclass="Melee", widget={ type="CheckBox" }, options={ Show=true, Dec_Melee_AttSp=true, }, subgroup=true },
{ stat="HasteRanged", onupdate=true, events={}, spell=23989, spellclass="Ranged", widget={ type="CheckBox" }, options={ Show=true, WithBar=true, Percent_Rating=true, Dec_Ranged_Haste=true, Cap_Ranged_Haste=true, }, subgroup=true },
{ stat="rangedSpeed", onupdate=true, events={}, spell=34948, spellclass="Ranged", widget={ type="CheckBox" }, options={ Show=true, Dec_Ranged_AttSp=true, }, subgroup=true },
{ stat="HasteCaster", onupdate=true, events={}, spell=30060, spellclass="Spell", widget={ type="CheckBox" }, options={ Show=true, WithBar=true, Percent_Rating=true, Dec_Spell_Haste=true, Cap_Spell_Haste=true, }, subgroup=true, },
{ stat="ArmorPenetration", onupdate=true, events={}, spell=26866, spellclass="Melee", widget={ type="CheckBox" }, options={ Show=true, WithBar=true, Dec_Melee_ArPen=true, Cap_Melee_ArPen=true, }, subgroup=true },
{ stat="BossReduc", onupdate=true, events={}, spell=20164, spellclass="Melee", widget={ type="CheckBox" }, options={ Show=true, Dec_Melee_Dmg=true, Color_Effect=true, }, subgroup=true, },
{ stat="Expertise", onupdate=true, events={}, spell=30920, spellclass="Melee", widget={ type="CheckBox" }, options={ Show=true, WithBar=true, Percent_Rating=true, Dec_Melee_Exp=true, Cap_Melee_Exp=true, Display_Simulate=true }, subgroup=true },
{ stat="MeleeMiss", onupdate=true, events={}, spell=1329, spellclass="Melee", widget={ type="CheckBox" }, options={ Show=true, WithBar="MeleeMiss", Level_Same_Boss=true, Dec_Melee_Miss=true, Display_Simulate=true, }, subgroup=true },
{ stat="Avoidance", onupdate=true, events={}, spell=31223, spellclass="Defense", widget={ type="CheckBox" }, options={ Show=true, WithBar="Avoidance", Dec_Def_Avoidance=true, Color_Effect=true, }, subgroup=true, activeonload=true, },
{ stat="Crushing", onupdate=true, events={}, spell=32175, spellclass="Defense", widget={ type="CheckBox" }, options={ Show=true, WithBar="Crushing", Dec_Def_Crush=true, Color_Effect=true, }, subgroup=true },
{ stat="CritReceived", onupdate=true, events={}, spell=33856, spellclass="Defense", widget={ type="CheckBox" }, options={ Chance_Reduction=true, Dec_Def_Crit=true, Display_Simulate=true, WithBar="CritReceived", Color_Effect=true, }, subgroup=true },
{ stat="EHP", onupdate=true, events={}, spell=31837, spellclass="Defense", widget={ type="CheckBox" }, options={ Show=true, Dec_Def_Armor=true, }, subgroup=true },
{ stat="RangedMiss", onupdate=true, events={}, spell=34460, spellclass="Ranged", widget={ type="CheckBox" }, options={ Show=true, WithBar="RangedMiss", Level_Same_Boss=true, Dec_Ranged_Miss=true, Display_Simulate=true, }, subgroup=true },
{ stat="SpellPenetration", onupdate=true, events={}, spell=11242, spellclass="Spell", widget={ type="CheckBox" }, options={ Show=true, Dec_Spell_Pen=true, }, subgroup=true },
{ stat="SpellMiss", onupdate=true, events={}, spell=30108, spellclass="Spell", widget={ type="CheckBox" }, options={ Show=true, WithBar="SpellMiss", Level_Same_Boss=true, Dec_Spell_Miss=true, Display_Simulate=true, }, subgroup=true },
{ stat="ManaRegen", onupdate=true, events={}, spell=31833, spellclass="Spell", widget={ type="CheckBox" }, options={ Regen_Normal_Casting=true, Dec_Spell_MP2=true, }, subgroup=true },
{ stat="MP5", onupdate=true, events={}, spell=34861, spellclass="Spell", widget={ type="CheckBox" }, options={ Regen_Normal_Casting=true, Dec_Spell_MP5=true, }, subgroup=true, },
{ stat="Resilience", onupdate=true, events={}, spell=29623, spellclass="Defense", widget={ type="CheckBox" }, options={ Crit_Damage_Taken=true, Display_Rating=true, Cap_Rating=true, Dec_Def_Res=true, }, subgroup=true },
{ stat="Armor", onupdate=true, events={}, spell=29140, spellclass="Defense", widget={ type="CheckBox" }, options={ Show=true, Dec_Def_Armor=true, Cap_Def_Armor=true, WithBar="Armor"}, subgroup=true },
{ stat="Stamina", onupdate=true, events={}, spell=25389, spellclass="Defense", widget={ type="CheckBox" }, options={ Show=true, Dec_Def_Armor=true, Color_Effect=true, }, subgroup=true },
{ stat="NPCArmor", onupdate=true, events={}, spell=44520, spellclass="Melee", widget={ type="CheckBox" }, options={ Show=true, Dec_Def_Armor=true, }, subgroup=true },
{ stat="DMGReduc", onupdate=true, events={}, spell=871, spellclass="Defense", widget={ type="CheckBox" }, options={ Show=true, Dec_Def_Mit=true, Cap_Def_Mit=true, WithBar="DMGReduc" }, subgroup=true },
{ stat="Defense", onupdate=true, events={}, spell=32700, spellclass="Defense", widget={ type="CheckBox" }, options={ Total_Rating=true, Display_Basic=true, Dec_Def_Def=true, Cap_Def_Def=true, WithBar="Defense", }, 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=2565, spellclass="Defense", widget={ type="CheckBox" }, options={ Percent_Rating=true, Dec_Def_Block=true, Display_Simulate=true, }, subgroup=true },
{ stat="FireResist", events={ UNIT_RESISTANCES={ "player", }, }, spell=18459, spellclass="Resistance", widget={ type="CheckBox" }, options={ Show=true, Color_Effect=true, }, subgroup=true, activeonload=true, },
{ stat="FrostResist", events={ UNIT_RESISTANCES={ "player", }, }, spell=31667, spellclass="Resistance", widget={ type="CheckBox" }, options={ Show=true, Color_Effect=true, }, subgroup=true },
{ stat="ShadowResist", events={ UNIT_RESISTANCES={ "player", }, }, spell=30283, spellclass="Resistance", widget={ type="CheckBox" }, options={ Show=true, Color_Effect=true, }, subgroup=true },
{ stat="ArcaneResist", events={ UNIT_RESISTANCES={ "player", }, }, spell=16850, spellclass="Resistance", widget={ type="CheckBox" }, options={ Show=true, Color_Effect=true, }, subgroup=true },
{ stat="NatureResist", events={ UNIT_RESISTANCES={ "player", }, }, spell=30675, spellclass="Resistance", widget={ type="CheckBox" }, options={ Show=true, Color_Effect=true, }, subgroup=true },
{ stat="Speed", onupdate=true, events={}, updatespeed=1, spell=31641, spellclass="Misc", widget={ type="CheckBox" }, options={ WithBar="Speed", Show=true, Color_Effect=true, }, subgroup=true, activeonload=true, },
{ stat="TargetSpeed", onupdate=true, events={}, spell=31641, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, Color_Effect=true, }, subgroup=true },
{ stat="Durability", events={ UPDATE_INVENTORY_DURABILITY=true, }, spell=3100, spellclass="Misc", widget={ type="CheckBox" }, options={ WithBar="Dura", Show=true, AutoColorOff=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 },
{ stat="Travel", onupdate=true, events={}, updatespeed=1, spell=1850, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, Yards_KM=true, Reset_Login=true, Reset_Counter=true, }, subgroup=true },
{ stat="Jump", onupdate=true, events={}, spell=40493, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, Reset_Login=true, Reset_Counter=true, }, subgroup=true },
--{ stat="KillCounter", events={ NAME_PLATE_UNIT_ADDED=true, NAME_PLATE_UNIT_REMOVED=true, }, spell=5308, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, NPC_Players=true, Reset_Login=true, Reset_Counter=true, }, subgroup=true },
{ stat="CombatTimer", onupdate=true, events={}, updatespeed=1, spell=34712, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, Combat_Color=true, }, subgroup=true },
--{ stat="MobCounter", events={ NAME_PLATE_UNIT_ADDED=true, NAME_PLATE_UNIT_REMOVED=true, }, spell=199483, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, Editbox_MobRange=true, }, subgroup=true },
{ stat="Lag", onupdate=true, events={}, spell=33592, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
{ stat="FPS", onupdate=true, events={}, spell=19498, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, Color_Effect=true, }, subgroup=true },
{ stat="Money", onupdate=true, events={}, spell=921, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
{ stat="Guild", events={ GUILD_ROSTER_UPDATE=true, }, item=23705, spellclass="Misc", widget={ type="CheckBox" }, options={ WithBar=true, Show=true, Display_Total=true }, subgroup=true },
{ stat="Friends", events={ FRIENDLIST_UPDATE=true, BN_FRIEND_INFO_CHANGED=true, }, item=22260, spellclass="Misc", widget={ type="CheckBox" }, options={ WithBar=true, BNet_Realm=true }, subgroup=true },
}

------------------------------
--		Global Events		--
------------------------------
Ns.GlobalEvents = {
	UNIT_AURA={ "player", "target", },
	UNIT_INVENTORY_CHANGED={ "player", },
	UNIT_STATS={ "player", },
	UPDATE_INVENTORY_DURABILITY=true,
	UPDATE_FACTION=true,
	BIND_ENCHANT=true,
	CHARACTER_POINTS_CHANGED=true,
	PLAYER_LEVEL_UP=true,
	PLAYER_TARGET_CHANGED=true,
	REPLACE_ENCHANT=true,
	GET_ITEM_INFO_RECEIVED=true,
	TRAIT_CONFIG_UPDATED=true,
	MASTERY_UPDATE=true,
	UNIT_RESISTANCES={ "player", },
	UNIT_DAMAGE=true,
	UNIT_RANGEDDAMAGE=true,
	UNIT_ATTACK_POWER=true,
	UNIT_RANGED_ATTACK_POWER=true,
	UNIT_DEFENSE={ "player", },
	BAG_CLOSED=true,
	COMBAT_LOG_EVENT_UNFILTERED=true,
	PLAYER_REGEN_DISABLED=true,
	INSPECT_READY=true,
	PLAYER_TALENT_UPDATE=true,
}

------------------------------
--		Settings Groups		--
------------------------------

Ns.SpellClass = {
	[0] = { stat="Settings", grp=Ns.SettingsGroupOrder, order=Ns.SettingsDisplayOrder, icon="Settings", },
	[1] = { stat="Text", grp=Ns.TextGroupOrder, order=Ns.TextDisplayOrder, icon="Fonts", },
	[2] = { stat="Layout", grp=Ns.LayoutGroupOrder, order=Ns.LayoutDisplayOrder, icon="Layout", },
	[3] = { stat="Events", grp=Ns.EventsGroupOrder, order=Ns.EventsDisplayOrder, icon="Events", },
	[4] = { stat="Profiles", grp=Ns.ProfileGroupOrder, order=Ns.ProfileDisplayOrder, icon="Profiles", },
	[5] = { stat="", },
	[6] = { stat="Search", icon="Search", },
	[7] = { stat="Melee", icon="Physical", },
	[8] = { stat="Defense", icon="Defense", },
	[9] = { stat="Ranged", icon="Ranged", },
	[10] = { stat="Spell", icon="Spell", },
	[11] = { stat="Resistance", icon="Resistance", },
	[12] = { stat="Misc", icon="Miscs", },
	[13] = { stat="", },
	[14] = { stat="FAQ", icon="Misc", },
}

------------------------------
--		Stat Options		--
------------------------------
Ns.Options = {
	{ stat="Show", widget={ type="CheckBox", } },
	{ stat="CustName", widget={ type="EditBox", width=100, height=20, numeric=false, }, tooltip=true, },
	{ stat="Level_Same_Boss", spellclass="Level_Same_Boss", widget={ type="Radio", }, tooltip=true, default=1, labels={ "SameLevel", "BossLevel", "Both"}, newline=true },
	{ stat="Regen_Normal_Casting", spellclass="Regen_Normal_Casting", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Regen", "Casting", "Both"}, newline=true },
	{ stat="Enhanced_Base", spellclass="Enhanced_Base", widget={ type="Radio", }, tooltip=true,  default=1, labels={ "Enhanced", "Base", "Both"}, newline=true, },
	{ stat="Percent_Rating", spellclass="Percent_Rating", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Percentage", "Rating", "Both"}, newline=true, },
	{ stat="Crit_Damage_Taken", spellclass="Crit_Damage_Taken", widget={ type="Radio", }, tooltip=true, default=1, labels={ "CritTaken", "DamageTaken", "Both"}, newline=true, },
	{ stat="Chance_Reduction", spellclass="Chance_Reduction", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Chance", "Reduction", "Both"}, newline=true, },
	{ stat="Total_Rating", spellclass="Total_Rating", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Total", "Rating", "Both"}, newline=true, },
	{ stat="Display_Rating", spellclass="Display_Rating", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "Display_Rating"}, },
	{ stat="Display_Basic", spellclass="Display_Basic", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "Display_Basic"}, },
	{ stat="Display_Simulate", spellclass="Display_Simulate", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "Display_Simulate"}, },
	{ 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_CritCap", spellclass="Dec_Melee_CritCap", default=2, 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_AttSp", spellclass="Dec_Melee_AttSp", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, }, newline=true, },
	{ stat="Dec_Melee_DPS", spellclass="Dec_Melee_DPS", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, }, newline=true, },
	{ stat="Dec_Melee_ArPen", spellclass="Dec_Melee_ArPen", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, }, newline=true, },
	{ stat="Dec_Melee_Dmg", spellclass="Dec_Melee_Dmg", 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_AP", spellclass="Dec_Melee_AP", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, }, newline=true, },
	{ stat="Dec_Melee_DMG", spellclass="Dec_Melee_DMG", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, }, newline=true, },
	{ stat="Dec_Melee_NPCArmor", spellclass="Dec_Melee_NPCArmor", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, }, newline=true, },
	{ 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_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_AttSp", spellclass="Dec_Ranged_AttSp", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, }, newline=true, },
	{ stat="Dec_Ranged_DPS", spellclass="Dec_Ranged_DPS", 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_AP", spellclass="Dec_Ranged_AP", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, }, newline=true, },
	{ stat="Dec_Ranged_DMG", spellclass="Dec_Ranged_DMG", 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_Hit", spellclass="Dec_Spell_Hit", 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_Miss", spellclass="Dec_Spell_Miss", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, }, newline=true, },
	{ stat="Dec_Spell_Pen", spellclass="Dec_Spell_Pen", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, }, newline=true, },
	{ stat="Dec_Spell_MP2", spellclass="Dec_Spell_MP2", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, }, newline=true, },
	{ stat="Dec_Spell_MP5", spellclass="Dec_Spell_MP5", 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_Healing", spellclass="Dec_Spell_Healing", 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_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_Crit", spellclass="Dec_Def_Crit", 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_Mit", spellclass="Dec_Def_Mit", 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, },
	{ 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_Def", spellclass="Dec_Def_Def", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, }, newline=true, },
	{ stat="Dec_Def_Stamina", spellclass="Dec_Def_Stamina", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ 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_Hit", spellclass="Cap_Melee_Hit", default=9, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	{ stat="Cap_Melee_Haste", spellclass="Cap_Melee_Haste", default=100, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	{ stat="Cap_Melee_ArPen", spellclass="Cap_Melee_ArPen", default=100, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	{ stat="Cap_Melee_Exp", spellclass="Cap_Melee_Exp", default=103, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.0f", }, },
	{ stat="Cap_Ranged_Crit", spellclass="Cap_Ranged_Crit", default=100, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	{ stat="Cap_Ranged_Hit", spellclass="Cap_Ranged_Hit", default=9, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	{ stat="Cap_Ranged_Haste", spellclass="Cap_Ranged_Haste", default=100, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	{ 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_Hit", spellclass="Cap_Spell_Hit", default=16, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	{ stat="Cap_Spell_Haste", spellclass="Cap_Spell_Haste", default=100, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	{ stat="Cap_Percent", spellclass="Cap_Percent", default=100, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f%%", }, },
	{ stat="Cap_Rating", spellclass="Cap_Rating", default=0, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.2f", }, },
	{ stat="Editbox_D", spellclass="Editbox_D", default=8, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.0f", }, newline=true, },
	{ stat="Display_Delves", spellclass="Display_Delves", widget={ type="CheckBox", }, tooltip=false, default=false, labels={ "Display_Delves"}, },
	{ stat="AutoColorOff", spellclass="AutoColorOff", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "AutoColorOff"}, newline=true, },
	{ stat="Color_Effect", spellclass="Color_Effect", widget={ type="CheckBox", }, tooltip=true, default=true, labels={ "Color_Effect"}, newline=true, },
	{ stat="Display_Total", spellclass="Display_Total", widget={ type="CheckBox", }, default=false, labels={ "Display_Total"}, newline=true, },
	{ stat="Yards_KM", spellclass="Yards_KM", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Yards", "Kilometers", "Both"}, newline=true, },
	{ stat="NPC_Players", spellclass="NPC_Players", widget={ type="Radio", }, tooltip=true, default=1, labels={ "NPC", "Players", "Both"}, newline=true, },
	{ stat="Reset_Login", spellclass="Reset_Login", widget={ type="CheckBox", }, default=false, labels={ "Reset_Login"}, newline=true, },
-- 	{ stat="Reset_Counter", spellclass="Reset_Counter", widget={ type="PlainButton", }, default=false, },
	{ stat="Combat_Color", spellclass="Combat_Color", widget={ type="CheckBox", }, tooltip=false, default=true, labels={ "Combat_Color"}, newline=true, },
	{ stat="Editbox_MobRange", spellclass="Editbox_MobRange", default=0, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.0f", }, newline=true, },
	{ stat="BNet_Realm", spellclass="BNet_Realm", widget={ type="Radio", }, tooltip=true, default=1, labels={ "BNet", "Realm", "Both"}, newline=true, },
	{ stat="Cap_Def_Def", spellclass="Cap_Def_Def", default=490, tooltip=true, widget={ type="EditBox", width=50, height=20, numeric=true, format="%.2f", }, },
	{ stat="Cap_Def_Armor", spellclass="Cap_Def_Armor", default=35880, 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="ColorCustom", default=false, widget={ type="CheckBox", }, linked={ "ColorName", false, "ColorClass", false, "ColorValue", false, "ColorValueEndable", false, }, onclick="InitCustomColors", newline=true },
	{ stat="ColorName", default={ r=1, g=1, b=1, }, widget={ type="ColorPicker", }, },
	{ stat="ColorClass", default=false, widget={ type="CheckBox", }, },
	{ stat="ColorValueEndable", default=false, widget={ type="CheckBox", }, linked={ "ColorValue", false, }, newline=true },
	{ stat="ColorValue", default={ r=1, g=1, b=1, }, widget={ type="ColorPicker", }, },

		-- stat bars (using baremode to estrict key to specific)
	{ stat="ShowBar", spellclass="ShowBar", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "ShowBar"}, baropt=true, newline=true,},
	{ stat="BarMaxMode", spellclass="BarMaxMode", widget={ type="DropList", data="BarMaxMode", width=120, }, default=1, onchange="OnBarMaxModeChange", baropt=true, barmode="Default", },
	{ stat="SpeedBar", spellclass="SpeedBar", widget={ type="DropList", data="SpeedBar", width=120, }, default=1, baropt=true, barmode="Speed", },
	{ stat="BarMaxCustom", spellclass="BarMaxCustom", default=100, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.0f", }, baropt=true, barmode="Default,Speed", },
	{ stat="JourneyBarMode", spellclass="JourneyBarMode", widget={ type="DropList", data="JourneyBarMode", width=120, }, default=1, baropt=true, barmode="Journey", },
	{ stat="StaticBar", spellclass="StaticBar", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "StaticBar"}, baropt=true, staticopt=true, newline=true, },
	{ stat="BarTexture", spellclass="BarTexture", widget={ type="DropList", data="BarTextures", width=170, }, default="Solid", baropt=true, staticopt=true, newline=true, },
	{ stat="BarColor", spellclass="BarColor", default={ r=0.2, g=0.6, b=0.2, }, widget={ type="ColorPicker", }, baropt=true, staticopt=true, },
	{ stat="BarAutoColor", spellclass="BarAutoColor", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "BarAutoColor"}, baropt=true, linked={ "BarColor", true, }, },
	{ stat="BarAlpha", spellclass="BarAlpha", default=1, widget={ type="Slider", min=0, max=1, valuestep=0.01, width=145, }, baropt=true, staticopt=true, },
	{ stat="BarBgColor", spellclass="BarBgColor", default={ r=0.1, g=0.1, b=0.1, }, widget={ type="ColorPicker", }, baropt=true, },
	{ stat="BarBgAlpha", spellclass="BarBgAlpha", default=1, widget={ type="Slider", min=0, max=1, valuestep=0.01, width=145, }, baropt=true, },
}

--------------------------
--		Class & ID		--
--------------------------
Ns.byPlayerClass = {
--10.0 DF
	["EVOKER"] = 13,
--7.0 Legion
	["DEMONHUNTER"] = 12,
--5.0 Pandaria
	["MONK"] = 10,
--3.0 Wrath
	["DEATHKNIGHT"] = 6,
--1.0 Classic
	["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 = {

--1.0 Classic
		DRUID = {
			Haste = true,
			Versatility = true,
			CritChance = true,
			Mastery = true,
			AP = true,
			SpellPower = true,
			Intellect = true,
			ManaRegen = true,
			EnergyRegen = true,
			Speed = true,
			Durability = true,
		},
		HUNTER = {
			Haste = true,
			Versatility = true,
			CritChance = true,
			Agility = true,
			Mastery = true,
			AP = true,
			Speed = true,
			Durability = true,
		},
		MAGE = {
			Haste = true,
			Versatility = true,
			CritChance = true,
			Mastery = true,
			Intellect = true,
			SpellPower = true,
			ManaRegen = true,
			Speed = true,
			Durability = true,
		},
		PALADIN = {
			Haste = true,
			Versatility = true,
			CritChance = true,
			Mastery = true,
			Intellect = true,
			ManaRegen = true,
			Healing = true,
			Speed = true,
			Durability = true,
		},
		PRIEST = {
			Haste = true,
			Versatility = true,
			CritChance = true,
			Mastery = true,
			Intellect = true,
			ManaRegen = true,
			SpellPower = true,
			Healing = true,
			Speed = true,
			Durability = true,
		},
		ROGUE = {
			Haste = true,
			Versatility = true,
			CritChance = true,
			Mastery = true,
			Agility = true,
			AP = true,
			EnergyRegen = true,
			Dodge = true,
			Speed = true,
			Durability = true,
		},
		SHAMAN = {
			Haste = true,
			Versatility = true,
			CritChance = true,
			Mastery = true,
			Intellect = true,
			ManaRegen = true,
			SpellPower = true,
			Healing = true,
			Speed = true,
			Durability = true,
		},
		WARLOCK = {
			Haste = true,
			Versatility = true,
			CritChance = true,
			Mastery = true,
			Intellect = true,
			SpellPower = true,
			Speed = true,
			Durability = true,
		},
		WARRIOR = {
			Haste = true,
			Versatility = true,
			CritChance = true,
			Mastery = true,
			Strength = true,
			AP = true,
			Armor = true,
			Block = true,
			Dodge = true,
			Speed = true,
			Durability = true,
		},
	}
	return class and defaults[strupper(class)] or defaults
end