local config = {
  AutoWindow = nil,
  button = nil,
  premDays = 0,
  key = "Alt+2",
  vip = false  --altere para que playes free também possam ativar o autoLoot
}



function terminate()
  g_keyboard.unbindKeyDown(config.key, toggle)
end

function setPremDays(days)
  config.premDays = days
end

function getPremDays()
  return config.premDays
end

function toggle()
  local player = g_game.getLocalPlayer()
  if not player then return end
  if getPremDays() <= 0 and config.vip == true then
    modules.game_textmessage.displayFailureMessage(tr('Você precisa ser VIP para ativar este AutoLoot!'))
	return true
  end
  local function closeAutoWindow()
    config.AutoWindow:destroy()
    config.AutoWindow = nil
  end
  if config.AutoWindow then closeAutoWindow() end
  local function toggleAutoLoot()
    closeAutoWindow()
    g_game.talkChannel(0, 0, "!autoLootStatusChange")
  end

end