Skip to content

Commit

Permalink
Merge branch 'bugfix/fix-era-armor-values' of https://github.com/Bohi…
Browse files Browse the repository at this point in the history
…catv/ModernUO into bugfix/fix-era-armor-values
  • Loading branch information
Bohicatv committed Feb 5, 2025
2 parents a2bba95 + 2e2160e commit 15465ba
Show file tree
Hide file tree
Showing 18 changed files with 227 additions and 230 deletions.
42 changes: 20 additions & 22 deletions Projects/UOContent/Engines/ML Quests/Items/PrismaticCrystal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,30 @@ public override void OnDoubleClick(Mobile from)
return;
}

if (pm.InRange(GetWorldLocation(), 2))
if (!pm.InRange(GetWorldLocation(), 2))
{
if (MLQuestSystem.GetContext(pm)?.IsDoingQuest(typeof(UnfadingMemoriesPartOne)) == true &&
pm.Backpack.FindItemByType<PrismaticAmber>(false) == null)
{
Item amber = new PrismaticAmber();

if (pm.PlaceInBackpack(amber))
{
MLQuestSystem.MarkQuestItem(pm, amber);
Delete();
}
else
{
pm.SendLocalizedMessage(502385); // Your pack cannot hold this item.
amber.Delete();
}
}
else
{
pm.SendLocalizedMessage(1075464); // You already have as many of those as you need.
}
pm.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
return;
}

if (MLQuestSystem.GetContext(pm)?.IsDoingQuest(typeof(UnfadingMemoriesPartOne)) != true ||
pm.Backpack.FindItemByType<PrismaticAmber>(false) != null)
{
pm.SendLocalizedMessage(1075464); // You already have as many of those as you need.
return;
}

var amber = new PrismaticAmber();

if (pm.PlaceInBackpack(amber))
{
MLQuestSystem.MarkQuestItem(pm, amber);
Delete();
}
else
{
pm.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
pm.SendLocalizedMessage(502385); // Your pack cannot hold this item.
amber.Delete();
}
}
}
13 changes: 8 additions & 5 deletions Projects/UOContent/Engines/Plants/PlantItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -467,12 +467,15 @@ public override void OnDoubleClick(Mobile from)
return;
}

var loc = GetWorldLocation();

if (!from.InLOS(loc) || !from.InRange(loc, 2))
if (!IsChildOf(from))
{
from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 1019045); // I can't reach that.
return;
var loc = GetWorldLocation();

if (!from.InLOS(loc) || !from.InRange(loc, 2))
{
from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 1019045); // I can't reach that
return;
}
}

if (!IsUsableBy(from))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,22 +536,21 @@ public bool IsOn

public override void OnDoubleClick(Mobile from)
{
if (from.InRange(GetWorldLocation(), 2))
if (!from.InRange(GetWorldLocation(), 2))
{
if (IsOn)
{
IsOn = false;
from.PlaySound(0x3BE);
}
else
{
IsOn = true;
from.PlaySound(0x47);
}
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
return;
}

if (IsOn)
{
IsOn = false;
from.PlaySound(0x3BE);
}
else
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
IsOn = true;
from.PlaySound(0x47);
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions Projects/UOContent/Items/Food/Beverage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,17 +361,17 @@ public virtual bool ValidateUse(Mobile from, bool message)
}
}

if (from.Map != Map || !from.InRange(GetWorldLocation(), 2) || !from.InLOS(this))
if (from.Map == Map && from.InRange(GetWorldLocation(), 2) && from.InLOS(this))
{
if (message)
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
return true;
}

return false;
if (message)
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}

return true;
return false;
}

public virtual void Fill_OnTarget(Mobile from, object targ)
Expand Down
18 changes: 10 additions & 8 deletions Projects/UOContent/Items/Skill Items/Fishing/FishingPole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@ public FishingPole() : base(0x0DC0)

public override void OnDoubleClick(Mobile from)
{
var loc = GetWorldLocation();

if (!from.InLOS(loc) || !from.InRange(loc, 2))
{
from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 1019045); // I can't reach that
}
else
if (!IsChildOf(from))
{
Fishing.System.BeginHarvesting(from, this);
var loc = GetWorldLocation();

if (!from.InLOS(loc) || !from.InRange(loc, 2))
{
from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 1019045); // I can't reach that
return;
}
}

Fishing.System.BeginHarvesting(from, this);
}

public override void GetContextMenuEntries(Mobile from, ref PooledRefList<ContextMenuEntry> list)
Expand Down
41 changes: 21 additions & 20 deletions Projects/UOContent/Items/Skill Items/Misc/RecipeScroll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,28 +59,29 @@ public override void OnDoubleClick(Mobile from)

var r = Recipe;

if (r != null && from is PlayerMobile pm)
if (r == null || from is not PlayerMobile pm)
{
if (!pm.HasRecipe(r))
{
var chance = r.CraftItem.GetSuccessChance(pm, null, r.CraftSystem, false, out var allRequiredSkills);
return;
}

if (allRequiredSkills && chance >= 0.0)
{
// You have learned a new recipe: ~1_RECIPE~
pm.SendLocalizedMessage(1073451, r.TextDefinition.ToString());
pm.AcquireRecipe(r);
Delete();
}
else
{
pm.SendLocalizedMessage(1044153); // You don't have the required skills to attempt this item.
}
}
else
{
pm.SendLocalizedMessage(1073427); // You already know this recipe.
}
if (pm.HasRecipe(r))
{
pm.SendLocalizedMessage(1073427); // You already know this recipe.
return;
}

