Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Pwadmin question

Night Gaming Network
Joined
Sep 13, 2014
Messages
728
Reaction score
46
On the live chat plugin on pwadmin is there a way to change "From: Player(Char Id) to Char name?
 
Joined
Jul 17, 2007
Messages
665
Reaction score
104
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));
}



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)
 
Upvote 0
Night Gaming Network
Joined
Sep 13, 2014
Messages
728
Reaction score
46
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)
 
Upvote 0
Junior Spellweaver
Joined
Oct 16, 2012
Messages
136
Reaction score
46
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:
[COLOR="#FFFF00"]<%[/COLOR]!
  [COLOR="#0000FF"]String[/COLOR] Roleid2Name(int roleid)
  {  
    [COLOR="#0000FF"]if[/COLOR](roleid == -1) {
      [COLOR="#008000"]//probably a gm (bug in pw 151)[/COLOR]
      [COLOR="#0000FF"]return[/COLOR] [COLOR="#FFA500"]""[/COLOR]; 
    }
    [COLOR="#0000FF"]else[/COLOR] {
      [COLOR="#0000FF"]try[/COLOR] {
        protocol.[COLOR="#800080"]GRoleBase[/COLOR] base = protocol.[COLOR="#800080"]GameDB[/COLOR].getRoleBase(roleid);
        [COLOR="#0000FF"]if[/COLOR](base == [COLOR="#0000CD"]null[/COLOR]) {
          [COLOR="#008000"]// unable to resolve roleid to a actual character[/COLOR]
          [COLOR="#0000FF"]return[/COLOR] [COLOR="#FFA500"]""[/COLOR];
        }
        [COLOR="#0000FF"]return[/COLOR] base.name.getString();
      }
      [COLOR="#0000FF"]catch[/COLOR]([COLOR="#800080"]Exception[/COLOR] ex) {
        [COLOR="#008000"]// is gamedbd online? dunno?[/COLOR]
        [COLOR="#0000FF"]return[/COLOR] [COLOR="#FFA500"]""[/COLOR];
      }
    }    
  }
[COLOR="#FFFF00"]%>[/COLOR]

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.
 
Upvote 0
Back
Top