internal void StopEffect(int EffectId) { AvatarEffect avatarEffect = ( from X in this.Effects where X.EffectId == EffectId select X).Last <AvatarEffect>(); if (avatarEffect == null || !avatarEffect.HasExpired) { return; } using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.runFastQuery(string.Concat(new object[] { "DELETE FROM user_effects WHERE user_id = ", this.UserId, " AND effect_id = ", EffectId, " AND is_activated = 1" })); } this.Effects.Remove(avatarEffect); this.GetClient().GetMessageHandler().GetResponse().Init(Outgoing.StopAvatarEffectMessageComposer); this.GetClient().GetMessageHandler().GetResponse().AppendInt32(EffectId); this.GetClient().GetMessageHandler().SendResponse(); if (this.CurrentEffect >= 0) { this.ActivateCustomEffect(-1); } }
internal void ActivateEffect(int EffectId) { if (!this.Session.GetHabbo().InRoom) { return; } else { if (!this.HasEffect(EffectId)) { return; } } if (EffectId < 1) { this.ActivateCustomEffect(EffectId); return; } AvatarEffect avatarEffect = ( from X in this.Effects where X.EffectId == EffectId select X).Last <AvatarEffect>(); avatarEffect.Activate(); using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.runFastQuery(string.Concat(new object[] { "UPDATE user_effects SET is_activated = '1', activated_stamp = ", CyberEnvironment.GetUnixTimestamp(), " WHERE user_id = ", this.UserId, " AND effect_id = ", EffectId })); } this.EnableInRoom(EffectId); }