コード例 #1
0
            public CountdownTimer(TournamentStone stone) : base(TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1))
            {
                m_TournamentStone = stone;
                count             = m_TournamentStone.StartDelay;

                CommandHandlers.BroadcastMessage(AccessLevel.Player, 38, string.Format("An automated and supplied 1v1 tournament will start in {0} minute{1}! Type .jointour to join or .watchtour to watch", count, count == 1 ? "" : "s"));
            }
コード例 #2
0
        public HalloweenEventController()
            : base(0xEDC)
        {
            Name = "Halloween Event Settings Controller";

            Movable = false;
            Visible = false;

            Hue = 1358;

            if (Instance != null && Instance != this)
            {
                // there can only be one seasonal event controller game stone in the world
                Instance.Location = Location;

                CommandHandlers.BroadcastMessage(
                    AccessLevel.Seer,
                    1161,
                    "Existing Halloween Event Controller has been moved to this location.");

                Timer.DelayCall(TimeSpan.FromSeconds(1), UpdateInstancePosition, this);
            }
            else
            {
                Instance = this;
            }
        }
コード例 #3
0
        public DynamicSettingsController()
            : base(0xEDC)
        {
            Name = "Dynamic Settings Controller";

            Movable = false;
            Visible = false;

            if (Instance != null && Instance != this)
            {
                // there can only be one DynamicSettingsController game stone in the world
                Instance.Location = Location;

                CommandHandlers.BroadcastMessage(
                    AccessLevel.Administrator,
                    1161,
                    "Existing DynamicSettingsController has been moved to this location.");

                Timer.DelayCall(TimeSpan.FromSeconds(1), UpdateInstancePosition, this);
            }
            else
            {
                Instance = this;
            }
        }
コード例 #4
0
        public EasterEventController()
            : base(0xEDC)
        {
            Name = "Easter Event Settings Controller";

            Movable = false;
            Visible = false;

            if (Instance != null && Instance != this)
            {
                // there can only be one seasonal event controller game stone in the world
                Instance.Location = Location;

                CommandHandlers.BroadcastMessage(
                    AccessLevel.Seer,
                    1161,
                    "Existing Easter Event Controller has been moved to this location.");

                Timer.DelayCall(TimeSpan.FromSeconds(1), UpdateInstancePosition, this);
            }
            else
            {
                Instance = this;
            }

            ParticipantList = new Dictionary <PlayerMobile, int>();
            PointList       = new Dictionary <PlayerMobile, int>();
        }
コード例 #5
0
            protected override void OnTick()
            {
                count--;

                if (m_TournamentStone != null && m_TournamentStone.Started)
                {
                    if (count <= 0)
                    {
                        if (m_TournamentStone.Contestants.Count >= 2)
                        {
                            CommandHandlers.BroadcastMessage(AccessLevel.Player, 38, "An automated tournament has begun");
                            m_TournamentStone.AcceptingContestants = false;
                            m_TournamentStone.AddFighters(true);
                            Stop();
                        }
                        else
                        {
                            TournamentCore.SendMessage(m_TournamentStone.Contestants, "Not enough players joined, ending tournament");
                            m_TournamentStone.EndTournament(false);
                            Stop();
                        }
                    }
                    else if (count <= 10)
                    {
                        CommandHandlers.BroadcastMessage(AccessLevel.Player, 38, string.Format("An automated and supplied 1v1 tournament will start in {0} minute{1}! Type .jointour to join or .watchtour to watch", count, count == 1 ? "" : "s"));
                    }
                }
                else
                {
                    Stop();
                }
            }
コード例 #6
0
        public ValorRewardController()
            : base(0xEDC)
        {
            Name         = "Rewards Controller";
            Movable      = false;
            Visible      = false;
            MTitle       = new TitleCollection();
            _mValorItems = new ValorItemCollection();
            Categories   = new Dictionary <int, string>
            {
                { 0, "Titles" }
            };

            if (_mInstance != null)
            {
                // there can only be one RewardController game stone in the world
                _mInstance.Location = Location;
                CommandHandlers.BroadcastMessage(
                    AccessLevel.GameMaster, 0x489, "Existing Title Controller has been moved to this location (DON'T DELETE IT!).");
                Timer.DelayCall(TimeSpan.FromSeconds(1), UpdateInstancePosition, this);
            }
            else
            {
                _mInstance = this;
            }
        }
コード例 #7
0
 public LMPTimer(LastManPentagram lmp, int count, String location, int ticksRequired)
     : base(TimeSpan.FromSeconds(6.0), TimeSpan.FromSeconds(6.0))
 {
     m_LMP                = lmp;
     m_Count              = count * 10;
     m_Location           = location;
     m_TimerTicksRequired = ticksRequired;
     CommandHandlers.BroadcastMessage(AccessLevel.Player, 1150, String.Format("The pentagram at {0} will be active in {1} minutes. The first one who stands on it alone for {2} seconds will receive a random reward. Hiding at this pentagram is deadly mistake.", location, count, ticksRequired * 6));
 }
