예제 #1
0
		/// <summary>
		/// Sends EnterDynamicRegion to creature's client.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="warpFromRegionId"></param>
		/// <param name="warpToRegion"></param>
		public static void EnterDynamicRegion(Creature creature, int warpFromRegionId, Region warpToRegion, int x, int y)
		{
			var warpTo = warpToRegion as DynamicRegion;
			if (warpTo == null)
				throw new ArgumentException("EnterDynamicRegion requires a dynamic region.");

			var pos = creature.GetPosition();

			var packet = new Packet(Op.EnterDynamicRegion, MabiId.Broadcast);
			packet.PutLong(creature.EntityId);
			packet.PutInt(warpFromRegionId); // creature's current region or 0?

			packet.PutInt(warpToRegion.Id);
			packet.PutString(warpToRegion.Name); // dynamic region name
			packet.PutUInt(0x80000000); // bitmask? (|1 = time difference?)
			packet.PutInt(warpTo.BaseId);
			packet.PutString(warpTo.BaseName);
			packet.PutInt(200); // 100|200 (100 changes the lighting?)
			packet.PutByte(0); // 1 = next is empty?
			packet.PutString("data/world/{0}/{1}", warpTo.BaseName, warpTo.Variation);

			packet.PutByte(0);
			//if (^ true)
			//{
			//	pp.PutByte(1);
			//	pp.PutInt(3100); // some region id?
			//}
			packet.PutInt(x); // target x pos
			packet.PutInt(y); // target y pos

			creature.Client.Send(packet);
		}
예제 #2
0
		/// <summary>
		/// Sends CharacterUnlock to creature's client.
		/// </summary>
		public static void CharacterUnlock(Creature creature, Locks type)
		{
			var packet = new Packet(Op.CharacterUnlock, creature.EntityId);
			packet.PutUInt((uint)type);

			creature.Client.Send(packet);
		}
예제 #3
0
		/// <summary>
		/// Sends system message (special Chat) to creature's client.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="from"></param>
		/// <param name="format"></param>
		/// <param name="args"></param>
		private static void SystemMessage(Creature creature, string from, string format, params object[] args)
		{
			var packet = new Packet(Op.Chat, creature.EntityId);
			packet.PutByte(0);
			packet.PutString(from);
			packet.PutString(format, args);
			packet.PutByte(true);
			packet.PutUInt(0xFFFF8080);
			packet.PutInt(0);
			packet.PutByte(0);

			creature.Client.Send(packet);
		}
예제 #4
0
		public static void System_Broadcast(string from, string format, params object[] args)
		{
			var packet = new Packet(Op.Chat, MabiId.Broadcast);
			packet.PutByte(0);
			packet.PutString("<{0}>", from);
			packet.PutString(format, args);
			packet.PutByte(true);
			packet.PutUInt(0xFFFF8080);
			packet.PutInt(0);
			packet.PutByte(0);

			ChannelServer.Instance.World.Broadcast(packet);
		}
예제 #5
0
        /// <summary>
        /// Sends Chat in range of creature.
        /// </summary>
        /// <param name="creature">Source, in terms of name and position</param>
        /// <param name="format"></param>
        /// <param name="args"></param>
        public static void Chat(Creature creature, string format, params object[] args)
        {
            var packet = new Packet(Op.Chat, creature.EntityId);
            packet.PutByte(0); // speech (0) vs thought (1) bubble
            packet.PutString(creature.Name);
            packet.PutString(format, args);

            // The following part is not required for normal chat

            packet.PutByte(0); // 1 hides chat bubble and enables --v
            packet.PutUInt(0); // custom color (supports alpha transparency, FF is 100% opaque)

            packet.PutInt(0);
            packet.PutByte(0);

            creature.Region.Broadcast(packet, creature);
        }
