Download
(98Kb)
Download
Updated: 12-25-10 01:13 PM
Pictures
File Info
Updated:12-25-10 01:13 PM
Created:12-21-10 01:53 AM
Downloads:2,246
Favorites:16
MD5:

Stupid Cash Flow

Version: 1.1b
by: Siku [More]

The new message when you loot money when you are in a guild of level 5 of higher, the Cash Flow passive adds "(Some money deposited in the guild bank.)" which made the text to long to my chatframe's liking, or my guildmates'.

So i made a small addon to change that:

There are three modes to this addon, all enabled using a command:

/scf Short - Default mode. This will remove the "deposited in the guild bank." message, but will keep the actual money in parenthesis. (As seen in screenshot)

/scf None - This will completly remove the guild bank money message.

/scf Long - This will "disable" the addon, or more precisely, let the loot message shows the verbose way of saying money got into the guild bank.

Commands can be /scf or /stupidcashflow .

Version 1.1:
SCF now has options that you can toggle independently of the mode selected:

/scf Compact - This will shorten the gold, silver and copper in the loot messages.

/scf Share - This will shorten the looting message when you get a part of the loot while in a group. It will change from "Your share of the loot is" to "Your share is"

/scf Color - This will add colors to your loot messages.

1.1b
---
Fixed Issue with addon on non-US clients.

1.1
---
Added Compact, Share and Color options.
Changed how Localized strings are handled, only use 1 table now.
The Compact and Color options should be working fine on non-enUS clients.
Optional Files (0)


Post A Reply Comment Options
Unread 12-25-10, 01:18 PM  
Siku
A Fallenroot Satyr
 
Siku's Avatar
AddOn Author - Click to view AddOns

Forum posts: 29
File comments: 100
Uploads: 5
Huge Facepalm on my part, i knew i shouldn't have checked and "tried" to fix it at 4am in the morning.
Issue was with the fact there's no string table if you aren't on enUS, Auctionator appeared because its starts with an A, and the addon that loaded the Ace Libs.

So i fixed that, if your locale doesn't have a string translated, it'll pull from the enUS lines now.
Report comment to moderator  
Reply With Quote
Unread 12-24-10, 06:12 AM  
leks0d
A Kobold Labourer
 
leks0d's Avatar

Forum posts: 1
File comments: 71
Uploads: 0
Code:
[17:10:42] Interface\AddOns\StupidCashFlow\StupidCashFlow.lua:112: attempt to index upvalue 'SCF_L' (a nil value)
Interface\AddOns\Auctionator\Auctionator.lua:386: in function <Interface\AddOns\Auctionator\Auctionator.lua:340>
[C]: ?
Interface\AddOns\StupidCashFlow\StupidCashFlow.lua:112: in function <Interface\AddOns\StupidCashFlow\StupidCashFlow.lua:100>
...-3.0\AceConfigRegistry-3.0\AceConfigRegistry-3.0.lua:309: in function `optgetter'
...\AceConfig-3.0\AceConfigCmd-3.0\AceConfigCmd-3.0.lua:749: in function `HandleCommand'
Interface\AddOns\StupidCashFlow\StupidCashFlow.lua:184: in function `?'
...ddOns\AdiBags\libs\AceConsole-3.0\AceConsole-3.0.lua:94: in function `value'
Interface\FrameXML\ChatFrame.lua:4147: in function `ChatEdit_ParseText'
Interface\FrameXML\ChatFrame.lua:3737: in function `ChatEdit_SendText'
Interface\FrameXML\ChatFrame.lua:3775: in function `ChatEdit_OnEnterPressed'
[string "*:OnEnterPressed"]:1: in function <[string "*:OnEnterPressed"]:1>
When i type "/scf"
Report comment to moderator  
Reply With Quote
Unread 12-24-10, 03:35 AM  
Siku
A Fallenroot Satyr
 
Siku's Avatar
AddOn Author - Click to view AddOns

Forum posts: 29
File comments: 100
Uploads: 5
That's pretty weird... i just uploaded a new version that make sure to not use "L" alone (actually prefixed it to SCF_L and SCF_Locale) . But the variables were locals, they shouldnt be interacting with other addons (such as Auctionator) in this case...

Tell me if it fixes anything, if it doesnt, ill try to find the problem tomorrow.
Report comment to moderator  
Reply With Quote
Unread 12-24-10, 01:36 AM  
leks0d
A Kobold Labourer
 
leks0d's Avatar

Forum posts: 1
File comments: 71
Uploads: 0
Code:
[12:33:22] Interface\AddOns\StupidCashFlow\StupidCashFlow.lua:114: attempt to index upvalue 'L' (a nil value)
Interface\AddOns\Auctionator\Auctionator.lua:386: in function <Interface\AddOns\Auctionator\Auctionator.lua:340>
[C]: ?
Interface\AddOns\StupidCashFlow\StupidCashFlow.lua:114: in function <Interface\AddOns\StupidCashFlow\StupidCashFlow.lua:102>
...-3.0\AceConfigRegistry-3.0\AceConfigRegistry-3.0.lua:309: in function `optgetter'
...\AceConfig-3.0\AceConfigCmd-3.0\AceConfigCmd-3.0.lua:749: in function `HandleCommand'
Interface\AddOns\StupidCashFlow\StupidCashFlow.lua:186: in function `?'
...ddOns\AdiBags\libs\AceConsole-3.0\AceConsole-3.0.lua:94: in function `value'
Interface\FrameXML\ChatFrame.lua:4147: in function `ChatEdit_ParseText'
Interface\FrameXML\ChatFrame.lua:3737: in function `ChatEdit_SendText'
Interface\FrameXML\ChatFrame.lua:3775: in function `ChatEdit_OnEnterPressed'
[string "*:OnEnterPressed"]:1: in function <[string "*:OnEnterPressed"]:1>
Report comment to moderator  
Reply With Quote
Unread 12-23-10, 04:39 PM  
Naganalf
A Kobold Labourer