コード例 #8
0
ファイル: XMLFaction.cs プロジェクト: bsenyuva/terranubia3
 public void Delete()
 {
     if (Owner != null)
     {
         Owner.SendMessage("Votre faction {0} viens d'être effacée");
     }
     CommandHandlers.BroadcastMessage(AccessLevel.GameMaster, 1333, String.Format("(GM)La faction de '{0}' nommée '{1}' à été effacée", (Owner == null ? "Personne" : Owner.Name), Name));
     XMLFactions.Remove(m_Name);
 }
コード例 #9
0
 /// Edit by Orbit Storm
 /// <summary>
 /// On new player login, broadcast a message.
 /// </summary>
 public static void EventSink_CharacterCreated(CharacterCreatedEventArgs e)
 {
     if (e.Mobile != null)
     {
         if (e.Mobile.AccessLevel == AccessLevel.Player)
         {
             CommandHandlers.BroadcastMessage(AccessLevel.Player, m_NewPlayerHue, String.Format(m_NewPlayerMessage, e.Mobile.Name));
         }
     }
 }
コード例 #10
0
 protected override void OnTick()
 {
     if (m_Boss != null && !m_Boss.Deleted)
     {
         CommandHandlers.BroadcastMessage(AccessLevel.Player, 38, "You will all perish before the Lord of the Undead!  I will burn Skara Brae to the ground!");
     }
     else
     {
         Stop();
     }
 }
コード例 #11
0
 void EventSink_CharacterCreated(CharacterCreatedEventArgs e)
 {
     if (e.Mobile != null)
     {
         if (e.Mobile.AccessLevel == AccessLevel.Player)
         {
             connection.Sender.PublicMessage(chatChannel, String.Format("5{0} has just arrived in Comraich!", e.Mobile.RawName));
             CommandHandlers.BroadcastMessage(AccessLevel.Player, announcementHue, String.Format("{0} has just arrived in Comraich!", e.Mobile.RawName));
         }
     }
 }
コード例 #12
0
ファイル: PvpCore.cs プロジェクト: furkanugur/imaginenation
        public static void SendMessage(List <Mobile> mobiles, string message, bool toStaff)
        {
            for (int i = 0; i < mobiles.Count; i++)
            {
                mobiles[i].SendMessage(38, message);
            }

            if (toStaff)
            {
                CommandHandlers.BroadcastMessage(AccessLevel.Counselor, 38, string.Format("[Deathmatch] {0}", message));
            }
        }
コード例 #13
0
        public void OnTick()
        {
            if (_CoreTicks == 0)
            {
                SpawnInvaders(CurrentLevel.SpawnAmount);
            }

            if (_CoreTicks > 60 && _CoreTicks % 30 == 0)
            {
                if (Invaders.Count != CurrentLevel.SpawnAmount)
                {
                    SpawnInvaders(CurrentLevel.SpawnAmount - Invaders.Count);
                }
            }

            if (_CoreTicks % 600 == 0)
            {
                CommandHandlers.BroadcastMessage(AccessLevel.Player, 33,
                                                 "Defenders are needed to halt the " + InvasionName + ".");
            }

            if (_CoreTicks >= (int)CurrentLevel.TimeLimit.TotalSeconds && CurrentLevel.KillAmount == 0 ||
                (int)CurrentLevel.TimeLimit.TotalSeconds == 0 && CurrentLevel.KillAmount > 0 &&
                CurrentLevelKills >= CurrentLevel.KillAmount
                ||
                _CoreTicks < (int)CurrentLevel.TimeLimit.TotalSeconds && CurrentLevel.KillAmount > 0 &&
                CurrentLevelKills >= CurrentLevel.KillAmount)
            {
                if (Levels.Last() == CurrentLevel || Levels.Count == 1)
                {
                    FinishInvasion();
                    _CoreTimer.Stop();
                    return;
                }
                else
                {
                    IncrementLevel();
                    return;
                }
            }

            if (CurrentLevel != null && (int)CurrentLevel.TimeLimit.TotalSeconds > 0 &&
                _CoreTicks >= (int)CurrentLevel.TimeLimit.TotalSeconds && CurrentLevel.KillAmount > 0 &&
                CurrentLevelKills < CurrentLevel.KillAmount)
            {
                FinishInvasion();
                _CoreTimer.Stop();
                return;
            }

            ++_CoreTicks;
        }
