mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	Updated Map Server namespace. Moved all other data folders (www and sql) to data folder. Renamed boot name to Project Meteor.
This commit is contained in:
		
							
								
								
									
										61
									
								
								Map Server/Packets/Send/Actor/ActorDoEmotePacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								Map Server/Packets/Send/Actor/ActorDoEmotePacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,61 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class ActorDoEmotePacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x00E1; | ||||
|         public const uint PACKET_SIZE = 0x30; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint targettedActorId, uint animationId, uint descriptionId) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             if (targettedActorId == 0) | ||||
|             { | ||||
|                 targettedActorId = sourceActorId; | ||||
|                 if (descriptionId != 10105) | ||||
|                     descriptionId++; | ||||
|             } | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     uint realAnimID = 0x5000000 | (animationId << 12);                     | ||||
|                     binWriter.Write((UInt32)realAnimID); | ||||
|                     binWriter.Write((UInt32)targettedActorId); | ||||
|                     binWriter.Write((UInt32)descriptionId); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             SubPacket packet = new SubPacket(OPCODE, sourceActorId, data); | ||||
|             packet.DebugPrintSubPacket(); | ||||
|             return packet; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										61
									
								
								Map Server/Packets/Send/Actor/ActorInstantiatePacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								Map Server/Packets/Send/Actor/ActorInstantiatePacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,61 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.lua; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class ActorInstantiatePacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x00CC; | ||||
|         public const uint PACKET_SIZE = 0x128; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, string objectName, string className, List<LuaParam> initParams) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     int value1 = 0x00; //Instance ID? | ||||
|                     int value2 = 0x3040; | ||||
|                     binWriter.Write((Int16)value1); | ||||
|                     binWriter.Write((Int16)value2); | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(objectName), 0, Encoding.ASCII.GetByteCount(objectName) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(objectName)); | ||||
|                     binWriter.BaseStream.Seek(0x24, SeekOrigin.Begin); | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(className), 0, Encoding.ASCII.GetByteCount(className) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(className)); | ||||
|                     binWriter.BaseStream.Seek(0x44, SeekOrigin.Begin); | ||||
|                     LuaUtils.WriteLuaParams(binWriter, initParams); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										54
									
								
								Map Server/Packets/Send/Actor/ActorSpecialGraphicPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								Map Server/Packets/Send/Actor/ActorSpecialGraphicPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,54 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class SetActorQuestGraphicPacket | ||||
|     { | ||||
|         public const int NONE            = 0x0; | ||||
|         public const int QUEST           = 0x2; | ||||
|         public const int NOGRAPHIC       = 0x3; | ||||
|         public const int QUEST_IMPORTANT = 0x4; | ||||
|  | ||||
|         public const ushort OPCODE = 0x00E3; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, int iconCode) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((Int32)iconCode); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										40
									
								
								Map Server/Packets/Send/Actor/AddActorPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								Map Server/Packets/Send/Actor/AddActorPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class AddActorPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x00CA; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, byte val) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE-0x20]; | ||||
|             data[0] = val; //Why? | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										33
									
								
								Map Server/Packets/Send/Actor/Battle/BattleAction.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								Map Server/Packets/Send/Actor/Battle/BattleAction.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| namespace FFXIVClassic_Map_Server.packets.send.actor.battle | ||||
| { | ||||
|     class BattleAction | ||||
|     { | ||||
|         public uint targetId; | ||||
|         public ushort amount; | ||||
|         public ushort worldMasterTextId; | ||||
|         public uint effectId; | ||||
|         public byte param; | ||||
|         public byte unknown; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,80 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using FFXIVClassic.Common; | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| namespace FFXIVClassic_Map_Server.packets.send.actor.battle | ||||
| { | ||||
|     class BattleActionX10Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x013A; | ||||
|         public const uint PACKET_SIZE = 0xD8; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint playerActorID, uint sourceActorId, uint animationId, ushort commandId, BattleAction[] actionList) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)sourceActorId); | ||||
|                     binWriter.Write((UInt32)animationId); | ||||
|  | ||||
|                     //Missing... last value is float, string in here as well? | ||||
|  | ||||
|                     binWriter.Seek(0x20, SeekOrigin.Begin); | ||||
|                     binWriter.Write((UInt32) actionList.Length); //Num actions (always 1 for this) | ||||
|                     binWriter.Write((UInt16)commandId); | ||||
|                     binWriter.Write((UInt16)810); //? | ||||
|  | ||||
|                     binWriter.Seek(0x20, SeekOrigin.Begin); | ||||
|                     foreach (BattleAction action in actionList) | ||||
|                         binWriter.Write((UInt32)action.targetId); | ||||
|  | ||||
|                     binWriter.Seek(0x50, SeekOrigin.Begin); | ||||
|                     foreach (BattleAction action in actionList) | ||||
|                         binWriter.Write((UInt16)action.amount); | ||||
|  | ||||
|                     binWriter.Seek(0x64, SeekOrigin.Begin); | ||||
|                     foreach (BattleAction action in actionList) | ||||
|                         binWriter.Write((UInt16)action.worldMasterTextId); | ||||
|  | ||||
|                     binWriter.Seek(0x78, SeekOrigin.Begin); | ||||
|                     foreach (BattleAction action in actionList) | ||||
|                         binWriter.Write((UInt32)action.effectId); | ||||
|  | ||||
|                     binWriter.Seek(0xA0, SeekOrigin.Begin); | ||||
|                     foreach (BattleAction action in actionList) | ||||
|                         binWriter.Write((Byte)action.param); | ||||
|  | ||||
|                     binWriter.Seek(0xAA, SeekOrigin.Begin); | ||||
|                     foreach (BattleAction action in actionList) | ||||
|                         binWriter.Write((Byte)action.unknown); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,80 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using FFXIVClassic.Common; | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| namespace FFXIVClassic_Map_Server.packets.send.actor.battle | ||||
| { | ||||
|     class BattleActionX18Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x013B; | ||||
|         public const uint PACKET_SIZE = 0x148; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint playerActorID, uint sourceActorId, uint animationId, ushort commandId, BattleAction[] actionList) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)sourceActorId); | ||||
|                     binWriter.Write((UInt32)animationId); | ||||
|  | ||||
|                     //Missing... last value is float, string in here as well? | ||||
|  | ||||
|                     binWriter.Seek(0x20, SeekOrigin.Begin); | ||||
|                     binWriter.Write((UInt32) actionList.Length); //Num actions (always 1 for this) | ||||
|                     binWriter.Write((UInt16)commandId); | ||||
|                     binWriter.Write((UInt16)810); //? | ||||
|  | ||||
|                     binWriter.Seek(0x58, SeekOrigin.Begin); | ||||
|                     foreach (BattleAction action in actionList) | ||||
|                         binWriter.Write((UInt32)action.targetId); | ||||
|  | ||||
|                     binWriter.Seek(0xA0, SeekOrigin.Begin); | ||||
|                     foreach (BattleAction action in actionList) | ||||
|                         binWriter.Write((UInt16)action.amount); | ||||
|  | ||||
|                     binWriter.Seek(0xC4, SeekOrigin.Begin); | ||||
|                     foreach (BattleAction action in actionList) | ||||
|                         binWriter.Write((UInt16)action.worldMasterTextId); | ||||
|  | ||||
|                     binWriter.Seek(0xE8, SeekOrigin.Begin); | ||||
|                     foreach (BattleAction action in actionList) | ||||
|                         binWriter.Write((UInt32)action.effectId); | ||||
|  | ||||
|                     binWriter.Seek(0x130, SeekOrigin.Begin); | ||||
|                     foreach (BattleAction action in actionList) | ||||
|                         binWriter.Write((Byte)action.param); | ||||
|  | ||||
|                     binWriter.Seek(0x142, SeekOrigin.Begin); | ||||
|                     foreach (BattleAction action in actionList) | ||||
|                         binWriter.Write((Byte)action.unknown); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										425
									
								
								Map Server/Packets/Send/Actor/Battle/CommandResult.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										425
									
								
								Map Server/Packets/Send/Actor/Battle/CommandResult.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,425 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
