:raphael_shop
  if Switches.hiredRaphael
    if Switches.isExpandingHouse
      Raphael "I'm already working on your house. The job will be complete soon."
    else
      if Variables.daysRaphaelWorked > 0
        if Managers.Weather.isBadWeather()
          Raphael "Hey! Sorry I can't work in your house with this weather."
        else
          Raphael "Hey! I took the day off today, but I'll continue working on your house tomorrow."
        end
      else
        Raphael "I'll start working on your house tomorrow. Look forward to it."
      end
    end

    return
  end

  Raphael ("What are you looking for?", "House Expansion", "Other Stuff", "Just Chat", "Nothing", "Nothing")

  if response == "House Expansion"
    play child raphael_shop_house_expansion
    return
  end

  if response == "Other Stuff"
    play child raphael_shop_objects
    return
  end

  if response == "Just Chat"
    force chat Raphael
    return
  end  

:raphael_first_house_upgrade
  Raphael "To expand your house, I'll need the following materials:"
  Raphael "<color:important><item:branch></color> x 200<br><color:important><item:brick></color> x 50<br><color:important><item:roof-tile></color> x 30"
  Raphael ("And I'll also ask you for $ 6,000 to do the job. Do you accept?", "Yes", "No", "No")

  if response == "Yes"
    if Managers.Items.numItemsById('branch') < 200
      include raphael_not_enough_materials
      return
    end

    if Managers.Items.numItemsById('brick') < 50
      include raphael_not_enough_materials
      return
    end

    if Managers.Items.numItemsById('roof-tile') < 30
      include raphael_not_enough_materials
      return
    end

    if Managers.Items.gold < 6000
      Raphael "You don't have enough money."
      return
    end

    lose gold 6000
    lose item branch x 200
    lose item brick x 50
    lose item roof-tile x 30

    switch hiredRaphael ON
    variable daysRaphaelWorked 0

    Raphael "Alright, I'll start working on your house expansion tomorrow."
    if bad weather tomorrow
      Raphael "Oh but the weather prediction isn't looking good for tomorrow, so I may skip the day."
    end

    return
  end

:raphael_second_house_upgrade
  Raphael "I can add a second floor to your house if you bring me the following materials:"
  Raphael "<color:important><item:branch></color> x 200<br><color:important><item:brick></color> x 200<br><color:important><item:roof-tile></color> x 200"
  Raphael ("And I'll also ask you for $ 15,000 to do the job. Do you accept?", "Yes", "No", "No")

  if response == "Yes"
    if Managers.Items.numItemsById('branch') < 200
      include raphael_not_enough_materials
      return
    end

    if Managers.Items.numItemsById('brick') < 200
      include raphael_not_enough_materials
      return
    end

    if Managers.Items.numItemsById('roof-tile') < 200
      include raphael_not_enough_materials
      return
    end

    if Managers.Items.gold < 15000
      Raphael "You don't have enough money."
      return
    end

    lose gold 15000
    lose item branch x 200
    lose item brick x 200
    lose item roof-tile x 200

    switch hiredRaphael ON
    variable daysRaphaelWorked 0

    Raphael "Alright, I'll start working on your second floor tomorrow."
    if bad weather tomorrow
      Raphael "Oh but the weather prediction isn't looking good for tomorrow, so I may skip the day."
    end
    return
  end

:raphael_shop_house_expansion
  if-switch builtSecondFloor
    Raphael "I can't expand your house anymore. Not yet, at least."
    return
  end

  if-switch expandedHouse
    include raphael_second_house_upgrade
  else
    include raphael_first_house_upgrade
  end

  if response == "No"
    Raphael "No problem. Let me know if you change your mind."
    return
  end

:raphael_not_enough_materials
  Raphael "You don't have all the materials."

:raphael_shop_objects
  wait 10
  js Managers.Scenes.snapForBackground();
  js Managers.Scenes.push(GameScenes.CarpenterObjectShop);

:cindy_furniture_shop
  wait 10
  js Managers.Scenes.snapForBackground();
  js Managers.Scenes.push(GameScenes.FurnitureShop);

:cindy_shop
  Cindy ("What would you like today?", "Furniture", "Just Chat", "Nothing", "Nothing")

  if response == "Furniture"
    play child cindy_furniture_shop
    return
  end

  if response == "Just Chat"
    force chat Cindy
    return
  end  
