示例#1
0
		protected virtual void OnTeleported(PlayerMobile pm, Point3D oldLocation, Map oldMap)
		{
			if (pm == null || pm.Deleted)
			{
				return;
			}

			if (State == PvPBattleState.Internal || Hidden)
			{
				return;
			}

			if ((pm.InRegion(BattleRegion) || pm.InRegion(SpectateRegion)) && (IsParticipant(pm) || IsSpectator(pm)))
			{
				Negate(pm);
			}
		}
示例#2
0
		public static bool CanView(PlayerMobile target)
		{
			return target != null && !target.Deleted // Sanity
				   && !IsCamera(target) // No Cams
				   && target.Map != null && target.Map != Map.Internal // No Invalid Maps
				   && target.IsOnline() // Online Only
				   && target.InCombat(TimeSpan.FromSeconds(60.0)) // Combat Heat Only
				   && (DateTime.UtcNow - target.LastMoveTime).TotalSeconds < 60.0 // Has Moved
				   && !target.InRegion<HouseRegion>() && !target.InRegion<Jail>() // No Houses or Jail
				   && !RegionBlackList.Any(target.InRegion); // No Blacklisted Regions (By Name)
		}
示例#3
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
					}
				}
			}
		}
示例#4
0
		public virtual void InvalidateSolidHueOverride(PlayerMobile defender)
		{
			if(Deserializing || defender == null || defender.Deleted || !IsMember(defender) || !defender.InRegion(Battle.BattleRegion))
			{
				return;
			}

			defender.SolidHueOverride = (Battle.State == PvPBattleState.Preparing || Battle.State == PvPBattleState.Running) &&
										SolidHueOverride
											? Color
											: -1;

			if(defender.QuestArrow != null)
			{
				defender.QuestArrow.Stop();
			}
		}