Example #1
0
        public void PlayGraphicalEffect(EffectDirectionType directionType, ObjectId characterId, ModelId type,
                                        Location3D location, byte animationSpeed, byte duration, bool adjustDirection, bool explodeOnImpact)
        {
            GraphicalEffectPacket packet = new GraphicalEffectPacket(characterId, 0, type, location, location,
                                                                     animationSpeed, directionType, duration, adjustDirection, explodeOnImpact);

            Send(packet.RawPacket);
        }
Example #2
0
    // add methods that spawn a graphical effect and send a message to clients if host.

    public void ReceiveNetworkMessage(NetworkMessage message)
    {
        if (!GameController.Instance.IsHost)
        {
            GraphicalEffectPacket effect = NetworkUtils.GetNetworkData <GraphicalEffectPacket>(message.contents);
            if (effect != null)
            {
                switch ((GraphicalEffectType)effect.effect)
                {
                // spawn graphical effect for client
                default:
                    break;
                }
            }
        }
    }
        public void Can_deserialize_packet_with_negative_z_coords()
        {
            var rawPacket = FakePackets.Instantiate(new byte[]
            {
                0x70,                   // packet
                0x03,                   // direction type
                0x00, 0x04, 0x5B, 0x2A, // character id
                0x00, 0x00, 0x00, 0x00, // target id
                0x37, 0x3A,             // model of the first frame
                0x0A, 0xA0,             // xloc
                0x0C, 0xB3,             // yloc
                0xF0,                   // zloc
                0x0A, 0xA0,             // target xloc
                0x0C, 0xB3,             // target yloc
                0xF1,                   // target zloc
                0x00,                   // speed of animation
                0x0F,                   // duration
                0x00, 0x00,             // unknown
                0x01,                   // adjust direction during animation
                0x00,                   // explode on impact
            });

            var packet = new GraphicalEffectPacket();

            packet.Deserialize(rawPacket);

            packet.DirectionType.Should().Be(EffectDirectionType.StayWithSource);
            packet.CharacterId.Should().Be((ObjectId)0x00045B2A);
            packet.TargetId.Should().Be((ObjectId)0x00000000);
            packet.Type.Should().Be((ModelId)0x373A);

            unchecked
            {
                packet.Location.Should().Be(new Location3D(0x0AA0, 0x0CB3, (sbyte)0xF0));
                packet.TargetLocation.Should().Be(new Location3D(0x0AA0, 0x0CB3, (sbyte)0xF1));
            }

            packet.AnimationSpeed.Should().Be(0);
            packet.Duration.Should().Be(0);
            packet.AdjustDirection.Should().BeTrue();
            packet.ExplodeOnImpact.Should().BeFalse();
        }
Example #4
0
 private void HandleGraphicalEffect(GraphicalEffectPacket packet)
 {
     eventJournalSource.Publish(new GraphicalEffectStartedEvent(packet.DirectionType, packet.CharacterId,
                                                                packet.TargetId, packet.Type, packet.Location, packet.TargetLocation));
 }