fix(Core/Commands): Fix removing item from player account (#11041)

The additem command would silently return when trying to remove an item
from a player security level account
This commit is contained in:
SilentCLD
2022-05-06 04:33:18 +01:00
committed by GitHub
parent a3bf902c6d
commit 7975bc63ca

View File

@@ -1658,20 +1658,22 @@ public:
{
// output that player don't have any items to destroy
handler->PSendSysMessage(LANG_REMOVEITEM_FAILURE, handler->GetNameLink(playerTarget).c_str(), itemId);
handler->SetSentErrorMessage(true);
return false;
}
else if (!playerTarget->HasItemCount(itemId, -count))
if (!playerTarget->HasItemCount(itemId, -count))
{
// output that player don't have as many items that you want to destroy
handler->PSendSysMessage(LANG_REMOVEITEM_ERROR, handler->GetNameLink(playerTarget).c_str(), itemId);
handler->SetSentErrorMessage(true);
return false;
}
}
else
{
// output successful amount of destroyed items
playerTarget->DestroyItemCount(itemId, -count, true, false);
handler->PSendSysMessage(LANG_REMOVEITEM, itemId, -count, handler->GetNameLink(playerTarget).c_str());
}
// output successful amount of destroyed items
playerTarget->DestroyItemCount(itemId, -count, true, false);
handler->PSendSysMessage(LANG_REMOVEITEM, itemId, -count, handler->GetNameLink(playerTarget).c_str());
return true;
}