本文整理汇总了C++中P_CHAR::getOldId方法的典型用法代码示例。如果您正苦于以下问题:C++ P_CHAR::getOldId方法的具体用法?C++ P_CHAR::getOldId怎么用?C++ P_CHAR::getOldId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_CHAR
的用法示例。
在下文中一共展示了P_CHAR::getOldId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doubleclick
//.........这里部分代码省略.........
*/////////////////////ENDREMOVE/////////////////////////////////////
case ITYPE_POTION: // potions
if (pi->morey != 3)
pc->drink(pi); //Luxor: delayed potions drinking
else //explosion potion
usepotion(pc, pi);
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;
示例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 );
}
//.........这里部分代码省略.........