public void IncrementSlayerCount(PlayerMobile player) { SlayerTitleAttachment attachment = SlayerTitleSystem.FindAttachment(player); if (attachment != null) { SlayerSystemTracker tracker = attachment.FindSystemName(SlayerTitleName); if (tracker != null) { tracker.SlayerCount += 1; string newTitle = GetTitleAwarded(tracker.SlayerCount); if (newTitle != null) { if (tracker.LastTitleAwarded == null || tracker.LastTitleAwarded != newTitle) { if (tracker.LastTitleAwarded != null && tracker.LastTitleAwarded != newTitle) { try { player.CollectionTitles.Remove(tracker.LastTitleAwarded); } catch { } } player.AddCollectionTitle(newTitle); tracker.LastTitleAwarded = newTitle; player.SendSound(0x3D); player.SendMessage(0xC8, String.Format("Your have been awarded the title of '{0}' for {1} kills.", newTitle, tracker.SlayerCount)); } } } } }
public static void EventSink_Login(LoginEventArgs e) { if (e.Mobile is PlayerMobile) { SlayerTitleAttachment attachment = FindAttachment(e.Mobile); } }
public static SlayerTitleAttachment FindAttachment(Mobile m) { SlayerTitleAttachment attachment = (SlayerTitleAttachment)XmlAttach.FindAttachment(m, typeof(SlayerTitleAttachment)); if (attachment == null) { attachment = new SlayerTitleAttachment(); XmlAttach.AttachTo(m, attachment); } return(attachment); }
public static SlayerTitleAttachment FindAttachment(Mobile m) { SlayerTitleAttachment attachment = (SlayerTitleAttachment)XmlAttach.FindAttachment(m, typeof(SlayerTitleAttachment)); if (attachment == null) { attachment = new SlayerTitleAttachment(); XmlAttach.AttachTo(m, attachment); } return attachment; }