예제 #6
0
		public static void System_Broadcast(string from, string format, params object[] args)
		{
			var packet = new Packet(Op.Chat, MabiId.Broadcast);

			foreach (var msg in string.Format(format, args).Chunkify(100)) // Mabi displays up to 100 chars
			{
				packet.PutByte(0);
				packet.PutString("<{0}>", from);
				packet.PutString(msg);
				packet.PutByte(true);
				packet.PutUInt(0xFFFF8080);
				packet.PutInt(0);
				packet.PutByte(0);

				ChannelServer.Instance.World.Broadcast(packet);

				packet.Clear(packet.Op, packet.Id);
			}
		}
예제 #7
0
		/// <summary>
		/// Broadcasts Effect in range of creature, with the given packet id.
		/// </summary>
		/// <remarks>
		/// Parameters have to be casted to the proper type, use carefully!
		/// </remarks>
		/// <param name="id"></param>
		/// <param name="entity"></param>
		/// <param name="effectId"></param>
		/// <param name="parameters"></param>
		public static void Effect(long id, Entity entity, int effectId, params object[] parameters)
		{
			var packet = new Packet(Op.Effect, id);
			packet.PutInt(effectId);
			foreach (var p in parameters)
			{
				if (p is byte) packet.PutByte((byte)p);
				else if (p is bool) packet.PutByte((bool)p);
				else if (p is short) packet.PutShort((short)p);
				else if (p is ushort) packet.PutUShort((ushort)p);
				else if (p is int) packet.PutInt((int)p);
				else if (p is uint) packet.PutUInt((uint)p);
				else if (p is long) packet.PutLong((long)p);
				else if (p is ulong) packet.PutULong((ulong)p);
				else if (p is float) packet.PutFloat((float)p);
				else if (p is string) packet.PutString((string)p);
				else
					throw new Exception("Unsupported effect parameter: " + p.GetType());
			}

			entity.Region.Broadcast(packet, entity);
		}
예제 #8
0
		/// <summary>
		/// Sends system message (special Chat) to creature's client.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="from"></param>
		/// <param name="format"></param>
		/// <param name="args"></param>
		private static void SystemMessage(Creature creature, string from, string format, params object[] args)
		{
			var packet = new Packet(Op.Chat, creature.EntityId);

			foreach (var msg in string.Format(format, args).Chunkify(100)) // Mabi displays up to 100 chars
			{
				packet.PutByte(0);
				packet.PutString(from);
				packet.PutString(msg);
				packet.PutByte(true);
				packet.PutUInt(0xFFFF8080);
				packet.PutInt(0);
				packet.PutByte(0);

				creature.Client.Send(packet);

				packet.Clear(packet.Op, packet.Id);
			}
		}
예제 #9
0
		/// <summary>
		/// Sends GuildCreateGuildRobeUpdate to creature's client.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="emblemMark"></param>
		/// <param name="emblemOutline"></param>
		/// <param name="stripes"></param>
		/// <param name="robeColor"></param>
		/// <param name="badgeColor"></param>
		/// <param name="emblemMarkColor"></param>
		/// <param name="emblemOutlineColor"></param>
		/// <param name="stripesColor"></param>
		public static void GuildCreateGuildRobeUpdate(Creature creature, byte emblemMark, byte emblemOutline, byte stripes, uint robeColor, byte badgeColor, byte emblemMarkColor, byte emblemOutlineColor, byte stripesColor, bool success)
		{
			var packet = new Packet(Op.GuildCreateGuildRobeUpdate, creature.EntityId);
			packet.PutByte(emblemMark);
			packet.PutByte(emblemOutline);
			packet.PutByte(stripes);
			packet.PutUInt(robeColor);
			packet.PutByte(badgeColor);
			packet.PutByte(emblemMarkColor);
			packet.PutByte(emblemOutlineColor);
			packet.PutByte(stripesColor);
			packet.PutByte(success);

			creature.Client.Send(packet);
		}
예제 #10
0
		/// <summary>
		/// Sends GuildOpenGuildRobeCreation to creature's client.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="amount"></param>
		public static void GuildOpenGuildCreation(Creature creature, long entityId, string guildName, uint color)
		{
			var packet = new Packet(Op.GuildOpenGuildRobeCreation, creature.EntityId);
			packet.PutLong(entityId);
			packet.PutString(guildName);
			packet.PutUInt(color);
			packet.PutByte(0);

			creature.Client.Send(packet);
		}
