void PowerRegulatorMenuComponent::fillObjectMenuResponse(SceneObject* sceneObject, ObjectMenuResponse* menuResponse, CreatureObject* player) { ManagedReference<BuildingObject*> building = cast<BuildingObject*>(sceneObject->getParentRecursively(SceneObjectType::FACTIONBUILDING).get().get()); if (building == NULL) return; if (player == NULL || player->isDead() || player->isIncapacitated()) return; Zone* zone = building->getZone(); if (zone == NULL) return; GCWManager* gcwMan = zone->getGCWManager(); if (gcwMan == NULL) return; if (!gcwMan->canUseTerminals(player, building, sceneObject)) return; if (gcwMan->isDNASampled(building) && !gcwMan->isPowerOverloaded(building) && player->getFaction() != building->getFaction()) { menuResponse->addRadialMenuItem(228, 3, "@hq:mnu_set_overload"); // Set to overload } }
void HQMenuComponent::fillObjectMenuResponse(SceneObject* sceneObject, ObjectMenuResponse* menuResponse, CreatureObject* player) { ManagedReference<BuildingObject*> building = cast<BuildingObject*>(sceneObject->getParentRecursively(SceneObjectType::FACTIONBUILDING).get().get()); if (building == NULL) return; if ( player == NULL || player->isDead() || player->isIncapacitated()) return; Zone* zone = building->getZone(); if(zone == NULL) return; GCWManager* gcwMan = zone->getGCWManager(); if(!gcwMan->canUseTerminals(player, building, sceneObject)) return; if(building->getFaction() == player->getFaction()) { menuResponse->addRadialMenuItem(228, 3, "@hq:mnu_defense_status"); if(gcwMan->isShutdownSequenceStarted(building) && building->getPvpStatusBitmask() && CreatureFlag::OVERT){ menuResponse->addRadialMenuItem(231, 3, "@hq:mnu_shutdown"); // Shutdown facility } // donate menus removed menuResponse->addRadialMenuItem(37, 3, "@hq:mnu_donate"); // Donate //menuResponse->addRadialMenuItemToRadialID(37, 225, 3, "@hq:mnu_donate_money"); // Donate MOney menuResponse->addRadialMenuItemToRadialID(37, 226, 3, "@hq:mnu_donate_deed"); // donate defense if(building->getOwnerCreatureObject() == player && building->getPvpStatusBitmask() & CreatureFlag::OVERT){ menuResponse->addRadialMenuItem(38, 3, "@hq:mnu_reset_vulnerability"); // Reset Vulnerability } } else { if(gcwMan->isPowerOverloaded(building) && !gcwMan->isShutdownSequenceStarted(building)){ menuResponse->addRadialMenuItem(230, 3, "@hq:mnu_overload"); // activate overload } } // Admin menus to test out vulnerability manually /* if ( player->getPlayerObject()->isPrivileged()) { //info("player is privelaged", true); menuResponse->addRadialMenuItem(35, 3, "PVP EVENT"); menuResponse->addRadialMenuItemToRadialID(35, MAKEIMPERIAL, 3, "MAKE VULNERABLE"); menuResponse->addRadialMenuItemToRadialID(35, MAKENEUTRAL, 3, "MAKE INVULNERABLE"); } */ //menuResponse->addRadialMenuItem(229, 3, "@player_structure:permission_destroy"); //Destroy Structure }
int PowerRegulatorMenuComponent::handleObjectMenuSelect(SceneObject* sceneObject, CreatureObject* player, byte selectedID) const { if (player->isDead() || player->isIncapacitated() || selectedID != 20) return 1; ManagedReference<BuildingObject*> building = sceneObject->getParentRecursively(SceneObjectType::FACTIONBUILDING).castTo<BuildingObject*>(); ManagedReference<TangibleObject*> powerRegulator = cast<TangibleObject*>(sceneObject); if (building == NULL) return 1; Zone* zone = building->getZone(); if (zone == NULL) return 1; GCWManager* gcwMan = zone->getGCWManager(); if (gcwMan == NULL) return 1; if (!gcwMan->isBaseVulnerable(building)) return 1; if (!gcwMan->areOpposingFactions(player->getFaction(), building->getFaction())) { player->sendSystemMessage("@faction/faction_hq/faction_hq_response:no_tamper"); // You are not an enemy of this structure. Why would you want to tamper? return 1; } else if (gcwMan->isPowerOverloaded(building)) { player->sendSystemMessage("@faction/faction_hq/faction_hq_response:already_overloading"); // The power regulator has already been set to overload. return 1; } else if (!gcwMan->isDNASampled(building)) { player->sendSystemMessage("@faction/faction_hq/faction_hq_response:other_objectives"); // Other objectives must be disabled prior to gaining access to this one. return 1; } else if (player->isInCombat()) { player->sendSystemMessage("@faction/faction_hq/faction_hq_response:power_not_in_combat"); // You cannot align the power flow to overload if you are in combat! return 1; } else if (powerRegulator->getParentID() != player->getParentID()) { player->sendSystemMessage("@faction/faction_hq/faction_hq_response:power_not_in_room"); // You cannot align the power flow if you are not even in the same room! return 1; } else if (powerRegulator->getDistanceTo(player) > 15) { player->sendSystemMessage("@faction/faction_hq/faction_hq_response:power_too_far"); // You are too far away from the power regulator to continue the setup! return 1; } else if (!player->hasSkill("combat_commando_heavyweapon_speed_02")) { player->sendSystemMessage("@faction/faction_hq/faction_hq_response:commando_only"); // Only an experienced commando with heavy weapons training could expect to rig the regulators for overload return 1; } Reference<CreatureObject*> playerRef = player; Core::getTaskManager()->executeTask([=] () { Locker locker(playerRef); Locker clocker(building, playerRef); gcwMan->sendPowerRegulatorControls(playerRef, building, powerRegulator); }, "SendPowerRegulatorControlsLambda"); return 0; }