Beispiel #1
0
        public TeamLMSGauntlet(Mobile challenger) : base(0x1414)
        {
            m_Challenger = challenger;

            m_Organizers.Add(challenger);

            // check for points attachments
            XmlPoints afrom = (XmlPoints)XmlAttach.FindAttachment(challenger, typeof(XmlPoints));

            Movable = false;

            Hue = 33;

            if (challenger == null || afrom == null || afrom.Deleted)
            {
                Delete();
            }
            else
            {
                Name = XmlPoints.SystemText(100413) + " " + String.Format(XmlPoints.SystemText(100315), challenger.Name); // "Challenge by {0}"
            }
        }
        public LastManStandingGauntlet(Mobile challenger)
            : base(0x1414)
        {
            this.m_Challenger = challenger;

            this.m_Organizers.Add(challenger);

            // check for points attachments
            XmlPoints afrom = (XmlPoints)XmlAttach.FindAttachment(challenger, typeof(XmlPoints));

            this.Movable = false;

            this.Hue = 33;

            if (challenger == null || afrom == null || afrom.Deleted)
            {
                this.Delete();
            }
            else
            {
                this.Name = XmlPoints.SystemText(100302) + " " + String.Format(XmlPoints.SystemText(100315), challenger.Name); // "Challenge by {0}"
            }
        }
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;
                }
            }
        }