-- edit the "tokenData" table to change the preset difficulties
-- list of valid ids: 'p1', '0', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8',
--   'skull', 'cultist', 'tablet', 'elder', 'red', 'blue', 'bless', 'curse', 'frost'

local tokenData = {
  Easy = { 'p1', 'p1', '0', '0', '0', 'm1', 'm1', 'm1', 'm2', 'm2', 'skull', 'skull', 'cultist', 'red', 'blue' },
  Standard = { 'p1', '0', '0', 'm1', 'm1', 'm1', 'm2', 'm2', 'm3', 'm4', 'skull', 'skull', 'cultist', 'red', 'blue' },
  Hard = { '0', '0', '0', 'm1', 'm1', 'm2', 'm2', 'm3', 'm3', 'm4', 'm5', 'skull', 'skull', 'cultist', 'red', 'blue' },
  Expert = { '0', 'm1', 'm1', 'm2', 'm2', 'm3', 'm3', 'm4', 'm4', 'm5', 'm6', 'm8', 'skull', 'skull', 'cultist', 'red', 'blue' }
}

-- create buttons on startup
function onLoad()
  local z_offset = -0.15
  for difficulty, _ in pairs(tokenData) do
    local clickFunction = difficulty:lower() .. "Click"
    self.setVar(clickFunction, function() clickFun(difficulty) end)

    self.createButton({
      label = difficulty,
      function_owner = self,
      click_function = clickFunction,
      position = { 0, 0.1, z_offset },
      rotation = { 0, 0, 0 },
      scale = { 0.47, 1, 0.47 },
      height = 200,
      width = 1150,
      font_size = 100,
      color = { 0.87, 0.8, 0.70 },
      font_color = { 0, 0, 0 }
    })
    z_offset = z_offset + 0.20
  end
end

function clickFun(difficulty)
  Global.call("setChaosBagState", tokenData[difficulty])
end