本文整理汇总了C++中P_ITEM::Delete方法的典型用法代码示例。如果您正苦于以下问题:C++ P_ITEM::Delete方法的具体用法?C++ P_ITEM::Delete怎么用?C++ P_ITEM::Delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_ITEM
的用法示例。
在下文中一共展示了P_ITEM::Delete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ItemDroppedOnTrainer
static bool ItemDroppedOnTrainer(NXWCLIENT ps, PKGx08 *pp, P_ITEM pi)
{
if (ps == NULL) return false;
VALIDATEPIR(pi, false);
NXWSOCKET s = ps->toInt();
P_CHAR pc = ps->currChar();
VALIDATEPCR(pc,false);
P_CHAR pc_t = pointers::findCharBySerial(pp->Tserial);
VALIDATEPCR(pc_t,false);
if( pi->getId() == ITEMID_GOLD )
{ // They gave the NPC gold
UI08 sk=pc_t->trainingplayerin;
pc_t->talk( s, TRANSLATE("I thank thee for thy payment. That should give thee a good start on thy way. Farewell!"),0);
int sum = pc->getSkillSum();
int delta = pc_t->getTeachingDelta(pc, sk, sum);
if(pi->amount>delta) // Paid too much
{
pi->amount-=delta;
Sndbounce5(s);
if (ps->isDragging())
{
ps->resetDragging();
item_bounce5(s,pi);
}
}
else
{
if(pi->amount < delta) // Gave less gold
delta = pi->amount; // so adjust skillgain
pi->Delete();
}
pc->baseskill[sk]+=delta;
Skills::updateSkillLevel(pc, sk);
updateskill(s,sk);
pc->trainer=-1;
pc_t->trainingplayerin=0xFF;
pc->playSFX( itemsfx(pi->getId()) );
}
else // Did not give gold
{
pc_t->talk( s, TRANSLATE("I am sorry, but I can only accept gold."),0);
Sndbounce5(s);
if (ps->isDragging())
{
ps->resetDragging();
item_bounce5(s,pi);
}
}//if items[i]=gold
return true;
}
示例2: ItemDroppedOnGuard
static bool ItemDroppedOnGuard(NXWCLIENT ps, PKGx08 *pp, P_ITEM pi)
{
if (ps == NULL)
return false;
VALIDATEPIR(pi, false);
char temp[TEMP_STR_SIZE]; //xan -> this overrides the global temp var
NXWSOCKET s=ps->toInt();
P_CHAR pc = ps->currChar();
VALIDATEPCR(pc,false);
P_CHAR pc_t=pointers::findCharBySerial(pp->Tserial); //the guard
VALIDATEPCR(pc_t,false);
// Search for the key word "the head of"
if( strstr( pi->getCurrentNameC(), "the head of" ) ) //!!! Wrong! it must check the ItemID, not the name :(
{
// This is a head of someone, see if the owner has a bounty on them
P_CHAR own=pointers::findCharBySerial(pi->getOwnerSerial32());
VALIDATEPCR(own,false);
if( own->questBountyReward > 0 )
{
// Give the person the bounty assuming that they are not the
// same person as the reward is for
if( pc->getSerial32() != own->getSerial32() )
{
// give them the gold for bringing the villan to justice
addgold( s, own->questBountyReward );
pc->playSFX( goldsfx( own->questBountyReward ) );
// Now thank them for their hard work
sprintf( temp, TRANSLATE("Excellent work! You have brought us the head of %s. Here is your reward of %d gold coins."),
own->getCurrentNameC(), own->questBountyReward );
pc_t->talk( s, temp, 0);
// Delete the Bounty from the bulletin board
BountyDelete(own );
// xan : increment fame & karma :)
pc->modifyFame( ServerScp::g_nBountyFameGain );
pc->IncreaseKarma(ServerScp::g_nBountyKarmaGain);
}
else
pc_t->talk( s, TRANSLATE("You can not claim that prize scoundrel. You are lucky I don't strike you down where you stand!"),0);
// Delete the item
pi->Delete();
}
}
return true;
}
示例3: ItemDroppedOnBeggar
static bool ItemDroppedOnBeggar(NXWCLIENT ps, PKGx08 *pp, P_ITEM pi)
{
if (ps == NULL)
return false;
VALIDATEPIR(pi, false);
char temp[TEMP_STR_SIZE]; //xan -> this overrides the global temp var
NXWSOCKET s=ps->toInt();
P_CHAR pc=ps->currChar();
VALIDATEPCR(pc,false);
P_CHAR pc_t=pointers::findCharBySerial(pp->Tserial); //beggar
VALIDATEPCR(pc_t,false);
if(pi->getId()!=ITEMID_GOLD)
{
sprintf(temp,TRANSLATE("Sorry %s i can only use gold"), pc->getCurrentNameC());
pc_t->talk( s,temp,0);
Sndbounce5(s);
if (ps->isDragging())
{
ps->resetDragging();
item_bounce5(s,pi);
return true;
}
}
else
{
sprintf(temp,TRANSLATE("Thank you %s for the %i gold!"), pc->getCurrentNameC(), pi->amount);
pc_t->talk( s,temp,0);
if(pi->amount<=100)
{
pc->IncreaseKarma(10);
ps->sysmsg(TRANSLATE("You have gain a little karma!"));
}
else if(pi->amount>100)
{
pc->IncreaseKarma(50);
ps->sysmsg(TRANSLATE("You have gain some karma!"));
}
pi->Delete();
return true;
}
return true;
}
示例4: Item_ToolWearOut
/*!
\brief apply wear out to item, delete if necessary
\author Ripper, rewritten by Luxor
\return bool
\param s socket of player who wear out the item
\param pi pointer to item to wear out
\todo become a method of cItem
*/
static bool Item_ToolWearOut(NXWSOCKET s, P_ITEM pi)
{
VALIDATEPIR(pi, false);
if ( s < 0 || s >= now )
return false;
P_CHAR pc = pointers::findCharBySerial(currchar[s]);
VALIDATEPCR(pc, false);
if( chance(5) ) { // has item been destroyed ??
pi->hp--;
if ( pi->hp <= 0 ) {
pc->sysmsg("Your %s has been destroyed", pi->getCurrentNameC());
pi->Delete();
return true;
}
}
return false;
}
示例5: doubleclick
//.........这里部分代码省略.........
return;
case ITYPE_RUNE:
if (pi->morex==0 && pi->morey==0 && pi->morez==0)
{
pc->sysmsg( TRANSLATE("That rune is not yet marked!"));
}
else
{
pc->runeserial = pi->getSerial32();
pc->sysmsg( TRANSLATE("Enter new rune name."));
}
return;
case ITYPE_SMOKE:
pc->smoketimer = pi->morex*MY_CLOCKS_PER_SEC + getclock();
pi->ReduceAmount(1);
return;
case ITYPE_RENAME_DEED:
pc->namedeedserial = pi->getSerial32();
pc->sysmsg( TRANSLATE("Enter your new name."));
pi->ReduceAmount(1);
return;
case ITYPE_POLYMORPH:
pc->setId( pi->morex );
pc->teleport();
pi->type = ITYPE_POLYMORPH_BACK;
return;
case ITYPE_POLYMORPH_BACK:
pc->setId( pc->getOldId() );
pc->teleport();
pi->type = ITYPE_POLYMORPH;
return;
case ITYPE_ARMY_ENLIST:
enlist(s, pi->morex);
pi->Delete();
return;
case ITYPE_TELEPORT:
pc->MoveTo( pi->morex,pi->morey,pi->morez );
pc->teleport();
return;
case ITYPE_DRINK:
switch (rand()%2)
{
case 0: pc->playSFX(0x0031); break;
case 1: pc->playSFX(0x0030); break;
}
pi->ReduceAmount(1);
pc->sysmsg( TRANSLATE("Gulp !"));
return;
case ITYPE_GUILDSTONE:
if ( pi->getId() == 0x14F0 || pi->getId() == 0x1869 ) // Check for Deed/Teleporter + Guild Type
{
pc->fx1 = DEREF_P_ITEM(pi);
Guilds->StonePlacement(s);
return;
}
else if (pi->getId() == 0x0ED5) // Check for Guildstone + Guild Type
{
pc->fx1 = DEREF_P_ITEM(pi);
Guilds->Menu(s, 1);
return;
}
else
WarnOut("Unhandled guild item type named: %s with ID of: %X\n", pi->getCurrentNameC(), pi->getId());
return;
case ITYPE_PLAYER_VENDOR_DEED: // PlayerVendors deed
{
示例6: pack_item
//.........这里部分代码省略.........
item_bounce6(ps,pItem);
return;
}
}
}
//ndEndy this not needed because when is dragging cont serial is INVALID
//testing UOP Blocking Tauriel 1-12-99
if (!pItem->isInWorld())
{
item_bounce6(ps,pItem);
return;
}
data::seekTile(pItem->getId(), tile);
if (( ( (pItem->magic==2) || ( (tile.weight==255) && (pItem->magic != 1 ) ) ) && !pc->canAllMove()) ||
( (pItem->magic==3|| pItem->magic==4) && !(pItem->getOwnerSerial32()==pc->getSerial32())))
{
Sndbounce5(s);
if (ps->isDragging())
{
ps->resetDragging();
item_bounce3(pItem);
if (pCont->getId() >= 0x4000)
senditem(s, pCont);
}
return;
}
// - Trash container
if( pCont->type==ITYPE_TRASH)
{
pItem->Delete();
ps->sysmsg(TRANSLATE("As you let go of the item it disappears."));
return;
}
// - Spell Book
if (pCont->type==ITYPE_SPELLBOOK)
{
if (!pItem->IsSpellScroll72())
{
ps->sysmsg(TRANSLATE("You can only place spell scrolls in a spellbook!"));
Sndbounce5(s);
if (ps->isDragging())
{
ps->resetDragging();
item_bounce3(pItem);
}
if (pCont->getId() >= 0x4000)
senditem(s, pCont);
return;
}
pack= pc->getBackpack();
if(ISVALIDPI(pack))
{
if ((!(pCont->getContSerial()==pc->getSerial32())) &&
(!(pCont->getContSerial()==pack->getSerial32())) && (!(pc->CanSnoop())))
{
ps->sysmsg(TRANSLATE("You cannot place spells in other peoples spellbooks."));
item_bounce6(ps,pItem);
return;
}
if( strncmp(pItem->getCurrentNameC(), "#", 1) )
pItem->getName(temp2);