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;
}
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();
pm.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
return;
}
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.
}
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();
}
}
}

View file

@ -467,12 +467,15 @@ public partial class PlantItem : Item, ISecurable
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))

View file

@ -536,22 +536,21 @@ public partial class TowerLanternArtifact : BaseDecorationArtifact
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);
}
}
}

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)
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
return false;
return true;
}
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)

View file

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

View file

@ -59,28 +59,29 @@ public partial class RecipeScroll : Item
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.
}
}
}

View file

@ -31,21 +31,20 @@ public partial class CurtainsComponent : AddonComponent, IDyable
{
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)
{
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.
}
}
(curtain.ItemID, curtain.ClosedId) = (curtain.ClosedId, curtain.ItemID);
}
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)
{
if (from.InRange(c.Location, 2))
if (!from.InRange(c.Location, 2))
{
if (_fruits > 0)
{
var fruit = Fruit;
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
return;
}
if (fruit == null)
{
return;
}
if (_fruits <= 0)
{
from.SendLocalizedMessage(501017); // There is no more fruit on this tree
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);
}
var fruit = Fruit;
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
}
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.
}
}

View file

@ -28,23 +28,22 @@ public partial class GuillotineAddon : BaseAddon
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);
}
}

View file

@ -16,24 +16,23 @@ public partial class IronMaidenAddon : BaseAddon
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);
}
}

View file

@ -14,23 +14,22 @@ public partial class WallTorchComponent : AddonComponent
public override void OnDoubleClick(Mobile from)
{
if (from.InRange(Location, 2))
{
ItemID = ItemID switch
{
0x3D98 => 0x3D9B,
0x3D9B => 0x3D98,
0x3D94 => 0x3D97,
0x3D97 => 0x3D94,
_ => ItemID
};
Effects.PlaySound(Location, Map, 0x3BE);
}
else
if (!from.InRange(Location, 2))
{
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);
if (house?.IsCoOwner(from) == true)
if (house?.IsCoOwner(from) != true)
{
if (from.InRange(GetWorldLocation(), 3))
{
from.SendGump(new WreathAddonGump(from, this));
}
else
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
return;
}
if (from.InRange(GetWorldLocation(), 3))
{
from.SendGump(new WreathAddonGump(from, this));
}
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)
{
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)
{
from.SendGump(new RewardDemolitionGump(this, 1018318)); // Do you wish to re-deed this banner?
}
else
{
// You can only re-deed a banner if you placed it or you are the owner of the house.
from.SendLocalizedMessage(1018330);
}
var house = BaseHouse.FindHouseAt(this);
if (house?.IsOwner(from) == true)
{
from.SendGump(new RewardDemolitionGump(this, 1018318)); // Do you wish to re-deed this banner?
}
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)
{
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)
{
from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration?
}
else
{
// You can only re-deed this decoration if you are the house owner or originally placed the decoration.
from.SendLocalizedMessage(1049784);
}
var house = BaseHouse.FindHouseAt(this);
if (house?.IsOwner(from) == true)
{
from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration?
}
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)
{
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)
{
from.SendGump(new RewardDemolitionGump(this, 1018329)); // Do you wish to re-deed this skull?
}
else
{
// You can only re-deed a skull if you placed it or you are the owner of the house.
from.SendLocalizedMessage(1018328);
}
var house = BaseHouse.FindHouseAt(this);
if (house?.IsOwner(from) == true)
{
from.SendGump(new RewardDemolitionGump(this, 1018329)); // Do you wish to re-deed this skull?
}
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)
{
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)
{
from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration?
}
else
{
// You can only re-deed this decoration if you are the house owner or originally placed the decoration.
from.SendLocalizedMessage(1049784);
}
var house = BaseHouse.FindHouseAt(this);
if (house?.IsOwner(from) == true)
{
from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration?
}
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)
{
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)
{
from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration?
}
else
{
// You can only re-deed this decoration if you are the house owner or originally placed the decoration.
from.SendLocalizedMessage(1049784);
}
var house = BaseHouse.FindHouseAt(this);
if (house?.IsOwner(from) == true)
{
from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration?
}
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;
}
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 (!IsAccessibleTo(from))