mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	Added new packets for controlling BG objects. Added group delete packet. Fixed crash if tried to warp to non-existent zone. Added a create LS db method.
This commit is contained in:
		| @@ -1258,6 +1258,43 @@ namespace FFXIVClassic_Map_Server | ||||
|             return cheevosPacket.BuildPacket(player.actorId); | ||||
|         } | ||||
|  | ||||
|         public static bool CreateLinkshell(Player player, string lsName, ushort lsCrest) | ||||
|         { | ||||
|             bool success = false; | ||||
|             using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD))) | ||||
|             { | ||||
|                 try | ||||
|                 { | ||||
|                     conn.Open(); | ||||
|  | ||||
|                     string query = @" | ||||
|                                     INSERT INTO server_linkshells                                     | ||||
|                                     (name, master, crest) | ||||
|                                     VALUES | ||||
|                                     (@lsName, @master, @crest) | ||||
|                                     ; | ||||
|                                     "; | ||||
|  | ||||
|                     MySqlCommand cmd = new MySqlCommand(query, conn); | ||||
|                     cmd.Parameters.AddWithValue("@lsName", lsName); | ||||
|                     cmd.Parameters.AddWithValue("@master", player.actorId); | ||||
|                     cmd.Parameters.AddWithValue("@crest", lsCrest);                     | ||||
|  | ||||
|                     cmd.ExecuteNonQuery(); | ||||
|                     success = true; | ||||
|                 } | ||||
|                 catch (MySqlException e) | ||||
|                 { | ||||
|                     Program.Log.Error(e.ToString()); | ||||
|                 } | ||||
|                 finally | ||||
|                 { | ||||
|                     conn.Dispose(); | ||||
|                 } | ||||
|             } | ||||
|             return success; | ||||
|         } | ||||
|  | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -201,6 +201,8 @@ | ||||
|     <Compile Include="packets\send\actor\SetActorIconPacket.cs" /> | ||||
|     <Compile Include="packets\send\actor\SetActorIdleAnimationPacket.cs" /> | ||||
|     <Compile Include="packets\send\actor\SetActorStatusPacket.cs" /> | ||||
|     <Compile Include="packets\send\actor\_0xD9Packet.cs" /> | ||||
|     <Compile Include="packets\send\actor\_0xD8Packet.cs" /> | ||||
|     <Compile Include="packets\send\actor\_0xFPacket.cs" /> | ||||
|     <Compile Include="packets\send\groups\CreateNamedGroup.cs" /> | ||||
|     <Compile Include="packets\send\groups\CreateNamedGroupMultiple.cs" /> | ||||
| @@ -208,6 +210,7 @@ | ||||
|     <Compile Include="packets\send\events\KickEventPacket.cs" /> | ||||
|     <Compile Include="packets\send\events\RunEventFunctionPacket.cs" /> | ||||
|     <Compile Include="packets\send\GameMessagePacket.cs" /> | ||||
|     <Compile Include="packets\send\groups\DeleteGroupPacket.cs" /> | ||||
|     <Compile Include="packets\send\groups\GroupHeaderPacket.cs" /> | ||||
|     <Compile Include="packets\send\groups\GroupMember.cs" /> | ||||
|     <Compile Include="packets\send\groups\GroupMembersBeginPacket.cs" /> | ||||
|   | ||||
							
								
								
									
										29
									
								
								FFXIVClassic Map Server/packets/send/Actor/_0xD8Packet.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								FFXIVClassic Map Server/packets/send/Actor/_0xD8Packet.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| using System.IO; | ||||
|  | ||||
| using FFXIVClassic.Common; | ||||
| using System; | ||||
|  | ||||
| namespace  FFXIVClassic_Map_Server.packets.send.actor | ||||
| { | ||||
|     class _0xD8Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x00D8; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, uint val1, uint val2) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)val1); | ||||
|                     binWriter.Write((UInt32)val2); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, targetActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										29
									
								
								FFXIVClassic Map Server/packets/send/Actor/_0xD9Packet.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								FFXIVClassic Map Server/packets/send/Actor/_0xD9Packet.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| using System.IO; | ||||
|  | ||||
| using FFXIVClassic.Common; | ||||
| using System; | ||||
| using System.Text; | ||||
|  | ||||
| namespace  FFXIVClassic_Map_Server.packets.send.actor | ||||
| { | ||||
|     class _0xD9Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x00D9; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, string anim) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(anim), 0, Encoding.ASCII.GetByteCount(anim) >= 4 ? 4 : Encoding.ASCII.GetByteCount(anim)); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, targetActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,43 @@ | ||||
| using FFXIVClassic.Common; | ||||
| using FFXIVClassic_Map_Server.actors.group; | ||||
| 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.groups | ||||
| { | ||||
|     class DeleteGroupPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0143; | ||||
|         public const uint PACKET_SIZE = 0x40; | ||||
|  | ||||
|         public static SubPacket buildPacket(uint playerActorID, Group group) | ||||
|         { | ||||
|             return buildPacket(playerActorID, group.groupId); | ||||
|         } | ||||
|  | ||||
|         public static SubPacket buildPacket(uint playerActorID, ulong groupId) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     //Write control num ???? | ||||
|                     binWriter.Write((UInt64)3); | ||||
|  | ||||
|                     //Write Ids | ||||
|                     binWriter.Write((UInt64)groupId); | ||||
|                     binWriter.Write((UInt64)0); | ||||
|                     binWriter.Write((UInt64)groupId); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user