Thread Tools Display Modes
08-27-18, 11:43 AM   #1
Quingar
A Deviate Faerie Dragon
Join Date: Apr 2011
Posts: 13
Need help to edit this code from old RealUI for showing stat on player frame

Hello guys,
So I was happy to find my old realui backups from Wotlk/Cata/MoP times.
And I found the code that was adding that secondary stats next to your player frame/health bar.

Can somebody help me to update this code to be able to use it in BfA ? Mainly that show stat part on unit frame. Mainly I need our current 2nd stats so Haste/Mastery/Crit/Versatility
Thank you in advance

Code:
local nibRealUI = LibStub("AceAddon-3.0"):GetAddon("nibRealUI");

local db, dbc;

local nibRealUICharacter_defaults = {
	initialized = false,
	needchatmoved = true,
};

local table_Stats = {
	"Armor Penetration",
	"Armor",
	"Attack Power",
	"Attack Speed",
	"Defense",
	"Ranged Attack Power",
	"Spell Penetration",
	"Spell Damage",
	"Spell Healing",
	"Mana Regen",
	"Parry Chance",
	"Dodge Chance",
	"Melee Crit",
	"Ranged Crit",
	"Spell Crit",
	"Hit Rating",
	"Block Chance",
	"Expertise",
	"Haste Rating",
	"Resilience",
};

local table_TalentRoles = {
	[1] = "DPS",
	[2] = "Tank",
	[3] = "Heal",
};

local newcharoptions, sdoptions = nil, nil;
local function GetNewCharOptions()
	local StatDisplay = nibRealUI:GetModule("StatDisplay", true);
	if (StatDisplay ~= nil) and (not sdoptions) then
	local dbsdc = StatDisplay.db.char;
		sdoptions = {
			statdisplayoptions = {
				name = "StatDisplay",
				type = "group",
				arg = "StatDisplay",
				inline = true,
				order = 2,
				args = {
					header_statdisplay = {
						type = "description",
						name = "The two stats you choose here will appear directly below your Player Unit Frame.",
						order = 1,
					},
					primarystat_area = {
						name = "Stats - Primary",
						type = "group",
						inline = true,
						order = 2,
						args = {
							header_primarystat = {
								type = "description",
								name = "Choose the stats you would like to display when in your Primary talent spec.",
								order = 1,
							},
							sep2 = {
								type = "description",
								name = "",
								order = 2,
							},
							primarystat1 = {
								type = "select",
								name = "Stat 1",
								desc = "First stat to display",
								get = function(info)
									for k,v in pairs(table_Stats) do
										if v == dbsdc.primary.stat1 then return k end
									end
								end,
								set = function(info, value)
									dbsdc.primary.stat1 = table_Stats[value]
									if StatDisplay.RefreshStats then
										if type(StatDisplay.RefreshStats) == "function" then
											StatDisplay:RefreshStats()
										end
									end
								end,
								style = "dropdown",
								width = nil,
								values = table_Stats,
								order = 3,
							},
							primarystat2= {
								type = "select",
								name = "Stat 2",
								desc = "Second stat to display",
								get = function(info)
									for k,v in pairs(table_Stats) do
										if v == dbsdc.primary.stat2 then return k end
									end
								end,
								set = function(info, value)
									dbsdc.primary.stat2 = table_Stats[value]
									if StatDisplay.RefreshStats then
										if type(StatDisplay.RefreshStats) == "function" then
											StatDisplay:RefreshStats()
										end
									end
								end,
								style = "dropdown",
								width = nil,
								values = table_Stats,
								order = 4,
							},
						},
					},
					secondarystat_area = {
						name = "Stats - Secondary",
						type = "group",
						inline = true,
						order = 3,
						args = {
							header_secondarystat = {
								type = "description",
								name = "Choose the stats to display when in your Secondary talent spec.",
								order = 1,
							},
							sep2 = {
								type = "description",
								name = "",
								order = 2,
							},
							secondarystat1 = {
								type = "select",
								name = "Stat 1",
								desc = "First stat to display",
								get = function(info)
									for k,v in pairs(table_Stats) do
										if v == dbsdc.secondary.stat1 then return k end
									end
								end,
								set = function(info, value)
									dbsdc.secondary.stat1 = table_Stats[value]
									if StatDisplay.RefreshStats then
										if type(StatDisplay.RefreshStats) == "function" then
											StatDisplay:RefreshStats()
										end
									end
								end,
								style = "dropdown",
								width = nil,
								values = table_Stats,
								order = 3,
							},
							secondarystat2= {
								type = "select",
								name = "Stat 2",
								desc = "Second stat to display",
								get = function(info)
									for k,v in pairs(table_Stats) do
										if v == dbsdc.secondary.stat2 then return k end
									end
								end,
								set = function(info, value)
									dbsdc.secondary.stat2 = table_Stats[value]
									if StatDisplay.RefreshStats then
										if type(StatDisplay.RefreshStats) == "function" then
											StatDisplay:RefreshStats()
										end
									end
								end,
								style = "dropdown",
								width = nil,
								values = table_Stats,
								order = 4,
							},
						},
					},
				},
			},
		};
	end
  Reply With Quote

WoWInterface » Featured Projects » RealUI » Need help to edit this code from old RealUI for showing stat on player frame

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off