fix: Fixes axes not working when equipped or in backpack (#2112)

This commit is contained in:
Kamron Batman 2025-02-04 22:11:29 -08:00 committed by GitHub
parent b83c52a7b1
commit d407847fc4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 224 additions and 227 deletions

View file

@ -24,32 +24,30 @@ public partial class PrismaticCrystal : Item
return; return;
} }
if (pm.InRange(GetWorldLocation(), 2)) if (!pm.InRange(GetWorldLocation(), 2))
{ {
if (MLQuestSystem.GetContext(pm)?.IsDoingQuest(typeof(UnfadingMemoriesPartOne)) == true && pm.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
pm.Backpack.FindItemByType<PrismaticAmber>(false) == null) return;
{ }
Item amber = new PrismaticAmber();
if (pm.PlaceInBackpack(amber)) if (MLQuestSystem.GetContext(pm)?.IsDoingQuest(typeof(UnfadingMemoriesPartOne)) != true ||
{ pm.Backpack.FindItemByType<PrismaticAmber>(false) != null)
MLQuestSystem.MarkQuestItem(pm, amber); {
Delete(); pm.SendLocalizedMessage(1075464); // You already have as many of those as you need.
} return;
else }
{
pm.SendLocalizedMessage(502385); // Your pack cannot hold this item. var amber = new PrismaticAmber();
amber.Delete();
} if (pm.PlaceInBackpack(amber))
} {
else MLQuestSystem.MarkQuestItem(pm, amber);
{ Delete();
pm.SendLocalizedMessage(1075464); // You already have as many of those as you need.
}
} }
else else
{ {
pm.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. pm.SendLocalizedMessage(502385); // Your pack cannot hold this item.
amber.Delete();
} }
} }
} }

View file

@ -467,12 +467,15 @@ public partial class PlantItem : Item, ISecurable
return; return;
} }
var loc = GetWorldLocation(); if (!IsChildOf(from))
if (!from.InLOS(loc) || !from.InRange(loc, 2))
{ {
from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 1019045); // I can't reach that. var loc = GetWorldLocation();
return;
if (!from.InLOS(loc) || !from.InRange(loc, 2))
{
from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 1019045); // I can't reach that
return;
}
} }
if (!IsUsableBy(from)) if (!IsUsableBy(from))

View file

@ -536,22 +536,21 @@ public partial class TowerLanternArtifact : BaseDecorationArtifact
public override void OnDoubleClick(Mobile from) public override void OnDoubleClick(Mobile from)
{ {
if (from.InRange(GetWorldLocation(), 2)) if (!from.InRange(GetWorldLocation(), 2))
{ {
if (IsOn) from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
{ return;
IsOn = false; }
from.PlaySound(0x3BE);
} if (IsOn)
else {
{ IsOn = false;
IsOn = true; from.PlaySound(0x3BE);
from.PlaySound(0x47);
}
} }
else else
{ {
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. IsOn = true;
from.PlaySound(0x47);
} }
} }
} }

View file

@ -361,17 +361,17 @@ public abstract partial class BaseBeverage : Item, IHasQuantity
} }
} }
if (from.Map != Map || !from.InRange(GetWorldLocation(), 2) || !from.InLOS(this)) if (from.Map == Map && from.InRange(GetWorldLocation(), 2) && from.InLOS(this))
{ {
if (message) return true;
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
return false;
} }
return true; if (message)
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
return false;
} }
public virtual void Fill_OnTarget(Mobile from, object targ) public virtual void Fill_OnTarget(Mobile from, object targ)

View file

