mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-20 03:37:48 +00:00
Packet refactoring.
This commit is contained in:
parent
96641865bc
commit
0ec9c5576c
22 changed files with 115 additions and 109 deletions
|
@ -265,6 +265,15 @@ namespace Meteor.Common
|
|||
return secondDigit + firstDigit;
|
||||
}
|
||||
|
||||
public static string ReadNullTermString(BinaryReader reader, int maxSize = 0x20)
|
||||
{
|
||||
return Encoding.ASCII.GetString(reader.ReadBytes(maxSize)).Trim(new[] { '\0' });
|
||||
}
|
||||
|
||||
public static void WriteNullTermString(BinaryWriter writer, string value, int maxSize = 0x20)
|
||||
{
|
||||
writer.Write(Encoding.ASCII.GetBytes(value), 0, Encoding.ASCII.GetByteCount(value) >= maxSize ? maxSize : Encoding.ASCII.GetByteCount(value));
|
||||
}
|
||||
|
||||
public static string FFXIVLoginStringDecodeBinary(string path)
|
||||
{
|
||||
|
|
|
@ -104,6 +104,7 @@ namespace Meteor.Map.Actors
|
|||
//Event Related
|
||||
public uint currentEventOwner = 0;
|
||||
public string currentEventName = "";
|
||||
public byte currentEventType = 0;
|
||||
public Coroutine currentEventRunning;
|
||||
|
||||
//Player Info
|
||||
|
@ -576,6 +577,7 @@ namespace Meteor.Map.Actors
|
|||
QueuePacket(SetWeatherPacket.BuildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR, 1));
|
||||
|
||||
QueuePacket(SetMapPacket.BuildPacket(actorId, zone.regionId, zone.actorId));
|
||||
QueuePacket(SetPlayerDreamPacket.BuildPacket(actorId, 0));
|
||||
|
||||
QueuePackets(GetSpawnPackets(this, spawnType));
|
||||
//GetSpawnPackets(actorId, spawnType).DebugPrintPacket();
|
||||
|
@ -604,18 +606,6 @@ namespace Meteor.Map.Actors
|
|||
|
||||
//Inn Packets (Dream, Cutscenes, Armoire)
|
||||
|
||||
if (zone.isInn)
|
||||
{
|
||||
SetCutsceneBookPacket cutsceneBookPacket = new SetCutsceneBookPacket();
|
||||
for (int i = 0; i < 2048; i++)
|
||||
cutsceneBookPacket.cutsceneFlags[i] = true;
|
||||
SubPacket packet = cutsceneBookPacket.BuildPacket(actorId, "<Path Companion>", 11, 1, 1);
|
||||
|
||||
packet.DebugPrintSubPacket();
|
||||
QueuePacket(packet);
|
||||
QueuePacket(SetPlayerItemStoragePacket.BuildPacket(actorId));
|
||||
}
|
||||
|
||||
if (zone.GetWeatherDirector() != null)
|
||||
{
|
||||
playerSession.QueuePacket(zone.GetWeatherDirector().GetSpawnPackets());
|
||||
|
@ -1757,8 +1747,9 @@ namespace Meteor.Map.Actors
|
|||
|
||||
public void StartEvent(Actor owner, EventStartPacket start)
|
||||
{
|
||||
currentEventOwner = start.scriptOwnerActorID;
|
||||
currentEventName = start.triggerName;
|
||||
currentEventOwner = start.ownerActorID;
|
||||
currentEventName = start.eventName;
|
||||
currentEventType = start.eventType;
|
||||
LuaEngine.GetInstance().EventStarted(this, owner, start);
|
||||
}
|
||||
|
||||
|
@ -1767,24 +1758,24 @@ namespace Meteor.Map.Actors
|
|||
LuaEngine.GetInstance().OnEventUpdate(this, update.luaParams);
|
||||
}
|
||||
|
||||
public void KickEvent(Actor actor, string conditionName, params object[] parameters)
|
||||
public void KickEvent(Actor actor, string eventName, params object[] parameters)
|
||||
{
|
||||
if (actor == null)
|
||||
return;
|
||||
|
||||
List<LuaParam> lParams = LuaUtils.CreateLuaParamList(parameters);
|
||||
SubPacket spacket = KickEventPacket.BuildPacket(actorId, actor.actorId, 0x75dc1705, conditionName, lParams);
|
||||
SubPacket spacket = KickEventPacket.BuildPacket(actorId, actor.actorId, eventName, 0, lParams);
|
||||
spacket.DebugPrintSubPacket();
|
||||
QueuePacket(spacket);
|
||||
}
|
||||
|
||||
public void KickEventSpecial(Actor actor, uint unknown, string conditionName, params object[] parameters)
|
||||
public void KickEventSpecial(Actor actor, uint unknown, string eventName, params object[] parameters)
|
||||
{
|
||||
if (actor == null)
|
||||
return;
|
||||
|
||||
List<LuaParam> lParams = LuaUtils.CreateLuaParamList(parameters);
|
||||
SubPacket spacket = KickEventPacket.BuildPacket(actorId, actor.actorId, unknown, conditionName, lParams);
|
||||
SubPacket spacket = KickEventPacket.BuildPacket(actorId, actor.actorId, eventName, 0, lParams);
|
||||
spacket.DebugPrintSubPacket();
|
||||
QueuePacket(spacket);
|
||||
}
|
||||
|
@ -1797,19 +1788,20 @@ namespace Meteor.Map.Actors
|
|||
public void RunEventFunction(string functionName, params object[] parameters)
|
||||
{
|
||||
List<LuaParam> lParams = LuaUtils.CreateLuaParamList(parameters);
|
||||
SubPacket spacket = RunEventFunctionPacket.BuildPacket(actorId, currentEventOwner, currentEventName, functionName, lParams);
|
||||
SubPacket spacket = RunEventFunctionPacket.BuildPacket(actorId, currentEventOwner, currentEventName, currentEventType, functionName, lParams);
|
||||
spacket.DebugPrintSubPacket();
|
||||
QueuePacket(spacket);
|
||||
}
|
||||
|
||||
public void EndEvent()
|
||||
{
|
||||
SubPacket p = EndEventPacket.BuildPacket(actorId, currentEventOwner, currentEventName);
|
||||
SubPacket p = EndEventPacket.BuildPacket(actorId, currentEventOwner, currentEventName, currentEventType);
|
||||
p.DebugPrintSubPacket();
|
||||
QueuePacket(p);
|
||||
|
||||
currentEventOwner = 0;
|
||||
currentEventName = "";
|
||||
currentEventType = 0;
|
||||
currentEventRunning = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -601,7 +601,7 @@ namespace Meteor.Map.lua
|
|||
public void EventStarted(Player player, Actor target, EventStartPacket eventStart)
|
||||
{
|
||||
List<LuaParam> lparams = eventStart.luaParams;
|
||||
lparams.Insert(0, new LuaParam(2, eventStart.triggerName));
|
||||
lparams.Insert(0, new LuaParam(2, eventStart.eventName));
|
||||
if (mSleepingOnPlayerEvent.ContainsKey(player.actorId))
|
||||
{
|
||||
Coroutine coroutine = mSleepingOnPlayerEvent[player.actorId];
|
||||
|
@ -862,7 +862,7 @@ namespace Meteor.Map.lua
|
|||
return;
|
||||
List<SubPacket> SendError = new List<SubPacket>();
|
||||
player.SendMessage(SendMessagePacket.MESSAGE_TYPE_SYSTEM_ERROR, "", message);
|
||||
player.QueuePacket(EndEventPacket.BuildPacket(player.actorId, player.currentEventOwner, player.currentEventName));
|
||||
player.QueuePacket(EndEventPacket.BuildPacket(player.actorId, player.currentEventOwner, player.currentEventName, 0));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -197,25 +197,25 @@ namespace Meteor.Map
|
|||
}
|
||||
*/
|
||||
|
||||
Actor ownerActor = Server.GetStaticActors(eventStart.scriptOwnerActorID);
|
||||
Actor ownerActor = Server.GetStaticActors(eventStart.ownerActorID);
|
||||
|
||||
if (ownerActor == null)
|
||||
{
|
||||
//Is it your retainer?
|
||||
if (session.GetActor().currentSpawnedRetainer != null && session.GetActor().currentSpawnedRetainer.actorId == eventStart.scriptOwnerActorID)
|
||||
if (session.GetActor().currentSpawnedRetainer != null && session.GetActor().currentSpawnedRetainer.actorId == eventStart.ownerActorID)
|
||||
ownerActor = session.GetActor().currentSpawnedRetainer;
|
||||
//Is it a instance actor?
|
||||
if (ownerActor == null)
|
||||
ownerActor = session.GetActor().zone.FindActorInArea(eventStart.scriptOwnerActorID);
|
||||
ownerActor = session.GetActor().zone.FindActorInArea(eventStart.ownerActorID);
|
||||
if (ownerActor == null)
|
||||
{
|
||||
//Is it a Director?
|
||||
Director director = session.GetActor().GetDirector(eventStart.scriptOwnerActorID);
|
||||
Director director = session.GetActor().GetDirector(eventStart.ownerActorID);
|
||||
if (director != null)
|
||||
ownerActor = director;
|
||||
else
|
||||
{
|
||||
Program.Log.Debug("\n===Event START===\nCould not find actor 0x{0:X} for event started by caller: 0x{1:X}\nEvent Starter: {2}\nParams: {3}", eventStart.actorID, eventStart.scriptOwnerActorID, eventStart.triggerName, LuaUtils.DumpParams(eventStart.luaParams));
|
||||
Program.Log.Debug("\n===Event START===\nCould not find actor 0x{0:X} for event started by caller: 0x{1:X}\nEvent Starter: {2}\nParams: {3}", eventStart.triggerActorID, eventStart.ownerActorID, eventStart.eventName, LuaUtils.DumpParams(eventStart.luaParams));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ namespace Meteor.Map
|
|||
|
||||
session.GetActor().StartEvent(ownerActor, eventStart);
|
||||
|
||||
Program.Log.Debug("\n===Event START===\nSource Actor: 0x{0:X}\nCaller Actor: 0x{1:X}\nVal1: 0x{2:X}\nVal2: 0x{3:X}\nEvent Starter: {4}\nParams: {5}", eventStart.actorID, eventStart.scriptOwnerActorID, eventStart.val1, eventStart.val2, eventStart.triggerName, LuaUtils.DumpParams(eventStart.luaParams));
|
||||
Program.Log.Debug("\n===Event START===\nSource Actor: 0x{0:X}\nCaller Actor: 0x{1:X}\nVal1: 0x{2:X}\nVal2: 0x{3:X}\nEvent Starter: {4}\nParams: {5}", eventStart.triggerActorID, eventStart.ownerActorID, eventStart.serverCodes, eventStart.unknown, eventStart.eventName, LuaUtils.DumpParams(eventStart.luaParams));
|
||||
break;
|
||||
//Unknown, happens at npc spawn and cutscene play????
|
||||
case 0x00CE:
|
||||
|
@ -238,7 +238,7 @@ namespace Meteor.Map
|
|||
case 0x012E:
|
||||
subpacket.DebugPrintSubPacket();
|
||||
EventUpdatePacket eventUpdate = new EventUpdatePacket(subpacket.data);
|
||||
Program.Log.Debug("\n===Event UPDATE===\nSource Actor: 0x{0:X}\nCaller Actor: 0x{1:X}\nVal1: 0x{2:X}\nVal2: 0x{3:X}\nStep: 0x{4:X}\nParams: {5}", eventUpdate.actorID, eventUpdate.scriptOwnerActorID, eventUpdate.val1, eventUpdate.val2, eventUpdate.step, LuaUtils.DumpParams(eventUpdate.luaParams));
|
||||
Program.Log.Debug("\n===Event UPDATE===\nSource Actor: 0x{0:X}\nCaller Actor: 0x{1:X}\nVal1: 0x{2:X}\nVal2: 0x{3:X}\nStep: 0x{4:X}\nParams: {5}", eventUpdate.triggerActorID, eventUpdate.serverCodes, eventUpdate.unknown1, eventUpdate.unknown2, eventUpdate.eventType, LuaUtils.DumpParams(eventUpdate.luaParams));
|
||||
/*
|
||||
//Is it a static actor? If not look in the player's instance
|
||||
Actor updateOwnerActor = Server.GetStaticActors(session.GetActor().currentEventOwner);
|
||||
|
|
|
@ -19,9 +19,10 @@ 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.receive
|
||||
{
|
||||
|
@ -51,7 +52,7 @@ namespace Meteor.Map.packets.receive
|
|||
posZ = binReader.ReadSingle();
|
||||
posRot = binReader.ReadSingle();
|
||||
logType = binReader.ReadUInt32();
|
||||
message = Encoding.ASCII.GetString(binReader.ReadBytes(0x200)).Trim(new [] { '\0' });
|
||||
message = Utils.ReadNullTermString(binReader, 0x200);
|
||||
}
|
||||
catch (Exception){
|
||||
invalidPacket = true;
|
||||
|
|
|
@ -19,11 +19,11 @@ along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
using Meteor.Common;
|
||||
using Meteor.Map.lua;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Meteor.Map.packets.receive.events
|
||||
{
|
||||
|
@ -34,20 +34,18 @@ namespace Meteor.Map.packets.receive.events
|
|||
|
||||
public bool invalidPacket = false;
|
||||
|
||||
public uint actorID;
|
||||
public uint scriptOwnerActorID;
|
||||
public uint val1;
|
||||
public uint val2;
|
||||
public byte val3;
|
||||
public uint triggerActorID;
|
||||
public uint ownerActorID;
|
||||
public uint serverCodes;
|
||||
public uint unknown;
|
||||
public byte eventType;
|
||||
public string eventName;
|
||||
public List<LuaParam> luaParams;
|
||||
|
||||
public uint errorIndex;
|
||||
public uint errorNum;
|
||||
public string error = null;
|
||||
|
||||
public string triggerName;
|
||||
|
||||
public List<LuaParam> luaParams;
|
||||
|
||||
public EventStartPacket(byte[] data)
|
||||
{
|
||||
using (MemoryStream mem = new MemoryStream(data))
|
||||
|
@ -55,11 +53,11 @@ namespace Meteor.Map.packets.receive.events
|
|||
using (BinaryReader binReader = new BinaryReader(mem))
|
||||
{
|
||||
try{
|
||||
actorID = binReader.ReadUInt32();
|
||||
scriptOwnerActorID = binReader.ReadUInt32();
|
||||
val1 = binReader.ReadUInt32();
|
||||
val2 = binReader.ReadUInt32();
|
||||
val3 = binReader.ReadByte();
|
||||
triggerActorID = binReader.ReadUInt32();
|
||||
ownerActorID = binReader.ReadUInt32();
|
||||
serverCodes = binReader.ReadUInt32();
|
||||
unknown = binReader.ReadUInt32();
|
||||
eventType = binReader.ReadByte();
|
||||
/*
|
||||
//Lua Error Dump
|
||||
if (val1 == 0x39800010)
|
||||
|
@ -74,15 +72,7 @@ namespace Meteor.Map.packets.receive.events
|
|||
return;
|
||||
}
|
||||
*/
|
||||
List<byte> strList = new List<byte>();
|
||||
byte curByte;
|
||||
while ((curByte = binReader.ReadByte())!=0)
|
||||
{
|
||||
strList.Add(curByte);
|
||||
}
|
||||
triggerName = Encoding.ASCII.GetString(strList.ToArray());
|
||||
|
||||
binReader.BaseStream.Seek(0x31, SeekOrigin.Begin);
|
||||
eventName = Utils.ReadNullTermString(binReader);
|
||||
|
||||
if (binReader.PeekChar() == 0x1)
|
||||
luaParams = new List<LuaParam>();
|
||||
|
|
|
@ -19,11 +19,12 @@ 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 Meteor.Map.lua;
|
||||
|
||||
namespace Meteor.Map.packets.receive.events
|
||||
{
|
||||
class EventUpdatePacket
|
||||
|
@ -33,11 +34,11 @@ namespace Meteor.Map.packets.receive.events
|
|||
|
||||
public bool invalidPacket = false;
|
||||
|
||||
public uint actorID;
|
||||
public uint scriptOwnerActorID;
|
||||
public uint val1;
|
||||
public uint val2;
|
||||
public byte step;
|
||||
public uint triggerActorID;
|
||||
public uint serverCodes;
|
||||
public uint unknown1;
|
||||
public uint unknown2;
|
||||
public byte eventType;
|
||||
public List<LuaParam> luaParams;
|
||||
|
||||
public EventUpdatePacket(byte[] data)
|
||||
|
@ -47,11 +48,11 @@ namespace Meteor.Map.packets.receive.events
|
|||
using (BinaryReader binReader = new BinaryReader(mem))
|
||||
{
|
||||
try{
|
||||
actorID = binReader.ReadUInt32();
|
||||
scriptOwnerActorID = binReader.ReadUInt32();
|
||||
val1 = binReader.ReadUInt32();
|
||||
val2 = binReader.ReadUInt32();
|
||||
step = binReader.ReadByte();
|
||||
triggerActorID = binReader.ReadUInt32();
|
||||
serverCodes = binReader.ReadUInt32();
|
||||
unknown1 = binReader.ReadUInt32();
|
||||
unknown2 = binReader.ReadUInt32();
|
||||
eventType = binReader.ReadByte();
|
||||
luaParams = LuaUtils.ReadLuaParams(binReader);
|
||||
}
|
||||
catch (Exception){
|
||||
|
|
|
@ -19,6 +19,7 @@ along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
using Meteor.Common;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
@ -40,7 +41,7 @@ namespace Meteor.Map.packets.receive
|
|||
{
|
||||
try{
|
||||
groupId = binReader.ReadUInt64();
|
||||
workString = Encoding.ASCII.GetString(binReader.ReadBytes(0x20)).Trim(new[] { '\0' });
|
||||
workString = Utils.ReadNullTermString(binReader);
|
||||
}
|
||||
catch (Exception){
|
||||
invalidPacket = true;
|
||||
|
|
|
@ -19,6 +19,7 @@ along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
using Meteor.Common;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
@ -39,7 +40,7 @@ namespace Meteor.Map.packets.receive
|
|||
{
|
||||
try{
|
||||
binReader.BaseStream.Seek(4, SeekOrigin.Begin);
|
||||
actorID = UInt32.Parse(Encoding.ASCII.GetString(binReader.ReadBytes(10)));
|
||||
actorID = UInt32.Parse(Utils.ReadNullTermString(binReader, 10));
|
||||
}
|
||||
catch (Exception){
|
||||
invalidPacket = true;
|
||||
|
|
|
@ -38,7 +38,6 @@ namespace Meteor.Map.packets.receive.recruitment
|
|||
{
|
||||
try{
|
||||
recruitmentId = binReader.ReadUInt64();
|
||||
|
||||
}
|
||||
catch (Exception){
|
||||
invalidPacket = true;
|
||||
|
|
|
@ -21,7 +21,8 @@ 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.receive.recruitment
|
||||
{
|
||||
|
@ -55,7 +56,7 @@ namespace Meteor.Map.packets.receive.recruitment
|
|||
unknown1 = binReader.ReadByte();
|
||||
unknown2 = binReader.ReadByte();
|
||||
|
||||
text = Encoding.ASCII.GetString(binReader.ReadBytes(0x20));
|
||||
text = Utils.ReadNullTermString(binReader);
|
||||
}
|
||||
catch (Exception){
|
||||
invalidPacket = true;
|
||||
|
|
|
@ -19,9 +19,9 @@ 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.receive.recruitment
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ namespace Meteor.Map.packets.receive.recruitment
|
|||
binReader.ReadByte();
|
||||
}
|
||||
|
||||
comment = Encoding.ASCII.GetString(binReader.ReadBytes(0x168));
|
||||
comment = Utils.ReadNullTermString(binReader, 0x168);
|
||||
}
|
||||
catch (Exception){
|
||||
invalidPacket = true;
|
||||
|
|
|
@ -19,15 +19,16 @@ 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.receive.social
|
||||
{
|
||||
class AddRemoveSocialPacket
|
||||
{
|
||||
public bool invalidPacket = false;
|
||||
|
||||
public string name;
|
||||
|
||||
public AddRemoveSocialPacket(byte[] data)
|
||||
|
@ -37,7 +38,7 @@ namespace Meteor.Map.packets.receive.social
|
|||
using (BinaryReader binReader = new BinaryReader(mem))
|
||||
{
|
||||
try{
|
||||
name = Encoding.ASCII.GetString(binReader.ReadBytes(0x20));
|
||||
name = Utils.ReadNullTermString(binReader);
|
||||
}
|
||||
catch (Exception){
|
||||
invalidPacket = true;
|
||||
|
|
|
@ -19,9 +19,9 @@ 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.receive.supportdesk
|
||||
{
|
||||
|
@ -42,8 +42,8 @@ namespace Meteor.Map.packets.receive.supportdesk
|
|||
{
|
||||
langCode = binReader.ReadUInt32();
|
||||
ticketIssueIndex = binReader.ReadUInt32();
|
||||
ticketTitle = Encoding.ASCII.GetString(binReader.ReadBytes(0x80)).Trim(new[] { '\0' });
|
||||
ticketBody = Encoding.ASCII.GetString(binReader.ReadBytes(0x800)).Trim(new[] { '\0' });
|
||||
ticketTitle = Utils.ReadNullTermString(binReader, 0x80);
|
||||
ticketBody = Utils.ReadNullTermString(binReader, 0x800);
|
||||
}
|
||||
catch (Exception){
|
||||
invalidPacket = true;
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace Meteor.Map.packets.receive
|
|||
{
|
||||
bool invalidPacket = false;
|
||||
|
||||
public ulong time;
|
||||
public ulong timestamp;
|
||||
public float x, y, z, rot;
|
||||
public ushort moveState; //0: Standing, 1: Walking, 2: Running
|
||||
|
||||
|
@ -39,7 +39,7 @@ namespace Meteor.Map.packets.receive
|
|||
using (BinaryReader binReader = new BinaryReader(mem))
|
||||
{
|
||||
try{
|
||||
time = binReader.ReadUInt64();
|
||||
timestamp = binReader.ReadUInt64();
|
||||
x = binReader.ReadSingle();
|
||||
y = binReader.ReadSingle();
|
||||
z = binReader.ReadSingle();
|
||||
|
|
|
@ -21,7 +21,6 @@ along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
|||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
using Meteor.Common;
|
||||
|
||||
|
@ -32,7 +31,7 @@ namespace Meteor.Map.packets.send.events
|
|||
public const ushort OPCODE = 0x0131;
|
||||
public const uint PACKET_SIZE = 0x50;
|
||||
|
||||
public static SubPacket BuildPacket(uint sourcePlayerActorId, uint eventOwnerActorID, string eventStarter)
|
||||
public static SubPacket BuildPacket(uint sourcePlayerActorId, uint eventOwnerActorID, string eventName, byte eventType)
|
||||
{
|
||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||
int maxBodySize = data.Length - 0x80;
|
||||
|
@ -43,8 +42,8 @@ namespace Meteor.Map.packets.send.events
|
|||
{
|
||||
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));
|
||||
binWriter.Write((Byte)eventType);
|
||||
Utils.WriteNullTermString(binWriter, eventName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Meteor.Map.packets.send.events
|
|||
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)
|
||||
public static SubPacket BuildPacket(uint triggerActorId, uint ownerActorId, string eventName, byte eventType, List<LuaParam> luaParams)
|
||||
{
|
||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||
|
||||
|
@ -42,11 +42,13 @@ namespace Meteor.Map.packets.send.events
|
|||
{
|
||||
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.Write((UInt32)triggerActorId);
|
||||
binWriter.Write((UInt32)ownerActorId);
|
||||
binWriter.Write((Byte)eventType);
|
||||
binWriter.Write((Byte)0x17); //?
|
||||
binWriter.Write((UInt16)0x75DC); //?
|
||||
binWriter.Write((UInt32)0x30400000); //ServerCodes
|
||||
Utils.WriteNullTermString(binWriter, eventName);
|
||||
|
||||
binWriter.Seek(0x30, SeekOrigin.Begin);
|
||||
|
||||
|
@ -54,7 +56,7 @@ namespace Meteor.Map.packets.send.events
|
|||
}
|
||||
}
|
||||
|
||||
return new SubPacket(OPCODE, sourcePlayerActorId, data);
|
||||
return new SubPacket(OPCODE, triggerActorId, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Meteor.Map.packets.send.events
|
|||
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)
|
||||
public static SubPacket BuildPacket(uint triggerActorID, uint ownerActorID, string eventName, byte eventType, string functionName, List<LuaParam> luaParams)
|
||||
{
|
||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||
int maxBodySize = data.Length - 0x80;
|
||||
|
@ -43,19 +43,19 @@ namespace Meteor.Map.packets.send.events
|
|||
{
|
||||
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.Write((UInt32)triggerActorID);
|
||||
binWriter.Write((UInt32)ownerActorID);
|
||||
binWriter.Write((Byte)eventType);
|
||||
Utils.WriteNullTermString(binWriter, eventName);
|
||||
binWriter.Seek(0x29, SeekOrigin.Begin);
|
||||
binWriter.Write(Encoding.ASCII.GetBytes(callFunction), 0, Encoding.ASCII.GetByteCount(callFunction) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(callFunction));
|
||||
Utils.WriteNullTermString(binWriter, functionName);
|
||||
binWriter.Seek(0x49, SeekOrigin.Begin);
|
||||
|
||||
LuaUtils.WriteLuaParams(binWriter, luaParams);
|
||||
}
|
||||
}
|
||||
|
||||
return new SubPacket(OPCODE, sourcePlayerActorId, data);
|
||||
return new SubPacket(OPCODE, triggerActorID, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ namespace Meteor.Map.packets.send.player
|
|||
{
|
||||
class SetCurrentMountGoobbuePacket
|
||||
{
|
||||
|
||||
public const ushort OPCODE = 0x01a0;
|
||||
public const uint PACKET_SIZE = 0x28;
|
||||
|
||||
|
|
|
@ -105,8 +105,7 @@ namespace Meteor.Map.packets.send.player
|
|||
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));
|
||||
|
||||
Utils.WriteNullTermString(binWriter, sNpcName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ 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.player
|
||||
{
|
||||
|
@ -31,8 +32,18 @@ namespace Meteor.Map.packets.send.player
|
|||
|
||||
public static SubPacket BuildPacket(uint sourceActorId, uint dreamID)
|
||||
{
|
||||
dreamID += 0x20E;
|
||||
return new SubPacket(OPCODE, sourceActorId, BitConverter.GetBytes((uint)dreamID));
|
||||
dreamID = 0x0216;
|
||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||
|
||||
using (MemoryStream mem = new MemoryStream(data))
|
||||
{
|
||||
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||
{
|
||||
binWriter.Write((Int32)0x216);
|
||||
}
|
||||
}
|
||||
|
||||
return new SubPacket(OPCODE, sourceActorId, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue