From be23031a32850642822b04c293b5a0746a667758 Mon Sep 17 00:00:00 2001 From: WarrentyExpired Date: Mon, 5 Oct 2026 10:12:55 -0400 Subject: [PATCH] #W# Added: Added a waterskin. Water only. Dclick will check surrounding area for water to refill or it will drink. --- Projects/UOContent/Items/Food/WaterSkin.cs | 124 ++++++++++++++++++ .../Mobiles/Vendors/SBInfo/SBBarkeeper.cs | 1 + .../Mobiles/Vendors/SBInfo/SBInnKeeper.cs | 1 + .../Mobiles/Vendors/SBInfo/SBProvisioner.cs | 1 + .../Mobiles/Vendors/SBInfo/SBTavernKeeper.cs | 1 + .../Mobiles/Vendors/SBInfo/SBWaiter.cs | 1 + 6 files changed, 129 insertions(+) create mode 100644 Projects/UOContent/Items/Food/WaterSkin.cs diff --git a/Projects/UOContent/Items/Food/WaterSkin.cs b/Projects/UOContent/Items/Food/WaterSkin.cs new file mode 100644 index 000000000..4f9d36112 --- /dev/null +++ b/Projects/UOContent/Items/Food/WaterSkin.cs @@ -0,0 +1,124 @@ +using System; +using Server; +using ModernUO.Serialization; + +namespace Server.Items +{ + [SerializationGenerator(0, false)] + public partial class WaterSkin : BaseBeverage + { + [Constructible] + public WaterSkin() : base(BeverageType.Water) + { + Name = "a waterskin"; + } + + public override double DefaultWeight => 1.0; + + public override int MaxQuantity => 15; + + public override bool ShowQuantity => false; + + public override int ComputeItemID() + { + return 0x098F; + } + + public override void GetProperties(IPropertyList list) + { + base.GetProperties(list); + list.Add(1060658, $"Uses remaining\t{Quantity}"); + } + + public override void OnDoubleClick(Mobile from) + { + if (!ValidateUse(from, true)) + return; + + if (TryRefill(from)) + return; + + if (IsEmpty) + { + from.SendMessage("It is empty. You need to find a water trough or river to refill it."); + return; + } + + Drink(from); + } + + private bool TryRefill(Mobile from) + { + if (Quantity >= MaxQuantity) + return false; + + bool foundWater = false; + + foreach (Item item in from.GetItemsInRange(2)) + { + if (item is IWaterSource || item is BaseWaterContainer || (item is AddonComponent ac && ac.Addon is IWaterSource)) + { + foundWater = true; + break; + } + } + + if (!foundWater && from.Map != null && from.Map != Map.Internal) + { + for (int x = -2; x <= 2 && !foundWater; x++) + { + for (int y = -2; y <= 2 && !foundWater; y++) + { + int checkX = from.X + x; + int checkY = from.Y + y; + + LandTile landTile = from.Map.Tiles.GetLandTile(checkX, checkY); + if ((TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags & TileFlag.Wet) != 0) + { + foundWater = true; + } + else + { + foreach (StaticTile staticTile in from.Map.Tiles.GetStaticTiles(checkX, checkY)) + { + if ((TileData.ItemTable[staticTile.ID & TileData.MaxItemValue].Flags & TileFlag.Wet) != 0) + { + foundWater = true; + break; + } + } + } + } + } + } + + if (foundWater) + { + Content = BeverageType.Water; + Quantity = MaxQuantity; + + from.SendLocalizedMessage(1010089); // "You fill the container with water." + from.PlaySound(0x240); // Standard splashing refill sound + return true; + } + + return false; + } + + private void Drink(Mobile from) + { + if (from.Thirst >= 20) + { + from.SendMessage("You are not thirsty right now."); + return; + } + + from.Thirst += 1; + + from.PlaySound(Utility.RandomList(0x30, 0x2D6)); // Standard drinking sounds + from.SendMessage("You take a refreshing drink of water."); + + Quantity--; + } + } +} diff --git a/Projects/UOContent/Mobiles/Vendors/SBInfo/SBBarkeeper.cs b/Projects/UOContent/Mobiles/Vendors/SBInfo/SBBarkeeper.cs index 7cf023464..ed9fe2720 100644 --- a/Projects/UOContent/Mobiles/Vendors/SBInfo/SBBarkeeper.cs +++ b/Projects/UOContent/Mobiles/Vendors/SBInfo/SBBarkeeper.cs @@ -29,6 +29,7 @@ namespace Server.Mobiles Add(new GenericBuyInfo(typeof(CheeseWheel), 21, 10, 0x97E, 0)); Add(new GenericBuyInfo(typeof(CookedBird), 17, 20, 0x9B7, 0)); Add(new GenericBuyInfo(typeof(LambLeg), 8, 20, 0x160A, 0)); + Add(new GenericBuyInfo(typeof(WaterSkin), 15, 20, 0x098F, 0)); Add(new GenericBuyInfo(typeof(WoodenBowlOfCarrots), 3, 20, 0x15F9, 0)); Add(new GenericBuyInfo(typeof(WoodenBowlOfCorn), 3, 20, 0x15FA, 0)); diff --git a/Projects/UOContent/Mobiles/Vendors/SBInfo/SBInnKeeper.cs b/Projects/UOContent/Mobiles/Vendors/SBInfo/SBInnKeeper.cs index 6f395221e..351c731f0 100644 --- a/Projects/UOContent/Mobiles/Vendors/SBInfo/SBInnKeeper.cs +++ b/Projects/UOContent/Mobiles/Vendors/SBInfo/SBInnKeeper.cs @@ -25,6 +25,7 @@ namespace Server.Mobiles Add(new BeverageBuyInfo(typeof(Pitcher), BeverageType.Wine, 11, 20, 0x1F9B, 0)); Add(new BeverageBuyInfo(typeof(Pitcher), BeverageType.Water, 11, 20, 0x1F9D, 0)); + Add(new GenericBuyInfo(typeof(WaterSkin), 15, 20, 0x098F, 0)); Add(new GenericBuyInfo(typeof(BreadLoaf), 6, 10, 0x103B, 0)); Add(new GenericBuyInfo(typeof(CheeseWheel), 21, 10, 0x97E, 0)); Add(new GenericBuyInfo(typeof(CookedBird), 17, 20, 0x9B7, 0)); diff --git a/Projects/UOContent/Mobiles/Vendors/SBInfo/SBProvisioner.cs b/Projects/UOContent/Mobiles/Vendors/SBInfo/SBProvisioner.cs index 40271ebb0..86bd211f3 100644 --- a/Projects/UOContent/Mobiles/Vendors/SBInfo/SBProvisioner.cs +++ b/Projects/UOContent/Mobiles/Vendors/SBInfo/SBProvisioner.cs @@ -59,6 +59,7 @@ namespace Server.Mobiles Add(new BeverageBuyInfo(typeof(BeverageBottle), BeverageType.Wine, 7, 20, 0x9C7, 0)); Add(new BeverageBuyInfo(typeof(BeverageBottle), BeverageType.Liquor, 7, 20, 0x99B, 0)); Add(new BeverageBuyInfo(typeof(Jug), BeverageType.Cider, 13, 20, 0x9C8, 0)); + Add(new GenericBuyInfo(typeof(WaterSkin), 15, 20, 0x098F, 0)); Add(new GenericBuyInfo(typeof(Pear), 3, 20, 0x994, 0)); Add(new GenericBuyInfo(typeof(Apple), 3, 20, 0x9D0, 0)); diff --git a/Projects/UOContent/Mobiles/Vendors/SBInfo/SBTavernKeeper.cs b/Projects/UOContent/Mobiles/Vendors/SBInfo/SBTavernKeeper.cs index f0a3d6e74..fb94da532 100644 --- a/Projects/UOContent/Mobiles/Vendors/SBInfo/SBTavernKeeper.cs +++ b/Projects/UOContent/Mobiles/Vendors/SBInfo/SBTavernKeeper.cs @@ -24,6 +24,7 @@ namespace Server.Mobiles Add(new BeverageBuyInfo(typeof(Pitcher), BeverageType.Liquor, 11, 20, 0x1F99, 0)); Add(new BeverageBuyInfo(typeof(Pitcher), BeverageType.Wine, 11, 20, 0x1F9B, 0)); Add(new BeverageBuyInfo(typeof(Pitcher), BeverageType.Water, 11, 20, 0x1F9D, 0)); + Add(new GenericBuyInfo(typeof(WaterSkin), 15, 20, 0x098F, 0)); Add(new GenericBuyInfo(typeof(BreadLoaf), 6, 10, 0x103B, 0)); Add(new GenericBuyInfo(typeof(CheeseWheel), 21, 10, 0x97E, 0)); diff --git a/Projects/UOContent/Mobiles/Vendors/SBInfo/SBWaiter.cs b/Projects/UOContent/Mobiles/Vendors/SBInfo/SBWaiter.cs index 2a695207a..cda212c5b 100644 --- a/Projects/UOContent/Mobiles/Vendors/SBInfo/SBWaiter.cs +++ b/Projects/UOContent/Mobiles/Vendors/SBInfo/SBWaiter.cs @@ -24,6 +24,7 @@ namespace Server.Mobiles Add(new BeverageBuyInfo(typeof(Pitcher), BeverageType.Wine, 11, 20, 0x1F9B, 0)); Add(new BeverageBuyInfo(typeof(Pitcher), BeverageType.Water, 11, 20, 0x1F9D, 0)); + Add(new GenericBuyInfo(typeof(WaterSkin), 15, 20, 0x098F, 0)); Add(new GenericBuyInfo(typeof(BreadLoaf), 6, 10, 0x103B, 0)); Add(new GenericBuyInfo(typeof(CheeseWheel), 21, 10, 0x97E, 0)); Add(new GenericBuyInfo(typeof(CookedBird), 17, 20, 0x9B7, 0));