Untitled

 avatar
unknown
lua
2 years ago
1.5 kB
2
Indexable
local function removeFirst(tbl, val)
	for i, v in ipairs(tbl) do
	  if v == val then
		return table.remove(tbl, i)
	  end
	end
end

local function ReportLockouts(msg, editbox)
	Dungeons = {
		"Utgarde Keep",
		"Drak'Tharon Keep",
		"Ahn'kahet: The Old Kingdom",
		"Azjol-Nerub",
		"Gundrak",
		"Violet Hold",
		"Utgarde Pinnacle",
		"The Oculus",
		"Halls of Lightning",
		"Halls of Stone",
		"The Nexus",
		"The Culling of Stratholme"
	}
    instances = GetNumSavedInstances()
    

	if msg == 'u' then
		print("You are saved to:")
		for i=instances,1,-1 do
			name, id, reset, difficulty, locked, extended, instanceIDMostSig, isRaid, maxPlayers, difficultyName, numEncounters, encounterProgress = GetSavedInstanceInfo(i)
        	print(name) 
    	end
	else  
        for i=instances,1,-1 do
			name, id, reset, difficulty, locked, extended, instanceIDMostSig, isRaid, maxPlayers, difficultyName, numEncounters, encounterProgress = GetSavedInstanceInfo(i)
        	removeFirst(Dungeons, name) 
    	end
		s = #(Dungeons)
		nlo = ""
		for i = 1, s do
			if (i == 1) then filler = " " else filler = ", " end
			nlo = nlo .. filler .. Dungeons[i]
		end
		if msg == 'g' then SendChatMessage("I can do:" .. nlo, "GUILD") elseif msg == 'w' then SendChatMessage("I can do:" .. nlo, "WHISPER", nil, ChatFrame1EditBox:GetAttribute("tellTarget")) elseif msg == 'p' then SendChatMessage("I can do:" .. nlo, "PARTY") else print('You can run:' .. nlo) end
    end
end

SLASH_LO1 = "/lo"
SlashCmdList["LO"] = ReportLockouts
Editor is loading...