Guest User

Untitled

a guest
Apr 13th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.60 KB | None | 0 0
  1. function downloaded_file(_, filename)
  2. --  debug("name: " .. filename)
  3.   if filename:match("thonoursjson", 1, true) then
  4.     io.input(filename)
  5.     local s = io.read("*all")
  6.     players = players or {}
  7.     local plinfo = yajl.to_value(s)
  8.     local descParseReg = rex.new([[^(?:He|She) is an? ([\w\'\-]*?) ?(\w+) (\w+)\.]])
  9.    plinfo.title, plinfo.statpack, plinfo.race = rex.match(plinfo.description, descParseReg)
  10.    if plinfo.name then
  11.      cecho("<orange>(<white>Truehonours-><yellow>" .. plinfo.name .. "<white> Done!<orange>)")
  12.      players[plinfo.name] = plinfo
  13.    end
  14.    if plinfo.name:match(target) and not t.class:match(plinfo.profession) then
  15.      cecho("<orange>(<white>" .. plinfo.name .. " class update from <yellow>" .. t.class .. " to " ..
  16.       plinfo.profession .. "<white>)")
  17.      raidTell("Target " .. target .. " changed class from " .. t.class .. " to " .. plinfo.profession)
  18.      t.class = plinfo.profession
  19.    end
  20.    redrawPlayerList()
  21.    io.close()
  22.    os.remove(filename)
  23.  elseif filename:match("thonours", 1, true) then
  24.    io.input(filename)
  25.    local s = io.read("*all")
  26.    local plinfo = {}
  27.    local name = s:match([[Name: (%w+)]])
  28.    plinfo["name"] = name
  29.    plinfo["fullname"] = s:match([[Full name: ([%w%s-,']+)]])
  30.     plinfo["city"] = s:match([[City: (%w+)]])
  31.     plinfo["guild"] = s:match([[Guild: (%w+)]])
  32.     plinfo["towne"] = s:match([[Towne: ([%w']+)]])
  33.    plinfo["level"] = s:match([[Level: (%d+)]])
  34.    plinfo["bashinglevel"] = s:match([[Bashing level: (%d+)]])
  35.    plinfo["questinglevel"] = s:match([[Questing level: (%d+)]])
  36.    plinfo["pklevel"] = s:match([[Pk level: (%d+)]])
  37.    plinfo["description"] = s:match([[Description: ([%w%d%s,'"-.]+)]])
  38.    plinfo["profession"] = s:match([[Profession: (%w+)]])
  39.    plinfo["player kills"] = s:match([[Player kills: (%d+)]])
  40.    plinfo["deaths"] = s:match([[Deaths: (%d+)]])
  41.    plinfo["arena rank"] = s:match([[Arena rank: (%d+)]])
  42.    plinfo["pvp rank"] = s:match([[Pvp rank: (%d+)]])
  43.    if plinfo.name then
  44.      cecho("<orange>(<white>Truehonours-><yellow>" .. plinfo.name .. "<white> Done!<orange>)")
  45.      if players then
  46.        players[name] = plinfo
  47.        table.save(getMudletHomeDir() .. "/players.lua",players)
  48.      else
  49.        players = {}
  50.      end
  51.    end
  52.    io.close()
  53.    os.remove(filename)
  54.  elseif filename:match("votePage", 1, true) then
  55.    cecho("<white>.")
  56.    io.input(filename)
  57.    local s = io.read("*all")
  58.    cecho("<white>.")
  59.    local oldhash = string.match(s,'<input name="oldhash" type="hidden" value="(%x+)">')
  60.    cecho("<white>.")
  61.    local test = string.match(s,'<input name="test" type="hidden" value="(%x+)">')
  62.    cecho("<white>.")
  63.    local mudid = string.match(s,'<input type="hidden" name="mudid" value="(%d+)">')
  64.    cecho("<white>.")
  65.    local votehash = string.match(s,'<input type="hidden" name="votehash" value="(%x+)">')
  66.    cecho("<white>.")
  67. --    local votestring = "http://www.topmudsites.com/vote.php?" .. "&do=in" .. "&oldhash=" .. oldhash .. "&zq=" .. zq .. "&mudid=" .. mudid .. "&votehash=" .. votehash
  68. --    local votestring = "http://www.topmudsites.com/vote.php?" .. "&do=in" .. "&zq=" .. zq .. "&mudid=" .. mudid .. "&votehash=" .. votehash
  69.    local votestring = "http://www.topmudsites.com/vote.php?" .. "&do=in" .. "&oldhash=" .. oldhash .. "&test=" .. test .. "&mudid=" .. mudid .. "&votehash=" .. votehash
  70.    cecho("<white>.")
  71.    downloadFile(getMudletHomeDir().."/voteDone.html", votestring)
  72.    
  73.  elseif filename:match("voteDone", 1, true) then
  74.    cecho("<lime_green>Successful!<white>)\n")
  75.    send("voted", false)
  76.  end
  77. end
Add Comment
Please, Sign In to add comment