WoWInterface SVN InFlight

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 128 to Rev 129
    Reverse comparison

Rev 128 → Rev 129

tags/1.13.002_Classic/InFlight_Load/embeds.xml New file
0,0 → 1,4
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Script file="..\InFlight\libs\LibStub\LibStub.lua"/>
<Include file="..\InFlight\libs\AceLocale-3.0\AceLocale-3.0.xml"/>
</Ui>
\ No newline at end of file Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight_Load/locales/zhCN.lua New file
0,0 → 1,11
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "zhCN")
if not L then return end
 
L["Nighthaven"] = "永夜港"
L["NighthavenGossipA"] = "我想飞往鲁瑟兰村"
L["NighthavenGossipH"] = "我想飞往雷霆崖"
L["Return"] = "回来"
L["Rut'theran Village"] = "鲁瑟兰村"
L["Stormwind City"] = "暴风城"
L["StormwindCityGossip"] = "我要绕暴风城港口游览一圈"
L["Thunder Bluff"] = "雷霆崖"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight_Load/locales/koKR.lua New file
0,0 → 1,11
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "koKR")
if not L then return end
 
L["Nighthaven"] = "밤의 안식처"
L["NighthavenGossipA"] = "루테란 마을로 날아가고 싶습니다"
L["NighthavenGossipH"] = "썬더 블러프로 날아가고 싶어요"
L["Return"] = "돌아오다"
L["Rut'theran Village"] = "루테란 마을"
L["Stormwind City"] = "스톰윈드"
L["StormwindCityGossip"] = "스톰윈드 항구 주변을 한 바퀴 돌면서 구경했으면 좋겠습니다"
L["Thunder Bluff"] = "썬더 블러프"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight_Load/locales/ptBR.lua New file
0,0 → 1,11
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "ptBR")
if not L then return end
 
L["Nighthaven"] = "Refúgio Noturno"
L["NighthavenGossipA"] = "Eu quero voar até a Vila de Rut'theran"
L["NighthavenGossipH"] = "Eu gostaria de voar para o Penhasco do Trovão"
L["Return"] = "Volta"
L["Rut'theran Village"] = "Vila de Rut'theran"
L["Stormwind City"] = "Ventobravo"
L["StormwindCityGossip"] = "Eu quero sobrevoar o Porto de Ventobravo"
L["Thunder Bluff"] = "Penhasco do Trovão"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight_Load/locales/itIT.lua New file
0,0 → 1,11
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "itIT")
if not L then return end
 
L["Nighthaven"] = "Nottequieta"
L["NighthavenGossipA"] = "Vorrei andare a Rut'theran"
L["NighthavenGossipH"] = "Vorrei andare a Picco del Tuono"
L["Return"] = "Tornare"
L["Rut'theran Village"] = "Rut'theran"
L["Stormwind City"] = "Roccavento"
L["StormwindCityGossip"] = "Vorrei fare un volo sopra il Porto di Roccavento"
L["Thunder Bluff"] = "Picco del Tuono"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight_Load/locales/enUS.lua New file
0,0 → 1,11
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "enUS", true)
if not L then return end
 
L["Nighthaven"] = true
L["NighthavenGossipA"] = "I'd like to fly to Rut'theran Village"
L["NighthavenGossipH"] = "I'd like to fly to Thunder Bluff"
L["Return"] = true
L["Rut'theran Village"] = true
L["Stormwind City"] = true
L["StormwindCityGossip"] = "I'd like to take a flight around Stormwind Harbor"
L["Thunder Bluff"] = true
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight_Load/locales/esMX.lua New file
0,0 → 1,11
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "esMX")
if not L then return end
 
L["Nighthaven"] = "Amparo de la Noche"
L["NighthavenGossipA"] = "Me gustaría volar a Aldea Rut'theran"
L["NighthavenGossipH"] = "Me gustaría volar a Cima del Trueno"
L["Return"] = "Regresar"
L["Rut'theran Village"] = "Aldea Rut'theran"
L["Stormwind City"] = "Ciudad de Ventormenta"
L["StormwindCityGossip"] = "Me gustaría volar alrededor del Puerto de Ventormenta"
L["Thunder Bluff"] = "Cima del Trueno"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight_Load/locales/zhTW.lua New file
0,0 → 1,11
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "zhTW")
if not L then return end
 
L["Nighthaven"] = "永夜港"
L["NighthavenGossipA"] = "我想飛往魯瑟蘭村"
L["NighthavenGossipH"] = "我想飛往雷霆崖"
L["Return"] = "回來"
L["Rut'theran Village"] = "魯瑟蘭村"
L["Stormwind City"] = "暴風城"
L["StormwindCityGossip"] = "我想要繞著暴風港飛一趟"
L["Thunder Bluff"] = "雷霆崖"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight_Load/locales/ruRU.lua New file
0,0 → 1,11
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "ruRU")
if not L then return end
 
L["Nighthaven"] = "Ночная Гавань"
L["NighthavenGossipA"] = "Я бы хотел отправиться в деревню Рут'теран"
L["NighthavenGossipH"] = "Мне хотелось бы слетать в Громовой Утес"
L["Return"] = "Возвращение"
L["Rut'theran Village"] = "Деревня Рут'теран"
L["Stormwind City"] = "Штормград"
L["StormwindCityGossip"] = "Я хочу полетать над портом Штормграда"
L["Thunder Bluff"] = "Громовой Утес"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight_Load/locales/esES.lua New file
0,0 → 1,11
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "esES")
if not L then return end
 
L["Nighthaven"] = "Amparo de la Noche"
L["NighthavenGossipA"] = "Me gustaría volar a la Aldea Rut'theran"
L["NighthavenGossipH"] = "Me gustaría volar a Cima del Trueno"
L["Return"] = "Regresar"
L["Rut'theran Village"] = "Aldea Rut'theran"
L["Stormwind City"] = "Ciudad de Ventormenta"
L["StormwindCityGossip"] = "Me gustaría volar alrededor del Puerto de Ventormenta"
L["Thunder Bluff"] = "Cima del Trueno"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight_Load/locales/frFR.lua New file
0,0 → 1,11
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "frFR")
if not L then return end
 
L["Nighthaven"] = "Havrenuit"
L["NighthavenGossipA"] = "J’aimerais voler jusqu’au village de Rut’theran"
L["NighthavenGossipH"] = "J’aimerais voler jusqu’aux Pitons-du-Tonnerre"
L["Return"] = "Revenir"
L["Rut'theran Village"] = "Rut’theran"
L["Stormwind City"] = "Hurlevent"
L["StormwindCityGossip"] = "J’aimerais survoler le port de Hurlevent"
L["Thunder Bluff"] = "Les Pitons-du-Tonnerre"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight_Load/locales/deDE.lua New file
0,0 → 1,11
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "deDE")
if not L then return end
 
L["Nighthaven"] = "Nachthafen"
L["NighthavenGossipA"] = "Ich würde gerne nach Rut'theran fliegen"
L["NighthavenGossipH"] = "Ich würde gerne nach Donnerfels fliegen"
L["Return"] = "Zurück zum Startpunkt"
L["Rut'theran Village"] = "Rut'theran"
L["Stormwind City"] = "Sturmwind"
L["StormwindCityGossip"] = "Ich möchte durch den Hafen von Sturmwind fliegen"
L["Thunder Bluff"] = "Donnerfels"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight_Load/locales/locales.xml New file
0,0 → 1,14
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="enUS.lua"/>
<Script file="deDE.lua"/>
<Script file="esES.lua"/>
<Script file="esMX.lua"/>
<Script file="frFR.lua"/>
<Script file="itIT.lua"/>
<Script file="koKR.lua"/>
<Script file="ptBR.lua"/>
<Script file="ruRU.lua"/>
<Script file="zhTW.lua"/>
<Script file="zhCN.lua"/>
</Ui>
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight_Load/InFlight_Load.lua New file
0,0 → 1,111
local InFlight = CreateFrame("Frame", "InFlight") -- no parent is intentional
local self = InFlight
InFlight:SetScript("OnEvent", function(this, event, ...) this[event](this, ...) end)
InFlight:RegisterEvent("ADDON_LOADED")
 
-- LOCAL FUNCTIONS
local function LoadInFlight()
if not InFlight.ShowOptions then
LoadAddOn("InFlight")
end
 
return (InFlight.ShowOptions and true) or nil
end
 
-----------------------------------------
function InFlight:ADDON_LOADED(addonName)
-----------------------------------------
if addonName == "InFlight_Load" then
self:RegisterEvent("TAXIMAP_OPENED")
if self.SetupInFlight then
self:SetupInFlight()
else
self:UnregisterEvent("ADDON_LOADED")
end
elseif addonName == "InFlight" then
self:UnregisterEvent("ADDON_LOADED")
self:LoadBulk()
end
end
 
-------------------------------------
function InFlight:TAXIMAP_OPENED(...)
-------------------------------------
if LoadInFlight() then
local uiMapSystem = ...
local isTaxiMap = uiMapSystem == Enum.UIMapSystem.Taxi
self:InitSource(isTaxiMap)
end
end
 
-- maybe this stuff gets garbage collected if InFlight isn't loadable
if GetAddOnEnableState(UnitName("player"), "InFlight") == 2 then
-- GLOBALS -> LOCAL
local ipairs, pairs, strfind, strmatch = ipairs, pairs, strfind, strmatch
 
-- LOCALIZATION
local L = LibStub("AceLocale-3.0"):GetLocale("InFlight", true)
InFlight.L = L
 
local t
do
t = {
[L["Nighthaven"]] = {{ find = L["NighthavenGossipA"], s = "Nighthaven", d = "Rut'theran Village" },
{ find = L["NighthavenGossipH"], s = "Nighthaven", d = "Thunder Bluff" }},
[L["Stormwind City"]] = {{ find = L["StormwindCityGossip"], s = "Stormwind City", d = "Return" }},
}
end
 
-- support for flightpaths that are started by gossip options
hooksecurefunc("GossipTitleButton_OnClick", function(this, button)
if this.type ~= "Gossip" then
return
end
 
local subzone = GetMinimapZoneText()
local tsz = t[subzone]
if not tsz then
return
end
 
local text = this:GetText()
if not text or text == "" then
return
end
 
local source, destination
for i, sz in ipairs(tsz) do
if strfind(text, sz.find, 1, true) then
source = sz.s
destination = sz.d
break
end
end
 
if source and destination and LoadInFlight() then
self:StartMiscFlight(source, destination)
end
end)
 
---------------------------------
function InFlight:SetupInFlight()
---------------------------------
SlashCmdList.INFLIGHT = function()
if LoadInFlight() then
self:ShowOptions()
end
end
SLASH_INFLIGHT1 = "/inflight"
 
local panel = CreateFrame("Frame")
panel.name = "InFlight"
panel:SetScript("OnShow", function(this)
if LoadInFlight() and InFlight.SetLayout then
InFlight:SetLayout(this)
end
end)
panel:Hide()
InterfaceOptions_AddCategory(panel)
InFlight.SetupInFlight = nil
end
end
tags/1.13.002_Classic/InFlight_Load/InFlight_Load.toc New file
0,0 → 1,27
## Interface: 11302
## Title: InFlight_Load
## Notes: Loader for InFlight
## Notes-deDE: Loader für InFlight
## Notes-esES: Cargador para InFlight
## Notes-esMX: Cargador para InFlight
## Notes-frFR: Loader pour InFlight
## Notes-itIT: Caricatore per InFlight
## Notes-koKR: InFlight 용 로더
## Notes-ptBR: Loader para InFlight
## Notes-ruRU: Загрузчик для InFlight
## Notes-zhCN: InFlight 的載入器
## Notes-zhTW: InFlight 的裝載機
## Author: TotalPackage
## Version: 1.13.002
 
## X-Category: Interface Enhancements
 
## OptionalDeps: Ace3
 
## LoadManagers: AddonLoader
## X-LoadOn-Always: delayed
 
embeds.xml
 
locales\locales.xml
InFlight_Load.lua
tags/1.13.002_Classic/InFlight/locales/koKR.lua New file
0,0 → 1,36
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "koKR")
if not L then return end
 
L["BackgroundColor"] = "배경 색상"
L["BarColor"] = "바 색상"
L["BarOptions"] = "바 설정"
L["Border"] = "테두리"
L["BorderColor"] = "테두리 색상"
L["CompactMode"] = "간단 모드"
L["ConfirmFlight"] = "경로 확인"
L["ConfirmPopup"] = "%s로 비행할까요?"
L["DefaultsUpdated"] = "기본값이 업데이트되었습니다."
L["DestParse"] = " %- (.+)"
L["Duration"] = "지속시간: "
L["FillUp"] = "바 채우기"
L["FlightTimeAdded"] = "추가 비행 시간 :"
L["FlightTimeContribute"] = "%s 비행 시간 업로드 할 수는."
L["FlightTimeUpdated"] = "업데이트 된 비행 시간 :"
L["Font"] = "글꼴"
L["FontColor"] = "글꼴 색상"
L["Height"] = "높이"
L["OutlineInfo"] = "정보 윤곽선"
L["OutlineTime"] = "시간 윤곽선"
L["PerCharOptions"] = "캐릭터별 설정"
L["ResetFlightTimes"] = "비행 시간 초기화"
L["ResetOptions"] = "설정 초기화"
L["ShowChat"] = "채팅 메시지"
L["ShowSpark"] = "불꽃 표시"
L["TextOptions"] = "글자 설정"
L["Texture"] = "바 텍스처"
L["TooltipOption2"] = "<쉬프트+클릭> 하면 이동합니다"
L["TooltipOption3"] = "<오른쪽-클릭> 하면 설정을 엽니다"
L["TooltipOption4"] = "<Ctrl+클릭> 하면 강제로 닫습니다"
L["ToText"] = "\"~\"숙어"
L["UnknownColor"] = "모르는 경로 색상"
L["Width"] = "길이"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/locales/ptBR.lua New file
0,0 → 1,36
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "ptBR")
if not L then return end
 
L["BackgroundColor"] = "Cor de Fundo"
L["BarColor"] = "Cor da Barra"
L["BarOptions"] = "Opções de Bar"
L["Border"] = "Borda"
L["BorderColor"] = "Cor da Borda"
L["CompactMode"] = "Modo Compacto"
L["ConfirmFlight"] = "Confirmar Vôo"
L["ConfirmPopup"] = "Tome o vôo para %s?"
L["DefaultsUpdated"] = "Dados padrão atualizados."
L["DestParse"] = ", (.+)"
L["Duration"] = "Duração:"
L["FillUp"] = "Encher"
L["FlightTimeAdded"] = "tempo de vôo acrescentou:"
L["FlightTimeContribute"] = "%s tempos de voo disponíveis para contribuir."
L["FlightTimeUpdated"] = "tempo de vôo atualização:"
L["Font"] = "Fonte"
L["FontColor"] = "Cor da Fonte"
L["Height"] = "Altura"
L["OutlineInfo"] = "Delinear as Informações"
L["OutlineTime"] = "Delinear o Tempo"
L["PerCharOptions"] = "Opções Específicas de Caracteres"
L["ResetFlightTimes"] = "Redefinir o vôo Tempos"
L["ResetOptions"] = "Redefinir as Opções"
L["ShowChat"] = "Mensagens de Chat"
L["ShowSpark"] = "Mostrar Faísca"
L["TextOptions"] = "Opções de Texto"
L["Texture"] = "Textura"
L["TooltipOption2"] = "<Shift Clique-Esquerdo> para mover"
L["TooltipOption3"] = "<Clique-Direito> para Opções"
L["TooltipOption4"] = "<Ctrl Clique-Esquerda> para forçar perto"
L["ToText"] = "\"Para\" Texto"
L["UnknownColor"] = "Cor Desconhecida"
L["Width"] = "Largura"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/locales/itIT.lua New file
0,0 → 1,36
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "itIT")
if not L then return end
 
