当前位置: 首页>>代码示例>>C++>>正文


C++ PetManager::checkMountEligibility方法代码示例

本文整理汇总了C++中PetManager::checkMountEligibility方法的典型用法代码示例。如果您正苦于以下问题:C++ PetManager::checkMountEligibility方法的具体用法?C++ PetManager::checkMountEligibility怎么用?C++ PetManager::checkMountEligibility使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PetManager的用法示例。


在下文中一共展示了PetManager::checkMountEligibility方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: arrestGrowth

void PetControlDeviceImplementation::arrestGrowth() {
	if (petType != PetManager::CREATUREPET)
		return;

	if (growthStage <= 0 || growthStage >= 10)
		return;

	ManagedReference<TangibleObject*> controlledObject = this->controlledObject.get();

	if (controlledObject == NULL || !controlledObject->isCreature())
		return;

	ManagedReference<Creature*> pet = cast<Creature*>(controlledObject.get());

	ManagedReference<CreatureTemplate*> creatureTemplate = pet->getCreatureTemplate();

	if (creatureTemplate == NULL)
		return;

	PetManager* petManager = pet->getZoneServer()->getPetManager();
	if (petManager == NULL)
		return;

	int newStage = growthStage;

	for (int i = (growthStage + 1); i < 11; i++) {
		float newHeight = creatureTemplate->getScale() * (0.46 + ((float)i * 0.06));

		short mountEligibility = petManager->checkMountEligibility(_this.getReferenceUnsafeStaticCast(), newHeight);

		if (mountEligibility == PetManager::TOOLARGE)
			break;
		else if (mountEligibility == PetManager::CANBEMOUNTTRAINED)
			newStage = i;
	}

	if (newStage > growthStage) {
		float newLevel = ((float)pet->getAdultLevel() / 10.0) * (float)newStage;
		if (newLevel < 1)
			newLevel = 1;

		float newHeight = creatureTemplate->getScale() * (0.46 + ((float)newStage * 0.06));

		pet->setHeight(newHeight, false);
		pet->setPetLevel(newLevel);
	}

	setVitality(getVitality());

	growthStage = 10;
	lastGrowth.updateToCurrentTime();
}
开发者ID:Marott1,项目名称:Core3,代码行数:52,代码来源:PetControlDeviceImplementation.cpp

示例2: trainAsMount

void PetControlDeviceImplementation::trainAsMount(CreatureObject* player) {
	if (isTrainedAsMount())
		return;

	PetManager* petManager = player->getZoneServer()->getPetManager();
	if (petManager == NULL)
		return;

	if (petManager->checkMountEligibility(_this.get()) != PetManager::CANBEMOUNTTRAINED)
		return;

	ManagedReference<TangibleObject*> controlledObject = this->controlledObject.get();
	if (controlledObject == NULL || !controlledObject->isAiAgent())
		return;

	AiAgent* pet = cast<AiAgent*>(controlledObject.get());
	if( pet == NULL )
		return;

	trainedAsMount = true;
	pet->setOptionsBitmask(0x1080);
}
开发者ID:KiritoShadowfang,项目名称:Core3,代码行数:22,代码来源:PetControlDeviceImplementation.cpp

示例3: trainAsMount

void PetControlDeviceImplementation::trainAsMount(CreatureObject* player) {
	if (isTrainedAsMount() || !player->hasSkill("outdoors_creaturehandler_support_04"))
		return;

	PetManager* petManager = player->getZoneServer()->getPetManager();
	if (petManager == NULL)
		return;

	if (petManager->checkMountEligibility(_this.getReferenceUnsafeStaticCast()) != PetManager::CANBEMOUNTTRAINED)
		return;

	ManagedReference<TangibleObject*> controlledObject = this->controlledObject.get();
	if (controlledObject == NULL || !controlledObject->isAiAgent())
		return;

	AiAgent* pet = cast<AiAgent*>(controlledObject.get());
	if( pet == NULL )
		return;

	assert(pet->isLockedByCurrentThread());

	trainedAsMount = true;
	pet->setOptionBit(0x1000);
}
开发者ID:Marott1,项目名称:Core3,代码行数:24,代码来源:PetControlDeviceImplementation.cpp

示例4: fillObjectMenuResponse


