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
{
[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]
[SerializableField(0, setter: "private")]

View file

@ -28,7 +28,8 @@ public interface ISlayer
}
[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;

View file

@ -2,62 +2,62 @@ using System;
using Server.Mobiles;
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;
}
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 Mobile mobile)
{
if (o is Item item)
{
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;
}
mobile.OnSingleClick(from);
return;
}
if (!Core.AOS)
{
item.OnSingleClick(from);
}
}
else
{
from.SendLocalizedMessage(500353); // You are not certain...
}
}
else if (o is Mobile mobile)
bool identified = false;
if (o is Item item)
{
if (item is IIdentifiable identifiable && from.CheckTargetSkill(SkillName.ItemID, item, 0, 100))
{
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...
}
}
}
}