Exemplo n.º 1
0
 public GraphicEffectHuedPacket(int id, PacketReader reader)
     : base(id, reader)
 {
     Hue       = reader.ReadInt32();
     BlendMode = (GraphicEffectBlendMode)reader.ReadInt32();
 }
Exemplo n.º 2
0
        public void Add
        (
            GraphicEffectType type,
            uint source, uint target,
            ushort graphic,
            ushort hue,
            ushort srcX, ushort srcY, sbyte srcZ,
            ushort targetX, ushort targetY, sbyte targetZ,
            byte speed, int duration, bool fixedDir, bool doesExplode, bool hasparticles, GraphicEffectBlendMode blendmode
        )
        {
            if (hasparticles)
            {
                Log.Warn("Unhandled particles in an effects packet.");
            }

            GameEffect effect = null;

            if (hue != 0)
            {
                hue++;
            }

            duration *= Constants.ITEM_EFFECT_ANIMATION_DELAY;

            switch (type)
            {
            case GraphicEffectType.Moving:
                if (graphic <= 0)
                {
                    return;
                }

                if (speed == 0)
                {
                    speed++;
                }

                effect = new MovingEffect(source, target, srcX, srcY, srcZ, targetX, targetY, targetZ, graphic, hue, fixedDir, speed)
                {
                    Blend = blendmode
                };

                if (doesExplode)
                {
                    effect.AddChildEffect(new AnimatedItemEffect(target, targetX, targetY, targetZ, 0x36Cb, hue, 9, speed));
                }

                break;

            case GraphicEffectType.Lightning:
                effect = new LightningEffect(source, srcX, srcY, srcZ, hue);

                break;

            case GraphicEffectType.FixedXYZ:

                if (graphic <= 0)
                {
                    return;
                }

                effect = new AnimatedItemEffect(srcX, srcY, srcZ, graphic, hue, duration, speed)
                {
                    Blend = blendmode
                };

                break;

            case GraphicEffectType.FixedFrom:

                if (graphic <= 0)
                {
                    return;
                }

                effect = new AnimatedItemEffect(source, srcX, srcY, srcZ, graphic, hue, duration, speed)
                {
                    Blend = blendmode
                };

                break;

            case GraphicEffectType.ScreenFade:
                Log.Warn("Unhandled 'Screen Fade' effect.");

                break;

            default:
                Log.Warn("Unhandled effect.");

                return;
            }


            Add(effect);
        }
Exemplo n.º 3
0
        public void Add(GraphicEffectType type, Serial source, Serial target, Graphic graphic, Hue hue, Position srcPos, Position targPos, byte speed, int duration, bool fixedDir, bool doesExplode, bool hasparticles, GraphicEffectBlendMode blendmode)
        {
            if (hasparticles)
            {
                Log.Message(LogTypes.Warning, "Unhandled particles in an effects packet.");
            }
            GameEffect effect = null;

            switch (type)
            {
            case GraphicEffectType.Moving:

                if (graphic <= 0)
                {
                    return;
                }

                if (speed == 0)
                {
                    speed++;
                }

                effect = new MovingEffect(source, target, srcPos.X, srcPos.Y, srcPos.Z, targPos.X, targPos.Y, targPos.Z, graphic, hue)
                {
                    Blend = blendmode, MovingDelay = speed
                };

                if (doesExplode)
                {
                    effect.AddChildEffect(new AnimatedItemEffect(target, targPos.X, targPos.Y, targPos.Z, 0x36Cb, hue, 9));
                }

                break;

            case GraphicEffectType.Lightning:
                effect = new LightningEffect(source, srcPos.X, srcPos.Y, srcPos.Z, hue);

                break;

            case GraphicEffectType.FixedXYZ:

                if (graphic <= 0)
                {
                    return;
                }

                effect = new AnimatedItemEffect(srcPos.X, srcPos.Y, srcPos.Z, graphic, hue, duration)
                {
                    Blend = blendmode
                };

                break;

            case GraphicEffectType.FixedFrom:

                if (graphic <= 0)
                {
                    return;
                }

                effect = new AnimatedItemEffect(source, srcPos.X, srcPos.Y, srcPos.Z, graphic, hue, duration)
                {
                    Blend = blendmode
                };
                break;

            case GraphicEffectType.ScreenFade:
                Log.Message(LogTypes.Warning, "Unhandled 'Screen Fade' effect.");

                break;

            default:
                Log.Message(LogTypes.Warning, "Unhandled effect.");

                return;
            }


            Add(effect);
        }
