Exemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //Prepare header
            enchantHeader = DBCHelper.prepareHeader(enchantReader);

            //Load individual enchanments
            for (int i = 0; i < enchantHeader.RecordsCount; i++)
            {
                GCHandle             handle      = GCHandle.Alloc(enchantReader.GetRowAsByteArray(i), GCHandleType.Pinned);
                var                  size        = Marshal.SizeOf(typeof(SpellItemEnchantment));
                SpellItemEnchantment enchantment = (SpellItemEnchantment)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SpellItemEnchantment));
                enchantDict.Add(enchantment.ID, enchantment);
                handle.Free();
            }

            //Prepare header
            randomPropertiesHeader = DBCHelper.prepareHeader(randomPropertiesReader);

            //Load individual enchanments
            for (int i = 0; i < randomPropertiesHeader.RecordsCount; i++)
            {
                GCHandle             handle           = GCHandle.Alloc(randomPropertiesReader.GetRowAsByteArray(i), GCHandleType.Pinned);
                var                  size             = Marshal.SizeOf(typeof(ItemRandomProperties));
                ItemRandomProperties randomProperties = (ItemRandomProperties)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ItemRandomProperties));
                randomPropertiesDict.Add(randomProperties.ID, randomProperties);
                handle.Free();
            }

            this.Text           = this.Text + " " + enchantDict.Keys.Count.ToString() + " enchants " + randomPropertiesDict.Keys.Count.ToString() + " properties";
            itemEntryField.Text = "16913";
        }
Exemplo n.º 2
0
        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++;
            }
        }
Exemplo n.º 3
0
        //Populates spellitemenchantment.dbc with entries from stat
        private static List <SpellItemEnchantment> populateStat(Stat stat)
        {
            List <SpellItemEnchantment> enchants = new List <SpellItemEnchantment>();

            for (int i = 0; i < enchantVariations; i++)
            {
                StatPair pair = new StatPair(stat, i, stat.dbID);

                SpellItemEnchantment enchant = new SpellItemEnchantment();
                enchant.ID               = DBCHelper.getNextEnchantEntry();
                enchant.sRefName1        = (uint)enchantReader.StringTableAdd(pair.ToString());
                enchant.spellDispelType1 = 5;
                enchant.objectId1        = (uint)stat.dbID;
                enchant.minAmount1       = (uint)i;
                enchant.maxAmount1       = (uint)i;
                enchant.itemCache        = 16712190;
                enchants.Add(enchant);
            }

            return(enchants);
        }
Exemplo n.º 4
0
 private static SpellItemEnchantment setStatValues(SpellItemEnchantment enchant, Item item, StatPair pair)
 {
     enchant.minAmount1 = (uint)pair.value;
     enchant.maxAmount1 = (uint)pair.value;
     return(enchant);
 }
Exemplo n.º 5
0
 private static SpellItemEnchantment setStatTypes(SpellItemEnchantment enchant, Item item, Stat stat)
 {
     enchant.objectId1 = (uint)stat.dbID;
     return(enchant);
 }
Exemplo n.º 6
0
 //Sets all dispel types (5 == stats, 3 = spells)
 private static SpellItemEnchantment setDispelTypes(SpellItemEnchantment enchant, Item item)
 {
     enchant.spellDispelType1 = 5; //5 = Stats, 3 = spells
     return(enchant);
 }
Exemplo n.º 7
0
 private static SpellItemEnchantment updateStatName(SpellItemEnchantment enchant, StatPair pair, DBCReader enchantReader)
 {
     enchant.sRefName1 = (uint)enchantReader.StringTableAdd(pair.ToString());
     return(enchant);
 }