public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch(version) { case 8: { this.m_StartingLoc = reader.ReadPoint3D(); try { this.m_StartingMap = Map.Parse(reader.ReadString()); } catch { } goto case 7; } case 7: { string langstr = reader.ReadString(); try { this.m_CurrentLanguage = (LanguageType)Enum.Parse(typeof(LanguageType), langstr); } catch { } goto case 6; } case 6: { this.m_ChallengeGame = (BaseChallengeGame)reader.ReadItem(); this.m_ChallengeSetup = (BaseChallengeGame)reader.ReadItem(); goto case 5; } case 5: { TimeSpan remaining = reader.ReadTimeSpan(); if (remaining > TimeSpan.Zero) { this.DoTimer(remaining); } goto case 4; } case 4: { this.m_ReceiveBroadcasts = reader.ReadBool(); goto case 3; } case 3: { this.m_Rank = reader.ReadInt(); this.m_DeltaRank = reader.ReadInt(); this.m_WhenRanked = reader.ReadDateTime(); this.m_LastDecay = reader.ReadDateTime(); goto case 2; } case 2: { this.m_Credits = reader.ReadInt(); goto case 1; } case 1: { this.m_Broadcast = reader.ReadBool(); goto case 0; } case 0: { this.m_Points = reader.ReadInt(); this.m_Kills = reader.ReadInt(); this.m_Deaths = reader.ReadInt(); this.m_Challenger = reader.ReadMobile(); this.m_LastKill = reader.ReadDateTime(); this.m_LastDeath = reader.ReadDateTime(); // read in the kill list int count = reader.ReadInt(); this.KillList = new ArrayList(); for (int i = 0; i < count; i++) { Mobile m = reader.ReadMobile(); DateTime t = reader.ReadDateTime(); if (m != null && !m.Deleted) { this.KillList.Add(new KillEntry(m,t)); } } // get the owner of this in order to rebuild the rankings Mobile killer = reader.ReadMobile(); // rebuild the ranking list // if they have never made a kill, then dont rank if (killer != null && this.m_Kills > 0) { UpdateRanking(killer, this); } break; } } }
public ChallengeTimer(BaseChallengeGame gauntlet, TimeSpan delay) : base(delay, delay) { Priority = TimerPriority.OneSecond; m_gauntlet = gauntlet; }
public ChallengeTimer( BaseChallengeGame gauntlet, TimeSpan delay ) : base( delay, delay ) { Priority = TimerPriority.OneSecond; m_gauntlet = gauntlet; }
public static void DoSetupChallenge(Mobile from, int nameindex, Type gametype) { if (from != null && gametype != null) { bool onlyinchallenge = false; FieldInfo finfo = null; finfo = gametype.GetField("OnlyInChallengeGameRegion"); if (finfo != null && finfo.IsStatic && finfo.FieldType == typeof(bool)) { try{ onlyinchallenge = (bool)finfo.GetValue(null); } catch {} } // is this in a challenge game region? Region r = Region.Find(from.Location, from.Map); if (r is ChallengeGameRegion) { ChallengeGameRegion cgr = r as ChallengeGameRegion; if (cgr.ChallengeGame != null && !cgr.ChallengeGame.Deleted && !cgr.ChallengeGame.GameCompleted && !cgr.ChallengeGame.IsOrganizer(from)) { from.SendMessage(String.Format(XmlPoints.GetText(from, 100303), XmlPoints.GetText(from, nameindex))); //"Unable to set up a {0} Challenge: Another Challenge Game is already in progress in this Challenge Game region.", "Last Man Standing" return; } } else if (onlyinchallenge) { from.SendMessage(String.Format(XmlPoints.GetText(from, 100304), XmlPoints.GetText(from, nameindex))); // "Unable to set up a {0} Challenge: Must be in a Challenge Game region.", "Last Man Standing" return; } // create the game gauntlet object newgame = null; object[] gameargs = new object[1]; gameargs[0] = from; try{ newgame = Activator.CreateInstance(gametype, gameargs); } catch {} BaseChallengeGame g = newgame as BaseChallengeGame; if (g == null || g.Deleted) { from.SendMessage(String.Format(XmlPoints.GetText(from, 100305), XmlPoints.GetText(from, nameindex))); // "Unable to set up a {0} Challenge.", "Last Man Standing" return; } g.MoveToWorld(from.Location, from.Map); from.SendMessage(String.Format(XmlPoints.GetText(from, 100306), XmlPoints.GetText(from, nameindex))); // "Setting up a {0} Challenge.", "Last Man Standing" // call any game-specific setups g.SetupChallenge(from); if (r is ChallengeGameRegion) { ChallengeGameRegion cgr = r as ChallengeGameRegion; cgr.ChallengeGame = g; g.IsInChallengeGameRegion = true; // announce challenge game region games XmlPoints.BroadcastMessage(AccessLevel.Player, 0x482, String.Format(XmlPoints.SystemText(100307), XmlPoints.SystemText(nameindex), r.Name, from.Name)); // "{0} Challenge being prepared in '{1}' by {2}", "Last Man Standing" } // if there was a previous challenge being setup then delete it unless it is still in progress XmlPoints afrom = (XmlPoints)XmlAttach.FindAttachment(from, typeof(XmlPoints)); if (afrom != null) { if (afrom.ChallengeSetup != null && !(afrom.ChallengeSetup.GameInProgress || afrom.ChallengeSetup.GameCompleted)) { afrom.ChallengeSetup.Delete(); } afrom.ChallengeSetup = g; } } }