food.js additions
Posted: Sat Dec 17, 2011 4:18 am
I noticed you could eat everything.. really even the bowls LOL
so here is my addition to the food.js so you can no longer eat bowls :0 just the food in the bowl
enjoy 
so here is my addition to the food.js so you can no longer eat bowls :0 just the food in the bowl
Code: Select all
function onUseChecked( pUser, iUsed )
{
var socket = pUser.socket;
if( socket && iUsed && iUsed.isItem )
{
//Check to see if it's locked down
if( iUsed.movable == 2 || iUsed.movable == 3 )
{
socket.SysMessage( GetDictionaryEntry( 774, socket.Language ) ); //That is locked down and you cannot use it
return false;
}
var pHunger = pUser.hunger;
if( pHunger < 6 )
{
pUser.SoundEffect( (0x003A + RandomNumber( 0, 2 )), true );
if( pHunger >= 0 )
socket.SysMessage( GetDictionaryEntry( (408 + pHunger), socket.Language ) ); //You eat the food, but are still extremely hungry.
else
socket.SysMessage( GetDictionaryEntry( 415, socket.Language ) ); //You are simply too full to eat any more!
iPoison = iUsed.poison;
if( iPoison && pUser.poison < iPoison )
{
socket.SysMessage( GetDictionaryEntry( (416 + RandomNumber( 0, 2 )), socket.Language ) ); //You feel disoriented and nauseous.
pUser.SoundEffect( 0x0246, true );
pUser.poison = iPoison;
pUser.SetTimer( 5, 180000 ); // Set the Poison Timer (Need to use uox.ini eventually)
}
if( iUsed.id == 0x15F9 || iUsed.id == 0x15FA || iUsed.id == 0x15FB || iUsed.id == 0x15FC )
{
CreateBlankItem( socket, pUser, 1, "#", 0x15F8, 0x0000, "ITEM", true );
pUser.hunger = (pHunger+2);
iUsed.Delete();
return false;
}
else if( iUsed.id == 0x15FE || iUsed.id == 0x15FF || iUsed.id == 0x1600 || iUsed.id == 0x1601 || iUsed.id == 0x1602 )
{
CreateBlankItem( socket, pUser, 1, "#", 0x15FD, 0x0000, "ITEM", true );
pUser.hunger = (pHunger+2);
iUsed.Delete();
return false;
}
else if( iUsed.id == 0x1604 || iUsed.id == 0x1606 )
{
CreateBlankItem( socket, pUser, 1, "#", 0x1605, 0x0000, "ITEM", true );
pUser.hunger = (pHunger+2);
iUsed.Delete();
return false;
}
else
{
if( iUsed.amount > 1 )
iUsed.amount = (iUsed.amount-1);
else
iUsed.Delete();
}
pUser.hunger = (pHunger+1);
}
else
socket.SysMessage( GetDictionaryEntry( 407, socket.Language ) ); //You are simply too full to eat any more!
}
return false;
}