| using Meteor.Map.actors.chara.ai; | ||||
| using Meteor.Map.actors.chara.ai.utils; | ||||
| using Meteor.Map.Actors; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.actor.battle | ||||
| { | ||||
|     //These flags can be stacked and mixed, but the client will prioritize certain flags over others. | ||||
|     [Flags] | ||||
|     public enum HitEffect : uint | ||||
|     { | ||||
|         //This is used for physical attacks | ||||
|         HitEffectType = 8 << 24, | ||||
|         //This is used for additioanl effect hits. Only difference from HitEffectType is that it does not play audio. | ||||
|         AdditionalEffectType = 24 << 24, | ||||
|         //Status effects use 32 << 24 | ||||
|         StatusEffectType = 32 << 24, | ||||
|         //When losing a status effect while using a skill, this prevents the hit effect from playing on the actor playing the animation | ||||
|         StatusLossType = 40 << 24, | ||||
|         //Magic effects use 48 << 24, this is also used for when statuses are lost on attack | ||||
|         MagicEffectType = 48 << 24, | ||||
|         //This places the number on the user regardless of the target this hit effect is for, used for things like bloodbath | ||||
|         SelfHealType = 72 << 24, | ||||
|         //Plays the effect animation with no text or additional effects. Unsure if there are any flags. Used for things like Convert | ||||
|         AnimationEffectType = 96 << 24, | ||||
|  | ||||
|         //Each Type has it's own set of flags. These should be split into their own enums, | ||||
|         //but for now just keep them all under HitEffect so we don't have to change anything. | ||||
|  | ||||
|         //HitEffectType flags | ||||
|  | ||||
|         //Not setting RecoilLv2 or RecoilLv3 results in the weaker RecoilLv1. | ||||
|         //These are the recoil animations that play on the target, ranging from weak to strong. | ||||
|         //The recoil that gets set was likely based on the percentage of HP lost from the attack. | ||||
|         //These also have a visual effect with heals and spells but in reverse. RecoilLv1 has a large effect, Lv3 has none. Crit is very large | ||||
|         //For spells they represent resists. Lv0 is a max resist, Lv3 is no resist. Crit is still used for crits. | ||||
|         //Heals used the same effects sometimes but it isn't clear what for, it seems random? Possibly something like a trait proccing or even just a bug | ||||
|         RecoilLv1 = 0, | ||||
|         RecoilLv2 = 1 << 0, | ||||
|         RecoilLv3 = 1 << 1, | ||||
|  | ||||
|         //Setting both recoil flags triggers the "Critical!" pop-up text and hit visual effect. | ||||
|         CriticalHit = RecoilLv2 | RecoilLv3, | ||||
|  | ||||
|         //Hit visual and sound effects when connecting with the target. | ||||
|         //Mixing these flags together will yield different results. | ||||
|         //Each visual likely relates to a specific weapon. | ||||
|         //Ex: HitVisual4 flag alone appears to be the visual and sound effect for hand-to-hand attacks. | ||||
|  | ||||
|         //HitVisual is probably based on attack property. | ||||
|         //HitVisual1 is for slashing attacks | ||||
|         //HitVisual2 is for piercing attacks | ||||
|         //HitVisual1 | Hitvisual2 is for blunt attacks | ||||
|         //HitVisual3 is for projectile attacks | ||||
|         //Basically take the attack property of a weapon and shift it left 2 | ||||
|         //For auto attacks attack property is weapon's damageAttributeType1 | ||||
|         //Still not totally sure how this works with weaponskills or what hitvisual4 or the other combinations are for | ||||
|         HitVisual1 = 1 << 2, | ||||
|         HitVisual2 = 1 << 3, | ||||
|         HitVisual3 = 1 << 4, | ||||
|         HitVisual4 = 1 << 5, | ||||
|  | ||||
|         //An additional visual effect that plays on the target when attacked if: | ||||
|         //The attack is physical and they have the protect buff on. | ||||
|         //The attack is magical and they have the shell buff on. | ||||
|         //Special Note: Shell was removed in later versions of the game. | ||||
|         //Another effect plays when both Protect and Shell flags are activated. | ||||
|         //Not sure what this effect is. | ||||
|         //Random guess: if the attack was a hybrid of both physical and magical and the target had both Protect and Shell buffs applied. | ||||
|         Protect = 1 << 6, | ||||
|         Shell = 1 << 7, | ||||
|         ProtectShellSpecial = Protect | Shell, | ||||
|  | ||||
|         //If only HitEffect1 is set out of the hit effects, the "Evade!" pop-up text triggers along with the evade visual. | ||||
|         //If no hit effects are set, the "Miss!" pop-up is triggered and no hit visual is played. | ||||
|         HitEffect1 = 1 << 9, | ||||
|         HitEffect2 = 1 << 10,   //Plays the standard hit visual effect, but with no sound if used alone. | ||||
|         HitEffect3 = 1 << 11,   //Yellow effect, crit? | ||||
|         HitEffect4 = 1 << 12,   //Plays the blocking animation | ||||
|         HitEffect5 = 1 << 13, | ||||
|         GustyHitEffect = HitEffect3 | HitEffect2, | ||||
|         GreenTintedHitEffect = HitEffect4 | HitEffect1, | ||||
|  | ||||
|         //For specific animations | ||||
|         Miss = 0, | ||||
|         Evade = HitEffect1, | ||||
|         Hit = HitEffect1 | HitEffect2, | ||||
|         Crit = HitEffect3, | ||||
|         Parry = Hit | HitEffect3, | ||||
|         Block = HitEffect4, | ||||
|  | ||||
|         //Knocks you back away from the attacker. | ||||
|         KnockbackLv1 = HitEffect4 | HitEffect2 | HitEffect1, | ||||
|         KnockbackLv2 = HitEffect4 | HitEffect3, | ||||
|         KnockbackLv3 = HitEffect4 | HitEffect3 | HitEffect1, | ||||
|         KnockbackLv4 = HitEffect4 | HitEffect3 | HitEffect2, | ||||
|         KnockbackLv5 = HitEffect4 | HitEffect3 | HitEffect2 | HitEffect1, | ||||
|  | ||||
|         //Knocks you away from the attacker in a counter-clockwise direction. | ||||
|         KnockbackCounterClockwiseLv1 = HitEffect5, | ||||
|         KnockbackCounterClockwiseLv2 = HitEffect5 | HitEffect1, | ||||
|  | ||||
|         //Knocks you away from the attacker in a clockwise direction. | ||||
|         KnockbackClockwiseLv1 = HitEffect5 | HitEffect2, | ||||
|         KnockbackClockwiseLv2 = HitEffect5 | HitEffect2 | HitEffect1, | ||||
|  | ||||
|         //Completely drags target to the attacker, even across large distances. | ||||
|         DrawIn = HitEffect5 | HitEffect3, | ||||
|  | ||||
|         //An additional visual effect that plays on the target based on according buff. | ||||
|         UnknownShieldEffect = HitEffect5 | HitEffect4, | ||||
|         Stoneskin = HitEffect5 | HitEffect4 | HitEffect1, | ||||
|  | ||||
|         //A special effect when performing appropriate skill combos in succession. | ||||
|         //Ex: Thunder (SkillCombo1 Effect) -> Thundara (SkillCombo2 Effect) -> Thundaga (SkillCombo3 Effect) | ||||
|         //Special Note: SkillCombo4 was never actually used in 1.0 since combos only chained up to 3 times maximum. | ||||
|         SkillCombo1 = 1 << 15, | ||||
|         SkillCombo2 = 1 << 16, | ||||
|         SkillCombo3 = SkillCombo1 | SkillCombo2, | ||||
|         SkillCombo4 = 1 << 17, | ||||
|  | ||||
|         //This is used in the absorb effect for some reason | ||||
|         Unknown = 1 << 19, | ||||
|  | ||||
|         //AdditionalEffectType flags | ||||
|         //The AdditionalEffectType is used for the additional effects some weapons have. | ||||
|         //These effect ids do not repeat the effect of the attack and will not show without a preceding HitEffectType or MagicEffectType | ||||
|  | ||||
|         //It's unclear what this is for. The ifrit fight capture has a BLM using the garuda weapon | ||||
|         //and this flag is set every time but has no apparent effect. | ||||
|         UnknownAdditionalFlag = 1, | ||||
|  | ||||
|         //These play effects on the target | ||||
|         FireEffect = 1 << 10, | ||||
|         IceEffect = 2 << 10, | ||||
|         WindEffect = 3 << 10, | ||||
|         EarthEffect = 4 << 10, | ||||
|         LightningEffect = 5 << 10, | ||||
|         WaterEffect = 6 << 10, | ||||
|         AstralEffect = 7 << 10,         //Possibly for blind? | ||||
|         UmbralEffect = 8 << 10,         //Posibly for poison? | ||||
|  | ||||
|         //Unknown status effect effects | ||||
|         StatusEffect1 = 12 << 10, | ||||
|         StatusEffect2 = 13 << 10, | ||||
|  | ||||
|         HPAbsorbEffect = 14 << 10, | ||||
|         MPAbsorbEffect = 15 << 10, | ||||
|         TPAbsorbEffect = 16 << 10, | ||||
|         TripleAbsorbEffect = 17 << 10,  //Not sure about this | ||||
|         MoogleEffect = 18 << 10, | ||||
|  | ||||
|         //MagicEffectType Flags | ||||
|         //THese are used for magic effects that deal or heal damage as well as damage over time effects | ||||
|         //Crit is the same as HitEffectType | ||||
|         FullResist = 0, | ||||
|         WeakResist = 1 << 0,    //Used for level 1, 2, and 3 resists probably | ||||
|         NoResist = 1 << 1, | ||||
|  | ||||
|         MagicShell = 1 << 4,    //Used when casting on target with shell effects. MagicEffectType doesnt have a flag for protect or stoneskin | ||||
|         MagicShield = 1 << 5,   //When used with an command that has an animation, this plays a purple shield effect. DoTs also have this flag set (at least on ifrit) but they have no animations so it doesnt show | ||||
|  | ||||
|         // Required for heal text to be blue, not sure if that's all it's used for | ||||
|         Heal = 1 << 8, | ||||
|         MP = 1 << 9,            //Causes "MP" text to appear when used with MagicEffectType. | with Heal to make text blue | ||||
|         TP = 1 << 10,           //Causes "TP" text to appear when used with MagicEffectType. | with Heal to make text blue | ||||
|  | ||||
|         //SelfHealType flags | ||||
|         //This category causes numbers to appear on the user rather regardless of the target associated with the hit effect and do not play an animation | ||||
|         //These determine the text that displays (HP has no text) | ||||
|         SelfHealHP = 0, | ||||
|         SelfHealMP = 1 << 0,    //Shows MP text on self. | with SelfHeal to make blue | ||||
|         SelfHealTP = 1 << 1,    //Shows TP text on self. | with SelfHeal to make blue | ||||
|  | ||||
|         //Causes self healing numbers to be blue | ||||
|         SelfHeal = 1 << 10, | ||||
|     } | ||||
|  | ||||
|     //Mixing some of these flags will cause the client to crash. | ||||
|     //Setting a flag higher than Left (0x10-0x80) will cause the client to crash. | ||||
|     [Flags] | ||||
|     public enum HitDirection : byte | ||||
|     { | ||||
|         None = 0, | ||||
|         Front = 1 << 0, | ||||
|         Right = 1 << 1, | ||||
|         Rear = 1 << 2, | ||||
|         Left = 1 << 3 | ||||
|     } | ||||
|  | ||||
|     public enum HitType : ushort | ||||
|     { | ||||
|         Miss = 0, | ||||
|         Evade = 1, | ||||
|         Parry = 2, | ||||
|         Block = 3, | ||||
|         SingleResist = 4, | ||||
|         DoubleResist = 5, | ||||
|         TripleResist = 6, | ||||
|         FullResist = 7, | ||||
|         Hit = 8, | ||||
|         Crit = 9 | ||||
|     } | ||||
|  | ||||
|     //Type of action | ||||
|     public enum ActionType : ushort | ||||
|     { | ||||
|         None = 0, | ||||
|         Physical = 1, | ||||
|         Magic = 2, | ||||
|         Heal = 3, | ||||
|         Status = 4 | ||||
|     } | ||||
|  | ||||
|     //There's are two columns in gamecommand that are for action property and action element respectively and both have percentages next to them | ||||
|     //the percentages are for what percent that property or element factors into the attack. Astral and Umbral are always 33% because they are both 3 elments combined | ||||
|     //ActionProperty and ActionElement are slightly different. Property defines whta type of attack it is, and 11-13 are used for "sonic, breath, neutral". Neutral is always used for magic | ||||
|     //For Element 11-13 are used for astral, umbral, and healing magic. | ||||
|     //Right now we aren't actually using these but when things like resists get better defined we'll have to | ||||
|     public enum ActionProperty : ushort | ||||
|     { | ||||
|         None = 0, | ||||
|         Slashing = 1, | ||||
|         Piercing = 2, | ||||
|         Blunt = 3, | ||||
|         Projectile = 4, | ||||
|  | ||||
|         Fire = 5, | ||||
|         Ice = 6, | ||||
|         Wind = 7, | ||||
|         Earth = 8, | ||||
|         Lightning = 9, | ||||
|         Water = 10, | ||||
|  | ||||
|         //These I'm not sure about. Check gameCommand.csv | ||||
|         Astral = 11, | ||||
|         Umbral = 12, | ||||
|         Heal = 13 | ||||
|     } | ||||
|      | ||||
|     | ||||
|     /* | ||||
|     public enum ActionProperty : ushort | ||||
|     { | ||||
|         None = 0, | ||||
|         Slashing = 1, | ||||
|         Piercing = 2, | ||||
|         Blunt = 3, | ||||
|         Projectile = 4, | ||||
|  | ||||
|         Fire = 5, | ||||
|         Ice = 6, | ||||
|         Wind = 7, | ||||
|         Earth = 8, | ||||
|         Lightning = 9, | ||||
|         Water = 10, | ||||
|          | ||||
|         Sonic = 11, | ||||
|         Breath = 12, | ||||
|         Neutral = 13, | ||||
|         Astral = 14, | ||||
|         Umbral = 15 | ||||
|     } | ||||
|  | ||||
|     public enum ActionElement : ushort | ||||
|     { | ||||
|         None = 0, | ||||
|         Slashing = 1, | ||||
|         Piercing = 2, | ||||
|         Blunt = 3, | ||||
|         Projectile = 4, | ||||
|  | ||||
|         Fire = 5, | ||||
|         Ice = 6, | ||||
|         Wind = 7, | ||||
|         Earth = 8, | ||||
|         Lightning = 9, | ||||
|         Water = 10, | ||||
|  | ||||
|         //These I'm not sure about. Check gameCommand.csv | ||||
|         Astral = 11, | ||||
|         Umbral = 12, | ||||
|         Heal = 13 | ||||
|     }*/ | ||||
|  | ||||
|  | ||||
|     class CommandResult | ||||
|     { | ||||
|         public uint targetId; | ||||
|         public ushort amount; | ||||
|         public ushort amountMitigated;          //Amount that got blocked/evaded or resisted | ||||
|         public ushort enmity;                   //Seperate from amount for abilities that cause a different amount of enmity than damage | ||||
|         public ushort worldMasterTextId; | ||||
|         public uint effectId;                   //Impact effect, damage/heal/status numbers or name | ||||
|         public byte param;                      //Which side the battle action is coming from | ||||
|         public byte hitNum;                     //Which hit in a sequence of hits this is | ||||
|  | ||||
|         /// <summary> | ||||
|         /// these fields are not actually part of the packet struct | ||||
|         /// </summary> | ||||
|         public uint animation; | ||||
|         public CommandType commandType;         //What type of command was used (ie weaponskill, ability, etc) | ||||
|         public ActionProperty actionProperty;   //Damage type of the action | ||||
|         public ActionType actionType;           //Type of this action (ie physical, magic, heal) | ||||
|         public HitType hitType; | ||||
|  | ||||
|         //Rates, I'm not sure if these need to be stored like this but with the way some buffs work maybe they do? | ||||
|         //Makes things like Blindside easy at least. | ||||
|         public double parryRate = 0.0; | ||||
|         public double blockRate = 0.0; | ||||
|         public double resistRate = 0.0; | ||||
|         public double hitRate = 0.0; | ||||
|         public double critRate = 0.0; | ||||
|  | ||||
|         public CommandResult(uint targetId, ushort worldMasterTextId, uint effectId, ushort amount = 0, byte param = 0, byte hitNum = 1) | ||||
|         { | ||||
|             this.targetId = targetId; | ||||
|             this.worldMasterTextId = worldMasterTextId; | ||||
|             this.effectId = effectId; | ||||
|             this.amount = amount; | ||||
|             this.param = param; | ||||
|             this.hitNum = hitNum; | ||||
|             this.hitType = HitType.Hit; | ||||
|             this.enmity = amount; | ||||
|             this.commandType = (byte) CommandType.None; | ||||
|         } | ||||
|  | ||||
|         public CommandResult(uint targetId, BattleCommand command, byte param = 0, byte hitNum = 1) | ||||
|         { | ||||
|             this.targetId = targetId; | ||||
|             this.worldMasterTextId = command.worldMasterTextId; | ||||
|             this.param = param; | ||||
|             this.hitNum = hitNum; | ||||
|             this.commandType = command.commandType; | ||||
|             this.actionProperty = command.actionProperty; | ||||
|             this.actionType = command.actionType; | ||||
|         } | ||||
|  | ||||
|         //Order of what (probably) happens when a skill is used: | ||||
|         //Buffs that alter things like recast times or that only happen once per skill usage like Power Surge are activated | ||||
|         //Script calculates damage and handles any special requirements | ||||
|         //Rates are calculated | ||||
|         //Buffs that impact indiviudal hits like Blindside or Blood for Blood are activated | ||||
|         //The final hit type is determined | ||||
|         //Stoneskin takes damage | ||||
|         //Final damage amount is calculated using the hit type and defender's stats | ||||
|         //Buffs that activate or respond to damage like Rampage. Stoneskin gets removed AFTER damage if it falls off. | ||||
|         //Additional effects that are a part of the skill itself or weapon in case of auto attacks take place like status effects | ||||
|         //Certain buffs that alter the whole skill fall off (Resonance, Excruciate) | ||||
|          | ||||
|         public void DoAction(Character caster, Character target, BattleCommand skill, CommandResultContainer results) | ||||
|         { | ||||
|             //First calculate rates for hit/block/etc | ||||
|             CalcRates(caster, target, skill); | ||||
|  | ||||
|             //Next, modify those rates based on preaction buffs | ||||
|             //Still not sure how we shouldh andle these | ||||
|             PreAction(caster, target, skill, results); | ||||
|  | ||||
|             BattleUtils.DoAction(caster, target, skill, this, results); | ||||
|         } | ||||
|  | ||||
|  | ||||
|         //Calculate the chance of hitting/critting/etc | ||||
|         public void CalcRates(Character caster, Character target, BattleCommand skill) | ||||
|         { | ||||
|             hitRate = BattleUtils.GetHitRate(caster, target, skill, this); | ||||
|             critRate = BattleUtils.GetCritRate(caster, target, skill, this); | ||||
|             blockRate = BattleUtils.GetBlockRate(caster, target, skill, this); | ||||
|             parryRate = BattleUtils.GetParryRate(caster, target, skill, this); | ||||
|             resistRate = BattleUtils.GetResistRate(caster, target, skill, this); | ||||
|         } | ||||
|  | ||||
|         //These are buffs that activate before the action hits. Usually they change things like hit or crit rates or damage | ||||
|         public void PreAction(Character caster, Character target, BattleCommand skill, CommandResultContainer results) | ||||
|         { | ||||
|             target.statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnPreactionTarget, "onPreAction", caster, target, skill, this, results); | ||||
|  | ||||
|             caster.statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnPreactionCaster, "onPreAction", caster, target, skill, this, results); | ||||
|         } | ||||
|  | ||||
|         //Try and apply a status effect | ||||
|         public void TryStatus(Character caster, Character target, BattleCommand skill, CommandResultContainer results, bool isAdditional = true) | ||||
|         { | ||||
|             BattleUtils.TryStatus(caster, target, skill, this, results, isAdditional); | ||||
|         } | ||||
|  | ||||
|         public ushort GetHitType() | ||||
|         { | ||||
|             return (ushort)hitType; | ||||
|         } | ||||
|  | ||||
|         public void SetTextId(ushort id) | ||||
|         { | ||||
|             worldMasterTextId = id; | ||||
|         } | ||||
|  | ||||
|         //Whether this action didn't miss, and wasn't evaded or resisted | ||||
|         public bool ActionLanded() | ||||
|         { | ||||
|             return hitType > HitType.Evade && hitType != HitType.SingleResist && hitType != HitType.DoubleResist && hitType != HitType.FullResist; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										120
									
								
								Map Server/Packets/Send/Actor/Battle/CommandResultContainer.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										120
									
								
								Map Server/Packets/Send/Actor/Battle/CommandResultContainer.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,120 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System.Collections.Generic; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.actor.battle | ||||
| { | ||||
|     class CommandResultContainer | ||||
|     { | ||||
|         private List<CommandResult> actionsList = new List<CommandResult>(); | ||||
|          | ||||
|         //EXP messages are always the last mesages in battlea ction packets, so they get appended after all the rest of the actions are done. | ||||
|         private List<CommandResult> expActionList = new List<CommandResult>();  | ||||
|  | ||||
|         public CommandResultContainer() | ||||
|         { | ||||
|  | ||||
|         } | ||||
|  | ||||
|         public void AddAction(uint targetId, ushort worldMasterTextId, uint effectId, ushort amount = 0, byte param = 0, byte hitNum = 0) | ||||
|         { | ||||
|             AddAction(new CommandResult(targetId, worldMasterTextId, effectId, amount, param, hitNum)); | ||||
|         } | ||||
|  | ||||
|         //Just to make scripting simpler | ||||
|         //These have to be split into the normal actions and absorb actions because they use different flags | ||||
|         //AddMP/HP/TPAction are for actions where the targetID is the person being targeted by command. Like Sanguine Rite would use AddMPAction | ||||
|         public void AddMPAction(uint targetId, ushort worldMasterTextId, ushort amount) | ||||
|         { | ||||
|             uint effectId = (uint) (HitEffect.MagicEffectType | HitEffect.MP | HitEffect.Heal); | ||||
|             AddAction(targetId, worldMasterTextId, effectId, amount); | ||||
|         } | ||||
|  | ||||
|         public void AddHPAction(uint targetId, ushort worldMasterTextId, ushort amount) | ||||
|         { | ||||
|             uint effectId = (uint) (HitEffect.MagicEffectType | HitEffect.Heal); | ||||
|             AddAction(targetId, worldMasterTextId, effectId, amount); | ||||
|         } | ||||
|  | ||||
|         public void AddTPAction(uint targetId, ushort worldMasterTextId, ushort amount) | ||||
|         { | ||||
|             uint effectId = (uint) (HitEffect.MagicEffectType | HitEffect.TP | HitEffect.Heal); | ||||
|             AddAction(targetId, worldMasterTextId, effectId, amount); | ||||
|         } | ||||
|  | ||||
|         //These are used for skills where the targetId is the person using a command. For example casting with parsimony would use AddMPAbsorbAction | ||||
|         public void AddMPAbsorbAction(uint targetId, ushort worldMasterTextId, ushort amount) | ||||
|         { | ||||
|             uint effectId = (uint) (HitEffect.SelfHealType | HitEffect.SelfHealMP | HitEffect.SelfHeal); | ||||
|             AddAction(targetId, worldMasterTextId, effectId, amount); | ||||
|         } | ||||
|  | ||||
|         public void AddHPAbsorbAction(uint targetId, ushort worldMasterTextId, ushort amount) | ||||
|         { | ||||
|             uint effectId = (uint) (HitEffect.SelfHealType | HitEffect.SelfHeal | HitEffect.SelfHeal); | ||||
|             AddAction(targetId, worldMasterTextId, effectId, amount); | ||||
|         } | ||||
|  | ||||
|         public void AddTPAbsorbAction(uint targetId, ushort worldMasterTextId, ushort amount) | ||||
|         { | ||||
|             uint effectId = (uint) (HitEffect.SelfHealType | HitEffect.SelfHealTP | HitEffect.SelfHeal); | ||||
|             AddAction(targetId, worldMasterTextId, effectId, amount); | ||||
|         } | ||||
|  | ||||
|         public void AddHitAction(uint targetId, ushort worldMasterTextId, ushort amount) | ||||
|         { | ||||
|             uint effectId = (uint) (HitEffect.HitEffectType | HitEffect.Hit); | ||||
|             AddAction(targetId, worldMasterTextId, effectId, amount); | ||||
|         } | ||||
|  | ||||
|         public void AddAction(CommandResult action) | ||||
|         { | ||||
|             if (action != null) | ||||
|                 actionsList.Add(action); | ||||
|         } | ||||
|          | ||||
|         public void AddActions(List<CommandResult> actions) | ||||
|         { | ||||
|             actionsList.AddRange(actions); | ||||
|         } | ||||
|  | ||||
|         public void AddEXPAction(CommandResult action) | ||||
|         { | ||||
|             expActionList.Add(action); | ||||
|         } | ||||
|  | ||||
|         public void AddEXPActions(List<CommandResult> actionList) | ||||
|         { | ||||
|             expActionList.AddRange(actionList); | ||||
|         } | ||||
|  | ||||
|         public void CombineLists() | ||||
|         { | ||||
|             actionsList.AddRange(expActionList); | ||||
|         } | ||||
|  | ||||
|         public List<CommandResult> GetList() | ||||
|         { | ||||
|             return actionsList; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,57 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.actor.battle | ||||
| { | ||||
|     class CommandResultX00Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x013C; | ||||
|         public const uint PACKET_SIZE = 0x48; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)sourceActorId); | ||||
|                     binWriter.Write((UInt32)animationId); | ||||
|  | ||||
|                     //Missing... last value is float, string in here as well? | ||||
|  | ||||
|                     binWriter.Seek(0x20, SeekOrigin.Begin); | ||||
|                     binWriter.Write((UInt32)0); //Num actions (always 0 for this) | ||||
|                     binWriter.Write((UInt16)commandId); | ||||
|                     binWriter.Write((UInt16)810); //? | ||||
|  | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,73 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.actor.battle | ||||
| { | ||||
|     // see xtx_command | ||||
|     enum CommandResultX01PacketCommand : ushort | ||||
|     { | ||||
|         Disengage = 12002, | ||||
|         Attack = 22104, | ||||
|     } | ||||
|  | ||||
|     class CommandResultX01Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0139; | ||||
|         public const uint PACKET_SIZE = 0x58; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, CommandResult action) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)sourceActorId); | ||||
|  | ||||
|                     binWriter.Write((UInt32)animationId); | ||||
|  | ||||
|                     //Missing... last value is float, string in here as well? | ||||
|  | ||||
|                     binWriter.Seek(0x20, SeekOrigin.Begin); | ||||
|                     binWriter.Write((UInt32)1); //Num actions (always 1 for this) | ||||
|                     binWriter.Write((UInt16)commandId); | ||||
|                     binWriter.Write((UInt16)0x810); //? | ||||
|  | ||||
|                     binWriter.Write((UInt32)action.targetId); | ||||
|  | ||||
|                     binWriter.Write((UInt16)action.amount); | ||||
|                     binWriter.Write((UInt16)action.worldMasterTextId); | ||||
|  | ||||
|                     binWriter.Write((UInt32)action.effectId); | ||||
|                     binWriter.Write((Byte)action.param); | ||||
|                     binWriter.Write((Byte)action.hitNum); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										148
									
								
								Map Server/Packets/Send/Actor/Battle/CommandResultX10Packet.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										148
									
								
								Map Server/Packets/Send/Actor/Battle/CommandResultX10Packet.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,148 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| using System.Collections.Generic; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.battle | ||||
| { | ||||
|     class CommandResultX10Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x013A; | ||||
|         public const uint PACKET_SIZE = 0xD8; | ||||
|          | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, CommandResult[] actionList, ref int listOffset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     int max; | ||||
|                     if (actionList.Length - listOffset <= 10) | ||||
|                         max = actionList.Length - listOffset; | ||||
|                     else | ||||
|                         max = 10; | ||||
|  | ||||
|                     binWriter.Write((UInt32)sourceActorId); | ||||
|                     binWriter.Write((UInt32)animationId); | ||||
|  | ||||
|                     //Missing... last value is float, string in here as well? | ||||
|  | ||||
|                     binWriter.Seek(0x20, SeekOrigin.Begin); | ||||
|                     binWriter.Write((UInt32)max); //Num actions | ||||
|                     binWriter.Write((UInt16)commandId); | ||||
|                     binWriter.Write((UInt16)0x810); //? | ||||
|  | ||||
|                     //binWriter.Seek(0x20, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((UInt32)actionList[listOffset + i].targetId); | ||||
|  | ||||
|                     binWriter.Seek(0x50, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((UInt16)actionList[listOffset + i].amount); | ||||
|  | ||||
|                     binWriter.Seek(0x64, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((UInt16)actionList[listOffset + i].worldMasterTextId); | ||||
|  | ||||
|                     binWriter.Seek(0x78, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((UInt32)actionList[listOffset + i].effectId); | ||||
|  | ||||
|                     binWriter.Seek(0xA0, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((Byte)actionList[listOffset + i].param); | ||||
|  | ||||
|                     binWriter.Seek(0xAA, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((Byte)actionList[listOffset + i].hitNum); | ||||
|  | ||||
|                     listOffset += max; | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, List<CommandResult> actionList, ref int listOffset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     int max; | ||||
|                     if (actionList.Count - listOffset <= 10) | ||||
|                         max = actionList.Count - listOffset; | ||||
|                     else | ||||
|                         max = 10; | ||||
|  | ||||
|                     binWriter.Write((UInt32)sourceActorId); | ||||
|                     binWriter.Write((UInt32)animationId); | ||||
|  | ||||
|                     //Missing... last value is float, string in here as well? | ||||
|  | ||||
|                     binWriter.Seek(0x20, SeekOrigin.Begin); | ||||
|                     binWriter.Write((UInt32)max); //Num actions | ||||
|                     binWriter.Write((UInt16)commandId); | ||||
|                     binWriter.Write((UInt16)0x810); //? | ||||
|  | ||||
|                     //binWriter.Seek(0x20, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((UInt32)actionList[listOffset + i].targetId); | ||||
|  | ||||
|                     binWriter.Seek(0x50, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((UInt16)actionList[listOffset + i].amount); | ||||
|  | ||||
|                     binWriter.Seek(0x64, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((UInt16)actionList[listOffset + i].worldMasterTextId); | ||||
|  | ||||
|                     binWriter.Seek(0x78, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Write((UInt32)actionList[listOffset + i].effectId); | ||||
|                     } | ||||
|  | ||||
|                     binWriter.Seek(0xA0, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((Byte)actionList[listOffset + i].param); | ||||
|  | ||||
|                     binWriter.Seek(0xAA, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((Byte) actionList[listOffset + i].hitNum); | ||||
|  | ||||
|                     listOffset += max; | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										145
									
								
								Map Server/Packets/Send/Actor/Battle/CommandResultX18Packet.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										145
									
								
								Map Server/Packets/Send/Actor/Battle/CommandResultX18Packet.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,145 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| using System.Collections.Generic; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.battle | ||||
| { | ||||
|     class CommandResultX18Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x013B; | ||||
|         public const uint PACKET_SIZE = 0x148; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, CommandResult[] actionList, ref int listOffset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     int max; | ||||
|                     if (actionList.Length - listOffset <= 18) | ||||
|                         max = actionList.Length - listOffset; | ||||
|                     else | ||||
|                         max = 18; | ||||
|  | ||||
|                     binWriter.Write((UInt32)sourceActorId); | ||||
|                     binWriter.Write((UInt32)animationId); | ||||
|  | ||||
|                     //Missing... last value is float, string in here as well? | ||||
|  | ||||
|                     binWriter.Seek(0x20, SeekOrigin.Begin); | ||||
|                     binWriter.Write((UInt32)max); //Num actions | ||||
|                     binWriter.Write((UInt16)commandId); | ||||
|                     binWriter.Write((UInt16)0x810); //? | ||||
|  | ||||
|                     binWriter.Seek(0x28, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((UInt32)actionList[listOffset + i].targetId); | ||||
|                      | ||||
|                     binWriter.Seek(0x70, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((UInt16)actionList[listOffset + i].amount); | ||||
|  | ||||
|                     binWriter.Seek(0x94, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((UInt16)actionList[listOffset + i].worldMasterTextId); | ||||
|  | ||||
|                     binWriter.Seek(0xB8, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((UInt32)actionList[listOffset + i].effectId); | ||||
|  | ||||
|                     binWriter.Seek(0x100, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((Byte)actionList[listOffset + i].param); | ||||
|  | ||||
|                     binWriter.Seek(0x112, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((Byte)actionList[listOffset + i].hitNum); | ||||
|  | ||||
|                     listOffset += max; | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, List<CommandResult> actionList, ref int listOffset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     int max; | ||||
|                     if (actionList.Count - listOffset <= 18) | ||||
|                         max = actionList.Count - listOffset; | ||||
|                     else | ||||
|                         max = 18; | ||||
|  | ||||
|                     binWriter.Write((UInt32)sourceActorId); | ||||
|                     binWriter.Write((UInt32)animationId); | ||||
|  | ||||
|                     //Missing... last value is float, string in here as well? | ||||
|  | ||||
|                     binWriter.Seek(0x20, SeekOrigin.Begin); | ||||
|                     binWriter.Write((UInt32)max); //Num actions | ||||
|                     binWriter.Write((UInt16)commandId); | ||||
|                     binWriter.Write((UInt16)0x818); //? | ||||
|  | ||||
|                     binWriter.Seek(0x28, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((UInt32)actionList[listOffset + i].targetId); | ||||
|  | ||||
|                     binWriter.Seek(0x70, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((UInt16)actionList[listOffset + i].amount); | ||||
|  | ||||
|                     binWriter.Seek(0x94, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((UInt16)actionList[listOffset + i].worldMasterTextId); | ||||
|  | ||||
|                     binWriter.Seek(0xB8, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((UInt32)actionList[listOffset + i].effectId); | ||||
|  | ||||
|                     binWriter.Seek(0x100, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((Byte)actionList[listOffset + i].param); | ||||
|  | ||||
|                     binWriter.Seek(0x112, SeekOrigin.Begin); | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                         binWriter.Write((Byte)actionList[listOffset + i].hitNum); | ||||
|  | ||||
|                     listOffset += max; | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										36
									
								
								Map Server/Packets/Send/Actor/DeleteAllActorsPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								Map Server/Packets/Send/Actor/DeleteAllActorsPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class DeleteAllActorsPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0007; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId) | ||||
|         { | ||||
|             return new SubPacket(OPCODE, sourceActorId, new byte[8]); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,53 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using Meteor.Map.actors; | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.actor.events | ||||
| { | ||||
|     class SetEmoteEventCondition | ||||
|     { | ||||
|         public const ushort OPCODE = 0x016C; | ||||
|         public const uint PACKET_SIZE = 0x48; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, EventList.EmoteEventCondition condition) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((Byte)condition.unknown1); //4 | ||||
|                     binWriter.Write((UInt16)condition.emoteId); //82, 76, 6E | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName)); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										52
									
								
								Map Server/Packets/Send/Actor/Events/SetEventStatus.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								Map Server/Packets/Send/Actor/Events/SetEventStatus.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.events | ||||
| { | ||||
|     class SetEventStatus | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0136; | ||||
|         public const uint PACKET_SIZE = 0x48; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, bool enabled, byte unknown2, string conditionName) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)(enabled ? 1 : 0)); | ||||
|                     binWriter.Write((Byte)unknown2); | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(conditionName), 0, Encoding.ASCII.GetByteCount(conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(conditionName)); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,54 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.actors; | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.events | ||||
| { | ||||
|     class SetNoticeEventCondition | ||||
|     { | ||||
|         public const ushort OPCODE = 0x016B; | ||||
|         public const uint PACKET_SIZE = 0x48; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, EventList.NoticeEventCondition condition) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((Byte)condition.unknown1); //Seen: 0, 1, E | ||||
|                     binWriter.Write((Byte)condition.unknown2); //Seen: 0, 1 | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName)); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,58 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.actors; | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.events | ||||
| { | ||||
|     class SetPushEventConditionWithCircle | ||||
|     { | ||||
|         public const ushort OPCODE = 0x016F; | ||||
|         public const uint PACKET_SIZE = 0x58; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, EventList.PushCircleEventCondition condition) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((Single)condition.radius); | ||||
|                     binWriter.Write((UInt32)0x44533088); | ||||
|                     binWriter.Write((Single)100.0f); | ||||
|                     binWriter.Seek(4, SeekOrigin.Current); | ||||
|                     binWriter.Write((Byte)(condition.outwards ? 0x11 : 0x1)); //If == 0x10, Inverted Bounding Box | ||||
|                     binWriter.Write((Byte)0); | ||||
|                     binWriter.Write((Byte)(condition.silent ? 0x1 : 0x0)); //Silent Trigger | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName)); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,60 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.actors; | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.events | ||||
| { | ||||
|     class SetPushEventConditionWithFan | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0170; | ||||
|         public const uint PACKET_SIZE = 0x60; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, EventList.PushFanEventCondition condition) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((Single)condition.radius); | ||||
|                     binWriter.Write((UInt32)0xbfc90fdb); | ||||
|                     binWriter.Write((UInt32)0x3f860a92); | ||||
|                     binWriter.Write((UInt32)sourceActorId); //Actor Id | ||||
|                     binWriter.Write((Single)10.0f); | ||||
|                     binWriter.Seek(4, SeekOrigin.Current); | ||||
|                     binWriter.Write((Byte)(condition.outwards ? 0x11 : 0x1)); //If == 0x10, Inverted Bounding Box | ||||
|                     binWriter.Write((Byte)0); | ||||
|                     binWriter.Write((Byte)(condition.silent ? 0x1 : 0x0)); //Silent Trigger | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName)); | ||||
|                 } | ||||
|             } | ||||
|             new SubPacket(OPCODE, sourceActorId, data).DebugPrintSubPacket(); | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,58 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.actors; | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.events | ||||
| { | ||||
|     class SetPushEventConditionWithTriggerBox | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0175; | ||||
|         public const uint PACKET_SIZE = 0x60; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, EventList.PushBoxEventCondition condition) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)condition.size); | ||||
|                     binWriter.Write((UInt32)0x1A5); | ||||
|                     binWriter.Write((UInt32)4); | ||||
|                     binWriter.Seek(8, SeekOrigin.Current); | ||||
|                     binWriter.Write((Byte)(condition.outwards ? 0x11 : 0x0)); //If == 0x10, Inverted Bounding Box | ||||
|                     binWriter.Write((Byte)3); | ||||
|                     binWriter.Write((Byte)(condition.silent ? 0x1 : 0x0)); //Silent Trigger; | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName)); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,54 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.actors; | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.events | ||||
| { | ||||
|     class SetTalkEventCondition | ||||
|     { | ||||
|         public const ushort OPCODE = 0x012E; | ||||
|         public const uint PACKET_SIZE = 0x48; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, EventList.TalkEventCondition condition) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     condition.unknown1 = 4; | ||||
|                     binWriter.Write((Byte)condition.unknown1); | ||||
|                     binWriter.Write((Byte)(condition.isDisabled ? 0x1 : 0x0)); | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName)); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,41 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class InventoryBeginChangePacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x016D; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint playerActorID, bool clearItemPackage = false) | ||||
|         { | ||||
|             byte[] data = new byte[8]; | ||||
|  | ||||
|             if (clearItemPackage) | ||||
|                 data[0] = 2; | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,37 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class InventoryEndChangePacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x016E; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId) | ||||
|         { | ||||
|             return new SubPacket(OPCODE, sourceActorId, new byte[8]); | ||||
|         } | ||||
|          | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,59 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.dataobjects; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class InventoryItemEndPacket | ||||
|     { | ||||
|  | ||||
|         public const ushort OPCODE = 0x0149; | ||||
|         public const uint PACKET_SIZE = 0x90; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint playerActorID, List<InventoryItem> items, ref int listOffset) | ||||
|         { | ||||
|             byte[] data; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream()) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     for (int i = listOffset; i < items.Count; i++) | ||||
|                     { | ||||
|                         binWriter.Write(items[i].ToPacketBytes()); | ||||
|                         listOffset++; | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                 data = mem.GetBuffer(); | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|  | ||||
|  | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,59 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.dataobjects; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class InventoryItemPacket | ||||
|     { | ||||
|  | ||||
|         public const ushort OPCODE = 0x014A; | ||||
|         public const uint PACKET_SIZE = 0x90; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint playerActorID, List<InventoryItem> items, ref int listOffset) | ||||
|         { | ||||
|             byte[] data; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream()) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     for (int i = listOffset; i < items.Count; i++) | ||||
|                     { | ||||
|                         binWriter.Write(items[i].ToPacketBytes()); | ||||
|                         listOffset++; | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                 data = mem.GetBuffer(); | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|  | ||||
|  | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,50 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.dataobjects; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class InventoryListX01Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0148; | ||||
|         public const uint PACKET_SIZE = 0x90; | ||||
|          | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, InventoryItem item) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 {                     | ||||
|                         binWriter.Write(item.ToPacketBytes());                        | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,64 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.dataobjects; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class InventoryListX08Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0149; | ||||
|         public const uint PACKET_SIZE = 0x3A8; | ||||
|          | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, List<InventoryItem> items, ref int listOffset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     int max; | ||||
|                     if (items.Count - listOffset <= 8) | ||||
|                         max = items.Count - listOffset; | ||||
|                     else | ||||
|                         max = 8; | ||||
|  | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Write(items[listOffset].ToPacketBytes()); | ||||
|                         listOffset++; | ||||
|                     } | ||||
|  | ||||
|                     binWriter.Seek(0x380, SeekOrigin.Begin); | ||||
|                     binWriter.Write((UInt32)max); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,61 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.dataobjects; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class InventoryListX16Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x014A; | ||||
|         public const uint PACKET_SIZE = 0x720; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, List<InventoryItem> items, ref int listOffset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     int max; | ||||
|                     if (items.Count - listOffset <= 16) | ||||
|                         max = items.Count - listOffset; | ||||
|                     else | ||||
|                         max = 16; | ||||
|  | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Write(items[listOffset].ToPacketBytes()); | ||||
|                         listOffset++; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|          | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,60 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.dataobjects; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class InventoryListX32Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x014B; | ||||
|         public const uint PACKET_SIZE = 0xE20; | ||||
|      | ||||
|         public static SubPacket BuildPacket(uint playerActorID, List<InventoryItem> items, ref int listOffset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     int max; | ||||
|                     if (items.Count - listOffset <= 32) | ||||
|                         max = items.Count - listOffset; | ||||
|                     else | ||||
|                         max = 32; | ||||
|  | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Write(items[listOffset].ToPacketBytes()); | ||||
|                         listOffset++; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,60 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.dataobjects; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class InventoryListX64Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x014C; | ||||
|         public const uint PACKET_SIZE = 0x1C20; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint playerActorID, List<InventoryItem> items, ref int listOffset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     int max; | ||||
|                     if (items.Count - listOffset <= 64) | ||||
|                         max = items.Count - listOffset; | ||||
|                     else | ||||
|                         max = 64; | ||||
|  | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Write(items[listOffset].ToPacketBytes()); | ||||
|                         listOffset++; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,47 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class InventoryRemoveX01Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0152; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|         public static SubPacket BuildPacket(uint playerActorID, ushort slot) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt16)slot); | ||||
|                 } | ||||
|             } | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,60 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class InventoryRemoveX08Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0153; | ||||
|         public const uint PACKET_SIZE = 0x38; | ||||
|         public static SubPacket BuildPacket(uint playerActorID, List<ushort> slots, ref int listOffset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     int max; | ||||
|                     if (slots.Count - listOffset <= 8) | ||||
|                         max = slots.Count - listOffset; | ||||
|                     else | ||||
|                         max = 8; | ||||
|  | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Write((UInt16)slots[listOffset]); | ||||
|                         listOffset++; | ||||
|                     } | ||||
|  | ||||
|                     binWriter.Seek(0x10, SeekOrigin.Begin); | ||||
|                     binWriter.Write((Byte)max); | ||||
|                 } | ||||
|             } | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,60 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class InventoryRemoveX16Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x154; | ||||
|         public const uint PACKET_SIZE = 0x40; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint playerActorID, List<ushort> slots, ref int listOffset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     int max; | ||||
|                     if (slots.Count - listOffset <= 16) | ||||
|                         max = slots.Count - listOffset; | ||||
|                     else | ||||
|                         max = 16; | ||||
|  | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Write((UInt16)slots[listOffset]); | ||||
|                         listOffset++; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,60 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class InventoryRemoveX32Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0155; | ||||
|         public const uint PACKET_SIZE = 0x60; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint playerActorID, List<ushort> slots, ref int listOffset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     int max; | ||||
|                     if (slots.Count - listOffset <= 32) | ||||
|                         max = slots.Count - listOffset; | ||||
|                     else | ||||
|                         max = 32; | ||||
|  | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Write((UInt16)slots[listOffset]); | ||||
|                         listOffset++; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,60 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class InventoryRemoveX64Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x156; | ||||
|         public const uint PACKET_SIZE = 0xA0; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint playerActorID, List<ushort> slots, ref int listOffset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     int max; | ||||
|                     if (slots.Count - listOffset <= 64) | ||||
|                         max = slots.Count - listOffset; | ||||
|                     else | ||||
|                         max = 64; | ||||
|  | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Write((UInt16)slots[listOffset]); | ||||
|                         listOffset++; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,52 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class InventorySetBeginPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0146; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, ushort size, ushort code) | ||||
|         { | ||||
|             byte[] data = new byte[8]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)sourceActorId); | ||||
|                     binWriter.Write((UInt16)size); | ||||
|                     binWriter.Write((UInt16)code); | ||||
|                 }                 | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,37 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class InventorySetEndPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0147; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint playerActorId) | ||||
|         { | ||||
|             return new SubPacket(OPCODE, playerActorId, new byte[8]); | ||||
|         } | ||||
|          | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,52 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
| using Meteor.Map.dataobjects; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class LinkedItemListX01Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x014D; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint playerActorID, ushort position, InventoryItem linkedItem) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt16)position); | ||||
|                     binWriter.Write((UInt16)linkedItem.slot); | ||||
|                     binWriter.Write((UInt16)linkedItem.itemPackage); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         }         | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,67 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.dataobjects; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class LinkedItemListX08Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x14E; | ||||
|         public const uint PACKET_SIZE = 0x58; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint playerActorId, InventoryItem[] linkedItemList, List<ushort> slotsToUpdate, ref int listOffset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     int max; | ||||
|                     if (slotsToUpdate.Count - listOffset <= 8) | ||||
|                         max = slotsToUpdate.Count - listOffset; | ||||
|                     else | ||||
|                         max = 8; | ||||
|  | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Write((UInt16)slotsToUpdate[i]); //LinkedItemPackageSlot | ||||
|                         binWriter.Write((UInt16)linkedItemList[slotsToUpdate[i]].slot); //ItemPackage Slot  | ||||
|                         binWriter.Write((UInt16)linkedItemList[slotsToUpdate[i]].itemPackage); //ItemPackage Code          | ||||
|                         listOffset++; | ||||
|                     } | ||||
|  | ||||
|                     binWriter.Seek(0x30, SeekOrigin.Begin); | ||||
|                     binWriter.Write((UInt32)max); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorId, data); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,65 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.dataobjects; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class LinkedItemListX16Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x14F; | ||||
|         public const uint PACKET_SIZE = 0x80; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint playerActorId, InventoryItem[] linkedItemList, List<ushort> slotsToUpdate, ref int listOffset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     int max; | ||||
|                     if (slotsToUpdate.Count - listOffset <= 16) | ||||
|                         max = slotsToUpdate.Count - listOffset; | ||||
|                     else | ||||
|                         max = 16; | ||||
|  | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Write((UInt16)slotsToUpdate[i]); //LinkedItemPackageSlot | ||||
|                         binWriter.Write((UInt16)linkedItemList[slotsToUpdate[i]].slot); //ItemPackage Slot  | ||||
|                         binWriter.Write((UInt16)linkedItemList[slotsToUpdate[i]].itemPackage); //ItemPackage Code    | ||||
|                         listOffset++; | ||||
|                     } | ||||
|  | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorId, data); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,65 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.dataobjects; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class LinkedItemListX32Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x150; | ||||
|         public const uint PACKET_SIZE = 0xE0; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint playerActorId, InventoryItem[] linkedItemList, List<ushort> slotsToUpdate, ref int listOffset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     int max; | ||||
|                     if (slotsToUpdate.Count - listOffset <= 32) | ||||
|                         max = slotsToUpdate.Count - listOffset; | ||||
|                     else | ||||
|                         max = 32; | ||||
|  | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Write((UInt16)slotsToUpdate[i]); //LinkedItemPackageSlot | ||||
|                         binWriter.Write((UInt16)linkedItemList[slotsToUpdate[i]].slot); //ItemPackage Slot  | ||||
|                         binWriter.Write((UInt16)linkedItemList[slotsToUpdate[i]].itemPackage); //ItemPackage Code   | ||||
|                         listOffset++; | ||||
|                     } | ||||
|  | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorId, data); | ||||
|         }     | ||||
|  | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,65 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.dataobjects; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor.inventory | ||||
| { | ||||
|     class LinkedItemListX64Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x151; | ||||
|         public const uint PACKET_SIZE = 0x194; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint playerActorId, InventoryItem[] linkedItemList, List<ushort> slotsToUpdate, ref int listOffset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     int max; | ||||
|                     if (slotsToUpdate.Count - listOffset <= 64) | ||||
|                         max = slotsToUpdate.Count - listOffset; | ||||
|                     else | ||||
|                         max = 64; | ||||
|  | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Write((UInt16)slotsToUpdate[i]); //LinkedItemPackageSlot | ||||
|                         binWriter.Write((UInt16)linkedItemList[slotsToUpdate[i]].slot); //ItemPackage Slot  | ||||
|                         binWriter.Write((UInt16)linkedItemList[slotsToUpdate[i]].itemPackage); //ItemPackage Code     | ||||
|                         listOffset++; | ||||
|                     } | ||||
|  | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorId, data); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,119 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| 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.inventory | ||||
| { | ||||
|     class SetInitialEquipmentPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x014E; | ||||
|         public const uint PACKET_SIZE = 0x58; | ||||
|  | ||||
|         public const uint UNEQUIPPED = 0xFFFFFFFF; | ||||
|  | ||||
|         public const int SLOT_MAINHAND			    = 0x00; | ||||
| 		public const int SLOT_OFFHAND			    = 0x01; | ||||
| 		public const int SLOT_THROWINGWEAPON		= 0x04; | ||||
| 		public const int SLOT_PACK				    = 0x05; | ||||
| 		public const int SLOT_POUCH				    = 0x06; | ||||
| 		public const int SLOT_HEAD				    = 0x08; | ||||
| 		public const int SLOT_UNDERSHIRT			= 0x09; | ||||
| 		public const int SLOT_BODY				    = 0x0A; | ||||
| 		public const int SLOT_UNDERGARMENT		    = 0x0B; | ||||
| 		public const int SLOT_LEGS				    = 0x0C; | ||||
| 		public const int SLOT_HANDS				    = 0x0D; | ||||
| 		public const int SLOT_BOOTS				    = 0x0E; | ||||
| 		public const int SLOT_WAIST				    = 0x0F; | ||||
| 		public const int SLOT_NECK				    = 0x10; | ||||
| 		public const int SLOT_EARS				    = 0x11; | ||||
| 		public const int SLOT_WRISTS				= 0x13; | ||||
| 		public const int SLOT_RIGHTFINGER		    = 0x15; | ||||
| 		public const int SLOT_LEFTFINGER			= 0x16; | ||||
|  | ||||
|         private uint[] equipment = new uint[0x17]; | ||||
|  | ||||
|         public SetInitialEquipmentPacket() | ||||
|         { | ||||
|             for (int i = 0; i < equipment.Length; i++) | ||||
|                 equipment[i] = UNEQUIPPED; //We will use this as "Unequipped" | ||||
|         } | ||||
|  | ||||
|         public void SetItem(int slot, uint itemSlot) | ||||
|         { | ||||
|             if (slot >= equipment.Length) | ||||
|                 return; | ||||
|  | ||||
|             equipment[slot] = itemSlot; | ||||
|         } | ||||
|  | ||||
|         public List<SubPacket> BuildPackets(uint playerActorID) | ||||
|         {             | ||||
|             List<SubPacket> packets = new List<SubPacket>(); | ||||
|             int packetCount = 0; | ||||
|             int runningCount = 0; | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|             MemoryStream mem = new MemoryStream(data); | ||||
|             BinaryWriter binWriter = new BinaryWriter(mem); | ||||
|  | ||||
|             for (int i = 0; i < equipment.Length; i++) | ||||
|             { | ||||
|                 if (equipment[i] == UNEQUIPPED) | ||||
|                     continue; | ||||
|  | ||||
|                 binWriter.Write((UInt16)i); | ||||
|                 binWriter.Write((UInt32)equipment[i]); | ||||
|  | ||||
|                 packetCount++; | ||||
|                 runningCount++; | ||||
|  | ||||
|                 //Create another packet | ||||
|                 if (runningCount >= 8) | ||||
|                 { | ||||
|                     packetCount = 0; | ||||
|                     binWriter.Write((UInt32)8); | ||||
|                     binWriter.Dispose(); | ||||
|                     mem.Dispose(); | ||||
|                     packets.Add(new SubPacket(OPCODE, playerActorID, playerActorID, data)); | ||||
|                     data = new byte[PACKET_SIZE - 0x20]; | ||||
|                     mem = new MemoryStream(data); | ||||
|                     binWriter = new BinaryWriter(mem); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             //Create any leftover subpacket | ||||
|             binWriter.BaseStream.Seek(0x30, SeekOrigin.Begin); | ||||
|             binWriter.Write((UInt32)packetCount); | ||||
|             binWriter.Dispose(); | ||||
|             mem.Dispose(); | ||||
|             packets.Add(new SubPacket(OPCODE, playerActorID, playerActorID, data)); | ||||
|                     | ||||
|             return packets; | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										56
									
								
								Map Server/Packets/Send/Actor/MoveActorToPositionPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								Map Server/Packets/Send/Actor/MoveActorToPositionPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,56 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class MoveActorToPositionPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x00CF; | ||||
|         public const uint PACKET_SIZE = 0x50; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, float x, float y, float z, float rot, ushort moveState) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.BaseStream.Seek(0x8, SeekOrigin.Begin); | ||||
|                     binWriter.Write((Single)x); | ||||
|                     binWriter.Write((Single)y); | ||||
|                     binWriter.Write((Single)z); | ||||
|                     binWriter.Write((Single)rot); | ||||
|                     binWriter.Write((ushort)moveState); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             SubPacket packet = new SubPacket(OPCODE, sourceActorId, data); | ||||
|             return packet; | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										37
									
								
								Map Server/Packets/Send/Actor/PlayAnimationOnActorPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								Map Server/Packets/Send/Actor/PlayAnimationOnActorPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class PlayAnimationOnActorPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x00DA; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint animationID) | ||||
|         { | ||||
|             return new SubPacket(OPCODE, sourceActorId, BitConverter.GetBytes((ulong)animationID)); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										49
									
								
								Map Server/Packets/Send/Actor/PlayBGAnimation.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								Map Server/Packets/Send/Actor/PlayBGAnimation.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class PlayBGAnimation | ||||
|     { | ||||
|         public const ushort OPCODE = 0x00D9; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, string animName) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|            | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(animName), 0, Encoding.ASCII.GetByteCount(animName) > 0x8 ? 0x8 : Encoding.ASCII.GetByteCount(animName)); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data);             | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										50
									
								
								Map Server/Packets/Send/Actor/RemoveActorPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								Map Server/Packets/Send/Actor/RemoveActorPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class RemoveActorPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x00CB; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)sourceActorId);                  | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										103
									
								
								Map Server/Packets/Send/Actor/SetActorAppearancePacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										103
									
								
								Map Server/Packets/Send/Actor/SetActorAppearancePacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,103 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class SetActorAppearancePacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x00D6; | ||||
