本文整理汇总了C++中P_ITEM::SetOwnSerial方法的典型用法代码示例。如果您正苦于以下问题:C++ P_ITEM::SetOwnSerial方法的具体用法?C++ P_ITEM::SetOwnSerial怎么用?C++ P_ITEM::SetOwnSerial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_ITEM
的用法示例。
在下文中一共展示了P_ITEM::SetOwnSerial方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetBankBox
P_ITEM cChar::GetBankBox( short banktype )
{
P_ITEM pi;
unsigned int ci=0;
vector<SERIAL> vecContainer = contsp.getData(serial);
for ( ci = 0; ci < vecContainer.size(); ci++)
{
pi = FindItemBySerial(vecContainer[ci]);
if (pi->type == 1 && pi->morex == 1)
if ( banktype == 1 && pi->morez == 123 && SrvParams->useSpecialBank())
return pi;
else if ( banktype != 1 || !SrvParams->useSpecialBank())
return pi;
}
// If we reach this point, bankbox wasn't found == wasn't created yet.
sprintf((char*)temp, "%s's bank box.", name.c_str());
UOXSOCKET s = calcSocketFromChar(this);
pi = Items->SpawnItem(this, 1, (char*)temp, 0, 0x09AB, 0, 0);
if(pi == NULL)
return NULL;
pi->layer=0x1d;
pi->SetOwnSerial(this->serial);
pi->SetContSerial(this->serial);
pi->morex=1;
if(SrvParams->useSpecialBank() && banktype == 1)//AntiChrist - Special Bank
pi->morey=123;//gold only bank
pi->type=1;
if (s != -1)
wearIt(s, pi);
return pi;
}
示例2: grabItem
//.........这里部分代码省略.........
outmostCont->setMoreZ(0);
// sendtradestatus( tradeWindow, outmostCont );
}
}
// If the top-most container ( thats important ) is a corpse
// and looting is a crime, flag the character criminal.
if( !pChar->isGM() && outmostCont && outmostCont->corpse() )
{
// For each item we take out we loose carma
// if the corpse is innocent and not in our guild
bool sameGuild = ( GuildCompare( pChar, outmostCont->owner() ) != 0 );
if( ( outmostCont->more2() == 1 ) && !pChar->Owns( outmostCont ) && !sameGuild )
{
// pChar->karma -= 5;
pChar->setKarma( pChar->karma() - 5 );
pChar->setCriminalTime( uiCurrentTime + SrvParams->crimtime() * MY_CLOCKS_PER_SEC );
socket->sysMessage( tr("You lost some karma.") );
}
}
// Check if the item is too heavy
//if( !pc_currchar->isGMorCounselor() )
//{
//} << Deactivated (DarkStorm)
// ==== Grabbing the Item is allowed here ====
// Remove eventual item-bonusses if we're unequipping something
if( pItem->container() && pItem->container()->isChar() )
{
P_CHAR wearer = dynamic_cast<P_CHAR>( pItem->container() );
if( wearer )
wearer->removeItemBonus( pItem );
// resend the stat window
if( wearer && wearer->objectType() == enPlayer )
{
P_PLAYER pp = dynamic_cast<P_PLAYER>(wearer);
if( pp->socket() )
pp->socket()->sendStatWindow();
}
}
// Send the user a pickup sound if we're picking it up
// From a container/paperdoll
if( !pItem->isInWorld() )
socket->soundEffect( 0x57, pItem );
// If we're picking up a specific amount of what we got
// Take that into account
if( amount < pItem->amount() )
{
UI32 pickedAmount = QMIN( amount, pItem->amount() );
// We only have to split if we're not taking it all
if( pickedAmount != pItem->amount() )
{
P_ITEM splitItem = new cItem( *pItem ); // Create a new item to pick that up
splitItem->setSerial( World::instance()->findItemSerial() );
splitItem->setAmount( pItem->amount() - pickedAmount );
P_ITEM pContainer = dynamic_cast<P_ITEM>(pItem->container());
if ( pContainer )
pContainer->addItem( splitItem, false );
splitItem->SetOwnSerial( pItem->ownSerial() );
splitItem->SetSpawnSerial( pItem->spawnserial );
// He needs to see the new item
splitItem->update();
// If we're taking something out of a spawn-region it's spawning "flag" is removed isn't it?
pItem->SetSpawnSerial( INVALID_SERIAL );
pItem->setAmount( pickedAmount );
}
}
// *normally* we should exclude the dragging socket here. but it works so as well.
pItem->removeFromView( true );
// Remove it from the World if it is in world, otherwise remove it from it's current container
if( pItem->isInWorld() )
MapObjects::instance()->remove( pItem );
else
pItem->removeFromCont( true );
// The item was in a multi
if( pItem->multis() != INVALID_SERIAL )
{
cMulti* pMulti = dynamic_cast< cMulti* >( FindItemBySerial( pItem->multis() ) );
if( pMulti )
pMulti->removeItem( pItem );
}
pChar->addItem( cBaseChar::Dragging, pItem );
if( weight != pChar->weight() )
socket->sendStatWindow();
}
示例3: grabItem
//.........这里部分代码省略.........
if( outmostCont && ( outmostCont->contserial == pChar->serial ) && ( outmostCont->layer() == 0 ) && ( outmostCont->id() == 0x1E5E ) )
{
// Get the other sides tradewindow
P_ITEM tradeWindow = FindItemBySerial( calcserial( outmostCont->moreb1(), outmostCont->moreb2(), outmostCont->moreb3(), outmostCont->moreb4() ) );
// If one of the trade-windows has the ack-status reset it
if( tradeWindow && ( tradeWindow->morez || outmostCont->morez ) )
{
tradeWindow->morez = 0;
outmostCont->morez = 0;
sendtradestatus( tradeWindow, outmostCont );
}
}
// If the top-most container ( thats important ) is a corpse
// and looting is a crime, flag the character criminal.
if( outmostCont && outmostCont->corpse() )
{
// For each item we take out we loose carma
// if the corpse is innocent and not in our guild
bool sameGuild = ( GuildCompare( pChar, FindCharBySerial( outmostCont->ownserial ) ) != 0 );
if( ( outmostCont->more2 == 1 ) && !pChar->Owns( outmostCont ) && !sameGuild )
{
pChar->karma -= 5;
criminal( pChar );
client->sysMessage( "You lost some karma." );
}
}
// Check if the item is too heavy
//if( !pc_currchar->isGMorCounselor() )
//{
//} << Deactivated (DarkStorm)
// ==== Grabbing the Item is allowed here ====
// Remove eventual item-bonusses if we're unequipping something
if( pItem->layer() > 0 )
{
P_CHAR wearer = FindCharBySerial( pItem->contserial );
if( wearer )
wearer->removeItemBonus( pItem );
}
// Send the user a pickup sound if we're picking it up
// From a container/paperdoll
if( !pItem->isInWorld() )
soundeffect( client->socket(), 0x00, 0x57 );
// If we're picking up a specific amount of what we got
// Take that into account
if( pItem->amount() > 1 )
{
UI32 pickedAmount = min( amount, pItem->amount() );
// We only have to split if we're not taking it all
if( pickedAmount != pItem->amount() )
{
P_ITEM splitItem = new cItem( *pItem ); // Create a new item to pick that up
splitItem->SetSerial( cItemsManager::getInstance()->getUnusedSerial() );
splitItem->setAmount( pItem->amount() - pickedAmount );
splitItem->setContSerial( pItem->contserial );
splitItem->SetOwnSerial( pItem->ownserial );
splitItem->SetSpawnSerial( pItem->spawnserial );
// He needs to see the new item
RefreshItem( splitItem );
// If we're taking something out of a spawn-region it's spawning "flag" is removed isn't it?
pItem->SetSpawnSerial( INVALID_SERIAL );
pItem->setAmount( pickedAmount );
}
}
pItem->setContSerial( pChar->serial );
pItem->SetMultiSerial( INVALID_SERIAL );
pItem->setLayer( 0x1E );
// It's in the equipment of another character
if( itemOwner && ( itemOwner != pChar ) )
{
itemOwner->weight -= pItem->getWeight();
statwindow( calcSocketFromChar( itemOwner ), itemOwner );
}
// If the item is in the bank or any sell-container it's NOT counted as char-weight
bool inBank = ( outmostCont && ( outmostCont->contserial == pChar->serial ) && ( outmostCont->layer() >= 0x1A ) );
// Add the weight if:
// - Picked from ground
// - Picked out of another character
// - Picked out of our bank or any other non-visible container
if( ( itemOwner != pChar ) || !inBank )
{
pChar->weight += pItem->getWeight();
statwindow( client->socket(), pChar );
}
}
示例4: grabItem
//.........这里部分代码省略.........
P_ITEM outmostCont = pItem->getOutmostItem();
// If the top-most container ( thats important ) is a corpse
// and looting is a crime, flag the character criminal.
if ( !pChar->isGM() && outmostCont && outmostCont->corpse() )
{
// For each item we take out we loose carma
// if the corpse is innocent and not in our guild
bool sameGuild = true;//( GuildCompare( pChar, outmostCont->owner() ) != 0 );
if ( outmostCont->hasTag( "notoriety" ) && outmostCont->getTag( "notoriety" ).toInt() == 1 && !pChar->owns( outmostCont ) && !sameGuild )
{
// pChar->karma -= 5;
pChar->setKarma( pChar->karma() - 5 );
pChar->setCriminalTime( Server::instance()->time() + Config::instance()->crimtime() * MY_CLOCKS_PER_SEC );
socket->sysMessage( tr( "You lost some karma." ) );
}
}
// Check if the item is too heavy
//if( !pc_currchar->isGMorCounselor() )
//{
//} << Deactivated (DarkStorm)
// ==== Grabbing the Item is allowed here ====
// Send the user a pickup sound if we're picking it up
// From a container/paperdoll
if ( !pItem->isInWorld() )
socket->soundEffect( 0x57, pItem );
// If we're picking up a specific amount of what we got
// Take that into account
if ( amount < pItem->amount() )
{
UI32 pickedAmount = QMIN( amount, pItem->amount() );
// We only have to split if we're not taking it all
if ( pickedAmount != pItem->amount() )
{
P_ITEM splitItem = pItem->dupe(); // Create a new item to pick that up
splitItem->setAmount( pItem->amount() - pickedAmount );
// Add tags to the splitted item
QStringList keys = pItem->getTags();
QStringList::const_iterator it = keys.begin();
for ( ; it != keys.end(); ++it )
{
splitItem->setTag( *it, pItem->getTag( *it ) );
}
P_ITEM pContainer = dynamic_cast<P_ITEM>( pItem->container() );
if ( pContainer )
pContainer->addItem( splitItem, false );
splitItem->SetOwnSerial( pItem->ownSerial() );
splitItem->setSpawnregion( pItem->spawnregion() );
// He needs to see the new item
splitItem->update();
// If we're taking something out of a spawn-region it's spawning "flag" is removed isn't it?
pItem->setAmount( pickedAmount );
}
}
// *normally* we should exclude the dragging socket here. but it works so as well.
pItem->removeFromView( true );
// Remove from spawnregion
pItem->setSpawnregion( 0 );
// Remove it from the World if it is in world, otherwise remove it from it's current container
if ( pItem->isInWorld() )
MapObjects::instance()->remove( pItem );
else
pItem->removeFromCont( true );
// Remove eventual item-bonusses if we're unequipping something
if ( pItem->container() && pItem->container()->isChar() )
{
P_CHAR wearer = dynamic_cast<P_CHAR>( pItem->container() );
// resend the stat window
if ( wearer && wearer->objectType() == enPlayer )
{
P_PLAYER pp = dynamic_cast<P_PLAYER>( wearer );
if ( pp->socket() )
pp->socket()->sendStatWindow();
}
}
pChar->addItem( cBaseChar::Dragging, pItem );
if ( weight != pChar->weight() )
{
socket->sendStatWindow();
}
}