WoWInterface SVN Accountant

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 1 to Rev 2
    Reverse comparison

Rev 1 → Rev 2

AccountantButton.blp Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
localization.lua New file
0,0 → 1,67
-- Header
ACCLOC_TITLE = "Accountant";
ACCLOC_TOT_IN = "Revenue";
ACCLOC_TOT_OUT = "Expenditures";
ACCLOC_NET = "Net Profit / Loss";
ACCLOC_NETLOSS = "Net Loss";
ACCLOC_NETPROF = "Net Profit";
ACCLOC_SOURCE = "Source";
ACCLOC_IN = "Revenue";
ACCLOC_OUT = "Expenditures";
ACCLOC_WEEKSTART = "Week Start";
ACCLOC_SUM = "Sum Total";
ACCLOC_CHAR = "Character";
ACCLOC_MONEY = "Money";
ACCLOC_UPDATED = "Updated";
ACCLOC_ALLIANCE = "Alliance"
ACCLOC_HORDE = "Horde"
 
-- Section Labels
ACCLOC_LOOT = "Loot";
ACCLOC_QUEST = "Quest Rewards";
ACCLOC_MERCH = "Merchants";
ACCLOC_TRADE = "Trade Window";
ACCLOC_MAIL = "Mail";
ACCLOC_TRAIN = "Training Costs";
ACCLOC_TAXI = "Taxi Fares";
ACCLOC_OTHER = "Unknown";
ACCLOC_REPAIR = "Repair Costs";
ACCLOC_AUC = "Auction House";
 
-- Buttons
ACCLOC_RESET = "Clear Data";
ACCLOC_OPTBUT = "Options";
ACCLOC_EXIT = "Exit";
 
-- Tabs
ACCLOC_SESS = "Session";
ACCLOC_DAY = "Day";
ACCLOC_WEEK = "Week";
ACCLOC_TOTAL = "Total";
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_TUE = "Tuesday";
ACCLOC_WD_WED = "Wednesday";
ACCLOC_WD_THU = "Thursday";
ACCLOC_WD_FRI = "Friday";
ACCLOC_WD_SAT = "Saturday";
ACCLOC_DONE = "Done";
 
-- Misc
ACCLOC_RESET_CONF = "Are you sure you want to reset the";
ACCLOC_NEWPROFILE = "New Accountant profile created for";
ACCLOC_LOADPROFILE = "Loaded Accountant Profile for";
ACCLOC_LOADED = "Loaded";
ACCLOC_RCLICK = "Right-Click"
ACCLOC_LCLICK = "Left-Click"
 
-- Key Bindings headers
BINDING_HEADER_ACCOUNTANT = "Accountant";
BINDING_NAME_ACCOUNTANTTOG = "Toggle Accountant";
\ No newline at end of file
AccountantButton-Up.blp Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
AccountantData.lua New file
0,0 → 1,31
 
 
--[[
AccountantData.lua
 
Declare the global namespace, data, and constants
--]]
 
-- Reserve the naamespace
Accountant = {}
-- Saved by WoW so leave in global namespace
Accountant_SaveData = nil;
 
-- Create a short cut
local SC = Accountant
 
SC.Version = "3.3";
SC.AUTHOR = "urnati"
ACCOUNTANT_OPTIONS_TITLE = "Accountant Options";
ACCOUNTANT_BUTTON_TOOLTIP = "Toggle Accountant";
 
SC.log_modes = {"Session","Day","Week","Total"};
SC.log_modes_short = {"Sess","Day","Week","Tot"};
 
-- Store the list of characters to be displayed.
-- Same realm and faction
SC.Toons = {}
SC.Faction = ""
SC.ShowAlliance = nil
SC.ShowHorde = nil
 
\ No newline at end of file
libs/LibDataBroker-1.1/LibDataBroker-1.1.lua New file
0,0 → 1,66
 
assert(LibStub, "LibDataBroker-1.1 requires LibStub")
assert(LibStub:GetLibrary("CallbackHandler-1.0", true), "LibDataBroker-1.1 requires CallbackHandler-1.0")
 
local lib, oldminor = LibStub:NewLibrary("LibDataBroker-1.1", 3)
if not lib then return end
oldminor = oldminor or 0
 
 
lib.callbacks = lib.callbacks or LibStub:GetLibrary("CallbackHandler-1.0"):New(lib)
lib.attributestorage, lib.namestorage, lib.proxystorage = lib.attributestorage or {}, lib.namestorage or {}, lib.proxystorage or {}
local attributestorage, namestorage, callbacks = lib.attributestorage, lib.namestorage, lib.callbacks
 
if oldminor < 2 then
lib.domt = {
__metatable = "access denied",
__index = function(self, key) return attributestorage[self] and attributestorage[self][key] end,
}
end
 
if oldminor < 3 then
lib.domt.__newindex = function(self, key, value)
if not attributestorage[self] then attributestorage[self] = {} end
if attributestorage[self][key] == value then return end
attributestorage[self][key] = value
local name = namestorage[self]
if not name then return end
callbacks:Fire("LibDataBroker_AttributeChanged", name, key, value, self)
callbacks:Fire("LibDataBroker_AttributeChanged_"..name, name, key, value, self)
callbacks:Fire("LibDataBroker_AttributeChanged_"..name.."_"..key, name, key, value, self)
callbacks:Fire("LibDataBroker_AttributeChanged__"..key, name, key, value, self)
end
end
 
if oldminor < 2 then
function lib:NewDataObject(name, dataobj)
if self.proxystorage[name] then return end
 
if dataobj then
assert(type(dataobj) == "table", "Invalid dataobj, must be nil or a table")
self.attributestorage[dataobj] = {}
for i,v in pairs(dataobj) do
self.attributestorage[dataobj][i] = v
dataobj[i] = nil
end
end
dataobj = setmetatable(dataobj or {}, self.domt)
self.proxystorage[name], self.namestorage[dataobj] = dataobj, name
self.callbacks:Fire("LibDataBroker_DataObjectCreated", name, dataobj)
return dataobj
end
end
 
if oldminor < 1 then
function lib:DataObjectIterator()
return pairs(self.proxystorage)
end
 
function lib:GetDataObjectByName(dataobjectname)
return self.proxystorage[dataobjectname]
end
 
function lib:GetNameByDataObject(dataobject)
return self.namestorage[dataobject]
end
end
libs/LibStub/LibStub.lua New file
0,0 → 1,30
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info
-- LibStub is hereby placed in the Public Domain Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
local LibStub = _G[LIBSTUB_MAJOR]
 
if not LibStub or LibStub.minor < LIBSTUB_MINOR then
LibStub = LibStub or {libs = {}, minors = {} }
_G[LIBSTUB_MAJOR] = LibStub
LibStub.minor = LIBSTUB_MINOR
 
function LibStub:NewLibrary(major, minor)
assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.")
 
local oldminor = self.minors[major]
if oldminor and oldminor >= minor then return nil end
self.minors[major], self.libs[major] = minor, self.libs[major] or {}
return self.libs[major], oldminor
end
 
function LibStub:GetLibrary(major, silent)
if not self.libs[major] and not silent then
error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
end
return self.libs[major], self.minors[major]
end
 
