找回密码
 点一下
查看: 3843|回复: 11

部分WAR3文件解释

[复制链接]
发表于 2008-6-11 08:51:50 | 显示全部楼层 |阅读模式
2.01 The W3N File Format

A W3N file is a Warcraft III Campaign file. It has the same 512 byte header as map files and also has a 260 byte footer for authentification purposes. See the W3M specification for details on the header and footer. These campaign files are only available in the Frozen Throne expansion pack.

The MPQ part can contain the following files:
(listfile)
(signature)
(attributes)
war3campaign.w3u
war3campaign.w3t
war3campaign.w3a
war3campaign.w3b
war3campaign.w3d
war3campaign.w3q
war3campaign.w3f
war3campaign.imp
war3campaignImported\*.*
We'll see now what the war3campaign.w3f file stands for. The other files have already been discussed in the W3M specification.


2.02 The war3campaign.w3f file (The info file for campaigns)



Code:
int: file format version (currently 1)
int: campaign version (how many times it has been saved)
int: saved with editor version
String: campaign name
String: campaign difficulty
String: author name
String: campaign description
int: variable difficulty levels flag + expansion flag
0=Fixed Diffculty, Only w3m maps
1=Variable Difficulty, Only w3m maps
2=Fixed Difficulty, Contains w3x maps
3=Variable Difficulty, Contains w3x maps
int: campaign background screen index (-1 = none or custom path)
String: path of custom background screen (empty if none or preset)
String: path of minimap picture (empty = none)
int: ambient sound index (-1 = imported file, 0 = none, greater 0 = preset index)
String: path of custom imported ambient sound mp3
int: uses terrain fog (0 = not used, greater 0 = index of terrain fog style dropdown box)
float: fog start z height
float: fog end z height
float: fog density
byte: fog red value
byte: fog green value
byte: fog blue value
byte: fog alpha value
int: cursor and ui race index (0 = human)
int: number "n" of maps in the campaign
"n" times a map title structure*
int: number "m" of maps in the flow chart (usually equal to "n")
"m" times a map order structure*

*Map Title Structure:
int: is map visible in the campaign screen from the beginning (1 = visible, 0 = invisible)
String: chapter title
String: map title
String: path of the map in the campaign archive

**Map Order Structure:
String: unknown (always empty, might also be a single character)
String: path of the map in the campaign archive
2.03 The SLK files (table format for different purposes)

SLK files can technically be opened by Microsoft Excel, though if you don't own Excel or a SLK editor, or want to open SLK files with your application, you might be interested in the format, so here it is. SLK files are text files and read line by line. The first two letters of each line can be used to decide what to do with it.


Code:
Format:
Line["ID"]: the first line you will have to read is the one starting with ID, this id is usually set to ID;PWXL;N;E
Line["B;"]: this line defines the number of columns and lines of the table
Example: B;Y837;X61;D0 0 836 60
This file has 837 lines and 61 columns, the rest of the line is always set to ;D0 0 Y-1 X-1 so these are probably the internal index bounds
From now on we will only look at lines that start with "C;" and are followed by "Y" or "X".
Line["C;Y"]: specifies the value for the cell with the specified line and column if the fourth token starts with a "K", otherwise we ignore it, anyway the current line is set to the y value, so the following lines that might be missing the y value refer to this line
Example: C;Y1;X1;K"unitBalanceID"
Sets the cell in line 1 and column 1 to "unitBalanceID"
Line["C;X"}: specifies the value for the cell with the specified column and the line previously specified as current line (in a "C;Y" statement) if the fourth token starts with a "K", otherwise we ignore it
Example: C;X45;K1.8
Assigns 1.8 to the cell in current line and column 45
The x value might also be omitted, so that the x value of the previous line is used.All other lines can be ignored, they contain comments and format information. After a "K" there may either be a whole or floating point number or a string within quotes. Empty cells don't have any entries. This should be enough information to successfully parse all of Blizzard's SLK files and files edited
with Excel or its Open Office equivalent.


2.04 The BLP files (image format)

Besides TGA files, Warcraft III uses mainly the BLP format for images. The format supports JPG-compression and paletted images. See the "war3mapMap.blp" description for details on the BLP format.


2.05 The MDX and MDL files (model format)

The Warcraft III models are stored in MDX format.
There are several spec files on both formats available


2.06 The Packed Files : W3V, W3Z, W3G (gamecache, savegame, replay files)

These files are packed using zlib compression. They have a common compressed format.
But after unpacking the files, each type has its own file format. The packed format is as follows :


Code:
*Packed File Header

char[28] signature: always "Warcraft III recorded game\0x1A\0"
uint header size: 0x40 for versions up to 1.06, 0x44 for later versions
uint compressed file size: including header
uint header version: 0x00 up to version 1.06, 0x01 for later versions
uint compressed size: size of the original decompressed file
uint "n": nr of compressed data blocks in the file
if (header version == 0) {
ushort unknown: always 0
ushort version number: the part behind the decimal point
} else {
char[4] version identifier: "WAR3" for classic, "W3XP" for expansion
uint version number: the part behind the decimal point
}
ushort build number: that is a unique id for each Warcraft III build
ushort flags: 0x0000 for single player, 0x8000 for multiplayer
uint length: in milli seconds for replays, 0x00000000 otherwise
uint checksum: CRC32 of the whole header until now, with this int set to 0
now there are "n" compressed blocks

*Compressed Data Block

ushort "m": compressed size of the block
ushort original size: size of the original uncomprssed input data,
must be multiple of 2048, rest is filled with 0x00 bytes
uint hash: checksum over the block header and the block data,
the formula how this is computed won't be released to the public,
however reasonable requests might be answeredNow there are "m" bytes zlib compressed data, which can be decompressed/compressed with a zlib library.
Depending on the zlib implementation you might have to compute the zlib header by yourself. That would be :

byte[2] zlib header: can be skipped when reading, set to 0x78 and 0x01 when writing
byte[m - 2] deflate stream, use deflate stream implementation to decompress/compress

After uncompressing all blocks and appending them to each other, you have the original uncompressed file.
Depending on the type of file, the replay, gamecache or savegame file specifications will now apply.


2.07 The Campaigns.w3v file (gamecache file)

This file is found once for each profile in the save directory of Warcraft III and contains stores variables and units
carried from one map to another in campaigns. Campaigns.w3v files are also embedded in savegame files where they
represent the in-memory state of the gamecaches at the time when the savegame was made. Here's the format :


Code:
*Campaigns.w3v header:
int: reserved for version (currently nr of gamecaches)
int: nr "n" of gamecaches
"n" gamecache structures

*Gamecache structure:
string: gamecache name
int: reserved (currently nr of categories)
int: nr "m" of categories
"m" category structures

*Category structure:
string: category name
int[5]: reserved for additional variable types
int: nr "i" integers
"i" integer structures
int: nr "r" reals
"r" real structures
int: nr "b" booleans
"b" boolean structures
int: nr "u" units
"u" unit structures
int: nr "s" strings
"s" string structures

*Integer/Real/Boolean structure:
string: label name
byte[4]: four bytes for the value


*String structure:
string: label name
string: value

*Unit structure:
string: lable name
int: unit id
int: nr "j" inventory slots
"j" inventory slot structures
int: experience
int: level
int: unused skill points
int[9]: unknown
int: nr "k" hero skills
"k" hero skill structures
int[2]: unknown
float: unknown
int[4]: unknown
short: unknown

*Inventory slot structure (everything 0 if slot is empty):
int: item id
int: nr charges
int: unknown

*Hero skill structure (everything 0 if not learned yet):
int: ability id
int: current level
2.08 The W3Z file (savegames)

There's not much to say about savegame files. No one ever tried to track the format of Warcraft III savegames down because they are huge and the format is pretty complicated. The only information available here can be used to extract embedded gamecache data.
To find the embedded gamecache data you simply have to search for the string token Campaigns.w3v in the savegame.
After this token you will find a full Campaigns.w3v file as described in the above section. Anyone never tried to reinject edited gamecaches into a savegame, but it is sure there's a hash or checksum that would prevent it from working.


2.09 The W3G file (replays)

Read there : Explanation on Replays

3.00 The Others Files

