public static void UndressToBackpack( Mobile mobile )
{
Item bank = mobile.FindBankNoCreate( ); // cache bank
Item pack = mobile.Backpack; // cache pack
int i = mobile.Items.Count;
while( --i >= 0 ) // loop through equipped items in reverse
{
if( i >= mobile.Items.Count ) // prevent index out of range error
{
continue;
}
Item item = mobile.Items[i];
// only move items that are not the pack or bank
if( item != null && item != pack && item != bank )
{
if( item is EtherealMount ) // special case dismount
{
((EtherealMount)item).Rider = null;
}
else
{
// doesn't care about pack max items/weight
mobile.PlaceInBackpack( item );
}
}
}
}
We use essential cookies to make this site work, and optional cookies to enhance your experience.