--[[ data.lua Various data load functions. ]] -- Function: Define the EFM data variable(s) function EFM_DefineData() --------------------------------- -- Global options data definition if (EFM_MyConf == nil) then EFM_MyConf = {}; end if (EFM_MyConf.Timer == nil) then EFM_MyConf.Timer = true; end if (EFM_MyConf.ZoneMarker == nil) then EFM_MyConf.ZoneMarker = true; end if (EFM_MyConf.DruidPaths == nil) then EFM_MyConf.DruidPaths = true; end if (EFM_MyConf.ShowTimerBar == nil) then EFM_MyConf.ShowTimerBar = false; end if (EFM_MyConf.ShrinkStatusBar == nil) then EFM_MyConf.ShrinkStatusBar = true; end if (EFM_MyConf.ShowLargeBar == nil) then EFM_MyConf.ShowLargeBar = false; end if (EFM_MyConf.TimerPosition == nil) then EFM_MyConf.TimerPosition = -150; end if (EFM_MyConf.LoadAll == nil) then EFM_MyConf.LoadAll = true; end if (EFM_MyConf.ContinentOverlay == nil) then EFM_MyConf.ContinentOverlay = true; end end -- Function: Import preloaded data into "live" EFM data function EFM_Data_Import(faction) local myLocale = GetLocale(); if (EFM_Data == nil) then EFM_Data = {}; end if (faction == FACTION_ALLIANCE) then if (Default_EFM_FlightData[myLocale] ~= nil) then if (Default_EFM_FlightData[myLocale][FACTION_ALLIANCE] ~= nil) then if (EFM_Data[FACTION_ALLIANCE] == nil) then EFM_Data[FACTION_ALLIANCE] = {}; end EFM_SF_mergeTable(Default_EFM_FlightData[myLocale][FACTION_ALLIANCE], EFM_Data[FACTION_ALLIANCE]); EFM_Message("announce", format(EFM_MSG_DATALOAD, FACTION_ALLIANCE)); return; end end elseif (faction == FACTION_HORDE) then if (Default_EFM_FlightData[myLocale] ~= nil) then if (Default_EFM_FlightData[myLocale][FACTION_HORDE] ~= nil) then if (EFM_Data[FACTION_HORDE] == nil) then EFM_Data[FACTION_HORDE] = {}; end EFM_SF_mergeTable(Default_EFM_FlightData[myLocale][FACTION_HORDE], EFM_Data[FACTION_HORDE]); EFM_Message("announce", format(EFM_MSG_DATALOAD, FACTION_HORDE)); return; end end else if (Default_EFM_FlightData[myLocale] ~= nil) then EFM_SF_mergeTable(Default_EFM_FlightData[myLocale], EFM_Data); EFM_Message("announce", format(EFM_MSG_DATALOAD, "All Factions")); return; end end EFM_Shared_DebugMessage("EFM: No data available for locale "..myLocale.."!", Lys_Debug); end -- Function: Load times for known flight points from provided data set. function EFM_Data_ImportTimes(faction) local myLocale = GetLocale(); if (myLocale == "enGB") then myLocale = "enUS"; end if (faction == nil) then EFM_Shared_DebugMessage("EFM: Faction not given for timers import!", Lys_Debug); return; end if ((faction ~= FACTION_ALLIANCE) and (faction ~= FACTION_HORDE)) then EFM_Shared_DebugMessage("EFM: Invalid faction given for timers import!", Lys_Debug); return; end if (Default_EFM_FlightData[myLocale] ~= nil) then for myContinent in pairs(EFM_Data[faction]) do for myZone in pairs(EFM_Data[faction][myContinent]) do for myNode in pairs(EFM_Data[faction][myContinent][myZone]) do if (Default_EFM_FlightData[myLocale][faction] ~= nil) then if (Default_EFM_FlightData[myLocale][faction][myContinent] ~= nil) then if (Default_EFM_FlightData[myLocale][faction][myContinent][myZone] ~= nil) then if (Default_EFM_FlightData[myLocale][faction][myContinent][myZone][myNode] ~= nil) then if (Default_EFM_FlightData[myLocale][faction][myContinent][myZone][myNode]["timers"] ~= nil) then if (EFM_Data[faction][myContinent][myZone][myNode]["timers"] == nil) then EFM_Data[faction][myContinent][myZone][myNode]["timers"] = {}; end EFM_SF_mergeTable(Default_EFM_FlightData[myLocale][faction][myContinent][myZone][myNode]["timers"], EFM_Data[faction][myContinent][myZone][myNode]["timers"]); end end end end end end end end EFM_Message("announce", format(EFM_MSG_DATALOADTIMERS, faction)); return; end EFM_Shared_DebugMessage("EFM: No data available for locale "..myLocale.."!", Lys_Debug); end -- Function: Fixup for special blizzard nodes. function EFM_Data_NodeFixup() local myDebug = false; for orgZone, newZone in pairs (EFM_SearchZones) do EFM_Shared_DebugMessage("EFM: orgZone="..orgZone, myDebug); EFM_Shared_DebugMessage("EFM: newZone="..newZone, myDebug); local continentNames, key, val = { GetMapContinents() } ; for myContinent = 1, table.getn(continentNames) do local continentName = EFM_Shared_GetContinentName(myContinent); if (EFM_Data ~= nil) then -- Fixup Alliance Nodes if (EFM_Data[FACTION_ALLIANCE] ~= nil) then if (EFM_Data[FACTION_ALLIANCE][continentName] ~= nil) then if (EFM_Data[FACTION_ALLIANCE][continentName][orgZone] ~= nil) then EFM_Shared_DebugMessage("EFM: Zone Exists="..orgZone, myDebug); EFM_Data[FACTION_ALLIANCE][continentName][newZone] = {}; EFM_SF_mergeTable(EFM_Data[FACTION_ALLIANCE][continentName][orgZone], EFM_Data[FACTION_ALLIANCE][continentName][newZone]); EFM_Data[FACTION_ALLIANCE][continentName][orgZone] = nil; end end end -- Fixup Horde Nodes if (EFM_Data[FACTION_HORDE] ~= nil) then if (EFM_Data[FACTION_HORDE][continentName] ~= nil) then if (EFM_Data[FACTION_HORDE][continentName][orgZone] ~= nil) then EFM_Shared_DebugMessage("EFM: Zone Exists="..orgZone, myDebug); EFM_Data[FACTION_HORDE][continentName][newZone] = {}; EFM_SF_mergeTable(EFM_Data[FACTION_HORDE][continentName][orgZone], EFM_Data[FACTION_HORDE][continentName][newZone]); EFM_Data[FACTION_HORDE][continentName][orgZone] = nil; end end end end end end end