コード例 #14
0
ファイル: HarvestTracker.cs プロジェクト: Pumpk1ns/outlands
        public static void NotifyStaff(Mobile from, HarvestType type)
        {
            string htype = "";

            switch (type)
            {
            case HarvestType.Fishing: { htype = "fishing"; } break;

            case HarvestType.Lumberjacking: { htype = "lumberjacking"; } break;

            case HarvestType.Mining: { htype = "mining"; } break;
            }
            CommandHandlers.BroadcastMessage(AccessLevel.GameMaster, 0x482, String.Format("Watchlist player \"{0}\" is currently {1}.", from.Name, htype));
        }
コード例 #15
0
        public void PseudoSeerMessage(string message, params object[] args)
        {
            message = String.Format(message, args);

            foreach (PlayerMobile member in PseudoSeers.Keys)
            {
                member.SendMessage(0x489, message);
            }

            if (MessageStaff)
            {
                CommandHandlers.BroadcastMessage(CreaturePossession.FullAccessStaffLevel, 0x489, message);
            }
        }
コード例 #16
0
 /// <summary>
 /// On player login, broadcast a message.
 /// </summary>
 public static void EventSink_Login(LoginEventArgs e)
 {
     if (e.Mobile.Player)
     {
         if (e.Mobile.AccessLevel <= m_AnnounceLevel)
         {
             CommandHandlers.BroadcastMessage(AccessLevel.Player, m_LoginHue, String.Format(m_LoginMessage, e.Mobile.Name));
         }
         else //broadcast any other level to the staff
         {
             CommandHandlers.BroadcastMessage(AccessLevel.Counselor, m_LoginHue, String.Format(m_LoginMessage, e.Mobile.Name));
         }
     }
 }
コード例 #17
0
        /// <summary>
        /// On player logout, broadcast a message.
        /// </summary>
        public static void EventSink_Logout(LogoutEventArgs e)
        {
            if (e.Mobile.Player)
            {
                e.Mobile.Send(PlayMusic.GetInstance(MusicName.LoginLoop));

                if (e.Mobile.AccessLevel <= m_AnnounceLevel)
                {
                    CommandHandlers.BroadcastMessage(AccessLevel.Player, m_LogoutHue, String.Format(m_LogoutMessage, e.Mobile.Name));
                }
                else //broadcast any other level to the staff
                {
                    CommandHandlers.BroadcastMessage(AccessLevel.Counselor, m_LogoutHue, String.Format(m_LogoutMessage, e.Mobile.Name));
                }
            }
        }
コード例 #18
0
ファイル: DMStone.cs プロジェクト: rberiot/imaginenation
        public void EndDeathmatch(bool worldLoaded)
        {
            if (m_MatchTimer != null)
            {
                m_MatchTimer.Stop();
            }

            PvpCore.RemoveRunningDM();
            CommandHandlers.BroadcastMessage(AccessLevel.Player, 38, "A deathmatch has ended");

            if (m_ScoreTable != null && m_ScoreTable.Count > 0)
            {
                List <ScoreKeeper> scoreKeeperList = new List <ScoreKeeper>(m_ScoreTable.Values);

                scoreKeeperList.Sort();

                if (scoreKeeperList[0] != null && worldLoaded)
                {
                    CommandHandlers.BroadcastMessage(AccessLevel.Player, 38, String.Format("{0} has won the deathmatch!", scoreKeeperList[0].Player.Name));
                    RewardPlayers(scoreKeeperList);
                }
            }

            if (Contestants != null && Contestants.Count > 0)
            {
                List <Mobile> removeList = new List <Mobile>(Contestants);
                foreach (Mobile m in removeList)
                {
                    ShowScore(m);
                    RemovePlayer(m, false);
                }
            }

            m_Started = false;
            m_AcceptingContestants = false;

            m_ScoreTable       = new Dictionary <Serial, ScoreKeeper>();
            m_LatestSpawnPoint = new Dictionary <Serial, DMSpawnPoint>();
            Contestants        = new List <Mobile>();

            if (EndlessMatches)
            {
                Started = true;
            }
        }
