예제 #1
0
        internal void StopEffect(int EffectId)
        {
            // REMOVE EFFECT!!!
            AvatarEffect Effect = GetEffect(EffectId, true);

            if (Effect == null || !Effect.HasExpired)
            {
                return;
            }

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("DELETE FROM user_effects WHERE user_id = " + UserId + " AND effect_id = " + EffectId + " AND is_activated = '1'");
            }

            lock (_removeQueue.SyncRoot)
            {
                _removeQueue.Enqueue(Effect);
            }
            //Effects.Remove(Effect);
            //EffectCount--;

            GetClient().GetMessageHandler().GetResponse().Init(Outgoing.StopEffect);
            GetClient().GetMessageHandler().GetResponse().AppendInt32(EffectId);
            GetClient().GetMessageHandler().SendResponse();

            if (CurrentEffect >= 0)
            {
                ApplyEffect(-1);
            }
        }
예제 #2
0
 internal void HandleQueue()
 {
     lock (_removeQueue.SyncRoot)
     {
         while (_removeQueue.Count > 0)
         {
             AvatarEffect effect = (AvatarEffect)_removeQueue.Dequeue();
             Effects.Remove(effect);
             EffectCount--;
         }
     }
 }
예제 #3
0
        internal void EnableEffect(int EffectId)
        {
            AvatarEffect Effect = GetEffect(EffectId, false);

            if (Effect == null || Effect.HasExpired || Effect.Activated)
            {
                return;
            }

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("UPDATE user_effects SET is_activated = '1', activated_stamp = " + FirewindEnvironment.GetUnixTimestamp() + " WHERE user_id = " + UserId + " AND effect_id = " + EffectId + "");
            }

            Effect.Activate();

            GetClient().GetMessageHandler().GetResponse().Init(Outgoing.EnableEffect);
            GetClient().GetMessageHandler().GetResponse().AppendInt32(Effect.EffectId);
            GetClient().GetMessageHandler().GetResponse().AppendInt32(Effect.TotalDuration);
            GetClient().GetMessageHandler().SendResponse();
        }