本文整理汇总了C++中P_ITEM::poisoned方法的典型用法代码示例。如果您正苦于以下问题:C++ P_ITEM::poisoned方法的具体用法?C++ P_ITEM::poisoned怎么用?C++ P_ITEM::poisoned使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_ITEM
的用法示例。
在下文中一共展示了P_ITEM::poisoned方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dropFoodOnChar
// 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 );
}
示例2: dropOnBeggar
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 );
}