コード例 #19
0
ファイル: PerkOverviewGump.cs プロジェクト: zerodowned/Ulmeta
        /// <summary>
        /// Handles the first level purchase of a perk
        /// </summary>
        public void OnFirstLevelResponse(Mobile from, bool okay, object state)
        {
            if (!okay)
            {
            }
            else if (Perk.HasPerk(Player, Perk))
            {
                Player.SendMessage("You have already unlocked the {0} perk!", Perk.Label);
            }
            else if (!Perk.HasFreeSlot(Player))
            {
                Player.SendMessage("You cannot unlock this perk because you have already started developing two other perks.");
            }
            else if (Player.EssenceOfCharacter < Perk.FirstLevelCost)
            {
                Player.SendMessage("You need at least {0:N0} Essence of Character to begin developing perks!", Perk.FirstLevelCost);
            }
            else
            {
                Perk newPerk = null;

                try
                {
                    newPerk = Activator.CreateInstance(Perk.GetType(), Player) as Perk;
                }
                catch (Exception e)
                {
                    ExceptionManager.LogException("PerkOverviewGump.OnFirstLevelResponse()", e);
                }

                if (Perk.Set(Player, newPerk, PerkPosition.Primary, false))
                {
                    Player.EssenceOfCharacter -= Perk.FirstLevelCost;

                    PlayUpgradeEffect(Player, newPerk, PerkLevel.First);
                }
                else
                {
                    Player.SendMessage("There was a problem unlocking this perk. The server staff has been notified and will contact you soon.");
                    CommandHandlers.BroadcastMessage(AccessLevel.Administrator, 32, String.Format("Alert: a problem has occurred unlocking a perk for '{0}'", Player.RawName));
                }
            }

            Player.SendGump(new PerkOverviewGump(Player, Page.Detail, Perk, PerkLevel.First));
        }
コード例 #20
0
 private void Button_SendMessage_Click(object sender, EventArgs e)
 {
     if (this.TextBox_Message.Text != null && this.TextBox_Message.Text != string.Empty && this.TextBox_Message.Text.Length > 0)
     {
         if (this.CB_Broadcast_ACL.SelectedIndex < 5 && this.CB_Broadcast_ACL.SelectedIndex >= 0)
         {
             CommandHandlers.BroadcastMessage((AccessLevel)this.CB_Broadcast_ACL.SelectedIndex, 0x21, this.TextBox_Message.Text);
         }
         else if (this.CB_Broadcast_ACL.SelectedIndex == 5)
         {
             Console.WriteLine(this.TextBox_Message.Text);
         }
     }
     else
     {
         MessageBox.Show(Core.MainForm, "There's no message to send", "Error");
     }
 }
コード例 #21
0
ファイル: HarvestTracker.cs プロジェクト: Pumpk1ns/outlands
        private static void WriteTopFile()
        {
            try
            {
                StreamWriter sw = new StreamWriter(String.Format("HarvestLogs\\{0}.log", DateTime.UtcNow.ToLongDateString()), true);

                List <KeyValuePair <Mobile, Int32> > fishlist = ReturnTop10(HarvestType.Fishing);
                List <KeyValuePair <Mobile, Int32> > minelist = ReturnTop10(HarvestType.Mining);
                List <KeyValuePair <Mobile, Int32> > loglist  = ReturnTop10(HarvestType.Lumberjacking);

                if (fishlist != null)
                {
                    sw.WriteLine("*************Fishing*************");
                    foreach (KeyValuePair <Mobile, Int32> entry in fishlist)
                    {
                        sw.WriteLine(String.Format("({0}){1}: {2}", entry.Key.Account.Username, entry.Key.Name, entry.Value));
                    }
                }
                if (minelist != null)
                {
                    sw.WriteLine("**************Mining**************");
                    foreach (KeyValuePair <Mobile, Int32> entry in minelist)
                    {
                        sw.WriteLine(String.Format("({0}){1}: {2}", entry.Key.Account.Username, entry.Key.Name, entry.Value));
                    }
                }
                if (loglist != null)
                {
                    sw.WriteLine("**********Lumberjacking**********");
                    foreach (KeyValuePair <Mobile, Int32> entry in loglist)
                    {
                        sw.WriteLine(String.Format("({0}){1}: {2}", entry.Key.Account.Username, entry.Key.Name, entry.Value));
                    }
                }
                sw.Close();
                m_DateLastWroteLog = DateTime.UtcNow;
                Reset();
            }
            catch (Exception ex)
            {
                CommandHandlers.BroadcastMessage(AccessLevel.GameMaster, 0x482, String.Format("Error writing logfile:{0}", ex));
            }
        }
コード例 #22
0
        public void EndTournament(bool worldLoaded)
        {
            if (m_CountdownTimer != null)
            {
                m_CountdownTimer.Stop();
            }

            TournamentCore.RemoveRunningTournament();
            CommandHandlers.BroadcastMessage(AccessLevel.Player, 38, "A tournament has ended");

            if (ScoreTable != null && ScoreTable.Count > 0)
            {
                List <ScoreKeeper> scoreKeeperList = new List <ScoreKeeper>(ScoreTable.Values);

                scoreKeeperList.Sort();

                if (scoreKeeperList[0] != null && worldLoaded)
                {
                    CommandHandlers.BroadcastMessage(AccessLevel.Player, 38, String.Format("{0} has won the tournament!", scoreKeeperList[0].Player.Name));
                    RewardPlayers(scoreKeeperList);
                }
            }

            if (Contestants != null && Contestants.Count > 0)
            {
                List <Mobile> removeList = new List <Mobile>(Contestants);
                foreach (Mobile m in removeList)
                {
                    RemovePlayer(m, false, false);
                }
            }

            m_Started            = false;
            AcceptingContestants = false;

            ScoreTable    = new Dictionary <Serial, ScoreKeeper>();
            Contestants   = new List <Mobile>();
            Fighting      = new List <Mobile>();
            Winners       = new List <Mobile>();
            m_Areas       = new List <Rectangle2D>();
            m_MatchTimers = new Dictionary <Rectangle2D, Timer>();
            NeedRestock   = new List <Mobile>(); // - Rob
        }
