mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	Added skeleton of "DoBattleActionPacket". Added size checks for chat message packet.
This commit is contained in:
		| @@ -0,0 +1,47 @@ | ||||
| using FFXIVClassic_Lobby_Server.packets; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| namespace FFXIVClassic_Map_Server.packets.send.actor | ||||
| { | ||||
|     class DoBattleActionPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0139; | ||||
|         public const uint PACKET_SIZE = 0x58; | ||||
|  | ||||
|         public static SubPacket buildPacket(uint playerActorID, uint targetActorID) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                    /* | ||||
|                     uint32	actionSourceId = 0; | ||||
| 		            uint32	animationId = 0; | ||||
| 		            uint32	unknown0 = 0; | ||||
| 		            uint32	unknown1 = 0; | ||||
| 		            uint32	unknown2 = 0; | ||||
| 		            uint32	unknown3 = 0; | ||||
| 		            uint32	unknown4 = 0; | ||||
| 		            float	unknown5 = 1.0f; | ||||
| 		            uint32	unknown6 = 1; | ||||
| 		            uint32	descriptionId = 0; | ||||
| 		            uint32	actionTargetId = 0; | ||||
| 		            uint16	damage = 0; | ||||
| 		            uint16	damageType = 0; | ||||
| 		            uint32	feedbackId = 0; | ||||
| 		            uint32	attackSide = 0; | ||||
|                     */ | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -38,7 +38,7 @@ namespace FFXIVClassic_Map_Server.packets.send | ||||
|             public const ushort OPCODE = 0x0003; | ||||
|             public const uint PACKET_SIZE = 0x248; | ||||
|  | ||||
|             public static SubPacket buildPacket(uint playerActorID, uint targetID, uint logtype, string sender, string message) | ||||
|             public static SubPacket buildPacket(uint playerActorID, uint targetID, uint messageType, string sender, string message) | ||||
|             { | ||||
|                 byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
| @@ -46,10 +46,15 @@ namespace FFXIVClassic_Map_Server.packets.send | ||||
|                 { | ||||
|                     using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                     { | ||||
|                         binWriter.Write(ASCIIEncoding.ASCII.GetBytes(sender)); | ||||
|                         if (Encoding.Unicode.GetByteCount(sender) >= 0x20) | ||||
|                             sender = "ERR: Too Big"; | ||||
|                         if (Encoding.Unicode.GetByteCount(message) >= 0x200) | ||||
|                             message = "ERR: Too Big"; | ||||
|  | ||||
|                         binWriter.Write(Encoding.Unicode.GetBytes(sender)); | ||||
|                         binWriter.BaseStream.Seek(0x20, SeekOrigin.Begin); | ||||
|                         binWriter.Write((UInt32)logtype); | ||||
|                         binWriter.Write(ASCIIEncoding.ASCII.GetBytes(message)); | ||||
|                         binWriter.Write((UInt32)messageType); | ||||
|                         binWriter.Write(Encoding.Unicode.GetBytes(sender)); | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user