Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 15.11.2005, 19:12   #1
Firedaemon
Архивный участник
 
Join Date: Oct 2005
Posts: 267
Default [TOOL] NPCDATA Import / Export - mySQL/PHP

Greetings,

I shared part of this on RZ in the past; but thought I would share our entire system for managing npc data here on PP.

The following PHP and SQL scripts will allow you to manage your NPC data through mySQL. If you use this and then use something like PHPmyAdmin, you can edit npcdata alot faster, perform complex searches and etc. Its much better than editing in a text editor or Excel. It will also help you to maintain a master npc database having multiple people contribute to the editing.

Also, the SQL has many of the pre-defined npc options already defined. So when it comes to adding new npcs and etc, you can make use of drop down menus and etc making the job much easier.

These scrips make use of the iconv library for PHP to convert the npcdata.txt from UTF-16 into ASCII automatically and viceversa. There is no need for you to save it as ASCII before trying to import it as the script will auto convert it. Same with the export, as it will save as Unicode 16 LE.

You will need to change some values in the php script such as your mysql username, password and possibly path to your npcdata.txt.

There are 3 files included with this release.

isogames_npc.sql - Contains the sql for mySQL
npc_import.php - Imports UTF-16 npcdata.txt into an empty database
npc_export.php - Exports UTF-16 npcdata.txt from the contents of the database

Hope some of you find this useful. This is used by isoGames in our day to day management of npc data. It is mostly bug free. If you have problems with the import, it is more than likeley due to improperly formatted npcdata.txt. If you make sure there are no spaces in the file, then you should be fine.
Firedaemon is offline  
Old 15.11.2005, 19:39   #2
Nurgl
Архивный участник
 
Join Date: May 2005
Posts: 118
Default Re: [TOOL] NPCDATA Import / Export - mySQL/PHP

Quote:
Originally Posted by Firedaemon
Greetings,

I shared part of this on RZ in the past; but thought I would share our entire system for managing npc data here on PP.

The following PHP and SQL scripts will allow you to manage your NPC data through mySQL. If you use this and then use something like PHPmyAdmin, you can edit npcdata alot faster, perform complex searches and etc. Its much better than editing in a text editor or Excel. It will also help you to maintain a master npc database having multiple people contribute to the editing.

Also, the SQL has many of the pre-defined npc options already defined. So when it comes to adding new npcs and etc, you can make use of drop down menus and etc making the job much easier.

These scrips make use of the iconv library for PHP to convert the npcdata.txt from UTF-16 into ASCII automatically and viceversa. There is no need for you to save it as ASCII before trying to import it as the script will auto convert it. Same with the export, as it will save as Unicode 16 LE.

You will need to change some values in the php script such as your mysql username, password and possibly path to your npcdata.txt.

There are 3 files included with this release.

isogames_npc.sql - Contains the sql for mySQL
npc_import.php - Imports UTF-16 npcdata.txt into an empty database
npc_export.php - Exports UTF-16 npcdata.txt from the contents of the database

Hope some of you find this useful. This is used by isoGames in our day to day management of npc data. It is mostly bug free. If you have problems with the import, it is more than likeley due to improperly formatted npcdata.txt. If you make sure there are no spaces in the file, then you should be fine.
Hmm, this for l2j mysql database ?
Nurgl is offline  
Old 15.11.2005, 19:42   #3
Firedaemon
Архивный участник
 
Join Date: Oct 2005
Posts: 267
Default

No, this is not intended for l2j
Firedaemon is offline  
Old 16.11.2005, 06:15   #4
oddy
Архивный участник
 
Join Date: Jul 2005
Posts: 13
Default

Nice management system. Thanks for the share.
oddy is offline  
Old 16.11.2005, 11:04   #5
Nurgl
Архивный участник
 
Join Date: May 2005
Posts: 118
Default

Quote:
Originally Posted by oddy
Nice management system. Thanks for the share.
Share PHP for convert drop to l2j :lol:
Nurgl is offline  
Old 16.11.2005, 13:55   #6
Forbik
Архивный участник
 
Join Date: Apr 2005
Posts: 21
Default

NPC Data Lines: 3797
Successfully added NPC Data #1
Successfully added NPC Data #2
Successfully added NPC Data #3
Successfully added NPC Data #4
Successfully added NPC Data #5
Successfully added NPC Data #6
== MYSQL ERROR ==