@ -17,16 +17,18 @@ public partial class FishingPole : Item
public override void OnDoubleClick(Mobile from) public override void OnDoubleClick(Mobile from)
{ {
var loc = GetWorldLocation(); if (!IsChildOf(from))
{
var loc = GetWorldLocation();
if (!from.InLOS(loc) || !from.InRange(loc, 2)) if (!from.InLOS(loc) || !from.InRange(loc, 2))
{ {
from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 1019045); // I can't reach that from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 1019045); // I can't reach that
} return;
else }
{
Fishing.System.BeginHarvesting(from, this);
} }
Fishing.System.BeginHarvesting(from, this);
} }
public override void GetContextMenuEntries(Mobile from, ref PooledRefList<ContextMenuEntry> list) public override void GetContextMenuEntries(Mobile from, ref PooledRefList<ContextMenuEntry> list)

View file

@ -59,28 +59,29 @@ public partial class RecipeScroll : Item
var r = Recipe; var r = Recipe;
if (r != null && from is PlayerMobile pm) if (r == null || from is not PlayerMobile pm)
{ {
if (!pm.HasRecipe(r)) return;
{ }
var chance = r.CraftItem.GetSuccessChance(pm, null, r.CraftSystem, false, out var allRequiredSkills);
if (allRequiredSkills && chance >= 0.0) if (pm.HasRecipe(r))
{ {
// You have learned a new recipe: ~1_RECIPE~ pm.SendLocalizedMessage(1073427); // You already know this recipe.
pm.SendLocalizedMessage(1073451, r.TextDefinition.ToString()); return;
pm.AcquireRecipe(r); }
Delete();
} var chance = r.CraftItem.GetSuccessChance(pm, null, r.CraftSystem, false, out var allRequiredSkills);
else
{ if (allRequiredSkills && chance >= 0.0)
pm.SendLocalizedMessage(1044153); // You don't have the required skills to attempt this item. {
} // You have learned a new recipe: ~1_RECIPE~
} pm.SendLocalizedMessage(1073451, r.TextDefinition.ToString());
else pm.AcquireRecipe(r);
{ Delete();
pm.SendLocalizedMessage(1073427); // You already know this recipe. }
} else
{
pm.SendLocalizedMessage(1044153); // You don't have the required skills to attempt this item.
} }
} }
} }

View file

@ -31,21 +31,20 @@ public partial class CurtainsComponent : AddonComponent, IDyable
{ {
base.OnDoubleClick(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)
{ {
foreach (var c in Addon.Components) (curtain.ItemID, curtain.ClosedId) = (curtain.ClosedId, curtain.ItemID);
{ }
if (c is CurtainsComponent curtain) else
{ {
(curtain.ItemID, curtain.ClosedId) = (curtain.ClosedId, curtain.ItemID); from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
else
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
}
} }
} }
} }

View file

@ -24,40 +24,38 @@ public abstract partial class BaseFruitTreeAddon : BaseAddon
public override void OnComponentUsed(AddonComponent c, Mobile from) public override void OnComponentUsed(AddonComponent c, Mobile from)
{ {
if (from.InRange(c.Location, 2)) if (!from.InRange(c.Location, 2))
{ {
if (_fruits > 0) from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
{ return;
var fruit = Fruit; }
if (fruit == null) if (_fruits <= 0)
{ {
return; from.SendLocalizedMessage(501017); // There is no more fruit on this tree
} return;
}
if (!from.PlaceInBackpack(fruit)) var fruit = 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. if (fruit == null)
} {
} return;
else }
{
from.SendLocalizedMessage(501017); // There is no more fruit on this tree if (!from.PlaceInBackpack(fruit))
} {
fruit.Delete();
from.SendLocalizedMessage(501015); // There is no room in your backpack for the fruit.
} }
else 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.
} }
} }

View file

@ -28,23 +28,22 @@ public partial class GuillotineAddon : BaseAddon
public override void OnComponentUsed(AddonComponent c, Mobile from) public override void OnComponentUsed(AddonComponent c, Mobile from)
{ {
if (from.InRange(Location, 2)) if (!from.InRange(Location, 2))
{ {
if (Utility.RandomBool()) from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
{ return;
from.Location = Location; }
Timer.StartTimer(TimeSpan.FromSeconds(0.5), () => Activate(c, from)); if (Utility.RandomBool())
} {
else from.Location = Location;
{
// Hmm... you suspect that if you used this again, it might hurt. Timer.StartTimer(TimeSpan.FromSeconds(0.5), () => Activate(c, from));
from.LocalOverheadMessage(MessageType.Regular, 0, 501777);
}
} }
else 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);
} }
} }

