internal List <SimcRawItemEffect> GenerateItemEffectData(Dictionary <string, string> incomingRawData)
        {
            var rawEffectData = incomingRawData.Where(d => d.Key == "ItemEffectData.raw").FirstOrDefault().Value;

            var lines = rawEffectData.Split(
                new[] { "\r\n", "\r", "\n" },
                StringSplitOptions.None
                );

            var itemEffects = new List <SimcRawItemEffect>();

            foreach (var line in lines)
            {
                // Split the data up
                var data = line.Split(',');

                // Only process valid lines
                if (data.Count() < 9)
                {
                    continue;
                }

                var itemEffect = new SimcRawItemEffect();

                // Clean the data up
                for (var i = 0; i < data.Length; i++)
                {
                    data[i] = data[i].Replace("}", "").Replace("{", "").Trim();
                }

                // 0 is Id
                itemEffect.Id = Convert.ToUInt32(data[0]);

                // 1 is spell id
                itemEffect.SpellId = Convert.ToUInt32(data[1]);

                // 2 is item id
                itemEffect.ItemId = Convert.ToUInt32(data[2]);

                // 3 is index
                itemEffect.Index = Convert.ToInt32(data[3]);

                // 4 is type
                itemEffect.Type = Convert.ToInt32(data[4]);

                // 5 is cooldown group
                itemEffect.CooldownGroup = Convert.ToInt32(data[5]);

                // 6 is cd duration
                itemEffect.CooldownDuration = Convert.ToInt32(data[6]);

                // 7 is cd group duration
                itemEffect.CooldownGroupDuration = Convert.ToInt32(data[7]);

                itemEffects.Add(itemEffect);
            }

            return(itemEffects);
        }
Ejemplo n.º 2
0
        private async Task AddSpellEffectAsync(SimcItem item, SimcRawItemEffect effect)
        {
            // Note: there is a similar process inside this method:
            // double spelleffect_data_t::average( const player_t* p, unsigned level ) const
            // That is done to get scale values for non-item effects based instead on player level
            // This is for things like racial abilities and uses a simpler formula
            // It does use the spell scaling array values, which we already have.

            var effectSpell = await _simcSpellCreationService.GenerateItemSpellAsync(item, effect.SpellId);

            var newEffect = new SimcItemEffect
            {
                EffectId              = effect.Id,
                CooldownDuration      = effect.CooldownDuration,
                CooldownGroup         = effect.CooldownGroup,
                CooldownGroupDuration = effect.CooldownGroupDuration,
                Spell = effectSpell
            };

            item.Effects.Add(newEffect);
        }