コード例 #23
0
        public PseudoSeerStone()
            : base(0xEDC)
        {
            MovePSeerToLastPossessed = true;
            Name         = "Pseudoseer Stone";
            Movable      = false;
            SeerDuration = TimeSpan.MaxValue;
            MessageStaff = true;

            if (_Instance != null)
            {
                // there can only be one PseudoSeerStone game stone in the world
                _Instance.Delete();

                CommandHandlers.BroadcastMessage(
                    CreaturePossession.FullAccessStaffLevel,
                    0x489,
                    "Old PseudoSeerStone gamestone has been deleted as new one was added.");
            }

            _Instance = this;
        }
コード例 #24
0
        public AntiRailGump(Mobile from, string strNotice, string strSkill)
            : base(50, 50)
        {
            m_Mobile    = from;
            m_strNotify = strNotice;
            m_strSkill  = strSkill;

            //close any other RTT gumps
            from.CloseGump(typeof(AntiRailGump));

            // notify staff
            CommandHandlers.BroadcastMessage(AccessLevel.Administrator,
                                             0x482,
                                             String.Format("{0}({1}) is taking the RTT ({2}).", m_Mobile.Name, m_Mobile.Serial, strSkill));

            SetupGump();

            m_AntiRailTestLaunched = DateTime.UtcNow;

            m_timeout = new AntiRailTimer(m_Mobile, TimeSpan.FromSeconds(Utility.RandomList(90, 120, 180)));
            m_timeout.Start();
        }
コード例 #25
0
        public PetRestorationStone()
            : base(0xEDC)
        {
            Name =
                "Pet Restoration Stone - Double click and pets lost in the recent update will be brought here (NOT to your stable) and you will have control of them.";
            Movable = false;
            Visible = false;

            if (m_Instance != null)
            {
                // there can only be one WeaponDamageController game stone in the world
                m_Instance.Location = Location;
                CommandHandlers.BroadcastMessage(
                    AccessLevel.Administrator,
                    0x489,
                    "Existing PetRestorationStone has been moved to this location (DON'T DELETE IT!).");
                Timer.DelayCall(TimeSpan.FromSeconds(1), UpdateInstancePosition, this);
            }
            else
            {
                m_Instance = this;
            }
        }
コード例 #26
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            // kill our timeout timer
            if (m_timeout != null)
            {
                m_timeout.Stop();
                m_timeout = null;
            }

            int      button = info.ButtonID;
            TimeSpan diff   = DateTime.UtcNow - m_AntiRailTestLaunched;

            if (button == m_CorrectResponse + m_CorrectResponseOffset)
            {
                m_Mobile.SendMessage("Thanks for verifying that you're at your computer.");

                if (diff <= TimeSpan.FromSeconds(1.0))
                {
                    CommandHandlers.BroadcastMessage(AccessLevel.Counselor,
                                                     0x22,
                                                     String.Format("{0}({1}) has quickly passed the RTT ({2} ms) ({3}).", m_Mobile.Name, m_Mobile.Serial, diff.TotalMilliseconds, m_strNotify));
                }
                else
                {
                    CommandHandlers.BroadcastMessage(AccessLevel.Counselor,
                                                     0x482,
                                                     String.Format("{0}({1}) has passed the RTT ({2} ms).  ({3})", m_Mobile.Name, m_Mobile.Serial, diff.TotalMilliseconds, m_strNotify));
                }
            }
            else
            {
                m_Mobile.SendMessage("You have failed the AFK test.");
                CommandHandlers.BroadcastMessage(AccessLevel.Counselor,
                                                 0x482,
                                                 String.Format("{0}({1}) has failed the RTT. ({2})", m_Mobile.Name, m_Mobile.Serial, this.m_strNotify));
            }
        }
