View Single Post
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