2019-06-18 22:55:32 -04:00
|
|
|
|
/*
|
|
|
|
|
===========================================================================
|
|
|
|
|
Copyright (C) 2015-2019 Project Meteor Dev Team
|
|
|
|
|
|
|
|
|
|
This file is part of Project Meteor Server.
|
|
|
|
|
|
|
|
|
|
Project Meteor Server is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General Public License as published by
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
Project Meteor Server is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
|
|
|
|
===========================================================================
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using FFXIVClassic.Common;
|
2016-08-22 10:43:04 -04:00
|
|
|
|
using System;
|
2015-10-06 23:53:14 -04:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
2016-08-22 10:43:04 -04:00
|
|
|
|
namespace FFXIVClassic_Map_Server.packets.send.actor
|
2015-10-06 23:53:14 -04:00
|
|
|
|
{
|
|
|
|
|
class SetActorSpeedPacket
|
|
|
|
|
{
|
|
|
|
|
public const ushort OPCODE = 0x00D0;
|
|
|
|
|
public const uint PACKET_SIZE = 0xA8;
|
|
|
|
|
|
2016-02-02 00:02:06 -05:00
|
|
|
|
public const float DEFAULT_STOP = 0.0f;
|
|
|
|
|
public const float DEFAULT_WALK = 2.0f;
|
|
|
|
|
public const float DEFAULT_RUN = 5.0f;
|
2017-01-03 19:02:35 -05:00
|
|
|
|
public const float DEFAULT_ACTIVE = 5.0f;
|
2015-10-06 23:53:14 -04:00
|
|
|
|
|
2017-06-27 13:23:05 -04:00
|
|
|
|
public static SubPacket BuildPacket(uint sourceActorId)
|
2015-10-06 23:53:14 -04:00
|
|
|
|
{
|
|
|
|
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
|
|
|
|
|
|
|
|
|
using (MemoryStream mem = new MemoryStream(data))
|
|
|
|
|
{
|
|
|
|
|
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
|
|
|
|
{
|
2016-02-02 00:02:06 -05:00
|
|
|
|
binWriter.Write((Single)DEFAULT_STOP);
|
2015-10-06 23:53:14 -04:00
|
|
|
|
binWriter.Write((UInt32)0);
|
|
|
|
|
|
2016-02-02 00:02:06 -05:00
|
|
|
|
binWriter.Write((Single)DEFAULT_WALK);
|
2015-10-06 23:53:14 -04:00
|
|
|
|
binWriter.Write((UInt32)1);
|
|
|
|
|
|
2016-02-02 00:02:06 -05:00
|
|
|
|
binWriter.Write((Single)DEFAULT_RUN);
|
2015-10-06 23:53:14 -04:00
|
|
|
|
binWriter.Write((UInt32)2);
|
|
|
|
|
|
2017-01-03 19:02:35 -05:00
|
|
|
|
binWriter.Write((Single)DEFAULT_ACTIVE);
|
2015-10-06 23:53:14 -04:00
|
|
|
|
binWriter.Write((UInt32)3);
|
|
|
|
|
|
|
|
|
|
binWriter.BaseStream.Seek(0x80, SeekOrigin.Begin);
|
|
|
|
|
|
2017-01-03 19:02:35 -05:00
|
|
|
|
binWriter.Write((UInt32)4);
|
2015-10-06 23:53:14 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-27 13:23:05 -04:00
|
|
|
|
return new SubPacket(OPCODE, sourceActorId, data);
|
2015-10-06 23:53:14 -04:00
|
|
|
|
}
|
|
|
|
|
|
2017-06-27 13:23:05 -04:00
|
|
|
|
public static SubPacket BuildPacket(uint sourceActorId, float stopSpeed, float walkSpeed, float runSpeed, float activeSpeed)
|
2015-10-06 23:53:14 -04:00
|
|
|
|
{
|
|
|
|
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
|
|
|
|
|
|
|
|
|
using (MemoryStream mem = new MemoryStream(data))
|
|
|
|
|
{
|
|
|
|
|
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
|
|
|
|
{
|
2016-02-02 00:02:06 -05:00
|
|
|
|
binWriter.Write((Single)stopSpeed);
|
2015-10-06 23:53:14 -04:00
|
|
|
|
binWriter.Write((UInt32)0);
|
|
|
|
|
|
2016-02-02 00:02:06 -05:00
|
|
|
|
binWriter.Write((Single)walkSpeed);
|
2015-10-06 23:53:14 -04:00
|
|
|
|
binWriter.Write((UInt32)1);
|
|
|
|
|
|
2016-02-02 00:02:06 -05:00
|
|
|
|
binWriter.Write((Single)runSpeed);
|
2015-10-06 23:53:14 -04:00
|
|
|
|
binWriter.Write((UInt32)2);
|
2016-02-02 00:02:06 -05:00
|
|
|
|
|
2017-01-03 19:02:35 -05:00
|
|
|
|
binWriter.Write((Single)activeSpeed);
|
2015-10-06 23:53:14 -04:00
|
|
|
|
binWriter.Write((UInt32)3);
|
|
|
|
|
|
2016-02-03 00:45:11 -05:00
|
|
|
|
binWriter.BaseStream.Seek(0x80, SeekOrigin.Begin);
|
2015-10-06 23:53:14 -04:00
|
|
|
|
|
2017-01-03 19:02:35 -05:00
|
|
|
|
binWriter.Write((UInt32)4);
|
2015-10-06 23:53:14 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-27 13:23:05 -04:00
|
|
|
|
return new SubPacket(OPCODE, sourceActorId, data);
|
2015-10-06 23:53:14 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|