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 = { -- grp = SpellClass, options order = display order, ["on"]/["off"] option is implied in all stats so not required in the table. The [1]..[2] not required but just for example
{ stat="Primary", onupdate=true, events={}, spell=261769, spellclass="Enhancement", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Auto_Name=true, Decimals_Default=true }, subgroup=true, activeonload=true, },
{ stat="CritChance", onupdate=true, events={}, spell=1217605, spellclass="Enhancement", widget={ type="CheckBox" }, options={ WithBar=true, Percent_Rating=true, Display_Basic=true, Decimals_Two=true, Cap_Percent=true, Cap_Rating=true, DR_Display=true, DR_Gradient=true }, subgroup=true, },
{ stat="Haste", onupdate=true, events={}, spell=342245, spellclass="Enhancement", widget={ type="CheckBox" }, options={ WithBar=true, Percent_Rating=true, Decimals_Two=true, Cap_Percent=true, Cap_Rating=true, DR_Display=true, DR_Gradient=true }, subgroup=true },
{ stat="Mastery", onupdate=true, events={}, spell=207684, spellclass="Enhancement", widget={ type="CheckBox" }, options={ WithBar=true, Percent_Rating=true, Decimals_Two=true, Cap_Percent=true, Cap_Rating=true, DR_Display=true, DR_Gradient=true }, subgroup=true },
{ stat="Versatility", onupdate=true, events={}, spell=202137, spellclass="Enhancement", widget={ type="CheckBox" }, options={ WithBar=true, Damage_Taken=true, Display_Rating=true, Decimals_Two=true, Cap_Percent=true, DR_Display=true, DR_Gradient=true }, subgroup=true },
{ stat="Avoidance", onupdate=true, events={}, spell=202138, spellclass="Enhancement", widget={ type="CheckBox" }, options={ WithBar=true, Percent_Rating=true, Decimals_Two=true, Cap_Percent=true, Cap_Rating=true }, subgroup=true },
{ stat="Leech", onupdate=true, events={}, spell=204021, spellclass="Enhancement", widget={ type="CheckBox" }, options={ WithBar=true, Percent_Rating=true, Decimals_Two=true, Cap_Percent=true, Cap_Rating=true }, subgroup=true },
{ stat="Speed", onupdate=true, events={}, updatespeed=1, spell=109215, spellclass="Enhancement", widget={ type="CheckBox" }, options={ WithBar="Speed", Speed_Static=true, Speed_Color=true, Decimals_Default=true }, subgroup=true },
{ stat="Strength", onupdate=true, events={}, spell=48743, spellclass="Physical", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Decimals_Default=true }, subgroup=true, activeonload=true, },
{ stat="Agility", onupdate=true, events={}, spell=319032, spellclass="Physical", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Decimals_Default=true }, subgroup=true },
{ stat="Intellect", onupdate=true, events={}, spell=23030, spellclass="Spell", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Decimals_Default=true }, subgroup=true, activeonload=true, },
{ stat="AP", onupdate=true, events={}, spell=29838, spellclass="Physical", widget={ type="CheckBox" }, options={ Melee_Ranged=true, Decimals_Default=true }, subgroup=true },
{ stat="DMG", onupdate=true, events={}, spell=315720, spellclass="Physical", widget={ type="CheckBox" }, options={ Max_Average_Damage=true, Display_MainHand=true, Decimals_Default=true }, subgroup=true },
{ stat="DMGMod", onupdate=true, events={}, spell=152175, spellclass="Physical", widget={ type="CheckBox" }, options={ Melee_Ranged=true, Decimals_Default=true }, subgroup=true },
{ stat="DPS", onupdate=true, events={}, spell=115080, spellclass="Physical", widget={ type="CheckBox" }, options={ Melee_Ranged=true, Display_MainHand=true, Decimals_Default=true }, subgroup=true },
{ stat="SpellPower", onupdate=true, events={}, spell=321358, spellclass="Spell", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Decimals_Default=true }, subgroup=true },
{ stat="DMGModSpell", onupdate=true, events={}, spell=385899, spellclass="Spell", widget={ type="CheckBox" }, options={ Decimals_Default=true }, subgroup=true },
{ stat="Healing", onupdate=true, events={}, spell=2050, spellclass="Spell", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Decimals_Default=true }, subgroup=true },
{ stat="weaponSpeed", onupdate=true, events={}, spell=321281, spellclass="Physical", widget={ type="CheckBox" }, options={ Melee_Ranged=true, Decimals_Two=true }, subgroup=true },
{ stat="ManaRegen", onupdate=true, events={}, spell=63733, spellclass="Spell", widget={ type="CheckBox" }, options={ Show=true, Decimals_Default=true }, subgroup=true },
{ stat="EnergyRegen", onupdate=true, events={}, spell=212283, spellclass="Physical", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Decimals_One=true }, subgroup=true },
{ stat="Stamina", onupdate=true, events={}, spell=320380, spellclass="Physical", widget={ type="CheckBox" }, options={ Enhanced_Base=true, Decimals_Default=true }, subgroup=true },
{ stat="Mitigation", onupdate=true, events={}, spell=155147, spellclass="Physical", widget={ type="CheckBox" }, options={ Show=true, Decimals_One=true }, subgroup=true },
{ stat="Armor", onupdate=true, events={}, spell=321708, spellclass="Physical", widget={ type="CheckBox" }, options={ Show=true, Decimals_Default=true }, subgroup=true },
{ stat="Dodge", onupdate=true, events={}, spell=115008, spellclass="Physical", widget={ type="CheckBox" }, options={ Percent_Rating=true, Decimals_Two=true, Cap_Percent=true, Cap_Rating=true }, subgroup=true },
{ stat="Parry", onupdate=true, events={}, spell=118038, spellclass="Physical", widget={ type="CheckBox" }, options={ Percent_Rating=true, Decimals_Two=true, Cap_Percent=true, Cap_Rating=true  }, subgroup=true },
{ stat="Block", onupdate=true, events={}, spell=203177, spellclass="Physical", widget={ type="CheckBox" }, options={ Percent_Rating=true, Decimals_Two=true, Cap_Percent=true, Cap_Rating=true  }, subgroup=true },
--{ stat="Absorb", events={ UNIT_ABSORB_AMOUNT_CHANGED=true, }, spell=343744, spellclass="Physical", widget={ type="CheckBox" }, options={ Show=true, Decimals_Default=true, }, subgroup=true },
{ stat="Stagger", onupdate=true, events={}, spell=280195, spellclass="Physical", widget={ type="CheckBox" }, options={ Show=true, Decimals_Two=true }, subgroup=true },
{ stat="Delver", events={ MAJOR_FACTION_RENOWN_LEVEL_CHANGED=true, UPDATE_FACTION=true, }, spell=471521, spellclass="Journeys", widget={ type="CheckBox" }, options={ WithBar="Journey", Rank_Rep=true, Display_Percentage=true, }, subgroup=true, activeonload=true, },
{ stat="Companion", events={ MAJOR_FACTION_RENOWN_LEVEL_CHANGED=true, UPDATE_FACTION=true, }, spell=220172, spellclass="Journeys", widget={ type="CheckBox" }, options={ WithBar="Journey", Rank_Rep=true, Display_Percentage=true, }, subgroup=true, },
{ stat="Prey", events={ MAJOR_FACTION_RENOWN_LEVEL_CHANGED=true, UPDATE_FACTION=true, }, currency=3386, spellclass="Journeys", widget={ type="CheckBox" }, options={ WithBar="Journey", Rank_Rep=true, Display_Percentage=true, }, subgroup=true, },
{ stat="Ritual", events={ MAJOR_FACTION_RENOWN_LEVEL_CHANGED=true, UPDATE_FACTION=true, }, currency=3428, spellclass="Journeys", widget={ type="CheckBox" }, options={ WithBar="Journey", Rank_Rep=true, Display_Percentage=true }, subgroup=true },
{ stat="Silvermoon", events={ MAJOR_FACTION_RENOWN_LEVEL_CHANGED=true, UPDATE_FACTION=true, }, currency=3365, spellclass="Journeys", widget={ type="CheckBox" }, options={ WithBar="Journey", Rank_Rep=true, Display_Percentage=true }, subgroup=true },
{ stat="Amani", events={ MAJOR_FACTION_RENOWN_LEVEL_CHANGED=true, UPDATE_FACTION=true, }, currency=3354, spellclass="Journeys", widget={ type="CheckBox" }, options={ WithBar="Journey", Rank_Rep=true, Display_Percentage=true }, subgroup=true },
{ stat="Arati", events={ MAJOR_FACTION_RENOWN_LEVEL_CHANGED=true, UPDATE_FACTION=true, }, currency=3370, spellclass="Journeys", widget={ type="CheckBox" }, options={ WithBar="Journey", Rank_Rep=true, Display_Percentage=true }, subgroup=true },
{ stat="Singularity", events={ MAJOR_FACTION_RENOWN_LEVEL_CHANGED=true, UPDATE_FACTION=true, }, currency=3389, spellclass="Journeys", widget={ type="CheckBox" }, options={ WithBar="Journey", Rank_Rep=true, Display_Percentage=true }, subgroup=true },
{ stat="Slayer", events={ UPDATE_FACTION=true, }, currency=3410, spellclass="Journeys", widget={ type="CheckBox" }, options={ WithBar="Rep", Rank_Rep=true, Display_Percentage=true, }, subgroup=true },
{ stat="Delves", events={ SCENARIO_COMPLETED=true, WALK_IN_DATA_UPDATE=true, QUEST_TURNED_IN=true, }, currency=3386, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, Display_All=true, Editbox_DP=true, Display_Tier8=true, Vault_Tooltip=true, WithBar="DelvesPrey, "}, subgroup=true, activeonload=true,},
--{ stat="Delves", events={ WEEKLY_REWARDS_UPDATE=true, SCENARIO_COMPLETED=true, WALK_IN_DATA_UPDATE=true}, spell=471521, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, Editbox_D=true, Display_Delves=true, }, subgroup=true, },
{ stat="GreatVault", events={ WEEKLY_REWARDS_UPDATE=true, }, item=228942, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, Raids_Dungeons=true, Display_Weekly=true, WithBar="GreatVault", }, subgroup=true },
{ stat="MythicPlus", events={ CHALLENGE_MODE_COMPLETED=true, }, spell=393977, spellclass="Misc", widget={ type="CheckBox" }, options={ Season_Exp=true }, subgroup=true, },
{ stat="Threat", onupdate=true, events={}, spell=185245, spellclass="Misc", widget={ type="CheckBox" }, options={ WithBar=true, Percent_Rating=true }, subgroup=true },
{ stat="ItemLevel", onupdate=true, events={}, spell=48792, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, Equipped_Overall=true, Decimals_Two=true }, subgroup=true },
{ stat="PvPiLvl", onupdate=true, events={}, spell=347503, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, Decimals_Two=true }, subgroup=true },
{ stat="TargetSpeed", onupdate=true, events={}, spell=52358, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
{ stat="Durability", events={ UPDATE_INVENTORY_DURABILITY=true, }, spell=3100, spellclass="Misc", widget={ type="CheckBox" }, options={ WithBar=true, Show=true, AutoColorOff=true }, subgroup=true },
{ stat="GlobalCD", events={ UNIT_SPELLCAST_SUCCEEDED={ "player" }, }, spell=363929, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, Decimals_Two=true }, subgroup=true },
{ stat="Adventurer", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3383, spellclass="Currency", widget={ type="CheckBox" }, options={ WithBar="Crest", Current_Earned=true, Display_Max=true, Display_Weekly=true }, subgroup=true, activeonload=true, },
{ stat="Veteran", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3341, spellclass="Currency", widget={ type="CheckBox" }, options={ WithBar="Crest", Current_Earned=true, Display_Max=true, Display_Weekly=true }, subgroup=true },
{ stat="Champion", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3343, spellclass="Currency", widget={ type="CheckBox" }, options={ WithBar="Crest", Current_Earned=true, Display_Max=true, Display_Weekly=true  }, subgroup=true },
{ stat="Hero", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3345, spellclass="Currency", widget={ type="CheckBox" }, options={ WithBar="Crest", Current_Earned=true, Display_Max=true, Display_Weekly=true  }, subgroup=true },
{ stat="Myth", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3347, spellclass="Currency", widget={ type="CheckBox" }, options={ WithBar="Crest", Current_Earned=true, Display_Max=true, Display_Weekly=true  }, subgroup=true },
{ stat="Catalyst", events={ UNIT_INVENTORY_CHANGED=true, }, currency=3378, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Display_Max=true, }, subgroup=true },
{ stat="Voidcore", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3418, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Decimals_Default=true }, subgroup=true },
{ stat="AscendantVoid", events={ CURRENCY_DISPLAY_UPDATE=true, }, item=268650, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Core_Shard=true, }, subgroup=true },
{ stat="GalacticVoid", events={ CURRENCY_DISPLAY_UPDATE=true, }, item=271342, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Core_Shard=true, }, subgroup=true },
{ stat="Spark", events={ UNIT_INVENTORY_CHANGED=true, }, item=232875, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Splint_Spark=true, Display_Max=true, WithBar="Spark", }, subgroup=true },
{ stat="Stash", events={ WALK_IN_DATA_UPDATE=true, MINIMAP_UPDATE_ZOOM=true, }, spell=1216211, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, WithBar="Stash" }, subgroup=true },
{ stat="CofferKey", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3310, spellclass="Currency", widget={ type="CheckBox" }, options={ Current_Earned=true, Decimals_Default=true, Display_Max=true, Display_Weekly=true, WithBar="CofferKey", }, subgroup=true },
{ stat="RestoredKey", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3028, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true }, subgroup=true },
{ stat="Undercoin", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=2803, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Decimals_Default=true }, subgroup=true },
{ stat="Accolade", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3405, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Decimals_Default=true }, subgroup=true },
{ stat="DarkParticle", events={ UNIT_INVENTORY_CHANGED=true, }, item=267051, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
{ stat="AnglerPearls", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3373, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Decimals_Default=true }, subgroup=true },
{ stat="Voidlight", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3316, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Decimals_Default=true }, subgroup=true },
{ stat="ManaCrystals", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3356, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Decimals_Default=true, Display_Max=true, }, subgroup=true },
{ stat="Illusionary", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3393, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Decimals_Default=true, }, subgroup=true },
{ stat="Anguish", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3392, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Decimals_Default=true }, subgroup=true },
{ stat="Arcana", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3379, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Decimals_Default=true }, subgroup=true },
{ stat="Abundance", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3377, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Decimals_Default=true }, subgroup=true },
{ stat="Dundun", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3376, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Decimals_Default=true }, subgroup=true },
{ stat="VoidSample", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3377, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true }, subgroup=true },
{ stat="Luminous", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3385, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Decimals_Default=true }, subgroup=true },
{ stat="Skyshards", events={ UNIT_INVENTORY_CHANGED=true, }, item=255826, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
{ stat="VileEssence", events={ UNIT_INVENTORY_CHANGED=true, }, item=259361, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
{ stat="ValorPoints", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=1191, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
{ stat="BloodyTokens", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=2123, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
{ stat="Honor", events={ CURRENCY_DISPLAY_UPDATE=true, }, spell=269083, spellclass="Currency", widget={ type="CheckBox" }, options={ Level_HonorPoints=true, Display_Rated=true, }, subgroup=true },
{ stat="Conquest", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=1602, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
{ stat="Timewarped", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=1166, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Decimals_Default=true }, subgroup=true },
{ stat="Coupons", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3363, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Decimals_Default=true }, subgroup=true },
{ stat="TraderTender", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=2032, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Decimals_Default=true }, subgroup=true },
{ stat="Darkmoon", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=515, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true }, subgroup=true },
{ stat="Coordinates", onupdate=true, events={}, updatespeed=1, item=140731, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, Decimals_One=true }, subgroup=true },
{ stat="Travel", onupdate=true, events={}, updatespeed=1, spell=87840, 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=6544, 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=69042, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, Combat_Color=true, }, subgroup=true },
--{ stat="InstanceTimer", onupdate=true, events={}, updatespeed=1, spell=2825, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, Timer_Format=true, Send_Chat=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=190447, spellclass="Misc", widget={ type="CheckBox" }, options={ World_Realm=true, }, subgroup=true },
{ stat="FPS", onupdate=true, events={}, updatespeed=1, spell=6196, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, }, subgroup=true },
{ stat="Gold", events={ PLAYER_MONEY=true, }, spell=303624, 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, Decimals_Default=true, }, subgroup=true },
{ stat="Guild", events={ GUILD_ROSTER_UPDATE=true, }, item=69210, 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, }, spell=456726, spellclass="Misc", widget={ type="CheckBox" }, options={ WithBar=true, BNet_Realm=true }, subgroup=true },
--{ stat="RepairCost", events={ UPDATE_INVENTORY_DURABILITY=true, }, spell=52774, spellclass="Misc", widget={ type="CheckBox" }, options={ Show=true, Display_Gold=true, Decimals_Default=true }, subgroup=true },
}