View file

@ -16,24 +16,23 @@ public partial class IronMaidenAddon : BaseAddon
public override void OnComponentUsed(AddonComponent c, Mobile from) 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.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
{ return;
from.Location = Location; }
c.ItemID = 0x124A;
Timer.StartTimer(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), 3, () => Activate(c, from)); if (Utility.RandomBool())
} {
else from.Location = Location;
{ c.ItemID = 0x124A;
// Hmm... you suspect that if you used this again, it might hurt.
from.LocalOverheadMessage(MessageType.Regular, 0, 501777); Timer.StartTimer(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), 3, () => Activate(c, from));
}
} }
else 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);
} }
} }

View file

@ -14,23 +14,22 @@ public partial class WallTorchComponent : AddonComponent
public override void OnDoubleClick(Mobile from) public override void OnDoubleClick(Mobile from)
{ {
if (from.InRange(Location, 2)) if (!from.InRange(Location, 2))
{
ItemID = ItemID switch
{
0x3D98 => 0x3D9B,
0x3D9B => 0x3D98,
0x3D94 => 0x3D97,
0x3D97 => 0x3D94,
_ => ItemID
};
Effects.PlaySound(Location, Map, 0x3BE);
}
else
{ {
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
return;
} }
ItemID = ItemID switch
{
0x3D98 => 0x3D9B,
0x3D9B => 0x3D98,
0x3D94 => 0x3D97,
0x3D97 => 0x3D94,
_ => ItemID
};
Effects.PlaySound(Location, Map, 0x3BE);
} }
} }

View file

@ -92,16 +92,18 @@ public partial class WreathAddon : Item, IDyable, IAddon
{ {
var house = BaseHouse.FindHouseAt(this); var house = BaseHouse.FindHouseAt(this);
if (house?.IsCoOwner(from) == true) if (house?.IsCoOwner(from) != true)
{ {
if (from.InRange(GetWorldLocation(), 3)) return;
{ }
from.SendGump(new WreathAddonGump(from, this));
} if (from.InRange(GetWorldLocation(), 3))
else {
{ from.SendGump(new WreathAddonGump(from, this));
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. }
} else
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
} }
} }

View file

@ -71,23 +71,22 @@ public partial class Banner : Item, IAddon, IDyable, IRewardItem
public override void OnDoubleClick(Mobile from) public override void OnDoubleClick(Mobile from)
{ {
if (from.InRange(Location, 2)) if (!from.InRange(Location, 2))
{ {
var house = BaseHouse.FindHouseAt(this); from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
return;
}
if (house?.IsOwner(from) == true) var house = BaseHouse.FindHouseAt(this);
{
from.SendGump(new RewardDemolitionGump(this, 1018318)); // Do you wish to re-deed this banner? if (house?.IsOwner(from) == true)
} {
else from.SendGump(new RewardDemolitionGump(this, 1018318)); // Do you wish to re-deed this banner?
{
// You can only re-deed a banner if you placed it or you are the owner of the house.
from.SendLocalizedMessage(1018330);
}
} }
else else
{ {
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. // You can only re-deed a banner if you placed it or you are the owner of the house.
from.SendLocalizedMessage(1018330);
} }
} }
} }

View file