//.........这里部分代码省略.........
		menuResponse->addRadialMenuItemToRadialID(141, 151, 3, "@pet/pet_menu:menu_assume_formation_2" ); // PET_ASSUME_FORMATION_2
		menuResponse->addRadialMenuItemToRadialID(141, 158, 3, "@pet/pet_menu:menu_group" ); // PET_GROUP
		menuResponse->addRadialMenuItemToRadialID(141, 163, 3, "@pet/pet_menu:menu_ranged_attack" );
		menuResponse->addRadialMenuItemToRadialID(141, 164, 3, "@pet/pet_menu:menu_store" );
		menuResponse->addRadialMenuItemToRadialID(141, 165, 3, "@pet/pet_menu:menu_follow_other" );

		if( pet->isIncapacitated() ){
			menuResponse->addRadialMenuItem(166, 3, "@pet/pet_menu:awaken" );
		}

	}
	// CREATURES
	else if( controlDevice->getPetType() == PetManager::CREATUREPET ){

		menuResponse->addRadialMenuItem(234, 3, "@pet/pet_menu:menu_feed" ); // PET_FEED

		menuResponse->addRadialMenuItem(141, 3, "@pet/pet_menu:menu_command"); // PET_COMMAND

		if( player->hasSkill( "outdoors_creaturehandler_novice" ) ){
			menuResponse->addRadialMenuItemToRadialID(141, 142, 3, "@pet/pet_menu:menu_follow" ); // PET_FOLLOW
			menuResponse->addRadialMenuItemToRadialID(141, 146, 3, "@pet/pet_menu:menu_attack" ); // PET_ATTACK
			menuResponse->addRadialMenuItemToRadialID(141, 164, 3, "@pet/pet_menu:menu_store" );
		}

		if( player->hasSkill( "outdoors_creaturehandler_training_01" ) ){
			menuResponse->addRadialMenuItemToRadialID(141, 143, 3, "@pet/pet_menu:menu_stay" ); // PET_STAY
		}

		if( player->hasSkill( "outdoors_creaturehandler_training_02" ) ){
			menuResponse->addRadialMenuItemToRadialID(141, 144, 3, "@pet/pet_menu:menu_guard" ); // PET_GUARD
		}

		if( player->hasSkill( "outdoors_creaturehandler_training_03" ) ){
			menuResponse->addRadialMenuItemToRadialID(141, 147, 3, "@pet/pet_menu:menu_patrol" ); // PET_PATROL
			menuResponse->addRadialMenuItemToRadialID(141, 148, 3, "@pet/pet_menu:menu_get_patrol_point" ); // PET_GET_PATROL_POINT
			menuResponse->addRadialMenuItemToRadialID(141, 149, 3, "@pet/pet_menu:menu_clear_patrol_points" ); // PET_CLEAR_PATROL_POINTS
		}

		if( player->hasSkill( "outdoors_creaturehandler_training_04" ) ){
			menuResponse->addRadialMenuItemToRadialID(141, 150, 3, "@pet/pet_menu:menu_assume_formation_1" ); // PET_ASSUME_FORMATION_1
			menuResponse->addRadialMenuItemToRadialID(141, 151, 3, "@pet/pet_menu:menu_assume_formation_2" ); // PET_ASSUME_FORMATION_2
		}

		if( player->hasSkill( "outdoors_creaturehandler_healing_01" ) ){
			menuResponse->addRadialMenuItemToRadialID(141, 154, 3, "@pet/pet_menu:menu_trick_1" ); // PET_TRICK_1
		}

		if( player->hasSkill( "outdoors_creaturehandler_healing_03" ) ){
			menuResponse->addRadialMenuItemToRadialID(141, 155, 3, "@pet/pet_menu:menu_trick_2" ); // PET_TRICK_2
		}

		if( player->hasSkill( "outdoors_creaturehandler_support_01" ) ){
			menuResponse->addRadialMenuItemToRadialID(141, 158, 3, "@pet/pet_menu:menu_group" ); // PET_GROUP
		}

		if( player->hasSkill( "outdoors_creaturehandler_support_02" ) ){
			menuResponse->addRadialMenuItemToRadialID(141, 165, 3, "@pet/pet_menu:menu_follow_other" );
		}

		if( player->hasSkill( "outdoors_creaturehandler_support_03" ) ){
			menuResponse->addRadialMenuItemToRadialID(141, 145, 3, "@pet/pet_menu:menu_friend" ); // PET_FRIEND
		}

		if( player->hasSkill( "outdoors_creaturehandler_taming_03" ) && pet->hasSpecialAttack(1) ){
			menuResponse->addRadialMenuItemToRadialID(141, 161, 3, "@pet/pet_menu:menu_specialattack_one" ); // PET_SPECIAL_ATTACK_ONE
		}

		if( player->hasSkill( "outdoors_creaturehandler_taming_04" ) && pet->hasSpecialAttack(2) ){
			menuResponse->addRadialMenuItemToRadialID(141, 162, 3, "@pet/pet_menu:menu_specialattack_two" ); // PET_SPECIAL_ATTACK_TWO
		}

		if( player->hasSkill( "outdoors_creaturehandler_master" ) ){
			if (pet->hasRangedWeapon()) {
				menuResponse->addRadialMenuItemToRadialID(141, 163, 3, "@pet/pet_menu:menu_ranged_attack" );
			}

			menuResponse->addRadialMenuItemToRadialID(141, 152, 3, "@pet/pet_menu:menu_transfer" ); // PET_TRANSFER
		}

		if( player->hasSkill( "outdoors_creaturehandler_support_04") && !controlDevice->isTrainedAsMount() && petManager->checkMountEligibility(controlDevice) == PetManager::CANBEMOUNTTRAINED){
			menuResponse->addRadialMenuItemToRadialID(141, 207, 3, "@pet/pet_menu:menu_train_mount" ); // Train Pet As A Mount
		}

		if( pet->isIncapacitated() ){
			menuResponse->addRadialMenuItem(166, 3, "@pet/pet_menu:awaken" );
		}

		if (controlDevice->isTrainedAsMount() && !pet->isDead() && !pet->isIncapacitated()) {
			Reference<SceneObject*> rider = pet->getSlottedObject("rider");

			if (rider == NULL) {
				menuResponse->addRadialMenuItem(205, 3, "@pet/pet_menu:menu_mount"); // Climb Aboard Pet
			} else {
				menuResponse->addRadialMenuItem(206, 3, "@pet/pet_menu:menu_dismount"); // Climb Off Of Pet
			}
		}

	}

}
开发者ID:duffstone01,项目名称:duffEMU,代码行数:101,代码来源:PetMenuComponent.cpp