Exemplo n.º 4
0
 public GraphicEffectHuedPacket(int id, PacketReader reader)
     : base(id, reader)
 {
     Hue = reader.ReadInt32();
     BlendMode = (GraphicEffectBlendMode)reader.ReadInt32();
 }
Exemplo n.º 5
0
        public void CreateEffect
        (
            GraphicEffectType type,
            uint source,
            uint target,
            ushort graphic,
            ushort hue,
            ushort srcX,
            ushort srcY,
            sbyte srcZ,
            ushort targetX,
            ushort targetY,
            sbyte targetZ,
            byte speed,
            int duration,
            bool fixedDir,
            bool doesExplode,
            bool hasparticles,
            GraphicEffectBlendMode blendmode
        )
        {
            if (hasparticles)
            {
                Log.Warn("Unhandled particles in an effects packet.");
            }

            GameEffect effect;

            if (hue != 0)
            {
                hue++;
            }

            duration *= Constants.ITEM_EFFECT_ANIMATION_DELAY;

            switch (type)
            {
            case GraphicEffectType.Moving:
                if (graphic <= 0)
                {
                    return;
                }

                // TODO: speed == 0 means run at standard frameInterval got from anim.mul?
                if (speed == 0)
                {
                    speed++;
                }

                effect = new MovingEffect
                         (
                    this,
                    source,
                    target,
                    srcX,
                    srcY,
                    srcZ,
                    targetX,
                    targetY,
                    targetZ,
                    graphic,
                    hue,
                    fixedDir,
                    duration,
                    speed
                         )
                {
                    Blend = blendmode,
                    CanCreateExplosionEffect = doesExplode
                };

                break;

            case GraphicEffectType.DragEffect:

                if (graphic <= 0)
                {
                    return;
                }

                if (speed == 0)
                {
                    speed++;
                }

                effect = new DragEffect
                         (
                    this,
                    source,
                    target,
                    srcX,
                    srcY,
                    srcZ,
                    targetX,
                    targetY,
                    targetZ,
                    graphic,
                    hue,
                    duration,
                    speed
                         )
                {
                    Blend = blendmode,
                    CanCreateExplosionEffect = doesExplode
                };

                break;

            case GraphicEffectType.Lightning:
                effect = new LightningEffect
                         (
                    this,
                    source,
                    srcX,
                    srcY,
                    srcZ,
                    hue
                         );

                break;

            case GraphicEffectType.FixedXYZ:

                if (graphic <= 0)
                {
                    return;
                }

                effect = new FixedEffect
                         (
                    this,
                    srcX,
                    srcY,
                    srcZ,
                    graphic,
                    hue,
                    duration,
                    0     //speed [use 50ms]
                         )
                {
                    Blend = blendmode
                };

                break;

            case GraphicEffectType.FixedFrom:

                if (graphic <= 0)
                {
                    return;
                }

                effect = new FixedEffect
                         (
                    this,
                    source,
                    srcX,
                    srcY,
                    srcZ,
                    graphic,
                    hue,
                    duration,
                    0     //speed [use 50ms]
                         )
                {
                    Blend = blendmode
                };

                break;

            case GraphicEffectType.ScreenFade:
                Log.Warn("Unhandled 'Screen Fade' effect.");

                return;

            default:
                Log.Warn("Unhandled effect.");

                return;
            }


            PushToBack(effect);
        }
Exemplo n.º 6
0
 public void Load_FromPacket(GraphicEffectHuedPacket packet)
 {
     this.Load_FromPacket((GraphicEffectPacket)packet);
     m_isHued = true;
     m_hue = packet.Hue;
     m_bendMode = packet.BlendMode;
 }