﻿using System.Collections.Generic;
using galaxy.core.habbolib.users.effects;

namespace galaxy.core.communication.packets.outgoing.inventory.avatareffects
{
    class AvatarEffectsComposer : ServerPacket
    {
        public AvatarEffectsComposer(ICollection<AvatarEffect> Effects)
            : base(ServerPacketHeader.AvatarEffectsMessageComposer)
        {
            base.WriteInteger(Effects.Count);

            foreach (AvatarEffect Effect in Effects)
            {
                base.WriteInteger(Effect.spriteId);//Effect Id
                base.WriteInteger(0);//Type, 0 = Hand, 1 = Full
                base.WriteInteger((int)Effect.Duration);
                base.WriteInteger(Effect.Activated ? Effect.Quantity - 1 : Effect.Quantity);
                base.WriteInteger(Effect.Activated ? (int)Effect.TimeLeft : -1);
                base.WriteBoolean(false);//Permanent
            }
        }
    }
}
