mirror of
https://github.com/EQEmu/Server.git
synced 2026-11-25 19:07:16 +00:00
Added perl function function: CanClassEquipItem(item_id)
Returns a bool if can equip or not.
This commit is contained in:
1 parent
33767aeb91
commit
cafd0eaba1
3 files changed
+52
No files matched your search
@@ -5363,3 +5363,26 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot)
|
||||
return stat;
|
||||
}
|
||||
|
||||
bool Mob::CanClassEquipItem(uint32 item_id)
|
||||
{
|
||||
const Item_Struct* itm = nullptr;
|
||||
itm = database.GetItem(item_id);
|
||||
|
||||
if (!itm)
|
||||
return false;
|
||||
|
||||
if(itm->Classes == 65535 )
|
||||
return true;
|
||||
|
||||
if (GetClass() > 16)
|
||||
return false;
|
||||
|
||||
int bitmask = 1;
|
||||
bitmask = bitmask << (GetClass() - 1);
|
||||
|
||||
if(!(itm->Classes & bitmask))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user