function LibStub:IterateLibraries() return pairs(self.libs) end
setmetatable(LibStub, { __call = LibStub.GetLibrary })
end
libs/LibStub/LibStub.toc New file
0,0 → 1,9
## Interface: 20100
## Title: Lib: LibStub
## Notes: Universal Library Stub
## Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel
## X-Website: http://jira.wowace.com/browse/LS | http://www.wowace.com/wiki/LibStub
## X-Category: Library
## X-License: Public Domain
 
LibStub.lua
libs/CallbackHandler-1.0/CallbackHandler-1.0.xml New file
0,0 → 1,4
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="CallbackHandler-1.0.lua"/>
</Ui>
\ No newline at end of file
libs/CallbackHandler-1.0/CallbackHandler-1.0.lua New file
0,0 → 1,239
--[[ $Id: CallbackHandler-1.0.lua 60697 2008-02-09 16:51:20Z nevcairiel $ ]]
local MAJOR, MINOR = "CallbackHandler-1.0", 3
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)
 
if not CallbackHandler then return end -- No upgrade needed
 
local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end}
 
local type = type
local pcall = pcall
local pairs = pairs
local assert = assert
local concat = table.concat
local loadstring = loadstring
local next = next
local select = select
local type = type
local xpcall = xpcall
 
local function errorhandler(err)
return geterrorhandler()(err)
end
 
local function CreateDispatcher(argCount)
local code = [[
local next, xpcall, eh = ...
 
local method, ARGS
local function call() method(ARGS) end
 
local function dispatch(handlers, ...)
local index
index, method = next(handlers)
if not method then return end
local OLD_ARGS = ARGS
ARGS = ...
repeat
xpcall(call, eh)
index, method = next(handlers, index)
until not method
ARGS = OLD_ARGS
end
 
return dispatch
]]
 
local ARGS, OLD_ARGS = {}, {}
for i = 1, argCount do ARGS[i], OLD_ARGS[i] = "arg"..i, "old_arg"..i end
code = code:gsub("OLD_ARGS", concat(OLD_ARGS, ", ")):gsub("ARGS", concat(ARGS, ", "))
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(next, xpcall, errorhandler)
end
 
local Dispatchers = setmetatable({}, {__index=function(self, argCount)
local dispatcher = CreateDispatcher(argCount)
rawset(self, argCount, dispatcher)
return dispatcher
end})
 
--------------------------------------------------------------------------
-- CallbackHandler:New
--
-- target - target object to embed public APIs in
-- RegisterName - name of the callback registration API, default "RegisterCallback"
-- UnregisterName - name of the callback unregistration API, default "UnregisterCallback"
-- UnregisterAllName - name of the API to unregister all callbacks, default "UnregisterAllCallbacks". false == don't publish this API.
 
function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAllName, OnUsed, OnUnused)
-- TODO: Remove this after beta has gone out
assert(not OnUsed and not OnUnused, "ACE-80: OnUsed/OnUnused are deprecated. Callbacks are now done to registry.OnUsed and registry.OnUnused")
 
RegisterName = RegisterName or "RegisterCallback"
UnregisterName = UnregisterName or "UnregisterCallback"
if UnregisterAllName==nil then -- false is used to indicate "don't want this method"
UnregisterAllName = "UnregisterAllCallbacks"
end
 
-- we declare all objects and exported APIs inside this closure to quickly gain access
-- to e.g. function names, the "target" parameter, etc
 
 
-- Create the registry object
local events = setmetatable({}, meta)
local registry = { recurse=0, events=events }
 
-- registry:Fire() - fires the given event/message into the registry
function registry:Fire(eventname, ...)
if not rawget(events, eventname) or not next(events[eventname]) then return end
local oldrecurse = registry.recurse
registry.recurse = oldrecurse + 1
 
Dispatchers[select('#', ...) + 1](events[eventname], eventname, ...)
 
registry.recurse = oldrecurse
 
if registry.insertQueue and oldrecurse==0 then
-- Something in one of our callbacks wanted to register more callbacks; they got queued
for eventname,callbacks in pairs(registry.insertQueue) do
local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten.
for self,func in pairs(callbacks) do
events[eventname][self] = func
-- fire OnUsed callback?
if first and registry.OnUsed then
registry.OnUsed(registry, target, eventname)
first = nil
end
end
end
registry.insertQueue = nil
end
end
 
-- Registration of a callback, handles:
-- self["method"], leads to self["method"](self, ...)
-- self with function ref, leads to functionref(...)
-- "addonId" (instead of self) with function ref, leads to functionref(...)
-- all with an optional arg, which, if present, gets passed as first argument (after self if present)
target[RegisterName] = function(self, eventname, method, ... --[[actually just a single arg]])
if type(eventname) ~= "string" then
error("Usage: "..RegisterName.."(eventname, method[, arg]): 'eventname' - string expected.", 2)
end
 
method = method or eventname
 
local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten.
 
if type(method) ~= "string" and type(method) ~= "function" then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - string or function expected.", 2)
end
 
local regfunc
 
if type(method) == "string" then
-- self["method"] calling style
if type(self) ~= "table" then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): self was not a table?", 2)
elseif self==target then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): do not use Library:"..RegisterName.."(), use your own 'self'", 2)
elseif type(self[method]) ~= "function" then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - method '"..tostring(method).."' not found on self.", 2)
end
 
if select("#",...)>=1 then -- this is not the same as testing for arg==nil!
local arg=select(1,...)
regfunc = function(...) self[method](self,arg,...) end
else
regfunc = function(...) self[method](self,...) end
end
else
-- function ref with self=object or self="addonId"
if type(self)~="table" and type(self)~="string" then
error("Usage: "..RegisterName.."(self or \"addonId\", eventname, method): 'self or addonId': table or string expected.", 2)
end
 
if select("#",...)>=1 then -- this is not the same as testing for arg==nil!
local arg=select(1,...)
regfunc = function(...) method(arg,...) end
else
regfunc = method
end
end
 
 
if events[eventname][self] or registry.recurse<1 then
-- if registry.recurse<1 then
-- we're overwriting an existing entry, or not currently recursing. just set it.
events[eventname][self] = regfunc
-- fire OnUsed callback?
if registry.OnUsed and first then
registry.OnUsed(registry, target, eventname)
end
else
-- we're currently processing a callback in this registry, so delay the registration of this new entry!
-- yes, we're a bit wasteful on garbage, but this is a fringe case, so we're picking low implementation overhead over garbage efficiency
registry.insertQueue = registry.insertQueue or setmetatable({},meta)
registry.insertQueue[eventname][self] = regfunc
end
end
 
-- Unregister a callback
target[UnregisterName] = function(self, eventname)
if not self or self==target then
error("Usage: "..UnregisterName.."(eventname): bad 'self'", 2)
end
if type(eventname) ~= "string" then
error("Usage: "..UnregisterName.."(eventname): 'eventname' - string expected.", 2)
end
if rawget(events, eventname) and events[eventname][self] then
events[eventname][self] = nil
-- Fire OnUnused callback?
if registry.OnUnused and not next(events[eventname]) then
registry.OnUnused(registry, target, eventname)
end
end
if registry.insertQueue and rawget(registry.insertQueue, eventname) and registry.insertQueue[eventname][self] then
registry.insertQueue[eventname][self] = nil
end
end
 