-- unused entries (seasonal, etc)
--{ stat="LoveToken", events={ UNIT_INVENTORY_CHANGED=true, }, item=49927, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true }, subgroup=true },
--{ stat="Puzzling", events={ UNIT_INVENTORY_CHANGED=true, }, item=250741, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true }, subgroup=true },
--{ stat="CofferKey", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3028, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true }, subgroup=true },
--{ stat="Bronze", events={ CURRENCY_DISPLAY_UPDATE=true, }, currency=3252, spellclass="Currency", widget={ type="CheckBox" }, options={ Show=true, Decimals_Bronze=true, Decimals_Default=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,
}

------------------------------
--		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="Enhancement", icon="Physical", },
	[8] = { stat="Physical", icon="Defense", },
	[9] = { stat="Spell", icon="Spell", },
	[10] = { stat="Currency", icon="Currency", },
	[11] = { stat="Journeys", icon="Journeys", },
	[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="Auto_Name", spellclass="Auto_Name", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "Auto_Name"}, },
	{ 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="Damage_Taken", spellclass="Damage_Taken", widget={ type="Radio", }, tooltip=true,  default=1, labels={ "Damage", "DamageTaken", "Both"}, newline=true, },
	{ stat="Melee_Ranged", spellclass="Melee_Ranged", widget={ type="Radio", }, tooltip=true,  default=1, labels={ "Melee", "Ranged", "Both"},newline=true, },
	{ stat="Display_Average", spellclass="Display_Average", widget={ type="CheckBox", }, tooltip=true,  default=false, labels={ "Display_Average"}, newline=true, },
	{ stat="World_Realm", spellclass="World_Realm", widget={ type="Radio", }, tooltip=true,  default=1, labels={ "World", "Realm", "Both"}, newline=true, },
	{ stat="Equipped_Overall", spellclass="Equipped_Overall", widget={ type="Radio", }, tooltip=true,  default=1, labels={ "Equipped", "Max", "Both"}, newline=true, },
	{ stat="Level_HonorPoints", spellclass="Level_HonorPoints", widget={ type="Radio", }, tooltip=true,  default=1, labels={ "Level", "Honor", "Both"}, newline=true, },
	{ stat="Max_Average_Damage", spellclass="Max_Average_Damage", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Max", "Average", "Low"}, newline=true, },
	{ stat="Current_Earned", spellclass="Current_Earned", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Current", "Earned", "Both"}, newline=true, },
	{ stat="Rank_Rep", spellclass="Rank_Rep", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Rank", "Rep", "Both"}, newline=true, },
	{ stat="Core_Shard", spellclass="Core_Shard", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Core", "Shard", "Both"}, newline=true, },
	{ stat="Display_Rated", spellclass="Display_Rated", widget={ type="CheckBox", }, tooltip=true,  default=false, labels={ "Display_Rated"}, },
	{ 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_Percentage", spellclass="Display_Percentage", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "Display_Percentage"}, },
	{ stat="Hide_Reputation", spellclass="Hide_Reputation", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "Hide_Reputation"}, newline=true, },
	{ stat="Display_MainHand", spellclass="Display_MainHand", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "Display_MainHand"}, },
	{ stat="Display_Total", spellclass="Display_Total", widget={ type="CheckBox", }, default=false, labels={ "Display_Total"}, newline=true,},
	{ stat="BNet_Realm", spellclass="BNet_Realm", widget={ type="Radio", }, tooltip=true, default=1, labels={ "BNet", "Realm", "Both"}, newline=true, },
	{ stat="Speed_Static", spellclass="Speed_Static", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Live", "Static", "Both"}, newline=true, },
	{ stat="Speed_Color", spellclass="Speed_Color", widget={ type="CheckBox", }, default=true, labels={ "Speed_Color"}, },
	{ stat="Normal_Enchanted", spellclass="Normal_Enchanted", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Normal", "Enchanted", "Both"}, newline=true, },
	{ stat="Shadow_Ing", spellclass="Shadow_Ing", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Shadowflame", "Ingenuity", "Both"}, newline=true, },
	{ stat="Season_Exp", spellclass="Season_Exp", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Season", "Expansion", "Both"}, newline=true, },
	{ stat="Raids_Dungeons", spellclass="Raids_Dungeons", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Raids", "Dungeons", "Both"}, newline=true, },
	{ stat="Splint_Spark", spellclass="Splint_Spark", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Spark", "Splinter", "Both"}, newline=true, },
	{ stat="Display_Gold", spellclass="Display_Gold", widget={ type="CheckBox", }, tooltip=false, default=false, labels={ "Display_Gold"}, },
	{ 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="Timer_Format", spellclass="Timer_Format", widget={ type="DropList", data="TimerFormat", width=120, }, default=1, newline=true, },
	{ stat="Send_Chat", spellclass="Send_Chat", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "Send_Chat"}, newline=true, },
	{ stat="Editbox_MobRange", spellclass="Editbox_MobRange", default=10, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.0f", }, newline=true, },
	{ stat="AutoColorOff", spellclass="AutoColorOff", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "AutoColorOff"}, newline=true, },
	{ stat="GradientText", spellclass="GradientText", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "GradientText"}, newline=true, },
	{ stat="Empty_Vintage", spellclass="Empty_Vintage", widget={ type="Radio", }, tooltip=true, default=1, labels={ "Empty", "Vintage", "Both"}, newline=true, },
	-- decimals
	{ stat="Decimals_Default", spellclass="Decimals_Default", default=0, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Decimals_One", spellclass="Decimals_One", default=1, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Decimals_Two", spellclass="Decimals_Two", default=2, widget={ type="Slider", min=0, max=3, valuestep=1, width=140, } , newline=true, },
	{ stat="Display_Max", spellclass="Display_Max", widget={ type="CheckBox", }, tooltip=true, default=true, labels={ "Display_Max"}, newline=true, },
	{ stat="Display_Weekly", spellclass="Display_Weekly", widget={ type="CheckBox", }, tooltip=false, default=false, labels={ "Display_Weekly"}, },
	-- caps
	{ 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", }, },
	-- Diminishing Returns
	{ stat="DR_Display", spellclass="DR_Display", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "DR_Display"}, newline=true, },
	{ stat="DR_Gradient", spellclass="DR_Gradient", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "DR_Gradient"}, },
	{ 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="Editbox_DP", spellclass="Editbox_DP", default=11, tooltip=true, widget={ type="EditBox", width=60, height=20, numeric=true, format="%.0f", }, newline=true, },
	{ stat="Display_Tier8", spellclass="Display_Tier8", widget={ type="CheckBox", }, tooltip=false, default=false, labels={ "Display_Tier8"}, linked={ "Editbox_DP", true }, },
	{ stat="Display_All", spellclass="Display_All", widget={ type="CheckBox", }, tooltip=false, default=false, labels={ "Display_All"}, linked={ "Display_Tier8", true }, },
	{ stat="Vault_Tooltip", spellclass="Vault_Tooltip", widget={ type="CheckBox", }, tooltip=true, default=false, labels={ "Vault_Tooltip"}, onclick="OnVaultTooltipToggle", newline=true, },
	-- colors
	{ 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="Blizzard", 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 = {
--10.0 DF
		EVOKER = {
			Haste = true,
			Versatility = true,
			CritChance = true,
			Mastery = true,
			ManaRegen = true,
			SpellPower = true,
			Healing = true,
			Speed = true,
			Durability = true,
		},
--7.0 Legion
		DEMONHUNTER  = {
			Haste = true,
			Versatility = true,
			CritChance = true,
			Mastery = true,
			Leech = true,
			Strength = true,
			AP = true,
			DMG = true,
			Armor = true,
			Dodge = true,
			Speed = true,
			Durability = true,
		},
--5.0 Panda
		MONK = {
			Haste = true,
			Versatility = true,
			CritChance = true,
			Mastery = true,
			Stagger = true,
			AP = true,
			Agility = true,
			Armor = true,
			Dodge = true,
			Speed = true,
			Durability = true,
		},
--3.0 Wrath
		DEATHKNIGHT = { -- setup will check the stat. exists for game version being played
			Haste = true,
			Versatility = true,
			CritChance = true,
			Mastery = true,
			Leech = true,
			AP = true,
			Strength = true,
			Armor = true,
			Parry = true,
			Speed = true,
			Durability = true,
		},
--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