本文整理汇总了C++中P_CHAR::getSkillSum方法的典型用法代码示例。如果您正苦于以下问题:C++ P_CHAR::getSkillSum方法的具体用法?C++ P_CHAR::getSkillSum怎么用?C++ P_CHAR::getSkillSum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_CHAR
的用法示例。
在下文中一共展示了P_CHAR::getSkillSum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: dropOnTrainer
void cDragItems::dropOnTrainer( P_CLIENT client, P_ITEM pItem, P_CHAR pTrainer )
{
P_CHAR pChar = client->player();
if( pItem->id() != 0xEED )
{
pTrainer->talk( "You need to give me gold if you want me to train you!" );
bounceItem( client, pItem );
return;
}
pTrainer->talk( "I thank thee for thy payment. That should give thee a good start on thy way. Farewell!" );
Q_UINT8 skill = pTrainer->trainingplayerin();
Q_INT32 skillSum = pChar->getSkillSum();
Q_INT32 skillDelta = pTrainer->getTeachingDelta( pChar, skill, skillSum );
goldsfx( client->socket(), pItem->amount() );
if( pItem->amount() > skillDelta )
{
pItem->ReduceAmount( skillDelta );
bounceItem( client, pItem );
}
else
{
skillDelta = pItem->amount();
Items->DeleItem( pItem );
}
pChar->setBaseSkill( skill, pChar->baseSkill( skill ) + skillDelta );
Skills->updateSkillLevel( pChar, skill );
updateskill( client->socket(), skill );
// we will not reset the trainer id here because he may want to give him more money
}