-- OPTIONAL: Unregister all callbacks for given selfs/addonIds
if UnregisterAllName then
target[UnregisterAllName] = function(...)
if select("#",...)<1 then
error("Usage: "..UnregisterAllName.."([whatFor]): missing 'self' or \"addonId\" to unregister events for.", 2)
end
if select("#",...)==1 and ...==target then
error("Usage: "..UnregisterAllName.."([whatFor]): supply a meaningful 'self' or \"addonId\"", 2)
end
 
 
for i=1,select("#",...) do
local self = select(i,...)
if registry.insertQueue then
for eventname, callbacks in pairs(registry.insertQueue) do
if callbacks[self] then
callbacks[self] = nil
end
end
end
for eventname, callbacks in pairs(events) do
if callbacks[self] then
callbacks[self] = nil
-- Fire OnUnused callback?
if registry.OnUnused and not next(callbacks) then
registry.OnUnused(registry, target, eventname)
end
end
end
end
end
end
 
return registry
end
 
 
-- CallbackHandler purposefully does NOT do explicit embedding. Nor does it
-- try to upgrade old implicit embeds since the system is selfcontained and
-- relies on closures to work.
 
AccountantButton-Down.blp Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
Bindings.xml New file
0,0 → 1,5
<Bindings>
<Binding name="ACCOUNTANTTOG" header="ACCOUNTANT">
Accountant.Button_OnClick();
</Binding>
</Bindings>
Accountant.xml New file
0,0 → 1,823
<!--
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">
<Script file="AccountantData.lua" />
<Script file="localization.lua" />
<Script file="Accountant.lua" />
<!-- Item Row Template -->
<Button name="AccountantTabTemplate"
inherits="CharacterFrameTabButtonTemplate" virtual="true">
<Scripts>
<OnClick>Accountant.Tab_OnClick();</OnClick>
</Scripts>
</Button>
<FontString name="AccountantTextTemplate"
inherits="GameFontHighlightSmall" virtual="true">
<Size>
<AbsDimension x="100" y="10" />
</Size>
</FontString>
 
<Frame name="AccountantRowTemplate" virtual="true">
<Size>
<AbsDimension x="320" y="19" />
</Size>
<Layers>
<Layer level="BACKGROUND">
<FontString name="$parentTitle"
inherits="GameFontNormal">
<Anchors>
<Anchor point="TOPLEFT"
relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="3" y="-2" />
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentIn"
inherits="GameFontHighlightSmall">
<Anchors>
<Anchor point="TOPRIGHT"
relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="225" y="-4" />
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentOut"
inherits="GameFontHighlightSmall">
<Anchors>
<Anchor point="TOPRIGHT"
relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="317" y="-4" />
</Offset>
</Anchor>
</Anchors>
</FontString>
<Texture
file="Interface\AuctionFrame\UI-AuctionItemNameFrame">
<Size>
<AbsDimension x="400" y="19" />
</Size>
<Anchors>
<Anchor point="TOPLEFT"
relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
</Layers>
</Frame>
 
<!-- Main Window -->
<Frame name="AccountantFrame" toplevel="true" enableMouse="true"
frameStrata="HIGH" movable="true" parent="UIParent" hidden="true">
<Size>
<AbsDimension x="384" y="539" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="400" y="-104" />
</Offset>
</Anchor>
</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="BACKGROUND">
<Texture name="AccountantFramePortrait">
<Size>
<AbsDimension x="60" y="60" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="7" y="-6" />
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
-->
<Layer level="ARTWORK">
<FontString name="$parentTitleText"
inherits="GameFontHighlight" text="SOME_TITLE">
<Size>
<AbsDimension x="300" y="14" />
</Size>
<Anchors>
<Anchor point="TOP" relativePoint="TOP">
<Offset>
<AbsDimension x="30" y="-16" />
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentMoneyTotal" justifyH = "RIGHT"
inherits="AccountantTextTemplate">
<Anchors>
<Anchor point="TOPLEFT"
relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="8" y="-40" />
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentSource"
inherits="GameFontHighlight">
<Anchors>
<Anchor point="TOPLEFT"
relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="24" y="-123" />
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentIn"
inherits="GameFontHighlight">
<Anchors>
<Anchor point="LEFT" relativeTo="$parentSource"
relativePoint="LEFT">
<Offset>
<AbsDimension x="145" y="0" />
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentOut"
inherits="GameFontHighlight">
<Anchors>
<Anchor point="LEFT" relativeTo="$parentIn"
relativePoint="LEFT">
<Offset>
<AbsDimension x="91" y="0" />
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentTotalIn"
inherits="AccountantTextTemplate" justifyH = "LEFT">
<Anchors>
<Anchor point="TOPLEFT"
relativeTo="$parent"
relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="20" y="-80" />
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentTotalInValue"
inherits="AccountantTextTemplate" justifyH = "RIGHT">
<Anchors>
<Anchor point="LEFT" relativeTo="$parentTotalIn"
relativePoint="RIGHT">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentTotalOut"
inherits="AccountantTextTemplate" justifyH = "LEFT">
<Anchors>
<Anchor point="TOP" relativeTo="$parentTotalIn"
relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-3" />
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentTotalOutValue"
inherits="AccountantTextTemplate" justifyH = "RIGHT">
<Anchors>
<Anchor point="LEFT"
relativeTo="$parentTotalOut" relativePoint="RIGHT">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentTotalFlow"
inherits="AccountantTextTemplate" justifyH = "LEFT">
<Anchors>
<Anchor point="TOP" relativeTo="$parentTotalOut"
relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-3" />
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentTotalFlowValue"
inherits="AccountantTextTemplate" justifyH = "RIGHT">
<Anchors>
<Anchor point="LEFT"
relativeTo="$parentTotalFlow" relativePoint="RIGHT">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentExtra"
inherits="GameFontHighlightSmall">
<Anchors>
<Anchor point="TOP" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="240" y="-39" />
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentExtraValue"
inherits="GameFontNormalSmall">
<Anchors>
<Anchor point="TOP" relativeTo="$parentExtra"
relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
 
<Frames>
<Frame name="Accountant_CharDropDown" inherits="UIDropDownMenuTemplate" id="1" hidden="false">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="0" y="-10"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnShow>
Accountant.CharDropDown_OnShow();
</OnShow>
</Scripts>
</Frame>
<Frame name="AccountantMoneyTotal" >
<Anchors>
<Anchor point="TOP" relativeTo="Accountant_CharDropDown"
relativePoint="BOTTOM">
<Offset>
<AbsDimension x="10" y="0" />
</Offset>
</Anchor>
</Anchors>
</Frame>
<CheckButton name="AccountantFrameAllianceToggleButton"
inherits="OptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="$parent"
relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="-70" y="-70" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>Accountant.Button_Alliance_Toggle();</OnClick>
</Scripts>
</CheckButton>
<CheckButton name="AccountantFrameHordeToggleButton"
inherits="OptionsCheckButtonTemplate">
<Anchors>
<Anchor point="BOTTOMLEFT" relativeTo="AccountantFrameAllianceToggleButton"
relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>Accountant.Button_Horde_Toggle();</OnClick>
</Scripts>
</CheckButton>
<!--
<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>
<AbsDimension x="21" y="-141" />
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentRow2"
inherits="AccountantRowTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentRow1"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-1" />
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentRow3"
inherits="AccountantRowTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentRow2"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-1" />
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentRow4"
inherits="AccountantRowTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentRow3"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-1" />
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentRow5"
inherits="AccountantRowTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentRow4"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-1" />
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentRow6"
inherits="AccountantRowTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentRow5"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-1" />
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentRow7"
inherits="AccountantRowTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentRow6"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-1" />
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentRow8"
inherits="AccountantRowTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentRow7"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-1" />
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentRow9"
inherits="AccountantRowTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentRow8"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-1" />
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentRow10"
inherits="AccountantRowTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentRow9"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-1" />
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentRow11"
inherits="AccountantRowTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentRow10"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-1" />
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentRow12"
inherits="AccountantRowTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentRow11"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-1" />
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentRow13"
inherits="AccountantRowTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentRow12"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-1" />
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentRow14"
inherits="AccountantRowTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentRow13"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-1" />
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentRow15"
inherits="AccountantRowTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentRow14"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-1" />
</Offset>
</Anchor>
</Anchors>
</Frame>
 
