Thread Tools Display Modes
09/10/15, 02:57 PM   #1
t31os
AddOn Author - Click to view addons
Join Date: Jun 2015
Posts: 26
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?
  Reply With Quote
09/10/15, 03:32 PM   #2
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
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.
  Reply With Quote
09/10/15, 03:37 PM   #3
t31os
AddOn Author - Click to view addons
Join Date: Jun 2015
Posts: 26
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..

Last edited by t31os : 09/10/15 at 03:40 PM.
  Reply With Quote
09/10/15, 03:58 PM   #4
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
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.
  Reply With Quote
09/10/15, 09:58 PM   #5
Fyrakin
 
Fyrakin's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 129
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.
  Reply With Quote
09/11/15, 04:02 AM   #6
t31os
AddOn Author - Click to view addons
Join Date: Jun 2015
Posts: 26
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.
  Reply With Quote
09/11/15, 08:23 AM   #7
haggen
 
haggen's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2015
Posts: 137
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.
  Reply With Quote
09/11/15, 03:25 PM   #8
ZOS_DanBatson
ZOS Staff!
 
ZOS_DanBatson's Avatar
Yes this person is from ZeniMax!
Join Date: Jul 2015
Posts: 171
I've added a GetNextBackpackUpgradePrice to the API. It'll go out with the next major version.
  Reply With Quote
09/11/15, 06:12 PM   #9
haggen
 
haggen's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2015
Posts: 137
Originally Posted by ZOS_DanBatson View Post
I've added a GetNextBackpackUpgradePrice to the API. It'll go out with the next major version.
Thanks a bunch!
  Reply With Quote
09/12/15, 03:54 PM   #10
t31os
AddOn Author - Click to view addons
Join Date: Jun 2015
Posts: 26
Originally Posted by ZOS_DanBatson View Post
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.

Last edited by t31os : 09/13/15 at 01:20 PM.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Function to get next bag upgrade cost?

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