本文整理汇总了C++中P_PLAYER::bodyID方法的典型用法代码示例。如果您正苦于以下问题:C++ P_PLAYER::bodyID方法的具体用法?C++ P_PLAYER::bodyID怎么用?C++ P_PLAYER::bodyID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_PLAYER
的用法示例。
在下文中一共展示了P_PLAYER::bodyID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: equipItem
void cDragItems::equipItem( cUOSocket *socket, cUORxWearItem *packet )
{
P_ITEM pItem = FindItemBySerial( packet->serial() );
P_CHAR pWearer = FindCharBySerial( packet->wearer() );
if( !pItem || !pWearer )
return;
P_PLAYER pChar = socket->player();
// We're dead and can't do that
if( pChar->isDead() )
{
socket->clilocMessage( 0x7A4D5, "", 0x3b2 ); // You can't do that when you're dead.
socket->bounceItem( pItem, BR_NO_REASON );
return;
}
// Our target is dead
if( ( pWearer != pChar ) && pWearer->isDead() )
{
socket->sysMessage( tr( "You can't equip dead players." ) );
socket->bounceItem( pItem, BR_NO_REASON );
return;
}
// Get our tile-information
tile_st pTile = TileCache::instance()->getTile( pItem->id() );
// Is the item wearable ? ( layer == 0 | equip-flag not set )
// Multis are not wearable are they :o)
if( pTile.layer == 0 || !( pTile.flag3 & 0x40 ) || pItem->isMulti() )
{
socket->sysMessage( tr( "This item cannot be equipped." ) );
socket->bounceItem( pItem, BR_NO_REASON );
return;
}
// Required Strength
if( pItem->st() > pWearer->strength() )
{
if( pWearer == pChar )
socket->sysMessage( tr( "You cannot wear that item, you seem not strong enough" ) );
else
socket->sysMessage( tr( "This person can't wear that item, it seems not strong enough" ) );
socket->bounceItem( pItem, BR_NO_REASON );
return;
}
// Required Dexterity
if( pItem->dx() > pWearer->dexterity() )
{
if( pWearer == pChar )
socket->sysMessage( tr( "You cannot wear that item, you seem not agile enough" ) );
else
socket->sysMessage( tr( "This person can't wear that item, it seems not agile enough" ) );
socket->bounceItem( pItem, BR_NO_REASON );
return;
}
// Required Intelligence
if( pItem->in() > pWearer->intelligence() )
{
if( pWearer == pChar )
socket->sysMessage( tr( "You cannot wear that item, you seem not smart enough" ) );
else
socket->sysMessage( tr( "This person can't wear that item, it seems not smart enough" ) );
socket->bounceItem( pItem, BR_NO_REASON );
return;
}
// Males can't wear female armor
if( ( pChar->bodyID() == 0x0190 ) && ( pItem->id() >= 0x1C00 ) && ( pItem->id() <= 0x1C0D ) )
{
socket->sysMessage( tr( "You cannot wear female armor." ) );
socket->bounceItem( pItem, BR_NO_REASON );
return;
}
// Needs a check (!)
// Checks for equipment on the same layer
// If there is any it tries to unequip it
// If that fails it cancels
// we also need to check if there is a twohanded weapon if we want to equip another weapon.
UI08 layer = pTile.layer;
bool twohanded = false;
P_ITEM equippedLayerItem = pWearer->atLayer( static_cast<cBaseChar::enLayer>(layer) );
if ( equippedLayerItem )
twohanded = equippedLayerItem->twohanded();
if( twohanded && ( layer == 1 || layer == 2 ) )
{
socket->sysMessage( tr("You can't hold another item while wearing a twohanded weapon!") );
socket->bounceItem( pItem, BR_NO_REASON );
return;
//.........这里部分代码省略.........