public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); Team = reader.ReadInt(); ProximityRange = reader.ReadInt(); Flag = reader.ReadItem() as CTFFlag; m_gauntlet = reader.ReadItem() as CTFGauntlet; m_HasFlag = reader.ReadBool(); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); this.Team = reader.ReadInt(); this.ProximityRange = reader.ReadInt(); this.Flag = reader.ReadItem() as CTFFlag; this.m_gauntlet = reader.ReadItem() as CTFGauntlet; this.m_HasFlag = reader.ReadBool(); }
public CTFBase(CTFGauntlet gauntlet, int team) : base( 0x1183 ) { Movable = false; Hue = BaseChallengeGame.TeamColor(team); Team = team; Name = String.Format("Team {0} Base", team); m_gauntlet = gauntlet; // add the flag Flag = new CTFFlag(this, team); Flag.HomeBase = this; HasFlag = true; }
public CTFBase(CTFGauntlet gauntlet, int team) : base(0x1183) { Movable = false; Hue = BaseChallengeGame.TeamColor(team); Team = team; Name = String.Format("Team {0} Base", team); m_gauntlet = gauntlet; // add the flag Flag = new CTFFlag(this, team); Flag.HomeBase = this; HasFlag = true; }
public CTFBaseTarget(CTFGauntlet gauntlet, int team) : base(30, true, TargetFlags.None) { this.m_team = team; this.m_gauntlet = gauntlet; }
public MemberTarget(CTFGauntlet gauntlet, ArrayList list) : base(30, false, TargetFlags.None) { this.m_list = list; this.m_gauntlet = gauntlet; }
public TeamsGump(CTFGauntlet gauntlet, Mobile from) : base(350, 30) { this.m_gauntlet = gauntlet; int yinc = 25; if (gauntlet == null) return; ArrayList Teams = gauntlet.GetTeams(); // make sure that all bases have teams defined ArrayList dlist = new ArrayList(); foreach (CTFBase b in gauntlet.HomeBases) { bool hasteam = false; if (Teams != null) { foreach (TeamInfo t in Teams) { if (t.ID == b.Team) { hasteam = true; break; } } } if (!hasteam) { // delete it dlist.Add(b); } } foreach (CTFBase b in dlist) { gauntlet.HomeBases.Remove(b); if (b != null) b.Delete(); } // gump height determined by number of teams int height = Teams.Count * yinc + 80; if (from == this.m_gauntlet.Challenger && !this.m_gauntlet.GameLocked) { this.AddBackground(0, 0, 290, height, 0xDAC); this.AddLabel(240, 40, 0, XmlPoints.GetText(from, 200622)); // "Base" } else { this.AddBackground(0, 0, 260, height, 0xDAC); } //AddAlphaRegion( 0, 0, 340, height ); this.AddLabel(60, 10, 0, XmlPoints.GetText(from, 200623)); // "CTF Team Status" this.AddLabel(20, 40, 0, XmlPoints.GetText(from, 200591)); // "Team" this.AddLabel(75, 40, 0, XmlPoints.GetText(from, 200596)); // "Members" this.AddLabel(135, 40, 0, XmlPoints.GetText(from, 200597)); // "Active" this.AddLabel(185, 40, 0, XmlPoints.GetText(from, 200598)); // "Score" int yoffset = 60; // list all of the teams and their status foreach (TeamInfo t in Teams) { int teamhue = 0; if (t.ID > 0) { teamhue = BaseChallengeGame.TeamColor(t.ID); } this.AddLabel(20, yoffset, teamhue, t.ID.ToString()); this.AddLabel(75, yoffset, teamhue, t.Members.Count.ToString()); this.AddLabel(135, yoffset, teamhue, t.NActive.ToString()); this.AddLabel(185, yoffset, teamhue, t.Score.ToString()); // organizer gets the base placement buttons if (from == this.m_gauntlet.Challenger && !this.m_gauntlet.GameLocked && t.ID > 0) { this.AddButton(240, yoffset, 0xFAE, 0xFAF, 1000 + t.ID, GumpButtonType.Reply, 0); } yoffset += yinc; } }
public static void RefreshAllGumps(CTFGauntlet gauntlet, bool force) { if (gauntlet.Participants != null) { foreach (CTFGauntlet.ChallengeEntry entry in gauntlet.Participants) { if (entry.Participant != null) { if (force || entry.Participant.HasGump(typeof(CTFGump))) { entry.Participant.SendGump(new CTFGump(gauntlet, entry.Participant)); } } } } // update for the organizer if (gauntlet.Challenger != null) { if (force || gauntlet.Challenger.HasGump(typeof(CTFGump))) { gauntlet.Challenger.SendGump(new CTFGump(gauntlet, gauntlet.Challenger)); } } }
public CTFGump(CTFGauntlet gauntlet, Mobile from, int page) : base(20, 30) { if (from == null || gauntlet == null || gauntlet.Deleted || gauntlet.Challenger == null) return; from.CloseGump(typeof(CTFGump)); this.m_gauntlet = gauntlet; this.viewpage = page; int height = 555; this.AddBackground(0, 0, 350, height, 0xDAC); //AddAlphaRegion( 0, 0, 340, height ); this.AddLabel(90, 10, 0, XmlPoints.GetText(from, 200620)); // "Team KotH Challenge" this.AddLabel(20, 30, 0, String.Format(XmlPoints.GetText(from, 200501), gauntlet.Challenger.Name)); // "Organized by: {0}" this.AddLabel(20, 50, 0, String.Format(XmlPoints.GetText(from, 200502), this.m_gauntlet.EntryFee)); // "Entry Fee: {0}" this.AddLabel(20, 70, 0, String.Format(XmlPoints.GetText(from, 200503), this.m_gauntlet.ArenaSize)); // "Arena Size: {0}" this.AddImageTiled(15, 130, 320, 20, 0xdb3); // display all of the current team members if (gauntlet.Participants != null) { // copy the master list to a temporary working list this.m_WorkingList = (ArrayList)gauntlet.Participants.Clone(); this.AddLabel(150, 50, 0, String.Format(XmlPoints.GetText(from, 200504), this.m_WorkingList.Count * this.m_gauntlet.EntryFee)); // "Total Purse: {0}" this.AddLabel(150, 70, 0, String.Format(XmlPoints.GetText(from, 200505), this.m_gauntlet.Location, this.m_gauntlet.Map)); // "Loc: {0} {1}" this.AddLabel(20, 90, 0, String.Format(XmlPoints.GetText(from, 200506), gauntlet.Participants.Count)); // "Players: {0}" this.AddLabel(150, 90, 0, String.Format(XmlPoints.GetText(from, 200507), gauntlet.ActivePlayers())); // "Active: {0}" if (gauntlet.TargetScore > 0) this.AddLabel(20, 110, 0, String.Format(XmlPoints.GetText(from, 200561), gauntlet.TargetScore)); // "Target Score: {0}" else this.AddLabel(20, 110, 0, XmlPoints.GetText(from, 200562)); // "Target Score: None" if (gauntlet.MatchLength > TimeSpan.Zero) this.AddLabel(150, 110, 0, String.Format(XmlPoints.GetText(from, 200563), gauntlet.MatchLength)); // "Match Length: {0}" else this.AddLabel(150, 110, 0, XmlPoints.GetText(from, 200564)); // "Match Length: Unlimited" int yoffset = 155; // page up and down buttons this.AddButton(300, 130, 0x15E0, 0x15E4, 13, GumpButtonType.Reply, 0); this.AddButton(320, 130, 0x15E2, 0x15E6, 12, GumpButtonType.Reply, 0); // find the players entry to determine the viewing page for (int i = 0; i < this.m_WorkingList.Count; i++) { CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry)this.m_WorkingList[i]; if (entry == null) continue; if (entry.Participant == from) { this.viewpage = entry.PageBeingViewed; break; } } this.AddLabel(220, 130, 0, String.Format("Page: {0}/{1}", this.viewpage + 1, (int)(this.m_WorkingList.Count / this.PlayersPerPage) + 1)); if (gauntlet.GameInProgress && gauntlet.MatchLength > TimeSpan.Zero) { this.AddLabelCropped(20, 130, 180, 21, 0, String.Format(XmlPoints.GetText(from, 200565), // "Time left {0}" TimeSpan.FromSeconds((double)((int)((gauntlet.MatchStart + gauntlet.MatchLength - DateTime.UtcNow).TotalSeconds))))); } else if (gauntlet.GameCompleted && gauntlet.MatchLength > TimeSpan.Zero) { this.AddLabelCropped(20, 130, 180, 21, 0, String.Format(XmlPoints.GetText(from, 200565), // "Time left {0}" TimeSpan.FromSeconds((double)((int)((gauntlet.MatchStart + gauntlet.MatchLength - gauntlet.MatchEnd).TotalSeconds))))); } this.AddLabel(160, 130, 0, XmlPoints.GetText(from, 200591)); // "Team" for (int i = 0; i < this.m_WorkingList.Count; i++) { // determine which page is being viewed if ((int)(i / this.PlayersPerPage) != this.viewpage) continue; CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry)this.m_WorkingList[i]; if (entry == null) continue; // display the entry with a color indicating whether they have accepted or not Mobile m = entry.Participant; string statusmsg = XmlPoints.GetText(from, 200509); // "Waiting" int texthue = 0; // this section is available during game setup if (!this.m_gauntlet.GameLocked) { statusmsg = XmlPoints.GetText(from, 200509); // "Waiting" if (entry.Accepted) { texthue = 68; statusmsg = XmlPoints.GetText(from, 200510); // "Accepted" } // check to see if they have the Entry fee if (!this.m_gauntlet.HasEntryFee(m)) { texthue = 33; statusmsg = XmlPoints.GetText(from, 200511); // "Insufficient funds" } // if the game is still open then enable these buttons // if this is the participant then add the accept button to the entry if (m == from) { this.AddButton(15, yoffset, entry.Accepted ? 0xd1 : 0xd0, entry.Accepted ? 0xd0 : 0xd1, 1000 + i, GumpButtonType.Reply, 0); } // if this is the organizer then add the kick button and the team assignment to each entry if (from == this.m_gauntlet.Challenger) { this.AddImageTiled(223, yoffset, 20, 19, textentrybackground); this.AddTextEntry(225, yoffset, 20, 19, 0, 500 + i, entry.Team.ToString()); } if (from == this.m_gauntlet.Challenger || from == entry.Participant) { this.AddButton(190, yoffset, 0xFB1, 0xFB3, 2000 + i, GumpButtonType.Reply, 0); } } else { // this section is active after the game has started // enable the forfeit button if (m == from && entry.Status == ChallengeStatus.Active && !this.m_gauntlet.GameCompleted) { this.AddButton(190, yoffset, 0xFB1, 0xFB3, 4000 + i, GumpButtonType.Reply, 0); } if (entry.Status == ChallengeStatus.Forfeit) { texthue = 33; statusmsg = XmlPoints.GetText(from, 200520); // "Forfeit" } else if (entry.Caution == ChallengeStatus.Hidden && entry.Status == ChallengeStatus.Active) { texthue = 53; statusmsg = XmlPoints.GetText(from, 200521); // "Hidden" } else if (entry.Caution == ChallengeStatus.OutOfBounds && entry.Status == ChallengeStatus.Active) { texthue = 53; statusmsg = XmlPoints.GetText(from, 200522); // "Out of Bounds" } else if (entry.Caution == ChallengeStatus.Offline && entry.Status == ChallengeStatus.Active) { texthue = 53; statusmsg = XmlPoints.GetText(from, 200523); // "Offline" } else if (entry.Status == ChallengeStatus.Active) { texthue = 68; if (entry.Winner) statusmsg = XmlPoints.GetText(from, 200524); // "Winner" else statusmsg = XmlPoints.GetText(from, 200525); // "Active" } else if (entry.Status == ChallengeStatus.Dead) { texthue = 33; statusmsg = XmlPoints.GetText(from, 200526); // "Dead" } else if (entry.Status == ChallengeStatus.Disqualified) { texthue = 33; statusmsg = XmlPoints.GetText(from, 200527); // "Disqualified" } } if (m != null) { int teamhue = 0; if (entry.Team > 0) { teamhue = BaseChallengeGame.TeamColor(entry.Team); } this.AddLabel(40, yoffset, teamhue, m.Name); this.AddLabel(165, yoffset, teamhue, entry.Team.ToString()); this.AddLabel(255, yoffset, texthue, statusmsg); if (this.m_gauntlet.GameInProgress || this.m_gauntlet.GameCompleted) { this.AddLabel(13, yoffset, 0, entry.Score.ToString()); } } yoffset += this.y_inc; } } // the challenger gets additional options if (from == gauntlet.Challenger && !this.m_gauntlet.GameLocked) { this.AddImageTiled(15, height - 135, 320, 20, 0xdb3); this.AddButton(130, height - 35, 0xFA8, 0xFAA, 100, GumpButtonType.Reply, 0); this.AddLabel(170, height - 35, 0, XmlPoints.GetText(from, 200528)); // "Add" this.AddButton(230, height - 35, 0xFB7, 0xFB9, 300, GumpButtonType.Reply, 0); this.AddLabel(270, height - 35, 0, XmlPoints.GetText(from, 200529)); // "Start" // set entry fee this.AddButton(20, height - 110, 0xFAE, 0xFAF, 10, GumpButtonType.Reply, 0); this.AddImageTiled(120, height - 110, 60, 19, textentrybackground); this.AddTextEntry(120, height - 110, 60, 25, 0, 10, this.m_gauntlet.EntryFee.ToString()); this.AddLabel(55, height - 110, 0, XmlPoints.GetText(from, 200572)); // "Entry Fee: " // set arena size this.AddButton(20, height - 85, 0xFAE, 0xFAF, 20, GumpButtonType.Reply, 0); this.AddImageTiled(130, height - 85, 30, 19, textentrybackground); this.AddTextEntry(130, height - 85, 30, 25, 0, 20, this.m_gauntlet.ArenaSize.ToString()); this.AddLabel(55, height - 85, 0, XmlPoints.GetText(from, 200573)); // "Arena Size: " // set target score this.AddButton(200, height - 110, 0xFAE, 0xFAF, 30, GumpButtonType.Reply, 0); this.AddImageTiled(275, height - 110, 30, 19, textentrybackground); this.AddTextEntry(275, height - 110, 30, 25, 0, 30, this.m_gauntlet.TargetScore.ToString()); this.AddLabel(235, height - 110, 0, XmlPoints.GetText(from, 200566)); // "Score: " // set match length this.AddButton(200, height - 85, 0xFAE, 0xFAF, 40, GumpButtonType.Reply, 0); this.AddImageTiled(310, height - 85, 25, 19, textentrybackground); this.AddTextEntry(310, height - 85, 25, 25, 0, 40, this.m_gauntlet.MatchLength.TotalMinutes.ToString()); this.AddLabel(235, height - 85, 0, XmlPoints.GetText(from, 200567)); // "Length mins: " // set teams this.AddButton(200, height - 60, 0xFAE, 0xFAF, 11, GumpButtonType.Reply, 0); this.AddLabel(240, height - 60, 0, XmlPoints.GetText(from, 200592)); // "Set Teams" } else { this.AddImageTiled(15, height - 60, 320, 20, 0xdb3); } this.AddButton(20, height - 35, 0xFAB, 0xFAD, 1, GumpButtonType.Reply, 0); this.AddLabel(60, height - 35, 0, XmlPoints.GetText(from, 200532)); // "Refresh" if (gauntlet.GameInProgress) { this.AddLabel(150, height - 35, 68, XmlPoints.GetText(from, 200533)); // "Game is in progress!" } else if (gauntlet.Winner != 0) { this.AddLabel(130, height - 35, 68, String.Format(XmlPoints.GetText(from, 200593), gauntlet.Winner)); // "Team {0} is the winner!" } //AddButton( 30, height - 35, 0xFB7, 0xFB9, 0, GumpButtonType.Reply, 0 ); //AddLabel( 70, height - 35, 0, "Close" ); // display the teams gump from.CloseGump(typeof(TeamsGump)); from.SendGump(new TeamsGump(this.m_gauntlet, from)); }
public CTFGump(CTFGauntlet gauntlet, Mobile from) : this(gauntlet, from, 0) { }