Example #1
0
 public static ItemRandomProperty CreateNewItemRandomProperty()
 {
     int maxid = (from d in LegacyToolBox.Data.ItemRandomProperty select d.ID).Max() + 1;
     ItemRandomProperty property = new ItemRandomProperty();
     property.ID = maxid;
     property.Enchant = new int[3] { 0, 0, 0 };
     property.InnerName = "";
     property.Name = "";
     property.NameFlag = 16712190;
     LegacyToolBox.Data.ItemRandomProperty.Add(property);
     return property;
 }
Example #2
0
 public static ObservableCollection<ItemRandomProperty> LoadItemRandomProperty()
 {
     ObservableCollection<ItemRandomProperty> list = new ObservableCollection<ItemRandomProperty>();
     using (FileStream stream = File.OpenRead(LegacyToolBox.DATA_PATH + "DBC/ItemRandomProperties.dbc"))
     {
         BinaryReader r = new BinaryReader(stream);
         stream.Position = 4;
         int records = r.ReadInt32();
         int columns = r.ReadInt32();
         int rowSize = r.ReadInt32();
         int stringSize = r.ReadInt32();
         int dataSize = 20 + rowSize * records;
         for (int i = 0; i != records; ++i)
         {
             ItemRandomProperty prop = new ItemRandomProperty();
             prop.ID = r.ReadInt32();
             prop.InnerName = DBC.ReadString(r, dataSize);
             prop.Enchant[0] = r.ReadInt32();
             prop.Enchant[1] = r.ReadInt32();
             prop.Enchant[2] = r.ReadInt32();
             prop.Enchant[3] = r.ReadInt32();
             prop.Enchant[4] = r.ReadInt32();
             prop.Name = DBC.ReadString(r, dataSize, 4 * 4, 4 * 11);
             prop.NameFlag = r.ReadInt32();
             list.Add(prop);
         }
         r.Close();
     }
     return list;
 }