void DroidRepairModuleDataComponent::handlePetCommand(String cmd, CreatureObject* speaker){ ManagedReference<DroidObject*> droid = getDroidObject(); if( droid == NULL ) return; ManagedReference<PetControlDevice*> pcd = droid->getControlDevice().get().castTo<PetControlDevice*>(); if( pcd == NULL ) return; PetManager* petManager = droid->getZoneServer()->getPetManager(); if( petManager == NULL ) return; // Owner-only command if( droid->getLinkedCreature() != speaker ) return; if( petManager->isTrainedCommand( pcd, PetManager::REPAIR, cmd ) ){ petManager->enqueuePetCommand(speaker, droid, String("petRepair").toLowerCase().hashCode(), ""); } }
int DroidRepairModuleDataComponent::handleObjectMenuSelect(CreatureObject* player, byte selectedID, PetControlDevice* controller) { // Handle repair request if( selectedID == REPAIR_MODULE_ACTIVATE ){ PetManager* petManager = player->getZoneServer()->getPetManager(); if( petManager == NULL ) return 0; petManager->enqueuePetCommand(player, getDroidObject(), String("petRepair").toLowerCase().hashCode(), ""); } // Handle command training else if( selectedID == REPAIR_MODULE_TRAIN ){ if( controller == NULL ) return 0; controller->setTrainingCommand( PetManager::REPAIR ); } return 0; }