<Button name="$parentCloseButton"
inherits="UIPanelCloseButton">
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="$parent"
relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="-8" y="-8" />
</Offset>
</Anchor>
</Anchors>
</Button>
<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" />
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentTab2" inherits="AccountantTabTemplate"
id="2">
<Anchors>
<Anchor point="LEFT" relativeTo="$parentTab1"
relativePoint="RIGHT">
<Offset>
<AbsDimension x="-15" y="0" />
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentTab3" inherits="AccountantTabTemplate"
id="3">
<Anchors>
<Anchor point="LEFT" relativeTo="$parentTab2"
relativePoint="RIGHT">
<Offset>
<AbsDimension x="-15" y="0" />
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentTab4" inherits="AccountantTabTemplate"
id="4">
<Anchors>
<Anchor point="LEFT" relativeTo="$parentTab3"
relativePoint="RIGHT">
<Offset>
<AbsDimension x="-15" y="0" />
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentTab5" inherits="AccountantTabTemplate"
id="5">
<Anchors>
<Anchor point="BOTTOMRIGHT"
relativePoint="BOTTOMRIGHT">
<Offset>
<AbsDimension x="-40" y="46" />
</Offset>
</Anchor>
</Anchors>
</Button>
</Frames>
<Scripts>
<OnLoad>
 
-- Make Frame Moveable.
tinsert(UISpecialFrames, "AccountantFrame");
UIPanelWindows["AccountantFrame"] = { area = "left", pushable = 11 };
this:RegisterForDrag("LeftButton");
 
-- Setup
Accountant.RegisterEvents();
</OnLoad>
<OnShow>Accountant.OnShow();</OnShow>
<OnHide>Accountant.OnHide();</OnHide>
<OnEvent>Accountant.OnEvent(event, arg1);</OnEvent>
<OnDragStart>this:StartMoving();</OnDragStart>
<OnDragStop>this:StopMovingOrSizing();</OnDragStop>
<OnMouseUp>this:StopMovingOrSizing();</OnMouseUp>
</Scripts>
</Frame>
<GameTooltip name="AccountantTooltip" inherits="GameTooltipTemplate"
parent="UIParent" hidden="true" />
 
<!-- Button on Minimap -->
<Frame name="AccountantButtonFrame" parent="Minimap"
enableMouse="true" hidden="false" frameStrata="LOW">
<Size>
<AbsDimension x="32" y="32" />
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="Minimap"
relativePoint="RIGHT">
<Offset>
<AbsDimension x="2" y="0" />
</Offset>
</Anchor>
</Anchors>
<Frames>
<Button name="AccountantButton">
<Size>
<AbsDimension x="32" y="32" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
<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>
</Scripts>
</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>
Accountant.lua New file
0,0 → 1,1660
--[[
Accountant
Originally by Sabaki (sabaki@gmail.com)
Redone by urnati - 3.0
 
Tracks your incoming / outgoing cash
 
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
]]
 
-- 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;
SC.verbose = false;
SC.got_name = false;
SC.current_tab = 1;
Accountant.player = "";
SC.show_toons = ""
SC.could_repair = false;
SC.can_repair = "";
SC.repair_cost, SC.repair_money = 0,0;
local Accountant_RepairAllItems_old;
local Accountant_CursorHasItem_old;
local tmpstr = "";
 
 
--[[
AccountantButton.lua
 
Declare the minimap button routines for Accountant
]]
 
--
-- Toggle the Accountant window on click of the mini-map button
--
function SC.Button_OnClick()
if AccountantFrame:IsVisible() then
HideUIPanel(AccountantFrame);
else
ShowUIPanel(AccountantFrame);
end
 
end
 
--
-- 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
 
--
-- 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
AccountantButtonFrame:Hide();
end
end
 
--
-- 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;
else
AccountantButtonFrame:Show();
Accountant_SaveData[SC.Button_makename()]["options"].showbutton = true;
end
end
 
--
-- Place the mini-map button where the user selects for that character.
--
function SC.Button_UpdatePosition()
AccountantButtonFrame:SetPoint(
"TOPLEFT",
"Minimap",
"TOPLEFT",
50 - (75 * cos(Accountant_SaveData[SC.Button_makename()]["options"].buttonpos)),
(75 * sin(Accountant_SaveData[SC.Button_makename()]["options"].buttonpos)) - 50
--[[
55 - (75 * cos(Accountant_SaveData[SC.Button_makename()]["options"].buttonpos)),
(75 * sin(Accountant_SaveData[SC.Button_makename()]["options"].buttonpos)) - 55
--]]
);
end
 
 
--[[
AccountantButton.lua end
]]
 
--[[
AccountantOptions.lua begin
]]
 
--
-- 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
 
--
-- Create the options window frame on load
--
function Accountant.Options_OnLoad()
UIPanelWindows['AccountantOptionsFrame'] = {area = 'center', pushable = 0};
end
 
 
--
-- Draw the options window frame when requested
--
function Accountant.Options_OnShow()
AccountantOptionsFrameToggleButtonText:SetText(ACCLOC_MINIBUT);
AccountantSliderButtonPosText:SetText(ACCLOC_BUTPOS);
AccountantOptionsFrameWeekLabel:SetText(ACCLOC_STARTWEEK);
 
AccountantOptionsFrameToggleButton:SetChecked(Accountant_SaveData[Accountant.player]["options"].showbutton);
 
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 week start options window frame on load
--
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
 
--
-- 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
]]
 
-- Set the LDB framework for the other LDB routines
SC.LDB_frame = CreateFrame("Frame")
SC.LDB_frame.obj = {}
--
-- Initialize the Data Broker 'button'
--
function SC:LDB_Init()
SC.LDB_frame.obj =
LibStub("LibDataBroker-1.1"):NewDataObject("Accountant_LDB", {
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,
 
OnTooltipShow = function(tooltip)
SC.LDB_OnTooltipShow(tooltip)
end,
})
end
 
--
-- Update the Data Broker 'button'
-- Used by Accountant
--
function SC:LDB_Update()
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
SC.LDB_frame.obj.text =
"|cFFF5B800"..mode..FONT_COLOR_CODE_CLOSE
.." "..SC.NiceNetCash(cash)
end
 
