DBCFields添加对CreatureFamily.dbc的描述,内容如下:
<File name="CreatureFamily.dbc" version="1.0">
<Note>http://www.madx.dk/wowdev/wiki/index.php?title=CreatureFamily.dbc</Note>
<Fields>
<Field position="0" type="integer">ID</Field>
<Field position="1" type="float">Unkn</Field>
<Field position="2" type="integer">Pet</Field>
<Field position="3" type="float">Unkn</Field>
<Field position="4" type="integer">Unkn</Field>
<Field position="5" type="integer">SkillLine</Field>
<Field position="6" type="integer">Unkn</Field>
<Field position="7" type="bit">PetFood</Field>
<Field position="14" type="string">Name</Field>
<Field position="27" type="string">Path</Field>
</Fields>
</File>
新增了一种字段类型bit,用于现在Mask类型。分析此dbc内容,结合ItemPetFood.dbc,可以发现Pet能吃的东东就八类,可怜啊,看看还是熊和猪最好养,啥都吃,嘿嘿~~当然SS的Pet依然是啥都不吃,省啊~
下面是新增类型bit转换为string的代码,用于将integer显示为0/1的形式:
1 int CBitField::Data2String(std::string &str, CFileBuffer &fb, int offset, int strpos) const
2 {
3 int data = 0;
4 fb.Seek(offset);
5 fb.Read(data);
6
7 str = "";
8 int i = 0;
9 while(data > 0)
10 {
11 str += ((data % 2 == 1) ? '1' : '0');
12 data /= 2;
13 }
14 while(str.size() < 8)
15 {
16 str += '0';
17 }
18
19 std::reverse(str.begin(), str.end());
20 str += 'B';
21 return fb.Good() ? 0 : -1;
22 }