public void RefreshRegions()
        {
            if (m_ChallengeRegion != null)
            {
                m_ChallengeRegion.Unregister();
            }
            // define a new one based on the named region
            m_ChallengeRegion = new ChallengeGameRegion(m_ChallengeRegionName, m_ChallengeMap, m_Priority, m_ChallengeArea);
            // update the new region properties with current values
            m_ChallengeRegion.Music    = m_Music;
            m_ChallengeRegion.Disabled = m_Disable;

            m_ChallengeRegion.Register();
        }
        public void RefreshRegions()
        {
            if (this.m_ChallengeRegion != null)
            {
                this.m_ChallengeRegion.Unregister();
            }

            if (this.m_ChallengeMap == null || this.m_ChallengeArea == null)
            {
                return;
            }

            // define a new one based on the named region
            this.m_ChallengeRegion = new ChallengeGameRegion(this.m_ChallengeRegionName, this.m_ChallengeMap, this.m_Priority, this.m_ChallengeArea);
            // update the new region properties with current values
            this.m_ChallengeRegion.Music    = this.m_Music;
            this.m_ChallengeRegion.Disabled = this.m_Disable;

            this.m_ChallengeRegion.Register();
        }
        public void RefreshRegions()
        {
            if (this.m_ChallengeRegion != null)
            {
                this.m_ChallengeRegion.Unregister();
            }

            if (this.m_ChallengeMap == null || this.m_ChallengeArea == null)
                return;

            // define a new one based on the named region
            this.m_ChallengeRegion = new ChallengeGameRegion(this.m_ChallengeRegionName, this.m_ChallengeMap, this.m_Priority, this.m_ChallengeArea);
            // update the new region properties with current values
            this.m_ChallengeRegion.Music = this.m_Music;
            this.m_ChallengeRegion.Disabled = this.m_Disable;

            this.m_ChallengeRegion.Register();
        }
Exemple #4
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 RefreshRegions()
        {
            if (m_ChallengeRegion != null)
            {
                m_ChallengeRegion.Unregister();
            }
            // define a new one based on the named region
            m_ChallengeRegion = new ChallengeGameRegion(m_ChallengeRegionName, m_ChallengeMap, m_Priority, m_ChallengeArea);
            // update the new region properties with current values
            m_ChallengeRegion.Music = m_Music;
            m_ChallengeRegion.Disabled = m_Disable;

            m_ChallengeRegion.Register();
        }