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