local _, core = ...;

StaticPopupDialogs["AlertExportWC"] = {
	text = core.L["FullExportSuccessMessage"],
	button1 = "Ok",
	hideOnEscape = false,
	whileDead = true,
}

local frame = CreateFrame("FRAME");
frame:RegisterEvent("ADDON_LOADED");
function frame:OnEvent(event, arg1)
	if event == "ADDON_LOADED" and arg1 == "WoWChallenger_ImpExport" then
		if WoWChallenger_ImpExport_ShowAlert then
			StaticPopup_Show("AlertExportWC");
			WoWChallenger_ImpExport_ShowAlert = false;
		end
	end
	if event == "ADDON_LOADED" and arg1 == "WoWChallenger" then
		if WC_AdventuresData == nil then
			WC_AdventuresData = {
				adventures = {},
				units      = {},
				spells     = {},
				victories  = {},
			}
		end
		if NewGuides == nil then
			NewGuides = {}
		end
		if Prefer == nil then
			Prefer = {
				hide = false,
			}
		end
		if WC_Ranking == nil then
			WC_Ranking = {
				Guild  = {},
				People = {},
			}
		end
		if DBProfile == nil then
			DBProfile = {
				Equip = {76390, 46471}, -- [1]: Weapon, [2]: Armor
				pdv = 50,
				pdvMax = 50,
				damage = 5,
				damageMax = 5,
				skillPoints = 0,
				showTuto = true,
				itemUnlock = {
					{0, 2, 2, 2, 2},			-- Skin armes   -- 2: Lock, 1: CanBuy, 0: Unlock
					{0, 2, 2, 2, 2}, 			-- Skin armures -- 2: Lock, 1: CanBuy, 0: Unlock
					{0, 0, 2, 2, 2, 2, 2, 2}, 	-- Spells 	 	-- 2: Lock, 1: CanBuy, 0: Unlock
					{2, 2, 2}, 		 			-- Bonus 		-- 2: Lock, 1: CanBuy, 0: Unlock
				},
				bonusLvL = {0, 0, 0},
			}
		end
		if Campaign1 == nil then
			Campaign1 = {
				[1] = {
					done = false,
				},
				[2] = {
					done = false,
				},
				[3] = {
					done = false,
				},
				[4] = {
					done = false,
				},
				[5] = {
					done = false,
				}
			}
		end
		if Campaign2 == nil then
			Campaign2 = {
				[1] = {
					done = false,
				},
				[2] = {
					done = false,
				},
				[3] = {
					done = false,
				},
				[4] = {
					done = false,
				},
				[5] = {
					done = false,
				},
				[6] = {
					done = false,
				},
			}
		end
		if Campaign3 == nil then
			Campaign3 = {
				[1] = {
					done = false,
				},
				[2] = {
					done = false,
				},
				[3] = {
					done = false,
				},
				[4] = {
					done = false,
				},
				[5] = {
					done = false,
				},
				[6] = {
					done = false,
				},
			}
		end
		if Campaign4 == nil then
			Campaign4 = {
				[1] = {
					done = false,
				},
				[2] = {
					done = false,
				},
				[3] = {
					done = false,
				},
				[4] = {
					done = false,
				},
				[5] = {
					done = false,
				},
				[6] = {
					done = false,
				},
				[7] = {
					done = false,
				},
				[8] = {
					done = false,
				},
				[9] = {
					done = false,
				},
			}
		end
		if (WC_Guides == nil) then
			WC_Guides = {};
		end
		if (WC_ListGuides == nil) then
			WC_ListGuides = {};
			for i = 1, #WC_Guides do
				WC_ListGuides[i] = WC_ListGuides[i].idGuide;
			end
		end
		if (WC_arrIsDone == nil) then
			WC_arrIsDone = {};
		end
	end
end
frame:SetScript("OnEvent", frame.OnEvent);
