Beispiel #1
0
        public override bool ParseBytesAndExecute(byte[] data)
        {
            if (data.Length != 8 + 1 + 4 + 24)
            {
                return(false);
            }
            long     EID      = Utilities.BytesToLong(Utilities.BytesPartial(data, 0, 8));
            bool     enabled  = (data[8] & 1) == 1;
            float    distance = Utilities.BytesToFloat(Utilities.BytesPartial(data, 8 + 1, 4));
            Location color    = Location.FromDoubleBytes(data, 8 + 1 + 4);
            Entity   ent      = TheClient.TheRegion.GetEntity(EID);

            if (ent == null || !(ent is CharacterEntity))
            {
                return(false);
            }
            Destroy(ent);
            if (enabled)
            {
                SpotLight sl = new SpotLight(ent.GetPosition(), distance, color, Location.UnitX, 45)
                {
                    Direction = ((CharacterEntity)ent).ForwardVector()
                };
                sl.Reposition(ent.GetPosition());
                ((CharacterEntity)ent).Flashlight = sl;
                TheClient.MainWorldView.Lights.Add(sl);
            }
            return(true);
        }