|         public const uint PACKET_SIZE = 0x128; | ||||
|          | ||||
|         public const int SIZE = 0; | ||||
|         public const int COLORINFO = 1; | ||||
|         public const int FACEINFO = 2; | ||||
|         public const int HIGHLIGHT_HAIR = 3; | ||||
|         public const int VOICE = 4; | ||||
|         public const int MAINHAND = 5; | ||||
|         public const int OFFHAND = 6; | ||||
|         public const int SPMAINHAND = 7; | ||||
|         public const int SPOFFHAND = 8; | ||||
|         public const int THROWING = 9; | ||||
|         public const int PACK = 10; | ||||
|         public const int POUCH = 11; | ||||
|         public const int HEADGEAR = 12; | ||||
|         public const int BODYGEAR = 13; | ||||
|         public const int LEGSGEAR = 14; | ||||
|         public const int HANDSGEAR = 15; | ||||
|         public const int FEETGEAR = 16; | ||||
|         public const int WAISTGEAR = 17; | ||||
|         public const int NECKGEAR = 18; | ||||
|         public const int L_EAR = 19; | ||||
|         public const int R_EAR = 20; | ||||
|         public const int R_WRIST = 21; | ||||
|         public const int L_WRIST = 22; | ||||
|         public const int R_RINGFINGER = 23; | ||||
|         public const int L_RINGFINGER = 24; | ||||
|         public const int R_INDEXFINGER = 25; | ||||
|         public const int L_INDEXFINGER = 26; | ||||
|         public const int UNKNOWN = 27; | ||||
|  | ||||
|         public uint modelID; | ||||
|         public uint[] appearanceIDs; | ||||
|  | ||||
|         public SetActorAppearancePacket(uint modelID) | ||||
|         { | ||||
|             this.modelID = modelID; | ||||
|             appearanceIDs = new uint[28]; | ||||
|         } | ||||
|  | ||||
|         public SetActorAppearancePacket(uint modelID, uint[] appearanceTable) | ||||
|         { | ||||
|             this.modelID = modelID; | ||||
|             appearanceIDs = appearanceTable; | ||||
|         } | ||||
|  | ||||
|         public SubPacket BuildPacket(uint sourceActorId) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((uint)modelID); | ||||
|                     for (int i = 0; i < appearanceIDs.Length; i++) | ||||
|                     { | ||||
|                         binWriter.Write((uint)i); | ||||
|                         binWriter.Write((uint)appearanceIDs[i]); | ||||
|                     } | ||||
|                      | ||||
|                     binWriter.Seek(0x100, SeekOrigin.Begin); | ||||
|                     binWriter.Write(appearanceIDs.Length); | ||||
|                 } | ||||
|  | ||||
|             } | ||||
|  | ||||
|             SubPacket packet = new SubPacket(OPCODE, sourceActorId, data); | ||||
|             return packet; | ||||
|         }        | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										50
									
								
								Map Server/Packets/Send/Actor/SetActorBGPropertiesPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								Map Server/Packets/Send/Actor/SetActorBGPropertiesPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class SetActorBGPropertiesPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x00D8; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, 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, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										53
									
								
								Map Server/Packets/Send/Actor/SetActorIconPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								Map Server/Packets/Send/Actor/SetActorIconPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,53 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class SetActorIconPacket | ||||
