private static void Obj_AI_Base_OnBuffLose(Obj_AI_Base sender, Obj_AI_BaseBuffLoseEventArgs args) { try { if (!sender.IsValid || !args.Buff.Caster.IsValid || !sender.IsHero()) return; Program.SpellList.RemoveAll(d => d.Buff && d.Target == sender && (d.Name == args.Buff.DisplayName || d.Name == args.Buff.Name)); DrawManager.Line.RemoveAll(d => d.Buff && d.Target == sender && (d.Name == args.Buff.DisplayName || d.Name == args.Buff.Name)); DrawManager.Timer.RemoveAll(d => d.Buff && d.Target == sender && (d.Name == args.Buff.DisplayName || d.Name == args.Buff.Name)); DrawManager.TimerLine.RemoveAll(d => d.Buff && d.Target == sender && (d.Name == args.Buff.DisplayName || d.Name == args.Buff.Name)); } catch (Exception e) { e.ErrorMessage("BUFF_LOSE", args.Buff.DisplayName); } }
private static void Obj_AI_Base_OnBuffGain(Obj_AI_Base sender, Obj_AI_BaseBuffGainEventArgs args) { try { if (!sender.IsValid || !args.Buff.Caster.IsValid || !sender.IsHero()) return; var database = SpellDatabase.Database.FirstOrDefault(d => d.Buff && (d.Name == args.Buff.DisplayName || d.Name == args.Buff.Name)); if (database != null) { if ((database.SpellType == SpellType.Spell && !Config.Menu.CheckboxValue("sTimer")) || (database.SpellType == SpellType.SummonerSpell && !Config.Menu.CheckboxValue("ssTimer")) || (database.SpellType == SpellType.Item && !Config.Menu.CheckboxValue("itemTimer"))) return; Program.SpellList.Add(new Spell { SpellType = database.SpellType, Team = sender.IsAlly ? Team.Ally : sender.IsEnemy ? Team.Enemy : Team.None, DrawType = database.DrawType, Importance = database.Importance, Caster = sender, Target = sender, CastPosition = sender.Position, ChampionName = database.ChampionName, Name = database.Name, MenuCode = database.MenuCode, FullTime = args.Buff.EndTime - args.Buff.StartTime, EndTime = args.Buff.EndTime, NetworkID = sender.NetworkId, Buff = database.Buff, OnlyMe = database.OnlyMe, Color = database.Color, SpriteName = database.SpriteName, }); return; } } catch (Exception e) { e.ErrorMessage("BUFF_GAIN", args.Buff.DisplayName); } }