internal static void LockTrade(GameClient ModSession, uint UserId, string Message, int Length) { GameClient clientByUserID = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (clientByUserID == null) { return; } int num = Length; checked { if (!clientByUserID.GetHabbo().CheckTrading()) { num += CyberEnvironment.GetUnixTimestamp() - clientByUserID.GetHabbo().TradeLockExpire; } clientByUserID.GetHabbo().TradeLocked = true; clientByUserID.GetHabbo().TradeLockExpire = CyberEnvironment.GetUnixTimestamp() + num; clientByUserID.SendNotif(Message); using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.runFastQuery("UPDATE users SET trade_lock = '1', trade_lock_expire = '" + clientByUserID.GetHabbo().TradeLockExpire + "'"); } } }
internal void GetCurrentQuest(GameClient Session, ClientMessage Message) { if (!Session.GetHabbo().InRoom) { return; } Quest quest = this.GetQuest(Session.GetHabbo().LastQuestCompleted); Quest nextQuestInSeries = this.GetNextQuestInSeries(quest.Category, checked (quest.Number + 1)); if (nextQuestInSeries == null) { return; } using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.runFastQuery(string.Concat(new object[] { "REPLACE INTO user_quests(user_id,quest_id) VALUES (", Session.GetHabbo().Id, ", ", nextQuestInSeries.Id, ")" })); queryreactor.runFastQuery(string.Concat(new object[] { "UPDATE user_stats SET quest_id = ", nextQuestInSeries.Id, " WHERE id = ", Session.GetHabbo().Id })); } Session.GetHabbo().CurrentQuestId = nextQuestInSeries.Id; this.GetList(Session, null); Session.SendMessage(QuestStartedComposer.Compose(Session, nextQuestInSeries)); }
internal RoomData GenerateRoomData(uint RoomId) { if (this.loadedRoomData.Contains(RoomId)) { return((RoomData)this.loadedRoomData[RoomId]); } RoomData roomData = new RoomData(); if (this.IsRoomLoaded(RoomId)) { return(this.GetRoom(RoomId).RoomData); } DataRow dataRow = null; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT * FROM rooms WHERE id = " + RoomId + " LIMIT 1"); dataRow = queryreactor.getRow(); } if (dataRow == null) { return(null); } roomData.Fill(dataRow); this.loadedRoomData.Add(RoomId, roomData); return(roomData); }
internal void DestroyFriendship(uint friendID) { using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.runFastQuery(string.Concat(new object[] { "DELETE FROM messenger_friendships WHERE (user_one_id = ", this.UserId, " AND user_two_id = ", friendID, ") OR (user_two_id = ", this.UserId, " AND user_one_id = ", friendID, ")" })); } this.OnDestroyFriendship(friendID); GameClient clientByUserID = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(friendID); if (clientByUserID != null && clientByUserID.GetHabbo().GetMessenger() != null) { clientByUserID.GetHabbo().GetMessenger().OnDestroyFriendship(this.UserId); } }
private void Dispose() { if (!this.mDisposed) { this.mDisposed = true; this.mCycleEnded = true; CyberEnvironment.GetGame().GetRoomManager().QueueActiveRoomRemove(this.mRoomData); using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { this.GetRoomItemHandler().SaveFurniture(queryreactor, null); queryreactor.runFastQuery("UPDATE rooms SET users_now=0 WHERE id = " + this.Id + " LIMIT 1"); } this.ProcessTimer.Dispose(); this.ProcessTimer = null; this.tagCount = 0; this.Tags.Clear(); this.roomUserManager.UserList.Clear(); this.UsersWithRights.Clear(); this.Bans.Clear(); this.LoadedGroups.Clear(); this.RoomChat.Clear(); this.GetWiredHandler().Destroy(); foreach (RoomItem current in this.GetRoomItemHandler().mFloorItems.Values) { current.Destroy(); } foreach (RoomItem current2 in this.GetRoomItemHandler().mWallItems.Values) { current2.Destroy(); } this.ActiveTrades.Clear(); } }
internal RoomData CreateRoom(GameClient Session, string Name, string Desc, string Model, int Category, int MaxVisitors, int TradeState) { if (!this.roomModels.Contains(Model)) { Session.SendNotif("I can't create your room with that model!"); return(null); } uint RoomId = 0; using (IQueryAdapter dbClient = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { dbClient.setQuery("INSERT INTO rooms (roomtype,caption,description,owner,model_name,category,users_max,trade_state) VALUES ('private',@caption,@desc,@username,@model,@cat,@usmax,@tstate)"); dbClient.addParameter("caption", Name); dbClient.addParameter("desc", Desc); dbClient.addParameter("username", Session.GetHabbo().Username); dbClient.addParameter("model", Model); dbClient.addParameter("cat", Category); dbClient.addParameter("usmax", MaxVisitors); dbClient.addParameter("tstate", TradeState.ToString()); RoomId = (uint)dbClient.insertQuery(); } RoomData Data = this.GenerateRoomData(RoomId); Session.GetHabbo().UsersRooms.Add(Data); return(Data); }
internal void LoadMusic() { DataTable table; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT items_rooms_songs.songid,items.id,items.base_item FROM items_rooms_songs LEFT JOIN items ON items.id = items_rooms_songs.itemid WHERE items_rooms_songs.roomid = " + this.RoomId); table = queryreactor.getTable(); } if (table != null) { foreach (DataRow dataRow in table.Rows) { uint songID = (uint)dataRow[0]; uint num = Convert.ToUInt32(dataRow[1]); int baseItem = Convert.ToInt32(dataRow[2]); string songCode = ""; string extraData = ""; using (IQueryAdapter queryreactor2 = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor2.setQuery("SELECT extra_data,songcode FROM items WHERE id = " + num); DataRow row = queryreactor2.getRow(); if (row != null) { extraData = (string)row["extra_data"]; songCode = (string)row["songcode"]; } } SongItem diskItem = new SongItem(num, songID, baseItem, extraData, songCode); this.GetRoomMusicController().AddDisk(diskItem); } } }
internal void FlushSettings() { this.mCycleEnded = true; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { this.GetRoomItemHandler().SaveFurniture(queryreactor, null); } this.Tags.Clear(); this.UsersWithRights.Clear(); this.Bans.Clear(); this.ActiveTrades.Clear(); this.LoadedGroups.Clear(); if (this.GotFreeze()) { this.freeze = new Freeze(this); } if (this.GotBanzai()) { this.banzai = new BattleBanzai(this); } if (this.GotSoccer()) { this.soccer = new Soccer(this); } if (this.gameItemHandler != null) { this.gameItemHandler = new GameItemHandler(this); } }
internal List <uint> GetGroupRequestsByString(Guild Group, string SearchVal, uint Req) { if (string.IsNullOrWhiteSpace(SearchVal)) { return(Group.Requests); } List <uint> list = new List <uint>(); using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT id FROM users WHERE username LIKE @query"); queryreactor.addParameter("query", "%" + SearchVal + "%"); DataTable table = queryreactor.getTable(); if (table != null) { foreach (DataRow dataRow in table.Rows) { if (Group.Requests.Contains((uint)dataRow[0])) { list.Add((uint)dataRow[0]); } } } } return(list); }
internal void OnNewFriendship(uint friendID) { GameClient clientByUserID = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(friendID); MessengerBuddy messengerBuddy; if (clientByUserID == null || clientByUserID.GetHabbo() == null) { DataRow row; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT id,username,motto,look,last_online,hide_inroom,hide_online FROM users WHERE id = " + friendID); row = queryreactor.getRow(); } messengerBuddy = new MessengerBuddy(friendID, (string)row["username"], (string)row["look"], (string)row["motto"], (int)row["last_online"], CyberEnvironment.EnumToBool(row["hide_online"].ToString()), CyberEnvironment.EnumToBool(row["hide_inroom"].ToString())); } else { Habbo habbo = clientByUserID.GetHabbo(); messengerBuddy = new MessengerBuddy(friendID, habbo.Username, habbo.Look, habbo.Motto, 0, habbo.AppearOffline, habbo.HideInRoom); messengerBuddy.UpdateUser(clientByUserID); } if (!this.friends.ContainsKey(friendID)) { this.friends.Add(friendID, messengerBuddy); } this.GetClient().SendMessage(this.SerializeUpdate(messengerBuddy)); }
internal static void KickUser(GameClient ModSession, uint UserId, string Message, bool Soft) { GameClient clientByUserID = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (clientByUserID == null || clientByUserID.GetHabbo().CurrentRoomId < 1u || clientByUserID.GetHabbo().Id == ModSession.GetHabbo().Id) { return; } if (clientByUserID.GetHabbo().Rank >= ModSession.GetHabbo().Rank) { ModSession.SendNotif("You are not allowed to kick him/her."); return; } Room room = CyberEnvironment.GetGame().GetRoomManager().GetRoom(clientByUserID.GetHabbo().CurrentRoomId); if (room == null) { return; } room.GetRoomUserManager().RemoveUserFromRoom(clientByUserID, true, false); clientByUserID.CurrentRoomUserID = -1; if (!Soft) { clientByUserID.SendNotif(Message); using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.runFastQuery("UPDATE user_info SET cautions = cautions + 1 WHERE user_id = " + UserId); } } }
internal ServerMessage SerializePopularRoomTags() { Dictionary <string, int> dictionary = new Dictionary <string, int>(); ServerMessage result; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT tags, users_now FROM rooms WHERE roomtype = 'private' AND users_now > 0 ORDER BY users_now DESC LIMIT 50"); DataTable table = queryreactor.getTable(); if (table != null) { foreach (DataRow dataRow in table.Rows) { int num; if (!string.IsNullOrEmpty(dataRow["users_now"].ToString())) { num = (int)dataRow["users_now"]; } else { num = 0; } List <string> list = new List <string>(); string[] array = dataRow["tags"].ToString().Split(new char[] { ',' }); for (int i = 0; i < array.Length; i++) { string item = array[i]; list.Add(item); } foreach (string current in list) { if (dictionary.ContainsKey(current)) { Dictionary <string, int> dictionary2; string key; (dictionary2 = dictionary)[key = current] = checked (dictionary2[key] + num); } else { dictionary.Add(current, num); } } } } List <KeyValuePair <string, int> > list2 = new List <KeyValuePair <string, int> >(dictionary); list2.Sort((KeyValuePair <string, int> firstPair, KeyValuePair <string, int> nextPair) => firstPair.Value.CompareTo(nextPair.Value)); ServerMessage serverMessage = new ServerMessage(Outgoing.PopularRoomTagsMessageComposer); serverMessage.AppendInt32(list2.Count); foreach (KeyValuePair <string, int> current2 in list2) { serverMessage.AppendString(current2.Key); serverMessage.AppendInt32(current2.Value); } result = serverMessage; } return(result); }
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 UserItem(uint Id, uint BaseItem, string ExtraData, uint Group, string SongCode) { this.Id = Id; this.BaseItem = BaseItem; this.ExtraData = ExtraData; this.mBaseItem = this.GetBaseItem(); this.GroupId = Group; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT * FROM items_limited WHERE item_id=" + Id + " LIMIT 1"); DataRow row = queryreactor.getRow(); if (row != null) { this.LimitedNo = int.Parse(row[1].ToString()); this.LimitedTot = int.Parse(row[2].ToString()); } else { this.LimitedNo = 0; this.LimitedTot = 0; } } this.isWallItem = (this.mBaseItem.Type == 'i'); this.SongCode = SongCode; }
internal static RoomBot GenerateBotFromRow(DataRow Row) { uint num = Convert.ToUInt32(Row["id"]); if (Row == null) { return(null); } List <RandomSpeech> list = new List <RandomSpeech>(); DataTable table; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT text, shout FROM bots_speech WHERE bot_id = @id;"); queryreactor.addParameter("id", num); table = queryreactor.getTable(); } foreach (DataRow dataRow in table.Rows) { list.Add(new RandomSpeech((string)dataRow["text"], CyberEnvironment.EnumToBool(dataRow["shout"].ToString()))); } List <BotResponse> list2 = new List <BotResponse>(); return(new RoomBot(num, Convert.ToUInt32(Row["user_id"]), Convert.ToUInt32(Row["room_id"]), AIType.Generic, "freeroam", (string)Row["name"], (string)Row["motto"], (string)Row["look"], int.Parse(Row["x"].ToString()), int.Parse(Row["y"].ToString()), (double)int.Parse(Row["z"].ToString()), 4, 0, 0, 0, 0, ref list, ref list2, (string)Row["gender"], (int)Row["dance"], Row["is_bartender"].ToString() == "1")); }
internal AvatarEffectsInventoryComponent(uint UserId, GameClient Client, UserData Data) { this.UserId = UserId; this.Session = Client; this.Effects = new List <AvatarEffect>(); foreach (AvatarEffect current in Data.effects) { if (!current.HasExpired) { this.Effects.Add(current); } else { using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.runFastQuery(string.Concat(new object[] { "DELETE FROM user_effects WHERE user_id = ", UserId, " AND effect_id = ", current.EffectId, "; " })); } } } }
internal GenericBot(int VirtualId, int BotId, AIType Type, bool IsBartender) { int num = 7; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT speaking_interval from bots WHERE id = " + BotId); num = queryreactor.getInteger(); queryreactor.setQuery("SELECT automatic_chat from bots WHERE id = " + BotId); this.canSpeak = Convert.ToBoolean(queryreactor.getString()); queryreactor.setQuery("SELECT mix_phrases from bots WHERE id = " + BotId); this.MixPhrases = Convert.ToBoolean(queryreactor.getString()); } this.SpeechTimer = num * 1000; this.moveTimer = 0; this.virtualId = VirtualId; this.IsBartender = IsBartender; if (SpeechTimer < 2000) { SpeechTimer = 2000; } if (canSpeak || MixPhrases) { this.chatTimer = new Timer(new TimerCallback(ChatTimerTick), null, SpeechTimer, SpeechTimer); } }
internal void RegisterClient(GameClient client, uint userID, string username) { if (this.usernameRegister.Contains(username.ToLower())) { this.usernameRegister[username.ToLower()] = client; } else { this.usernameRegister.Add(username.ToLower(), client); } if (this.userIDRegister.Contains(userID)) { this.userIDRegister[userID] = client; } else { this.userIDRegister.Add(userID, client); } if (!this.usernameIdRegister.Contains(username)) { this.usernameIdRegister.Add(username, userID); } if (!this.idUsernameRegister.Contains(userID)) { this.idUsernameRegister.Add(userID, username); } using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("UPDATE users SET online='1' WHERE id=" + userID + " LIMIT 1"); } }
internal void Close(TicketStatus NewStatus, bool UpdateInDb) { this.Status = NewStatus; if (UpdateInDb) { string text; switch (NewStatus) { case TicketStatus.ABUSIVE: text = "abusive"; goto IL_41; case TicketStatus.INVALID: text = "invalid"; goto IL_41; } text = "resolved"; IL_41: using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.runFastQuery(string.Concat(new object[] { "UPDATE moderation_tickets SET status = '", text, "' WHERE id = ", this.Id })); } } }
internal static UserData GetUserData(int UserId) { DataRow dataRow; uint num; DataRow row; DataTable table; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT users.* FROM users WHERE users.id = @id"); queryreactor.addParameter("id", UserId); dataRow = queryreactor.getRow(); CyberEnvironment.GetGame().GetClientManager().LogClonesOut(Convert.ToUInt32(UserId)); if (dataRow == null) { UserData result = null; return(result); } num = Convert.ToUInt32(dataRow["id"]); if (CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(num) != null) { UserData result = null; return(result); } queryreactor.setQuery("SELECT group_id,rank FROM group_memberships WHERE user_id=" + UserId); queryreactor.getTable(); queryreactor.setQuery("SELECT * FROM user_stats WHERE id=" + num + " LIMIT 1"); row = queryreactor.getRow(); queryreactor.setQuery("SELECT * FROM user_relationships WHERE user_id=@id"); queryreactor.addParameter("id", num); table = queryreactor.getTable(); } Dictionary <string, UserAchievement> achievements = new Dictionary <string, UserAchievement>(); Dictionary <int, UserTalent> talents = new Dictionary <int, UserTalent>(); List <uint> favouritedRooms = new List <uint>(); List <uint> ignores = new List <uint>(); List <string> tags = new List <string>(); List <Badge> badges = new List <Badge>(); List <UserItem> inventory = new List <UserItem>(); List <AvatarEffect> effects = new List <AvatarEffect>(); Dictionary <uint, MessengerBuddy> friends = new Dictionary <uint, MessengerBuddy>(); Dictionary <uint, MessengerRequest> requests = new Dictionary <uint, MessengerRequest>(); HashSet <RoomData> rooms = new HashSet <RoomData>(); Dictionary <uint, Pet> pets = new Dictionary <uint, Pet>(); Dictionary <uint, int> quests = new Dictionary <uint, int>(); Dictionary <uint, RoomBot> bots = new Dictionary <uint, RoomBot>(); HashSet <GroupUser> group = new HashSet <GroupUser>(); HashSet <uint> pollData = new HashSet <uint>(); Dictionary <int, Relationship> dictionary = new Dictionary <int, Relationship>(); foreach (DataRow dataRow2 in table.Rows) { dictionary.Add((int)dataRow2[0], new Relationship((int)dataRow2[0], (int)dataRow2[2], Convert.ToInt32(dataRow2[3].ToString()))); } Habbo user = HabboFactory.GenerateHabbo(dataRow, row, group); dataRow = null; return(new UserData(num, achievements, talents, favouritedRooms, ignores, tags, null, badges, inventory, effects, friends, requests, rooms, pets, quests, user, bots, dictionary, pollData, 0)); }
internal void GiveBadge(string Badge, bool InDatabase, GameClient Session, bool WiredReward = false) { if (WiredReward) { Session.SendMessage(this.SerializeBadgeReward(!this.HasBadge(Badge))); } if (this.HasBadge(Badge)) { return; } if (InDatabase) { using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery(string.Concat(new object[] { "INSERT INTO user_badges (user_id,badge_id,badge_slot) VALUES (", this.UserId, ",@badge,", 0, ")" })); queryreactor.addParameter("badge", Badge); queryreactor.runQuery(); } } this.Badges.Add(Badge, new Badge(Badge, 0)); Session.SendMessage(this.SerializeBadge(Badge)); Session.SendMessage(this.Update(Badge)); }
public void OnPlace(GameClient Session, RoomItem Item) { checked { Item.GetRoom().GetRoomItemHandler().HopperCount++; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("INSERT INTO items_hopper (hopper_id, room_id) VALUES (@hopperid, @roomid);"); queryreactor.addParameter("hopperid", Item.Id); queryreactor.addParameter("roomid", Item.RoomId); queryreactor.runQuery(); } if (Item.InteractingUser != 0u) { RoomUser roomUserByHabbo = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Item.InteractingUser); if (roomUserByHabbo != null) { roomUserByHabbo.ClearMovement(true); roomUserByHabbo.AllowOverride = false; roomUserByHabbo.CanWalk = true; } Item.InteractingUser = 0u; } } }
internal void ActivateQuest(GameClient Session, ClientMessage Message) { Quest quest = this.GetQuest(Message.PopWiredUInt()); if (quest == null) { return; } using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.runFastQuery(string.Concat(new object[] { "REPLACE INTO user_quests(user_id,quest_id) VALUES (", Session.GetHabbo().Id, ", ", quest.Id, ")" })); queryreactor.runFastQuery(string.Concat(new object[] { "UPDATE user_stats SET quest_id = ", quest.Id, " WHERE id = ", Session.GetHabbo().Id })); } Session.GetHabbo().CurrentQuestId = quest.Id; this.GetList(Session, null); Session.SendMessage(QuestStartedComposer.Compose(Session, quest)); }
internal void RemoveFromDatabase() { using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.runFastQuery("DELETE FROM items_rooms_songs WHERE itemid = " + this.itemID); } }
internal void InitMessenger() { GameClient client = this.GetClient(); if (client == null) { return; } this.Messenger.OnStatusChanged(false); client.SendMessage(this.Messenger.SerializeFriends()); client.SendMessage(this.Messenger.SerializeRequests()); if (CyberEnvironment.OfflineMessages.ContainsKey(this.Id)) { List <OfflineMessage> list = CyberEnvironment.OfflineMessages[this.Id]; foreach (OfflineMessage current in list) { client.SendMessage(this.Messenger.SerializeOfflineMessages(current)); } CyberEnvironment.OfflineMessages.Remove(this.Id); OfflineMessage.RemoveAllMessages(CyberEnvironment.GetDatabaseManager().getQueryReactor(), this.Id); } if ((long)this.Messenger.requests.Count > (long)((ulong)CyberEnvironment.FriendRequestLimit)) { client.SendNotif("¡Tienes muchos amigos! No puedes tener más."); } }
internal static void PerformRoomAction(GameClient ModSession, uint RoomId, bool KickUsers, bool LockRoom, bool InappropriateRoom, ServerMessage Message) { Room room = CyberEnvironment.GetGame().GetRoomManager().GetRoom(RoomId); if (room == null) { return; } if (LockRoom) { room.State = 1; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.runFastQuery("UPDATE rooms SET state = 'locked' WHERE id = " + room.RoomId); } } if (InappropriateRoom) { room.Name = "Inappropiate to Hotel Management."; room.Description = "Your room description is not allowed."; room.ClearTags(); room.RoomData.SerializeRoomData(Message, false, ModSession, true); } if (KickUsers) { room.onRoomKick(); } }
internal void SendNewTicket(GameClient Session, int Category, uint ReportedUser, string Message, int type, List <string> Messages) { UInt32 Id = 0; if (Session.GetHabbo().CurrentRoomId <= 0) { using (IQueryAdapter DBClient = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { DBClient.setQuery(string.Concat(new object[] { "INSERT INTO moderation_tickets (score,type,status,sender_id,reported_id,moderator_id,message,room_id,room_name,timestamp) VALUES (1,'", Category, "','open','", Session.GetHabbo().Id, "','", ReportedUser, "','0',@message,'0','','", CyberEnvironment.GetUnixTimestamp(), "')" })); DBClient.addParameter("message", Message); Id = (uint)DBClient.insertQuery(); DBClient.runFastQuery("UPDATE user_info SET cfhs = cfhs + 1 WHERE user_id = " + Session.GetHabbo().Id); } SupportTicket Ticket = new SupportTicket(Id, 1, type, Session.GetHabbo().Id, ReportedUser, Message, 0u, "", (double)CyberEnvironment.GetUnixTimestamp(), Messages); this.Tickets.Add(Ticket); ModerationTool.SendTicketToModerators(Ticket); return; } RoomData Data = CyberEnvironment.GetGame().GetRoomManager().GenerateNullableRoomData(Session.GetHabbo().CurrentRoomId); using (IQueryAdapter DBClient = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { DBClient.setQuery(string.Concat(new object[] { "INSERT INTO moderation_tickets (score,type,status,sender_id,reported_id,moderator_id,message,room_id,room_name,timestamp) VALUES (1,'", Category, "','open','", Session.GetHabbo().Id, "','", ReportedUser, "','0',@message,'", Data.Id, "',@name,'", CyberEnvironment.GetUnixTimestamp(), "')" })); DBClient.addParameter("message", Message); DBClient.addParameter("name", Data.Name); Id = (uint)DBClient.insertQuery(); DBClient.runFastQuery("UPDATE user_info SET cfhs = cfhs + 1 WHERE user_id = " + Session.GetHabbo().Id); } SupportTicket Ticket2 = new SupportTicket(Id, 1, type, Session.GetHabbo().Id, ReportedUser, Message, 0u, "", (double)CyberEnvironment.GetUnixTimestamp(), Messages); this.Tickets.Add(Ticket2); ModerationTool.SendTicketToModerators(Ticket2); }
internal static ServerMessage SerializeTicketChatlog(SupportTicket Ticket, RoomData RoomData, double Timestamp) { ServerMessage result; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery(string.Concat(new object[] { "SELECT user_id,timestamp,message FROM chatlogs WHERE room_id = ", RoomData.Id, " AND (timestamp >= ", Timestamp - 300.0, " AND timestamp <= ", Timestamp, ") OR (timestamp >= ", Timestamp - 300.0, " AND timestamp = 0) ORDER BY timestamp DESC LIMIT 150" })); DataTable table = queryreactor.getTable(); ServerMessage serverMessage = new ServerMessage(Outgoing.ModerationToolIssueChatlogMessageComposer); serverMessage.AppendUInt(Ticket.TicketId); serverMessage.AppendUInt(Ticket.SenderId); serverMessage.AppendUInt(Ticket.ReportedId); serverMessage.AppendUInt(RoomData.Id); serverMessage.AppendBoolean(false); serverMessage.AppendUInt(RoomData.Id); serverMessage.AppendString(RoomData.Name); if (table != null) { serverMessage.AppendInt32(table.Rows.Count); IEnumerator enumerator = table.Rows.GetEnumerator(); try { while (enumerator.MoveNext()) { DataRow dataRow = (DataRow)enumerator.Current; Habbo habboForId = CyberEnvironment.getHabboForId(Convert.ToUInt32(dataRow["user_id"])); serverMessage.AppendInt32(CyberEnvironment.UnixToDateTime(Convert.ToDouble(dataRow["timestamp"])).Minute); serverMessage.AppendUInt(habboForId.Id); serverMessage.AppendString(habboForId.Username); serverMessage.AppendString((string)dataRow["message"]); } goto IL_1B8; } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } } serverMessage.AppendInt32(0); IL_1B8: result = serverMessage; } return(result); }
internal void Disable() { this.Enabled = false; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.runFastQuery("UPDATE room_items_moodlight SET enabled = '0' WHERE item_id = " + this.ItemId); } }
internal void reloaditems() { using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { this.ItemManager.LoadItems(queryreactor); this.globalInventory = new InventoryGlobal(); } }