chore: flatten Altoholic-Addon/ wrapper + add standard .gitignore/.gitattributes
Each DataStore_* / Altoholic_* addon now lives at the repo root, matching the Exiles fork-layout convention (one folder per addon, no wrapper dir).
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
------------------------------------------------------------------------
|
||||
r11 | Thaoky | 2010-07-06 17:17:32 +0000 (Tue, 06 Jul 2010) | 1 line
|
||||
Changed paths:
|
||||
M /trunk/DataStore_Skills.toc
|
||||
|
||||
Toc update.
|
||||
------------------------------------------------------------------------
|
||||
r10 | pompachomp | 2010-02-19 18:59:58 +0000 (Fri, 19 Feb 2010) | 2 lines
|
||||
Changed paths:
|
||||
M /trunk/DataStore_Skills.toc
|
||||
A /trunk/Locales (from /trunk/Locals:9)
|
||||
D /trunk/Locals
|
||||
D /trunk/local.xml
|
||||
A /trunk/locale.xml (from /trunk/local.xml:9)
|
||||
|
||||
Locals->Locales
|
||||
local.xml->locale.xml
|
||||
------------------------------------------------------------------------
|
||||
@@ -0,0 +1,216 @@
|
||||
--[[ *** DataStore_Skills ***
|
||||
Written by : Thaoky, EU-Marécages de Zangar
|
||||
July 6th, 2009
|
||||
--]]
|
||||
|
||||
if not DataStore then return end
|
||||
|
||||
local addonName = "DataStore_Skills"
|
||||
|
||||
_G[addonName] = LibStub("AceAddon-3.0"):NewAddon(addonName, "AceConsole-3.0", "AceEvent-3.0")
|
||||
|
||||
local addon = _G[addonName]
|
||||
|
||||
local THIS_ACCOUNT = "Default"
|
||||
local BI = LibStub("LibBabble-Inventory-3.0"):GetLookupTable()
|
||||
local L = LibStub("AceLocale-3.0"):GetLocale("DataStore_Skills")
|
||||
|
||||
local AddonDB_Defaults = {
|
||||
global = {
|
||||
Characters = {
|
||||
['*'] = { -- ["Account.Realm.Name"]
|
||||
lastUpdate = nil,
|
||||
Skills = {
|
||||
['*'] = { -- "Professions", "Secondary Skills", "Class Skills", etc...
|
||||
['*'] = nil
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- ** Mixins **
|
||||
local function _GetPrimaryProfessions(character)
|
||||
return character.Skills[L["Professions"]]
|
||||
end
|
||||
|
||||
local function _GetSecondaryProfessions(character)
|
||||
return character.Skills[L["Secondary Skills"]]
|
||||
end
|
||||
|
||||
local function _GetSkillInfo(character, name)
|
||||
for categoryName, category in pairs(character.Skills) do
|
||||
for skillName, skill in pairs(category) do
|
||||
if skillName == name then
|
||||
local skillRank, skillMaxRank = strsplit("|", skill)
|
||||
return tonumber(skillRank) or 0, tonumber(skillMaxRank) or 0
|
||||
end
|
||||
end
|
||||
end
|
||||
return 0, 0
|
||||
end
|
||||
|
||||
local function _GetSkillInfoByCategory(character, category, name)
|
||||
local skillRank, skillMaxRank
|
||||
local skill = character.Skills[category][name]
|
||||
if skill then
|
||||
skillRank, skillMaxRank = strsplit("|", skill)
|
||||
end
|
||||
return tonumber(skillRank) or 0, tonumber(skillMaxRank) or 0
|
||||
end
|
||||
|
||||
-- a few shortcuts for commonly used skills
|
||||
local function _GetFirstAidRank(character)
|
||||
return _GetSkillInfoByCategory(character, L["Secondary Skills"], BI["First Aid"])
|
||||
end
|
||||
|
||||
local function _GetCookingRank(character)
|
||||
return _GetSkillInfoByCategory(character, L["Secondary Skills"], BI["Cooking"])
|
||||
end
|
||||
|
||||
local function _GetFishingRank(character)
|
||||
return _GetSkillInfoByCategory(character, L["Secondary Skills"], BI["Fishing"])
|
||||
end
|
||||
|
||||
local function _GetRidingRank(character)
|
||||
return _GetSkillInfoByCategory(character, L["Secondary Skills"], L["Riding"])
|
||||
end
|
||||
|
||||
local PublicMethods = {
|
||||
GetPrimaryProfessions = _GetPrimaryProfessions,
|
||||
GetSecondaryProfessions = _GetSecondaryProfessions,
|
||||
GetSkillInfo = _GetSkillInfo,
|
||||
GetSkillInfoByCategory = _GetSkillInfoByCategory,
|
||||
GetFirstAidRank = _GetFirstAidRank,
|
||||
GetCookingRank = _GetCookingRank,
|
||||
GetFishingRank = _GetFishingRank,
|
||||
GetRidingRank = _GetRidingRank,
|
||||
}
|
||||
|
||||
function addon:OnInitialize()
|
||||
addon.db = LibStub("AceDB-3.0"):New(addonName .. "DB", AddonDB_Defaults)
|
||||
|
||||
DataStore:RegisterModule(addonName, addon, PublicMethods)
|
||||
DataStore:SetCharacterBasedMethod("GetPrimaryProfessions")
|
||||
DataStore:SetCharacterBasedMethod("GetSecondaryProfessions")
|
||||
DataStore:SetCharacterBasedMethod("GetSkillInfo")
|
||||
DataStore:SetCharacterBasedMethod("GetSkillInfoByCategory")
|
||||
DataStore:SetCharacterBasedMethod("GetFirstAidRank")
|
||||
DataStore:SetCharacterBasedMethod("GetCookingRank")
|
||||
DataStore:SetCharacterBasedMethod("GetFishingRank")
|
||||
DataStore:SetCharacterBasedMethod("GetRidingRank")
|
||||
end
|
||||
|
||||
function addon:OnEnable()
|
||||
addon:RegisterEvent("PLAYER_ALIVE")
|
||||
addon:RegisterEvent("CHAT_MSG_SKILL")
|
||||
end
|
||||
|
||||
function addon:OnDisable()
|
||||
addon:UnregisterEvent("PLAYER_ALIVE")
|
||||
addon:UnregisterEvent("CHAT_MSG_SKILL")
|
||||
end
|
||||
|
||||
-- *** Scanning functions ***
|
||||
local headersState = {}
|
||||
local headerCount
|
||||
|
||||
local function SaveHeaders()
|
||||
headerCount = 0 -- use a counter to avoid being bound to header names, which might not be unique.
|
||||
|
||||
for i = GetNumSkillLines(), 1, -1 do -- 1st pass, expand all categories
|
||||
local _, isHeader, isExpanded = GetSkillLineInfo(i)
|
||||
if isHeader then
|
||||
headerCount = headerCount + 1
|
||||
if not isExpanded then
|
||||
ExpandSkillHeader(i)
|
||||
headersState[headerCount] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function RestoreHeaders()
|
||||
headerCount = 0
|
||||
for i = GetNumSkillLines(), 1, -1 do
|
||||
local _, isHeader = GetSkillLineInfo(i)
|
||||
if isHeader then
|
||||
headerCount = headerCount + 1
|
||||
if headersState[headerCount] then
|
||||
CollapseSkillHeader(i)
|
||||
end
|
||||
end
|
||||
end
|
||||
wipe(headersState)
|
||||
end
|
||||
|
||||
local function ScanSkills()
|
||||
local skills = addon.ThisCharacter.Skills
|
||||
wipe(skills)
|
||||
|
||||
SaveHeaders()
|
||||
|
||||
local category
|
||||
for i = 1, GetNumSkillLines() do
|
||||
local skillName, isHeader, _, skillRank, _, _, skillMaxRank = GetSkillLineInfo(i)
|
||||
if isHeader then
|
||||
category = skillName
|
||||
else
|
||||
if category and skillName then
|
||||
skills[category][skillName] = skillRank .. "|" .. skillMaxRank
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
RestoreHeaders()
|
||||
|
||||
addon.ThisCharacter.lastUpdate = time()
|
||||
end
|
||||
|
||||
-- *** EVENT HANDLERS ***
|
||||
function addon:PLAYER_ALIVE()
|
||||
-- print("DataStore_Skills.lua") -- DEBUG 2025 07 21
|
||||
if not UnitIsGhost("player") then return end -- only scan if player released spirit and went to graveyard
|
||||
|
||||
ScanSkills()
|
||||
end
|
||||
|
||||
-- this turns
|
||||
-- "Your skill in %s has increased to %d."
|
||||
-- into
|
||||
-- "Your skill in (.+) has increased to (%d+)."
|
||||
|
||||
local arg1pattern, arg2pattern
|
||||
if GetLocale() == "deDE" then
|
||||
-- ERR_SKILL_UP_SI = "Eure Fertigkeit '%1$s' hat sich auf %2$d erhöht.";
|
||||
arg1pattern = "'%%1%$s'"
|
||||
arg2pattern = "%%2%$d"
|
||||
else
|
||||
arg1pattern = "%%s"
|
||||
arg2pattern = "%%d"
|
||||
end
|
||||
|
||||
local skillUpMsg = gsub(ERR_SKILL_UP_SI, arg1pattern, "(.+)")
|
||||
skillUpMsg = gsub(skillUpMsg, arg2pattern, "(%%d+)")
|
||||
|
||||
|
||||
function addon:CHAT_MSG_SKILL(self, msg)
|
||||
-- This code is a bit more complex than calling ScanSkills again.
|
||||
-- The purpose is to avoid triggering events when expanding/collapsing headers, as this may result in heavy processing in other addons
|
||||
if not msg then return end
|
||||
|
||||
local updatedSkill, value = msg:match(skillUpMsg)
|
||||
|
||||
if updatedSkill and value then
|
||||
for _, category in pairs(addon.ThisCharacter.Skills) do
|
||||
for skillName, skillData in pairs(category) do
|
||||
if skillName == updatedSkill then
|
||||
local _, skillMaxRank = strsplit("|", skillData)
|
||||
category[skillName] = tonumber(value) .. "|" .. skillMaxRank
|
||||
addon.ThisCharacter.lastUpdate = time()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,19 @@
|
||||
## Interface: 30300
|
||||
## Title: DataStore_Skills
|
||||
## Notes: Stores information about character skills
|
||||
## Author: Thaoky (EU-Marécages de Zangar)
|
||||
## Version: 3.3.002
|
||||
## Dependencies: DataStore
|
||||
## OptionalDeps: Ace3
|
||||
## SavedVariables: DataStore_SkillsDB
|
||||
## X-Category: Interface Enhancements
|
||||
## X-Embeds: Ace3
|
||||
## X-Curse-Packaged-Version: r11
|
||||
## X-Curse-Project-Name: DataStore_Skills
|
||||
## X-Curse-Project-ID: datastore_skills
|
||||
## X-Curse-Repository-ID: wow/datastore_skills/mainline
|
||||
|
||||
embeds.xml
|
||||
locale.xml
|
||||
|
||||
DataStore_Skills.lua
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
All Rights Reserved unless otherwise explicitly stated.
|
||||
@@ -0,0 +1,7 @@
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale( "DataStore_Skills", "deDE" )
|
||||
|
||||
if not L then return end
|
||||
|
||||
L["Professions"] = "Berufe"
|
||||
L["Secondary Skills"] = "Sekundäre Fertigkeiten"
|
||||
L["Riding"] = "Reiten"
|
||||
@@ -0,0 +1,7 @@
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale("DataStore_Skills", "enUS", true, true)
|
||||
|
||||
if not L then return end
|
||||
|
||||
L["Professions"] = true
|
||||
L["Secondary Skills"] = true
|
||||
L["Riding"] = true
|
||||
@@ -0,0 +1,7 @@
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale( "DataStore_Skills", "esES" )
|
||||
|
||||
if not L then return end
|
||||
|
||||
L["Professions"] = "Profesiones"
|
||||
L["Secondary Skills"] = "Habilidades secundarias"
|
||||
L["Riding"] = "Equitación"
|
||||
@@ -0,0 +1,7 @@
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale( "DataStore_Skills", "esMX" )
|
||||
|
||||
if not L then return end
|
||||
|
||||
L["Professions"] = "Profesiones"
|
||||
L["Secondary Skills"] = "Habilidades secundarias"
|
||||
L["Riding"] = "Equitación"
|
||||
@@ -0,0 +1,7 @@
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale( "DataStore_Skills", "frFR" )
|
||||
|
||||
if not L then return end
|
||||
|
||||
L["Professions"] = "Métiers"
|
||||
L["Secondary Skills"] = "Compétences secondaires"
|
||||
L["Riding"] = "Monte"
|
||||
@@ -0,0 +1,7 @@
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale( "DataStore_Skills", "koKR" )
|
||||
|
||||
if not L then return end
|
||||
|
||||
L["Professions"] = "전문 기술"
|
||||
L["Secondary Skills"] = "보조 기술"
|
||||
L["Riding"] = "탈것 타기"
|
||||
@@ -0,0 +1,7 @@
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale("DataStore_Skills", "enUS", true, true)
|
||||
|
||||
if not L then return end
|
||||
|
||||
L["Professions"] = true
|
||||
L["Secondary Skills"] = true
|
||||
L["Riding"] = true
|
||||
@@ -0,0 +1,7 @@
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale( "DataStore_Skills", "ruRU" )
|
||||
|
||||
if not L then return end
|
||||
|
||||
L["Professions"] = "Профессии"
|
||||
L["Secondary Skills"] = "Разное"
|
||||
L["Riding"] = "Верховая езда"
|
||||
@@ -0,0 +1,7 @@
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale( "DataStore_Skills", "zhCN" )
|
||||
|
||||
if not L then return end
|
||||
|
||||
L["Professions"] = "专业"
|
||||
L["Secondary Skills"] = "辅助技能"
|
||||
L["Riding"] = "骑术"
|
||||
@@ -0,0 +1,7 @@
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale( "DataStore_Skills", "zhTW" )
|
||||
|
||||
if not L then return end
|
||||
|
||||
L["Professions"] = "專業技能"
|
||||
L["Secondary Skills"] = "次要技能"
|
||||
L["Riding"] = "騎術"
|
||||
@@ -0,0 +1,5 @@
|
||||
<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">
|
||||
|
||||
<Include file="libs\LibBabble-Inventory-3.0\lib.xml"/>
|
||||
</Ui>
|
||||
@@ -0,0 +1,292 @@
|
||||
-- LibBabble-3.0 is hereby placed in the Public Domain
|
||||
-- Credits: ckknight
|
||||
local LIBBABBLE_MAJOR, LIBBABBLE_MINOR = "LibBabble-3.0", 2
|
||||
|
||||
local LibBabble = LibStub:NewLibrary(LIBBABBLE_MAJOR, LIBBABBLE_MINOR)
|
||||
if not LibBabble then
|
||||
return
|
||||
end
|
||||
|
||||
local data = LibBabble.data or {}
|
||||
for k,v in pairs(LibBabble) do
|
||||
LibBabble[k] = nil
|
||||
end
|
||||
LibBabble.data = data
|
||||
|
||||
local tablesToDB = {}
|
||||
for namespace, db in pairs(data) do
|
||||
for k,v in pairs(db) do
|
||||
tablesToDB[v] = db
|
||||
end
|
||||
end
|
||||
|
||||
local function warn(message)
|
||||
local _, ret = pcall(error, message, 3)
|
||||
geterrorhandler()(ret)
|
||||
end
|
||||
|
||||
local lookup_mt = { __index = function(self, key)
|
||||
local db = tablesToDB[self]
|
||||
local current_key = db.current[key]
|
||||
if current_key then
|
||||
self[key] = current_key
|
||||
return current_key
|
||||
end
|
||||
local base_key = db.base[key]
|
||||
local real_MAJOR_VERSION
|
||||
for k,v in pairs(data) do
|
||||
if v == db then
|
||||
real_MAJOR_VERSION = k
|
||||
break
|
||||
end
|
||||
end
|
||||
if not real_MAJOR_VERSION then
|
||||
real_MAJOR_VERSION = LIBBABBLE_MAJOR
|
||||
end
|
||||
if base_key then
|
||||
warn(("%s: Translation %q not found for locale %q"):format(real_MAJOR_VERSION, key, GetLocale()))
|
||||
rawset(self, key, base_key)
|
||||
return base_key
|
||||
end
|
||||
warn(("%s: Translation %q not found."):format(real_MAJOR_VERSION, key))
|
||||
rawset(self, key, key)
|
||||
return key
|
||||
end }
|
||||
|
||||
local function initLookup(module, lookup)
|
||||
local db = tablesToDB[module]
|
||||
for k in pairs(lookup) do
|
||||
lookup[k] = nil
|
||||
end
|
||||
setmetatable(lookup, lookup_mt)
|
||||
tablesToDB[lookup] = db
|
||||
db.lookup = lookup
|
||||
return lookup
|
||||
end
|
||||
|
||||
local function initReverse(module, reverse)
|
||||
local db = tablesToDB[module]
|
||||
for k in pairs(reverse) do
|
||||
reverse[k] = nil
|
||||
end
|
||||
for k,v in pairs(db.current) do
|
||||
reverse[v] = k
|
||||
end
|
||||
tablesToDB[reverse] = db
|
||||
db.reverse = reverse
|
||||
db.reverseIterators = nil
|
||||
return reverse
|
||||
end
|
||||
|
||||
local prototype = {}
|
||||
local prototype_mt = {__index = prototype}
|
||||
|
||||
--[[---------------------------------------------------------------------------
|
||||
Notes:
|
||||
* If you try to access a nonexistent key, it will warn but allow the code to pass through.
|
||||
Returns:
|
||||
A lookup table for english to localized words.
|
||||
Example:
|
||||
local B = LibStub("LibBabble-Module-3.0") -- where Module is what you want.
|
||||
local BL = B:GetLookupTable()
|
||||
assert(BL["Some english word"] == "Some localized word")
|
||||
DoSomething(BL["Some english word that doesn't exist"]) -- warning!
|
||||
-----------------------------------------------------------------------------]]
|
||||
function prototype:GetLookupTable()
|
||||
local db = tablesToDB[self]
|
||||
|
||||
local lookup = db.lookup
|
||||
if lookup then
|
||||
return lookup
|
||||
end
|
||||
return initLookup(self, {})
|
||||
end
|
||||
--[[---------------------------------------------------------------------------
|
||||
Notes:
|
||||
* If you try to access a nonexistent key, it will return nil.
|
||||
Returns:
|
||||
A lookup table for english to localized words.
|
||||
Example:
|
||||
local B = LibStub("LibBabble-Module-3.0") -- where Module is what you want.
|
||||
local B_has = B:GetUnstrictLookupTable()
|
||||
assert(B_has["Some english word"] == "Some localized word")
|
||||
assert(B_has["Some english word that doesn't exist"] == nil)
|
||||
-----------------------------------------------------------------------------]]
|
||||
function prototype:GetUnstrictLookupTable()
|
||||
local db = tablesToDB[self]
|
||||
|
||||
return db.current
|
||||
end
|
||||
--[[---------------------------------------------------------------------------
|
||||
Notes:
|
||||
* If you try to access a nonexistent key, it will return nil.
|
||||
* This is useful for checking if the base (English) table has a key, even if the localized one does not have it registered.
|
||||
Returns:
|
||||
A lookup table for english to localized words.
|
||||
Example:
|
||||
local B = LibStub("LibBabble-Module-3.0") -- where Module is what you want.
|
||||
local B_hasBase = B:GetBaseLookupTable()
|
||||
assert(B_hasBase["Some english word"] == "Some english word")
|
||||
assert(B_hasBase["Some english word that doesn't exist"] == nil)
|
||||
-----------------------------------------------------------------------------]]
|
||||
function prototype:GetBaseLookupTable()
|
||||
local db = tablesToDB[self]
|
||||
|
||||
return db.base
|
||||
end
|
||||
--[[---------------------------------------------------------------------------
|
||||
Notes:
|
||||
* If you try to access a nonexistent key, it will return nil.
|
||||
* This will return only one English word that it maps to, if there are more than one to check, see :GetReverseIterator("word")
|
||||
Returns:
|
||||
A lookup table for localized to english words.
|
||||
Example:
|
||||
local B = LibStub("LibBabble-Module-3.0") -- where Module is what you want.
|
||||
local BR = B:GetReverseLookupTable()
|
||||
assert(BR["Some localized word"] == "Some english word")
|
||||
assert(BR["Some localized word that doesn't exist"] == nil)
|
||||
-----------------------------------------------------------------------------]]
|
||||
function prototype:GetReverseLookupTable()
|
||||
local db = tablesToDB[self]
|
||||
|
||||
local reverse = db.reverse
|
||||
if reverse then
|
||||
return reverse
|
||||
end
|
||||
return initReverse(self, {})
|
||||
end
|
||||
local blank = {}
|
||||
local weakVal = {__mode='v'}
|
||||
--[[---------------------------------------------------------------------------
|
||||
Arguments:
|
||||
string - the localized word to chek for.
|
||||
Returns:
|
||||
An iterator to traverse all English words that map to the given key
|
||||
Example:
|
||||
local B = LibStub("LibBabble-Module-3.0") -- where Module is what you want.
|
||||
for word in B:GetReverseIterator("Some localized word") do
|
||||
DoSomething(word)
|
||||
end
|
||||
-----------------------------------------------------------------------------]]
|
||||
function prototype:GetReverseIterator(key)
|
||||
local db = tablesToDB[self]
|
||||
local reverseIterators = db.reverseIterators
|
||||
if not reverseIterators then
|
||||
reverseIterators = setmetatable({}, weakVal)
|
||||
db.reverseIterators = reverseIterators
|
||||
elseif reverseIterators[key] then
|
||||
return pairs(reverseIterators[key])
|
||||
end
|
||||
local t
|
||||
for k,v in pairs(db.current) do
|
||||
if v == key then
|
||||
if not t then
|
||||
t = {}
|
||||
end
|
||||
t[k] = true
|
||||
end
|
||||
end
|
||||
reverseIterators[key] = t or blank
|
||||
return pairs(reverseIterators[key])
|
||||
end
|
||||
--[[---------------------------------------------------------------------------
|
||||
Returns:
|
||||
An iterator to traverse all translations English to localized.
|
||||
Example:
|
||||
local B = LibStub("LibBabble-Module-3.0") -- where Module is what you want.
|
||||
for english, localized in B:Iterate() do
|
||||
DoSomething(english, localized)
|
||||
end
|
||||
-----------------------------------------------------------------------------]]
|
||||
function prototype:Iterate()
|
||||
local db = tablesToDB[self]
|
||||
|
||||
return pairs(db.current)
|
||||
end
|
||||
|
||||
-- #NODOC
|
||||
-- modules need to call this to set the base table
|
||||
function prototype:SetBaseTranslations(base)
|
||||
local db = tablesToDB[self]
|
||||
local oldBase = db.base
|
||||
if oldBase then
|
||||
for k in pairs(oldBase) do
|
||||
oldBase[k] = nil
|
||||
end
|
||||
for k, v in pairs(base) do
|
||||
oldBase[k] = v
|
||||
end
|
||||
base = oldBase
|
||||
else
|
||||
db.base = base
|
||||
end
|
||||
for k,v in pairs(base) do
|
||||
if v == true then
|
||||
base[k] = k
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function init(module)
|
||||
local db = tablesToDB[module]
|
||||
if db.lookup then
|
||||
initLookup(module, db.lookup)
|
||||
end
|
||||
if db.reverse then
|
||||
initReverse(module, db.reverse)
|
||||
end
|
||||
db.reverseIterators = nil
|
||||
end
|
||||
|
||||
-- #NODOC
|
||||
-- modules need to call this to set the current table. if current is true, use the base table.
|
||||
function prototype:SetCurrentTranslations(current)
|
||||
local db = tablesToDB[self]
|
||||
if current == true then
|
||||
db.current = db.base
|
||||
else
|
||||
local oldCurrent = db.current
|
||||
if oldCurrent then
|
||||
for k in pairs(oldCurrent) do
|
||||
oldCurrent[k] = nil
|
||||
end
|
||||
for k, v in pairs(current) do
|
||||
oldCurrent[k] = v
|
||||
end
|
||||
current = oldCurrent
|
||||
else
|
||||
db.current = current
|
||||
end
|
||||
end
|
||||
init(self)
|
||||
end
|
||||
|
||||
for namespace, db in pairs(data) do
|
||||
setmetatable(db.module, prototype_mt)
|
||||
init(db.module)
|
||||
end
|
||||
|
||||
-- #NODOC
|
||||
-- modules need to call this to create a new namespace.
|
||||
function LibBabble:New(namespace, minor)
|
||||
local module, oldminor = LibStub:NewLibrary(namespace, minor)
|
||||
if not module then
|
||||
return
|
||||
end
|
||||
|
||||
if not oldminor then
|
||||
local db = {
|
||||
module = module,
|
||||
}
|
||||
data[namespace] = db
|
||||
tablesToDB[module] = db
|
||||
else
|
||||
for k,v in pairs(module) do
|
||||
module[k] = nil
|
||||
end
|
||||
end
|
||||
|
||||
setmetatable(module, prototype_mt)
|
||||
|
||||
return module
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,16 @@
|
||||
## Interface: 30300
|
||||
## LoadOnDemand: 1
|
||||
## Title: Lib: Babble-Inventory-3.0
|
||||
## Notes: A library to help with localization of item types and subtypes.
|
||||
## Notes-esES: Una libreria para ayudar con la traduccion de tipos y subtipos de objetos.
|
||||
## Author: ckknight
|
||||
## X-eMail: ckknight@gmail.com
|
||||
## X-Category: Library
|
||||
## X-License: MIT
|
||||
## X-Curse-Packaged-Version: r101
|
||||
## X-Curse-Project-Name: LibBabble-Inventory-3.0
|
||||
## X-Curse-Project-ID: libbabble-inventory-3-0
|
||||
## X-Curse-Repository-ID: wow/libbabble-inventory-3-0/mainline
|
||||
|
||||
LibStub\LibStub.lua
|
||||
lib.xml
|
||||
@@ -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
|
||||
@@ -0,0 +1,5 @@
|
||||
<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="LibBabble-3.0.lua" />
|
||||
<Script file="LibBabble-Inventory-3.0.lua" />
|
||||
</Ui>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.blizzard.com/wow/ui/" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||
..\FrameXML\UI.xsd">
|
||||
|
||||
<Include file="Locales\deDE.lua"/>
|
||||
<Include file="Locales\enUS.lua"/>
|
||||
<Include file="Locales\esES.lua"/>
|
||||
<Include file="Locales\esMX.lua"/>
|
||||
<Include file="Locales\frFR.lua"/>
|
||||
<Include file="Locales\koKR.lua"/>
|
||||
<Include file="Locales\ruRU.lua"/>
|
||||
<Include file="Locales\zhCN.lua"/>
|
||||
<Include file="Locales\zhTW.lua"/>
|
||||
|
||||
</Ui>
|
||||
Reference in New Issue
Block a user