Exemplo n.º 1
0
        public void Clear(bool RaiseChangedEvent)
        {
            if (RaiseChangedEvent)
            {
                OverlayFileRID     = 0;
                FirstAnimationType = 0;
                ColorTranslation   = 0;
                Effect             = 0;
                Animation          = new AnimationNone();
                Source             = new ObjectID(0);
                Target             = new ObjectID(0);
                Speed        = 0;
                Flags        = 0;
                LightingInfo = new LightingInfo();

                OverlayFile = String.Empty;
            }
            else
            {
                overlayFileRID     = 0;
                firstAnimationType = 0;
                colorTranslation   = 0;
                effect             = 0;
                animation          = new AnimationNone();
                source             = new ObjectID(0);
                target             = new ObjectID(0);
                speed        = 0;
                flags        = 0;
                lightingInfo = new LightingInfo();

                overlayFile = String.Empty;
            }
        }
Exemplo n.º 2
0
        public Projectile(
            uint ResourceID,
            AnimationType FirstObjectAnimationType,
            byte ColorTranslation,
            byte Effect,
            Animation Animation,
            ObjectID Source,
            ObjectID Target,
            byte Speed,
            ushort Flags,
            LightingInfo LightingInfo)
        {
            ID = nextID;
            nextID++;

            this.overlayFileRID = ResourceID;

            this.firstAnimationType = FirstObjectAnimationType;
            this.colorTranslation   = ColorTranslation;
            this.effect             = Effect;

            this.animation = Animation;

            this.source = Source;
            this.target = Target;

            this.flags        = Flags;
            this.lightingInfo = LightingInfo;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Updates values of this instance to values taken from parameter instance.
        /// </summary>
        /// <param name="Model"></param>
        /// <param name="RaiseChangedEvent"></param>
        public override void UpdateFromModel(ObjectBase Model, bool RaiseChangedEvent)
        {
            base.UpdateFromModel(Model, RaiseChangedEvent);

            if (RaiseChangedEvent)
            {
                OverlayFileRID = Model.OverlayFileRID;
                NameRID        = Model.NameRID;
                Flags.UpdateFromModel(Model.Flags, RaiseChangedEvent);
                LightingInfo.UpdateFromModel(Model.LightingInfo, RaiseChangedEvent);
                FirstAnimationType = Model.FirstAnimationType;
                ColorTranslation   = Model.ColorTranslation;
                Effect             = Model.Effect;

                if (Animation != null)
                {
                    Animation.PropertyChanged -= OnAnimationPropertyChanged;
                }

                Animation = Model.Animation;
                Animation.PropertyChanged += OnAnimationPropertyChanged;

                subOverlays.Clear();
                subOverlays.AddRange(Model.SubOverlays);

                Name        = Model.Name;
                OverlayFile = Model.OverlayFile;
                Resource    = Model.Resource;
            }
            else
            {
                overlayFileRID = Model.OverlayFileRID;
                nameRID        = Model.NameRID;
                Flags.UpdateFromModel(Model.Flags, RaiseChangedEvent);
                LightingInfo.UpdateFromModel(Model.LightingInfo, RaiseChangedEvent);
                firstAnimationType = Model.FirstAnimationType;
                colorTranslation   = Model.ColorTranslation;
                effect             = Model.Effect;

                if (animation != null)
                {
                    animation.PropertyChanged -= OnAnimationPropertyChanged;
                }

                animation = Model.Animation;
                animation.PropertyChanged += OnAnimationPropertyChanged;

                subOverlays.Clear();
                subOverlays.AddRange(Model.SubOverlays);

                name        = Model.Name;
                overlayFile = Model.OverlayFile;
                resource    = Model.Resource;
            }

            // appearance update
            ProcessAppearance(true);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Constructor by values
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="Count"></param>
        /// <param name="OverlayFileRID"></param>
        /// <param name="NameRID"></param>
        /// <param name="Flags"></param>
        /// <param name="LightingInfo"></param>
        /// <param name="FirstAnimationType"></param>
        /// <param name="ColorTranslation"></param>
        /// <param name="Effect"></param>
        /// <param name="Animation"></param>
        /// <param name="SubOverlays"></param>
        /// <param name="HasLight"></param>
        public ObjectBase(
            uint ID,
            uint Count,
            uint OverlayFileRID,
            uint NameRID,
            uint Flags,
            LightingInfo LightingInfo,
            AnimationType FirstAnimationType,
            byte ColorTranslation,
            byte Effect,
            Animation Animation,
            IEnumerable <SubOverlay> SubOverlays,
            bool HasLight = true)
            : base(ID, Count)
        {
            // with light ?
            hasLight = HasLight;

            // basic
            overlayFileRID = OverlayFileRID;
            nameRID        = NameRID;
            flags.Value    = Flags;

            // light
            lightingInfo = LightingInfo;

            // first animation: colortranslation or effect
            firstAnimationType = FirstAnimationType;
            colorTranslation   = ColorTranslation;
            effect             = Effect;

            // special handling for secondtrans
            if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans)
            {
                colorTranslation = ColorTransformation.FILTERWHITE90;

                foreach (SubOverlay subOv in SubOverlays)
                {
                    subOv.ColorTranslation = ColorTransformation.FILTERWHITE90;
                }
            }

            // animation
            animation = Animation;
            animation.PropertyChanged += OnAnimationPropertyChanged;


            // suboverlays
            subOverlays.AddRange(SubOverlays);

            // attach listeners last (no need to refresh in contructor)
            subOverlays.ListChanged      += OnSubOverlaysListChanged;
            flags.PropertyChanged        += OnFlagsPropertyChanged;
            lightingInfo.PropertyChanged += OnLightingInfoPropertyChanged;
        }
Exemplo n.º 5
0
        public int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            overlayFileRID = BitConverter.ToUInt32(Buffer, cursor);
            cursor        += TypeSizes.INT;

            if ((AnimationType)Buffer[cursor] == AnimationType.TRANSLATION)
            {
                firstAnimationType = (AnimationType)Buffer[cursor];
                cursor++;

                colorTranslation = Buffer[cursor];
                cursor++;
            }
            else if (((AnimationType)Buffer[cursor] == AnimationType.EFFECT))
            {
                firstAnimationType = (AnimationType)Buffer[cursor];
                cursor++;

                effect = Buffer[cursor];
                cursor++;
            }

            animation = Animation.ExtractAnimation(Buffer, cursor);
            animation.PropertyChanged += animation_PropertyChanged;
            cursor += animation.ByteLength;

            source  = new ObjectID(Buffer, cursor);
            cursor += source.ByteLength;

            target  = new ObjectID(Buffer, cursor);
            cursor += target.ByteLength;

            speed = Buffer[cursor];
            cursor++;

            flags   = BitConverter.ToUInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            lightingInfo = new LightingInfo(Buffer, cursor);
            cursor      += lightingInfo.ByteLength;

            return(cursor - StartIndex);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Constructor by values
 /// </summary>
 /// <param name="ID"></param>
 /// <param name="Count"></param>
 /// <param name="OverlayFileRID"></param>
 /// <param name="NameRID"></param>
 /// <param name="Flags"></param>
 /// <param name="LightingInfo"></param>
 /// <param name="FirstAnimationType"></param>
 /// <param name="ColorTranslation"></param>
 /// <param name="Effect"></param>
 /// <param name="Animation"></param>
 /// <param name="SubOverlays"></param>
 /// <param name="Price"></param>
 public TradeOfferObject(
     uint ID,
     uint Count,
     uint OverlayFileRID,
     uint NameRID,
     uint Flags,
     LightingInfo LightingInfo,
     AnimationType FirstAnimationType,
     byte ColorTranslation,
     byte Effect,
     Animation Animation,
     IEnumerable <SubOverlay> SubOverlays,
     uint Price)
     : base(
         ID, Count, OverlayFileRID, NameRID, Flags,
         LightingInfo, FirstAnimationType,
         ColorTranslation, Effect, Animation, SubOverlays)
 {
     this.price = Price;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Constructor by values
 /// </summary>
 /// <param name="ID"></param>
 /// <param name="Count"></param>
 /// <param name="OverlayFileRID"></param>
 /// <param name="NameRID"></param>
 /// <param name="Flags"></param>
 /// <param name="LightingInfo"></param>
 /// <param name="FirstAnimationType"></param>
 /// <param name="ColorTranslation"></param>
 /// <param name="Effect"></param>
 /// <param name="Animation"></param>
 /// <param name="SubOverlays"></param>
 /// <param name="IsInUse"></param>
 public InventoryObject(
     uint ID,
     uint Count,
     uint OverlayFileRID,
     uint NameRID,
     uint Flags,
     LightingInfo LightingInfo,
     AnimationType FirstAnimationType,
     byte ColorTranslation,
     byte Effect,
     Animation Animation,
     BaseList <SubOverlay> SubOverlays,
     bool IsInUse
     )
     : base(
         ID, Count, OverlayFileRID, NameRID, Flags,
         LightingInfo, FirstAnimationType,
         ColorTranslation, Effect, Animation, SubOverlays)
 {
     this.isInUse = IsInUse;
 }
Exemplo n.º 8
0
 public PlayerOverlay(
     uint ID,
     uint Count,
     uint OverlayFileRID,
     uint NameRID,
     uint Flags,
     LightingInfo LightingInfo,
     AnimationType FirstAnimationType,
     byte ColorTranslation,
     byte Effect,
     Animation Animation,
     BaseList <SubOverlay> SubOverlays,
     PlayerOverlayHotspot RenderPosition)
     : base(
         ID, Count, OverlayFileRID, NameRID, Flags,
         LightingInfo, FirstAnimationType,
         ColorTranslation, Effect,
         Animation, SubOverlays, false)
 {
     renderPosition = RenderPosition;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Constructor by values
 /// </summary>
 /// <param name="ID"></param>
 /// <param name="Count"></param>
 /// <param name="OverlayFileRID"></param>
 /// <param name="NameRID"></param>
 /// <param name="Flags"></param>
 /// <param name="LightingInfo"></param>
 /// <param name="FirstAnimationType"></param>
 /// <param name="ColorTranslation"></param>
 /// <param name="Effect"></param>
 /// <param name="Animation"></param>
 /// <param name="SubOverlays"></param>
 /// <param name="TargetsCount"></param>
 /// <param name="SchoolType"></param>
 public SpellObject(
     uint ID,
     uint Count,
     uint OverlayFileRID,
     uint NameRID,
     uint Flags,
     LightingInfo LightingInfo,
     AnimationType FirstAnimationType,
     byte ColorTranslation,
     byte Effect,
     Animation Animation,
     IEnumerable <SubOverlay> SubOverlays,
     byte TargetsCount,
     SchoolType SchoolType)
     : base(
         ID, Count, OverlayFileRID, NameRID, Flags,
         LightingInfo, FirstAnimationType,
         ColorTranslation, Effect, Animation, SubOverlays)
 {
     this.targetsCount = TargetsCount;
     this.schoolType   = SchoolType;
 }
Exemplo n.º 10
0
        public ObjectUpdate(
            uint ID,
            uint Count                                 = 0,
            uint OverlayFileRID                        = 0,
            uint NameRID                               = 0,
            uint Flags                                 = 0,
            LightingInfo LightingInfo                  = null,
            AnimationType FirstAnimationType           = 0,
            byte ColorTranslation                      = 0,
            byte Effect                                = 0,
            Animation Animation                        = null,
            IEnumerable <SubOverlay> SubOverlays       = null,
            AnimationType MotionFirstAnimationType     = 0,
            byte MotionColorTranslation                = 0,
            byte MotionEffect                          = 0,
            Animation MotionAnimation                  = null,
            IEnumerable <SubOverlay> MotionSubOverlays = null)
            : base(ID, Count)
        {
            this.overlayFileRID     = OverlayFileRID;
            this.nameRID            = NameRID;
            this.flags.Value        = Flags;
            this.lightingInfo       = LightingInfo;
            this.firstAnimationType = FirstAnimationType;
            this.colorTranslation   = ColorTranslation;

            // special handling for secondtrans
            if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans)
            {
                colorTranslation = ColorTransformation.FILTERWHITE90;

                foreach (SubOverlay subOv in SubOverlays)
                {
                    subOv.ColorTranslation = ColorTransformation.FILTERWHITE90;
                }
            }

            this.effect    = Effect;
            this.animation = Animation;

            if (SubOverlays != null)
            {
                this.subOverlays.AddRange(SubOverlays);
            }

            this.motionFirstAnimationType = MotionFirstAnimationType;
            this.motionColorTranslation   = MotionColorTranslation;

            // special handling for secondtrans
            if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans)
            {
                motionColorTranslation = ColorTransformation.FILTERWHITE90;

                foreach (SubOverlay subOv in MotionSubOverlays)
                {
                    subOv.ColorTranslation = ColorTransformation.FILTERWHITE90;
                }
            }

            this.motionEffect    = MotionEffect;
            this.motionAnimation = MotionAnimation;

            if (MotionSubOverlays != null)
            {
                this.motionSubOverlays.AddRange(MotionSubOverlays);
            }
        }