ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Negative gold (https://www.esoui.com/forums/showthread.php?t=10020)

marcjordan 12/19/21 06:04 PM

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!

Baertram 12/20/21 03:45 AM

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).

Sharlikran 12/20/21 10:27 AM

EGR might be ESO Grinder but couldn't find anything else close.

HHamp78 12/23/21 02:00 AM

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.

Baertram 12/23/21 02:17 AM

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

Gullyable 02/02/22 01:12 PM

Quote:

Originally Posted by Sharlikran (Post 45087)
EGR might be ESO Grinder but couldn't find anything else close.

Yes, that pic is from a local WIP working copy.

Gullyable 02/04/22 06:01 PM

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


Baertram 02/05/22 10:50 AM

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


All times are GMT -6. The time now is 02:36 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI