昨天闲着无聊把wow2.33中的技能说明都给提取了出来,想在自己单机版的武器上添加绿字技能玩,下面是代码(我比较懒所以只提取的技能ID,名称和说明部分,好多地方的实现不是很好)
Spell.dbc结构:
Header(文件头20字节)
Records.................行数(4字节)
Fields....................列数(4字节)
Record Size...............每行所占字节(4字节)
String Block Size.....字符区所占字节(4字节)
Data(数据区 共Records * Record Size字节)-----存技能各种数据
row1.....(占Record Size字节)
row2.....(占Record Size字节)
Text(字符区 共String Block Size字节)------存技能文字说明等字符信息
第一行总为/0,后面的遇到/0为一行
例:技能名称提取 先由Data中找出技能名称所在字段,在127列*4byte=508byte位置得到技能名称在Text区的偏移量,String Block Size+偏移量就能得到技能名称的位置
------------------------------------------------------------------------------------------
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
namespace WowItemTool
{
[Serializable]
public class spellInfo
{
public int id;
public string name, type, memo;
}
class spell
{
private byte[] m_stringTable;
private byte[] rowData;
public List<spellInfo> GetSpellList()
{
int rows, cols, rlen, tlen;
List<spellInfo> list=new List<spellInfo>();
![]()
//打开文件
FileStream file = new FileStream("c:/dbc/spell.dbc",FileMode.Open,FileAccess.Read);
BinaryReader br= new BinaryReader(f