Jump to content
  • We need you!

    You must register to discover all the features of our community!

  • 0

How to read skill_level column


andimarius

Question

Posted (edited)

 

Hi

 

 

1. Description of the problem / Question :

Does somebody know how to read the blob structure of the column skill_level from the tabel Player inside the DB Player? I found some resources on the internet but i still can't do it.

I am trying to create a JS script to read player spells.

 

 

 

Thanks, Sincerly,
Andi

 

Edited by andimarius
I found the solution (see edit history)
Link to post

1 answer to this question

Recommended Posts

  • 0
Posted (edited)

Okay, i think I did it.

 

I will try to explain how i did it.

 

Let's suppose i have this player: 

  • Name : X
  • Level : 12
  • Class: Body Warrior (skill_group + job)
  • skill_level:  SELECT HEX(skill_level) FROM player WHERE name='X';
    000000000000000400000000000100000000000100000000000400000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000032800000000032800000000000B00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Now, from the above result we need to remove the first four 0s; 

(in JS I could do something like this data.substr(4); )

 

After this, you need to divide every group of the recod, so you can find the spells . 

To do this you could loop the string by 12 chars at a time.

 

Example: 

    arrayskills=[]; vnum=0;

    for(let i = 0; i< data.length; i+=12) {

        arrayskills[vnum]=data.substr(i,12);

        vnum++;

    }

 

You loop the new array to remove from the zeros every element. 

     arrayskillsNew[i]=arrayskills[i].substr(9,12);            
--> This way you will have something like this : [0. 1 . 2 .3][SPELL LEVEL]
                                                 [   M  G  P][FROM 0 TO 40 - you need to convert it from HEX to DEC] 

 

Based on the index of the first array (vnum) you can find what spell it is by looking in the skilldesc.txt file from the client. That ID is the same as the index of the spell array.

 

The final result could be something like this :  for me "id" is the id of the spell and "spell" is the level of the spell xD

            {
                "id": 1,
                "spell": "004"
            },
            {
                "id": 2,
                "spell": "001"
            },
            {
                "id": 3,
                "spell": "001"
            },
            {
                "id": 4,
                "spell": "004"
            },
            {
                "id": 5,
                "spell": "001"
            }

   

I did my best to explain this possible solution. Hope it could be useful for somebody.

 

Sources that helped me to understand how the hex worked:

link removed by moderator

Edited by VegaS™
Link removed by moderator (see edit history)
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.