diff --git a/Projects/UOContent/Commands/Object Creation/Decorate.cs b/Projects/UOContent/Commands/Object Creation/Decorate.cs index e36944c44..25c311cd6 100644 --- a/Projects/UOContent/Commands/Object Creation/Decorate.cs +++ b/Projects/UOContent/Commands/Object Creation/Decorate.cs @@ -497,6 +497,9 @@ namespace Server.Commands } } + // Make light never run out of fuel. + light.Duration = TimeSpan.Zero; + if (!unlit) { light.Ignite(); diff --git a/Projects/UOContent/Commands/Object Creation/DecorateMag.cs b/Projects/UOContent/Commands/Object Creation/DecorateMag.cs index be9d86629..3160147f6 100644 --- a/Projects/UOContent/Commands/Object Creation/DecorateMag.cs +++ b/Projects/UOContent/Commands/Object Creation/DecorateMag.cs @@ -493,6 +493,9 @@ namespace Server.Commands } } + // Make light never run out of fuel. + light.Duration = TimeSpan.Zero; + if (!unlit) { light.Ignite(); diff --git a/Projects/UOContent/Engines/Craft/DefGlassblowing.cs b/Projects/UOContent/Engines/Craft/DefGlassblowing.cs index 0157f734a..c41ddb229 100644 --- a/Projects/UOContent/Engines/Craft/DefGlassblowing.cs +++ b/Projects/UOContent/Engines/Craft/DefGlassblowing.cs @@ -110,6 +110,7 @@ public class DefGlassblowing : CraftSystem AddCraft(typeof(CurvedFlask), 1044050, 1044612, 55.0, 105.0, typeof(Sand), 1044625, 2, 1044627); AddCraft(typeof(LongFlask), 1044050, 1044613, 57.5, 107.5, typeof(Sand), 1044625, 4, 1044627); AddCraft(typeof(LargeFlask), 1044050, 1044623, 60.0, 110.0, typeof(Sand), 1044625, 5, 1044627); + AddCraft(typeof(EmptyOilFlask), 1044050, 1150866, 70.0, 120.0, typeof(Sand), 1044625, 5, 1044627); AddCraft(typeof(AniSmallBlueFlask), 1044050, 1044614, 60.0, 110.0, typeof(Sand), 1044625, 5, 1044627); AddCraft(typeof(AniLargeVioletFlask), 1044050, 1044615, 60.0, 110.0, typeof(Sand), 1044625, 5, 1044627); AddCraft(typeof(AniRedRibbedFlask), 1044050, 1044624, 60.0, 110.0, typeof(Sand), 1044625, 7, 1044627); diff --git a/Projects/UOContent/Items/Lights/Lantern.cs b/Projects/UOContent/Items/Lights/Lantern.cs index 84c964ad5..b7cddd0cc 100644 --- a/Projects/UOContent/Items/Lights/Lantern.cs +++ b/Projects/UOContent/Items/Lights/Lantern.cs @@ -6,10 +6,12 @@ namespace Server.Items; [SerializationGenerator(0, false)] public partial class Lantern : BaseEquipableLight { + public static TimeSpan FullDuration = TimeSpan.FromMinutes(20); + [Constructible] public Lantern() : base(0xA25) { - Duration = Burnout ? TimeSpan.FromMinutes(20) : TimeSpan.Zero; + Duration = Burnout ? FullDuration : TimeSpan.Zero; Burning = false; Light = LightType.Circle300; diff --git a/Projects/UOContent/Items/Misc/OilFlask.cs b/Projects/UOContent/Items/Misc/OilFlask.cs new file mode 100644 index 000000000..6355d847b --- /dev/null +++ b/Projects/UOContent/Items/Misc/OilFlask.cs @@ -0,0 +1,109 @@ +using ModernUO.Serialization; +using Server.Targeting; + +namespace Server.Items; + +[SerializationGenerator(0)] +public partial class OilFlask : Item +{ + [Constructible] + public OilFlask(int amount = 1) : base(0x1C18) + { + Stackable = true; + Amount = amount; + } + + public override int LabelNumber => 1027199; // oil flask + public virtual int FilledMessageNumber => 1150864; // You fill the lamp with oil. + public virtual double FillMultiplier => 1; + + public override void OnDoubleClick(Mobile from) + { + from.SendLocalizedMessage(501947); // Select lantern to refuel. + from.BeginTarget(2, true, TargetFlags.None, OnTargetPicked); + } + + private void OnTargetPicked(Mobile from, object targeted) + { + if (targeted is Lantern lantern) + { + if (!lantern.Movable || lantern.Protected && from.AccessLevel == AccessLevel.Player) + { + from.SendLocalizedMessage(500685); // You can't use that, it belongs to someone else. + return; + } + + var wasBurning = lantern.Burning; + lantern.Douse(); + lantern.Duration = Lantern.FullDuration * FillMultiplier; + lantern.BurntOut = false; + + if (wasBurning) + { + lantern.Ignite(); + } + + from.SendLocalizedMessage(FilledMessageNumber); + + var emptyFlask = new EmptyOilFlask(); + if (!from.PlaceInBackpack(emptyFlask)) + { + var didStack = false; + var eable = from.GetItemsInRange(0); + + foreach (var i in eable) + { + if (i.StackWith(from, this, false)) + { + didStack = true; + break; + } + } + + eable.Free(); + + if (!didStack) + { + emptyFlask.MoveToWorld(Location, Map); + } + } + + Consume(1); + } + else + { + from.SendLocalizedMessage(502218); // You cannot use that. + } + } +} + +[SerializationGenerator(0)] +public partial class FishOilFlask : OilFlask +{ + [Constructible] + public FishOilFlask(int amount = 1) : base(amount) + { + } + + public override int LabelNumber => 1150863; // fish oil flask + public override int FilledMessageNumber => 1150865; // You fill the lamp with fish oil. It should burn for a nice long time. + public override double FillMultiplier => 2; +} + +[SerializationGenerator(0)] +public partial class EmptyOilFlask : Item +{ + [Constructible] + public EmptyOilFlask(int amount = 1) : base(0x1C18) + { + Stackable = true; + Amount = amount; + } + + public override int LabelNumber => 1150866; // empty oil flask + + public override void OnDoubleClick(Mobile from) + { + from.SendLocalizedMessage(500318); // This flask is empty. + } +} diff --git a/Projects/UOContent/Migrations/Server.Items.EmptyOilFlask.v0.json b/Projects/UOContent/Migrations/Server.Items.EmptyOilFlask.v0.json new file mode 100644 index 000000000..47943ee7a --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.EmptyOilFlask.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.EmptyOilFlask" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.FishOilFlask.v0.json b/Projects/UOContent/Migrations/Server.Items.FishOilFlask.v0.json new file mode 100644 index 000000000..84ee50148 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.FishOilFlask.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.FishOilFlask" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.OilFlask.v0.json b/Projects/UOContent/Migrations/Server.Items.OilFlask.v0.json new file mode 100644 index 000000000..5ae660ede --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.OilFlask.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.OilFlask" +} \ No newline at end of file diff --git a/Projects/UOContent/Mobiles/Vendors/SBInfo/SBProvisioner.cs b/Projects/UOContent/Mobiles/Vendors/SBInfo/SBProvisioner.cs index 6ee2af559..40271ebb0 100644 --- a/Projects/UOContent/Mobiles/Vendors/SBInfo/SBProvisioner.cs +++ b/Projects/UOContent/Mobiles/Vendors/SBInfo/SBProvisioner.cs @@ -34,8 +34,7 @@ namespace Server.Mobiles Add(new GenericBuyInfo(typeof(Candle), 6, 20, 0xA28, 0)); Add(new GenericBuyInfo(typeof(Torch), 8, 20, 0xF6B, 0)); Add(new GenericBuyInfo(typeof(Lantern), 2, 20, 0xA25, 0)); - - // TODO: Oil Flask @ 8GP + Add(new GenericBuyInfo(typeof(OilFlask), 9, 20, 0x1C18, 0)); Add(new GenericBuyInfo(typeof(Lockpick), 12, 20, 0x14FC, 0)); @@ -120,6 +119,7 @@ namespace Server.Mobiles Add(typeof(Candle), 3); Add(typeof(Torch), 4); Add(typeof(Lantern), 1); + Add(typeof(OilFlask), 7); Add(typeof(Lockpick), 6); Add(typeof(FloppyHat), 3); Add(typeof(WideBrimHat), 4);