@ -55,23 +55,22 @@ public partial class DecorativeShield : Item, IAddon, IRewardItem
public override void OnDoubleClick(Mobile from) public override void OnDoubleClick(Mobile from)
{ {
if (from.InRange(Location, 2)) if (!from.InRange(Location, 2))
{ {
var house = BaseHouse.FindHouseAt(this); from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
return;
}
if (house?.IsOwner(from) == true) var house = BaseHouse.FindHouseAt(this);
{
from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration? if (house?.IsOwner(from) == true)
} {
else from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration?
{
// You can only re-deed this decoration if you are the house owner or originally placed the decoration.
from.SendLocalizedMessage(1049784);
}
} }
else else
{ {
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. // You can only re-deed this decoration if you are the house owner or originally placed the decoration.
from.SendLocalizedMessage(1049784);
} }
} }
} }

View file

@ -69,23 +69,22 @@ public partial class FlamingHead : StoneFaceTrapNoDamage, IAddon, IRewardItem
public override void OnDoubleClick(Mobile from) public override void OnDoubleClick(Mobile from)
{ {
if (from.InRange(Location, 2)) if (!from.InRange(Location, 2))
{ {
var house = BaseHouse.FindHouseAt(this); from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
return;
}
if (house?.IsOwner(from) == true) var house = BaseHouse.FindHouseAt(this);
{
from.SendGump(new RewardDemolitionGump(this, 1018329)); // Do you wish to re-deed this skull? if (house?.IsOwner(from) == true)
} {
else from.SendGump(new RewardDemolitionGump(this, 1018329)); // Do you wish to re-deed this skull?
{
// You can only re-deed a skull if you placed it or you are the owner of the house.
from.SendLocalizedMessage(1018328);
}
} }
else else
{ {
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. // You can only re-deed a skull if you placed it or you are the owner of the house.
from.SendLocalizedMessage(1018328);
} }
} }
} }

View file

@ -59,23 +59,22 @@ public partial class HangingSkeleton : Item, IAddon, IRewardItem
public override void OnDoubleClick(Mobile from) public override void OnDoubleClick(Mobile from)
{ {
if (from.InRange(Location, 3)) if (!from.InRange(Location, 3))
{ {
var house = BaseHouse.FindHouseAt(this); from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
return;
}
if (house?.IsOwner(from) == true) var house = BaseHouse.FindHouseAt(this);
{
from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration? if (house?.IsOwner(from) == true)
} {
else from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration?
{
// You can only re-deed this decoration if you are the house owner or originally placed the decoration.
from.SendLocalizedMessage(1049784);
}
} }
else else
{ {
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. // You can only re-deed this decoration if you are the house owner or originally placed the decoration.
from.SendLocalizedMessage(1049784);
} }
} }
} }

View file

@ -70,23 +70,22 @@ public partial class StoneAnkh : BaseAddon, IRewardItem
public override void OnComponentUsed(AddonComponent c, Mobile from) public override void OnComponentUsed(AddonComponent c, Mobile from)
{ {
if (from.InRange(Location, 2)) if (!from.InRange(Location, 2))
{ {
var house = BaseHouse.FindHouseAt(this); from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
return;
}
if (house?.IsOwner(from) == true) var house = BaseHouse.FindHouseAt(this);
{
from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration? if (house?.IsOwner(from) == true)
} {
else from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration?
{
// You can only re-deed this decoration if you are the house owner or originally placed the decoration.
from.SendLocalizedMessage(1049784);
}
} }
else else
{ {
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. // You can only re-deed this decoration if you are the house owner or originally placed the decoration.
from.SendLocalizedMessage(1049784);
} }
} }
} }

View file

@ -73,12 +73,15 @@ namespace Server.Items
return; return;
} }
var loc = GetWorldLocation(); if (!IsChildOf(from))
if (!from.InLOS(loc) || !from.InRange(loc, 2))
{ {
from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 1019045); // I can't reach that var loc = GetWorldLocation();
return;
if (!from.InLOS(loc) || !from.InRange(loc, 2))
{
from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 1019045); // I can't reach that
return;
}
} }
if (!IsAccessibleTo(from)) if (!IsAccessibleTo(from))