コード例 #1
0
        public GameMessageUpdateMotion(ObjectGuid animationTargetGuid, byte[] instance_timestamp, SequenceManager sequence, MotionState newState)
            : base(GameMessageOpcode.Motion, GameMessageGroup.Group0A)
        {
            Writer.WriteGuid(animationTargetGuid);
            // who is getting the message - the rest of the sequences are the target objects sequences -may be the same
            Writer.Write(instance_timestamp);
            Writer.Write(sequence.GetNextSequence(SequenceType.ObjectMovement));
            if (!newState.IsAutonomous)
            {
                Writer.Write(sequence.GetNextSequence(SequenceType.ObjectServerControl));
            }
            else
            {
                Writer.Write(sequence.GetCurrentSequence(SequenceType.ObjectServerControl));
            }

            ushort autonomous;

            if (newState.IsAutonomous)
            {
                autonomous = 1;
            }
            else
            {
                autonomous = 0;
            }
            Writer.Write(autonomous);
            var movementData = newState.GetPayload(animationTargetGuid, sequence);

            Writer.Write(movementData);
            Writer.Align();
        }
コード例 #2
0
 public GameMessagePublicUpdatePropertyBool(SequenceManager sequences, PropertyBool property, bool value)
     : base(GameMessageOpcode.PublicUpdatePropertyBool, GameMessageGroup.UIQueue)
 {
     Writer.Write(sequences.GetNextSequence(SequenceType.PublicUpdatePropertyBool));
     Writer.Write((uint)property);
     Writer.Write(value);
 }
コード例 #3
0
 public GameMessagePrivateUpdatePropertyInt(SequenceManager sequences, PropertyInt property, int value)
     : base(GameMessageOpcode.PrivateUpdatePropertyInt, GameMessageGroup.Group09)
 {
     Writer.Write(sequences.GetNextSequence(SequenceType.PrivateUpdatePropertyInt));
     Writer.Write((uint)property);
     Writer.Write(value);
 }
コード例 #4
0
 public GameMessagePublicUpdatePropertyDouble(SequenceManager sequences, PropertyDouble property, uint value)
     : base(GameMessageOpcode.PublicUpdatePropertyDouble, GameMessageGroup.Group09)
 {
     Writer.Write(sequences.GetNextSequence(SequenceType.PublicUpdatePropertyDouble));
     Writer.Write((uint)property);
     Writer.Write(value);
 }
コード例 #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sequences"></param>
 /// <param name="sender"></param>
 /// <param name="property"></param>
 /// <param name="value"></param>
 public GameMessagePublicUpdatePropertyInt(SequenceManager sequences, ObjectGuid sender, PropertyInt property, int value)
     : base(GameMessageOpcode.PublicUpdatePropertyInt, GameMessageGroup.UIQueue)
 {
     Writer.Write(sequences.GetNextSequence(SequenceType.PublicUpdatePropertyInt));
     Writer.Write(sender.Full);
     Writer.Write((uint)property);
     Writer.Write(value);
 }
コード例 #6
0
 /// <summary>
 /// This is used to
 /// </summary>
 /// <param name="sequences"></param>
 /// <param name="sender"></param>
 /// <param name="property"></param>
 /// <param name="value"></param>
 public GameMessagePublicUpdatePropertyBool(SequenceManager sequences, ObjectGuid sender, PropertyBool property, bool value)
     : base(GameMessageOpcode.PublicUpdatePropertyBool, GameMessageGroup.Group09)
 {
     Writer.Write(sequences.GetNextSequence(SequenceType.PublicUpdatePropertyBool));
     Writer.Write(sender.Full);
     Writer.Write((uint)property);
     Writer.Write(value);
 }
コード例 #7
0
 public GameMessageUpdateInstanceId(SequenceManager sequences, ObjectGuid senderGuid, PropertyInstanceId idPropertyId, ObjectGuid value)
     : base(GameMessageOpcode.UpdateInstanceId, GameMessageGroup.Group09)
 {
     Writer.Write(sequences.GetNextSequence(SequenceType.PublicUpdatePropertyInstanceId));  // wts
     Writer.Write(senderGuid.Full);
     Writer.Write((uint)idPropertyId);
     Writer.Write(value.Full);
 }
