本文整理汇总了C++中Skill::getSkillsRequired方法的典型用法代码示例。如果您正苦于以下问题:C++ Skill::getSkillsRequired方法的具体用法?C++ Skill::getSkillsRequired怎么用?C++ Skill::getSkillsRequired使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skill
的用法示例。
在下文中一共展示了Skill::getSkillsRequired方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fullfillsSkillPrerequisites
bool SkillManager::fullfillsSkillPrerequisites(const String& skillName, CreatureObject* creature) {
Skill* skill = skillMap.get(skillName.hashCode());
if (skill == NULL) {
return false;
}
Vector<String>* requiredSpecies = skill->getSpeciesRequired();
if (requiredSpecies->size() > 0) {
bool foundSpecies = false;
for (int i = 0; i < requiredSpecies->size(); i++) {
if (creature->getSpeciesName() == requiredSpecies->get(i)) {
foundSpecies = true;
break;
}
}
if (!foundSpecies) {
return false;
}
}
//Check for required skills.
Vector<String>* requiredSkills = skill->getSkillsRequired();
for (int i = 0; i < requiredSkills->size(); ++i) {
String requiredSkillName = requiredSkills->get(i);
Skill* requiredSkill = skillMap.get(requiredSkillName.hashCode());
if (requiredSkill == NULL) {
continue;
}
if (!creature->hasSkill(requiredSkillName)) {
return false;
}
}
PlayerObject* ghost = creature->getPlayerObject();
if(ghost == NULL || ghost->getJediState() < skill->getJediStateRequired()) {
return false;
}
if (ghost->isPrivileged())
return true;
if (skillName.beginsWith("force_sensitive")) { // Check for Force Sensitive boxes.
int index = skillName.indexOf("0");
if (index != -1) {
String skillNameFinal = skillName.subString(0, skillName.length() - 3);
if (creature->getScreenPlayState("VillageUnlockScreenPlay:" + skillNameFinal) < 2) {
return false;
}
}
}
if(skillName == "force_title_jedi_rank_01" && getForceSensitiveSkillCount(creature, false) < 24) {
return false;
}
if(skillName == "force_title_jedi_rank_03" && !knightPrereqsMet(creature, "")) {
return false;
}
return true;
}
示例2: awardSkill
bool SkillManager::awardSkill(const String& skillName, CreatureObject* creature, bool notifyClient, bool awardRequiredSkills, bool noXpRequired) {
Skill* skill = skillMap.get(skillName.hashCode());
if (skill == NULL)
return false;
Locker locker(creature);
//Check for required skills.
Vector<String>* requiredSkills = skill->getSkillsRequired();
for (int i = 0; i < requiredSkills->size(); ++i) {
String requiredSkillName = requiredSkills->get(i);
Skill* requiredSkill = skillMap.get(requiredSkillName.hashCode());
if (requiredSkill == NULL)
continue;
if (awardRequiredSkills)
awardSkill(requiredSkillName, creature, notifyClient, awardRequiredSkills, noXpRequired);
if (!creature->hasSkill(requiredSkillName))
return false;
}
if (!canLearnSkill(skillName, creature, noXpRequired)) {
return false;
}
//If they already have the skill, then return true.
if (creature->hasSkill(skill->getSkillName()))
return true;
ManagedReference<PlayerObject*> ghost = creature->getPlayerObject();
if (ghost != NULL) {
//Withdraw skill points.
ghost->addSkillPoints(-skill->getSkillPointsRequired());
//Witdraw experience.
if (!noXpRequired) {
ghost->addExperience(skill->getXpType(), -skill->getXpCost(), true);
}
creature->addSkill(skill, notifyClient);
//Add skill modifiers
VectorMap<String, int>* skillModifiers = skill->getSkillModifiers();
for (int i = 0; i < skillModifiers->size(); ++i) {
VectorMapEntry<String, int>* entry = &skillModifiers->elementAt(i);
creature->addSkillMod(SkillModManager::SKILLBOX, entry->getKey(), entry->getValue(), notifyClient);
}
//Add abilities
Vector<String>* abilityNames = skill->getAbilities();
addAbilities(ghost, *abilityNames, notifyClient);
if (skill->isGodOnly()) {
for (int i = 0; i < abilityNames->size(); ++i) {
String ability = abilityNames->get(i);
StringIdChatParameter params;
params.setTU(ability);
params.setStringId("ui", "skill_command_acquired_prose");
creature->sendSystemMessage(params);
}
}
//Add draft schematic groups
Vector<String>* schematicsGranted = skill->getSchematicsGranted();
SchematicMap::instance()->addSchematics(ghost, *schematicsGranted, notifyClient);
//Update maximum experience.
updateXpLimits(ghost);
// Update Force Power Max.
ghost->setForcePowerMax(creature->getSkillMod("jedi_force_power_max"), true);
if (skillName.contains("master")) {
ManagedReference<PlayerManager*> playerManager = creature->getZoneServer()->getPlayerManager();
if (playerManager != NULL) {
const Badge* badge = BadgeList::instance()->get(skillName);
if (badge == NULL && skillName == "crafting_shipwright_master") {
badge = BadgeList::instance()->get("crafting_shipwright");
}
if (badge != NULL) {
playerManager->awardBadge(ghost, badge);
}
}
}
SkillList* list = creature->getSkillList();
int totalSkillPointsWasted = 250;
for (int i = 0; i < list->size(); ++i) {
Skill* skill = list->get(i);
//.........这里部分代码省略.........