fix: Fixes Item ID so it doesn't gain from non-identifiable items (#2075)

This commit is contained in:
Kamron Batman 2025-01-18 10:58:22 -08:00 • committed by GitHub
parent c98b8fdeca
commit 09d6420320
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 50 additions and 48 deletions

View file

@ -13,7 +13,8 @@ using AMT = Server.Items.ArmorMaterialType;
namespace Server.Items namespace Server.Items
{ {
[SerializationGenerator(9, false)] [SerializationGenerator(9, false)]
public abstract partial class BaseArmor : Item, IScissorable, IFactionItem, ICraftable, IWearableDurability, IAosItem public abstract partial class BaseArmor
: Item, IScissorable, IFactionItem, ICraftable, IWearableDurability, IAosItem, IIdentifiable
{ {
[SerializedIgnoreDupe] [SerializedIgnoreDupe]
[SerializableField(0, setter: "private")] [SerializableField(0, setter: "private")]

View file

@ -28,7 +28,8 @@ public interface ISlayer
} }
[SerializationGenerator(10, false)] [SerializationGenerator(10, false)]
public abstract partial class BaseWeapon : Item, IWeapon, IFactionItem, ICraftable, ISlayer, IDurability, IAosItem public abstract partial class BaseWeapon
: Item, IWeapon, IFactionItem, ICraftable, ISlayer, IDurability, IAosItem, IIdentifiable
{ {
private static bool _enableInstaHit; private static bool _enableInstaHit;

View file

@ -2,62 +2,62 @@ using System;
using Server.Mobiles; using Server.Mobiles;
using Server.Targeting; using Server.Targeting;
namespace Server.Items namespace Server.Items;
public interface IIdentifiable
{ {
public static class ItemIdentification bool Identified { get; set; }
}
public static class ItemIdentification
{
public static void Initialize()
{ {
public static void Initialize() SkillInfo.Table[(int)SkillName.ItemID].Callback = OnUse;
}
public static TimeSpan OnUse(Mobile from)
{
from.SendLocalizedMessage(500343); // What do you wish to appraise and identify?
from.Target = new InternalTarget();
return TimeSpan.FromSeconds(1.0);
}
[PlayerVendorTarget]
private class InternalTarget : Target
{
public InternalTarget() : base(8, false, TargetFlags.None) => AllowNonlocal = true;
protected override void OnTarget(Mobile from, object o)
{ {
SkillInfo.Table[(int)SkillName.ItemID].Callback = OnUse; if (o is Mobile mobile)
}
public static TimeSpan OnUse(Mobile from)
{
from.SendLocalizedMessage(500343); // What do you wish to appraise and identify?
from.Target = new InternalTarget();
return TimeSpan.FromSeconds(1.0);
}
[PlayerVendorTarget]
private class InternalTarget : Target
{
public InternalTarget() : base(8, false, TargetFlags.None) => AllowNonlocal = true;
protected override void OnTarget(Mobile from, object o)
{ {
if (o is Item item) mobile.OnSingleClick(from);
{ return;
if (from.CheckTargetSkill(SkillName.ItemID, item, 0, 100)) }
{
if (item is BaseWeapon weapon)
{
weapon.Identified = true;
}
else if (item is BaseArmor armor)
{
armor.Identified = true;
}
if (!Core.AOS) bool identified = false;
{
item.OnSingleClick(from); if (o is Item item)
} {
} if (item is IIdentifiable identifiable && from.CheckTargetSkill(SkillName.ItemID, item, 0, 100))
else
{
from.SendLocalizedMessage(500353); // You are not certain...
}
}
else if (o is Mobile mobile)
{ {
mobile.OnSingleClick(from); identifiable.Identified = true;
identified = true;
} }
else
if (!Core.AOS)
{ {
from.SendLocalizedMessage(500353); // You are not certain... item.OnSingleClick(from);
} }
} }
if (!identified)
{
from.SendLocalizedMessage(500353); // You are not certain...
}
} }
} }
} }