/trunk
Thanks To: |
Jay for testing |
Atlas by Razark for the minimap icon code that was lifted |
Everyone who commented and voted for the mod on curse-gaming.com |
]] |
local AceConfigDialog = LibStub("AceConfigDialog-3.0") |
local AceConfig = LibStub("AceConfig-3.0") |
-- Create a short cut |
local SC = Accountant |
SC.data = nil; |
SC.MaxRows = 15 -- Per the rows implemented in the XML |
--Accountant_Disabled = false; |
SC.mode = ""; |
SC.refund_mode = ""; |
--Accountant_MailIndex = ""; |
SC.sender = ""; |
SC.current_money = 0; |
SC.last_money = 0; |
local Accountant_CursorHasItem_old; |
local tmpstr = ""; |
SC.show_events = false -- could generate a lot of output! |
function SC.TableContainsValue(table, value) |
if table and value then |
local i,v |
for i, v in pairs(table) do |
if v == value then |
return i; |
end |
end |
end |
return nil |
end |
--[[ |
AccountantButton.lua |
function SC.ClearData () |
-- |
-- Clear all data all modes |
-- |
for player in next,Accountant_SaveData do |
for key,value in next,SC.data do |
if Accountant_SaveData[player]["data"][key] == nil then |
Accountant_SaveData[player]["data"][key] = {} |
end |
for modekey,mode in next,SC.log_modes do |
Accountant_SaveData[player]["data"][key][mode] = {In=0,Out=0} |
SC.data[key][mode] = {In=0,Out=0} |
end |
end |
end |
end |
function SC.UtilToonDropDownList (realm) |
-- |
-- Initialize the toon dropdown |
-- |
local faction = "" |
local strtmp = "" |
local toon_table = {} |
for player in next,Accountant_SaveData do |
if realm then |
strtmp = player |
else |
local str_pos = strfind(player, "-") |
strtmp = strsub(player, str_pos+1) -- remove the realm and dash |
end |
table.insert(toon_table, strtmp) |
--DEFAULT_CHAT_FRAME:AddMessage("Acc ToonDropDownList- "..(strtmp or "?").." .. " ..(player or "?")) |
end |
table.sort(toon_table) |
SC.AllToons = toon_table |
return toon_table |
end |
function SC.ToonDelete (toon_value) |
-- |
-- Remove the data of the selected toon |
-- |
local pop_str = "" |
for i = 1, #SC.AllToons do |
if i == toon_value then |
if SC.AllToons[i] == SC.player then |
DEFAULT_CHAT_FRAME:AddMessage(ACCLOC_TITLE..": "..ACCLOC_TOON_DELETE_SELF) |
else |
pop_str = SC.AllToons[i] |
-- delete the data |
Accountant_SaveData[SC.AllToons[i]] = nil; |
-- remove the toon from the options dropdown |
table.remove(SC.AllToons, i) |
-- just in case, rebuild Accountant |
SC.OnLoad() |
DEFAULT_CHAT_FRAME:AddMessage(ACCLOC_TITLE..": "..ACCLOC_TOON_DELETE_DONE |
..(pop_str or "?").." "..ACCLOC_DONE) |
end |
end |
end |
end |
function SC.ToonMerge (from, to) |
-- |
-- Merge the data of the selected toons |
-- |
if from == to then |
DEFAULT_CHAT_FRAME:AddMessage(ACCLOC_TITLE..": "..ACCLOC_TOON_MERGE_ERR1) |
else |
for key,value in next,SC.data do |
for modekey,mode in next,SC.log_modes do |
if Accountant_SaveData[to]["data"][key][mode] == nil then |
Accountant_SaveData[to]["data"][key][mode] = {In=0,Out=0}; |
end |
Accountant_SaveData[to]["data"][key][mode].In = |
(tonumber(Accountant_SaveData[to]["data"][key][mode].In) or 0) |
+ (tonumber(Accountant_SaveData[from]["data"][key][mode].In) or 0) |
Accountant_SaveData[to]["data"][key][mode].Out = |
(tonumber(Accountant_SaveData[to]["data"][key][mode].Out) or 0) |
+ (tonumber(Accountant_SaveData[from]["data"][key][mode].Out) or 0) |
end |
end |
Accountant_SaveData[to]["options"]["totalcash"] = |
(tonumber(Accountant_SaveData[to]["options"]["totalcash"]) or 0) |
+ (tonumber(Accountant_SaveData[from]["options"]["totalcash"]) or 0) |
if to == SC.player then |
-- Reload the data for this toon |
SC.LoadData() |
end |
DEFAULT_CHAT_FRAME:AddMessage(ACCLOC_TITLE..": "..ACCLOC_TOON_MERGE.." of " |
..(from or "?").." "..ACCLOC_TO.." "..(to or "?").." "..ACCLOC_DONE) |
end |
end |
--[[ AccountantButton.lua |
Declare the minimap button routines for Accountant |
]] |
function SC.Button_OnClick() |
-- |
-- Toggle the Accountant window on click of the mini-map button |
-- |
function SC.Button_OnClick() |
if AccountantFrame:IsVisible() then |
HideUIPanel(AccountantFrame); |
else |
end |
function SC.Button_makename() |
-- |
-- Create the name so the right data can be looked up. |
-- Create the name so the right Accountnat data can be looked up. |
-- |
function SC.Button_makename() |
acc_realm = GetRealmName(); |
acc_name = acc_realm.."-"..UnitName("player"); |
return acc_name; |
end |
function SC.Button_Init() |
-- |
-- On start, show or hide the mini-map button based on the user's selection |
-- for that character. |
-- |
function SC.Button_Init() |
if(Accountant_SaveData[SC.Button_makename()]["options"].showbutton) then |
AccountantButtonFrame:Show(); |
else |
end |
end |
function SC.Button_Toggle() |
-- |
-- Honor the user's selection to show or hide the mini-map button |
-- Honor the user's selection to show or hide the min-map button |
-- for that character. |
-- |
function SC.Button_Toggle() |
if(AccountantButtonFrame:IsVisible()) then |
AccountantButtonFrame:Hide(); |
Accountant_SaveData[SC.Button_makename()]["options"].showbutton = false; |
end |
end |
function SC.Button_UpdatePosition() |
-- |
-- Place the mini-map button where the user selects for that character. |
-- |
function SC.Button_UpdatePosition() |
AccountantButtonFrame:SetPoint( |
"TOPLEFT", |
"Minimap", |
end |
--[[ AccountantButton.lua end |
--[[ |
AccountantButton.lua end |
]] |
--[[ AccountantOptions.lua begin |
--[[ |
AccountantOptions.lua begin |
]] |
local acc_main_options = { |
name = "Accountant", |
type = "group", |
args = |
{ |
confgendesc = |
{ |
order = 1, |
type = "description", |
name = ACCLOC_CONF_DESC.."\n\n", |
cmdHidden = true |
}, |
nulloption1 = |
{ |
order = 2, |
type = "description", |
name = " ", |
cmdHidden = true |
}, |
confshowtotal = |
{ |
name = "Show total on button (LDB)", |
--ACCLOC_TOG_MINIMAP, |
desc = "If checked the total will be shown on the LDB button", |
--ACCLOC_TOG_MINIMAP_DESC, |
order = 3, |
type = "toggle", width = "full", |
get = function() return Accountant_SaveData[Accountant.player]["options"].showtotal end, |
set = function() SC.ShowTotalLDB() end, |
}, |
nulloption2 = |
{ |
order = 3, |
type = "description", |
name = " ", |
cmdHidden = true |
}, |
nulloption3 = |
{ |
order = 4, |
type = "description", |
name = " ", |
cmdHidden = true |
}, |
confinfodesc = |
{ |
name = "About", |
order = 50, |
type = "group", inline = true, |
args = |
{ |
confversiondesc = |
{ |
order = 1, |
type = "description", |
name = SC.GREEN_COLOR.."Version"..": "..SC.GOLD_COLOR..SC.Version, |
cmdHidden = true |
}, |
confauthordesc = |
{ |
order = 2, |
type = "description", |
name = SC.GREEN_COLOR.."Version"..": "..SC.GOLD_COLOR..SC.AUTHOR, |
cmdHidden = true |
}, |
}, |
}, |
} |
} |
local acc_options_minimap = { |
name = "Accountant_options_minimap", |
type = "group", |
args = { |
confdesc = { |
order = 1, |
type = "description", |
name = ACCLOC_CONF_GEN_DESC.."\n", |
cmdHidden = true |
}, |
nulloption3 = { |
order = 2, |
type = "description", |
name = " ", |
cmdHidden = true |
}, |
--[[ |
toggleminimapbuttonheader = { |
order = 3, |
type = "header", |
name = ACCLOC_MINIMAP_BUT, |
}, |
--]] |
toggleminimapbutton = |
{ |
name = ACCLOC_TOG_MINIMAP, |
desc = ACCLOC_TOG_MINIMAP_DESC, |
order = 4, type = "toggle", width = "full", |
get = function() return Accountant_SaveData[Accountant.player]["options"].showbutton end, |
set = function() SC.Button_Toggle() end, |
}, |
minimapbuttonpos = { |
name = ACCLOC_POS_MINIMAP, |
desc = ACCLOC_POS_MINIMAP_DESC, |
order = 5, type = "range", width = "full", |
min = 0, max = 360, step = 1, |
get = function() return Accountant_SaveData[Accountant.player]["options"].buttonpos end, |
set = function(_, a) |
Accountant_SaveData[Accountant.player]["options"].buttonpos = a |
Accountant.Button_UpdatePosition() |
end, |
}, |
nulloption4 = { |
order = 6, |
type = "description", |
name = " ", |
cmdHidden = true |
}, |
} |
} |
-- |
-- Show / hide the options window when the user clicks the Options button |
-- |
function Accountant.Options_Toggle() |
if(AccountantOptionsFrame:IsVisible()) then |
AccountantOptionsFrame:Hide(); |
else |
AccountantOptionsFrame:Show(); |
end |
end |
local acc_options_start = { |
name = "Accountant_options_start", |
type = "group", |
args = { |
confdesc = { |
order = 1, |
type = "description", |
name = ACCLOC_STARTWEEK_DESC.."\n", |
cmdHidden = true |
}, |
nulloption3 = { |
order = 2, |
type = "description", |
name = " ", |
cmdHidden = true |
}, |
--[[ |
weekstartheader = { |
order = 3, |
type = "header", |
name = ACCLOC_STARTWEEK, |
}, |
--]] |
weekstartselect = |
{ |
name = ACCLOC_WEEKDAY, |
desc = ACCLOC_WEEKDAY_DESC, |
order = 4, type = "select", |
get = function() return Accountant_SaveData[Accountant.player]["options"].weekstart end, |
set = function(_,v) |
Accountant_SaveData[Accountant.player]["options"].weekstart = v |
DEFAULT_CHAT_FRAME:AddMessage(ACCLOC_TITLE..": " |
..ACCLOC_WEEKDAY_DONE.." "..(v or "?").." "..ACCLOC_DONE) |
for player in next,Accountant_SaveData do |
Accountant_SaveData[player]["options"].weekstart = v; |
end |
end, |
values = function() |
return {ACCLOC_WD_SUN,ACCLOC_WD_MON,ACCLOC_WD_TUE, |
ACCLOC_WD_WED,ACCLOC_WD_THU,ACCLOC_WD_FRI,ACCLOC_WD_SAT} |
end, |
}, |
nulloption4 = { |
order = 6, |
type = "description", |
name = " ", |
cmdHidden = true |
}, |
} |
} |
-- |
-- Create the options window frame on load |
-- |
function Accountant.Options_OnLoad() |
UIPanelWindows['AccountantOptionsFrame'] = {area = 'center', pushable = 0}; |
end |
local acc_options_reset = { |
name = "Accountant_options_reset", |
type = "group", |
args = { |
confdesc = { |
order = 1, |
type = "description", |
name = ACCLOC_RESET_DESC.."\n", |
cmdHidden = true |
}, |
nulloption3 = { |
order = 2, |
type = "description", |
name = " ", |
cmdHidden = true |
}, |
reset = { |
order = 5, type = "execute", |
name = ACCLOC_RESET, |
desc = ACCLOC_RESET_DESC_SHORT, |
func = function() |
SC.ClearData (); |
DEFAULT_CHAT_FRAME:AddMessage(ACCLOC_TITLE..": "..ACCLOC_RESET.." "..ACCLOC_DONE) |
end, |
}, |
nulloption4 = { |
order = 6, |
type = "description", |
name = " ", |
cmdHidden = true |
}, |
} |
} |
local remove_toon = "" |
local ignore_toon = "" |
local merge_toon_from = "" |
local merge_toon_from_name = "" |
local merge_toon_to = "" |
local merge_toon_to_name = "" |
local acc_options_toons_remove = { |
name = "Accountant_Toon_Remove", |
type = "group", |
args = { |
confdesc = { |
order = 1, |
type = "description", |
name = ACCLOC_TOON_MGMT_2, |
cmdHidden = true |
}, |
-- delete / remove |
setskinheader = { |
order = 10, |
type = "header", |
name = ACCLOC_TOON_DELETE, |
}, |
deltoonlist = { |
order = 11, type = "select", width = "full", |
name = ACCLOC_TOON, |
desc = ACCLOC_TOON_REMOVE_DESC, |
get = function() return remove_toon; end, |
set = function(_,v) remove_toon = v; end, |
values = function() return SC.AllToons end, |
}, |
deltoon = { |
order = 12, type = "execute", |
name = ACCLOC_TOON_DELETE, |
desc = ACCLOC_TOON_DELETE_DESC, |
func = function() |
SC.ToonDelete (remove_toon); |
remove_toon = ""; |
end, |
}, |
delnotes = { |
order = 13, |
type = "description", |
name = ACCLOC_TOON_REMOVE_NOTES, |
cmdHidden = true |
}, |
--[[ |
-- ignore |
nulloption01 = { |
order = 5, |
type = "description", |
name = " ", |
cmdHidden = true |
}, |
setskinheaderignore = { |
order = 10, |
type = "header", |
name = ACCLOC_TOON_IGNORE, |
}, |
ignoretoonlist = { |
order = 11, type = "select", width = "full", |
name = ACCLOC_TOON, |
desc = ACCLOC_TOON_IGNORE_DESC, |
get = function() return ignore_toon end, |
set = function(_,v) ignore_toon = v; end, |
values = function() return SC.AllToons; end, |
}, |
ignoretoon = { |
order = 12, type = "execute", |
name = ACCLOC_TOON_IGNORE, |
desc = ACCLOC_TOON_IGNORE_DESC, |
func = function() |
DEFAULT_CHAT_FRAME:AddMessage(ACCLOC_TOON_IGNORE.." "..(ignore_toon or "?").." "); |
--SC.ToonDelete (ignore_toon); |
end, |
}, |
--]] |
nulloption1 = { |
order = 50, |
type = "description", |
name = " ", |
cmdHidden = true |
}, |
} |
} |
-- |
-- Draw the options window frame when requested |
-- |
function Accountant.Options_OnShow() |
AccountantOptionsFrameToggleButtonText:SetText(ACCLOC_MINIBUT); |
AccountantSliderButtonPosText:SetText(ACCLOC_BUTPOS); |
AccountantOptionsFrameWeekLabel:SetText(ACCLOC_STARTWEEK); |
local acc_options_toons_merge = { |
name = "Accountant_Toon_Merge", |
type = "group", |
args = { |
confdesc = { |
order = 1, |
type = "description", |
name = ACCLOC_TOON_MGMT_2, |
cmdHidden = true |
}, |
-- merge |
nulloption02 = { |
order = 19, |
type = "description", |
name = " ", |
cmdHidden = true |
}, |
setskinheadermerge = { |
order = 20, |
type = "header", |
name = ACCLOC_TOON_MERGE, |
}, |
mergetoonfromlist = { |
order = 21, type = "select", width = "full", |
name = ACCLOC_TOON_FROM, |
desc = ACCLOC_TOON_FROM_DESC, |
get = function() return merge_toon_from end, |
set = function(info, value) |
merge_toon_from = value; |
for i = 1, #SC.AllToons do |
if i == value then |
-- save the name |
merge_toon_from_name = SC.AllToons[i] |
end |
end |
--DEFAULT_CHAT_FRAME:AddMessage(ACCLOC_TOON_MERGE.." from "..(value or "?").." "..(merge_toon_from_name or "?")); |
end, |
values = function() return SC.AllToons; end, |
}, |
mergetoontolist = { |
order = 22, type = "select", width = "full", |
name = ACCLOC_TOON_TO, |
desc = ACCLOC_TOON_TO_DESC, |
get = function() return merge_toon_to end, |
set = function(_,value) |
merge_toon_to = value; |
for i = 1, #SC.AllToons do |
if i == value then |
-- save the name |
merge_toon_to_name = SC.AllToons[i] |
end |
end |
--DEFAULT_CHAT_FRAME:AddMessage(ACCLOC_TOON_MERGE.." to "..(value or "?").." "..(merge_toon_to_name or "?")); |
end, |
values = function() return SC.AllToons; end, |
}, |
mergetoon = { |
order = 23, type = "execute", |
name = ACCLOC_TOON_MERGE, |
desc = ACCLOC_TOON_MERGE_NOTES1, |
func = function() |
SC.ToonMerge (merge_toon_from_name, merge_toon_to_name); |
end, |
}, |
mergenotes2 = { |
order = 25, |
type = "description", |
name = ACCLOC_TOON_MERGE_NOTES2, |
cmdHidden = true |
}, |
nulloption1 = { |
order = 50, |
type = "description", |
name = " ", |
cmdHidden = true |
}, |
} |
} |
AccountantOptionsFrameToggleButton:SetChecked(Accountant_SaveData[Accountant.player]["options"].showbutton); |
local acc_options_transparency = { |
name = "Accountant_options_transparency", |
type = "group", |
args = { |
confdesc = { |
order = 1, |
type = "description", |
name = ACCLOC_TRANSP_DESC.."\n", |
cmdHidden = true |
}, |
bartrans = { |
name = ACCLOC_TRANSP, |
desc = ACCLOC_TRANSP_DESC, |
order = 2, type = "range", width = "full", |
min = 0, max = 1, step = 0.01, |
get = function() return (Accountant_SaveData[Accountant.player]["options"].transparancy or 1) end, |
set = function(_, trans) |
AccountantFrame.AccountantFrameBackdrop:SetAlpha(trans); |
Accountant_SaveData[Accountant.player]["options"].transparancy = trans; |
end, |
}, |
} |
} |
AccountantSliderButtonPos:SetValue(Accountant_SaveData[Accountant.player]["options"].buttonpos); |
UIDropDownMenu_Initialize(AccountantOptionsFrameWeek, |
function () SC.OptionsFrameWeek_Init () end); |
UIDropDownMenu_SetSelectedID(AccountantOptionsFrameWeek, Accountant_SaveData[Accountant.player]["options"].weekstart); |
end |
function Accountant.Options_OnHide() |
if(MYADDONS_ACTIVE_OPTIONSFRAME == this) then |
ShowUIPanel(myAddOnsFrame); |
end |
end |
-- |
-- Create the structures for the options screens |
-- The Blizz options screens will be used |
-- Create the week start options window frame on load |
-- |
function SC.InitOptions() |
-- Create the dropdown used in the options |
SC.UtilToonDropDownList (true) |
AceConfig:RegisterOptionsTable("Accountant Main", acc_main_options) |
AceConfig:RegisterOptionsTable("Accountant Minimap", acc_options_minimap) |
AceConfig:RegisterOptionsTable("Accountant Transparancy", acc_options_transparency) |
AceConfig:RegisterOptionsTable("Accountant Week Start", acc_options_start) |
AceConfig:RegisterOptionsTable("Accountant Toon Remove", acc_options_toons_remove) |
AceConfig:RegisterOptionsTable("Accountant Toon Merge", acc_options_toons_merge) |
AceConfig:RegisterOptionsTable("Accountant Reset", acc_options_reset) |
AceConfigDialog:AddToBlizOptions("Accountant Main", ACCLOC_TITLE, nil) |
AceConfigDialog:AddToBlizOptions("Accountant Minimap", ACCLOC_MINIMAP_BUT, ACCLOC_TITLE) |
-- AceConfigDialog:AddToBlizOptions("Accountant Transparancy", ACCLOC_TRANSPARANCY, ACCLOC_TITLE) |
AceConfigDialog:AddToBlizOptions("Accountant Week Start", ACCLOC_STARTWEEK, ACCLOC_TITLE) |
AceConfigDialog:AddToBlizOptions("Accountant Toon Remove", ACCLOC_TOON_REMOVE, ACCLOC_TITLE) |
AceConfigDialog:AddToBlizOptions("Accountant Toon Merge", ACCLOC_TOON_MERGE_T, ACCLOC_TITLE) |
AceConfigDialog:AddToBlizOptions("Accountant Reset", ACCLOC_RESET, ACCLOC_TITLE) |
function Accountant.OptionsFrameWeek_Init() |
local info; |
Accountant_DayList = {ACCLOC_WD_SUN,ACCLOC_WD_MON,ACCLOC_WD_TUE,ACCLOC_WD_WED,ACCLOC_WD_THU,ACCLOC_WD_FRI,ACCLOC_WD_SAT}; |
for i = 1, getn(Accountant_DayList), 1 do |
info = { }; |
info.text = Accountant_DayList[i]; |
info.func = function () SC.OptionsFrameWeek_OnClick () end; |
UIDropDownMenu_AddButton(info); |
end |
end |
--[[ AccountantOptions.lua end |
-- |
-- Draw the week start options window frame when requested |
-- |
function Accountant.OptionsFrameWeek_OnClick() |
UIDropDownMenu_SetSelectedID(AccountantOptionsFrameWeek, this:GetID()); |
-- Set all chars to the same weekstart |
for player in next,Accountant_SaveData do |
Accountant_SaveData[player]["options"].weekstart = this:GetID(); |
end |
end |
--[[ |
AccountantOptions.lua end |
--]] |
--[[ Data Broker section begin |
--[[ |
Data Broker section begin |
]] |
-- Set the LDB framework for the other LDB routines |
SC.LDB_frame = CreateFrame("Frame") |
SC.LDB_frame.obj = {} |
function SC:LDB_Init() |
-- |
-- Initialize the Data Broker 'button' |
-- |
function SC:LDB_Init() |
SC.LDB_frame.obj = |
LibStub("LibDataBroker-1.1"):NewDataObject("Accountant_LDB", { |
type = "data source", |
icon = SC.artwork_path.."AccountantButton.blp", |
label = "Accountant_", |
text = "nyl", |
type = "data source", |
icon = "Interface\\AddOns\\Accountant\\AccountantButton.blp", |
label = "Accountant_", |
text = "nyl", |
OnClick = function(self, button) |
if ( button == "LeftButton" ) then |
Accountant.Button_OnClick(); |
elseif ( button == "RightButton" ) then |
end |
end, |
OnClick = function(self, button) |
if ( button == "LeftButton" ) then |
Accountant.Button_OnClick(); |
elseif ( button == "RightButton" ) then |
end |
end, |
OnTooltipShow = function(tooltip) |
SC.LDB_OnTooltipShow(tooltip) |
end, |
}) |
OnTooltipShow = function(tooltip) |
SC.LDB_OnTooltipShow(tooltip) |
end, |
}) |
end |
function SC:LDB_Update() |
-- |
-- Update the Accountant Data Broker 'button' |
-- Update the Data Broker 'button' |
-- Used by Accountant |
-- |
local TotalIn = 0 |
local TotalOut = 0 |
function SC:LDB_Update() |
local TotalIn = 0 |
local TotalOut = 0 |
local mode = "<nyl>" |
local total = 0 |
local total_str = "" |
if SC.current_tab ~= 5 then |
TotalIn, TotalOut = |
SC.GetDetailForToons(SC.log_modes[SC.current_tab], false) |
if SC.current_tab ~= 5 then |
TotalIn, TotalOut = |
SC.GetDetailForToons(SC.log_modes[SC.current_tab], false) |
cash = TotalIn-TotalOut |
mode = SC.log_modes_short[SC.current_tab] |
total = SC.GetCashForToons() |
else |
cash = SC.GetCashForAllToons(false) |
else |
cash = SC.GetCashForAllToons(false) |
mode = ACCLOC_CHARS |
end |
if Accountant_SaveData[SC.Button_makename()]["options"].showtotal then |
total_str = SC.NiceCash(total, true, true).." : " |
end |
SC.LDB_frame.obj.text = |
total_str -- rely on the text setup for spacing |
.."|cFFF5B800"..mode..FONT_COLOR_CODE_CLOSE |
.." "..SC.NiceCash(cash, true, true) |
end |
SC.LDB_frame.obj.text = |
"|cFFF5B800"..mode..FONT_COLOR_CODE_CLOSE |
.." "..SC.NiceNetCash(cash) |
end |
function SC.LDB_OnTooltipShow(tooltip) |
-- |
-- Display the Data Broker tooltip |
-- A Data Broker display addon will use this routine |
-- |
function SC.LDB_OnTooltipShow(tooltip) |
--Accountant.Button_OnClick() |
tooltip = tooltip or GameTooltip |
local tt_str = "" |
local tt_str = "" |
local strtmp = "" |
if SC.show_toons == ACCLOC_CHARS then |
strtmp = ACCLOC_CHARS |
local str_pos = strfind(SC.show_toons, "-") |
strtmp = strsub(SC.show_toons, str_pos+1) -- remove the realm and dash |
end |
tt_str = |
GREEN_FONT_COLOR_CODE |
..strtmp |
.."\n"..FONT_COLOR_CODE_CLOSE |
tooltip:AddLine(tt_str) |
tt_str = |
GREEN_FONT_COLOR_CODE |
..strtmp |
-- ..ACCLOC_TITLE |
-- .." ("..SC.Version..")" |
.."\n"..FONT_COLOR_CODE_CLOSE |
tooltip:AddLine(tt_str) |
-- |
SC.LDB_GetTooltipDetail(tooltip) |
tt_str = " " |
tooltip:AddLine(tt_str) |
tt_str = |
GREEN_FONT_COLOR_CODE |
..ACCLOC_LCLICK |
.." "..BINDING_NAME_ACCOUNTANTTOG |
..FONT_COLOR_CODE_CLOSE; |
tooltip:AddLine(tt_str) |
--]] |
tt_str = |
GREEN_FONT_COLOR_CODE |
..ACCLOC_RCLICK |
.." "..BINDING_NAME_ACCOUNTANTTOG |
..FONT_COLOR_CODE_CLOSE; |
tooltip:AddLine(tt_str) |
--]] |
end |
function SC.LDB_GetTooltipDetail(tooltip) |
-- |
-- get the detail of user selected toons for the requested mode |
-- |
local TotalRowIn |
local TotalRowOut |
local TotalIn = 0 |
local TotalOut = 0 |
local mode = "" |
local tt_str = "" |
local tmpstr = "" |
function SC.LDB_GetTooltipDetail(tooltip) |
local TotalRowIn |
local TotalRowOut |
local TotalIn = 0 |
local TotalOut = 0 |
local mode = "" |
local tt_str = "" |
local tmpstr = "" |
if SC.current_tab == 5 then |
return; |
end |
mode = SC.log_modes[SC.current_tab]; |
for key,value in next,SC.data do |
TotalRowIn = 0; |
TotalRowOut = 0; |
for key,value in next,SC.data do |
TotalRowIn = 0; |
TotalRowOut = 0; |
for player in next,Accountant_SaveData do |
for player in next,Accountant_SaveData do |
-- Find the one player or all players of the faction(s) requested |
faction = Accountant_SaveData[player]["options"]["faction"] |
if (string.find(player, SC.Realm) ~= nil) |
and (( (faction == ACCLOC_ALLIANCE) |
if (string.find(player, SC.Realm) ~= nil) |
and (( (faction == ACCLOC_ALLIANCE) |
and (SC.ShowAlliance == true) ) |
or ( (faction == ACCLOC_HORDE) |
or ( (faction == ACCLOC_HORDE) |
and (SC.ShowHorde == true) )) |
and ( SC.show_toons == player |
and ( SC.show_toons == player |
or SC.show_toons == SC.AllDropdown ) then |
--DEFAULT_CHAT_FRAME:AddMessage("AccLDB tip: " |
-- .." In:"..Accountant_SaveData[player]["data"][key][mode].In |
-- .." Out:"..Accountant_SaveData[player]["data"][key][mode].Out |
-- ) |
TotalRowIn = TotalRowIn + Accountant_SaveData[player]["data"][key][mode].In; |
TotalRowIn = TotalRowIn + Accountant_SaveData[player]["data"][key][mode].In; |
TotalRowOut = TotalRowOut + Accountant_SaveData[player]["data"][key][mode].Out; |
TotalRowOut = TotalRowOut + Accountant_SaveData[player]["data"][key][mode].Out; |
end |
end |
end |
tmpstr = key |
--TotalIn = TotalIn + TotalRowIn; |
--TotalOut = TotalOut + TotalRowOut; |
tmpstr = key |
--tmpstr = string.format("%-10s", key) |
--tmpstr = string.sub (key, 1, 2) |
tt_str = "|cFFF5B800"..tmpstr..FONT_COLOR_CODE_CLOSE |
tmpstr = SC.NiceCash((TotalRowIn - TotalRowOut), true, true) |
tooltip:AddDoubleLine(tt_str,tmpstr); |
end |
tt_str = "|cFFF5B800"..tmpstr..FONT_COLOR_CODE_CLOSE |
tmpstr = SC.NiceFormatCash((TotalRowIn - TotalRowOut)) |
--[[ |
if TotalRowIn - TotalRowOut > 0 then |
tmpstr = SC.NiceFormatCash(TotalRowIn - TotalRowOut).." " |
elseif TotalRowIn - TotalRowOut < 0 then |
tmpstr = "("..SC.NiceFormatCash((TotalRowIn - TotalRowOut)*-1)..")" |
else -- 0 |
tmpstr = " " |
end |
tmpstr = string.format("%13s", tmpstr) |
--]] |
tooltip:AddDoubleLine(tt_str,tmpstr); |
end |
end |
--[[ |
function SC.LDB_OnEvent(self, event, ...) |
if ( event == "PLAYER_MONEY" ) then |
DEFAULT_CHAT_FRAME:AddMessage("AccLDB OnEvent: "..event |
.." $:"..Accountant_GetCurrentBal(ACCLOC_TOTAL,1) |
) |
SC.LDB_frame.obj.text = Accountant_GetCurrentBal(ACCLOC_TOTAL, |
1) |
return; |
end |
end |
--]] |
--[[ Data Broker section end |
--[[ |
Data Broker section end |
]] |
--[[ Accountant.lua begin |
--[[ |
Accountant.lua begin |
]] |
function SC.RegisterEvents() |
-- |
-- Register for all the events needed to track the flow of gold |
-- |
function SC.RegisterEvents() |
this:RegisterEvent("MERCHANT_SHOW"); |
this:RegisterEvent("MERCHANT_CLOSED"); |
this:RegisterEvent("MERCHANT_UPDATE"); |
this:RegisterEvent("PLAYER_MONEY"); |
this:RegisterEvent("UNIT_NAME_UPDATE"); |
this:RegisterEvent("PLAYER_ENTERING_WORLD"); |
this:RegisterEvent("PLAYER_LEAVING_WORLD"); |
this:RegisterEvent("PLAYER_ENTERING_WORLD"); |
this:RegisterEvent("PLAYER_LEAVING_WORLD"); |
this:RegisterEvent("UPDATE_INVENTORY_ALERTS"); |
this:RegisterEvent("UPDATE_INVENTORY_DURABILITY"); |
end |
--[[ |
-- |
-- Create the list of toons to use |
-- |
function Accountant.ToonFrame_Init() |
local info; |
Accountant_DayList = {ACCLOC_WD_SUN,ACCLOC_WD_MON,ACCLOC_WD_TUE,ACCLOC_WD_WED,ACCLOC_WD_THU,ACCLOC_WD_FRI,ACCLOC_WD_SAT}; |
for i = 1, getn(Accountant_DayList), 1 do |
info = { }; |
info.text = Accountant_DayList[i]; |
info.func = function () SC.ToonFrame_OnClick () end; |
UIDropDownMenu_AddButton(info); |
end |
end |
function SC.SetLabels() |
-- |
-- Select the one to use |
-- |
function Accountant.ToonFrame_OnClick() |
UIDropDownMenu_SetSelectedID(AccountantFrameToon, this:GetID()); |
end |
--]] |
-- |
-- Create the various labels and headers for the Accountant frame |
-- |
function SC.SetLabels() |
-- For those that add / delete toons, clear the all rows. |
for i = 1, SC.MaxRows, 1 do |
getglobal("AccountantFrameRow"..i.."Title"):SetText(""); |
AccountantFrameHordeToggleButtonText:SetText(ACCLOC_HORDE); |
AccountantFrameHordeToggleButton:SetChecked(Accountant_SaveData[Accountant.player]["options"].showHorde); |
-- Set the header |
local name = this:GetName(); |
local header = getglobal("AccountantFrameTitleText"); |
if ( header ) then |
header:SetText(ACCLOC_TITLE.." "..SC.Version); |
end |
if SC.current_tab == 5 then |
AccountantFrameSource:SetText(ACCLOC_CHARCAP); |
if SC.current_tab == 5 then |
AccountantFrameSource:SetText(ACCLOC_CHAR); |
AccountantFrameIn:SetText(ACCLOC_MONEY); |
AccountantFrameOut:SetText(ACCLOC_UPDATED); |
AccountantFrameTotalIn:SetText(""); |
AccountantFrameTotalOutValue:SetText(""); |
AccountantFrameTotalFlowValue:SetText(""); |
--AccountantFrameResetButton:Hide(); |
AccountantFrameCacheBox:Hide() |
AccountantFrameCacheAmount:Hide() |
Accountant_CharDropDown:Hide() |
return; |
end |
Accountant_CharDropDown:Show() |
AccountantFrameCacheBox:Show() |
AccountantFrameCacheAmount:Show() |
AccountantFrameMoneyTotal:SetText("") |
AccountantFrameSource:SetText(ACCLOC_SOURCE); |
getglobal("AccountantFrameRow"..InPos.."Title"):SetText(SC.data[key].Title); |
InPos = InPos + 1; |
end |
-- Set the header |
local name = this:GetName(); |
local header = getglobal("AccountantFrameTitleText"); |
if ( header ) then |
header:SetText(ACCLOC_TITLE.." "..SC.Version); |
end |
end |
function SC.OnLoad() |
-- |
-- Do all the setup needed on load of Accountant |
-- |
function SC.OnLoad() |
SC.Realm = GetRealmName(); |
SC.Char = UnitName("player"); |
SC.Faction = UnitFactionGroup("player") |
-- default behaviour |
SC.show_toons = ACCLOC_CHARS |
-- shamelessly print a load message to chat window |
-- shamelessly print a load message to chat window |
DEFAULT_CHAT_FRAME:AddMessage( |
GREEN_FONT_COLOR_CODE.."Accountant " |
..SC.Version |
.."|cFFFFFF00"..SC.AUTHOR..FONT_COLOR_CODE_CLOSE |
.." for " |
..SC.player |
); |
); |
-- Setup |
SC.LoadData(); |
-- Add myAddOns support |
if myAddOnsList then |
myAddOnsList.Accountant = {name = "Accountant", |
description = "Tracks your revenues / expenditures", |
version = SC.Version, |
frame = "AccountantFrame", |
optionsframe = "AccountantFrame"}; |
myAddOnsList.Accountant = {name = "Accountant", description = "Tracks your revenues / expenditures", version = SC.Version, frame = "AccountantFrame", optionsframe = "AccountantFrame"}; |
end |
-- Create the confirm box to use if needed |
PanelTemplates_SetTab(AccountantFrame, AccountantFrameTab1); |
PanelTemplates_UpdateTabs(AccountantFrame); |
AccountantFrameCacheBox:SetText("Cache Box"..":") --;ACCLOC_NET..":"); |
AccountantFrameCacheUpdate:SetText("Update") |
-- init the data broker 'button' |
SC:LDB_Init() |
SC:LDB_Update() |
end |
function SC.LoadData() |
-- |
-- Load the account data of the character that is being played |
-- |
function SC.LoadData() |
SC.data = {}; |
SC.data["LOOT"] = {Title = ACCLOC_LOOT}; |
SC.data["MERCH"] = {Title = ACCLOC_MERCH}; |
date=cdate, |
weekdate=cweek, |
weekstart=3, |
totalcash=0, |
cachebox = 0, |
showtotal = nil, |
}, |
data={}, |
current_tab=1, |
show_toons = ACCLOC_CHARS, |
}; |
totalcash=0}, |
data={}, |
current_tab=1, |
show_toons = ACCLOC_CHARS}; |
-- Quel's mod: make sure introduction of a new character gets the same weekstart as |
-- Quel's mod: make sure introdudction of a new character gets the same weekstart as |
-- existing chars, otherwise it will prematurely wipe out the weekly totals. |
for player in next,Accountant_SaveData do |
-- Quel's mod: only consider chars on the same server |
if (string.find(player, SC.Realm) ~= nil) then |
if (Accountant_SaveData[player]["options"]["weekstart"] ~= nil) then |
SC.Print2("Adding a new account for new character, " |
..Accountant.player..", weekstart = " |
..Accountant_SaveData[player]["options"]["weekstart"]); |
Accountant_SaveData[Accountant.player]["options"]["weekstart"] |
= Accountant_SaveData[player]["options"]["weekstart"]; |
SC.Print2("Adding a new account for new character, "..Accountant.player..", weekstart = "..Accountant_SaveData[player]["options"]["weekstart"]); |
Accountant_SaveData[Accountant.player]["options"]["weekstart"] = Accountant_SaveData[player]["options"]["weekstart"]; |
end |
if (Accountant_SaveData[player]["options"]["dateweek"] ~= nil) then |
SC.Print2("Adding a new account for new character, " |
..Accountant.player..", dateweek = "..Accountant_SaveData[player]["options"]["dateweek"]); |
Accountant_SaveData[Accountant.player]["options"]["dateweek"] |
= Accountant_SaveData[player]["options"]["dateweek"]; |
SC.Print2("Adding a new account for new character, "..Accountant.player..", dateweek = "..Accountant_SaveData[player]["options"]["dateweek"]); |
Accountant_SaveData[Accountant.player]["options"]["dateweek"] = Accountant_SaveData[player]["options"]["dateweek"]; |
end |
end |
end |
-- Old Version Conversion |
if Accountant_SaveData[Accountant.player]["data"][key].TotalIn ~= nil then |
Accountant_SaveData[Accountant.player]["data"][key]["Total"].In |
= Accountant_SaveData[Accountant.player]["data"][key].TotalIn; |
Accountant_SaveData[Accountant.player]["data"][key]["Total"].In = Accountant_SaveData[Accountant.player]["data"][key].TotalIn; |
SC.data[key]["Total"].In = Accountant_SaveData[Accountant.player]["data"][key].TotalIn; |
Accountant_SaveData[Accountant.player]["data"][key].TotalIn = nil; |
end |
if Accountant_SaveData[Accountant.player]["data"][key].TotalOut ~= nil then |
Accountant_SaveData[Accountant.player]["data"][key]["Total"].Out |
= Accountant_SaveData[Accountant.player]["data"][key].TotalOut; |
Accountant_SaveData[Accountant.player]["data"][key]["Total"].Out = Accountant_SaveData[Accountant.player]["data"][key].TotalOut; |
SC.data[key]["Total"].Out = Accountant_SaveData[Accountant.player]["data"][key].TotalOut; |
Accountant_SaveData[Accountant.player]["data"][key].TotalOut = nil; |
end |
if (string.find(player, SC.Realm) ~= nil) then |
if (Accountant_SaveData[player]["options"]["weekstart"] ~= nil) then |
-- SC.Print2("Setting weekstart for "..AccountantPlayer.." to match "..player.." value: "..Accountant_SaveData[player]["options"]["weekstart"]); |
Accountant_SaveData[Accountant.player]["options"]["weekstart"] |
= Accountant_SaveData[player]["options"]["weekstart"]; |
Accountant_SaveData[Accountant.player]["options"]["weekstart"] = Accountant_SaveData[player]["options"]["weekstart"]; |
end |
end |
end |
if (string.find(player, SC.Realm) ~= nil) then |
if (Accountant_SaveData[player]["options"]["dateweek"] ~= nil) then |
-- SC.Print2("Setting dateweek for "..Accountant.player.." to match "..player.." value: "..Accountant_SaveData[player]["options"]["dateweek"]); |
Accountant_SaveData[Accountant.player]["options"]["dateweek"] |
= Accountant_SaveData[player]["options"]["dateweek"]; |
Accountant_SaveData[Accountant.player]["options"]["dateweek"] = Accountant_SaveData[player]["options"]["dateweek"]; |
end |
end |
end |
if (string.find(player, SC.Realm) ~= nil) then |
if (Accountant_SaveData[player]["options"]["date"] ~= nil) then |
-- SC.Print2("Setting date for "..AccountantPlayer.." to match "..player.." value: "..Accountant_SaveData[player]["options"]["date"]); |
Accountant_SaveData[Accountant.player]["options"]["date"] |
= Accountant_SaveData[player]["options"]["date"]; |
Accountant_SaveData[Accountant.player]["options"]["date"] = Accountant_SaveData[player]["options"]["date"]; |
end |
end |
end |
SC.ToonDropDownList () |
end |
function SC.CacheSetCopper(cash) |
-- |
-- Set the cache box values on the frame |
-- |
local default = "?" |
local total_str, total, gold, silver, copper = SC.NiceCash(cash, false, false) |
if total > 0 then |
else |
-- assume it has not been set or was cleared |
gold = "" |
silver = "" |
copper = "" |
end |
AccountantFrameCacheAmountGold:SetText((gold or default)) |
AccountantFrameCacheAmountSilver:SetText((silver or default)) |
AccountantFrameCacheAmountCopper:SetText((copper or default)) |
end |
function SC.CacheGetCopper() |
-- |
-- Update the cache box if asked to |
-- |
local totalCopper = 0; |
local gold = AccountantFrameCacheAmountGold:GetText() --getglobal(moneyFrame:GetName().."Copper"):GetText(); |
local silver = AccountantFrameCacheAmountSilver:GetText() --getglobal(moneyFrame:GetName().."Silver"):GetText(); |
local copper = AccountantFrameCacheAmountCopper:GetText() --getglobal(moneyFrame:GetName().."Gold"):GetText(); |
if ( copper ~= "" ) then |
totalCopper = totalCopper + copper; |
end |
if ( silver ~= "" ) then |
totalCopper = totalCopper + (silver * COPPER_PER_SILVER); |
end |
if ( gold ~= "" ) then |
totalCopper = totalCopper + (gold * COPPER_PER_GOLD); |
end |
return totalCopper; |
end |
function SC.CacheBoxUpdate() |
--Get the values the user input |
local cache_copper = (SC.CacheGetCopper() or 0) |
Accountant_SaveData[SC.show_toons]["options"].cachebox = cache_copper; |
-- update appropriate values |
SC.ShowValues() |
SC:LDB_Update() |
end |
function SC.ToonDropDownList () |
-- |
-- Initialize the toon dropdown |
-- |
function SC.ToonDropDownList () |
local faction = "" |
SC.Toons = {} |
for player in next,Accountant_SaveData do |
table.sort(SC.Toons) |
end |
function SC.CharDropDown_Init () |
-- |
-- Initialize the toon dropdown |
-- |
local info = {} |
function SC.CharDropDown_Init () |
SC.ToonDropDownList () |
-- Initialize the dropdown of toons |
info.text = ACCLOC_CHARS |
--DEFAULT_CHAT_FRAME:AddMessage("Acc char drop Init: ") |
end |
function SC.CharDropDown_Setup() |
-- |
-- Setup the dropdown |
-- Used outside the XML controller |
-- |
function SC.CharDropDown_Setup() |
UIDropDownMenu_Initialize(Accountant_CharDropDown, SC.CharDropDown_Init); |
-- UIDropDownMenu_SetSelectedID(Accountant_CharDropDown, 1) |
UIDropDownMenu_SetSelectedID(Accountant_CharDropDown, 1) |
SC.show_toons = SC.AllDropdown |
end |
--DEFAULT_CHAT_FRAME:AddMessage("Acc char drop _OnShow: ") |
end |
function SC.CharDropDown_OnShow() |
-- |
-- Init and show the dropdown |
-- |
function SC.CharDropDown_OnShow() |
SC.CharDropDown_Setup() |
UIDropDownMenu_SetWidth(Accountant_CharDropDown, 100); |
UIDropDownMenu_SetWidth(100); |
--DEFAULT_CHAT_FRAME:AddMessage("Acc char drop _OnShow: ") |
end |
function SC.CharDropDown_OnClick() |
-- |
-- Handle a selection from the toons drop down |
-- |
function SC.CharDropDown_OnClick() |
local id = this:GetID(); |
UIDropDownMenu_SetSelectedID(Accountant_CharDropDown, id); |
-- Show the new values |
SC.ShowValues() |
SC:LDB_Update() |
SC:LDB_Update() |
-- Update(); |
end |
function SC.Button_Alliance_Toggle() |
-- |
-- Honor the user's selection to show or hide Alliance characters. |
-- |
function SC.Button_Alliance_Toggle() |
if (this:GetChecked()) then |
Accountant_SaveData[SC.Button_makename()]["options"].showAlliance = true; |
else |
SC.ShowAlliance = Accountant_SaveData[SC.Button_makename()]["options"].showAlliance |
SC.CharDropDown_Setup() |
SC.ShowValues() |
SC:LDB_Update() |
SC:LDB_Update() |
end |
function SC.Button_Horde_Toggle() |
-- |
-- Honor the user's selection to show or hide Alliance characters. |
-- |
function SC.Button_Horde_Toggle() |
if (this:GetChecked()) then |
Accountant_SaveData[SC.Button_makename()]["options"].showHorde = true; |
else |
SC.ShowHorde = Accountant_SaveData[SC.Button_makename()]["options"].showHorde |
SC.CharDropDown_Setup() |
SC.ShowValues() |
SC:LDB_Update() |
SC:LDB_Update() |
end |
function SC.Slash(msg) |
-- |
-- Consume and act on the Accountant slash commands |
-- |
function SC.Slash(msg) |
if msg == nil or msg == "" then |
msg = "log"; |
end |
end |
end |
function SC.OnEvent(event, arg1) |
-- |
-- Handle the events Accountant registered for |
-- |
function SC.OnEvent(event, arg1) |
local oldmode = SC.mode; |
--[[ |
if SC.show_events then |
DEFAULT_CHAT_FRAME:AddMessage( |
"|cFFFFFF00".."Acc debug "..FONT_COLOR_CODE_CLOSE |
..GREEN_FONT_COLOR_CODE.."ev: " |
..event |
.." arg: " |
..(arg1 or "nyl") |
); |
end |
--]] |
if ( event == "UNIT_NAME_UPDATE" and arg1 == "player" ) |
if ( event == "UNIT_NAME_UPDATE" and arg1 == "player" ) |
or (event=="PLAYER_ENTERING_WORLD") then |
if (SC.got_name) then |
return; |
end |
local playerName = UnitName("player"); |
if ( playerName ~= UNKNOWNBEING |
and playerName ~= UNKNOWNOBJECT |
and playerName ~= nil ) then |
SC.got_name = true; |
SC.OnLoad(); |
SC.Button_Init(); |
SC.Button_UpdatePosition(); |
-- init the data broker 'button' |
SC:LDB_Init() |
SC:LDB_Update() |
-- Create the options structures |
SC.InitOptions() |
end |
return; |
end |
if ( event == "PLAYER_LEAVING_WORLD") then |
-- save the current tab for next login |
Accountant_SaveData[Accountant.player]["options"]["current_tab"] = |
SC.current_tab |
Accountant_SaveData[Accountant.player]["options"]["show_toons"] = |
if (SC.got_name) then |
return; |
end |
local playerName = UnitName("player"); |
if ( playerName ~= UNKNOWNBEING |
and playerName ~= UNKNOWNOBJECT |
and playerName ~= nil ) then |
SC.got_name = true; |
SC.OnLoad(); |
SC.Options_OnLoad(); |
SC.Button_Init(); |
SC.Button_UpdatePosition(); |
end |
return; |
end |
if ( event == "PLAYER_LEAVING_WORLD") then |
-- save the current tab for next login |
Accountant_SaveData[Accountant.player]["options"]["current_tab"] = |
SC.current_tab |
Accountant_SaveData[Accountant.player]["options"]["show_toons"] = |
SC.show_toons |
return; |
end |
return; |
end |
if ( event == "MERCHANT_SHOW" |
or event == "MERCHANT_CLOSED" |
or event == "MERCHANT_UPDATE" |
or event == "UPDATE_INVENTORY_ALERTS" |
or event == "UPDATE_INVENTORY_DURABILITY" ) then |
-- DEFAULT_CHAT_FRAME:AddMessage(" ACC event: "..event.." : "..tmp); |
end |
if event == "MERCHANT_SHOW" then |
SC.mode = "MERCH"; |
SC.repair_money = GetMoney(); |
SC.repair_cost, SC.can_repair = GetRepairAllCost(); |
else |
end |
--[[ |
if ( SC.could_repair ) then |
tmpstr = "true"; |
else |
tmpstr = "false"; |
end |
DEFAULT_CHAT_FRAME:AddMessage(" ACC Merch show: " |
..tmpstr.." : "..SC.repair_cost.." : "..SC.repair_money); |
--]] |
elseif event == "MERCHANT_CLOSED" then |
SC.mode = ""; |
Account_RepairCost = 0; |
-- Could have bought something before or after repair |
SC.repair_money = GetMoney(); |
elseif event == "UPDATE_INVENTORY_DURABILITY" then |
--[[ |
if ( SC.could_repair ) then |
tmpstr = "true"; |
else |
tmpstr = "false"; |
end |
DEFAULT_CHAT_FRAME:AddMessage(" ACC dura: " |
..tmpstr.." : "..SC.repair_cost); |
--]] |
if ( SC.could_repair and SC.repair_cost > 0 ) then |
local cash = GetMoney(); |
-- DEFAULT_CHAT_FRAME:AddMessage(" ACC dura-1: " |
-- ..SC.repair_money.." : "..cash); |
if ( SC.repair_money > cash ) then |
-- most likely this is a repair bill |
local tmpMode = SC.mode; |
SC.mode = "REPAIRS"; |
SC.UpdateLog(); |
-- DEFAULT_CHAT_FRAME:AddMessage(" ACC repair: " |
-- ..SC.repair_cost); |
SC.mode = tmpMode; |
-- a single item could have been repaired |
SC.repair_money = cash; |
-- SC.mode = ""; |
elseif event == "MAIL_SHOW" then |
SC.mode = "MAIL"; |
SC.show_events = true |
elseif event == "MAIL_INBOX_UPDATE" then |
-- SC.Print("Accountant: event" |
-- ..event |
-- .." mode '"..SC.mode.."'"); |
-- Quel's fix: when we open a mail message, see if this is a successfull Auction. |
if (nil ~= InboxFrame.openMailID) then |
a, b, sender, subject, money = GetInboxHeaderInfo(InboxFrame.openMailID); |
if (nil ~= sender) then |
if (string.find(subject, ACCLOC_AUCTION_SUCC) ~= nil) then |
if (string.find(subject,"Auction successful:") ~= nil) then |
SC.mode="AH"; |
-- SC.Print("Accountant: Auction successful"); |
elseif (string.find (subject, ACCLOC_AUCTION_OUTBID) ~= nil) then |
elseif (string.find (subject, "Outbid") ~= nil) then |
SC.mode="IGNORE"; |
SC.refund_mode="AH"; |
SC.sender = Accountant.player; |
elseif (nil ~= money ) then |
sender = SC.Realm.."-"..sender; |
for char in next,Accountant_SaveData do |
if (sender == char) then |
SC.mode="IGNORE"; |
SC.refund_mode = "MAIL" |
SC.sender=sender; |
end |
end |
end |
end |
end |
elseif event == "MAIL_CLOSED" then |
SC.mode = ""; |
SC.show_events = false |
elseif event == "TRAINER_SHOW" then |
SC.mode = "TRAIN"; |
elseif event == "TRAINER_CLOSED" then |
SC.mode = ""; |
elseif event == "PLAYER_MONEY" then |
SC.UpdateLog(); |
SC:LDB_Update() |
SC:LDB_Update() |
end |
if SC.verbose and SC.mode ~= oldmode then |
SC.Print("Accountant mode changed to '"..SC.mode.."'"); |
end |
end |
function SC.NiceCash(value, show_zero, show_neg) |
-- |
-- Take the 'amount' of gold and make it into a nice, colorful string |
-- of g s c (gold silver copper) |
-- Take the 'amount' of gold nad make it into a nice, colorful string |
-- of g c s (gold silver copper) |
-- |
local neg1 = "" |
local neg2 = "" |
local agold = 10000; |
local asilver = 100; |
local outstr = ""; |
local gold = 0; |
local gold_str = "" |
local gc = "|cFFFFFF00" |
local silver = 0; |
local silver_str = "" |
local sc = "|cFFCCCCCC" |
local copper = 0; |
local copper_str = "" |
local cc = "|cFFFF6600" |
local amount = (value or 0) |
local cash = (amount or 0) |
function SC.NiceCash(amount) |
local agold = 10000; |
local asilver = 100; |
local outstr = ""; |
local gold = 0; |
local silver = 0; |
if show_neg then |
if amount < 0 then |
neg1 = "|cFFFF6600" .."("..FONT_COLOR_CODE_CLOSE |
neg2 = "|cFFFF6600" ..")"..FONT_COLOR_CODE_CLOSE |
else |
neg2 = " " -- need to pad for other negative numbers |
end |
end |
if amount < 0 then |
amount = amount * -1 |
end |
if amount >= agold then |
gold = math.floor(amount / agold); |
outstr = "|cFFFFFF00" .. gold .. "g "..FONT_COLOR_CODE_CLOSE; |
end |
amount = amount - (gold * agold); |
if amount >= asilver then |
silver = math.floor(amount / asilver); |
outstr = outstr .. "|cFFCCCCCC" .. silver .. "s "..FONT_COLOR_CODE_CLOSE; |
end |
amount = amount - (silver * asilver); |
if amount > 0 then |
outstr = outstr .. "|cFFFF6600" .. amount .. "c"..FONT_COLOR_CODE_CLOSE; |
end |
return outstr; |
end |
-- |
-- Take the 'amount' of gold nad make it into a nice, colorful string |
-- of g c s (gold silver copper) |
-- |
function SC.NiceFormatCash(amount) |
local agold = 10000; |
local asilver = 100; |
local outstr = ""; |
local gold = 0; |
local silver = 0; |
local tmpstr = "" |
local neg = false |
if amount == 0 then |
if show_zero then |
copper_str = cc..(amount or "?").."c"..FONT_COLOR_CODE_CLOSE |
end |
elseif amount > 0 then |
-- figure out the gold - silver - copper components |
gold = (math.floor(amount / agold) or 0) |
amount = amount - (gold * agold); |
silver = (math.floor(amount / asilver) or 0) |
copper = amount - (silver * asilver) |
-- now make them line up in a column |
return |
elseif amount < 0 then |
neg = true |
amount = amount * -1 |
end |
if amount >= agold then |
gold = math.floor(amount / agold); |
tmpstr = string.format("%d", gold) --tostring(gold) |
outstr = "|cFFFFFF00" .. tmpstr .. "g "..FONT_COLOR_CODE_CLOSE; |
end |
amount = amount - (gold * agold); |
if amount >= asilver then |
silver = math.floor(amount / asilver); |
tmpstr = string.format("%02d", silver) |
outstr = outstr .. "|cFFCCCCCC" .. tmpstr .. "s "..FONT_COLOR_CODE_CLOSE; |
else |
if gold > 0 then |
gold_str = gc..(gold or "?").."g "..FONT_COLOR_CODE_CLOSE |
silver_str = sc..(string.format("%02d", silver) or "?").."s "..FONT_COLOR_CODE_CLOSE |
copper_str = cc..(string.format("%02d", copper) or "?").."c"..FONT_COLOR_CODE_CLOSE |
elseif (silver > 0) then |
silver_str = sc..(silver or "?").."s "..FONT_COLOR_CODE_CLOSE |
copper_str = cc..(string.format("%02d", copper) or "?").."c"..FONT_COLOR_CODE_CLOSE |
elseif (copper > 0) then |
copper_str = cc..(copper or "?").."c"..FONT_COLOR_CODE_CLOSE |
outstr = outstr .. "|cFFCCCCCC" .. "00" .. "s "..FONT_COLOR_CODE_CLOSE; |
end |
end |
end |
amount = amount - (silver * asilver); |
if amount > 0 then |
tmpstr = string.format("%02d", amount) |
outstr = outstr .. "|cFFFF6600" .. amount .. "c"..FONT_COLOR_CODE_CLOSE; |
else |
if gold > 0 or silver > 0 then |
outstr = outstr .. "|cFFFF6600" .. "00" .. "c"..FONT_COLOR_CODE_CLOSE; |
end |
end |
-- build the return string |
outstr = outstr |
..neg1 |
..gold_str |
..silver_str |
..copper_str |
..neg2 |
--[[ |
SC.Print("Acc cash:" |
..(gold or "?").."g " |
..(silver or "?").."s " |
..(copper or "?").."c " |
..(outstr or "?") |
); |
--]] |
return outstr, cash, gold, silver, copper |
if neg == true then |
outstr = "|cFFFF6600" .. "("..FONT_COLOR_CODE_CLOSE |
..outstr |
.."|cFFFF6600" .. ")"..FONT_COLOR_CODE_CLOSE |
else |
outstr = outstr.." " |
end |
return outstr; |
end |
function SC.WeekStart() |
-- |
-- Take the g c s (gold silver copper) and wrap it for display |
-- |
function SC.NiceNetCash(diff) |
local tmpstr = ""; |
if ( diff > 0 ) then |
tmpstr = SC.NiceCash(diff); |
elseif ( diff == 0 ) then |
tmpstr = "|cFFFFFF00" |
..tostring(0) |
..FONT_COLOR_CODE_CLOSE; |
else -- less than 0 |
tmpstr = |
"|cFFFF6600".."(" |
..FONT_COLOR_CODE_CLOSE |
..SC.NiceCash(diff * -1) |
.."|cFFFF6600"..")" |
..FONT_COLOR_CODE_CLOSE |
-- nice cash only deals with positive cash |
end |
-- SC.Print("Accountant Bal end '"..tmpstr.."' for "..Accountant.player); |
return tmpstr; |
end |
-- |
-- Find and return the chosen week start |
-- |
function SC.WeekStart() |
oneday = 86400; |
ct = time(); |
dt = date("*t",ct); |
return string.sub(cdate,0,8); |
end |
function SC.GetDetailForToons(mode, for_display) |
-- |
-- get the detail of user selected toons for the requested mode |
-- This routime is used by Titan Panel Accountant. |
-- Others are welcome to use it as well. |
-- |
local TotalRowIn |
local TotalRowOut |
-- logmode = the mode from log_modes. |
-- session, week, ... |
-- all_t0ons = is a boolean to return the gold |
-- of the character being played |
-- or all characters on the server the user is logged into |
-- |
-- <return> = is a string consisting of |
-- <logmode> - the shortened version from log_modes_short |
-- <gold> - output of NiceNetCash |
-- |
function Accountant_GetCurrentBal(logmode, all_toons) |
local TotalIn = 0 |
local TotalOut = 0 |
local mode = "<nyl>" |
if SC.current_tab ~= 5 then |
TotalIn, TotalOut = |
SC.GetDetailForToons(SC.log_modes[SC.current_tab], false) |
cash = TotalIn-TotalOut |
mode = SC.log_modes_short[SC.current_tab] |
else |
cash = SC.GetCashForAllToons(false) |
mode = ACCLOC_CHARS |
end |
return |
"|cFFFFFF00"..mode..FONT_COLOR_CODE_CLOSE |
.." "..SC.NiceNetCash(cash); |
end |
-- |
-- get the net balance for this toon for the requested mode |
-- used by Accountant_GetCurrentBal |
-- |
function SC.GetNetBalForToonForMode(mode) |
local TotalRowIn = 0; |
local TotalRowOut = 0; |
local TotalIn = 0 |
local TotalOut = 0 |
for key,value in next,SC.data do |
TotalRowIn = 0; |
TotalRowOut = 0; |
for key,value in next,SC.data do |
for player in next,Accountant_SaveData do |
if (string.find(Accountant.player, SC.Realm) ~= nil) then |
TotalRowIn = TotalRowIn + Accountant_SaveData[Accountant.player]["data"][key][mode].In; |
TotalRowOut = TotalRowOut + Accountant_SaveData[Accountant.player]["data"][key][mode].Out; |
end |
TotalIn = TotalIn + TotalRowIn; |
TotalOut = TotalOut + TotalRowOut; |
end |
return TotalIn, TotalOut |
end |
-- |
-- get the net balance of all toons for the requested mode |
-- used by Accountant_GetCurrentBal |
-- |
function SC.GetNetBalForAllToonsForMode(mode) |
local TotalRowIn |
local TotalRowOut |
local TotalIn = 0 |
local TotalOut = 0 |
for key,value in next,SC.data do |
TotalRowIn = 0; |
TotalRowOut = 0; |
for player in next,Accountant_SaveData do |
if (string.find(player, SC.Realm) ~= nil) then |
TotalRowIn = TotalRowIn + Accountant_SaveData[player]["data"][key][mode].In; |
TotalRowOut = TotalRowOut + Accountant_SaveData[player]["data"][key][mode].Out; |
end |
end |
TotalIn = TotalIn + TotalRowIn; |
TotalOut = TotalOut + TotalRowOut; |
end |
return TotalIn, TotalOut |
end |
-- |
-- get the detail of user selected toons for the requested mode |
-- |
function SC.GetDetailForToons(mode, for_display) |
local TotalRowIn |
local TotalRowOut |
local TotalIn = 0 |
local TotalOut = 0 |
for key,value in next,SC.data do |
TotalRowIn = 0; |
TotalRowOut = 0; |
for player in next,Accountant_SaveData do |
-- Find the one player or all players of the faction(s) requested |
faction = Accountant_SaveData[player]["options"]["faction"] |
--[[ |
tmpstr1 = player |
tmpstr2 = faction |
if tmpstr2 then |
else |
tmpstr2 = "not set" |
end |
tmpstr3 = SC.show_toons |
DEFAULT_CHAT_FRAME:AddMessage("Acc ShowValues: " |
.."player:"..tmpstr1 |
.." faction: "..tmpstr2 |
.." sel: "..tmpstr3 |
) |
--]] |
if (string.find(player, SC.Realm) ~= nil) |
and (( (faction == ACCLOC_ALLIANCE) |
and (SC.ShowAlliance == true) ) |
TotalRowOut = TotalRowOut + Accountant_SaveData[player]["data"][key][mode].Out; |
end |
end |
end |
TotalIn = TotalIn + TotalRowIn; |
TotalOut = TotalOut + TotalRowOut; |
TotalIn = TotalIn + TotalRowIn; |
TotalOut = TotalOut + TotalRowOut; |
if for_display then |
if for_display then |
row = getglobal("AccountantFrameRow" ..SC.data[key].InPos.."In"); |
row:SetText(SC.NiceCash(TotalRowIn, false, false)); |
row:SetText(SC.NiceCash(TotalRowIn)); |
row = getglobal("AccountantFrameRow" ..SC.data[key].InPos.."Out"); |
row:SetText(SC.NiceCash(TotalRowOut, false, false)); |
end |
end |
row:SetText(SC.NiceCash(TotalRowOut)); |
end |
end |
return TotalIn, TotalOut |
end |
function SC.GetCashForToons() |
-- |
-- get the net balance of user selected toons |
-- |
local faction = "" |
local cachebox = 0 |
local alltotal = 0 |
function SC.GetCashForToons() |
local faction = "" |
local alltotal = 0 |
-- collect the total for the toon(s) selected |
for player in next,Accountant_SaveData do |
faction = Accountant_SaveData[player]["options"]["faction"] |
if (string.find(player, SC.Realm) ~= nil) |
and (( (faction == ACCLOC_ALLIANCE) |
for player in next,Accountant_SaveData do |
faction = Accountant_SaveData[player]["options"]["faction"] |
if (string.find(player, SC.Realm) ~= nil) |
and (( (faction == ACCLOC_ALLIANCE) |
and (SC.ShowAlliance == true) ) |
or ( (faction == ACCLOC_HORDE) |
or ( (faction == ACCLOC_HORDE) |
and (SC.ShowHorde == true) )) |
and ( SC.show_toons == player |
and ( SC.show_toons == player |
or SC.show_toons == SC.AllDropdown ) then |
-- cachebox may not exist if the user has not logged onto the toon yet |
cachebox = (Accountant_SaveData[player]["options"]["cachebox"] or 0) |
alltotal = alltotal |
+ Accountant_SaveData[player]["options"]["totalcash"] - cachebox |
end |
end |
alltotal = alltotal + Accountant_SaveData[player]["options"]["totalcash"]; |
end |
end |
return alltotal |
end |
function SC.GetCashForAllToons(for_display) |
-- |
-- get the total cash for all toons |
-- |
function SC.GetCashForAllToons(for_display) |
local i=1; |
local alltotal = 0 |
local total = 0 |
local cachebox = 0 |
local alltotal = 0 |
for char,charvalue in next,Accountant_SaveData do |
-- Find all players of the faction(s) requested |
getglobal("AccountantFrameRow" ..i.."Title"):SetText(strtmp); |
end |
if Accountant_SaveData[char]["options"]["totalcash"] ~= nil then |
-- poss cachebox does not exist if the user has not logged onto the toon yet |
cachebox = (Accountant_SaveData[char]["options"]["cachebox"] or 0) |
total = Accountant_SaveData[char]["options"]["totalcash"] - cachebox |
alltotal = alltotal + total |
if for_display then |
getglobal("AccountantFrameRow" ..i.."In"):SetText( |
SC.NiceCash(total, false, false)); |
getglobal("AccountantFrameRow" ..i.."Out"):SetText( |
Accountant_SaveData[char]["options"]["date"]); |
if for_display then |
getglobal("AccountantFrameRow" ..i.."In"):SetText(SC.NiceCash(Accountant_SaveData[char]["options"]["totalcash"])); |
getglobal("AccountantFrameRow" ..i.."Out"):SetText(Accountant_SaveData[char]["options"]["date"]); |
end |
alltotal = alltotal + Accountant_SaveData[char]["options"]["totalcash"]; |
else |
if for_display then |
getglobal("AccountantFrameRow" ..i.."In"):SetText("Unknown"); |
end |
if for_display then |
getglobal("AccountantFrameRow" ..i.."In"):SetText("Unknown"); |
end |
end |
i=i+1; |
end |
end |
return alltotal |
return alltotal |
end |
function SC.ShowValues() |
-- |
-- Set the Accountant values based on the user selection |
-- |
function SC.ShowValues() |
local str_pos |
local strtmp = "<nyl>" |
local tmpstr1 = "<nyl>" |
local tmpstr2 = "<nyl>" |
local tmpstr3 = "<nyl>" |
local diff = 0 |
-- charachter totals |
local alltotal; |
SC.SetLabels(); |
if SC.current_tab ~= 5 then |
AccountantFrameResetButton:Show() |
TotalIn = 0; |
TotalOut = 0; |
-- mode = SC.log_modes[SC.current_tab]; |
TotalIn, TotalOut = SC.GetDetailForToons(SC.log_modes[SC.current_tab], true) |
diff = (TotalOut-TotalIn or 0); |
AccountantFrameTotalInValue:SetText(SC.NiceCash(TotalIn, true, false)); |
AccountantFrameTotalOutValue:SetText(SC.NiceCash(TotalOut, true, false)); |
AccountantFrameTotalFlowValue:SetText(SC.NiceCash(diff, true, false)) |
AccountantFrameTotalInValue:SetText(SC.NiceCash(TotalIn)); |
AccountantFrameTotalOutValue:SetText(SC.NiceCash(TotalOut)); |
if diff > 0 then |
if TotalOut > TotalIn then |
diff = TotalOut-TotalIn; |
AccountantFrameTotalFlow:SetText("|cFFFF3333"..ACCLOC_NETLOSS..":"); |
elseif diff < 0 then |
AccountantFrameTotalFlow:SetText("|cFF00FF00"..ACCLOC_NETPROF..":"); |
AccountantFrameTotalFlowValue:SetText(SC.NiceCash(diff)); |
else |
AccountantFrameTotalFlow:SetText(ACCLOC_NET); |
if TotalOut ~= TotalIn then |
diff = TotalIn-TotalOut; |
AccountantFrameTotalFlow:SetText("|cFF00FF00"..ACCLOC_NETPROF..":"); |
AccountantFrameTotalFlowValue:SetText(SC.NiceCash(diff)); |
else |
AccountantFrameTotalFlow:SetText(ACCLOC_NET); |
AccountantFrameTotalFlowValue:SetText(""); |
end |
end |
alltotal = SC.GetCashForToons() |
else |
AccountantFrameResetButton:Hide() |
alltotal = SC.GetCashForAllToons(true) |
end |
-- SetPortraitTexture(AccountantFramePortrait, "player"); |
if (SC.show_toons == SC.AllDropdown) or (SC.current_tab == 5) then |
SC.CacheSetCopper(0) |
AccountantFrameCacheAmount:Hide() |
AccountantFrameCacheUpdate:Hide() |
else |
SC.CacheSetCopper((Accountant_SaveData[SC.show_toons]["options"].cachebox or 0)) |
AccountantFrameCacheAmount:Show() |
AccountantFrameCacheUpdate:Show() |
end |
if SC.current_tab == 3 then |
AccountantFrameExtra:SetText(ACCLOC_WEEKSTART..":"); |
AccountantFrameExtraValue:SetText(Accountant_SaveData[Accountant.player]["options"]["dateweek"]); |
AccountantFrameExtraValue:SetText(""); |
end |
local cash = SC.NiceCash(alltotal, true, true) |
local cash = SC.NiceNetCash(alltotal) |
-- if cash == "" then |
-- cash = "|cFFFF6600" .. "0" .. "c"..FONT_COLOR_CODE_CLOSE; |
-- end |
AccountantFrameMoneyTotal:SetText(cash); |
PanelTemplates_SetTab(AccountantFrame, SC.current_tab); |
end |
function SC.OnShow() |
-- |
-- Show the Accountant window on request |
-- |
SC.ShowValues() |
function SC.OnShow() |
SC.ShowValues() |
SC.LDB_Update() |
end |
end |
end |
function SC.Print(msg) |
-- |
-- Accountant print |
-- |
function SC.Print(msg) |
DEFAULT_CHAT_FRAME:AddMessage(format("Accountant: "..msg)); |
end |
function SC.Print2(msg) |
-- |
-- Accountant print used mainly for debug |
-- |
function SC.Print2(msg) |
ChatFrame4:AddMessage(format("Accountant: "..msg)); |
end |
QM_Print("/accountant log\n"); |
end |
function SC.UpdateLog() |
-- |
-- request confirmation from the user to make sure they |
-- really really want to reset all the data |
-- |
function SC.ResetData() |
local type = SC.log_modes[SC.current_tab]; |
if type == "Total" then |
type = "overall"; |
end |
SC.show_toons = ACCLOC_CHARS |
StaticPopupDialogs["ACCOUNTANT_RESET"].text = ACCLOC_RESET_CONF |
.." "..type.." " |
..ACCLOC_TOTAL |
.." for "..ACCLOC_CHARS |
.." on "..SC.Realm |
.."?"; |
local dialog = StaticPopup_Show("ACCOUNTANT_RESET","weeee"); |
end |
-- |
-- On confirmation from the user, reset all the data |
-- |
function SC.ResetConfirmed() |
local type = SC.log_modes[SC.current_tab]; |
for key,value in next,SC.data do |
SC.data[key][type].In = 0; |
SC.data[key][type].Out = 0; |
-- Clear every player on the realm on a reset. |
for player in next,Accountant_SaveData do |
if (string.find(player, SC.Realm) ~= nil) then |
Accountant_SaveData[player]["data"][key][type].In = 0; |
Accountant_SaveData[player]["data"][key][type].Out = 0; |
end |
end |
end |
if AccountantFrame:IsVisible() then |
SC.OnShow(); |
end |
end |
-- |
-- Update the Accountant data based on the current Accountant mode |
-- The mode sets the category of gold income or expense shown in |
-- the Accountant window |
-- |
function SC.UpdateLog() |
SC.current_money = GetMoney(); |
Accountant_SaveData[Accountant.player]["options"].totalcash = SC.current_money; |
diff = SC.current_money - SC.last_money; |
SC.data[mode][logmode].In = SC.data[mode][logmode].In + diff; |
Accountant_SaveData[Accountant.player]["data"][mode][logmode].In = SC.data[mode][logmode].In; |
end |
if SC.verbose then SC.Print("Gained "..SC.NiceCash(diff, false, false).." from "..mode); end |
if SC.verbose then SC.Print("Gained "..SC.NiceCash(diff).." from "..mode); end |
elseif diff < 0 then |
diff = diff * -1; |
SC.data[mode][logmode].Out = SC.data[mode][logmode].Out + diff; |
Accountant_SaveData[Accountant.player]["data"][mode][logmode].Out = SC.data[mode][logmode].Out; |
end |
if SC.verbose then SC.Print("Lost "..SC.NiceCash(diff, false, false).." from "..mode); end |
if SC.verbose then SC.Print("Lost "..SC.NiceCash(diff).." from "..mode); end |
end |
else |
if (SC.refund_mode == "AH") then |
end |
if SC.verbose then |
SC.Print("IGNORE: "..SC.NiceCash(diff, false, false) |
.." mode = "..SC.refund_mode .." refundee = "..SC.sender); |
SC.Print("IGNORE: "..SC.NiceCash(diff).." mode = "..SC.refund_mode .." refundee = "..SC.sender); |
end |
end |
-- special case mode resets |
-- if SC.mode == "REPAIRS" then |
-- SC.mode = "MERCH"; |
-- end |
if AccountantFrame:IsVisible() then |
SC.OnShow(); |
end |
end |
function SC.Tab_OnClick() |
-- |
-- Switch tabs on the Accountant window on user request (click) |
-- |
function SC.Tab_OnClick() |
PanelTemplates_SetTab(AccountantFrame, this:GetID()); |
SC.current_tab = this:GetID(); |
PlaySound("igCharacterInfoTab"); |
SC.OnShow(); |
end |
function SC.ShowTotalLDB() |
-- |
-- show or hide the total on the LDB button based on the user selection |
-- for that character. |
-- |
if(Accountant_SaveData[SC.Button_makename()]["options"].showtotal) then |
Accountant_SaveData[SC.Button_makename()]["options"].showtotal = false |
else |
Accountant_SaveData[SC.Button_makename()]["options"].showtotal = true |
end |
SC:LDB_Update() |
end |
-- |
-- This routime is used by Titan Panel Accountant. |
-- Others are welcome to use it as well. |
-- |
-- logmode = the mode from log_modes. |
-- session, week, ... |
-- all_t0ons = is a boolean to return the gold |
-- of the character being played |
-- or all characters on the server the user is logged into |
-- |
-- <return> = is a string consisting of |
-- <logmode> - the shortened version from log_modes_short |
-- <gold> - output of NiceNetCash |
-- |
function Accountant_GetCurrentBal(logmode, all_toons) |
local TotalIn = 0 |
local TotalOut = 0 |
local mode = "<nyl>" |
if SC.current_tab ~= 5 then |
TotalIn, TotalOut = |
SC.GetDetailForToons(SC.log_modes[SC.current_tab], false) |
cash = TotalIn-TotalOut |
mode = SC.log_modes_short[SC.current_tab] |
else |
cash = SC.GetCashForAllToons(false) |
mode = ACCLOC_CHARS |
end |
return |
"|cFFFFFF00"..mode..FONT_COLOR_CODE_CLOSE |
.." "..SC.NiceCash(cash, true, true) |
end |
## Interface: 30300 |
## Title: Accountant 3.7.30300 |
## Version: 3.7.30300 |
## Author: urnati |
## Interface: 30000 |
## Title: Accountant |
## Version: 3.3 |
## Description: Logs where your WoW gold goes |
## DefaultState: enabled |
## RequiredDeps: |
## SavedVariables: Accountant_SaveData,Accountant_Options |
libs\LibStub\LibStub.lua |
libs\CallbackHandler-1.0\CallbackHandler-1.0.xml |
libs\LibDataBroker-1.1\LibDataBroker-1.1.lua |
libs\AceConfig-3.0\AceGUI-3.0\AceGUI-3.0.xml |
libs\AceConfig-3.0\AceConfig-3.0.xml |
libs\AceConfig-3.0\AceConfigDialog-3.0.xml |
AccountantData.lua |
localization.lua |
Accountant.lua |
AccountantOptions.xml |
Accountant.xml |
-- Change Log: |
v3.6.00: |
- Updated toc for 3.3 patch |
- Changed naming convention to reflect WoW patch version |
--ToDo: |
- Place more info into the tooltip |
- Clean up more of the code |
v3.6.00: |
- Updated toc for 3.2 patch |
- Add new option to show total on LDB button. |
- Added a 'cache box' to 'hide' money from the total. Only the total in |
the Accountant frame or Accountant LDB button is affected. |
Note: You are allowed to cache more money than you have resulting in a |
negative amount being shown. |
- Resized window to show more gold (for those lucky few!) |
v3.5.00: |
- Fixed library dependencies that caused a lot of errors. |
- Moved options to the Blizzard options for addons. |
- Added the option to 'remove' Accountant data for a character. The character could have been deleted. |
- Added the option to 'merge' Accountant data of two characters. The character could have been renamed. |
- Cleaned up parts of the code. |
- Fixed an error when user had selected 'All Chars' tab and used a LDB addon - the tooltip threw an error. |
- Made the numbers shown 'stack' better vertically |
- Fixed an error where the Accountant title was no showing. |
v3.4.02: |
- Added some German translation thanks to ylarion. |
v3.4.01: |
- Removed a debug statement that was appearing in chat. |
v3.4.00: |
- Fixed error popping up when opening Accountant. |
- Now allow gold to transfer between characters via mail instead of ignoring |
v3.3.01: |
- Fixed typo causing the Data Broker icon to not be shown. |
ACCLOC_OUT = "Expenditures"; |
ACCLOC_WEEKSTART = "Week Start"; |
ACCLOC_SUM = "Sum Total"; |
ACCLOC_CHARCAP = "Character" |
ACCLOC_CHAR = "character" |
ACCLOC_CHAR = "Character"; |
ACCLOC_MONEY = "Money"; |
ACCLOC_UPDATED = "Updated"; |
ACCLOC_ALLIANCE = "Alliance" |
ACCLOC_ALLIANCE = "Alliance" |
ACCLOC_HORDE = "Horde" |
-- Section Labels |
-- Buttons |
ACCLOC_RESET = "Clear Data"; |
ACCLOC_OPTBUT = "Options"; |
ACCLOC_EXIT = "Exit"; |
-- Tabs |
ACCLOC_CHARS = "All Chars"; |
-- Options |
ACCLOC_OPTS = "Accountant Options"; |
ACCLOC_MINIBUT = "Show Minimap Button"; |
ACCLOC_BUTPOS = "Minimap Button Position"; |
ACCLOC_STARTWEEK = "Start of Week"; |
ACCLOC_WD_SUN = "Sunday"; |
ACCLOC_WD_MON = "Monday"; |
ACCLOC_WD_THU = "Thursday"; |
ACCLOC_WD_FRI = "Friday"; |
ACCLOC_WD_SAT = "Saturday"; |
ACCLOC_DONE = "complete"; |
ACCLOC_DONE = "Done"; |
-- Misc |
ACCLOC_RESET_CONF = "Are you sure you want to reset the"; |
ACCLOC_NEWPROFILE = "New "..ACCLOC_TITLE.." profile created for"; |
ACCLOC_LOADPROFILE = "Loaded "..ACCLOC_TITLE.." profile for"; |
ACCLOC_NEWPROFILE = "New Accountant profile created for"; |
ACCLOC_LOADPROFILE = "Loaded Accountant Profile for"; |
ACCLOC_LOADED = "Loaded"; |
ACCLOC_RCLICK = "Right-Click" |
ACCLOC_LCLICK = "Left-Click" |
ACCLOC_REMOVE = "Remove" |
ACCLOC_MERGE = "Merge" |
ACCLOC_MERGETO = " --> " |
ACCLOC_TOGGLE = "Toggle" |
ACCLOC_MINIMAP = "Minimap" |
ACCLOC_BUTTON = "Button" |
ACCLOC_RCLICK = "Right-Click" |
ACCLOC_LCLICK = "Left-Click" |
-- Mail strings |
ACCLOC_AUCTION_SUCC = "Auction successful:" |
ACCLOC_AUCTION_OUTBID = "Outbid" |
-- Key Bindings headers |
BINDING_NAME_ACCOUNTANTTOG = ACCLOC_TOGGLE.." "..ACCLOC_TITLE; |
-- Config strings |
ACCLOC_MINIMAP_BUT = ACCLOC_MINIMAP.." "..ACCLOC_BUTTON; |
ACCLOC_CONF_DESC = ACCLOC_TITLE.." allows you to track where your gold is going."; |
ACCLOC_CONF_GEN_DESC = "Configure "..ACCLOC_MINIMAP.." "..ACCLOC_BUTTON |
ACCLOC_TOG_MINIMAP = "Display "..ACCLOC_MINIMAP.." "..ACCLOC_BUTTON |
ACCLOC_TOG_MINIMAP_DESC = "Display the "..ACCLOC_MINIMAP.." "..ACCLOC_BUTTON |
ACCLOC_POS_MINIMAP = ACCLOC_MINIMAP.." "..ACCLOC_BUTTON.." Position" |
ACCLOC_POS_MINIMAP_DESC = "Position the "..ACCLOC_MINIMAP.." "..ACCLOC_BUTTON.." on the "..ACCLOC_MINIMAP.."" |
ACCLOC_TRANSPARANCY = "Transparancy" |
ACCLOC_TRANSP = "Change the "..ACCLOC_TRANSPARANCY.." of the "..ACCLOC_TITLE.." window" |
ACCLOC_TRANSP_DESC = "Change "..ACCLOC_TRANSPARANCY |
ACCLOC_STARTWEEK_DESC = "Change the day of the week that "..ACCLOC_TITLE.." uses. This resets the "..ACCLOC_STARTWEEK.." totals."; |
ACCLOC_WEEKDAY = "Week Day"; |
ACCLOC_WEEKDAY_DESC = "Select the day of the week."; |
ACCLOC_WEEKDAY_DONE = "Change to "..ACCLOC_WEEKDAY; |
ACCLOC_TOON = ACCLOC_CHARCAP |
ACCLOC_TOON_MGMT = ACCLOC_CHARCAP.." Management"; |
ACCLOC_TOON_MGMT_2 = "It is recommended that you save your "..ACCLOC_TITLE.." data before proceeding - just in case. The data is found in the "..ACCLOC_TITLE..".lua file in the SavedVariables folder."; |
ACCLOC_TOON_MGMT_DESC = "Manage the "..ACCLOC_TITLE.." data of your "..ACCLOC_CHAR.."(s)."; |
ACCLOC_TOON_DELETE = ACCLOC_REMOVE; |
ACCLOC_TOON_REMOVE = ACCLOC_TOON.." "..ACCLOC_TOON_DELETE; |
ACCLOC_TOON_DELETE_DESC = ACCLOC_REMOVE..ACCLOC_TITLE.." data for the selected "..ACCLOC_CHAR; |
ACCLOC_TOON_DELETE_SELF = "You can not remove yourself!" |
ACCLOC_TOON_DELETE_DONE = ACCLOC_REMOVE.." of " |
ACCLOC_TOON_REMOVE_DESC = ACCLOC_REMOVE..ACCLOC_TITLE.." data for this "..ACCLOC_CHAR |
ACCLOC_TOON_REMOVE_NOTES= "This will remove the "..ACCLOC_TITLE.." data for the selected "..ACCLOC_CHAR..". You must exit the game or log into another "..ACCLOC_CHAR.." to save the changes." |
ACCLOC_TOON_IGNORE = "Ignore"; |
ACCLOC_TOON_IGNORE_DESC = "Ignore "..ACCLOC_TITLE.." data for this "..ACCLOC_CHAR..". Do not collect data."; |
ACCLOC_TOON_MERGE = "Merge"; |
ACCLOC_TOON_MERGE_T = ACCLOC_TOON.." "..ACCLOC_TOON_MERGE; |
ACCLOC_TOON_FROM = "From:" |
ACCLOC_TOON_TO = "To:" |
ACCLOC_TO = "to" |
ACCLOC_TOON_MERGE_ERR1 = "Can not merge a "..ACCLOC_CHAR.." to itself!!"; |
ACCLOC_TOON_FROM_DESC = "Merge "..ACCLOC_TITLE.." data from this "..ACCLOC_CHAR; |
ACCLOC_TOON_TO_DESC = "Merge "..ACCLOC_TITLE.." data to this "..ACCLOC_CHAR; |
ACCLOC_TOON_MERGE_NOTES1= "" |
ACCLOC_TOON_MERGE_NOTES2= "NOTE: If you merge "..ACCLOC_TITLE.." data 'to' the "..ACCLOC_CHAR.." you are logged into session data will be lost. You should also log into the "..ACCLOC_CHAR.." you want to merge 'from'. Otherwise week data may not be correct (depending on when you last logged into that "..ACCLOC_CHAR..")." |
ACCLOC_RESET_DESC = "Clear the "..ACCLOC_TITLE.." data for all characters on this realm only: " |
..GREEN_FONT_COLOR_CODE..GetRealmName() |
ACCLOC_RESET_DESC_SHORT = "Clear data for "..GREEN_FONT_COLOR_CODE..GetRealmName() |
if ( locale == "deDE" ) then |
-- Mail strings |
ACCLOC_AUCTION_SUCC = "Auktion erfolgreich:" |
ACCLOC_AUCTION_OUTBID = "überboten" |
end |
BINDING_HEADER_ACCOUNTANT = "Accountant"; |
BINDING_NAME_ACCOUNTANTTOG = "Toggle Accountant"; |
-- Create a short cut |
local SC = Accountant |
SC.Version = tostring(GetAddOnMetadata("Accountant", "Version")) or "Unknown" -- "3.4.02"; |
SC.AUTHOR = GetAddOnMetadata("Accountant", "Author") or "Unknown" --"urnati" |
SC.Version = "3.3"; |
SC.AUTHOR = "urnati" |
ACCOUNTANT_OPTIONS_TITLE = "Accountant Options"; |
ACCOUNTANT_BUTTON_TOOLTIP = "Toggle Accountant"; |
SC.artwork_path = "Interface\\AddOns\\Accountant\\Artwork\\" |
SC.log_modes = {"Session","Day","Week","Total"}; |
SC.log_modes_short = {"Sess","Day","Week","Tot"}; |
SC.Faction = "" |
SC.ShowAlliance = nil |
SC.ShowHorde = nil |
-- Store the list of all characters, regardless of realm or faction |
SC.AllToons = {} |
SC.GOLD_COLOR = "|cFFFFFF00" |
SC.GREEN_COLOR = GREEN_FONT_COLOR_CODE |
SC.TITLE = "Accountant" |
--> |
<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"> |
xsi:schemaLocation="http://www.blizzard.com/wow/ui/ |
..\FrameXML\UI.xsd"> |
<Script file="AccountantData.lua" /> |
<Script file="localization.lua" /> |
<Script file="Accountant.lua" /> |
<!-- Item Row Template --> |
<Button name="AccountantTabTemplate" |
inherits="CharacterFrameTabButtonTemplate" virtual="true"> |
<OnClick>Accountant.Tab_OnClick();</OnClick> |
</Scripts> |
</Button> |
<FontString name="AccountantTextTemplate" inherits="GameFontHighlightSmall" virtual="true"> |
<Size> |
<AbsDimension x="100" y="10" /> |
</Size> |
<FontString name="AccountantTextTemplate" |
inherits="GameFontHighlightSmall" virtual="true"> |
<Size> |
<AbsDimension x="100" y="10" /> |
</Size> |
</FontString> |
<FontString name="AccountantValueTemplate" inherits="GameFontHighlightSmall" virtual="true"> |
<Size> |
<AbsDimension x="150" y="10" /> |
</Size> |
</FontString> |
<Frame name="AccountantRowTemplate" virtual="true"> |
<Size> |
<AbsDimension x="400" y="19" /> |
<AbsDimension x="320" y="19" /> |
</Size> |
<Layers> |
<Layer level="BACKGROUND"> |
<FontString name="$parentTitle" inherits="GameFontNormal" justifyH="LEFT" > |
<Size> |
<AbsDimension x="100" y="14" /> |
</Size> |
<FontString name="$parentTitle" |
inherits="GameFontNormal"> |
<Anchors> |
<Anchor point="TOPLEFT" |
relativePoint="TOPLEFT"> |
<Offset> |
<AbsDimension x="5" y="-2" /> |
<AbsDimension x="3" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
<FontString name="$parentIn" inherits="GameFontHighlightSmall"> |
<Size> |
<AbsDimension x="150" y="14" /> |
</Size> |
<FontString name="$parentIn" |
inherits="GameFontHighlightSmall"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentTitle" |
relativePoint="RIGHT"> |
<Anchor point="TOPRIGHT" |
relativePoint="TOPLEFT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
<AbsDimension x="225" y="-4" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
<FontString name="$parentOut" inherits="GameFontHighlightSmall"> |
<Size> |
<AbsDimension x="150" y="14" /> |
</Size> |
<FontString name="$parentOut" |
inherits="GameFontHighlightSmall"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentIn" |
relativePoint="RIGHT"> |
<Anchor point="TOPRIGHT" |
relativePoint="TOPLEFT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
<AbsDimension x="317" y="-4" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
<Texture file="Interface\AuctionFrame\UI-AuctionItemNameFrame"> |
<Texture |
file="Interface\AuctionFrame\UI-AuctionItemNameFrame"> |
<Size> |
<AbsDimension x="480" y="19" /> |
<AbsDimension x="400" y="19" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT" |
<Frame name="AccountantFrame" toplevel="true" enableMouse="true" |
frameStrata="HIGH" movable="true" parent="UIParent" hidden="true"> |
<Size> |
<AbsDimension x="440" y="539" /> |
<AbsDimension x="384" y="539" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
</Layer> |
--> |
<Layer level="ARTWORK"> |
<!-- Title of the frame --> |
<FontString name="$parentTitleText" inherits="GameFontHighlight" text="SOME_TITLE"> |
<FontString name="$parentTitleText" |
inherits="GameFontHighlight" text="SOME_TITLE"> |
<Size> |
<AbsDimension x="300" y="14" /> |
</Size> |
</Anchor> |
</Anchors> |
</FontString> |
<!-- gold listed under the character pulldown --> |
<FontString name="$parentMoneyTotal" |
inherits="AccountantValueTemplate" justifyH = "RIGHT"> |
<FontString name="$parentMoneyTotal" justifyH = "RIGHT" |
inherits="AccountantTextTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT" relativePoint="TOPLEFT"> |
<Anchor point="TOPLEFT" |
relativePoint="TOPLEFT"> |
<Offset> |
<AbsDimension x="8" y="-40" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
<!-- 3 labels for template rows --> |
<FontString name="$parentSource" inherits="GameFontHighlight" justifyH = "CENTER"> |
<Size> |
<AbsDimension x="100" y="14" /> |
</Size> |
<FontString name="$parentSource" |
inherits="GameFontHighlight"> |
<Anchors> |
<Anchor point="TOPLEFT" relativePoint="TOPLEFT"> |
<Anchor point="TOPLEFT" |
relativePoint="TOPLEFT"> |
<Offset> |
<AbsDimension x="24" y="-123" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
<!-- --> |
<FontString name="$parentIn" inherits="GameFontHighlight" justifyH = "CENTER"> |
<Size> |
<AbsDimension x="150" y="14" /> |
</Size> |
<FontString name="$parentIn" |
inherits="GameFontHighlight"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentSource" relativePoint="RIGHT"> |
<Anchor point="LEFT" relativeTo="$parentSource" |
relativePoint="LEFT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
<AbsDimension x="145" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
<!-- --> |
<FontString name="$parentOut" inherits="GameFontHighlight" justifyH = "CENTER"> |
<Size> |
<AbsDimension x="150" y="14" /> |
</Size> |
<FontString name="$parentOut" |
inherits="GameFontHighlight"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentIn" relativePoint="RIGHT"> |
<Anchor point="LEFT" relativeTo="$parentIn" |
relativePoint="LEFT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
<AbsDimension x="91" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
<!-- Revenue --> |
<FontString name="$parentTotalIn" inherits="AccountantTextTemplate" justifyH = "LEFT"> |
<FontString name="$parentTotalIn" |
inherits="AccountantTextTemplate" justifyH = "LEFT"> |
<Anchors> |
<Anchor point="TOPLEFT" |
relativeTo="$parent" |
</Anchor> |
</Anchors> |
</FontString> |
<!-- --> |
<FontString name="$parentTotalInValue" inherits="AccountantValueTemplate" justifyH = "RIGHT"> |
<FontString name="$parentTotalInValue" |
inherits="AccountantTextTemplate" justifyH = "RIGHT"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentTotalIn" relativePoint="RIGHT"> |
<Anchor point="LEFT" relativeTo="$parentTotalIn" |
relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
<!-- Expense --> |
<FontString name="$parentTotalOut" inherits="AccountantTextTemplate" justifyH = "LEFT"> |
<FontString name="$parentTotalOut" |
inherits="AccountantTextTemplate" justifyH = "LEFT"> |
<Anchors> |
<Anchor point="TOP" relativeTo="$parentTotalIn" |
relativePoint="BOTTOM"> |
</Anchor> |
</Anchors> |
</FontString> |
<!-- --> |
<FontString name="$parentTotalOutValue" inherits="AccountantValueTemplate" justifyH = "RIGHT"> |
<FontString name="$parentTotalOutValue" |
inherits="AccountantTextTemplate" justifyH = "RIGHT"> |
<Anchors> |
<Anchor point="LEFT" |
relativeTo="$parentTotalOut" relativePoint="RIGHT"> |
</Anchor> |
</Anchors> |
</FontString> |
<!-- Net of Revenue - Expense --> |
<FontString name="$parentTotalFlow" inherits="AccountantTextTemplate" justifyH = "LEFT"> |
<FontString name="$parentTotalFlow" |
inherits="AccountantTextTemplate" justifyH = "LEFT"> |
<Anchors> |
<Anchor point="TOP" relativeTo="$parentTotalOut" |
relativePoint="BOTTOM"> |
</Anchor> |
</Anchors> |
</FontString> |
<!-- --> |
<FontString name="$parentTotalFlowValue" inherits="AccountantValueTemplate" justifyH = "RIGHT"> |
<FontString name="$parentTotalFlowValue" |
inherits="AccountantTextTemplate" justifyH = "RIGHT"> |
<Anchors> |
<Anchor point="LEFT" |
relativeTo="$parentTotalFlow" relativePoint="RIGHT"> |
</Anchor> |
</Anchors> |
</FontString> |
<!-- Week start --> |
<FontString name="$parentExtra" inherits="GameFontHighlightSmall"> |
<FontString name="$parentExtra" |
inherits="GameFontHighlightSmall"> |
<Anchors> |
<Anchor point="TOP" relativePoint="TOPLEFT"> |
<Offset> |
</Anchor> |
</Anchors> |
</FontString> |
<!-- --> |
<FontString name="$parentExtraValue" inherits="GameFontNormalSmall"> |
<FontString name="$parentExtraValue" |
inherits="GameFontNormalSmall"> |
<Anchors> |
<Anchor point="TOP" relativeTo="$parentExtra" |
relativePoint="BOTTOM"> |
</Anchor> |
</Anchors> |
</FontString> |
<!-- near bottom of Window --> |
<FontString name="$parentCacheBox" inherits="GameFontNormalSmall" justifyH="LEFT"> |
<Size> |
<AbsDimension x="200" y="16"/> |
</Size> |
<Anchors> |
<Anchor point="BOTTOMLEFT" relativeTo="$parent" |
relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="15" y="30"/> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
</Layer> |
</Layers> |
<Frames> |
<Frame name="Accountant_CharDropDown" |
inherits="UIDropDownMenuTemplate" id="1" hidden="false"> |
<Size> |
<AbsDimension x="150" y="16"/> |
</Size> |
<Frame name="Accountant_CharDropDown" inherits="UIDropDownMenuTemplate" id="1" hidden="false"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT"> |
<Offset> |
<OnClick>Accountant.Button_Horde_Toggle();</OnClick> |
</Scripts> |
</CheckButton> |
<Frame name="$parentRow1" inherits="AccountantRowTemplate"> |
<!-- |
<Frame name="AccountantMoneyFrame" |
inherits="SmallMoneyFrameTemplate"> |
<Anchors> |
<Anchor point="TOP" relativeTo="Accountant_CharDropDown" |
relativePoint="BOTTOM"> |
<Offset> |
<AbsDimension x="10" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Frame> |
--> |
<Frame name="$parentRow1" |
inherits="AccountantRowTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parent" |
relativePoint="TOPLEFT"> |
<Offset> |
</Anchor> |
</Anchors> |
</Frame> |
<Frame name="$parentRow2" inherits="AccountantRowTemplate"> |
<Frame name="$parentRow2" |
inherits="AccountantRowTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentRow1" |
relativePoint="BOTTOMLEFT"> |
</Anchor> |
</Anchors> |
</Frame> |
<Frame name="$parentRow3" inherits="AccountantRowTemplate"> |
<Frame name="$parentRow3" |
inherits="AccountantRowTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentRow2" |
relativePoint="BOTTOMLEFT"> |
</Anchor> |
</Anchors> |
</Frame> |
<Frame name="$parentRow4" inherits="AccountantRowTemplate"> |
<Frame name="$parentRow4" |
inherits="AccountantRowTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentRow3" |
relativePoint="BOTTOMLEFT"> |
</Anchor> |
</Anchors> |
</Frame> |
<Frame name="$parentRow5" inherits="AccountantRowTemplate"> |
<Frame name="$parentRow5" |
inherits="AccountantRowTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentRow4" |
relativePoint="BOTTOMLEFT"> |
</Anchor> |
</Anchors> |
</Frame> |
<Frame name="$parentRow6" inherits="AccountantRowTemplate"> |
<Frame name="$parentRow6" |
inherits="AccountantRowTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentRow5" |
relativePoint="BOTTOMLEFT"> |
</Anchor> |
</Anchors> |
</Frame> |
<Frame name="$parentRow7" inherits="AccountantRowTemplate"> |
<Frame name="$parentRow7" |
inherits="AccountantRowTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentRow6" |
relativePoint="BOTTOMLEFT"> |
</Anchor> |
</Anchors> |
</Frame> |
<Frame name="$parentRow8" inherits="AccountantRowTemplate"> |
<Frame name="$parentRow8" |
inherits="AccountantRowTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentRow7" |
relativePoint="BOTTOMLEFT"> |
</Anchor> |
</Anchors> |
</Frame> |
<Frame name="$parentRow9" inherits="AccountantRowTemplate"> |
<Frame name="$parentRow9" |
inherits="AccountantRowTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentRow8" |
relativePoint="BOTTOMLEFT"> |
</Anchor> |
</Anchors> |
</Frame> |
<Frame name="$parentRow10" inherits="AccountantRowTemplate"> |
<Frame name="$parentRow10" |
inherits="AccountantRowTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentRow9" |
relativePoint="BOTTOMLEFT"> |
</Anchor> |
</Anchors> |
</Frame> |
<Frame name="$parentRow11" inherits="AccountantRowTemplate"> |
<Frame name="$parentRow11" |
inherits="AccountantRowTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentRow10" |
relativePoint="BOTTOMLEFT"> |
</Anchor> |
</Anchors> |
</Frame> |
<Frame name="$parentRow12" inherits="AccountantRowTemplate"> |
<Frame name="$parentRow12" |
inherits="AccountantRowTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentRow11" |
relativePoint="BOTTOMLEFT"> |
</Anchor> |
</Anchors> |
</Frame> |
<Frame name="$parentRow13" inherits="AccountantRowTemplate"> |
<Frame name="$parentRow13" |
inherits="AccountantRowTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentRow12" |
relativePoint="BOTTOMLEFT"> |
</Anchor> |
</Anchors> |
</Frame> |
<Frame name="$parentRow14" inherits="AccountantRowTemplate"> |
<Frame name="$parentRow14" |
inherits="AccountantRowTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentRow13" |
relativePoint="BOTTOMLEFT"> |
</Anchor> |
</Anchors> |
</Frame> |
<Frame name="$parentRow15" inherits="AccountantRowTemplate"> |
<Frame name="$parentRow15" |
inherits="AccountantRowTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentRow14" |
relativePoint="BOTTOMLEFT"> |
</Anchors> |
</Frame> |
<Button name="$parentCloseButton" inherits="UIPanelCloseButton"> |
<Button name="$parentCloseButton" |
inherits="UIPanelCloseButton"> |
<Anchors> |
<Anchor point="TOPRIGHT" relativeTo="$parent" |
relativePoint="TOPRIGHT"> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentTab1" inherits="AccountantTabTemplate" id="1"> |
<Button name="$parentExitButton" |
inherits="UIPanelButtonTemplate" text="ACCLOC_EXIT"> |
<Size> |
<AbsDimension x="77" y="21" /> |
</Size> |
<Anchors> |
<Anchor point="BOTTOMRIGHT" relativeTo="$parent" |
relativePoint="BOTTOMRIGHT"> |
<Offset> |
<AbsDimension x="-13" y="13" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick>HideUIPanel(this:GetParent());</OnClick> |
</Scripts> |
</Button> |
<Button name="$parentOptionsButton" |
inherits="UIPanelButtonTemplate" text="ACCLOC_OPTBUT"> |
<Size> |
<AbsDimension x="80" y="22" /> |
</Size> |
<Anchors> |
<Anchor point="TOPRIGHT" |
relativeTo="$parentExitButton" relativePoint="TOPLEFT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick>Accountant.Options_Toggle();</OnClick> |
</Scripts> |
</Button> |
<Button name="$parentResetButton" |
inherits="UIPanelButtonTemplate" text="ACCLOC_RESET"> |
<Size> |
<AbsDimension x="80" y="22" /> |
</Size> |
<Anchors> |
<Anchor point="BOTTOMLEFT" relativeTo="$parent" |
relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="13" y="13" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick>Accountant.ResetData();</OnClick> |
</Scripts> |
</Button> |
<Button name="$parentTab1" inherits="AccountantTabTemplate" |
id="1"> |
<Anchors> |
<Anchor point="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="15" y="46" /> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentTab2" inherits="AccountantTabTemplate" id="2"> |
<Button name="$parentTab2" inherits="AccountantTabTemplate" |
id="2"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentTab1" |
relativePoint="RIGHT"> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentTab3" inherits="AccountantTabTemplate" id="3"> |
<Button name="$parentTab3" inherits="AccountantTabTemplate" |
id="3"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentTab2" |
relativePoint="RIGHT"> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentTab4" inherits="AccountantTabTemplate" id="4"> |
<Button name="$parentTab4" inherits="AccountantTabTemplate" |
id="4"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentTab3" |
relativePoint="RIGHT"> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentTab5" inherits="AccountantTabTemplate" id="5"> |
<Button name="$parentTab5" inherits="AccountantTabTemplate" |
id="5"> |
<Anchors> |
<Anchor point="BOTTOMRIGHT" |
relativePoint="BOTTOMRIGHT"> |
</Anchor> |
</Anchors> |
</Button> |
<Frame name="$parentCacheAmount" inherits="MoneyInputFrameTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentCacheBox" |
relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Frame> |
<Button name="$parentCacheUpdate" inherits="UIPanelButtonTemplate" > |
<Size> |
<AbsDimension x="80" y="22"/> |
</Size> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentCacheAmount" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="0" y="0"/> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick>Accountant.CacheBoxUpdate();</OnClick> |
</Scripts> |
</Button> |
</Frames> |
<Scripts> |
<OnLoad> |
</Offset> |
</Anchor> |
</Anchors> |
<NormalTexture file="Interface\AddOns\Accountant\Artwork\AccountantButton-Up" /> |
<PushedTexture file="Interface\AddOns\Accountant\Artwork\AccountantButton-Down" /> |
<NormalTexture file="Interface\AddOns\Accountant\AccountantButton-Up" /> |
<PushedTexture file="Interface\AddOns\Accountant\AccountantButton-Down" /> |
<HighlightTexture alphaMode="ADD" file="Interface\Minimap\UI-Minimap-ZoomButton-Highlight" /> |
<Scripts> |
<OnClick>Accountant.Button_OnClick();</OnClick> |
</Button> |
</Frames> |
</Frame> |
<!-- Accountant Options frame --> |
<Frame name="AccountantOptionsFrame" toplevel="true" |
frameStrata="DIALOG" movable="true" enableMouse="true" hidden="true" |
parent="UIParent" enableKeyboard="true"> |
<Size> |
<AbsDimension x="300" y="200" /> |
</Size> |
<Anchors> |
<Anchor point="CENTER" /> |
</Anchors> |
<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" |
edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="11" right="12" top="12" bottom="11" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="32" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="32" /> |
</EdgeSize> |
</Backdrop> |
<Layers> |
<Layer level="ARTWORK"> |
<Texture name="AccountantOptionsFrameHeader" |
file="Interface\DialogFrame\UI-DialogBox-Header"> |
<Size> |
<AbsDimension x="256" y="64" /> |
</Size> |
<Anchors> |
<Anchor point="TOP"> |
<Offset> |
<AbsDimension x="0" y="12" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Texture> |
<FontString inherits="GameFontNormal" |
text="ACCOUNTANT_OPTIONS_TITLE"> |
<Anchors> |
<Anchor point="TOP" |
relativeTo="AccountantOptionsFrameHeader"> |
<Offset> |
<AbsDimension x="0" y="-14" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
</Layer> |
</Layers> |
<Frames> |
<CheckButton name="AccountantOptionsFrameToggleButton" |
inherits="OptionsCheckButtonTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="40" y="-30" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick>Accountant.Button_Toggle();</OnClick> |
</Scripts> |
</CheckButton> |
<Slider name="AccountantSliderButtonPos" |
inherits="OptionsSliderTemplate"> |
<Size> |
<AbsDimension x="220" y="16" /> |
</Size> |
<Anchors> |
<Anchor point="TOP"> |
<Offset> |
<AbsDimension x="0" y="-75" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnLoad> |
getglobal(this:GetName().."High"):SetText(); |
getglobal(this:GetName().."Low"):SetText(); |
AccountantSliderButtonPos:SetMinMaxValues(0,360); |
AccountantSliderButtonPos:SetValueStep(1); |
</OnLoad> |
<OnValueChanged> |
<!-- Quel's mod to support totals across all chars |
Accountant_SaveData[UnitName("player")]["options"].buttonpos = |
--> |
Accountant_SaveData[Accountant.player]["options"].buttonpos = AccountantSliderButtonPos:GetValue(); |
Accountant.Button_UpdatePosition(); |
</OnValueChanged> |
</Scripts> |
</Slider> |
<Frame name="$parentWeek" inherits="UIDropDownMenuTemplate" |
enableMouse="true"> |
<Anchors> |
<Anchor point="TOP" relativeTo="$parent" |
relativePoint="TOPLEFT"> |
<Offset> |
<AbsDimension x="87" y="-110" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer level="BACKGROUND"> |
<FontString name="$parentLabel" |
inherits="GameFontNormalSmall" text="ACCLOC_STARTWEEK"> |
<Anchors> |
<Anchor point="BOTTOMLEFT" |
relativePoint="TOPLEFT"> |
<Offset> |
<AbsDimension x="21" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
</Layer> |
</Layers> |
<Scripts> |
<OnLoad>Accountant.OptionsFrameWeek_Init();</OnLoad> |
</Scripts> |
</Frame> |
<Button name="AccountantOptionsFrameDone" |
inherits="OptionsButtonTemplate" text="ACCLOC_DONE"> |
<Anchors> |
<Anchor point="BOTTOMRIGHT" |
relativePoint="BOTTOMRIGHT"> |
<Offset> |
<AbsDimension x="-13" y="13" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick>Accountant.Options_Toggle();</OnClick> |
</Scripts> |
</Button> |
</Frames> |
<Scripts> |
<OnShow>Accountant.Options_OnShow();</OnShow> |
<OnHide>Accountant.Options_OnHide();</OnHide> |
</Scripts> |
</Frame> |
</Ui> |