WoWInterface SVN GuildTracker

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 8 to Rev 10
    Reverse comparison

Rev 8 → Rev 10

GuildTracker.lua
1,5 → 1,6
GuildTracker = LibStub("AceAddon-3.0"):NewAddon("GuildTracker", "AceBucket-3.0", "AceEvent-3.0", "AceConsole-3.0", "AceTimer-3.0")
 
local DB_VERSION = 1
 
local ICON_DELETE = "|TInterface\\Buttons\\UI-GroupLoot-Pass-Up:16:16:0:0:16:16:0:16:0:16|t"
local ICON_CHAT = "|TInterface\\ChatFrame\\UI-ChatWhisperIcon:16:16:0:0:16:16:0:16:0:16|t"
133,7 → 134,8
Active = 8,
LevelChange = 9,
NoteChange = 10,
NameChange = 11,
OfficerNoteChange = 11,
NameChange = 12,
}
 
local StateInfo = {
208,12 → 210,19
template = "has gone up %d level%s and is now %d",
},
[State.NoteChange] = {
color = RGB2HEX(0.75,0.55,0.55),
color = RGB2HEX(0.79,0.58,0.58),
category = "Note",
shorttext = "Note change",
longtext = "got a new guild note",
template = "note changed from \"%s\" to \"%s\"",
},
[State.OfficerNoteChange] = {
color = RGB2HEX(0.65,0.45,0.45),
category = "Note",
shorttext = "Officer note change",
longtext = "got a new officer note",
template = "officer note changed from \"%s\" to \"%s\"",
},
[State.NameChange] = {
color = RGB2HEX(0.3,0.75,0.3),
category = "Name",
534,6 → 543,7
self:Print(string.format("Creating new database for guild '%s'", guildname))
self.db.realm.guild[guildname] = {
updated = time(),
version = DB_VERSION,
roster = {},
changes = {}
}
542,8 → 552,20
end
 
self.GuildDB = self.db.realm.guild[guildname]
 
self:UpgradeGuildDatabase()
end
 
--------------------------------------------------------------------------------
function GuildTracker:UpgradeGuildDatabase()
--------------------------------------------------------------------------------
if self.GuildDB.version == nil then
self:Debug("Upgrading database to version 1")
self.GuildDB.version = 1
self.GuildDB.isOfficer = CanViewOfficerNote()
end
end
 
--------------------------------------------------------------------------------
function GuildTracker:UpdateGuildRoster()
--------------------------------------------------------------------------------
570,10 → 592,16
--------------------------------------------------------------------------------
function GuildTracker:UpdateGuildChanges()
--------------------------------------------------------------------------------
-- We don't know what guild we're updating yet
if self.GuildDB == nil then
return
end
 
-- Fail-safe when the roster returned 0 guild members; this can't be right so ignore
if #self.GuildRoster == 0 then
return
end
 
local oldRoster = self.GuildDB.roster
 
-- If there's no saved roster data available, we can't determine any changes yet
610,6 → 638,10
self:AddGuildChange(State.NoteChange, info, newPlayerInfo)
end
 
if newPlayerInfo[Field.OfficerNote] ~= info[Field.OfficerNote] and self.GuildDB.isOfficer == CanViewOfficerNote() then
self:AddGuildChange(State.OfficerNoteChange, info, newPlayerInfo)
end
 
end
end
 
792,6 → 824,7
end
 
self.GuildDB.updated = self.LastRosterUpdate
self.GuildDB.isOfficer = CanViewOfficerNote()
 
self:Debug(string.format("Roster: %d added, %d removed, %d updated", added, removed, updated))
end
1035,6 → 1068,10
local oldName = change.oldinfo[Field.Name]
local newName = change.newinfo[Field.Name]
template = string.format(template, newName)
elseif state == State.OfficerNoteChange then
local oldNote = change.oldinfo[Field.OfficerNote]
local newNote = change.newinfo[Field.OfficerNote]
template = string.format(template, oldNote, newNote)
end
 
return stateColor, shortText, longText, template, category
1310,7 → 1347,7
local txtName = RAID_CLASS_COLORS_hex[item[Field.Class]] .. item[Field.Name]
local txtLevel = item[Field.Level]
local txtRank = GuildControlGetRankName(item[Field.Rank]+1)
local txtNote = item[Field.Note]
local txtNote = (changeType == State.OfficerNoteChange) and item[Field.OfficerNote] or item[Field.Note]
local txtOffline = self:GetFormattedLastOnline(item[Field.LastOnline])
local txtTimestamp, fullTimestamp = self:GetFormattedTimestamp(changeItem.timestamp)
 
1339,6 → 1376,9
txtNote = CLR_YELLOW .. txtNote
elseif changeType == State.NameChange then
oldName = changeItem.oldinfo[Field.Name]
elseif changeType == State.OfficerNoteChange then
oldNote = changeItem.oldinfo[Field.OfficerNote]
txtNote = CLR_YELLOW .. txtNote
end
 
lineNum = tooltip:AddLine()
1369,7 → 1409,8
 
lineNum, colNum = tooltip:SetCell(lineNum, colNum, txtNote)
if oldNote then
tooltip:SetCellScript(lineNum, colNum-1, "OnEnter", ShowSimpleTooltip, {"Previous note: ", oldNote})
local caption = (changeType == State.OfficerNoteChange) and "Previous officer note: " or "Previous note: "
tooltip:SetCellScript(lineNum, colNum-1, "OnEnter", ShowSimpleTooltip, {caption, oldNote})
tooltip:SetCellScript(lineNum, colNum-1, "OnLeave", HideSimpleTooltip)
end
 
GuildTracker.toc
2,8 → 2,8
## Title: Guild Tracker
## Notes: Keeps track of changes in the guild roster between logins, and also shows who disabled their account
## Author: Dracula
## Version: 5.0.5-1
## Version: 5.0.5-2
## SavedVariables: GuildTrackerDB
 
embeds.xml
GuildTracker.lua
GuildTracker.lua
\ No newline at end of file