Pwadmin question

Results 1 to 5 of 5
  1. #1
    Night Gaming Network HyperSin is offline
    MemberRank
    Sep 2014 Join Date
    United StatesLocation
    713Posts

    Pwadmin question

    On the live chat plugin on pwadmin is there a way to change "From: Player(Char Id) to Char name?


  2. #2
    Account Upgraded | Title Enabled! shadowvzs is offline
    MemberRank
    Jul 2007 Join Date
    RomaniaLocation
    678Posts

    Re: Pwadmin question

    Quote Originally Posted by HyperSin View Post
    On the live chat plugin on pwadmin is there a way to change "From: Player(Char Id) to Char name?
    gamedb handle id's not player name, id is fixed, player name not!
    only thing what you can do if you want get player/char id with name like in my web....

    if (isset($_GET['UserName2Id'])){
    $oname = $_GET['UserName2Id'];
    $name = iconv("UTF-8", "UTF-16LE", $oname);
    $data = pack("N", -1).cuint(strlen($name)).$name."\x00";
    $redy = cuint(3033).cuint(strlen($data)).$data;
    if(!@$sock=socket_create(AF_INET, SOCK_STREAM, SOL_TCP)){throw new Exception("Unable to bind socket"); exit();}
    socket_connect($sock,"localhost",29400);
    socket_set_block($sock);
    socket_send($sock, $redy, 8192, 0);
    socket_recv($sock, $buf, 8192, 0);
    socket_set_nonblock($sock);
    socket_close($sock);
    $b = $buf;
    list($id) = array_values(unpack("N", substr($b, 11, 4)));
    if ($id > 0){
    echo"<script>parent.document.getElementById('Inp_RoleId').value = '".$id."';
    parent.document.getElementById('MailResponse').innerHTML = '<font color=blue><b><i> ".$oname." is ".$id."! </i></b></font>';
    </script>";
    }else{
    echo"<script>
    parent.document.getElementById('MailResponse').innerHTML = '<font color=red><b><i> ".$oname." not exist! </i></b></font>';
    </script>";
    }
    }


    function cuint($data){
    if($data < 128)
    return strrev(pack("C", $data));
    else if($data < 16384)
    return strrev(pack("S", ($data | 0x8000)));
    else if($data < 536870912)
    return strrev(pack("I", ($data | 0xC0000000)));
    return strrev(pack("c", -32) . pack("i", $data));
    }
    - - - Updated - - -

    btw only if char is online work the broadcast... else or not show name or not show either the message (except i guess if id is -1)

  3. #3
    Night Gaming Network HyperSin is offline
    MemberRank
    Sep 2014 Join Date
    United StatesLocation
    713Posts

    Re: Pwadmin question

    Myweb wont work on my host because i cant set the Apache.conf file from var/www none to all, (well i can but it dont work)

  4. #4
    Valued Member GiantAxe is offline
    MemberRank
    Oct 2012 Join Date
    136Posts

    Re: Pwadmin question

    Quote Originally Posted by HyperSin View Post
    Myweb wont work on my host because i cant set the Apache.conf file from var/www none to all, (well i can but it dont work)
    iweb has build-in functionality for most things, no need to re-invent the wheel.
    That said there is no direct roleid to name function.

    However, we can do a call to gamedb for the most basic role information (id, name, race etc, nothing heavy like inventory, tasks data etc)

    Code:
    <%!
      String Roleid2Name(int roleid)
      {  
        if(roleid == -1) {
          //probably a gm (bug in pw 151)
          return ""; 
        }
        else {
          try {
            protocol.GRoleBase base = protocol.GameDB.getRoleBase(roleid);
            if(base == null) {
              // unable to resolve roleid to a actual character
              return "";
            }
            return base.name.getString();
          }
          catch(Exception ex) {
            // is gamedbd online? dunno?
            return "";
          }
        }    
      }
    %>
    Then just modify the code that builds up the chatline for livechat and make a call to the above local function

    The thing is, wether its php or java, if you want to do this lower the amount of chatlines at time to like 50 or so. otherwise you're going to end up calling the gamedb so much its chrashing or slowing down your iweb to a crawl.

  5. #5
    Night Gaming Network HyperSin is offline
    MemberRank
    Sep 2014 Join Date
    United StatesLocation
    713Posts

    Re: Pwadmin question

    I will try this



Advertisement