mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	Added new search packets.
This commit is contained in:
		| @@ -264,7 +264,10 @@ | ||||
|     <Compile Include="packets\send\recruitment\EndRecruitmentPacket.cs" /> | ||||
|     <Compile Include="packets\send\recruitment\RecruiterStatePacket.cs" /> | ||||
|     <Compile Include="packets\send\recruitment\StartRecruitingResponse.cs" /> | ||||
|     <Compile Include="packets\send\search\PlayerSearchResult.cs" /> | ||||
|     <Compile Include="packets\send\search\ItemSearchResult.cs" /> | ||||
|     <Compile Include="packets\send\search\PlayerSearchCommentResultPacket.cs" /> | ||||
|     <Compile Include="packets\send\search\PlayerSearchInfoResultPacket.cs" /> | ||||
|     <Compile Include="packets\send\search\ItemSearchResultsEndPacket.cs" /> | ||||
|     <Compile Include="packets\send\search\ItemSearchResultsBodyPacket.cs" /> | ||||
|     <Compile Include="packets\send\search\ItemSearchResultsBeginPacket.cs" /> | ||||
|   | ||||
| @@ -0,0 +1,19 @@ | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| using FFXIVClassic.Common; | ||||
|  | ||||
| namespace FFXIVClassic_Map_Server.packets.send.social | ||||
| { | ||||
|     class ItemSearchClosePacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x01E1; | ||||
|         public const uint PACKET_SIZE = 0x028; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, bool isSuccess, string nameToAdd) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20];            | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,56 @@ | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| using FFXIVClassic.Common; | ||||
| using System; | ||||
| using FFXIVClassic_Map_Server.packets.send.search; | ||||
|  | ||||
| namespace FFXIVClassic_Map_Server.packets.send.social | ||||
| { | ||||
|     class PlayerSearchCommentResultPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x01E0; | ||||
|         public const uint PACKET_SIZE = 0x288; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint searchSessionId, byte resultCode, PlayerSearchResult[] results, ref int offset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             byte count = 0; | ||||
|  | ||||
|             for (int i = offset; i < results.Length; i++) | ||||
|             { | ||||
|                 int size = 3 + (Encoding.ASCII.GetByteCount(results[i].comment) >= 597 ? 596 : Encoding.ASCII.GetByteCount(results[i].comment)); | ||||
|  | ||||
|                 if (size >= 600) | ||||
|                     break; | ||||
|  | ||||
|                 count++; | ||||
|             } | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     for (int i = offset; i < count; i++) | ||||
|                     { | ||||
|                         binWriter.Write((UInt32)searchSessionId); | ||||
|                         binWriter.Write((Byte)count); | ||||
|                         binWriter.Seek(1, SeekOrigin.Current); | ||||
|                         binWriter.Write((Byte)resultCode); | ||||
|                         binWriter.Seek(4, SeekOrigin.Current); | ||||
|  | ||||
|                         binWriter.Write((Byte)i); | ||||
|                         binWriter.Write((UInt16)(Encoding.ASCII.GetByteCount(results[i].comment) >= 597 ? 596 : Encoding.ASCII.GetByteCount(results[i].comment))); | ||||
|                         binWriter.Write(Encoding.ASCII.GetBytes(results[i].comment), 0, Encoding.ASCII.GetByteCount(results[i].comment) >= 597 ? 596 : Encoding.ASCII.GetByteCount(results[i].comment)); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             offset += count; | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,56 @@ | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| using FFXIVClassic.Common; | ||||
| using System; | ||||
| using FFXIVClassic_Map_Server.packets.send.search; | ||||
|  | ||||
| namespace FFXIVClassic_Map_Server.packets.send.social | ||||
| { | ||||
|     class PlayerSearchInfoResultPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x01DF; | ||||
|         public const uint PACKET_SIZE = 0x3C8; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint searchSessionId, byte resultCode, PlayerSearchResult[] results, ref int offset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             byte count; | ||||
|  | ||||
|             if (results.Length - offset < 8) | ||||
|                 count = (byte)(results.Length - offset); | ||||
|             else | ||||
|                 count = 8; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     for (int i = offset; i < count; i++) | ||||
|                     { | ||||
|                         long start = binWriter.BaseStream.Position; | ||||
|                         binWriter.Write((Byte)results[i].preferredClass); | ||||
|                         binWriter.Write((Byte)0); | ||||
|                         binWriter.Write((Byte)results[i].clientLanguage); | ||||
|                         binWriter.Write((UInt16)results[i].currentZone); | ||||
|                         binWriter.Write((Byte)results[i].initialTown); | ||||
|                         binWriter.Write((Byte)0); | ||||
|                         binWriter.Write((Byte)results[i].status); | ||||
|                         binWriter.Write((Byte)results[i].currentClass); | ||||
|                         binWriter.Write((Byte)0); | ||||
|                         binWriter.Write(Encoding.ASCII.GetBytes(results[i].name), 0, Encoding.ASCII.GetByteCount(results[i].name) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(results[i].name)); | ||||
|                         binWriter.Seek((int)(start + 30), SeekOrigin.Begin); | ||||
|                         //classes | ||||
|                         binWriter.Seek((int)(start + 30 + 20), SeekOrigin.Begin); | ||||
|                         //jobs | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             offset += count; | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,24 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| namespace FFXIVClassic_Map_Server.packets.send.search | ||||
| { | ||||
|     class PlayerSearchResult | ||||
|     { | ||||
|         public string name; | ||||
|         public string comment; | ||||
|  | ||||
|         public byte preferredClass; | ||||
|         public byte clientLanguage; | ||||
|         public byte initialTown; | ||||
|         public byte status; | ||||
|         public byte currentClass; | ||||
|         public ushort currentZone; | ||||
|  | ||||
|  | ||||
|  | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,19 @@ | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| using FFXIVClassic.Common; | ||||
|  | ||||
| namespace FFXIVClassic_Map_Server.packets.send.social | ||||
| { | ||||
|     class RetainerResultBodyPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x01DB; | ||||
|         public const uint PACKET_SIZE = 0x028; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, bool isSuccess, string nameToAdd) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20];            | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,20 @@ | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| using FFXIVClassic.Common; | ||||
|  | ||||
| namespace FFXIVClassic_Map_Server.packets.send.social | ||||
| { | ||||
|     class RetainerResultEndPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x01DA; | ||||
|         public const uint PACKET_SIZE = 0x038; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, bool isSuccess) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|             data[16] = (byte) (isSuccess ? 1 : 0); | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,21 @@ | ||||
| using System.IO; | ||||
| using System.Text; | ||||
| using System; | ||||
| using FFXIVClassic.Common; | ||||
| using FFXIVClassic_Map_Server.packets.send.search; | ||||
| using System.Collections.Generic; | ||||
|  | ||||
| namespace FFXIVClassic_Map_Server.packets.send.social | ||||
| { | ||||
|     class RetainerResultUpdatePacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x01DC; | ||||
|         public const uint PACKET_SIZE = 0x028; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, bool isSuccess, string nameToAdd) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user