本文整理汇总了C++中SkillRef::SkillPrereqsComplete方法的典型用法代码示例。如果您正苦于以下问题:C++ SkillRef::SkillPrereqsComplete方法的具体用法?C++ SkillRef::SkillPrereqsComplete怎么用?C++ SkillRef::SkillPrereqsComplete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkillRef
的用法示例。
在下文中一共展示了SkillRef::SkillPrereqsComplete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InjectSkillIntoBrain
bool Character::InjectSkillIntoBrain(SkillRef skill)
{
Client *c = m_factory.entity_list.FindCharacter( itemID() );
SkillRef oldSkill = GetSkill( skill->typeID() );
if( oldSkill )
{
//TODO: build and send proper UserError for CharacterAlreadyKnowsSkill.
if( c != NULL )
c->SendNotifyMsg( "You already know this skill." );
return false;
}
// TODO: based on config options later, check to see if another character, owned by this characters account,
// is training a skill. If so, return. (flagID=61).
if( !skill->SkillPrereqsComplete( *this ) )
{
// TODO: need to send back a response to the client. need packet specs.
_log( ITEM__TRACE, "%s (%u): Requested to train skill %u item %u but prereq not complete.", itemName().c_str(), itemID(), skill->typeID(), skill->itemID() );
if( c != NULL )
c->SendNotifyMsg( "Injection failed! Skill prerequisites incomplete." );
return false;
}
// are we injecting from a stack of skills?
if( skill->quantity() > 1 )
{
// split the stack to obtain single item
InventoryItemRef single_skill = skill->Split( 1 );
if( !single_skill )
{
_log( ITEM__ERROR, "%s (%u): Unable to split stack of %s (%u).", itemName().c_str(), itemID(), skill->itemName().c_str(), skill->itemID() );
return false;
}
// use single_skill ...
single_skill->MoveInto( *this, flagSkill );
}
else
// use original skill
skill->MoveInto( *this, flagSkill );
if( c != NULL )
c->SendNotifyMsg( "Injection of skill complete." );
return true;
}