本文整理汇总了C++中P_ITEM::getContSerial方法的典型用法代码示例。如果您正苦于以下问题:C++ P_ITEM::getContSerial方法的具体用法?C++ P_ITEM::getContSerial怎么用?C++ P_ITEM::getContSerial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_ITEM
的用法示例。
在下文中一共展示了P_ITEM::getContSerial方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// Name: item_bounce3
// Purpose: holds some statements that were COPIED some 50 times
// Remarks: temporary functions to revamp the 30 occurences of the 'bouncing bugfix'
// History: init Duke, 10.8.2000 / bugfix for bonus stats, Xanathar, 05-aug-2001
static void item_bounce3(const P_ITEM pi)
{
VALIDATEPI( pi );
pi->setContSerial( pi->getContSerial(true) );
pi->setPosition( pi->getOldPosition() );
pi->layer=pi->oldlayer;
P_CHAR pc = pointers::findCharBySerial( pi->getContSerial(true) );
if(pc==NULL)
return ;
VALIDATEPC( pc );
if ( pi->layer > 0 )
{
// Xanathar -- add BONUS STATS given by equipped special items
pc->setStrength( pc->getStrength() + pi->st2, true );
//pc->st += pi->st2;
pc->dx += pi->dx2;
pc->in += pi->in2;
// Xanathar -- for poisoned items
if (pi->poisoned)
{
pc->poison += pi->poisoned;
if ( pc->poison < 0)
pc->poison = 0;
}
}
}
示例2: updContMap
/*!
\brief updates containers map
\author Luxor
\param pi the item which the function will update in the containers map
*/
void updContMap(P_ITEM pi)
{
VALIDATEPI(pi);
vector<P_ITEM>::iterator contIter;
SI32 ser;
ser= pi->getContSerial(true);
if( ser > INVALID )
{
contIter = find(pContMap[ser].begin(), pContMap[ser].end(), pi);
if ( !pContMap[ser].empty() && (contIter!=pContMap[ser].end()) )
pContMap[ser].erase(contIter);
}
ser= pi->getContSerial();
if( ser > INVALID)
{
contIter = find(pContMap[ser].begin(), pContMap[ser].end(), pi);
if (!pContMap[ser].empty() && contIter != pContMap[ser].end())
pContMap[ser].erase(contIter);
pContMap[ser].push_back(pi);
}
}
示例3: UpdateStatusWindow
void UpdateStatusWindow(NXWSOCKET socket, P_ITEM pi)
{
P_CHAR pc = MAKE_CHAR_REF( currchar[socket] );
VALIDATEPC( pc );
VALIDATEPI( pi );
P_ITEM pack = pc->getBackpack();
VALIDATEPI( pack );
if( pi->getContSerial() != pack->getSerial32() || pi->getContSerial() == pc->getSerial32() )
statwindow( pc, pc );
}
示例4: delItem
/*!
\brief removes an item from items pointer and from the vector of his container
\author Luxor
\param pi the item
*/
void delItem(P_ITEM pi)
{
VALIDATEPI(pi);
if (pi->isInWorld())
{
#ifdef SPAR_I_LOCATION_MAP
pointers::delFromLocationMap(pi);
#else
mapRegions->remove(pi);
#endif
}
objects.eraseObject(pi);
eraseContainerInfo( pi->getSerial32() );
SERIAL cont=pi->getContSerial();
if ( cont > INVALID ) {
std::map<SERIAL, vector <P_ITEM> >::iterator vect( pContMap.find( cont ) );
if( ( vect!=pContMap.end() ) && !vect->second.empty() ) {
vector<P_ITEM>::iterator contIter;
contIter = find( vect->second.begin(), vect->second.end(), pi);
if( contIter != vect->second.end() )
vect->second.erase(contIter);
}
}
}
示例5: 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;
}
示例6: 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) )
//.........这里部分代码省略.........
示例7: snooping
/*!
\brief Snoop into container
\author Unknow, completly rewritten by Endymion
\param snooper the snooper
\param cont the contanier
*/
void snooping( P_CHAR snooper, P_ITEM cont )
{
VALIDATEPC(snooper);
NXWCLIENT ps = snooper->getClient();
if( ps == NULL ) return;
NXWSOCKET s = ps->toInt();
VALIDATEPI(cont);
P_CHAR owner = cont->getPackOwner();
VALIDATEPC(owner);
char temp[TEMP_STR_SIZE];
if (snooper->getSerial32() == owner->getSerial32())
snooper->showContainer(cont);
else if (snooper->IsGMorCounselor())
snooper->showContainer(cont);
else
if ((char_inRange(snooper, owner, 2)) ||(item_inRange(snooper, cont, 2)))
{
if ( owner->HasHumanBody() && ( owner->getOwnerSerial32()==snooper->getSerial32()))
snooper->showContainer(cont);
else if ( owner->npcaitype == NPCAI_PLAYERVENDOR)
snooper->showContainer(cont);
else
{
if ((cont->getContSerial()>1) && (cont->getContSerial() != snooper->getSerial32()) )
{
if ( owner->amxevents[EVENT_CHR_ONSNOOPED])
{
g_bByPass = false;
owner->amxevents[EVENT_CHR_ONSNOOPED]->Call( owner->getSerial32(), snooper->getSerial32());
if (g_bByPass==true) return;
}
/*
owner->runAmxEvent( EVENT_CHR_ONSNOOPED, owner->getSerial32(), s);
if (g_bByPass==true)
return;
*/
snooper->objectdelay=SrvParms->snoopdelay * MY_CLOCKS_PER_SEC + uiCurrentTime;
if ( owner->IsGMorCounselor())
{
snooper->sysmsg( TRANSLATE("You can't peek into that container or you'll be jailed."));// AntiChrist
sprintf( temp, TRANSLATE("%s is trying to snoop you!"), snooper->getCurrentNameC());
owner->sysmsg(temp);
return;
}
else if (snooper->checkSkill( SNOOPING, 0, 1000))
{
snooper->showContainer(cont);
snooper->sysmsg( TRANSLATE("You successfully peek into that container."));
}
else
{
snooper->sysmsg( TRANSLATE("You failed to peek into that container."));
if ( owner->npc )
owner->talk(s, TRANSLATE("Art thou attempting to disturb my privacy?"), 0);
else {
sprintf( temp, TRANSLATE("You notice %s trying to peek into your pack!"), snooper->getCurrentNameC());
owner->sysmsg( temp );
}
snooper->IncreaseKarma(-ServerScp::g_nSnoopKarmaLoss);//AntiChrist
snooper->modifyFame(-ServerScp::g_nSnoopFameLoss);//AntiChrist
setCrimGrey(snooper, ServerScp::g_nSnoopWillCriminal);
}
}
}
}
else {
snooper->sysmsg(TRANSLATE("You are too far away!"));
}
}
示例8: wear_item
void wear_item(NXWCLIENT ps) // Item is dropped on paperdoll
{
if ( ps == NULL )
return;
NXWSOCKET s = ps->toInt();
if (s < 0)
return;
P_CHAR pc=ps->currChar();
VALIDATEPC( pc );
P_CHAR pck = pointers::findCharBySerPtr(buffer[s]+6);
VALIDATEPC( pck );
if( pck->dead ) //Exploit fix: Dead ppl can't equip anything.
return;
P_ITEM pi=pointers::findItemBySerPtr(buffer[s]+1);
VALIDATEPI(pi);
bool resetDragging = false;
if( (pi->getId()>>8) >= 0x40) // LB, client crashfix if multi-objects are moved to PD
resetDragging = true;
tile_st tile;
int serial/*, letsbounce=0*/; // AntiChrist (5) - new ITEMHAND system
data::seekTile(pi->getId(), tile);
if( ( clientDimension[s]==3 ) && (tile.quality==0) )
{
ps->sysmsg(TRANSLATE("You can't wear that"));
resetDragging = true;
}
else {
P_ITEM outmost = pi->getOutMostCont();
P_CHAR vendor = pointers::findCharBySerial( outmost->getContSerial() );
if( ISVALIDPC( vendor ) && ( vendor->getOwnerSerial32() != pc->getSerial32() ) )
{
resetDragging = true;
}
}
if( resetDragging ) {
Sndbounce5(s);
if (ps->isDragging())
{
ps->resetDragging();
item_bounce4(s,pi);
UpdateStatusWindow(s,pi);
}
return;
}
if ( pck->getSerial32() == pc->getSerial32() || pc->IsGM() )
{
if ( !pc->IsGM() && pi->st > pck->getStrength() && !pi->isNewbie() ) // now you can equip anything if it's newbie
{
ps->sysmsg(TRANSLATE("You are not strong enough to use that."));
resetDragging = true;
}
else if ( !pc->IsGM() && !checkItemUsability(pc, pi, ITEM_USE_WEAR) )
{
resetDragging = true;
}
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
{
ps->sysmsg(TRANSLATE("You cant wear female armor!"));
resetDragging = true;
}
else if ((((pi->magic==2)||((tile.weight==255)&&(pi->magic!=1))) && !pc->canAllMove()) ||
( (pi->magic==3|| pi->magic==4) && !(pi->getOwnerSerial32()==pc->getSerial32())))
{
resetDragging = true;
}
if( resetDragging ) {
Sndbounce5(s);
if (ps->isDragging())
{
ps->resetDragging();
item_bounce4(s,pi);
UpdateStatusWindow(s,pi);
}
return;
}
// - AntiChrist (4) - checks for new ITEMHAND system
// - now you can't equip 2 hnd weapons with 1hnd weapons nor shields!!
serial= pck->getSerial32(); //xan -> k not cc :)
P_ITEM pj = NULL;
P_CHAR pc_currchar= pck;
// P_ITEM pack= pc_currchar->getBackpack();
//<Luxor>
P_ITEM pW = pc_currchar->getWeapon();
if (tile.quality == 1 || tile.quality == 2)
{ //weapons layers
//.........这里部分代码省略.........
示例9: 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 ) )
//.........这里部分代码省略.........
示例10: 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();
//.........这里部分代码省略.........