#W# Merge: Merged with upstream. Conflicts resolved.

This commit is contained in:
WarrentyExpired 2026-10-27 19:56:03 -04:00
commit f6f50470a9
276 changed files with 6742 additions and 8845 deletions

View file

@ -1,10 +1,11 @@
using ModernUO.Serialization;
using Server.Engines.Craft.T2A;
using Server.Targeting;
namespace Server.Items;
[SerializationGenerator(0, false)]
public abstract partial class CookableFood : Item
public abstract partial class CookableFood : Item, IT2ACombinable
{
[SerializableField(0)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
@ -14,6 +15,21 @@ public abstract partial class CookableFood : Item
public abstract Food Cook();
public override void OnDoubleClick(Mobile from)
{
if (T2ACraftSystem.Enabled)
{
T2ACooking.Prompt(from, this);
}
else
{
base.OnDoubleClick(from);
}
}
public bool TryCombine(Mobile from, object target) =>
IsHeatSource(target) ? T2ACooking.BeginHeat(from, this, target) : T2ACooking.CannotCombine(from);
public static bool IsHeatSource(object targeted)
{
int itemID;

View file

@ -1,11 +1,12 @@
using System;
using ModernUO.Serialization;
using Server.Engines.Craft.T2A;
using Server.Targeting;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class Dough : Item
public partial class Dough : Item, IT2ACombinable
{
[Constructible]
public Dough() : base(0x103d)
@ -14,10 +15,68 @@ public partial class Dough : Item
}
public override double DefaultWeight => 1.0;
public override void OnDoubleClick(Mobile from)
{
if (T2ACraftSystem.Enabled)
{
T2ACooking.Prompt(from, this);
}
else
{
base.OnDoubleClick(from);
}
}
public bool TryCombine(Mobile from, object target)
{
if (CookableFood.IsHeatSource(target))
{
return T2ACooking.BeginHeat(from, this, target);
}
if (target is not Item item)
{
return T2ACooking.CannotCombine(from);
}
if (!T2ACooking.ValidateInPack(from, item))
{
return false;
}
Item result = item switch
{
JarHoney => new SweetDough(),
Pear => new UnbakedFruitPie(),
Peach => new UnbakedPeachCobbler(),
Apple => new UnbakedApplePie(),
Pumpkin or SmallPumpkin => new UnbakedPumpkinPie(),
Eggs => new UnbakedQuiche(),
Ham or Spam or CookedBird or FishSteak => new UnbakedMeatPie(),
Sausage => new UncookedSausagePizza(),
_ => null
};
if (result == null)
{
return T2ACooking.CannotCombine(from);
}
return T2ACooking.Combine(
from,
this,
item,
result,
item is JarHoney
? "You mix the dough with honey to make sweet dough."
: "You combine the dough with the ingredient."
);
}
}
[SerializationGenerator(0, false)]
public partial class SweetDough : Item
public partial class SweetDough : Item, IT2ACombinable
{
[Constructible]
public SweetDough() : base(0x103d)
@ -28,10 +87,79 @@ public partial class SweetDough : Item
public override double DefaultWeight => 1.0;
public override int LabelNumber => 1041340; // sweet dough
public override void OnDoubleClick(Mobile from)
{
if (T2ACraftSystem.Enabled)
{
T2ACooking.Prompt(from, this);
}
else
{
base.OnDoubleClick(from);
}
}
public bool TryCombine(Mobile from, object target)
{
if (CookableFood.IsHeatSource(target))
{
return T2ACooking.BeginHeat(from, this, target);
}
switch (target)
{
case JarHoney honey:
{
return T2ACooking.ValidateInPack(from, honey) && T2ACooking.Combine(
from,
this,
honey,
new CookieMix(),
"You mix the sweet dough with honey to make cookie mix."
);
}
case SackFlour sack:
{
if (!T2ACooking.ValidateInPack(from, sack))
{
return false;
}
if (!sack.IsOpen)
{
from.SendAsciiMessage("You must open the sack of flour first.");
return false;
}
return T2ACooking.Combine(
from,
this,
sack,
new CakeMix(),
"You mix the flour with sweet dough to make cake mix."
);
}
case BowlFlour bowl:
{
return T2ACooking.ValidateInPack(from, bowl) && T2ACooking.Combine(
from,
this,
bowl,
new CakeMix(),
"You mix the flour with sweet dough to make cake mix."
);
}
default:
{
return T2ACooking.CannotCombine(from);
}
}
}
}
[SerializationGenerator(0, false)]
public partial class JarHoney : Item
public partial class JarHoney : Item, IT2ACombinable
{
[Constructible]
public JarHoney() : base(0x9ec)
@ -40,10 +168,44 @@ public partial class JarHoney : Item
}
public override double DefaultWeight => 1.0;
public override void OnDoubleClick(Mobile from)
{
if (T2ACraftSystem.Enabled)
{
T2ACooking.Prompt(from, this);
}
else
{
base.OnDoubleClick(from);
}
}
public bool TryCombine(Mobile from, object target)
{
return target switch
{
Dough dough => T2ACooking.ValidateInPack(from, dough) && T2ACooking.Combine(
from,
this,
dough,
new SweetDough(),
"You mix the dough with honey to make sweet dough."
),
SweetDough sweetDough => T2ACooking.ValidateInPack(from, sweetDough) && T2ACooking.Combine(
from,
this,
sweetDough,
new CookieMix(),
"You mix the sweet dough with honey to make cookie mix."
),
_ => T2ACooking.CannotCombine(from)
};
}
}
[SerializationGenerator(0, false)]
public partial class BowlFlour : Item
public partial class BowlFlour : Item, IT2ACombinable
{
[Constructible]
public BowlFlour() : base(0xa1e)
@ -51,6 +213,41 @@ public partial class BowlFlour : Item
}
public override double DefaultWeight => 1.0;
public override void OnDoubleClick(Mobile from)
{
if (T2ACraftSystem.Enabled)
{
T2ACooking.Prompt(from, this);
}
else
{
base.OnDoubleClick(from);
}
}
public bool TryCombine(Mobile from, object target)
{
return target switch
{
SweetDough sweetDough => T2ACooking.ValidateInPack(from, sweetDough) && T2ACooking.Combine(
from,
this,
sweetDough,
new CakeMix(),
"You mix the flour with sweet dough to make cake mix."
),
Item item when T2ACooking.GetWaterSource(item) is { } water =>
T2ACooking.CanReachWater(from, item) && T2ACooking.Combine(
from,
this,
water,
new Dough(),
"You mix the flour with water to make dough."
),
_ => T2ACooking.CannotCombine(from)
};
}
}
[SerializationGenerator(0, false)]
@ -66,7 +263,7 @@ public partial class WoodenBowl : Item
[TypeAlias("Server.Items.SackFlourOpen")]
[SerializationGenerator(0, false)]
public partial class SackFlour : Item, IHasQuantity
public partial class SackFlour : Item, IHasQuantity, IT2ACombinable
{
[Constructible]
public SackFlour() : base(0x1039)
@ -104,7 +301,52 @@ public partial class SackFlour : Item, IHasQuantity
{
++ItemID;
}
if (!T2ACraftSystem.Enabled || !T2ACooking.ValidateInPack(from, this))
{
return;
}
if (IsOpen)
{
T2ACooking.Prompt(from, this);
}
else
{
from.SendAsciiMessage("You must open the sack of flour first.");
}
}
public bool TryCombine(Mobile from, object target)
{
if (!IsOpen)
{
from.SendAsciiMessage("You must open the sack of flour first.");
return false;
}
return target switch
{
SweetDough sweetDough => T2ACooking.ValidateInPack(from, sweetDough) && T2ACooking.Combine(
from,
this,
sweetDough,
new CakeMix(),
"You mix the flour with sweet dough to make cake mix."
),
Item item when T2ACooking.GetWaterSource(item) is { } water =>
T2ACooking.CanReachWater(from, item) && T2ACooking.Combine(
from,
this,
water,
new Dough(),
"You mix the flour with water to make dough."
),
_ => T2ACooking.CannotCombine(from)
};
}
public bool IsOpen => ItemID is not (0x1039 or 0x1045);
}
[SerializationGenerator(0, false)]