예제 #11
0
파일: Send.cs 프로젝트: aura-project/aura
		/// <summary>
		/// Sends xInfoRequestR to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="op"></param>
		/// <param name="character"></param>
		/// <param name="items"></param>
		public static void CharacterInfoRequestR(LoginClient client, int op, Character character, List<Item> items)
		{
			var packet = new Packet(op, MabiId.Login);
			packet.PutByte(character != null);

			if (character != null)
			{
				packet.PutString(character.Server);
				packet.PutLong(character.EntityId);
				packet.PutByte(1);
				packet.PutString(character.Name);
				packet.PutString("");
				packet.PutString("");
				packet.PutInt(character.Race);
				packet.PutByte(character.SkinColor);
				packet.PutShort(character.EyeType);
				packet.PutByte(character.EyeColor);
				packet.PutByte(character.MouthType);
				packet.PutUInt((uint)character.State);
				packet.PutFloat(character.Height);
				packet.PutFloat(character.Weight);
				packet.PutFloat(character.Upper);
				packet.PutFloat(character.Lower);
				packet.PutInt(0);
				packet.PutInt(0);
				packet.PutInt(0);
				packet.PutByte(0);
				packet.PutInt(0);
				packet.PutByte(0);
				packet.PutInt((int)character.Color1);
				packet.PutInt((int)character.Color2);
				packet.PutInt((int)character.Color3);
				packet.PutFloat(0.0f);
				packet.PutString("");
				packet.PutFloat(49.0f);
				packet.PutFloat(49.0f);
				packet.PutFloat(0.0f);
				packet.PutFloat(49.0f);
				// [180800, NA196 (14.10.2014)] ?
				{
					packet.PutShort(0);
				}
				packet.PutInt(0);
				packet.PutInt(0);
				packet.PutShort(0);
				packet.PutLong(0);
				packet.PutString("");
				packet.PutByte(0);

				packet.PutInt(items.Count);
				foreach (var item in items)
				{
					packet.PutLong(item.Id);
					packet.PutBin(item.Info);
				}

				packet.PutInt(0);  // PetRemainingTime
				packet.PutLong(0); // PetLastTime
				packet.PutLong(0); // PetExpireTime
			}

			client.Send(packet);
		}
예제 #12
0
		/// <summary>
		/// Sends EnterDynamicRegionExtended to creature's client.
		/// </summary>
		/// <remarks>
		/// From the looks of it this basically does the same as EnterDynamicRegion,
		/// but it supports the creation of multiple regions before warping to one.
		/// </remarks>
		/// <param name="creature"></param>
		/// <param name="warpFromRegionId"></param>
		/// <param name="warpToRegion"></param>
		public static void EnterDynamicRegionExtended(Creature creature, int warpFromRegionId, Region warpToRegion)
		{
			var warpTo = warpToRegion as DynamicRegion;
			if (warpTo == null)
				throw new ArgumentException("EnterDynamicRegionExtended requires a dynamic region.");

			var pos = creature.GetPosition();

			var packet = new Packet(Op.EnterDynamicRegionExtended, MabiId.Broadcast);
			packet.PutLong(creature.EntityId);
			packet.PutInt(warpFromRegionId); // creature's current region or 0?

			packet.PutInt(warpToRegion.Id); // target region id
			packet.PutInt(pos.X); // target x pos
			packet.PutInt(pos.Y); // target y pos
			packet.PutInt(0); // 0|4|8|16

			packet.PutInt(1); // count of dynamic regions v

			packet.PutInt(warpToRegion.Id);
			packet.PutString(warpToRegion.Name); // dynamic region name
			packet.PutUInt(0x80000000); // bitmask? (|1 = time difference?)
			packet.PutInt(warpTo.BaseId);
			packet.PutString(warpTo.BaseName);
			packet.PutInt(200); // 100|200
			packet.PutByte(0); // 1 = next is empty?
			packet.PutString("data/world/{0}/{1}", warpTo.BaseName, warpTo.Variation);

			creature.Client.Send(packet);
		}