Rune Emulator PHP Website Buffer

Results 1 to 1 of 1
  1. #1
    Elite Member MatreX is offline
    Member +Rank
    Sep 2004 Join Date
    U.s.ALocation
    236Posts

    Rune Emulator PHP Website Buffer

    I'm trying to figure out how to read the buffs from that god awefull (BLOB) field and I cant understand it.

    Using a script I found that reads the inventory I have put this together:
    PHP Code:
    <?php
    function toInt($s$pos)
    {
        
    $s3=str_split(substr($s$pos4));
        
        
    $r=ord($s3[0])+ord($s3[1])*256 ord($s3[2])*65536 ord($s3[3])*65536*256;
        return 
    $r;
    };

    class 
    buff
    {
        public 
    $id;
        public 
    $level;
        public 
    $duration;
        function 
    __construct($s=""$pos=0)
        {
            if(
    $s!="")
            {
                
    $id toInt($s$pos);
            }
        }
    };

    $MySQLi = new mysqli('**********''*****''******''*****');
    $result $MySQLi->query("SELECT buffs FROM characters WHERE name = 'bLah'");
    $row $result->fetch_object();

    for(
    $a=0;$a<72;$a++) {
        
        
    $Buff = new buff();
        
        
    $Buff->id toInt($row->buffs$a*4);
        echo 
    $Buff->id;
        echo 
    '<br />';
    }
    ?>
    I put 3 buffs on my character; protect, sf, and heap. The output gives me this:
    146
    10
    1642797
    148
    10
    1733781
    49
    20
    2429375
    4294965248
    0
    0
    0
    .....(With 59 more "0"'s following)
    Now, it shows the buff ID like i want but what are those other numbers?
    Ive changes the $pos around and $a*4 has given me the best results so far. I'm not sure what else to do, I don't really understand the math and the conversions that need to be done.


    Anyone know how this is done?

    ---------- Post added at 02:43 AM ---------- Previous post was at 02:01 AM ----------

    I did a little more tinkering. I think the toInt() function needs to be adjusted to work with the buffs, I stole it from a script to read inventory. Problem is, I have no clue what that function is doing...


    Heres my progress:
    PHP Code:
    <?php
    function toInt($s$pos)
    {
        
    $s3=str_split(substr($s$pos4));
        
        
    $r ord($s3[0]) + ord($s3[1]) * 256 ord($s3[2]) * 65536 ord($s3[3]) * 65536 256;
        return 
    $r;
    };

    class 
    buff
    {
        public 
    $id;
        public 
    $level;
        public 
    $duration;
        function 
    __construct($s=""$pos=0)
        {
            if(
    $s!="")
            {
                
    $id toInt($s$pos);
                if(
    $id==4294965248)$id=-1;
                
    $level toInt($s$pos+4);
                
    $duration toInt($s$pos+8);
            }
        }
    };

    $MySQLi = new mysqli('************''**********''*********''*********');
    $result $MySQLi->query("SELECT buffs FROM characters WHERE name = 'bLah'");
    $row $result->fetch_object();

    echo 
    toInt($row->buffs0),'<br />';

    for(
    $a=0;$a<72;$a++) {
        
        
    $Buff = new buff();
        
        
    $Buff->id toInt($row->buffs$a*24);
        
    $Buff->level toInt($row->buffs$a*24+4);
        
    $Buff->duration toInt($row->buffs$a*24+8);
        echo 
    $Buff->id.' '.$Buff->level.' '.$Buff->duration;
        echo 
    '<br />';
    }

    ?>
    Its now showing the correct information its just not showing all the buffs. I had 3 buffs, it showed me 2, now ive got 8 buffs and it shows me 4, with an unknown number where the 5th buff id should show.



    I'm going to bed now, someone must know something about this. Hopefully they will help me out.




Advertisement