本文整理汇总了C++中AiAgent::getZoneServer方法的典型用法代码示例。如果您正苦于以下问题:C++ AiAgent::getZoneServer方法的具体用法?C++ AiAgent::getZoneServer怎么用?C++ AiAgent::getZoneServer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AiAgent
的用法示例。
在下文中一共展示了AiAgent::getZoneServer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleObjectMenuSelect
int PetMenuComponent::handleObjectMenuSelect(SceneObject* sceneObject, CreatureObject* player, byte selectedID) {
if (!sceneObject->isPet() || player == NULL)
return 0;
AiAgent* pet = cast<AiAgent*>(sceneObject);
if (!player->getPlayerObject()->isPrivileged() && pet->getLinkedCreature().get() != player)
return 0;
Locker crossLocker(pet, player);
ManagedReference<PetControlDevice*> petControlDevice = pet->getControlDevice().get().castTo<PetControlDevice*>();
if (petControlDevice == NULL)
return 0;
PetManager* petManager = pet->getZoneServer()->getPetManager();
if (petManager == NULL)
return 0;
Locker locker(petControlDevice);
// Store
if (selectedID == 59) {
if (pet->getLinkedCreature() != player) {
ManagedReference<CreatureObject*> owner = pet->getLinkedCreature().get();
if (owner != NULL) {
Reference<PetControlDeviceStoreObjectTask*> task = new PetControlDeviceStoreObjectTask(petControlDevice, owner, true);
task->execute();
}
} else {
petControlDevice->storeObject(player);
}
return 0;
}
if (pet->getLinkedCreature().get() != player)
return 0;
switch(selectedID) {
case 142: // Train Command: Follow
petControlDevice->setTrainingCommand( PetManager::FOLLOW );
break;
case 143: // Train Command: Stay
petControlDevice->setTrainingCommand( PetManager::STAY );
break;
case 144: // Train Command: Guard
petControlDevice->setTrainingCommand( PetManager::GUARD );
break;
case 145: // Train Command: Friend
petControlDevice->setTrainingCommand( PetManager::FRIEND );
break;
case 146: // Train Command: Attack
petControlDevice->setTrainingCommand( PetManager::ATTACK );
break;
case 147: // Train Command: Patrol
petControlDevice->setTrainingCommand( PetManager::PATROL );
break;
case 148: // Train Command: Get Patrol Point
petControlDevice->setTrainingCommand( PetManager::GETPATROLPOINT );
break;
case 149: // Train Command: Clear Patrol Points
petControlDevice->setTrainingCommand( PetManager::CLEARPATROLPOINTS );
break;
case 150: // Train Command: Wedge Formation
petControlDevice->setTrainingCommand( PetManager::FORMATION1 );
break;
case 151: // Train Command: Column Formation
petControlDevice->setTrainingCommand( PetManager::FORMATION2 );
break;
case 152: // Train Command: Transfer
petControlDevice->setTrainingCommand( PetManager::TRANSFER );
break;
case 154: // Train Command: Trick 1
petControlDevice->setTrainingCommand( PetManager::TRICK1 );
break;
case 155: // Train Command: Trick 2
petControlDevice->setTrainingCommand( PetManager::TRICK2 );
break;
case 158: // Train Command: Group
petControlDevice->setTrainingCommand( PetManager::GROUP );
break;
case 161: // Train Command: Special Attack 1
petControlDevice->setTrainingCommand( PetManager::SPECIAL_ATTACK1 );
break;
case 162: // Train Command: Special Attack 2
petControlDevice->setTrainingCommand( PetManager::SPECIAL_ATTACK2 );
break;
case 163: // Train Command: Ranged Attack
petControlDevice->setTrainingCommand( PetManager::RANGED_ATTACK );
break;
case 164: // Train Command: Store
petControlDevice->setTrainingCommand( PetManager::STORE );
break;
case 165: // Train Command: Follow Other
petControlDevice->setTrainingCommand( PetManager::FOLLOWOTHER );
break;
case 166: // Incapacitation Recovery
petManager->enqueueOwnerOnlyPetCommand(player, pet, String("petRecover").toLowerCase().hashCode(), "");
break;
//.........这里部分代码省略.........
示例2: setTrainingCommand
void PetControlDeviceImplementation::setTrainingCommand( unsigned int commandID ){
// we set to 0 to flag completion so skip all this then.
if (commandID == 0) {
trainingCommand = 0;
return;
}
ManagedReference<TangibleObject*> controlledObject = this->controlledObject.get();
if (controlledObject == NULL || !controlledObject->isAiAgent())
return;
AiAgent* pet = cast<AiAgent*>(controlledObject.get());
if( pet == NULL )
return;
ManagedReference<CreatureObject*> owner = pet->getLinkedCreature().get();
if (owner == NULL || !owner->isPlayerCreature())
return;
if( petType == PetManager::DROIDPET) {
ManagedReference<DroidObject*> droid = this->controlledObject.get().castTo<DroidObject*>();
if (droid == NULL)
return;
// Check power on droids
if( !droid->hasPower() ){
droid->showFlyText("npc_reaction/flytext","low_power", 204, 0, 0); // "*Low Power*"
return;
}
if(((commandID == PetManager::ATTACK || commandID == PetManager::GUARD) && !droid->isCombatDroid()) ||
(commandID == PetManager::RANGED_ATTACK && (!droid->isCombatDroid() || !droid->hasRangedWeapon())) ||
(commandID == PetManager::RECHARGEOTHER && !droid->isPowerDroid()) ||
(commandID == PetManager::TRANSFER) ||
(commandID == PetManager::SPECIAL_ATTACK1) ||
(commandID == PetManager::SPECIAL_ATTACK2) ||
(commandID == PetManager::TRICK1) ||
(commandID == PetManager::TRICK2)){
return;
}
}
else if(petType == PetManager::CREATUREPET){
if(((commandID == PetManager::ATTACK || commandID == PetManager::FOLLOW || commandID == PetManager::STORE) && !owner->hasSkill("outdoors_creaturehandler_novice") ) ||
(commandID == PetManager::STAY && !owner->hasSkill("outdoors_creaturehandler_training_01")) ||
(commandID == PetManager::GUARD && !owner->hasSkill("outdoors_creaturehandler_training_02")) ||
(commandID == PetManager::FRIEND && !owner->hasSkill("outdoors_creaturehandler_support_03")) ||
((commandID == PetManager::PATROL || commandID == PetManager::GETPATROLPOINT || commandID == PetManager::CLEARPATROLPOINTS) && !owner->hasSkill("outdoors_creaturehandler_training_03")) ||
((commandID == PetManager::FORMATION1 || commandID == PetManager::FORMATION2) && !owner->hasSkill("outdoors_creaturehandler_training_04")) ||
(commandID == PetManager::TRANSFER && !owner->hasSkill("outdoors_creaturehandler_master")) ||
(commandID == PetManager::TRICK1 && !owner->hasSkill("outdoors_creaturehandler_healing_01")) ||
(commandID == PetManager::TRICK2 && !owner->hasSkill("outdoors_creaturehandler_healing_03")) ||
(commandID == PetManager::GROUP && !owner->hasSkill("outdoors_creaturehandler_support_01")) ||
(commandID == PetManager::SPECIAL_ATTACK1 && (!owner->hasSkill("outdoors_creaturehandler_taming_03") || !pet->hasSpecialAttack(1))) ||
(commandID == PetManager::SPECIAL_ATTACK2 && (!owner->hasSkill("outdoors_creaturehandler_taming_04") || !pet->hasSpecialAttack(2))) ||
(commandID == PetManager::RANGED_ATTACK && (!owner->hasSkill("outdoors_creaturehandler_master") || !pet->hasRangedWeapon())) ||
(commandID == PetManager::FOLLOWOTHER && !owner->hasSkill("outdoors_creaturehandler_support_02")) ||
(commandID == PetManager::RECHARGEOTHER))
return;
}
else if(petType == PetManager::FACTIONPET){
if(commandID == PetManager::RECHARGEOTHER ||
(commandID == PetManager::TRANSFER) ||
(commandID == PetManager::SPECIAL_ATTACK1) ||
(commandID == PetManager::SPECIAL_ATTACK2) ||
(commandID == PetManager::TRICK1) ||
(commandID == PetManager::TRICK2))
return;
}
/** Check for converse and if so, get its personalityStf**/
if (pet->getOptionsBitmask() & OptionBitmask::CONVERSE) {
String stf = pet->getPersonalityStf();
StringBuffer message;
message << stf << ":start_convo_4";
StringIdChatParameter chat;
chat.setStringId(message.toString());
pet->getZoneServer()->getChatManager()->broadcastChatMessage(pet,chat,0,0,0);
} else {
pet->showFlyText("npc_reaction/flytext","alert", 204, 0, 0); // "?"
}
trainingCommand = commandID;
}
示例3: fillObjectMenuResponse
void PetMenuComponent::fillObjectMenuResponse(SceneObject* sceneObject, ObjectMenuResponse* menuResponse, CreatureObject* player) {
if (!sceneObject->isPet())
return;
AiAgent* pet = cast<AiAgent*>(sceneObject);
if (pet->getGroup() != NULL) {
ManagedReference<GroupObject*> group = player->getGroup();
if (group == pet->getGroup()) {
if (group->getLeader() == player) {
menuResponse->addRadialMenuItem(40, 3, "@ui_radial:group_kick"); // Kick from Group
menuResponse->addRadialMenuItemToRadialID(40, 41, 3, "@ui_radial:group_disband" ); // Disband Group
} else {
menuResponse->addRadialMenuItem(39, 3, "@ui_radial:group_leave"); // Leave Group
}
}
}
if (pet->isIncapacitated() && pet->isAttackableBy(player))
menuResponse->addRadialMenuItem(6, 3, "@ui_radial:combat_death_blow"); // Death Blow
if (!player->getPlayerObject()->isPrivileged() && pet->getLinkedCreature() != player) {
return;
}
menuResponse->addRadialMenuItem(59, 3, "@pet/pet_menu:menu_store"); // Store
if (pet->getLinkedCreature().get() != player)
return;
ManagedReference<PetControlDevice*> controlDevice = pet->getControlDevice().get().castTo<PetControlDevice*>();
if( controlDevice == NULL )
return;
PetManager* petManager = pet->getZoneServer()->getPetManager();
if (petManager == NULL)
return;
// DROIDS
if( controlDevice->getPetType() == PetManager::DROIDPET ){
ManagedReference<DroidObject*> droidObject = dynamic_cast<DroidObject*>(controlDevice->getControlledObject());
bool conversingDroid = (pet->getOptionsBitmask() & OptionBitmask::CONVERSE);
if(conversingDroid) {
menuResponse->addRadialMenuItem(132, 3, "@pet/pet_menu:droid_options"); // SERVER_ITEM_OPTIONS
menuResponse->addRadialMenuItemToRadialID(132, 234, 3, "@pet/pet_menu:menu_recharge" ); // PET_FEED
// convsering droids have less re-programmable commands
} else {
menuResponse->addRadialMenuItem(132, 3, "@pet/pet_menu:droid_options"); // SERVER_ITEM_OPTIONS
menuResponse->addRadialMenuItemToRadialID(132, 234, 3, "@pet/pet_menu:menu_recharge" ); // PET_FEED
menuResponse->addRadialMenuItem(141, 3, "@pet/pet_menu:menu_command_droid"); // PET_COMMAND
menuResponse->addRadialMenuItemToRadialID(141, 142, 3, "@pet/pet_menu:menu_follow" ); // PET_FOLLOW
menuResponse->addRadialMenuItemToRadialID(141, 143, 3, "@pet/pet_menu:menu_stay" ); // PET_STAY
if (droidObject != NULL && droidObject->isCombatDroid())
menuResponse->addRadialMenuItemToRadialID(141, 144, 3, "@pet/pet_menu:menu_guard" ); // PET_GUARD
menuResponse->addRadialMenuItemToRadialID(141, 145, 3, "@pet/pet_menu:menu_friend" ); // PET_FRIEND
if (droidObject != NULL && droidObject->isCombatDroid())
menuResponse->addRadialMenuItemToRadialID(141, 146, 3, "@pet/pet_menu:menu_attack" ); // PET_ATTACK
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
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
menuResponse->addRadialMenuItemToRadialID(141, 158, 3, "@pet/pet_menu:menu_group" ); // PET_GROUP
if (droidObject != NULL && droidObject->isCombatDroid() && droidObject->hasRangedWeapon())
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( droidObject != NULL && droidObject->isPowerDroid() ){
menuResponse->addRadialMenuItemToRadialID(141, 235, 3, "@pet/pet_menu:menu_recharge_other" );
}
}
if( pet->isIncapacitated() ){
menuResponse->addRadialMenuItem(166, 3, "@pet/pet_menu:awaken" );
}
}
// FACTION
else if( controlDevice->getPetType() == PetManager::FACTIONPET ){
// future, if conversion do as droid objects above and not add this menu at all.
//bool conversingPet = (pet->getOptionsBitmask() & OptionBitmask::CONVERSE);
menuResponse->addRadialMenuItem(141, 3, "@pet/pet_menu:menu_command"); // PET_COMMAND
menuResponse->addRadialMenuItemToRadialID(141, 142, 3, "@pet/pet_menu:menu_follow" ); // PET_FOLLOW
menuResponse->addRadialMenuItemToRadialID(141, 143, 3, "@pet/pet_menu:menu_stay" ); // PET_STAY
menuResponse->addRadialMenuItemToRadialID(141, 144, 3, "@pet/pet_menu:menu_guard" ); // PET_GUARD
menuResponse->addRadialMenuItemToRadialID(141, 145, 3, "@pet/pet_menu:menu_friend" ); // PET_FRIEND
menuResponse->addRadialMenuItemToRadialID(141, 146, 3, "@pet/pet_menu:menu_attack" ); // PET_ATTACK
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
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
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" );
//.........这里部分代码省略.........
示例4: handleObjectMenuSelect
int PetMenuComponent::handleObjectMenuSelect(SceneObject* sceneObject, CreatureObject* player, byte selectedID) {
if (!sceneObject->isPet())
return 0;
AiAgent* pet = cast<AiAgent*>(sceneObject);
if (!player->getPlayerObject()->isPrivileged() && pet->getLinkedCreature() != player)
return 0;
if (pet->getLinkedCreature() != player) {
player = pet->getLinkedCreature().get();
}
ManagedReference<PetControlDevice*> petControlDevice = pet->getControlDevice().get().castTo<PetControlDevice*>();
if (petControlDevice == NULL || player == NULL)
return 0;
PetManager* petManager = pet->getZoneServer()->getPetManager();
if (petManager == NULL)
return 0;
// Store
if (selectedID == 59) {
petControlDevice->storeObject(player);
return 0;
}
// Recharge
if (selectedID == 234 && petControlDevice->getPetType() == PetManager::DROIDPET ){
petManager->enqueueOwnerOnlyPetCommand(player, pet, String("petRecharge").toLowerCase().hashCode(), "");
}
// Feed
if (selectedID == 234 && petControlDevice->getPetType() == PetManager::CREATUREPET ){
petManager->enqueueOwnerOnlyPetCommand(player, pet, String("petFeed").toLowerCase().hashCode(), "");
}
// Trained Command: Recharge Other
if (selectedID == 235 ){
petControlDevice->setTrainingCommand( PetManager::RECHARGEOTHER );
}
// Train Command: Follow
if (selectedID == 142 ){ // PET_FOLLOW
petControlDevice->setTrainingCommand( PetManager::FOLLOW );
}
// Train Command: Stay
if (selectedID == 143 ){ // PET_STAY
petControlDevice->setTrainingCommand( PetManager::STAY );
}
// Train Command: Guard
if (selectedID == 144 ){ // PET_GUARD
petControlDevice->setTrainingCommand( PetManager::GUARD );
}
// Train Command: Friend
if (selectedID == 145 ){ // PET_FRIEND
petControlDevice->setTrainingCommand( PetManager::FRIEND );
}
// Train Command: Attack
if (selectedID == 146 ){ // PET_ATTACK
petControlDevice->setTrainingCommand( PetManager::ATTACK );
}
// Train Command: Patrol
if (selectedID == 147 ){ // PET_PATROL
petControlDevice->setTrainingCommand( PetManager::PATROL );
}
// Get Patrol Point
if (selectedID == 148 ){ // PET_GET_PATROL_POINT
// TODO Handle setting patrol point
player->sendSystemMessage("PET_GET_PATROL_POINT pet command is not yet implemented.");
}
// Clear Patrol Points
if (selectedID == 149 ){ // PET_CLEAR_PATROL_POINTS
// TODO Handle clearing patrol points
player->sendSystemMessage("PET_CLEAR_PATROL_POINTS pet command is not yet implemented.");
}
// Train Command: Wedge Formation
if (selectedID == 150 ){ // PET_ASSUME_FORMATION_1
petControlDevice->setTrainingCommand( PetManager::FORMATION1 );
}
// Train Command: Column Formation
if (selectedID == 151 ){ // PET_ASSUME_FORMATION_2
petControlDevice->setTrainingCommand( PetManager::FORMATION2 );
}
// Train Command: Transfer
if (selectedID == 152 ){ // PET_TRANSFER
petControlDevice->setTrainingCommand( PetManager::TRANSFER );
}
//.........这里部分代码省略.........