public static DBCHeader prepareHeader(DBCReader reader) { DBCHeader header = new DBCHeader(); header.DBCmagic = DBCReader.DBCFmtSig; header.RecordsCount = (uint)reader.RecordsCount; header.FieldsCount = (uint)reader.FieldsCount; header.RecordSize = (uint)reader.RecordSize; header.StringTableSize = (uint)reader.StringTableSize; return(header); }
public static List <SpellItemEnchantment> populate(DBCReader newEnchantReader) { enchantReader = newEnchantReader; List <SpellItemEnchantment> enchants = new List <SpellItemEnchantment>(); Dictionary <int, List <SpellItemEnchantment> > enchanctDict = new Dictionary <int, List <SpellItemEnchantment> >(); foreach (KeyValuePair <int, Stat> pair in StatContainer.stats) { if (pair.Value.dbID > 0) //Ignore unknown stat { List <SpellItemEnchantment> statEnchants = populateStat(pair.Value); enchants.AddRange(statEnchants); enchanctDict.Add(pair.Value.dbID, statEnchants); } } //Save in enchant container before returning and writing to DBC files EnchantContainer.enchants = enchanctDict; return(enchants); }
private static SpellItemEnchantment updateStatName(SpellItemEnchantment enchant, StatPair pair, DBCReader enchantReader) { enchant.sRefName1 = (uint)enchantReader.StringTableAdd(pair.ToString()); return(enchant); }
public static void fill(List <SpellItemEnchantment> enchants, Item item, uint propertyID, uint builderItemVariation, uint currentVariation, DBCReader enchantReader) { uint enchantVariation = 1; foreach (StatPair pair in item.stats) { Stat stat = pair.stat; SpellItemEnchantment enchant = new SpellItemEnchantment(); enchant.ID = DBCHelper.getNextEnchantEntry(); enchant = setDispelTypes(enchant, item); enchant = setStatValues(enchant, item, pair); enchant = setStatTypes(enchant, item, stat); enchant = setUnusedValues(enchant); enchant = updateStatName(enchant, pair, enchantReader); enchants.Add(enchant); enchantVariation++; } }
public static void fill(List <Variation> variations, List <Item> itemVariations, DBCReader enchantReader, int currentItemVariation) { int builderItemVariation = 1; foreach (Item item in itemVariations) { Variation variation = new Variation(); variation.property.ID = calculatePropertyID(item, builderItemVariation, currentItemVariation); if (item.stats.ToArray().Length > 0) { variation.enchants.Add(EnchantContainer.get(item.stats[0])); } if (item.stats.ToArray().Length > 1) { variation.enchants.Add(EnchantContainer.get(item.stats[1])); } if (item.stats.ToArray().Length > 2) { variation.enchants.Add(EnchantContainer.get(item.stats[2])); } //EnchantBuilder.fill(variation.enchants, item, variation.property.ID, (uint)builderItemVariation, (uint)currentItemVariation, enchantReader); We're going to use pre-generated enchant entries variation.property = RandomPropertiesBuilder.fill(variation.property, variation.enchants, builderItemVariation); variations.Add(variation); builderItemVariation++; } }