public SongItem(int itemID, int songID, int baseItem) { this.itemID = itemID; this.songID = songID; this.baseItem = null; RavenEnvironment.GetGame().GetItemManager().GetItem(baseItem, out this.baseItem); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_tickets")) { return; } int TicketId = Packet.PopInt(); ModerationTicket Ticket = null; if (!RavenEnvironment.GetGame().GetModerationManager().TryGetTicket(TicketId, out Ticket) || Ticket.Room == null) { return; } RoomData Data = RavenEnvironment.GetGame().GetRoomManager().GenerateRoomData(Ticket.Room.Id); if (Data == null) { return; } Session.SendMessage(new ModeratorTicketChatlogComposer(Ticket, Data, Ticket.Timestamp)); }
public override void OnUserLeaveRoom(GameClient Client) { if (GetBotData() == null) { return; } RoomUser Bot = GetRoomUser(); if (Client.GetHabbo().CurrentRoom.OwnerId == Client.GetHabbo().Id) { DataTable getRoom; using (IQueryAdapter query = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { query.SetQuery("DELETE FROM room_visits WHERE roomid = @id"); query.AddParameter("id", Client.GetHabbo().CurrentRoom.RoomId); getRoom = query.getTable(); } } DataTable getUpdate; using (IQueryAdapter query = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { query.SetQuery("UPDATE room_visits SET gone = @gone WHERE roomid = @id AND username = @username"); query.AddParameter("gone", "se ha ido."); query.AddParameter("id", Client.GetHabbo().CurrentRoom.RoomId); query.AddParameter("username", Client.GetHabbo().Username); getUpdate = query.getTable(); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom) { return; } Room Room = null; if (!RavenEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) { return; } if (!Room.CanTradeInRoom) { return; } Trade Trade = Room.GetUserTrade(Session.GetHabbo().Id); if (Trade == null) { return; } Item Item = Session.GetHabbo().GetInventoryComponent().GetItem(Packet.PopInt()); if (Item == null) { return; } Trade.OfferItem(Session.GetHabbo().Id, Item); }
public static Item CreateGiftItem(ItemData Data, Habbo Habbo, string ExtraData, string DisplayFlags, int ItemId, int LimitedNumber = 0, int LimitedStack = 0) { if (Data == null) { throw new InvalidOperationException("Data cannot be null."); } Item Item = new Item(ItemId, 0, Data.Id, ExtraData, 0, 0, 0, 0, Habbo.Id, 0, LimitedNumber, LimitedStack, ""); using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("INSERT INTO `items` (`id`,base_item,user_id,room_id,x,y,z,wall_pos,rot,extra_data,`limited_number`,`limited_stack`) VALUES (@id, @did,@uid,@rid,@x,@y,@z,@wall_pos,@rot,@extra_data, @limited_number, @limited_stack)"); dbClient.AddParameter("id", ItemId); dbClient.AddParameter("did", Data.Id); dbClient.AddParameter("uid", Habbo.Id); dbClient.AddParameter("rid", 0); dbClient.AddParameter("x", 0); dbClient.AddParameter("y", 0); dbClient.AddParameter("z", 0); dbClient.AddParameter("wall_pos", ""); dbClient.AddParameter("rot", 0); dbClient.AddParameter("extra_data", ExtraData); dbClient.AddParameter("limited_number", LimitedNumber); dbClient.AddParameter("limited_stack", LimitedStack); dbClient.RunQuery(); return(Item); } }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (!Room.CheckRights(Session, true)) { Session.SendWhisper("Oops, Al parecer el dueño de la sala no permite que ejecutes este comando"); return; } foreach (RoomUser User in Room.GetRoomUserManager().GetUserList().ToList()) { if (User == null || User.IsPet || !User.IsBot) { continue; } RoomUser BotUser = null; if (!Room.GetRoomUserManager().TryGetBot(User.BotData.Id, out BotUser)) { return; } using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `bots` SET `room_id` = '0' WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("id", User.BotData.Id); dbClient.RunQuery(); } Session.GetHabbo().GetInventoryComponent().TryAddBot(new Bot(Convert.ToInt32(BotUser.BotData.Id), Convert.ToInt32(BotUser.BotData.ownerID), BotUser.BotData.Name, BotUser.BotData.Motto, BotUser.BotData.Look, BotUser.BotData.Gender)); Session.SendMessage(new BotInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetBots())); Room.GetRoomUserManager().RemoveBot(BotUser.VirtualId, false); } Session.SendWhisper("Todos los bots fueron removidos."); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Introduce el nombre del usuario que deseas desmutear.."); return; } GameClient TargetClient = RavenEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient == null || TargetClient.GetHabbo() == null) { Session.SendWhisper("Ocurrio un error, escribe correctamente el nombre o no se encuentra online."); return; } using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `users` SET `time_muted` = '0' WHERE `id` = '" + TargetClient.GetHabbo().Id + "' LIMIT 1"); } TargetClient.GetHabbo().TimeMuted = 0; TargetClient.SendNotification("Usted ha sido desmuteado por " + Session.GetHabbo().Username + "!"); Session.SendWhisper("Acabas de desmutear a " + TargetClient.GetHabbo().Username + "!"); }
public void HandleSave(ClientPacket Packet) { int Unknown = Packet.PopInt(); int Score = Packet.PopInt(); int times = Packet.PopInt(); string Unknown2 = Packet.PopString(); int Unknown3 = Packet.PopInt(); int Delay = Packet.PopInt(); this.Delay = Delay; this.StringData = Convert.ToString(Score + ";" + times); Habbo Owner = RavenEnvironment.GetHabboById(Item.UserID); if (times > 3) { Owner.GetClient().SendWhisper("No puedes dar el premio más de tres veces.", 34); return; } if (Owner == null || Owner.Rank < 6) { this.StringData = Convert.ToString(0 + ";" + times); 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.")); } return; }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Introduce el nombre del usuario que deseas descongelar."); return; } GameClient TargetClient = RavenEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient == null) { Session.SendWhisper("Ocurrio un error, al parecer no se consigue el usuario o no se encuentra online"); return; } RoomUser TargetUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Params[1]); if (TargetUser != null) { TargetUser.Frozen = false; } Session.SendWhisper("Descongelado correctamente " + TargetClient.GetHabbo().Username + "!"); }
public ForumsListDataComposer(ICollection <GroupForum> Forums, GameClient Session, int ViewOrder = 0, int StartIndex = 0, int MaxLength = 20) : base(ServerPacketHeader.ForumsListDataMessageComposer) { base.WriteInteger(ViewOrder); base.WriteInteger(StartIndex); base.WriteInteger(StartIndex); base.WriteInteger(Forums.Count); // Forum List Count foreach (var Forum in Forums) { var lastpost = Forum.GetLastPost(); var isn = lastpost == null; base.WriteInteger(Forum.Id); //Maybe ID base.WriteString(Forum.Name); //Forum name base.WriteString(Forum.Description); //idk base.WriteString(Forum.Group.Badge); // Group Badge base.WriteInteger(0); //Idk base.WriteInteger(0); // Score base.WriteInteger(Forum.MessagesCount); //Message count base.WriteInteger(Forum.UnreadMessages(Session.GetHabbo().Id)); //unread message count base.WriteInteger(0); //Idk base.WriteInteger(!isn ? lastpost.GetAuthor().Id : 0); // Las user to message id base.WriteString(!isn ? lastpost.GetAuthor().Username : ""); //Last user to message name base.WriteInteger(!isn ? (int)RavenEnvironment.GetUnixTimestamp() - lastpost.Timestamp : 0); //Last message timestamp } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null) { return; } if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool")) { return; } int UserId = Packet.PopInt(); Habbo Habbo = RavenEnvironment.GetHabboById(UserId); if (Habbo == null) { Session.SendNotification("Oops, no se consigue este usuario"); return; } try { Session.SendMessage(new ModeratorUserChatlogComposer(UserId)); } catch { Session.SendNotification("Overflow :/"); } }
public MoodlightData(int ItemId) { this.ItemId = ItemId; DataRow Row = null; using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT enabled,current_preset,preset_one,preset_two,preset_three FROM room_items_moodlight WHERE item_id = '" + ItemId + "' LIMIT 1"); Row = dbClient.getRow(); } if (Row == null) { using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("INSERT INTO `room_items_moodlight` (item_id,enabled,current_preset,preset_one,preset_two,preset_three) VALUES (" + ItemId + ",0,1,'#000000,255,0','#000000,255,0','#000000,255,0')"); dbClient.SetQuery("SELECT enabled,current_preset,preset_one,preset_two,preset_three FROM room_items_moodlight WHERE item_id=" + ItemId + " LIMIT 1"); Row = dbClient.getRow(); } } Enabled = RavenEnvironment.EnumToBool(Row["enabled"].ToString()); CurrentPreset = Convert.ToInt32(Row["current_preset"]); Presets = new List <MoodlightPreset>(); Presets.Add(GeneratePreset(Convert.ToString(Row["preset_one"]))); Presets.Add(GeneratePreset(Convert.ToString(Row["preset_two"]))); Presets.Add(GeneratePreset(Convert.ToString(Row["preset_three"]))); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_kick")) { return; } int UserId = Packet.PopInt(); string Message = Packet.PopString(); GameClient Client = RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null || Client.GetHabbo().CurrentRoomId < 1 || Client.GetHabbo().Id == Session.GetHabbo().Id) { return; } if (Client.GetHabbo().Rank >= Session.GetHabbo().Rank) { Session.SendNotification(RavenEnvironment.GetGame().GetLanguageLocale().TryGetValue("moderation_kick_permissions")); return; } Room Room = null; if (!RavenEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) { return; } Room.GetRoomUserManager().RemoveUserFromRoom(Client, true, false); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 3) { GameClient TargetClient = null; TargetClient = RavenEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient != null) { if (!TargetClient.GetHabbo().GetBadgeComponent().HasBadge(Params[2])) { { Session.SendNotification("Este usuario no tiene la placa " + Params[2] + ""); } } else { RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); TargetClient.GetHabbo().GetBadgeComponent().RemoveBadge(Params[2], TargetClient); TargetClient.SendNotification("Tu placa " + Params[2] + " ha sido robada por " + ThisUser.GetUsername() + "!"); Session.SendNotification("La placa se le ha removido al usuario"); } } } else { Session.SendNotification("Usuario no encontrado."); return; } }
public static List <Item> GetItemsForUser(int UserId) { DataTable Items = null; List <Item> I = new List <Item>(); using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `items`.*, COALESCE(`items_groups`.`group_id`, 0) AS `group_id` FROM `items` LEFT OUTER JOIN `items_groups` ON `items`.`id` = `items_groups`.`id` WHERE `items`.`room_id` = 0 AND `items`.`user_id` = @uid;"); dbClient.AddParameter("uid", UserId); Items = dbClient.getTable(); if (Items != null) { foreach (DataRow Row in Items.Rows) { ItemData Data = null; if (RavenEnvironment.GetGame().GetItemManager().GetItem(Convert.ToInt32(Row["base_item"]), out Data)) { I.Add(new Item(Convert.ToInt32(Row["id"]), Convert.ToInt32(Row["room_id"]), Convert.ToInt32(Row["base_item"]), Convert.ToString(Row["extra_data"]), Convert.ToInt32(Row["x"]), Convert.ToInt32(Row["y"]), Convert.ToDouble(Row["z"]), Convert.ToInt32(Row["rot"]), Convert.ToInt32(Row["user_id"]), Convert.ToInt32(Row["group_id"]), Convert.ToInt32(Row["limited_number"]), Convert.ToInt32(Row["limited_stack"]), Convert.ToString(Row["wall_pos"]))); } else { // Item data does not exist anymore. } } } } return(I); }
public void OnTrigger(GameClient Session, Item Item, int Request, bool HasRights) { int Modes = Item.GetBaseItem().Modes - 1; if (Session == null || !HasRights || Modes <= 0) { return; } RavenEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.FURNI_SWITCH); int CurrentMode = 0; int NewMode = 0; if (!int.TryParse(Item.ExtraData, out CurrentMode)) { } if (CurrentMode <= 0) { NewMode = 1; } else if (CurrentMode >= Modes) { NewMode = 0; } else { NewMode = CurrentMode + 1; } Item.ExtraData = NewMode.ToString(); Item.UpdateState(); }
public void Parse(GameClient Session, ClientPacket Packet) { string PetName = Packet.PopString(); string word; if (PetName.Length < 2) { Session.SendMessage(new CheckPetNameComposer(2, "2")); return; } else if (PetName.Length > 15) { Session.SendMessage(new CheckPetNameComposer(1, "15")); return; } else if (!RavenEnvironment.IsValidAlphaNumeric(PetName)) { Session.SendMessage(new CheckPetNameComposer(3, "")); return; } else if (RavenEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(PetName, out word)) { Session.SendMessage(new CheckPetNameComposer(4, "" + word)); return; } Session.SendMessage(new CheckPetNameComposer(0, "")); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Usted debe especificar el ID de la sala"); return; } int RoomID; if (!int.TryParse(Params[1], out RoomID)) { Session.SendWhisper("Usted debe escribir correctamente el ID de la sala"); } else { Room _room = RavenEnvironment.GetGame().GetRoomManager().LoadRoom(RoomID); if (_room == null) { Session.SendWhisper("Esta sala no existe!"); } else { Session.GetHabbo().PrepareRoom(_room.Id, ""); } } }
private void SerializeQuest(ServerPacket Message, GameClient Session, Quest Quest, string Category) { if (Message == null || Session == null) { return; } int AmountInCat = RavenEnvironment.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(Category); int Number = Quest == null ? AmountInCat : Quest.Number - 1; int UserProgress = Quest == null ? 0 : Session.GetHabbo().GetQuestProgress(Quest.Id); if (Quest != null && Quest.IsCompleted(UserProgress)) { Number++; } Message.WriteString(Category); Message.WriteInteger(Number); // Quest progress in this cat Message.WriteInteger(AmountInCat); // Total quests in this cat Message.WriteInteger(Quest == null ? 3 : Quest.RewardType); // Reward type (1 = Snowflakes, 2 = Love hearts, 3 = Pixels, 4 = Seashells, everything else is pixels Message.WriteInteger(Quest == null ? 0 : Quest.Id); // Quest id Message.WriteBoolean(Quest == null ? false : Session.GetHabbo().GetStats().QuestID == Quest.Id); // Quest started Message.WriteString(Quest == null ? string.Empty : Quest.ActionName); Message.WriteString(Quest == null ? string.Empty : Quest.DataBit); Message.WriteInteger(Quest == null ? 0 : Quest.Reward); Message.WriteString(Quest == null ? string.Empty : Quest.Name); Message.WriteInteger(UserProgress); // Current progress Message.WriteInteger(Quest == null ? 0 : Quest.GoalData); // Target progress Message.WriteInteger(Quest == null ? 0 : Quest.TimeUnlock); // "Next quest available countdown" in seconds Message.WriteString(""); Message.WriteString(""); Message.WriteBoolean(true); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom) { return; } Room Room; if (!RavenEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) { return; } if (!Room.CanTradeInRoom) { return; } Trade Trade = Room.GetUserTrade(Session.GetHabbo().Id); if (Trade == null) { return; } Trade.Accept(Session.GetHabbo().Id); }
public void Init() { if (this._subscriptions.Count > 0) { this._subscriptions.Clear(); } using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `subscriptions`;"); DataTable GetSubscriptions = dbClient.getTable(); if (GetSubscriptions != null) { foreach (DataRow Row in GetSubscriptions.Rows) { if (!this._subscriptions.ContainsKey(Convert.ToInt32(Row["id"]))) { this._subscriptions.Add(Convert.ToInt32(Row["id"]), new SubscriptionData(Convert.ToInt32(Row["id"]), Convert.ToString(Row["name"]), Convert.ToString(Row["badge_code"]), Convert.ToInt32(Row["credits"]), Convert.ToInt32(Row["duckets"]), Convert.ToInt32(Row["respects"]))); } } } } //log.Info(">> Subscription Manager " + this._subscriptions.Count + " loaded."); log.Info(">> Subscription Manager -> READY!"); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool")) return; int UserId = Packet.PopInt(); DataRow User = null; DataRow Info = null; using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `id`,`username`,`online`,`mail`,`ip_last`,`look`,`account_created`,`last_online` FROM `users` WHERE `id` = '" + UserId + "' LIMIT 1"); User = dbClient.getRow(); if (User == null) { Session.SendNotification(RavenEnvironment.GetGame().GetLanguageLocale().TryGetValue("user_not_found")); return; } dbClient.SetQuery("SELECT `cfhs`,`cfhs_abusive`,`cautions`,`bans`,`trading_locked`,`trading_locks_count` FROM `user_info` WHERE `user_id` = '" + UserId + "' LIMIT 1"); Info = dbClient.getRow(); if (Info == null) { dbClient.RunQuery("INSERT INTO `user_info` (`user_id`) VALUES ('" + UserId + "')"); dbClient.SetQuery("SELECT `cfhs`,`cfhs_abusive`,`cautions`,`bans`,`trading_locked`,`trading_locks_count` FROM `user_info` WHERE `user_id` = '" + UserId + "' LIMIT 1"); Info = dbClient.getRow(); } } Session.SendMessage(new ModeratorUserInfoComposer(User, Info)); }
public void Init() { if (_leaderboards.Count > 0) { _leaderboards.Clear(); } using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { DataTable GetData = null; dbClient.SetQuery("SELECT * FROM `games_leaderboard`"); GetData = dbClient.getTable(); if (GetData != null) { foreach (DataRow Row in GetData.Rows) { LeaderBoardData value = new LeaderBoardData(Convert.ToInt32(Row["game_id"]), Convert.ToInt32(Row["user_id"]), Convert.ToInt32(Row["points"]), Convert.ToInt32(Row["record"]), Convert.ToInt32(Row["week"]), Convert.ToInt32(Row["year"])); this._leaderboards.Add(Convert.ToInt32(Row["id"]), value); } } } log.Info(">> LeaderBoardData Manager -> READY!"); }
public void Init() { this._items = new Dictionary <int, RentableSpaceItem>(); using (IQueryAdapter con = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { con.SetQuery("SELECT * FROM `items_rentablespace`"); DataTable table = con.getTable(); if (table != null) { for (int i = 0; i < table.Rows.Count; i++) { DataRow row = table.Rows[i]; if (row != null) { int id = Convert.ToInt32(row["item_id"].ToString()); int ownerid = Convert.ToInt32(row["owner"].ToString()); string ownername = ""; if (ownerid > 0) { Habbo owner = RavenEnvironment.GetHabboById(ownerid); if (owner != null) { ownername = owner.Username; } } int expirestamp = Convert.ToInt32(row["expire"].ToString()); int price = Convert.ToInt32(row["price"].ToString()); this.AddItem(new RentableSpaceItem(id, ownerid, ownername, expirestamp, price)); } } } } }
public MarketPlaceOffersComposer(int MinCost, int MaxCost, Dictionary <int, MarketOffer> dictionary, Dictionary <int, int> dictionary2) : base(ServerPacketHeader.MarketPlaceOffersMessageComposer) { base.WriteInteger(dictionary.Count); if (dictionary.Count > 0) { foreach (KeyValuePair <int, MarketOffer> pair in dictionary) { base.WriteInteger(pair.Value.OfferID); base.WriteInteger(1);//State base.WriteInteger(1); base.WriteInteger(pair.Value.SpriteId); base.WriteInteger(256); base.WriteString(""); base.WriteInteger(pair.Value.LimitedNumber); base.WriteInteger(pair.Value.LimitedStack); base.WriteInteger(pair.Value.TotalPrice); base.WriteInteger(0); base.WriteInteger(RavenEnvironment.GetGame().GetCatalog().GetMarketplace().AvgPriceForSprite(pair.Value.SpriteId)); base.WriteInteger(dictionary2[pair.Value.SpriteId]); } } base.WriteInteger(dictionary.Count);//Item count to show how many were found. }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) { return; } Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } String Username = Packet.PopString(); Habbo User = RavenEnvironment.GetHabboByUsername(Username); if (User == null || !Session.GetHabbo().MutedUsers.Contains(User.Id)) { return; } Session.GetHabbo().MutedUsers.Remove(User.Id); Session.SendMessage(new IgnoreStatusComposer(3, Username)); }
public void Execute(GameClient Session, Rooms.Room Room, string[] Params) { #region Parametros string type = Params[1]; int value = int.Parse(Params[2]); int uses = int.Parse(Params[3]); #endregion int Voucher = 10; string _CaracteresPermitidos = "abcdefghijklmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789!@$?"; Byte[] randomBytes = new Byte[Voucher]; char[] Caracter = new char[Voucher]; int CuentaPermitida = _CaracteresPermitidos.Length; for (int i = 0; i < Voucher; i++) { Random randomObj = new Random(); randomObj.NextBytes(randomBytes); Caracter[i] = _CaracteresPermitidos[(int)randomBytes[i] % CuentaPermitida]; } var code = new string(Caracter); RavenEnvironment.GetGame().GetCatalog().GetVoucherManager().AddVoucher(code, type, value, uses); RavenEnvironment.GetGame().GetClientManager().SendMessage(new RoomCustomizedAlertComposer("AVISO: Un nuevo voucher ha sido añadido, para canjearlo, dirígete al catálogo, en la pestaña 'Inicio' en la parte inferior, en el recuadro, introduce lo siguiente: \n\n" + "Código: " + code + "\nLa recompensa son: " + type + "\n Puede usarse hasta en " + uses + " ocasiones\n\n ¡Suerte canjeándolo!")); }
/// <summary> /// Initializes the EffectsComponent. /// </summary> /// <param name="UserId"></param> public bool Init(Habbo Habbo) { if (_effects.Count > 0) { return(false); } DataTable GetEffects = null; using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `user_effects` WHERE `user_id` = @id;"); dbClient.AddParameter("id", Habbo.Id); GetEffects = dbClient.getTable(); if (GetEffects != null) { foreach (DataRow Row in GetEffects.Rows) { if (this._effects.TryAdd(Convert.ToInt32(Row["id"]), new AvatarEffect(Convert.ToInt32(Row["id"]), Convert.ToInt32(Row["user_id"]), Convert.ToInt32(Row["effect_id"]), Convert.ToDouble(Row["total_duration"]), RavenEnvironment.EnumToBool(Row["is_activated"].ToString()), Convert.ToDouble(Row["activated_stamp"]), Convert.ToInt32(Row["quantity"])))) { //umm? } } } } this._habbo = Habbo; this._currentEffect = 0; return(true); }
public void Execute(GameClient Session, Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Por favor introduce el nombre del usuario al que le enviarás la alerta."); return; } GameClient TargetClient = RavenEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient == null) { Session.SendWhisper("Ocurrió un error, al parecer no se consigue el usuario o no se encuentra en línea."); return; } if (TargetClient.GetHabbo() == null) { Session.SendWhisper("Ocurrió un error, al parecer no se consigue el usuario o no se encuentra en línea."); return; } string Message = CommandManager.MergeParams(Params, 2); TargetClient.SendMessage(new GraphicAlertComposer(Message)); Session.SendWhisper("Alerta enviada satisfactoriamente a " + TargetClient.GetHabbo().Username + "."); }
public void Parse(GameClient Session, ClientPacket Packet) { string username = Packet.PopString(); Habbo targetData = RavenEnvironment.GetHabboByUsername(username); if (targetData == null) { Session.SendNotification("Ha ocurrido un error buscando el perfil del usuario."); return; } List <Group> groups = RavenEnvironment.GetGame().GetGroupManager().GetGroupsForUser(targetData.Id); int friendCount = 0; using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT COUNT(0) FROM `messenger_friendships` WHERE (`user_one_id` = @userid OR `user_two_id` = @userid)"); dbClient.AddParameter("userid", targetData.Id); friendCount = dbClient.getInteger(); } Session.SendMessage(new ProfileInformationComposer(targetData, Session, groups, friendCount)); }