View file

@ -15,7 +15,7 @@ public partial class BigFish : Item, ICarvable
public BigFish() : base(0x09CC)
{
// TODO: Find correct formula. max on OSI currently 200, OSI dev says it's not 200 as max, and ~ 1/1,000,000 chance to get highest
Weight = Utility.RandomMinMax(3, 200);
Weight = Core.SE ? Utility.RandomMinMax(3, 200) : 100;
Hue = Utility.RandomBool() ? 0x847 : 0x58C;
}
@ -23,7 +23,8 @@ public partial class BigFish : Item, ICarvable
public void Carve(Mobile from, Item item)
{
ScissorHelper(from, new RawFishSteak(), Math.Max(16, (int)Weight) / 4, false);
var steaks = Core.SE ? Math.Max(4, (int)Weight / 5) : Math.Max(16, (int)Weight) / 4;
ScissorHelper(from, new RawFishSteak(), steaks, false);
}
public override void GetProperties(IPropertyList list)

View file

@ -16,7 +16,8 @@ public abstract partial class BaseMagicFish : Item
public virtual bool Apply(Mobile from)
{
var applied = SpellHelper.AddStatOffset(from, Type, Bonus, TimeSpan.FromMinutes(1.0));
var duration = Core.SE ? TimeSpan.FromSeconds(12.0) : TimeSpan.FromMinutes(1.0);
var applied = SpellHelper.AddStatOffset(from, Type, Bonus, duration);
if (!applied)
{
@ -50,7 +51,7 @@ public partial class PrizedFish : BaseMagicFish
{
}
public override int Bonus => 5;
public override int Bonus => Core.SE ? 1 : 5;
public override StatType Type => StatType.Int;
public override int LabelNumber => 1041073; // prized fish
@ -64,7 +65,7 @@ public partial class WondrousFish : BaseMagicFish
{
}
public override int Bonus => 5;
public override int Bonus => Core.SE ? 1 : 5;
public override StatType Type => StatType.Dex;
public override int LabelNumber => 1041074; // wondrous fish
@ -78,7 +79,7 @@ public partial class TrulyRareFish : BaseMagicFish
{
}
public override int Bonus => 5;
public override int Bonus => Core.SE ? 1 : 5;
public override StatType Type => StatType.Str;
public override int LabelNumber => 1041075; // truly rare fish

View file

@ -12,12 +12,6 @@ public partial class SOS : Item
// By default let's use the old gump, because we can.
private static bool UseNewMessages = false;
private static int[] WaterTiles =
{
0x00A8, 0x00AB,
0x0136, 0x0137
};
private static Rectangle2D[] BritRegions = { new(0, 0, 5120, 4096) };
private static Rectangle2D[] IlshRegions =
@ -179,34 +173,7 @@ public partial class SOS : Item
var x = Utility.Random(reg.X, reg.Width);
var y = Utility.Random(reg.Y, reg.Height);
if (!ValidateDeepWater(map, x, y))
{
continue;
}
var valid = true;
for (int j = 1, offset = 5; valid && j <= 5; ++j, offset += 5)
{
if (!ValidateDeepWater(map, x + offset, y + offset))
{
valid = false;
}
else if (!ValidateDeepWater(map, x + offset, y - offset))
{
valid = false;
}
else if (!ValidateDeepWater(map, x - offset, y + offset))
{
valid = false;
}
else if (!ValidateDeepWater(map, x - offset, y - offset))
{
valid = false;
}
}
if (valid)
if (SpecialFishingNet.FullValidation(map, x, y))
{
return new Point3D(x, y, 0);
}
@ -215,19 +182,6 @@ public partial class SOS : Item
return Point3D.Zero;
}
private static bool ValidateDeepWater(Map map, int x, int y)
{
var tileID = map.Tiles.GetLandTile(x, y).ID;
var water = false;
for (var i = 0; !water && i < WaterTiles.Length; i += 2)
{
water = tileID >= WaterTiles[i] && tileID <= WaterTiles[i + 1];
}
return water;
}
private class MessageGump : StaticGump<MessageGump>
{
private readonly string _fmt;

View file

@ -10,8 +10,8 @@ namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class SpecialFishingNet : Item
{
private static int[] _hues =
{
private static readonly int[] _hues =
[
0x09B,
0x0CD,
0x0D3,
@ -26,25 +26,19 @@ public partial class SpecialFishingNet : Item
0x492,
0x4B5,
0x8AA
};
];
private static int[] _waterTiles =
{
0x00A8, 0x00AB,
0x0136, 0x0137
};
private static readonly int[] _waterTiles = [0x00A8, 0x00AB, 0x0136, 0x0137 ];
private static int[] _shallowWaterTiles =
{
0x1797, 0x179C
};
private static readonly int[] _shallowWaterTiles = [0x1797, 0x179C];
[SerializableField(0)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private bool _inUse;
[Constructible]
public SpecialFishingNet() : base(0x0DCA) => Hue = Utility.RandomDouble() < 0.01 ? _hues.RandomElement() : 0x8A0;
public SpecialFishingNet() : base(0x0DCA) =>
Hue = Core.LBR && Utility.RandomDouble() < 0.1 ? _hues.RandomElement() : 0x8A0;
public override double DefaultWeight => 1.0;
@ -322,31 +316,15 @@ public partial class SpecialFishingNet : Item
public static bool FullValidation(Map map, int x, int y)
{
if (!ValidateDeepWater(map, x, y))
// Every tile closer than 14 must be water, so land and the edge of the map are at least 14 tiles away.
for (var ty = y - 13; ty <= y + 13; ++ty)
{
return false;
}
for (int j = 1, offset = 5; j <= 5; ++j, offset += 5)
{
if (!ValidateDeepWater(map, x + offset, y + offset))
for (var tx = x - 13; tx <= x + 13; ++tx)
{
return false;
}
if (!ValidateDeepWater(map, x + offset, y - offset))
{
return false;
}
if (!ValidateDeepWater(map, x - offset, y + offset))
{
return false;
}
if (!ValidateDeepWater(map, x - offset, y - offset))
{
return false;
if (!ValidateDeepWater(map, tx, ty))
{
return false;
}
}
}

View file

@ -108,6 +108,7 @@ public partial class Spellbook : Item, ICraftable, ISlayer, IAosItem
[SerializedCommandProperty(AccessLevel.GameMaster, canModify: true)]
private AosSkillBonuses _skillBonuses;
[InvalidateProperties]
[SerializableField(8)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _spellCount;
@ -135,7 +136,6 @@ public partial class Spellbook : Item, ICraftable, ISlayer, IAosItem
[SerializableField(7, fieldChanged: nameof(OnContentChanged))]
[SerializedCommandProperty(AccessLevel.GameMaster)]
[InvalidateProperties]
private ulong _content;
private void OnContentChanged(ulong oldValue, ulong newValue)

View file

@ -159,7 +159,7 @@ public abstract partial class BaseTool : Item, IUsesRemaining, ICraftable
{
from.SendLocalizedMessage(num);
}
else if (T2ACraftSystem.Enabled)
else if (T2ACraftSystem.Enabled && T2ACraftSystem.HasMenu(system))
{
from.Target = new T2ACraftToolTarget(this, system);
from.SendAsciiMessage("Target this tool to make last item, or any other target to begin crafting.");

View file

@ -11,8 +11,9 @@ namespace Server.Items
public override bool ValidatesDuringHit => false;
// Mana is only checked here; OnHit/OnMiss charge it, since they run only for a shot that actually fired.
public override bool OnBeforeSwing(Mobile attacker, Mobile defender) =>
Validate(attacker) && CheckMana(attacker, true);
Validate(attacker) && CheckMana(attacker, false);
public override void OnMiss(Mobile attacker, Mobile defender)
{
@ -20,7 +21,10 @@ namespace Server.Items
ClearCurrentAbility(attacker);
attacker.SendLocalizedMessage(1060089); // You fail to execute your special move
if (CheckMana(attacker, true))
{
attacker.SendLocalizedMessage(1060089); // You fail to execute your special move
}
}
public override void OnHit(Mobile attacker, Mobile defender, int damage, WorldLocation worldLocation)
@ -29,7 +33,10 @@ namespace Server.Items
ClearCurrentAbility(attacker);
attacker.SendLocalizedMessage(1060216); // Your shot was successful
if (CheckMana(attacker, true))
{
attacker.SendLocalizedMessage(1060216); // Your shot was successful
}
}
}
}

View file

@ -206,7 +206,7 @@ namespace Server.Items
var result = base.OnCraft(quality, makersMark, from, craftSystem, typeRes, tool, craftItem, resHue);
if (Core.ML)
{
ApplyWoodBonuses(typeRes);
ApplyWoodBonuses(typeRes ?? craftItem.Resources[0].ItemType);
}
return result;