void DroidHarvestModuleDataComponent::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().get() != speaker ) {
		return;
	}

	if( petManager->isTrainedCommand( pcd, PetManager::HARVEST, cmd ) ){
		Locker dlock(droid);
		uint64 targetID = speaker->getTargetID();
		Reference<CreatureObject*> target = droid->getZoneServer()->getObject(targetID, true).castTo<CreatureObject*>();

		if (target != NULL) {
			// this check should occur in the pet speaking handling.
			if(!target->isInRange(droid,64)) {
				speaker->sendSystemMessage("@pet/droid_modules:corpse_too_far");
				return;
			}

			harvestTargets.add(targetID);
		}
		for(int i=0;i<harvestTargets.size();i++){
			if (harvestTargets.get(i) == targetID)
				return;
		}
		harvestTargets.add(targetID);
	}
}
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(), "");
	}
}