本文整理汇总了C++中ManagedReference::canGroupMemberHarvestCorpse方法的典型用法代码示例。如果您正苦于以下问题:C++ ManagedReference::canGroupMemberHarvestCorpse方法的具体用法?C++ ManagedReference::canGroupMemberHarvestCorpse怎么用?C++ ManagedReference::canGroupMemberHarvestCorpse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ManagedReference
的用法示例。
在下文中一共展示了ManagedReference::canGroupMemberHarvestCorpse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: harvest
//.........这里部分代码省略.........
quantity = creature->getHideMax();
} else if (selectedID == 236) {
restype = creature->getBoneType();
quantity = creature->getBoneMax();
}
if(quantity == 0 || restype.isEmpty()) {
player->sendSystemMessage("Tried to harvest something this creature didn't have, please report this error");
return;
}
int quantityExtracted = int(quantity * float(player->getSkillMod("creature_harvesting") / 100.0f));
quantityExtracted = MAX(quantityExtracted, 3);
ManagedReference<ResourceSpawn*> resourceSpawn = resourceManager->getCurrentSpawn(restype, player->getZone()->getZoneName());
if (resourceSpawn == NULL) {
player->sendSystemMessage("Error: Server cannot locate a current spawn of " + restype);
return;
}
float density = resourceSpawn->getDensityAt(player->getZone()->getZoneName(), player->getPositionX(), player->getPositionY());
String creatureHealth = "";
if (density > 0.80f) {
quantityExtracted = int(quantityExtracted * 1.25f);
creatureHealth = "creature_quality_fat";
} else if (density > 0.60f) {
quantityExtracted = int(quantityExtracted * 1.00f);
creatureHealth = "creature_quality_medium";
} else if (density > 0.40f) {
quantityExtracted = int(quantityExtracted * 0.75f);
creatureHealth = "creature_quality_scrawny";
} else {
quantityExtracted = int(quantityExtracted * 0.50f);
creatureHealth = "creature_quality_skinny";
}
float modifier = 1;
int baseAmount = quantityExtracted;
if (player->isGrouped()) {
modifier = player->getGroup()->getGroupHarvestModifier(player);
quantityExtracted = (int)(quantityExtracted * modifier);
}
if (creature->getParent().get() != NULL)
quantityExtracted = 1;
resourceManager->harvestResourceToPlayer(player, resourceSpawn, quantityExtracted);
/// Send System Messages
StringIdChatParameter harvestMessage("skl_use", creatureHealth);
harvestMessage.setDI(quantityExtracted);
harvestMessage.setTU(resourceSpawn->getFinalClass());
player->sendSystemMessage(harvestMessage);
/// Send bonus message
if (modifier == 1.2f)
player->sendSystemMessage("@skl_use:group_harvest_bonus");
else if (modifier == 1.3f)
player->sendSystemMessage("@skl_use:group_harvest_bonus_ranger");
else if (modifier == 1.4f)
player->sendSystemMessage("@skl_use:group_harvest_bonus_masterranger");
/// Send group spam
if (player->isGrouped()) {
StringIdChatParameter bonusMessage("group", "notify_harvest_corpse");
bonusMessage.setTU(player->getFirstName());
bonusMessage.setDI(quantityExtracted);
bonusMessage.setTO(resourceSpawn->getFinalClass());
bonusMessage.setTT(creature->getObjectNameStringIdFile(), creature->getObjectNameStringIdName());
ChatSystemMessage* sysMessage = new ChatSystemMessage(bonusMessage);
player->getGroup()->broadcastMessage(player, sysMessage, false);
}
ManagedReference<PlayerManager*> playerManager = zoneServer->getPlayerManager();
int xp = creature->getLevel() * 5 + 19;
if(playerManager != NULL)
playerManager->awardExperience(player, "scout", xp, true);
creature->addAlreadyHarvested(player);
if (!creature->hasLoot() && creature->getBankCredits() < 1 && creature->getCashCredits() < 1 && !playerManager->canGroupMemberHarvestCorpse(player, creature)) {
Reference<DespawnCreatureTask*> despawn = creature->getPendingTask("despawn").castTo<DespawnCreatureTask*>();
if (despawn != NULL) {
despawn->cancel();
despawn->reschedule(1000);
}
}
}
示例2: droidHarvest
//.........这里部分代码省略.........
float density = resourceSpawn->getDensityAt(droid->getZone()->getZoneName(), droid->getPositionX(), droid->getPositionY());
String creatureHealth = "";
if (density > 0.80f) {
quantityExtracted = int(quantityExtracted * 1.25f);
creatureHealth = "creature_quality_fat";
} else if (density > 0.60f) {
quantityExtracted = int(quantityExtracted * 1.00f);
creatureHealth = "creature_quality_medium";
} else if (density > 0.40f) {
quantityExtracted = int(quantityExtracted * 0.75f);
creatureHealth = "creature_quality_scrawny";
} else {
quantityExtracted = int(quantityExtracted * 0.50f);
creatureHealth = "creature_quality_skinny";
}
float modifier = 1;
int baseAmount = quantityExtracted;
if (owner->isGrouped()) {
modifier = owner->getGroup()->getGroupHarvestModifier(owner);
quantityExtracted = (int)(quantityExtracted * modifier);
if (owner->getGroup()->getGroupSize() > 2 ) {
quantityExtracted -= quantityExtracted * 0.3; // 30% reduction
}
}
if (creature->getParent().get() != NULL)
quantityExtracted = 1;
int droidBonus = DroidMechanics::determineDroidSkillBonus(ownerSkill,harvestBonus,quantityExtracted);
quantityExtracted += droidBonus;
// add to droid inventory if there is space available, otherwise to player
DroidObject* pet = cast<DroidObject*>(droid);
if (pet == NULL) {
error("Incoming droid harvest call didnt include a droid!");
return;
}
if (pet->hasStorage()) {
bool didit = resourceManager->harvestResourceToPlayer(droid, resourceSpawn, quantityExtracted);
if (!didit) {
resourceManager->harvestResourceToPlayer(owner, resourceSpawn, quantityExtracted);
}
} else {
resourceManager->harvestResourceToPlayer(owner, resourceSpawn, quantityExtracted);
}
/// Send System Messages
StringIdChatParameter harvestMessage("skl_use", creatureHealth);
harvestMessage.setDI(quantityExtracted);
harvestMessage.setTU(resourceSpawn->getFinalClass());
owner->sendSystemMessage(harvestMessage);
/// Send bonus message
if (modifier == 1.2f)
owner->sendSystemMessage("@skl_use:group_harvest_bonus");
else if (modifier == 1.3f)
owner->sendSystemMessage("@skl_use:group_harvest_bonus_ranger");
else if (modifier == 1.4f)
owner->sendSystemMessage("@skl_use:group_harvest_bonus_masterranger");
/// Send group spam
if (owner->isGrouped()) {
StringIdChatParameter bonusMessage("group", "notify_harvest_corpse");
bonusMessage.setTU(droid->getDisplayedName());
bonusMessage.setDI(quantityExtracted);
bonusMessage.setTO(resourceSpawn->getFinalClass());
bonusMessage.setTT(creature->getObjectNameStringIdFile(), creature->getObjectNameStringIdName());
ChatSystemMessage* sysMessage = new ChatSystemMessage(bonusMessage);
owner->getGroup()->broadcastMessage(owner, sysMessage, false);
}
ManagedReference<PlayerManager*> playerManager = zoneServer->getPlayerManager();
int xp = creature->getLevel() * 5 + 19;
if(playerManager != NULL)
playerManager->awardExperience(owner, "scout", xp, true);
creature->addAlreadyHarvested(owner);
if (!creature->hasLoot() && creature->getBankCredits() < 1 && creature->getCashCredits() < 1 && !playerManager->canGroupMemberHarvestCorpse(owner, creature)) {
Reference<DespawnCreatureTask*> despawn = creature->getPendingTask("despawn").castTo<DespawnCreatureTask*>();
if (despawn != NULL) {
despawn->cancel();
despawn->reschedule(1000);
}
}
}