|
You last visited: Today at 11:56
Advertisement
[RELEASE]RDB to SQL PerResource C++ Source code
Discussion on [RELEASE]RDB to SQL PerResource C++ Source code within the Rappelz Private Server forum part of the Rappelz category.
11/18/2012, 20:59
|
#1
|
elite*gold: 0
Join Date: Aug 2012
Posts: 320
Received Thanks: 264
|
[RELEASE]RDB to SQL PerResource C++ Source code
Hey I give you the very hard source code*trololololo* for read rdb in C++
After you just have to change the structure and the SQL query for other RDB
|
|
|
11/19/2012, 00:56
|
#2
|
elite*gold: 0
Join Date: Aug 2011
Posts: 532
Received Thanks: 234
|
It's actually not 'very hard source code', it's just a dark forest for some people.
|
|
|
11/19/2012, 03:01
|
#3
|
elite*gold: 0
Join Date: Aug 2012
Posts: 320
Received Thanks: 264
|
Quote:
Originally Posted by marekrndr
It's actually not 'very hard source code', it's just a dark forest for some people.
|
I know is for that i say trolololo 
every people can do it in less than 1/2 day if they don't know programming...
|
|
|
11/21/2012, 15:28
|
#4
|
elite*gold: 0
Join Date: Apr 2010
Posts: 389
Received Thanks: 294
|
I don't know much about programming , I don't even know if this code is right or not , but can this be modified for reading other rdb files ?
|
|
|
11/21/2012, 16:00
|
#5
|
elite*gold: 0
Join Date: Aug 2012
Posts: 320
Received Thanks: 264
|
Yes this is the base... In exemple for CharachterMotion (is the same base just look what is changed) =>  (the last one i release ^^)
|
|
|
11/21/2012, 23:44
|
#6
|
elite*gold: 0
Join Date: Apr 2012
Posts: 463
Received Thanks: 838
|
good start. Now use classes to just have to change a structure to read another rdb (and not any sql/file reading related code)
Then use a lua vm and move all structures in lua so you don't have to recompile your rdb tool to read a new rdb or update a structure  (lua because some rdb are not just simple structure, they need some data processing unfortunately, and because some people there should know how to make that)
|
|
|
11/22/2012, 09:09
|
#7
|
elite*gold: 0
Join Date: Aug 2012
Posts: 320
Received Thanks: 264
|
I know it i have done a class who just asking the struct and the rdb/sql file but not for the lua ^^
I will done it and release it
|
|
|
11/22/2012, 16:41
|
#8
|
elite*gold: 0
Join Date: Nov 2009
Posts: 19
Received Thanks: 9
|
AutoIt
|
|
|
11/22/2012, 18:21
|
#9
|
elite*gold: 0
Join Date: Aug 2012
Posts: 320
Received Thanks: 264
|
De quoi donc? Si tu veux je peux mettre aussi une source en autoit mais c'est assez crade(enfin comme la quoi sans prog objet ^^) enfin en autoit quoi... x)
|
|
|
12/09/2012, 12:35
|
#10
|
elite*gold: 0
Join Date: Aug 2012
Posts: 10
Received Thanks: 4
|
Hello could you help me to find the fault?
The IDE shows 0 error bot if I start the .exe it show that the program does not work anymore (Windows error message) and the .sql file is empty.
Here my code:
Code:
#include <iostream>
#include <fstream>
using namespace std;
struct db_monster {
int id;
int monster_group;
int name_id;
int location_id;
char model[256];
int motion_file_id;
int transform_level;
int walk_type;
int slant_type;
float size;
float scale;
float target_fx_size;
int camera_x;
int camera_y;
int camera_z;
float target_x;
float target_y;
float target_z;
int level;
int grp;
int magic_type;
int race;
int visible_range;
int chase_range;
int f_fisrt_attack;
int f_group_first_attack;
int f_response_casting;
int f_response_race;
int f_response_battle;
int monster_type;
int stat_id;
int fight_type;
int monster_skill_link_id;
int material;
int weapon_type;
int attack_motion_speed;
int ability;
int standard_walk_spped;
int standard_run_spped;
int walk_speed;
int run_speed;
float attack_range;
float hidesense_range;
int hp;
int mp;
int attack_point;
int magic_point;
int defence;
int magic_defence;
int attack_speed;
int magic_speed;
int accuracy;
int avoid;
int magic_accuracy;
int magic_avoid;
int taming_id;
float taming_percentage;
float taming_exp_mod;
int exp;
int jp;
int gold_drop_percentage;
int gold_min;
int gold_max;
int chaos_drop_percentage;
int chaos_min;
int chaos_max;
int exp_2;
int jp_2;
int gold_min_2;
int gold_max_2;
int chaos_min_2;
int chaos_max_2;
int drop_table_link_id;
int texture_group;
int local_flag;
char script_on_dead[256];
};
int main()
{
int nbloop; //var for count number of loop
ifstream RDB; //stream for read rdb
ofstream SQL; //stream for write sql
RDB.open("db_monster.rdb", ios::in | ios::binary); //open RDB file
if(!RDB)//if the file can't be open
{
cout << "Error occured\n";
return 1;
}
SQL.open("db_monster.sql"); //open SQL file
RDB.seekg(128, ios::beg); //We go over the header(128empty bit)
RDB.read((char *) &nbloop,4);//we read 4bit(int) corresponding to the nb of line
db_monster data[nbloop];//create array who will contening each information
for(int i=0; i<nbloop; i++) //loop for read all data
{
RDB.read((char *) &data[i], sizeof(db_monster));//put each data from structure into
}
RDB.close(); //close RDB
if(!RDB.good()) //If error durring reading(some time because you try to read more than you can)
{
cout << "An error occured\n";
return 1;
}
//Wrinting Drop & create for CreatureFarmResource
SQL << "USE [Arcadia]\nGO\n/****** Object: Table [dbo].[MonsterResource] Script Date: 09/12/2012 01:32:00 ******/\nDROP TABLE [dbo].[MonsterResource]\nGO\n\nSET ANSI_NULLS ON\nGO\nSET QUOTED_IDENTIFIER ON\nGO\nCREATE TABLE [dbo].[MonsterResource](\n [id] [int] NOT NULL, \n [monster_group] [int] NOT NULL, \n [name_id] [int] NOT NULL, \n [location_id] [int] NOT NULL, \n [model] [varchar(256)] NOT NULL, \n [motion_file_id] [int] NOT NULL, \n [transform_level] [int] NOT NULL, \n [walk_type] [tinyint] NOT NULL, \n [slant_type] [tinyint] NOT NULL, \n [size] [decimal(10,2)] NOT NULL, \n [scale] [decimal(10,2)] NOT NULL, \n [target_fx_szize] [decimal(10,2)] NOT NULL, \n [camera_x] [int] NOT NULL, \n [camera_y] [int] NOT NULL, \n [camera_z] [int] NOT NULL, \n [target_x] [decimal(10,2)] NOT NULL, \n [target_y] [decimal(10,2)] NOT NULL, \n [target_z] [decimal(10,2)] NOT NULL, \n [level] [int] NOT NULL, \n [grp] [int] NOT NULL, \n [magic_type] [int] NOT NULL, \n [race] [int] NOT NULL, \n [visible_range] [int] NOT NULL, \n [chase_range] [int] NOT NULL, \n [f_fisrt_attack] [tinyint] NOT NULL, \n [f_group_first_attack] [tinyint] NOT NULL, \n [f_response_casting] [tinyint] NOT NULL, \n [f_response_race] [tinyint] NOT NULL, \n [f_response_battle] [tinyint] NOT NULL, \n [monster_type] [tinyint] NOT NULL, \n [stat_id] [int] NOT NULL, \n [fight_type] [int] NOT NULL, \n [monster_skill_link_id] [int] NOT NULL, \n [material] [int] NOT NULL, \n [weapon_type] [int] NOT NULL, \n [attack_motion_speed] [int] NOT NULL, \n [ability] [int] NOT NULL, \n [standard_walk_spped] [int] NOT NULL, \n [standard_run_spped] [int] NOT NULL, \n [walk_speed] [int] NOT NULL, \n [run_speed] [int] NOT NULL, \n [attack_range] [decimal(10,2)] NOT NULL, \n [hidesense_range] [decimal(10,2)] NOT NULL, \n [hp] [int] NOT NULL, \n [mp] [int] NOT NULL, \n [attack_point] [int] NOT NULL, \n [magic_point] [int] NOT NULL, \n [defence] [int] NOT NULL, \n [magic_defence] [int] NOT NULL, \n [attack_speed] [int] NOT NULL, \n [magic_speed] [int] NOT NULL, \n [accuracy] [int] NOT NULL, \n [avoid] [int] NOT NULL, \n [magic_accuracy] [int] NOT NULL, \n [magic_avoid] [int] NOT NULL, \n [taming_id] [int] NOT NULL, \n [taming_percentage] [decimal(12,4)] NOT NULL, \n [taming_exp_mod] [decimal(10,2)] NOT NULL, \n [exp] [int] NOT NULL, \n [jp] [int] NOT NULL, \n [gold_drop_percentage] [int] NOT NULL, \n [gold_min] [int] NOT NULL, \n [gold_max] [int] NOT NULL, \n [chaos_drop_percentage] [int] NOT NULL, \n [chaos_min] [int] NOT NULL, \n [chaos_max] [int] NOT NULL, \n [exp_2] [int] NOT NULL, \n [jp_2] [int] NOT NULL, \n [gold_min_2] [int] NOT NULL, \n [gold_max_2] [int] NOT NULL, \n [chaos_min_2] [int] NOT NULL, \n [chaos_max_2] [int] NOT NULL, \n [drop_table_link_id] [int] NOT NULL, \n [texture_group] [int] NOT NULL, \n [local_flag] [int] NOT NULL, \n [script_on_dead] [varchar(256)] NOT NULL\n) ON [PRIMARY]\n\nGO\n\n" ;
for(int i=0; i < nbloop; i++)
{
SQL << "INSERT INTO [Arcadia].[dbo].[MonsterResource]\n" << //Wrinting each data in SQL files
"([id] "<<
", [monster_group]" <<
", [name_id]" <<
", [location_id]" <<
", [model]" <<
", [motion_file_id]" <<
", [transform_level]" <<
", [walk_type]" <<
", [slant_type]" <<
", [size]" <<
", [scale]" <<
", [target_fx_size]" <<
", [camera_x]" <<
", [camera_y]" <<
", [camera_z]" <<
", [target_x]" <<
", [target_y]" <<
", [target_z]" <<
", [level]" <<
", [grp]" <<
", [magic_type]" <<
", [race]" <<
", [visible_range]" <<
", [chase_range]" <<
", [f_fisrt_attack]" <<
", [f_group_first_attack]" <<
", [f_response_casting]" <<
", [f_response_race]" <<
", [f_response_battle]" <<
", [monster_type]" <<
", [stat_id]" <<
", [fight_type]" <<
", [monster_skill_link_id]" <<
", [material]" <<
", [weapon_type]" <<
", [attack_motion_speed]" <<
", [ability]" <<
", [standard_walk_spped]" <<
", [standard_run_spped]" <<
", [walk_speed]" <<
", [run_speed]" <<
", [attack_range]" <<
", [hidesense_range]" <<
", [hp]" <<
", [mp]" <<
", [attack_point]" <<
", [magic_point]" <<
", [defence]" <<
", [magic_defence]" <<
", [attack_speed]" <<
", [magic_speed]" <<
", [accuracy]" <<
", [avoid]" <<
", [magic_accuracy]" <<
", [magic_avoid]" <<
", [taming_id]" <<
", [taming_percentage]" <<
", [taming_exp_mod]" <<
", [exp]" <<
", [jp]" <<
", [gold_drop_percentage]" <<
", [gold_min]" <<
", [gold_max]" <<
", [chaos_drop_percentage]" <<
", [chaos_min]" <<
", [chaos_max]" <<
", [exp_2]" <<
", [jp_2]" <<
", [gold_min_2]" <<
", [gold_max_2]" <<
", [chaos_min_2]" <<
", [chaos_max_2]" <<
", [drop_table_link_id]" <<
", [texture_group]" <<
", [local_flag]" <<
", [script_on_dead]) "<<
"\nVALUES\n"<<
"(" <<
(int)data[i].id << "," <<
(int)data[i].monster_group << "," <<
(int)data[i].name_id << "," <<
(int)data[i].location_id << "," <<
'"' << (string)data[i].model << '"' << "," <<
(int)data[i].motion_file_id << "," <<
(int)data[i].transform_level << "," <<
(int)data[i].walk_type << "," <<
(int)data[i].slant_type << "," <<
(float)data[i].size << "," <<
(float)data[i].scale << "," <<
(float)data[i].target_fx_size << "," <<
(int)data[i].camera_x << "," <<
(int)data[i].camera_y << "," <<
(int)data[i].camera_z << "," <<
(float)data[i].target_x << "," <<
(float)data[i].target_y << "," <<
(float)data[i].target_z << "," <<
(int)data[i].grp << "," <<
(int)data[i].magic_type << "," <<
(int)data[i].race << "," <<
(int)data[i].visible_range << "," <<
(int)data[i].chase_range << "," <<
(int)data[i].f_fisrt_attack << "," <<
(int)data[i].f_group_first_attack << "," <<
(int)data[i].f_response_casting << "," <<
(int)data[i].f_response_race << "," <<
(int)data[i].f_response_battle << "," <<
(int)data[i].monster_type << "," <<
(int)data[i].stat_id << "," <<
(int)data[i].fight_type << "," <<
(int)data[i].monster_skill_link_id << "," <<
(int)data[i].material << "," <<
(int)data[i].weapon_type << "," <<
(int)data[i].attack_motion_speed << "," <<
(int)data[i].ability << "," <<
(int)data[i].standard_walk_spped << "," <<
(int)data[i].standard_run_spped << "," <<
(int)data[i].walk_speed << "," <<
(int)data[i].run_speed << "," <<
(float)data[i].attack_range << "," <<
(int)data[i].hidesense_range << "," <<
(int)data[i].hp << "," <<
(int)data[i].mp << "," <<
(int)data[i].attack_point << "," <<
(int)data[i].magic_point << "," <<
(int)data[i].defence << "," <<
(int)data[i].magic_defence << "," <<
(int)data[i].attack_speed << "," <<
(int)data[i].magic_speed << "," <<
(int)data[i].accuracy << "," <<
(int)data[i].avoid << "," <<
(int)data[i].magic_accuracy << "," <<
(int)data[i].magic_avoid << "," <<
(int)data[i].taming_id << "," <<
(float)data[i].taming_percentage << "," <<
(float)data[i].taming_exp_mod << "," <<
(int)data[i].exp << "," <<
(int)data[i].jp << "," <<
(int)data[i].gold_drop_percentage << "," <<
(int)data[i].gold_min << "," <<
(int)data[i].gold_max << "," <<
(int)data[i].chaos_drop_percentage << "," <<
(int)data[i].chaos_min << "," <<
(int)data[i].chaos_max << "," <<
(int)data[i].exp_2 << "," <<
(int)data[i].jp_2 << "," <<
(int)data[i].chaos_min_2 << "," <<
(int)data[i].chaos_max_2 << "," <<
(int)data[i].drop_table_link_id << "," <<
(int)data[i].texture_group << "," <<
(int)data[i].local_flag << "," <<
'"' << (string)data[i].script_on_dead << '"' << ")" <<
"\nGo\n\n";
}
SQL.close(); //close SQL
return 0; //exit
}
|
|
|
12/09/2012, 13:11
|
#11
|
elite*gold: 0
Join Date: Apr 2012
Posts: 463
Received Thanks: 838
|
if you compile a 64bits program, RDB.read((char *) &nbloop,4) is not enough, as an integer will be 64bits (8 bytes), you have to add nbloop = 0 in this case before the read.
And (string)data[i].model should not be necessary, your data is already typed, why casting them all ? And for ' " ', it should be ' \' ' (without spaces) as the " is for column names and ' for values
If with that you still have the problem, try commenting out some part of code (or use a debugger)
|
|
|
12/09/2012, 17:31
|
#12
|
elite*gold: 0
Join Date: Aug 2012
Posts: 10
Received Thanks: 4
|
Hm thx for you help but i think i should stop working on in cause i don't know what i do at all xD
Well, then i just wait for a release of a new resource editor =/
|
|
|
All times are GMT +1. The time now is 11:56.
|
|