Forum posts: 0
File comments: 3
Uploads: 0
Well no, you don't really need the color, but I prefer it.
Report comment to moderator  
Reply With Quote
Unread 12-23-10, 01:09 AM  
Siku
A Fallenroot Satyr
 
Siku's Avatar
AddOn Author - Click to view AddOns

Forum posts: 29
File comments: 100
Uploads: 5
Thanks for sharing, but i already added something to this effect like, yesterday, didn't upload it yet before there were some stuff i wanted to test first.
I was using the word "Condensed" but i think i'll go with Compact actually, better name. And, do you really need the color in the loot? I could actually get it in easily, but my code didnt color them.

I've also cleaned some code all around.
Report comment to moderator  
Reply With Quote
Unread 12-22-10, 01:09 AM  
Naganalf
A Kobold Labourer

Forum posts: 0
File comments: 3
Uploads: 0
My changes work great. Here's my modifed lua file:

--[[
Project....: Stupid Cash Flow
File.......: StupidCashFlow.lua
Description: Changes how the Guild Bank Deposit from money looted is shown.
Version....: 1.0
Rev Date...: 20/12/10 [dd/mm/yy]
]]


---------------------
-- Local Variables --
---------------------
local addonName = ...
addon = LibStub("AceAddon-3.0"):NewAddon(addonName, "AceConsole-3.0")
local addonVer = GetAddOnMetadata(addonName, "Version")
local L = GetLocale()
local db

---------------------
-- Addon Functions --
---------------------
local msgCashFlow = {
["enUS"] = " deposited to guild bank",
}
local OptionMsg = {
["enUS"] = {
"Now displaying the Long version",
"Now displaying the Short version",
"No longer showing any Cash Flow messages.",
"Now displaying the Compact version.",
},
}
local OptionDesc = {
["enUS"] = {
"Show the long version of the Cash Flow message.",
"Show a Shortened version of the Cash Flow message.",
"Do not show the Cash Flow message at all.",
"Show a Compact version of the Cash Flow message.",
},
}
local copper = {
["enUS"] = {" Copper", "|cFFB87333c|r"},
}
local gold = {
["enUS"] = {" Gold", "|cFFFFD700g|r"},
}
local silver = {
["enUS"] = {" Silver", "|cFFC0C0C0s|r"},
}

local function filterFunc(ChatFrameSelf, event, msg, ...)
if db.Mode ~= 1 then
if db.Mode == 2 then
local newMsg = gsub(msg, msgCashFlow[L], "")
return false, newMsg, ...
elseif db.Mode == 3 then
local newMsg = strsplit("(", msg)
return false, newMsg, ...
elseif db.Mode == 4 then
local newMsg = gsub(msg, msgCashFlow[L], "")
newMsg = gsub(newMsg, ",", "")
newMsg = gsub(newMsg, copper[L][1], copper[L][2])
newMsg = gsub(newMsg, gold[L][1], gold[L][2])
newMsg = gsub(newMsg, silver[L][1], silver[L][2])
return false, newMsg, ...
end
end
end

-------------------
-- Addon Options --
-------------------
local defaults = {
profile = {
Mode = 2
},
}

local options = nil
local function LoadOptions()

if (not options) then

