本文整理汇总了C++中P_ITEM::getOutMostCont方法的典型用法代码示例。如果您正苦于以下问题:C++ P_ITEM::getOutMostCont方法的具体用法?C++ P_ITEM::getOutMostCont怎么用?C++ P_ITEM::getOutMostCont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_ITEM
的用法示例。
在下文中一共展示了P_ITEM::getOutMostCont方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkWearable
LOGICAL checkWearable(P_CHAR pc, P_ITEM pi)
{
NXWSOCKET s = pc->getSocket();
if (s < 0)
return false;
if( (pi->getId()>>8) >= 0x40) // LB, client crashfix if multi-objects are moved to PD
return false;
tile_st tile;
data::seekTile(pi->getId(), tile);
if( ( clientDimension[s]==3 ) && (tile.quality==0) )
{
pc->sysmsg(TRANSLATE("You can't wear that"));
return false;
}
else
{
P_ITEM outmost = pi->getOutMostCont();
P_CHAR vendor = pointers::findCharBySerial( outmost->getContSerial() );
if( ISVALIDPC( vendor ) && ( vendor->getOwnerSerial32() != pc->getSerial32() ) )
{
return false;
}
}
if ( !pc->IsGM() && pi->st > pc->getStrength() && !pi->isNewbie() ) // now you can equip anything if it's newbie
{
pc->sysmsg(TRANSLATE("You are not strong enough to use that."));
return false;
}
else if ( !pc->IsGM() && !checkItemUsability(pc, pi, ITEM_USE_WEAR) )
{
return false;
}
else if ( (pc->getId() == BODY_MALE) && ( pi->getId()==0x1c00 || pi->getId()==0x1c02 || pi->getId()==0x1c04 || pi->getId()==0x1c06 || pi->getId()==0x1c08 || pi->getId()==0x1c0a || pi->getId()==0x1c0c ) ) // Ripper...so males cant wear female armor
{
pc->sysmsg(TRANSLATE("You cant wear female armor!"));
return false;
}
else if ((((pi->magic==2)||((tile.weight==255)&&(pi->magic!=1))) && !pc->canAllMove()) ||
( (pi->magic==3|| pi->magic==4) && !(pi->getOwnerSerial32()==pc->getSerial32())))
{
return false;
}
return true;
}
示例2: doubleclick
//.........这里部分代码省略.........
{
if (drop[i] > -1)
{
P_ITEM p_drop=MAKE_ITEM_REF(drop[i]);
if(ISVALIDPI(p_drop))
pc->UnEquip( p_drop );
}
}
}
pc->playSFX( itemsfx(pi->getId()) );
pc->Equip( pi );
}
else
{
if (drop[0] == -1)
{
pc->playSFX( itemsfx(pi->getId()) );
pc->Equip( pi );
}
}
return;
}
} // </Anthalir>
//<Luxor>: Circle of transparency bug fix
P_ITEM pCont;
Location dst;
pCont = pi->getOutMostCont();
if(pCont->isInWorld()) {
dst = pCont->getPosition();
} else {
P_CHAR pg_dst = pointers::findCharBySerial( pCont->getContSerial() );
VALIDATEPC(pg_dst);
dst = pg_dst->getPosition();
}
Location charPos = pc->getPosition();
charPos.z = dst.z;
charPos.dispz = dst.dispz;
if ( !pc->IsGM() && !lineOfSight( charPos, dst ) && !(pc->nxwflags[0] & cChar::flagSpellTelekinesys) ) {
pc->sysmsg( TRANSLATE( "You cannot reach the item" ) );
return;
}
//</Luxor>
P_CHAR itmowner = pi->getPackOwner();
if(!pi->isInWorld()) {
if (isItemSerial(pi->getContSerial()) && pi->type != ITYPE_CONTAINER)
{// Cant use stuff that isn't in your pack.
if ( ISVALIDPC(itmowner) && (itmowner->getSerial32()!=pc->getSerial32()) )
return;
}
else
if (isCharSerial(pi->getContSerial()) && pi->type!=(UI32)INVALID)
{// in a character.
P_CHAR wearedby = pointers::findCharBySerial(pi->getContSerial());
示例3: get_item
/*!
\brief Get an item
\author Unknow, revamped by Endymion
\param client the client
*/
void get_item( NXWCLIENT client ) // Client grabs an item
{
if ( client == NULL)
return;
P_CHAR pc_currchar = client->currChar();
VALIDATEPC( pc_currchar );
NXWSOCKET s = client->toInt();
P_ITEM pi = pointers::findItemBySerPtr(buffer[s]+1);
VALIDATEPI(pi);
//Luxor: not-movable items
/*if (pi->magic == 2 || (isCharSerial(pi->getContSerial()) && pi->getContSerial() != pc_currchar->getSerial32()) ) {
if (isCharSerial(pi->getContSerial())) {
P_CHAR pc_i = pointers::findCharBySerial(pi->getContSerial());
if (ISVALIDPC(pc_i))
pc_i->sysmsg("Warning, backpack bug located!");
}
if (client->isDragging()) {
client->resetDragging();
UpdateStatusWindow(s,pi);
}
pi->setContSerial( pi->getContSerial(true) );
pi->setPosition( pi->getOldPosition() );
pi->layer = pi->oldlayer;
pi->Refresh();
return;
}*/
pc_currchar->disturbMed(); // Meditation
tile_st item;
data::seekTile( pi->getId(), item );
// Check if item is equiped
if( pi->getContSerial() == pc_currchar->getSerial32() && pi->layer == item.quality )
{
if( pc_currchar->UnEquip( pi, 1 ) == 1 ) // bypass called
{
if( client->isDragging() )
{
UI08 cmd[1]= {0x29};
client->resetDragging();
Xsend(s, cmd, 1);
UpdateStatusWindow(s,pi);
//AoS/ Network->FlushBuffer(s);
}
return;
}
}
P_CHAR owner=NULL;
P_ITEM container=NULL;
if ( !pi->isInWorld() ) { // Find character owning item
if ( isCharSerial( pi->getContSerial()))
{
owner = pointers::findCharBySerial( pi->getContSerial());
}
else // its an item
{
//Endymion Bugfix:
//before check the container.. but if this cont is a subcont?
//so get the outmostcont and check it else:
//can loot without lose karma in subcont
//can steal in trade ecc
//not very good :P
container = pi->getOutMostCont();
if( isCharSerial( container->getContSerial() ) )
owner=pointers::findCharBySerial( container->getContSerial() );
}
if ( ISVALIDPC( owner ) && owner->getSerial32()!=pc_currchar->getSerial32() )
{
if ( !pc_currchar->IsGM() && owner->getOwnerSerial32() != pc_currchar->getSerial32() )
{// Own serial stuff by Zippy -^ Pack aniamls and vendors.
UI08 bounce[2]= { 0x27, 0x00 };
Xsend(s, bounce, 2);
//AoS/ Network->FlushBuffer(s);
if (client->isDragging())
{
client->resetDragging();
pi->setContSerial(pi->getContSerial(),true,false);
item_bounce3(pi);
UpdateStatusWindow(s,pi);
}
return;
}
}
}
if ( ISVALIDPI( container ) )
//.........这里部分代码省略.........
示例4: pack_item
void pack_item(NXWCLIENT ps, PKGx08 *pp) // Item is put into container
{
if (ps == NULL) return;
char temp[TEMP_STR_SIZE]; //xan -> this overrides the global temp var
char temp2[TEMP_STR_SIZE]; //xan -> this overrides the global temp var
int serial/*, serhash*/;
tile_st tile;
// bool abort=false;
NXWSOCKET s=ps->toInt();
P_CHAR pc=ps->currChar();
VALIDATEPC(pc);
Location charpos= pc->getPosition();
P_ITEM pack;
P_ITEM pCont = pointers::findItemBySerial(pp->Tserial);
VALIDATEPI(pCont);
P_ITEM pItem = pointers::findItemBySerial(pp->Iserial);
VALIDATEPI(pItem);
if (pItem->getId() >= 0x4000)
{
// abort=true; // LB crashfix that prevents moving multi objcts in BP's
ps->sysmsg(TRANSLATE("Hey, putting houses in your pack crashes your back and client!"));
}
//ndEndy recurse only a time
P_ITEM contOutMost = pCont->getOutMostCont();
P_CHAR contOwner = ( !contOutMost->isInWorld() )? pointers::findCharBySerial( contOutMost->getContSerial() ) : NULL;
if( ISVALIDPC(contOwner) ) {
//if ((contOwner->npcaitype==NPCAI_PLAYERVENDOR) && (contOwner->npc) && (contOwner->getOwnerSerial32()!=pc->getSerial32()) )
if ( contOwner->getSerial32() != pc->getSerial32() && contOwner->getOwnerSerial32() != pc->getSerial32() && !pc->IsGM() ) { // Luxor
ps->sysmsg(TRANSLATE("This aint your backpack!"));
Sndbounce5(s);
if (ps->isDragging()) {
ps->resetDragging();
item_bounce3(pItem);
if (pCont->getId() >= 0x4000)
senditem(s, pCont);
}
return;
}
}
if (pCont->amxevents[EVENT_IONPUTITEM]!=NULL) {
g_bByPass = false;
pCont->amxevents[EVENT_IONPUTITEM]->Call( pCont->getSerial32(), pItem->getSerial32(), pc->getSerial32() );
if (g_bByPass)
{
item_bounce6(ps,pItem);
return;
}
}
/*
g_bByPass = false;
pCont->runAmxEvent( EVENT_IONPUTITEM, pCont->getSerial32(), pItem->getSerial32(), pc->getSerial32() );
if (g_bByPass)
{ //AntiChrist to preview item disappearing
item_bounce6(ps,pItem);
return;
}
*/
if (pCont->layer==0 && pCont->getId() == 0x1E5E &&
pCont->getContSerial()==pc->getSerial32())
{
// Trade window???
serial=calcserial(pCont->moreb1, pCont->moreb2, pCont->moreb3, pCont->moreb4);
if(serial==-1) return;
P_ITEM pi_z = pointers::findItemBySerial(serial);
if (ISVALIDPI(pi_z))
if ((pi_z->morez || pCont->morez))
{
pi_z->morez=0;
pCont->morez=0;
sendtradestatus( pi_z, pCont );
}
}
if(SrvParms->usespecialbank)//only if special bank is activated
{
if(pCont->morey==MOREY_GOLDONLYBANK && pCont->morex==MOREX_BANK && pCont->type==ITYPE_CONTAINER)
{
if ( pItem->getId() == ITEMID_GOLD )
{//if they're gold ok
pc->playSFX( goldsfx(2) );
} else
{//if they're not gold..bounce on ground
ps->sysmsg(TRANSLATE("You can only put golds in this bank box!"));
pItem->setContSerial(-1);
pItem->MoveTo( charpos );
pItem->Refresh();
//.........这里部分代码省略.........