Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Player List

RynokRynok Member Posts: 19
edited October 2013 in New Ideas
Is there, or could there be, an XML/PHP resource or in-game command where we can pull all the different player names and their stats from? Programatically it helps with tracking if what you are targeting is a player or an NPC, so you can adjust your key-bindings appropriately. (If I target "Ryno" for instance, when I do an HONOURS RYNO nothing comes back, so I assume it's an NPC and not the partial name of "Rynok").

With the old website there was a page that had the information on it but you had to do a screen scrape, but when this new site was made we lost that functionality. While it's possible to pull the data by other means (like checking who's online and who's died recently and compiling a list over time) it'd be much easier and less intensive to just check a file once in a while or enter a command at login or such.

If anyone has any other way they pull that data though, let me know, I'd be interested in it.
Post edited by Rynok on

Comments

  • DiceneDicene Member Posts: 913 ✭✭✭✭
    That functionality still exists. If nobody else posts code before I get home, I'll post my Mudlet Lua stuff.
    image
  • LionasLionas Member, Historian Posts: 765 ✭✭✭✭✭
    edited October 2013
    So, first thing's first, http://old.imperian.com/players.php?search=who is a thing.

    There's also the GMCP message Comm.Channel.Players which you can send to the server. The server will respond with a Comm.Channel.Players message that looks like this:

    EDIT: This post edited to change the CMUD dictionary back into the json that's actually sent.

    [ { "name": "Seria" }, { "name": "Adelena" }, { "name": "Apoloc", "channels": [ "The Clan of Honorary Council of Manliness" ] }, { "name": "Alexys" }, { "name": "Iluv", "channels": [ "The Council of Khandava", "The Clan of Honorary Council of Manliness", "The Clan of Demonic Legion", "The Clan of Khandava Guard", "The Clan of Deadwood Council" ] }, { "name": "Ryax" }, { "name": "Tikal" }, { "name": "Seraphyne" }, { "name": "Estcer" }, { "name": "Cerex" }, { "name": "Giselle", "channels": [ "The Council of Khandava", "The Tzolkin", "The Clan of The Corinthian Order", "The Clan of Demonic Legion", "The Clan of Khandava Guard", "The Clan of Corgi Cavalcade" ] }, { "name": "Keeran" }, { "name": "Drakar" }, { "name": "Azefel", "channels": [ "The Council of Khandava", "The Tzolkin", "The Clan of The Corinthian Order", "The Clan of Honorary Council of Manliness", "The Clan of Demonic Legion", "The Clan of Khandava Guard" ] }, { "name": "Doshar", "channels": [ "The Clan of The Corinthian Order", "The Clan of Honorary Council of Manliness" ] }, { "name": "Ria" }, { "name": "Blyth" }, { "name": "Shou" }, { "name": "Merack" }, { "name": "Sigard" }, { "name": "Braidan" }, { "name": "Kanthari", "channels": [ "The Council of Khandava", "The Tzolkin", "The Clan of The Corinthian Order", "The Clan of Honorary Council of Manliness", "The Clan of Demonic Legion", "The Clan of The Reapers", "The Clan of Corgi Cavalcade", "The Clan of Deadwood Council" ] }, { "name": "Celestine", "channels": [ "The Clan of The Corinthian Order" ] }, { "name": "Airamaya" }, { "name": "Vox" }, { "name": "Glijije" }, { "name": "Iyrandar" }, { "name": "Camaris" }, { "name": "Kolgrimm" }, { "name": "Draven", "channels": [ "The Clan of Honorary Council of Manliness" ] }, { "name": "Vaughn" }, { "name": "Lytharose" }, { "name": "Ferriter" }, { "name": "Iobelia" }, { "name": "Jarrhn" }, { "name": "Mercer" }, { "name": "Ambrose" } ]



    I use it thusly:

    #local $message, $sendstr
    $message = %json(%0)
    $sendstr = "unenemy all" + @{separator}
    #forall $message {#if (not %ismember(%i.name, @ignorelist)) {$sendstr = $sendstr + "enemy " + %i.name + @{separator}}}
    #send $sendstr
    I am the righteous one... 
    the claims are stated - it's the world I've created 
  • RynokRynok Member Posts: 19
    Aha, the old site still exists! I had missed that somewhere in the move and didn't realize that. Awesome, that solves a majority of the issue (it's far better & faster then my work-around was at least).

    That Comm.Channel.Players thing, is that basically just showing you who's online? The list seems small. Does it show people that are online? (Even those hidden from QWHO? I'd have to request the GMCP every time a target is chosen and doesn't show up on HONOURS <name>, but that would work if so)
  • LionasLionas Member, Historian Posts: 765 ✭✭✭✭✭
    edited October 2013
    That is a list of who is online, and what channels they share with you. It only gives you the names as they are on qwho.

    EDIT: So it is identical to the list on the site. Gems don't hide players anymore, and the site doesn't bypass hidden people or chameleon et al.
    I am the righteous one... 
    the claims are stated - it's the world I've created 
  • RynokRynok Member Posts: 19
    edited October 2013
    So during testing, right now I see Drakar on QWHO but not on Comm.Channels.List for example. Not sure why he shows on one and not the other though.
    Either way, looks like I'll just use the old site for now the way I used to. Grab a list of everyone, and in case of a partial match do my "best guess".

    Edit: Nevermind, I see Drakar. The numbers still don't add up, I'll see who isn't showing.

    Names not showing: Hastati, Katrina, Laila, Pamina. Could be chameleon or something messing with it and they aren't really online.
    Edit2: Yep, that was it. They don't seem to really be online (except Hastati, they are admin)
  • RynokRynok Member Posts: 19
    Thanks for the help guys!

    Here is the final result when I try to target "char" now.
    image
    LionasIniarAzefel
  • GarrynGarryn Member, Administrator Posts: 527 admin
    No need to use the old site - http://imperian.com/game/who and http://imperian.com/game/honors/Imperian/name offer these. There's also the webapi for an easy to parse option.
    IniarLionasRynok
  • IniarIniar AustraliaMember Posts: 3,213 ✭✭✭✭✭
    edited October 2013
    Name: Shou
    Full name: Shou Agarwaen
    Level: 124
    :PO

    :-O
    wit beyond measure is a Sidhe's greatest treasure
  • LionasLionas Member, Historian Posts: 765 ✭✭✭✭✭
    edited October 2013
    To expand on what Garryn said (since I didn't previously know the web api existed), here's a quick example.

    Doc is at http://www.ironrealms.com/IREAPIdocumentation.pdf

    This is in Python3:

    >>> import urllib.request
    >>> urllib.request.urlopen("http://api.imperian.com/characters.json").read()
    b'{"count":"25","characters":[{"uri":"http:\\/\\/api.imperian.com\\/characters\\/airamaya.json","name":"Airamaya"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/alyce.json","name":"Alyce"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/azefel.json","name":"Azefel"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/blyth.json","name":"Blyth"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/braidan.json","name":"Braidan"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/canavas.json","name":"Canavas"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/cas.json","name":"Cas"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/cerex.json","name":"Cerex"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/eathi.json","name":"Eathi"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/ixi.json","name":"Ixi"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/jarrhn.json","name":"Jarrhn"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/kryss.json","name":"Kryss"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/lytharose.json","name":"Lytharose"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/maglust.json","name":"Maglust"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/merelii.json","name":"Merelii"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/michiko.json","name":"Michiko"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/namir.json","name":"Namir"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/raykel.json","name":"Raykel"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/sarciossis.json","name":"Sarciossis"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/shaheen.json","name":"Shaheen"},{"uri":"http:\\/\\/api.imperian.com\\/characters\\/tek.json","name":"Tek"}]}'



    EDIT 2: Since your browser just does a GET anyway, you can also navigate to http://api.imperian.com/characters.json if you just want to see it.


    EDIT 3:
    In case you prefer the socket API
    requeststr = b"GET /characters.json HTTP/1.1\r\nHost: api.imperian.com\r\nConnection: close\r\n\r\n"

    s=socket.socket()
    s.connect(("api.imperian.com", 80)) #just "imperian.com" also works
    s.send(requeststr)
    s.recv(1000)

    Post edited by Lionas on
    I am the righteous one... 
    the claims are stated - it's the world I've created 
  • RynokRynok Member Posts: 19
    edited October 2013
    Right, we have the new site that shows you that, but it's a fairly involved to get the full picture of all available "player targets" in existence (not just online right now). Knowing who's online, and assuming it gets everyone and isn't blocking those with the Veil and such, requires me to get a target, then request information from Imperian to validate against partial names (or just scan every minute or so), and then respond with a list of matches (if not the exact match they wanted).

    By knowing every player name that exists currently, I can keep the list in memory and filter immediately upon target selection. I didn't see anything in the API that did something like that...although I do like what is there and plan on looking into it for more stuff.
  • LionasLionas Member, Historian Posts: 765 ✭✭✭✭✭
    Rynok said:
    Right, we have the new site that shows you that, but it's a fairly involved to get the full picture of all available "player targets" in existence (not just online right now). Knowing who's online, and assuming it gets everyone and isn't blocking those with the Veil and such, requires me to get a target, then request information from Imperian to validate against partial names (or just scan every minute or so), and then respond with a list of matches (if not the exact match they wanted).

    By knowing every player name that exists currently, I can keep the list in memory and filter immediately upon target selection. I didn't see anything in the API that did something like that...although I do like what is there and plan on looking into it for more stuff.
    Ah, so you're using the http://old.imperian.com/players.php?search page?
    I am the righteous one... 
    the claims are stated - it's the world I've created 
  • RynokRynok Member Posts: 19
    Yep, that's the easiest way right now. One url call and a little screen scraping, gives me every name I need. New site is missing that feature, although you can make it work but it requires lots of url calls to gather.
  • LionasLionas Member, Historian Posts: 765 ✭✭✭✭✭
    edited October 2013
    This post is off-topic to the title, but this may be useful to some people and there isn't a better place to put it:

    This is for Python 3 (I'm still training myself to use 3 instead of 2.7, and I'm rusty, so I'm doing everything in Python 3. This will be more or less the same for python 2, except that the print call will change)
    import urllib.request
    import json

    playerlist = json.loads(urllib.request.urlopen("http://api.imperian.com/characters.json").read().decode("utf-8"))
    print(playerlist["count"] + " players online:")
    for i in playerlist['characters']:
        print(i["name"], end=" ")

    I am the righteous one... 
    the claims are stated - it's the world I've created 
Sign In or Register to comment.