int TurretControlMenuComponent::handleObjectMenuSelect(SceneObject* sceneObject, CreatureObject* player, byte selectedID) {
	if (sceneObject == NULL || !sceneObject->isTangibleObject() || player == NULL)
		return 0;

	ManagedReference<PlayerObject*> ghost = player->getPlayerObject();
	if (ghost == NULL)
		return 1;

	ManagedReference<BuildingObject*> building = cast<BuildingObject*>(sceneObject->getParentRecursively(SceneObjectType::FACTIONBUILDING).get().get());

	if(building == NULL)
		return 1;

	Zone* zone = building->getZone();

	if(zone == NULL)
		return 1;

	ManagedReference<GCWManager*> gcwMan = zone->getGCWManager();

	if(gcwMan == NULL)
		return 1;

	if(!gcwMan->canUseTerminals(player, building, sceneObject))
		return 1;

	if(selectedID == 222){
		gcwMan->sendTurretAttackListTo(player,sceneObject);
	}

	return 0;
}
int HQMenuComponent::handleObjectMenuSelect(SceneObject* sceneObject, CreatureObject* creature, byte selectedID) {
	if (creature->isDead() || creature->isIncapacitated())
		return 1;
	ManagedReference<BuildingObject*> building = cast<BuildingObject*>(sceneObject->getParentRecursively(SceneObjectType::FACTIONBUILDING).get().get());

	if(building == NULL)
		return 1;

	Zone* zone = building->getZone();

	if(zone == NULL)
		return 1;

	ManagedReference<GCWManager*> gcwMan = zone->getGCWManager();

	if(gcwMan == NULL)
		return 1;

	if(!gcwMan->canUseTerminals(creature, building, sceneObject))
		return 1;

	if(creature->getFaction() == building->getFaction()) {
		if (selectedID == 20){
			gcwMan->sendStatus(building,creature);
		} else if( selectedID == 228 || selectedID == 20){
				gcwMan->sendBaseDefenseStatus(creature, building);
		} else if ( selectedID == 38) {
				gcwMan->sendResetVerification(creature, building);
		} else if(selectedID == 231) {
			ShutdownSequenceTask* task = new ShutdownSequenceTask(gcwMan, building, creature, false);
			task->execute();
		} else if (selectedID == 226)
				gcwMan->sendSelectDeedToDonate(building,creature,0);
	} else {
		if ( selectedID == 230 ) {
			if(creature->hasSkill("outdoors_squadleader_novice")) {
				ShutdownSequenceTask* task = new ShutdownSequenceTask(gcwMan, building, creature, true);
				task->execute();
			} else
				creature->sendSystemMessage(("@faction/faction_hq/faction_hq_response:terminal_response03")); // only an experienced squad leader could expect to coordinate a reactor overload

		} else if ( selectedID == 20) {

			if(creature->getFactionRank() >= 9) {
				gcwMan->sendStatus(building,creature);
			} else {
				creature->sendSystemMessage("You must be at least a Warrant Officer in order to use this terminal");
			}
		}
	}

	return 0;
}
int UplinkTerminalMenuComponent::handleObjectMenuSelect(SceneObject* sceneObject, CreatureObject* player, byte selectedID) {
	if (sceneObject == NULL || !sceneObject->isTangibleObject() || player == NULL || player->isDead() || player->isIncapacitated())
		return 0;

	ManagedReference<BuildingObject*> building = cast<BuildingObject*>(sceneObject->getParentRecursively(SceneObjectType::FACTIONBUILDING).get().get());
	ManagedReference<TangibleObject*> uplinkTerminal = cast<TangibleObject*>(sceneObject);

	if (building == NULL)
		return 1;

	Zone* zone = sceneObject->getZone();

	if (zone == NULL)
		return 1;

	ManagedReference<GCWManager*> gcwMan = zone->getGCWManager();

	if (gcwMan == NULL)
		return 1;

	if (!gcwMan->canUseTerminals(player, building, sceneObject))
		return 1;

	if (selectedID == 227 || selectedID == 20) {
		if (player->getFaction() != building->getFaction()) {

			if (player->hasSkill("combat_bountyhunter_investigation_02"))
				gcwMan->sendJamUplinkMenu(player, building, uplinkTerminal);
			else
				player->sendSystemMessage("Only an experienced Bounty Hunter with Investigation experience could expect to jam the uplink");
		}

	}

	return 0;
}