options = {
type = "group",
name = addonName,
handler = addon,
order = 50,
args = {
Long = {
name = "Long",
desc = OptionDesc[L][1],
type = "execute",
func = function()
db.Mode = 1
addon:Print(OptionMsg[L][db.Mode])
end,
},
Short = {
name = "Short",
desc = OptionDesc[L][2],
type = "execute",
func = function()
db.Mode = 2
addon:Print(OptionMsg[L][db.Mode])

end,
},
None = {
name = "None",
desc = OptionDesc[L][3],
type = "execute",
func = function()
db.Mode = 3
addon:Print(OptionMsg[L][db.Mode])
end,
},
Compact = {
name = "Compact",
desc = OptionDesc[L][4],
type = "execute",
func = function()
db.Mode = 4
addon:Print(OptionMsg[L][db.Mode])

end,
},
},
}

end

return options
end

--------------------
-- Initialization --
--------------------
function addon:OnInitialize()

--Database Init
self.db = LibStub("AceDB-3.0"):New("StupidCashFlowDB", defaults);
db = self.db.profile

--Setup Options
LibStub("AceConfig-3.0"):RegisterOptionsTable(addonName, LoadOptions)
self:RegisterChatCommand( addonName, "ChatCommand")
self:RegisterChatCommand( "scf", "ChatCommand")
end

function addon:OnEnable()
ChatFrame_AddMessageEventFilter("CHAT_MSG_MONEY", filterFunc)
end

function addon:OnDisable()
end

function addon:ChatCommand(input)
LibStub("AceConfigCmd-3.0"):HandleCommand(addonName, addonName, input)
end
Report comment to moderator  
Reply With Quote
Unread 12-21-10, 10:07 PM  
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view AddOns

Forum posts: 384
File comments: 144
Uploads: 3
Thank siku.
The memory usage wasn't the issue, I just didn't want this tiny feature as an extra add-on and just wanted to add it to a core add-on I had that fixes small things like these, and thus I wanted it light and only with the feature/setting I needed.
__________________

Report comment to moderator  
Reply With Quote
Unread 12-21-10, 05:26 PM  
Naganalf
A Kobold Labourer

Forum posts: 0
File comments: 3
Uploads: 0
This is great, was just what I was looking for.

I'd like an even more compact version. Something like:
You loot 14g 57s 17c (7s 23c).

I'm going to tweak your .lua to add a 4th option, will share if I do it correctly.

-n-
Report comment to moderator  
Reply With Quote
Unread 12-21-10, 12:32 PM  
Siku
A Fallenroot Satyr
 
Siku's Avatar
AddOn Author - Click to view AddOns

Forum posts: 29
File comments: 100
Uploads: 5
Originally posted by sacrife
I tried stripping it down to not use any options or libs.
(Just be mode 3 and no way to change it except in lua)
but I keep failing.
Can you paste a quick code example that would do that_
What would that accomplish?
If you're worried about memory usage, this isnt the addon that's causing trouble.


But i'm a nice guy, here's an ultra-condensed, no-libs, no-options version:

If you want to shorten it:
Code:
/script local function s(i, k, u, ...) return false, gsub(u," deposited to guild bank",""), ... end; ChatFrame_AddMessageEventFilter("CHAT_MSG_MONEY", s);
If you want to remove it:
Code:
/script local function s(i, k, u, ...) return false, strsplit("(", u), ... end; ChatFrame_AddMessageEventFilter("CHAT_MSG_MONEY", s);
That's a macro. Use it whenever you log. You cant have more lightweight than that.
Or make an event handler that will call that on PLAYER_LOGIN (minus the /script part)
Last edited by Siku : 12-21-10 at 12:49 PM.
Report comment to moderator  
Reply With Quote
Unread 12-21-10, 10:28 AM  
Sojik
A Wyrmkin Dreamwalker
 
Sojik's Avatar
AddOn Author - Click to view AddOns

Forum posts: 53
File comments: 166
Uploads: 10
Originally posted by sacrife
I tried stripping it down to not use any options or libs.
(Just be mode 3 and no way to change it except in lua)
but I keep failing.
Can you paste a quick code example that would do that_
Asking a bit much there.
Report comment to moderator  
Reply With Quote
Unread 12-21-10, 04:59 AM  
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view AddOns

Forum posts: 384
File comments: 144
Uploads: 3
I tried stripping it down to not use any options or libs.
(Just be mode 3 and no way to change it except in lua)
but I keep failing.
Can you paste a quick code example that would do that_
__________________

Report comment to moderator  
Reply With Quote
Unread 12-21-10, 02:59 AM  
Shadowcall
A Cyclonian
 
Shadowcall's Avatar
AddOn Author - Click to view AddOns

Forum posts: 44
File comments: 58
Uploads: 1
great idea, added to my fav addons
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: