Skip to content

Export current bonus roll currency balance — bonusRollCurrencies table exists in extras.lua but is never used #66

Description

@zke-lootpilot

Summary

extras.lua already defines a bonus roll currency table, but nothing in the addon references it:

Simulationcraft.bonusRollCurrencies = {
  [3418] = 'Nebulous Voidcore',
  [3511] = '[DNT, Unused] Venomous Voidcore',
}

The profile export includes the bonus roll history (# bonus_roll_items=, via GetBonusRollItems()), which is great — but not the player's current balance of the roll currency. That balance is the last missing piece for tools to plan bonus rolls fully automatically from a paste: today the roll history imports fine, but every tool still has to ask the user to manually type how many coins they have.

For context: LootPilot (a bonus roll planner that consumes the addon export) already parses c:3418:<quantity> if it ever shows up, and I'd expect other tools could use it the same way — the bonus_roll_items comment in bonusrolls.lua suggests Raidbots also cares about the roll currency for season mapping.

Proposed change

A GetBonusRollCurrencies() mirroring the existing GetUpgradeCurrencies() pattern in core.lua, plus one export line next to the other currency comments:

function Simulationcraft:GetBonusRollCurrencies()
  local bonusRollCurrencies = {}
  for currencyId, currencyName in pairs(Simulationcraft.bonusRollCurrencies) do
    local currencyInfo = C_CurrencyInfo.GetCurrencyInfo(currencyId)
    if currencyInfo and currencyInfo.quantity > 0 then
      bonusRollCurrencies[#bonusRollCurrencies + 1] = table.concat({ "c", currencyId, currencyInfo.quantity }, ':')
    end
  end
  return table.concat(bonusRollCurrencies, '/')
end

Output: # bonus_roll_currencies=c:3418:4

One thought: for this particular currency it might be worth dropping the quantity > 0 filter, since "0 coins left" is meaningful information for a planner (as opposed to "unknown"). Happy to go either way.

Alternatively, if a new comment line feels unnecessary, just adding [3418] = 'Nebulous Voidcore' to Simulationcraft.upgradeCurrencies would make it ride the existing # upgrade_currencies= line — a one-line change.

I'm happy to submit a PR for whichever variant you prefer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions