Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function downloaded_file(_, filename)
- -- debug("name: " .. filename)
- if filename:match("thonoursjson", 1, true) then
- io.input(filename)
- local s = io.read("*all")
- players = players or {}
- local plinfo = yajl.to_value(s)
- local descParseReg = rex.new([[^(?:He|She) is an? ([\w\'\-]*?) ?(\w+) (\w+)\.]])
- plinfo.title, plinfo.statpack, plinfo.race = rex.match(plinfo.description, descParseReg)
- if plinfo.name then
- cecho("<orange>(<white>Truehonours-><yellow>" .. plinfo.name .. "<white> Done!<orange>)")
- players[plinfo.name] = plinfo
- end
- if plinfo.name:match(target) and not t.class:match(plinfo.profession) then
- cecho("<orange>(<white>" .. plinfo.name .. " class update from <yellow>" .. t.class .. " to " ..
- plinfo.profession .. "<white>)")
- raidTell("Target " .. target .. " changed class from " .. t.class .. " to " .. plinfo.profession)
- t.class = plinfo.profession
- end
- redrawPlayerList()
- io.close()
- os.remove(filename)
- elseif filename:match("thonours", 1, true) then
- io.input(filename)
- local s = io.read("*all")
- local plinfo = {}
- local name = s:match([[Name: (%w+)]])
- plinfo["name"] = name
- plinfo["fullname"] = s:match([[Full name: ([%w%s-,']+)]])
- plinfo["city"] = s:match([[City: (%w+)]])
- plinfo["guild"] = s:match([[Guild: (%w+)]])
- plinfo["towne"] = s:match([[Towne: ([%w']+)]])
- plinfo["level"] = s:match([[Level: (%d+)]])
- plinfo["bashinglevel"] = s:match([[Bashing level: (%d+)]])
- plinfo["questinglevel"] = s:match([[Questing level: (%d+)]])
- plinfo["pklevel"] = s:match([[Pk level: (%d+)]])
- plinfo["description"] = s:match([[Description: ([%w%d%s,'"-.]+)]])
- plinfo["profession"] = s:match([[Profession: (%w+)]])
- plinfo["player kills"] = s:match([[Player kills: (%d+)]])
- plinfo["deaths"] = s:match([[Deaths: (%d+)]])
- plinfo["arena rank"] = s:match([[Arena rank: (%d+)]])
- plinfo["pvp rank"] = s:match([[Pvp rank: (%d+)]])
- if plinfo.name then
- cecho("<orange>(<white>Truehonours-><yellow>" .. plinfo.name .. "<white> Done!<orange>)")
- if players then
- players[name] = plinfo
- table.save(getMudletHomeDir() .. "/players.lua",players)
- else
- players = {}
- end
- end
- io.close()
- os.remove(filename)
- elseif filename:match("votePage", 1, true) then
- cecho("<white>.")
- io.input(filename)
- local s = io.read("*all")
- cecho("<white>.")
- local oldhash = string.match(s,'<input name="oldhash" type="hidden" value="(%x+)">')
- cecho("<white>.")
- local test = string.match(s,'<input name="test" type="hidden" value="(%x+)">')
- cecho("<white>.")
- local mudid = string.match(s,'<input type="hidden" name="mudid" value="(%d+)">')
- cecho("<white>.")
- local votehash = string.match(s,'<input type="hidden" name="votehash" value="(%x+)">')
- cecho("<white>.")
- -- local votestring = "http://www.topmudsites.com/vote.php?" .. "&do=in" .. "&oldhash=" .. oldhash .. "&zq=" .. zq .. "&mudid=" .. mudid .. "&votehash=" .. votehash
- -- local votestring = "http://www.topmudsites.com/vote.php?" .. "&do=in" .. "&zq=" .. zq .. "&mudid=" .. mudid .. "&votehash=" .. votehash
- local votestring = "http://www.topmudsites.com/vote.php?" .. "&do=in" .. "&oldhash=" .. oldhash .. "&test=" .. test .. "&mudid=" .. mudid .. "&votehash=" .. votehash
- cecho("<white>.")
- downloadFile(getMudletHomeDir().."/voteDone.html", votestring)
- elseif filename:match("voteDone", 1, true) then
- cecho("<lime_green>Successful!<white>)\n")
- send("voted", false)
- end
- end
Add Comment
Please, Sign In to add comment