== NPC QUERY ==
string(2177) "
INSERT INTO
npcdata
SET
`class`='warrior',
`id`='7',
`title`='[forest_walking_fungus]',
`level`='9',
`exp`='31378.8',
`acquire_exp_rate`='x.x7',
`undying`='0',
`can_be_attacked`='1',
`acquire_sp`='36',
`race`='plant',
`sex`='male',
`temper`='100',
`safe_height`='100',
`org_jump`='15',
`skill_list`='{@s_burning_wood;@s_plant_weakness}' ,
`magic_list`='{}',
`max_item`='50',
`item_make_list`='{}',
`corpse_make_list`='{{[suede];1;1;xx.xx07};{[cotton_shoes];1;1;6.0695}}',
`additional_make_list`='{}',
`additional_make_multi_list`='{{{{[adena];66;89;100}};70};{{{[leather_shirt];1;1;xx.xx1};{[leather_pants];1;1;xx.xx9}};1.5517};{{{[stem];1;1;xx.xx73};{[suede];1;1;xx.xx24};{[swift_attack_potion];1;1;3.0303}};3.3252}}',
`slot_chest`='[]',
`slot_rhand`='[]',
`slot_lhand`='[]',
`base_attack_type`='fist',
`base_can_penetrate`='0',
`base_attack_range`='40',
`base_damage_range`='{0;0;80;120}',
`base_rand_dam`='30',
`str`='40',
`int`='21',
`dex`='30',
`wit`='20',
`con`='43',
`men`='10',
`hp_increase`='10',
`mp_increase`='3',
`org_hp_regen`='2',
`org_mp_regen`='x.x',
`ground_low`='{70;0;10}',
`ground_high`='{110;-30;30}',
`underwater_low`='{50;0;10}',
`underwater_high`='{0;0;30}',
`fly_low`='{0;0;10}',
`fly_high`='{0;-30;30}',
`float_low`='{0;0;10}',
`float_high`='{0;-30;30}',
`org_earshot`='100',
`sight`='{0;0;2500;120;5}',
`agro_range`='1000',
`org_hp`='xx.x3801724886',
`org_mp`='xx.x8',
`base_defend`='xx.x70490485705',
`base_magic_attack`='x.x170704847468',
`base_magic_defend`='xx.x56383171859',
`base_physical_attack`='xx.x09668033088',
`physical_hit_modify`='x.x5',
`physical_avoid_modify`='0',
`base_attack_speed`='253',
`base_reuse_delay`='0',
`base_critical`='4',
`magic_use_speed_modify`='0',
`status`='{normal}',
`align`='-81',
`collision_radius`='15',
`collision_height`='xx.x',
`category`='{}',
`clan`='{@walking_fungus}',
`clan_help_range`='300',
`guild`='{}',
`pledge`='{}',
`pledge_leader`='0',
`alliance`='{}',
`alliance_leader`='0',
`ignore_clan_list`='{}',
`ruler`='0',
`ruling_domain`='{}',
`npc_ai`='{[forest_walking_fungus]}',
`corpse_time`='7',
`no_sleep_mode`='0'
"


== DB RESULT QUERY ==

SELECT
*
FROM
npcdata
WHERE
id='7'


bool(false)


== NPC TEXT ==
npc_beginwarrior7[forest_walking_fungus]level=9exp=31378.8acquire_exp_rate=3.27undying=0ca n_be_attacked=1acquire_sp=36race=plantsex=maletemp er=100safe_height=100org_jump=15skill_list={@s_bur ning_wood;@s_plant_weakness}magic_list={}max_item= 50item_make_list={}corpse_make_list={{[suede];1;1;xx.xx07};{[cotton_shoes];1;1;6.0695}}additional_make_list={}additional_mak e_multi_list={{{{[adena];66;89;100}};70};{{{[leather_shirt];1;1;xx.xx1};{[leather_pants];1;1;xx.xx9}};1.5517};{{{[stem];1;1;xx.xx73};{[suede];1;1;xx.xx24};{[swift_attack_potion];1;1;3.0303}};3.3252}}slot_chest=[]slot_rhand=[]slot_lhand=[]base_attack_type=fistbase_can_penetrate=0base_atta ck_range=40base_damage_range={0;0;80;120}base_rand _dam=30str=40int=21dex=30wit=20con=43men=10hp_incr ease=10mp_increase=3org_hp_regen=2org_mp_regen=0.9 ground_low={70;0;10}ground_high={110;-30;30}underwater_low={50;0;10}underwater_high={0;0 ;30}fly_low={0;0;10}fly_high={0;-30;30}float_low={0;0;10}float_high={0;-30;30}org_earshot=100sight={0;0;2500;120;5}agro_ra nge=1000org_hp=2xx.xx8017248857org_mp=1xx.xxbase_d efend=xx.xx04904857045base_magic_attack=7.21707048 474684base_magic_defend=xx.xx63831718592base_physi cal_attack=xx.xx96680330876physical_hit_modify=4.7 5physical_avoid_modify=0base_attack_speed=253base_ reuse_delay=0base_critical=4magic_use_speed_modify =0status={normal}align=-81collision_radius=15collision_height=22.5category ={}clan={@walking_fungus}clan_help_range=300guild= {}pledge={}pledge_leader=0alliance={}alliance_lead er=0ignore_clan_list={}ruler=0ruling_domain={}npc_ ai={[forest_walking_fungus]}corpse_time=7no_sleep_mode=0npc_end


Criticle Error. NPC Data Mis Match with key:class having a value of
Forbik is offline  
Old 16.11.2005, 19:52   #7
Firedaemon
Архивный участник
 
Join Date: Oct 2005
Posts: 267
Default

With every single npc that is added to the database, it checks to make sure that the data added is the same as what was inserted. So after each query it performs a query and compares it.

