public static void Initialize() { if (Core.SA && m_Instance == null) { m_Instance = new HuntingSystem(); } }
public HuntingSystem() : base(17603) { if (m_Instance != null) { this.Delete(); return; } m_Instance = this; m_Active = true; m_Top10 = new Dictionary <HuntType, List <HuntingKillEntry> >(); m_Leaders = new Dictionary <HuntType, List <HuntingKillEntry> >(); m_SeasonBegins = DateTime.Now; DateTime ends = DateTime.Now + TimeSpan.FromDays(30); m_SeasonEnds = new DateTime(ends.Year, ends.Month, ends.Day, 8, 0, 0); m_NextHint = DateTime.UtcNow; m_NextBonusIndex = DateTime.UtcNow; CheckTimer(); Setup(); Movable = false; Visible = false; Name = "Huntsmaster Challenge System"; MoveToWorld(new Point3D(744, 2136, 0), Map.Trammel); }
public override bool OnDragDrop(Mobile from, Item dropped) { if (dropped is HuntingPermit) { HuntingPermit permit = dropped as HuntingPermit; HuntingSystem sys = HuntingSystem.Instance; if (sys == null || !sys.Active) { return(false); } if (!permit.HasDocumentedKill) { SayTo(from, "You can't submit a kill you haven't documented yet!"); } else if (permit.KillEntry.DateKilled < sys.SeasonBegins) { SayTo(from, 1155720); // This permit was documented in a different month or year than the current month and year. I only accept permits documented in the current month and year. } else if (permit.HasSubmitted) { SayTo(from, 1155719); // This permit has already been submitted. } else { sys.TrySubmitKill(this, from, permit); } } return(false); }
public HuntingSystem() : base(17603) { if(m_Instance != null) { this.Delete(); return; } m_Instance = this; m_Active = true; m_Top10 = new Dictionary<HuntType, List<HuntingKillEntry>>(); m_Leaders = new Dictionary<HuntType, List<HuntingKillEntry>>(); m_SeasonBegins = DateTime.Now; DateTime ends = DateTime.Now + TimeSpan.FromDays(30); m_SeasonEnds = new DateTime(ends.Year, ends.Month, ends.Day, 8, 0, 0); m_NextHint = DateTime.UtcNow; m_NextBonusIndex = DateTime.UtcNow; CheckTimer(); Timer.DelayCall(TimeSpan.FromSeconds(1), Setup); Movable = false; Visible = false; Name = "Huntsmaster Challenge System"; MoveToWorld(new Point3D(744, 2136, 0), Map.Trammel); }
public override void RemovePoints(double points) { if (HuntingSystem.Instance == null) { return; } HuntingSystem sys = HuntingSystem.Instance; if (sys.UnclaimedWinners.ContainsKey(User)) { sys.UnclaimedWinners[User]--; if (sys.UnclaimedWinners[User] <= 0) { sys.UnclaimedWinners.Remove(User); } } }
public override double GetPoints(Mobile m) { if (HuntingSystem.Instance == null) { return(0.0); } HuntingSystem sys = HuntingSystem.Instance; if (sys.UnclaimedWinners.ContainsKey(m)) { if (sys.UnclaimedWinners[User] <= 0) { sys.UnclaimedWinners.Remove(User); } else { return(sys.UnclaimedWinners[m]); } } return(0.0); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int v = reader.ReadInt(); m_Active = reader.ReadBool(); m_SeasonBegins = reader.ReadDateTime(); m_SeasonEnds = reader.ReadDateTime(); m_Top10 = new Dictionary <HuntType, List <HuntingKillEntry> >(); m_Leaders = new Dictionary <HuntType, List <HuntingKillEntry> >(); int count = reader.ReadInt(); for (int i = 0; i < count; i++) { Mobile m = reader.ReadMobile(); HuntingKillEntry entry = new HuntingKillEntry(reader); if (m != null) { m_UnclaimedWinners[m] = entry; } } count = reader.ReadInt(); for (int i = 0; i < count; i++) { HuntType type = (HuntType)reader.ReadInt(); int c = reader.ReadInt(); if (!m_Top10.ContainsKey(type)) { m_Top10[type] = new List <HuntingKillEntry>(); } for (int j = 0; j < c; j++) { m_Top10[type].Add(new HuntingKillEntry(reader)); } } count = reader.ReadInt(); for (int i = 0; i < count; i++) { HuntType type = (HuntType)reader.ReadInt(); int c = reader.ReadInt(); if (!m_Leaders.ContainsKey(type)) { m_Leaders[type] = new List <HuntingKillEntry>(); } for (int j = 0; j < c; j++) { m_Leaders[type].Add(new HuntingKillEntry(reader)); } } m_Instance = this; m_NextHint = DateTime.UtcNow; m_NextBonusIndex = DateTime.UtcNow; CheckTimer(); }
public static void Initialize() { if(Core.SA && m_Instance == null) m_Instance = new HuntingSystem(); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int v = reader.ReadInt(); m_Active = reader.ReadBool(); m_SeasonBegins = reader.ReadDateTime(); m_SeasonEnds = reader.ReadDateTime(); m_Top10 = new Dictionary<HuntType, List<HuntingKillEntry>>(); m_Leaders = new Dictionary<HuntType, List<HuntingKillEntry>>(); int count = reader.ReadInt(); for(int i = 0; i < count; i++) { Mobile m = reader.ReadMobile(); HuntingKillEntry entry = new HuntingKillEntry(reader); if(m != null) m_UnclaimedWinners[m] = entry; } count = reader.ReadInt(); for(int i = 0; i < count; i++) { HuntType type = (HuntType)reader.ReadInt(); int c = reader.ReadInt(); if (!m_Top10.ContainsKey(type)) m_Top10[type] = new List<HuntingKillEntry>(); for (int j = 0; j < c; j++) { m_Top10[type].Add(new HuntingKillEntry(reader)); } } count = reader.ReadInt(); for(int i = 0; i < count; i++) { HuntType type = (HuntType)reader.ReadInt(); int c = reader.ReadInt(); if (!m_Leaders.ContainsKey(type)) m_Leaders[type] = new List<HuntingKillEntry>(); for(int j = 0; j < c; j++) { m_Leaders[type].Add(new HuntingKillEntry(reader)); } } m_Instance = this; m_NextHint = DateTime.UtcNow; m_NextBonusIndex = DateTime.UtcNow; CheckTimer(); }