|     { | ||||
|         public const uint DISCONNECTING = 0x00010000; | ||||
|         public const uint ISGM = 0x00020000; | ||||
|         public const uint ISAFK = 0x00000100; | ||||
|  | ||||
|         public const ushort OPCODE = 0x0145; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint iconCode) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)iconCode); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										38
									
								
								Map Server/Packets/Send/Actor/SetActorIsZoningPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								Map Server/Packets/Send/Actor/SetActorIsZoningPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class SetActorIsZoningPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x017B; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, bool isDimmed) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|             data[0] = (byte)(isDimmed ? 1 : 0); | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										58
									
								
								Map Server/Packets/Send/Actor/SetActorNamePacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								Map Server/Packets/Send/Actor/SetActorNamePacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class SetActorNamePacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x013D; | ||||
|         public const uint PACKET_SIZE = 0x48; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint displayNameID, string customName) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)displayNameID); | ||||
|  | ||||
|                     if (customName != null && (displayNameID == 0 || displayNameID == 0xFFFFFFFF)) | ||||
|                     { | ||||
|                         binWriter.Write(Encoding.ASCII.GetBytes(customName), 0, Encoding.ASCII.GetByteCount(customName) >= 0x20 ? 0x19 : Encoding.ASCII.GetByteCount(customName)); | ||||
|                     } | ||||
|  | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             SubPacket packet = new SubPacket(OPCODE, sourceActorId, data); | ||||
|             return packet; | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										69
									
								
								Map Server/Packets/Send/Actor/SetActorPositionPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								Map Server/Packets/Send/Actor/SetActorPositionPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,69 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class SetActorPositionPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x00CE; | ||||
|         public const uint PACKET_SIZE = 0x48; | ||||
|  | ||||
|         public const ushort SPAWNTYPE_FADEIN = 0; | ||||
|         public const ushort SPAWNTYPE_PLAYERWAKE = 1; | ||||
|         public const ushort SPAWNTYPE_WARP_DUTY = 2; | ||||
|         public const ushort SPAWNTYPE_WARP2 = 3; | ||||
|         public const ushort SPAWNTYPE_WARP3 = 4; | ||||
|         public const ushort SPAWNTYPE_WARP_YELLOW = 5; | ||||
|         public const ushort SPAWNTYPE_WARP_DUTY2 = 6; | ||||
|         public const ushort SPAWNTYPE_WARP_LIGHT = 7; | ||||
|          | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint actorId, float x, float y, float z, float rotation, ushort spawnType, bool isZoningPlayer) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE-0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((Int32)0);                     | ||||
|                     binWriter.Write((Int32)actorId); | ||||
|                     binWriter.Write((Single)x); | ||||
|                     binWriter.Write((Single)y); | ||||
|                     binWriter.Write((Single)z); | ||||
|                     binWriter.Write((Single)rotation); | ||||
|  | ||||
|                     binWriter.BaseStream.Seek(0x24, SeekOrigin.Begin); | ||||
|  | ||||
|                     binWriter.Write((UInt16)spawnType); | ||||
|                     binWriter.Write((UInt16)(isZoningPlayer ? 1 : 0)); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										243
									
								
								Map Server/Packets/Send/Actor/SetActorPropetyPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										243
									
								
								Map Server/Packets/Send/Actor/SetActorPropetyPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,243 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Linq; | ||||
