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:
Filip Maj 2015-10-13 19:15:44 -04:00
parent 28b868e421
commit b17a86ba2c
6 changed files with 225 additions and 38 deletions

View file

@ -41,16 +41,41 @@ namespace FFXIVClassic_Map_Server.dataobjects
public uint actorID;
public uint displayNameID;
public bool isNameplateVisible;
public bool isTargetable;
public uint displayNameID = 0xFFFFFFFF;
public string customDisplayName;
public uint nameplateIcon;
public uint modelID;
public uint[] appearanceIDs = new uint[0x1D];
public float positionX, positionY, positionZ;
public float oldPositionX, oldPositionY, oldPositionZ;
public float rotation;
public ushort moveState;
public uint currentTarget = 0xC0000000;
public uint currentLockedTarget = 0xC0000000;
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)
{
@ -94,7 +119,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
public SubPacket createStatePacket(uint playerActorID)
{
return SetActorStatePacket.buildPacket(playerActorID, actorID, SetActorStatePacket.STATE_PASSIVE);
return SetActorStatePacket.buildPacket(playerActorID, actorID, currentState);
}
public SubPacket createSpeedPacket(uint playerActorID)
@ -102,5 +127,33 @@ namespace FFXIVClassic_Map_Server.dataobjects
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);
}
}
}

View file

@ -1,5 +1,7 @@
using FFXIVClassic_Lobby_Server;
using FFXIVClassic_Lobby_Server.dataobjects;
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic;
using System.Linq;
@ -15,12 +17,8 @@ namespace FFXIVClassic_Map_Server.dataobjects
ClientConnection conn1;
ClientConnection conn2;
public uint characterID = 0;
public uint actorID = 0;
private uint currentTarget = 0xC0000000;
private uint currentLockedTarget = 0xC0000000;
private uint currentZoneID = 0;
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)
{
currentLockedTarget = actorID;
}
public List<BasePacket> updateInstance(List<Actor> list)
{
List<BasePacket> basePackets = new List<BasePacket>();
List<SubPacket> posUpdateSubpackets = new List<SubPacket>();
public uint getTargetedActor()
{
return currentTarget;
for (int i = 0; i < list.Count; i++)
{
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;
}
}
}