本文整理汇总了C++中P_ITEM::getPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ P_ITEM::getPosition方法的具体用法?C++ P_ITEM::getPosition怎么用?C++ P_ITEM::getPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_ITEM
的用法示例。
在下文中一共展示了P_ITEM::getPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_item
//.........这里部分代码省略.........
setCrimGrey(pc_currchar, ServerScp::g_nLootingWillCriminal);
pc_currchar->sysmsg( TRANSLATE("You are loosing karma!"));
}
}
} // corpse stuff
container->SetMultiSerial(INVALID);
//at end reset decay of container
container->setDecayTime();
} // end cont valid
}
if ( !pi->corpse )
{
UpdateStatusWindow(s, pi);
tile_st tile;
data::seekTile( pi->getId(), tile);
if (!pc_currchar->IsGM() && (( pi->magic == 2 || ((tile.weight == 255) && ( pi->magic != 1))) && !pc_currchar->canAllMove() ) ||
(( pi->magic == 3|| pi->magic == 4) && !pc_currchar->isOwnerOf( pi )))
{
UI08 bounce[2]={ 0x27, 0x00 };
Xsend(s, bounce, 2);
//AoS/ Network->FlushBuffer(s);
if (client->isDragging()) // only restore item if it got draggged before !!!
{
client->resetDragging();
item_bounce4(s, pi );
}
} // end of can't get
else
{
// AntiChrist bugfix for the bad bouncing bug ( disappearing items when bouncing )
client->setDragging();
pi->setOldPosition( pi->getPosition() ); // first let's save the position
pi->oldlayer = pi->layer; // then the layer
pi->layer = 0;
if (!pi->isInWorld())
pc_currchar->playSFX(0x0057);
if (pi->amount>1)
{
UI16 amount = ShortFromCharPtr(buffer[s] +5);
if (amount > pi->amount)
amount = pi->amount;
else if (amount < pi->amount)
{ //get not all but a part of item ( piled? ), but anyway make a new one item
P_ITEM pin =archive::item::New();
(*pin)=(*pi);
pin->amount = (UI16)( pi->amount - amount);
pin->setContSerial(pi->getContSerial()); //Luxor
pin->setPosition( pi->getPosition() );
/*if( !pin->isInWorld() && isItemSerial( pin->getContSerial() ) )
pin->SetRandPosInCont( (P_ITEM)pin->getContainer() );*/
if ( pin->getOwnerSerial32() != INVALID )
pin->setOwnerSerial32( pi->getOwnerSerial32() );
statwindow(pc_currchar,pc_currchar);
pin->Refresh();//AntiChrist
}
if ( pi->getId() == ITEMID_GOLD)
{
P_ITEM pack= pc_currchar->getBackpack();
if (ISVALIDPI(pack)) // lb
if ( pi->getContSerial() == pack->getSerial32())
statwindow(pc_currchar, pc_currchar);
}
pi->amount = amount;
} // end if corpse
#ifdef SPAR_I_LOCATION_MAP
pointers::delFromLocationMap( pi );
#else
mapRegions->remove( pi );
#endif
pi->setPosition( 0, 0, 0 );
pi->setContSerial( INVALID, false );
}
}
int amt = 0, wgt;
if ( container == NULL )
{
wgt = (int)weights::LockeddownWeight( pi, &amt);
pc_currchar->weight += wgt;
statwindow(pc_currchar, pc_currchar);
}
}
示例2: doubleclick
/*!
\brief Double click
\author Ripper, rewrite by Endymion
\param ps client of player dbclick
\note Completely redone by Morrolan 20-07-99
\warning I use a define CASE for make more readable the code, if you change name of P_ITEM pi chage also the macro
\todo los
*/
void doubleclick(NXWCLIENT ps)
{
if(ps==NULL) return;
P_CHAR pc = ps->currChar();
VALIDATEPC( pc );
NXWSOCKET s = ps->toInt();
// the 0x80 bit in the first byte is used later for "keyboard" and should be ignored
SERIAL serial = LongFromCharPtr(buffer[s] +1) & 0x7FFFFFFF;
if (isCharSerial(serial))
{
P_CHAR pd=pointers::findCharBySerial(serial);
if(ISVALIDPC(pd))
dbl_click_character(ps, pd);
return;
}
P_ITEM pi = pointers::findItemBySerial(serial);
VALIDATEPI(pi);
if (pi->amxevents[EVENT_IONDBLCLICK]!=NULL) {
g_bByPass = false;
pi->amxevents[EVENT_IONDBLCLICK]->Call( pi->getSerial32(), pc->getSerial32() );
if (g_bByPass==true)
return;
}
/*
g_bByPass = false;
pi->runAmxEvent( EVENT_IONDBLCLICK, pi->getSerial32(), s );
if (g_bByPass==true)
return;
*/
if (!checkItemUsability(pc , pi, ITEM_USE_DBLCLICK))
return;
Location charpos= pc->getPosition();
if (pc->IsHiddenBySpell()) return; //Luxor: cannot use items if under invisible spell
if ( !pc->IsGM() && pc->objectdelay >= uiCurrentTime )
{
pc->sysmsg(TRANSLATE("You must wait to perform another action."));
return;
}
else
pc->objectdelay = SrvParms->objectdelay * MY_CLOCKS_PER_SEC + uiCurrentTime;
///MODIFY, CANT CLICK ITEM AT DISTANCE >2//////////////
if ( (pc->distFrom(pi)>2) && !pc->IsGM() && !(pc->nxwflags[0] & cChar::flagSpellTelekinesys) ) //Luxor: let's check also for the telekinesys spell
{
pc->sysmsg( TRANSLATE("Must be closer to use this!"));
pc->objectdelay=0;
return;
}
//<Anthalir> VARIAIBLI
tile_st item;
P_ITEM pack= pc->getBackpack();
VALIDATEPI( pack );
data::seekTile( pi->getId(), item );
//////FINEVARIABILI
if ( ServerScp::g_nEquipOnDclick )
{
// equip the item only if it is in the backpack of the player
if ((pi->getContSerial() == pack->getSerial32()) && (item.quality != 0) && (item.quality != LAYER_BACKPACK) && (item.quality != LAYER_MOUNT))
{
int drop[2]= {-1, -1}; // list of items to drop, there no reason for it to be larger
int curindex= 0;
NxwItemWrapper wea;
wea.fillItemWeared( pc, true, true, true );
for( wea.rewind(); !wea.isEmpty(); wea++ )
{
P_ITEM pj=wea.getItem();
if(!ISVALIDPI(pj))
continue;
if ((item.quality == LAYER_1HANDWEAPON) || (item.quality == LAYER_2HANDWEAPON))// weapons
{
if (pi->itmhand == 2) // two handed weapons or shield
{
if (pj->itmhand == 2)
drop[curindex++]= DEREF_P_ITEM(pj);
if ( (pj->itmhand == 1) || (pj->itmhand == 3) )
//.........这里部分代码省略.........
示例3: 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();
//.........这里部分代码省略.........