More than likeley, your NPC data contains data that is not pre-defined in the table structure. For NPC ID#7, check that @walking_fungus is defined in the table field `clan` as a predefined clan. If it is already defined, then examine the row carefully to make sure that it is being parsed correctly. If the clan is not in the field as a pre-defined option, then simply add it.
Firedaemon is offline  
Old 16.11.2005, 20:08   #8
Forbik
Архивный участник
 
Join Date: Apr 2005
Posts: 21
Default

This is NPCDATA.txt from PPL2C_v1.0
Forbik is offline  
Old 23.01.2006, 17:44   #9
Cremator
Архивный участник
 
Join Date: Jan 2006
Posts: 1
Default

Quote:
Originally Posted by Forbik
This is NPCDATA.txt from PPL2C_v1.0
Big 10x to Firedaemon for this great share, I just tune the sql create table script to fit PPL2C_v1.0 npcdata.
Cremator is offline  
Old 10.02.2006, 20:31   #10
Kenster
Архивный участник
 
Join Date: Sep 2005
Posts: 455
Default

Fire. Not sure if your around, but I tested this many ways, Import script is flawless. If you try to export, and run. It errors with Synatx errors. And there is no way I am going through that many lines of code to find a bug :P
Kenster is offline  
Old 12.02.2006, 03:58   #11
Kenster
Архивный участник
 
Join Date: Sep 2005
Posts: 455
Default

Very Odd. I started the server with 20 mobs each, until I did ALL of them. Found 4 mobs with Random bugs. Not sure exactly how that happened. But checking ur Scripts now. 1 was missing a }} on AI. Another was missing } on ai, but it doesnt even have AI, default was {}. Another pushed magic_list=add itional something, and another mixed adition_make_list with another.
Kenster is offline  
Old 12.02.2006, 07:44   #12
Firedaemon
Архивный участник
 
Join Date: Oct 2005
Posts: 267
Default

I have made some changes to my scripts since I originally published. Perhaps I will reshare this coming week. I think it is time

Yes there were a few issues with it that I found since I published. Most have been corrected. I dont use the import script hardley but my npcdata is always generated from my mySQL database contents.

I will probably republish the next version on Monday or Tuesday. It does auto EXP calculation based on mob level now and also sets up rates as well as the aquire exp based on my own proprietary formula.

Details soon...
Firedaemon is offline  
Old 12.02.2006, 19:06   #13
Zil
Архивный участник
 
Join Date: Jan 2006
Posts: 277
Default

i can't do somethig...my php say Error Please, can you share maded npcdata.txt?
Zil is offline  
Old 14.02.2006, 15:21   #14
TuMBLer
Архивный участник
 
Join Date: Apr 2005
Posts: 127
Default

cool.
thx. very thx.
TuMBLer is offline  
Old 14.02.2006, 21:32   #15
Kenster
Архивный участник
 
Join Date: Sep 2005
Posts: 455
Default

Ok. I got it fully working. Although this is listed in the GPL, my modifications are 100% mine. I will show you a like of our new database once I can do it, without giving away the content. Right now it lists the strings for the mobs, and you lazy people would be able to copy and paste perfect c3 mobs :P Anyway. It does work, just it can be buggy.
Kenster is offline  
Old 14.02.2006, 22:19   #16
TuMBLer
Архивный участник
 
Join Date: Apr 2005
Posts: 127
Default

damn :cry:
seems all works fine but when i try import
at line 540 stops
Code:
NPC Data Lines: 3624
Empty data detected.

Successfully added NPC Data #2
Successfully added NPC Data #3
Successfully added NPC Data #4
Successfully added NPC Data #5
Successfully added NPC Data #6
Successfully added NPC Data #7
Successfully added NPC Data #8
---
Successfully added NPC Data #535
Successfully added NPC Data #536
Successfully added NPC Data #537
Successfully added NPC Data #538
Successfully added NPC Data #539
Successfully added NPC Data #540
in database addet only 540 rows...
no syntax errors ...
nothing...
TuMBLer is offline  
Old 15.02.2006, 02:53   #17
Kenster
Архивный участник
 
Join Date: Sep 2005
Posts: 455
Default

Space maybe at the end of the npc to make it think its over?
Kenster is offline  
Old 15.02.2006, 12:37   #18
TuMBLer
Архивный участник
 
Join Date: Apr 2005
Posts: 127
Default

no spaces =( cheked many times...
TuMBLer is offline  
Old 20.02.2006, 18:15   #19
Kenster
Архивный участник
 
Join Date: Sep 2005
Posts: 455
Default

This is what my team made with this for my players
http://l2-paradise.com/npc

Enjoy viewing
Kenster is offline  
Old 06.04.2006, 16:36   #20
melwidh
Архивный участник
 
Join Date: Oct 2005
Posts: 99
Default

My errors:

With the npcdata of my server:

NPC Data Lines: 3826
== UNIQUE FIELD DATA ==
array(0) {
}

With the one of PP release(with some changes)

NPC Data Lines: 3796
== UNIQUE FIELD DATA ==
array(0) {
}

PD: Sorry for reopen this ops:
melwidh is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 18:07.