Beispiel #1
0
        public void CheckForDisqualification()
        {
            if (Participants == null || !GameInProgress)
            {
                return;
            }

            bool statuschange = false;

            foreach (IChallengeEntry entry in Participants)
            {
                if (entry.Participant == null || entry.Status == ChallengeStatus.Forfeit || entry.Status == ChallengeStatus.Disqualified)
                {
                    continue;
                }

                bool hadcaution = (entry.Caution != ChallengeStatus.None);

                // and a map check
                if (entry.Participant.Map != Map)
                {
                    // check to see if they are offline
                    if (entry.Participant.Map == Map.Internal)
                    {
                        // then give them a little time to return before disqualification
                        if (entry.Caution == ChallengeStatus.Offline)
                        {
                            // were previously out of bounds so check for disqualification
                            // check to see how long they have been out of bounds
                            if (DateTime.Now - entry.LastCaution > MaximumOfflineDuration)
                            {
                                entry.Status = ChallengeStatus.Disqualified;
                                GameBroadcast(100308, entry.Participant.Name);  // "{0} has been disqualified"
                                RefreshSymmetricNoto(entry.Participant);
                                statuschange = true;
                            }
                        }
                        else
                        {
                            entry.LastCaution = DateTime.Now;
                            statuschange      = true;
                        }

                        entry.Caution = ChallengeStatus.Offline;
                    }
                    else
                    {
                        // changing to any other map is instant disqualification
                        entry.Status = ChallengeStatus.Disqualified;
                        GameBroadcast(100308, entry.Participant.Name);  // "{0} has been disqualified"
                        RefreshSymmetricNoto(entry.Participant);
                        statuschange = true;
                    }
                }
                else
                // make a range check
                if (m_ArenaSize > 0 && !Utility.InRange(entry.Participant.Location, Location, m_ArenaSize) ||
                    (IsInChallengeGameRegion && !(Region.Find(entry.Participant.Location, entry.Participant.Map) is ChallengeGameRegion)))
                {
                    if (entry.Caution == ChallengeStatus.OutOfBounds)
                    {
                        // were previously out of bounds so check for disqualification
                        // check to see how long they have been out of bounds
                        if (DateTime.Now - entry.LastCaution > MaximumOutOfBoundsDuration)
                        {
                            entry.Status = ChallengeStatus.Disqualified;
                            GameBroadcast(100308, entry.Participant.Name);  // "{0} has been disqualified"
                            RefreshSymmetricNoto(entry.Participant);
                            statuschange = true;
                        }
                    }
                    else
                    {
                        entry.LastCaution = DateTime.Now;
                        // inform the player
                        XmlPoints.SendText(entry.Participant, 100309, MaximumOutOfBoundsDuration.TotalSeconds);  // "You are out of bounds!  You have {0} seconds to return"
                        statuschange = true;
                    }

                    entry.Caution = ChallengeStatus.OutOfBounds;
                }
                else
                // make a hiding check
                if (entry.Participant.Hidden)
                {
                    if (entry.Caution == ChallengeStatus.Hidden)
                    {
                        // were previously hidden so check for disqualification
                        // check to see how long they have hidden
                        if (DateTime.Now - entry.LastCaution > MaximumHiddenDuration)
                        {
                            entry.Status = ChallengeStatus.Disqualified;
                            GameBroadcast(100308, entry.Participant.Name);  // "{0} has been disqualified"
                            RefreshSymmetricNoto(entry.Participant);
                            statuschange = true;
                        }
                    }
                    else
                    {
                        entry.LastCaution = DateTime.Now;
                        // inform the player
                        XmlPoints.SendText(entry.Participant, 100310, MaximumHiddenDuration.TotalSeconds); // "You have {0} seconds become unhidden"
                        statuschange = true;
                    }

                    entry.Caution = ChallengeStatus.Hidden;
                }
                else
                {
                    entry.Caution = ChallengeStatus.None;
                }

                if (hadcaution && entry.Caution == ChallengeStatus.None)
                {
                    statuschange = true;
                }

                // if they were disqualified, then drop them
                if (entry.Status == ChallengeStatus.Disqualified)
                {
                    ClearChallenge(entry.Participant);
                }
            }

            if (statuschange)
            {
                // update gumps with the new status
                KingOfTheHillGump.RefreshAllGumps(this, false);
            }

            // it is possible that the game could end like this so check
            CheckForGameEnd();
        }
