ON INIT {
 SETNAME [description_barrel]
 SET £type "barrel_wood"
 set §genInv 0
 SET_MATERIAL WOOD
 VIEW_BLOCK ON
 INVENTORY CREATE
 INVENTORY SKIN "ingame_inventory_wood"
 ACCEPT
}

ON INVENTORY2_OPEN {
 PLAY "barrel_open"
>>RANDOM_ITEM
IF ( §genInv == 1 ) ACCEPT
 IF (£type == "barrel_food") {
  IF (#RANDOMIZER < 3) {
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_CHICKEN_UNCOOKED\\FOOD_CHICKEN_UNCOOKED" 2
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_FISH\\FOOD_FISH" 2
  }
  IF (#RANDOMIZER == 3) {
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_APPLE\\FOOD_APPLE" 2
  INVENTORY ADDMULTI "PROVISIONS\\CHEESE\\CHEESE" 2
  }
  IF (#RANDOMIZER == 4) {
  INVENTORY ADD "PROVISIONS\\FOOD_CHICKEN_UNCOOKED\\FOOD_CHICKEN_UNCOOKED"
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_FISH\\FOOD_FISH" 2
  INVENTORY ADD "PROVISIONS\\CHEESE\\CHEESE"
  }
  IF (#RANDOMIZER == 5) {
  INVENTORY ADD "PROVISIONS\\FOOD_CHICKEN_UNCOOKED\\FOOD_CHICKEN_UNCOOKED"
  INVENTORY ADD "PROVISIONS\\FOOD_FISH\\FOOD_FISH"
  INVENTORY ADD "PROVISIONS\\CHEESE\\CHEESE"
  INVENTORY ADD "PROVISIONS\\FOOD_LEEK\\FOOD_LEEK"
  }
  IF (#RANDOMIZER == 6) {
  INVENTORY ADD "PROVISIONS\\FOOD_LEEK\\FOOD_LEEK"
  INVENTORY ADD "PROVISIONS\\CARROT\\CARROT"
  INVENTORY ADD "PROVISIONS\\MUSHROOM\\FOOD_MUSHROOM"
  INVENTORY ADD "PROVISIONS\\FOOD_APPLE\\FOOD_APPLE"
  }
  IF (#RANDOMIZER == 7) {
  INVENTORY ADD "PROVISIONS\\FOOD_LEEK\\FOOD_LEEK"
  INVENTORY ADDMULTI "PROVISIONS\\CARROT\\CARROT" 2
  INVENTORY ADD "PROVISIONS\\MUSHROOM\\FOOD_MUSHROOM"
  }
  IF (#RANDOMIZER > 7) {
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_LEEK\\FOOD_LEEK" 2
  INVENTORY ADDMULTI "PROVISIONS\\CARROT\\CARROT" 2
  }
  RANDOM 40 { INVENTORY ADD "PROVISIONS\\GARLIC\\GARLIC" }
  set §genInv 1
  ACCEPT
 }
 IF (£type == "barrel_food_fish") {
  IF (#RANDOMIZER < 4) {
  INVENTORY ADDMULTI "PROVISIONS\\GARLIC\\GARLIC" 8
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_FISH\\FOOD_FISH" 6
  }
  IF (#RANDOMIZER == 4) {
  INVENTORY ADDMULTI "PROVISIONS\\GARLIC\\GARLIC" 6
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_FISH\\FOOD_FISH" 8
  }
  IF (#RANDOMIZER == 5) {
  INVENTORY ADDMULTI "PROVISIONS\\GARLIC\\GARLIC" 4
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_FISH\\FOOD_FISH" 10
  }
  IF (#RANDOMIZER > 5) {
  INVENTORY ADDMULTI "PROVISIONS\\GARLIC\\GARLIC" 2
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_FISH\\FOOD_FISH" 12
  }
  set §genInv 1
  ACCEPT
 }
 IF (£type == "barrel_food_castle") {
  IF (#RANDOMIZER < 3) {
  INVENTORY ADDMULTI "PROVISIONS\\RIBS\\RIBS" 4
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_CHICKEN_UNCOOKED\\FOOD_CHICKEN_UNCOOKED" 4
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_LEEK\\FOOD_LEEK" 4
  INVENTORY ADDMULTI "PROVISIONS\\CARROT\\CARROT" 5
  INVENTORY ADDMULTI "PROVISIONS\\MUSHROOM\\FOOD_MUSHROOM" 4
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_APPLE\\FOOD_APPLE" 4
  INVENTORY ADDMULTI "PROVISIONS\\CHEESE\\CHEESE" 5
  INVENTORY ADDMULTI "PROVISIONS\\GARLIC\\GARLIC" 2
  }
  IF (#RANDOMIZER == 3) {
  INVENTORY ADDMULTI "PROVISIONS\\RIBS\\RIBS" 2
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_CHICKEN_UNCOOKED\\FOOD_CHICKEN_UNCOOKED" 6
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_LEEK\\FOOD_LEEK" 4
  INVENTORY ADDMULTI "PROVISIONS\\CARROT\\CARROT" 3
  INVENTORY ADDMULTI "PROVISIONS\\MUSHROOM\\FOOD_MUSHROOM" 6
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_APPLE\\FOOD_APPLE" 4
  INVENTORY ADDMULTI "PROVISIONS\\CHEESE\\CHEESE" 4
  INVENTORY ADDMULTI "PROVISIONS\\GARLIC\\GARLIC" 3
  }
  IF (#RANDOMIZER == 4) {
  INVENTORY ADDMULTI "PROVISIONS\\RIBS\\RIBS" 2
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_CHICKEN_UNCOOKED\\FOOD_CHICKEN_UNCOOKED" 3
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_LEEK\\FOOD_LEEK" 6
  INVENTORY ADDMULTI "PROVISIONS\\CARROT\\CARROT" 6
  INVENTORY ADDMULTI "PROVISIONS\\MUSHROOM\\FOOD_MUSHROOM" 6
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_APPLE\\FOOD_APPLE" 2
  INVENTORY ADDMULTI "PROVISIONS\\CHEESE\\CHEESE" 4
  INVENTORY ADDMULTI "PROVISIONS\\GARLIC\\GARLIC" 3
  }
  IF (#RANDOMIZER == 5) {
  INVENTORY ADDMULTI "PROVISIONS\\RIBS\\RIBS" 3
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_CHICKEN_UNCOOKED\\FOOD_CHICKEN_UNCOOKED" 5
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_LEEK\\FOOD_LEEK" 3
  INVENTORY ADDMULTI "PROVISIONS\\CARROT\\CARROT" 4
  INVENTORY ADDMULTI "PROVISIONS\\MUSHROOM\\FOOD_MUSHROOM" 4
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_APPLE\\FOOD_APPLE" 4
  INVENTORY ADDMULTI "PROVISIONS\\CHEESE\\CHEESE" 7
  INVENTORY ADDMULTI "PROVISIONS\\GARLIC\\GARLIC" 2
  }
  IF (#RANDOMIZER == 6) {
  INVENTORY ADDMULTI "PROVISIONS\\RIBS\\RIBS" 6
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_CHICKEN_UNCOOKED\\FOOD_CHICKEN_UNCOOKED" 3
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_LEEK\\FOOD_LEEK" 3
  INVENTORY ADDMULTI "PROVISIONS\\CARROT\\CARROT" 6
  INVENTORY ADDMULTI "PROVISIONS\\MUSHROOM\\FOOD_MUSHROOM" 2
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_APPLE\\FOOD_APPLE" 5
  INVENTORY ADDMULTI "PROVISIONS\\CHEESE\\CHEESE" 5
  INVENTORY ADDMULTI "PROVISIONS\\GARLIC\\GARLIC" 2
  }
  IF (#RANDOMIZER == 7) {
  INVENTORY ADDMULTI "PROVISIONS\\RIBS\\RIBS" 3
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_CHICKEN_UNCOOKED\\FOOD_CHICKEN_UNCOOKED" 3
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_LEEK\\FOOD_LEEK" 3
  INVENTORY ADDMULTI "PROVISIONS\\CARROT\\CARROT" 5
  INVENTORY ADDMULTI "PROVISIONS\\MUSHROOM\\FOOD_MUSHROOM" 3
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_APPLE\\FOOD_APPLE" 6
  INVENTORY ADDMULTI "PROVISIONS\\CHEESE\\CHEESE" 6
  INVENTORY ADDMULTI "PROVISIONS\\GARLIC\\GARLIC" 3
  }
  IF (#RANDOMIZER > 7) {
  INVENTORY ADDMULTI "PROVISIONS\\RIBS\\RIBS" 3
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_CHICKEN_UNCOOKED\\FOOD_CHICKEN_UNCOOKED" 4
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_LEEK\\FOOD_LEEK" 3
  INVENTORY ADDMULTI "PROVISIONS\\CARROT\\CARROT" 4
  INVENTORY ADDMULTI "PROVISIONS\\MUSHROOM\\FOOD_MUSHROOM" 6
  INVENTORY ADDMULTI "PROVISIONS\\FOOD_APPLE\\FOOD_APPLE" 4
  INVENTORY ADDMULTI "PROVISIONS\\CHEESE\\CHEESE" 3
  INVENTORY ADDMULTI "PROVISIONS\\GARLIC\\GARLIC" 5
  }
  RANDOM 40 { INVENTORY ADD "PROVISIONS\\GARLIC\\GARLIC" }
  set §genInv 1
  ACCEPT
 }
 IF (£type == "barrel_drink") {
  IF (#RANDOMIZER < 4) {
  INVENTORY ADDMULTI "PROVISIONS\\BOTTLE_WATER\\BOTTLE_WATER" 4
  }
  IF (#RANDOMIZER == 4) {
  INVENTORY ADDMULTI "PROVISIONS\\BOTTLE_WATER\\BOTTLE_WATER" 2
  INVENTORY ADDMULTI "PROVISIONS\\BOTTLE_WINE\\BOTTLE_WINE" 2
  }
  IF (#RANDOMIZER == 5) {
  INVENTORY ADDMULTI "PROVISIONS\\BOTTLE_WATER\\BOTTLE_WATER" 3
  INVENTORY ADD "PROVISIONS\\BOTTLE_WINE\\BOTTLE_WINE"
  }
  IF (#RANDOMIZER == 6) {
  INVENTORY ADD "PROVISIONS\\BOTTLE_WATER\\BOTTLE_WATER"
  INVENTORY ADDMULTI "PROVISIONS\\BOTTLE_WINE\\BOTTLE_WINE" 3
  }
  IF (#RANDOMIZER > 6) {
  INVENTORY ADDMULTI "PROVISIONS\\BOTTLE_WINE\\BOTTLE_WINE" 4
  }
  RANDOM 40 { INVENTORY ADD "PROVISIONS\\BOTTLE_EMPTY\\BOTTLE_EMPTY" }
  set §genInv 1
  ACCEPT
 }
 IF (£type == "barrel_misc") {
  IF (#RANDOMIZER < 1) INVENTORY ADD "PROVISIONS\\SALT\\SALT"
  IF (#RANDOMIZER == 1) INVENTORY ADD "PROVISIONS\\BOTTLE_WATER\\BOTTLE_WATER"
  IF (#RANDOMIZER == 2) INVENTORY ADDMULTI "PROVISIONS\\BOTTLE_WATER\\BOTTLE_WATER" 2
  IF (#RANDOMIZER == 3) INVENTORY ADD "JEWELRY\\SILVER_RING\\SILVER_RING"
  IF (#RANDOMIZER == 4) INVENTORY ADDMULTI "PROVISIONS\\SALT\\SALT" 2
  IF (#RANDOMIZER == 5) INVENTORY ADD "SPECIAL\\Tool_Craft\\Tool_Craft"
  IF (#RANDOMIZER == 6) INVENTORY ADD "PROVISIONS\\flour\\flour"
  IF (#RANDOMIZER == 7) INVENTORY ADDMULTI "PROVISIONS\\flour\\flour" 2
  IF (#RANDOMIZER == 8) INVENTORY ADD "PROVISIONS\\candle\\candel"
  IF (#RANDOMIZER == 9) INVENTORY ADD "PROVISIONS\\BREAD\\BREAD"
  IF (#RANDOMIZER == 10) INVENTORY ADD "PROVISIONS\\CHEESE\\CHEESE"
  IF (#RANDOMIZER == 11) INVENTORY ADD "PROVISIONS\\BREAD_HALF\\BREAD_HALF"
  IF (#RANDOMIZER > 11) INVENTORY ADD "PROVISIONS\\BOTTLE_EMPTY\\BOTTLE_EMPTY"
  RANDOM 80 { INVENTORY ADD "MAGIC\\powder_rust\\powder_rust" }
  RANDOM 40 { INVENTORY ADD "MAGIC\\powder_rust\\powder_rust" }
  RANDOM 16 { INVENTORY ADD "JEWELRY\\GOLD_COIN\\GOLD_COIN" }
  RANDOM 8 { INVENTORY ADD "JEWELRY\\GOLD_COIN\\GOLD_COIN" }
  RANDOM 4 { INVENTORY ADD "JEWELRY\\GOLD_COIN\\GOLD_COIN" }
  set §genInv 1
  ACCEPT
 }
 IF (£type == "barrel_old") {
  IF (#RANDOMIZER < 3) {
  INVENTORY ADD "PROVISIONS\\SALT\\SALT"
  INVENTORY ADDMULTI "MAGIC\\powder_rust\\powder_rust" 6
  }
  IF (#RANDOMIZER == 3) {
  INVENTORY ADDMULTI "PROVISIONS\\SALT\\SALT" 2
  INVENTORY ADDMULTI "MAGIC\\powder_rust\\powder_rust" 2
  INVENTORY ADDMULTI "PROVISIONS\\IRON_RATION\\IRON_RATION" 3
  }
  IF (#RANDOMIZER == 4) {
  INVENTORY ADDMULTI "PROVISIONS\\SALT\\SALT" 2
  INVENTORY ADDMULTI "MAGIC\\powder_rust\\powder_rust" 4
  INVENTORY ADDMULTI "PROVISIONS\\IRON_RATION\\IRON_RATION" 2
  }
  IF (#RANDOMIZER == 5) {
  INVENTORY ADDMULTI "PROVISIONS\\SALT\\SALT" 3
  INVENTORY ADD "MAGIC\\powder_rust\\powder_rust"
  INVENTORY ADD "PROVISIONS\\IRON_RATION\\IRON_RATION"
  }
  IF (#RANDOMIZER == 6) {
  INVENTORY ADDMULTI "PROVISIONS\\SALT\\SALT" 3
  INVENTORY ADDMULTI "MAGIC\\powder_rust\\powder_rust" 3
  INVENTORY ADD "PROVISIONS\\IRON_RATION\\IRON_RATION"
  }
  IF (#RANDOMIZER == 7) {
  INVENTORY ADDMULTI "PROVISIONS\\SALT\\SALT" 2
  INVENTORY ADDMULTI "MAGIC\\powder_rust\\powder_rust" 5
  INVENTORY ADD "PROVISIONS\\IRON_RATION\\IRON_RATION"
  }
  IF (#RANDOMIZER > 7) {
  INVENTORY ADDMULTI "PROVISIONS\\SALT\\SALT" 4
  INVENTORY ADD "MAGIC\\powder_rust\\powder_rust"
  }
  set §genInv 1
  ACCEPT
 }
 set §genInv 1
 ACCEPT
}

ON INVENTORY2_CLOSE {
 PLAY "barrel_close"
 ACCEPT
}

ON GAME_READY {
 ANCHOR_BLOCK ON
 ACCEPT
}