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,13 @@
|
||||
------------------------------------------------------------------------
|
||||
r8 | Thaoky | 2010-07-06 17:18:34 +0000 (Tue, 06 Jul 2010) | 1 line
|
||||
Changed paths:
|
||||
M /trunk/DataStore_Spells.lua
|
||||
|
||||
Minor fix when scanning spell tab data.
|
||||
------------------------------------------------------------------------
|
||||
r7 | thaoky | 2009-12-09 12:35:40 +0000 (Wed, 09 Dec 2009) | 1 line
|
||||
Changed paths:
|
||||
M /trunk/DataStore_Spells.toc
|
||||
|
||||
ToC Update
|
||||
------------------------------------------------------------------------
|
||||
@@ -0,0 +1,115 @@
|
||||
--[[ *** DataStore_Spells ***
|
||||
Written by : Thaoky, EU-Marécages de Zangar
|
||||
July 6th, 2009
|
||||
--]]
|
||||
if not DataStore then return end
|
||||
|
||||
local addonName = "DataStore_Spells"
|
||||
|
||||
_G[addonName] = LibStub("AceAddon-3.0"):NewAddon(addonName, "AceConsole-3.0", "AceEvent-3.0")
|
||||
|
||||
local addon = _G[addonName]
|
||||
|
||||
local THIS_ACCOUNT = "Default"
|
||||
|
||||
local AddonDB_Defaults = {
|
||||
global = {
|
||||
Characters = {
|
||||
['*'] = { -- ["Account.Realm.Name"]
|
||||
lastUpdate = nil,
|
||||
Spells = {
|
||||
['*'] = { -- "General", "Arcane", "Fire", etc...
|
||||
['*'] = nil
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- ** Mixins **
|
||||
local function _GetNumSpells(character, school)
|
||||
return #character.Spells[school]
|
||||
end
|
||||
|
||||
local function _GetSpellInfo(character, school, index)
|
||||
local spellID, rank = strsplit("|", character.Spells[school][index])
|
||||
return tonumber(spellID), rank
|
||||
end
|
||||
|
||||
local function _IsSpellKnown(character, spellID)
|
||||
for schoolName, _ in pairs(character.Spells) do
|
||||
for i = 1, _GetNumSpells(character, schoolName) do
|
||||
local id = _GetSpellInfo(character, schoolName, i)
|
||||
if id == spellID then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local PublicMethods = {
|
||||
GetNumSpells = _GetNumSpells,
|
||||
GetSpellInfo = _GetSpellInfo,
|
||||
IsSpellKnown = _IsSpellKnown,
|
||||
}
|
||||
|
||||
function addon:OnInitialize()
|
||||
addon.db = LibStub("AceDB-3.0"):New(addonName .. "DB", AddonDB_Defaults)
|
||||
|
||||
DataStore:RegisterModule(addonName, addon, PublicMethods)
|
||||
DataStore:SetCharacterBasedMethod("GetNumSpells")
|
||||
DataStore:SetCharacterBasedMethod("GetSpellInfo")
|
||||
DataStore:SetCharacterBasedMethod("IsSpellKnown")
|
||||
end
|
||||
|
||||
function addon:OnEnable()
|
||||
addon:RegisterEvent("PLAYER_ALIVE")
|
||||
addon:RegisterEvent("LEARNED_SPELL_IN_TAB")
|
||||
end
|
||||
|
||||
function addon:OnDisable()
|
||||
addon:UnregisterEvent("PLAYER_ALIVE")
|
||||
addon:UnregisterEvent("LEARNED_SPELL_IN_TAB")
|
||||
end
|
||||
|
||||
-- *** Scanning functions ***
|
||||
local function ScanSpellTab(tabID)
|
||||
local tabName, _, offset, numSpells = GetSpellTabInfo(tabID);
|
||||
if not tabName then return end
|
||||
|
||||
local spells = addon.ThisCharacter.Spells
|
||||
wipe(spells[tabName])
|
||||
|
||||
local spell, rank, link, spellID
|
||||
|
||||
for s = offset + 1, offset + numSpells do
|
||||
spell, rank = GetSpellName(s, BOOKTYPE_SPELL);
|
||||
if spell and rank then
|
||||
link = GetSpellLink(spell, rank)
|
||||
if link then
|
||||
spellID = tonumber(link:match("spell:(%d+)"))
|
||||
table.insert(spells[tabName], spellID .. "|" .. rank) -- ex: "43017|Rank 1",
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function ScanSpells()
|
||||
for tabID = 1, GetNumSpellTabs() do
|
||||
ScanSpellTab(tabID)
|
||||
end
|
||||
addon.ThisCharacter.lastUpdate = time()
|
||||
end
|
||||
|
||||
-- *** EVENT HANDLERS ***
|
||||
function addon:PLAYER_ALIVE()
|
||||
-- print("DataStore_Spells.lua") -- DEBUG 2025 07 21
|
||||
if not UnitIsGhost("player") then return end -- only scan if player released spirit and went to graveyard
|
||||
|
||||
ScanSpells()
|
||||
end
|
||||
|
||||
function addon:LEARNED_SPELL_IN_TAB()
|
||||
ScanSpells()
|
||||
end
|
||||
@@ -0,0 +1,16 @@
|
||||
## Interface: 30300
|
||||
## Title: DataStore_Spells
|
||||
## Notes: Stores information about character spells
|
||||
## Author: Thaoky (EU-Marécages de Zangar)
|
||||
## Version: 3.3.001
|
||||
## Dependencies: DataStore
|
||||
## OptionalDeps: Ace3
|
||||
## SavedVariables: DataStore_SpellsDB
|
||||
## X-Category: Interface Enhancements
|
||||
## X-Embeds: Ace3
|
||||
## X-Curse-Packaged-Version: r8
|
||||
## X-Curse-Project-Name: DataStore_Spells
|
||||
## X-Curse-Project-ID: datastore_spells
|
||||
## X-Curse-Repository-ID: wow/datastore_spells/mainline
|
||||
|
||||
DataStore_Spells.lua
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
All Rights Reserved unless otherwise explicitly stated.
|
||||
Reference in New Issue
Block a user