Skip to content

Commit

Permalink
+ Add backward compatibility for BaseTool.CheckAccessible()
Browse files Browse the repository at this point in the history
  • Loading branch information
Voxpire committed Feb 20, 2017
1 parent a725455 commit 8eeb69d
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions Scripts/Items/Tools/BaseTool.cs
Expand Up @@ -128,7 +128,7 @@ public virtual void DisplayDurabilityTo(Mobile m)
this.LabelToAffix(m, 1017323, AffixType.Append, ": " + this.m_UsesRemaining.ToString()); // Durability
}

public virtual bool CheckAccessible(Mobile m, ref int num)
public virtual bool CheckAccessible(Mobile m, ref int num)
{
if (!IsChildOf(m) && Parent != m)
{
Expand All @@ -139,7 +139,35 @@ public virtual bool CheckAccessible(Mobile m, ref int num)
return true;
}

public static bool CheckTool(Item tool, Mobile m)
public static bool CheckAccessible(Item tool, Mobile m)
{
return CheckAccessible(tool, m, false);
}

public static bool CheckAccessible(Item tool, Mobile m, bool message)
{
var num = 0;

bool res;

if (tool is BaseTool)
{
res = ((BaseTool)tool).CheckAccessible(m, ref num);
}
else
{
res = tool.IsChildOf(m) || tool.Parent == m;
}

if (num > 0 && message)
{
m.SendLocalizedMessage(num);
}

return res;
}

public static bool CheckTool(Item tool, Mobile m)
{
Item check = m.FindItemOnLayer(Layer.OneHanded);

Expand Down

2 comments on commit 8eeb69d

@kevin-10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this a conflict with VNC?

@Voxpire
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And any other non-distro code that could potentially use these methods.

Please sign in to comment.