Beispiel #2
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (state == null || info == null || state.Mobile == null || this.m_gauntlet == null || this.m_gauntlet.Challenger == null)
            {
                return;
            }

            XmlPoints afrom = (XmlPoints)XmlAttach.FindAttachment(state.Mobile, typeof(XmlPoints));

            switch (info.ButtonID)
            {
            case 1:
                // refresh

                this.m_gauntlet.CheckForDisqualification();

                state.Mobile.SendGump(new DeathBallGump(this.m_gauntlet, state.Mobile, this.viewpage));
                break;

            case 10:
                // Entry fee
                int       val = 0;
                TextRelay tr  = info.GetTextEntry(10);
                if (tr != null)
                {
                    try
                    {
                        val = int.Parse(tr.Text);
                    }
                    catch
                    {
                    }
                }
                this.m_gauntlet.EntryFee = val;

                this.m_gauntlet.ResetAcceptance();

                // update all the gumps
                RefreshAllGumps(this.m_gauntlet, true);

                state.Mobile.SendGump(new DeathBallGump(this.m_gauntlet, state.Mobile, this.viewpage));
                break;

            case 12:
                // page up
                // try doing the default for non-participants
                int nplayers = 0;
                if (this.m_gauntlet.Participants != null)
                {
                    nplayers = this.m_gauntlet.Participants.Count;
                }

                int page = this.viewpage + 1;
                if (page > (int)(nplayers / this.PlayersPerPage))
                {
                    page = (int)(nplayers / this.PlayersPerPage);
                }

                foreach (DeathBallGauntlet.ChallengeEntry entry in this.m_WorkingList)
                {
                    if (entry != null)
                    {
                        if (entry.Participant == state.Mobile)
                        {
                            entry.PageBeingViewed++;

                            if (entry.PageBeingViewed > (int)(nplayers / this.PlayersPerPage))
                            {
                                entry.PageBeingViewed = (int)(nplayers / this.PlayersPerPage);
                            }
                            page = entry.PageBeingViewed;
                            break;
                        }
                    }
                }

                state.Mobile.SendGump(new DeathBallGump(this.m_gauntlet, state.Mobile, page));
                break;

            case 13:
                // page down
                // try doing the default for non-participants

                page = this.viewpage - 1;
                if (page < 0)
                {
                    page = 0;
                }
                foreach (DeathBallGauntlet.ChallengeEntry entry in this.m_WorkingList)
                {
                    if (entry != null)
                    {
                        if (entry.Participant == state.Mobile)
                        {
                            entry.PageBeingViewed--;

                            if (entry.PageBeingViewed < 0)
                            {
                                entry.PageBeingViewed = 0;
                            }
                            page = entry.PageBeingViewed;
                            break;
                        }
                    }
                }

                state.Mobile.SendGump(new DeathBallGump(this.m_gauntlet, state.Mobile, page));
                break;

            case 20:
                // arena size
                val = 0;
                tr  = info.GetTextEntry(20);
                if (tr != null)
                {
                    try
                    {
                        val = int.Parse(tr.Text);
                    }
                    catch
                    {
                    }
                }
                this.m_gauntlet.ArenaSize = val;

                this.m_gauntlet.ResetAcceptance();

                // update all the gumps
                RefreshAllGumps(this.m_gauntlet, true);

                state.Mobile.SendGump(new DeathBallGump(this.m_gauntlet, state.Mobile, this.viewpage));
                break;

            case 30:
                // target score
                val = 0;
                tr  = info.GetTextEntry(30);
                if (tr != null)
                {
                    try
                    {
                        val = int.Parse(tr.Text);
                    }
                    catch
                    {
                    }
                }
                this.m_gauntlet.TargetScore = val;

                this.m_gauntlet.ResetAcceptance();

                // update all the gumps
                RefreshAllGumps(this.m_gauntlet, true);

                state.Mobile.SendGump(new DeathBallGump(this.m_gauntlet, state.Mobile, this.viewpage));
                break;

            case 100:

                // add to Participants
                if (this.m_gauntlet.Participants == null)
                {
                    this.m_gauntlet.Participants = new ArrayList();
                }

                if (this.MaxTeamSize > 0 && this.m_gauntlet.Participants.Count >= this.MaxTeamSize)
                {
                    XmlPoints.SendText(state.Mobile, 100535);         // "Challenge is full!"
                }
                else
                {
                    state.Mobile.Target = new MemberTarget(this.m_gauntlet, this.m_gauntlet.Participants);
                }

                state.Mobile.SendGump(new DeathBallGump(this.m_gauntlet, state.Mobile, this.viewpage));
                break;

            case 300:
                // Start game
                if (this.m_WorkingList == null)
                {
                    return;
                }

                bool complete = true;
                foreach (DeathBallGauntlet.ChallengeEntry entry in this.m_WorkingList)
                {
                    if (entry != null)
                    {
                        Mobile m = entry.Participant;

                        if (m == null)
                        {
                            continue;
                        }

                        if (!this.m_gauntlet.CheckQualify(m))
                        {
                            complete = false;
                            break;
                        }

                        if (!entry.Accepted)
                        {
                            XmlPoints.SendText(this.m_gauntlet.Challenger, 100539, m.Name);      // "{0} has not accepted yet."
                            complete = false;
                            break;
                        }
                    }
                }

                if (this.m_WorkingList.Count < 2)
                {
                    XmlPoints.SendText(this.m_gauntlet.Challenger, 100540);      // "Insufficient number of players."
                    complete = false;
                }

                if (this.m_gauntlet.TargetScore <= 0)
                {
                    XmlPoints.SendText(this.m_gauntlet.Challenger, 100568);      // "No valid end condition for match."
                    complete = false;
                }
                // copy all of the accepted entries to the final participants list

                if (complete)
                {
                    this.m_gauntlet.Participants = new ArrayList();

                    foreach (DeathBallGauntlet.ChallengeEntry entry in this.m_WorkingList)
                    {
                        if (entry != null)
                        {
                            Mobile m = entry.Participant;

                            if (m == null)
                            {
                                continue;
                            }

                            // try to collect any entry fee
                            if (!this.m_gauntlet.CollectEntryFee(m, this.m_gauntlet.EntryFee))
                            {
                                continue;
                            }

                            // set up the challenge on each player
                            XmlPoints a = (XmlPoints)XmlAttach.FindAttachment(m, typeof(XmlPoints));
                            if (a != null)
                            {
                                a.ChallengeGame = this.m_gauntlet;
                            }

                            entry.Status = ChallengeStatus.Active;

                            this.m_gauntlet.Participants.Add(entry);
                        }
                    }

                    // and lock the game
                    this.m_gauntlet.StartGame();

                    // refresh all gumps
                    RefreshAllGumps(this.m_gauntlet, true);
                }
                else
                {
                    state.Mobile.SendGump(new DeathBallGump(this.m_gauntlet, state.Mobile, this.viewpage));
                }

                break;

            default:
            {
                // forfeit buttons
                if (info.ButtonID >= 4000)
                {
                    int selection = info.ButtonID - 4000;

                    if (selection < this.m_WorkingList.Count)
                    {
                        DeathBallGauntlet.ChallengeEntry entry = (DeathBallGauntlet.ChallengeEntry) this.m_WorkingList[selection];

                        // find the master participants list entry with the same participant
                        if (this.m_gauntlet.Participants != null)
                        {
                            DeathBallGauntlet.ChallengeEntry forfeitentry = null;

                            foreach (DeathBallGauntlet.ChallengeEntry masterentry in this.m_gauntlet.Participants)
                            {
                                if (entry == masterentry)
                                {
                                    forfeitentry = masterentry;
                                    break;
                                }
                            }

                            // and remove it
                            if (forfeitentry != null)
                            {
                                forfeitentry.Status = ChallengeStatus.Forfeit;

                                // inform him that he has been kicked
                                this.m_gauntlet.Forfeit(forfeitentry.Participant);
                            }
                        }
                    }
                }
                // kick buttons
                if (info.ButtonID >= 2000)
                {
                    int selection = info.ButtonID - 2000;

                    if (selection < this.m_WorkingList.Count)
                    {
                        DeathBallGauntlet.ChallengeEntry entry = (DeathBallGauntlet.ChallengeEntry) this.m_WorkingList[selection];
                        // find the master participants list entry with the same participant
                        if (this.m_gauntlet.Participants != null)
                        {
                            DeathBallGauntlet.ChallengeEntry kickentry = null;

                            foreach (DeathBallGauntlet.ChallengeEntry masterentry in this.m_gauntlet.Participants)
                            {
                                if (entry == masterentry)
                                {
                                    kickentry = masterentry;
                                    break;
                                }
                            }

                            // and remove it
                            if (kickentry != null)
                            {
                                this.m_gauntlet.Participants.Remove(kickentry);

                                // refresh his gump and inform him that he has been kicked
                                if (kickentry.Participant != null)
                                {
                                    XmlPoints.SendText(kickentry.Participant, 100545, this.m_gauntlet.ChallengeName);         // "You have been kicked from {0}"
                                    kickentry.Participant.SendGump(new DeathBallGump(this.m_gauntlet, kickentry.Participant, this.viewpage));
                                }
                            }
                        }

                        this.m_gauntlet.ResetAcceptance();
                    }

                    // refresh all gumps
                    RefreshAllGumps(this.m_gauntlet, true);
                    //state.Mobile.SendGump( new DeathBallGump( m_gauntlet, state.Mobile));
                }
                else if (info.ButtonID >= 1000)
                {
                    int selection = info.ButtonID - 1000;
                    // set the acceptance flag of the participant
                    if (selection < this.m_WorkingList.Count)
                    {
                        DeathBallGauntlet.ChallengeEntry entry = (DeathBallGauntlet.ChallengeEntry) this.m_WorkingList[selection];

                        entry.Accepted = !entry.Accepted;
                    }

                    // refresh all gumps
                    RefreshAllGumps(this.m_gauntlet, true);
                    //state.Mobile.SendGump( new DeathBallGump( m_gauntlet, state.Mobile));
                }

                break;
            }
            }
        }