コード例 #27
0
ファイル: XMLFaction.cs プロジェクト: bsenyuva/terranubia3
        public XMLFaction(string _Name, Mobile _owner)
        {
            m_Name  = _Name;
            m_Owner = _owner;


            if (m_Owner != null)
            {
                m_Access        = m_Owner.AccessLevel;
                m_PlayerFaction = (m_Owner.AccessLevel <= AccessLevel.Player);
            }

            bool CanCreate = true;

            foreach (XMLFaction f in XMLFactions.GetFactions())
            {
                if (CompareTo(f) == 0)
                {
                    CanCreate = false;
                }
            }
            if (!CanCreate)
            {
                if (m_Owner != null)
                {
                    m_Owner.SendMessage(133, "Impossible de créer votre faction: Le nom est déjà pris");
                }
                return;                 //N'étant pas ajouté a XMLFactions.m_Factions, l'objet ne sera pas save et sera Delete comme un Grand.
                // Ne surtout pas utiliser Delete ici, on effacerai la faction existante du même nom ^^
            }

            CommandHandlers.BroadcastMessage(AccessLevel.Player, 133, String.Format("La faction {0} viens de voir le jour", Name));
            CommandHandlers.BroadcastMessage(AccessLevel.GameMaster, 0, String.Format("(GM)Faction crée par: {0}", (Owner == null ? "Personne" : Owner.Name)));

            XMLFactions.Add(this);
        }
コード例 #28
0
            protected override void OnTick()
            {
                if (m_LMP == null || m_LMP.Deleted)
                {
                    Stop();
                }

                string message = "";

                if (!m_GetWinner)
                {
                    m_Count--;

                    if (m_Count < 1)
                    {
                        m_GetWinner = true;
                        CommandHandlers.BroadcastMessage(AccessLevel.Player, 1150, String.Format("The pentagram at {0} is active!", m_Location));
                    }

                    else if (m_Count % 10 == 0)
                    {
                        CommandHandlers.BroadcastMessage(AccessLevel.Player, 1150, String.Format("The pentagram at {0} will be active in {1} minutes. The first one who stands on it alone for {2} seconds will receive a random reward. Hiding at this pentagram is deadly mistake.", m_Location, m_Count / 10, m_TimerTicksRequired * 6));
                    }
                }

                else
                {
                    List <Mobile> moblist = new List <Mobile>();

                    foreach (Mobile m in m_LMP.Map.GetMobilesInRange(m_LMP.Location, 1))                                            // Edit by Silver: Changed range from 2 to 1
                    {
                        if (m.Player && m.Alive && m.AccessLevel == AccessLevel.Player && m.Z + 2 >= m_LMP.Z && m.Z - 5 <= m_LMP.Z) // Edit by Silver: Z-check
                        {
                            moblist.Add(m);
                        }
                    }

                    for (int i = moblist.Count - 1; i >= 0; i--)
                    {
                        Mobile m = moblist[i];
                        if (m.Hidden)
                        {
                            m.Kill();
                            moblist.RemoveAt(i);
                        }
                    }

                    if (moblist.Count == 1)
                    {
                        if (moblist[0] == m_Winner)
                        {
                            if (m_ConsWinner == 0)
                            {
                                CommandHandlers.BroadcastMessage(AccessLevel.Player, 1150, m_Winner.Name + String.Format(" was appointed as the sole person standing on the {0} pentagram!", m_Location));
                            }
                            else
                            {
                                message = m_Winner.Name + String.Format(" was appointed as the sole person standing on the {0} pentagram!", m_Location);
                            }
                            m_ConsWinner++;
                        }
                        else
                        {
                            m_Winner     = moblist[0];
                            m_ConsWinner = 0;
                        }

                        if (m_ConsWinner >= m_TimerTicksRequired)
                        {
                            CommandHandlers.BroadcastMessage(AccessLevel.Player, 1150, m_Winner.Name + " has won the pentagram event.");

                            /*	GoldMarkCoin p = new GoldMarkCoin();
                             *      p.Amount = 1000;
                             *
                             *      m_Winner.BankBox.DropItem(p);
                             *      m_Winner.SendMessage("You have won the pentagram event and 1000 Marks have been deposited into your bankbox.");
                             */
                            message = "";
                            Stop();
                        }
                    }

                    else
                    {
                        m_ConsWinner = 0;
                        if (Utility.Random(6) == 0)
                        {
                            CommandHandlers.BroadcastMessage(AccessLevel.Player, 1150, String.Format("No person could be appointed to be the only one standing on the {0} pentagram", m_Location));
                        }
                        else
                        {
                            message = String.Format("No person could be appointed to be the only one standing on the {0} pentagram", m_Location);
                        }
                    }
                }

                List <Mobile> mobilelist = new List <Mobile>();

                foreach (Mobile m in m_LMP.Map.GetMobilesInRange(m_LMP.Location, 20))
                {
                    if (m.Player && m.Alive)
                    {
                        mobilelist.Add(m);
                    }
                }

                foreach (Mobile m in mobilelist)
                {
                    if (!m.Criminal && m.AccessLevel == AccessLevel.Player)
                    {
                        m.Criminal = true;
                    }

                    if (message != "")
                    {
                        m.SendMessage(message);
                    }
                }
            }