L["BackgroundColor"] = "Colore di Sfondo"
L["BarColor"] = "Colore della Barra"
L["BarOptions"] = "Opzioni della Barra"
L["Border"] = "Bordo"
L["BorderColor"] = "Colore del Bordo"
L["CompactMode"] = "Modalità Compatta"
L["ConfirmFlight"] = "Confermare Volo"
L["ConfirmPopup"] = "Prendi il volo per %s?"
L["DefaultsUpdated"] = "Dati predefiniti aggiornati."
L["DestParse"] = ", (.+)"
L["Duration"] = "Durata:"
L["FillUp"] = "Colmare"
L["FlightTimeAdded"] = "tempo di volo aggiunto:"
L["FlightTimeContribute"] = "%s tempo di volo disponibile per contribuire."
L["FlightTimeUpdated"] = "orario di volo aggiornato:"
L["Font"] = true
L["FontColor"] = "Colore del Carattere"
L["Height"] = "Altezza"
L["OutlineInfo"] = "Delineare le Informazioni"
L["OutlineTime"] = "Delineare il Tempo"
L["PerCharOptions"] = "Opzioni Specifiche del Personaggio"
L["ResetFlightTimes"] = "Reimposta i Tempi di Volo"
L["ResetOptions"] = "Reimpostare le Opzioni"
L["ShowChat"] = "Messaggi di Chat"
L["ShowSpark"] = "Mostra Spark"
L["TextOptions"] = "Opzioni di Testo"
L["Texture"] = "Aspetto"
L["TooltipOption2"] = "<Shift Sinistra-Click> per spostare"
L["TooltipOption3"] = "<Right-Click> per le Opzioni"
L["TooltipOption4"] = "<Ctrl Sinistro-Click> per forzare vicino"
L["ToText"] = "\"Verso\" Testo"
L["UnknownColor"] = "Colore Sconosciuto"
L["Width"] = "Larghezza"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/locales/enUS.lua New file
0,0 → 1,36
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "enUS", true)
if not L then return end
 
L["BackgroundColor"] = "Background Color"
L["BarColor"] = "Bar Color"
L["BarOptions"] = "Bar Options"
L["Border"] = true
L["BorderColor"] = "Border Color"
L["CompactMode"] = "Compact Mode"
L["ConfirmFlight"] = "Confirm Flight"
L["ConfirmPopup"] = "Take flight to %s?"
L["DefaultsUpdated"] = "Default data updated."
L["DestParse"] = ", (.+)"
L["Duration"] = "Duration: "
L["FillUp"] = "Fill Up"
L["FlightTimeAdded"] = "flight time added:"
L["FlightTimeContribute"] = "%s flight times available to contribute."
L["FlightTimeUpdated"] = "flight time updated:"
L["Font"] = true
L["FontColor"] = "Font Color"
L["Height"] = true
L["OutlineInfo"] = "Outline Info"
L["OutlineTime"] = "Outline Time"
L["PerCharOptions"] = "Character Specific Options"
L["ResetFlightTimes"] = "Reset Flight Times"
L["ResetOptions"] = "Reset Options"
L["ShowChat"] = "Chat Messages"
L["ShowSpark"] = "Show Spark"
L["TextOptions"] = "Text Options"
L["Texture"] = true
L["TooltipOption2"] = "<Shift Left-Click> to move"
L["TooltipOption3"] = "<Right-Click> for Options"
L["TooltipOption4"] = "<Ctrl Left-Click> to force close"
L["ToText"] = "\"To\" Text"
L["UnknownColor"] = "Unknown Color"
L["Width"] = true
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/locales/esMX.lua New file
0,0 → 1,36
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "esMX")
if not L then return end
 
L["BackgroundColor"] = "Color de Fondo"
L["BarColor"] = "Color de la Barra"
L["BarOptions"] = "Opciones de barra"
L["Border"] = "Borde"
L["BorderColor"] = "Color de Borde"
L["CompactMode"] = "Modo Compacto"
L["ConfirmFlight"] = "Confirmar Vuelo"
L["ConfirmPopup"] = "Tomar vuelo a %s?"
L["DefaultsUpdated"] = "Datos por defecto actualizados."
L["DestParse"] = ", (.+)"
L["Duration"] = "Duración: "
L["FillUp"] = "Rellenar"
L["FlightTimeAdded"] = "tiempo de vuelo añadido:"
L["FlightTimeContribute"] = "%s tiempos de vuelo disponibles para contribuir."
L["FlightTimeUpdated"] = "tiempo de vuelo actualizado:"
L["Font"] = "Fuente"
L["FontColor"] = "Color de fuente"
L["Height"] = "Alto"
L["OutlineInfo"] = "Delinear la Fuente"
L["OutlineTime"] = "Delinear el Tiempo"
L["PerCharOptions"] = "Opciones especificas del personaje"
L["ResetFlightTimes"] = "Restablecer Tiempos de Vuelo"
L["ResetOptions"] = "Restablecer las Opciones"
L["ShowChat"] = "Mensajes de Chat"
L["ShowSpark"] = "Mostrar Chispa"
L["TextOptions"] = "Opciones de Texto"
L["Texture"] = "Textura"
L["TooltipOption2"] = "<Shift Click-Izquierdo> para mover"
L["TooltipOption3"] = "<Click-Derecho> para Opciones"
L["TooltipOption4"] = "<Ctrl Clic-Izquierdo> para forzar cerca"
L["ToText"] = "Texto \"Hacia\""
L["UnknownColor"] = "Color de Desconocido"
L["Width"] = "Ancho"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/locales/zhTW.lua New file
0,0 → 1,36
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "zhTW")
if not L then return end
 
L["BackgroundColor"] = "背景顏色"
L["BarColor"] = "時間條顏色"
L["BarOptions"] = "外觀"
L["Border"] = "邊框"
L["BorderColor"] = "邊框顏色"
L["CompactMode"] = "內嵌模式"
L["ConfirmFlight"] = "確定飛行"
L["ConfirmPopup"] = "你確定你要飛到%s?"
L["DefaultsUpdated"] = "默認數據已更新。"
L["DestParse"] = ",(.+)"
L["Duration"] = "時間: "
L["FillUp"] = "遞增"
L["FlightTimeAdded"] = "飛行時間補充:"
L["FlightTimeContribute"] = "%s 飛行時間可供貢獻。"
L["FlightTimeUpdated"] = "航班時間更新:"
L["Font"] = "字形"
L["FontColor"] = "字形顏色"
L["Height"] = "高度"
L["OutlineInfo"] = "輪廓信息文本"
L["OutlineTime"] = "輪廓 時間文本"
L["PerCharOptions"] = "字符特定選項"
L["ResetFlightTimes"] = "重置飛行時間"
L["ResetOptions"] = "重置選項"
L["ShowChat"] = "顯示聊天消息"
L["ShowSpark"] = "顯示火花"
L["TextOptions"] = "字形"
L["Texture"] = "時間條紋理"
L["TooltipOption2"] = "Shift-左擊: 移動"
L["TooltipOption3"] = "右擊: 打開設定選單"
L["TooltipOption4"] = "<Ctrl鍵左鍵單擊>將強制關閉"
L["ToText"] = "「到」文字"
L["UnknownColor"] = "未知顏色"
L["Width"] = "寬度"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/locales/ruRU.lua New file
0,0 → 1,36
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "ruRU")
if not L then return end
 
L["BackgroundColor"] = "Цвет фона"
L["BarColor"] = "Цвет заполнения"
L["BarOptions"] = "Опции полосы"
L["Border"] = "Края"
L["BorderColor"] = "Цвет края"
L["CompactMode"] = "Компактный режим"
L["ConfirmFlight"] = "Подтверждать полет"
L["ConfirmPopup"] = "Лететь в %s?"
L["DefaultsUpdated"] = "Данные по умолчанию обновлены."
L["DestParse"] = ", (.+)"
L["Duration"] = "Продолжительность полета: "
L["FillUp"] = "Заполнять"
L["FlightTimeAdded"] = "добавлено время полета:"
L["FlightTimeContribute"] = "%s раз полета доступны внести свой вклад."
L["FlightTimeUpdated"] = "Время полета обновлено:"
L["Font"] = "Шрифт"
L["FontColor"] = "Цвет шрифта"
L["Height"] = "Высота"
L["OutlineInfo"] = "Обрисовать информация"
L["OutlineTime"] = "Обрисуйте время"
L["PerCharOptions"] = "Символьные Конкретные опции"
L["ResetFlightTimes"] = "Сброс Время полета"
L["ResetOptions"] = "Сброс опций"
L["ShowChat"] = "Сообщения чата"
L["ShowSpark"] = "Показать Спарк"
L["TextOptions"] = "Опции текста"
L["Texture"] = "Текстура"
L["TooltipOption2"] = "<Shift левый-клик> для перемещения"
L["TooltipOption3"] = "<Правый-клик> для опций"
L["TooltipOption4"] = "<Ctrl левый-клик> чтобы заставить близко"
L["ToText"] = "\"в\" Текст"
L["UnknownColor"] = "Неизвестный цвет"
L["Width"] = "Ширина"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/locales/esES.lua New file
0,0 → 1,36
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "esES")
if not L then return end
 
L["BackgroundColor"] = "Color de Fondo"
L["BarColor"] = "Color de la Barra"
L["BarOptions"] = "Opciones de la Barra"
L["Border"] = "Borde"
L["BorderColor"] = "Color de Borde"
L["CompactMode"] = "Modo Compacto"
L["ConfirmFlight"] = "Confirmar Vuelo"
L["ConfirmPopup"] = "¿Coger un vuelo hacia %s?"
L["DefaultsUpdated"] = "Datos por defecto actualizados."
L["DestParse"] = ", (.+)"
L["Duration"] = "Duración: "
L["FillUp"] = "Rellenar"
L["FlightTimeAdded"] = "tiempo de vuelo añadido:"
L["FlightTimeContribute"] = "%s tiempos de vuelo disponibles para contribuir."
L["FlightTimeUpdated"] = "tiempo de vuelo actualizado:"
L["Font"] = "Fuente"
L["FontColor"] = "Color de Fuente"
L["Height"] = "Alto"
L["OutlineInfo"] = "Delinear la Fuente"
L["OutlineTime"] = "Delinear el Tiempo"
L["PerCharOptions"] = "Opciones especificas del personaje"
L["ResetFlightTimes"] = "Restablecer Tiempos de Vuelo"
L["ResetOptions"] = "Restablecer las Opciones"
L["ShowChat"] = "Mensajes de Chat"
L["ShowSpark"] = "Mostrar Chispa"
L["TextOptions"] = "Opciones de Texto"
L["Texture"] = "Textura"
L["TooltipOption2"] = "<Shift Clic-Izquierdo> para mover"
L["TooltipOption3"] = "<Clic-Derecho> para Opciones"
L["TooltipOption4"] = "<Ctrl Clic-Izquierdo> para forzar cerca"
L["ToText"] = "Texto \"Hacia\""
L["UnknownColor"] = "Color de Desconocido"
L["Width"] = "Ancho"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/locales/frFR.lua New file
0,0 → 1,36
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "frFR")
if not L then return end
 
L["BackgroundColor"] = "Couleur de Fond"
L["BarColor"] = "Couleur de Remplissage"
L["BarOptions"] = "Status Options"
L["Border"] = "Bordure"
L["BorderColor"] = "Couleur de la Bordure"
L["CompactMode"] = "Mode Compact"
L["ConfirmFlight"] = "Confirmer votre vol"
L["ConfirmPopup"] = "Prenez votre envol pour %s?"
L["DefaultsUpdated"] = "Données par défaut mises à jour."
L["DestParse"] = ", (.+)"
L["Duration"] = "Durée: "
L["FillUp"] = "Compléter"
L["FlightTimeAdded"] = "temps de vol ajouté:"
L["FlightTimeContribute"] = "%s temps de vol disponibles pour contribuer."
L["FlightTimeUpdated"] = "temps de vol mis à jour:"
L["Font"] = true
L["FontColor"] = "Couleur de Font"
L["Height"] = "Hauteur"
L["OutlineInfo"] = "Contour du Texte"
L["OutlineTime"] = "Contour le Time"
L["PerCharOptions"] = "Options Spécifiques aux Personnages"
L["ResetFlightTimes"] = "Réinitialiser les Temps de Vol"
L["ResetOptions"] = "Réinitialiser les Options"
L["ShowChat"] = "Messages de Chat"
L["ShowSpark"] = "Montrer l'étincelle"
L["TextOptions"] = "Options du Texte"
L["Texture"] = true
L["TooltipOption2"] = "<Shift Clic-Gauche> pour se déplacer"
L["TooltipOption3"] = "<Clic-Droit> pour les Options"
L["TooltipOption4"] = "<Ctrl Clic-Gauche> pour forcer la fermeture"
L["ToText"] = "\"Après\" Text"
L["UnknownColor"] = "Couleur Inconnu"
L["Width"] = "Largeur"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/locales/deDE.lua New file
0,0 → 1,36
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "deDE")
if not L then return end
 
L["BackgroundColor"] = "Hintergrundfarbe"
L["BarColor"] = "Farbe der Leiste"
L["BarOptions"] = "Leisteneinstellungen"
L["Border"] = "Rand"
L["BorderColor"] = "Randfarbe"
L["CompactMode"] = "Kompaktmodus"
L["ConfirmFlight"] = "Flug bestätigen"
L["ConfirmPopup"] = "Flug nehmen zu %s?"
L["DefaultsUpdated"] = "Standarddaten aktualisiert."
L["DestParse"] = ", (.+)"
L["Duration"] = "Flugdauer: "
L["FillUp"] = "Füllen"
L["FlightTimeAdded"] = "Flugzeit hinzugefügt:"
L["FlightTimeContribute"] = "Es stehen %s Flugzeiten zur Verfügung die zur Verbesserung des Addons beitragen."
L["FlightTimeUpdated"] = "Flugzeit aktualisiert:"
L["Font"] = "Schriftart"
L["FontColor"] = "Schriftfarbe"
L["Height"] = "Höhe"
L["OutlineInfo"] = "Kontur-Info"
L["OutlineTime"] = "Kontur-Zeitangabe"
L["PerCharOptions"] = "Charakterspezifische Einstellungen"
L["ResetFlightTimes"] = "Flugzeiten zurücksetzen"
L["ResetOptions"] = "Einstellungen zurücksetzen"
L["ShowChat"] = "Chat-Nachrichten"
L["ShowSpark"] = "Funken anzeigen"
L["TextOptions"] = "Texteinstellungen"
L["Texture"] = "Textur"
L["TooltipOption2"] = "<Umschalttaste+Linksklick> zum Bewegen"
L["TooltipOption3"] = "<Rechtsklick> für Einstellungen"
L["TooltipOption4"] = "<Strg+Linksklick> schließen erzwingen"
L["ToText"] = "\"Nach\" Text"
L["UnknownColor"] = "Unbekannt-Farbe"
L["Width"] = "Breite"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/locales/locales.xml New file
0,0 → 1,14
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="enUS.lua"/>
<Script file="deDE.lua"/>
<Script file="esES.lua"/>
<Script file="esMX.lua"/>
<Script file="frFR.lua"/>
<Script file="itIT.lua"/>
<Script file="koKR.lua"/>
<Script file="ptBR.lua"/>
<Script file="ruRU.lua"/>
<Script file="zhTW.lua"/>
<Script file="zhCN.lua"/>
</Ui>
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/locales/zhCN.lua New file
0,0 → 1,36
local L = LibStub("AceLocale-3.0"):NewLocale("InFlight", "zhCN")
if not L then return end
 