コード例 #8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sequences"></param>
 /// <param name="sender"></param>
 /// <param name="property"></param>
 /// <param name="value"></param>
 public GameMessagePublicUpdatePropertyString(SequenceManager sequences, ObjectGuid sender, PropertyString property, string value)
     : base(GameMessageOpcode.PublicUpdatePropertyString, GameMessageGroup.UIQueue)
 {
     Writer.Write(sequences.GetNextSequence(SequenceType.PublicUpdatePropertyString));
     Writer.Write((uint)property);
     Writer.Write(sender.Full);
     Writer.Align();
     Writer.WriteString16L(value);
 }
コード例 #9
0
 public GameMessageSetStackSize(SequenceManager sequence, ObjectGuid itemGuid, int amount, int newValue)
     : base(GameMessageOpcode.SetStackSize, GameMessageGroup.Group09)
 {
     // TODO: need to understand what we really need to send here for sequence it is only a byte
     // and it increments by the number of items popped off the stack in the case of comp burn. Og II
     Writer.Write(sequence.GetNextSequence(SequenceType.ObjectInstance)[0]);
     Writer.Write(itemGuid.Full);
     Writer.Write(amount);
     Writer.Write(newValue);
 }
コード例 #10
0
        public override byte[] GetPayload(ObjectGuid animationTargetGuid, SequenceManager sequence)
        {
            MemoryStream stream = new MemoryStream();
            BinaryWriter writer = new BinaryWriter(stream);

            writer.Write((byte)MovementTypes);
            MotionFlags flags = MotionFlags.None;

            if (HasTarget)
            {
                flags |= MotionFlags.HasTarget;
            }
            if (Jumping)
            {
                flags |= MotionFlags.Jumping;
            }

            writer.Write((byte)flags);    // these can be or and has sticky object | is long jump mode |
            writer.Write((ushort)Stance); // called command in the client
            switch (MovementTypes)
            {
            case MovementTypes.General:
            {
                MovementData.SetMovementStateFlag();
                MovementStateFlag generalFlags = MovementData.MovementStateFlag;

                generalFlags += (uint)Commands.Count << 7;
                writer.Write((uint)generalFlags);

                MovementData.Serialize(writer);
                // Must be aligned for correct alignment. - sigh Og II
                writer.Align();

                foreach (var item in Commands)
                {
                    writer.Write((ushort)item.Motion);
                    writer.Write(sequence.GetNextSequence(SequenceType.Motion));
                    writer.Write(item.Speed);
                }
                break;
            }

            case MovementTypes.MoveToPosition:
            case MovementTypes.MoveToObject:
            {
                try
                {
                    if (MovementTypes == MovementTypes.MoveToObject)
                    {
                        writer.Write(TargetGuid.Full);
                    }

                    Position.Serialize(writer, false);
                    writer.Write(Flag);
                    writer.Write(DistanceFrom);
                    writer.Write(MinimumDistance);
                    writer.Write(FailDistance);
                    writer.Write(Speed);
                    writer.Write(WalkRunThreshold);
                    writer.Write(Heading);
                    writer.Write(RunRate);
                }
                catch (Exception)
                {
                    // Do nothing
                    // TODO: This prevents a crash in Kryst and possibly other locations, Please investigate and fix if possible.
                }
                break;
            }

            case MovementTypes.TurnToObject:
            {
                // This had the wrong value being passed.   We had never used this
                // movement type yet - coded it up but had not used or tested.
                writer.Write(TargetGuid.Full);
                writer.Write(Heading);
                writer.Write(Flag);
                writer.Write(Speed);
                writer.Write(DesiredHeading);         // always 0.0 in every pcap of this type.
                break;
            }

            case MovementTypes.TurnToHeading:
            {
                writer.Write(Flag);
                writer.Write(Speed);
                writer.Write(Heading);
                break;
            }
            }

            return(stream.ToArray());
        }