コード例 #29
0
ファイル: AutoSave.cs プロジェクト: Volk1nson/imaginenation
        public static void Save(bool permitBackgroundWrite)
        {
            if (AutoRestart.Restarting)
            {
                return;
            }

            World.WaitForWriteCompletion();

            // should world.save be allowed to occur at this time?
            if (NoIOHour != -1)
            {
                DateTime now = DateTime.Now;

                if (now.Hour == NoIOHour)
                {
                    // DEBUG
                    Console.WriteLine("AutoSave.cs : NoIOHour : Saving not allowed during hour {0}.", NoIOHour);

                    return;
                }
            }

#if USESGUMP
            ArrayList mobs = new ArrayList(World.Mobiles.Values);
            foreach (Mobile m in mobs)
            {
                if (m != null && m is PlayerMobile)
                {
                    m.SendGump(new SaveGump());   // change to the name of your custom save gump if you have one
                }
            }
#endif

#if CHECKFREEDISK
            string[] rootdriv  = Core.BaseDirectory.Split('\\');
            string   rootdrive = rootdriv[0] + "\\";

            // get size of Saves directory.
            long savesize = directorySize(Path.Combine(Core.BaseDirectory, "Saves"));

            long freeBytesAvailable = 0;
            bool worked             = false;


            DriveInfo r = new DriveInfo(rootdrive);
            if (r.IsReady)
            {
                freeBytesAvailable = r.AvailableFreeSpace;

                worked = true;
            }


            long totalBytes = 0;

            if (worked)
            {
                totalBytes = freeBytesAvailable;
            }
            else
            {
                totalBytes = 1000000000;  // 1 gig
            }
            // DEBUG
            //Console.WriteLine( "\n\nrootdrive: {0}", rootdrive );
            //Console.WriteLine( "freeBytesAvailable: {0:n}", freeBytesAvailable );
            //Console.WriteLine( "savesize: {0:n}\n\n", savesize );


            // m_Archive may point to a different drive than the one RunUO is on...


            long   atotalBytes = 0;
            string arootdrive  = "";

            if (m_Archive != null)
            {
                string[] arootdriv = m_Archive.Split('\\');
                arootdrive = arootdriv[0] + "\\";

                if (arootdrive == rootdrive)
                {
                    atotalBytes = totalBytes;
                }
                else
                {
                    worked = false;  // reset

                    DriveInfo a = new DriveInfo(rootdrive);
                    if (a.IsReady)
                    {
                        freeBytesAvailable = a.AvailableFreeSpace;

                        worked = true;
                    }

                    if (worked)
                    {
                        atotalBytes = freeBytesAvailable;
                    }
                    else
                    {
                        atotalBytes = 1000000000;  // 1 gig - fudge it
                    }
                }

                // DEBUG
                //Console.WriteLine( "arootdrive: {0}", arootdrive );
                //Console.WriteLine( "atotalBytes: {0:n}\n\n", atotalBytes );
            }


            // ARCHIVE
            // * 4 for fudge factor
            if (m_Archive != null && atotalBytes > (savesize * 4))
            {
#endif
            if (m_Archive != null)
            {
                try { Archive(); }
                catch { Console.WriteLine("AutoSave.cs : Save() : try Archive() :\n Archive attempt failed!"); }
            }
#if CHECKFREEDISK
        }

        else if (m_Archive != null)
        {
            Console.WriteLine("Error! Not enough free disk space left on {0} to Archive!", arootdrive);
            CommandHandlers.BroadcastMessage(m_Notify, 33, String.Format("[AutoSave.cs] Error! Not enough free disk space left on {0} to Archive!", arootdrive));
        }


        /*
         * Something tells me I should not be checking for free disk space during a
         * backup, since in the majority of cases, backups will be overwriting
         * existing backups and thus not using any additional space. Also, removing
         * the old Saves directory may be necessary, and it is Backup() which does
         * that. Leaving this feature commented out for now. There is a try command
         * wrapping it, so that should prevent a crash...
         */
        // BACKUP
        // * for fudge factor
        //	if ( totalBytes > ( savesize * 2 ) )
        //	{
#endif
            try { Backup(); }
            catch { Console.WriteLine("AutoSave.cs : Save() : try Backup() :\n Backup attempt failed!"); }
#if CHECKFREEDISK
            //	}
            //	else
            //	{
            //		Console.WriteLine( "Error! Not enough free disk space left on {0} to Backup!", rootdrive );
            //		CommandHandlers.BroadcastMessage( m_Notify, 33, String.Format( "[AutoSave.cs] Error! Not enough free disk space left on {0} to Backup!", rootdrive ) );
            //	}


            // SAVE
            // * 2 for fudge factor
            if (totalBytes > (savesize * 2))
            {
#endif
            World.Save(true, permitBackgroundWrite);
#if CHECKFREEDISK
        }
        else
        {
            Console.WriteLine("Error! Not enough free disk space left on {0} to Save!", rootdrive);
            CommandHandlers.BroadcastMessage(m_Notify, 33, String.Format("[AutoSave.cs] Error! Not enough free disk space left on {0} to Save!", rootdrive));
        }
#endif

#if USESGUMP
            // Comment these lines out to keep your save
            // gump up after the save has completed.
            foreach (Mobile m in mobs)
            {
                if (m != null && m is PlayerMobile)
                {
                    m.CloseGump(typeof(SaveGump));
                }
            }
#endif
        }
