I would recommend you use the search function to learn about bringing alcohol on board. There have been several recent threads on the topic.
As far as buying alcohol in port, you might be able to sneak small amounts on board and take to your cabin (you go through a scanner and your bags get xrayed each time you embark). But generally they will take the booze away from and and deliver it back to your cabin the last night of your cruise..
Ditto for any alcohol purchased from the ship's store. Of course anything you buy at the bar you can consume right away
All I ask is a tall ship and a star to steer her by; John Masefield
Carnival: Glory 2004, Destiny 2008, Splendor 2009, Freedom 2011, Valor 2012, Dream 2013
Celebrity: Summit 2011
Princess: Ruby 2010, 2014, Caribbean 2013, Coral 2014, Regal 2014, 2016
Star Clippers: Royal Clipper 2015