ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Function to get next bag upgrade cost? (https://www.esoui.com/forums/showthread.php?t=5145)

t31os 09/10/15 02:57 PM

Function to get next bag upgrade cost?
 
Been trawling the wiki and source and i'm still stumped as to how to fetch the cost of the next upgrade for the bag/inventory.

The bank upgrade has a convenient "GetNextBankUpgradePrice()" function, but i can't find an equivalent for the inventory.

Any suggestions chaps?

Ayantir 09/10/15 03:32 PM

I don't think there is something because such functions are hardcoded in the speech of a npc (for bag, it's a chat with a npc which upgrade the bag).

But you can build a table and deduct it with the bag size and upgrade of the mount.

t31os 09/10/15 03:37 PM

If that's the case and there's no way to do a lookup with an ingame constant, function or both i'll probably just hard code in the upgrade costs, and work it out that way, cheaper and easier, until such time the API provides a means.

Aside: The game has to read the max bag size and cost from somewhere though, i feel i'm missing something. Though i guess certain data is outside the scope of the API and thus unavailable.

Thanks.. :)

Garkin 09/10/15 03:58 PM

When you try to buy bag space, game fires event where the only argument is upgrade cost:
* EVENT_INVENTORY_BUY_BAG_SPACE (*integer* _cost_)

I didn't find any other place where is mentioned upgrade price in EsoUI source code.

Fyrakin 09/10/15 09:58 PM

Numbers can be logged into a table and function can be made based on available item space. Other than that I am not aware of any other way.

t31os 09/11/15 04:02 AM

That's pretty much all i could find to Garkin, i wasn't sure if i was looking hard and deep enough or whether i was simply missing something totally obvious to someone more familiar with the code base.

Thank you both for having a dig around for me, unfortunately it only confirms my own conclusions but it's nice to have some confirmation all the same.

I'll stick to pulling the values from the wiki and hard-coding them in for now, it'll mean adding or tweaking items in an array any time these change in-game, but i think i can live with that.

haggen 09/11/15 08:23 AM

Could we have an add-on with such additions ? Like an extended ESO API ? That'd be great, I also have some functions I'd like to include.

ZOS_DanBatson 09/11/15 03:25 PM

I've added a GetNextBackpackUpgradePrice to the API. It'll go out with the next major version.

haggen 09/11/15 06:12 PM

Quote:

Originally Posted by ZOS_DanBatson (Post 23459)
I've added a GetNextBackpackUpgradePrice to the API. It'll go out with the next major version.

Thanks a bunch! :D

t31os 09/12/15 03:54 PM

Quote:

Originally Posted by ZOS_DanBatson (Post 23459)
I've added a GetNextBackpackUpgradePrice to the API. It'll go out with the next major version.

Awesome! Thank you.

For any other potential addon authors/tweakers who may be wondering how i'm currently getting the next upgrade price, see below.

Store the bag sizes and costs in an object.
Code:

myObj.bagSizes = {
    [70] = 400,
    [80] = 2000,
    [90] = 5900,
    [100] = 11000,
    [110] = 19200,
    [120] = 30700,
    [130] = 46000,
    [140] = 64500,
}

Get data on Riding stats and Inventory slots, and work out inventory size.
Code:

    local inventoryBonus, maxInventoryBonus, staminaBonus, maxStaminaBonus, speedBonus, maxSpeedBonus = GetRidingStats()
    local usedSlots, maxSlots = PLAYER_INVENTORY:GetNumSlots(INVENTORY_BACKPACK)

    myObj.inventorySize  = maxSlots - inventoryBonus

Check if our bagSizes object has an index 10 above the current bag size.
Code:

    if( myObj.bagSizes[myObj.inventorySize+10] ~= nil ) then
        myObj.nextBagUpgrade = myObj.bagSizes[myObj.inventorySize+10]
    else
        -- do or set something else
    end

Function is coming in next major, the above should do until then. :)


All times are GMT -6. The time now is 01:58 AM.

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