Beispiel #3
0
        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;
                }
            }
        }
        public void CheckForDisqualification()
        {
            if (this.Participants == null || !this.GameInProgress)
            {
                return;
            }

            bool statuschange = false;

            foreach (ChallengeEntry entry in this.Participants)
            {
                if (entry.Participant == null || entry.Status != ChallengeStatus.Active)
                {
                    continue;
                }

                bool hadcaution = (entry.Caution != ChallengeStatus.None);

                // and a map check
                if (entry.Participant.Map != this.Map)
                {
                    // check to see if they are offline
                    if (entry.Participant.Map == Map.Internal)
                    {
                        // then give them a little time to return before disqualification
                        if (entry.Caution == ChallengeStatus.Offline)
                        {
                            // were previously out of bounds so check for disqualification
                            // check to see how long they have been out of bounds
                            if (DateTime.UtcNow - entry.LastCaution > MaximumOfflineDuration)
                            {
                                // penalize them
                                this.SubtractScore(entry);
                                entry.LastCaution = DateTime.UtcNow;
                            }
                        }
                        else
                        {
                            entry.LastCaution = DateTime.UtcNow;
                            statuschange      = true;
                        }

                        entry.Caution = ChallengeStatus.Offline;
                    }
                    else
                    {
                        // changing to any other map results in instant
                        // teleport back to the gauntlet
                        // and point loss
                        this.RespawnWithPenalty(entry);
                        entry.Caution = ChallengeStatus.None;
                    }
                }
                else if (this.m_ArenaSize > 0 && !Utility.InRange(entry.Participant.Location, this.Location, this.m_ArenaSize) ||
                         (this.IsInChallengeGameRegion && !(Region.Find(entry.Participant.Location, entry.Participant.Map) is ChallengeGameRegion)))
                {
                    if (entry.Caution == ChallengeStatus.OutOfBounds)
                    {
                        // were previously out of bounds so check for disqualification
                        // check to see how long they have been out of bounds
                        if (DateTime.UtcNow - entry.LastCaution > MaximumOutOfBoundsDuration)
                        {
                            // teleport them back to the gauntlet
                            this.RespawnWithPenalty(entry);
                            this.GameBroadcast(100401, entry.Participant.Name);  // "{0} was penalized."
                            entry.Caution = ChallengeStatus.None;
                            statuschange  = true;
                        }
                    }
                    else
                    {
                        entry.LastCaution = DateTime.UtcNow;
                        // inform the player
                        XmlPoints.SendText(entry.Participant, 100309, MaximumOutOfBoundsDuration.TotalSeconds);  // "You are out of bounds!  You have {0} seconds to return"
                        statuschange = true;
                    }

                    entry.Caution = ChallengeStatus.OutOfBounds;
                }
                else if (entry.Participant.Hidden)
                {
                    if (entry.Caution == ChallengeStatus.Hidden)
                    {
                        // were previously hidden so check for disqualification
                        // check to see how long they have hidden
                        if (DateTime.UtcNow - entry.LastCaution > MaximumHiddenDuration)
                        {
                            // penalize them
                            this.SubtractScore(entry);
                            entry.Participant.Hidden = false;
                            this.GameBroadcast(100401, entry.Participant.Name);  // "{0} was penalized."
                            entry.Caution = ChallengeStatus.None;
                            statuschange  = true;
                        }
                    }
                    else
                    {
                        entry.LastCaution = DateTime.UtcNow;
                        // inform the player
                        XmlPoints.SendText(entry.Participant, 100310, MaximumHiddenDuration.TotalSeconds); // "You have {0} seconds become unhidden"
                        statuschange = true;
                    }

                    entry.Caution = ChallengeStatus.Hidden;
                }
                else
                {
                    entry.Caution = ChallengeStatus.None;
                }

                if (hadcaution && entry.Caution == ChallengeStatus.None)
                {
                    statuschange = true;
                }
            }

            if (statuschange)
            {
                // update gumps with the new status
                TeamDeathmatchGump.RefreshAllGumps(this, false);
            }

            // it is possible that the game could end like this so check
            this.CheckForGameEnd();
        }
