Exemplo n.º 1
0
        protected override void OnBattleEnded(DateTime when)
        {
            Winners = GetWinningTeams().ToArray();

            if (StatisticsCache.Count > 0)
            {
                /*foreach (PlayerMobile player in StatisticsCache.Keys)
                 * {
                 *  PlayerEventScoreProfile eventprofile = EventScores.EnsureProfile(player);
                 *  eventprofile.AddBattle(Name, (int) StatisticsCache[player].PointsGained, player);
                 * }*/

                foreach (BattleResultsGump g in
                         StatisticsCache.Keys.With(Spectators).Select(CreateResultsGump).Where(g => g != null))
                {
                    g.Send();
                }

                SendResultsToCameras();
            }

            if (GiveTrophies)
            {
                AwardTrophies();

                if (PlayerStarted)
                {
                    GiveTrophies = false;
                }
            }

            base.OnBattleEnded(when);

            Hidden = true;

            if (PlayerStarted)
            {
                //Hidden = !IgnoreCapacity && (Schedule == null || !Schedule.Enabled || !Schedule.Running);

                //Hidden will probably always be false anyways.  I cannot forsee a case where it will be playerstarted and not be hidden

                PlayerStarted = false;
            }

            if (ThrowableMode)
            {
                if (_Axes != null)
                {
                    foreach (KeyValuePair <PlayerMobile, ThrowableAxe> kvp in _Axes.Where(kvp => kvp.Value != null))
                    {
                        kvp.Value.Delete();
                    }
                    _Axes.Clear();
                }
            }

            ActionCams.ForceToNormalCams();
        }
Exemplo n.º 2
0
        protected override void OnBattlePreparing(DateTime when)
        {
            base.OnBattlePreparing(when);

            foreach (GlobalJoinGump g in
                     NetState.Instances.Select(s => s.Mobile)
                     .OfType <PlayerMobile>()
                     .Not(m => IsQueued(m) || IsParticipant(m) || ActionCams.IsCamera(m) || CentralGump.EnsureProfile(m).IgnoreBattles)
                     .Select(CreateJoinGump)
                     .Where(g => g != null))
            {
                g.Send();
            }
        }
Exemplo n.º 3
0
        protected override void OnBattleOpened(DateTime when)
        {
            base.OnBattleOpened(when);

            if (PlayerStarted)
            {
                GiveTrophies = true;
            }

            foreach (GlobalJoinGump g in
                     NetState.Instances.Select(s => s.Mobile)
                     .OfType <PlayerMobile>()
                     .Not(m => IsQueued(m) || ActionCams.IsCamera(m) || CentralGump.EnsureProfile(m).IgnoreBattles)
                     .Select(CreateJoinGump)
                     .Where(g => g != null))
            {
                g.Send();
            }
        }
Exemplo n.º 4
0
        protected override void OnBattleCancelled(DateTime when)
        {
            if (GiveTrophies && PlayerStarted)
            {
                GiveTrophies = false;
            }

            base.OnBattleCancelled(when);

            Hidden = true;

            if (PlayerStarted)
            {
                //Hidden = !IgnoreCapacity && (Schedule == null || !Schedule.Enabled || !Schedule.Running);

                PlayerStarted = false;
            }

            ActionCams.ForceToNormalCams();
        }
Exemplo n.º 5
0
        private static void SendWarning(Mobile m, string speech, bool jailed, bool banned)
        {
            if (m == null || m.Deleted || !m.Player || String.IsNullOrWhiteSpace(speech))
            {
                return;
            }

            string message;

            if (CMOptions.NotifyStaff)
            {
                message = "[Warning: Advertising Detected]: " + GetDetectedString(m, speech, jailed, banned);

                NetState.Instances.AsParallel()
                .Where(
                    ns => ns != null && ns.Mobile != null && ns.Mobile is PlayerMobile && !ns.Mobile.Deleted && ns.Mobile.AccessLevel >= CMOptions.NotifyAccess && !ActionCams.IsCamera(ns.Mobile as PlayerMobile))
                .ForEach(ns => ns.Mobile.SendNotification <AntiAdvertNotifyGump>(message, false, color: Color.OrangeRed));
            }

            if (CMOptions.NotifyPlayer)
            {
                var pm = m as PlayerMobile;

                if (pm == null)
                {
                    return;
                }

                message = String.Empty;

                message += "A recent check shows that you may be trying to advertise on " + ServerList.ServerName + ".\n";
                message += "Advertising is not allowed.\n";

                if (jailed)
                {
                    message += "You have been jailed until a member of staff can review your case.\n";
                    message += "If you are found to be innocent, you will be promptly released and free to adventure again.\n";
                }
                else
                {
                    message += "A report has been submitted to the staff team for review.\n";
                }

                message += "\nOffending Speech:\n" + speech;

                new NoticeDialogGump(pm)
                {
                    Width          = 420,
                    Height         = 420,
                    CanMove        = false,
                    CanDispose     = false,
                    BlockSpeech    = true,
                    RandomButtonID = true,
                    Title          = jailed ? "Jailed! Why?" : "Advertising Reported",
                    Html           = message
                }.Send();
            }
        }
Exemplo n.º 6
0
        protected override void OnBattleStarted(DateTime when)
        {
            base.OnBattleStarted(when);

            ActionCams.ForcetoBattleCams();
        }
Exemplo n.º 7
0
 public override bool CanSendInvite(PlayerMobile pm)
 {
     return(base.CanSendInvite(pm) && !ActionCams.IsCamera(pm));
 }
Exemplo n.º 8
0
        private void SendToStaffMessage(Mobile from, string text)
        {
            Packet p = null;

            foreach (NetState ns in from.GetClientsInRange(8))
            {
                Mobile mob = ns.Mobile;

                if (mob != null && mob.AccessLevel >= AccessLevel.GameMaster && mob.AccessLevel > from.AccessLevel && mob.Party != this && !m_Listeners.Contains(mob) && !ActionCams.IsCamera(mob as PlayerMobile))
                {
                    if (p == null)
                    {
                        p = Packet.Acquire(new UnicodeMessage(from.Serial, from.Body, MessageType.Regular, from.SpeechHue, 3, from.Language, from.Name, text));
                    }

                    ns.Send(p);
                }
            }

            Packet.Release(p);
        }