LCKB
Request (PHP DB > Lod Dump) - Printable Version

+- LCKB (https://lckb.dev/forum)
+-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109)
+--- Forum: Off-Topic (The Outer World) (https://lckb.dev/forum/forumdisplay.php?fid=198)
+---- Forum: General Discussion (https://lckb.dev/forum/forumdisplay.php?fid=147)
+---- Thread: Request (PHP DB > Lod Dump) (/showthread.php?tid=2247)



- Sutz - 01-21-2015


Hello..

 

I remember talking in a topic on LCDEV board about a php script Wizatek created that connects to your DB an can dump data into a lod file.

Well I'm in bad need of this if anyone has any info on it or saved the code from that board.

 

I'm looking for shop / npc / skills / quest

 

reason?.. I have found my old EP1 project database but I don't have the client an I'm working hard on restoring the client but its taking so much time. With these php scripts I could have it done so much faster.

 

Wizatek! I know you don't see eye to eye with me but maybe you could help me with this??

 

 

<?php
 
    class LCFile
    {
 
        var $fp;
 
        /**
         * Creates a new binary file to write to
         * @param string $fileName The name of the file to create
         */
        function Create($fileName)
        {
            $this->fp = fopen($fileName, 'wb');
 
            if ( !$this->fp )
                return false;
 
            return true;
        }
 
        /**
         * Write a signed 32bit integer to the file
         * @param int $val the integer to write to the file
         */
        function WriteInt($val)
        {
            fwrite($this->fp, pack('l', $val));
        }
 
        /**
         * Writes a signed short to the file
         * @param short $val the value to write to the file 
         */
        function WriteShort($val)
        {
            fwrite($this->fp, pack('s', $val));
        }
 
        /**
         * Writes a signed byte to the file
         * @param byte $val the value to write to the file 
         */
        function WriteByte($val)
        {
            fwrite($this->fp, pack('C', $val));
        }
 
        /**
         * Writes a float to the file
         * @param float $val the value to write to the file 
         */
        function WriteFloat($val)
        {
            fwrite($this->fp, pack('f', $val));
        }
 
        /**
         * Writes a string to the file
         * @param string $val the value to write to the file 
         */
        function WriteString($val)
        {
            if ( strlen($val) > 0 )
            {
                $this->WriteInt(strlen($val));
                fwrite($this->fp, $val);
            }
            else
                $this->WriteInt(0);
        }
 
    }
 
?>




- Nikolee - 01-21-2015


Well i could show you in C#/C++/Java ect.. but i never did php.. 

 

But just think what you have to do:

1 - Mysql Connection to the Database (example: t_item)

2 - Load the t_item table into your Vars. (int index, String ItemName, String desc [... ect])

3 - And then simply just write the Vars into a .lod File with a streamwriter or bufferedwriter.

 

U just need to know the Structure of the Files and for this u can take the Tools from Bash and Decompile them with .Net Reflector. (or you just compare a .lod with your DB but its faster to decompile the tool)

 

If i misunderstood something then im sry Tongue im at work and very sleepy XD




- Kekers - 01-21-2015

Why not just install the original 1185 client and go from there. I mean if it is an "old school server" then the need for custom client load files seems unnecessary.




- Wizatek - 01-21-2015


I have no idea anymore about the structures of these old files.

Usually its pretty much the same order as in the database, just take a good Hex editor and compare the values




- DamonA - 01-21-2015

pn me in skype when you have time Tongue