var chance = r.CraftItem.GetSuccessChance(pm, null, r.CraftSystem, false, out var allRequiredSkills);

if (allRequiredSkills && chance >= 0.0)
{
// You have learned a new recipe: ~1_RECIPE~
pm.SendLocalizedMessage(1073451, r.TextDefinition.ToString());
pm.AcquireRecipe(r);
Delete();
}
else
{
pm.SendLocalizedMessage(1044153); // You don't have the required skills to attempt this item.
}
}
}
25 changes: 12 additions & 13 deletions Projects/UOContent/Items/Special/Heritage Items/Curtains.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,20 @@ public override void OnDoubleClick(Mobile from)
{
base.OnDoubleClick(from);

if (Addon != null)
if (Addon == null || !from.InRange(Location, 1))
{
if (from.InRange(Location, 1))
return;
}

foreach (var c in Addon.Components)
{
if (c is CurtainsComponent curtain)
{
(curtain.ItemID, curtain.ClosedId) = (curtain.ClosedId, curtain.ItemID);
}
else
{
foreach (var c in Addon.Components)
{
if (c is CurtainsComponent curtain)
{
(curtain.ItemID, curtain.ClosedId) = (curtain.ClosedId, curtain.ItemID);
}
else
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
}
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
}
}
Expand Down
58 changes: 28 additions & 30 deletions Projects/UOContent/Items/Special/Heritage Items/FruitTrees.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,40 +24,38 @@ public int Fruits

public override void OnComponentUsed(AddonComponent c, Mobile from)
{
if (from.InRange(c.Location, 2))
if (!from.InRange(c.Location, 2))
{
if (_fruits > 0)
{
var fruit = Fruit;

if (fruit == null)
{
return;
}

if (!from.PlaceInBackpack(fruit))
{
fruit.Delete();
from.SendLocalizedMessage(501015); // There is no room in your backpack for the fruit.
}
else
{
if (--Fruits == 0)
{
Timer.StartTimer(TimeSpan.FromMinutes(30), Respawn);
}

from.SendLocalizedMessage(501016); // You pick some fruit and put it in your backpack.
}
}
else
{
from.SendLocalizedMessage(501017); // There is no more fruit on this tree
}
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
return;
}

if (_fruits <= 0)
{
from.SendLocalizedMessage(501017); // There is no more fruit on this tree
return;
}

var fruit = Fruit;

if (fruit == null)
{
return;
}

if (!from.PlaceInBackpack(fruit))
{
fruit.Delete();
from.SendLocalizedMessage(501015); // There is no room in your backpack for the fruit.
}
else
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
if (--Fruits == 0)
{
Timer.StartTimer(TimeSpan.FromMinutes(30), Respawn);
}

from.SendLocalizedMessage(501016); // You pick some fruit and put it in your backpack.
}
}

Expand Down
23 changes: 11 additions & 12 deletions Projects/UOContent/Items/Special/Heritage Items/Guillotine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,22 @@ public GuillotineAddon()

public override void OnComponentUsed(AddonComponent c, Mobile from)
{
if (from.InRange(Location, 2))
if (!from.InRange(Location, 2))
{
if (Utility.RandomBool())
{
from.Location = Location;
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
return;
}

Timer.StartTimer(TimeSpan.FromSeconds(0.5), () => Activate(c, from));
}
else
{
// Hmm... you suspect that if you used this again, it might hurt.
from.LocalOverheadMessage(MessageType.Regular, 0, 501777);
}
if (Utility.RandomBool())
{
from.Location = Location;

Timer.StartTimer(TimeSpan.FromSeconds(0.5), () => Activate(c, from));
}
else
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
// Hmm... you suspect that if you used this again, it might hurt.
from.LocalOverheadMessage(MessageType.Regular, 0, 501777);
}
}

Expand Down
25 changes: 12 additions & 13 deletions Projects/UOContent/Items/Special/Heritage Items/IronMaiden.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,23 @@ public IronMaidenAddon()

public override void OnComponentUsed(AddonComponent c, Mobile from)
{
if (from.InRange(GetWorldLocation(), 2) && from.InLOS(GetWorldLocation()))
if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(GetWorldLocation()))
{
if (Utility.RandomBool())
{
from.Location = Location;
c.ItemID = 0x124A;
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
return;
}

Timer.StartTimer(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), 3, () => Activate(c, from));
}
else
{
// Hmm... you suspect that if you used this again, it might hurt.
from.LocalOverheadMessage(MessageType.Regular, 0, 501777);
}
if (Utility.RandomBool())
{
from.Location = Location;
c.ItemID = 0x124A;

Timer.StartTimer(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), 3, () => Activate(c, from));
}
else
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
// Hmm... you suspect that if you used this again, it might hurt.
from.LocalOverheadMessage(MessageType.Regular, 0, 501777);
}
}

Expand Down
Loading

0 comments on commit 15465ba

Please sign in to comment.