Bug fix on broadcast packet method, filled out what 0x144 does.

This commit is contained in:
Filip Maj 2017-05-16 23:43:07 -04:00
parent 08b3564d7e
commit c67c5f3bdf
6 changed files with 23 additions and 8 deletions

View File

@ -196,7 +196,7 @@
<Compile Include="packets\send\actor\inventory\EquipmentListX08Packet.cs" />
<Compile Include="packets\send\actor\RemoveActorPacket.cs" />
<Compile Include="packets\send\actor\SetActorIconPacket.cs" />
<Compile Include="packets\send\actor\SetActorIdleAnimationPacket.cs" />
<Compile Include="packets\send\actor\SetActorSubStatPacket.cs" />
<Compile Include="packets\send\actor\SetActorStatusPacket.cs" />
<Compile Include="packets\send\actor\_0xD9Packet.cs" />
<Compile Include="packets\send\actor\_0xD8Packet.cs" />

View File

@ -355,7 +355,7 @@ namespace FFXIVClassic_Map_Server.Actors
if (isIsolated && packet.header.sourceId != a.actorId)
continue;
SubPacket clonedPacket = new SubPacket(packet, actor.actorId);
SubPacket clonedPacket = new SubPacket(packet, a.actorId);
Player p = (Player)a;
p.QueuePacket(clonedPacket);
}

View File

@ -81,7 +81,7 @@ namespace FFXIVClassic_Map_Server.Actors
public SubPacket CreateIdleAnimationPacket(uint playerActorId)
{
return SetActorIdleAnimationPacket.BuildPacket(actorId, playerActorId, animationId);
return SetActorSubStatPacket.BuildPacket(actorId, playerActorId, 0, 0, 0, 0, 0, 0, animationId);
}
public void SetQuestGraphic(Player player, int graphicNum)

View File

@ -321,6 +321,12 @@ namespace FFXIVClassic_Map_Server.Actors
{
return actorClassId;
}
public void ChangeNpcAppearance(uint id)
{
LoadNpcAppearance(id);
zone.BroadcastPacketAroundActor(this, CreateAppearancePacket(actorId));
}
public void LoadNpcAppearance(uint id)
{

View File

@ -405,6 +405,10 @@ namespace FFXIVClassic_Map_Server.lua
#region RunGMCommand
public static void RunGMCommand(Player player, String cmd, string[] param, bool help = false)
{
bool playerNull = player == null;
if (playerNull && param.Length >= 2)
player = Server.GetWorldManager().GetPCInWorld(param[1] + " " + param[2]);
// load from scripts/commands/gm/ directory
var path = String.Format("./scripts/commands/gm/{0}.lua", cmd.ToLower());
@ -490,7 +494,7 @@ namespace FFXIVClassic_Map_Server.lua
// we'll push our lua params here
List<object> LuaParam = new List<object>();
var i = 0;
var i = playerNull ? 2 : 0;
for (; i < parameters.Length; ++i)
{
try
@ -526,7 +530,7 @@ namespace FFXIVClassic_Map_Server.lua
// the script can double check the player exists, we'll push them anyways
LuaParam.Insert(0, player);
// push the arg count too
LuaParam.Insert(1, i);
LuaParam.Insert(1, i - (playerNull ? 2 : 0));
// run the script
//script.Call(script.Globals["onTrigger"], LuaParam.ToArray());

View File

@ -5,12 +5,12 @@ using FFXIVClassic.Common;
namespace FFXIVClassic_Map_Server.packets.send.actor
{
class SetActorIdleAnimationPacket
class SetActorSubStatPacket
{
public const ushort OPCODE = 0x144;
public const uint PACKET_SIZE = 0x28;
public static SubPacket BuildPacket(uint playerActorID, uint targetID, uint idleAnimationId)
public static SubPacket BuildPacket(uint playerActorID, uint targetID, byte breakage, int leftChant, int rightChant, int guard, int wasteStat, int statMode, uint idleAnimationId)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
@ -18,7 +18,12 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
{
using (BinaryWriter binWriter = new BinaryWriter(mem))
{
binWriter.Seek(0x6, SeekOrigin.Begin);
binWriter.Write((byte)breakage);
binWriter.Write((byte)(((leftChant & 0xF) << 8) | (rightChant & 0xF)));
binWriter.Write((byte)(guard & 0xF));
binWriter.Write((byte)((wasteStat & 0xF) << 8));
binWriter.Write((byte)(statMode & 0xF));
binWriter.Write((byte)0);
binWriter.Write((UInt16)(idleAnimationId&0xFFFF));
}
}