Пример #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";
        }
Пример #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++;
            }
        }
Пример #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);
        }
Пример #4
0
 private static uint calculatePropertyID(Item item, int builderItemVariation, int currentItemVariation)
 {
     return(DBCHelper.getNextItemRandomPropertyEntry());
 }