-- module independent variables -- ---------------------------------- local addon, ns = ... local C, L, I = ns.LC.color, ns.L, ns.I if ns.client_version<3 then return end -- module own local variables and local cached functions -- ----------------------------------------------------------- local name = "GuildLog" -- L["GuildLog"] L["ModDesc-GuildLog"] local ttName,ttColumns,tt,module = name.."TT",4 local type2locale = { ["invite"] = C("cyan",CALENDAR_STATUS_INVITED), ["join"] = C("green",LFG_LIST_APP_INVITE_ACCEPTED), ["promote"] = C("yellow",L["Promoted"]), ["demote"] = C("orange",L["Demoted"]), ["remove"] = C("red",L["Removed"]), ["quit"] = C("red",L["Left the guild"]), } local logs = {}; -- register icon names and default files -- ------------------------------------------- I[name] = {iconfile="Interface\\icons\\inv_misc_note_05",coords={0.05,0.95,0.05,0.95}} --IconName::GuildLog-- -- some local functions -- -------------------------- local function createTooltip(tt) if not (tt and tt.key and tt.key==ttName) then return end -- don't override other LibQTip tooltips... local doHide = { ["join"] = ns.profile[name].hideJoin==true, ["quit"] = ns.profile[name].hideLeave==true, ["invite"] = ns.profile[name].hideInvite==true, ["promote"] = ns.profile[name].hidePromote==true, ["demote"] = ns.profile[name].hideDemote==true, ["remove"] = ns.profile[name].hideRemove==true } local limit,nolimit,tLimit = tonumber(ns.profile[name].max_entries),false; tLimit = limit; if (limit==0) then limit = #logs; nolimit=true; end if (limit > #logs) then limit = #logs; end if tt.lines~=nil then tt:Clear(); end if (ns.profile[name].displayMode=="NORMAL") then local l=tt:AddHeader(C("dkyellow",L[name])); if(not nolimit)then tt:SetCell(l,2,C("dkyellow","(" .. L["latest %d entries"]:format(tLimit) .. ")"),nil,"RIGHT",ttColumns-1); end l=nil; tt:AddSeparator(4,0,0,0,0); tt:AddLine( C("ltblue",L["Action"]), C("ltblue",CHARACTER), C("ltblue",L["By"]), C("ltblue",L["Recently"]) ); tt:AddSeparator(); for num=1, limit do if (not doHide[logs[num].type]) then local act = type2locale[logs[num].type]; if (logs[num].type=="promote" or logs[num].type=="demote") then act = act .. " ("..logs[num].rank..")"; end local Name,Realm,_ = strsplit("-", logs[num].char ,2); local byName,byRealm; if logs[num].by then byName,byRealm = strsplit("-", logs[num].by ,2); end tt:AddLine( act, Name .. ns.showRealmName(name,Realm), (byName) and byName .. ns.showRealmName(name,byRealm) or "", logs[num].recent ); end end elseif (ns.profile[name].displayMode=="SPLIT") then local actions,_ = {"invite","join","promote","demote","remove","quit"}; tt:AddHeader(C("dkyellow",L[name])); for _,action in ipairs(actions) do if (not doHide[action]) then tt:AddSeparator(4,0,0,0,0); tt:AddHeader(type2locale[action] .. ((not nolimit) and " ("..L["latest %d entries"]:format(tLimit)..")" or "")); if (action=="demote") or (action=="promote") then tt:AddLine( C("ltblue",CHARACTER), C("ltblue",L["By"]), C("ltblue",L["New rank"]), C("ltblue",L["Recently"]) ); else tt:AddLine( C("ltblue",CHARACTER), (action~="quit" and action~="join") and C("ltblue",L["By"]) or "", "", C("ltblue",L["Recently"]) ); end tt:AddSeparator(); local c = 0; for num=1, #logs do if (logs[num].type==action) and (c