public void LearnSpell(AbstractSpell spell) { if (!KnownSpells.Contains(spell)) { KnownSpells.Add(spell); } }
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; }
public void ForgetSpell(AbstractSpell spell) { if (KnownSpells.Contains(spell)) { KnownSpells.Remove(spell); } else { Console.WriteLine("Character doesn't know this spell!"); } }
/* #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); }
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()); } }
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(); } }
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; }
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 }); } }
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); }
IEnumerator IEnumerable.GetEnumerator() { return(KnownSpells.GetEnumerator()); }
IEnumerator <WoWSpell> IEnumerable <WoWSpell> .GetEnumerator() { return(KnownSpells.GetEnumerator()); }
public WoWSpell this[string name] { get { return(KnownSpells.FirstOrDefault(s => s.Name == name)); } }
public WoWSpell this[uint index] { get { return(KnownSpells.FirstOrDefault(s => s.Id == index)); } }