public MoodlightData(int ItemId) { this.ItemId = ItemId; DataRow Row = null; using (IQueryAdapter dbClient = BiosEmuThiago.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 = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.runFastQuery("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 = BiosEmuThiago.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 OnNewFriendship(int friendID) { GameClient friend = BiosEmuThiago.GetGame().GetClientManager().GetClientByUserID(friendID); MessengerBuddy newFriend; if (friend == null || friend.GetHabbo() == null) { DataRow dRow; using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT id,username,motto,look,last_online,hide_inroom,hide_online FROM users WHERE `id` = @friendid LIMIT 1"); dbClient.AddParameter("friendid", friendID); dRow = dbClient.getRow(); } newFriend = new MessengerBuddy(friendID, Convert.ToString(dRow["username"]), Convert.ToString(dRow["look"]), Convert.ToString(dRow["motto"]), Convert.ToInt32(dRow["last_online"]), BiosEmuThiago.EnumToBool(dRow["hide_online"].ToString()), BiosEmuThiago.EnumToBool(dRow["hide_inroom"].ToString())); } else { Habbo user = friend.GetHabbo(); newFriend = new MessengerBuddy(friendID, user.Username, user.Look, user.Motto, 0, user.AppearOffline, user.AllowPublicRoomStatus); newFriend.UpdateUser(friend); } if (!_friends.ContainsKey(friendID)) { _friends.Add(friendID, newFriend); } GetClient().SendMessage(SerializeUpdate(newFriend)); }
public static MoodlightPreset GeneratePreset(string Data) { String[] Bits = Data.Split(','); if (!IsValidColor(Bits[0])) { Bits[0] = "#000000"; } return(new MoodlightPreset(Bits[0], int.Parse(Bits[1]), BiosEmuThiago.EnumToBool(Bits[2]))); }
public static Habbo GenerateHabbo(DataRow Row, DataRow UserInfo) { return(new Habbo(Convert.ToInt32(Row["id"]), Convert.ToString(Row["username"]), Convert.ToInt32(Row["rank"]), Convert.ToString(Row["motto"]), Convert.ToString(Row["look"]), Convert.ToString(Row["gender"]), Convert.ToInt32(Row["credits"]), Convert.ToInt32(Row["activity_points"]), Convert.ToInt32(Row["home_room"]), BiosEmuThiago.EnumToBool(Row["block_newfriends"].ToString()), Convert.ToInt32(Row["last_online"]), BiosEmuThiago.EnumToBool(Row["hide_online"].ToString()), BiosEmuThiago.EnumToBool(Row["hide_inroom"].ToString()), Convert.ToDouble(Row["account_created"]), Convert.ToInt32(Row["vip_points"]), Convert.ToString(Row["machine_id"]), (Row["nux_user"].ToString() == "true"), BiosEmuThiago.EnumToBool(Row["is_nuevo"].ToString()), Convert.ToString(Row["volume"]), BiosEmuThiago.EnumToBool(Row["chat_preference"].ToString()), BiosEmuThiago.EnumToBool(Row["focus_preference"].ToString()), BiosEmuThiago.EnumToBool(Row["pets_muted"].ToString()), BiosEmuThiago.EnumToBool(Row["bots_muted"].ToString()), BiosEmuThiago.EnumToBool(Row["advertising_report_blocked"].ToString()), Convert.ToDouble(Row["last_change"].ToString()), Convert.ToInt32(Row["gotw_points"]), Convert.ToInt32(Row["user_points"]), BiosEmuThiago.EnumToBool(Convert.ToString(Row["ignore_invites"])), Convert.ToDouble(Row["time_muted"]), Convert.ToDouble(UserInfo["trading_locked"]), BiosEmuThiago.EnumToBool(Row["allow_gifts"].ToString()), Convert.ToInt32(Row["friend_bar_state"]), BiosEmuThiago.EnumToBool(Row["disable_forced_effects"].ToString()), BiosEmuThiago.EnumToBool(Row["allow_mimic"].ToString()), BiosEmuThiago.EnumToBool(Row["allow_events"].ToString()), Convert.ToInt32(Row["rank_vip"]), Convert.ToString(Row["name_color"]), Convert.ToString(Row["bubble_color"]), Convert.ToString(Row["prefix_name"]), Convert.ToString(Row["prefix_name_color"]), Convert.ToInt32(Row["bubble_id"]), Convert.ToByte(Row["publi"]), Convert.ToByte(Row["guia"].ToString()), Convert.ToByte(Row["builder"].ToString()), Convert.ToByte(Row["croupier"].ToString()), Row["talent_status"].ToString(), Convert.ToByte(Row["targeted_buy"]), Convert.ToInt32(Row["bonus_points"]))); }
public void InitBots() { using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `id`,`room_id`,`name`,`motto`,`look`,`x`,`y`,`z`,`rotation`,`gender`,`user_id`,`ai_type`,`walk_mode`,`automatic_chat`,`speaking_interval`,`mix_sentences`,`chat_bubble` FROM `bots` WHERE `room_id` = '" + RoomId + "' AND `ai_type` != 'pet'"); DataTable Data = dbClient.getTable(); if (Data == null) { return; } foreach (DataRow Bot in Data.Rows) { dbClient.SetQuery("SELECT `text` FROM `bots_speech` WHERE `bot_id` = '" + Convert.ToInt32(Bot["id"]) + "'"); DataTable BotSpeech = dbClient.getTable(); List <RandomSpeech> Speeches = new List <RandomSpeech>(); foreach (DataRow Speech in BotSpeech.Rows) { Speeches.Add(new RandomSpeech(Convert.ToString(Speech["text"]), Convert.ToInt32(Bot["id"]))); } _roomUserManager.DeployBot(new RoomBot(Convert.ToInt32(Bot["id"]), Convert.ToInt32(Bot["room_id"]), Convert.ToString(Bot["ai_type"]), Convert.ToString(Bot["walk_mode"]), Convert.ToString(Bot["name"]), Convert.ToString(Bot["motto"]), Convert.ToString(Bot["look"]), int.Parse(Bot["x"].ToString()), int.Parse(Bot["y"].ToString()), int.Parse(Bot["z"].ToString()), int.Parse(Bot["rotation"].ToString()), 0, 0, 0, 0, ref Speeches, "M", 0, Convert.ToInt32(Bot["user_id"].ToString()), Convert.ToBoolean(Bot["automatic_chat"]), Convert.ToInt32(Bot["speaking_interval"]), BiosEmuThiago.EnumToBool(Bot["mix_sentences"].ToString()), Convert.ToInt32(Bot["chat_bubble"])), null); } } }
/// <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 = BiosEmuThiago.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"]), BiosEmuThiago.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 Init() { if (_games.Count > 0) { _games.Clear(); } using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { DataTable GetData = null; dbClient.SetQuery("SELECT `id`,`name`,`colour_one`,`colour_two`,`resource_path`,`string_three`,`game_swf`,`game_assets`,`game_server_host`,`game_server_port`,`socket_policy_port`,`game_enabled` FROM `games_config`"); GetData = dbClient.getTable(); if (GetData != null) { foreach (DataRow Row in GetData.Rows) { _games.Add(Convert.ToInt32(Row["id"]), new GameData(Convert.ToInt32(Row["id"]), Convert.ToString(Row["name"]), Convert.ToString(Row["colour_one"]), Convert.ToString(Row["colour_two"]), Convert.ToString(Row["resource_path"]), Convert.ToString(Row["string_three"]), Convert.ToString(Row["game_swf"]), Convert.ToString(Row["game_assets"]), Convert.ToString(Row["game_server_host"]), Convert.ToString(Row["game_server_port"]), Convert.ToString(Row["socket_policy_port"]), BiosEmuThiago.EnumToBool(Row["game_enabled"].ToString()))); } } } log.Info("» Jogos do Bios Emulador -> PRONTO - BY: Thiago Araujo"); }
public bool RequestBuddy(string UserQuery) { int userID; bool hasFQDisabled; GameClient client = BiosEmuThiago.GetGame().GetClientManager().GetClientByUsername(UserQuery); if (client == null) { DataRow Row = null; using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `id`,`block_newfriends` FROM `users` WHERE `username` = @query LIMIT 1"); dbClient.AddParameter("query", UserQuery.ToLower()); Row = dbClient.getRow(); } if (Row == null) { return(false); } userID = Convert.ToInt32(Row["id"]); hasFQDisabled = BiosEmuThiago.EnumToBool(Row["block_newfriends"].ToString()); } else { userID = client.GetHabbo().Id; hasFQDisabled = client.GetHabbo().AllowFriendRequests; } if (hasFQDisabled) { GetClient().SendMessage(new MessengerErrorComposer(39, 3)); return(false); } int ToId = userID; if (RequestExists(ToId)) { return(true); } using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("REPLACE INTO `messenger_requests` (`from_id`,`to_id`) VALUES ('" + _userId + "','" + ToId + "')"); } BiosEmuThiago.GetGame().GetQuestManager().ProgressUserQuest(GetClient(), QuestType.ADD_FRIENDS); GameClient ToUser = BiosEmuThiago.GetGame().GetClientManager().GetClientByUserID(ToId); if (ToUser == null || ToUser.GetHabbo() == null) { return(true); } MessengerRequest Request = new MessengerRequest(ToId, _userId, BiosEmuThiago.GetGame().GetClientManager().GetNameById(_userId)); ToUser.GetHabbo().GetMessenger().OnNewRequest(_userId); UserCache ThisUser = BiosEmuThiago.GetGame().GetCacheManager().GenerateUser(_userId); if (ThisUser != null) { ToUser.SendMessage(new NewBuddyRequestComposer(ThisUser)); } _requests.Add(ToId, Request); return(true); }
public void LoadModels() { if (this._roomModels.Count > 0) { _roomModels.Clear(); } using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT id,door_x,door_y,door_z,door_dir,heightmap,public_items,club_only,poolmap,`wall_height` FROM `room_models` WHERE `custom` = '0'"); DataTable Data = dbClient.getTable(); if (Data == null) { return; } foreach (DataRow Row in Data.Rows) { string Modelname = Convert.ToString(Row["id"]); string staticFurniture = Convert.ToString(Row["public_items"]); _roomModels.Add(Modelname, new RoomModel(Convert.ToInt32(Row["door_x"]), Convert.ToInt32(Row["door_y"]), (Double)Row["door_z"], Convert.ToInt32(Row["door_dir"]), Convert.ToString(Row["heightmap"]), Convert.ToString(Row["public_items"]), BiosEmuThiago.EnumToBool(Row["club_only"].ToString()), Convert.ToString(Row["poolmap"]), Convert.ToInt32(Row["wall_height"]))); } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) { return; } Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } DynamicRoomModel Model = Room.GetGameMap().Model; if (Model == null) { return; } ICollection <Item> FloorItems = Room.GetRoomItemHandler().GetFloor; Session.SendMessage(new FloorPlanFloorMapComposer(FloorItems)); Session.SendMessage(new FloorPlanSendDoorComposer(Model.DoorX, Model.DoorY, Model.DoorOrientation)); Session.SendMessage(new RoomVisualizationSettingsComposer(Room.WallThickness, Room.FloorThickness, BiosEmuThiago.EnumToBool(Room.Hidewall.ToString()))); }
public void Fill(DataRow Row) { Id = Convert.ToInt32(Row["id"]); Name = Convert.ToString(Row["caption"]); Description = Convert.ToString(Row["description"]); Type = Convert.ToString(Row["roomtype"]); OwnerId = Convert.ToInt32(Row["owner"]); OwnerName = ""; using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `username` FROM `users` WHERE `id` = @owner LIMIT 1"); dbClient.AddParameter("owner", OwnerId); string result = dbClient.getString(); if (!String.IsNullOrEmpty(result)) { OwnerName = result; } } this.Access = RoomAccessUtility.ToRoomAccess(Row["state"].ToString().ToLower()); Category = Convert.ToInt32(Row["category"]); if (!string.IsNullOrEmpty(Row["users_now"].ToString())) { UsersNow = Convert.ToInt32(Row["users_now"]); } else { UsersNow = 0; } UsersMax = Convert.ToInt32(Row["users_max"]); ModelName = Convert.ToString(Row["model_name"]); Score = Convert.ToInt32(Row["score"]); Tags = new List <string>(); AllowPets = Convert.ToInt32(Row["allow_pets"].ToString()); AllowPetsEating = Convert.ToInt32(Row["allow_pets_eat"].ToString()); RoomBlockingEnabled = Convert.ToInt32(Row["room_blocking_disabled"].ToString()); Hidewall = Convert.ToInt32(Row["allow_hidewall"].ToString()); Password = Convert.ToString(Row["password"]); Wallpaper = Convert.ToString(Row["wallpaper"]); Floor = Convert.ToString(Row["floor"]); Landscape = Convert.ToString(Row["landscape"]); FloorThickness = Convert.ToInt32(Row["floorthick"]); WallThickness = Convert.ToInt32(Row["wallthick"]); WhoCanMute = Convert.ToInt32(Row["mute_settings"]); WhoCanKick = Convert.ToInt32(Row["kick_settings"]); WhoCanBan = Convert.ToInt32(Row["ban_settings"]); chatMode = Convert.ToInt32(Row["chat_mode"]); chatSpeed = Convert.ToInt32(Row["chat_speed"]); chatSize = Convert.ToInt32(Row["chat_size"]); TradeSettings = Convert.ToInt32(Row["trade_settings"]); Group G = null; if (BiosEmuThiago.GetGame().GetGroupManager().TryGetGroup(Convert.ToInt32(Row["group_id"]), out G)) { Group = G; } else { Group = null; } foreach (string Tag in Row["tags"].ToString().Split(',')) { Tags.Add(Tag); } mModel = BiosEmuThiago.GetGame().GetRoomManager().GetModel(ModelName); this.PushEnabled = BiosEmuThiago.EnumToBool(Row["push_enabled"].ToString()); this.PullEnabled = BiosEmuThiago.EnumToBool(Row["pull_enabled"].ToString()); this.SPushEnabled = BiosEmuThiago.EnumToBool(Row["spush_enabled"].ToString()); this.SPullEnabled = BiosEmuThiago.EnumToBool(Row["spull_enabled"].ToString()); this.EnablesEnabled = BiosEmuThiago.EnumToBool(Row["enables_enabled"].ToString()); this.RespectNotificationsEnabled = BiosEmuThiago.EnumToBool(Row["respect_notifications_enabled"].ToString()); this.PetMorphsAllowed = BiosEmuThiago.EnumToBool(Row["pet_morphs_allowed"].ToString()); WiredScoreBordDay = new Dictionary <int, KeyValuePair <int, string> >(); WiredScoreBordWeek = new Dictionary <int, KeyValuePair <int, string> >(); WiredScoreBordMonth = new Dictionary <int, KeyValuePair <int, string> >(); using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { List <bool> SuperCheck = new List <bool>() { false, false, false }; DateTime now = DateTime.Now; int getdaytoday = Convert.ToInt32(now.ToString("MMddyyyy")); int getmonthtoday = Convert.ToInt32(now.ToString("MM")); int getweektoday = CultureInfo.GetCultureInfo("Nl-nl").Calendar.GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday); this.WiredScoreFirstBordInformation = new List <int>() { getdaytoday, getmonthtoday, getweektoday }; dbClient.SetQuery("SELECT * FROM wired_scorebord WHERE roomid = @id ORDER BY `punten` DESC "); dbClient.AddParameter("id", this.Id); foreach (DataRow row in dbClient.getTable().Rows) { int userid = Convert.ToInt32(row["userid"]); string username = Convert.ToString(row["username"]); int Punten = Convert.ToInt32(row["punten"]); string soort = Convert.ToString(row["soort"]); int timestamp = Convert.ToInt32(row["timestamp"]); if ((!(soort == "day") || this.WiredScoreBordDay.ContainsKey(userid) ? false : !SuperCheck[0])) { if (timestamp != getdaytoday) { SuperCheck[0] = false; } if (!SuperCheck[0]) { this.WiredScoreBordDay.Add(userid, new KeyValuePair <int, string>(Punten, username)); } } if ((!(soort == "month") || this.WiredScoreBordMonth.ContainsKey(userid) ? false : !SuperCheck[1])) { if (timestamp != getmonthtoday) { SuperCheck[1] = false; } this.WiredScoreBordMonth.Add(userid, new KeyValuePair <int, string>(Punten, username)); } if ((!(soort == "week") || this.WiredScoreBordWeek.ContainsKey(userid) ? false : !SuperCheck[2])) { if (timestamp != getweektoday) { SuperCheck[2] = false; } this.WiredScoreBordWeek.Add(userid, new KeyValuePair <int, string>(Punten, username)); } } if (SuperCheck[0]) { dbClient.RunQuery(string.Concat("DELETE FROM `wired_scorebord` WHERE `roomid`='", this.Id, "' AND `soort`='day'")); this.WiredScoreBordDay.Clear(); } if (SuperCheck[1]) { dbClient.RunQuery(string.Concat("DELETE FROM `wired_scorebord` WHERE `roomid`='", this.Id, "' AND `soort`='month'")); this.WiredScoreBordMonth.Clear(); } if (SuperCheck[2]) { dbClient.RunQuery(string.Concat("DELETE FROM `wired_scorebord` WHERE `roomid`='", this.Id, "' AND `soort`='week'")); this.WiredScoreBordDay.Clear(); } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null) { return; } Room Room = BiosEmuThiago.GetGame().GetRoomManager().LoadRoom(Packet.PopInt()); if (Room == null || !Room.CheckRights(Session, true)) { return; } string word; string Name = Packet.PopString(); Name = BiosEmuThiago.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Name, out word) ? "Spam" : Name; string Description = Packet.PopString(); Description = BiosEmuThiago.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Description, out word) ? "Spam" : Description; RoomAccess Access = RoomAccessUtility.ToRoomAccess(Packet.PopInt()); string Password = Packet.PopString(); int MaxUsers = Packet.PopInt(); int CategoryId = Packet.PopInt(); int TagCount = Packet.PopInt(); List <string> Tags = new List <string>(); StringBuilder formattedTags = new StringBuilder(); for (int i = 0; i < TagCount; i++) { if (i > 0) { formattedTags.Append(","); } string tag = Packet.PopString().ToLower(); Tags.Add(tag); formattedTags.Append(tag); } int TradeSettings = Packet.PopInt();//2 = All can trade, 1 = owner only, 0 = no trading. int AllowPets = Convert.ToInt32(BiosEmuThiago.BoolToEnum(Packet.PopBoolean())); int AllowPetsEat = Convert.ToInt32(BiosEmuThiago.BoolToEnum(Packet.PopBoolean())); int RoomBlockingEnabled = Convert.ToInt32(BiosEmuThiago.BoolToEnum(Packet.PopBoolean())); int Hidewall = Convert.ToInt32(BiosEmuThiago.BoolToEnum(Packet.PopBoolean())); int WallThickness = Packet.PopInt(); int FloorThickness = Packet.PopInt(); int WhoMute = Packet.PopInt(); // mute int WhoKick = Packet.PopInt(); // kick int WhoBan = Packet.PopInt(); // ban int chatMode = Packet.PopInt(); int chatSize = Packet.PopInt(); int chatSpeed = Packet.PopInt(); int chatDistance = Packet.PopInt(); int extraFlood = Packet.PopInt(); if (chatMode < 0 || chatMode > 1) { chatMode = 0; } if (chatSize < 0 || chatSize > 2) { chatSize = 0; } if (chatSpeed < 0 || chatSpeed > 2) { chatSpeed = 0; } if (chatDistance < 0) { chatDistance = 1; } if (chatDistance > 99) { chatDistance = 100; } if (extraFlood < 0 || extraFlood > 2) { extraFlood = 0; } if (TradeSettings < 0 || TradeSettings > 2) { TradeSettings = 0; } if (WhoMute < 0 || WhoMute > 1) { WhoMute = 0; } if (WhoKick < 0 || WhoKick > 1) { WhoKick = 0; } if (WhoBan < 0 || WhoBan > 1) { WhoBan = 0; } if (WallThickness < -2 || WallThickness > 1) { WallThickness = 0; } if (FloorThickness < -2 || FloorThickness > 1) { FloorThickness = 0; } if (Name.Length < 1) { return; } if (Name.Length > 60) { Name = Name.Substring(0, 60); } if (Access == RoomAccess.PASSWORD && Password.Length == 0) { Access = RoomAccess.OPEN; } if (MaxUsers < 0) { MaxUsers = 10; } if (MaxUsers > 50) { MaxUsers = 50; } SearchResultList SearchResultList = null; if (!BiosEmuThiago.GetGame().GetNavigator().TryGetSearchResultList(CategoryId, out SearchResultList)) { CategoryId = 36; } if (SearchResultList.CategoryType != NavigatorCategoryType.CATEGORY || SearchResultList.RequiredRank > Session.GetHabbo().Rank || (Session.GetHabbo().Id != Room.OwnerId && Session.GetHabbo().Rank >= SearchResultList.RequiredRank)) { CategoryId = 36; } if (TagCount > 2) { return; } Room.AllowPets = AllowPets; Room.AllowPetsEating = AllowPetsEat; Room.RoomBlockingEnabled = RoomBlockingEnabled; Room.Hidewall = Hidewall; Room.RoomData.AllowPets = AllowPets; Room.RoomData.AllowPetsEating = AllowPetsEat; Room.RoomData.RoomBlockingEnabled = RoomBlockingEnabled; Room.RoomData.Hidewall = Hidewall; Room.Name = Name; Room.Access = Access; Room.Description = Description; Room.Category = CategoryId; Room.Password = Password; Room.RoomData.Name = Name; Room.RoomData.Access = Access; Room.RoomData.Description = Description; Room.RoomData.Category = CategoryId; Room.RoomData.Password = Password; Room.WhoCanBan = WhoBan; Room.WhoCanKick = WhoKick; Room.WhoCanMute = WhoMute; Room.RoomData.WhoCanBan = WhoBan; Room.RoomData.WhoCanKick = WhoKick; Room.RoomData.WhoCanMute = WhoMute; Room.ClearTags(); Room.AddTagRange(Tags); Room.UsersMax = MaxUsers; Room.RoomData.Tags.Clear(); Room.RoomData.Tags.AddRange(Tags); Room.RoomData.UsersMax = MaxUsers; Room.WallThickness = WallThickness; Room.FloorThickness = FloorThickness; Room.RoomData.WallThickness = WallThickness; Room.RoomData.FloorThickness = FloorThickness; Room.chatMode = chatMode; Room.chatSize = chatSize; Room.chatSpeed = chatSpeed; Room.chatDistance = chatDistance; Room.extraFlood = extraFlood; Room.TradeSettings = TradeSettings; Room.RoomData.chatMode = chatMode; Room.RoomData.chatSize = chatSize; Room.RoomData.chatSpeed = chatSpeed; Room.RoomData.chatDistance = chatDistance; Room.RoomData.extraFlood = extraFlood; Room.RoomData.TradeSettings = TradeSettings; string AccessStr = Password.Length > 0 ? "password" : "open"; switch (Access) { default: case RoomAccess.OPEN: AccessStr = "open"; break; case RoomAccess.PASSWORD: AccessStr = "password"; break; case RoomAccess.DOORBELL: AccessStr = "locked"; break; case RoomAccess.INVISIBLE: AccessStr = "invisible"; break; } using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE rooms SET caption = @caption, description = @description, password = @password, category = " + CategoryId + ", state = '" + AccessStr + "', tags = @tags, users_max = " + MaxUsers + ", allow_pets = '" + AllowPets + "', allow_pets_eat = '" + AllowPetsEat + "', room_blocking_disabled = '" + RoomBlockingEnabled + "', allow_hidewall = '" + Room.Hidewall + "', floorthick = " + Room.FloorThickness + ", wallthick = " + Room.WallThickness + ", mute_settings='" + Room.WhoCanMute + "', kick_settings='" + Room.WhoCanKick + "',ban_settings='" + Room.WhoCanBan + "', `chat_mode` = '" + Room.chatMode + "', `chat_size` = '" + Room.chatSize + "', `chat_speed` = '" + Room.chatSpeed + "', `chat_extra_flood` = '" + Room.extraFlood + "', `chat_hearing_distance` = '" + Room.chatDistance + "', `trade_settings` = '" + Room.TradeSettings + "' WHERE `id` = '" + Room.RoomId + "' LIMIT 1"); dbClient.AddParameter("caption", Room.Name); dbClient.AddParameter("description", Room.Description); dbClient.AddParameter("password", Room.Password); dbClient.AddParameter("tags", formattedTags.ToString()); dbClient.RunQuery(); } Room.GetGameMap().GenerateMaps(); if (Session.GetHabbo().CurrentRoom == null) { Session.SendMessage(new RoomSettingsSavedComposer(Room.RoomId)); Session.SendMessage(new RoomInfoUpdatedComposer(Room.RoomId)); Session.SendMessage(new RoomVisualizationSettingsComposer(Room.WallThickness, Room.FloorThickness, BiosEmuThiago.EnumToBool(Room.Hidewall.ToString()))); } else { Room.SendMessage(new RoomSettingsSavedComposer(Room.RoomId)); Room.SendMessage(new RoomInfoUpdatedComposer(Room.RoomId)); Room.SendMessage(new RoomVisualizationSettingsComposer(Room.WallThickness, Room.FloorThickness, BiosEmuThiago.EnumToBool(Room.Hidewall.ToString()))); } BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModDoorModeSeen", 1); BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModWalkthroughSeen", 1); BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModChatScrollSpeedSeen", 1); BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModChatFloodFilterSeen", 1); BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModChatHearRangeSeen", 1); }
public void Init() { if (_items.Count > 0) { _items.Clear(); } using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `furniture`"); DataTable ItemData = dbClient.getTable(); if (ItemData != null) { foreach (DataRow Row in ItemData.Rows) { try { int id = Convert.ToInt32(Row["id"]); int spriteID = Convert.ToInt32(Row["sprite_id"]); string itemName = Convert.ToString(Row["item_name"]); string PublicName = Convert.ToString(Row["public_name"]); string type = Row["type"].ToString(); int width = Convert.ToInt32(Row["width"]); int length = Convert.ToInt32(Row["length"]); double height = Convert.ToDouble(Row["stack_height"]); bool allowStack = BiosEmuThiago.EnumToBool(Row["can_stack"].ToString()); bool allowWalk = BiosEmuThiago.EnumToBool(Row["is_walkable"].ToString()); bool allowSit = BiosEmuThiago.EnumToBool(Row["can_sit"].ToString()); bool allowRecycle = BiosEmuThiago.EnumToBool(Row["allow_recycle"].ToString()); bool allowTrade = BiosEmuThiago.EnumToBool(Row["allow_trade"].ToString()); bool allowMarketplace = Convert.ToInt32(Row["allow_marketplace_sell"]) == 1; bool allowGift = Convert.ToInt32(Row["allow_gift"]) == 1; bool allowInventoryStack = BiosEmuThiago.EnumToBool(Row["allow_inventory_stack"].ToString()); InteractionType interactionType = InteractionTypes.GetTypeFromString(Convert.ToString(Row["interaction_type"])); int behaviourData = Convert.ToInt32(Row["behaviour_data"]); int cycleCount = Convert.ToInt32(Row["interaction_modes_count"]); string vendingIDS = Convert.ToString(Row["vending_ids"]); string heightAdjustable = Convert.ToString(Row["height_adjustable"]); int EffectId = Convert.ToInt32(Row["effect_id"]); int WiredId = Convert.ToInt32(Row["wired_id"]); bool IsRare = BiosEmuThiago.EnumToBool(Row["is_rare"].ToString()); int ClothingId = Convert.ToInt32(Row["clothing_id"]); bool ExtraRot = BiosEmuThiago.EnumToBool(Row["extra_rot"].ToString()); if (!_gifts.ContainsKey(spriteID)) { _gifts.Add(spriteID, new ItemData(id, spriteID, itemName, PublicName, type, width, length, height, allowStack, allowWalk, allowSit, allowRecycle, allowTrade, allowMarketplace, allowGift, allowInventoryStack, interactionType, behaviourData, cycleCount, vendingIDS, heightAdjustable, EffectId, WiredId, IsRare, ClothingId, ExtraRot)); } if (!_items.ContainsKey(id)) { _items.Add(id, new ItemData(id, spriteID, itemName, PublicName, type, width, length, height, allowStack, allowWalk, allowSit, allowRecycle, allowTrade, allowMarketplace, allowGift, allowInventoryStack, interactionType, behaviourData, cycleCount, vendingIDS, heightAdjustable, EffectId, WiredId, IsRare, ClothingId, ExtraRot)); } } catch (Exception e) { Console.WriteLine(e.ToString()); Console.ReadKey(); log.Warn("Could not load item #" + Convert.ToInt32(Row[0]) + ", please verify the data is okay."); } } } } log.Info("» Administrador de Items -> PRONTO - BY: Thiago Araujo"); }
public static UserData GetUserData(string SessionTicket, out byte errorCode) { int UserId; DataRow dUserInfo = null; DataTable dAchievements = null; DataTable dFavouriteRooms = null; DataTable dBadges = null; DataTable dFriends = null; DataTable dRequests = null; DataTable dRooms = null; DataTable tagsTable; DataTable dQuests = null; DataTable dRelations = null; DataTable talentsTable = null; DataRow UserInfo = null; DataTable Subscriptions = null; using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM users WHERE auth_ticket = @sso LIMIT 1"); dbClient.AddParameter("sso", SessionTicket); dUserInfo = dbClient.getRow(); if (dUserInfo == null) { errorCode = 1; return(null); } UserId = Convert.ToInt32(dUserInfo["id"]); if (BiosEmuThiago.GetGame().GetClientManager().GetClientByUserID(UserId) != null) { errorCode = 2; BiosEmuThiago.GetGame().GetClientManager().GetClientByUserID(UserId).Disconnect(); return(null); } dbClient.SetQuery("SELECT `group`,`level`,`progress` FROM `user_achievements` WHERE `userid` = '" + UserId + "'"); dAchievements = dbClient.getTable(); dbClient.SetQuery("SELECT room_id FROM user_favorites WHERE `user_id` = '" + UserId + "'"); dFavouriteRooms = dbClient.getTable(); dbClient.SetQuery("SELECT `badge_id`,`badge_slot` FROM user_badges WHERE `user_id` = '" + UserId + "'"); dBadges = dbClient.getTable(); dbClient.SetQuery( "SELECT users.id,users.username,users.motto,users.look,users.last_online,users.hide_inroom,users.hide_online " + "FROM users " + "JOIN messenger_friendships " + "ON users.id = messenger_friendships.user_one_id " + "WHERE messenger_friendships.user_two_id = " + UserId + " " + "UNION ALL " + "SELECT users.id,users.username,users.motto,users.look,users.last_online,users.hide_inroom,users.hide_online " + "FROM users " + "JOIN messenger_friendships " + "ON users.id = messenger_friendships.user_two_id " + "WHERE messenger_friendships.user_one_id = " + UserId); dFriends = dbClient.getTable(); dbClient.SetQuery("SELECT messenger_requests.from_id,messenger_requests.to_id,users.username FROM users JOIN messenger_requests ON users.id = messenger_requests.from_id WHERE messenger_requests.to_id = " + UserId); dRequests = dbClient.getTable(); dbClient.SetQuery("SELECT * FROM rooms WHERE `owner` = '" + UserId + "' LIMIT 150"); dRooms = dbClient.getTable(); dbClient.SetQuery("SELECT * FROM users_talents WHERE userid = '" + UserId + "'"); talentsTable = dbClient.getTable(); dbClient.SetQuery("SELECT `quest_id`,`progress` FROM user_quests WHERE `user_id` = '" + UserId + "'"); dQuests = dbClient.getTable(); dbClient.SetQuery("SELECT * FROM `user_relationships` WHERE `user_id` = @id"); dbClient.AddParameter("id", UserId); dRelations = dbClient.getTable(); dbClient.SetQuery("SELECT * FROM user_subscriptions WHERE user_id = '" + UserId + "'"); Subscriptions = dbClient.getTable(); dbClient.SetQuery(string.Format("SELECT `tag` FROM `user_tags` WHERE `user_id` = {0}", UserId)); tagsTable = dbClient.getTable(); dbClient.SetQuery("SELECT * FROM `user_info` WHERE `user_id` = '" + UserId + "' LIMIT 1"); UserInfo = dbClient.getRow(); if (UserInfo == null) { dbClient.runFastQuery("INSERT INTO `user_info` (`user_id`) VALUES ('" + UserId + "')"); dbClient.SetQuery("SELECT * FROM `user_info` WHERE `user_id` = '" + UserId + "' LIMIT 1"); UserInfo = dbClient.getRow(); } dbClient.runFastQuery("UPDATE `users` SET `online` = '1', `auth_ticket` = '' WHERE `id` = '" + UserId + "' LIMIT 1"); } ConcurrentDictionary <string, UserAchievement> Achievements = new ConcurrentDictionary <string, UserAchievement>(); foreach (DataRow dRow in dAchievements.Rows) { Achievements.TryAdd(Convert.ToString(dRow["group"]), new UserAchievement(Convert.ToString(dRow["group"]), Convert.ToInt32(dRow["level"]), Convert.ToInt32(dRow["progress"]))); } List <int> favouritedRooms = new List <int>(); foreach (DataRow dRow in dFavouriteRooms.Rows) { favouritedRooms.Add(Convert.ToInt32(dRow["room_id"])); } List <Badge> badges = new List <Badge>(); foreach (DataRow dRow in dBadges.Rows) { badges.Add(new Badge(Convert.ToString(dRow["badge_id"]), Convert.ToInt32(dRow["badge_slot"]))); } Dictionary <int, MessengerBuddy> friends = new Dictionary <int, MessengerBuddy>(); foreach (DataRow dRow in dFriends.Rows) { int friendID = Convert.ToInt32(dRow["id"]); string friendName = Convert.ToString(dRow["username"]); string friendLook = Convert.ToString(dRow["look"]); string friendMotto = Convert.ToString(dRow["motto"]); int friendLastOnline = Convert.ToInt32(dRow["last_online"]); bool friendHideOnline = BiosEmuThiago.EnumToBool(dRow["hide_online"].ToString()); bool friendHideRoom = BiosEmuThiago.EnumToBool(dRow["hide_inroom"].ToString()); if (friendID == UserId) { continue; } if (!friends.ContainsKey(friendID)) { friends.Add(friendID, new MessengerBuddy(friendID, friendName, friendLook, friendMotto, friendLastOnline, friendHideOnline, friendHideRoom)); } } Dictionary <int, MessengerRequest> requests = new Dictionary <int, MessengerRequest>(); foreach (DataRow dRow in dRequests.Rows) { int receiverID = Convert.ToInt32(dRow["from_id"]); int senderID = Convert.ToInt32(dRow["to_id"]); string requestUsername = Convert.ToString(dRow["username"]); if (receiverID != UserId) { if (!requests.ContainsKey(receiverID)) { requests.Add(receiverID, new MessengerRequest(UserId, receiverID, requestUsername)); } } else { if (!requests.ContainsKey(senderID)) { requests.Add(senderID, new MessengerRequest(UserId, senderID, requestUsername)); } } } List <RoomData> rooms = new List <RoomData>(); foreach (DataRow dRow in dRooms.Rows) { rooms.Add(BiosEmuThiago.GetGame().GetRoomManager().FetchRoomData(Convert.ToInt32(dRow["id"]), dRow)); } Dictionary <int, int> quests = new Dictionary <int, int>(); foreach (DataRow dRow in dQuests.Rows) { int questId = Convert.ToInt32(dRow["quest_id"]); if (quests.ContainsKey(questId)) { quests.Remove(questId); } quests.Add(questId, Convert.ToInt32(dRow["progress"])); } Dictionary <int, Relationship> Relationships = new Dictionary <int, Relationship>(); foreach (DataRow Row in dRelations.Rows) { if (friends.ContainsKey(Convert.ToInt32(Row[2]))) { Relationships.Add(Convert.ToInt32(Row[2]), new Relationship(Convert.ToInt32(Row[0]), Convert.ToInt32(Row[2]), Convert.ToInt32(Row[3].ToString()))); } } Dictionary <int, UserTalent> talents = new Dictionary <int, UserTalent>(); if (talentsTable != null) { foreach (DataRow row in talentsTable.Rows) { int num2 = (int)row["talent_id"]; int state = (int)row["talent_state"]; talents.Add(num2, new UserTalent(num2, state)); } } var tags = (from DataRow row in tagsTable.Rows select row["tag"].ToString().Replace(" ", "")).ToList(); Dictionary <string, Subscription> subscriptions = new Dictionary <string, Subscription>(); foreach (DataRow dataRow in Subscriptions.Rows) { string str = (string)dataRow["subscription_id"]; int TimeExpire = (int)dataRow["timestamp_expire"]; int TimeActivate = (int)dataRow["timestamp_activated"]; subscriptions.Add(str, new Subscription(str, TimeExpire, TimeActivate)); } Habbo user = HabboFactory.GenerateHabbo(dUserInfo, UserInfo); dUserInfo = null; dAchievements = null; dFavouriteRooms = null; dBadges = null; dFriends = null; dRequests = null; dRooms = null; dRelations = null; errorCode = 0; return(new UserData(UserId, Achievements, favouritedRooms, badges, friends, requests, rooms, quests, user, Relationships, talents, subscriptions, tags)); }
public void Init() { if (this._televisions.Count > 0) { _televisions.Clear(); } DataTable getData = null; using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `items_youtube` ORDER BY `id` DESC"); getData = dbClient.getTable(); if (getData != null) { foreach (DataRow Row in getData.Rows) { this._televisions.Add(Convert.ToInt32(Row["id"]), new TelevisionItem(Convert.ToInt32(Row["id"]), Row["youtube_id"].ToString(), Row["title"].ToString(), Row["description"].ToString(), BiosEmuThiago.EnumToBool(Row["enabled"].ToString()))); } } } log.Info("» YouTube Manager -> PRONTO - BY: Thiago Araujo"); }
public void Init(ItemDataManager ItemDataManager) { if (_pages.Count > 0) { _pages.Clear(); } if (_botPresets.Count > 0) { _botPresets.Clear(); } if (_items.Count > 0) { _items.Clear(); } if (_deals.Count > 0) { _deals.Clear(); } if (_predesignedItems.Count > 0) { _predesignedItems.Clear(); } if (_recyclerLevels.Count > 0) { _recyclerLevels.Clear(); } using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `id`,`item_id`,`catalog_name`,`cost_credits`,`cost_pixels`,`cost_diamonds`,`cost_gotw`,`amount`,`page_id`,`limited_sells`,`limited_stack`,`offer_active`,`extradata`,`badge`,`offer_id`, `predesigned_id` FROM `catalog_items`"); DataTable CatalogueItems = dbClient.getTable(); if (CatalogueItems != null) { foreach (DataRow Row in CatalogueItems.Rows) { if (Convert.ToInt32(Row["amount"]) <= 0) { continue; } int ItemId = Convert.ToInt32(Row["id"]); int PageId = Convert.ToInt32(Row["page_id"]); int BaseId = Convert.ToInt32(Row["item_id"]); int OfferId = Convert.ToInt32(Row["offer_id"]); uint PredesignedId = Convert.ToUInt32(Row["predesigned_id"]); if (BaseId == 0 && PredesignedId > 0) { var roomPack = _predesignedManager.predesignedRoom[PredesignedId]; if (roomPack == null) { continue; } if (roomPack.CatalogItems.Contains(";")) { var cataItems = new Dictionary <int, int>(); var itemArray = roomPack.CatalogItems.Split(new char[] { ';' }); foreach (var item in itemArray) { var items = item.Split(','); ItemData PredesignedData = null; if (!ItemDataManager.GetItem(Convert.ToInt32(items[0]), out PredesignedData)) { log.Error("Ops, o id {" + ItemId + "}, do pack no catalogo esta com erro!"); continue; } cataItems.Add(Convert.ToInt32(items[0]), Convert.ToInt32(items[1])); } this._predesignedItems[PageId] = new PredesignedContent(ItemId, cataItems); } } ItemData Data = null; if (PredesignedId <= 0) { if (!ItemDataManager.GetItem(BaseId, out Data)) { log.Error("Ops, o id {" + ItemId + "}, do pack no catalogo esta com erro!"); continue; } } if (!this._items.ContainsKey(PageId)) { this._items[PageId] = new Dictionary <int, CatalogItem>(); } if (OfferId != -1 && !this._itemOffers.ContainsKey(OfferId)) { this._itemOffers.Add(OfferId, PageId); } this._items[PageId].Add(Convert.ToInt32(Row["id"]), new CatalogItem(Convert.ToInt32(Row["id"]), Convert.ToInt32(Row["item_id"]), Data, Convert.ToString(Row["catalog_name"]), Convert.ToInt32(Row["page_id"]), Convert.ToInt32(Row["cost_credits"]), Convert.ToInt32(Row["cost_pixels"]), Convert.ToInt32(Row["cost_diamonds"]), Convert.ToInt32(Row["cost_gotw"]), Convert.ToInt32(Row["amount"]), Convert.ToInt32(Row["limited_sells"]), Convert.ToInt32(Row["limited_stack"]), BiosEmuThiago.EnumToBool(Row["offer_active"].ToString()), Convert.ToString(Row["extradata"]), Convert.ToString(Row["badge"]), Convert.ToInt32(Row["offer_id"]), Convert.ToInt32(Row["predesigned_id"]))); } } dbClient.SetQuery("SELECT * FROM `catalog_deals`"); DataTable GetDeals = dbClient.getTable(); if (GetDeals != null) { foreach (DataRow Row in GetDeals.Rows) { int Id = Convert.ToInt32(Row["id"]); int PageId = Convert.ToInt32(Row["page_id"]); string Items = Convert.ToString(Row["items"]); string Name = Convert.ToString(Row["name"]); int Credits = Convert.ToInt32(Row["cost_credits"]); int Pixels = Convert.ToInt32(Row["cost_pixels"]); if (!_deals.ContainsKey(PageId)) { _deals[PageId] = new Dictionary <int, CatalogDeal>(); } CatalogDeal Deal = new CatalogDeal(Id, PageId, Items, Name, Credits, Pixels, ItemDataManager); _deals[PageId].Add(Deal.Id, Deal); } } dbClient.SetQuery("SELECT `id`,`parent_id`,`caption`,`page_link`,`visible`,`enabled`,`min_rank`,`min_vip`,`icon_image`,`page_layout`,`page_strings_1`,`page_strings_2` FROM `catalog_pages` ORDER BY `order_num`"); DataTable CatalogPages = dbClient.getTable(); if (CatalogPages != null) { foreach (DataRow Row in CatalogPages.Rows) { _pages.Add(Convert.ToInt32(Row["id"]), new CatalogPage(Convert.ToInt32(Row["id"]), Convert.ToInt32(Row["parent_id"]), Row["enabled"].ToString(), Convert.ToString(Row["caption"]), Convert.ToString(Row["page_link"]), Convert.ToInt32(Row["icon_image"]), Convert.ToInt32(Row["min_rank"]), Convert.ToInt32(Row["min_vip"]), Row["visible"].ToString(), Convert.ToString(Row["page_layout"]), Convert.ToString(Row["page_strings_1"]), Convert.ToString(Row["page_strings_2"]), _items.ContainsKey(Convert.ToInt32(Row["id"])) ? _items[Convert.ToInt32(Row["id"])] : new Dictionary <int, CatalogItem>(), _deals.ContainsKey(Convert.ToInt32(Row["id"])) ? _deals[Convert.ToInt32(Row["id"])] : new Dictionary <int, CatalogDeal>(), _predesignedItems.ContainsKey(Convert.ToInt32(Row["id"])) ? _predesignedItems[Convert.ToInt32(Row["id"])] : null, ref _itemOffers)); } } dbClient.SetQuery("SELECT `id`,`name`,`figure`,`motto`,`gender`,`ai_type` FROM `catalog_bot_presets`"); DataTable bots = dbClient.getTable(); if (bots != null) { foreach (DataRow Row in bots.Rows) { _botPresets.Add(Convert.ToInt32(Row[0]), new CatalogBot(Convert.ToInt32(Row[0]), Convert.ToString(Row[1]), Convert.ToString(Row[2]), Convert.ToString(Row[3]), Convert.ToString(Row[4]), Convert.ToString(Row[5]))); } } _petRaceManager.Init(); _clothingManager.Init(); } log.Info("» Catalogo -> PRONTO - BY: Thiago Araujo"); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null) { return; } Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } if (Session.GetHabbo().InRoom) { if (!BiosEmuThiago.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room OldRoom)) { return; } if (OldRoom.GetRoomUserManager() != null) { OldRoom.GetRoomUserManager().RemoveUserFromRoom(Session, false, false); } } if (!Room.GetRoomUserManager().AddAvatarToRoom(Session)) { Room.GetRoomUserManager().RemoveUserFromRoom(Session, false, false); return;//TODO: Remove? } Room.SendObjects(Session); //Status updating for messenger, do later as buggy. try { if (Session.GetHabbo().GetMessenger() != null) { Session.GetHabbo().GetMessenger().OnStatusChanged(true); } } catch { } if (Session.GetHabbo().GetStats().QuestID > 0) { BiosEmuThiago.GetGame().GetQuestManager().QuestReminder(Session, Session.GetHabbo().GetStats().QuestID); } Session.SendMessage(new RoomEntryInfoComposer(Room.RoomId, Room.CheckRights(Session, true))); Session.SendMessage(new RoomVisualizationSettingsComposer(Room.WallThickness, Room.FloorThickness, BiosEmuThiago.EnumToBool(Room.Hidewall.ToString()))); RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username); if (ThisUser != null && Session.GetHabbo().PetId == 0) { Room.SendMessage(new UserChangeComposer(ThisUser, false)); } Session.SendMessage(new RoomEventComposer(Room.RoomData, Room.RoomData.Promotion)); // AQUI EL IF DE SI LA SALA TIENE POLL if (Room.poolQuestion != string.Empty) { Session.SendMessage(new QuickPollMessageComposer(Room.poolQuestion)); if (Room.yesPoolAnswers.Contains(Session.GetHabbo().Id) || Room.noPoolAnswers.Contains(Session.GetHabbo().Id)) { Session.SendMessage(new QuickPollResultsMessageComposer(Room.yesPoolAnswers.Count, Room.noPoolAnswers.Count)); } } if (Room.GetWired() != null) { Room.GetWired().TriggerEvent(WiredBoxType.TriggerRoomEnter, Session.GetHabbo()); } if (Room.ForSale && Room.SalePrice > 0 && (Room.GetRoomUserManager().GetRoomUserByHabbo(Room.OwnerName) != null)) { Session.SendWhisper("Esta sala esta a venda, em " + Room.SalePrice + " Duckets. Escreva :buyroom se deseja comprar!"); } else if (Room.ForSale && Room.GetRoomUserManager().GetRoomUserByHabbo(Room.OwnerName) == null) { foreach (RoomUser _User in Room.GetRoomUserManager().GetRoomUsers()) { if (_User.GetClient() != null && _User.GetClient().GetHabbo() != null && _User.GetClient().GetHabbo().Id != Session.GetHabbo().Id) { _User.GetClient().SendWhisper("Esta sala não se encontra a venda!"); } } Room.ForSale = false; Room.SalePrice = 0; } if (Session.GetHabbo().Effects().CurrentEffect == 77) { Session.GetHabbo().Effects().ApplyEffect(0); } if (BiosEmuThiago.GetUnixTimestamp() < Session.GetHabbo().FloodTime&& Session.GetHabbo().FloodTime != 0) { Session.SendMessage(new FloodControlComposer((int)Session.GetHabbo().FloodTime - (int)BiosEmuThiago.GetUnixTimestamp())); } if (Room.OwnerId == Session.GetHabbo().Id) { string dFrank = null; using (var dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT bot_frank FROM users WHERE id = '" + Session.GetHabbo().Id + "' LIMIT 1"); dFrank = dbClient.getString(); } int dFrankInt = Int32.Parse(dFrank); DateTime dateGregorian = new DateTime(); dateGregorian = DateTime.Today; int day = 1; if (dFrankInt != day) { using (var dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE users SET bot_frank = '1' WHERE id = " + Session.GetHabbo().Id + ";"); } List <RandomSpeech> BotSpeechList = new List <RandomSpeech>(); RoomUser BotUser = Room.GetRoomUserManager().DeployBot(new RoomBot(0, Session.GetHabbo().CurrentRoomId, "welcome", "freeroam", "Frank", "Gerente do Bios Emulador, criado por Thiago Araujo!", "hr-3194-38-36.hd-180-1.ch-220-1408.lg-285-73.sh-906-90.ha-3129-73.fa-1206-73.cc-3039-73", 0, 0, 0, 4, 0, 0, 0, 0, ref BotSpeechList, "", 0, 0, false, 0, false, 33), null); } else { //O usuário já recebeu o prêmio de hoje! } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) { return; } Room Room; if (!BiosEmuThiago.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) { return; } if (!Room.CheckRights(Session, true)) { return; } int BotId = Packet.PopInt(); int X = Packet.PopInt(); int Y = Packet.PopInt(); if (!Room.GetGameMap().CanWalk(X, Y, false) || !Room.GetGameMap().ValidTile(X, Y)) { Session.SendNotification("Não pode colocar um bot aqui!"); return; } Bot Bot = null; if (!Session.GetHabbo().GetInventoryComponent().TryGetBot(BotId, out Bot)) { return; } int BotCount = 0; foreach (RoomUser User in Room.GetRoomUserManager().GetUserList().ToList()) { if (User == null || User.IsPet || !User.IsBot) { continue; } BotCount += 1; } if (BotCount >= 25 && !Session.GetHabbo().GetPermissions().HasRight("bot_place_any_override")) { Session.SendNotification("Sentimos muito, mas só pode colocar 25 bots no quarto!"); return; } //TODO: Hmm, maybe not???? using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `bots` SET `room_id` = @roomId, `x` = @CoordX, `y` = @CoordY WHERE `id` = @BotId LIMIT 1"); dbClient.AddParameter("roomId", Room.RoomId); dbClient.AddParameter("BotId", Bot.Id); dbClient.AddParameter("CoordX", X); dbClient.AddParameter("CoordY", Y); dbClient.RunQuery(); } List <RandomSpeech> BotSpeechList = new List <RandomSpeech>(); //TODO: Grab data? DataRow GetData = null; using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `ai_type`,`rotation`,`walk_mode`,`automatic_chat`,`speaking_interval`,`mix_sentences`,`chat_bubble` FROM `bots` WHERE `id` = @BotId LIMIT 1"); dbClient.AddParameter("BotId", Bot.Id); GetData = dbClient.getRow(); dbClient.SetQuery("SELECT * FROM `bots_speech` WHERE `bot_id` = @BotId ORDER BY id ASC"); dbClient.AddParameter("BotId", Bot.Id); DataTable BotSpeech = dbClient.getTable(); foreach (DataRow Speech in BotSpeech.Rows) { BotSpeechList.Add(new RandomSpeech(Convert.ToString(Speech["text"]), Bot.Id)); } } RoomUser BotUser = Room.GetRoomUserManager().DeployBot(new RoomBot(Bot.Id, Session.GetHabbo().CurrentRoomId, Convert.ToString(GetData["ai_type"]), Convert.ToString(GetData["walk_mode"]), Bot.Name, "", Bot.Figure, X, Y, 0, 4, 0, 0, 0, 0, ref BotSpeechList, "", 0, Bot.OwnerId, BiosEmuThiago.EnumToBool(GetData["automatic_chat"].ToString()), Convert.ToInt32(GetData["speaking_interval"]), BiosEmuThiago.EnumToBool(GetData["mix_sentences"].ToString()), Convert.ToInt32(GetData["chat_bubble"])), null); using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `bots` WHERE `id` = @BotId "); dbClient.AddParameter("BotId", Bot.Id); DataTable BotSpeechData = dbClient.getTable(); foreach (DataRow SpeechData in BotSpeechData.Rows) { BotUser.Chat("Olá!", false, (Convert.ToInt32(SpeechData["chat_bubble"]))); } } Room.GetGameMap().UpdateUserMovement(new System.Drawing.Point(X, Y), new System.Drawing.Point(X, Y), BotUser); Bot ToRemove = null; if (!Session.GetHabbo().GetInventoryComponent().TryRemoveBot(BotId, out ToRemove)) { Console.WriteLine("Erro em eliminar no bot: " + ToRemove.Id); return; } Session.SendMessage(new BotInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetBots())); }
public void LoadModel(string Id) { DataRow Row = null; using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT id,door_x,door_y,door_z,door_dir,heightmap,public_items,club_only,poolmap,`wall_height` FROM `room_models` WHERE `custom` = '1' AND `id` = '" + Id + "' LIMIT 1"); Row = dbClient.getRow(); if (Row == null) { return; } string Modelname = Convert.ToString(Row["id"]); if (!this._roomModels.ContainsKey(Id)) { this._roomModels.Add(Modelname, new RoomModel(Convert.ToInt32(Row["door_x"]), Convert.ToInt32(Row["door_y"]), Convert.ToDouble(Row["door_z"]), Convert.ToInt32(Row["door_dir"]), Convert.ToString(Row["heightmap"]), Convert.ToString(Row["public_items"]), BiosEmuThiago.EnumToBool(Row["club_only"].ToString()), Convert.ToString(Row["poolmap"]), Convert.ToInt32(Row["wall_height"]))); } } }