本文整理汇总了C++中SkillRef类的典型用法代码示例。如果您正苦于以下问题:C++ SkillRef类的具体用法?C++ SkillRef怎么用?C++ SkillRef使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SkillRef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAttribute
EvilNumber Character::GetSPPerMin( SkillRef skill )
{
EvilNumber primarySkillTrainingAttr = skill->GetAttribute(AttrPrimaryAttribute);
EvilNumber secondarySkillTrainingAttr = skill->GetAttribute(AttrSecondaryAttribute);
EvilNumber primarySPperMin = GetAttribute( (uint32)(primarySkillTrainingAttr.get_int()) );
EvilNumber secondarySPperMin = GetAttribute( (uint32)(secondarySkillTrainingAttr.get_int()) );
//EvilNumber skillLearningLevel(0);
//
////3374 - Skill Learning
//SkillRef skillLearning = GetSkill( 3374 );
//if( skillLearning )
// skillLearningLevel = skillLearning->GetAttribute(AttrSkillLevel);
primarySPperMin = primarySPperMin + secondarySPperMin / 2.0f;
//primarySPperMin = primarySPperMin * (EvilNumber(1.0f) + EvilNumber(0.02f) * skillLearningLevel);
// 100% Training bonus for 30day and under character age has been removed in Incursion
// http://www.eveonline.com/en/incursion/article/57/learning-skills-are-going-away
// Check Total SP Trained for this character against the threshold for granting the 100% training bonus:
//if( m_totalSPtrained.get_float() < ((double)MAX_SP_FOR_100PCT_TRAINING_BONUS) )
// primarySPperMin = primarySPperMin * EvilNumber(2.0f);
return primarySPperMin;
}
示例2: GetSkillInTraining
uint64 Character::GetEndOfTraining() const
{
SkillRef skill = GetSkillInTraining();
if( !skill )
return 0;
return skill->expiryTime();
}
示例3: GetSkillInTraining
EvilNumber Character::GetEndOfTraining() const
{
SkillRef skill = GetSkillInTraining();
if( !skill )
return 0;
return skill->GetAttribute(AttrExpiryTime);
}
示例4: SkillRef
SkillRef ItemFactory::SpawnSkill(ItemData &data)
{
SkillRef s = Skill::Spawn( *this, data );
if( !s )
return SkillRef();
m_items.insert( std::make_pair( s->itemID(), s ) );
return s;
}
示例5: _Spawn
SkillRef Skill::Spawn(ItemFactory &factory, ItemData &data)
{
uint32 skillID = _Spawn( factory, data );
if( skillID == 0 )
return SkillRef();
SkillRef skillRef = Skill::Load( factory, skillID );
skillRef->SetAttribute(AttrIsOnline, 1); // Is Online
return skillRef;
}
示例6: HasSkillTrainedToLevel
bool Character::HasSkillTrainedToLevel(uint32 skillTypeID, uint32 skillLevel) const
{
SkillRef requiredSkill;
// First, check for existence of skill trained or in training:
requiredSkill = GetSkill( skillTypeID );
if( !requiredSkill )
return false;
// Second, check for required minimum level of skill, note it must already be trained to this level:
if( requiredSkill->GetAttribute(AttrSkillLevel) < skillLevel )
return false;
return true;
}
示例7: GetSkill
double Character::GetSPPerMin(SkillRef skill) const
{
double primaryVal = attributes.GetReal( (EVEAttributeMgr::Attr)skill->primaryAttribute() );
double secondaryVal = attributes.GetReal( (EVEAttributeMgr::Attr)skill->secondaryAttribute() );
uint8 skillLearningLevel = 0;
//3374 - Skill Learning
SkillRef skillLearning = GetSkill( 3374 );
if( skillLearning )
skillLearningLevel = skillLearning->skillLevel();
return (primaryVal + secondaryVal / 2.0)
* (1.0 + 0.02 * skillLearningLevel)
* 2.0; /* this is hacky and should be applied only if total SP < 1.6M */
}
示例8: itemID
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;
}
示例9: _log
void Character::AddItem(InventoryItemRef item)
{
Inventory::AddItem( item );
if( item->flag() == flagSkill
|| item->flag() == flagSkillInTraining )
{
// Skill has been added ...
if( item->categoryID() != EVEDB::invCategories::Skill ) {
_log( ITEM__WARNING, "%s (%u): %s has been added with flag %d.", itemName().c_str(), itemID(), item->category().name().c_str(), (int)item->flag() );
} else
{
SkillRef skill = SkillRef::StaticCast( item );
if( !skill->singleton() )
{
_log( ITEM__TRACE, "%s (%u): Injecting %s.", itemName().c_str(), itemID(), item->itemName().c_str() );
// Make it singleton and set initial skill values.
skill->ChangeSingleton( true );
skill->SetAttribute(AttrSkillLevel, 0);
skill->SetAttribute(AttrSkillPoints, 0);
if( skill->flag() != flagSkillInTraining )
skill->SetAttribute(AttrExpiryTime, 0);
}
}
}
}
示例10: SkillPrereqsComplete
bool Skill::SkillPrereqsComplete(Character &ch)
{
SkillRef requiredSkill;
if( GetAttribute(AttrRequiredSkill1).get_int() != 0 )
{
requiredSkill = ch.GetSkill(static_cast<uint32>(GetAttribute(AttrRequiredSkill1).get_int()));
if( !requiredSkill )
return false;
if( GetAttribute(AttrRequiredSkill1Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
if( GetAttribute(AttrRequiredSkill2).get_int() != 0 )
{
requiredSkill = ch.GetSkill(static_cast<uint32>(GetAttribute(AttrRequiredSkill2).get_int()));
if( !requiredSkill )
return false;
if( GetAttribute(AttrRequiredSkill2Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
if( GetAttribute(AttrRequiredSkill3).get_int() != 0 )
{
requiredSkill = ch.GetSkill(static_cast<uint32>(GetAttribute(AttrRequiredSkill3).get_int()));
if( !requiredSkill )
return false;
if( GetAttribute(AttrRequiredSkill3Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
return true;
}
示例11: itemID
bool Character::InjectSkillIntoBrain(SkillRef skill, uint8 level)
{
Client *c = m_factory.entity_list.FindCharacter( itemID() );
SkillRef oldSkill = GetSkill( skill->typeID() );
if( oldSkill )
{
oldSkill->attributes.SetNotify(true);
oldSkill->Set_skillLevel( level );
oldSkill->Set_skillPoints( pow(2, ( 2.5 * level ) - 2.5 ) * SKILL_BASE_POINTS * ( oldSkill->attributes.GetInt( oldSkill->attributes.Attr_skillTimeConstant ) ) );
return true;
}
// 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
skill->MoveInto( *this, flagSkill );
skill->Set_skillLevel( level );
//TODO: get right number of skill points
//skill->Set_skillPoints( SKILL_BASE_POINTS * skillTimeConstant() * pow(32, (level - 1) / 2.0) );
skill->Set_skillPoints( pow(2,( 2.5 * level) - 2.5 ) * SKILL_BASE_POINTS * ( skill->attributes.GetInt( skill->attributes.Attr_skillTimeConstant ) ) );
return true;
}
示例12: GetAttribute
EvilNumber Character::GetSPPerMin( SkillRef skill )
{
EvilNumber primarySkillTrainingAttr = skill->GetAttribute(AttrPrimaryAttribute);
EvilNumber secondarySkillTrainingAttr = skill->GetAttribute(AttrSecondaryAttribute);
EvilNumber primarySPperMin = GetAttribute( (uint32)(primarySkillTrainingAttr.get_int()) );
EvilNumber secondarySPperMin = GetAttribute( (uint32)(secondarySkillTrainingAttr.get_int()) );
EvilNumber skillLearningLevel(0);
//3374 - Skill Learning
SkillRef skillLearning = GetSkill( 3374 );
if( skillLearning )
skillLearningLevel = skillLearning->GetAttribute(AttrSkillLevel);
primarySPperMin = primarySPperMin + secondarySPperMin / 2.0f;
primarySPperMin = primarySPperMin * (EvilNumber(1.0f) + EvilNumber(0.02f) * skillLearningLevel);
// Check Total SP Trained for this character against the threshold for granting the 100% training bonus:
if( m_totalSPtrained.get_float() < ((double)MAX_SP_FOR_100PCT_TRAINING_BONUS) )
primarySPperMin = primarySPperMin * EvilNumber(2.0f);
return primarySPperMin;
}
示例13: FitModuleSkillCheck
bool Skill::FitModuleSkillCheck(InventoryItemRef item, CharacterRef character)
{
//TODO: move to skills
SkillRef requiredSkill;
//Primary Skill
if(item->GetAttribute(AttrRequiredSkill1) != 0)
{
requiredSkill = character->GetSkill( static_cast<uint32>(item->GetAttribute(AttrRequiredSkill1).get_int()) );
if( !requiredSkill )
return false;
if( item->GetAttribute(AttrRequiredSkill1Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Secondary Skill
if(item->GetAttribute(AttrRequiredSkill2) != 0)
{
requiredSkill = character->GetSkill( static_cast<uint32>(item->GetAttribute(AttrRequiredSkill2).get_int()) );
if( !requiredSkill )
return false;
if( item->GetAttribute(AttrRequiredSkill2Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Tertiary Skill
if(item->GetAttribute(AttrRequiredSkill3) != 0)
{
requiredSkill = character->GetSkill( static_cast<uint32>(item->GetAttribute(AttrRequiredSkill3).get_int()) );
if( !requiredSkill )
return false;
if( item->GetAttribute(AttrRequiredSkill3Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Quarternary Skill
if(item->GetAttribute(AttrRequiredSkill4) != 0)
{
requiredSkill = character->GetSkill( static_cast<uint32>(item->GetAttribute(AttrRequiredSkill4).get_int()) );
if( !requiredSkill )
return false;
if( item->GetAttribute(AttrRequiredSkill4Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Quinary Skill
if(item->GetAttribute(AttrRequiredSkill5) != 0)
{
requiredSkill = character->GetSkill(static_cast<uint32>(item->GetAttribute(AttrRequiredSkill5).get_int()));
if( !requiredSkill )
return false;
if( item->GetAttribute(AttrRequiredSkill5Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Senary Skill
if(item->GetAttribute(AttrRequiredSkill6) != 0)
{
requiredSkill = character->GetSkill(static_cast<uint32>(item->GetAttribute(AttrRequiredSkill6).get_int()));
if( !requiredSkill )
return false;
if( item->GetAttribute(AttrRequiredSkill6Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
return true;
}
示例14: ValidateBoardShip
bool Ship::ValidateBoardShip(ShipRef ship, CharacterRef character)
{
SkillRef requiredSkill;
//Primary Skill
if(ship->GetAttribute(AttrRequiredSkill1).get_int() != 0)
{
requiredSkill = character->GetSkill( ship->GetAttribute(AttrRequiredSkill1).get_int() );
if( !requiredSkill )
return false;
if( ship->GetAttribute(AttrRequiredSkill1Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Secondary Skill
if(ship->GetAttribute(AttrRequiredSkill2).get_int() != 0)
{
requiredSkill = character->GetSkill( ship->GetAttribute(AttrRequiredSkill2).get_int() );
if( !requiredSkill )
return false;
if( ship->GetAttribute(AttrRequiredSkill2Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Tertiary Skill
if(ship->GetAttribute(AttrRequiredSkill3).get_int() != 0)
{
requiredSkill = character->GetSkill( ship->GetAttribute(AttrRequiredSkill3).get_int() );
if( !requiredSkill )
return false;
if( ship->GetAttribute(AttrRequiredSkill3Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Quarternary Skill
if(ship->GetAttribute(AttrRequiredSkill4).get_int() != 0)
{
requiredSkill = character->GetSkill( ship->GetAttribute(AttrRequiredSkill4).get_int() );
if( !requiredSkill )
return false;
if( ship->GetAttribute(AttrRequiredSkill4Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Quinary Skill
if(ship->GetAttribute(AttrRequiredSkill5).get_int() != 0)
{
requiredSkill = character->GetSkill( ship->GetAttribute(AttrRequiredSkill5).get_int() );
if( !requiredSkill )
return false;
if( ship->GetAttribute(AttrRequiredSkill5Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Senary Skill
if(ship->GetAttribute(AttrRequiredSkill6).get_int() != 0)
{
requiredSkill = character->GetSkill( ship->GetAttribute(AttrRequiredSkill6).get_int() );
if( !requiredSkill )
return false;
if( ship->GetAttribute(AttrRequiredSkill6Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
return true;
}
示例15: Command_giveskill
PyResult Command_giveskill( Client* who, CommandDB* db, PyServiceMgr* services, const Seperator& args )
{
uint32 typeID;
uint8 level;
CharacterRef character;
EVEItemFlags flag;
uint32 gty = 1;
//uint8 oldSkillLevel = 0;
EvilNumber oldSkillLevel(0);
uint32 ownerID = 0;
if( args.argCount() == 4 )
{
if( args.isNumber( 1 ) )
{
ownerID = atoi( args.arg( 1 ).c_str() );
character = services->entity_list.FindCharacter( ownerID )->GetChar();
}
else if( args.arg( 1 ) == "me" )
{
ownerID = who->GetCharacterID();
character = who->GetChar();
}
else if( !args.isNumber( 1 ) )
{
const char *name = args.arg( 1 ).c_str();
Client *target = services->entity_list.FindCharacter( name );
if(target == NULL)
throw PyException( MakeCustomError( "Cannot find Character by the name of %s", name ) );
ownerID = target->GetCharacterID();
}
else
throw PyException( MakeCustomError( "Argument 1 must be Character ID or Character Name ") );
if( !args.isNumber( 2 ) )
throw PyException( MakeCustomError( "Argument 2 must be type ID." ) );
typeID = atoi( args.arg( 2 ).c_str() );
if( !args.isNumber( 3 ) )
throw PyException( MakeCustomError( "Argument 3 must be level" ) );
level = atoi( args.arg( 3 ).c_str() );
//levels don't go higher than 5
if( level > 5 )
level = 5;
} else
throw PyException( MakeCustomError("Correct Usage: /giveskill [Character Name or ID] [skillID] [desired level]") );
SkillRef skill;
if(character->HasSkill( typeID ) )
{
// Character already has this skill, so let's get the current level and check to see
// if we need to update its level to what's required:
SkillRef oldSkill = character->GetSkill( typeID );
oldSkillLevel = oldSkill->GetAttribute( AttrSkillLevel );
// Now check the current level to the required level and update it
if( oldSkillLevel < level )
{
character->InjectSkillIntoBrain( oldSkill, level);
return new PyString ( "Gifting skills complete" );
}
}
else
{
// Character DOES NOT have this skill, so spawn a new one and then add this
// to the character with required level and skill points:
ItemData idata(
typeID,
ownerID,
0, //temp location
flag = (EVEItemFlags)flagSkill,
gty
);
InventoryItemRef item = services->item_factory.SpawnItem( idata );
skill = SkillRef::StaticCast( item );
if( !item )
throw PyException( MakeCustomError( "Unable to create item of type %s.", item->typeID() ) );
character->InjectSkillIntoBrain( skill, level);
return new PyString ( "Gifting skills complete" );
}
return new PyString ("Skill Gifting Failure");
}