/// <summary> /// Activates the effect. /// </summary> /// <param name="effectId">The effect identifier.</param> internal void ActivateEffect(int effectId) { if (!_session.GetHabbo().InRoom) { return; } if (!HasEffect(effectId)) { return; } if (effectId < 1) { ActivateCustomEffect(effectId); } if (effectId < 1) { return; } AvatarEffect avatarEffect = _effects.Last(x => x.EffectId == effectId); avatarEffect.Activate(); using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor()) queryReactor.RunFastQuery( string.Concat("UPDATE users_effects SET is_activated = '1', activated_stamp = ", Yupi.GetUnixTimeStamp(), " WHERE user_id = ", _userId, " AND effect_id = ", effectId)); EnableInRoom(effectId); }
private static void ActivateEffect(Session Session, ClientMessage Message) { AvatarEffect Effect = Session.AvatarEffectCache.GetEffect(Message.PopWiredInt32(), false, true); // If we do not have an effect that needs activating OR if we already have an effect // of this sort which IS activated, stop. if (Effect == null || Session.AvatarEffectCache.HasEffect(Effect.SpriteId, true)) { return; } Effect.Activate(); Session.SendData(UserEffectActivatedComposer.Compose(Effect)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int EffectId = Packet.PopInt(); AvatarEffect Effect = Session.GetHabbo().Effects().GetEffectNullable(EffectId, false, true); if (Effect == null || Session.GetHabbo().Effects().HasEffect(EffectId, true)) { return; } if (Effect.Activate()) { Session.SendMessage(new AvatarEffectActivatedComposer(Effect)); } }
public void Parse(GameClient session, ClientPacket packet) { int effectId = packet.PopInt(); AvatarEffect effect = session.GetHabbo().Effects().GetEffectNullable(effectId, false, true); if (effect == null || session.GetHabbo().Effects().HasEffect(effectId, true)) { return; } if (effect.Activate()) { session.SendPacket(new AvatarEffectActivatedComposer(effect)); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int EffectId = Packet.PopInt(); AvatarEffect Effect = Session.GetHabbo().Effects().GetEffectNullable(EffectId, false, true); if (Effect == null || Session.GetHabbo().Effects().HasEffect(EffectId, true)) { return; } if (Effect.Activate()) { Session.SendMessage(new AvatarEffectActivatedComposer(Effect)); QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_ExploreEffects", 1); } }
public void ActivateEffect(UserEntity user, int effectId) { if (user.Room == null || !user.UserInfo.EffectComponent.HasEffect(effectId) || effectId < 1) { return; } AvatarEffect avatarEffect = user.UserInfo.EffectComponent.Effects.Last(x => x.EffectId == effectId); avatarEffect.Activate(); user.UserInfo.EffectComponent.ActiveEffect = avatarEffect; UserRepository.Save(user.UserInfo); user.Room.EachUser( (session) => { session.Router.GetComposer <ApplyEffectMessageComposer>() .Compose(session, user, avatarEffect); } ); }