Пример #1
0
		public static DisposableRealmPacketIn CreateFromOutPacket(BufferSegment segment, RealmPacketOut packet)
		{
			var bytes = packet.GetFinalizedPacket();
			return Create(packet.PacketId, bytes, packet.HeaderSize, bytes.Length - packet.HeaderSize, segment);
		}
Пример #2
0
		public static PinnedRealmPacketIn CreateFromOutPacket(RealmPacketOut packet)
		{
			var oldBuf = packet.GetFinalizedPacket();
			return CreateFromOutPacket(oldBuf);
		}
Пример #3
0
 public override void WriteSpecialStats(RealmPacketOut packet)
 {
     packet.WriteInt(BasesAssaulted);
     packet.WriteInt(BasesDefended);
 }
Пример #4
0
		//public override void Dispose()
		//{
		//    base.Dispose();
		//    _segment.Free();
		//}

		public static DisposableRealmPacketIn CreateFromOutPacket(RealmPacketOut packet)
		{
			var oldBuf = packet.GetFinalizedPacket();
			return CreateFromOutPacket(oldBuf, 0, oldBuf.Length);
		}
Пример #5
0
		public static void SendCharacterRenameSuccess(RealmClient client, EntityId guid, string newName)
		{
			using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_CHAR_RENAME, 10 + newName.Length))
			{
				packet.WriteByte((byte)AccountCharacterErrorCodes.ACCNT_MANIP_OK);
				packet.Write(guid.Full);
				packet.WriteCString(newName);
				client.Send(packet);
			}
		}
Пример #6
0
		public static void CreatureNameQueryRequest(RealmClient client, RealmPacketIn packet)
		{
			uint creatureEntry = packet.ReadUInt32();
			EntityId creatureEntityId = packet.ReadEntityId();

			var npc = WorldMgr.GetObject(creatureEntityId) as NPC;
			if (npc != null)
			{
				var entry = npc.Entry;
				var name = entry.Name;
				var title = entry.Title;
				var info = entry.Info;
				using (RealmPacketOut pkt = new RealmPacketOut(RealmServerOpCode.SMSG_CREATURE_QUERY_RESPONSE, 
					5 + 4 + 1 + 36 + 2 + name.Length + title.Length))
				{
					pkt.WriteUInt(creatureEntry);
					pkt.Write(name);
					pkt.WriteByte(0);							// Name2
					pkt.WriteByte(0);							// Name3
					pkt.WriteByte(0);							// Name4
					pkt.WriteCString(title);
					//pkt.WriteCString(info);
					pkt.WriteUInt(entry.Flags);
					pkt.Write((uint)entry.Type);
					pkt.WriteUInt(entry.Family);
					pkt.Write((uint)entry.Rank);
					pkt.WriteUInt(entry.UInt1);
					pkt.WriteUInt(entry.SpellDataId);
					pkt.WriteUInt(npc.DisplayId);
					pkt.Write(entry.Float1);
					pkt.Write(entry.Float2);
					pkt.WriteByte(0);
					pkt.WriteByte(entry.IsLeader);


					client.Send(pkt);
				}
			}
		}
Пример #7
0
		public static void Start()
		{
			Account acc = new Account("abc");
			//acc.InitializeAccount

			var rec = CharacterRecord.GetRecordByName("Abc");
			if (rec == null)
			{
				rec = CharacterRecord.CreateNewCharacterRecord(acc, "Abc");

				rec.Gender = (GenderType)1;
				rec.Skin = (byte)1;
				rec.Face = (byte)1;
				rec.HairStyle = (byte)1;
				rec.HairColor = (byte)1;
				rec.FacialHair = (byte)1;
				rec.Outfit = (byte)1;


				var archetype = RaceClassMgr.GetArchetype(ClassType.Warlock, RaceType.Human);

				var race = archetype.Race;

				rec.Class = archetype.Class.ClassID;
				rec.Race = race.Type;
				rec.Level = 1;
				rec.PositionX = race.StartPosition.X;
				rec.PositionY = race.StartPosition.Y;
				rec.PositionZ = race.StartPosition.Z;
				rec.Orientation = race.StartPosition.W;
				rec.CurrentMap = race.StartMap;
				rec.CurrentZone = race.StartZone;
				rec.TotalPlayTime = 0;
				rec.LevelPlayTime = 0;
				rec.TutorialFlags = new byte[32];

				uint h = 4000000;
				rec.Health = (int)h;

				if (race.Type == RaceType.BloodElf)
				{
					rec.DisplayId = race.ModelOffset - (uint)rec.Gender;
				}
				else
				{
					rec.DisplayId = race.ModelOffset + (uint)rec.Gender;
				}
				rec.SaveAndFlush();
			}

			var client = new FakeRealmClient(acc);
			var chr = new Character(acc, rec, client);

			var packet = new RealmPacketOut(RealmServerOpCode.CMSG_CAST_SPELL);
			packet.WriteUInt(3662);
			client.Receive(packet);


			packet = new RealmPacketOut(RealmServerOpCode.CMSG_CANCEL_CAST);
			packet.WriteUInt(425);
			client.Receive(packet);


			packet = new RealmPacketOut(RealmServerOpCode.CMSG_MESSAGECHAT);
			packet.WriteUInt((uint)ChatMsgType.Officer);
			packet.WriteUInt((uint)ChatLanguage.Darnassian);
			client.Receive(packet);

			var region = WorldMgr.GetRegion(MapId.Outland);
			if (region != null)
			{
				var pos = new Vector3();
				region.AddObjectInstantly(chr, ref pos);
			}
		}
Пример #8
0
		public static void SendCharacterRenameError(RealmClient client, AccountCharacterErrorCodes error)
		{
			using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_CHAR_RENAME, 1))
			{
				packet.WriteByte((byte)error);
				client.Send(packet);
			}
		}
Пример #9
0
		public override void WriteSpecialStats(RealmPacketOut packet)
		{
			packet.WriteInt(FlagCaptures); // Flag caps
			packet.WriteInt(FlagReturns); // Flag returns
		}
Пример #10
0
		public static ParsedSegment Parse(RealmPacketOut realmPacketOut, PacketSender sender, PacketDefinition def)
		{
			using (var packetIn = DisposableRealmPacketIn.CreateFromOutPacket(realmPacketOut))
			{
				//if (packetIn.PacketID == RealmServerOpCode.SMSG_COMPRESSED_MOVE)
				//{
				//    using (var movePacket = ParseCompressedMove(packetIn))
				//    {
				//        return Parse(movePacket, sender, def);
				//    }
				//}
				return Parse(packetIn, sender, def);
			}
		}
Пример #11
0
		public static ParsedSegment Parse(RealmPacketOut realmPacketOut, PacketSender sender)
		{
			return Parse(realmPacketOut, sender, PacketAnalyzer.GetDefinition(realmPacketOut.PacketId, sender));
		}
Пример #12
0
        static void DoPacketAnalyzr()
        {
            DebugHelper.Init();
            var packet = new RealmPacketOut(RealmServerOpCode.CMSG_MESSAGECHAT, 40);
            packet.Write((uint)ChatMsgType.Guild);
            packet.Write((uint)ChatLanguage.DemonTongue);
            packet.WriteCString("huhu Guild!");

            DebugHelper.DumpPacket(packet.GetFinalizedPacket());
        }
Пример #13
0
 /// <summary>
 /// Unimportant
 /// </summary>
 /// <param name="packet"></param>
 public void Send(RealmPacketOut packet)
 {
 }