本文整理汇总了C++中P_ITEM::isInWorld方法的典型用法代码示例。如果您正苦于以下问题:C++ P_ITEM::isInWorld方法的具体用法?C++ P_ITEM::isInWorld怎么用?C++ P_ITEM::isInWorld使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_ITEM
的用法示例。
在下文中一共展示了P_ITEM::isInWorld方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: glowHalo
void cChar::glowHalo(P_ITEM pi)
{
if (pi->glow != INVALID_SERIAL)
{
P_ITEM pHalo=FindItemBySerial(pi->glow);
if (!pHalo) return;
pHalo->layer=pi->layer; // copy layer information of the glowing item to the invisible light emitting object
if(pHalo->layer==0 && pi->isInWorld()) // unequipped -> light source coords = item coords
{
pHalo->dir=29;
pHalo->pos.x=pi->pos.x;
pHalo->pos.y=pi->pos.y;
pHalo->pos.z=pi->pos.z;
} else if (pHalo->layer==0 && !pi->isInWorld()) // euqipped -> light source coords = players coords
{
pHalo->pos.x=this->pos.x;
pHalo->pos.y=this->pos.y;
pHalo->pos.z=this->pos.z+4;
pHalo->dir=99; // gives no light in backpacks
} else
{
pHalo->pos.x=this->pos.x;
pHalo->pos.y=this->pos.y;
pHalo->pos.z=this->pos.z+4;
pHalo->dir=29;
}
RefreshItem(pHalo);//AntiChrist
}
}
示例2: getNearbyItems
PITEM_VECTOR* getNearbyItems( cObject* pObject, UI32 range, UI32 flags )
{
PITEM_VECTOR* pvItemsInRange = 0;
LOGICAL validCall = false;
P_ITEM pSelf = 0;
if( pObject != 0 )
{
if( isItemSerial( pObject->getSerial32() ) )
{
pSelf = static_cast<P_ITEM>(pObject);
if( pSelf->isInWorld() )
{
validCall = true;
}
}
else
{
validCall = true;
}
if( validCall )
pvItemsInRange = getNearbyItems( pObject->getPosition().x, pObject->getPosition().y, range, flags, pSelf );
}
return pvItemsInRange;
}
示例3: 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);
}
}
}
示例4:
static void item_bounce5(const UOXSOCKET s, const P_ITEM pi)
{
item_bounce3(pi);
if(pi->isInWorld())
{
if (pi->id1>=0x40)
senditem(s, pi);
}
else
senditem(s, pi);
}
示例5: bounceItem
void cDragItems::bounceItem( cUOSocket* socket, P_ITEM pItem, bool denyMove )
{
// Reject the move of the item
socket->bounceItem( pItem, BR_NO_REASON );
// If the Client is *not* dragging the item we don't need to reset it to it's original location
if( !socket->dragging() )
return;
// Sends the item to the backpack of char (client)
pItem->toBackpack( socket->player() );
// When we're dropping the item to the ground let's play a nice sound-effect
// to all in-range sockets
if( pItem->isInWorld() )
{
for( cUOSocket *mSock = cNetwork::instance()->first(); mSock; mSock = cNetwork::instance()->next() )
if( mSock->inRange( socket ) )
mSock->soundEffect( 0x42, pItem );
}
else
socket->soundEffect( 0x57, pItem );
}
示例6: bounceItem
void cDragItems::bounceItem( P_CLIENT client, P_ITEM pItem, bool denyMove )
{
// Reject the move of the item
cBounceItem pBounce( denyMove );
pBounce.send( client->socket() );
// If the Client is *not* dragging the item we don't need to reset it to it's original location
if( !client->dragging() )
return;
// Sends the item to the backpack of char (client)
pItem->toBackpack( client->player() );
// When we're dropping the item to the ground let's play a nice sound-effect
// to all in-range sockets
if( pItem->isInWorld() )
{
for( UOXSOCKET s = 0; s < now; s++ )
if( inrange2( s, pItem ) )
soundeffect( s, 0x00, 0x42 );
}
else
soundeffect( client->socket(), 0x00, 0x57 );
}
示例7: doubleclick
//.........这里部分代码省略.........
{
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());
if (ISVALIDPC(wearedby))
if (wearedby->getSerial32()!=pc->getSerial32() && pi->layer!=LAYER_UNUSED_BP && pi->type!=ITYPE_CONTAINER)
示例8: target_stealing
/*!
\brief Steal something
\author Unknow, completly rewritten by Endymion
\param ps the client
*/
void Skills::target_stealing( NXWCLIENT ps, P_TARGET t )
{
P_CHAR thief = ps->currChar();
VALIDATEPC(thief);
SERIAL target_serial = t->getClicked();
AMXEXECSVTARGET( thief->getSerial32(),AMXT_SKITARGS,STEALING,AMX_BEFORE);
//steal a char
if ( isCharSerial(target_serial) )
{
Skills::target_randomSteal(ps,t);
return;
}
const P_ITEM pi = pointers::findItemBySerial( target_serial );
VALIDATEPI(pi);
//steal a pickpocket, a steal training dummy
if( pi->getId() == 0x1E2D || pi->getId() == 0x1E2C )
{
Skills::PickPocketTarget(ps);
return;
}
//no stealing for items on layers other than 0 (equipped!) , newbie items, and items not being in containers allowed !
if ( pi->layer!=0 || pi->isNewbie() || pi->isInWorld() )
{
thief->sysmsg(TRANSLATE("You cannot steal that."));
return;
}
P_CHAR victim = pi->getPackOwner();
VALIDATEPC(victim);
if (victim->npcaitype == NPCAI_PLAYERVENDOR)
{
thief->sysmsg(TRANSLATE("You cannot steal from player vendors."));
return;
}
if ( (thief->getSerial32() == victim->getSerial32()) || (thief->getSerial32()==victim->getOwnerSerial32()) )
{
thief->sysmsg(TRANSLATE("You catch yourself red handed."));
return;
}
if (thief->distFrom( victim ) == 1)
{
int result;
R32 we = pi->getWeightActual();
int bonus= (int)( (1800 - we)/5 );
if ( thief->checkSkill( STEALING,0,(1000-bonus)) )
{
// 0 stealing 2 stones, 10 3 stones, 99.9 12 stones, 100 17 stones !!!
int cansteal = thief->skill[STEALING] > 999 ? 1700 : thief->skill[STEALING] + 200;
if ( we > cansteal )
{
thief->sysmsg(TRANSLATE("That is too heavy."));
return;
}
if (pi->amxevents[EVENT_IONSTOLEN]!=NULL)
{
g_bByPass = false;
pi->amxevents[EVENT_IONSTOLEN]->Call(pi->getSerial32(), thief->getSerial32(), victim->getSerial32());
if (g_bByPass==true)
return;
}
if (victim->amxevents[EVENT_CHR_ONSTOLEN])
{
g_bByPass = false;
victim->amxevents[EVENT_CHR_ONSTOLEN]->Call(victim->getSerial32(), thief->getSerial32());
if (g_bByPass==true)
return;
}
/*
pi->runAmxEvent( EVENT_IONSTOLEN, pi->getSerial32(), s, victim->getSerial32() );
if (g_bByPass==true)
return;
victim->runAmxEvent( EVENT_CHR_ONSTOLEN, victim->getSerial32(), s );
if (g_bByPass==true)
return;
*/
P_ITEM pack= thief->getBackpack();
VALIDATEPI(pack);
//.........这里部分代码省略.........
示例9: get_item
void cDragdrop::get_item(P_CLIENT ps) // Client grabs an item
{
int npc=-1, amount, update = 0, serial;
UOXSOCKET s = ps->GetSocket();
int cc = ps->GetCurrChar();
P_CHAR pc_currchar = MAKE_CHARREF_LR(cc);
serial = calcserial(buffer[s][1], buffer[s][2], buffer[s][3], buffer[s][4]);
if (serial == INVALID_SERIAL || buffer[s][1] < 0x40)
return; // landscape or a character
P_ITEM pi = FindItemBySerial(serial);
if (pi == NULL)
return;
pc_currchar->disturbMed(s); // Meditation
// Zippy's stealing changes
P_ITEM px = pi;
if (!px->isInWorld()) // Find character owning item
{
unsigned long loopexit = 0;
do // Find character owning item
{
if (isCharSerial(px->contserial))
{
npc = calcCharFromSer(px->contserial);
}
else // its an item
{
if (px->isInWorld())
{
npc=-1;
break;
}
px = FindItemBySerial(px->contserial);
// ANTICHRIST -- SECURE TRADE FIX
if (px != NULL) // LB overwriting x is essential here, dont change it!!!
{
if (px->layer == 0 && px->id() == 0x1E5E)
{
// Trade window???
serial = calcserial(px->moreb1, px->moreb2, px->moreb3, px->moreb4);
if (serial == INVALID_SERIAL)
return;
P_ITEM pi_z = FindItemBySerial(serial);
if ( pi_z != NULL )
if ((pi_z->morez || px->morez))
{
pi_z->morez = 0;
px->morez = 0;
sendtradestatus(pi_z, px);
}
}
// Blackwinds Looting is crime implementation
// changed slightly by Ripper
if (px->corpse != 0 && !pc_currchar->Owns(px))
{
P_CHAR co = FindCharBySerial(px->ownserial);
if (px->more2 == 1 && Guilds->Compare(DEREF_P_CHAR(pc_currchar), DEREF_P_CHAR(co)) == 0)
{
pc_currchar->karma -= 5;
criminal(DEREF_P_CHAR(pc_currchar));
sysmessage(s, "You lost some karma!");
}
npc = 0;
} // Criminal stuff
if (px->corpse != 0)
npc = 0;
} // end if x!=-1
if (px == NULL)
npc = 0;
}
} while ((npc==-1) &&(++loopexit < MAXLOOPS));
}
if (npc>0) // 0=corpse, hence >0 ..
{
if (!(pc_currchar->isGM()) && npc != DEREF_P_CHAR(pc_currchar) && ! pc_currchar->Owns(&chars[npc]))
{// Own serial stuff by Zippy -^ Pack aniamls and vendors.
bounce[1] = 0;
Xsend(s, bounce, 2);
if (ps->IsDragging())
{
ps->ResetDragging();
item_bounce3(pi);
pi->magic = 3;
}
return;
}
}
// End Zippy's change
// Boats->
if (px != NULL && npc!=-1)
{
if (px->multis>0)
imultisp.remove(px->multis, px->serial);
px->startDecay();
//.........这里部分代码省略.........
示例10: 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 ) )
//.........这里部分代码省略.........
示例11: pack_item
void pack_item(P_CLIENT ps, PKGx08 *pp) // Item is put into container
{
int j, serial;
bool abort=false;
UOXSOCKET s=ps->GetSocket();
CHARACTER cc=ps->GetCurrChar();
P_CHAR pc_currchar = MAKE_CHARREF_LR(cc);
serial=pp->Tserial;
if(serial == INVALID_SERIAL) abort=true;
const P_ITEM pCont= FindItemBySerial( serial );
serial=pp->Iserial;
if(serial == INVALID_SERIAL) abort=true;
const P_ITEM pItem = FindItemBySerial( serial );
if (pCont == NULL)
{
RefreshItem(pCont);//AntiChrist
return;
}
if (pItem == NULL || pCont == NULL) return; //LB
pItem->flags.isBeeingDragged=false;
if (pItem->id1>=0x40)
{
abort=true; // LB crashfix that prevents moving multi objcts in BP's
sysmessage(s,"Hey, putting houses in your pack crashes your back and client!");
}
j=DEREF_P_CHAR(GetPackOwner(pCont));
if (j>-1)
if (chars[j].npcaitype==17 && chars[j].isNpc() && !pc_currchar->Owns(&chars[j]))
{
abort=true;
sysmessage(s, "This aint your vendor!");
}
if(abort)
{//AntiChrist to preview item disappearing
item_bounce6(ps,pItem);
return;
}
if (pCont->layer==0 && pCont->id() == 0x1E5E &&
pc_currchar->Wears(pCont))
{
// Trade window???
serial=calcserial(pCont->moreb1, pCont->moreb2, pCont->moreb3, pCont->moreb4);
if(serial == INVALID_SERIAL) return;
P_ITEM pi_z = FindItemBySerial( serial );
if (pi_z != NULL)
if ((pi_z->morez || pCont->morez))
{
pi_z->morez=0;
pCont->morez=0;
sendtradestatus(pi_z, pCont);
}
}
//
//AntiChrist - Special Bank Stuff
//
//if morey==123 - gold only bank
//
if(SrvParms->usespecialbank)//only if special bank is activated
{
if(pCont->morey==123 && pCont->morex==1 && pCont->type==1)
{
if ( pItem->id() == 0x0EED )
{//if they're gold ok
goldsfx(s, 2);
} else
{//if they're not gold..bounce on ground
sysmessage(s,"You can only put golds in this bank box!");
pItem->SetContSerial(-1);
pItem->MoveTo(pc_currchar->pos.x,pc_currchar->pos.y,pc_currchar->pos.z);
RefreshItem(pItem);//AntiChrist
itemsfx(s,pItem->id());
return;
}
}
}
//testing UOP Blocking Tauriel 1-12-99
if (!pItem->isInWorld())
{
item_bounce6(ps,pItem);
return;
}
if (!pc_currchar->canPickUp(pItem))
{
Sndbounce5(s);
if (ps->IsDragging())
{
ps->ResetDragging();
item_bounce3(pItem);
//.........这里部分代码省略.........
示例12: checkTarget
bool cNewMagic::checkTarget( P_CHAR pCaster, stNewSpell *sInfo, cUORxTarget *target )
{
cUOSocket *socket;
if( pCaster->objectType() == enPlayer )
socket = dynamic_cast<P_PLAYER>(pCaster)->socket();
P_CHAR pChar = FindCharBySerial( target->serial() );
P_ITEM pItem = FindItemBySerial( target->serial() );
if( sInfo->targets & (TARGET_CHAR|TARGET_ITEM) && !pItem && !pChar )
{
socket->sysMessage( tr( "Please target an object" ) );
return false;
}
if( sInfo->targets & TARGET_CHAR && !pChar )
{
socket->sysMessage( tr( "Please target a living creature." ) );
return false;
}
if( sInfo->targets & TARGET_ITEM && !pItem )
{
socket->sysMessage( tr( "Please target an item." ) );
return false;
}
// Several checks (Get the correct position of the target and do NOT trust the position transmitted by the client)
Coord_cl pos = socket->player()->pos();
if( pChar )
pos = pChar->pos();
else if( pItem )
pos = pItem->pos();
else
{
pos.x = target->x();
pos.y = target->y();
pos.z = target->z();
}
if( pItem && !pItem->isInWorld() )
{
P_CHAR pOut = pItem->getOutmostChar();
if( pOut == socket->player() )
return true;
else
{
socket->clilocMessage( 0x7A258, "", 0x3b2 ); // You cannot reach that
return false;
}
}
else
{
// Distance check (VisRange + 5 for macros)
if( pos.distance( socket->player()->pos() ) > ( socket->player()->visualRange() + 5 ) )
{
socket->sysMessage( tr( "You can't see the target." ) );
return false;
}
// Line of Sight check
if( !lineOfSight( pos, socket->player()->pos()+Coord_cl( 0, 0, 13 ), WALLS_CHIMNEYS|TREES_BUSHES|ROOFING_SLANTED|LAVA_WATER|DOORS ) )
{
socket->sysMessage( tr( "You can't see the target." ) );
return false;
}
}
// Visibility check (Chars)
if( pChar && pChar->isHidden() && !socket->player()->isGM() )
{
socket->sysMessage( tr( "You can't see this character." ) );
return false;
}
// Visibility check (Items)
if( pItem && ( ( pItem->visible() == 1 && !socket->player()->Owns( pItem ) ) || pItem->visible() == 2 ) && !socket->player()->isGM() )
{
socket->sysMessage( tr( "You can't see this item." ) );
return false;
}
return true;
}
示例13: 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 );
}
}
示例14: get_item
void get_item(P_CLIENT ps) // Client grabs an item
{
int x, npc=-1, c, amount, update = 0, serial;
// tile_st tile;
int z;// antichrist for trade fix
UOXSOCKET s = ps->GetSocket();
int cc = ps->GetCurrChar();
P_CHAR pc_currchar = MAKE_CHARREF_LR(cc);
serial = calcserial(buffer[s][1], buffer[s][2], buffer[s][3], buffer[s][4]);
if (serial == INVALID_SERIAL || buffer[s][1] < 0x40)
return; // landscape or a character
P_ITEM pi = FindItemBySerial(serial);
if (pi == NULL)
return;
pc_currchar->disturbMed(s); // Meditation
// Zippy's stealing changes
x = DEREF_P_ITEM(pi);
if (!items[x].isInWorld()) // Find character owning item
{
int loopexit = 0;
do // Find character owning item
{
if (isCharSerial(items[x].contserial))
{
npc = calcCharFromSer(items[x].contserial);
}
else // its an item
{
if (items[x].isInWorld())
{
npc=-1;
break;
}
x = calcItemFromSer(items[x].contserial);
// ANTICHRIST -- SECURE TRADE FIX
if (x!=-1) // LB overwriting x is essential here, dont change it!!!
{
if (items[x].layer == 0 && items[x].id() == 0x1E5E)
{
// Trade window???
serial = calcserial(items[x].moreb1, items[x].moreb2, items[x].moreb3, items[x].moreb4);
if (serial == INVALID_SERIAL)
return;
z = calcItemFromSer(serial);
if (z!=-1)
if ((items[z].morez || items[x].morez))
{
items[z].morez = 0;
items[x].morez = 0;
sendtradestatus(z, x);
}
}
// Blackwinds Looting is crime implementation
// changed slightly by Ripper
if (items[x].corpse != 0 && !pc_currchar->Owns(&items[x]))
{
P_CHAR co = FindCharBySerial(items[x].ownserial);
if (items[x].more2 == 1 && Guilds->Compare(cc, DEREF_P_CHAR(co)) == 0)
{
pc_currchar->karma -= 5;
criminal(cc);
sysmessage(s, "You lost some karma!");
}
npc = 0;
} // Criminal stuff
if (items[x].corpse != 0)
npc = 0;
} // end if x!=-1
if (x==-1)
npc = 0;
}
} while ((npc==-1) &&(++loopexit < MAXLOOPS));
}
if (npc>0) // 0=corpse, hence >0 ..
{
if (!(pc_currchar->isGM()) && npc != cc && ! pc_currchar->Owns(&chars[npc]))
{// Own serial stuff by Zippy -^ Pack aniamls and vendors.
bounce[1] = 0;
Xsend(s, bounce, 2);
if (ps->IsDragging())
{
ps->ResetDragging();
item_bounce3(pi);
pi->magic = 3;
}
return;
}
}
// End Zippy's change
// Boats->
if (x!=-1 && npc!=-1)
{
if (items[x].multis>0)
//.........这里部分代码省略.........
示例15: grabItem
//.........这里部分代码省略.........
socket->sysMessage( "You can't see the item." );
bounceItem( socket, pItem, true );
return;
}*/
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();