| using System.Reflection; | ||||
| using System.Text; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class SetActorPropetyPacket | ||||
|     { | ||||
|  | ||||
|         public const ushort OPCODE = 0x0137; | ||||
|         public const uint PACKET_SIZE = 0xA8; | ||||
|  | ||||
|         private const ushort MAXBYTES = 0x7D;         | ||||
|  | ||||
|         private ushort runningByteTotal = 0; | ||||
|         private byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|         private bool isArrayMode = false; | ||||
|         private bool isMore = false; | ||||
|  | ||||
|         string currentTarget; | ||||
|  | ||||
|         private MemoryStream mem; | ||||
|         private BinaryWriter binWriter; | ||||
|  | ||||
|         public SetActorPropetyPacket(string startingTarget) | ||||
|         { | ||||
|             mem = new MemoryStream(data); | ||||
|             binWriter = new BinaryWriter(mem); | ||||
|             binWriter.Seek(1, SeekOrigin.Begin); | ||||
|             currentTarget = startingTarget; | ||||
|         } | ||||
|  | ||||
|         public void CloseStreams() | ||||
|         { | ||||
|             binWriter.Dispose(); | ||||
|             mem.Dispose(); | ||||
|         } | ||||
|  | ||||
|         public bool AddByte(uint id, byte value) | ||||
|         { | ||||
|             if (runningByteTotal + 6 + (1 + Encoding.ASCII.GetByteCount(currentTarget)) > MAXBYTES) | ||||
|                 return false; | ||||
|  | ||||
|             binWriter.Write((byte)1); | ||||
|             binWriter.Write((UInt32)id); | ||||
|             binWriter.Write((byte)value); | ||||
|             runningByteTotal+=6; | ||||
|  | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         public bool AddShort(uint id, ushort value) | ||||
|         { | ||||
|             if (runningByteTotal + 7 + (1 + Encoding.ASCII.GetByteCount(currentTarget)) > MAXBYTES) | ||||
|                 return false; | ||||
|  | ||||
|             binWriter.Write((byte)2); | ||||
|             binWriter.Write((UInt32)id); | ||||
|             binWriter.Write((UInt16)value); | ||||
|             runningByteTotal+=7; | ||||
|  | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         public bool AddInt(uint id, uint value) | ||||
|         { | ||||
|             if (runningByteTotal + 9 + (1 + Encoding.ASCII.GetByteCount(currentTarget)) > MAXBYTES) | ||||
|                 return false; | ||||
|  | ||||
|             binWriter.Write((byte)4); | ||||
|             binWriter.Write((UInt32)id); | ||||
|             binWriter.Write((UInt32)value); | ||||
|             runningByteTotal+=9; | ||||
|  | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         public bool AddBuffer(uint id, byte[] buffer) | ||||
|         { | ||||
|             if (runningByteTotal + 5 + buffer.Length + (1 + Encoding.ASCII.GetByteCount(currentTarget)) > MAXBYTES) | ||||
|                 return false; | ||||
|  | ||||
|             binWriter.Write((byte)buffer.Length); | ||||
|             binWriter.Write((UInt32)id); | ||||
|             binWriter.Write(buffer); | ||||
|             runningByteTotal += (ushort)(5 + buffer.Length); | ||||
|  | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         public bool AddBuffer(uint id, byte[] buffer, int index, int length, int page) | ||||
|         { | ||||
|             if (runningByteTotal + 5 + length + (1 + Encoding.ASCII.GetByteCount(currentTarget)) > MAXBYTES) | ||||
|                 return false; | ||||
|  | ||||
|             binWriter.Write((byte)(length + 1)); | ||||
|             binWriter.Write((UInt32)id); | ||||
|             binWriter.Write(buffer, index, length); | ||||
|             binWriter.Write((byte)page); | ||||
|             runningByteTotal += (ushort)(6 + length); | ||||
|  | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         public bool AddProperty(Meteor.Map.Actors.Actor actor, string name) | ||||
|         { | ||||
|             string[] split = name.Split('.'); | ||||
|             int arrayIndex = 0; | ||||
|  | ||||
|             if (!(split[0].Equals("work") || split[0].Equals("charaWork") || split[0].Equals("playerWork") || split[0].Equals("npcWork") || split[0].Equals("guildleveWork"))) | ||||
|                 return false; | ||||
|  | ||||
|             Object curObj = actor; | ||||
|             for (int i = 0; i < split.Length; i++) | ||||
|             { | ||||
|                 //For arrays | ||||
|                 if (split[i].Contains('[')) | ||||
|                 { | ||||
|                     if (split[i].LastIndexOf(']') - split[i].IndexOf('[') <= 0) | ||||
|                         return false; | ||||
|  | ||||
|                     arrayIndex = Convert.ToInt32(split[i].Substring(split[i].IndexOf('[') + 1, split[i].LastIndexOf(']') - split[i].LastIndexOf('[')-1)); | ||||
|                     split[i] = split[i].Substring(0, split[i].IndexOf('[')); | ||||
|                 } | ||||
|  | ||||
|                 FieldInfo field = curObj.GetType().GetField(split[i]); | ||||
|                 if (field == null) | ||||
|                     return false; | ||||
|  | ||||
|                 curObj = field.GetValue(curObj); | ||||
|                 if (curObj == null) | ||||
|                     return false; | ||||
|             } | ||||
|  | ||||
|             if (curObj == null) | ||||
|                 return false; | ||||
|             else | ||||
|             { | ||||
|                 //Array, we actually care whats inside | ||||
|                 if (curObj.GetType().IsArray) | ||||
|                 { | ||||
|                     if (((Array)curObj).Length <= arrayIndex) | ||||
|                         return false; | ||||
|                     curObj = ((Array)curObj).GetValue(arrayIndex); | ||||
|                 } | ||||
|  | ||||
|                 if (curObj == null) | ||||
|                     return false; | ||||
|  | ||||
|                 //Cast to the proper object and Add to packet | ||||
|                 uint id = Utils.MurmurHash2(name, 0); | ||||
|                 if (curObj is bool)                 | ||||
|                     return AddByte(id, (byte)(((bool)curObj) ? 1 : 0)); | ||||
|                 else if (curObj is byte) | ||||
|                     return AddByte(id, (byte)curObj); | ||||
|                 else if (curObj is sbyte) | ||||
|                     return AddByte(id, (byte)(sbyte)curObj); | ||||
|                 else if (curObj is ushort) | ||||
|                     return AddShort(id, (ushort)curObj); | ||||
|                 else if (curObj is short) | ||||
|                     return AddShort(id, (ushort)(short)curObj); | ||||
|                 else if (curObj is uint) | ||||
|                     return AddInt(id, (uint)curObj); | ||||
|                 else if (curObj is int) | ||||
|                     return AddInt(id, (uint)(int)curObj); | ||||
|                 else if (curObj is float) | ||||
|                     return AddBuffer(id, BitConverter.GetBytes((float)curObj)); | ||||
|                 else | ||||
|                     return false; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         public void SetIsArrayMode(bool flag) | ||||
|         { | ||||
|             isArrayMode = flag; | ||||
|         } | ||||
|  | ||||
|         public void SetIsMore(bool flag) | ||||
|         { | ||||
|             isMore = flag; | ||||
|         } | ||||
|  | ||||
|         public void SetTarget(string target) | ||||
|         { | ||||
|             currentTarget = target; | ||||
|         } | ||||
|  | ||||
|         public void AddTarget() | ||||
|         { | ||||
|             if (isArrayMode) | ||||
|                 binWriter.Write((byte)(0xA4 + currentTarget.Length)); | ||||
|             else | ||||
|                 binWriter.Write((byte)(isMore ? 0x60 + currentTarget.Length : 0x82 + currentTarget.Length)); | ||||
|             binWriter.Write(Encoding.ASCII.GetBytes(currentTarget)); | ||||
|             runningByteTotal += (ushort)(1 + Encoding.ASCII.GetByteCount(currentTarget)); | ||||
|         } | ||||
|  | ||||
|         public void AddTarget(string newTarget) | ||||
|         { | ||||
|             binWriter.Write((byte)(isMore ? 0x60 + currentTarget.Length : 0x82 + currentTarget.Length)); | ||||
|             binWriter.Write(Encoding.ASCII.GetBytes(currentTarget)); | ||||
|             runningByteTotal += (ushort)(1 + Encoding.ASCII.GetByteCount(currentTarget)); | ||||
|             currentTarget = newTarget; | ||||
|         } | ||||
|  | ||||
|         public SubPacket BuildPacket(uint sourceActorId) | ||||
|         { | ||||
|             binWriter.Seek(0, SeekOrigin.Begin); | ||||
|             binWriter.Write((byte)runningByteTotal); | ||||
|              | ||||
|             CloseStreams(); | ||||
|  | ||||
|             SubPacket packet = new SubPacket(OPCODE, sourceActorId, data); | ||||
|             return packet; | ||||
|         }        | ||||
|      | ||||
|     } | ||||
| } | ||||
							
								
								
									
										96
									
								
								Map Server/Packets/Send/Actor/SetActorSpeedPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								Map Server/Packets/Send/Actor/SetActorSpeedPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,96 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class SetActorSpeedPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x00D0; | ||||
|         public const uint PACKET_SIZE = 0xA8; | ||||
|  | ||||
|         public const float DEFAULT_STOP = 0.0f; | ||||
|         public const float DEFAULT_WALK = 2.0f; | ||||
|         public const float DEFAULT_RUN = 5.0f; | ||||
|         public const float DEFAULT_ACTIVE = 5.0f; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((Single)DEFAULT_STOP); | ||||
|                     binWriter.Write((UInt32)0); | ||||
|  | ||||
|                     binWriter.Write((Single)DEFAULT_WALK); | ||||
|                     binWriter.Write((UInt32)1); | ||||
|  | ||||
|                     binWriter.Write((Single)DEFAULT_RUN); | ||||
|                     binWriter.Write((UInt32)2); | ||||
|  | ||||
|                     binWriter.Write((Single)DEFAULT_ACTIVE); | ||||
|                     binWriter.Write((UInt32)3); | ||||
|  | ||||
|                     binWriter.BaseStream.Seek(0x80, SeekOrigin.Begin); | ||||
|  | ||||
|                     binWriter.Write((UInt32)4); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, float stopSpeed, float walkSpeed, float runSpeed, float activeSpeed) | ||||
|         {                | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((Single)stopSpeed); | ||||
|                     binWriter.Write((UInt32)0); | ||||
|  | ||||
|                     binWriter.Write((Single)walkSpeed); | ||||
|                     binWriter.Write((UInt32)1); | ||||
|  | ||||
|                     binWriter.Write((Single)runSpeed); | ||||
|                     binWriter.Write((UInt32)2); | ||||
|                      | ||||
|                     binWriter.Write((Single)activeSpeed); | ||||
|                     binWriter.Write((UInt32)3); | ||||
|  | ||||
|                     binWriter.BaseStream.Seek(0x80, SeekOrigin.Begin); | ||||
|  | ||||
|                     binWriter.Write((UInt32)4); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										58
									
								
								Map Server/Packets/Send/Actor/SetActorStatePacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								Map Server/Packets/Send/Actor/SetActorStatePacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class SetActorStatePacket | ||||
|     { | ||||
|         public const int MAIN_STATE_PASSIVE = 0; | ||||
|         public const int MAIN_STATE_DEAD = 1; | ||||
|         public const int MAIN_STATE_ACTIVE = 2; | ||||
|         public const int MAIN_STATE_DEAD2 = 3; | ||||
|  | ||||
|         public const int MAIN_STATE_SITTING_OBJECT = 11; | ||||
|         public const int MAIN_STATE_SITTING_FLOOR = 13; | ||||
|  | ||||
|         public const int MAIN_STATE_MOUNTED = 15; | ||||
|  | ||||
|         public const int MAIN_STATE_UNKNOWN1 = 0x0E; | ||||
|         public const int MAIN_STATE_UNKNOWN2 = 0x1E; | ||||
|         public const int MAIN_STATE_UNKNOWN3 = 0x1F; | ||||
|         public const int MAIN_STATE_UNKNOWN4 = 0x20; | ||||
|  | ||||
|         //What is this for? | ||||
|         public const int SUB_STATE_NONE = 0x00; | ||||
|         public const int SUB_STATE_PLAYER = 0xBF; | ||||
|         public const int SUB_STATE_MONSTER = 0x03; | ||||
|  | ||||
|         public const ushort OPCODE = 0x134; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint mainState, uint subState) | ||||
|         {             | ||||
|             ulong combined = (mainState & 0xFF) | ((subState & 0xFF) << 8); | ||||
|             return new SubPacket(OPCODE, sourceActorId, BitConverter.GetBytes(combined)); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										54
									
								
								Map Server/Packets/Send/Actor/SetActorStatusAllPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								Map Server/Packets/Send/Actor/SetActorStatusAllPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,54 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class SetActorStatusAllPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0179; | ||||
|         public const uint PACKET_SIZE = 0x48; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, ushort[] statusIds) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|            | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     for (int i = 0; i < statusIds.Length; i++) | ||||
|                     { | ||||
|                         if (i >= 20) | ||||
|                             break; | ||||
|                         binWriter.Write((UInt16)statusIds[i]); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             SubPacket packet = new SubPacket(OPCODE, sourceActorId, data); | ||||
|             return packet; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										49
									
								
								Map Server/Packets/Send/Actor/SetActorStatusPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								Map Server/Packets/Send/Actor/SetActorStatusPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class SetActorStatusPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0177; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, ushort index, ushort statusCode) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|            | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt16)index); | ||||
|                     binWriter.Write((UInt16)statusCode); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data);             | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										66
									
								
								Map Server/Packets/Send/Actor/SetActorSubStatePacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								Map Server/Packets/Send/Actor/SetActorSubStatePacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,66 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
| using Meteor.Map.actors.chara; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class SetActorSubStatePacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x144; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         enum SubStat : int | ||||
|         { | ||||
|             Breakage          = 0x00, // (index goes high to low, bitflags) | ||||
|             Chant             = 0x01, // [Nibbles: left / right hand = value]) (AKA SubStatObject) | ||||
|             Guard             = 0x02, // [left / right hand = true] 0,1,2,3) ||| High byte also defines how many bools to use as flags for byte 0x4.  | ||||
|             Waste             = 0x03, // (High Nibble) | ||||
|             Mode              = 0x04, // ??? | ||||
|             Unknown           = 0x05, // ??? | ||||
|             SubStatMotionPack = 0x06, | ||||
|             Unknown2          = 0x07, | ||||
|         } | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, SubState substate) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                    binWriter.Write((byte)substate.breakage); | ||||
|                    binWriter.Write((byte)substate.chantId); | ||||
|                    binWriter.Write((byte)(substate.guard & 0xF)); | ||||
|                    binWriter.Write((byte)(substate.waste)); | ||||
|                    binWriter.Write((byte)(substate.mode)); | ||||
|                    binWriter.Write((byte)0); | ||||
|                    binWriter.Write((ushort)substate.motionPack); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,38 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class SetActorTargetAnimatedPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x00D3; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|          | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint targetID) | ||||
|         {             | ||||
|             return new SubPacket(OPCODE, sourceActorId, BitConverter.GetBytes((ulong)targetID)); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										37
									
								
								Map Server/Packets/Send/Actor/SetActorTargetPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								Map Server/Packets/Send/Actor/SetActorTargetPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class SetActorTargetPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x00DB; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|          | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint targetID) | ||||
|         {             | ||||
|             return new SubPacket(OPCODE, sourceActorId, BitConverter.GetBytes((ulong)targetID)); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										53
									
								
								Map Server/Packets/Send/Actor/StartCountdownPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								Map Server/Packets/Send/Actor/StartCountdownPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,53 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class StartCountdownPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0xE5; | ||||
|         public const uint PACKET_SIZE = 0x48; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, byte countdownLength, ulong syncTime, string message) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((Byte)countdownLength); | ||||
|                     binWriter.Seek(8, SeekOrigin.Begin); | ||||
|                     binWriter.Write((UInt64)syncTime); | ||||
|                     binWriter.Seek(18, SeekOrigin.Begin); | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(message), 0, Encoding.ASCII.GetByteCount(message) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(message)); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										50
									
								
								Map Server/Packets/Send/Actor/_0x132Packet.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								Map Server/Packets/Send/Actor/_0x132Packet.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class _0x132Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x132; | ||||
|         public const uint PACKET_SIZE = 0x48; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, ushort number, string function) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt16)number); | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(function), 0, Encoding.ASCII.GetByteCount(function) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(function)); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										48
									
								
								Map Server/Packets/Send/Actor/_0xFPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								Map Server/Packets/Send/Actor/_0xFPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,48 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class _0xFPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x000F; | ||||
|         public const uint PACKET_SIZE = 0x38; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActor) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                      | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActor, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										54
									
								
								Map Server/Packets/Send/Events/EndEventPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								Map Server/Packets/Send/Events/EndEventPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,54 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.events | ||||
| { | ||||
|     class EndEventPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0131; | ||||
|         public const uint PACKET_SIZE = 0x50; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourcePlayerActorId, uint eventOwnerActorID, string eventStarter) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|             int maxBodySize = data.Length - 0x80; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)sourcePlayerActorId); | ||||
|                     binWriter.Write((UInt32)0); | ||||
|                     binWriter.Write((Byte)1); | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(eventStarter), 0, Encoding.ASCII.GetByteCount(eventStarter) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(eventStarter)); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourcePlayerActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										61
									
								
								Map Server/Packets/Send/Events/KickEventPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								Map Server/Packets/Send/Events/KickEventPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,61 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.lua; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.events | ||||
| { | ||||
|     class KickEventPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x012F; | ||||
|         public const uint PACKET_SIZE = 0x90; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourcePlayerActorId, uint targetEventActorId, uint unknown, string conditionName, List<LuaParam> luaParams) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)sourcePlayerActorId); | ||||
|                     binWriter.Write((UInt32)targetEventActorId); | ||||
|                     binWriter.Write((UInt32)unknown); | ||||
|                     binWriter.Write((UInt32)0x30400000); | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(conditionName), 0, Encoding.ASCII.GetByteCount(conditionName) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(conditionName)); | ||||
|  | ||||
|                     binWriter.Seek(0x30, SeekOrigin.Begin); | ||||
|  | ||||
|                     LuaUtils.WriteLuaParams(binWriter, luaParams); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourcePlayerActorId, data); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| } | ||||
							
								
								
									
										61
									
								
								Map Server/Packets/Send/Events/RunEventFunctionPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								Map Server/Packets/Send/Events/RunEventFunctionPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,61 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.lua; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.events | ||||
| { | ||||
|     class RunEventFunctionPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0130; | ||||
|         public const uint PACKET_SIZE = 0x2B8; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourcePlayerActorId, uint eventOwnerActorID, string eventStarter, string callFunction, List<LuaParam> luaParams) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|             int maxBodySize = data.Length - 0x80; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)sourcePlayerActorId); | ||||
|                     binWriter.Write((UInt32)eventOwnerActorID); | ||||
|                     binWriter.Write((Byte)5); | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(eventStarter), 0, Encoding.ASCII.GetByteCount(eventStarter) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(eventStarter)); | ||||
|                     binWriter.Seek(0x29, SeekOrigin.Begin); | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(callFunction), 0, Encoding.ASCII.GetByteCount(callFunction) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(callFunction)); | ||||
|                     binWriter.Seek(0x49, SeekOrigin.Begin); | ||||
|  | ||||
|                     LuaUtils.WriteLuaParams(binWriter, luaParams); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourcePlayerActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										371
									
								
								Map Server/Packets/Send/GameMessagePacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										371
									
								
								Map Server/Packets/Send/GameMessagePacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,371 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.lua; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace Meteor.Map.packets.send | ||||
