mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Added more packet creators to the actor class. Made sendPacketQueue private to avoid confusion. Added zone stuff to test multiplayer.
This commit is contained in:
parent
28b868e421
commit
b17a86ba2c
@ -21,7 +21,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
public Socket socket;
|
public Socket socket;
|
||||||
public byte[] buffer = new byte[0xffff];
|
public byte[] buffer = new byte[0xffff];
|
||||||
public CircularBuffer<byte> incomingStream = new CircularBuffer<byte>(1024);
|
public CircularBuffer<byte> incomingStream = new CircularBuffer<byte>(1024);
|
||||||
public BlockingCollection<BasePacket> sendPacketQueue = new BlockingCollection<BasePacket>(100);
|
private BlockingCollection<BasePacket> sendPacketQueue = new BlockingCollection<BasePacket>(100);
|
||||||
|
|
||||||
//Instance Stuff
|
//Instance Stuff
|
||||||
public uint owner = 0;
|
public uint owner = 0;
|
||||||
@ -68,7 +68,8 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
public void disconnect()
|
public void disconnect()
|
||||||
{
|
{
|
||||||
socket.Disconnect(false);
|
if (socket.Connected)
|
||||||
|
socket.Disconnect(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,7 @@
|
|||||||
<Compile Include="packets\receive\StartScriptPacket.cs" />
|
<Compile Include="packets\receive\StartScriptPacket.cs" />
|
||||||
<Compile Include="packets\send\actor\ActorDoEmotePacket.cs" />
|
<Compile Include="packets\send\actor\ActorDoEmotePacket.cs" />
|
||||||
<Compile Include="packets\send\actor\DeleteAllActorsPacket.cs" />
|
<Compile Include="packets\send\actor\DeleteAllActorsPacket.cs" />
|
||||||
|
<Compile Include="packets\send\actor\DoBattleActionPacket.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" />
|
||||||
@ -113,6 +114,7 @@
|
|||||||
<Compile Include="packets\send\player\SetPlayerTitlePacket.cs" />
|
<Compile Include="packets\send\player\SetPlayerTitlePacket.cs" />
|
||||||
<Compile Include="packets\send\PongPacket.cs" />
|
<Compile Include="packets\send\PongPacket.cs" />
|
||||||
<Compile Include="packets\send\QuitPacket.cs" />
|
<Compile Include="packets\send\QuitPacket.cs" />
|
||||||
|
<Compile Include="packets\send\SendMessagePacket.cs" />
|
||||||
<Compile Include="packets\send\SetMapPacket.cs" />
|
<Compile Include="packets\send\SetMapPacket.cs" />
|
||||||
<Compile Include="packets\send\SetMusicPacket.cs" />
|
<Compile Include="packets\send\SetMusicPacket.cs" />
|
||||||
<Compile Include="packets\send\SetWeatherPacket.cs" />
|
<Compile Include="packets\send\SetWeatherPacket.cs" />
|
||||||
@ -122,6 +124,7 @@
|
|||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Server.cs" />
|
<Compile Include="Server.cs" />
|
||||||
|
<Compile Include="Zone.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
|
@ -17,6 +17,7 @@ using FFXIVClassic_Map_Server.packets.send.login;
|
|||||||
using FFXIVClassic_Map_Server.packets.send.Actor.inventory;
|
using FFXIVClassic_Map_Server.packets.send.Actor.inventory;
|
||||||
using FFXIVClassic_Map_Server.packets.send.Actor;
|
using FFXIVClassic_Map_Server.packets.send.Actor;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
|
using FFXIVClassic_Map_Server;
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server
|
namespace FFXIVClassic_Lobby_Server
|
||||||
{
|
{
|
||||||
@ -26,6 +27,8 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
List<ClientConnection> mConnections;
|
List<ClientConnection> mConnections;
|
||||||
Boolean isAlive = true;
|
Boolean isAlive = true;
|
||||||
|
|
||||||
|
Zone inn = new Zone();
|
||||||
|
|
||||||
public PacketProcessor(Dictionary<uint, Player> playerList, List<ClientConnection> connectionList)
|
public PacketProcessor(Dictionary<uint, Player> playerList, List<ClientConnection> connectionList)
|
||||||
{
|
{
|
||||||
mPlayers = playerList;
|
mPlayers = playerList;
|
||||||
@ -64,7 +67,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Send packets
|
//Send packets
|
||||||
if (conn != null && conn.sendPacketQueue.Count != 0)
|
if (conn != null)
|
||||||
conn.flushQueuedSendPackets();
|
conn.flushQueuedSendPackets();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,8 +113,8 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
client.sendPacketQueue.Add(init);
|
client.queuePacket(init);
|
||||||
client.sendPacketQueue.Add(reply2);
|
client.queuePacket(reply2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,6 +298,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
client.queuePacket(reply10);
|
client.queuePacket(reply10);
|
||||||
//client.queuePacket(reply11);
|
//client.queuePacket(reply11);
|
||||||
client.queuePacket(reply12);
|
client.queuePacket(reply12);
|
||||||
|
|
||||||
|
inn.addActorToZone(player.getActor());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
//Chat Received
|
//Chat Received
|
||||||
case 0x0003:
|
case 0x0003:
|
||||||
@ -304,26 +310,31 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
case 0x00CA:
|
case 0x00CA:
|
||||||
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);
|
||||||
|
|
||||||
|
List<BasePacket> instanceUpdatePackets = player.updateInstance(inn.getActorsAroundActor(player.getActor(), 50));
|
||||||
|
foreach (BasePacket bp in instanceUpdatePackets)
|
||||||
|
client.queuePacket(bp);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
//Set Target
|
//Set Target
|
||||||
case 0x00CD:
|
case 0x00CD:
|
||||||
subpacket.debugPrintSubPacket();
|
subpacket.debugPrintSubPacket();
|
||||||
|
|
||||||
SetTargetPacket setTarget = new SetTargetPacket(subpacket.data);
|
SetTargetPacket setTarget = new SetTargetPacket(subpacket.data);
|
||||||
player.setTarget(setTarget.actorID);
|
player.getActor().currentTarget = setTarget.actorID;
|
||||||
client.queuePacket(BasePacket.createPacket(SetActorTargetAnimatedPacket.buildPacket(player.actorID, player.actorID, setTarget.actorID), true, false));
|
client.queuePacket(BasePacket.createPacket(SetActorTargetAnimatedPacket.buildPacket(player.actorID, player.actorID, setTarget.actorID), true, false));
|
||||||
break;
|
break;
|
||||||
//Lock Target
|
//Lock Target
|
||||||
case 0x00CC:
|
case 0x00CC:
|
||||||
LockTargetPacket lockTarget = new LockTargetPacket(subpacket.data);
|
LockTargetPacket lockTarget = new LockTargetPacket(subpacket.data);
|
||||||
player.setLockedTarget(lockTarget.actorID);
|
player.getActor().currentLockedTarget = lockTarget.actorID;
|
||||||
break;
|
break;
|
||||||
//Start Script
|
//Start Script
|
||||||
case 0x012D:
|
case 0x012D:
|
||||||
subpacket.debugPrintSubPacket();
|
subpacket.debugPrintSubPacket();
|
||||||
//StartScriptPacket startScript = new StartScriptPacket(subpacket.data);
|
//StartScriptPacket startScript = new StartScriptPacket(subpacket.data);
|
||||||
//client.queuePacket(new BasePacket("./packets/script/bed.bin"));
|
//client.queuePacket(new BasePacket("./packets/script/bed.bin"));
|
||||||
client.queuePacket(BasePacket.createPacket(ActorDoEmotePacket.buildPacket(player.actorID, player.getTargetedActor(), 137), true, false));
|
client.queuePacket(BasePacket.createPacket(ActorDoEmotePacket.buildPacket(player.actorID, player.getActor().currentTarget, 137), true, false));
|
||||||
break;
|
break;
|
||||||
//Script Result
|
//Script Result
|
||||||
case 0x012E:
|
case 0x012E:
|
||||||
@ -354,9 +365,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
{
|
{
|
||||||
packet.replaceActorID(entry.Value.actorID);
|
packet.replaceActorID(entry.Value.actorID);
|
||||||
if (conn == 1 || conn == 3)
|
if (conn == 1 || conn == 3)
|
||||||
entry.Value.getConnection1().sendPacketQueue.Add(packet);
|
entry.Value.getConnection1().queuePacket(packet);
|
||||||
if (conn == 2 || conn == 3)
|
if (conn == 2 || conn == 3)
|
||||||
entry.Value.getConnection2().sendPacketQueue.Add(packet);
|
entry.Value.getConnection2().queuePacket(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,17 +10,45 @@ namespace FFXIVClassic_Map_Server
|
|||||||
class Zone
|
class Zone
|
||||||
{
|
{
|
||||||
public uint mapId;
|
public uint mapId;
|
||||||
|
public ushort weatherNormal, weatherCommon, weatherRare;
|
||||||
|
public ushort bgmDay, bgmNight, bgmBattle;
|
||||||
public int boundingGridSize = 200;
|
public int boundingGridSize = 200;
|
||||||
|
public int minX = -1000, minY = -1000, maxX = 1000, maxY = 1000;
|
||||||
|
private int numXBlocks, numYBlocks;
|
||||||
|
private int halfWidth, halfHeight;
|
||||||
|
private List<Actor>[,] actorBlock;
|
||||||
|
|
||||||
private Dictionary<Tuple<int, int>, List<Actor>> actorBlock = new Dictionary<Tuple<int, int>, List<Actor>>();
|
public Zone()
|
||||||
|
{
|
||||||
|
numXBlocks = (maxX - minX) / boundingGridSize;
|
||||||
|
numYBlocks = (maxY - minY) / boundingGridSize;
|
||||||
|
actorBlock = new List<Actor>[numXBlocks, numYBlocks];
|
||||||
|
halfWidth = numXBlocks / 2;
|
||||||
|
halfHeight = numYBlocks / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Actor Management
|
||||||
|
|
||||||
public void addActorToZone(Actor actor)
|
public void addActorToZone(Actor actor)
|
||||||
{
|
{
|
||||||
int gridX = (int)actor.positionX / boundingGridSize;
|
int gridX = (int)actor.positionX / boundingGridSize;
|
||||||
int gridY = (int)actor.positionY / boundingGridSize;
|
int gridY = (int)actor.positionY / boundingGridSize;
|
||||||
|
|
||||||
|
gridX += halfWidth;
|
||||||
|
gridY += halfHeight;
|
||||||
|
|
||||||
|
//Boundries
|
||||||
|
if (gridX < 0)
|
||||||
|
gridX = 0;
|
||||||
|
if (gridX >= numXBlocks)
|
||||||
|
gridX = numXBlocks - 1;
|
||||||
|
if (gridY < 0)
|
||||||
|
gridY = 0;
|
||||||
|
if (gridY >= numYBlocks)
|
||||||
|
gridY = numYBlocks - 1;
|
||||||
|
|
||||||
lock (actorBlock)
|
lock (actorBlock)
|
||||||
actorBlock[Tuple.Create(gridX, gridY)].Add(actor);
|
actorBlock[gridX, gridY].Add(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeActorToZone(Actor actor)
|
public void removeActorToZone(Actor actor)
|
||||||
@ -28,8 +56,21 @@ namespace FFXIVClassic_Map_Server
|
|||||||
int gridX = (int)actor.positionX / boundingGridSize;
|
int gridX = (int)actor.positionX / boundingGridSize;
|
||||||
int gridY = (int)actor.positionY / boundingGridSize;
|
int gridY = (int)actor.positionY / boundingGridSize;
|
||||||
|
|
||||||
|
gridX += halfWidth;
|
||||||
|
gridY += halfHeight;
|
||||||
|
|
||||||
|
//Boundries
|
||||||
|
if (gridX < 0)
|
||||||
|
gridX = 0;
|
||||||
|
if (gridX >= numXBlocks)
|
||||||
|
gridX = numXBlocks - 1;
|
||||||
|
if (gridY < 0)
|
||||||
|
gridY = 0;
|
||||||
|
if (gridY >= numYBlocks)
|
||||||
|
gridY = numYBlocks - 1;
|
||||||
|
|
||||||
lock (actorBlock)
|
lock (actorBlock)
|
||||||
actorBlock[Tuple.Create(gridX, gridY)].Remove(actor);
|
actorBlock[gridX, gridY].Remove(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateActorPosition(Actor actor)
|
public void updateActorPosition(Actor actor)
|
||||||
@ -37,17 +78,43 @@ namespace FFXIVClassic_Map_Server
|
|||||||
int gridX = (int)actor.positionX / boundingGridSize;
|
int gridX = (int)actor.positionX / boundingGridSize;
|
||||||
int gridY = (int)actor.positionY / boundingGridSize;
|
int gridY = (int)actor.positionY / boundingGridSize;
|
||||||
|
|
||||||
|
gridX += halfWidth;
|
||||||
|
gridY += halfHeight;
|
||||||
|
|
||||||
|
//Boundries
|
||||||
|
if (gridX < 0)
|
||||||
|
gridX = 0;
|
||||||
|
if (gridX >= numXBlocks)
|
||||||
|
gridX = numXBlocks - 1;
|
||||||
|
if (gridY < 0)
|
||||||
|
gridY = 0;
|
||||||
|
if (gridY >= numYBlocks)
|
||||||
|
gridY = numYBlocks - 1;
|
||||||
|
|
||||||
int gridOldX = (int)actor.oldPositionX / boundingGridSize;
|
int gridOldX = (int)actor.oldPositionX / boundingGridSize;
|
||||||
int gridOldY = (int)actor.oldPositionY / boundingGridSize;
|
int gridOldY = (int)actor.oldPositionY / boundingGridSize;
|
||||||
|
|
||||||
|
gridOldX += halfWidth;
|
||||||
|
gridOldY += halfHeight;
|
||||||
|
|
||||||
|
//Boundries
|
||||||
|
if (gridOldX < 0)
|
||||||
|
gridOldX = 0;
|
||||||
|
if (gridOldX >= numXBlocks)
|
||||||
|
gridOldX = numXBlocks - 1;
|
||||||
|
if (gridOldY < 0)
|
||||||
|
gridOldY = 0;
|
||||||
|
if (gridOldY >= numYBlocks)
|
||||||
|
gridOldY = numYBlocks - 1;
|
||||||
|
|
||||||
//Still in same block
|
//Still in same block
|
||||||
if (gridX == gridOldX && gridY == gridOldY)
|
if (gridX == gridOldX && gridY == gridOldY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lock (actorBlock)
|
lock (actorBlock)
|
||||||
actorBlock[Tuple.Create(gridOldX, gridOldY)].Remove(actor);
|
actorBlock[gridOldX, gridOldY].Remove(actor);
|
||||||
lock (actorBlock)
|
lock (actorBlock)
|
||||||
actorBlock[Tuple.Create(gridX, gridY)].Add(actor);
|
actorBlock[gridX, gridY].Add(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Actor> getActorsAroundPoint(float x, float y, int checkDistance)
|
public List<Actor> getActorsAroundPoint(float x, float y, int checkDistance)
|
||||||
@ -55,18 +122,63 @@ namespace FFXIVClassic_Map_Server
|
|||||||
int gridX = (int)x/boundingGridSize;
|
int gridX = (int)x/boundingGridSize;
|
||||||
int gridY = (int)y/boundingGridSize;
|
int gridY = (int)y/boundingGridSize;
|
||||||
|
|
||||||
|
gridX += halfWidth;
|
||||||
|
gridY += halfHeight;
|
||||||
|
|
||||||
|
//Boundries
|
||||||
|
if (gridX < 0)
|
||||||
|
gridX = 0;
|
||||||
|
if (gridX >= numXBlocks)
|
||||||
|
gridX = numXBlocks - 1;
|
||||||
|
if (gridY < 0)
|
||||||
|
gridY = 0;
|
||||||
|
if (gridY >= numYBlocks)
|
||||||
|
gridY = numYBlocks - 1;
|
||||||
|
|
||||||
List<Actor> result = new List<Actor>();
|
List<Actor> result = new List<Actor>();
|
||||||
|
|
||||||
for (int gx = gridX - checkDistance; gx <= gridX + checkDistance; gx++)
|
for (int gx = gridX - checkDistance; gx <= gridX + checkDistance; gx++)
|
||||||
{
|
{
|
||||||
for (int gy = gridY - checkDistance; gy <= gridY + checkDistance; gy++)
|
for (int gy = gridY - checkDistance; gy <= gridY + checkDistance; gy++)
|
||||||
{
|
{
|
||||||
result.AddRange(actorBlock[Tuple.Create(gx, gy)]);
|
result.AddRange(actorBlock[gx, gy]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Actor> getActorsAroundActor(Actor actor, int checkDistance)
|
||||||
|
{
|
||||||
|
int gridX = (int)actor.positionX / boundingGridSize;
|
||||||
|
int gridY = (int)actor.positionY / boundingGridSize;
|
||||||
|
|
||||||
|
gridX += halfWidth;
|
||||||
|
gridY += halfHeight;
|
||||||
|
|
||||||
|
//Boundries
|
||||||
|
if (gridX < 0)
|
||||||
|
gridX = 0;
|
||||||
|
if (gridX >= numXBlocks)
|
||||||
|
gridX = numXBlocks - 1;
|
||||||
|
if (gridY < 0)
|
||||||
|
gridY = 0;
|
||||||
|
if (gridY >= numYBlocks)
|
||||||
|
gridY = numYBlocks - 1;
|
||||||
|
|
||||||
|
List<Actor> result = new List<Actor>();
|
||||||
|
|
||||||
|
for (int gx = gridX - checkDistance; gx <= gridX + checkDistance; gx++)
|
||||||
|
{
|
||||||
|
for (int gy = gridY - checkDistance; gy <= gridY + checkDistance; gy++)
|
||||||
|
{
|
||||||
|
result.AddRange(actorBlock[gx, gy]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,16 +41,41 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
|
|
||||||
public uint actorID;
|
public uint actorID;
|
||||||
|
|
||||||
public uint displayNameID;
|
public bool isNameplateVisible;
|
||||||
|
public bool isTargetable;
|
||||||
|
|
||||||
|
public uint displayNameID = 0xFFFFFFFF;
|
||||||
public string customDisplayName;
|
public string customDisplayName;
|
||||||
|
public uint nameplateIcon;
|
||||||
|
|
||||||
public uint modelID;
|
public uint modelID;
|
||||||
public uint[] appearanceIDs = new uint[0x1D];
|
public uint[] appearanceIDs = new uint[0x1D];
|
||||||
|
|
||||||
public float positionX, positionY, positionZ;
|
public uint currentTarget = 0xC0000000;
|
||||||
public float oldPositionX, oldPositionY, oldPositionZ;
|
public uint currentLockedTarget = 0xC0000000;
|
||||||
public float rotation;
|
|
||||||
public ushort moveState;
|
public float positionX, positionY, positionZ, rotation;
|
||||||
|
public float oldPositionX, oldPositionY, oldPositionZ, oldRotation;
|
||||||
|
public ushort moveState, oldMoveState;
|
||||||
|
|
||||||
|
public uint currentState = SetActorStatePacket.STATE_PASSIVE;
|
||||||
|
|
||||||
|
public uint currentZoneID;
|
||||||
|
|
||||||
|
//Properties
|
||||||
|
public ushort curHP, curMP, curTP;
|
||||||
|
public ushort maxHP, maxMP, maxTP;
|
||||||
|
|
||||||
|
public byte currentJob;
|
||||||
|
public ushort currentLevel;
|
||||||
|
|
||||||
|
public ushort statSTR, statVIT, statDEX, statINT, statMIN, statPIE;
|
||||||
|
public ushort statAttack, statDefense, statAccuracy, statAttackMgkPotency, statHealingMgkPotency, statEnchancementMgkPotency, statEnfeeblingMgkPotency, statMgkAccuracy, statMgkEvasion;
|
||||||
|
public ushort resistFire, resistIce, resistWind, resistEarth, resistLightning, resistWater;
|
||||||
|
|
||||||
|
public uint currentEXP;
|
||||||
|
|
||||||
|
public ushort linkshellcrest;
|
||||||
|
|
||||||
public Actor(uint id)
|
public Actor(uint id)
|
||||||
{
|
{
|
||||||
@ -94,7 +119,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
|
|
||||||
public SubPacket createStatePacket(uint playerActorID)
|
public SubPacket createStatePacket(uint playerActorID)
|
||||||
{
|
{
|
||||||
return SetActorStatePacket.buildPacket(playerActorID, actorID, SetActorStatePacket.STATE_PASSIVE);
|
return SetActorStatePacket.buildPacket(playerActorID, actorID, currentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket createSpeedPacket(uint playerActorID)
|
public SubPacket createSpeedPacket(uint playerActorID)
|
||||||
@ -102,5 +127,33 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
return SetActorSpeedPacket.buildPacket(playerActorID, actorID);
|
return SetActorSpeedPacket.buildPacket(playerActorID, actorID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SubPacket createSpawnPositonPacket(uint playerActorID, uint spawnType)
|
||||||
|
{
|
||||||
|
return SetActorPositionPacket.buildPacket(playerActorID, actorID, positionX, positionY, positionZ, rotation, spawnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SubPacket createPositionUpdatePacket(uint playerActorID)
|
||||||
|
{
|
||||||
|
return MoveActorToPositionPacket.buildPacket(playerActorID, actorID, positionX, positionY, positionZ, rotation, moveState);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SubPacket createScriptBindPacket(uint playerActorID)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BasePacket createActorSpawnPackets(uint playerActorID)
|
||||||
|
{
|
||||||
|
List<SubPacket> subpackets = new List<SubPacket>();
|
||||||
|
subpackets.Add(AddActorPacket.buildPacket(playerActorID, actorID));
|
||||||
|
subpackets.Add(createSpeedPacket(playerActorID));
|
||||||
|
subpackets.Add(createSpawnPositonPacket(playerActorID, 0));
|
||||||
|
subpackets.Add(createAppearancePacket(playerActorID));
|
||||||
|
subpackets.Add(createNamePacket(playerActorID));
|
||||||
|
subpackets.Add(createStatePacket(playerActorID));
|
||||||
|
subpackets.Add(createScriptBindPacket(playerActorID));
|
||||||
|
return BasePacket.createPacket(subpackets, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
using FFXIVClassic_Lobby_Server;
|
using FFXIVClassic_Lobby_Server;
|
||||||
using FFXIVClassic_Lobby_Server.dataobjects;
|
using FFXIVClassic_Lobby_Server.dataobjects;
|
||||||
|
using FFXIVClassic_Lobby_Server.packets;
|
||||||
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -15,12 +17,8 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
ClientConnection conn1;
|
ClientConnection conn1;
|
||||||
ClientConnection conn2;
|
ClientConnection conn2;
|
||||||
|
|
||||||
public uint characterID = 0;
|
|
||||||
public uint actorID = 0;
|
public uint actorID = 0;
|
||||||
|
|
||||||
private uint currentTarget = 0xC0000000;
|
|
||||||
private uint currentLockedTarget = 0xC0000000;
|
|
||||||
|
|
||||||
private uint currentZoneID = 0;
|
private uint currentZoneID = 0;
|
||||||
|
|
||||||
List<Actor> actorInstanceList = new List<Actor>();
|
List<Actor> actorInstanceList = new List<Actor>();
|
||||||
@ -112,19 +110,28 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTarget(uint actorID)
|
|
||||||
{
|
|
||||||
currentTarget = actorID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLockedTarget(uint actorID)
|
public List<BasePacket> updateInstance(List<Actor> list)
|
||||||
{
|
{
|
||||||
currentLockedTarget = actorID;
|
List<BasePacket> basePackets = new List<BasePacket>();
|
||||||
}
|
List<SubPacket> posUpdateSubpackets = new List<SubPacket>();
|
||||||
|
|
||||||
public uint getTargetedActor()
|
for (int i = 0; i < list.Count; i++)
|
||||||
{
|
{
|
||||||
return currentTarget;
|
Actor actor = list[i];
|
||||||
|
|
||||||
|
if (actor.actorID == playerActor.actorID)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (actorInstanceList.Contains(actor))
|
||||||
|
posUpdateSubpackets.Add(actor.createPositionUpdatePacket(playerActor.actorID));
|
||||||
|
else
|
||||||
|
basePackets.Add(actor.createActorSpawnPackets(playerActor.actorID));
|
||||||
|
}
|
||||||
|
|
||||||
|
basePackets.Add(BasePacket.createPacket(posUpdateSubpackets, true, false));
|
||||||
|
|
||||||
|
return basePackets;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user