Beispiel #5
0
        public DeathBallGump(DeathBallGauntlet gauntlet, Mobile from, int page)
            : base(20, 30)
        {
            if (from == null || gauntlet == null || gauntlet.Deleted || gauntlet.Challenger == null)
            {
                return;
            }

            from.CloseGump(typeof(DeathBallGump));

            this.m_gauntlet = gauntlet;

            this.viewpage = page;

            int height = 520;

            this.AddBackground(0, 0, 350, height, 0xDAC);
            //AddAlphaRegion( 0, 0, 340, height );

            this.AddLabel(100, 10, 0, XmlPoints.GetText(from, 200570));                                          // "Deathball 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"
                }
                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++)
                {
                    DeathBallGauntlet.ChallengeEntry entry = (DeathBallGauntlet.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(XmlPoints.GetText(from, 200508), this.viewpage + 1, (int)(this.m_WorkingList.Count / this.PlayersPerPage) + 1)); // "Page: {0}/{1}"

                for (int i = 0; i < this.m_WorkingList.Count; i++)
                {
                    // determine which page is being viewed
                    if ((int)(i / this.PlayersPerPage) != this.viewpage)
                    {
                        continue;
                    }

                    DeathBallGauntlet.ChallengeEntry entry = (DeathBallGauntlet.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 to each entry
                        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 (gauntlet.Winner == entry.Participant)
                            {
                                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)
                    {
                        this.AddLabel(40, yoffset, 0, m.Name);

                        this.AddLabel(225, yoffset, texthue, statusmsg);

                        if (this.m_gauntlet.GameInProgress)
                        {
                            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 - 110, 320, 20, 0xdb3);

                this.AddButton(130, height - 35, 0xFA8, 0xFAA, 100, GumpButtonType.Reply, 0);
                this.AddLabel(165, height - 35, 0, XmlPoints.GetText(from, 200528));      // "Add"

                this.AddButton(240, height - 35, 0xFB7, 0xFB9, 300, GumpButtonType.Reply, 0);
                this.AddLabel(275, height - 35, 0, XmlPoints.GetText(from, 200529));     // "Start"

                // set entry fee
                this.AddButton(20, height - 85, 0xFAE, 0xFAF, 10, GumpButtonType.Reply, 0);
                this.AddImageTiled(130, height - 85, 60, 19, textentrybackground);
                this.AddTextEntry(130, height - 85, 60, 25, 0, 10, this.m_gauntlet.EntryFee.ToString());
                this.AddLabel(55, height - 85, 0, XmlPoints.GetText(from, 200572));  // "Entry Fee: "

                // set arena size
                this.AddButton(20, height - 60, 0xFAE, 0xFAF, 20, GumpButtonType.Reply, 0);
                this.AddImageTiled(130, height - 60, 30, 19, textentrybackground);
                this.AddTextEntry(130, height - 60, 30, 25, 0, 20, this.m_gauntlet.ArenaSize.ToString());
                this.AddLabel(55, height - 60, 0, XmlPoints.GetText(from, 200573));    //  "Arena Size: "

                // set target score
                this.AddButton(200, height - 85, 0xFAE, 0xFAF, 30, GumpButtonType.Reply, 0);
                this.AddImageTiled(280, height - 85, 40, 19, textentrybackground);
                this.AddTextEntry(280, height - 85, 40, 25, 0, 30, this.m_gauntlet.TargetScore.ToString());
                this.AddLabel(235, height - 85, 0, XmlPoints.GetText(from, 200566));    //  "Score: "
            }
            else
            {
                this.AddImageTiled(15, height - 60, 320, 20, 0xdb3);
            }

            this.AddButton(20, height - 35, 0xFAB, 0xFAD, 1, GumpButtonType.Reply, 0);
            this.AddLabel(55, 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!"
            }
            //AddButton( 30, height - 35, 0xFB7, 0xFB9, 0, GumpButtonType.Reply, 0 );
            //AddLabel( 70, height - 35, 0, "Close" );
        }
Beispiel #6
0
        public TeamDeathmatchGump(TeamDeathmatchGauntlet gauntlet, Mobile from, int page) : base(20, 30)
        {
            if (from == null || gauntlet == null || gauntlet.Deleted || gauntlet.Challenger == null)
            {
                return;
            }

            from.CloseGump(typeof(TeamDeathmatchGump));

            m_gauntlet = gauntlet;

            viewpage = page;

            int height = 555;

            AddBackground(0, 0, 350, height, 0xDAC);
            //AddAlphaRegion( 0, 0, 340, height );

            AddLabel(100, 10, 0, XmlPoints.GetText(from, 200590));                                         // "Team Deathmatch Challenge"
            AddLabel(20, 30, 0, String.Format(XmlPoints.GetText(from, 200501), gauntlet.Challenger.Name)); // "Organized by: {0}"
            AddLabel(20, 50, 0, String.Format(XmlPoints.GetText(from, 200502), m_gauntlet.EntryFee));      // "Entry Fee: {0}"
            AddLabel(20, 70, 0, String.Format(XmlPoints.GetText(from, 200503), m_gauntlet.ArenaSize));     // "Arena Size: {0}"

            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
                m_WorkingList = (ArrayList)gauntlet.Participants.Clone();

                AddLabel(150, 50, 0, String.Format(XmlPoints.GetText(from, 200504), m_WorkingList.Count * m_gauntlet.EntryFee)); // "Total Purse: {0}"

                AddLabel(150, 70, 0, String.Format(XmlPoints.GetText(from, 200505), m_gauntlet.Location, m_gauntlet.Map));       // "Loc: {0} {1}"

                AddLabel(20, 90, 0, String.Format(XmlPoints.GetText(from, 200506), gauntlet.Participants.Count));                // "Players: {0}"

                AddLabel(150, 90, 0, String.Format(XmlPoints.GetText(from, 200507), gauntlet.ActivePlayers()));                  // "Active: {0}"

                if (gauntlet.TargetScore > 0)
                {
                    AddLabel(20, 110, 0, String.Format(XmlPoints.GetText(from, 200561), gauntlet.TargetScore));   // "Target Score: {0}"
                }
                else
                {
                    AddLabel(20, 110, 0, XmlPoints.GetText(from, 200562));  // "Target Score: None"
                }
                if (gauntlet.MatchLength > TimeSpan.Zero)
                {
                    AddLabel(150, 110, 0, String.Format(XmlPoints.GetText(from, 200563), gauntlet.MatchLength));   // "Match Length: {0}"
                }
                else
                {
                    AddLabel(150, 110, 0, XmlPoints.GetText(from, 200564));    // "Match Length: Unlimited"
                }
                int yoffset = 155;

                // page up and down buttons
                AddButton(300, 130, 0x15E0, 0x15E4, 13, GumpButtonType.Reply, 0);
                AddButton(320, 130, 0x15E2, 0x15E6, 12, GumpButtonType.Reply, 0);


                // find the players entry to determine the viewing page
                for (int i = 0; i < m_WorkingList.Count; i++)
                {
                    TeamDeathmatchGauntlet.ChallengeEntry entry = (TeamDeathmatchGauntlet.ChallengeEntry)m_WorkingList[i];

                    if (entry == null)
                    {
                        continue;
                    }

                    if (entry.Participant == from)
                    {
                        viewpage = entry.PageBeingViewed;
                        break;
                    }
                }

                AddLabel(220, 130, 0, String.Format(XmlPoints.GetText(from, 200508), viewpage + 1, (int)(m_WorkingList.Count / PlayersPerPage) + 1)); // "Page: {0}/{1}"

                if (gauntlet.GameInProgress && gauntlet.MatchLength > TimeSpan.Zero)
                {
                    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)))));
                }

                AddLabel(160, 130, 0, XmlPoints.GetText(from, 200591));   // "Team"

                for (int i = 0; i < m_WorkingList.Count; i++)
                {
                    // determine which page is being viewed

                    if ((int)(i / PlayersPerPage) != viewpage)
                    {
                        continue;
                    }

                    TeamDeathmatchGauntlet.ChallengeEntry entry = (TeamDeathmatchGauntlet.ChallengeEntry)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 (!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 (!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)
                        {
                            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 == m_gauntlet.Challenger)
                        {
                            AddImageTiled(223, yoffset, 20, 19, textentrybackground);
                            AddTextEntry(225, yoffset, 20, 19, 0, 500 + i, entry.Team.ToString());
                        }
                        if (from == m_gauntlet.Challenger || from == entry.Participant)
                        {
                            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 && !m_gauntlet.GameCompleted)
                        {
                            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);
                        }
                        AddLabel(40, yoffset, teamhue, m.Name);
                        AddLabel(165, yoffset, teamhue, entry.Team.ToString());
                        AddLabel(255, yoffset, texthue, statusmsg);

                        if (m_gauntlet.GameInProgress || m_gauntlet.GameCompleted)
                        {
                            AddLabel(13, yoffset, 0, entry.Score.ToString());
                        }
                    }

                    yoffset += y_inc;
                }
            }


            // the challenger gets additional options
            if (from == gauntlet.Challenger && !m_gauntlet.GameLocked)
            {
                AddImageTiled(15, height - 135, 320, 20, 0xdb3);

                AddButton(130, height - 35, 0xFA8, 0xFAA, 100, GumpButtonType.Reply, 0);
                AddLabel(170, height - 35, 0, XmlPoints.GetText(from, 200528));        // "Add"

                AddButton(230, height - 35, 0xFB7, 0xFB9, 300, GumpButtonType.Reply, 0);
                AddLabel(270, height - 35, 0, XmlPoints.GetText(from, 200529));       // "Start"

                // set entry fee
                AddButton(20, height - 110, 0xFAE, 0xFAF, 10, GumpButtonType.Reply, 0);
                AddImageTiled(120, height - 110, 60, 19, textentrybackground);
                AddTextEntry(120, height - 110, 60, 25, 0, 10, m_gauntlet.EntryFee.ToString());
                AddLabel(55, height - 110, 0, XmlPoints.GetText(from, 200572));    // "Entry Fee: "

                // set arena size
                AddButton(20, height - 85, 0xFAE, 0xFAF, 20, GumpButtonType.Reply, 0);
                AddImageTiled(130, height - 85, 30, 19, textentrybackground);
                AddTextEntry(130, height - 85, 30, 25, 0, 20, m_gauntlet.ArenaSize.ToString());
                AddLabel(55, height - 85, 0, XmlPoints.GetText(from, 200573));      //  "Arena Size: "

                // set target score
                AddButton(200, height - 110, 0xFAE, 0xFAF, 30, GumpButtonType.Reply, 0);
                AddImageTiled(275, height - 110, 30, 19, textentrybackground);
                AddTextEntry(275, height - 110, 30, 25, 0, 30, m_gauntlet.TargetScore.ToString());
                AddLabel(235, height - 110, 0, XmlPoints.GetText(from, 200566));      //  "Score: "

                // set match length
                AddButton(200, height - 85, 0xFAE, 0xFAF, 40, GumpButtonType.Reply, 0);
                AddImageTiled(310, height - 85, 25, 19, textentrybackground);
                AddTextEntry(310, height - 85, 25, 25, 0, 40, m_gauntlet.MatchLength.TotalMinutes.ToString());
                AddLabel(235, height - 85, 0, XmlPoints.GetText(from, 200567));     // "Length mins: "

                // set teams
                AddButton(200, height - 60, 0xFAE, 0xFAF, 11, GumpButtonType.Reply, 0);
                AddLabel(240, height - 60, 0, XmlPoints.GetText(from, 200592));    // "Set Teams"
            }
            else
            {
                AddImageTiled(15, height - 60, 320, 20, 0xdb3);
            }

            AddButton(20, height - 35, 0xFAB, 0xFAD, 1, GumpButtonType.Reply, 0);
            AddLabel(60, height - 35, 0, XmlPoints.GetText(from, 200532));    // "Refresh"

            if (gauntlet.GameInProgress)
            {
                AddLabel(150, height - 35, 68, XmlPoints.GetText(from, 200533));   // "Game is in progress!"
            }
            else
            if (gauntlet.Winner != 0)
            {
                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(m_gauntlet, from));
        }
