/trunk
font = "Friz Quadrata TT", |
fSize = 14, |
fColor = {r=1, g=1, b=1}, |
calendar = true, |
calendarShowAlways = false, |
} |
local function SaveIcon(reminder) |
end, |
order = 6, |
}, |
login = { |
name = "Login", |
zone = { |
name = "Zone", |
type = "group", |
order = 7, |
args = { |
use = { |
name = "Configure login-based reminders.", |
name = "Configure zone-based reminders.", |
type = "description", |
width = "full", |
order = 1, |
name = "Edit a Reminder", |
desc = "Select a reminder to edit.", |
type = "select", |
disabled = function() return #lr == 0 end, |
disabled = function() return #zr == 0 end, |
values = function() |
wipe(dropdownContents) |
for i = 1, #lr do |
tinsert(dropdownContents, lr[i].name) |
for i = 1, #zr do |
tinsert(dropdownContents, zr[i].name) |
end |
return dropdownContents |
end, |
get = function() return lre end, |
get = function() return zre end, |
set = function(_,rID) |
lre = rID |
zre = rID |
end, |
order = 2, |
}, |
addNew = { |
name = "New Reminder", |
desc = "Create a name for your new login-based reminder.", |
desc = "Create a name for your new zone-based reminder.", |
type = "input", |
width = "double", |
get = function() return "" end, |
set = function(_, name) |
tinsert(lr, {name = name, data = {}}) |
lre = #lr |
tinsert(zr, {name = name, data = {}}) |
zre = #zr |
end, |
order = 3, |
}, |
name = "Configure your reminder.", |
type = "group", |
inline = true, |
disabled = function() if lre then return false else return true end end, |
disabled = function() if zre then return false else return true end end, |
args = { |
icon = { |
name = "Icon", |
desc = "The icon to display with your reminder text.", |
type = "execute", |
func = function() |
OpenIconBrowser(lr[lre]) |
OpenIconBrowser(zr[zre]) |
end, |
image = function() |
if lre and lr[lre].data.icon then |
return lr[lre].data.icon |
if zre and zr[zre].data.icon then |
return zr[zre].data.icon |
else |
return sampleData.icon --or empty image? |
end |
desc = "The text to display for your reminder.", |
type = "input", |
width = "double", |
get = function() return lre and lr[lre].data.text or "" end, |
get = function() return zre and zr[zre].data.text or "" end, |
set = function(_, text) |
lr[lre].data.text = text |
zr[zre].data.text = text |
end, |
order = 2, |
}, |
name = "Play sound", |
desc = "If checked, a sound will play when your reminder goes off.", |
type = "toggle", |
get = function() return (lre and lr[lre].data.sound) and true or false end, |
get = function() return (zre and zr[zre].data.sound) and true or false end, |
set = function() end, --need this? |
order = 3, |
}, |
type = "select", |
dialogControl = "LSM30_Sound", |
values = widgetLists.sound, |
get = function() return lre and lr[lre].data.sound end, |
get = function() return zre and zr[zre].data.sound end, |
set = function(_, sound) |
lr[lre].data.sound = sound |
zr[zre].data.sound = sound |
end, |
order = 4, |
}, |
thisChar = { |
name = "Character Specific", |
desc = function() |
return BiM.CharSpecOptionDesc(lr, lre) |
return BiM.CharSpecOptionDesc(zr, zre) |
end, |
type = "toggle", |
tristate = true, |
get = function() |
return BiM.CharSpecOptionGet(lr, lre) |
return BiM.CharSpecOptionGet(zr, zre) |
end, |
set = function(_, state) |
return BiM.CharSpecOptionSet(lr, lre, state) |
return BiM.CharSpecOptionSet(zr, zre, state) |
end, |
order = 5, |
}, |
zone = { |
name = "Remind when in zone...", |
desc = function() |
return strformat('What zone should your reminder display in? Will look for the "real" zone, the sub-zone, or the main zone. Note: make sure you spell your zone name correctly.\n\nFor example, you are currently in...\n"Real" zone: %s\nSubzone: %s\nZone: %s', GetRealZoneText()or"", GetSubZoneText()or"", GetZoneText()or"") |
end, |
type = "input", |
width = "double", |
get = function() return zre and zr[zre].zone or "" end, |
set = function(_, zone) |
zr[zre].zone = zone |
end, |
order = 6, |
}, |
showAlways = { |
name = "Always show", |
desc = "Show every time you login, or just once per day? Note: if you wish to only show on a certain day, set up a day-based reminder.", |
desc = "Show every time you enter this zone, or just once per day?", |
type = "toggle", |
get = function() return lre and lr[lre].showAlways end, |
get = function() return zre and zr[zre].showAlways end, |
set = function() |
lr[lre].showAlways = not lr[lre].showAlways |
zr[zre].showAlways = not zr[zre].showAlways |
end, |
order = 7, |
}, |
desc = "Remove this reminder.", |
type = "execute", |
func = function() |
tremove(lr, lre) |
lre = nil |
tremove(zr, zre) |
zre = nil |
end, |
order = 9, |
}, |
event = { |
name = "Event", |
type = "group", |
order = 8, |
args = { |
use = { |
name = "Configure event-based reminders.", |
}, |
}, |
}, |
zone = { |
name = "Zone", |
login = { |
name = "Login", |
type = "group", |
order = 9, |
args = { |
use = { |
name = "Configure zone-based reminders.", |
name = "Configure login-based reminders.", |
type = "description", |
width = "full", |
order = 1, |
name = "Edit a Reminder", |
desc = "Select a reminder to edit.", |
type = "select", |
disabled = function() return #zr == 0 end, |
disabled = function() return #lr == 0 end, |
values = function() |
wipe(dropdownContents) |
for i = 1, #zr do |
tinsert(dropdownContents, zr[i].name) |
for i = 1, #lr do |
tinsert(dropdownContents, lr[i].name) |
end |
return dropdownContents |
end, |
get = function() return zre end, |
get = function() return lre end, |
set = function(_,rID) |
zre = rID |
lre = rID |
end, |
order = 2, |
}, |
addNew = { |
name = "New Reminder", |
desc = "Create a name for your new zone-based reminder.", |
desc = "Create a name for your new login-based reminder.", |
type = "input", |
width = "double", |
get = function() return "" end, |
set = function(_, name) |
tinsert(zr, {name = name, data = {}}) |
zre = #zr |
tinsert(lr, {name = name, data = {}}) |
lre = #lr |
end, |
order = 3, |
}, |
name = "Configure your reminder.", |
type = "group", |
inline = true, |
disabled = function() if zre then return false else return true end end, |
disabled = function() if lre then return false else return true end end, |
args = { |
icon = { |
name = "Icon", |
desc = "The icon to display with your reminder text.", |
type = "execute", |
func = function() |
OpenIconBrowser(zr[zre]) |
OpenIconBrowser(lr[lre]) |
end, |
image = function() |
if zre and zr[zre].data.icon then |
return zr[zre].data.icon |
if lre and lr[lre].data.icon then |
return lr[lre].data.icon |
else |
return sampleData.icon --or empty image? |
end |
desc = "The text to display for your reminder.", |
type = "input", |
width = "double", |
get = function() return zre and zr[zre].data.text or "" end, |
get = function() return lre and lr[lre].data.text or "" end, |
set = function(_, text) |
zr[zre].data.text = text |
lr[lre].data.text = text |
end, |
order = 2, |
}, |
name = "Play sound", |
desc = "If checked, a sound will play when your reminder goes off.", |
type = "toggle", |
get = function() return (zre and zr[zre].data.sound) and true or false end, |
get = function() return (lre and lr[lre].data.sound) and true or false end, |
set = function() end, --need this? |
order = 3, |
}, |
type = "select", |
dialogControl = "LSM30_Sound", |
values = widgetLists.sound, |
get = function() return zre and zr[zre].data.sound end, |
get = function() return lre and lr[lre].data.sound end, |
set = function(_, sound) |
zr[zre].data.sound = sound |
lr[lre].data.sound = sound |
end, |
order = 4, |
}, |
thisChar = { |
name = "Character Specific", |
desc = function() |
return BiM.CharSpecOptionDesc(zr, zre) |
return BiM.CharSpecOptionDesc(lr, lre) |
end, |
type = "toggle", |
tristate = true, |
get = function() |
return BiM.CharSpecOptionGet(zr, zre) |
return BiM.CharSpecOptionGet(lr, lre) |
end, |
set = function(_, state) |
return BiM.CharSpecOptionSet(zr, zre, state) |
return BiM.CharSpecOptionSet(lr, lre, state) |
end, |
order = 5, |
}, |
zone = { |
name = "Remind when in zone...", |
desc = function() |
return strformat('What zone should your reminder display in? Will look for the "real" zone, the sub-zone, or the main zone. Note: make sure you spell your zone name correctly.\n\nFor example, you are currently in...\n"Real" zone: %s\nSubzone: %s\nZone: %s', GetRealZoneText()or"", GetSubZoneText()or"", GetZoneText()or"") |
end, |
type = "input", |
width = "double", |
get = function() return zre and zr[zre].zone or "" end, |
set = function(_, zone) |
zr[zre].zone = zone |
end, |
order = 6, |
}, |
showAlways = { |
name = "Always show", |
desc = "Show every time you enter this zone, or just once per day?", |
desc = "Show every time you login, or just once per day? Note: if you wish to only show on a certain day, set up a day-based reminder.", |
type = "toggle", |
get = function() return zre and zr[zre].showAlways end, |
get = function() return lre and lr[lre].showAlways end, |
set = function() |
zr[zre].showAlways = not zr[zre].showAlways |
lr[lre].showAlways = not lr[lre].showAlways |
end, |
order = 7, |
}, |
desc = "Remove this reminder.", |
type = "execute", |
func = function() |
tremove(zr, zre) |
zre = nil |
tremove(lr, lre) |
lre = nil |
end, |
order = 9, |
}, |
day = { |
name = "Day", |
type = "group", |
order = 10, |
args = { |
use = { |
name = "Configure day-based reminders.", |
time = { |
name = "Time", |
type = "group", |
order = 11, |
args = { |
use = { |
name = "Configure time-based reminders.", |
}, |
}, |
}, |
calendar = { |
name = "Calendar", |
type = "group", |
order = 12, |
args = { |
use = { |
name = "Enable calendar event notices at login. This will display all events for the current day.", |
type = "description", |
width = "full", |
order = 1, |
}, |
enable = { |
name = "Enabled", |
type = "toggle", |
get = function() return db.calendar end, |
set = function() db.calendar = not db.calendar end, |
order = 2, |
}, |
showAlways = { |
name = "Always show", |
desc = "Show every time you log in on this day, or just once per day?", |
type = "toggle", |
get = function() return db.calendarShowAlways end, |
set = function() |
db.calendarShowAlways = not db.calendarShowAlways |
end, |
order = 3, |
}, |
}, |
}, |
}, |
} |
login = {}, |
custom = {}, |
} |
db.calReminders = db.calReminders or {} |
--reset any reminders that are stuck at shown (logging out without dismissing or client crash) |
for rtype, set in pairs(db.reminders) do |
for i = 1, #set do |
local tinsert = table.insert |
local tremove = table.remove |
local strformat = string.format |
local db, pcdb, _ |
local calIcon = "Interface\\Addons\\Bear in Mind\\calendar" |
local db, pcdb |
numLines = 0 --just #lines ? |
inUse = 0 |
end |
end |
local function CheckForCalendarEvents(curMonth, curDate, curYear) |
--will fire at login if calendar checks enabled |
local curDateStamp = string.format("%d%d%d", curYear, curMonth, curDate) |
local calReminders = db.calReminders |
--[[CalendarSetAbsMonth(curMonth, curYear) |
OpenCalendar() |
-- |
CalendarFrame_Update()]]-- |
--collect the day's events |
local numEvents = CalendarGetNumDayEvents(0, curDate) |
--print(numEvents, "today") |
local curEvents = {} |
for i = 1, numEvents do |
local title, _,_, calType = CalendarGetDayEvent(0, curDate, i) |
tinsert(curEvents, {name = "Calendar"..i, data = {text = title, icon = calIcon}}) |
end |
--loop through saved list |
for i, r in pairs(calReminders) do |
r.current = false |
for j, event in pairs(curEvents) do --compare with current day's events |
if r.data.text == event.data.text then --if a previously shown event is a current event |
--print(r.data.text, "still ongoing") |
curEvents[j] = nil --remove from this table, already matched |
r.current = true |
break --break out of loop (match found) and leave in calReminders table |
end |
end |
if r.lastShown and curDateStamp - r.lastShown > 0 then |
if not r.current then --not a current day's event |
--print("old event -", r.data.text, "- last shown", curDateStamp - r.lastShown, "days ago", "- current:", r.current) |
calReminders[i] = nil --remove from saved table - old event |
end |
end |
end |
--if there are new current events today (that wouldn't have been matched with the saved table) |
if #curEvents > 0 then |
for k, v in pairs(curEvents) do |
--print("new event - adding", v.data.text) |
tinsert(calReminders, v) --add to saved list |
end |
end |
--display reminders |
local crNum, crShow = 0, 0 |
for k, v in pairs(calReminders) do |
crNum = crNum+1 |
if db.calendarShowAlways or v.lastShown ~= curDateStamp then --one last check to see if we want to show the saved event |
v.lastShown = curDateStamp --shown today - update date stamp |
tinsert(sRD, v.data) |
BiM.DisplayReminder(v.data) |
crShow = crShow+1 |
end |
end |
--print("showing", crShow, "/", crNum, "total") |
end |
function BiM.PlayerLogin() |
db = BearInMindDB |
pcdb = BearInMindPCDB |
anchor:SetClampedToScreen(true) |
if db.lock then |
anchor.bg:SetTexture(0,0,1,0) |
anchor:EnableMouse(false) |
else |
anchor.bg:SetTexture(0,0,1,.4) |
anchor:EnableMouse(true) |
anchor:SetMovable(true) |
end |
anchor:SetScript("OnMouseDown", function(self) |
if not db.lock then |
anchor:StartMoving() |
end |
end) |
anchor:SetScript("OnMouseDown", function(self) anchor:StartMoving() end) |
anchor:SetScript("OnMouseUp", function(self) |
self:StopMovingOrSizing() |
db.anchor, _, _, db.offsetX, db.offsetY = anchor:GetPoint() |
end |
--check for any reminders for a certain time and start C_Timer.After |
CheckForCertainTimeReminders() |
--check for calendar events |
if db.calendar then |
local _, curMonth, curDate, curYear = CalendarGetDate() |
CalendarSetAbsMonth(curMonth, curYear) |
OpenCalendar() |
-- |
CalendarFrame_Update() |
C_Timer.After(2, function() CheckForCalendarEvents(curMonth, curDate, curYear) end) |
--CheckForCalendarEvents(curMonth, curDate, curYear) |
end |
end |
local zoneEvents = { |
for k,v in pairs(zoneEvents) do |
eventFrame:RegisterEvent(k) |
end |
eventFrame:SetScript("OnEvent", function(self, event, ...) |
if zoneEvents[event] then |
CheckForZoneReminders() |
<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="Locales\enUS.lua"/> |
<Script file="FileData.lua"/> |
<Script file="LibAdvancedIconSelector-1.0.lua"/> |
</Ui> |
if DEBUG and LibDebug then LibDebug() end |
local MAJOR_VERSION = "LibAdvancedIconSelector-1.0" |
--local MINOR_VERSION = 14 -- (do not call GetAddOnMetaData) |
local MINOR_VERSION = 15 -- (do not call GetAddOnMetaData) |
local MINOR_VERSION = 14 -- (do not call GetAddOnMetaData) |
if not LibStub then error(MAJOR_VERSION .. " requires LibStub to operate") end |
local lib = LibStub:NewLibrary(MAJOR_VERSION, MINOR_VERSION) |
end |
function lib:ConvertMacroTexture(table, index) |
if ( not index ) then |
return; |
end |
if (lib.HiddenSlot == nil) then |
lib.HiddenSlot = CreateFrame("CheckButton"); |
lib.HiddenSlot.icon = lib.HiddenSlot:CreateTexture(); |
end |
if ( not index ) then |
return; |
end |
if (lib.HiddenSlot == nil) then |
lib.HiddenSlot = CreateFrame("CheckButton"); |
lib.HiddenSlot.icon = lib.HiddenSlot:CreateTexture(); |
end |
local texture = table[index]; |
if (texture) then |
--[[if (type(texture) == "number") then |
lib.HiddenSlot.icon:SetToFileData(texture); |
local texture = lib.HiddenSlot.icon:GetTexture(); |
if texture then |
return gsub(strupper(texture), "INTERFACE\\ICONS\\", ""); |
else |
return nil; |
end |
else]] |
return texture; |
--end |
else |
return nil; |
end |
local texture = table[index]; |
if (texture) then |
if (type(texture) == "number") then |
lib.HiddenSlot.icon:SetToFileData(texture); |
local texture = lib.HiddenSlot.icon:GetTexture(); |
if texture then |
return gsub(strupper(texture), "INTERFACE\\ICONS\\", ""); |
else |
return nil; |
end |
else |
return texture; |
end |
else |
return nil; |
end |
end |
-- ================================================================ |
function Helpers.InitialInit() |
if not initialized then |
initialized = true |
--GetMacroIcons(MACRO_ICON_FILENAMES) |
--GetMacroItemIcons(ITEM_ICON_FILENAMES) |
--Seerah edit for 7.0-- |
local fd = LibAIS_IconFileData |
local macroIconIDs = {} |
local itemIconIDs = {} |
GetMacroIcons(macroIconIDs) |
for i = 1, #macroIconIDs do |
local path = LibAIS_IconFileData[macroIconIDs[i]] |
if path then |
tinsert(MACRO_ICON_FILENAMES, path) |
--debugging |
--else |
-- MISSING_MACRO_PATHS = (MISSING_MACRO_PATHS or 0) + 1 |
-- |
end |
end |
GetMacroItemIcons(itemIconIDs) |
for i = 1, #itemIconIDs do |
local path = LibAIS_IconFileData[itemIconIDs[i]] |
if path then |
tinsert(ITEM_ICON_FILENAMES, path) |
--debugging |
--else |
-- MISSING_ITEM_PATHS = (MISSING_ITEM_PATHS or 0) + 1 |
-- |
end |
end |
--[[debugging |
print("LibAIS_IconFileData:") |
print("num macro icons", #MACRO_ICON_FILENAMES) |
print("missing macro file paths", MISSING_MACRO_PATHS) |
print("num item icons", #ITEM_ICON_FILENAMES) |
print("missing item file paths", MISSING_ITEM_PATHS) |
]]-- |
GetMacroIcons(MACRO_ICON_FILENAMES) |
GetMacroItemIcons(ITEM_ICON_FILENAMES) |
end |
end |
## Interface: 70000 |
## Interface: 60200 |
## Title: Bear in Mind |
## Author: Seerah |
## Notes: An addon to remind you of things. |
## Version: 1.0 |
## Dependencies: Blizzard_Calendar |
## Version: 0.2 |
## OptionalDeps: Ace3, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, LibAdvancedIconSelector-1.0 |
## SavedVariables: BearInMindDB |
## SavedVariablesPerCharacter: BearInMindPCDB |