View Single Post
07-16-16, 08:42 PM   #5
Dejablue
A Wyrmkin Dreamwalker
 
Dejablue's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 58
I never figured out what I was doing wrong with the database... I went over the loader and scratched my head forever. I took the day to just rebuild step by step with a friend using your suggestions and his.

Here it is all fixed. Database works. I still have yet to rebuild the frame creation loop but all i did there was remove the table insertions and corrall them into DCS_FillSelectStatsTable(). Also have to do string conversion so the check button labels are not, for example, "ATTACK_POWER" and instead appear as "Attack Power".

Thanks for the help Lombra

here is the working code:

Code:
local _, private = ...
private.defaults.dejacharacterstatsSelectedStats = {
	HEALTH = true,POWER = false,ARMOR = false,
	STRENGTH = false,AGILITY = false,INTELLECT = false,STAMINA = false,
	ATTACK_DAMAGE = false,ATTACK_AP = false,ATTACK_ATTACKSPEED = false,SPELLPOWER = false,
	MANAREGEN = false,ENERGY_REGEN = false,RUNE_REGEN = false,FOCUS_REGEN = false,MOVESPEED = false,
	CRITCHANCE = false,HASTE = false,VERSATILITY = false,MASTERY = false,
	LIFESTEAL = false,AVOIDANCE = false,
	DODGE = false,PARRY = false,BLOCK = false,
}

PAPERDOLL_IndexDefaultStats ={
	[1] = "HEALTH",[2] = "POWER",[3] = "ARMOR",
	[4] = "STRENGTH",[5] = "AGILITY",[6] = "INTELLECT",[7] = "STAMINA",
	[8] = "ATTACK_DAMAGE",[9] = "ATTACK_AP",[10] = "ATTACK_ATTACKSPEED",[11] = "SPELLPOWER",
	[12] = "MANAREGEN",[13] = "ENERGY_REGEN",[14] = "RUNE_REGEN",[15] = "FOCUS_REGEN",[16] = "MOVESPEED",
	[17] = "CRITCHANCE",[18] = "HASTE",[19] = "VERSATILITY",[20] = "MASTERY",
	[21] = "LIFESTEAL",[22] = "AVOIDANCE",
	[23] = "DODGE",[24] = "PARRY",[25] = "BLOCK",
}
	
local function DCS_FillSelectStatsTable()
	for k, v in ipairs(PAPERDOLL_IndexDefaultStats) do
	--print(k,v)
	local checked = private.db.dejacharacterstatsSelectedStats[v]
	--print(checked)
		if checked == true then 
			--print(k,v)
			table.insert(PAPERDOLL_STATCATEGORIES[1].stats, { stat = format("%s", v) })
			PaperDollFrame_UpdateStats();
		end
	end
end
  Reply With Quote