| { | ||||
|     class GameMessagePacket | ||||
|     {         | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITH_ACTOR1 = 0x157; | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITH_ACTOR2 = 0x158; | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITH_ACTOR3 = 0x159; | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITH_ACTOR4 = 0x15a; | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITH_ACTOR5 = 0x15b; | ||||
|  | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITH_CUSTOM_SENDER1 = 0x15c; | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITH_CUSTOM_SENDER2 = 0x15d; | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITH_CUSTOM_SENDER3 = 0x15e; | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITH_CUSTOM_SENDER4 = 0x15f; | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITH_CUSTOM_SENDER5 = 0x160; | ||||
|  | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITH_DISPID_SENDER1 = 0x161; | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITH_DISPID_SENDER2 = 0x162; | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITH_DISPID_SENDER3 = 0x163; | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITH_DISPID_SENDER4 = 0x164; | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITH_DISPID_SENDER5 = 0x165; | ||||
|  | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITHOUT_ACTOR1 = 0x166; | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITHOUT_ACTOR2 = 0x167; | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITHOUT_ACTOR3 = 0x168; | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITHOUT_ACTOR4 = 0x169; | ||||
|         private const ushort OPCODE_GAMEMESSAGE_WITHOUT_ACTOR5 = 0x16a; | ||||
|  | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITH_ACTOR1 = 0x30; | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITH_ACTOR2 = 0x38; | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITH_ACTOR3 = 0x40; | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITH_ACTOR4 = 0x50; | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITH_ACTOR5 = 0x70; | ||||
|  | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITH_CUSTOM_SENDER1 = 0x48; | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITH_CUSTOM_SENDER2 = 0x58; | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITH_CUSTOM_SENDER3 = 0x68; | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITH_CUSTOM_SENDER4 = 0x78; | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITH_CUSTOM_SENDER5 = 0x98; | ||||
|  | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITH_DISPID_SENDER1 = 0x30; | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITH_DISPID_SENDER2 = 0x38; | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITH_DISPID_SENDER3 = 0x40; | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITH_DISPID_SENDER4 = 0x50; | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITH_DISPID_SENDER5 = 0x60; | ||||
|  | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITHOUT_ACTOR1 = 0x28; | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITHOUT_ACTOR2 = 0x38; | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITHOUT_ACTOR3 = 0x38; | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITHOUT_ACTOR4 = 0x48; | ||||
|         private const ushort SIZE_GAMEMESSAGE_WITHOUT_ACTOR5 = 0x68; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint actorId, uint textOwnerActorId, ushort textId, byte log) | ||||
|         { | ||||
|             byte[] data = new byte[SIZE_GAMEMESSAGE_WITH_ACTOR1 - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 {                     | ||||
|                     binWriter.Write((UInt32)actorId); | ||||
|                     binWriter.Write((UInt32)textOwnerActorId); | ||||
|                     binWriter.Write((UInt16)textId); | ||||
|                     binWriter.Write((UInt16)log); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE_GAMEMESSAGE_WITH_ACTOR1, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint actorId, uint textOwnerActorId, ushort textId, byte log, List<LuaParam> lParams) | ||||
|         { | ||||
|             int lParamsSize = findSizeOfParams(lParams); | ||||
|             byte[] data; | ||||
|             ushort opcode; | ||||
|  | ||||
|             if (lParamsSize <= 0x8) | ||||
|             { | ||||
|                 data = new byte[SIZE_GAMEMESSAGE_WITH_ACTOR2 - 0x20]; | ||||
|                 opcode = OPCODE_GAMEMESSAGE_WITH_ACTOR2; | ||||
|             } | ||||
|             else if (lParamsSize <= 0x10) | ||||
|             { | ||||
|                 data = new byte[SIZE_GAMEMESSAGE_WITH_ACTOR3 - 0x20]; | ||||
|                 opcode = OPCODE_GAMEMESSAGE_WITH_ACTOR3; | ||||
|             } | ||||
|             else if (lParamsSize <= 0x20) | ||||
|             { | ||||
|                 data = new byte[SIZE_GAMEMESSAGE_WITH_ACTOR4 - 0x20]; | ||||
|                 opcode = OPCODE_GAMEMESSAGE_WITH_ACTOR4; | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 data = new byte[SIZE_GAMEMESSAGE_WITH_ACTOR5 - 0x20]; | ||||
|                 opcode = OPCODE_GAMEMESSAGE_WITH_ACTOR5; | ||||
|             } | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)actorId); | ||||
|                     binWriter.Write((UInt32)textOwnerActorId); | ||||
|                     binWriter.Write((UInt16)textId); | ||||
|                     binWriter.Write((UInt16)log); | ||||
|                     LuaUtils.WriteLuaParams(binWriter, lParams); | ||||
|  | ||||
|                     if (lParamsSize <= 0x14-12) | ||||
|                     { | ||||
|                         binWriter.Seek(0x14, SeekOrigin.Begin); | ||||
|                         binWriter.Write((UInt32)8); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(opcode, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint textOwnerActorId, ushort textId, string sender, byte log) | ||||
|         { | ||||
|             byte[] data = new byte[SIZE_GAMEMESSAGE_WITH_CUSTOM_SENDER1 - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)textOwnerActorId); | ||||
|                     binWriter.Write((UInt16)textId); | ||||
|                     binWriter.Write((UInt16)log); | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(sender), 0, Encoding.ASCII.GetByteCount(sender) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(sender)); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE_GAMEMESSAGE_WITH_CUSTOM_SENDER1, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint textOwnerActorId, ushort textId, string sender, byte log, List<LuaParam> lParams) | ||||
|         { | ||||
|             int lParamsSize = findSizeOfParams(lParams); | ||||
|             byte[] data; | ||||
|             ushort opcode; | ||||
|  | ||||
|             if (lParamsSize <= 0x8) | ||||
|             { | ||||
|                 data = new byte[SIZE_GAMEMESSAGE_WITH_CUSTOM_SENDER2 - 0x20]; | ||||
|                 opcode = OPCODE_GAMEMESSAGE_WITH_CUSTOM_SENDER2; | ||||
|             } | ||||
|             else if (lParamsSize <= 0x10) | ||||
|             { | ||||
|                 data = new byte[SIZE_GAMEMESSAGE_WITH_CUSTOM_SENDER3 - 0x20]; | ||||
|                 opcode = OPCODE_GAMEMESSAGE_WITH_CUSTOM_SENDER3; | ||||
|             } | ||||
|             else if (lParamsSize <= 0x20) | ||||
|             { | ||||
|                 data = new byte[SIZE_GAMEMESSAGE_WITH_CUSTOM_SENDER4 - 0x20]; | ||||
|                 opcode = OPCODE_GAMEMESSAGE_WITH_CUSTOM_SENDER4; | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 data = new byte[SIZE_GAMEMESSAGE_WITH_CUSTOM_SENDER5 - 0x20]; | ||||
|                 opcode = OPCODE_GAMEMESSAGE_WITH_CUSTOM_SENDER5; | ||||
|             } | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)textOwnerActorId); | ||||
|                     binWriter.Write((UInt16)textId); | ||||
|                     binWriter.Write((UInt16)log); | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(sender), 0, Encoding.ASCII.GetByteCount(sender) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(sender)); | ||||
|                     LuaUtils.WriteLuaParams(binWriter, lParams); | ||||
|  | ||||
|                     if (lParamsSize <= 0x14 - 12) | ||||
|                     { | ||||
|                         binWriter.Seek(0x30, SeekOrigin.Begin); | ||||
|                         binWriter.Write((UInt32)8); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(opcode, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint textOwnerActorId, ushort textId, uint senderDisplayNameId, byte log) | ||||
|         { | ||||
|             byte[] data = new byte[SIZE_GAMEMESSAGE_WITH_DISPID_SENDER1 - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)senderDisplayNameId); | ||||
|                     binWriter.Write((UInt32)textOwnerActorId); | ||||
|                     binWriter.Write((UInt16)textId); | ||||
|                     binWriter.Write((UInt16)log); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE_GAMEMESSAGE_WITH_DISPID_SENDER1, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint textOwnerActorId, ushort textId, uint senderDisplayNameId, byte log, List<LuaParam> lParams) | ||||
|         { | ||||
|             int lParamsSize = findSizeOfParams(lParams); | ||||
|             byte[] data; | ||||
|             ushort opcode; | ||||
|  | ||||
|             if (lParamsSize <= 0x8) | ||||
|             { | ||||
|                 data = new byte[SIZE_GAMEMESSAGE_WITH_DISPID_SENDER2 - 0x20]; | ||||
|                 opcode = OPCODE_GAMEMESSAGE_WITH_DISPID_SENDER2; | ||||
|             } | ||||
|             else if (lParamsSize <= 0x10) | ||||
|             { | ||||
|                 data = new byte[SIZE_GAMEMESSAGE_WITH_DISPID_SENDER3 - 0x20]; | ||||
|                 opcode = OPCODE_GAMEMESSAGE_WITH_DISPID_SENDER3; | ||||
|             } | ||||
|             else if (lParamsSize <= 0x20) | ||||
|             { | ||||
|                 data = new byte[SIZE_GAMEMESSAGE_WITH_DISPID_SENDER4 - 0x20]; | ||||
|                 opcode = OPCODE_GAMEMESSAGE_WITH_DISPID_SENDER4; | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 data = new byte[SIZE_GAMEMESSAGE_WITH_DISPID_SENDER5 - 0x20]; | ||||
|                 opcode = OPCODE_GAMEMESSAGE_WITH_DISPID_SENDER5; | ||||
|             } | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)senderDisplayNameId); | ||||
|                     binWriter.Write((UInt32)textOwnerActorId); | ||||
|                     binWriter.Write((UInt16)textId); | ||||
|                     binWriter.Write((UInt16)log); | ||||
|                     LuaUtils.WriteLuaParams(binWriter, lParams); | ||||
|  | ||||
|                     if (lParamsSize <= 0x14 - 12) | ||||
|                     { | ||||
|                         binWriter.Seek(0x14, SeekOrigin.Begin); | ||||
|                         binWriter.Write((UInt32)8); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(opcode, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint textOwnerActorId, ushort textId, byte log) | ||||
|         { | ||||
|             byte[] data = new byte[SIZE_GAMEMESSAGE_WITHOUT_ACTOR1 - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)textOwnerActorId); | ||||
|                     binWriter.Write((UInt16)textId); | ||||
|                     binWriter.Write((UInt16)log); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE_GAMEMESSAGE_WITHOUT_ACTOR1, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint textOwnerActorId, ushort textId, byte log, List<LuaParam> lParams) | ||||
|         { | ||||
|             int lParamsSize = findSizeOfParams(lParams); | ||||
|             byte[] data; | ||||
|             ushort opcode; | ||||
|  | ||||
|             if (lParamsSize <= 0x8) | ||||
|             { | ||||
|                 data = new byte[SIZE_GAMEMESSAGE_WITHOUT_ACTOR2 - 0x20]; | ||||
|                 opcode = OPCODE_GAMEMESSAGE_WITHOUT_ACTOR2; | ||||
|             } | ||||
|             else if (lParamsSize <= 0x10) | ||||
|             { | ||||
|                 data = new byte[SIZE_GAMEMESSAGE_WITHOUT_ACTOR3 - 0x20]; | ||||
|                 opcode = OPCODE_GAMEMESSAGE_WITHOUT_ACTOR3; | ||||
|             } | ||||
|             else if (lParamsSize <= 0x20) | ||||
|             { | ||||
|                 data = new byte[SIZE_GAMEMESSAGE_WITHOUT_ACTOR4 - 0x20]; | ||||
|                 opcode = OPCODE_GAMEMESSAGE_WITHOUT_ACTOR4; | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 data = new byte[SIZE_GAMEMESSAGE_WITHOUT_ACTOR5 - 0x20]; | ||||
|                 opcode = OPCODE_GAMEMESSAGE_WITHOUT_ACTOR5; | ||||
|             } | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)textOwnerActorId); | ||||
|                     binWriter.Write((UInt16)textId); | ||||
|                     binWriter.Write((UInt16)log); | ||||
|                     LuaUtils.WriteLuaParams(binWriter, lParams); | ||||
|  | ||||
|                     if (lParamsSize <= 0x8) | ||||
|                     { | ||||
|                         binWriter.Seek(0x10, SeekOrigin.Begin); | ||||
|                         binWriter.Write((UInt32)8); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(opcode, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|         private static int findSizeOfParams(List<LuaParam> lParams) | ||||
|         { | ||||
|             int total = 0; | ||||
|             foreach (LuaParam l in lParams) | ||||
|             { | ||||
|                 switch (l.typeID) | ||||
|                 { | ||||
|                     case 0: | ||||
|                     case 1: | ||||
|                         total += 5; | ||||
|                         break; | ||||
|                     case 2: | ||||
|                         total += 20; | ||||
|                         break; | ||||
|                     case 6: | ||||
|                         total += 5; | ||||
|                         break; | ||||
|                     case 3: | ||||
|                     case 4: | ||||
|                     case 5: | ||||
|                         total += 1; | ||||
|                         break; | ||||
|                 } | ||||
|             } | ||||
|             return total + 1; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										69
									
								
								Map Server/Packets/Send/Groups/ContentMembersX08Packet.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								Map Server/Packets/Send/Groups/ContentMembersX08Packet.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,69 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.group | ||||
| { | ||||
|     class ContentMembersX08Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0183; | ||||
|         public const uint PACKET_SIZE = 0x1B8; | ||||
|  | ||||
|         public static SubPacket buildPacket(uint playerActorID, uint locationCode, ulong sequenceId, List<GroupMember> entries, ref int offset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     //Write List Header | ||||
|                     binWriter.Write((UInt64)locationCode); | ||||
|                     binWriter.Write((UInt64)sequenceId); | ||||
|                     //Write Entries | ||||
|                     int max = 8; | ||||
|                     if (entries.Count-offset < 8) | ||||
|                         max = entries.Count - offset; | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Seek(0x10 + (0xC * i), SeekOrigin.Begin); | ||||
|  | ||||
|                         GroupMember entry = entries[i]; | ||||
|                         binWriter.Write((UInt32)entry.actorId); | ||||
|                         binWriter.Write((UInt32)1001); //Layout ID | ||||
|                         binWriter.Write((UInt32)1); //? | ||||
|  | ||||
|                         offset++; | ||||
|                     } | ||||
|                     //Write Count | ||||
|                     binWriter.Seek(0x10 + (0xC * 8), SeekOrigin.Begin); | ||||
|                     binWriter.Write(max); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										66
									
								
								Map Server/Packets/Send/Groups/ContentMembersX16Packet.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								Map Server/Packets/Send/Groups/ContentMembersX16Packet.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,66 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.group | ||||
| { | ||||
|     class ContentMembersX16Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0184; | ||||
|         public const uint PACKET_SIZE = 0xF0; | ||||
|  | ||||
|         public static SubPacket buildPacket(uint playerActorID, uint locationCode, ulong sequenceId, List<GroupMember> entries, ref int offset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     //Write List Header | ||||
|                     binWriter.Write((UInt64)locationCode); | ||||
|                     binWriter.Write((UInt64)sequenceId); | ||||
|                     //Write Entries | ||||
|                     int max = 16; | ||||
|                     if (entries.Count-offset < 16) | ||||
|                         max = entries.Count - offset; | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Seek(0x10 + (0xC * i), SeekOrigin.Begin); | ||||
|  | ||||
|                         GroupMember entry = entries[i]; | ||||
|                         binWriter.Write((UInt32)entry.actorId); | ||||
|                         binWriter.Write((UInt32)1001); | ||||
|                         binWriter.Write((UInt32)1); | ||||
|  | ||||
|                         offset++; | ||||
|                     }                     | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										66
									
								
								Map Server/Packets/Send/Groups/ContentMembersX32Packet.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								Map Server/Packets/Send/Groups/ContentMembersX32Packet.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,66 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.group | ||||
| { | ||||
|     class ContentMembersX32Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0185; | ||||
|         public const uint PACKET_SIZE = 0x1B0; | ||||
|  | ||||
|         public static SubPacket buildPacket(uint playerActorID, uint locationCode, ulong sequenceId, List<GroupMember> entries, ref int offset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     //Write List Header | ||||
|                     binWriter.Write((UInt64)locationCode); | ||||
|                     binWriter.Write((UInt64)sequenceId); | ||||
|                     //Write Entries | ||||
|                     int max = 32; | ||||
|                     if (entries.Count-offset < 32) | ||||
|                         max = entries.Count - offset; | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Seek(0x10 + (0xC * i), SeekOrigin.Begin); | ||||
|  | ||||
|                         GroupMember entry = entries[i]; | ||||
|                         binWriter.Write((UInt32)entry.actorId); | ||||
|                         binWriter.Write((UInt32)1001); | ||||
|                         binWriter.Write((UInt32)1); | ||||
|  | ||||
|                         offset++; | ||||
|                     }                     | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										66
									
								
								Map Server/Packets/Send/Groups/ContentMembersX64Packet.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								Map Server/Packets/Send/Groups/ContentMembersX64Packet.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,66 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.group | ||||
| { | ||||
|     class ContentMembersX64Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0186; | ||||
|         public const uint PACKET_SIZE = 0x330; | ||||
|  | ||||
|         public static SubPacket buildPacket(uint playerActorID, uint locationCode, ulong sequenceId, List<GroupMember> entries, ref int offset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     //Write List Header | ||||
|                     binWriter.Write((UInt64)locationCode); | ||||
|                     binWriter.Write((UInt64)sequenceId); | ||||
|                     //Write Entries | ||||
|                     int max = 64; | ||||
|                     if (entries.Count - offset < 64) | ||||
|                         max = entries.Count - offset; | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Seek(0x10 + (0xC * i), SeekOrigin.Begin); | ||||
|  | ||||
|                         GroupMember entry = entries[i]; | ||||
|                         binWriter.Write((UInt32)entry.actorId); | ||||
|                         binWriter.Write((UInt32)1001); | ||||
|                         binWriter.Write((UInt32)1); | ||||
|  | ||||
|                         offset++; | ||||
|                     }                    | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										58
									
								
								Map Server/Packets/Send/Groups/CreateNamedGroup.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								Map Server/Packets/Send/Groups/CreateNamedGroup.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using Meteor.Map.actors.group; | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.group | ||||
| { | ||||
|     class CreateNamedGroup | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0188; | ||||
|         public const uint PACKET_SIZE = 0x60; | ||||
|  | ||||
|         public static SubPacket buildPacket(uint playerActorID, Group group) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt64)group.groupIndex); | ||||
|                     binWriter.Write((UInt32)group.GetTypeId()); | ||||
|                     binWriter.Write((Int32)group.GetGroupLocalizedName()); | ||||
|  | ||||
|                     binWriter.Write((UInt16)0x121C); | ||||
|  | ||||
|                     binWriter.Seek(0x20, SeekOrigin.Begin); | ||||
|  | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(group.GetGroupName()), 0, Encoding.ASCII.GetByteCount(group.GetGroupName()) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(group.GetGroupName()));                     | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										72
									
								
								Map Server/Packets/Send/Groups/CreateNamedGroupMultiple.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								Map Server/Packets/Send/Groups/CreateNamedGroupMultiple.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,72 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using Meteor.Map.actors.group; | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.group | ||||
| { | ||||
|     class CreateNamedGroupMultiple | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0189; | ||||
|         public const uint PACKET_SIZE = 0x228; | ||||
|  | ||||
|         public static SubPacket buildPacket(uint playerActorID, Group[] groups, ref int offset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     int max = 8; | ||||
|                     if (groups.Length - offset <= 8) | ||||
|                         max = groups.Length - offset; | ||||
|  | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     {                         | ||||
|                         binWriter.Seek(i * 0x40, SeekOrigin.Begin); | ||||
|  | ||||
|                         Group group = groups[offset+i]; | ||||
|  | ||||
|                         binWriter.Write((UInt64)group.groupIndex); | ||||
|                         binWriter.Write((UInt32)group.GetTypeId()); | ||||
|                         binWriter.Write((Int32)group.GetGroupLocalizedName()); | ||||
|  | ||||
|                         binWriter.Write((UInt16)0x121C); | ||||
|  | ||||
|                         binWriter.Seek(0x20, SeekOrigin.Begin); | ||||
|  | ||||
|                         binWriter.Write(Encoding.ASCII.GetBytes(group.GetGroupName()), 0, Encoding.ASCII.GetByteCount(group.GetGroupName()) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(group.GetGroupName()));                     | ||||
|                     } | ||||
|  | ||||
|                     binWriter.Seek(0x200, SeekOrigin.Begin); | ||||
|                     binWriter.Write((Byte)max); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										60
									
								
								Map Server/Packets/Send/Groups/DeleteGroupPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								Map Server/Packets/Send/Groups/DeleteGroupPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,60 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using Meteor.Map.actors.group; | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| namespace Meteor.Map.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.groupIndex); | ||||
|         } | ||||
|  | ||||
|         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, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										79
									
								
								Map Server/Packets/Send/Groups/GroupHeaderPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								Map Server/Packets/Send/Groups/GroupHeaderPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,79 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using Meteor.Map.actors.group; | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.group | ||||
| { | ||||
|     class GroupHeaderPacket | ||||
|     { | ||||
|         public const uint TYPEID_RETAINER = 0x13881; | ||||
|         public const uint TYPEID_PARTY = 0x2711; | ||||
|         public const uint TYPEID_LINKSHELL = 0x4E22; | ||||
|  | ||||
|         public const ushort OPCODE = 0x017C; | ||||
|         public const uint PACKET_SIZE = 0x98; | ||||
|  | ||||
|         public static SubPacket buildPacket(uint playerActorID, uint locationCode, ulong sequenceId, Group group) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     //Write list header | ||||
|                     binWriter.Write((UInt64)locationCode); | ||||
|                     binWriter.Write((UInt64)sequenceId); | ||||
|  | ||||
|                     //Write list id | ||||
|                     binWriter.Write((UInt64)3); | ||||
|                     binWriter.Write((UInt64)group.groupIndex); | ||||
|                     binWriter.Write((UInt64)0); | ||||
|                     binWriter.Write((UInt64)group.groupIndex); | ||||
|  | ||||
|                     //This seems to change depending on what the list is for | ||||
|                     binWriter.Write((UInt32)group.GetTypeId()); | ||||
|                     binWriter.Seek(0x40, SeekOrigin.Begin); | ||||
|  | ||||
|                     //This is for Linkshell | ||||
|                     binWriter.Write((UInt32)group.GetGroupLocalizedName()); | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(group.GetGroupName()), 0, Encoding.ASCII.GetByteCount(group.GetGroupName()) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(group.GetGroupName())); | ||||
|  | ||||
|                     binWriter.Seek(0x64, SeekOrigin.Begin); | ||||
|  | ||||
|                     binWriter.Write((UInt32)0x6D); | ||||
|                     binWriter.Write((UInt32)0x6D); | ||||
|                     binWriter.Write((UInt32)0x6D); | ||||
|                     binWriter.Write((UInt32)0x6D); | ||||
|  | ||||
|                     binWriter.Write((UInt32)group.GetMemberCount()); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										43
									
								
								Map Server/Packets/Send/Groups/GroupMember.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								Map Server/Packets/Send/Groups/GroupMember.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,43 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| namespace Meteor.Map.packets.send.group | ||||
| { | ||||
|     class GroupMember | ||||
|     { | ||||
|         public uint actorId; | ||||
|         public int localizedName; | ||||
|         public uint unknown2; | ||||
|         public bool flag1; | ||||
|         public bool isOnline; | ||||
|         public string name; | ||||
|  | ||||
|         public GroupMember(uint actorId, int localizedName, uint unknown2, bool flag1, bool isOnline, string name) | ||||
|         { | ||||
|             this.actorId = actorId; | ||||
|             this.localizedName = localizedName; | ||||
|             this.unknown2 = unknown2; | ||||
|             this.flag1 = flag1; | ||||
|             this.isOnline = isOnline; | ||||
|             this.name = name == null ? "" : name; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										54
									
								
								Map Server/Packets/Send/Groups/GroupMembersBeginPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								Map Server/Packets/Send/Groups/GroupMembersBeginPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,54 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using Meteor.Map.actors.group; | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.group | ||||
| { | ||||
|     class GroupMembersBeginPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x017D; | ||||
|         public const uint PACKET_SIZE = 0x40; | ||||
|  | ||||
|         public static SubPacket buildPacket(uint playerActorID, uint locationCode, ulong sequenceId, Group group) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     //Write List Header | ||||
|                     binWriter.Write((UInt64)locationCode); | ||||
|                     binWriter.Write((UInt64)sequenceId); | ||||
|                     //Write List Info | ||||
|                     binWriter.Write((UInt64)group.groupIndex); | ||||
|                     binWriter.Write((UInt32)group.GetMemberCount()); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										54
									
								
								Map Server/Packets/Send/Groups/GroupMembersEndPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								Map Server/Packets/Send/Groups/GroupMembersEndPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,54 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using Meteor.Map.actors.group; | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.group | ||||
| { | ||||
|     class GroupMembersEndPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x017E; | ||||
|         public const uint PACKET_SIZE = 0x38; | ||||
|  | ||||
|         public static SubPacket buildPacket(uint playerActorID, uint locationCode, ulong sequenceId, Group group) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     //Write List Header | ||||
|                     binWriter.Write((UInt64)locationCode); | ||||
|                     binWriter.Write((UInt64)sequenceId); | ||||
|                     //Write List Info | ||||
|                     binWriter.Write((UInt64)group.groupIndex); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										74
									
								
								Map Server/Packets/Send/Groups/GroupMembersX08Packet.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								Map Server/Packets/Send/Groups/GroupMembersX08Packet.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,74 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.group | ||||
| { | ||||
|     class GroupMembersX08Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x017F; | ||||
|         public const uint PACKET_SIZE = 0x1B8; | ||||
|  | ||||
|         public static SubPacket buildPacket(uint playerActorID, uint locationCode, ulong sequenceId, List<GroupMember> entries, ref int offset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     //Write List Header | ||||
|                     binWriter.Write((UInt64)locationCode); | ||||
|                     binWriter.Write((UInt64)sequenceId); | ||||
|                     //Write Entries | ||||
|                     int max = 8; | ||||
|                     if (entries.Count-offset < 8) | ||||
|                         max = entries.Count - offset; | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Seek(0x10 + (0x30 * i), SeekOrigin.Begin); | ||||
|  | ||||
|                         GroupMember entry = entries[i]; | ||||
|                         binWriter.Write((UInt32)entry.actorId); | ||||
|                         binWriter.Write((Int32)entry.localizedName); | ||||
|                         binWriter.Write((UInt32)entry.unknown2); | ||||
|                         binWriter.Write((Byte)(entry.flag1? 1 : 0)); | ||||
|                         binWriter.Write((Byte)(entry.isOnline? 1 : 0)); | ||||
|  | ||||
|                         binWriter.Write(Encoding.ASCII.GetBytes(entry.name), 0, Encoding.ASCII.GetByteCount(entry.name) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(entry.name)); | ||||
|  | ||||
|                         offset++; | ||||
|                     } | ||||
|                     //Write Count | ||||
|                     binWriter.Seek(0x10 + (0x30 * 8), SeekOrigin.Begin); | ||||
|                     binWriter.Write(max); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										70
									
								
								Map Server/Packets/Send/Groups/GroupMembersX16Packet.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								Map Server/Packets/Send/Groups/GroupMembersX16Packet.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,70 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.group | ||||
| { | ||||
|     class GroupMembersX16Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0180; | ||||
|         public const uint PACKET_SIZE = 0x330; | ||||
|  | ||||
|         public static SubPacket buildPacket(uint playerActorID, uint locationCode, ulong sequenceId, List<GroupMember> entries, ref int offset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     //Write List Header | ||||
|                     binWriter.Write((UInt64)locationCode); | ||||
|                     binWriter.Write((UInt64)sequenceId); | ||||
|                     //Write Entries | ||||
|                     int max = 16; | ||||
|                     if (entries.Count-offset < 16) | ||||
|                         max = entries.Count - offset; | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Seek(0x10 + (0x30 * i), SeekOrigin.Begin); | ||||
|  | ||||
|                         GroupMember entry = entries[i]; | ||||
|                         binWriter.Write((UInt32)entry.actorId); | ||||
|                         binWriter.Write((Int32)entry.localizedName); | ||||
|                         binWriter.Write((UInt32)entry.unknown2); | ||||
|                         binWriter.Write((Byte)(entry.flag1? 1 : 0)); | ||||
|                         binWriter.Write((Byte)(entry.isOnline? 1 : 0)); | ||||
|                         binWriter.Write(Encoding.ASCII.GetBytes(entry.name), 0, Encoding.ASCII.GetByteCount(entry.name) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(entry.name)); | ||||
|  | ||||
|                         offset++; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										70
									
								
								Map Server/Packets/Send/Groups/GroupMembersX32Packet.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								Map Server/Packets/Send/Groups/GroupMembersX32Packet.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,70 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.group | ||||
| { | ||||
|     class GroupMembersX32Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0181; | ||||
|         public const uint PACKET_SIZE = 0x630; | ||||
|  | ||||
|         public static SubPacket buildPacket(uint playerActorID, uint locationCode, ulong sequenceId, List<GroupMember> entries, ref int offset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     //Write List Header | ||||
|                     binWriter.Write((UInt64)locationCode); | ||||
|                     binWriter.Write((UInt64)sequenceId); | ||||
|                     //Write Entries | ||||
|                     int max = 32; | ||||
|                     if (entries.Count-offset < 32) | ||||
|                         max = entries.Count - offset; | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Seek(0x10 + (0x30 * i), SeekOrigin.Begin); | ||||
|  | ||||
|                         GroupMember entry = entries[i]; | ||||
|                         binWriter.Write((UInt32)entry.actorId); | ||||
|                         binWriter.Write((Int32)entry.localizedName); | ||||
|                         binWriter.Write((UInt32)entry.unknown2); | ||||
|                         binWriter.Write((Byte)(entry.flag1? 1 : 0)); | ||||
|                         binWriter.Write((Byte)(entry.isOnline? 1 : 0)); | ||||
|                         binWriter.Write(Encoding.ASCII.GetBytes(entry.name), 0, Encoding.ASCII.GetByteCount(entry.name) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(entry.name)); | ||||
|  | ||||
|                         offset++; | ||||
|                     }                     | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										70
									
								
								Map Server/Packets/Send/Groups/GroupMembersX64Packet.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								Map Server/Packets/Send/Groups/GroupMembersX64Packet.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,70 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.group | ||||
| { | ||||
|     class GroupMembersX64Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0182; | ||||
|         public const uint PACKET_SIZE = 0xC30; | ||||
|  | ||||
|         public static SubPacket buildPacket(uint playerActorID, uint locationCode, ulong sequenceId, List<GroupMember> entries, ref int offset) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     //Write List Header | ||||
|                     binWriter.Write((UInt64)locationCode); | ||||
|                     binWriter.Write((UInt64)sequenceId); | ||||
|                     //Write Entries | ||||
|                     int max = 64; | ||||
|                     if (entries.Count - offset < 64) | ||||
|                         max = entries.Count - offset; | ||||
|                     for (int i = 0; i < max; i++) | ||||
|                     { | ||||
|                         binWriter.Seek(0x10 + (0x30 * i), SeekOrigin.Begin); | ||||
|  | ||||
|                         GroupMember entry = entries[i]; | ||||
|                         binWriter.Write((UInt32)entry.actorId); | ||||
|                         binWriter.Write((Int32)entry.localizedName); | ||||
|                         binWriter.Write((UInt32)entry.unknown2); | ||||
|                         binWriter.Write((Byte)(entry.flag1? 1 : 0)); | ||||
|                         binWriter.Write((Byte)(entry.isOnline? 1 : 0)); | ||||
|                         binWriter.Write(Encoding.ASCII.GetBytes(entry.name), 0, Encoding.ASCII.GetByteCount(entry.name) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(entry.name)); | ||||
|  | ||||
|                         offset++; | ||||
|                     }                    | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, playerActorID, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										229
									
								
								Map Server/Packets/Send/Groups/SynchGroupWorkValuesPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										229
									
								
								Map Server/Packets/Send/Groups/SynchGroupWorkValuesPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,229 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using Meteor.Map.actors.group; | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Linq; | ||||
| using System.Reflection; | ||||
| using System.Text; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.groups | ||||
| { | ||||
|     class SynchGroupWorkValuesPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x017A; | ||||
|         public const uint PACKET_SIZE = 0xB0; | ||||
|  | ||||
|         private const ushort MAXBYTES = 0x98; | ||||
|  | ||||
|         private ushort runningByteTotal = 0; | ||||
|         private byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|         private bool isMore = false; | ||||
|  | ||||
|         private MemoryStream mem; | ||||
|         private BinaryWriter binWriter; | ||||
|  | ||||
|         public SynchGroupWorkValuesPacket(ulong listId) | ||||
|         { | ||||
|             mem = new MemoryStream(data); | ||||
|             binWriter = new BinaryWriter(mem); | ||||
|             binWriter.Write((UInt64)listId); | ||||
|             binWriter.Seek(1, SeekOrigin.Current); | ||||
|         } | ||||
|  | ||||
|         public void closeStreams() | ||||
|         { | ||||
|             binWriter.Dispose(); | ||||
|             mem.Dispose(); | ||||
|         } | ||||
|  | ||||
|         public bool addByte(uint id, byte value) | ||||
|         { | ||||
|             if (runningByteTotal + 6 > MAXBYTES) | ||||
|                 return false; | ||||
|  | ||||
|             binWriter.Write((byte)1); | ||||
|             binWriter.Write((UInt32)id); | ||||
|             binWriter.Write((byte)value); | ||||
|             runningByteTotal += 6; | ||||
|  | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         public bool addShort(uint id, ushort value) | ||||
|         { | ||||
|             if (runningByteTotal + 7 > MAXBYTES) | ||||
|                 return false; | ||||
|  | ||||
|             binWriter.Write((byte)2); | ||||
|             binWriter.Write((UInt32)id); | ||||
|             binWriter.Write((UInt16)value); | ||||
|             runningByteTotal += 7; | ||||
|  | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         public bool addInt(uint id, uint value) | ||||
|         { | ||||
|             if (runningByteTotal + 9 > MAXBYTES) | ||||
|                 return false; | ||||
|  | ||||
|             binWriter.Write((byte)4); | ||||
|             binWriter.Write((UInt32)id); | ||||
|             binWriter.Write((UInt32)value); | ||||
|             runningByteTotal += 9; | ||||
|  | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         public bool addLong(uint id, ulong value) | ||||
|         { | ||||
|             if (runningByteTotal + 13 > MAXBYTES) | ||||
|                 return false; | ||||
|  | ||||
|             binWriter.Write((byte)8); | ||||
|             binWriter.Write((UInt32)id); | ||||
|             binWriter.Write((UInt64)value); | ||||
|             runningByteTotal += 13; | ||||
|  | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         public bool addBuffer(uint id, byte[] buffer) | ||||
|         { | ||||
|             if (runningByteTotal + 5 + buffer.Length > MAXBYTES) | ||||
|                 return false; | ||||
|  | ||||
|             binWriter.Write((byte)buffer.Length); | ||||
|             binWriter.Write((UInt32)id); | ||||
|             binWriter.Write(buffer); | ||||
|             runningByteTotal += (ushort)(5 + buffer.Length); | ||||
|  | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         public void addProperty(Group group, string name) | ||||
|         { | ||||
|             string[] split = name.Split('.'); | ||||
|             int arrayIndex = 0; | ||||
|  | ||||
|             if (!(split[0].Equals("work") || split[0].Equals("partyGroupWork") || split[0].Equals("contentGroupWork"))) | ||||
|                 return; | ||||
|  | ||||
|             Object curObj = group; | ||||
|             for (int i = 0; i < split.Length; i++) | ||||
|             { | ||||
|                 //For arrays | ||||
|                 if (split[i].Contains('[')) | ||||
|                 { | ||||
|                     if (split[i].LastIndexOf(']') - split[i].IndexOf('[') <= 0) | ||||
|                         return; | ||||
|  | ||||
|                     arrayIndex = Convert.ToInt32(split[i].Substring(split[i].IndexOf('[') + 1, split[i].Length - split[i].LastIndexOf(']'))); | ||||
|  | ||||
|                     split[i] = split[i].Substring(0, split[i].IndexOf('[')); | ||||
|  | ||||
|                     if (i != split.Length - 1) | ||||
|                     { | ||||
|                         curObj = curObj.GetType().GetField(split[i]).GetValue(curObj); | ||||
|                         curObj = ((Array)curObj).GetValue(arrayIndex); | ||||
|                         i++; | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                 FieldInfo field = curObj.GetType().GetField(split[i]); | ||||
|                 if (field == null) | ||||
|                     return; | ||||
|  | ||||
|                 curObj = field.GetValue(curObj); | ||||
|                 if (curObj == null) | ||||
|                     return; | ||||
|             } | ||||
|  | ||||
|             if (curObj == null) | ||||
|                 return; | ||||
|             else | ||||
|             { | ||||
|                 //Array, we actually care whats inside | ||||
|                 if (curObj.GetType().IsArray) | ||||
|                 { | ||||
|                     if (((Array)curObj).Length <= arrayIndex) | ||||
|                         return; | ||||
|                     curObj = ((Array)curObj).GetValue(arrayIndex); | ||||
|                 } | ||||
|  | ||||
|                 if (curObj == null) | ||||
|                     return; | ||||
|  | ||||
|                 //Cast to the proper object and add to packet | ||||
|                 uint id = Utils.MurmurHash2(name, 0); | ||||
|                 if (curObj is bool) | ||||
|                     addByte(id, (byte)(((bool)curObj) ? 1 : 0)); | ||||
|                 else if (curObj is byte) | ||||
|                     addByte(id, (byte)curObj); | ||||
|                 else if (curObj is ushort) | ||||
|                     addShort(id, (ushort)curObj); | ||||
|                 else if (curObj is short) | ||||
|                     addShort(id, (ushort)(short)curObj); | ||||
|                 else if (curObj is uint) | ||||
|                     addInt(id, (uint)curObj); | ||||
|                 else if (curObj is int) | ||||
|                     addInt(id, (uint)(int)curObj); | ||||
|                 else if (curObj is long) | ||||
|                     addLong(id, (ulong)(long)curObj); | ||||
|                 else if (curObj is ulong) | ||||
|                     addLong(id, (ulong)curObj); | ||||
|                 else if (curObj is float) | ||||
|                     addBuffer(id, BitConverter.GetBytes((float)curObj)); | ||||
|                 else | ||||
|                     return; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         public void setIsMore(bool flag) | ||||
|         { | ||||
|             isMore = flag; | ||||
|         } | ||||
|  | ||||
|         public void setTarget(string target) | ||||
|         { | ||||
|             binWriter.Write((byte)(isMore ? 0x62 + target.Length : 0x82 + target.Length)); | ||||
|             binWriter.Write(Encoding.ASCII.GetBytes(target)); | ||||
|             runningByteTotal += (ushort)(1 + Encoding.ASCII.GetByteCount(target)); | ||||
|  | ||||
|         } | ||||
|  | ||||
|         public SubPacket buildPacket(uint actorID) | ||||
|         { | ||||
|             binWriter.Seek(0x8, SeekOrigin.Begin); | ||||
|             binWriter.Write((byte)runningByteTotal); | ||||
|  | ||||
|             closeStreams(); | ||||
|  | ||||
|             SubPacket packet = new SubPacket(OPCODE, actorID, data); | ||||
|             return packet; | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
|  | ||||
							
								
								
									
										49
									
								
								Map Server/Packets/Send/Login/0x2Packet.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								Map Server/Packets/Send/Login/0x2Packet.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.login | ||||
| { | ||||
|     class _0x2Packet | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0002; | ||||
|         public const uint PACKET_SIZE = 0x30; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE-0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.BaseStream.Seek(0x8, SeekOrigin.Begin); | ||||
|                     binWriter.Write((uint)sourceActorId); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										36
									
								
								Map Server/Packets/Send/LogoutPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								Map Server/Packets/Send/LogoutPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace Meteor.Map.packets.send | ||||
| { | ||||
|     class LogoutPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x000E; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint playerActorID) | ||||
|         { | ||||
|             return new SubPacket(OPCODE, playerActorID, new byte[8]); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										38
									
								
								Map Server/Packets/Send/Player/AchievementEarnedPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								Map Server/Packets/Send/Player/AchievementEarnedPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.player | ||||
| { | ||||
|     class AchievementEarnedPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x019E; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint achievementID) | ||||
|         { | ||||
|             return new SubPacket(OPCODE, sourceActorId, BitConverter.GetBytes((UInt64)achievementID)); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										50
									
								
								Map Server/Packets/Send/Player/GenericDataPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								Map Server/Packets/Send/Player/GenericDataPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Map.lua; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.player | ||||
| { | ||||
|     class GenericDataPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0133; | ||||
|         public const uint PACKET_SIZE = 0xE0; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, List<LuaParam> luaParams) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     LuaUtils.WriteLuaParams(binWriter, luaParams); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										51
									
								
								Map Server/Packets/Send/Player/SendAchievementRatePacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								Map Server/Packets/Send/Player/SendAchievementRatePacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,51 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.player | ||||
| { | ||||
|     class SendAchievementRatePacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x019F; | ||||
|         public const uint PACKET_SIZE = 0x30; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint achievementId, uint progressCount, uint progressFlags) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((UInt32)achievementId); | ||||
|                     binWriter.Write((UInt32)progressCount); | ||||
|                     binWriter.Write((UInt32)progressFlags); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										38
									
								
								Map Server/Packets/Send/Player/SetAchievementPointsPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								Map Server/Packets/Send/Player/SetAchievementPointsPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.player | ||||
| { | ||||
|     class SetAchievementPointsPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x019C; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint numAchievementPoints) | ||||
|         {             | ||||
|             return new SubPacket(OPCODE, sourceActorId, BitConverter.GetBytes((UInt64) numAchievementPoints)); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										40
									
								
								Map Server/Packets/Send/Player/SetChocoboNamePacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								Map Server/Packets/Send/Player/SetChocoboNamePacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System.Text; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.player | ||||
| { | ||||
|     class SetChocoboNamePacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0198; | ||||
|         public const uint PACKET_SIZE = 0x40; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, string name) | ||||
|         { | ||||
|             if (Encoding.Unicode.GetByteCount(name) >= 0x20) | ||||
|                 name = "ERR: Too Long"; | ||||
|             return new SubPacket(OPCODE, sourceActorId, Encoding.ASCII.GetBytes(name)); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,68 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System.IO; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.player | ||||
| { | ||||
|     class SetCompletedAchievementsPacket | ||||
|     {      | ||||
|         //Achievenments are +1 and up, except for Quests and GCs which is +2 | ||||
|         public const int CATEGORY_BATTLE =             000; | ||||
|         public const int CATEGORY_CHARACTER =          050; | ||||
|         public const int CATEGORY_CURRENCY =           200; | ||||
|         public const int CATEGORY_ITEMS =              250; | ||||
|         public const int CATEGORY_SYNTHESIS =          300; | ||||
|         public const int CATEGORY_GATHERING =          400; | ||||
|         public const int CATEGORY_MATERIA =            550; | ||||
|         public const int CATEGORY_QUESTS =             600; | ||||
|         public const int CATEGORY_SEASONAL_EVENTS =    700; | ||||
|         public const int CATEGORY_DUNGEONS =           750; | ||||
|         public const int CATEGORY_EXPLORATION =        800; | ||||
|         public const int CATEGORY_GRAND_COMPANY =      820; | ||||
|          | ||||
|         public const ushort OPCODE = 0x019A; | ||||
|         public const uint PACKET_SIZE = 0xA0; | ||||
|  | ||||
|         public bool[] achievementFlags = new bool[1024]; | ||||
|  | ||||
|         public SubPacket BuildPacket(uint sourceActorId) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     byte[] binStream = Utils.ConvertBoolArrayToBinaryStream(achievementFlags); | ||||
|                     if (binStream.Length <= PACKET_SIZE - 0x20) | ||||
|                         binWriter.Write(binStream); | ||||
|                     else                     | ||||
|                         Program.Log.Error("Failed making SetCompletedAchievements packet. Bin Stream was too big!");                     | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data);             | ||||
|         } | ||||
|          | ||||
|     } | ||||
| } | ||||
							
								
								
									
										38
									
								
								Map Server/Packets/Send/Player/SetCurrentJobPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								Map Server/Packets/Send/Player/SetCurrentJobPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.player | ||||
| { | ||||
|     class SetCurrentJobPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x01A4; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint jobId) | ||||
|         { | ||||
|             return new SubPacket(OPCODE, sourceActorId, BitConverter.GetBytes((uint)jobId)); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,55 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.player | ||||
| { | ||||
|     class SetCurrentMountChocoboPacket | ||||
|     { | ||||
|         public const int CHOCOBO_NORMAL = 0; | ||||
|  | ||||
|         public const int CHOCOBO_LIMSA1 = 0x1; | ||||
|         public const int CHOCOBO_LIMSA2 = 0x2; | ||||
|         public const int CHOCOBO_LIMSA3 = 0x3; | ||||
|         public const int CHOCOBO_LIMSA4 = 0x4; | ||||
|  | ||||
|         public const int CHOCOBO_GRIDANIA1 = 0x1F; | ||||
|         public const int CHOCOBO_GRIDANIA2 = 0x20; | ||||
|         public const int CHOCOBO_GRIDANIA3 = 0x21; | ||||
|         public const int CHOCOBO_GRIDANIA4 = 0x22; | ||||
|  | ||||
|         public const int CHOCOBO_ULDAH1 = 0x3D; | ||||
|         public const int CHOCOBO_ULDAH2 = 0x3E; | ||||
|         public const int CHOCOBO_ULDAH3 = 0x3F; | ||||
|         public const int CHOCOBO_ULDAH4 = 0x40; | ||||
|  | ||||
|         public const ushort OPCODE = 0x0197; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, int appearanceId) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|             data[5] = (byte)(appearanceId & 0xFF); | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,39 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.player | ||||
| { | ||||
|     class SetCurrentMountGoobbuePacket | ||||
|     { | ||||
|  | ||||
|         public const ushort OPCODE = 0x01a0; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, int appearanceId) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|             data[0] = (byte)(appearanceId & 0xFF); | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										117
									
								
								Map Server/Packets/Send/Player/SetCutsceneBookPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										117
									
								
								Map Server/Packets/Send/Player/SetCutsceneBookPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,117 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.player | ||||
| { | ||||
|     class SetCutsceneBookPacket | ||||
|     { | ||||
|         //Main Story | ||||
|         public const int CATEGORY_MAINSTORY =  072; | ||||
|         public const int CATEGORY_SIDEQUESTS1 = 672; | ||||
|         public const int CATEGORY_SIDEQUESTS2 = 892; | ||||
|         public const int CATEGORY_INSTANCED = 888; | ||||
|  | ||||
|         //Other         | ||||
|         public const int OTHER_UGHAMARO =      005; | ||||
|         public const int OTHER_NATALAN =       006; | ||||
|         public const int OTHER_Z =             007; | ||||
|         public const int OTHER_CASTRUMNOVUM =  008; | ||||
|         public const int OTHER_NIGHTMARE =     014; | ||||
|  | ||||
|         //Class Cutscenes | ||||
|         public const int CATEGORY_PUG_QUESTS = 128; | ||||
|         public const int CATEGORY_GLA_QUESTS = 148; | ||||
|         public const int CATEGORY_MRD_QUESTS = 168; | ||||
|         public const int CATEGORY_ARC_QUESTS = 188; | ||||
|         public const int CATEGORY_LNC_QUESTS = 208; | ||||
|         public const int CATEGORY_THM_QUESTS = 228; | ||||
|         public const int CATEGORY_CNJ_QUESTS = 248; | ||||
|  | ||||
|         //DoH/DoL Cutscenes | ||||
|         public const int CATEGORY_CRP_QUESTS = 268; | ||||
|         public const int CATEGORY_BSM_QUESTS = 288; | ||||
|         public const int CATEGORY_GSM_QUESTS = 308; | ||||
|         public const int CATEGORY_LTW_QUESTS = 328; | ||||
|         public const int CATEGORY_WVR_QUESTS = 348; | ||||
|         public const int CATEGORY_ALC_QUESTS = 368; | ||||
|         public const int CATEGORY_CUL_QUESTS = 388; | ||||
|         public const int CATEGORY_MIN_QUESTS = 408; | ||||
|         public const int CATEGORY_BTN_QUESTS = 428; | ||||
|         public const int CATEGORY_FSH_QUESTS = 448; | ||||
|          | ||||
|         //Job Cutscenes | ||||
|         public const int CATEGORY_WAR_QUESTS = 1272; | ||||
|         public const int CATEGORY_MNK_QUESTS = 1292; | ||||
|         public const int CATEGORY_WHM_QUESTS = 1312; | ||||
|         public const int CATEGORY_BLM_QUESTS = 1332; | ||||
|         public const int CATEGORY_PLD_QUESTS = 1352; | ||||
|         public const int CATEGORY_BRD_QUESTS = 1372; | ||||
|         public const int CATEGORY_DRG_QUESTS = 1392; | ||||
|  | ||||
|         //GC Cutscenes | ||||
|         public const int CATEGORY_MAELSTROM =  1472; | ||||
|         public const int CATEGORY_ADDERS =     1672; | ||||
|         public const int CATEGORY_FLAMES =     1872;         | ||||
|  | ||||
|         public const ushort OPCODE = 0x01A3; | ||||
|         public const uint PACKET_SIZE = 0x150; | ||||
|  | ||||
|         public bool[] cutsceneFlags = new bool[2048]; | ||||
|  | ||||
|         public SubPacket BuildPacket(uint sourceActorId, string sNpcName, short sNpcActorIdOffset, byte sNpcSkin, byte sNpcPersonality) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     byte[] binStream = Utils.ConvertBoolArrayToBinaryStream(cutsceneFlags); | ||||
|                      | ||||
|                     //Temp Path Companion SNPC Stuff | ||||
|                     binWriter.Seek(0x01 ,SeekOrigin.Begin); | ||||
|                     binWriter.Write((Int16)2); | ||||
|                     binWriter.Write((Byte)0); | ||||
|                     binWriter.Write((Int16)sNpcActorIdOffset); | ||||
|                     binWriter.Write((Byte)sNpcSkin); | ||||
|                     binWriter.Write((Byte)sNpcPersonality); | ||||
|  | ||||
|                     if (binStream.Length <= PACKET_SIZE - 0x20) | ||||
|                         binWriter.Write(binStream); | ||||
|                     else | ||||
|                         Program.Log.Error("Failed making SetCutsceneBook packet. Bin Stream was too big!"); | ||||
|  | ||||
|                     binWriter.Seek(0x109, SeekOrigin.Begin); | ||||
|                     binWriter.Write(Encoding.ASCII.GetBytes(sNpcName), 0, Encoding.ASCII.GetByteCount(sNpcName) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(sNpcName)); | ||||
|  | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										53
									
								
								Map Server/Packets/Send/Player/SetGrandCompanyPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								Map Server/Packets/Send/Player/SetGrandCompanyPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,53 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace  Meteor.Map.packets.send.actor | ||||
| { | ||||
|     class SetGrandCompanyPacket | ||||
|     {         | ||||
|         public const ushort OPCODE = 0x0194; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, ushort currentAllegiance, ushort rankLimsa, ushort rankGridania, ushort rankUldah) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     binWriter.Write((Byte)currentAllegiance); | ||||
|                     binWriter.Write((Byte)rankLimsa); | ||||
|                     binWriter.Write((Byte)rankGridania); | ||||
|                     binWriter.Write((Byte)rankUldah); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										38
									
								
								Map Server/Packets/Send/Player/SetHasChocoboPacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								Map Server/Packets/Send/Player/SetHasChocoboPacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.player | ||||
| { | ||||
|     class SetHasChocoboPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x0199; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, bool hasChocobo) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|             data[0] = (byte)(hasChocobo ? 1 : 0); | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										38
									
								
								Map Server/Packets/Send/Player/SetHasGoobbuePacket.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								Map Server/Packets/Send/Player/SetHasGoobbuePacket.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.player | ||||
| { | ||||
|     class SetHasGoobbuePacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x01A1; | ||||
|         public const uint PACKET_SIZE = 0x28; | ||||
|  | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, bool hasGoobbue) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|             data[0] = (byte)(hasGoobbue ? 1 : 0); | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,55 @@ | ||||
| /* | ||||
| =========================================================================== | ||||
| Copyright (C) 2015-2019 Project Meteor Dev Team | ||||
|  | ||||
| This file is part of Project Meteor Server. | ||||
|  | ||||
| Project Meteor Server is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published by | ||||
| the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| Project Meteor Server is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| GNU Affero General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>. | ||||
| =========================================================================== | ||||
| */ | ||||
|  | ||||
| using System; | ||||
| using System.IO; | ||||
|  | ||||
| using Meteor.Common; | ||||
|  | ||||
| namespace Meteor.Map.packets.send.player | ||||
| { | ||||
|     class SetLatestAchievementsPacket | ||||
|     { | ||||
|         public const ushort OPCODE = 0x019B; | ||||
|         public const uint PACKET_SIZE = 0x40; | ||||
|         | ||||
|         public static SubPacket BuildPacket(uint sourceActorId, uint[] latestAchievementIDs) | ||||
|         { | ||||
|             byte[] data = new byte[PACKET_SIZE - 0x20]; | ||||
|  | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryWriter binWriter = new BinaryWriter(mem)) | ||||
|                 { | ||||
|                     for (int i = 0; i < 5; i++) | ||||
|                     { | ||||
|                         //Had less than 5 | ||||
|                         if (i > latestAchievementIDs.Length) | ||||
|                             break; | ||||
|                         binWriter.Write((UInt32)latestAchievementIDs[i]); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return new SubPacket(OPCODE, sourceActorId, data); | ||||
|         } | ||||
|     } | ||||
| } | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user