--
-- 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 strtmp = ""
if SC.show_toons == ACCLOC_CHARS then
strtmp = ACCLOC_CHARS
else
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
-- ..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_RCLICK
.." "..BINDING_NAME_ACCOUNTANTTOG
..FONT_COLOR_CODE_CLOSE;
tooltip:AddLine(tt_str)
--]]
end
--
-- get the detail of user selected toons for the requested mode
--
function SC.LDB_GetTooltipDetail(tooltip)
local TotalRowIn
local TotalRowOut
local TotalIn = 0
local TotalOut = 0
local mode = ""
local tt_str = ""
local tmpstr = ""
 
mode = SC.log_modes[SC.current_tab];
 
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"]
if (string.find(player, SC.Realm) ~= nil)
and (( (faction == ACCLOC_ALLIANCE)
and (SC.ShowAlliance == true) )
or ( (faction == ACCLOC_HORDE)
and (SC.ShowHorde == true) ))
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;
 
TotalRowOut = TotalRowOut + Accountant_SaveData[player]["data"][key][mode].Out;
end
end
 
--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.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
]]
 
--[[
Accountant.lua begin
]]
 
--
-- 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("QUEST_COMPLETE");
this:RegisterEvent("QUEST_FINISHED");
 
this:RegisterEvent("LOOT_OPENED");
this:RegisterEvent("LOOT_CLOSED");
 
this:RegisterEvent("TAXIMAP_OPENED");
this:RegisterEvent("TAXIMAP_CLOSED");
 
this:RegisterEvent("TRADE_SHOW");
this:RegisterEvent("TRADE_CLOSE");
 
this:RegisterEvent("MAIL_SHOW");
this:RegisterEvent("MAIL_INBOX_UPDATE");
this:RegisterEvent("MAIL_CLOSED");
-- this:RegisterEvent("MAIL_SEND_INFO_UPDATE");
-- this:RegisterEvent("MAIL_SEND_SUCCESS");
 
this:RegisterEvent("TRAINER_SHOW");
this:RegisterEvent("TRAINER_CLOSED");
 
this:RegisterEvent("AUCTION_HOUSE_SHOW");
this:RegisterEvent("AUCTION_HOUSE_CLOSED");
 
this:RegisterEvent("PLAYER_MONEY");
 
this:RegisterEvent("UNIT_NAME_UPDATE");
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
 
--
-- 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("");
getglobal("AccountantFrameRow"..i.."In"):SetText("");
getglobal("AccountantFrameRow"..i.."Out"):SetText("");
end
 
AccountantFrameAllianceToggleButtonText:SetText(ACCLOC_ALLIANCE);
AccountantFrameAllianceToggleButton:SetChecked(Accountant_SaveData[Accountant.player]["options"].showAlliance);
AccountantFrameHordeToggleButtonText:SetText(ACCLOC_HORDE);
AccountantFrameHordeToggleButton:SetChecked(Accountant_SaveData[Accountant.player]["options"].showHorde);
 
if SC.current_tab == 5 then
AccountantFrameSource:SetText(ACCLOC_CHAR);
AccountantFrameIn:SetText(ACCLOC_MONEY);
AccountantFrameOut:SetText(ACCLOC_UPDATED);
AccountantFrameTotalIn:SetText("");
AccountantFrameTotalOut:SetText("");
AccountantFrameTotalFlow:SetText("");
AccountantFrameTotalInValue:SetText("");
AccountantFrameTotalOutValue:SetText("");
AccountantFrameTotalFlowValue:SetText("");
--AccountantFrameResetButton:Hide();
return;
end
 
AccountantFrameMoneyTotal:SetText("")
 
AccountantFrameSource:SetText(ACCLOC_SOURCE);
AccountantFrameIn:SetText(ACCLOC_IN);
AccountantFrameOut:SetText(ACCLOC_OUT);
AccountantFrameTotalIn:SetText(ACCLOC_TOT_IN..":");
AccountantFrameTotalOut:SetText(ACCLOC_TOT_OUT..":");
AccountantFrameTotalFlow:SetText(ACCLOC_NET..":");
 
-- Row Labels (auto generate)
InPos = 1
for key,value in next,SC.data do
SC.data[key].InPos = InPos;
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
 
--
-- Do all the setup needed on load of Accountant
--
function SC.OnLoad()
SC.Realm = GetRealmName();
SC.Char = UnitName("player");
SC.Faction = UnitFactionGroup("player")
SC.player = SC.Realm.."-"..SC.Char;
SC.AllDropdown = ACCLOC_CHARS
 
-- default behaviour
SC.show_toons = ACCLOC_CHARS
 
-- shamelessly print a load message to chat window
DEFAULT_CHAT_FRAME:AddMessage(
GREEN_FONT_COLOR_CODE.."Accountant "
..SC.Version
.." by "
..FONT_COLOR_CODE_CLOSE
.."|cFFFFFF00"..SC.AUTHOR..FONT_COLOR_CODE_CLOSE
.." for "
..SC.player
);
 
-- Setup
SC.LoadData();
SC.SetLabels();
 
-- Current Cash
SC.current_money = GetMoney();
SC.last_money = SC.current_money;
 
-- Register the slash Commands
SlashCmdList["ACCOUNTANT"] = SC.Slash;
SLASH_ACCOUNTANT1 = "/accountant";
SLASH_ACCOUNTANT2 = "/acc";
 
-- Add myAddOns support
if myAddOnsList then
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
StaticPopupDialogs["ACCOUNTANT_RESET"] = {
text = TEXT("meh"),
button1 = TEXT(OKAY),
button2 = TEXT(CANCEL),
OnAccept = function()
SC.ResetConfirmed();
end,
showAlert = 1,
timeout = 0,
exclusive = 1,
whileDead = 1,
interruptCinematic = 1
};
 
-- Set the tabs at the bottom of the Accountant window
AccountantFrameTab1:SetText(ACCLOC_SESS);
-- For some reason, WoW Lich King does not like _TabResize
-- but it does not effect the look so it is commented
-- out for now.
-- PanelTemplates_TabResize(10, AccountantFrameTab1);
AccountantFrameTab2:SetText(ACCLOC_DAY);
-- PanelTemplates_TabResize(10, AccountantFrameTab1);
AccountantFrameTab3:SetText(ACCLOC_WEEK);
-- PanelTemplates_TabResize(10, AccountantFrameTab2);
AccountantFrameTab4:SetText(ACCLOC_TOTAL);
-- PanelTemplates_TabResize(10, AccountantFrameTab4);
AccountantFrameTab5:SetText(ACCLOC_CHARS);
-- PanelTemplates_TabResize(10, AccountantFrameTab5);
PanelTemplates_SetNumTabs(AccountantFrame, 5);
PanelTemplates_SetTab(AccountantFrame, AccountantFrameTab1);
PanelTemplates_UpdateTabs(AccountantFrame);
 
-- init the data broker 'button'
SC:LDB_Init()
SC:LDB_Update()
 
end
 
--
-- 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};
SC.data["QUEST"] = {Title = ACCLOC_QUEST};
SC.data["TRADE"] = {Title = ACCLOC_TRADE};
SC.data["MAIL"] = {Title = ACCLOC_MAIL};
SC.data["AH"] = {Title = ACCLOC_AUC};
SC.data["TRAIN"] = {Title = ACCLOC_TRAIN};
SC.data["TAXI"] = {Title = ACCLOC_TAXI};
SC.data["REPAIRS"] = {Title = ACCLOC_REPAIR};
SC.data["OTHER"] = {Title = ACCLOC_OTHER};
 
