Pretty simple really. All you have to do is define a table to hold the log, save it in the savevariables then add log entries as it writes them to chat. Then when you log off it will save the log as well. (So you will have to log off to view the log.
So first, where it does it's own savevariables, we do our own. There are 3 but I think the one in AdvCombatLog_VerCheck is enough. It is at about line 34 in AdvCombatLogFunction.lua
Code: Select all
function AdvCombatLog_VerCheck()
local flag = false;
if (not AdvCombatLog_Config) then
AdvCombatLog_Config = AdvCombatLog_ConfigDefault;
end
if (tonumber(AdvCombatLog_Config["ver"]) < tonumber(ACL_VERSION)) then
if (tonumber(AdvCombatLog_Config["ver"]) < tonumber(0.45)) then
AdvCombatLog_Config = AdvCombatLog_ConfigDefault;
elseif (tonumber(AdvCombatLog_Config["ver"]) < tonumber(0.46)) then
AdvCombatLog_Config["order"] = AdvCombatLog_ConfigDefault["order"];
end
AdvCombatLog_Config["ver"] = ACL_VERSION;
flag = true;
end
SaveVariables("AdvCombatLog_Config");
if (flag) then
DEFAULT_CHAT_FRAME:AddMessage(string.format(AdvCombatLog_Lang_UP.."|r", "|cffffffff"..ACL_ADDON_NAME.."|r|cff00ccf"), 255, 255, 255);
end
return;
end
Near the end of that function, just before the 'return' add
Code: Select all
AdvCombatLog_Log = {}
SaveVariablesPerCharacter(AdvCombatLog_Log)
Note: I'm using the per character savevariables because the main savevariables can get quite large and cumbersome to search through.
Now I have to find where it writes the chat message and save it. Looks like what it does is on the CHAT_MSG_COMBAT event it intercepts 'arg1' (the message), re-formats it, and saves it back to 'arg1' and leaves it to the system to write it to chat.
The end of AdvCombatLog.lua looks like this.
Code: Select all
elseif (event == "CHAT_MSG_COMBAT") then
if (ACL_LOADED) then
if (AdvCombatLog_Config["options"][1] and arg1 ~= nil) then
local aclarg = arg1;
local i;
local n = 0;
aclarg = string.gsub(aclarg, "|r", "");
aclarg = string.gsub(aclarg, "|c........", "");
for i = 1, table.getn(AdvCombatLogStrings) do
if (string.find(aclarg, AdvCombatLogStrings[i][1])) then
n = i;
break;
end
end
if (n ~= 0) then
if (AdvCombatLog_Config["options"][4]) then
aclarg = AdvCombatLog_ShortLog(aclarg, n);
else
aclarg = AdvCombatLog_NormalLog(aclarg, n)
end
local lbr = AdvCombatLog_Config["options"][5][1];
local rbr = AdvCombatLog_Config["options"][5][2];
if (ACL_ENTIME) then
if (AdvCombatLog_Config["options"][2]) then
local TS = AdvCombatLog_Config["colors"][7];
TS = AdvCombatLog_RGBToHex(TS["r"], TS["g"], TS["b"]);
aclarg = lbr.."|cff"..TS..os.date(AdvCombatLog_Config["options"][3]).."|r"..rbr.." "..aclarg;
end
end
local NT = AdvCombatLog_Config["colors"][1];
arg1 = aclarg;
ACL_Temp = {};
end
end
end
end
end
This is the whole "CHAT_MSG_COMBAT" event handler.
You need to add
Code: Select all
table.insert(AdvCombatLog_Log, aclarg)
I think the best place is just after it strips the link formating and before it adds it's own formatting so you get the cleanest log entry. So just after these 2 line.
Code: Select all
aclarg = string.gsub(aclarg, "|r", "");
aclarg = string.gsub(aclarg, "|c........", "");
We could also add an option to switch it on or off if you like so it doesn't log every battle. Let me know if you want that.
Note: this has not been tested. Hope it works.