本文整理汇总了C++中PlayerManager::awardExperience方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerManager::awardExperience方法的具体用法?C++ PlayerManager::awardExperience怎么用?C++ PlayerManager::awardExperience使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerManager
的用法示例。
在下文中一共展示了PlayerManager::awardExperience方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleSlice
void SlicingSessionImplementation::handleSlice(SuiListBox* suiBox) {
ManagedReference<CreatureObject*> player = this->player.get();
ManagedReference<TangibleObject*> tangibleObject = this->tangibleObject.get();
if (player == NULL || tangibleObject == NULL)
return;
Locker locker(player);
Locker clocker(tangibleObject, player);
PlayerManager* playerManager = player->getZoneServer()->getPlayerManager();
suiBox->removeAllMenuItems();
suiBox->setCancelButton(false,"@cancel");
StringBuffer prompt;
prompt << "@slicing/slicing:";
prompt << getPrefix(tangibleObject) + "examine";
suiBox->setPromptText(prompt.toString());
player->getPlayerObject()->addSuiBox(suiBox);
player->sendMessage(suiBox->generateMessage());
if (tangibleObject->isContainerObject() || tangibleObject->getGameObjectType() == SceneObjectType::PLAYERLOOTCRATE) {
handleContainerSlice();
playerManager->awardExperience(player, "slicing", 125, true); // Container Slice XP
} else if (tangibleObject->isMissionTerminal()) {
MissionTerminal* term = cast<MissionTerminal*>( tangibleObject.get());
playerManager->awardExperience(player, "slicing", 250, true); // Terminal Slice XP
term->addSlicer(player);
player->sendSystemMessage("@slicing/slicing:terminal_success");
} else if (tangibleObject->isWeaponObject()) {
handleWeaponSlice();
playerManager->awardExperience(player, "slicing", 500, true); // Weapon Slice XP
} else if (tangibleObject->isArmorObject()) {
handleArmorSlice();
playerManager->awardExperience(player, "slicing", 1000, true); // Armor Slice XP
} else if ( isBaseSlice()){
playerManager->awardExperience(player,"slicing", 1000, true); // Base slicing
Zone* zone = player->getZone();
if(zone != NULL){
GCWManager* gcwMan = zone->getGCWManager();
if(gcwMan != NULL){
SecuritySliceTask* task = new SecuritySliceTask(gcwMan, tangibleObject.get(), player);
task->execute();
}
}
}
endSlicing();
}
示例2: despawnCamp
bool CampSiteActiveAreaImplementation::despawnCamp() {
Locker locker(_this.get());
if(!abandoned && campOwner != NULL && campOwner->getZoneServer() != NULL) {
/// Get Player Manager
PlayerManager* playerManager = campOwner->getZoneServer()->getPlayerManager();
if (playerManager == NULL) {
error("playerManager is null");
return false;
}
float durationUsed = ((float)(System::getTime() - timeCreated)) / (campStructureData->getDuration() / 4);
if (durationUsed > 1)
durationUsed = 1;
int amount = 0;
int campXp = campStructureData->getExperience();
amount = (int)(campXp * durationUsed);
amount += (int)((visitors.size() -1) * (campXp / 30) * durationUsed);
amount += (int)(currentXp * durationUsed);
playerManager->awardExperience(campOwner, "camp", amount, true);
}
Locker tlocker(&taskMutex);
if(despawnTask != NULL ) {
if(despawnTask->isScheduled())
despawnTask->cancel();
despawnTask = NULL;
}
if(abandonTask != NULL) {
if(abandonTask->isScheduled())
abandonTask->cancel();
abandonTask = NULL;
}
tlocker.release();
if(campOwner != NULL)
campOwner->dropObserver(ObserverEventType::STARTCOMBAT, campObserver);
if (camp != NULL) {
if(camp->getZone() == NULL)
return false;
StructureManager::instance()->destroyStructure(camp);
}
destroyObjectFromWorld(true);
destroyObjectFromDatabase(true);
return true;
}
示例3: awardExperience
int LuaCreatureObject::awardExperience(lua_State* L) {
String experienceType = lua_tostring(L, -2);
int experienceAmount = lua_tointeger(L, -1);
PlayerManager* playerManager = realObject->getZoneServer()->getPlayerManager();
playerManager->awardExperience(realObject, experienceType, experienceAmount, false);
return 0;
}
示例4: handleCommandTraining
bool PetManagerImplementation::handleCommandTraining(CreatureObject* speaker, AiAgent* pet, const String& message){
if( speaker == NULL || pet == NULL )
return false;
if( message.isEmpty() )
return false;
ManagedWeakReference< CreatureObject*> linkedCreature = pet->getLinkedCreature();
if( linkedCreature == NULL )
return false;
// Only owner may train
if( linkedCreature != speaker)
return false;
ManagedReference<PetControlDevice*> pcd = pet->getControlDevice().get().castTo<PetControlDevice*>();
if( pcd == NULL )
return false;
if( pcd->hasTrainedCommandString(message) ){
pet->showFlyText("npc_reaction/flytext","confused", 204, 0, 0); // "?!!?!?!"
return true;
}
unsigned int trainingCommand = pcd->getTrainingCommand();
int petType = pcd->getPetType();
// Train command
if (petType == CREATUREPET) {
bool alreadyTrained = pcd->hasTrainedCommand(trainingCommand);
if (!alreadyTrained) {
bool success = false;
int skill = speaker->getSkillMod("tame_level");
int roll = System::random(skill + 30);
if (skill > roll)
success = true;
if (!success) {
pet->showFlyText("npc_reaction/flytext","confused", 204, 0, 0); // "?!!?!?!"
speaker->sendSystemMessage("@pet/pet_menu:pet_nolearn"); // Your pet doesn't seem to understand you.
return true;
}
}
// Success
pcd->addTrainedCommand( trainingCommand, message );
pet->showFlyText("npc_reaction/flytext","threaten", 204, 0, 0); // "!"
speaker->sendSystemMessage("@pet/pet_menu:pet_learn"); // You teach your pet a new command.
if (!alreadyTrained) {
CreatureTemplate* creatureTemplate = pet->getCreatureTemplate();
if (creatureTemplate == NULL)
return true;
PlayerManager* playerManager = zoneServer->getPlayerManager();
playerManager->awardExperience(speaker, "creaturehandler", 10 * creatureTemplate->getLevel());
}
}
else{
pcd->addTrainedCommand( trainingCommand, message );
pet->showFlyText("npc_reaction/flytext","threaten", 204, 0, 0); // "!"
speaker->sendSystemMessage("@pet/pet_menu:pet_learn"); // You teach your pet a new command.
}
// No renaming of faction pets
if (petType == FACTIONPET)
return true;
// Check for naming string
StringTokenizer tokenizer(message);
tokenizer.setDelimeter(" ");
String parsedName = "";
int numberOfSubStrings = 0;
while (tokenizer.hasMoreTokens()) {
numberOfSubStrings++;
if (!parsedName.isEmpty())
break;
tokenizer.getStringToken(parsedName);
}
String futureName = pcd->getFutureName();
unsigned int namingProgress = pcd->getNamingProgress();
// Validate and check name
if (numberOfSubStrings > 1) {
ZoneProcessServer* zps = pet->getZoneProcessServer();
NameManager* nameManager = zps->getNameManager();
if (nameManager->validateName(parsedName) != NameManagerResult::ACCEPTED) {
return true;
}
//.........这里部分代码省略.........
示例5: updateImageDesign
//.........这里部分代码省略.........
//System::out << h << endl;
if (commitChanges) {
//TODO: set XP Values
int xpGranted = 0; // Minimum Image Design XP granted (base amount).
//if (imageDesignData.mi)
String hairTemplate = imageDesignData.getHairTemplate();
bool statMig = imageDesignData.isStatMigrationRequested();
if (statMig && strongReferenceDesigner->getParentRecursively(SceneObjectType::SALONBUILDING).get().get()
&& strongReferenceDesigner->getParentRecursively(SceneObjectType::SALONBUILDING).get().get() && strongReferenceDesigner != strongReferenceTarget) {
ManagedReference<Facade*> facade = strongReferenceTarget->getActiveSession(SessionFacadeType::MIGRATESTATS);
ManagedReference<MigrateStatsSession*> session = dynamic_cast<MigrateStatsSession*>(facade.get());
if (session != NULL) {
session->migrateStats();
xpGranted = 2000;
}
}
VectorMap<String, float>* bodyAttributes = imageDesignData.getBodyAttributesMap();
VectorMap<String, uint32>* colorAttributes = imageDesignData.getColorAttributesMap();
ImageDesignManager* imageDesignManager = ImageDesignManager::instance();
hairObject = strongReferenceTarget->getSlottedObject("hair").castTo<TangibleObject*>();
if (type == 1) {
String oldCustomization;
if (hairObject != NULL)
hairObject->getCustomizationString(oldCustomization);
hairObject = imageDesignManager->createHairObject(strongReferenceDesigner, strongReferenceTarget, imageDesignData.getHairTemplate(), imageDesignData.getHairCustomizationString());
if (hairObject != NULL)
hairObject->setCustomizationString(oldCustomization);
if (xpGranted < 100)
xpGranted = 100;
}
if (bodyAttributes->size() > 0) {
if (xpGranted < 300)
xpGranted = 300;
for (int i = 0; i < bodyAttributes->size(); ++i) {
VectorMapEntry<String, float>* entry = &bodyAttributes->elementAt(i);
imageDesignManager->updateCustomization(strongReferenceDesigner, entry->getKey(), entry->getValue(), strongReferenceTarget);
}
}
if (colorAttributes->size() > 0) {
if(xpGranted < 100)
xpGranted = 100;
for (int i = 0; i < colorAttributes->size(); ++i) {
VectorMapEntry<String, uint32>* entry = &colorAttributes->elementAt(i);
imageDesignManager->updateColorCustomization(strongReferenceDesigner, entry->getKey(), entry->getValue(), hairObject, strongReferenceTarget);
}
}
imageDesignManager->updateHairObject(strongReferenceTarget, hairObject);
// Add holo emote
String holoemote = imageDesignData.getHoloEmote();
if( !holoemote.isEmpty() ){
PlayerObject* ghost = strongReferenceTarget->getPlayerObject();
ghost->setInstalledHoloEmote( holoemote ); // Also resets number of uses available
strongReferenceTarget->sendSystemMessage("@image_designer:new_holoemote"); //"Congratulations! You have purchased a new Holo-Emote generator. Type '/holoemote help' for instructions."
if(xpGranted < 100)
xpGranted = 100;
}
// Drop the Session for both the designer and the targetCreature;
strongReferenceDesigner->dropActiveSession(SessionFacadeType::IMAGEDESIGN);
strongReferenceTarget->dropActiveSession(SessionFacadeType::IMAGEDESIGN);
// Award XP.
PlayerManager* playerManager = strongReferenceDesigner->getZoneServer()->getPlayerManager();
if (playerManager != NULL && xpGranted > 0) {
if(strongReferenceDesigner == strongReferenceTarget)
xpGranted /= 2;
playerManager->awardExperience(strongReferenceDesigner, "imagedesigner", xpGranted, true);
}
if (idTimeoutEvent != NULL && idTimeoutEvent->isScheduled())
dequeueIdTimeoutEvent();
}
targetObject->sendMessage(message);
}