#W# Added: Added a waterskin. Water only. Dclick will check surrounding area for water to refill or it will drink.

This commit is contained in:
WarrentyExpired 2026-10-05 10:12:55 -04:00
parent 1be86c0a40
commit be23031a32
6 changed files with 129 additions and 0 deletions

View file

@ -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--;
}
}
}

View file

@ -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));

View file

@ -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));

View file

@ -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));

View file

@ -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));

View file

@ -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));