本文整理汇总了C++中P_PLAYER::Wears方法的典型用法代码示例。如果您正苦于以下问题:C++ P_PLAYER::Wears方法的具体用法?C++ P_PLAYER::Wears怎么用?C++ P_PLAYER::Wears使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_PLAYER
的用法示例。
在下文中一共展示了P_PLAYER::Wears方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dropOnItem
void cDragItems::dropOnItem( cUOSocket *socket, P_ITEM pItem, P_ITEM pCont, const Coord_cl &dropPos )
{
P_PLAYER pChar = socket->player();
if( pItem->isMulti() )
{
socket->sysMessage( tr( "You cannot put houses in containers" ) );
cUOTxBounceItem bounce;
bounce.setReason( BR_NO_REASON );
socket->send( &bounce );
Items->DeleItem( pItem );
return;
}
if( pItem->onDropOnItem( pCont ) )
{
if( socket->dragging() )
socket->bounceItem( socket->dragging(), BR_NO_REASON );
return;
}
else if( pCont->onDropOnItem( pItem ) )
{
if( socket->dragging() )
socket->bounceItem( socket->dragging(), BR_NO_REASON );
return;
}
// If the target belongs to another character
// It needs to be our vendor or else it's denied
P_CHAR packOwner = pCont->getOutmostChar();
if( ( packOwner ) && ( packOwner != pChar ) && !pChar->isGM() )
{
// For each item someone puts into there
// He needs to do a snoop-check
if( pChar->maySnoop() )
{
if( !pChar->checkSkill( SNOOPING, 0, 1000 ) )
{
socket->sysMessage( tr( "You fail to put that into %1's pack" ).arg( packOwner->name() ) );
socket->bounceItem( pItem, BR_NO_REASON );
return;
}
}
if( packOwner->objectType() == enPlayer ||
( packOwner->objectType() == enNPC && dynamic_cast<P_NPC>(packOwner)->owner() != pChar ) )
{
socket->sysMessage( tr("You cannot put that into the belongings of another player") );
socket->bounceItem( pItem, BR_NO_REASON );
return;
}
}
// If we put the item into a trade-window
// Reset the trade-status for both players
if( pCont->layer() == 0 && pCont->id() == 0x1E5E && pChar->Wears( pCont ) )
{
// Trade window???
P_ITEM tradeWindow = FindItemBySerial( calcserial( pCont->moreb1(), pCont->moreb2(), pCont->moreb3(), pCont->moreb4() ) );
// If it *IS* a trade-window, replace the status
if( tradeWindow && ( pCont->morez() || tradeWindow->morez() ) )
{
tradeWindow->setMoreZ(0);
pCont->setMoreZ(0);
// sendtradestatus( tradeWindow, pCont );
}
}
if( !pChar->canPickUp( pItem ) )
{
socket->bounceItem( pItem, BR_CANNOT_PICK_THAT_UP );
return;
}
// Trash can
if( pCont->type()==87 )
{
Items->DeleItem( pItem );
socket->sysMessage( tr( "As you let go of the item it disappears." ) );
return;
}
// Spell Book
cSpellBook *pBook = dynamic_cast< cSpellBook* >( pCont );
if( pBook )
{
SI08 spellId = NewMagic->calcSpellId( pItem->id() );
if( pItem->type() != 1105 || spellId < 0 )
{
socket->sysMessage( tr( "You can only put scrolls into a spellbook" ) );
socket->bounceItem( pItem, BR_NO_REASON );
return;
}
//.........这里部分代码省略.........