示例5: growPet

bool PetControlDeviceImplementation::growPet(CreatureObject* player, bool force, bool adult) {
	if (petType != PetManager::CREATUREPET)
		return true;

	if (growthStage <= 0 || growthStage >= 10)
		return true;

	ManagedReference<TangibleObject*> controlledObject = this->controlledObject.get();

	if (controlledObject == NULL || !controlledObject->isCreature())
		return true;
	ManagedReference<Creature*> pet = cast<Creature*>(controlledObject.get());

	ManagedReference<CreatureTemplate*> creatureTemplate = pet->getCreatureTemplate();

	if (creatureTemplate == NULL)
		return true;

	PetManager* petManager = pet->getZoneServer()->getPetManager();
	if (petManager == NULL)
		return true;

	Time currentTime;
	uint32 timeDelta = currentTime.getTime() - lastGrowth.getTime();
	int stagesToGrow = timeDelta / 43200; // 12 hour

	if (adult)
		stagesToGrow = 10;

	if (stagesToGrow == 0 && !force)
		return true;

	int newStage = growthStage + stagesToGrow;
	if (newStage > 10)
		newStage = 10;

	float newLevel = ((float)pet->getAdultLevel() / 10.0) * (float)newStage;
	if (newLevel < 1)
		newLevel = 1;

	float newHeight = creatureTemplate->getScale() * (0.46 + ((float)newStage * 0.06));

	short preEligibility = petManager->checkMountEligibility(_this.getReferenceUnsafeStaticCast());
	short postEligibility = petManager->checkMountEligibility(_this.getReferenceUnsafeStaticCast(), newHeight);

	assert(pet->isLockedByCurrentThread());

	if (preEligibility == PetManager::CANBEMOUNTTRAINED && postEligibility == PetManager::TOOLARGE && !force) {
		if (isTrainedAsMount()) {
			arrestGrowth();
			return true;
		}

		PlayerObject* ghost = player->getPlayerObject();

		if (ghost == NULL){
			return true;
		}

		ManagedReference<SuiListBox*> box = new SuiListBox(player, SuiWindowType::MOUNT_GROWTH_ARREST);
		box->setPromptTitle("@pet/pet_menu:mount_growth_title"); // Pet Growth Arrest
		box->setPromptText("@pet/pet_menu:mount_growth_prompt"); // Your pet could be trained as a mount, but is about to grow too large to serve as one. If you ever plan on training this pet as a mount you must arrest it's growth now. Stop pet's growth?
		box->setUsingObject(_this.getReferenceUnsafeStaticCast());
		box->setCancelButton(true, "@cancel");
		box->setOkButton(true, "@yes");
		box->setOtherButton(true, "@no");
		box->setCallback(new MountGrowthArrestSuiCallback(player->getZoneServer(), _this.getReferenceUnsafeStaticCast()));

		ghost->addSuiBox(box);
		player->sendMessage(box->generateMessage());
		return false;
	}

	if (adult)
		pet->setHeight(newHeight, true);
	else
		pet->setHeight(newHeight, false);

	pet->setPetLevel(newLevel);

	growthStage = newStage;
	lastGrowth.updateToCurrentTime();

	setVitality(getVitality());

	return true;
}
开发者ID:Marott1,项目名称:Core3,代码行数:87,代码来源:PetControlDeviceImplementation.cpp


注:本文中的PetManager::checkMountEligibility方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。