1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-22 12:47:46 +00:00

Fixed music packet, no longer hard coded. Added setTarget, lockOn, and startScript packets. Console window has quieted down woo!

This commit is contained in:
Filip Maj 2015-10-08 00:49:31 -04:00
parent a4d050b3be
commit 29f030eddb
8 changed files with 161 additions and 11 deletions

View file

@ -76,6 +76,10 @@
<Compile Include="PacketProcessor.cs" /> <Compile Include="PacketProcessor.cs" />
<Compile Include="packets\BasePacket.cs" /> <Compile Include="packets\BasePacket.cs" />
<Compile Include="packets\receive\HandshakePacket.cs" /> <Compile Include="packets\receive\HandshakePacket.cs" />
<Compile Include="packets\receive\SetTargetPacket.cs" />
<Compile Include="packets\receive\LockTargetPacket.cs" />
<Compile Include="packets\receive\EndScriptPacket.cs" />
<Compile Include="packets\receive\StartScriptPacket.cs" />
<Compile Include="packets\send\actor\inventory\EquipmentChangePacket.cs" /> <Compile Include="packets\send\actor\inventory\EquipmentChangePacket.cs" />
<Compile Include="packets\send\actor\inventory\InventoryBeginChangePacket.cs" /> <Compile Include="packets\send\actor\inventory\InventoryBeginChangePacket.cs" />
<Compile Include="packets\send\actor\inventory\InventoryEndChangePacket.cs" /> <Compile Include="packets\send\actor\inventory\InventoryEndChangePacket.cs" />
@ -109,7 +113,9 @@
<None Include="App.config" /> <None Include="App.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup>
<Folder Include="packets\send\script\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View file

@ -186,6 +186,8 @@ namespace FFXIVClassic_Lobby_Server
BasePacket reply8 = new BasePacket("./packets/login/login8_data.bin"); BasePacket reply8 = new BasePacket("./packets/login/login8_data.bin");
BasePacket reply9 = new BasePacket("./packets/login/login9_zonesetup.bin"); BasePacket reply9 = new BasePacket("./packets/login/login9_zonesetup.bin");
BasePacket reply10 = new BasePacket("./packets/login/login10.bin"); BasePacket reply10 = new BasePacket("./packets/login/login10.bin");
BasePacket reply11 = new BasePacket("./packets/login/login11.bin");
BasePacket reply12 = new BasePacket("./packets/login/login12.bin");
BasePacket setinv = new BasePacket("./packets/login/inventory_backup.bin"); BasePacket setinv = new BasePacket("./packets/login/inventory_backup.bin");
BasePacket keyitems = new BasePacket("./packets/login/keyitems.bin"); BasePacket keyitems = new BasePacket("./packets/login/keyitems.bin");
@ -201,9 +203,13 @@ namespace FFXIVClassic_Lobby_Server
reply7.replaceActorID(player.actorID); reply7.replaceActorID(player.actorID);
reply8.replaceActorID(player.actorID); reply8.replaceActorID(player.actorID);
reply9.replaceActorID(player.actorID); reply9.replaceActorID(player.actorID);
reply10.replaceActorID(player.actorID);
reply11.replaceActorID(player.actorID);
reply12.replaceActorID(player.actorID);
#endregion #endregion
client.queuePacket(BasePacket.createPacket(SetMapPacket.buildPacket(player.actorID, 0xD1), true, false)); client.queuePacket(BasePacket.createPacket(SetMapPacket.buildPacket(player.actorID, 0xD1), true, false));
client.queuePacket(BasePacket.createPacket(SetMusicPacket.buildPacket(player.actorID, 0x3D, 0x01), true, false));
client.queuePacket(BasePacket.createPacket(_0x2Packet.buildPacket(player.actorID), true, false)); client.queuePacket(BasePacket.createPacket(_0x2Packet.buildPacket(player.actorID), true, false));
client.queuePacket(reply5); client.queuePacket(reply5);
@ -289,8 +295,9 @@ namespace FFXIVClassic_Lobby_Server
client.queuePacket(reply7); client.queuePacket(reply7);
client.queuePacket(reply8); client.queuePacket(reply8);
client.queuePacket(reply9); client.queuePacket(reply9);
client.queuePacket(reply10); client.queuePacket(reply10);
client.queuePacket(reply11);
client.queuePacket(reply12);
break; break;
//Chat Received //Chat Received
case 0x0003: case 0x0003:
@ -301,14 +308,23 @@ namespace FFXIVClassic_Lobby_Server
UpdatePlayerPositionPacket posUpdate = new UpdatePlayerPositionPacket(subpacket.data); UpdatePlayerPositionPacket posUpdate = new UpdatePlayerPositionPacket(subpacket.data);
player.updatePlayerActorPosition(posUpdate.x, posUpdate.y, posUpdate.z, posUpdate.rot, posUpdate.moveState); player.updatePlayerActorPosition(posUpdate.x, posUpdate.y, posUpdate.z, posUpdate.rot, posUpdate.moveState);
break; break;
//Set Target
case 0x00CD: case 0x00CD:
subpacket.debugPrintSubPacket(); SetTargetPacket setTarget = new SetTargetPacket(subpacket.data);
//ProcessSetSelection(subPacket); player.setTarget(setTarget.actorID);
break; break;
//Lock Target
case 0x00CC:
LockTargetPacket lockTarget = new LockTargetPacket(subpacket.data);
player.setLockedTarget(lockTarget.actorID);
break;
//Start Script
case 0x012D: case 0x012D:
subpacket.debugPrintSubPacket(); subpacket.debugPrintSubPacket();
//ProcessScriptCommand(subPacket); StartScriptPacket startScript = new StartScriptPacket(subpacket.data);
break; client.queuePacket(new BasePacket("./packets/script/bed.bin"));
break;
//Script Result
case 0x012E: case 0x012E:
subpacket.debugPrintSubPacket(); subpacket.debugPrintSubPacket();
processScriptResult(subpacket); processScriptResult(subpacket);