for key,value in next,SC.data do
for modekey,mode in next,SC.log_modes do
SC.data[key][mode] = {In=0,Out=0};
end
end
 
-- If the data structure used does not exist, this is the first time Accountant
-- has been run on this machine
if(Accountant_SaveData == nil) then
Accountant_SaveData = {};
end
 
-- If the player does not exist, this is the first time
-- the player has been logged in on this machine.
if (Accountant_SaveData[Accountant.player] == nil ) then
cdate = date();
cdate = string.sub(cdate,0,8);
cweek = "";
Accountant_SaveData[Accountant.player] = {options
={showbutton=true,
buttonpos=0,
version=SC.Version,
date=cdate,
weekdate=cweek,
weekstart=3,
totalcash=0},
data={},
current_tab=1,
show_toons = ACCLOC_CHARS};
 
-- 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"];
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"];
end
end
end
-- SC.Print(ACCLOC_NEWPROFILE.." "..Accountant.player);
else
-- SC.Print(ACCLOC_LOADPROFILE.." "..Accountant.player);
end
 
-- If the faction does not exist, this is the first time the version 3.1
-- has been run on this machine
if (Accountant_SaveData[SC.Button_makename()]["options"].showAlliance == nil) then
Accountant_SaveData[SC.Button_makename()]["options"].showAlliance = true;
end
if (Accountant_SaveData[SC.Button_makename()]["options"].showHorde == nil) then
Accountant_SaveData[SC.Button_makename()]["options"].showHorde = true;
SC.ShowHorde = true
end
SC.ShowAlliance = Accountant_SaveData[SC.Button_makename()]["options"].showAlliance
SC.ShowHorde = Accountant_SaveData[SC.Button_makename()]["options"].showHorde
 
order = 1;
for key,value in next,SC.data do
if Accountant_SaveData[Accountant.player]["data"][key] == nil then
Accountant_SaveData[Accountant.player]["data"][key] = {}
end
for modekey,mode in next,SC.log_modes do
if Accountant_SaveData[Accountant.player]["data"][key][mode] == nil then
Accountant_SaveData[Accountant.player]["data"][key][mode] = {In=0,Out=0};
end
SC.data[key][mode].In = Accountant_SaveData[Accountant.player]["data"][key][mode].In;
SC.data[key][mode].Out = Accountant_SaveData[Accountant.player]["data"][key][mode].Out;
end
SC.data[key]["Session"].In = 0;
SC.data[key]["Session"].Out = 0;
 
-- 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;
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;
SC.data[key]["Total"].Out = Accountant_SaveData[Accountant.player]["data"][key].TotalOut;
Accountant_SaveData[Accountant.player]["data"][key].TotalOut = nil;
end
if Accountant_SaveData[key] ~= nil then
Accountant_SaveData[key] = nil;
end
-- End OVC
SC.data[key].order = order;
order = order + 1;
 
-- Quel's modifications to track income/expense across all characters relies on the savedata structure,
-- so we have to reset the session totals for all players each time we log in, only for chars on this server.
for player in next,Accountant_SaveData do
if (string.find(player, SC.Realm) ~= nil) then
-- SC.Print2("Blanking session data for: "..player..", "..key);
Accountant_SaveData[player]["data"][key]["Session"].In = 0;
Accountant_SaveData[player]["data"][key]["Session"].Out = 0;
end
end
 
end
 
Accountant_SaveData[Accountant.player]["options"].version = SC.Version;
Accountant_SaveData[Accountant.player]["options"].totalcash = GetMoney();
 
-- Always set the player's faction.
-- They could have deleted a character and remade it.
Accountant_SaveData[Accountant.player]["options"]["faction"] = SC.Faction
--DEFAULT_CHAT_FRAME:AddMessage("Acc faction: "..
--Accountant_SaveData[Accountant.player]["options"]["faction"])
if Accountant_SaveData[Accountant.player]["options"]["current_tab"] == nil then
Accountant_SaveData[Accountant.player]["options"]["current_tab"] = 1
end
SC.current_tab = Accountant_SaveData[Accountant.player]["options"]["current_tab"]
if Accountant_SaveData[Accountant.player]["options"]["show_toons"] == nil then
Accountant_SaveData[Accountant.player]["options"]["show_toons"] = ACCLOC_CHARS
end
SC.show_toons = Accountant_SaveData[Accountant.player]["options"]["show_toons"]
 
if Accountant_SaveData[Accountant.player]["options"]["weekstart"] == nil then
Accountant_SaveData[Accountant.player]["options"]["weekstart"] = 3;
-- Quel's mod: make sure introdudction of a new character gets the same cdate as
-- existing chars on this realm, otherwise it will prematurely wipe out the daily totals
for player in next,Accountant_SaveData do
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"];
end
end
end
end
if Accountant_SaveData[Accountant.player]["options"]["dateweek"] == nil then
Accountant_SaveData[Accountant.player]["options"]["dateweek"] = SC.WeekStart();
-- Quel's mod: make sure introdudction of a new character gets the same cdate as
-- existing chars on this server, otherwise it will prematurely wipe out the daily totals.
for player in next,Accountant_SaveData do
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"];
end
end
end
end
if Accountant_SaveData[Accountant.player]["options"]["date"] == nil then
cdate = date();
cdate = string.sub(cdate,0,8);
Accountant_SaveData[Accountant.player]["options"]["date"] = cdate;
 
-- Quel's mod: make sure introdudction of a new character gets the same cdate as
-- existing chars on this server, otherwise it will prematurely wipe out the daily totals.
for player in next,Accountant_SaveData do
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"];
end
end
end
end
 
-- Quel's mod: the following code to check for a new day/week was originally in OnShow(), which had
-- a serious flaw. If you collected money on the first day of the week, then opened Accountant, the
-- OnShow function would see a new week, blank the weekly values, then show zeros (losing the income
-- or expenses). The session totals remained correct since they weren't reset. I moved all initialization
-- code here.
 
-- Check to see if the day has rolled over
cdate = date();
cdate = string.sub(cdate,0,8);
if Accountant_SaveData[Accountant.player]["options"]["date"] ~= cdate then
-- Its a new day! clear out the day tab
-- SC.Print2("Found a new day!");
for mode,value in next,SC.data do
SC.data[mode]["Day"].In = 0;
SC.data[mode]["Day"].Out = 0;
 
-- Quel's mod: have to clear data for all chars on this server when it rolls over and update
-- their date to match.
for player in next,Accountant_SaveData do
if (string.find(player, SC.Realm) ~= nil) then
-- SC.Print2(" Setting Accountant_SaveData["..player.."][data]["..mode.."][date] = "..cdate);
Accountant_SaveData[player]["data"][mode]["Day"].In = 0;
Accountant_SaveData[player]["data"][mode]["Day"].Out = 0;
Accountant_SaveData[player]["options"]["date"] = cdate;
end
end
end
end
 
-- Check to see if the week has rolled over
if Accountant_SaveData[Accountant.player]["options"]["dateweek"] ~= SC.WeekStart() then
-- SC.Print2("Found a new week!");
-- Its a new week! clear out the week tab
for mode,value in next,SC.data do
SC.data[mode]["Week"].In = 0;
SC.data[mode]["Week"].Out = 0;
 
