mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-20 11:47:48 +00:00
Added substate modifications to characters.
This commit is contained in:
parent
42aa3d7512
commit
c55145d715
4 changed files with 110 additions and 24 deletions
|
@ -11,6 +11,7 @@ using System.Reflection;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor.battle;
|
using FFXIVClassic_Map_Server.packets.send.actor.battle;
|
||||||
using FFXIVClassic_Map_Server.packets.send;
|
using FFXIVClassic_Map_Server.packets.send;
|
||||||
|
using FFXIVClassic_Map_Server.actors.chara;
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors
|
namespace FFXIVClassic_Map_Server.Actors
|
||||||
{
|
{
|
||||||
|
@ -21,17 +22,18 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
Position = 0x01,
|
Position = 0x01,
|
||||||
HpTpMp = 0x02,
|
HpTpMp = 0x02,
|
||||||
State = 0x04,
|
State = 0x04,
|
||||||
Combat = 0x07,
|
SubState = 0x08,
|
||||||
Name = 0x08,
|
Combat = 0x0F,
|
||||||
Appearance = 0x10,
|
Name = 0x10,
|
||||||
Speed = 0x20,
|
Appearance = 0x20,
|
||||||
Work = 0x40,
|
Speed = 0x40,
|
||||||
Stats = 0x80,
|
Work = 0x80,
|
||||||
Status = 0x100,
|
Stats = 0x100,
|
||||||
StatusTime = 0x200,
|
Status = 0x200,
|
||||||
|
StatusTime = 0x400,
|
||||||
|
|
||||||
AllNpc = 0x6F,
|
AllNpc = 0xDF,
|
||||||
AllPlayer = 0x9F
|
AllPlayer = 0x13F
|
||||||
}
|
}
|
||||||
|
|
||||||
class Actor
|
class Actor
|
||||||
|
@ -44,7 +46,9 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
public string customDisplayName;
|
public string customDisplayName;
|
||||||
|
|
||||||
public ushort currentMainState = SetActorStatePacket.MAIN_STATE_PASSIVE;
|
public ushort currentMainState = SetActorStatePacket.MAIN_STATE_PASSIVE;
|
||||||
public ushort currentSubState = SetActorStatePacket.SUB_STATE_NONE;
|
|
||||||
|
public SubState currentSubState = new SubState();
|
||||||
|
|
||||||
public float positionX, positionY, positionZ, rotation;
|
public float positionX, positionY, positionZ, rotation;
|
||||||
public float oldPositionX, oldPositionY, oldPositionZ, oldRotation;
|
public float oldPositionX, oldPositionY, oldPositionZ, oldRotation;
|
||||||
public ushort moveState, oldMoveState;
|
public ushort moveState, oldMoveState;
|
||||||
|
@ -378,6 +382,16 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SubState GetSubState()
|
||||||
|
{
|
||||||
|
return currentSubState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SubstateModified()
|
||||||
|
{
|
||||||
|
updateFlags |= (ActorUpdateFlags.SubState);
|
||||||
|
}
|
||||||
|
|
||||||
public void ModifySpeed(float mod)
|
public void ModifySpeed(float mod)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
|
@ -450,7 +464,12 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
|
|
||||||
if ((updateFlags & ActorUpdateFlags.State) != 0)
|
if ((updateFlags & ActorUpdateFlags.State) != 0)
|
||||||
{
|
{
|
||||||
packets.Add(SetActorStatePacket.BuildPacket(actorId, currentMainState, currentSubState));
|
packets.Add(SetActorStatePacket.BuildPacket(actorId, currentMainState, 0x3B));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((updateFlags & ActorUpdateFlags.SubState) != 0)
|
||||||
|
{
|
||||||
|
packets.Add(SetActorSubStatePacket.BuildPacket(actorId, currentSubState));
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFlags = ActorUpdateFlags.None;
|
updateFlags = ActorUpdateFlags.None;
|
||||||
|
|
|
@ -169,7 +169,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
|
|
||||||
public SubPacket CreateIdleAnimationPacket()
|
public SubPacket CreateIdleAnimationPacket()
|
||||||
{
|
{
|
||||||
return SetActorSubStatPacket.BuildPacket(actorId, 0, 0, 0, 0, 0, 0, animationId);
|
return SetActorSubStatePacket.BuildPacket(actorId, 0, 0, 0, 0, 0, 0, animationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetQuestGraphic(Player player, int graphicNum)
|
public void SetQuestGraphic(Player player, int graphicNum)
|
||||||
|
@ -221,8 +221,8 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
|
|
||||||
public void SendChant(int left, int right)
|
public void SendChant(int left, int right)
|
||||||
{
|
{
|
||||||
SetActorSubStatPacket.BuildPacket(actorId, 0, left, right, 0, 0, 0, 0).DebugPrintSubPacket();
|
SetActorSubStatePacket.BuildPacket(actorId, 0, left, right, 0, 0, 0, 0).DebugPrintSubPacket();
|
||||||
zone.BroadcastPacketAroundActor(this, SetActorSubStatPacket.BuildPacket(actorId, 0, left, right, 0, 0, 0, 0));
|
zone.BroadcastPacketAroundActor(this, SetActorSubStatePacket.BuildPacket(actorId, 0, left, right, 0, 0, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DoBattleAction(ushort commandId, uint animationId)
|
public void DoBattleAction(ushort commandId, uint animationId)
|
||||||
|
@ -370,7 +370,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
|
|
||||||
if ((updateFlags & ActorUpdateFlags.State) != 0)
|
if ((updateFlags & ActorUpdateFlags.State) != 0)
|
||||||
{
|
{
|
||||||
packets.Add(SetActorStatePacket.BuildPacket(actorId, currentMainState, currentSubState));
|
packets.Add(SetActorStatePacket.BuildPacket(actorId, currentMainState, 0x0));
|
||||||
packets.Add(BattleActionX00Packet.BuildPacket(actorId, 0x72000062, 0));
|
packets.Add(BattleActionX00Packet.BuildPacket(actorId, 0x72000062, 0));
|
||||||
packets.Add(BattleActionX01Packet.BuildPacket(actorId, 0x7C000062, 21001, new BattleAction(actorId, 0, 1)));
|
packets.Add(BattleActionX01Packet.BuildPacket(actorId, 0x7C000062, 21001, new BattleAction(actorId, 0, 1)));
|
||||||
|
|
||||||
|
@ -378,6 +378,16 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
//DoBattleAction(21001, 0x7C000062, new BattleAction(this.actorId, 0, 1, 0, 0, 1)); //Attack Mode
|
//DoBattleAction(21001, 0x7C000062, new BattleAction(this.actorId, 0, 1, 0, 0, 1)); //Attack Mode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((updateFlags & ActorUpdateFlags.SubState) != 0)
|
||||||
|
{
|
||||||
|
packets.Add(SetActorSubStatePacket.BuildPacket(actorId, currentSubState));
|
||||||
|
packets.Add(BattleActionX00Packet.BuildPacket(actorId, 0x72000062, 0));
|
||||||
|
packets.Add(BattleActionX01Packet.BuildPacket(actorId, 0x7C000062, 21001, new BattleAction(actorId, 0, 1)));
|
||||||
|
|
||||||
|
updateFlags &= ~ActorUpdateFlags.SubState;
|
||||||
|
//DoBattleAction(21001, 0x7C000062, new BattleAction(this.actorId, 0, 1, 0, 0, 1)); //Attack Mode
|
||||||
|
}
|
||||||
|
|
||||||
if ((updateFlags & ActorUpdateFlags.Status) != 0)
|
if ((updateFlags & ActorUpdateFlags.Status) != 0)
|
||||||
{
|
{
|
||||||
List<SubPacket> statusPackets = statusEffects.GetStatusPackets();
|
List<SubPacket> statusPackets = statusEffects.GetStatusPackets();
|
||||||
|
|
56
FFXIVClassic Map Server/actors/chara/SubState.cs
Normal file
56
FFXIVClassic Map Server/actors/chara/SubState.cs
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FFXIVClassic_Map_Server.actors.chara
|
||||||
|
{
|
||||||
|
class SubState
|
||||||
|
{
|
||||||
|
public byte breakage = 0;
|
||||||
|
public byte chantId = 0;
|
||||||
|
public byte guard = 0;
|
||||||
|
public byte waste = 0;
|
||||||
|
public byte mode = 0;
|
||||||
|
public ushort motionPack = 0;
|
||||||
|
|
||||||
|
public void toggleBreak(int index, bool toggle)
|
||||||
|
{
|
||||||
|
if (index > 7 || index < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (toggle)
|
||||||
|
breakage = (byte)(breakage | (1 << index));
|
||||||
|
else
|
||||||
|
breakage = (byte)(breakage & ~(1 << index));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChant(byte chant) {
|
||||||
|
chantId = chant;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGuard(byte guard)
|
||||||
|
{
|
||||||
|
if (guard >= 0 && guard <= 3)
|
||||||
|
this.guard = guard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWaste(byte waste)
|
||||||
|
{
|
||||||
|
if (waste >= 0 && waste <= 3)
|
||||||
|
this.waste = waste;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMode(byte bitfield)
|
||||||
|
{
|
||||||
|
mode = bitfield;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotionPack(ushort mp)
|
||||||
|
{
|
||||||
|
motionPack = mp;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,10 +2,11 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
using FFXIVClassic.Common;
|
using FFXIVClassic.Common;
|
||||||
|
using FFXIVClassic_Map_Server.actors.chara;
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.packets.send.actor
|
namespace FFXIVClassic_Map_Server.packets.send.actor
|
||||||
{
|
{
|
||||||
class SetActorSubStatPacket
|
class SetActorSubStatePacket
|
||||||
{
|
{
|
||||||
public const ushort OPCODE = 0x144;
|
public const ushort OPCODE = 0x144;
|
||||||
public const uint PACKET_SIZE = 0x28;
|
public const uint PACKET_SIZE = 0x28;
|
||||||
|
@ -21,7 +22,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
||||||
SubStatMotionPack = 0x06,
|
SubStatMotionPack = 0x06,
|
||||||
Unknown2 = 0x07,
|
Unknown2 = 0x07,
|
||||||
}
|
}
|
||||||
public static SubPacket BuildPacket(uint sourceActorId, byte breakage, int leftChant, int rightChant, int guard, int wasteStat, int statMode, uint idleAnimationId)
|
public static SubPacket BuildPacket(uint sourceActorId, SubState substate)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -29,13 +30,13 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
||||||
{
|
{
|
||||||
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||||
{
|
{
|
||||||
binWriter.Write((byte)breakage);
|
binWriter.Write((byte)substate.breakage);
|
||||||
binWriter.Write((byte)(((leftChant & 0xF) << 4) | (rightChant & 0xF)));
|
binWriter.Write((byte)substate.chantId);
|
||||||
binWriter.Write((byte)(guard & 0xF));
|
binWriter.Write((byte)(substate.guard & 0xF));
|
||||||
binWriter.Write((byte)(wasteStat));
|
binWriter.Write((byte)(substate.waste));
|
||||||
binWriter.Write((byte)(statMode));
|
binWriter.Write((byte)(substate.mode));
|
||||||
binWriter.Write((byte)0);
|
binWriter.Write((byte)0);
|
||||||
binWriter.Write((UInt16)(idleAnimationId&0xFFFF));
|
binWriter.Write((ushort)substate.motionPack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue