public static void HandleChat(TNLConnection conn, Packet packet) { var type = (ChatType) packet.ReadUInteger(); var isGm = packet.ReadBoolean(); var recipient = packet.ReadUtf8StringOn(17); var sender = packet.ReadUtf8StringOn(17); packet.ReadPadding(1); var msglen = packet.ReadUShort(); var msg = packet.ReadUtf8StringOn(msglen); if (msg.StartsWith("/")) { if (msg.Equals("/save")) conn.CurrentCharacter.SaveToDB(); return; } var pack = ConstructChatPacket(type, isGm, recipient, sender, msg); switch (type) { default: Logger.WriteLog("Unhandled ChatType in HandleChat: {0}", LogType.Error, type); break; } }
public static void HandleBroadcast(TNLConnection conn, Packet packet) { var type = (ChatType) packet.ReadUInteger(); var sendercoid = packet.ReadLong(); var isGm = packet.ReadBoolean(); packet.ReadPadding(1); var msglen = packet.ReadUShort(); var sender = packet.ReadUtf8StringOn(17); var msg = packet.ReadUtf8StringOn(msglen); if (msg.StartsWith("/")) { if (msg.Equals("/save")) conn.CurrentCharacter.SaveToDB(); return; } conn.CurrentCharacter.GetMap().BroadcastChat(type, ConstructBroadcastPacket(type, isGm, sender, sendercoid, msg), conn.CurrentCharacter); }
public static CreateCharacterModel Read(Packet packet) { return new CreateCharacterModel { CBid = packet.ReadInteger(), AccountName = packet.ReadUtf8StringOn(33), CharacterName = packet.ReadUtf8StringOn(51), Head = packet.ReadInteger(), Body = packet.ReadInteger(), HeadDetail = packet.ReadInteger(), HeadDetail2 = packet.ReadInteger(), Helmet = packet.ReadInteger(), Eyes = packet.ReadInteger(), Mouth = packet.ReadInteger(), Hair = packet.ReadInteger(), PrimaryColor = packet.ReadUInteger(), SecondaryColor = packet.ReadUInteger(), EyeColor = packet.ReadUInteger(), HairColor = packet.ReadUInteger(), SkinColor = packet.ReadUInteger(), SpecialColor = packet.ReadUInteger(), ShardId = packet.ReadUInteger(), VehiclePrimaryColor = packet.ReadUInteger(), VehicleSecondaryColor = packet.ReadUInteger(), VehicleTrim = packet.ReadByte(), ScaleOffset = packet.ReadPadding(3).ReadSingle(), CBidWheelset = packet.ReadInteger(), VehicleName = packet.ReadUtf8StringOn(33), }; }
public override void HandleMove(Packet packet) { base.HandleMove(packet); Acceleration = packet.ReadSingle(); Steering = packet.ReadSingle(); TurretDirection = packet.ReadSingle(); var vehFlags = packet.ReadUInteger(); var firing = packet.ReadBoolean(); var target = packet.ReadPadding(2).ReadTFID(); var targetObj = GetMap().GetObject(target); if (targetObj != null) SetTargetObject(targetObj); }