public bool SetWallItem(GameClient Session, RoomItem Item) { Item.Interactor.OnPlace(Session, Item); switch (Item.GetBaseItem().InteractionType.ToLower()) { case "dimmer": if (MoodlightData == null) { MoodlightData = new MoodlightData(Item.Id); Item.ExtraData = MoodlightData.GenerateExtraData(); } break; } using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient()) { dbClient.AddParamWithValue("extra_data", Item.ExtraData); dbClient.ExecuteQuery("INSERT INTO room_items (id,room_id,base_item,extra_data,x,y,z,rot,wall_pos) VALUES ('" + Item.Id + "','" + RoomId + "','" + Item.BaseItem + "',@extra_data,'0','0','0','0','" + Item.WallPos + "')"); } Items.Add(Item); ServerPacket Message = new ServerPacket(83); Item.Serialize(Message); SendMessage(Message); return true; }
public void LoadFurniture() { this.Items.Clear(); DataTable Data = null; using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient()) { Data = dbClient.ReadDataTable("SELECT * FROM room_items WHERE room_id = '" + Id + "'"); } if (Data == null) { return; } foreach (DataRow Row in Data.Rows) { RoomItem Item = new RoomItem((uint)Row["id"], RoomId, (uint)Row["base_item"], (string)Row["extra_data"], (int)Row["x"], (int)Row["y"], (Double)Row["z"], (int)Row["rot"], (string)Row["wall_pos"]); switch (Item.GetBaseItem().InteractionType.ToLower()) { case "dimmer": if (MoodlightData == null) { MoodlightData = new MoodlightData(Item.Id); } break; } this.Items.Add(Item); } }