Beispiel #7
0
 private static void Add(int index, string text)
 {
     XmlPoints.AddText(XmlPoints.LanguageType.SPANISH, index, text);
 }
Beispiel #8
0
        public static int MobileNotoriety(Mobile source, Mobile target)
        {
            if (Core.AOS && (target.Blessed || (target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier))
            {
                return(Notoriety.Invulnerable);
            }

            #region Dueling
            if (source is PlayerMobile && target is PlayerMobile)
            {
                PlayerMobile pmFrom = (PlayerMobile)source;
                PlayerMobile pmTarg = (PlayerMobile)target;

                if (pmFrom.DuelContext != null && pmFrom.DuelContext.StartedBeginCountdown && !pmFrom.DuelContext.Finished && pmFrom.DuelContext == pmTarg.DuelContext)
                {
                    return(pmFrom.DuelContext.IsAlly(pmFrom, pmTarg) ? Notoriety.Ally : Notoriety.Enemy);
                }
            }
            #endregion

            if (target.IsStaff())
            {
                return(Notoriety.CanBeAttacked);
            }

            if (source.Player && !target.Player && source is PlayerMobile && target is BaseCreature)
            {
                BaseCreature bc = (BaseCreature)target;

                Mobile master = bc.GetMaster();

                if (master != null && master.IsStaff())
                {
                    return(Notoriety.CanBeAttacked);
                }

                master = bc.ControlMaster;

                if (Core.ML && master != null)
                {
                    if ((source == master && CheckAggressor(target.Aggressors, source)) || (CheckAggressor(source.Aggressors, bc)))
                    {
                        return(Notoriety.CanBeAttacked);
                    }
                    else
                    {
                        return(MobileNotoriety(source, master));
                    }
                }

                if (!bc.Summoned && !bc.Controlled && ((PlayerMobile)source).EnemyOfOneType == target.GetType())
                {
                    return(Notoriety.Enemy);
                }
            }

            if (target.Kills >= 5 || (target.Body.IsMonster && IsSummoned(target as BaseCreature) && !(target is BaseFamiliar) && !(target is ArcaneFey) && !(target is Golem)) || (target is BaseCreature && (((BaseCreature)target).AlwaysMurderer || ((BaseCreature)target).IsAnimatedDead)))
            {
                return(Notoriety.Murderer);
            }

            #region Mondain's Legacy
            if (target is Gregorio)
            {
                Gregorio gregorio = (Gregorio)target;

                if (Gregorio.IsMurderer(source))
                {
                    return(Notoriety.Murderer);
                }

                return(Notoriety.Innocent);
            }
            else if (source.Player && target is Engines.Quests.BaseEscort)
            {
                return(Notoriety.Innocent);
            }
            #endregion

            if (target.Criminal)
            {
                return(Notoriety.Criminal);
            }

            if (XmlPoints.AreTeamMembers(source, target))
            {
                return(Notoriety.Ally);
            }
            else if (XmlPoints.AreChallengers(source, target))
            {
                return(Notoriety.Enemy);
            }

            Guild sourceGuild = GetGuildFor(source.Guild as Guild, source);
            Guild targetGuild = GetGuildFor(target.Guild as Guild, target);

            if (sourceGuild != null && targetGuild != null)
            {
                if (sourceGuild == targetGuild || sourceGuild.IsAlly(targetGuild))
                {
                    return(Notoriety.Ally);
                }
                else if (sourceGuild.IsEnemy(targetGuild))
                {
                    return(Notoriety.Enemy);
                }
            }

            Faction srcFaction = Faction.Find(source, true, true);
            Faction trgFaction = Faction.Find(target, true, true);

            if (srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet)
            {
                return(Notoriety.Enemy);
            }

            if (SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Contains(source))
            {
                return(Notoriety.CanBeAttacked);
            }

            if (target is BaseCreature && ((BaseCreature)target).AlwaysAttackable)
            {
                return(Notoriety.CanBeAttacked);
            }

            if (CheckHouseFlag(source, target, target.Location, target.Map))
            {
                return(Notoriety.CanBeAttacked);
            }

            if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent))   //If Target is NOT A baseCreature, OR it's a BC and the BC is initial innocent...
            {
                if (!target.Body.IsHuman && !target.Body.IsGhost && !IsPet(target as BaseCreature) && !(target is PlayerMobile) || !Core.ML && !target.CanBeginAction(typeof(Server.Spells.Seventh.PolymorphSpell)))
                {
                    return(Notoriety.CanBeAttacked);
                }
            }

            if (CheckAggressor(source.Aggressors, target))
            {
                return(Notoriety.CanBeAttacked);
            }

            if (CheckAggressed(source.Aggressed, target))
            {
                return(Notoriety.CanBeAttacked);
            }

            if (target is BaseCreature)
            {
                BaseCreature bc = (BaseCreature)target;

                if (bc.Controlled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source)
                {
                    return(Notoriety.CanBeAttacked);
                }
            }

            if (source is BaseCreature)
            {
                BaseCreature bc     = (BaseCreature)source;
                Mobile       master = bc.GetMaster();

                if (master != null)
                {
                    if (CheckAggressor(master.Aggressors, target) || MobileNotoriety(master, target) == Notoriety.CanBeAttacked || target is BaseCreature)
                    {
                        return(Notoriety.CanBeAttacked);
                    }
                }
            }

            return(Notoriety.Innocent);
        }
Beispiel #9
0
        /*private static bool CheckHarmfulStatus( GuildStatus from, GuildStatus target )
         * {
         * if ( from == GuildStatus.Waring && target == GuildStatus.Waring )
         * return true;
         *
         * return false;
         * }*/

        public static bool Mobile_AllowBeneficial(Mobile from, Mobile target)
        {
            if (from == null || target == null || from.IsStaff() || target.IsStaff())
            {
                return(true);
            }

            #region Dueling
            PlayerMobile pmFrom = from as PlayerMobile;
            PlayerMobile pmTarg = target as PlayerMobile;

            if (pmFrom == null && from is BaseCreature)
            {
                BaseCreature bcFrom = (BaseCreature)from;

                if (bcFrom.Summoned)
                {
                    pmFrom = bcFrom.SummonMaster as PlayerMobile;
                }
            }

            if (pmTarg == null && target is BaseCreature)
            {
                BaseCreature bcTarg = (BaseCreature)target;

                if (bcTarg.Summoned)
                {
                    pmTarg = bcTarg.SummonMaster as PlayerMobile;
                }
            }

            if (pmFrom != null && pmTarg != null)
            {
                if (pmFrom.DuelContext != pmTarg.DuelContext && ((pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg.DuelContext != null && pmTarg.DuelContext.Started)))
                {
                    return(false);
                }

                if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && ((pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started) || pmFrom.DuelContext.Tied || pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated))
                {
                    return(false);
                }

                if (pmFrom.DuelPlayer != null && !pmFrom.DuelPlayer.Eliminated && pmFrom.DuelContext != null && pmFrom.DuelContext.IsSuddenDeath)
                {
                    return(false);
                }

                if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.m_Tournament != null && pmFrom.DuelContext.m_Tournament.IsNotoRestricted && pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null && pmFrom.DuelPlayer.Participant != pmTarg.DuelPlayer.Participant)
                {
                    return(false);
                }

                if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.Started)
                {
                    return(true);
                }
            }

            if ((pmFrom != null && pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg != null && pmTarg.DuelContext != null && pmTarg.DuelContext.Started))
            {
                return(false);
            }

            Engines.ConPVP.SafeZone sz = from.Region.GetRegion(typeof(Engines.ConPVP.SafeZone)) as Engines.ConPVP.SafeZone;

            if (sz != null /*&& sz.IsDisabled()*/)
            {
                return(false);
            }

            sz = target.Region.GetRegion(typeof(Engines.ConPVP.SafeZone)) as Engines.ConPVP.SafeZone;

            if (sz != null /*&& sz.IsDisabled()*/)
            {
                return(false);
            }
            #endregion

            Map map = from.Map;

            #region Factions
            Faction targetFaction = Faction.Find(target, true);

            if ((!Core.ML || map == Faction.Facet) && targetFaction != null)
            {
                if (Faction.Find(from, true) != targetFaction)
                {
                    return(false);
                }
            }
            #endregion

            #region Mondain's Legacy
            if (target is Gregorio)
            {
                return(false);
            }
            #endregion

            if (map != null && (map.Rules & MapRules.BeneficialRestrictions) == 0)
            {
                return(true); // In felucca, anything goes
            }
            if (!from.Player)
            {
                return(true); // NPCs have no restrictions
            }
            if (target is BaseCreature && !((BaseCreature)target).Controlled)
            {
                return(false); // Players cannot heal uncontrolled mobiles
            }
            if (XmlPoints.AreInAnyGame(target))
            {
                return(XmlPoints.AreTeamMembers(from, target));
            }

            if (from is PlayerMobile && ((PlayerMobile)from).Young && (!(target is PlayerMobile) || !((PlayerMobile)target).Young))
            {
                return(false); // Young players cannot perform beneficial actions towards older players
            }
            Guild fromGuild   = from.Guild as Guild;
            Guild targetGuild = target.Guild as Guild;

            if (fromGuild != null && targetGuild != null && (targetGuild == fromGuild || fromGuild.IsAlly(targetGuild)))
            {
                return(true); // Guild members can be beneficial
            }
            return(CheckBeneficialStatus(GetGuildStatus(from), GetGuildStatus(target)));
        }