-- Quel's mod: have to clear data for all chars on this server when it rolls over and update
-- their date to match.
for player in next,Accountant_SaveData do
if (string.find(player, SC.Realm) ~= nil) then
-- SC.Print2(" Setting Accountant_SaveData["..player.."][data]["..mode.."][dateweek] = "..SC.WeekStart() );
Accountant_SaveData[player]["data"][mode]["Week"].In = 0;
Accountant_SaveData[player]["data"][mode]["Week"].Out = 0;
Accountant_SaveData[player]["options"]["dateweek"] = SC.WeekStart();
end
end
end
end
 
-- Create the list of characters to show in the drop down.
SC.ToonDropDownList ()
end
 
--
-- Initialize the toon dropdown
--
function SC.ToonDropDownList ()
local faction = ""
SC.Toons = {}
for player in next,Accountant_SaveData do
if (string.find(player, SC.Realm) ~= nil) then
local str_pos = strfind(player, "-")
local strtmp = strsub(player, str_pos+1) -- remove the realm and dash
faction = Accountant_SaveData[player]["options"]["faction"]
if ( (faction == ACCLOC_ALLIANCE)
and (SC.ShowAlliance == true) )
or ( (faction == ACCLOC_HORDE)
and (SC.ShowHorde == true) )
then
table.insert(SC.Toons, strtmp)
end
end
end
table.sort(SC.Toons)
end
 
--
-- Initialize the toon dropdown
--
function SC.CharDropDown_Init ()
 
SC.ToonDropDownList ()
-- Initialize the dropdown of toons
info.text = ACCLOC_CHARS
info.func = SC.CharDropDown_OnClick
info.checked = nil
UIDropDownMenu_AddButton(info)
for i = 1, #SC.Toons do
info.text = SC.Toons[i]
info.func = SC.CharDropDown_OnClick
info.checked = nil
UIDropDownMenu_AddButton(info)
end
--DEFAULT_CHAT_FRAME:AddMessage("Acc char drop Init: ")
end
 
 
--
-- Setup the dropdown
-- Used outside the XML controller
--
function SC.CharDropDown_Setup()
UIDropDownMenu_Initialize(Accountant_CharDropDown, SC.CharDropDown_Init);
-- UIDropDownMenu_SetSelectedID(Accountant_CharDropDown, 1)
 
--
local selected
for i = 1, #SC.Toons do
if SC.show_toons == SC.Realm.."-"..SC.Toons[i] then
UIDropDownMenu_SetSelectedID(Accountant_CharDropDown, i+1)
selected = true
end
end
if selected == nil then
UIDropDownMenu_SetSelectedID(Accountant_CharDropDown, 1)
SC.show_toons = SC.AllDropdown
end
 
--DEFAULT_CHAT_FRAME:AddMessage("Acc char drop _OnShow: ")
end
 
--
-- Init and show the dropdown
--
function SC.CharDropDown_OnShow()
SC.CharDropDown_Setup()
 
UIDropDownMenu_SetWidth(100);
--DEFAULT_CHAT_FRAME:AddMessage("Acc char drop _OnShow: ")
end
 
--
-- Handle a selection from the toons drop down
--
function SC.CharDropDown_OnClick()
local id = this:GetID();
UIDropDownMenu_SetSelectedID(Accountant_CharDropDown, id);
 
if( id > 1) then
searchChar = SC.Realm.."-"..SC.Toons[id-1];
else
searchChar = SC.AllDropdown;
end
--DEFAULT_CHAT_FRAME:AddMessage("Acc char drop _OnClick: "..searchChar)
 
-- Change the player to the one selected
SC.show_toons = searchChar
 
-- Show the new values
SC.ShowValues()
SC:LDB_Update()
-- Update();
end
 
--
-- 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
Accountant_SaveData[SC.Button_makename()]["options"].showAlliance = false;
end
SC.ShowAlliance = Accountant_SaveData[SC.Button_makename()]["options"].showAlliance
SC.CharDropDown_Setup()
SC.ShowValues()
SC:LDB_Update()
end
 
--
-- 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
Accountant_SaveData[SC.Button_makename()]["options"].showHorde = false;
end
SC.ShowHorde = Accountant_SaveData[SC.Button_makename()]["options"].showHorde
SC.CharDropDown_Setup()
SC.ShowValues()
SC:LDB_Update()
end
 
--
-- Consume and act on the Accountant slash commands
--
function SC.Slash(msg)
if msg == nil or msg == "" then
msg = "log";
end
local args = {n=0}
local function helper(word) table.insert(args, word) end
string.gsub(msg, "[_%w]+", helper);
if args[1] == 'log' then
ShowUIPanel(AccountantFrame);
elseif args[1] == 'verbose' then
if SC.verbose == nil then
SC.verbose = 1;
SC.Print("Verbose Mode On");
else
SC.verbose = nil;
SC.Print("Verbose Mode Off");
end
elseif args[1] == 'week' then
SC.Print(SC.WeekStart());
else
SC.ShowUsage();
end
end
 
--
-- Handle the events Accountant registered for
--
function SC.OnEvent(event, arg1)
local oldmode = SC.mode;
 
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.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
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.could_repair = CanMerchantRepair();
-- if merchant can repair set up variables so we can track repairs
if ( SC.could_repair ) then
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;
elseif event == "MERCHANT_UPDATE" then
-- 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;
-- reset the repair cost for the next repair
SC.repair_cost, SC.can_repair = GetRepairAllCost();
-- DEFAULT_CHAT_FRAME:AddMessage(" ACC dura-2: "
-- ..SC.repair_cost.." : ");
end
end
elseif event == "TAXIMAP_OPENED" then
SC.mode = "TAXI";
elseif event == "TAXIMAP_CLOSED" then
-- Commented out due to taximap closing before money transaction
-- SC.mode = "";
elseif event == "LOOT_OPENED" then
SC.mode = "LOOT";
elseif event == "LOOT_CLOSED" then
-- Commented out due to loot window closing before money transaction
-- SC.mode = "";
elseif event == "TRADE_SHOW" then
SC.mode = "TRADE";
elseif event == "TRADE_CLOSE" then
SC.mode = "";
elseif event == "QUEST_COMPLETE" then
SC.mode = "QUEST";
elseif event == "QUEST_FINISHED" then
-- Commented out due to quest window closing before money transaction
-- SC.mode = "";
elseif event == "MAIL_SHOW" then
SC.mode = "MAIL";
elseif event == "MAIL_INBOX_UPDATE" then
-- 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,"Auction successful:") ~= nil) then
SC.mode="AH";
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 = "";
elseif event == "TRAINER_SHOW" then
SC.mode = "TRAIN";
elseif event == "TRAINER_CLOSED" then
SC.mode = "";
elseif event == "AUCTION_HOUSE_SHOW" then
SC.mode = "AH";
elseif event == "AUCTION_HOUSE_CLOSED" then
SC.mode = "";
elseif event == "PLAYER_MONEY" then
SC.UpdateLog();
SC:LDB_Update()
end
if SC.verbose and SC.mode ~= oldmode then
SC.Print("Accountant mode changed to '"..SC.mode.."'");
end
end
 
--
-- Take the 'amount' of gold nad make it into a nice, colorful string
-- of g c s (gold silver copper)
--
function SC.NiceCash(amount)
local agold = 10000;
local asilver = 100;
local outstr = "";
local gold = 0;
local silver = 0;
 
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
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
outstr = outstr .. "|cFFCCCCCC" .. "00" .. "s "..FONT_COLOR_CODE_CLOSE;
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
 
