// Food was dropped on a pet void cDragItems::dropFoodOnChar( cUOSocket* socket, P_ITEM pItem, P_CHAR pChar ) { // Feed our pets if( pChar->hunger() >= 6 || pItem->type2() == 0 || !( pChar->nutriment() & ( 1 << (pItem->type2()-1) ) ) ) { socket->sysMessage( tr("It doesn't seem to want your item") ); bounceItem( socket, pItem ); return; } // We have three different eating-sounds (I don't like the idea as they sound too human) pChar->soundEffect( 0x3A + RandomNum( 1, 3 ) ); // If you want to poison a pet... Why not if( pItem->poisoned() && pChar->poisoned() < pItem->poisoned() ) { pChar->soundEffect( 0x246 ); pChar->setPoisoned( pItem->poisoned() ); // a lev.1 poison takes effect after 40 secs, a deadly pois.(lev.4) takes 40/4 secs - AntiChrist pChar->setPoisonTime( uiCurrentTime + ( MY_CLOCKS_PER_SEC * ( 40 / pChar->poisoned() ) ) ); //wear off starts after poison takes effect - AntiChrist pChar->setPoisonWearOffTime(pChar->poisonTime() + ( MY_CLOCKS_PER_SEC * SrvParams->poisonTimer() ) ); // Refresh the health-bar of our target pChar->resend( false ); } // *You see Snowwhite eating some poisoned apples* // Color: 0x0026 pChar->emote( tr( "*You see %1 eating %2*" ).arg( pChar->name() ).arg( pItem->getName() ) ); // We try to feed it more than it needs if( pChar->hunger() + pItem->amount() > 6 ) { pItem->setAmount( pItem->amount() - ( 6 - pChar->hunger() ) ); pChar->setHunger( 6 ); // Pack the rest into his backpack bounceItem( socket, pItem ); return; } pChar->setHunger( pChar->hunger() + pItem->amount() ); Items->DeleItem( pItem ); }
void cDragItems::dropOnBeggar( cUOSocket* socket, P_ITEM pItem, P_CHAR pBeggar ) { int tempint; if( ( pBeggar->hunger() < 6 ) && pItem->type() == 14 ) { pBeggar->talk( tr("*cough* Thank thee!") ); pBeggar->soundEffect( 0x3A + RandomNum( 1, 3 ) ); // If you want to poison a pet... Why not if( pItem->poisoned() && pBeggar->poisoned() < pItem->poisoned() ) { pBeggar->soundEffect( 0x246 ); pBeggar->setPoisoned( pItem->poisoned() ); // a lev.1 poison takes effect after 40 secs, a deadly pois.(lev.4) takes 40/4 secs - AntiChrist pBeggar->setPoisonTime( uiCurrentTime + ( MY_CLOCKS_PER_SEC * ( 40 / pBeggar->poisoned() ) ) ); //wear off starts after poison takes effect - AntiChrist pBeggar->setPoisonWearOffTime( pBeggar->poisonTime() + ( MY_CLOCKS_PER_SEC * SrvParams->poisonTimer() ) ); // Refresh the health-bar of our target pBeggar->resend( false ); } // *You see Snowwhite eating some poisoned apples* // Color: 0x0026 pBeggar->emote( tr( "*You see %1 eating %2*" ).arg( pBeggar->name() ).arg( pItem->getName() ) ); // We try to feed it more than it needs if( pBeggar->hunger() + pItem->amount() > 6 ) { // client->player()->karma += ( 6 - pBeggar->hunger() ) * 10; tempint = ( 6 - pBeggar->hunger() ) * 10; socket->player()->setKarma( socket->player()->karma() + tempint ); pItem->setAmount( pItem->amount() - ( 6 - pBeggar->hunger() ) ); pBeggar->setHunger( 6 ); // Pack the rest into his backpack bounceItem( socket, pItem ); return; } pBeggar->setHunger( pBeggar->hunger() + pItem->amount() ); // client->player()->karma += pItem->amount() * 10; tempint = pItem->amount() * 10; socket->player()->setKarma( socket->player()->karma() + tempint ); Items->DeleItem( pItem ); return; } // No Food? Then it has to be Gold if( pItem->id() != 0xEED ) { pBeggar->talk( tr("Sorry, but i can only use gold.") ); bounceItem( socket, pItem ); return; } pBeggar->talk( tr( "Thank you %1 for the %2 gold!" ).arg( socket->player()->name() ).arg( pItem->amount() ) ); socket->sysMessage( tr("You have gained some karma!") ); if( pItem->amount() <= 100 ) socket->player()->setKarma( socket->player()->karma() + 10 ); else socket->player()->setKarma( socket->player()->karma() + 50 ); Items->DeleItem( pItem ); }