本文整理汇总了C++中PlayerObject::hasAbility方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerObject::hasAbility方法的具体用法?C++ PlayerObject::hasAbility怎么用?C++ PlayerObject::hasAbility使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerObject
的用法示例。
在下文中一共展示了PlayerObject::hasAbility方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleObjectMenuSelect
int SurveyToolImplementation::handleObjectMenuSelect(CreatureObject* player, byte selectedID) {
PlayerObject* playerObject = player->getPlayerObject();
if(isASubChildOf(player)) {
if (!playerObject->hasAbility("survey")) {
player->sendSystemMessage("@error_message:insufficient_skill");
return 0;
}
if (selectedID == 20) { // use object
if(getRange(player) == 0) {
sendRangeSui(player);
return 0;
}
Locker locker(_this.getReferenceUnsafeStaticCast());
ManagedReference<SurveySession*> session = player->getActiveSession(SessionFacadeType::SURVEY).castTo<SurveySession*>();
if(session == NULL) {
session = new SurveySession(player);
session->initializeSession(_this.getReferenceUnsafeStaticCast());
}
session->setOpenSurveyTool(_this.getReferenceUnsafeStaticCast());
ManagedReference<ResourceManager*> resourceManager = cast<ResourceManager*>(server->getZoneServer()->getResourceManager());
if(resourceManager == NULL) {
error("null resource manager");
return 0;
}
resourceManager->sendResourceListForSurvey(player, getToolType(), getSurveyType());
return 0;
}
if (selectedID == 133) { // Set Tool Range
sendRangeSui(player);
return 0;
}
}
return TangibleObjectImplementation::handleObjectMenuSelect(player, selectedID);
}
示例2: payMaintenance
void StructureManager::payMaintenance(StructureObject* structure,
CreatureObject* creature, int amount) {
if (amount < 0)
return;
int currentMaint = structure->getSurplusMaintenance();
if (currentMaint + amount > 100000000 || currentMaint + amount < 0) {
creature->sendSystemMessage("The maximum maintenance a house can hold is 100.000.000");
return;
}
if (!creature->isInRange(structure, 16.f)
&& creature->getRootParent() != structure) {
creature->sendSystemMessage("@player_structure:pay_out_of_range"); //You have moved out of range of your original /payMaintenance target. Aborting...
return;
}
int cash = creature->getCashCredits();
if (cash < amount) {
creature->sendSystemMessage("@player_structure:insufficient_funds"); //You have insufficient funds to make this deposit.
return;
}
StringIdChatParameter params("base_player", "prose_pay_success"); //You successfully make a payment of %DI credits to %TT.
params.setTT(structure->getDisplayedName());
params.setDI(amount);
creature->sendSystemMessage(params);
creature->subtractCashCredits(amount);
structure->addMaintenance(amount);
PlayerObject* ghost = creature->getPlayerObject();
if (ghost->hasAbility("maintenance_fees_1")){
structure->setMaintenanceReduced(true);
}else{
structure->setMaintenanceReduced(false);
}
}