本文整理汇总了C++中P_CHAR::getId方法的典型用法代码示例。如果您正苦于以下问题:C++ P_CHAR::getId方法的具体用法?C++ P_CHAR::getId怎么用?C++ P_CHAR::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_CHAR
的用法示例。
在下文中一共展示了P_CHAR::getId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: newbieitems
void newbieitems(P_CHAR pc)
{
VALIDATEPC(pc);
NXWCLIENT ps=pc->getClient();
if(ps==NULL)
return;
int first, second, third, storeval, itemaddperskill, loopexit = 0;
char sect[512];
char whichsect[105];
cScpIterator* iter = NULL;
first = bestskill(pc);
second = nextbestskill(pc, first);
third = nextbestskill(pc, second);
if (pc->baseskill[third] < 190)
third = 46;
for (itemaddperskill = 1; itemaddperskill <= 5; itemaddperskill++)
{
switch (itemaddperskill)
{
// first of all the general section with the backpack, else where we put items?
case 1: strcpy(whichsect, "SECTION ALLNEWBIES"); break;
case 2:
if ( (pc->getId() == BODY_MALE) && (pc->getOldId() == BODY_MALE) )
strcpy(whichsect, "SECTION MALENEWBIES");
else
strcpy(whichsect, "SECTION FEMALENEWBIES");
break;
case 3: sprintf(whichsect, "SECTION BESTSKILL %i", first); break;
case 4: sprintf(whichsect, "SECTION BESTSKILL %i", second); break;
case 5: sprintf(whichsect, "SECTION BESTSKILL %i", third); break;
default:
ErrOut("Switch fallout. newbie.cpp, newbieitems()/n"); // Morrolan
}
sprintf(sect, whichsect);
char script1[1000], script2[1000];
safedelete(iter);
iter = Scripts::Newbie->getNewIterator(sect);
if (iter==NULL) return;
do
{
iter->parseLine(script1,script2);
if (script1[0] == '@') pc->loadEventFromScript(script1, script2); // Sparhawk: Huh loading character events
// from newbie item scripts????
if (script1[0] != '}')
{
if (!(strcmp("PACKITEM", script1)))
{
std::string itemnum, amount;
splitLine( script2, itemnum, amount );
int amt = ( amount != "" )? str2num( amount ) : INVALID; //ndEndy defined amount
P_ITEM pi_n = item::CreateFromScript( str2num( itemnum ), pc->getBackpack(), amt );
if (ISVALIDPI(pi_n)) {
pi_n->priv |= 0x02; // Mark as a newbie item
}
strcpy(script1, "DUMMY");
}
else if (!strcmp("BANKITEM", script1))
{
std::string itemnum, amount;
splitLine( script2, itemnum, amount );
int amt= (amount!="")? str2num( amount ) : INVALID;
P_ITEM pi = item::CreateFromScript( str2num( itemnum ), pc->GetBankBox(), amt );
if (ISVALIDPI(pi)) {
pi->priv |= 0x02; // Mark as a newbie item
}
strcpy(script1, "DUMMY");
}
else if (!strcmp("EQUIPITEM", script1))
{
P_ITEM pi = item::CreateFromScript( script2 );
if (ISVALIDPI(pi))
{
pi->priv |= 0x02; // Mark as a newbie item
pi->setCont(pc);
storeval = pi->getScriptID();
}
strcpy(script1, "DUMMY");
}
}
}
while ((script1[0] != '}') &&(++loopexit < MAXLOOPS));
safedelete(iter);
}
// Give the character some gold
if ( goldamount > 0 )
{
item::CreateFromScript( "$item_gold_coin", pc->getBackpack(), goldamount );
}
//.........这里部分代码省略.........