if neg == true then
outstr = "|cFFFF6600" .. "("..FONT_COLOR_CODE_CLOSE
..outstr
.."|cFFFF6600" .. ")"..FONT_COLOR_CODE_CLOSE
else
outstr = outstr.." "
end
return outstr;
end
 
--
-- 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);
thisDay = dt["wday"];
while thisDay ~= Accountant_SaveData[Accountant.player]["options"].weekstart do
ct = ct - oneday;
dt = date("*t",ct);
thisDay = dt["wday"];
end
cdate = date(nil,ct);
return string.sub(cdate,0,8);
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.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
 
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) )
or ( (faction == ACCLOC_HORDE)
and (SC.ShowHorde == true) ))
and ( SC.show_toons == player
or SC.show_toons == SC.AllDropdown ) 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;
 
if for_display then
row = getglobal("AccountantFrameRow" ..SC.data[key].InPos.."In");
row:SetText(SC.NiceCash(TotalRowIn));
 
row = getglobal("AccountantFrameRow" ..SC.data[key].InPos.."Out");
row:SetText(SC.NiceCash(TotalRowOut));
end
end
 
return TotalIn, TotalOut
end
 
--
-- get the net balance of user selected toons
--
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)
and (SC.ShowAlliance == true) )
or ( (faction == ACCLOC_HORDE)
and (SC.ShowHorde == true) ))
and ( SC.show_toons == player
or SC.show_toons == SC.AllDropdown ) then
alltotal = alltotal + Accountant_SaveData[player]["options"]["totalcash"];
end
end
 
return alltotal
end
 
--
-- get the total cash for all toons
--
function SC.GetCashForAllToons(for_display)
local i=1;
local alltotal = 0
 
for char,charvalue in next,Accountant_SaveData do
-- Find all players of the faction(s) requested
faction = Accountant_SaveData[char]["options"]["faction"]
if faction then
else
faction = "not set"
end
if (string.find(char, SC.Realm) ~= nil)
and (( (faction == ACCLOC_ALLIANCE)
and (SC.ShowAlliance == true) )
or ( (faction == ACCLOC_HORDE)
and (SC.ShowHorde == true) ))
then
str_pos = strfind(char, "-")
strtmp = strsub(char, str_pos+1) -- remove the realm and dash
if for_display then
getglobal("AccountantFrameRow" ..i.."Title"):SetText(strtmp);
end
if Accountant_SaveData[char]["options"]["totalcash"] ~= nil then
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
end
i=i+1;
end
end
 
return alltotal
end
 
--
-- 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>"
 
-- charachter totals
local alltotal;
 
-- Make sure we start fresh
alltotal = 0;
 
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)
 
AccountantFrameTotalInValue:SetText(SC.NiceCash(TotalIn));
AccountantFrameTotalOutValue:SetText(SC.NiceCash(TotalOut));
 
if TotalOut > TotalIn then
diff = TotalOut-TotalIn;
AccountantFrameTotalFlow:SetText("|cFFFF3333"..ACCLOC_NETLOSS..":");
AccountantFrameTotalFlowValue:SetText(SC.NiceCash(diff));
else
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.current_tab == 3 then
AccountantFrameExtra:SetText(ACCLOC_WEEKSTART..":");
AccountantFrameExtraValue:SetText(Accountant_SaveData[Accountant.player]["options"]["dateweek"]);
else
AccountantFrameExtra:SetText("");
AccountantFrameExtraValue:SetText("");
end
 
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
 
--
-- Show the Accountant window on request
--
function SC.OnShow()
SC.ShowValues()
SC.LDB_Update()
end
 
function SC.OnHide()
if MYADDONS_ACTIVE_OPTIONSFRAME == this then
ShowUIPanel(myAddOnsFrame);
end
end
 
--
-- Accountant print
--
function SC.Print(msg)
DEFAULT_CHAT_FRAME:AddMessage(format("Accountant: "..msg));
end
 
--
-- Accountant print used mainly for debug
--
function SC.Print2(msg)
ChatFrame4:AddMessage(format("Accountant: "..msg));
end
 
function SC.ShowUsage()
QM_Print("/accountant log\n");
end
 
--
-- 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.last_money = SC.current_money;
if diff == 0 or diff == nil then
return;
end
 
local mode = SC.mode;
if mode == "" then mode = "OTHER"; end
 
-- Quel's mod: ignore cash transfers between the player's characters
if (SC.mode ~= "IGNORE") then
if diff >0 then
for key,logmode in next,SC.log_modes do
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).." from "..mode); end
 
elseif diff < 0 then
diff = diff * -1;
for key,logmode in next,SC.log_modes do
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).." from "..mode); end
end
else
if (SC.refund_mode == "AH") then
postage = 0;
else
postage = 30;
end
 
-- if xfer between the player's chars or outbid auction back to the sender's totals
for key,logmode in next,SC.log_modes do
Accountant_SaveData[SC.sender]["data"][SC.refund_mode][logmode].Out = Accountant_SaveData[SC.sender]["data"][SC.refund_mode][logmode].Out - (diff - postage);
if (Accountant_SaveData[SC.sender]["data"][SC.refund_mode][logmode].Out < 0) then
Accountant_SaveData[SC.sender]["data"][SC.refund_mode][logmode].Out = 0;
end
end
 
if SC.verbose then
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
 
--
-- 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
Accountant.toc New file
0,0 → 1,13
## Interface: 30000
## Title: Accountant
## Version: 3.3
## Description: Logs where your WoW gold goes
## DefaultState: enabled
## 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
 
AccountantOptions.xml
Accountant.xml
ChangeLog.txt New file
0,0 → 1,43
-- Change Log:
 
--ToDo:
- Place more info into the tooltip
- Clean up more of the code
 
v3.3.01:
- Fixed typo causing the Data Broker icon to not be shown.
 
v3.3:
- Now has a Lib Data Broker component. If you have a Data Broker display addon
it will display the net profit/loss of the session / day / week / total tabs.
Or the Total of all characters if the 'All Chars' tab is selected.
Note: This has been tested with Titan Panel only.
- The last tab and character(s) selected are now remembered, by character, across logins.
- If you use the Titan Accountant addon, it will display the same value as
the Data Broker component. This is redundant - the Titan Addon should be removed.
- Net loss (negative) is shown as gold with "()" around it. This is in line with
accounting practice.
- Data Broker button tooltip gives the break down (net) into categories
 
v3.2:
- Changes to allow Accountant to run in Lich King (Beta)
 
v3.1:
NOTE: You MUST log into each character you want see in Accountant!
There is new data saved for each character that is needed by the recent changes.
The current data is NOT lost.
- New look and feel. The older UI was too hard to change and maintain for what I needed.
- Added the ability to choose all Alliance and / or all Horde.
- Added a character pull down to see a single character. (suggested by Inwe Anwame)
 
v3.01:
- Removed realm name from all character tab.
Thanks to LadySilverwolf for letting me know long realm names
wrap to the next row.
 
v3.0:
- Fixed the 'repair' account section
- Cleaner code (less global variables)
- Added a couple routines for AccountTitan
- Changed the NiceCash to return 0 gold
- Moved the minimap button slighty off the map