View file

@ -17,8 +17,11 @@ namespace FFXIVClassic_Map_Server.dataobjects
public uint characterID = 0; public uint characterID = 0;
public uint actorID = 0; public uint actorID = 0;
uint currentZoneID = 0; private uint currentTarget = 0;
private uint currentLockedTarget = 0;
private uint currentZoneID = 0;
List<Actor> actorInstanceList = new List<Actor>(); List<Actor> actorInstanceList = new List<Actor>();
@ -109,5 +112,14 @@ namespace FFXIVClassic_Map_Server.dataobjects
} }
public void setTarget(uint actorID)
{
currentTarget = actorID;
}
public void setLockedTarget(uint actorID)
{
currentLockedTarget = actorID;
}
} }
} }

View file

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.packets.send.script
{
class EndScriptPacket
{
}
}

View file

@ -0,0 +1,34 @@
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.receive
{
class LockTargetPacket
{
public bool invalidPacket = false;
public uint actorID;
public uint otherVal; //Camera related?
public LockTargetPacket(byte[] data)
{
using (MemoryStream mem = new MemoryStream(data))
{
using (BinaryReader binReader = new BinaryReader(mem))
{
try{
actorID = binReader.ReadUInt32();
otherVal = binReader.ReadUInt32();
}
catch (Exception){
invalidPacket = true;
}
}
}
}
}
}

View file

@ -0,0 +1,34 @@
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.receive
{
class SetTargetPacket
{
public bool invalidPacket = false;
public uint actorID;
public uint otherVal; //Usually 0xE0000000
public SetTargetPacket(byte[] data)
{
using (MemoryStream mem = new MemoryStream(data))
{
using (BinaryReader binReader = new BinaryReader(mem))
{
try{
actorID = binReader.ReadUInt32();
otherVal = binReader.ReadUInt32();
}
catch (Exception){
invalidPacket = true;
}
}
}
}
}
}

View file

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.packets.receive
{
class StartScriptPacket
{
public uint sourceActor;
public uint targetActor;
public string scriptName;
public bool invalidPacket = false;
public StartScriptPacket(byte[] data)
{
using (MemoryStream mem = new MemoryStream(data))
{
using (BinaryReader binReader = new BinaryReader(mem))
{
try{
sourceActor = binReader.ReadUInt32();
targetActor = binReader.ReadUInt32();
}
catch (Exception){
invalidPacket = true;
}
}
}
}
}
}

View file

@ -12,9 +12,9 @@ namespace FFXIVClassic_Map_Server.packets.send
public const ushort OPCODE = 0x000C; public const ushort OPCODE = 0x000C;
public const uint PACKET_SIZE = 0x28; public const uint PACKET_SIZE = 0x28;
public static SubPacket buildPacket(uint playerActorID, uint musicID, uint musicTrackMode) public static SubPacket buildPacket(uint playerActorID, ushort musicID, ushort musicTrackMode)
{ {
ulong combined = musicID | (musicTrackMode << 32); ulong combined = (ulong)(musicID | (musicTrackMode << 16));
return new SubPacket(OPCODE, 0, playerActorID, BitConverter.GetBytes(combined)); return new SubPacket(OPCODE, 0, playerActorID, BitConverter.GetBytes(combined));
} }
} }