public void Handle(GameClient session, ClientMessage message) { session.GetHabbo().GetUserSettings().FriendStream = message.PopBase64Boolean(); using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient()) { dbClient.AddParamWithValue("userId", session.GetHabbo().ID); dbClient.AddParamWithValue("friendStream", TextUtilies.BoolToString(session.GetHabbo().GetUserSettings().FriendStream)); dbClient.ExecuteQuery("UPDATE users SET friend_stream = @friendStream WHERE id = @userId LIMIT 1"); } }
public override string GetItemData() { string itemString = ""; foreach (KeyValuePair <uint, MatchFurniData> data in this.MatchFurniData) { if (itemString.Length > 0) { itemString += "|"; } itemString += data.Key + "," + data.Value.ExtraData + "," + data.Value.Rot + "," + data.Value.X + "," + data.Value.Y + "," + TextUtilies.DoubleWithDotDecimal(data.Value.Z); } return(itemString + (char)9 + TextUtilies.BoolToString(this.FurniState) + (char)9 + TextUtilies.BoolToString(this.Direction) + (char)9 + TextUtilies.BoolToString(this.Position)); }
public override string GetItemData() { return this.Message + (char)9 + TextUtilies.BoolToString(this.OnlyOwner); }
public void SetCurrentPresetSettings(int preset, bool backgroundOnly, string colorCode, int colorIntensity) { if (this.IsValidColor(colorCode) && colorIntensity >= 0 && colorIntensity <= 255) { using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient()) { dbClient.AddParamWithValue("data", colorCode + "," + colorIntensity + "," + TextUtilies.BoolToString(backgroundOnly)); dbClient.AddParamWithValue("itemId", this.ItemID); dbClient.ExecuteQuery("UPDATE items_moodlight SET preset_" + (this.CurrentPreset == 1 ? "one" : this.CurrentPreset == 2 ? "two" : "three") + " = @data WHERE item_id = @itemId LIMIT 1"); } this.GetPreset(preset).BackgroundOnly = backgroundOnly; this.GetPreset(preset).ColorCode = colorCode; this.GetPreset(preset).ColorIntensity = colorIntensity; } }
public override string GetItemData() { return(string.Join(",", this.SelectedItems.Select(i => i.ID)) + (char)9 + TextUtilies.BoolToString(this.AllFurnis)); }
public Room CreateNewbieRoom(GameClient gameClient, uint roomId_) { if (this.NewbieRooms.TryGetValue(roomId_, out RoomData newbieData)) { uint roomId = 0; using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient()) { dbClient.AddParamWithValue("name", newbieData.Name); dbClient.AddParamWithValue("description", newbieData.Description); dbClient.AddParamWithValue("ownerid", gameClient.GetHabbo().ID); dbClient.AddParamWithValue("type", newbieData.Type); dbClient.AddParamWithValue("model", newbieData.Model); dbClient.AddParamWithValue("state", newbieData.State == RoomStateType.PASSWORD ? "password" : newbieData.State == RoomStateType.LOCKED ? "locked" : "open"); dbClient.AddParamWithValue("category", newbieData.Category); dbClient.AddParamWithValue("usersNow", newbieData.UsersNow); dbClient.AddParamWithValue("usersMax", newbieData.UsersMax); dbClient.AddParamWithValue("publicCcts", newbieData.PublicCCTs); dbClient.AddParamWithValue("score", newbieData.Score); dbClient.AddParamWithValue("tags", string.Join(",", newbieData.Tags)); dbClient.AddParamWithValue("iconBg", newbieData.RoomIcon.BackgroundImage); dbClient.AddParamWithValue("iconFg", newbieData.RoomIcon.ForegroundImage); dbClient.AddParamWithValue("iconItems", newbieData.RoomIcon.ItemsToString()); dbClient.AddParamWithValue("password", newbieData.Password); dbClient.AddParamWithValue("wallpaper", newbieData.Wallpaper); dbClient.AddParamWithValue("floor", newbieData.Floor); dbClient.AddParamWithValue("landscape", newbieData.Landscape); dbClient.AddParamWithValue("allowPets", TextUtilies.BoolToString(newbieData.AllowPets)); dbClient.AddParamWithValue("allowPetsEat", TextUtilies.BoolToString(newbieData.AllowPetsEat)); dbClient.AddParamWithValue("allowWalkthrough", TextUtilies.BoolToString(newbieData.AllowWalkthrough)); dbClient.AddParamWithValue("hidewalls", TextUtilies.BoolToString(newbieData.Hidewalls)); dbClient.AddParamWithValue("wallthick", newbieData.Wallthick); dbClient.AddParamWithValue("floorthick", newbieData.Floorthick); dbClient.ExecuteQuery("INSERT INTO rooms(name, description, ownerid, type, model, state, category, users_now, users_max, public_ccts, score, tags, icon_bg, icon_fg, icon_items, password, wallpaper, floor, landscape, allow_pets, allow_pets_eat, allow_walkthrough, hidewalls, wallthick, floorthick, data) VALUES(@name, @description, @ownerid, @type, @model, @state, @category, @usersNow, @usersMax, @publicCcts, @score, @tags, @iconBg, @iconFg, @iconItems, @password, @wallpaper, @floor, @landscape, @allowPets, @allowPetsEat, @allowWalkthrough, @hidewalls, @wallthick, @floorthick, '')"); roomId = (uint)dbClient.GetID(); if (roomId > 0) //check for possible error, ExecuteQuery should throw exception if there is something wrong with the query { if (Skylight.GetGame().GetItemManager().NewbieRoomItems.TryGetValue(roomId_, out List <RoomItem> items) && items.Count > 0) //does the room have items or is it empty, LMAO { dbClient.AddParamWithValue("roomId", roomId); dbClient.AddParamWithValue("userId", gameClient.GetHabbo().ID); string itemQuery = ""; foreach (RoomItem item in items) { dbClient.AddParamWithValue("baseItem" + item.ID, item.BaseItem.ID); dbClient.AddParamWithValue("extraData" + item.ID, item.ExtraData); dbClient.AddParamWithValue("x" + item.ID, item.X); dbClient.AddParamWithValue("y" + item.ID, item.Y); dbClient.AddParamWithValue("z" + item.ID, item.Z); dbClient.AddParamWithValue("rot" + item.ID, item.Rot); dbClient.AddParamWithValue("wallPos" + item.ID, item.WallCoordinate != null ? item.WallCoordinate.ToString() : ""); itemQuery += "INSERT INTO items(user_id, room_id, base_item, extra_data, x, y, z, rot, wall_pos) VALUES(@userId, @roomId, @baseItem" + item.ID + ", @extraData" + item.ID + ", @x" + item.ID + ", @y" + item.ID + ", @z" + item.ID + ", @rot" + item.ID + ", @wallPos" + item.ID + "); "; } if (itemQuery.Length > 0) //for sure { dbClient.ExecuteQuery(itemQuery); } } } } gameClient.GetHabbo().AddRoom(roomId); //navigator stuff return(this.TryGetAndLoadRoom(roomId)); //load the room and return it } else { return(null);//now newbie room :( } }