L["BackgroundColor"] = "背景颜色"
L["BarColor"] = "酒吧颜色"
L["BarOptions"] = "状态栏选项"
L["Border"] = "边框"
L["BorderColor"] = "边框颜色"
L["CompactMode"] = "紧凑模式"
L["ConfirmFlight"] = "确认航班"
L["ConfirmPopup"] = "乘坐航班到%s?"
L["DefaultsUpdated"] = "默认数据已更新。"
L["DestParse"] = ",(.+)"
L["Duration"] = "持续时间:"
L["FillUp"] = "填上"
L["FlightTimeAdded"] = "飞行时间补充:"
L["FlightTimeContribute"] = "%s 飞行时间可供贡献。"
L["FlightTimeUpdated"] = "飞行时间更新:"
L["Font"] = "字体"
L["FontColor"] = "字体颜色"
L["Height"] = "高度"
L["OutlineInfo"] = "勾勒出信息"
L["OutlineTime"] = "勾勒出时间"
L["PerCharOptions"] = "字符特定选项"
L["ResetFlightTimes"] = "重置飞行时间"
L["ResetOptions"] = "重置选项"
L["ShowChat"] = "채팅 메시지"
L["ShowSpark"] = "显示火花"
L["TextOptions"] = "文字选项"
L["Texture"] = "质地"
L["TooltipOption2"] = "<Shift左键单击>移动"
L["TooltipOption3"] = "<点击右键>的选项"
L["TooltipOption4"] = "<Ctrl键左键单击>将强制关闭"
L["ToText"] = "「到」文字"
L["UnknownColor"] = "未知的颜色"
L["Width"] = "宽度"
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/InFlight.lua New file
0,0 → 1,978
-- GLOBALS -> LOCAL
local _G = getfenv(0)
local InFlight, self = InFlight, InFlight
local GetNumRoutes, GetTaxiMapID, GetTime, NumTaxiNodes, TaxiGetNodeSlot, TaxiNodeGetType, TaxiNodeName, UnitOnTaxi
= GetNumRoutes, GetTaxiMapID, GetTime, NumTaxiNodes, TaxiGetNodeSlot, TaxiNodeGetType, TaxiNodeName, UnitOnTaxi
local abs, floor, format, gsub, ipairs, pairs, print, strjoin
= abs, floor, format, gsub, ipairs, pairs, print, strjoin
local gtt = GameTooltip
local oldTakeTaxiNode
InFlight.debug = false
 
-- LIBRARIES
local smed = LibStub("LibSharedMedia-3.0")
 
-- LOCAL VARIABLES
local debug = InFlight.debug
local Print, PrintD = InFlight.Print, InFlight.PrintD
local vars, db -- addon databases
local taxiSrc, taxiDst, endTime -- location data
local porttaken, takeoff, inworld, ontaxi -- flags
local ratio, endText = 0, "??" -- cache variables
local sb, spark, timeText, locText, bord -- frame elements
local totalTime, startTime, elapsed, throt = 0, 0, 0, 0 -- throttle vars
 
-- LOCALIZATION
local L = LibStub("AceLocale-3.0"):GetLocale("InFlight", not debug)
InFlight.L = L
 
-- LOCAL FUNCTIONS
local function FormatTime(secs) -- simple time format
if not secs then
return "??"
end
 
return format(TIMER_MINUTES_DISPLAY, secs / 60, secs % 60)
end
 
local function ShortenName(name) -- shorten name to lighten saved vars and display
return gsub(name, L["DestParse"], "")
end
 
local function SetPoints(f, lp, lrt, lrp, lx, ly, rp, rrt, rrp, rx, ry)
f:ClearAllPoints()
f:SetPoint(lp, lrt, lrp, lx, ly)
if rp then
f:SetPoint(rp, rrt, rrp, rx, ry)
end
end
 
local function SetToUnknown() -- setup bar for flights with unknown time
sb:SetMinMaxValues(0, 1)
sb:SetValue(1)
sb:SetStatusBarColor(db.unknowncolor.r, db.unknowncolor.g, db.unknowncolor.b, db.unknowncolor.a)
spark:Hide()
end
 
local function GetEstimatedTime(slot) -- estimates flight times based on hops
local numRoutes = GetNumRoutes(slot)
if numRoutes < 2 then
return
end
 
local taxiNodes = {[1] = taxiSrc, [numRoutes + 1] = ShortenName(TaxiNodeName(slot))}
for hop = 2, numRoutes, 1 do
taxiNodes[hop] = ShortenName(TaxiNodeName(TaxiGetNodeSlot(slot, hop, true)))
end
 
