예제 #1
0
        private static void JoinDeathCamEvent(PlayerMobile cam)
        {
            if (cam == null)
            {
                return;
            }

            if (DeathCams.Remove(cam))
            {
                cam.SendMessage("You have been removed from the regular death cameras list.");
            }

            if (DeathCamsEvents.ContainsKey(cam))
            {
                return;
            }

            DeathCamsEvents.Add(cam, DateTime.UtcNow);

            cam.BodyValue = 0;
            cam.Blessed   = true;
            cam.SendMessage("You are now a battle death camera.  Type [DCquit to stop.");

            cam.CloseAllGumps();

            RefreshUI(cam);
        }
예제 #2
0
        public static void AssignCams(PlayerMobile target, bool idleCams)
        {
            if (target == null || !CanView(target))
            {
                return;
            }

            DateTime now = DateTime.UtcNow;

            // Process battle cams and return, if they are in the pvp region.
            if (target.InRegion <PvPBattleRegion>())
            {
                const double idleSeconds = 5.0;

                foreach (KeyValuePair <PlayerMobile, DateTime> kv in DeathCamsEvents.ToArray())
                {
                    PlayerMobile cam  = kv.Key;
                    DateTime     time = kv.Value;

                    if (now > time && !idleCams)
                    {
                        CurrentlyViewing.AddOrReplace(cam, target);
                        DeathCamsEvents[cam] = now.AddSeconds(idleSeconds);
                    }
                    else if (now > time.AddSeconds(idleSeconds) && idleCams)
                    {
                        // if cam has been idling for longer than normal

                        CurrentlyViewing.AddOrReplace(cam, target);
                        DeathCamsEvents[cam] = now;                         // assign right away if primary threshhold is met
                    }
                }
            }
            else
            {
                const double idleSeconds = 15.0;

                // Normal (non-battle)
                foreach (KeyValuePair <PlayerMobile, DateTime> kv in DeathCams.ToArray())
                {
                    PlayerMobile cam  = kv.Key;
                    DateTime     time = kv.Value;

                    if (now > time && !idleCams)
                    {
                        CurrentlyViewing.AddOrReplace(cam, target);
                        DeathCams[cam] = now.AddSeconds(idleSeconds);
                    }
                    else if (now > time.AddSeconds(idleSeconds) && idleCams)
                    {
                        // if cam has been idling for longer than normal

                        CurrentlyViewing.AddOrReplace(cam, target);
                        DeathCams[cam] = now;                         // assign right away if primary threshhold is met
                    }
                }
            }
        }
예제 #3
0
        public static void Defragment()
        {
            DeathCams.RemoveKeyRange(cam => cam.Deleted || !cam.IsOnline());
            DeathCamsEvents.RemoveKeyRange(cam => cam.Deleted || !cam.IsOnline());

            CurrentlyViewing.RemoveKeyRange(cam => cam.Deleted || !cam.IsOnline() || !IsCamera(cam));
            CurrentlyViewing.RemoveValueRange(target => target.Deleted || !target.IsOnline() || IsCamera(target));

            PlayerMurderers.RemoveKeyRange(player => player.Deleted);
            MonsterMurderers.RemoveKeyRange(mob => mob.Deleted);
        }
예제 #4
0
        private static void QuitDeathCam(PlayerMobile cam)
        {
            if (cam == null)
            {
                return;
            }

            if (DeathCams.Remove(cam))
            {
                cam.BodyValue = cam.Race.Body(cam);
                cam.SendMessage("You have been removed from the regular death cameras list.");
            }

            if (DeathCamsEvents.Remove(cam))
            {
                cam.BodyValue = cam.Race.Body(cam);
                cam.SendMessage("You have been removed from the battles death cameras list.");
            }

            CurrentlyViewing.Remove(cam);

            CloseUI(cam);
        }
예제 #5
0
 public static bool IsCamera(PlayerMobile pm)
 {
     return(pm != null && (DeathCams.ContainsKey(pm) || DeathCamsEvents.ContainsKey(pm)));
 }