Beispiel #10
0
        public static bool Mobile_AllowHarmful(Mobile from, Mobile target)
        {
            if (from == null || target == null || from.IsStaff() || target.IsStaff())
            {
                return(true);
            }

            #region Mondain's Legacy
            if (target is Gregorio)
            {
                if (Gregorio.IsMurderer(from))
                {
                    return(true);
                }

                from.SendLocalizedMessage(1075456); // You are not allowed to damage this NPC unless your on the Guilty Quest
                return(false);
            }
            #endregion

            #region Dueling
            PlayerMobile pmFrom = from as PlayerMobile;
            PlayerMobile pmTarg = target as PlayerMobile;

            if (pmFrom == null && from is BaseCreature)
            {
                BaseCreature bcFrom = (BaseCreature)from;

                if (bcFrom.Summoned)
                {
                    pmFrom = bcFrom.SummonMaster as PlayerMobile;
                }
            }

            if (pmTarg == null && target is BaseCreature)
            {
                BaseCreature bcTarg = (BaseCreature)target;

                if (bcTarg.Summoned)
                {
                    pmTarg = bcTarg.SummonMaster as PlayerMobile;
                }
            }

            if (pmFrom != null && pmTarg != null)
            {
                if (pmFrom.DuelContext != pmTarg.DuelContext && ((pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg.DuelContext != null && pmTarg.DuelContext.Started)))
                {
                    return(false);
                }

                if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && ((pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started) || pmFrom.DuelContext.Tied || pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated))
                {
                    return(false);
                }

                if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.m_Tournament != null && pmFrom.DuelContext.m_Tournament.IsNotoRestricted && pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null && pmFrom.DuelPlayer.Participant == pmTarg.DuelPlayer.Participant)
                {
                    return(false);
                }

                if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.Started)
                {
                    return(true);
                }
            }

            if ((pmFrom != null && pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg != null && pmTarg.DuelContext != null && pmTarg.DuelContext.Started))
            {
                return(false);
            }

            Engines.ConPVP.SafeZone sz = from.Region.GetRegion(typeof(Engines.ConPVP.SafeZone)) as Engines.ConPVP.SafeZone;

            if (sz != null /*&& sz.IsDisabled()*/)
            {
                return(false);
            }

            sz = target.Region.GetRegion(typeof(Engines.ConPVP.SafeZone)) as Engines.ConPVP.SafeZone;

            if (sz != null /*&& sz.IsDisabled()*/)
            {
                return(false);
            }
            #endregion

            Map map = from.Map;

            if (map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0)
            {
                return(true); // In felucca, anything goes
            }
            BaseCreature bc = from as BaseCreature;

            if (!from.Player && !(bc != null && bc.GetMaster() != null && bc.GetMaster().IsPlayer()))
            {
                if (!CheckAggressor(from.Aggressors, target) && !CheckAggressed(from.Aggressed, target) && target is PlayerMobile && ((PlayerMobile)target).CheckYoungProtection(from))
                {
                    return(false);
                }

                return(true); // Uncontrolled NPCs are only restricted by the young system
            }

            if (XmlPoints.AreChallengers(from, target))
            {
                return(true);
            }

            Guild fromGuild   = GetGuildFor(from.Guild as Guild, from);
            Guild targetGuild = GetGuildFor(target.Guild as Guild, target);

            if (fromGuild != null && targetGuild != null && (fromGuild == targetGuild || fromGuild.IsAlly(targetGuild) || fromGuild.IsEnemy(targetGuild)))
            {
                return(true); // Guild allies or enemies can be harmful
            }
            if (target is BaseCreature && (((BaseCreature)target).Controlled || (((BaseCreature)target).Summoned && from != ((BaseCreature)target).SummonMaster)))
            {
                return(false); // Cannot harm other controlled mobiles
            }
            if (target.Player)
            {
                return(false); // Cannot harm other players
            }
            if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent))
            {
                if (Notoriety.Compute(from, target) == Notoriety.Innocent)
                {
                    return(false); // Cannot harm innocent mobiles
                }
            }

            return(true);
        }
Beispiel #11
0
        /*private static bool CheckHarmfulStatus( GuildStatus from, GuildStatus target )
         * {
         * if ( from == GuildStatus.Waring && target == GuildStatus.Waring )
         * return true;
         *
         * return false;
         * }*/

        public static bool Mobile_AllowBeneficial(Mobile from, Mobile target)
        {
            if (from == null || target == null || from.IsStaff() || target.IsStaff())
            {
                return(true);
            }

            Map map = from.Map;

            #region Factions/VvV
            if (Factions.Settings.Enabled)
            {
                Faction targetFaction = Faction.Find(target, true);

                if ((!Core.ML || map == Faction.Facet) && targetFaction != null)
                {
                    if (Faction.Find(from, true) != targetFaction)
                    {
                        return(false);
                    }
                }
            }

            if (ViceVsVirtueSystem.Enabled)
            {
                if (ViceVsVirtueSystem.IsEnemy(from, target))
                {
                    return(false);
                }
            }
            #endregion

            #region Mondain's Legacy
            if (target is Gregorio)
            {
                return(false);
            }
            #endregion

            if (map != null && (map.Rules & MapRules.BeneficialRestrictions) == 0)
            {
                return(true); // In felucca, anything goes
            }
            if (!from.Player)
            {
                return(true); // NPCs have no restrictions
            }
            if (target is BaseCreature && !((BaseCreature)target).Controlled)
            {
                return(false); // Players cannot heal uncontrolled mobiles
            }
            if (XmlPoints.AreInAnyGame(target))
            {
                return(XmlPoints.AreTeamMembers(from, target));
            }

            if (from is PlayerMobile && ((PlayerMobile)from).Young && target is BaseCreature &&
                ((BaseCreature)target).Controlled)
            {
                return(true);
            }

            if (from is PlayerMobile && ((PlayerMobile)from).Young && (!(target is PlayerMobile) || !((PlayerMobile)target).Young))
            {
                return(false); // Young players cannot perform beneficial actions towards older players
            }
            Guild fromGuild   = from.Guild as Guild;
            Guild targetGuild = target.Guild as Guild;

            if (fromGuild != null && targetGuild != null && (targetGuild == fromGuild || fromGuild.IsAlly(targetGuild)))
            {
                return(true); // Guild members can be beneficial
            }
            return(CheckBeneficialStatus(GetGuildStatus(from), GetGuildStatus(target)));
        }
