public static void InvokeOnKilledBy(OnKilledByEventArgs e) { if (OnKilledBy != null) { OnKilledBy(e); } }
public static void OnKilledBy(OnKilledByEventArgs e) { BaseCreature killed = e.Killed as BaseCreature; Mobile killer = e.KilledBy; if (killed != null && killer != null && killer.Alive && killed.GivesMLMinorArtifact && CheckArtifactChance(killer, killed)) { MondainsLegacy.GiveArtifactTo(killer); } }
private void EventSink_OnKilledBy(OnKilledByEventArgs e) { if (!this.Enabled) return; BaseCreature creature = null; PlayerMobile player = null; if (e.Killed is BaseCreature) creature = (BaseCreature)e.Killed; if (e.KilledBy is PlayerMobile) player = (PlayerMobile)e.KilledBy; SlayerModule module = player.GetModule(typeof(SlayerModule)) as SlayerModule; if (module == null) module = new SlayerModule(player); if (m_CrossReference.ContainsKey(creature.GetType())) { foreach(Int32 index in m_CrossReference[creature.GetType()]) { if (index < m_TitleDefinitions.Count && m_TitleDefinitions[index].CreatureRegistry.Contains(creature.GetType())) { TitleDefinition def = m_TitleDefinitions[index]; module.IncrementCounter(def.DefinitionName); Int32 value = module.GetSlayerCount(def.DefinitionName); TitleEntry titleToSet = null; foreach (TitleEntry entry in def.TitleRegistry) if (entry.CountNeeded == value) titleToSet = entry; if (titleToSet != null) { foreach (TitleEntry entry in def.TitleRegistry) if (player.CollectionTitles.Contains(entry.Title) && entry != titleToSet) player.CollectionTitles.Remove(entry.Title); player.AddCollectionTitle(titleToSet.Title); player.SendSound(0x3D); player.SendMessage(0xC8, String.Format("Your have been awarded the title of '{0}' for {1} kills.", titleToSet.Title, value)); if (TitleAwarded != null) TitleAwarded(player, def.DefinitionName, titleToSet.Title); if (IsMaxTitle(titleToSet.Title, def.TitleRegistry) && MaximumTitleAchieved != null) MaximumTitleAchieved(player, def.DefinitionName, titleToSet.Title); } } } } }
public static void InvokeOnKilledBy(OnKilledByEventArgs e) { OnKilledBy?.Invoke(e); }