Exemplo n.º 1
0
 public void LearnSpell(AbstractSpell spell)
 {
     if (!KnownSpells.Contains(spell))
     {
         KnownSpells.Add(spell);
     }
 }
Exemplo n.º 2
0
        public void Direct3D_EndScene()
        {
            if (!Manager.ObjectManager.IsInGame)
            {
                return;
            }

            if (!Update)
            {
                return;
            }

            var knownspells = new List <WoWSpell>();

            for (int i = 0; i < Manager.Memory.Read <int>((IntPtr)Pointers.Spell.SpellCount); i++)
            {
                var spellId = Manager.Memory.Read <uint>((IntPtr)(Pointers.Spell.SpellBook + (i * 4)));
                knownspells.Add(new WoWSpell(spellId));
            }

            if (KnownSpells.Count() == 0)
            {
                Log.WriteLine("SpellBook: {0} spells", knownspells.Count());
            }

            KnownSpells = knownspells;

            Update = false;
        }
Exemplo n.º 3
0
 public void ForgetSpell(AbstractSpell spell)
 {
     if (KnownSpells.Contains(spell))
     {
         KnownSpells.Remove(spell);
     }
     else
     {
         Console.WriteLine("Character doesn't know this spell!");
     }
 }
Exemplo n.º 4
0
    /*
     #pragma warning disable CA2227 // Collection properties should be read only
     *      [JsonInclude, JsonPropertyName("SpellStrengths")]
     *      public IDictionary<string, (bool, ushort)> StringKeyedSpells // Ugh, messy hack to work around System.Text.Json having crappy dictionary key support.
     *      {
     *          get => SpellStrengths.ToDictionary(x => x.Key.ToString(), x => x.Value);
     *          set => SpellStrengths = value.ToDictionary(x => SpellId.Parse(x.Key), x => x.Value);
     *      }
     #pragma warning restore CA2227 // Collection properties should be read only
     */

    public MagicSkills DeepClone()
    {
        var clone = new MagicSkills()
        {
            SpellPoints    = SpellPoints.DeepClone(),
            SpellClasses   = SpellClasses,
            KnownSpells    = KnownSpells.ToList(),
            SpellStrengths = SpellStrengths.ToDictionary(x => x.Key, x => x.Value)
        };

        return(clone);
    }
Exemplo n.º 5
0
        public override void ParseFromNetworkMessage(NetworkMessage message)
        {
            HasPremium     = message.ReadBool();
            PremiumUntil   = message.ReadUInt32();
            Profession     = message.ReadByte();
            HasReachedMain = message.ReadBool();

            KnownSpells.Capacity = message.ReadUInt16();
            for (var i = 0; i < KnownSpells.Capacity; ++i)
            {
                KnownSpells.Add(message.ReadByte());
            }
        }
Exemplo n.º 6
0
        public override void ParseFromNetworkMessage(NetworkMessage message)
        {
            HasPremium     = message.ReadBool();
            PremiumUntil   = message.ReadUInt32();
            Profession     = message.ReadByte();
            HasReachedMain = message.ReadBool();

            KnownSpells.Capacity = message.ReadUInt16();
            for (var i = 0; i < KnownSpells.Capacity; ++i)
            {
                KnownSpells.Add(message.ReadByte());
            }

            if (Client.VersionNumber >= 126010468)
            {
                activeManaShieldBar = message.ReadBool();
            }
        }
Exemplo n.º 7
0
        public void Direct3D_EndScene()
        {
            if (!Manager.ObjectManager.IsInGame)
            {
                return;
            }

            // --- DEBUG ----
            if (CastQueue.Count > 0 && this.Count() > 0)
            {
                if (!Manager.LocalPlayer.IsCasting)
                {
                    var spell = CastQueue.Peek();
                    //if (spell.IsReady)
                    //{
                    spell.Cast();
                    CastQueue.Dequeue();
                    //}
                }
            }
            // --------------

            if (!Update)
            {
                return;
            }

            var knownspells = new List <WoWSpell>();

            for (var i = 0; i < Manager.Memory.Read <int>((IntPtr)Pointers.Spell.SpellCount); i++)
            {
                var spellId = Manager.Memory.Read <uint>((IntPtr)(Pointers.Spell.SpellBook + (i * 4)));
                knownspells.Add(new WoWSpell(spellId));
            }

            if (KnownSpells.Count() == 0)
            {
                Log.WriteLine("SpellBook: {0} spells", knownspells.Count());
            }

            KnownSpells = knownspells;

            Update = false;
        }
Exemplo n.º 8
0
 public void DeserializeSelf(Helper _helper)
 {
     foreach (string spellDef in KnownSpellsS)
     {
         SpellDefinition sd = _helper.GetSpell(spellDef);
         if (sd != null)
         {
             KnownSpells.Add(sd);
         }
     }
     foreach (SpellS spell in SpellsS)
     {
         SpellDefinition sd = _helper.GetSpell(spell.Name);
         Spells.Add(new Spell()
         {
             Definition = sd, IsCasted = spell.IsCasted
         });
     }
 }
Exemplo n.º 9
0
        public void CastSpell(ReceivedSpell receivedSpell, Player player = null, int power = 0)
        {
            if (!KnownSpells.Contains((AbstractSpell)receivedSpell.Target))
            {
                Console.WriteLine("Character doesn't know this spell!");
                return;
            }

            if (power < 0)
            {
                power = 0;
            }

            if (player == null)
            {
                player = this;
            }

            receivedSpell(this, player, power);
        }
Exemplo n.º 10
0
 IEnumerator IEnumerable.GetEnumerator()
 {
     return(KnownSpells.GetEnumerator());
 }
Exemplo n.º 11
0
 IEnumerator <WoWSpell> IEnumerable <WoWSpell> .GetEnumerator()
 {
     return(KnownSpells.GetEnumerator());
 }
Exemplo n.º 12
0
 public WoWSpell this[string name]
 {
     get { return(KnownSpells.FirstOrDefault(s => s.Name == name)); }
 }
Exemplo n.º 13
0
 public WoWSpell this[uint index]
 {
     get { return(KnownSpells.FirstOrDefault(s => s.Id == index)); }
 }