public void Enter(Machine machine) { EnteredState = DateTime.Now; if (!StartedBuffing) { machine.ChatManager.SendTell(machine.CurrentRequest.RequesterName, "I need to buff myself, standby."); BuffProfile profile = machine.Utility.GetProfile("botbuffs"); machine.SpellsToCast.Clear(); foreach (Buff buff in profile.Buffs) { if (machine.Level7Self && machine.SpellTable.GetById(buff.Id).Difficulty > 300) { machine.SpellsToCast.Add(machine.GetFallbackSpell(machine.SpellTable.GetById(buff.Id), true)); } else { machine.SpellsToCast.Add(machine.SpellTable.GetById(buff.Id)); } } if (machine.Core.CharacterFilter.EffectiveSkill[CharFilterSkillType.CreatureEnchantment] < 400 && !machine.Level7Self) { machine.SpellsToCast.Insert(0, machine.SpellTable.GetById(2215)); // creature 7 machine.SpellsToCast.Insert(0, machine.SpellTable.GetById(2067)); // focus 7 machine.SpellsToCast.Insert(0, machine.SpellTable.GetById(2091)); // self 7 } StartedBuffing = true; } }
public bool HaveAllBuffs(Machine machine) { try { BuffProfile profile = machine.Utility.GetProfile("botbuffs"); List <Spell> requiredBuffs = new List <Spell>(); foreach (Buff buff in profile.Buffs) { Spell spell = machine.SpellTable.GetById(buff.Id); if (machine.Level7Self && spell.Difficulty > 300) { requiredBuffs.Add(machine.GetFallbackSpell(spell, true)); } else { requiredBuffs.Add(spell); } } Dictionary <int, int> enchantments = new Dictionary <int, int>(); foreach (EnchantmentWrapper enchantment in machine.Core.CharacterFilter.Enchantments) { if (requiredBuffs.Contains(machine.SpellTable.GetById(enchantment.SpellId)) && !enchantments.ContainsKey(enchantment.SpellId)) { enchantments.Add(enchantment.SpellId, enchantment.TimeRemaining); } } foreach (Spell requiredBuff in requiredBuffs) { if (!enchantments.ContainsKey(requiredBuff.Id)) { return(false); } else if (enchantments[requiredBuff.Id] < 300 && !enchantments[requiredBuff.Id].Equals(-1)) { return(false); } } return(true); } catch (Exception ex) { Debug.ToChat(ex.Message); return(false); } }
internal void SaveBuffProfile(BuffProfile profile) { try { if (BuffsPathCreateOrExists()) { string ProfilePath = Path.Combine(BuffProfilesPath, profile.Commands[0] + ".xml"); using (XmlTextWriter writer = new XmlTextWriter(ProfilePath, Encoding.UTF8)) { writer.Formatting = Formatting.Indented; writer.WriteStartDocument(); XmlSerializer xmlSerializer = new XmlSerializer(typeof(BuffProfile)); xmlSerializer.Serialize(writer, profile); } } } catch (Exception ex) { Debug.ToChat(ex.Message); } }
internal void GenerateDefaultProfiles() { BuffProfile newProfile = new BuffProfile(); BotBuffs botBuffs = new BotBuffs(); newProfile.Commands = botBuffs.Commands; newProfile.Buffs = botBuffs.Buffs; SaveBuffProfile(newProfile); Banes banes = new Banes(); newProfile.Commands = banes.Commands; newProfile.Buffs = banes.Buffs; SaveBuffProfile(newProfile); Finesse finesse = new Finesse(); newProfile.Commands = finesse.Commands; newProfile.Buffs = finesse.Buffs; SaveBuffProfile(newProfile); Heavy heavy = new Heavy(); newProfile.Commands = heavy.Commands; newProfile.Buffs = heavy.Buffs; SaveBuffProfile(newProfile); Light light = new Light(); newProfile.Commands = light.Commands; newProfile.Buffs = light.Buffs; SaveBuffProfile(newProfile); Mage mage = new Mage(); newProfile.Commands = mage.Commands; newProfile.Buffs = mage.Buffs; SaveBuffProfile(newProfile); Missile missile = new Missile(); newProfile.Commands = missile.Commands; newProfile.Buffs = missile.Buffs; SaveBuffProfile(newProfile); Trades trades = new Trades(); newProfile.Commands = trades.Commands; newProfile.Buffs = trades.Buffs; SaveBuffProfile(newProfile); TwoHand twoHand = new TwoHand(); newProfile.Commands = twoHand.Commands; newProfile.Buffs = twoHand.Buffs; SaveBuffProfile(newProfile); VoidBuffs voidBuffs = new VoidBuffs(); newProfile.Commands = voidBuffs.Commands; newProfile.Buffs = voidBuffs.Buffs; SaveBuffProfile(newProfile); XpChain xpChain = new XpChain(); newProfile.Commands = xpChain.Commands; newProfile.Buffs = xpChain.Buffs; SaveBuffProfile(newProfile); }