Exemplo n.º 1
0
        public void Add(GraphicEffectPacket packet)
        {
            bool hasHueData = (packet as GraphicEffectHuedPacket != null);
            bool hasParticles = (packet as GraphicEffectExtendedPacket != null); // we don't yet handle these.
            if (hasParticles)
            {
                Tracer.Warn("Unhandled particles in an effects packet.");
            }

            AEffect effect = null;
            int hue = hasHueData ? ((GraphicEffectHuedPacket)packet).Hue : 0;
            int blend = hasHueData ? (int)((GraphicEffectHuedPacket)packet).BlendMode : 0;

            switch (packet.EffectType)
            {
                case GraphicEffectType.Moving:
                    if (packet.ItemID <= 0)
                        return;
                    effect = new MovingEffect(m_Model.Map, packet.SourceSerial, packet.TargetSerial,
                        packet.SourceX, packet.SourceY, packet.SourceZ,
                        packet.TargetX, packet.TargetY, packet.TargetZ, 
                        packet.ItemID, hue);
                    effect.BlendMode = blend;
                    if (packet.DoesExplode)
                    {
                        effect.Children.Add(new AnimatedItemEffect(m_Model.Map, packet.TargetSerial, 
                            packet.TargetX, packet.TargetY, packet.TargetZ,
                            0x36cb, hue, 9));
                    }
                    break;
                case GraphicEffectType.Lightning:
                    effect = new LightningEffect(m_Model.Map, packet.SourceSerial, 
                        packet.SourceX, packet.SourceY, packet.SourceZ, hue);
                    break;
                case GraphicEffectType.FixedXYZ:
                    if (packet.ItemID <= 0)
                        return;
                    effect = new AnimatedItemEffect(m_Model.Map, 
                        packet.SourceX, packet.SourceY, packet.SourceZ,
                        packet.ItemID, hue, packet.Duration);
                    effect.BlendMode = blend;
                    break;
                case GraphicEffectType.FixedFrom:
                    if (packet.ItemID <= 0)
                        return;
                    effect = new AnimatedItemEffect(m_Model.Map, packet.SourceSerial, 
                        packet.SourceX, packet.SourceY, packet.SourceZ,
                        packet.ItemID, hue, packet.Duration);
                    effect.BlendMode = blend;
                    break;
                case GraphicEffectType.ScreenFade:
                    Tracer.Warn("Unhandled screen fade effect.");
                    break;
                default:
                    Tracer.Warn("Unhandled effect.");
                    return;
            }

            if (effect != null)
                Add(effect);
        }
Exemplo n.º 2
0
        public LightningEffectView(LightningEffect effect)
            : base(effect)
        {

        }