I just added this code to my server and am compiling it now. I will test it out and if it works well, I will post it in the code submissions section unless ndnet has any issues with that. Of course, all credit goes to ndnet.
I edited mine so that it just returns false and logs it:
Code:
/*------------------------------
Added to prevent MQ2
exploitation of equipping
normally-unequippable items
with effects and clicking them
for benefits. - ndnet
---------------------------------*/
if(item_slot && IsClient() && slot == USE_ITEM_SPELL_SLOT)
{
ItemInst *itm = CastToClient()->GetInv().GetItem(item_slot);
int bitmask = 1;
bitmask = bitmask << (CastToClient()->GetClass() - 1);
if( itm && itm->GetItem()->Classes != 65535 && (itm->GetItem()->Click.Type == ET_EquipClick) && !( itm->GetItem()->Classes & bitmask ) ){
// They are casting a spell on an item that requires equipping but shouldn't let them equip it
LogFile->write(EQEMuLog::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID);
//CastToClient()->DeleteItemInInventory(inventory_slot,0,false);
database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item with an invalid class");
return(false);
}
}
I didn't want it auto-banning people, just in case it might be a little buggy. But, I do want to prevent it and to log it. I think that should work.