Kilra Yan
Member
I wrote a function which check if player has any input item equipped
Basically it works like that:
supposed you have to discover if player has the Axe Of Abadon equipped you call
if (IsEquipped (mobile as PlayerMobile, Axeofabadon))
{ do this }
could become useful in order not to recall everytime the exact layer reference.
Basically it works like that:
supposed you have to discover if player has the Axe Of Abadon equipped you call
if (IsEquipped (mobile as PlayerMobile, Axeofabadon))
{ do this }
could become useful in order not to recall everytime the exact layer reference.
Code:
public bool IsEquipped( Mobile m, Item item )
{
if (m == null)
return false;
foreach (Layer l in Enum.GetValues(typeof(Layer)))
{
Item tocheck = m.FindItemOnLayer( l );
if (tocheck == item)
return true;
}
return false;
}