Codejie's C++ Space

Using C++

DBCFields.xml更新 - Pet好可怜,能吃的只有八种了~

    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 }


posted on 2009-04-27 17:46 codejie 阅读(262) 评论(0)  编辑 收藏 引用 所属分类: MPQ - WOW


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


公告

Using C++

导航

统计

留言簿(73)

随笔分类(513)

积分与排名

最新评论

阅读排行榜

评论排行榜