local etimes = { 0 }
local prevNode = {}
local nextNode = {}
local srcNode = 1
local dstNode = #taxiNodes - 1
PrintD("|cff208080New Route:|r", taxiSrc, "-->", taxiNodes[#taxiNodes], "-", #taxiNodes, "hops")
while srcNode and srcNode < #taxiNodes do
while dstNode and dstNode > srcNode do
PrintD("|cff208080Node:|r", taxiNodes[srcNode], "-->", taxiNodes[dstNode])
if vars[taxiNodes[srcNode]] then
if not etimes[dstNode] and vars[taxiNodes[srcNode]][taxiNodes[dstNode]] then
etimes[dstNode] = etimes[srcNode] + vars[taxiNodes[srcNode]][taxiNodes[dstNode]]
PrintD(taxiNodes[dstNode], "time:", FormatTime(etimes[srcNode]), "+", FormatTime(vars[taxiNodes[srcNode]][taxiNodes[dstNode]]), "=", FormatTime(etimes[dstNode]))
nextNode[srcNode] = dstNode - 1
prevNode[dstNode] = srcNode
srcNode = dstNode
dstNode = #taxiNodes
else
dstNode = dstNode - 1
end
else
srcNode = prevNode[srcNode]
dstNode = nextNode[srcNode]
end
end
 
if not etimes[#taxiNodes] then
PrintD("<<")
srcNode = prevNode[srcNode]
dstNode = nextNode[srcNode]
end
end
 
PrintD(".")
return etimes[#taxiNodes]
end
 
local function addDuration(time)
if time > 0 then
gtt:AddLine(L["Duration"]..FormatTime(time), 1, 1, 1)
else
gtt:AddLine(L["Duration"].."-:--", 0.8, 0.8, 0.8)
end
 
gtt:Show()
end
 
local function postTaxiNodeOnButtonEnter(button) -- adds duration info to taxi node tooltips
local id = button:GetID()
if TaxiNodeGetType(id) ~= "REACHABLE" then
return
end
 
addDuration(vars[taxiSrc] and vars[taxiSrc][ShortenName(TaxiNodeName(id))] or GetEstimatedTime(id) or 0)
end
 
----------------------------
function InFlight.Print(...) -- prefix chat messages
----------------------------
print("|cff0040ffIn|cff00aaffFlight|r:", ...)
end
Print = InFlight.Print
 
-----------------------------
function InFlight.PrintD(...) -- debug print
-----------------------------
if debug then
print("|cff00ff40In|cff00aaffFlight|r:", ...)
end
end
PrintD = InFlight.PrintD
 
----------------------------------
function InFlight:GetDestination()
----------------------------------
return taxiDst
end
 
---------------------------------
function InFlight:GetFlightTime()
---------------------------------
return endTime
end
 
----------------------------
function InFlight:LoadBulk() -- called from InFlight_Load
----------------------------
InFlightDB = InFlightDB or {}
 
-- Convert old saved variables
if not InFlightDB.version then
InFlightDB.perchar = nil
InFlightDB.dbinit = nil
InFlightDB.upload = nil
local tempDB = InFlightDB
InFlightDB = { profiles = { Default = tempDB }}
end
 
-- Check that this is the right version of the client and database to avoid corruption
local client = select(4, GetBuildInfo()) < 20000 and "classic"
if InFlightDB.version ~= client or InFlightDB.version ~= "classic" then
InFlightDB.global = nil
InFlightDB.version = "classic"
if client ~= "classic" then
return DisableAddOn("InFlight")
end
end
 
-- Update default data
local gameLocale = GetLocale()
gameLocale = gameLocale == "enGB" and "enUS" or gameLocale
if gameLocale == "enUS" and InFlightDB.dbinit ~= 1131 or debug then
InFlightDB.dbinit = 1131
InFlightDB.upload = nil
 
if InFlightDB.global then
local defaults = self.defaults.global
for faction, t in pairs(InFlightDB.global) do
for src, dt in pairs(t) do
if defaults[faction][src] then
for dst, dtime in pairs(dt) do
if dst ~= "name" and defaults[faction][src][dst] and abs(dtime - defaults[faction][src][dst]) < (debug and 2 or 5) then
InFlightDB.global[faction][src][dst] = defaults[faction][src][dst]
end
end
end
end
end
end
Print(L["DefaultsUpdated"])
end
 
-- Check every 2 weeks if there are new flight times that could be uploaded
if not InFlightDB.upload or InFlightDB.upload < time() then
if InFlightDB.global then
local defaults = self.defaults.global
for faction, t in pairs(InFlightDB.global) do
local found = 0
for src, dt in pairs(t) do
for dst, dtime in pairs(dt) do
if dst ~= "name" then
if not defaults[faction][src] or not defaults[faction][src][dst] then
found = found + 1
PrintD(faction, "|cff208020-|r", src, "-->", dst, "|cff208020found:|r", FormatTime(dtime))
elseif abs(dtime - defaults[faction][src][dst]) >= (debug and 2 or 5) then
found = found + 1
PrintD(faction, "|cff208020-|r", src, "-->", dst, "|cff208020updated:|r", FormatTime(defaults[faction][src][dst]), "-->", FormatTime(dtime))
end
end
end
end
 
if found > 0 then
Print(faction, format("|cff208020- "..L["FlightTimeContribute"].."|r", "|r"..found.."|cff208020"))
end
end
end
 
InFlightDB.upload = time() + 1209600 -- 2 weeks in seconds (60 * 60 * 24 * 14)
end
 
-- Create profile and flight time databases
local faction = UnitFactionGroup("player")
if not debug then
InFlight.defaults.global[faction == "Alliance" and "Horde" or "Alliance"] = nil
end
self.db = LibStub("AceDB-3.0"):New("InFlightDB", self.defaults, true)
db = self.db.profile
vars = self.db.global[faction]
 
oldTakeTaxiNode = TakeTaxiNode
TakeTaxiNode = function(slot)
if TaxiNodeGetType(slot) ~= "REACHABLE" then
return
end
 
taxiDst = ShortenName(TaxiNodeName(slot))
local t = vars[taxiSrc]
if t and t[taxiDst] and t[taxiDst] > 0 then -- saved variables lookup
endTime = t[taxiDst]
endText = FormatTime(endTime)
else
endTime = GetEstimatedTime(slot)
endText = (endTime and "~" or "")..FormatTime(endTime)
end
 
if db.confirmflight then -- confirm flight
StaticPopupDialogs.INFLIGHTCONFIRM = StaticPopupDialogs.INFLIGHTCONFIRM or {
button1 = OKAY, button2 = CANCEL,
OnAccept = function(this, data) InFlight:StartTimer(data) end,
timeout = 0, exclusive = 1, hideOnEscape = 1,
}
StaticPopupDialogs.INFLIGHTCONFIRM.text = format(L["ConfirmPopup"], "|cffffff00"..taxiDst..(endTime and " ("..endText..")" or "").."|r")
 
local dialog = StaticPopup_Show("INFLIGHTCONFIRM")
if dialog then
dialog.data = slot
end
else -- just take the flight
self:StartTimer(slot)
end
end
 
-- function hooks to detect if a user took a summon
hooksecurefunc("TaxiRequestEarlyLanding", function()
porttaken = true
PrintD("|cffff8080Taxi Early|cff208080, porttaken -|r", porttaken)
end)
 
hooksecurefunc("AcceptBattlefieldPort", function(index, accept)
porttaken = accept and true
PrintD("|cffff8080Battlefield port|cff208080, porttaken -|r", porttaken)
end)
 
hooksecurefunc("ConfirmSummon", function()
porttaken = true
PrintD("|cffff8080Summon|cff208080, porttaken -|r", porttaken)
end)
 
self:Hide()
self.LoadBulk = nil
end
 
---------------------------------------
function InFlight:InitSource(isTaxiMap) -- cache source location and hook tooltips
---------------------------------------
taxiSrc = nil
 
for i = 1, NumTaxiNodes(), 1 do
local tb = _G["TaxiButton"..i]
if tb and not tb.inflighted then
tb:HookScript("OnEnter", postTaxiNodeOnButtonEnter)
tb.inflighted = true
end
if TaxiNodeGetType(i) == "CURRENT" then
taxiSrc = ShortenName(TaxiNodeName(i))
end
end
end
 
----------------------------------
function InFlight:StartTimer(slot) -- lift off
----------------------------------
Dismount()
 
-- create the timer bar
if not sb then
self:CreateBar()
end
 
-- start the timers and setup statusbar
if endTime then
sb:SetMinMaxValues(0, endTime)
sb:SetValue(db.fill and 0 or endTime)
else
SetToUnknown()
end
 
InFlight:UpdateLook()
timeText:SetFormattedText("%s / %s", FormatTime(0), endText)
sb:Show()
self:Show()
 
porttaken = nil
elapsed, totalTime, startTime = 0, 0, GetTime()
takeoff, inworld = true, true
throt = min(0.2, (endTime or 50) / (db.width or 1)) -- increases updates for short flights
 
self:RegisterEvent("PLAYER_CONTROL_GAINED")
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("PLAYER_LEAVING_WORLD")
 
if slot then
oldTakeTaxiNode(slot)
end
end
 
-------------------------------------------
function InFlight:StartMiscFlight(src, dst) -- called from InFlight_Load for special flights
-------------------------------------------
taxiSrc = L[src]
taxiDst = L[dst]
endTime = vars[src] and vars[src][dst]
endText = FormatTime(endTime)
self:StartTimer()
end
 
do -- timer bar
local bdrop = { edgeSize = 16, insets = {}, }
local bdi = bdrop.insets
-----------------------------
function InFlight:CreateBar()
-----------------------------
sb = CreateFrame("StatusBar", "InFlightBar", UIParent)
sb:Hide()
sb:SetPoint(db.p, UIParent, db.rp, db.x, db.y)
sb:SetMovable(true)
sb:EnableMouse(true)
sb:SetClampedToScreen(true)
sb:SetScript("OnMouseUp", function(this, a1)
if a1 == "RightButton" then
InFlight:ShowOptions()
elseif a1 == "LeftButton" and IsControlKeyDown() then
ontaxi, porttaken = nil, true
end
end)
sb:RegisterForDrag("LeftButton")
sb:SetScript("OnDragStart", function(this)
if IsShiftKeyDown() then
this:StartMoving()
end
end)
sb:SetScript("OnDragStop", function(this)
this:StopMovingOrSizing()
local a,b,c,d,e = this:GetPoint()
db.p, db.rp, db.x, db.y = a, c, floor(d + 0.5), floor(e + 0.5)
end)
sb:SetScript("OnEnter", function(this)
gtt:SetOwner(this, "ANCHOR_RIGHT")
gtt:SetText("InFlight", 1, 1, 1)
gtt:AddLine(L["TooltipOption2"], 0, 1, 0)
gtt:AddLine(L["TooltipOption3"], 0, 1, 0)
gtt:AddLine(L["TooltipOption4"], 0, 1, 0)
gtt:Show()
end)
sb:SetScript("OnLeave", function() gtt:Hide() end)
 
timeText = sb:CreateFontString(nil, "OVERLAY")
locText = sb:CreateFontString(nil, "OVERLAY")
 
spark = sb:CreateTexture(nil, "OVERLAY")
spark:Hide()
spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark")
spark:SetWidth(16)
spark:SetBlendMode("ADD")
 
bord = CreateFrame("Frame", nil, sb) -- border/background
SetPoints(bord, "TOPLEFT", sb, "TOPLEFT", -5, 5, "BOTTOMRIGHT", sb, "BOTTOMRIGHT", 5, -5)
bord:SetFrameStrata("LOW")
 
local function onupdate(this, a1)
elapsed = elapsed + a1
if elapsed < throt then
return
end
 
totalTime = GetTime() - startTime
elapsed = 0
 
if takeoff then -- check if actually in flight after take off (doesn't happen immediately)
if UnitOnTaxi("player") then
takeoff, ontaxi = nil, true
elapsed, totalTime, startTime = throt - 0.01, 0, GetTime()
elseif totalTime > 5 then
sb:Hide()
this:Hide()
end
 
return
end
 
if not UnitOnTaxi("player") then -- event bug fix
ontaxi = nil
end
 
if not ontaxi then -- flight ended
PrintD("|cff208080porttaken -|r", porttaken)
if not porttaken and taxiSrc then
vars[taxiSrc] = vars[taxiSrc] or {}
local oldTime = vars[taxiSrc][taxiDst]
local newTime = floor(totalTime + 0.5)
local msg = strjoin(" ", taxiSrc, db.totext, taxiDst, "|cff208080")
if not oldTime then
msg = msg..L["FlightTimeAdded"].."|r "..FormatTime(newTime)
elseif abs(newTime - oldTime) >= 5 then
msg = msg..L["FlightTimeUpdated"].."|r "..FormatTime(oldTime).." |cff208080"..db.totext.."|r "..FormatTime(newTime)
else
if debug then
PrintD(msg..L["FlightTimeUpdated"].."|r "..FormatTime(oldTime).." |cff208080"..db.totext.."|r "..FormatTime(newTime))
end
 
if not debug or abs(newTime - oldTime) < 2 then
newTime = oldTime
end
 
msg = nil
end
 
vars[taxiSrc][taxiDst] = newTime
if msg and db.chatlog then
Print(msg)
end
end
 
endTime = nil
endText = FormatTime(endTime)
sb:Hide()
this:Hide()
 
return
end
 
if endTime then -- update statusbar if destination time is known
if totalTime - 2 > endTime then -- in case the flight is longer than expected
SetToUnknown()
endTime = nil
endText = FormatTime(endTime)
else
local value = db.fill and totalTime or (endTime - totalTime)
if value > endTime then
value = endTime
elseif value < 0 then
value = 0
end
 
sb:SetValue(value)
spark:SetPoint("CENTER", sb, "LEFT", value * ratio, 0)
timeText:SetFormattedText("%s / %s", FormatTime(value), endText)
end
else -- destination time is unknown, so show that it's timing
timeText:SetFormattedText("%s / %s", FormatTime(totalTime), endText)
end
end
 
function self:PLAYER_LEAVING_WORLD()
PrintD('PLAYER_LEAVING_WORLD')
inworld = nil
end
 
function self:PLAYER_ENTERING_WORLD()
PrintD('PLAYER_ENTERING_WORLD')
inworld = true
end
 
function self:PLAYER_CONTROL_GAINED()
PrintD('PLAYER_CONTROL_GAINED')
if not inworld then
return
end
 
if self:IsShown() then
ontaxi = nil
onupdate(self, 3)
end
 
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
self:UnregisterEvent("PLAYER_LEAVING_WORLD")
self:UnregisterEvent("PLAYER_CONTROL_GAINED")
end
 
self:SetScript("OnUpdate", onupdate)
self.CreateBar = nil
end
 
------------------------------
function InFlight:UpdateLook()
------------------------------
if not sb then
return
end
 
sb:SetWidth(db.width)
sb:SetHeight(db.height)
 
local texture = smed:Fetch("statusbar", db.texture)
local inset = (db.border=="Textured" and 2) or 4
bdrop.bgFile = texture
bdrop.edgeFile = smed:Fetch("border", db.border)
bdi.left, bdi.right, bdi.top, bdi.bottom = inset, inset, inset, inset
bord:SetBackdrop(bdrop)
bord:SetBackdropColor(db.backcolor.r, db.backcolor.g, db.backcolor.b, db.backcolor.a)
bord:SetBackdropBorderColor(db.bordercolor.r, db.bordercolor.g, db.bordercolor.b, db.bordercolor.a)
sb:SetStatusBarTexture(texture)
if sb:GetStatusBarTexture() then
sb:GetStatusBarTexture():SetHorizTile(false)
sb:GetStatusBarTexture():SetVertTile(false)
end
 
spark:SetHeight(db.height * 2.4)
if endTime then -- in case we're in flight
ratio = db.width / endTime
sb:SetStatusBarColor(db.barcolor.r, db.barcolor.g, db.barcolor.b, db.barcolor.a)
if db.spark then
spark:Show()
else
spark:Hide()
end
else
SetToUnknown()
end
 
locText:SetFont(smed:Fetch("font", db.font), db.fontsize, db.outline and "OUTLINE" or nil)
locText:SetShadowColor(0, 0, 0, db.fontcolor.a)
locText:SetShadowOffset(1, -1)
locText:SetTextColor(db.fontcolor.r, db.fontcolor.g, db.fontcolor.b, db.fontcolor.a)
 
timeText:SetFont(smed:Fetch("font", db.font), db.fontsize, db.outlinetime and "OUTLINE" or nil)
timeText:SetShadowColor(0, 0, 0, db.fontcolor.a)
timeText:SetShadowOffset(1, -1)
timeText:SetTextColor(db.fontcolor.r, db.fontcolor.g, db.fontcolor.b, db.fontcolor.a)
 
if db.inline then
timeText:SetJustifyH("RIGHT")
timeText:SetJustifyV("CENTER")
SetPoints(timeText, "RIGHT", sb, "RIGHT", -4, 0)
locText:SetJustifyH("LEFT")
locText:SetJustifyV("CENTER")
SetPoints(locText, "LEFT", sb, "LEFT", 4, 0, "RIGHT", timeText, "LEFT", -2, 0)
locText:SetText(taxiDst or "??")
else
timeText:SetJustifyH("CENTER")
timeText:SetJustifyV("CENTER")
SetPoints(timeText, "CENTER", sb, "CENTER", 0, 0)
locText:SetJustifyH("CENTER")
locText:SetJustifyV("BOTTOM")
SetPoints(locText, "TOPLEFT", sb, "TOPLEFT", -24, db.fontsize*2.5, "BOTTOMRIGHT", sb, "TOPRIGHT", 24, (db.border=="None" and 1) or 3)
locText:SetFormattedText("%s %s %s", taxiSrc or "??", db.totext, taxiDst or "??")
end
end
end
 
---------------------------------
function InFlight:SetLayout(this) -- setups the options in the default interface options
---------------------------------
local t1 = this:CreateFontString(nil, "ARTWORK")
t1:SetFontObject(GameFontNormalLarge)
t1:SetJustifyH("LEFT")
t1:SetJustifyV("TOP")
t1:SetPoint("TOPLEFT", 16, -16)
t1:SetText("|cff0040ffIn|cff00aaffFlight|r")
this.tl = t1
 
local t2 = this:CreateFontString(nil, "ARTWORK")
t2:SetFontObject(GameFontHighlight)
t2:SetJustifyH("LEFT")
t2:SetJustifyV("TOP")
SetPoints(t2, "TOPLEFT", t1, "BOTTOMLEFT", 0, -8, "RIGHT", this, "RIGHT", -32, 0)
t2:SetNonSpaceWrap(true)
local function GetInfo(field)
return GetAddOnMetadata("InFlight", field) or "N/A"
end
 
t2:SetFormattedText("|cff00aaffAuthor:|r %s\n|cff00aaffVersion:|r %s\n\n%s|r", GetInfo("Author"), GetInfo("Version"), GetInfo("Notes"))
 
local b = CreateFrame("Button", nil, this, "UIPanelButtonTemplate")
b:SetText(_G.GAMEOPTIONS_MENU)
b:SetWidth(max(120, b:GetTextWidth() + 20))
b:SetScript("OnClick", InFlight.ShowOptions)
b:SetPoint("TOPLEFT", t2, "BOTTOMLEFT", -2, -8)
 
this:SetScript("OnShow", nil)
 
self.SetLayout = nil
end
 
-- options table
smed:Register("border", "Textured", "\\Interface\\None") -- dummy border
local InFlightDD, offsetvalue, offsetcount, lastb
local info = { }
-------------------------------
function InFlight.ShowOptions()
-------------------------------
if not InFlightDD then
InFlightDD = CreateFrame("Frame", "InFlightDD", InFlight)
InFlightDD.displayMode = "MENU"
 
hooksecurefunc("ToggleDropDownMenu", function(...) lastb = select(8, ...) end)
local function Exec(b, k, value)
if k == "totext" then
StaticPopupDialogs["InFlightToText"] = StaticPopupDialogs["InFlightToText"] or {
text = "Enter your 'to' text.",
button1 = ACCEPT, button2 = CANCEL,
hasEditBox = 1, maxLetters = 12,
OnAccept = function(self)
db.totext = strtrim(self.editBox:GetText())
InFlight:UpdateLook()
end,
 
OnShow = function(self)
self.editBox:SetText(db.totext)
self.editBox:SetFocus()
end,
 
OnHide = function(self)
self.editBox:SetText("")
end,
 
EditBoxOnEnterPressed = function(self)
local parent = self:GetParent()
db.totext = strtrim(parent.editBox:GetText())
parent:Hide()
InFlight:UpdateLook()
end,
 
EditBoxOnEscapePressed = function(self)
self:GetParent():Hide()
end,
 
timeout = 0, exclusive = 1, whileDead = 1, hideOnEscape = 1,
}
StaticPopup_Show("InFlightToText")
elseif (k == "less" or k == "more") and lastb then
local off = (k == "less" and -8) or 8
if offsetvalue == value then
offsetcount = offsetcount + off
else
offsetvalue, offsetcount = value, off
end
 
local tb = _G[gsub(lastb:GetName(), "ExpandArrow", "")]
CloseDropDownMenus(b:GetParent():GetID())
ToggleDropDownMenu(b:GetParent():GetID(), tb.value, nil, nil, nil, nil, tb.menuList, tb)
elseif k == "resetoptions" then
self.db:ResetProfile()
if self.db:GetCurrentProfile() ~= "Default" then
db.perchar = true
end
elseif k == "resettimes" then
InFlightDB.dbinit = nil
InFlightDB.global = {}
ReloadUI()
end
end
 
local function Set(b, k)
if not k then
return
end
 
db[k] = not db[k]
if k == "perchar" then
local charKey = UnitName("player").." - "..GetRealmName()
if db[k] then
db[k] = false
self.db:SetProfile(charKey)
self.db:CopyProfile("Default")
db = self.db.profile
db[k] = true
else
self.db:SetProfile("Default")
db = self.db.profile
self.db:DeleteProfile(charKey)
end
end
 
InFlight:UpdateLook()
end
 
local function SetSelect(b, a1)
db[a1] = tonumber(b.value) or b.value
local level, num = strmatch(b:GetName(), "DropDownList(%d+)Button(%d+)")
level, num = tonumber(level) or 0, tonumber(num) or 0
for i = 1, UIDROPDOWNMENU_MAXBUTTONS, 1 do
local b = _G["DropDownList"..level.."Button"..i.."Check"]
if b then
b[i == num and "Show" or "Hide"](b)
end
end
 
InFlight:UpdateLook()
end
 
local function SetColor(a1)
local dbc = db[UIDROPDOWNMENU_MENU_VALUE]
if not dbc then
return
end
 
if a1 then
local pv = ColorPickerFrame.previousValues
dbc.r, dbc.g, dbc.b, dbc.a = pv.r, pv.g, pv.b, 1 - pv.opacity
else
dbc.r, dbc.g, dbc.b = ColorPickerFrame:GetColorRGB()
dbc.a = 1 - OpacitySliderFrame:GetValue()
end
 
InFlight:UpdateLook()
end
 
local function AddButton(lvl, text, keepshown)
info.text = text
info.keepShownOnClick = keepshown
UIDropDownMenu_AddButton(info, lvl)
wipe(info)
end
 
local function AddToggle(lvl, text, value)
info.arg1 = value
info.func = Set
info.checked = db[value]
info.isNotRadio = true
AddButton(lvl, text, true)
end
 
local function AddExecute(lvl, text, arg1, arg2)
info.arg1 = arg1
info.arg2 = arg2
info.func = Exec
info.notCheckable = 1
AddButton(lvl, text, true)
end
 
local function AddColor(lvl, text, value)
local dbc = db[value]
if not dbc then
return
end
 
info.hasColorSwatch = true
info.padding = 5
info.hasOpacity = 1
info.r, info.g, info.b, info.opacity = dbc.r, dbc.g, dbc.b, 1 - dbc.a
info.swatchFunc, info.opacityFunc, info.cancelFunc = SetColor, SetColor, SetColor
info.value = value
info.notCheckable = 1
info.func = UIDropDownMenuButton_OpenColorPicker
AddButton(lvl, text)
end
 
local function AddList(lvl, text, value)
info.value = value
info.hasArrow = true
info.notCheckable = 1
AddButton(lvl, text, true)
end
 
local function AddSelect(lvl, text, arg1, value)
info.arg1 = arg1
info.func = SetSelect
info.value = value
if tonumber(value) and tonumber(db[arg1] or "blah") then
if floor(100 * tonumber(value)) == floor(100 * tonumber(db[arg1])) then
info.checked = true
end
else
info.checked = (db[arg1] == value)
end
 
AddButton(lvl, text, true)
end
 
local function AddFakeSlider(lvl, value, minv, maxv, step, tbl)
local cvalue = 0
local dbv = db[value]
if type(dbv) == "string" and tbl then
for i, v in ipairs(tbl) do
if dbv == v then
cvalue = i
break
end
end
else
cvalue = dbv or ((maxv - minv) / 2)
end
 
local adj = (offsetvalue == value and offsetcount) or 0
local starti = max(minv, cvalue - (7 - adj) * step)
local endi = min(maxv, cvalue + (8 + adj) * step)
if starti == minv then
endi = min(maxv, starti + 16 * step)
elseif endi == maxv then
starti = max(minv, endi - 16 * step)
end
 
if starti > minv then
AddExecute(lvl, "--", "less", value)
end
 
if tbl then
for i = starti, endi, step do
AddSelect(lvl, tbl[i], value, tbl[i])
end
else
local fstring = (step >= 1 and "%d") or (step >= 0.1 and "%.1f") or "%.2f"
for i = starti, endi, step do
AddSelect(lvl, format(fstring, i), value, i)
end
end
 
if endi < maxv then
AddExecute(lvl, "++", "more", value)
end
end
 
InFlightDD.initialize = function(self, lvl)
if lvl == 1 then
info.isTitle = true
info.notCheckable = 1
AddButton(lvl, "|cff0040ffIn|cff00aaffFlight|r")
AddList(lvl, L["BarOptions"], "frame")
AddList(lvl, L["TextOptions"], "text")
AddList(lvl, _G.OTHER, "other")
elseif lvl == 2 then
local sub = UIDROPDOWNMENU_MENU_VALUE
if sub == "frame" then
AddToggle(lvl, L["FillUp"], "fill")
AddToggle(lvl, L["ShowSpark"], "spark")
AddList(lvl, L["Height"], "height")
AddList(lvl, L["Width"], "width")
AddList(lvl, L["Texture"], "texture")
AddList(lvl, L["Border"], "border")
AddColor(lvl, L["BackgroundColor"], "backcolor")
AddColor(lvl, L["BarColor"], "barcolor")
AddColor(lvl, L["UnknownColor"], "unknowncolor")
AddColor(lvl, L["BorderColor"], "bordercolor")
elseif sub == "text" then
AddToggle(lvl, L["CompactMode"], "inline")
AddExecute(lvl, L["ToText"], "totext")
AddList(lvl, L["Font"], "font")
AddList(lvl, _G.FONT_SIZE, "fontsize")
AddColor(lvl, L["FontColor"], "fontcolor")
AddToggle(lvl, L["OutlineInfo"], "outline")
AddToggle(lvl, L["OutlineTime"], "outlinetime")
elseif sub == "other" then
AddToggle(lvl, L["ShowChat"], "chatlog")
AddToggle(lvl, L["ConfirmFlight"], "confirmflight")
AddToggle(lvl, L["PerCharOptions"], "perchar")
AddExecute(lvl, L["ResetOptions"], "resetoptions")
AddExecute(lvl, L["ResetFlightTimes"], "resettimes")
end
elseif lvl == 3 then
local sub = UIDROPDOWNMENU_MENU_VALUE
if sub == "texture" or sub == "border" or sub == "font" then
local t = smed:List(sub == "texture" and "statusbar" or sub)
AddFakeSlider(lvl, sub, 1, #t, 1, t)
elseif sub == "width" then
AddFakeSlider(lvl, sub, 40, 500, 5)
elseif sub == "height" then
AddFakeSlider(lvl, sub, 4, 100, 1)
elseif sub == "fontsize" then
AddFakeSlider(lvl, sub, 4, 30, 1)
end
end
end
end
 
ToggleDropDownMenu(1, nil, InFlightDD, "cursor")
end
 
if debug then
 
function inflightupdate(updateExistingTimes)
local updates = {}
local ownData = false
if #updates == 0 then
updates[1] = InFlightDB.global
ownData = true
end
local InFlightVars = self.defaults.global
for i, flightPaths in ipairs(updates) do
 
-- Set updateExistingTimes to true to update and add new times (for updates based
-- on the current default db)
-- Set updateExistingTimes to false to only add new unknown times (use for updates
-- not based on current default db to avoid re-adding old/incorrect times)
updateExistingTimes = updateExistingTimes ~= nil and updateExistingTimes or ownData
 
for faction, t in pairs(flightPaths) do
if faction == "Horde" or faction == "Alliance" then
local found = false
local updated, added = 0, 0
for src, dt in pairs(t) do
if not InFlightVars[faction][src] then
InFlightVars[faction][src] = {}
PrintD(faction, "|cff208080New source:|r", src)
end
 
for dst, utime in pairs(dt) do
if dst == "name" then
if InFlightVars[faction][src][dst] ~= utime then
InFlightVars[faction][src][dst] = utime
PrintD(faction, "|cff208080New source name:|r", utime, src)
end
elseif src ~= dst and type(utime) == "number" then
local vtime = InFlightVars[faction][src][dst]
if utime >= 5 and (not vtime or ownData or abs(utime - vtime) >= 5) then
if vtime then
if updateExistingTimes and InFlightVars[faction][src][dst] ~= utime then
InFlightVars[faction][src][dst] = utime
found = true
updated = updated + 1
PrintD(faction, "|cff208020Update time:|r", InFlightVars[faction][src].name, src, "|cff208020-->|r", dst, "|cff208020- old:|r", vtime, "|cff208020new:|r", utime)
end
else
InFlightVars[faction][src][dst] = utime
found = true
added = added + 1
PrintD(faction, "|cff208080New time:|r", src, "|cff208020-->|r", dst, "|cff208020- new:|r", utime)
end
end
end
end
end
 
if found then
PrintD(faction, "|cff208020-|r", updated, "|cff208020updated times.|r")
PrintD(faction, "|cff208020-|r", added, "|cff208080new times.|r")
else
PrintD(faction, "|cff208020-|r No time updates found.")
end
else
InFlightVars[faction] = nil
Print("Unknown faction removed:", faction)
end
end
 
InFlightDB.defaults = InFlightVars
end
end
 
end -- debug
tags/1.13.002_Classic/InFlight/Defaults.lua New file
0,0 → 1,34
InFlight.defaults = {
profile = {
p = "BOTTOM",
rp = "TOP",
x = 0,
y = -170,
fill = true,
spark = true,
texture = "Blizzard",
width = 230,
height = 14,
border = "Blizzard Dialog",
barcolor = { r = 0.5, g = 0.5, b = 0.8, a = 1.0, },
unknowncolor = { r = 0.2, g = 0.2, b = 0.4, a = 1.0, },
backcolor = { r = 0.1, g = 0.1, b = 0.1, a = 0.6, },
bordercolor = { r = 0.6, g = 0.6, b = 0.6, a = 0.8, },
inline = false,
totext = "-->",
font = "2002 Bold",
fontsize = 12,
fontcolor = { r = 1.0, g = 1.0, b = 1.0, a = 1.0, },
outline = false,
outlinetime = false,
chatlog = true,
confirmflight = false,
perchar = false,
},
global = {
["Horde"] = {
},
["Alliance"] = {
},
},
}
tags/1.13.002_Classic/InFlight/InFlight.toc New file
0,0 → 1,27
## Interface: 11302
## Title: InFlight
## Notes: Status bar timer for your flight paths
## Notes-deDE: Statusleisten-Zeitanzeige für Ihre Flugrouten
## Notes-esES: Temporizador barra de estado para sus rutas de vuelo
## Notes-esMX: Temporizador barra de estado para sus rutas de vuelo
## Notes-frFR: Minuterie de barre d'état pour vos trajectoires de vol
## Notes-itIT: Timer della barra di stato per le tue traiettorie di volo
## Notes-koKR: 비행 경로에 대한 상태 표시 줄 타이머
## Notes-ptBR: Temporizador da barra de status para suas rotas de voo
## Notes-ruRU: Таймер строки состояния для ваших маршрутов полета
## Notes-zhCN: 您的航班路径的状态栏计时器
## Notes-zhTW: 您的航班路徑的狀態欄計時器
## Author: TotalPackage
## Version: 1.13.002
 
## SavedVariables: InFlightDB
## Dependencies: InFlight_Load
## OptionalDeps: Ace3, LibSharedMedia-3.0
 
## LoadOnDemand: 1
 
embeds.xml
 
locales\locales.xml
Defaults.lua
InFlight.lua
tags/1.13.002_Classic/InFlight/libs/LibStub/LibStub.lua New file
0,0 → 1,30
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info
-- LibStub is hereby placed in the Public Domain Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
local LibStub = _G[LIBSTUB_MAJOR]
 
if not LibStub or LibStub.minor < LIBSTUB_MINOR then
LibStub = LibStub or {libs = {}, minors = {} }
_G[LIBSTUB_MAJOR] = LibStub
LibStub.minor = LIBSTUB_MINOR
 
function LibStub:NewLibrary(major, minor)
assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.")
 
local oldminor = self.minors[major]
if oldminor and oldminor >= minor then return nil end
self.minors[major], self.libs[major] = minor, self.libs[major] or {}
return self.libs[major], oldminor
end
 
function LibStub:GetLibrary(major, silent)
if not self.libs[major] and not silent then
error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
end
return self.libs[major], self.minors[major]
end
 
function LibStub:IterateLibraries() return pairs(self.libs) end
setmetatable(LibStub, { __call = LibStub.GetLibrary })
end
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/libs/AceLocale-3.0/AceLocale-3.0.xml New file
0,0 → 1,4
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="AceLocale-3.0.lua"/>
</Ui>
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/libs/AceLocale-3.0/AceLocale-3.0.lua New file
0,0 → 1,137
--- **AceLocale-3.0** manages localization in addons, allowing for multiple locale to be registered with fallback to the base locale for untranslated strings.
-- @class file
-- @name AceLocale-3.0
-- @release $Id: AceLocale-3.0.lua 1035 2011-07-09 03:20:13Z kaelten $
local MAJOR,MINOR = "AceLocale-3.0", 6
 
local AceLocale, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
 
if not AceLocale then return end -- no upgrade needed
 
-- Lua APIs
local assert, tostring, error = assert, tostring, error
local getmetatable, setmetatable, rawset, rawget = getmetatable, setmetatable, rawset, rawget
 
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: GAME_LOCALE, geterrorhandler
 
local gameLocale = GetLocale()
if gameLocale == "enGB" then
gameLocale = "enUS"
end
 
AceLocale.apps = AceLocale.apps or {} -- array of ["AppName"]=localetableref
AceLocale.appnames = AceLocale.appnames or {} -- array of [localetableref]="AppName"
 
-- This metatable is used on all tables returned from GetLocale
local readmeta = {
__index = function(self, key) -- requesting totally unknown entries: fire off a nonbreaking error and return key
rawset(self, key, key) -- only need to see the warning once, really
geterrorhandler()(MAJOR..": "..tostring(AceLocale.appnames[self])..": Missing entry for '"..tostring(key).."'")
return key
end
}
 
-- This metatable is used on all tables returned from GetLocale if the silent flag is true, it does not issue a warning on unknown keys
local readmetasilent = {
__index = function(self, key) -- requesting totally unknown entries: return key
rawset(self, key, key) -- only need to invoke this function once
return key
end
}
 
-- Remember the locale table being registered right now (it gets set by :NewLocale())
-- NOTE: Do never try to register 2 locale tables at once and mix their definition.
local registering
 
-- local assert false function
local assertfalse = function() assert(false) end
 
-- This metatable proxy is used when registering nondefault locales
local writeproxy = setmetatable({}, {
__newindex = function(self, key, value)
rawset(registering, key, value == true and key or value) -- assigning values: replace 'true' with key string
end,
__index = assertfalse
})
 
-- This metatable proxy is used when registering the default locale.
-- It refuses to overwrite existing values
-- Reason 1: Allows loading locales in any order
-- Reason 2: If 2 modules have the same string, but only the first one to be
-- loaded has a translation for the current locale, the translation
-- doesn't get overwritten.
--
local writedefaultproxy = setmetatable({}, {
__newindex = function(self, key, value)
if not rawget(registering, key) then
rawset(registering, key, value == true and key or value)
end
end,
__index = assertfalse
})
 
--- Register a new locale (or extend an existing one) for the specified application.
-- :NewLocale will return a table you can fill your locale into, or nil if the locale isn't needed for the players
-- game locale.
-- @paramsig application, locale[, isDefault[, silent]]
-- @param application Unique name of addon / module
-- @param locale Name of the locale to register, e.g. "enUS", "deDE", etc.
-- @param isDefault If this is the default locale being registered (your addon is written in this language, generally enUS)
-- @param silent If true, the locale will not issue warnings for missing keys. Must be set on the first locale registered. If set to "raw", nils will be returned for unknown keys (no metatable used).
-- @usage
-- -- enUS.lua
-- local L = LibStub("AceLocale-3.0"):NewLocale("TestLocale", "enUS", true)
-- L["string1"] = true
--
-- -- deDE.lua
-- local L = LibStub("AceLocale-3.0"):NewLocale("TestLocale", "deDE")
-- if not L then return end
-- L["string1"] = "Zeichenkette1"
-- @return Locale Table to add localizations to, or nil if the current locale is not required.
function AceLocale:NewLocale(application, locale, isDefault, silent)
 
-- GAME_LOCALE allows translators to test translations of addons without having that wow client installed
local gameLocale = GAME_LOCALE or gameLocale
 
local app = AceLocale.apps[application]
 
if silent and app and getmetatable(app) ~= readmetasilent then
geterrorhandler()("Usage: NewLocale(application, locale[, isDefault[, silent]]): 'silent' must be specified for the first locale registered")
end
 
if not app then
if silent=="raw" then
app = {}
else
app = setmetatable({}, silent and readmetasilent or readmeta)
end
AceLocale.apps[application] = app
AceLocale.appnames[app] = application
end
 
if locale ~= gameLocale and not isDefault then
return -- nop, we don't need these translations
end
 
registering = app -- remember globally for writeproxy and writedefaultproxy
 
if isDefault then
return writedefaultproxy
end
 
return writeproxy
end
 
--- Returns localizations for the current locale (or default locale if translations are missing).
-- Errors if nothing is registered (spank developer, not just a missing translation)
-- @param application Unique name of addon / module
-- @param silent If true, the locale is optional, silently return nil if it's not found (defaults to false, optional)
-- @return The locale table for the current language.
function AceLocale:GetLocale(application, silent)
if not silent and not AceLocale.apps[application] then
error("Usage: GetLocale(application[, silent]): 'application' - No locales registered for '"..tostring(application).."'", 2)
end
return AceLocale.apps[application]
end
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/libs/CallbackHandler-1.0/CallbackHandler-1.0.xml New file
0,0 → 1,4
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="CallbackHandler-1.0.lua"/>
</Ui>
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/libs/CallbackHandler-1.0/CallbackHandler-1.0.lua New file
0,0 → 1,212
--[[ $Id: CallbackHandler-1.0.lua 1186 2018-07-21 14:19:18Z nevcairiel $ ]]
local MAJOR, MINOR = "CallbackHandler-1.0", 7
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)
 
if not CallbackHandler then return end -- No upgrade needed
 
local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end}
 
-- Lua APIs
local tconcat = table.concat
local assert, error, loadstring = assert, error, loadstring
local setmetatable, rawset, rawget = setmetatable, rawset, rawget
local next, select, pairs, type, tostring = next, select, pairs, type, tostring
 
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: geterrorhandler
 
local xpcall = xpcall
 
local function errorhandler(err)
return geterrorhandler()(err)
end
 
local function Dispatch(handlers, ...)
local index, method = next(handlers)
if not method then return end
repeat
xpcall(method, errorhandler, ...)
index, method = next(handlers, index)
until not method
end
 
--------------------------------------------------------------------------
-- CallbackHandler:New
--
-- target - target object to embed public APIs in
-- RegisterName - name of the callback registration API, default "RegisterCallback"
-- UnregisterName - name of the callback unregistration API, default "UnregisterCallback"
-- UnregisterAllName - name of the API to unregister all callbacks, default "UnregisterAllCallbacks". false == don't publish this API.
 
function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAllName)
 
RegisterName = RegisterName or "RegisterCallback"
UnregisterName = UnregisterName or "UnregisterCallback"
if UnregisterAllName==nil then -- false is used to indicate "don't want this method"
UnregisterAllName = "UnregisterAllCallbacks"
end
 
-- we declare all objects and exported APIs inside this closure to quickly gain access
-- to e.g. function names, the "target" parameter, etc
 
 
-- Create the registry object
local events = setmetatable({}, meta)
local registry = { recurse=0, events=events }
 
-- registry:Fire() - fires the given event/message into the registry
function registry:Fire(eventname, ...)
if not rawget(events, eventname) or not next(events[eventname]) then return end
local oldrecurse = registry.recurse
registry.recurse = oldrecurse + 1
 
Dispatch(events[eventname], eventname, ...)
 
registry.recurse = oldrecurse
 
if registry.insertQueue and oldrecurse==0 then
-- Something in one of our callbacks wanted to register more callbacks; they got queued
for eventname,callbacks in pairs(registry.insertQueue) do
local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten.
for self,func in pairs(callbacks) do
events[eventname][self] = func
-- fire OnUsed callback?
if first and registry.OnUsed then
registry.OnUsed(registry, target, eventname)
first = nil
end
end
end
registry.insertQueue = nil
end
end
 
-- Registration of a callback, handles:
-- self["method"], leads to self["method"](self, ...)
-- self with function ref, leads to functionref(...)
-- "addonId" (instead of self) with function ref, leads to functionref(...)
-- all with an optional arg, which, if present, gets passed as first argument (after self if present)
target[RegisterName] = function(self, eventname, method, ... --[[actually just a single arg]])
if type(eventname) ~= "string" then
error("Usage: "..RegisterName.."(eventname, method[, arg]): 'eventname' - string expected.", 2)
end
 
method = method or eventname
 
local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten.
 
if type(method) ~= "string" and type(method) ~= "function" then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - string or function expected.", 2)
end
 
local regfunc
 
if type(method) == "string" then
-- self["method"] calling style
if type(self) ~= "table" then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): self was not a table?", 2)
elseif self==target then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): do not use Library:"..RegisterName.."(), use your own 'self'", 2)
elseif type(self[method]) ~= "function" then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - method '"..tostring(method).."' not found on self.", 2)
end
 
if select("#",...)>=1 then -- this is not the same as testing for arg==nil!
local arg=select(1,...)
regfunc = function(...) self[method](self,arg,...) end
else
regfunc = function(...) self[method](self,...) end
end
else
-- function ref with self=object or self="addonId" or self=thread
if type(self)~="table" and type(self)~="string" and type(self)~="thread" then
error("Usage: "..RegisterName.."(self or \"addonId\", eventname, method): 'self or addonId': table or string or thread expected.", 2)
end
 
if select("#",...)>=1 then -- this is not the same as testing for arg==nil!
local arg=select(1,...)
regfunc = function(...) method(arg,...) end
else
regfunc = method
end
end
 
 
if events[eventname][self] or registry.recurse<1 then
-- if registry.recurse<1 then
-- we're overwriting an existing entry, or not currently recursing. just set it.
events[eventname][self] = regfunc
-- fire OnUsed callback?
if registry.OnUsed and first then
registry.OnUsed(registry, target, eventname)
end
else
-- we're currently processing a callback in this registry, so delay the registration of this new entry!
-- yes, we're a bit wasteful on garbage, but this is a fringe case, so we're picking low implementation overhead over garbage efficiency
registry.insertQueue = registry.insertQueue or setmetatable({},meta)
registry.insertQueue[eventname][self] = regfunc
end
end
 
-- Unregister a callback
target[UnregisterName] = function(self, eventname)
if not self or self==target then
error("Usage: "..UnregisterName.."(eventname): bad 'self'", 2)
end
if type(eventname) ~= "string" then
error("Usage: "..UnregisterName.."(eventname): 'eventname' - string expected.", 2)
end
if rawget(events, eventname) and events[eventname][self] then
events[eventname][self] = nil
-- Fire OnUnused callback?
if registry.OnUnused and not next(events[eventname]) then
registry.OnUnused(registry, target, eventname)
end
end
if registry.insertQueue and rawget(registry.insertQueue, eventname) and registry.insertQueue[eventname][self] then
registry.insertQueue[eventname][self] = nil
end
end
 
-- OPTIONAL: Unregister all callbacks for given selfs/addonIds
if UnregisterAllName then
target[UnregisterAllName] = function(...)
if select("#",...)<1 then
error("Usage: "..UnregisterAllName.."([whatFor]): missing 'self' or \"addonId\" to unregister events for.", 2)
end
if select("#",...)==1 and ...==target then
error("Usage: "..UnregisterAllName.."([whatFor]): supply a meaningful 'self' or \"addonId\"", 2)
end
 
 
for i=1,select("#",...) do
local self = select(i,...)
if registry.insertQueue then
for eventname, callbacks in pairs(registry.insertQueue) do
if callbacks[self] then
callbacks[self] = nil
end
end
end
for eventname, callbacks in pairs(events) do
if callbacks[self] then
callbacks[self] = nil
-- Fire OnUnused callback?
if registry.OnUnused and not next(callbacks) then
registry.OnUnused(registry, target, eventname)
end
end
end
end
end
end
 
return registry
end
 
 
-- CallbackHandler purposefully does NOT do explicit embedding. Nor does it
-- try to upgrade old implicit embeds since the system is selfcontained and
-- relies on closures to work.
 
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/libs/LibSharedMedia-3.0/LibSharedMedia-3.0.lua New file
0,0 → 1,298
--[[
Name: LibSharedMedia-3.0
Revision: $Revision: 112 $
Author: Elkano (elkano@gmx.de)
Inspired By: SurfaceLib by Haste/Otravi (troeks@gmail.com)
Website: http://www.wowace.com/projects/libsharedmedia-3-0/
Description: Shared handling of media data (fonts, sounds, textures, ...) between addons.
Dependencies: LibStub, CallbackHandler-1.0
License: LGPL v2.1
]]
 
local MAJOR, MINOR = "LibSharedMedia-3.0", 8020001 -- 8.2.0 v1 / increase manually on changes
local lib = LibStub:NewLibrary(MAJOR, MINOR)
 
if not lib then return end
 
local _G = getfenv(0)
 
local pairs = _G.pairs
local type = _G.type
 
local band = _G.bit.band
local table_sort = _G.table.sort
 
local locale = GetLocale()
local locale_is_western
local LOCALE_MASK = 0
lib.LOCALE_BIT_koKR = 1
lib.LOCALE_BIT_ruRU = 2
lib.LOCALE_BIT_zhCN = 4
lib.LOCALE_BIT_zhTW = 8
lib.LOCALE_BIT_western = 128
 
local CallbackHandler = LibStub:GetLibrary("CallbackHandler-1.0")
 
lib.callbacks = lib.callbacks or CallbackHandler:New(lib)
 
lib.DefaultMedia = lib.DefaultMedia or {}
lib.MediaList = lib.MediaList or {}
lib.MediaTable = lib.MediaTable or {}
lib.MediaType = lib.MediaType or {}
lib.OverrideMedia = lib.OverrideMedia or {}
 
local defaultMedia = lib.DefaultMedia
local mediaList = lib.MediaList
local mediaTable = lib.MediaTable
local overrideMedia = lib.OverrideMedia
 
 
-- create mediatype constants
lib.MediaType.BACKGROUND = "background" -- background textures
lib.MediaType.BORDER = "border" -- border textures
lib.MediaType.FONT = "font" -- fonts
lib.MediaType.STATUSBAR = "statusbar" -- statusbar textures
lib.MediaType.SOUND = "sound" -- sound files
 
-- populate lib with default Blizzard data
-- BACKGROUND
if not lib.MediaTable.background then lib.MediaTable.background = {} end
lib.MediaTable.background["None"] = [[]]
lib.MediaTable.background["Blizzard Collections Background"] = [[Interface\Collections\CollectionsBackgroundTile]]
lib.MediaTable.background["Blizzard Dialog Background"] = [[Interface\DialogFrame\UI-DialogBox-Background]]
lib.MediaTable.background["Blizzard Dialog Background Dark"] = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]]
lib.MediaTable.background["Blizzard Dialog Background Gold"] = [[Interface\DialogFrame\UI-DialogBox-Gold-Background]]
lib.MediaTable.background["Blizzard Garrison Background"] = [[Interface\Garrison\GarrisonUIBackground]]
lib.MediaTable.background["Blizzard Garrison Background 2"] = [[Interface\Garrison\GarrisonUIBackground2]]
lib.MediaTable.background["Blizzard Garrison Background 3"] = [[Interface\Garrison\GarrisonMissionUIInfoBoxBackgroundTile]]
lib.MediaTable.background["Blizzard Low Health"] = [[Interface\FullScreenTextures\LowHealth]]
lib.MediaTable.background["Blizzard Marble"] = [[Interface\FrameGeneral\UI-Background-Marble]]
lib.MediaTable.background["Blizzard Out of Control"] = [[Interface\FullScreenTextures\OutOfControl]]
lib.MediaTable.background["Blizzard Parchment"] = [[Interface\AchievementFrame\UI-Achievement-Parchment-Horizontal]]
lib.MediaTable.background["Blizzard Parchment 2"] = [[Interface\AchievementFrame\UI-GuildAchievement-Parchment-Horizontal]]
lib.MediaTable.background["Blizzard Rock"] = [[Interface\FrameGeneral\UI-Background-Rock]]
lib.MediaTable.background["Blizzard Tabard Background"] = [[Interface\TabardFrame\TabardFrameBackground]]
lib.MediaTable.background["Blizzard Tooltip"] = [[Interface\Tooltips\UI-Tooltip-Background]]
lib.MediaTable.background["Solid"] = [[Interface\Buttons\WHITE8X8]]
lib.DefaultMedia.background = "None"
 