Beispiel #12
0
        public static bool Mobile_AllowHarmful(Mobile from, IDamageable damageable)
        {
            Mobile target = damageable as Mobile;

            if (from == null || target == null || from.IsStaff() || target.IsStaff())
            {
                return(true);
            }

            #region Mondain's Legacy
            if (target is Gregorio)
            {
                if (Gregorio.IsMurderer(from))
                {
                    return(true);
                }

                from.SendLocalizedMessage(1075456); // You are not allowed to damage this NPC unless your on the Guilty Quest
                return(false);
            }
            #endregion

            Map map = from.Map;

            if (map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0)
            {
                return(true); // In felucca, anything goes
            }
            // Summons should follow the same rules as their masters
            if (from is BaseCreature && ((BaseCreature)from).Summoned && ((BaseCreature)from).SummonMaster != null)
            {
                from = ((BaseCreature)from).SummonMaster;
            }

            if (target is BaseCreature && ((BaseCreature)target).Summoned && ((BaseCreature)target).SummonMaster != null)
            {
                target = ((BaseCreature)target).SummonMaster;
            }

            BaseCreature bc = from as BaseCreature;

            if (!from.Player && !(bc != null && bc.GetMaster() != null && bc.GetMaster().IsPlayer()))
            {
                if (!CheckAggressor(from.Aggressors, target) && !CheckAggressed(from.Aggressed, target) && target is PlayerMobile && ((PlayerMobile)target).CheckYoungProtection(from))
                {
                    return(false);
                }

                return(true); // Uncontrolled NPCs are only restricted by the young system
            }

            if (XmlPoints.AreChallengers(from, target))
            {
                return(true);
            }

            Guild fromGuild   = GetGuildFor(from.Guild as Guild, from);
            Guild targetGuild = GetGuildFor(target.Guild as Guild, target);

            if (fromGuild != null && targetGuild != null && (fromGuild == targetGuild || fromGuild.IsAlly(targetGuild) || fromGuild.IsEnemy(targetGuild)))
            {
                return(true); // Guild allies or enemies can be harmful
            }
            if (target is BaseCreature && (((BaseCreature)target).Controlled || (((BaseCreature)target).Summoned && from != ((BaseCreature)target).SummonMaster)))
            {
                return(false); // Cannot harm other controlled mobiles
            }
            if (target.Player)
            {
                return(false); // Cannot harm other players
            }
            if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent))
            {
                if (Notoriety.Compute(from, target) == Notoriety.Innocent)
                {
                    return(false); // Cannot harm innocent mobiles
                }
            }

            return(true);
        }
Beispiel #13
0
            public TeamsGump(CTFGauntlet gauntlet, Mobile from)
                : base(350, 30)
            {
                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 == m_gauntlet.Challenger && !m_gauntlet.GameLocked)
                {
                    AddBackground(0, 0, 290, height, 0xDAC);
                    AddLabel(240, 40, 0, XmlPoints.GetText(from, 200622));                        // "Base"
                }
                else
                {
                    AddBackground(0, 0, 260, height, 0xDAC);
                }
                //AddAlphaRegion( 0, 0, 340, height );

                AddLabel(60, 10, 0, XmlPoints.GetText(from, 200623));                    // "CTF Team Status"

                AddLabel(20, 40, 0, XmlPoints.GetText(from, 200591));                    // "Team"
                AddLabel(75, 40, 0, XmlPoints.GetText(from, 200596));                    // "Members"
                AddLabel(135, 40, 0, XmlPoints.GetText(from, 200597));                   // "Active"
                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);
                    }
                    AddLabel(20, yoffset, teamhue, t.ID.ToString());
                    AddLabel(75, yoffset, teamhue, t.Members.Count.ToString());
                    AddLabel(135, yoffset, teamhue, t.NActive.ToString());
                    AddLabel(185, yoffset, teamhue, t.Score.ToString());

                    // organizer gets the base placement buttons
                    if (from == m_gauntlet.Challenger && !m_gauntlet.GameLocked && t.ID > 0)
                    {
                        AddButton(240, yoffset, 0xFAE, 0xFAF, 1000 + t.ID, GumpButtonType.Reply, 0);
                    }

                    yoffset += yinc;
                }
            }
