Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Rappelz > Rappelz Private Server
You last visited: Today at 23:17

  • Please register to post and access all features, it's quick, easy and FREE!

 

a question about db_item.rdb

Reply
 
Old   #1
 
elite*gold: 0
Join Date: May 2011
Posts: 139
Received Thanks: 12
a question about db_item.rdb

Hello..

I have read a post for glandu2 about the record of db_item.rdb in this thread




but I didn't understand this point


Quote:
union { //the wear_limit_bits and the struct share the same bits
UINT32 wear_limit_bits;
struct {
unsigned int : 1;
unsigned int : 1;
unsigned int limit_deva : 1;
unsigned int limit_asura : 1;
unsigned int limit_gaia : 1;
unsigned int : 1;
unsigned int : 1;
unsigned int : 1;
unsigned int : 1;
unsigned int : 1;
unsigned int limit_fighter : 1;
unsigned int limit_hunter : 1;
unsigned int limit_magician : 1;
unsigned int limit_summoner : 1;
unsigned int : 1;
unsigned int : 1;
unsigned int : 16;
};
};
I found 4 bytes for it in the first item which are 1C 3C 00 00
any body please can tell me what should I do with these bytes to extract the values


thank you....



diaa yousef is offline  
Old   #2
 
elite*gold: 0
Join Date: Sep 2008
Posts: 1,570
Received Thanks: 1,154
You have to check the bitsets in the bytes. If the Bit is set the flag is checked otherwise not...


c1ph3r is offline  
Thanks
1 User
Old   #3
 
elite*gold: 0
Join Date: May 2011
Posts: 139
Received Thanks: 12
Quote:
Originally Posted by c1ph3r View Post
You have to check the bitsets in the bytes. If the Bit is set the flag is checked otherwise not...
thank you for your answer
but can you please give me an example
diaa yousef is offline  
Old   #4
 
elite*gold: 0
Join Date: Apr 2012
Posts: 448
Received Thanks: 766
the code you quoted is in C language

in the structure, each line represent one or more bits
For example:
struct {
int blabla : 4;
int albalb : 12;
};

this structure is a 16 bit structure where blabla is the value of the 4 first bits and albalb the last 12 bits so if the byte is: 0x1234, blabla is 0x4 and albalb is 0x0123

here limit* fields is only 1 bit so there is int limit_* : 1;
("unsigned int" or just "int" is the type of the variable (limit* here))

when there is no name, the field is ignored as here:
unsigned int : 1; //we don't care about this bit


(also explained here: C++ Bit Fields (C++))

also as intel (compatible) processors are little endian, 0x1234 is represented as two byte: 0x34 and 0x12 (inversed order) so 1C 3C 00 00 is representable as an 32bits integer 0x00003C1C


glandu2 is offline  
Thanks
2 Users
Old   #5
 
elite*gold: 0
Join Date: Apr 2010
Posts: 389
Received Thanks: 289
Quote:
Originally Posted by glandu2 View Post
the code you quoted is in C language

in the structure, each line represent one or more bits
For example:
struct {
int blabla : 4;
int albalb : 12;
};

this structure is a 16 bit structure where blabla is the value of the 4 first bits and albalb the last 12 bits so if the byte is: 0x1234, blabla is 0x4 and albalb is 0x0123

here limit* fields is only 1 bit so there is int limit_* : 1;
("unsigned int" or just "int" is the type of the variable (limit* here))

when there is no name, the field is ignored as here:
unsigned int : 1; //we don't care about this bit


(also explained here: C++ Bit Fields (C++))

also as intel (compatible) processors are little endian, 0x1234 is represented as two byte: 0x34 and 0x12 (inversed order) so 1C 3C 00 00 is representable as an 32bits integer 0x00003C1C
a little question , in the example you mentioned
struct {
int blabla : 4;
int albalb : 12;
};

the (blabla) and (albalb) had more than 1 bit , but in the item.rdb structure the limit_* values are only 1 bit
so how can i find the value of 1 bit ?
use binary ?
thx
Strange2010 is offline  
Old   #6
 
elite*gold: 0
Join Date: May 2011
Posts: 139
Received Thanks: 12
yes use it

but discovered that the order is different than what I quoted
diaa yousef is offline  
Old   #7
 
elite*gold: 0
Join Date: Apr 2012
Posts: 448
Received Thanks: 766
in C the value of the bit is in the according variable as declared between brackets
so the 1 or 0 value is in limit* variables, if there is a value that is not 0 or 1 in limit* variables, your compiler is probably too old (or you miswritten the struct declaration)

so to test bits you just have to do something like this:
if( limit_* ) { ... }

in my example, the range of possible value of blabla is 0-16 for example, the declared type (unsigned int or int) is just a way for the compiler to know how to interpret the value


another way if you don't want to use C, is to use binary and

to get the first bit you can do:

(Value AND 2^0) = 0 if bit 0 is 0 else bit 0 is 1
(Value AND 2^1) = 0 if bit 1 is 0 else bit 1 is 1
(Value AND 2^2) = 0 if bit 2 is 0 else bit 2 is 1
...

where Value is the value of the flags (as the 1C 3C 00 00)
glandu2 is offline  
Thanks
1 User
Old   #8
 
elite*gold: 0
Join Date: May 2011
Posts: 139
Received Thanks: 12
Can you tell me please how do you get the record of rdb files
diaa yousef is offline  
Old   #9
 
elite*gold: 0
Join Date: Apr 2010
Posts: 389
Received Thanks: 289
Quote:
Originally Posted by diaa yousef View Post
yes use it

but discovered that the order is different than what I quoted
try to put it inversed for example (1c 3c 00 00) put it (00 00 3c 1c)
then read bits from right to left , it will be the right order
11110000011100

from right to left

and glandu i don't know anything about C++
but is this i mentioned above right ?

Quote:
Originally Posted by diaa yousef View Post
Can you tell me please how do you get the record of rdb files
compare them to the same table in sql
Strange2010 is offline  
Thanks
1 User
Old   #10
 
elite*gold: 0
Join Date: Apr 2012
Posts: 448
Received Thanks: 766
yes you're right ^^

and here the 3 "1" bits are
unsigned int limit_deva : 1;
unsigned int limit_asura : 1;
unsigned int limit_gaia : 1;

and the 4 others the other limit*, all are set to "1" (other bits set to "0" are not used)


glandu2 is offline  
Thanks
2 Users
Reply



« Previous Thread | Next Thread »

Similar Threads
[Release]db_item.rdb partial strs
NULL
20 Replies - Rappelz Private Server
Real structur of DB_ITEM.RDB
nulled
8 Replies - Rappelz Private Server



All times are GMT +2. The time now is 23:17.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy
Copyright ©2017 elitepvpers All Rights Reserved.