Thread Tools Display Modes
12/19/21, 06:04 PM   #1
marcjordan
AddOn Author - Click to view addons
Join Date: Sep 2020
Posts: 14
Negative gold

I've been updating the EGR addon a bit and I'm seeing an event for negative gold come in sometimes. Here's a log where I'm cashing a bunch of guild store sales then taking the current event rewards from Breda:



Is that a real thing or do I have a bug?

Thanks!
  Reply With Quote
12/20/21, 03:45 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,913
EGR = what in full name?

Not sure what the -131 is exactly. Is it a guild store sales entry? How did you read it?
Maybe it's the fee that was payed for the guild store sale and not the gold earned.

Hint:
If you read events from the guild sales you should definately use LibHistoire for this, if not already done.
It will cache the sales data properly and reuse it for different addons like MasterMerchant etc.
= less server stress as your adodn does not need to re-ask for the same data + performance gain (read from SavedVariables instead of waiting for a server response sometime).
  Reply With Quote
12/20/21, 10:27 AM   #3
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 627
EGR might be ESO Grinder but couldn't find anything else close.

Last edited by Sharlikran : 12/20/21 at 03:01 PM.
  Reply With Quote
12/23/21, 02:00 AM   #4
HHamp78
 
HHamp78's Avatar
Join Date: Dec 2021
Posts: 5
So, what is the "-131" number? I have a theory it's something about how much the number is different from the average guild sales number.
  Reply With Quote
12/23/21, 02:17 AM   #5
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,913
If it's ESOGrinder you talk about marcjordan:
I cannot see any guild related stuff in your code so far, so is the gold shown just the "looted gold" (via EVENT_LOOT_RECEIVED) from a guild sale mail?
Not sure which price the debug print to chat shows there but it must be one of these then:
GetItemLinkValue(iLink,false),
GetPriceMM(iLink),
GetPriceTTC(iLink),

Add more debug messages to the 3 functions and check which one returns what value and you should be able to see where the negative value comes from.

And as your addon tries to user MM and TTC functions your txt file should contain so that these addons load before yours.
Code:
## OptionalDependsOn: MasterMerchant TamrielTradeCenter

Last edited by Baertram : 12/23/21 at 02:24 AM.
  Reply With Quote
02/02/22, 01:12 PM   #6
Gullyable
Join Date: Apr 2018
Posts: 13
Originally Posted by Sharlikran View Post
EGR might be ESO Grinder but couldn't find anything else close.
Yes, that pic is from a local WIP working copy.
  Reply With Quote
02/04/22, 06:01 PM   #7
Gullyable
Join Date: Apr 2018
Posts: 13
Here's the code that produced that negative gold number. Negative gold here is normal when you're paying for something. It was weird because AFAIK there was no reason to lose gold at that moment.

Code:
function EsoGrinder.EventMoneyUpdateHandler( eventCode, newMoney, oldMoney, reason )
    local player_current_money = GetCurrentMoney()
    local new_money = newMoney
    local old_money = oldMoney
    local delta_money = new_money - old_money

    EsoGrinder.loot_log_count = EsoGrinder.loot_log_count + 1

    -- EsoGrinder.DebugPrint(string.format("EGR: EventMoneyUpdateHandler"))

    if EsoGrinder.OldMoney == 0.0 then
        EsoGrinder.OldMoney = oldMoney
    end

    temp_Icon = "|t24:24:esoui/art/currency/currency_gold_32.dds|t "

    z = zo_strformat ( "EGR <<1>> <<2>> |cFFD700Gold|r <<3>> (<<4>>) <<5>> <<6>>",
            EsoGrinder.loot_log_count,
            temp_Icon,
            delta_money,
            player_current_money,
            new_money,
            old_money)
    d ( z )
end
  Reply With Quote
02/05/22, 10:50 AM   #8
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,913
Is z a local defined variable in your file? Else it pollutes the global namespace table _G as _G["z"].
You should make it local then so it does not accidently overwrite any other addon's variable called z
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Negative gold

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off