war3mapImported\*.* = files imported by the world editor or by the user using the import manager (these should be listed in the imp file, otherwise they will be deleted when the map is saved), you can now use any path you like and are not limited to war3mapImported\ any more, this way you can override files in the Warcraft mpq archives by placing files with the same name in your map
(signature), (listfile) and (attributes) are rather extensions to the MPQ format than actual map files but they can also be found in map archives
(signature) = signature of the w3m file, used only by Blizzard (has been replaced by a stronger signature appended at the end of map archives)
(listfile) = list of files stored in the w3m file, used by MPQ editors to resolve the names of the files stored in the archive, this is needed because stored files are one-way-hashed
(attributes) = attributes of files in the w3m file, it is checked when a map is loaded in the World Editor, if you have modified a file of a map and didn't update the (attributes) file properly it will say that the map is corrupted, the easy way to prevent this is deleting the file from the archive, the harder way is updating it, the format of the file is as follows:

int: unknown1: set to 0x64000000
int: unknown2: set to 0x03000000
"n" times a CRC32, "n" is the number of used slots (=files) in the MPQ archive
So for each file we have the CRC32 (cycling redundancy check) value here, wich is a sort of checksum, you can find functions that calculate the CRC32 of a file on the web
"n" times a Filetime, "n" is the number of used slots (=files) in the MPQ archive
The Filetime specifies for each file when it was added to the archive. It consists of two ints (low and high date/time). These two integers include information about the year, month, day, hour, minute and second when each file has been added, these 2 values represent a WinAPI file time structure and can be converted to the WinAPI system time type by using the SystemTimeToFileTime and FileTimeToSystemTime functions in kernel32.dllint:
int: low date time

The order of the CRC32 and Filetimes is the same as the order of the files in the archive. Logically this means that the information of the last CRC32 and Filetime is the information about the (attributes) file, because it has to be added to the archive after all other files. This also means that the CRC32 of the last file is always 0, because you cannot calculate the CRC32 of a file that will be changed later, which would make the CRC invalid again.


4.00 Credits

Credits to : Quantam (Justin Olbrantz), Andrey Lelikov (LMPQ API and ShadowFlare), BlackDick, DJBnJack, PitzerMike, StonedStoopid, Ziutek, wc3campaign, Blizzard Entertainment, Zépir.

At all, most of Credits goes to : http://www.wc3campaigns.net
 楼主| 发表于 2008-6-11 08:52:03 | 显示全部楼层
话说。。。。。
原本已经翻译过的东西不想再碰了
于是就只翻译没有翻译过的吧
回复

使用道具 举报

发表于 2008-6-11 08:55:44 | 显示全部楼层
说实话我老早就看懂了
只是觉得你补全了给别人看比较有用额
回复

使用道具 举报

发表于 2008-6-11 09:06:05 | 显示全部楼层
哈哈  补全 补全
回复

使用道具 举报

发表于 2008-6-11 10:31:39 | 显示全部楼层
去直接补在原本那个里
回复

使用道具 举报

 楼主| 发表于 2008-6-11 14:38:52 | 显示全部楼层
因为内容比较多
或者说根本是两个不同的版本。。。。
所以发一起不太现实
回复

使用道具 举报

发表于 2008-6-11 20:23:06 | 显示全部楼层
可怜的苦工同学...
居然也不找篇好的
回复

使用道具 举报

恶声恶气 该用户已被删除
发表于 2008-6-11 22:25:46 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

发表于 2008-6-22 00:35:25 | 显示全部楼层
少了几个文件呢..
aysMH.exe, 这个是外挂.
aysSET.exe, 这个是外挂的配置程序
aysMH.ini         这个是外挂的配置文件.
回复

使用道具 举报

 楼主| 发表于 2008-6-22 10:16:05 | 显示全部楼层
   LS说的那啥。。。。太深奥了。。。。。。MH.........MB......
回复

使用道具 举报

发表于 2008-6-22 13:14:37 | 显示全部楼层
话说我居然看到了传说中的趴趴熊编辑器
可惜没下载点
回复

使用道具 举报

发表于 2008-6-22 15:12:16 | 显示全部楼层
我看不明白。
因为我看的全英文。
我是文盲。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-5-2 13:33 , Processed in 0.127385 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表