Beispiel #14
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (state == null || info == null || state.Mobile == null || m_gauntlet == null || m_gauntlet.Challenger == null)
            {
                return;
            }

            XmlPoints afrom = (XmlPoints)XmlAttach.FindAttachment(state.Mobile, typeof(XmlPoints));

            switch (info.ButtonID)
            {
            case 1:
                // refresh

                //m_gauntlet.CheckForDisqualification();

                state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, viewpage));
                break;

            case 10:
                // Entry fee
                int       val = 0;
                TextRelay tr  = info.GetTextEntry(10);
                if (tr != null)
                {
                    try { val = int.Parse(tr.Text); }
                    catch { }
                }
                m_gauntlet.EntryFee = val;

                m_gauntlet.ResetAcceptance();

                // update all the gumps
                RefreshAllGumps(m_gauntlet, true);

                state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, viewpage));
                break;

            case 11:
                // update teams
                if (m_WorkingList != null)
                {
                    for (int i = 0; i < m_WorkingList.Count; i++)
                    {
                        // is this on the visible page?
                        if ((int)(i / PlayersPerPage) != viewpage)
                        {
                            continue;
                        }

                        CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry)m_WorkingList[i];
                        if (entry != null)
                        {
                            int tval = 0;
                            tr = info.GetTextEntry(500 + i);
                            if (tr != null)
                            {
                                try { tval = int.Parse(tr.Text); }
                                catch { }
                            }
                            entry.Team = tval;
                        }
                    }
                }

                m_gauntlet.ResetAcceptance();
                // update all the gumps
                RefreshAllGumps(m_gauntlet, true);

                state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, viewpage));
                break;

            case 12:
                // page up
                // try doing the default for non-participants
                int nplayers = 0;
                if (m_gauntlet.Participants != null)
                {
                    nplayers = m_gauntlet.Participants.Count;
                }

                int page = viewpage + 1;
                if (page > (int)(nplayers / PlayersPerPage))
                {
                    page = (int)(nplayers / PlayersPerPage);
                }

                if (m_WorkingList != null)
                {
                    for (int i = 0; i < m_WorkingList.Count; i++)
                    {
                        CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry)m_WorkingList[i];
                        if (entry != null)
                        {
                            if (entry.Participant == state.Mobile)
                            {
                                entry.PageBeingViewed++;

                                if (entry.PageBeingViewed > (int)(nplayers / PlayersPerPage))
                                {
                                    entry.PageBeingViewed = (int)(nplayers / PlayersPerPage);
                                }

                                page = entry.PageBeingViewed;
                                //break;
                            }
                        }
                    }
                }

                state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, page));
                break;

            case 13:
                // page down
                // try doing the default for non-participants
                page = viewpage - 1;
                if (page < 0)
                {
                    page = 0;
                }
                if (m_WorkingList != null)
                {
                    for (int i = 0; i < m_WorkingList.Count; i++)
                    {
                        CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry)m_WorkingList[i];
                        if (entry != null)
                        {
                            if (entry.Participant == state.Mobile)
                            {
                                entry.PageBeingViewed--;

                                if (entry.PageBeingViewed < 0)
                                {
                                    entry.PageBeingViewed = 0;
                                }

                                page = entry.PageBeingViewed;
                                //break;
                            }
                        }
                    }
                }

                state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, page));
                break;

            case 20:
                // arena size
                val = 0;
                tr  = info.GetTextEntry(20);
                if (tr != null)
                {
                    try { val = int.Parse(tr.Text); }
                    catch { }
                }
                m_gauntlet.ArenaSize = val;

                m_gauntlet.ResetAcceptance();

                // update all the gumps
                RefreshAllGumps(m_gauntlet, true);

                state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, viewpage));
                break;

            case 30:
                // target score
                val = 0;
                tr  = info.GetTextEntry(30);
                if (tr != null)
                {
                    try { val = int.Parse(tr.Text); }
                    catch { }
                }
                m_gauntlet.TargetScore = val;

                m_gauntlet.ResetAcceptance();

                // update all the gumps
                RefreshAllGumps(m_gauntlet, true);

                state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, viewpage));
                break;

            case 40:
                // match length
                double dval = 0;
                tr = info.GetTextEntry(40);
                if (tr != null)
                {
                    try { dval = double.Parse(tr.Text); }
                    catch { }
                }
                m_gauntlet.MatchLength = TimeSpan.FromMinutes(dval);

                m_gauntlet.ResetAcceptance();

                // update all the gumps
                RefreshAllGumps(m_gauntlet, true);

                state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, viewpage));
                break;

            case 100:

                // add to Participants
                if (m_gauntlet.Participants == null)
                {
                    m_gauntlet.Participants = new ArrayList();
                }

                if (MaxTeamSize > 0 && m_gauntlet.Participants.Count >= MaxTeamSize)
                {
                    XmlPoints.SendText(state.Mobile, 100535);                                 // "Challenge is full!"
                }
                else
                {
                    state.Mobile.Target = new MemberTarget(m_gauntlet, m_gauntlet.Participants);
                }


                state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, viewpage));
                break;

            case 300:
                // Start game
                if (m_WorkingList == null)
                {
                    return;
                }

                bool complete = true;
                foreach (CTFGauntlet.ChallengeEntry entry in m_WorkingList)
                {
                    if (entry != null)
                    {
                        Mobile m = entry.Participant;

                        if (m == null)
                        {
                            continue;
                        }

                        if (!m_gauntlet.CheckQualify(m))
                        {
                            complete = false;
                            break;
                        }

                        if (!entry.Accepted)
                        {
                            XmlPoints.SendText(m_gauntlet.Challenger, 100539, m.Name);                                      // "{0} has not accepted yet."
                            complete = false;
                            break;
                        }

                        // and they have a team
                        if (entry.Team <= 0)
                        {
                            XmlPoints.SendText(m_gauntlet.Challenger, 100594, m.Name);                                     // "{0} has not been assigned a team."
                            complete = false;
                        }
                    }
                }

                if (m_WorkingList.Count < 2)
                {
                    XmlPoints.SendText(m_gauntlet.Challenger, 100540);                              // "Insufficient number of players."
                    complete = false;
                }

                // make sure all the bases have been defined
                ArrayList Teams = m_gauntlet.GetTeams();

                // make sure that all bases have teams defined
                if (Teams != null)
                {
                    foreach (TeamInfo t in Teams)
                    {
                        bool hasteam = false;
                        foreach (CTFBase b in m_gauntlet.HomeBases)
                        {
                            if (t.ID == b.Team)
                            {
                                hasteam = true;
                                break;
                            }
                        }

                        if (!hasteam)
                        {
                            XmlPoints.SendText(m_gauntlet.Challenger, 100621, t.ID);                                     // "Team {0} base not defined."
                            complete = false;
                        }
                    }
                }
                else
                {
                    complete = false;
                }

                if (complete)
                {
                    m_gauntlet.Participants = new ArrayList();

                    foreach (CTFGauntlet.ChallengeEntry entry in m_WorkingList)
                    {
                        if (entry != null)
                        {
                            Mobile m = entry.Participant;

                            if (m == null)
                            {
                                continue;
                            }

                            // try to collect any entry fee
                            if (!m_gauntlet.CollectEntryFee(m, m_gauntlet.EntryFee))
                            {
                                continue;
                            }

                            // set up the challenge on each player
                            XmlPoints a = (XmlPoints)XmlAttach.FindAttachment(m, typeof(XmlPoints));
                            if (a != null)
                            {
                                a.ChallengeGame = m_gauntlet;
                            }

                            entry.Status = ChallengeStatus.Active;

                            m_gauntlet.Participants.Add(entry);
                        }
                    }

                    // and lock the game
                    m_gauntlet.StartGame();

                    // refresh all gumps
                    RefreshAllGumps(m_gauntlet, true);
                }
                else
                {
                    state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, viewpage));
                }

                break;

            default:
            {
                // forfeit buttons
                if (info.ButtonID >= 4000)
                {
                    int selection = info.ButtonID - 4000;

                    if (selection < m_WorkingList.Count)
                    {
                        CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry)m_WorkingList[selection];

                        // find the master participants list entry with the same participant
                        if (m_gauntlet.Participants != null)
                        {
                            CTFGauntlet.ChallengeEntry forfeitentry = null;

                            foreach (CTFGauntlet.ChallengeEntry masterentry in m_gauntlet.Participants)
                            {
                                if (entry == masterentry)
                                {
                                    forfeitentry = masterentry;
                                    break;
                                }
                            }

                            // and remove it
                            if (forfeitentry != null)
                            {
                                forfeitentry.Status = ChallengeStatus.Forfeit;

                                // inform him that he has been kicked
                                m_gauntlet.Forfeit(forfeitentry.Participant);
                            }
                        }
                    }
                }
                // kick buttons
                if (info.ButtonID >= 2000)
                {
                    int selection = info.ButtonID - 2000;

                    if (selection < m_WorkingList.Count)
                    {
                        CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry)m_WorkingList[selection];
                        // find the master participants list entry with the same participant
                        if (m_gauntlet.Participants != null)
                        {
                            CTFGauntlet.ChallengeEntry kickentry = null;

                            foreach (CTFGauntlet.ChallengeEntry masterentry in m_gauntlet.Participants)
                            {
                                if (entry == masterentry)
                                {
                                    kickentry = masterentry;
                                    break;
                                }
                            }

                            // and remove it
                            if (kickentry != null)
                            {
                                m_gauntlet.Participants.Remove(kickentry);

                                // refresh his gump and inform him that he has been kicked
                                if (kickentry.Participant != null)
                                {
                                    XmlPoints.SendText(kickentry.Participant, 100545, m_gauntlet.ChallengeName);                                                     // "You have been kicked from {0}"
                                    kickentry.Participant.SendGump(new CTFGump(m_gauntlet, kickentry.Participant, viewpage));
                                }
                            }
                        }

                        m_gauntlet.ResetAcceptance();
                    }

                    // refresh all gumps
                    RefreshAllGumps(m_gauntlet, true);
                    //state.Mobile.SendGump( new CTFGump( m_gauntlet, state.Mobile));
                }
                else
                // accept buttons
                if (info.ButtonID >= 1000)
                {
                    int selection = info.ButtonID - 1000;
                    // set the acceptance flag of the participant
                    if (selection < m_WorkingList.Count)
                    {
                        CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry)m_WorkingList[selection];

                        entry.Accepted = !entry.Accepted;
                    }

                    // refresh all gumps
                    RefreshAllGumps(m_gauntlet, true);

                    //state.Mobile.SendGump( new CTFGump( m_gauntlet, state.Mobile));
                }


                break;
            }
            }
        }