Esempio n. 1
0
        public static void SendInitWorldStates(IPacketReceiver rcv, WorldStateCollection states, Zone newZone)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_INIT_WORLD_STATES, 300))
            {
                packet.Write((uint)newZone.Map.Id);
                packet.Write((uint)newZone.ParentZoneId);
                packet.Write((uint)newZone.Id);

                var countPos = packet.Position;
                packet.Position += 2;

                var count = AppendWorldStates(packet, newZone);

                packet.Position = countPos;
                packet.Write((ushort)count);

                rcv.Send(packet);
            }
        }
Esempio n. 2
0
		public override void SetZone(Zone newZone)
		{
			base.SetZone(newZone);
			if (newZone != null)
			{
				m_Map.CallDelayed(CharacterHandler.ZoneUpdateDelayMillis, () =>
				{
					if (IsInWorld && Zone == newZone)
					{
						SetZoneExplored(m_zone.Template, true);
					}
				});
			}
		}
Esempio n. 3
0
		public override void SetZone(Zone newZone)
		{
			base.SetZone(newZone);
			if (newZone != null)
			{
				m_region.CallDelayed(CharacterHandler.ZoneUpdateDelay, () =>
				{
					if (IsInWorld && Zone == newZone)
					{
						SetZoneExplored(m_zone.Info, true);
					}
				});
			}
		}
Esempio n. 4
0
		public virtual void SetZone(Zone zone)
		{
			Zone = zone;
		}
Esempio n. 5
0
		/// <summary>
		/// Lets the player join/leave the appropriate chat-channels
		/// </summary>
		/// <param name="chr">the player</param>
		private void UpdateChannels(Character chr, Zone oldZone)
		{
			var newChannels = GetChatChannels(chr.FactionGroup);
			if (oldZone != null)
			{
				var oldChannels = oldZone.GetChatChannels(chr.FactionGroup);

				if (oldZone.Template.IsCity)
				{
					ChatChannelGroup.GetGroup(chr.FactionGroup).TradeChannel.Leave(chr, false);
				}

				foreach (var oldChnl in oldChannels)
				{
					if (!newChannels.Contains(oldChnl))
					{
						oldChnl.Leave(chr, false);
					}
				}

				foreach (var newChnl in newChannels)
				{
					if (!oldChannels.Contains(newChnl))
					{
						newChnl.TryJoin(chr);
					}
				}
			}
			else
			{
				foreach (var newChnl in newChannels)
				{
					newChnl.TryJoin(chr);
				}
			}

			if (Template.IsCity)
			{
				ChatChannelGroup.GetGroup(chr.FactionGroup).TradeChannel.TryJoin(chr);
			}
		}
Esempio n. 6
0
		internal void EnterZone(Character chr, Zone oldZone)
		{
			UpdateChannels(chr, oldZone);
			WorldStateHandler.SendInitWorldStates(chr, WorldStates, this);

			if (oldZone != null)
			{
				oldZone.LeaveZone(chr);
			}

			// update PvPState
			var isBg = Map.IsBattleground;
			if (RealmServerConfiguration.ServerType.HasAnyFlag(RealmServerType.PVP | RealmServerType.RPPVP) || isBg)
			{
				if (isBg || Template.IsHostileTo(chr))
				{
				    chr.UpdatePvPState(true, true);
					chr.PlayerFlags |= PlayerFlags.PVP;
                    chr.PlayerFlags &= ~(PlayerFlags.InPvPSanctuary | PlayerFlags.FreeForAllPVP);
				}
				else if (Template.IsSanctuary)
				{
					chr.PvPState = PvPState.InPvPSanctuary;
					chr.PlayerFlags |= PlayerFlags.InPvPSanctuary;
                    chr.PlayerFlags &= ~(PlayerFlags.PVP | PlayerFlags.FreeForAllPVP);
				}
				else
				{
                    chr.UpdatePvPState(false);
                    chr.PlayerFlags &= ~(PlayerFlags.PVP | PlayerFlags.InPvPSanctuary | PlayerFlags.FreeForAllPVP);
				}

                if (Template.IsArena)
                {
                    chr.PvPState = PvPState.FFAPVP;
                    chr.PlayerFlags |= PlayerFlags.FreeForAllPVP;
                    chr.PlayerFlags &= ~(PlayerFlags.InPvPSanctuary);
                }
			}

			Template.OnPlayerEntered(chr, oldZone);
		}
Esempio n. 7
0
		internal void EnterZone(Character chr, Zone oldZone)
		{
			UpdateChannels(chr, oldZone);
			MiscHandler.SendInitWorldStates(chr, WorldStates, this);

			if (oldZone != null)
			{
				oldZone.LeaveZone(chr);
			}

			// update PvPState
			var isBg = Region.IsBattleground;
			if (RealmServerConfiguration.ServerType.HasAnyFlag(RealmServerType.PVP | RealmServerType.RPPVP) || isBg)
			{
				if (isBg || Info.IsHostileTo(chr))
				{
					chr.PvPState = PvPState.PVP;
					chr.PlayerFlags |= PlayerFlags.PVP;
				}
				else if (Info.IsSanctuary)
				{
					chr.PvPState = PvPState.InPvPSanctuary;
					chr.PlayerFlags |= PlayerFlags.InPvPSanctuary;
				}
				else
				{
					chr.PvPState = PvPState.None;
					chr.PlayerFlags &= ~(PlayerFlags.PVP | PlayerFlags.InPvPSanctuary);
				}
			}

			Info.OnPlayerEntered(chr, oldZone);
		}