На прошлой недели состряпал программку для низкоуровневой работы с мулами. Сия тулса может найти применение в следующих задачах:
- миграцией с старых клиентов на новые или наоборот
- массовый перенос объектов (к примеру сдвигу всех тайлов из определенного диапазона в другой, попутно проделав тоже самое с тайлдатой, радарколом, анимдатой, картой и статикой)
- создание скриптов для регулярной подмены содержимого (к примеру ежегодная замена тайлов на зимний вариант и обратно)
- как патчер для бедных или основа для собственного патчера
- дефрагментация данных (речь не только об статике, а об любых мулах - звуки, гампы, тайлы и тд)
Код
This software is part of EssenceUDK project
<http://dev.uoquint.ru/projects/essence-udk>
EssenceUDK.Tool version: 1.0.5492.35302
EssenceUDK.Platform version: 1.0.5492.35302
Usage: run "EssenceUDK.Tools.exe" with command.
Commands:
--fsutil - Operation over file system (rename, moving, deleteing files)
Arguments:
[-pfx <string>] [-min <number>] [-max <number>] [-ren <beg|end|file>]
[-mov <number>] [-len <number>] [-hex] [-del] <in_dir> <out_dir> [<list>]
-pfx <string> Prefix for file names: I, L, T, G and others.
-min <number> Ignore all files with ID < number.
-max <number> Ignore all files with ID > number.
-ren <beg|end> Rename all files from end or start without skipping ID.
-ren <file> Rename files from files according to there rule
-mov <number> Shift each result ID by specified value.
-len <number> Count of digits in output names (default 5 and 4 for hex)
-hex Save file names in HEX format.
-del Delete file from <in_dir> after coping ti <out_dir>.
<in_dir> Path to input folder.
<out_dir> Path to output folder.
<list> Path to output text file to store list of id's
--create - Create new index or not index *.mul file with specidied size
Arguments:
<entry_count> <entry_size> <mulfile>
<entry_count> <idxfile> <mulfile>
--resize - Increase/decrease *.mul file length
Arguments:
<entry_count> $MULCON$
--defrag - Defragmentation index *.mul file
Arguments:
$MULCON$
--export - Export data blocks and save them as *.mde files.
Arguments:
<dirpath> $MULCON$
--import - Import data blocks from *.mde files to *.mul file.
Arguments:
<dirpath> $MULCON$
--merger - Make binary merge for 2 *.mul files. All not existing entries in
second file will be replaced from 1st, and all conflict entries
will be exported to *.mde files in specified folders.
Arguments:
<dirpath> $MULCON$ <dirpath> $MULCON$
--convtd - Make conversation from new tiledta format(HS) to old one and back
Arguments:
<dstfile> <newformat> <mulfile>
<newformat> - true/false, true means converting from new format to old
--convmt - Make conversation from new multi format(HS) to old one and back
Arguments:
<newformat> <idxfile> <mulfile>
<newformat> - true/false, true means converting from new format to old
--copyid - Coping entries with specified numbers to new position
Arguments:
$LIST#2$ $MULCON$
--moveid - Moving entries with specified numbers to new position
Arguments:
$LIST#2$ $MULCON$
--remove - Delete entries with specified numbers in index *.mul file
Arguments:
$LIST#1$ $MULCON$
--facetm - Operation over facets (map, statics, facets)
Arguments:
<folder> <uodata> <uoopts> $SUBCMD$
<folder> - folder with data files
<uodata> - client type flags (for HS - 0x0462, else - 0x0062)
<uoopts> - array of map indexes and map sizes, where values are separeted
by "|" (for original HS maps:
"0|896|512|1|896|512|2|288|200|3|320|256|4|181|181|5|160|512")
$SUBCMD$ - subcommand, see list below:
-replid - Replace all land tiles with specified Index by new Index
Arguments:
$MPAREA$ $LIST#2$
-reptid - Replace all item tiles with specified Index by new Index
Arguments:
$MPAREA$ $LIST#2$
-rephid - Replace all item colors with specified Index by new Index
Arguments:
$MPAREA$ $LIST#2$
Allias:
$MULCON$ -> <index_offset> <entry_length> <idxfile> <mulfile>
$MULCON$ -> <byte_offset> <entry_length> <entry_size> <mulfile>
$MULCON$ -> <byte_offset> <entry_length> <entry_head_size>
<entry_item_size> <entry_item_count> <mulfile>
<entry_length> - if 0 then will be set up to the end of file
$LIST#1$ -> <index>
$LIST#1$ -> <txtfile>
$LIST#2$ -> <srs_index> <dst_index>
$LIST#2$ -> <txtfile>
$MPAREA$ -> <map_index> <block_x1> <block_y1> <block_x2> <block_y2>
<block_x2> == 0 or <block_y2> == 0 means width-1 and height-1
Notes:
- Before merge or defrag operation to make them more effective recomended to
resave all data by Fiddler. This action prevent situations when same data
will have different byte sequences.
- *.mde files are binary data of specified index with name in ?????? format,
where ?????? is number of entry. For index *.mul files first 4 bytes are
extra value from *.idx file.
- text file for $LIST#1$ allias must contain list of numbers separated with
line break.
- text file for $LIST#2$ allias must contain list of pair numbers separated
with line break. Numbers in pairs can be separated with space, comma, "->"
If second number not present instead of it will be used incremented by 1
last second value. If second value wasn't specifer befor exception occurs
- All numbers can be ither in decimal or in hex style, for last case they
have to start wirh "0x" specifier.
- All paths can be ither full or related for setting working directory
Info about muls:
| file name | entry size | entry count |
|--------------|-------------|--------------|
| tiledata.mul | 836 / 964 | 512 | - land tiles
| tiledata.mul | 1188 / 1316 | 512/1024/2048| - item tiles(off:428032/493568)
| animdata.mul | 548 | items / 8 |
| radarcol.mul | 2 | land + items |
| hues.mul | 708 | 375 |
| light.mul | - | 100 |
| sound.mul | - | 4096 |
| multi.mul | - | 8192 |
| map##.mul | 196 | width*height | - sizes in blocks (8x8 tiles)
| file name | header | item size | item count |
|--------------|--------|-----------|------------|
| tiledata.mul | 4 | 26 / 30 | 32 | - land tiles
| tiledata.mul | 4 | 37 / 41 | 32 | - item tiles
| animdata.mul | 4 | 68 | 8 |
| hues.mul | 4 | 88 | 8 |
Length of index based muls can be geted as *.idx length / 12