public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_mute")) { return; } int UserId = Packet.PopInt(); string Message = Packet.PopString(); double Length = (Packet.PopInt() * 60); string Unknown1 = Packet.PopString(); string Unknown2 = Packet.PopString(); Habbo Habbo = BiosEmuThiago.GetHabboById(UserId); if (Habbo == null) { Session.SendWhisper("Ocorreu um erro em encontrar esse usuário no banco de dados."); return; } if (Habbo.GetPermissions().HasRight("mod_mute") && !Session.GetHabbo().GetPermissions().HasRight("mod_mute_any")) { Session.SendWhisper("Ops, você não pode silenciar esse usuário."); return; } using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.runFastQuery("UPDATE `users` SET `time_muted` = '" + Length + "' WHERE `id` = '" + Habbo.Id + "' LIMIT 1"); } if (Habbo.GetClient() != null) { Habbo.TimeMuted = Length; Habbo.GetClient().SendNotification("Você foi silenciando por " + Length + " segundos!"); } }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Owner = NeonEnvironment.GetHabboById(Item.UserID); if (Owner == null || !Owner.GetPermissions().HasRight("room_item_wired_rewards")) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (User == null) { return(false); } if (string.IsNullOrEmpty(StringData)) { return(false); } Player.Duckets += int.Parse(StringData); Player.GetClient().SendMessage(RoomNotificationComposer.SendBubble("eventoxx", "Felicidades, " + Player.Username + ", acabas de recibir " + StringData + " duckets por un Wired de recompensa.", "catalog/open")); Player.GetClient().SendMessage(new HabboActivityPointNotificationComposer(Player.Duckets, int.Parse(StringData))); return(true); }
public bool Execute(params object[] Params) { if (Params.Length != 1) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null) { return(false); } if (this.TickCount <= 0) { this.TickCount = 3; } if (!this._toKick.Contains(Player)) { RoomUser User = Instance.GetRoomUserManager().GetRoomUserByHabbo(Player.Id); if (User == null) { return(false); } if (Player.GetPermissions().HasRight("mod_tool") || this.Instance.OwnerId == Player.Id) { Player.GetClient().SendPacket(new WhisperComposer(User.VirtualId, "Wired Kick Exception: Unkickable Player", 0, 0)); return(false); } this._toKick.Enqueue(Player); Player.GetClient().SendPacket(new WhisperComposer(User.VirtualId, this.StringData, 0, 0)); } return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Owner = RocketEmulador.GetHabboById(this.Item.UserID); Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null) { return(false); } if (Owner == null || !Owner.GetPermissions().HasRight("room_item_wired_rewards")) { Player.GetClient().SendMessage(new RoomNotificationComposer("supernoti", "message", "Você não tem permissão para utilizar este wired...")); return(false); } if (Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username) == null) { return(false); } if (string.IsNullOrEmpty(this.StringData)) { return(false); } if (Convert.ToInt32(this.StringData) > 6) { Player.GetClient().SendWhisper("La cantidad de Duckets pasa de los limites.", 0); return(false); } string Ducket = this.StringData; Player.Duckets = (Player.Duckets += Convert.ToInt32(Ducket)); Player.GetClient().SendMessage(new HabboActivityPointNotificationComposer(Player.Duckets, Convert.ToInt32(Ducket), 0)); Player.GetClient().SendMessage(new RoomNotificationComposer("command_notification_credits", "message", "Has recibido " + Ducket + " ducket(s)!")); return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (User == null) { return(false); } User.FastWalking = !User.FastWalking; if (User.SuperFastWalking) { User.SuperFastWalking = false; } if (!User.FastWalking) { Player.GetClient().SendMessage(RoomNotificationComposer.SendBubble("wffwalk", "" + User.GetClient().GetHabbo().Username + ", acabas de desactivar la hiperactividad mediante Wired.", "")); } else { Player.GetClient().SendMessage(RoomNotificationComposer.SendBubble("wffwalk", "" + User.GetClient().GetHabbo().Username + ", acabas de activar la hiperactividad mediante Wired, ve con cuidado, ahora vas más rápido que la luz.", "")); } return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Owner = RocketEmulador.GetHabboById(this.Item.UserID); Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null) { return(false); } if (Owner == null || !Owner.GetPermissions().HasRight("room_item_wired_rewards")) { Player.GetClient().SendMessage(new RoomNotificationComposer("supernoti", "message", "Você não tem permissão para utilizar este wired...")); return(false); } if (Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username) == null) { return(false); } if (string.IsNullOrEmpty(this.StringData)) { return(false); } if (Convert.ToInt32(this.StringData) > 6) { Player.GetClient().SendWhisper("A quantidade de moedas passa dos limites", 0); return(false); } string Credit = this.StringData; Player.Credits = (Player.Credits += Convert.ToInt32(Credit)); Player.GetClient().SendMessage(new CreditBalanceComposer(Player.Credits)); return(true); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_mute")) { return; } int UserId = Packet.PopInt(); string Message = Packet.PopString(); double Length = (Packet.PopInt() * 60); //string Unknown1 = Packet.PopString(); //string Unknown2 = Packet.PopString(); Habbo Habbo = null; Habbo = RocketEmulador.GetHabboById(UserId); if (Habbo == null) { Session.SendNotification("An error occoured whilst finding that user in the database."); return; } if (Habbo.GetPermissions().HasRight("mod_mute") && !Session.GetHabbo().GetPermissions().HasRight("mod_mute_any")) { Session.SendNotification("Oops, you cannot mute that user."); return; } using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `users` SET `time_muted` = '" + Length + "' WHERE `id` = '" + Habbo.Id + "' LIMIT 1"); } if (Habbo.GetClient() != null) { Length = 3600; Habbo.TimeMuted = Length; Habbo.GetClient().SendNotification("Você foi mutado por um moderador: " + Message + " e durará " + Length + " segundos."); } }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (User == null) { return(false); } User.Frozen = !User.Frozen; User.freezeUserTicks = 1; Player.GetClient().GetHabbo().Effects().ApplyEffect(12); return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null || string.IsNullOrWhiteSpace(this.StringData)) { return(false); } RoomUser ThisUser = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Id); if (ThisUser == null) { return(false); } string Dance = this.StringData; Player.GetClient().SendMessage(new DanceComposer(ThisUser, Convert.ToInt32(Dance))); return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null || string.IsNullOrWhiteSpace(StringData)) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (User == null) { return(false); } string[] Message = StringData.Split('_'); if (Message[0] == "1") { Player.GetClient().SendMessage(new RoomNotificationComposer(Message[1], Message[2], "gifts_event", Message[3], "event:" + Message[4])); } if (Message[0] == "2") { Player.GetClient().SendMessage(new RoomCustomizedAlertComposer(Message[1])); } if (Message[0] == "3") { Player.GetClient().SendMessage(new MassEventComposer(Message[1])); } if (Message[0] == "4") { Player.GetClient().SendMessage(RoomNotificationComposer.SendBubble(Message[1], Message[2], Message[3])); } if (Message[0] == "5") { Player.GetClient().SendMessage(new WiredSmartAlertComposer(Message[1])); } //if (Message[0] == "6") //{ // string eventillo = "<img src=\"icon_256.png\" alt=\"xD\" height=\"15\" width=\"15\"></img>"; // Player.GetClient().SendMessage(new UserNameChangeComposer(Instance.Id, User.VirtualId, eventillo)); // Player.GetClient().SendChat("Hay un nuevo evento, haz <a href='event:navigator/goto/3'><b>click aquí</b></a> para ir al evento. ", 33); //} return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } if (String.IsNullOrEmpty(this.StringData)) { return(false); } this.StringData.Split(' '); Console.WriteLine(this.BoolData); string BotName = this.StringData.Split(' ')[0]; string Chat = this.StringData.Split(' ')[1]; RoomUser User = this.Instance.GetRoomUserManager().GetBotByName(BotName); if (User == null) { return(false); } Habbo Player = (Habbo)Params[0]; if (this.BoolData) { Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Chat, 0, 31)); } else { Player.GetClient().SendMessage(new ChatComposer(User.VirtualId, Chat, 0, 31)); } return(true); }
internal static void MuteUser(GameClient ModSession, Habbo Client, int Length, String Message) { if (OtanixEnvironment.GetGame().GetMuteManager().UserIsMuted(Client.Id)) { if (ModSession != null) { ModSession.SendNotif("El usuario ya está muteado."); } return; } OtanixEnvironment.GetGame().GetMuteManager().AddUserMute(Client.Id, Length); if (Client.GetClient() != null) { DateTime newDateTime = OtanixEnvironment.UnixTimeStampToDateTime(OtanixEnvironment.GetGame().GetMuteManager().UsersMuted[Client.Id].ExpireTime); ServerMessage nMessage = new ServerMessage(Outgoing.SendLinkNotif); nMessage.AppendString("Tu keko no podrá hablar hasta " + newDateTime.ToString() + " Eh, levanta el pie. Tú también puedes hacer que tod@s pasen un rato agradable en " + EmuSettings.HOTEL_LINK + ". ¡Respeto sí! ¡Bullyng no! Vale, vale, ¡tiempo muerto! No vendría mal releer la Manera " + EmuSettings.HOTEL_LINK + " y los Términos de Servicio."); nMessage.AppendString("http://www." + EmuSettings.HOTEL_LINK + "/legal/terms-of-service"); Client.GetClient().SendMessage(nMessage); } }
public void HandleSave(ClientPacket Packet) { int Unknown = Packet.PopInt(); string Message = Packet.PopString(); this.StringData = Message; Habbo Owner = RavenEnvironment.GetHabboById(Item.UserID); if (Owner == null || Owner.Rank < 6) { this.StringData = ""; Owner.GetClient().SendWhisper("No sé quién te ha dado esto pero no deberías estar jugando con juguetes de mayores.", 34); RavenEnvironment.GetGame().GetClientManager().StaffAlert1(new RoomInviteComposer(int.MinValue, Owner.Username + " está utilizando sin permiso un Wired de Puntos de Recompensa.")); } }
public Badge GiveBadge(string Badge, Boolean InDatabase, int Slot = 0) { var Session = _player.GetClient(); if (HasBadge(Badge)) { return(null); } BadgeDefinition BadgeDefinition = null; QuasarEnvironment.GetGame().GetBadgeManager().TryGetBadge(Badge.ToUpper(), out BadgeDefinition); if (BadgeDefinition != null && (BadgeDefinition.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(BadgeDefinition.RequiredRight))) { return(null); } if (InDatabase) { using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("INSERT INTO user_badges (user_id, badge_id, badge_slot) VALUES (" + _player.Id + ", @badge, " + Slot + ")"); dbClient.AddParameter("badge", Badge); dbClient.RunQuery(); } } var badge = new Badge(Badge, Slot); _badges.Add(Badge, badge); if (Session != null) { Session.SendMessage(new BadgesComposer(Session)); Session.SendMessage(new FurniListNotificationComposer(1, 4)); } if (Session.GetHabbo().CurrentRoom != null) { Session.GetHabbo().CurrentRoom.SendMessage(new HabboUserBadgesComposer(Session.GetHabbo())); } return(badge); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (User == null) { return(false); } if (String.IsNullOrEmpty(StringData)) { return(false); } var mode = int.Parse(StringData); if (mode == 1) { User.Frozen = true; } User.GetClient().SendMessage(RoomNotificationComposer.SendBubble("bubble_wired_freeze", "" + User.GetClient().GetHabbo().Username + ", is bevroren door een Wired-effect.", "")); if (mode == 2) { User.GetClient().SendMessage(RoomNotificationComposer.SendBubble("bubble_wired_freeze", "" + User.GetClient().GetHabbo().Username + ", kan weer lopen.", "")); } User.Frozen = false; User.Frozen = false; return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (User == null) { return(false); } if (String.IsNullOrEmpty(StringData)) { return(false); } var effect = int.Parse(StringData); if (effect == 102 | effect == 178 | effect == 187 | effect == 593 | effect == 596 | effect == 592 | effect == 597 | effect == 594) { return(false); } User.GetClient().GetHabbo().Effects().ApplyEffect(effect); User.GetClient().SendMessage(RoomNotificationComposer.SendBubble("bubble_wired_effect", "" + User.GetClient().GetHabbo().Username + ", voert nu een enable uit door een Wired-effect.", "")); Item.UpdateState(false, true); Item.RequestUpdate(4, true); return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null) { return(false); } if (String.IsNullOrEmpty(StringData)) { return(false); } this._queue.Enqueue(Player); return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (User == null) { return(false); } if (String.IsNullOrEmpty(StringData)) { return(false); } RoomUser ThisUser = User.GetClient().GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(User.GetClient().GetHabbo().Id); var dance = int.Parse(StringData); User.GetClient().GetHabbo().CurrentRoom.SendMessage(new DanceComposer(ThisUser, dance)); User.GetClient().SendMessage(RoomNotificationComposer.SendBubble("bubble_wired_dans", "" + User.GetClient().GetHabbo().Username + ", is nu aan het dansen (" + StringData + ") door een Wired-effect.", "")); Item.UpdateState(false, true); Item.RequestUpdate(2, true); return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (User == null) { return(false); } if (String.IsNullOrEmpty(StringData)) { return(false); } var handitem = int.Parse(StringData); User.CarryItem(handitem); User.GetClient().SendMessage(RoomNotificationComposer.SendBubble("wfhanditem", "" + User.GetClient().GetHabbo().Username + ", acabas de recibir una bebida u otro objeto similar por un efecto de Wired.", "")); Item.UpdateState(false, true); Item.RequestUpdate(2, true); return(true); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (User == null) { return(false); } if (String.IsNullOrEmpty(StringData)) { return(false); } User.FastWalking = !User.FastWalking; if (User.SuperFastWalking) { User.SuperFastWalking = false; } User.GetClient().SendMessage(RoomNotificationComposer.SendBubble("bubble_wired_fastwalk", "" + User.GetClient().GetHabbo().Username + ", zijn of haar wandel-modes is aangepast door een Wired-effect.", "")); return(true); }
public bool Execute(params object[] Params) { Habbo Player = (Habbo)Params[0]; if (Player == null || Player.CurrentRoom == null || !Player.InRoom) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Id); if (User == null) { return(false); } if ((BoolData && Instance.OwnerId != Player.Id) || string.IsNullOrWhiteSpace(this.StringData)) { return(false); } IChatCommand ChatCommand = null; if (!PlusEnvironment.GetGame().GetChatManager().GetCommands().TryGetCommand(this.StringData.Replace(":", "").ToLower(), out ChatCommand)) { return(false); } if (Player.IChatCommand == ChatCommand) { Player.WiredInteraction = true; ICollection <IWiredItem> Effects = Instance.GetWired().GetEffects(this); ICollection <IWiredItem> Conditions = Instance.GetWired().GetConditions(this); foreach (IWiredItem Condition in Conditions.ToList()) { if (!Condition.Execute(Player)) { return(false); } Instance.GetWired().OnEvent(Condition.Item); } Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, this.StringData, 0, 0)); //Check the ICollection to find the random addon effect. bool HasRandomEffectAddon = Effects.Where(x => x.Type == WiredBoxType.AddonRandomEffect).ToList().Count() > 0; if (HasRandomEffectAddon) { //Okay, so we have a random addon effect, now lets get the IWiredItem and attempt to execute it. IWiredItem RandomBox = Effects.FirstOrDefault(x => x.Type == WiredBoxType.AddonRandomEffect); if (!RandomBox.Execute()) { return(false); } //Success! Let's get our selected box and continue. IWiredItem SelectedBox = Instance.GetWired().GetRandomEffect(Effects.ToList()); if (!SelectedBox.Execute()) { return(false); } //Woo! Almost there captain, now lets broadcast the update to the room instance. if (Instance != null) { Instance.GetWired().OnEvent(RandomBox.Item); Instance.GetWired().OnEvent(SelectedBox.Item); } } else { foreach (IWiredItem Effect in Effects.ToList()) { if (!Effect.Execute(Player)) { return(false); } Instance.GetWired().OnEvent(Effect.Item); } } return(true); } return(false); }
public void Run(object state) { try { if (_disabled) { return; } if (_timerRunning) { _timerLagging = true; Log.Warn("<Player " + _player.Id + "> Server can't keep up, Player timer is lagging behind."); return; } _resetEvent.Reset(); if (_player.TimeMuted > 0) { _player.TimeMuted -= 60; } if (_player.MessengerSpamTime > 0) { _player.MessengerSpamTime -= 60; } if (_player.MessengerSpamTime <= 0) { _player.MessengerSpamCount = 0; } _player.TimeAfk += 1; if (_player.GetStats().RespectsTimestamp != DateTime.Today.ToString("MM/dd")) { _player.GetStats().RespectsTimestamp = DateTime.Today.ToString("MM/dd"); using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_stats` SET `dailyRespectPoints` = '" + (_player.Rank == 1 && _player.VipRank == 0 ? 10 : _player.VipRank == 1 ? 15 : 20) + "', `dailyPetRespectPoints` = '" + (_player.Rank == 1 && _player.VipRank == 0 ? 10 : _player.VipRank == 1 ? 15 : 20) + "', `respectsTimestamp` = '" + DateTime.Today.ToString("MM/dd") + "' WHERE `id` = '" + _player.Id + "' LIMIT 1"); } _player.GetStats().DailyRespectPoints = _player.Rank == 1 && _player.VipRank == 0 ? 10 : _player.VipRank == 1 ? 15 : 20; _player.GetStats().DailyPetRespectPoints = _player.Rank == 1 && _player.VipRank == 0 ? 10 : _player.VipRank == 1 ? 15 : 20; if (_player.GetClient() != null) { _player.GetClient().SendPacket(new UserObjectComposer(_player)); } } if (_player.GiftPurchasingWarnings < 15) { _player.GiftPurchasingWarnings = 0; } if (_player.MottoUpdateWarnings < 15) { _player.MottoUpdateWarnings = 0; } if (_player.ClothingUpdateWarnings < 15) { _player.ClothingUpdateWarnings = 0; } if (_player.GetClient() != null) { PlusEnvironment.GetGame().GetAchievementManager() .ProgressAchievement(_player.GetClient(), "ACH_AllTimeHotelPresence", 1); } _player.CheckCreditsTimer(); _player.Effects().CheckEffectExpiry(_player); // END CODE // Reset the values _timerRunning = false; _timerLagging = false; _resetEvent.Set(); } catch { } }
public void HandleExpiration(Habbo Habbo) { this._quantity--; this._activated = false; this._timestampActivated = 0; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { if (this._quantity < 1) { dbClient.SetQuery("DELETE FROM `user_effects` WHERE `id` = @id"); dbClient.AddParameter("id", this.Id); dbClient.RunQuery(); } else { dbClient.SetQuery("UPDATE `user_effects` SET `quantity` = @qt, `is_activated` = '0', `activated_stamp` = 0 WHERE `id` = @id"); dbClient.AddParameter("qt", this.Quantity); dbClient.AddParameter("id", this.Id); dbClient.RunQuery(); } } Habbo.GetClient().SendMessage(new AvatarEffectExpiredComposer(this)); // reset fx if in room? }
/// <summary> /// Blows up the dynamite /// </summary> public override void Execute() { try { GameClient Session = (GameClient)Params[1]; Poll Poll = (Poll)Params[2]; bool RoomOnly = (bool)Params[3]; Room Room = Session.GetHabbo().CurrentRoom; List <RoomUser> Users = Room.GetRoomUserManager().GetRoomUsers(); if (Poll == null || Room == null || Poll.Type != PollType.Matching) { base.EndTimer(); return; } System.Threading.Thread.Sleep(3000); TimeLeft -= 1000; if (TimeLeft > 0) { if (RoomOnly) { lock (Users) { foreach (RoomUser User in Room.GetRoomUserManager().GetRoomUsers()) { Habbo RoomUser = PlusEnvironment.GetHabboById(User.UserId); if (RoomUser == null) { continue; } if (RoomUser.AnsweredMatchingPoll) { RoomUser.GetClient().SendMessage(new MatchingPollResultMessageComposer(Poll)); } } } return; } else { lock (PlusEnvironment.GetGame().GetClientManager().GetClients) { foreach (GameClient client in PlusEnvironment.GetGame().GetClientManager().GetClients) { if (client == null || client.GetHabbo() == null || client.GetRoomUser() == null) { continue; } if (client.GetHabbo().AnsweredMatchingPoll) { client.SendMessage(new MatchingPollResultMessageComposer(Poll)); } } } } return; } if (RoomOnly) { lock (Users) { foreach (RoomUser User in Room.GetRoomUserManager().GetRoomUsers()) { Habbo RoomUser = PlusEnvironment.GetHabboById(User.UserId); if (RoomUser == null) { continue; } RoomUser.AnsweredMatchingPoll = false; } } return; } else { lock (PlusEnvironment.GetGame().GetClientManager().GetClients) { foreach (GameClient client in PlusEnvironment.GetGame().GetClientManager().GetClients) { if (client == null || client.GetHabbo() == null || client.GetRoomUser() == null) { continue; } client.GetHabbo().AnsweredMatchingPoll = false; } } } base.EndTimer(); return; } catch (Exception e) { Logging.LogRPTimersError("Error in Execute() void: " + e); base.EndTimer(); } }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null || string.IsNullOrWhiteSpace(StringData)) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (User == null) { return(false); } string Message = StringData; if (StringData.Contains("%USERNAME%")) { Message = Message.Replace("%USERNAME%", Player.Username); } if (StringData.Contains("%ROOMNAME%")) { Message = Message.Replace("%ROOMNAME%", Player.CurrentRoom.Name); } if (StringData.Contains("%USERCOUNT%")) { Message = Message.Replace("%USERCOUNT%", Player.CurrentRoom.UserCount.ToString()); } if (StringData.Contains("%USERSONLINE%")) { Message = Message.Replace("%USERSONLINE%", BiosEmuThiago.GetGame().GetClientManager().Count.ToString()); } if (StringData.Contains("%USERID%")) { Message = Message.Replace("%USERID%", Convert.ToString(Player.Id)); } if (StringData.Contains("%HONOR%")) { Message = Message.Replace("%HONOR%", Convert.ToString(Player.GOTWPoints)); } if (StringData.Contains("%DUCKETS%")) { Message = Message.Replace("%DUCKETS%", Convert.ToString(Player.Duckets)); } if (StringData.Contains("%DIAMONDS%")) { Message = Message.Replace("%DIAMONDS%", Convert.ToString(Player.Diamonds)); } if (StringData.Contains("%RANGO%")) // Put names not number { Message = Message.Replace("%RANGO%", Convert.ToString(Player.Rank)); } if (StringData.Contains("%LIKESROOM%")) { Message = Message.Replace("%LIKESROOM%", Player.CurrentRoom.Score.ToString()); } Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Message, 0, 34)); return(true); }
public bool TryAuthenticate(string AuthTicket) { try { UserData userData = UserDataFactory.GetUserData(AuthTicket, out byte errorCode); if (errorCode == 1 || errorCode == 2) { Disconnect(); return(false); } #region Ban Checking //Let's have a quick search for a ban before we successfully authenticate.. ModerationBan BanRecord; if (!string.IsNullOrEmpty(MachineId)) { if (NeonEnvironment.GetGame().GetModerationManager().IsBanned(MachineId, out BanRecord)) { if (NeonEnvironment.GetGame().GetModerationManager().MachineBanCheck(MachineId)) { Disconnect(); return(false); } } } if (NeonEnvironment.GetGame().GetModerationManager().IsBanned(userData.user.Username, out BanRecord)) { if (NeonEnvironment.GetGame().GetModerationManager().UsernameBanCheck(userData.user.Username)) { Disconnect(); return(false); } } #endregion NeonEnvironment.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username); _habbo = userData.user; if (_habbo != null) { ssoTicket = AuthTicket; userData.user.Init(this, userData); SendMessage(new AuthenticationOKComposer()); SendMessage(new AvatarEffectsComposer(_habbo.Effects().GetAllEffects)); SendMessage(new NavigatorSettingsComposer(_habbo.HomeRoom)); SendMessage(new FavouritesComposer(userData.user.FavoriteRooms)); SendMessage(new FigureSetIdsComposer(_habbo.GetClothing().GetClothingAllParts)); SendMessage(new UserRightsComposer(_habbo)); SendMessage(new AvailabilityStatusComposer()); SendMessage(new AchievementScoreComposer(_habbo.GetStats().AchievementPoints)); //var habboClubSubscription = new ServerPacket(ServerPacketHeader.HabboClubSubscriptionComposer); //habboClubSubscription.WriteString("club_habbo"); //habboClubSubscription.WriteInteger(0); //habboClubSubscription.WriteInteger(0); //habboClubSubscription.WriteInteger(0); //habboClubSubscription.WriteInteger(2); //habboClubSubscription.WriteBoolean(false); //habboClubSubscription.WriteBoolean(false); //habboClubSubscription.WriteInteger(0); //habboClubSubscription.WriteInteger(0); //habboClubSubscription.WriteInteger(0); //SendMessage(habboClubSubscription); SendMessage(new BuildersClubMembershipComposer()); SendMessage(new CfhTopicsInitComposer()); SendMessage(new BadgeDefinitionsComposer(NeonEnvironment.GetGame().GetAchievementManager()._achievements)); SendMessage(new SoundSettingsComposer(_habbo.ClientVolume, _habbo.ChatPreference, _habbo.AllowMessengerInvites, _habbo.FocusPreference, FriendBarStateUtility.GetInt(_habbo.FriendbarState))); if (GetHabbo().GetMessenger() != null) { GetHabbo().GetMessenger().OnStatusChanged(true); } if (_habbo.Rank < 2 && !NeonStaticGameSettings.HotelOpenForUsers) { SendMessage(new SendHotelAlertLinkEventComposer("Actualmente solo el Equipo Adminsitrativo puede entrar al hotel para comprobar que todo está bien antes de que los usuarios puedan entrar. Vuelve a intentarlo en unos minutos, podrás encontrar más información en nuestro Facebook.", NeonEnvironment.GetDBConfig().DBData["facebook_url"])); Thread.Sleep(10000); Disconnect(); return(false); } if (!string.IsNullOrEmpty(MachineId)) { if (_habbo.MachineId != MachineId) { using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `users` SET `machine_id` = @MachineId WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("MachineId", MachineId); dbClient.AddParameter("id", _habbo.Id); dbClient.RunQuery(); } } _habbo.MachineId = MachineId; } if (NeonEnvironment.GetGame().GetPermissionManager().TryGetGroup(_habbo.Rank, out PermissionGroup PermissionGroup)) { if (!string.IsNullOrEmpty(PermissionGroup.Badge)) { if (!_habbo.GetBadgeComponent().HasBadge(PermissionGroup.Badge)) { _habbo.GetBadgeComponent().GiveBadge(PermissionGroup.Badge, true, this); } } } if (NeonEnvironment.GetGame().GetSubscriptionManager().TryGetSubscriptionData(_habbo.VIPRank, out SubscriptionData SubData)) { if (!string.IsNullOrEmpty(SubData.Badge)) { if (!_habbo.GetBadgeComponent().HasBadge(SubData.Badge)) { _habbo.GetBadgeComponent().GiveBadge(SubData.Badge, true, this); } } } if (!NeonEnvironment.GetGame().GetCacheManager().ContainsUser(_habbo.Id)) { NeonEnvironment.GetGame().GetCacheManager().GenerateUser(_habbo.Id); } _habbo.InitProcess(); GetHabbo()._lastitems = new Dictionary <int, CatalogItem>(); //ICollection<MessengerBuddy> Friends = new List<MessengerBuddy>(); //foreach (MessengerBuddy Buddy in this.GetHabbo().GetMessenger().GetFriends().ToList()) //{ // if (Buddy == null) // continue; // GameClient Friend = NeonEnvironment.GetGame().GetClientManager().GetClientByUserID(Buddy.Id); // if (Friend == null) // continue; // string figure = this.GetHabbo().Look; // Friend.SendMessage(RoomNotificationComposer.SendBubble("usr/look/" + this.GetHabbo().Username + "", this.GetHabbo().Username + " se ha conectado a " + NeonEnvironment.GetDBConfig().DBData["hotel.name"] + ".", "")); //} if (GetHabbo()._NUX) { SendMessage(new MassEventComposer("habbopages/bienvenida.txt")); } else { SendMessage(new MassEventComposer("habbopages/welk.txt?249")); } if (NeonEnvironment.GetDBConfig().DBData["pin.system.enable"] == "0") { GetHabbo().StaffOk = true; } if (GetHabbo().StaffOk) { if (GetHabbo().GetPermissions().HasRight("mod_tickets")) { SendMessage(new ModeratorInitComposer( NeonEnvironment.GetGame().GetModerationManager().UserMessagePresets, NeonEnvironment.GetGame().GetModerationManager().RoomMessagePresets, NeonEnvironment.GetGame().GetModerationManager().GetTickets)); } } if (GetHabbo().Rank > 5 || GetHabbo()._guidelevel > 0) { HelperToolsManager.AddHelper(_habbo.GetClient(), false, true, true); SendMessage(new HandleHelperToolComposer(true)); } //SendMessage(new CampaignCalendarDataComposer(_habbo.calendarGift)); //if (int.Parse(NeonEnvironment.GetDBConfig().DBData["advent.calendar.enable"]) == 1) // Tk Custom By Whats // SendMessage(new MassEventComposer("openView/calendar")); if (NeonEnvironment.GetGame().GetTargetedOffersManager().TargetedOffer != null) { NeonEnvironment.GetGame().GetTargetedOffersManager().Initialize(NeonEnvironment.GetDatabaseManager().GetQueryReactor()); TargetedOffers TargetedOffer = NeonEnvironment.GetGame().GetTargetedOffersManager().TargetedOffer; if (TargetedOffer.Expire > NeonEnvironment.GetIUnixTimestamp()) { if (TargetedOffer.Limit != GetHabbo()._TargetedBuy) { SendMessage(NeonEnvironment.GetGame().GetTargetedOffersManager().TargetedOffer.Serialize()); } } else if (TargetedOffer.Expire == -1) { if (TargetedOffer.Limit != GetHabbo()._TargetedBuy) { SendMessage(NeonEnvironment.GetGame().GetTargetedOffersManager().TargetedOffer.Serialize()); } } else { using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.runFastQuery("UPDATE targeted_offers SET active = 'false'"); } using (IQueryAdapter dbClient2 = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient2.runFastQuery("UPDATE users SET targeted_buy = '0' WHERE targeted_buy > 0"); } } } if (_habbo.MysticBoxes.Count == 0 && _habbo.MysticKeys.Count == 0) { int box = RandomNumber.GenerateRandom(1, 8); string boxcolor = ""; switch (box) { case 1: boxcolor = "purple"; break; case 2: boxcolor = "blue"; break; case 3: boxcolor = "green"; break; case 4: boxcolor = "yellow"; break; case 5: boxcolor = "lilac"; break; case 6: boxcolor = "orange"; break; case 7: boxcolor = "turquoise"; break; case 8: boxcolor = "red"; break; } int key = RandomNumber.GenerateRandom(1, 8); string keycolor = ""; switch (key) { case 1: keycolor = "purple"; break; case 2: keycolor = "blue"; break; case 3: keycolor = "green"; break; case 4: keycolor = "yellow"; break; case 5: keycolor = "lilac"; break; case 6: keycolor = "orange"; break; case 7: keycolor = "turquoise"; break; case 8: keycolor = "red"; break; } _habbo.MysticKeys.Add(keycolor); _habbo.MysticBoxes.Add(boxcolor); using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.runFastQuery("INSERT INTO user_mystic_data(user_id, mystic_keys, mystic_boxes) VALUES(" + GetHabbo().Id + ", '" + keycolor + "', '" + boxcolor + "');"); } } SendMessage(new MysteryBoxDataComposer(_habbo.GetClient())); SendMessage(new HCGiftsAlertComposer()); //if(!GetHabbo()._NUX) //{ // DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); // dtDateTime = dtDateTime.AddSeconds(GetHabbo().LastOnline); // if ((DateTime.Now - dtDateTime).TotalDays > 2) // { // //NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(_habbo.GetClient(), "ACH_Login", 1, true); // NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(_habbo.GetClient(), "ACH_RegistrationDuration", 1); // } // else if ((DateTime.Now - dtDateTime).TotalDays > 1 && (DateTime.Now - dtDateTime).TotalDays < 2) // { // NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(_habbo.GetClient(), "ACH_Login", 1); // NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(_habbo.GetClient(), "ACH_RegistrationDuration", 1); // if(GetHabbo().Rank > 2 || GetHabbo()._guidelevel > 0) // { // NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(_habbo.GetClient(), "ACH_GuideEnrollmentLifetime", 1); // } // } //} NeonEnvironment.GetGame().GetRewardManager().CheckRewards(this); if (GetHabbo()._NUX) { NeonEnvironment.GetGame().GetClientManager().StaffAlert(new RoomInviteComposer(int.MinValue, GetHabbo().Username + " acaba de registrarse en Keko.")); GetHabbo()._NUX = false; using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.runFastQuery("UPDATE users SET nux_user = '******' WHERE id = " + GetHabbo().Id + ";"); } } return(true); } } catch (Exception e) { Logging.LogCriticalException("Bug during user login: " + e); } return(false); }
private void SendMessageToUser(Habbo Player) { RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (User == null) { return; } string Message = StringData; string MessageFiltered = StringData; // Convertir esta chapuza integral a switch // USER VARIABLES if (StringData.Contains("%user%")) { MessageFiltered = MessageFiltered.Replace("%user%", Player.Username); } if (StringData.Contains("%userid%")) { MessageFiltered = MessageFiltered.Replace("%userid%", Convert.ToString(Player.Id)); } if (StringData.Contains("%honor%")) { MessageFiltered = MessageFiltered.Replace("%honor%", Convert.ToString(Player.GOTWPoints)); } if (StringData.Contains("%pixeles%")) { MessageFiltered = MessageFiltered.Replace("%pixeles%", Convert.ToString(Player.GOTWPoints)); } if (StringData.Contains("%duckets%")) { MessageFiltered = MessageFiltered.Replace("%duckets%", Convert.ToString(Player.Duckets)); } if (StringData.Contains("%diamonds%")) { MessageFiltered = MessageFiltered.Replace("%diamonds%", Convert.ToString(Player.Diamonds)); } if (StringData.Contains("%rank%")) { MessageFiltered = MessageFiltered.Replace("%rank%", Convert.ToString(Player.Rank)); } // ROOM VARIABLES if (StringData.Contains("%roomname%")) { MessageFiltered = MessageFiltered.Replace("%roomname%", Player.CurrentRoom.Name); } if (StringData.Contains("%roomusers%")) { MessageFiltered = MessageFiltered.Replace("%userson%", Player.CurrentRoom.UserCount.ToString()); } if (StringData.Contains("%roomowner%")) { MessageFiltered = MessageFiltered.Replace("%roomowner%", Player.CurrentRoom.OwnerName.ToString()); } if (StringData.Contains("%roomlikes%")) { MessageFiltered = MessageFiltered.Replace("%roomlikes%", Player.CurrentRoom.Score.ToString()); } // HOTEL VARIABLES if (StringData.Contains("%userson%")) { MessageFiltered = MessageFiltered.Replace("%userson%", RavenEnvironment.GetGame().GetClientManager().Count.ToString()); } // SPECIAL VARIABLES if (StringData.Contains("%SIT%")) { Message = Message.Replace("%SIT%", "Te has sentado"); if (User.Statusses.ContainsKey("lie") || User.isLying || User.RidingHorse || User.IsWalking) { return; } if (!User.Statusses.ContainsKey("sit")) { if ((User.RotBody % 2) == 0) { if (User == null) { return; } try { User.Statusses.Add("sit", "1.0"); User.Z -= 0.35; User.isSitting = true; User.UpdateNeeded = true; } catch { } } else { User.RotBody--; User.Statusses.Add("sit", "1.0"); User.Z -= 0.35; User.isSitting = true; User.UpdateNeeded = true; } } else if (User.isSitting == true) { User.Z += 0.35; User.Statusses.Remove("sit"); User.Statusses.Remove("1.0"); User.isSitting = false; User.UpdateNeeded = true; } } if (StringData.Contains("%STAND%")) { Message = Message.Replace("%STAND%", "Te has levantado"); if (User.isSitting) { User.Statusses.Remove("sit"); User.Z += 0.35; User.isSitting = false; User.UpdateNeeded = true; } else if (User.isLying) { User.Statusses.Remove("lay"); User.Z += 0.35; User.isLying = false; User.UpdateNeeded = true; } } if (StringData.Contains("%LAY%")) { Message = Message.Replace("%LAY%", "Te has tumbado"); Room Room = Player.GetClient().GetHabbo().CurrentRoom; if (!Room.GetGameMap().ValidTile(User.X + 2, User.Y + 2) && !Room.GetGameMap().ValidTile(User.X + 1, User.Y + 1)) { Player.GetClient().SendWhisper("Oops, no te puedes acostar aqui!"); return; } if (User.Statusses.ContainsKey("sit") || User.isSitting || User.RidingHorse || User.IsWalking) { return; } if (Player.GetClient().GetHabbo().Effects().CurrentEffect > 0) { Player.GetClient().GetHabbo().Effects().ApplyEffect(0); } if (!User.Statusses.ContainsKey("lay")) { if ((User.RotBody % 2) == 0) { if (User == null) { return; } try { User.Statusses.Add("lay", "1.0 null"); User.Z -= 0.35; User.isLying = true; User.UpdateNeeded = true; } catch { } } else { User.RotBody--;// User.Statusses.Add("lay", "1.0 null"); User.Z -= 0.35; User.isLying = true; User.UpdateNeeded = true; } } else { User.Z += 0.35; User.Statusses.Remove("lay"); User.Statusses.Remove("1.0"); User.isLying = false; User.UpdateNeeded = true; } } Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, MessageFiltered, 0, 34)); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Introduce el nombre del usuario y el tiempo en dias (min 1 dia, max 365 dias)."); return; } Habbo Habbo = NeonEnvironment.GetHabboByUsername(Params[1]); if (Habbo == null) { Session.SendWhisper("Ocurrio un error cuando se hizo la consulta en la base de datos."); return; } if (Convert.ToDouble(Params[2]) == 0) { using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '0' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1"); } if (Habbo.GetClient() != null) { Habbo.TradingLockExpiry = 0; Habbo.GetClient().SendNotification("Sus tradeo ya fueron desbloqueados, puede seguir comerciando con los demás usuarios."); } Session.SendWhisper("Desbloqueaste a " + Habbo.Username + " de su trade Ban."); return; } if (double.TryParse(Params[2], out double Days)) { if (Days < 1) { Days = 1; } if (Days > 365) { Days = 365; } double Length = (NeonEnvironment.GetUnixTimestamp() + (Days * 86400)); using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '" + Length + "', `trading_locks_count` = `trading_locks_count` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1"); } if (Habbo.GetClient() != null) { Habbo.TradingLockExpiry = Length; Habbo.GetClient().SendNotification("Usted tiene un bloqueo de tradeos por " + Days + " día(s)."); } Session.SendWhisper("Usted le ha bloqueado los tradeos a " + Habbo.Username + " por " + Days + " día(s)."); } else { Session.SendWhisper("Introduce dias valido, en numeros enteros."); } }
/// <summary> /// Called for each time the timer ticks. /// </summary> /// <param name="State"></param> public void Run(object State) { try { if (_disabled) { return; } if (_timerRunning) { _timerLagging = true; log.Warn("<Player " + _player.Id + "> Server can't keep up, Player timer is lagging behind."); return; } _resetEvent.Reset(); #region Muted Checks if (_player.TimeMuted > 0) { _player.TimeMuted -= 60; } #endregion #region Console Checks if (_player.MessengerSpamTime > 0) { _player.MessengerSpamTime -= 60; } if (_player.MessengerSpamTime <= 0) { _player.MessengerSpamCount = 0; } #endregion _player.TimeAFK += 1; #region Respect checking if (_player.GetStats().RespectsTimestamp != DateTime.Today.ToString("MM/dd")) { _player.GetStats().RespectsTimestamp = DateTime.Today.ToString("MM/dd"); using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_stats` SET `dailyRespectPoints` = '" + (_player.Rank == 1 && _player.VIPRank == 0 ? 10 : _player.VIPRank == 1 ? 15 : 20) + "', `dailyPetRespectPoints` = '" + (_player.Rank == 1 && _player.VIPRank == 0 ? 10 : _player.VIPRank == 1 ? 15 : 20) + "', `respectsTimestamp` = '" + DateTime.Today.ToString("MM/dd") + "' WHERE `id` = '" + _player.Id + "' LIMIT 1"); } _player.GetStats().DailyRespectPoints = (_player.Rank == 1 && _player.VIPRank == 0 ? 10 : _player.VIPRank == 1 ? 15 : 20); _player.GetStats().DailyPetRespectPoints = (_player.Rank == 1 && _player.VIPRank == 0 ? 10 : _player.VIPRank == 1 ? 15 : 20); if (_player.GetClient() != null) { _player.GetClient().SendMessage(new UserObjectComposer(_player)); } } #endregion #region Reset Scripting Warnings if (_player.GiftPurchasingWarnings < 15) { _player.GiftPurchasingWarnings = 0; } if (_player.MottoUpdateWarnings < 15) { _player.MottoUpdateWarnings = 0; } if (_player.ClothingUpdateWarnings < 15) { _player.ClothingUpdateWarnings = 0; } #endregion if (_player.GetClient() != null) { NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(_player.GetClient(), "ACH_AllTimeHotelPresence", 1); } _player.CheckCreditsTimer(); _player.Effects().CheckEffectExpiry(_player); _timerRunning = false; _timerLagging = false; _resetEvent.Set(); } catch { } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int GroupId = Packet.PopInt(); int UserId = Packet.PopInt(); Group Group = null; GroupRank GroupRank = null; if (GroupId < 1000) { Group = GroupManager.GetJob(GroupId); GroupRank = GroupManager.GetJobRank(GroupId, 1); } else { Group = GroupManager.GetGang(GroupId); GroupRank = GroupManager.GetGangRank(GroupId, 1); } if (Group == null) { return; } bool IsAdmin = false; if (Group.IsAdmin(Session.GetHabbo().Id)) { IsAdmin = true; } if (GroupId < 1000 && Session.GetHabbo().GetPermissions().HasRight("corporation_rights")) { IsAdmin = true; } bool IsOwner = false; if (Group.CreatorId == Session.GetHabbo().Id) { IsOwner = true; } if (GroupId < 1000 && Session.GetHabbo().GetPermissions().HasRight("roleplay_corp_manager")) { IsOwner = true; } if (!IsAdmin && !IsOwner) { return; } if (!Group.HasRequest(UserId)) { return; } Habbo Habbo = PlusEnvironment.GetHabboById(UserId); if (Habbo == null) { Session.SendNotification("Opa, ocorreu um erro ao encontrar este usuário."); return; } Group.HandleRequest(UserId, false); Habbo = PlusEnvironment.GetHabboById(UserId); if (Habbo != null) { if (Group.Id < 1000) { Session.SendWhisper("Sucesso, você rejeitou " + Habbo.Username + " de entrar na sua empresa '" + Group.Name + "'!", 1); } else { Session.SendWhisper("Sucesso, você rejeitou '" + Habbo.Username + "' de entrar na sua gangue '" + Group.Name + "'!", 1); } } else { using (UserCache Member = PlusEnvironment.GetGame().GetCacheManager().GenerateUser(UserId)) { if (Group.Id < 1000) { Session.SendWhisper("Sucesso, você rejeitou " + Member.Username + " de entrar na sua empresa '" + Group.Name + "'!", 1); } else { Session.SendWhisper("Sucesso, você rejeitou '" + Member.Username + "' de entrar na sua gangue '" + Group.Name + "'!", 1); } } } Session.SendMessage(new GroupInfoComposer(Group, Session)); Session.SendMessage(new UnknownGroupComposer(Group.Id, UserId)); if (Group.Id < 1000 && Habbo.GetClient() != null && Habbo.GetClient().GetRoomUser() != null) { if (Habbo.CurrentRoom != null && Habbo.CurrentRoom.TutorialEnabled) { Habbo.SendComposerToCorrectUsers(new UsersComposer(Habbo.GetClient().GetRoomUser())); } } }
public void WriteHabboData(Habbo Habbo) { #region Default base.WriteInteger(Habbo.Id); base.WriteInteger(3); #endregion #region Marriage base.WriteInteger(1); base.WriteInteger(1); if (Habbo.GetClient() != null && Habbo.GetClient().GetRoleplay() != null) { if (Habbo.GetClient().GetRoleplay().MarriedTo > 0) { Habbo Married = PlusEnvironment.GetHabboById(Habbo.GetClient().GetRoleplay().MarriedTo); if (Married == null) { Habbo.GetClient().GetRoleplay().MarriedTo = 0; base.WriteInteger(Habbo.Id); base.WriteString("Casado(a) com: Ninguém"); base.WriteString(Habbo.Look); } else { base.WriteInteger(Married.Id); base.WriteString("Casado(a) com: " + Married.Username); base.WriteString(Married.Look); } } else { base.WriteInteger(Habbo.Id); base.WriteString("Casado(a) com: Ninguém"); base.WriteString(Habbo.Look); } } else { using (UserCache Cache = PlusEnvironment.GetGame().GetCacheManager().GenerateUser(Habbo.Id)) { if (Cache.MarriedId > 0) { using (UserCache Married = PlusEnvironment.GetGame().GetCacheManager().GenerateUser(Cache.MarriedId)) { if (Married == null) { Cache.MarriedId = 0; base.WriteInteger(Habbo.Id); base.WriteString("Casado(a) com: Ninguém"); base.WriteString(Habbo.Look); } else { base.WriteInteger(Married.Id); base.WriteString("Casado(a) com: " + Married.Username); base.WriteString(Married.Look); } } } else { base.WriteInteger(Habbo.Id); base.WriteString("Casado(a) com: Ninguém"); base.WriteString(Habbo.Look); } } } #endregion #region Level base.WriteInteger(2); base.WriteInteger(1); if (Habbo.GetClient() != null && Habbo.GetClient().GetRoleplay() != null) { base.WriteInteger(Habbo.Id); base.WriteString("Level: " + Habbo.GetClient().GetRoleplay().Level + "/" + RoleplayManager.LevelCap); base.WriteString(Habbo.Look); } else { using (UserCache Cache = PlusEnvironment.GetGame().GetCacheManager().GenerateUser(Habbo.Id)) { base.WriteInteger(Habbo.Id); base.WriteString("Level: " + Cache.Level + "/" + RoleplayManager.LevelCap); base.WriteString(Habbo.Look); } } #endregion #region Gang base.WriteInteger(3); base.WriteInteger(1); if (Habbo.Id == 0 || (Habbo.GetClient() != null && Habbo.GetClient().GetRoleplay() != null)) { if (Habbo.Id == 0) { base.WriteInteger(Habbo.Id); base.WriteString("Força: " + Habbo.GetClient().GetRoleplay().Strength + "/" + RoleplayManager.StrengthCap); base.WriteString(Habbo.Look); } else { Group Gang = GroupManager.GetGang(Habbo.GetClient().GetRoleplay().GangId); if (Gang != null) { //Habbo GangOwner = PlusEnvironment.GetHabboById(Gang.CreatorId); base.WriteInteger(Habbo.Id); base.WriteString("Força: " + Habbo.GetClient().GetRoleplay().Strength + "/" + RoleplayManager.StrengthCap); base.WriteString(Habbo.Look); } else { base.WriteInteger(Habbo.Id); base.WriteString("Força: " + Habbo.GetClient().GetRoleplay().Strength + "/" + RoleplayManager.StrengthCap); base.WriteString(Habbo.Look); } } } else { if (GroupManager.Gangs.Values.Where(x => x.Members.ContainsKey(Habbo.Id)).ToList().Count > 0) { Group Gang = GroupManager.Gangs.Values.FirstOrDefault(x => x.Members.ContainsKey(Habbo.Id)); Habbo GangOwner = PlusEnvironment.GetHabboById(Gang.CreatorId); base.WriteInteger(Habbo.Id); base.WriteString("Força: " + Habbo.GetClient().GetRoleplay().Strength + "/" + RoleplayManager.StrengthCap); base.WriteString(Habbo.Look); } else { base.WriteInteger(Habbo.Id); base.WriteString("Força: " + Habbo.GetClient().GetRoleplay().Strength + "/" + RoleplayManager.StrengthCap); base.WriteString(Habbo.Look); } } #endregion }