コード例 #30
0
        private void IRCCommands(UserInfo User, string message)
        {
            if (message.ToLower().StartsWith("!bcast "))
            {
                string bcast = Regex.Replace(message, "!bcast ", "", RegexOptions.IgnoreCase);

                CommandHandlers.BroadcastMessage(AccessLevel.Player, announcementHue, String.Format("Staff message from {0}:", User.Nick));
                CommandHandlers.BroadcastMessage(AccessLevel.Player, announcementHue, bcast);
                connection.Sender.PublicMessage(chatChannel, String.Format("In game broadcast from {0}: 5{1}", User.Nick, bcast));
                return;
            }

            if (message.ToLower().StartsWith("!bcastname "))
            {
                string   bcast      = Regex.Replace(message, "!bcastname ", "", RegexOptions.IgnoreCase);
                string[] splitbcast = bcast.Split(' ');
                bcast = bcast.Replace(splitbcast[0], "");
                CommandHandlers.BroadcastMessage(AccessLevel.Player, announcementHue, String.Format("Staff message from {0}:", splitbcast[0]));
                CommandHandlers.BroadcastMessage(AccessLevel.Player, announcementHue, bcast);
                connection.Sender.PublicMessage("#Comraich", String.Format("In game broadcast from {0}:5{1}", splitbcast[0], bcast));
                return;
            }

            if (message.ToLower().StartsWith("!bcastnoname "))
            {
                string bcast = Regex.Replace(message, "!bcastnoname ", "", RegexOptions.IgnoreCase);
                CommandHandlers.BroadcastMessage(AccessLevel.Player, announcementHue, "Staff message:");
                CommandHandlers.BroadcastMessage(AccessLevel.Player, announcementHue, bcast);
                connection.Sender.PublicMessage(chatChannel, String.Format("In game broadcast: 5{0}", bcast));
                return;
            }

            if (message.ToLower().StartsWith("!chanserv "))
            {
                string command = Regex.Replace(message, "!chanserv ", "", RegexOptions.IgnoreCase);
                connection.Sender.PrivateMessage("chanserv", String.Format("{0}", command));
                return;
            }

            if (message.ToLower().StartsWith("!pages"))
            {
                int pages = PageQueue.List.Count;
                connection.Sender.PublicMessage(staffChannel, String.Format("5There are {0} pages in the queue.", pages));
                return;
            }

            /*if ( message.ToLower().StartsWith( "!createaccount" ) ) {
             *  string email = Regex.Replace( message, "!createaccount ", "", RegexOptions.IgnoreCase );
             *
             *  if ( email.Length < 1 || !email.Contains( "@" ) ) {
             *      connection.Sender.PublicMessage( staffChannel, String.Format( "5Not a valid email address." ) );
             *      return;
             *  }
             *
             *  MailAddress address = new MailAddress( email );
             *
             *  string acctName = address.User.ToLower();
             *  if ( acctName.Length > 12 )
             *      acctName = address.User.ToLower().Substring( 0, 12 );
             *
             *  IAccount account = Accounts.GetAccount( acctName );
             *
             *  if ( account == null ) {
             *      connection.Sender.PublicMessage( staffChannel, String.Format( "5Creating account for email {0}.", email ) );
             *      Mobile dummy = new Slime();
             *      dummy.Name = "ComBot Dummy";
             *      Server.CustomCommands.MakeAccount( email, dummy );
             *      dummy.Delete();
             *
             *      account = Accounts.GetAccount( acctName );
             *
             *      if ( account != null )
             *          connection.Sender.PublicMessage( staffChannel, String.Format( "5Account created.", email ) );
             *      else
             *          connection.Sender.PublicMessage( staffChannel, String.Format( "5Could not create account. Invalid email or already existing account.", email ) );
             *
             *
             *  }
             *  else
             *      connection.Sender.PublicMessage( staffChannel, String.Format( "5Account name {0} already exists.", acctName ) );
             *
             *
             *  return;
             * }*/
        }