elitepvpers

elitepvpers (https://www.elitepvpers.com/forum/)
-   CO2 PServer Guides & Releases (https://www.elitepvpers.com/forum/co2-pserver-guides-releases/)
-   -   [Release]Table Converter Open Source (https://www.elitepvpers.com/forum/co2-pserver-guides-releases/1805344-release-table-converter-open-source.html)

funhacker 04/04/2012 14:41

[Release]Table Converter Open Source
 
Hi guys,

Another application that is also open source. This one is a 'wip' as I've not had time to test out any other table -> data file structures yet. But it does work with cq_itemtype -> itemtype.dat. However you do need to make some modifications to your cq_itemtype table.

The application comes with a 'ItemtypeStructure.ini' file, which defines how the Itemtype is structured. This structure I made according to the best of my knowledge and added fields (although unused) that I believe to exist.

Before using this app you should make sure you cq_itemtype matches this:

Use Navicat and right click cq_itemtype and choose 'design table' make sure the fields are in the correct order too if you wish to use my structure file.

Code:

Primary Key = id
Allow Null = NONE
Decimals = 0 FOR ALL

Field Name        |Type                |Length        |Signed/Unsigned|Default Value
----------------+---------------+-------+---------------+-------------
id                |int                |4        |Unsigned        |0
name                |char                |16        |N/A                |Empty String
req_profession        |tinyint        |1        |Unsigned        |0
level                |tinyint        |1        |Unsigned        |0
req_level        |tinyint        |1        |Unsigned        |0
req_sex                |tinyint        |1        |Unsigned        |0
req_force        |smallint        |2        |Unsigned        |0
req_dex                |smallint        |2        |Unsigned        |0
req_health        |smallint        |2        |Unsigned        |0
req_soul        |smallint        |2        |Unsigned        |0
monopoly        |tinyint        |1        |Unsigned        |0
weight                |smallint        |2        |Unsigned        |0
price                |int                |4        |Unsigned        |0
id_action        |int                |4        |Unsigned        |0
attack_max        |smallint        |2        |Unsigned        |0
attack_min        |smallint        |2        |Unsigned        |0
defense                |smallint        |2        |Unsigned        |0
magic_atk_min        |smallint        |2        |Unsigned        |0
dodge                |smallint        |2        |Signed                |0
life                |smallint        |2        |Signed                |0
mana                |smallint        |2        |Signed                |0
amount                |smallint        |2        |Unsigned        |0
amount_limit        |smallint        |2        |Unsigned        |0
ident                |tinyint        |1        |Unsigned        |0
gem1                |tinyint        |1        |Unsigned        |0
gem2                |tinyint        |1        |Unsigned        |0
magic1                |tinyint        |1        |Unsigned        |0
magic2                |tinyint        |1        |Unsigned        |0
magic3                |tinyint        |1        |Unsigned        |0
magic_atk_max        |smallint        |2        |Unsigned        |0
magic_def        |smallint        |2        |Unsigned        |0
atk_range        |smallint        |2        |Unsigned        |0
atk_speed        |smallint        |2        |Unsigned        |0
hitrate                |int                |4        |Unsigned        |0
monster_type        |int                |4        |Unsigned        |0
target                |smallint        |2        |Unsigned        |0
able_mask        |tinyint        |1        |Unsigned        |0
exp_type        |tinyint        |1        |Unsigned        |0
emoney                |int                |4        |Unsigned        |0
official1        |smallint        |2        |Unsigned        |0
official2        |smallint        |2        |Unsigned        |0
official3        |smallint        |2        |Unsigned        |0
official4        |smallint        |2        |Unsigned        |0
official5        |smallint        |2        |Unsigned        |0
official6        |smallint        |2        |Unsigned        |0
official7        |smallint        |2        |Unsigned        |0
official8        |smallint        |2        |Unsigned        |0
official9        |smallint        |2        |Unsigned        |0
official10        |smallint        |2        |Unsigned        |0
official11        |smallint        |2        |Unsigned        |0
official12        |smallint        |2        |Unsigned        |0
soul_value        |int                |4        |Unsigned        |0
description        |char                |128        |N/A                |Empty String

How to create Itemtype.dat from new cq_itemtype
Open application
File -> New -> Binary File
Load Text file that has pasted data from your cq_itemtype
Load Structure file (ItemtypeStructure.ini) that was included in the application.rar
Input text that separates field values (%tab represents a tab character and is the default text)
Click 'Create Converted Binary File'
Choose name of the new file, then click save
File is now made

Note
ItemtypeStructure.ini applies to EO as of version approx 1100 (Latest Pserver version)
But in theory this application should be applicable for any other game/application.
I'm posting this thread in CO/EO/ZO sections to see if people that fully understand structures will create their own structure files and get back to me on any errors if encountered.
This source is fully open source, but also note that only [Only registered and activated users can see links. Click Here To Register...] and [Only registered and activated users can see links. Click Here To Register...] have permission to post any kind of copies of this application and/or source files.

Thanks,
funhacker

Attachments:
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

Important Update:
Please note I hadn't fully tested the table design I had placed. It screwed with the data when items are dropped in game.
So I've removed the 'luck' field, this also showed a minor flaw in the programming which is now fixed.
So please re-download the application.rar for the new .exe and the itemtypestructure.

funhacker 04/06/2012 13:10

Thought I'd put this in an extra post.
Feel free to merge if you find it's not relevant.

Please note I've not tested, but I'm sure the way I coded this it won't allow for extra fields, nor will it load according to table field index yet. It purely loads in order.

So if your itemtype structure has id name req_class....
Your text file MUST have id name req_class... they must also appear in the itemtype structure in the same order they appear in the itemtype.dat.

I've coded in the extra fields to latter work on this but for now it's touchy.

CO Itemtype Structure (4267)

As per Korvacs thread: [Only registered and activated users can see links. Click Here To Register...]

Code:


[%Main%]
HasEntryCount=True
HasIndexTable=True
IndexFieldName=id
DefaultByte=0
PrefferedDataType=Biggest
EntrySize=204

[id]
Type=UINT
DatOffset=0
TableFieldIndex=0

[name]
Type=CHARARRAY
Size=16
DatOffset=4
TableFieldIndex=1

[req_class]
Type=BYTE
DatOffset=20
TableFieldIndex=2

[req_profession]
Type=BYTE
DatOffset=21
TableFieldIndex=3

[level]
Type=USHORT
DatOffset=22
TableFieldIndex=4

[req_vitality]
Type=USHORT
DatOffset=24
TableFieldIndex=5

[req_strength]
Type=USHORT
DatOffset=26
TableFieldIndex=6

[req_dexterity]
Type=USHORT
DatOffset=28
TableFieldIndex=7

[req_spirit]
Type=USHORT
DatOffset=30
TableFieldIndex=8

[tradetype]
Type=BYTE
DatOffset=32
TableFieldIndex=9

[price]
Type=UINT
DatOffset=36
TableFieldIndex=10

[damage_max]
Type=USHORT
DatOffset=44
TableFieldIndex=11

[damage_min]
Type=USHORT
DatOffset=46
TableFieldIndex=12

[defense_add]
Type=USHORT
DatOffset=48
TableFieldIndex=13

[dexterity_add]
Type=USHORT
DatOffset=50
TableFieldIndex=14

[dodge_add]
Type=USHORT
DatOffset=52
TableFieldIndex=15

[hp_add]
Type=USHORT
DatOffset=54
TableFieldIndex=16

[mp_add]
Type=USHORT
DatOffset=56
TableFieldIndex=17

[durability]
Type=USHORT
DatOffset=58
TableFieldIndex=18

[max_durability]
Type=USHORT
DatOffset=60
TableFieldIndex=19

[magic_attack]
Type=USHORT
DatOffset=62
TableFieldIndex=20

[magic_defense_add]
Type=USHORT
DatOffset=64
TableFieldIndex=21

[range]
Type=BYTE
DatOffset=72
TableFieldIndex=22

[frequency]
Type=USHORT
DatOffset=74
TableFieldIndex=23

[description]
Type=CHARARRAY
Size=128
DatOffset=76
TableFieldIndex=24



All times are GMT +2. The time now is 02:35.

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