Nottinghster
Tibia World RPG Developer
- Joined
- Oct 24, 2007
- Messages
- 1,576
- Solutions
- 6
- Reaction score
- 450
- Location
- Brazil - Rio de Janeiro
- GitHub
- Nottinghster
Try that function:
Code:
void Player::dropLoot(Container* corpse)
{
if(!corpse){
return;
}
uint32_t itemLoss = lossPercent[LOSS_ITEMS];
#ifdef __SKULLSYSTEM__
if(getSkull() == SKULL_RED){
itemLoss = 100;
}
#endif
if(!lootDrop){
itemLoss = 0;
}
if(itemLoss > 0){
for(int i = SLOT_FIRST; i < SLOT_LAST; ++i){
Item* item = inventory[i];
if(item && ((item->getContainer()) || ((uint32_t)random_range(1, 100)) <= itemLoss)){
g_game.internalMoveItem(this, corpse, INDEX_WHEREEVER, item, item->getItemCount(), 0);
}
}
}
else if (itemLoss == 0) {
for(int i = SLOT_FIRST; i < SLOT_LAST; ++i){
Item* item = inventory[i];
if (item && Item::items[item->getID()].abilities.preventItemLoss != 0) {
g_game.internalRemoveItem(item);
}
}
}
}