-- BORDER
if not lib.MediaTable.border then lib.MediaTable.border = {} end
lib.MediaTable.border["None"] = [[]]
lib.MediaTable.border["Blizzard Achievement Wood"] = [[Interface\AchievementFrame\UI-Achievement-WoodBorder]]
lib.MediaTable.border["Blizzard Chat Bubble"] = [[Interface\Tooltips\ChatBubble-Backdrop]]
lib.MediaTable.border["Blizzard Dialog"] = [[Interface\DialogFrame\UI-DialogBox-Border]]
lib.MediaTable.border["Blizzard Dialog Gold"] = [[Interface\DialogFrame\UI-DialogBox-Gold-Border]]
lib.MediaTable.border["Blizzard Party"] = [[Interface\CHARACTERFRAME\UI-Party-Border]]
lib.MediaTable.border["Blizzard Tooltip"] = [[Interface\Tooltips\UI-Tooltip-Border]]
lib.DefaultMedia.border = "None"
 
-- FONT
if not lib.MediaTable.font then lib.MediaTable.font = {} end
local SML_MT_font = lib.MediaTable.font
--[[
All font files are currently in all clients, the following table depicts which font supports which charset as of 5.0.4
Fonts were checked using langcover.pl from DejaVu fonts (http://sourceforge.net/projects/dejavu/) and FontForge (http://fontforge.org/)
latin means check for: de, en, es, fr, it, pt
 
file name latin koKR ruRU zhCN zhTW
2002.ttf 2002 X X X - -
2002B.ttf 2002 Bold X X X - -
ARHei.ttf AR CrystalzcuheiGBK Demibold X - X X X
ARIALN.TTF Arial Narrow X - X - -
ARKai_C.ttf AR ZhongkaiGBK Medium (Combat) X - X X X
ARKai_T.ttf AR ZhongkaiGBK Medium X - X X X
bHEI00M.ttf AR Heiti2 Medium B5 - - - - X
bHEI01B.ttf AR Heiti2 Bold B5 - - - - X
bKAI00M.ttf AR Kaiti Medium B5 - - - - X
bLEI00D.ttf AR Leisu Demi B5 - - - - X
FRIZQT__.TTF Friz Quadrata TT X - - - -
FRIZQT___CYR.TTF FrizQuadrataCTT x - X - -
K_Damage.TTF YDIWingsM - X X - -
K_Pagetext.TTF MoK X X X - -
MORPHEUS.TTF Morpheus X - - - -
MORPHEUS_CYR.TTF Morpheus X - X - -
NIM_____.ttf Nimrod MT X - X - -
SKURRI.TTF Skurri X - - - -
SKURRI_CYR.TTF Skurri X - X - -
 
WARNING: Although FRIZQT___CYR is available on western clients, it doesn't support special European characters e.g. é, ï, ö
Due to this, we cannot use it as a replacement for FRIZQT__.TTF
]]
 
if locale == "koKR" then
LOCALE_MASK = lib.LOCALE_BIT_koKR
--
SML_MT_font["굵은 글꼴"] = [[Fonts\2002B.TTF]]
SML_MT_font["기본 글꼴"] = [[Fonts\2002.TTF]]
SML_MT_font["데미지 글꼴"] = [[Fonts\K_Damage.TTF]]
SML_MT_font["퀘스트 글꼴"] = [[Fonts\K_Pagetext.TTF]]
--
lib.DefaultMedia["font"] = "기본 글꼴" -- someone from koKR please adjust if needed
--
elseif locale == "zhCN" then
LOCALE_MASK = lib.LOCALE_BIT_zhCN
--
SML_MT_font["伤害数字"] = [[Fonts\ARKai_C.ttf]]
SML_MT_font["默认"] = [[Fonts\ARKai_T.ttf]]
SML_MT_font["聊天"] = [[Fonts\ARHei.ttf]]
--
lib.DefaultMedia["font"] = "默认" -- someone from zhCN please adjust if needed
--
elseif locale == "zhTW" then
LOCALE_MASK = lib.LOCALE_BIT_zhTW
--
SML_MT_font["提示訊息"] = [[Fonts\bHEI00M.ttf]]
SML_MT_font["聊天"] = [[Fonts\bHEI01B.ttf]]
SML_MT_font["傷害數字"] = [[Fonts\bKAI00M.ttf]]
SML_MT_font["預設"] = [[Fonts\bLEI00D.ttf]]
--
lib.DefaultMedia["font"] = "預設" -- someone from zhTW please adjust if needed
 
elseif locale == "ruRU" then
LOCALE_MASK = lib.LOCALE_BIT_ruRU
--
SML_MT_font["2002"] = [[Fonts\2002.TTF]]
SML_MT_font["2002 Bold"] = [[Fonts\2002B.TTF]]
SML_MT_font["AR CrystalzcuheiGBK Demibold"] = [[Fonts\ARHei.TTF]]
SML_MT_font["AR ZhongkaiGBK Medium (Combat)"] = [[Fonts\ARKai_C.TTF]]
SML_MT_font["AR ZhongkaiGBK Medium"] = [[Fonts\ARKai_T.TTF]]
SML_MT_font["Arial Narrow"] = [[Fonts\ARIALN.TTF]]
SML_MT_font["Friz Quadrata TT"] = [[Fonts\FRIZQT___CYR.TTF]]
SML_MT_font["MoK"] = [[Fonts\K_Pagetext.TTF]]
SML_MT_font["Morpheus"] = [[Fonts\MORPHEUS_CYR.TTF]]
SML_MT_font["Nimrod MT"] = [[Fonts\NIM_____.ttf]]
SML_MT_font["Skurri"] = [[Fonts\SKURRI_CYR.TTF]]
--
lib.DefaultMedia.font = "Friz Quadrata TT"
--
else
LOCALE_MASK = lib.LOCALE_BIT_western
locale_is_western = true
--
SML_MT_font["2002"] = [[Fonts\2002.TTF]]
SML_MT_font["2002 Bold"] = [[Fonts\2002B.TTF]]
SML_MT_font["AR CrystalzcuheiGBK Demibold"] = [[Fonts\ARHei.TTF]]
SML_MT_font["AR ZhongkaiGBK Medium (Combat)"] = [[Fonts\ARKai_C.TTF]]
SML_MT_font["AR ZhongkaiGBK Medium"] = [[Fonts\ARKai_T.TTF]]
SML_MT_font["Arial Narrow"] = [[Fonts\ARIALN.TTF]]
SML_MT_font["Friz Quadrata TT"] = [[Fonts\FRIZQT__.TTF]]
SML_MT_font["MoK"] = [[Fonts\K_Pagetext.TTF]]
SML_MT_font["Morpheus"] = [[Fonts\MORPHEUS_CYR.TTF]]
SML_MT_font["Nimrod MT"] = [[Fonts\NIM_____.ttf]]
SML_MT_font["Skurri"] = [[Fonts\SKURRI_CYR.TTF]]
--
lib.DefaultMedia.font = "Friz Quadrata TT"
--
end
 
-- STATUSBAR
if not lib.MediaTable.statusbar then lib.MediaTable.statusbar = {} end
lib.MediaTable.statusbar["Blizzard"] = [[Interface\TargetingFrame\UI-StatusBar]]
lib.MediaTable.statusbar["Blizzard Character Skills Bar"] = [[Interface\PaperDollInfoFrame\UI-Character-Skills-Bar]]
lib.MediaTable.statusbar["Blizzard Raid Bar"] = [[Interface\RaidFrame\Raid-Bar-Hp-Fill]]
lib.MediaTable.statusbar["Solid"] = [[Interface\Buttons\WHITE8X8]]
lib.DefaultMedia.statusbar = "Blizzard"
 
-- SOUND
if not lib.MediaTable.sound then lib.MediaTable.sound = {} end
lib.MediaTable.sound["None"] = 1 -- Relies on the fact that PlaySound[File] doesn't error on existing invalid input files.
lib.DefaultMedia.sound = "None"
 
local function rebuildMediaList(mediatype)
local mtable = mediaTable[mediatype]
if not mtable then return end
if not mediaList[mediatype] then mediaList[mediatype] = {} end
local mlist = mediaList[mediatype]
-- list can only get larger, so simply overwrite it
local i = 0
for k in pairs(mtable) do
i = i + 1
mlist[i] = k
end
table_sort(mlist)
end
 
function lib:Register(mediatype, key, data, langmask)
if type(mediatype) ~= "string" then
error(MAJOR..":Register(mediatype, key, data, langmask) - mediatype must be string, got "..type(mediatype))
end
if type(key) ~= "string" then
error(MAJOR..":Register(mediatype, key, data, langmask) - key must be string, got "..type(key))
end
mediatype = mediatype:lower()
if mediatype == lib.MediaType.FONT and ((langmask and band(langmask, LOCALE_MASK) == 0) or not (langmask or locale_is_western)) then
-- ignore fonts that aren't flagged as supporting local glyphs on non-western clients
return false
end
if type(data) == "string" and (mediatype == lib.MediaType.BACKGROUND or mediatype == lib.MediaType.BORDER or mediatype == lib.MediaType.STATUSBAR or mediatype == lib.MediaType.SOUND) then
local path = data:lower()
if not path:find("^interface") then
-- files accessed via path only allowed from interface folder
return false
end
if mediatype == lib.MediaType.SOUND and not (path:find(".ogg", nil, true) or not path:find(".mp3", nil, true)) then
-- Only ogg and mp3 are valid sounds.
return false
end
end
if not mediaTable[mediatype] then mediaTable[mediatype] = {} end
local mtable = mediaTable[mediatype]
if mtable[key] then return false end
 
mtable[key] = data
rebuildMediaList(mediatype)
self.callbacks:Fire("LibSharedMedia_Registered", mediatype, key)
return true
end
 
function lib:Fetch(mediatype, key, noDefault)
local mtt = mediaTable[mediatype]
local overridekey = overrideMedia[mediatype]
local result = mtt and ((overridekey and mtt[overridekey] or mtt[key]) or (not noDefault and defaultMedia[mediatype] and mtt[defaultMedia[mediatype]])) or nil
return result ~= "" and result or nil
end
 
function lib:IsValid(mediatype, key)
return mediaTable[mediatype] and (not key or mediaTable[mediatype][key]) and true or false
end
 
function lib:HashTable(mediatype)
return mediaTable[mediatype]
end
 
function lib:List(mediatype)
if not mediaTable[mediatype] then
return nil
end
if not mediaList[mediatype] then
rebuildMediaList(mediatype)
end
return mediaList[mediatype]
end
 
function lib:GetGlobal(mediatype)
return overrideMedia[mediatype]
end
 
function lib:SetGlobal(mediatype, key)
if not mediaTable[mediatype] then
return false
end
overrideMedia[mediatype] = (key and mediaTable[mediatype][key]) and key or nil
self.callbacks:Fire("LibSharedMedia_SetGlobal", mediatype, overrideMedia[mediatype])
return true
end
 
function lib:GetDefault(mediatype)
return defaultMedia[mediatype]
end
 
function lib:SetDefault(mediatype, key)
if mediaTable[mediatype] and mediaTable[mediatype][key] and not defaultMedia[mediatype] then
defaultMedia[mediatype] = key
return true
else
return false
end
end
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/libs/LibSharedMedia-3.0/lib.xml New file
0,0 → 1,4
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="LibSharedMedia-3.0.lua" />
</Ui>
tags/1.13.002_Classic/InFlight/libs/AceDB-3.0/AceDB-3.0.xml New file
0,0 → 1,4
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="AceDB-3.0.lua"/>
</Ui>
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/libs/AceDB-3.0/AceDB-3.0.lua New file
0,0 → 1,744
--- **AceDB-3.0** manages the SavedVariables of your addon.
-- It offers profile management, smart defaults and namespaces for modules.\\
-- Data can be saved in different data-types, depending on its intended usage.
-- The most common data-type is the `profile` type, which allows the user to choose
-- the active profile, and manage the profiles of all of his characters.\\
-- The following data types are available:
-- * **char** Character-specific data. Every character has its own database.
-- * **realm** Realm-specific data. All of the players characters on the same realm share this database.
-- * **class** Class-specific data. All of the players characters of the same class share this database.
-- * **race** Race-specific data. All of the players characters of the same race share this database.
-- * **faction** Faction-specific data. All of the players characters of the same faction share this database.
-- * **factionrealm** Faction and realm specific data. All of the players characters on the same realm and of the same faction share this database.
-- * **locale** Locale specific data, based on the locale of the players game client.
-- * **global** Global Data. All characters on the same account share this database.
-- * **profile** Profile-specific data. All characters using the same profile share this database. The user can control which profile should be used.
--
-- Creating a new Database using the `:New` function will return a new DBObject. A database will inherit all functions
-- of the DBObjectLib listed here. \\
-- If you create a new namespaced child-database (`:RegisterNamespace`), you'll get a DBObject as well, but note
-- that the child-databases cannot individually change their profile, and are linked to their parents profile - and because of that,
-- the profile related APIs are not available. Only `:RegisterDefaults` and `:ResetProfile` are available on child-databases.
--
-- For more details on how to use AceDB-3.0, see the [[AceDB-3.0 Tutorial]].
--
-- You may also be interested in [[libdualspec-1-0|LibDualSpec-1.0]] to do profile switching automatically when switching specs.
--
-- @usage
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("DBExample")
--
-- -- declare defaults to be used in the DB
-- local defaults = {
-- profile = {
-- setting = true,
-- }
-- }
--
-- function MyAddon:OnInitialize()
-- -- Assuming the .toc says ## SavedVariables: MyAddonDB
-- self.db = LibStub("AceDB-3.0"):New("MyAddonDB", defaults, true)
-- end
-- @class file
-- @name AceDB-3.0.lua
-- @release $Id: AceDB-3.0.lua 1217 2019-07-11 03:06:18Z funkydude $
local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 27
local AceDB = LibStub:NewLibrary(ACEDB_MAJOR, ACEDB_MINOR)
 
if not AceDB then return end -- No upgrade needed
 
-- Lua APIs
local type, pairs, next, error = type, pairs, next, error
local setmetatable, rawset, rawget = setmetatable, rawset, rawget
 
-- WoW APIs
local _G = _G
 
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: LibStub
 
AceDB.db_registry = AceDB.db_registry or {}
AceDB.frame = AceDB.frame or CreateFrame("Frame")
 
local CallbackHandler
local CallbackDummy = { Fire = function() end }
 
local DBObjectLib = {}
 
--[[-------------------------------------------------------------------------
AceDB Utility Functions
---------------------------------------------------------------------------]]
 
-- Simple shallow copy for copying defaults
local function copyTable(src, dest)
if type(dest) ~= "table" then dest = {} end
if type(src) == "table" then
for k,v in pairs(src) do
if type(v) == "table" then
-- try to index the key first so that the metatable creates the defaults, if set, and use that table
v = copyTable(v, dest[k])
end
dest[k] = v
end
end
return dest
end
 
-- Called to add defaults to a section of the database
--
-- When a ["*"] default section is indexed with a new key, a table is returned
-- and set in the host table. These tables must be cleaned up by removeDefaults
-- in order to ensure we don't write empty default tables.
local function copyDefaults(dest, src)
-- this happens if some value in the SV overwrites our default value with a non-table
--if type(dest) ~= "table" then return end
for k, v in pairs(src) do
if k == "*" or k == "**" then
if type(v) == "table" then
-- This is a metatable used for table defaults
local mt = {
-- This handles the lookup and creation of new subtables
__index = function(t,k)
if k == nil then return nil end
local tbl = {}
copyDefaults(tbl, v)
rawset(t, k, tbl)
return tbl
end,
}
setmetatable(dest, mt)
-- handle already existing tables in the SV
for dk, dv in pairs(dest) do
if not rawget(src, dk) and type(dv) == "table" then
copyDefaults(dv, v)
end
end
else
-- Values are not tables, so this is just a simple return
local mt = {__index = function(t,k) return k~=nil and v or nil end}
setmetatable(dest, mt)
end
elseif type(v) == "table" then
if not rawget(dest, k) then rawset(dest, k, {}) end
if type(dest[k]) == "table" then
copyDefaults(dest[k], v)
if src['**'] then
copyDefaults(dest[k], src['**'])
end
end
else
if rawget(dest, k) == nil then
rawset(dest, k, v)
end
end
end
end
 
-- Called to remove all defaults in the default table from the database
local function removeDefaults(db, defaults, blocker)
-- remove all metatables from the db, so we don't accidentally create new sub-tables through them
setmetatable(db, nil)
-- loop through the defaults and remove their content
for k,v in pairs(defaults) do
if k == "*" or k == "**" then
if type(v) == "table" then
-- Loop through all the actual k,v pairs and remove
for key, value in pairs(db) do
if type(value) == "table" then
-- if the key was not explicitly specified in the defaults table, just strip everything from * and ** tables
if defaults[key] == nil and (not blocker or blocker[key] == nil) then
removeDefaults(value, v)
-- if the table is empty afterwards, remove it
if next(value) == nil then
db[key] = nil
end
-- if it was specified, only strip ** content, but block values which were set in the key table
elseif k == "**" then
removeDefaults(value, v, defaults[key])
end
end
end
elseif k == "*" then
-- check for non-table default
for key, value in pairs(db) do
if defaults[key] == nil and v == value then
db[key] = nil
end
end
end
elseif type(v) == "table" and type(db[k]) == "table" then
-- if a blocker was set, dive into it, to allow multi-level defaults
removeDefaults(db[k], v, blocker and blocker[k])
if next(db[k]) == nil then
db[k] = nil
end
else
-- check if the current value matches the default, and that its not blocked by another defaults table
if db[k] == defaults[k] and (not blocker or blocker[k] == nil) then
db[k] = nil
end
end
end
end
 
-- This is called when a table section is first accessed, to set up the defaults
local function initSection(db, section, svstore, key, defaults)
local sv = rawget(db, "sv")
 
local tableCreated
if not sv[svstore] then sv[svstore] = {} end
if not sv[svstore][key] then
sv[svstore][key] = {}
tableCreated = true
end
 
local tbl = sv[svstore][key]
 
if defaults then
copyDefaults(tbl, defaults)
end
rawset(db, section, tbl)
 
return tableCreated, tbl
end
 
-- Metatable to handle the dynamic creation of sections and copying of sections.
local dbmt = {
__index = function(t, section)
local keys = rawget(t, "keys")
local key = keys[section]
if key then
local defaultTbl = rawget(t, "defaults")
local defaults = defaultTbl and defaultTbl[section]
 
if section == "profile" then
local new = initSection(t, section, "profiles", key, defaults)
if new then
-- Callback: OnNewProfile, database, newProfileKey
t.callbacks:Fire("OnNewProfile", t, key)
end
elseif section == "profiles" then
local sv = rawget(t, "sv")
if not sv.profiles then sv.profiles = {} end
rawset(t, "profiles", sv.profiles)
elseif section == "global" then
local sv = rawget(t, "sv")
if not sv.global then sv.global = {} end
if defaults then
copyDefaults(sv.global, defaults)
end
rawset(t, section, sv.global)
else
initSection(t, section, section, key, defaults)
end
end
 
return rawget(t, section)
end
}
 
local function validateDefaults(defaults, keyTbl, offset)
if not defaults then return end
offset = offset or 0
for k in pairs(defaults) do
if not keyTbl[k] or k == "profiles" then
error(("Usage: AceDBObject:RegisterDefaults(defaults): '%s' is not a valid datatype."):format(k), 3 + offset)
end
end
end
 
local preserve_keys = {
["callbacks"] = true,
["RegisterCallback"] = true,
["UnregisterCallback"] = true,
["UnregisterAllCallbacks"] = true,
["children"] = true,
}
 
local realmKey = GetRealmName()
local charKey = UnitName("player") .. " - " .. realmKey
local _, classKey = UnitClass("player")
local _, raceKey = UnitRace("player")
local factionKey = UnitFactionGroup("player")
local factionrealmKey = factionKey .. " - " .. realmKey
local localeKey = GetLocale():lower()
 
local regionTable = { "US", "KR", "EU", "TW", "CN" }
local regionKey = regionTable[GetCurrentRegion()]
local factionrealmregionKey = factionrealmKey .. " - " .. regionKey
 
-- Actual database initialization function
local function initdb(sv, defaults, defaultProfile, olddb, parent)
-- Generate the database keys for each section
 
-- map "true" to our "Default" profile
if defaultProfile == true then defaultProfile = "Default" end
 
local profileKey
if not parent then
-- Make a container for profile keys
if not sv.profileKeys then sv.profileKeys = {} end
 
-- Try to get the profile selected from the char db
profileKey = sv.profileKeys[charKey] or defaultProfile or charKey
 
-- save the selected profile for later
sv.profileKeys[charKey] = profileKey
else
-- Use the profile of the parents DB
profileKey = parent.keys.profile or defaultProfile or charKey
 
-- clear the profileKeys in the DB, namespaces don't need to store them
sv.profileKeys = nil
end
 
-- This table contains keys that enable the dynamic creation
-- of each section of the table. The 'global' and 'profiles'
-- have a key of true, since they are handled in a special case
local keyTbl= {
["char"] = charKey,
["realm"] = realmKey,
["class"] = classKey,
["race"] = raceKey,
["faction"] = factionKey,
["factionrealm"] = factionrealmKey,
["factionrealmregion"] = factionrealmregionKey,
["profile"] = profileKey,
["locale"] = localeKey,
["global"] = true,
["profiles"] = true,
}
 
validateDefaults(defaults, keyTbl, 1)
 
-- This allows us to use this function to reset an entire database
-- Clear out the old database
if olddb then
for k,v in pairs(olddb) do if not preserve_keys[k] then olddb[k] = nil end end
end
 
-- Give this database the metatable so it initializes dynamically
local db = setmetatable(olddb or {}, dbmt)
 
if not rawget(db, "callbacks") then
-- try to load CallbackHandler-1.0 if it loaded after our library
if not CallbackHandler then CallbackHandler = LibStub:GetLibrary("CallbackHandler-1.0", true) end
db.callbacks = CallbackHandler and CallbackHandler:New(db) or CallbackDummy
end
 
-- Copy methods locally into the database object, to avoid hitting
-- the metatable when calling methods
 
if not parent then
for name, func in pairs(DBObjectLib) do
db[name] = func
end
else
-- hack this one in
db.RegisterDefaults = DBObjectLib.RegisterDefaults
db.ResetProfile = DBObjectLib.ResetProfile
end
 
-- Set some properties in the database object
db.profiles = sv.profiles
db.keys = keyTbl
db.sv = sv
--db.sv_name = name
db.defaults = defaults
db.parent = parent
 
-- store the DB in the registry
AceDB.db_registry[db] = true
 
return db
end
 
-- handle PLAYER_LOGOUT
-- strip all defaults from all databases
-- and cleans up empty sections
local function logoutHandler(frame, event)
if event == "PLAYER_LOGOUT" then
for db in pairs(AceDB.db_registry) do
db.callbacks:Fire("OnDatabaseShutdown", db)
db:RegisterDefaults(nil)
 
-- cleanup sections that are empty without defaults
local sv = rawget(db, "sv")
for section in pairs(db.keys) do
if rawget(sv, section) then
-- global is special, all other sections have sub-entrys
-- also don't delete empty profiles on main dbs, only on namespaces
if section ~= "global" and (section ~= "profiles" or rawget(db, "parent")) then
for key in pairs(sv[section]) do
if not next(sv[section][key]) then
sv[section][key] = nil
end
end
end
if not next(sv[section]) then
sv[section] = nil
end
end
end
end
end
end
 
AceDB.frame:RegisterEvent("PLAYER_LOGOUT")
AceDB.frame:SetScript("OnEvent", logoutHandler)
 
 
--[[-------------------------------------------------------------------------
AceDB Object Method Definitions
---------------------------------------------------------------------------]]
 
--- Sets the defaults table for the given database object by clearing any
-- that are currently set, and then setting the new defaults.
-- @param defaults A table of defaults for this database
function DBObjectLib:RegisterDefaults(defaults)
if defaults and type(defaults) ~= "table" then
error(("Usage: AceDBObject:RegisterDefaults(defaults): 'defaults' - table or nil expected, got %q."):format(type(defaults)), 2)
end
 
validateDefaults(defaults, self.keys)
 
-- Remove any currently set defaults
if self.defaults then
for section,key in pairs(self.keys) do
if self.defaults[section] and rawget(self, section) then
removeDefaults(self[section], self.defaults[section])
end
end
end
 
-- Set the DBObject.defaults table
self.defaults = defaults
 
-- Copy in any defaults, only touching those sections already created
if defaults then
for section,key in pairs(self.keys) do
if defaults[section] and rawget(self, section) then
copyDefaults(self[section], defaults[section])
end
end
end
end
 
--- Changes the profile of the database and all of it's namespaces to the
-- supplied named profile
-- @param name The name of the profile to set as the current profile
function DBObjectLib:SetProfile(name)
if type(name) ~= "string" then
error(("Usage: AceDBObject:SetProfile(name): 'name' - string expected, got %q."):format(type(name)), 2)
end
 
-- changing to the same profile, dont do anything
if name == self.keys.profile then return end
 
local oldProfile = self.profile
local defaults = self.defaults and self.defaults.profile
 
-- Callback: OnProfileShutdown, database
self.callbacks:Fire("OnProfileShutdown", self)
 
if oldProfile and defaults then
-- Remove the defaults from the old profile
removeDefaults(oldProfile, defaults)
end
 
self.profile = nil
self.keys["profile"] = name
 
-- if the storage exists, save the new profile
-- this won't exist on namespaces.
if self.sv.profileKeys then
self.sv.profileKeys[charKey] = name
end
 
-- populate to child namespaces
if self.children then
for _, db in pairs(self.children) do
DBObjectLib.SetProfile(db, name)
end
end
 
-- Callback: OnProfileChanged, database, newProfileKey
self.callbacks:Fire("OnProfileChanged", self, name)
end
 
--- Returns a table with the names of the existing profiles in the database.
-- You can optionally supply a table to re-use for this purpose.
-- @param tbl A table to store the profile names in (optional)
function DBObjectLib:GetProfiles(tbl)
if tbl and type(tbl) ~= "table" then
error(("Usage: AceDBObject:GetProfiles(tbl): 'tbl' - table or nil expected, got %q."):format(type(tbl)), 2)
end
 
-- Clear the container table
if tbl then
for k,v in pairs(tbl) do tbl[k] = nil end
else
tbl = {}
end
 
local curProfile = self.keys.profile
 
local i = 0
for profileKey in pairs(self.profiles) do
i = i + 1
tbl[i] = profileKey
if curProfile and profileKey == curProfile then curProfile = nil end
end
 
-- Add the current profile, if it hasn't been created yet
if curProfile then
i = i + 1
tbl[i] = curProfile
end
 
return tbl, i
end
 
--- Returns the current profile name used by the database
function DBObjectLib:GetCurrentProfile()
return self.keys.profile
end
 
--- Deletes a named profile. This profile must not be the active profile.
-- @param name The name of the profile to be deleted
-- @param silent If true, do not raise an error when the profile does not exist
function DBObjectLib:DeleteProfile(name, silent)
if type(name) ~= "string" then
error(("Usage: AceDBObject:DeleteProfile(name): 'name' - string expected, got %q."):format(type(name)), 2)
end
 
if self.keys.profile == name then
error(("Cannot delete the active profile (%q) in an AceDBObject."):format(name), 2)
end
 
if not rawget(self.profiles, name) and not silent then
error(("Cannot delete profile %q as it does not exist."):format(name), 2)
end
 
self.profiles[name] = nil
 
-- populate to child namespaces
if self.children then
for _, db in pairs(self.children) do
DBObjectLib.DeleteProfile(db, name, true)
end
end
 
-- switch all characters that use this profile back to the default
if self.sv.profileKeys then
for key, profile in pairs(self.sv.profileKeys) do
if profile == name then
self.sv.profileKeys[key] = nil
end
end
end
 
-- Callback: OnProfileDeleted, database, profileKey
self.callbacks:Fire("OnProfileDeleted", self, name)
end
 
--- Copies a named profile into the current profile, overwriting any conflicting
-- settings.
-- @param name The name of the profile to be copied into the current profile
-- @param silent If true, do not raise an error when the profile does not exist
function DBObjectLib:CopyProfile(name, silent)
if type(name) ~= "string" then
error(("Usage: AceDBObject:CopyProfile(name): 'name' - string expected, got %q."):format(type(name)), 2)
end
 
if name == self.keys.profile then
error(("Cannot have the same source and destination profiles (%q)."):format(name), 2)
end
 
if not rawget(self.profiles, name) and not silent then
error(("Cannot copy profile %q as it does not exist."):format(name), 2)
end
 
-- Reset the profile before copying
DBObjectLib.ResetProfile(self, nil, true)
 
local profile = self.profile
local source = self.profiles[name]
 
copyTable(source, profile)
 
-- populate to child namespaces
if self.children then
for _, db in pairs(self.children) do
DBObjectLib.CopyProfile(db, name, true)
end
end
 
-- Callback: OnProfileCopied, database, sourceProfileKey
self.callbacks:Fire("OnProfileCopied", self, name)
end
 
--- Resets the current profile to the default values (if specified).
-- @param noChildren if set to true, the reset will not be populated to the child namespaces of this DB object
-- @param noCallbacks if set to true, won't fire the OnProfileReset callback
function DBObjectLib:ResetProfile(noChildren, noCallbacks)
local profile = self.profile
 
for k,v in pairs(profile) do
profile[k] = nil
end
 
local defaults = self.defaults and self.defaults.profile
if defaults then
copyDefaults(profile, defaults)
end
 
-- populate to child namespaces
if self.children and not noChildren then
for _, db in pairs(self.children) do
DBObjectLib.ResetProfile(db, nil, noCallbacks)
end
end
 
-- Callback: OnProfileReset, database
if not noCallbacks then
self.callbacks:Fire("OnProfileReset", self)
end
end
 
--- Resets the entire database, using the string defaultProfile as the new default
-- profile.
-- @param defaultProfile The profile name to use as the default
function DBObjectLib:ResetDB(defaultProfile)
if defaultProfile and type(defaultProfile) ~= "string" then
error(("Usage: AceDBObject:ResetDB(defaultProfile): 'defaultProfile' - string or nil expected, got %q."):format(type(defaultProfile)), 2)
end
 
local sv = self.sv
for k,v in pairs(sv) do
sv[k] = nil
end
 
initdb(sv, self.defaults, defaultProfile, self)
 
-- fix the child namespaces
if self.children then
if not sv.namespaces then sv.namespaces = {} end
for name, db in pairs(self.children) do
if not sv.namespaces[name] then sv.namespaces[name] = {} end
initdb(sv.namespaces[name], db.defaults, self.keys.profile, db, self)
end
end
 
-- Callback: OnDatabaseReset, database
self.callbacks:Fire("OnDatabaseReset", self)
-- Callback: OnProfileChanged, database, profileKey
self.callbacks:Fire("OnProfileChanged", self, self.keys["profile"])
 
return self
end
 
--- Creates a new database namespace, directly tied to the database. This
-- is a full scale database in it's own rights other than the fact that
-- it cannot control its profile individually
-- @param name The name of the new namespace
-- @param defaults A table of values to use as defaults
function DBObjectLib:RegisterNamespace(name, defaults)
if type(name) ~= "string" then
error(("Usage: AceDBObject:RegisterNamespace(name, defaults): 'name' - string expected, got %q."):format(type(name)), 2)
end
if defaults and type(defaults) ~= "table" then
error(("Usage: AceDBObject:RegisterNamespace(name, defaults): 'defaults' - table or nil expected, got %q."):format(type(defaults)), 2)
end
if self.children and self.children[name] then
error(("Usage: AceDBObject:RegisterNamespace(name, defaults): 'name' - a namespace called %q already exists."):format(name), 2)
end
 
local sv = self.sv
if not sv.namespaces then sv.namespaces = {} end
if not sv.namespaces[name] then
sv.namespaces[name] = {}
end
 
local newDB = initdb(sv.namespaces[name], defaults, self.keys.profile, nil, self)
 
if not self.children then self.children = {} end
self.children[name] = newDB
return newDB
end
 
--- Returns an already existing namespace from the database object.
-- @param name The name of the new namespace
-- @param silent if true, the addon is optional, silently return nil if its not found
-- @usage
-- local namespace = self.db:GetNamespace('namespace')
-- @return the namespace object if found
function DBObjectLib:GetNamespace(name, silent)
if type(name) ~= "string" then
error(("Usage: AceDBObject:GetNamespace(name): 'name' - string expected, got %q."):format(type(name)), 2)
end
if not silent and not (self.children and self.children[name]) then
error(("Usage: AceDBObject:GetNamespace(name): 'name' - namespace %q does not exist."):format(name), 2)
end
if not self.children then self.children = {} end
return self.children[name]
end
 
--[[-------------------------------------------------------------------------
AceDB Exposed Methods
---------------------------------------------------------------------------]]
 
--- Creates a new database object that can be used to handle database settings and profiles.
-- By default, an empty DB is created, using a character specific profile.
--
-- You can override the default profile used by passing any profile name as the third argument,
-- or by passing //true// as the third argument to use a globally shared profile called "Default".
--
-- Note that there is no token replacement in the default profile name, passing a defaultProfile as "char"
-- will use a profile named "char", and not a character-specific profile.
-- @param tbl The name of variable, or table to use for the database
-- @param defaults A table of database defaults
-- @param defaultProfile The name of the default profile. If not set, a character specific profile will be used as the default.
-- You can also pass //true// to use a shared global profile called "Default".
-- @usage
-- -- Create an empty DB using a character-specific default profile.
-- self.db = LibStub("AceDB-3.0"):New("MyAddonDB")
-- @usage
-- -- Create a DB using defaults and using a shared default profile
-- self.db = LibStub("AceDB-3.0"):New("MyAddonDB", defaults, true)
function AceDB:New(tbl, defaults, defaultProfile)
if type(tbl) == "string" then
local name = tbl
tbl = _G[name]
if not tbl then
tbl = {}
_G[name] = tbl
end
end
 
if type(tbl) ~= "table" then
error(("Usage: AceDB:New(tbl, defaults, defaultProfile): 'tbl' - table expected, got %q."):format(type(tbl)), 2)
end
 
if defaults and type(defaults) ~= "table" then
error(("Usage: AceDB:New(tbl, defaults, defaultProfile): 'defaults' - table expected, got %q."):format(type(defaults)), 2)
end
 
if defaultProfile and type(defaultProfile) ~= "string" and defaultProfile ~= true then
error(("Usage: AceDB:New(tbl, defaults, defaultProfile): 'defaultProfile' - string or true expected, got %q."):format(type(defaultProfile)), 2)
end
 
return initdb(tbl, defaults, defaultProfile)
end
 
-- upgrade existing databases
for db in pairs(AceDB.db_registry) do
if not db.parent then
for name,func in pairs(DBObjectLib) do
db[name] = func
end
else
db.RegisterDefaults = DBObjectLib.RegisterDefaults
db.ResetProfile = DBObjectLib.ResetProfile
end
end
Property changes : Added: svn:eol-style + native
tags/1.13.002_Classic/InFlight/embeds.xml New file
0,0 → 1,7
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Script file="libs\LibStub\LibStub.lua"/>
<Include file="libs\CallbackHandler-1.0\CallbackHandler-1.0.xml"/>
<Include file="libs\AceDB-3.0\AceDB-3.0.xml"/>
<Include file="libs\AceLocale-3.0\AceLocale-3.0.xml"/>
<Include file="libs\LibSharedMedia-3.0\lib.xml"/>
</Ui>
\ No newline at end of file
tags/1.13.002_Classic Property changes : Added: svn:mergeinfo Merged /trunk:r118-120