当前位置: 首页>>代码示例>>C++>>正文


C++ ManagedReference::addMenuItem方法代码示例

本文整理汇总了C++中ManagedReference::addMenuItem方法的典型用法代码示例。如果您正苦于以下问题:C++ ManagedReference::addMenuItem方法的具体用法?C++ ManagedReference::addMenuItem怎么用?C++ ManagedReference::addMenuItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ManagedReference的用法示例。


在下文中一共展示了ManagedReference::addMenuItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: doMusicSelection

void JukeboxImplementation::doMusicSelection(CreatureObject* player) {
	PlayerObject* ghost = player->getPlayerObject();

	if (ghost == NULL)
		return;

	PlayerManager* playerManager = player->getZoneServer()->getPlayerManager();

	if (playerManager == NULL)
		return;

	ManagedReference<SuiListBox*> listbox = new SuiListBox(player, SuiWindowType::JUKEBOX_SELECTION);
    listbox->setCallback(new JukeboxSelectionSuiCallback(server->getZoneServer()));
	listbox->setPromptTitle("@event_perk_jukebox_songs:songs_t"); // Music Select
	listbox->setPromptText("@event_perk_jukebox_songs:songs_d"); // Select a song to play from the list below.
	listbox->setUsingObject(_this.getReferenceUnsafeStaticCast());
	listbox->setForceCloseDistance(32.f);
	listbox->setCancelButton(true, "@cancel");

	int songListSize = playerManager->getNumJukeboxSongs();
	JukeboxSong* song = NULL;

	for (int i = 0; i < songListSize; i++) {
		song = playerManager->getJukeboxSong(i);

		if (song != NULL) {
			listbox->addMenuItem(song->getStringId());
		}
	}

	ghost->addSuiBox(listbox);
	player->sendMessage(listbox->generateMessage());
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:33,代码来源:JukeboxImplementation.cpp

示例2: sendItemListSUI

void ScavengerDroidImplementation::sendItemListSUI(CreatureObject* player) {
	PlayerObject* ghost = player->getPlayerObject();

	if (ghost == NULL)
		return;

	if (itemList.size() == 0) {
		player->sendSystemMessage("@event_perk:scavenger_no_items");
		return;
	}

	ManagedReference<SuiListBox*> listbox = new SuiListBox(player, SuiWindowType::SCAVENGER_ITEM_LIST);
	listbox->setPromptTitle("@event_perk:scavenger_list_t"); // Scavenger Hunt List
	listbox->setPromptText("@event_perk:scavenger_list_d"); // Below you will find the list of items you need to find for the scavenger hunt. Good luck!
	listbox->setUsingObject(_this.getReferenceUnsafeStaticCast());
	listbox->setForceCloseDistance(32.f);
	listbox->setCancelButton(true, "@cancel");

	for (int i = 0; i < itemList.size(); i++) {
		String itemTemplate = itemList.get(i);
		listbox->addMenuItem(TemplateManager::instance()->getTemplate(itemTemplate.hashCode())->getObjectName());
	}

	ghost->addSuiBox(listbox);
	player->sendMessage(listbox->generateMessage());
}
开发者ID:ModTheGalaxy,项目名称:mtgserver,代码行数:26,代码来源:ScavengerDroidImplementation.cpp

示例3: showData

void FireworkShowMenuComponent::showData(CreatureObject* player, FireworkObject* fireworkShow) const {
	ManagedReference<PlayerObject*> ghost = player->getPlayerObject();
	if (ghost == NULL || ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_ADDEVENT) || ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_REMOVEEVENT)
			|| ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_REORDERSHOW) || ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_MODIFYEVENT)
				|| ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_DELAYSELECTION)) {
		return;
	}

	DataObjectComponent* data = fireworkShow->getDataObjectComponent()->get();

	if (data == NULL || !data->isFireworkShowData())
		return;

	FireworkShowDataComponent* fireworkShowData = cast<FireworkShowDataComponent*>(data);

	Locker plocker(player);

	ManagedReference<SuiListBox*> suiBox = new SuiListBox(player, SuiWindowType::FIREWORK_SHOW_ADDEVENT, SuiListBox::HANDLESINGLEBUTTON);
	suiBox->setPromptTitle("@firework:data_title");
	suiBox->setPromptText("@firework:data_prompt");
	suiBox->setOkButton(true, "@ok");
	suiBox->setUsingObject(fireworkShow);

	int totalFireworks = fireworkShowData->getTotalFireworkCount();

	for (int i = 0; i < totalFireworks; i++) {
		ManagedReference<FireworkObject*> firework = fireworkShowData->getFirework(i);
		String fireworkDelay = String::valueOf(float(fireworkShowData->getFireworkDelay(i)) / 1000.f);
		String menuItem = "(" + String::valueOf(i) + ":" + fireworkDelay + "s) " + firework->getDisplayedName();
		suiBox->addMenuItem(menuItem);
	}

	ghost->addSuiBox(suiBox);
	player->sendMessage(suiBox->generateMessage());
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:35,代码来源:FireworkShowMenuComponent.cpp

示例4: sendMasterLooterList

	void GroupManager::sendMasterLooterList(GroupObject* group, CreatureObject* leader) {
		//Pre: Leader and group are locked
		//Post: Leader and group are locked

		if (group == NULL || leader == NULL)
			return;

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

		//Close SUI box if already open.
		ghost->closeSuiWindowType(SuiWindowType::GROUP_LOOT_PICK_LOOTER);

		//Create Master Looter selection list box.
		ManagedReference<SuiListBox*> sui = new SuiListBox(leader, SuiWindowType::GROUP_LOOT_PICK_LOOTER);
		sui->setPromptTitle("@group:master_looter_sui_title"); //"Select Master Looter"
		sui->setPromptText("@group:choose_master_looter"); //"Choose a Master Looter from the list of available players:"
		sui->setCancelButton(true, "@ui:cancel");
		sui->setOkButton(true, "@ui:ok");
		sui->setCallback(new GroupLootPickLooterSuiCallback(leader->getZoneServer()));

		for (int i = 0; i < group->getGroupSize(); ++i) {
			ManagedReference<CreatureObject*> member = (group->getGroupMember(i)).castTo<CreatureObject*>();
				if (member == NULL || !member->isPlayerCreature())
					continue;

			sui->addMenuItem(member->getFirstName(), member->getObjectID());
		}

		//Send list box to the group leader.
		ghost->addSuiBox(sui);
		leader->sendMessage(sui->generateMessage());
	}
开发者ID:newtempest,项目名称:mtgserver,代码行数:34,代码来源:GroupManager.cpp

示例5: initializeSession

int DestroyStructureSessionImplementation::initializeSession() {
	//TODO: Temporary until CreatureObject* dependency removed.
	if (!creatureObject->isPlayerCreature())
		return cancelSession();

	creatureObject->addActiveSession(SessionFacadeType::DESTROYSTRUCTURE, _this.getReferenceUnsafeStaticCast());

	Locker _lock(structureObject, creatureObject);

	CreatureObject* player = cast<CreatureObject*>( creatureObject.get());

	String no = "\\#FF6347 @player_structure:can_redeed_no_suffix \\#.";
	String yes = "\\#32CD32 @player_structure:can_redeed_yes_suffix \\#.";

	String redeed = (structureObject->isRedeedable()) ? yes : no;

	StringBuffer maint;
	maint << "@player_structure:redeed_maintenance \\#" << ((structureObject->isRedeedable()) ? "32CD32 " : "FF6347 ") << structureObject->getSurplusMaintenance() << "/" << structureObject->getRedeedCost() << "\\#.";

	StringBuffer entry;
	entry << "@player_structure:confirm_destruction_d1 ";
	entry << "@player_structure:confirm_destruction_d2 \n\n";
	entry << "@player_structure:confirm_destruction_d3a ";
	entry << "\\#32CD32 @player_structure:confirm_destruction_d3b \\#. ";
	entry << "@player_structure:confirm_destruction_d4 \n";
	entry << "@player_structure:redeed_confirmation " << redeed;

	StringBuffer cond;
	cond << "@player_structure:redeed_condition \\#32CD32 " << (structureObject->getMaxCondition() - structureObject->getConditionDamage()) << "/" << structureObject->getMaxCondition() << "\\#.";

	ManagedReference<SuiListBox*> sui = new SuiListBox(player);
	sui->setCallback(new DestroyStructureRequestSuiCallback(creatureObject->getZoneServer()));
	sui->setCancelButton(true, "@no");
	sui->setOkButton(true, "@yes");
	sui->setUsingObject(structureObject);
	sui->setPromptTitle(structureObject->getDisplayedName());
	sui->setPromptText(entry.toString());

	sui->addMenuItem("@player_structure:can_redeed_alert " + redeed);
	sui->addMenuItem(cond.toString());
	sui->addMenuItem(maint.toString());

	player->getPlayerObject()->addSuiBox(sui);
	player->sendMessage(sui->generateMessage());

	return 0;
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:47,代码来源:DestroyStructureSessionImplementation.cpp

示例6: sendListBox

void SuiManager::sendListBox(SceneObject* usingObject, SceneObject* player, const String& title, const String& text, const uint8& numOfButtons, const String& cancelButton, const String& otherButton, const String& okButton, LuaObject& options, const String& screenplay, const String& callback) {
	if (usingObject == NULL)
		return;

	if (player == NULL || !player->isCreatureObject())
		return;

	CreatureObject* creature = cast<CreatureObject*>(player);

	PlayerObject* playerObject = creature->getPlayerObject();

	if (playerObject != NULL) {

		ManagedReference<SuiListBox*> box = NULL;

		switch (numOfButtons) {
		case 1:
			box = new SuiListBox(creature, 0x00, SuiListBox::HANDLESINGLEBUTTON);
			box->setCancelButton(false, "");
			box->setOtherButton(false, "");
			box->setOkButton(true, okButton);
			break;
		case 2:
			box = new SuiListBox(creature, 0x00, SuiListBox::HANDLETWOBUTTON);
			box->setCancelButton(true, cancelButton);
			box->setOtherButton(false, "");
			box->setOkButton(true, okButton);
			break;
		case 3:
			box = new SuiListBox(creature, 0x00, SuiListBox::HANDLETHREEBUTTON);
			box->setCancelButton(true, cancelButton);
			box->setOtherButton(true, otherButton);
			box->setOkButton(true, okButton);
			break;
		default:
			return;
			break;
		}

		if(options.isValidTable()){
			for(int i = 1; i <= options.getTableSize(); ++i){
				String optionString = options.getStringAt(i);
				box->addMenuItem(optionString);
			}
			options.pop();
		}

		box->setCallback(new LuaSuiCallback(creature->getZoneServer(), screenplay, callback));
		box->setPromptTitle(title);
		box->setPromptText(text);
		box->setUsingObject(usingObject);
		box->setForceCloseDistance(32.f);

		creature->sendMessage(box->generateMessage());
		playerObject->addSuiBox(box);
	}
}
开发者ID:SWGChoice,项目名称:Core3,代码行数:57,代码来源:SuiManager.cpp

示例7: sendResourceSUI

void PlantObjectImplementation::sendResourceSUI(CreatureObject* player, int type) {
	ManagedReference<PlayerObject*> ghost = player->getPlayerObject();

	if (ghost == NULL)
		return;

	ManagedReference<SuiListBox*> suiBox = new SuiListBox(player, SuiWindowType::GROWABLE_PLANT, SuiListBox::HANDLETWOBUTTON);
	suiBox->setCallback(new GrowablePlantSuiCallback(player->getZoneServer()));
	suiBox->setPromptTitle("@plant_grow:select_resource_sub");
	suiBox->setPromptText("@plant_grow:select_resource_body");
	suiBox->setOkButton(true, "@ok");
	suiBox->setCancelButton(true, "@cancel");
	suiBox->setUsingObject(_this.getReferenceUnsafeStaticCast());
	suiBox->setForceCloseDistance(32.f);

	ManagedReference<SceneObject*> inventory = player->getSlottedObject("inventory");
	ManagedReference<SceneObject*> sceneObject = NULL;

	for (int i=0; i< inventory->getContainerObjectsSize(); i++) {
		sceneObject = inventory->getContainerObject(i);

		if (sceneObject == NULL)
			continue;

		if (sceneObject->isResourceContainer()) {
			ManagedReference<ResourceContainer*> rcno = cast<ResourceContainer*>( sceneObject.get());

			if (rcno == NULL)
				continue;

			ManagedReference<ResourceSpawn*> spawn = rcno->getSpawnObject();

			if (spawn == NULL)
				continue;

			if ((type == 1 && spawn->isType("organic")) || (type == 2 && spawn->isType("water"))) {
				suiBox->addMenuItem(spawn->getName(), sceneObject->getObjectID());
			}
		}
	}

	if (suiBox->getMenuSize() > 0) {
		ghost->closeSuiWindowType(SuiWindowType::GROWABLE_PLANT);
		ghost->addSuiBox(suiBox);
		player->sendMessage(suiBox->generateMessage());
	} else {
		if (type == 1)
			player->sendSystemMessage("@plant_grow:no_nutrients"); // You don't have any nutrients.
		else
			player->sendSystemMessage("@plant_grow:no_water"); // You don't have any water.
	}
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:52,代码来源:PlantObjectImplementation.cpp

示例8: sendRangeSui

void SurveyToolImplementation::sendRangeSui(CreatureObject* player) {
	int surveyMod = player->getSkillMod("surveying");

	ManagedReference<SuiListBox*> suiToolRangeBox = new SuiListBox(player, SuiWindowType::SURVEY_TOOL_RANGE, 0);

	suiToolRangeBox->setPromptTitle("@base_player:swg");
	suiToolRangeBox->setPromptText("@survey:select_range");

	if (surveyMod >= 20)
		suiToolRangeBox->addMenuItem("64m x 3pts", 0);

	if (surveyMod >= 35)
		suiToolRangeBox->addMenuItem("128m x 4pts", 1);

	if (surveyMod >= 55)
		suiToolRangeBox->addMenuItem("192m x 4pts", 2);

	if (surveyMod >= 75)
		suiToolRangeBox->addMenuItem("256m x 5pts", 3);

	if (surveyMod >= 100)
		suiToolRangeBox->addMenuItem("320m x 5pts", 4);


	/// The options below are not true to pre-cu
	if (surveyMod >= 105)
		suiToolRangeBox->addMenuItem("384m x 5pts", 5);

	if (surveyMod >= 110)
		suiToolRangeBox->addMenuItem("448m x 5pts", 6);

	if (surveyMod >= 115)
		suiToolRangeBox->addMenuItem("512m x 5pts", 7);

	if (surveyMod >= 125)
		suiToolRangeBox->addMenuItem("1024m x 1024m", 8);

	suiToolRangeBox->setUsingObject(_this.getReferenceUnsafeStaticCast());
	suiToolRangeBox->setCallback(new SurveyToolSetRangeSuiCallback(server->getZoneServer()));
	player->getPlayerObject()->addSuiBox(suiToolRangeBox);
	player->sendMessage(suiToolRangeBox->generateMessage());
}
开发者ID:Mesagoppinmypants,项目名称:mtgtestserver,代码行数:42,代码来源:SurveyToolImplementation.cpp

示例9: sendRepairConfirmTo

void VehicleObjectImplementation::sendRepairConfirmTo(CreatureObject* player) {
	ManagedReference<SuiListBox*> listbox = new SuiListBox(player, SuiWindowType::GARAGE_REPAIR);
    listbox->setCallback(new RepairVehicleSuiCallback(server->getZoneServer()));
	listbox->setPromptTitle("@pet/pet_menu:confirm_repairs_t"); //Confirm Vehicle Repairs
	listbox->setPromptText("@pet/pet_menu:vehicle_repair_d"); //You have chosen to repair your vehicle. Please review the listed details and confirm your selection.
	listbox->setUsingObject(_this.getReferenceUnsafeStaticCast());
	listbox->setCancelButton(true, "@cancel");

	int repairCost = calculateRepairCost(player);
	int totalFunds = player->getBankCredits();
	int tax = 0;

	ManagedReference<CityRegion*> city = getCityRegion();
	if(city != NULL && city->getGarageTax() > 0){
		repairCost += repairCost * city->getGarageTax() / 100;
	}

	listbox->addMenuItem("@pet/pet_menu:vehicle_prompt " + getDisplayedName()); //Vehicle:
	listbox->addMenuItem("@pet/pet_menu:repair_cost_prompt " + String::valueOf(repairCost)); //Repair Cost:
	listbox->addMenuItem("@pet/pet_menu:total_funds_prompt " + String::valueOf(totalFunds)); //Total Funds Available:

	player->getPlayerObject()->addSuiBox(listbox);
	player->sendMessage(listbox->generateMessage());
}
开发者ID:Mesagoppinmypants,项目名称:mtgtestserver,代码行数:24,代码来源:VehicleObjectImplementation.cpp

示例10: promptMaintenanceDroid

void StructureManager::promptMaintenanceDroid(StructureObject* structure, CreatureObject* creature) {
	ManagedReference<PlayerObject*> ghost = creature->getPlayerObject();

	if (ghost == NULL)
		return;

	Vector<DroidObject*> droids;
	ManagedReference<SceneObject*> datapad = creature->getSlottedObject("datapad");
	if(datapad == NULL) {
		return;
	}
	for (int i = 0; i < datapad->getContainerObjectsSize(); ++i) {
		ManagedReference<SceneObject*> object = datapad->getContainerObject(i);

		if (object != NULL && object->isPetControlDevice()) {
			PetControlDevice* device = cast<PetControlDevice*>( object.get());

			if (device->getPetType() == PetManager::DROIDPET) {
				DroidObject* pet = cast<DroidObject*>(device->getControlledObject());
				if (pet->isMaintenanceDroid()) {
					droids.add(pet);
				}
			}
		}
	}
	if (droids.size() == 0) {
		creature->sendSystemMessage("@player_structure:no_droids");
		return;
	}

	ManagedReference<SuiListBox*> box = new SuiListBox(creature,SuiWindowType::STRUCTURE_ASSIGN_DROID);
	box->setCallback(new StructureAssignDroidSuiCallback(creature->getZoneServer()));

	box->setPromptText("@sui:assign_droid_prompt");
	box->setPromptTitle("@sui:assign_droid_title"); // Configure Effects
	box->setOkButton(true, "@ok");

	// Check if player has a droid called with a maintenance module installed
	for (int i = 0; i < droids.size(); ++i) {
		DroidObject* droidObject = droids.elementAt(i);
		box->addMenuItem(droidObject->getDisplayedName(),droidObject->getObjectID());
	}
	box->setUsingObject(structure);
	ghost->addSuiBox(box);
	creature->sendMessage(box->generateMessage());

}
开发者ID:Nifdoolb,项目名称:Server,代码行数:47,代码来源:StructureManager.cpp

示例11: sendLoadUI

void DroidStimpackModuleDataComponent::sendLoadUI(CreatureObject* player) {
	ManagedReference<SceneObject* > inventory = player->getSlottedObject("inventory");

	if (inventory == NULL)
		return;

	ManagedReference<SuiListBox*> loader = new SuiListBox(player, SuiWindowType::DROID_LOAD_STIMPACK, SuiListBox::HANDLETWOBUTTON);
	loader->setPromptTitle("@pet/droid_modules:load_stimpack");
	loader->setPromptText("@group:set_loot_type_text");
	loader->setOkButton(true, "@ok");
	loader->setCancelButton(true, "@cancel");

	for (int i = 0; i < inventory->getContainerObjectsSize(); ++i) {
		SceneObject* item = inventory->getContainerObject(i);

		if (!item->isPharmaceuticalObject())
			continue;

		// check it they have atleast 1 stim pack
		PharmaceuticalObject* pharma = cast<PharmaceuticalObject*>(item);

		if (pharma->isStimPack()) {
			StimPack* stim = cast<StimPack*>(pharma);

			if (stim->isClassA()) {
				String name;

				if (stim->getCustomObjectName().isEmpty()) {
					name = "@" + stim->getObjectNameStringIdFile() + ":" + stim->getObjectNameStringIdName();
				} else {
					name = stim->getCustomObjectName().toString();
				}

				loader->addMenuItem(name, stim->getObjectID());
			}
		}
	}

	loader->setCallback(new LoadStimpackSuiCallback(getParent()->getZoneServer()));
	loader->setUsingObject(getDroidObject());
	player->getPlayerObject()->addSuiBox(loader);
	player->sendMessage(loader->generateMessage());
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:43,代码来源:DroidStimpackModuleDataComponent.cpp

示例12: reorderShow

void FireworkShowMenuComponent::reorderShow(CreatureObject* player, FireworkObject* fireworkShow) const {
	ManagedReference<PlayerObject*> ghost = player->getPlayerObject();
	if (ghost == NULL || ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_ADDEVENT) || ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_REMOVEEVENT)
			|| ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_REORDERSHOW) || ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_MODIFYEVENT)
				|| ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_DELAYSELECTION)) {
		return;
	}

	DataObjectComponent* data = fireworkShow->getDataObjectComponent()->get();

	if (data == NULL || !data->isFireworkShowData())
		return;

	FireworkShowDataComponent* fireworkShowData = cast<FireworkShowDataComponent*>(data);

	Locker plocker(player);

	ManagedReference<SuiListBox*> suiBox = new SuiListBox(player, SuiWindowType::FIREWORK_SHOW_REORDERSHOW, SuiListBox::HANDLETHREEBUTTON);
	suiBox->setPromptTitle("@firework:modify_index_title"); // Remove Show Event
	suiBox->setPromptText("@firework:modify_index_prompt"); // Select the event index for which you would like to modify the delay time.
	suiBox->setOkButton(true, "@ui:done");
	suiBox->setCancelButton(true, "@ui:moveup");
	suiBox->setOtherButton(true, "@ui:movedown");
	suiBox->setUsingObject(fireworkShow);

	int totalFireworks = fireworkShowData->getTotalFireworkCount();

	for (int i = 0; i < totalFireworks; i++) {
		ManagedReference<FireworkObject*> firework = fireworkShowData->getFirework(i);
		String fireworkDelay = String::valueOf(float(fireworkShowData->getFireworkDelay(i)) / 1000.f);
		String menuItem = "(" + String::valueOf(i) + ":" + fireworkDelay + "s) " + firework->getDisplayedName();
		suiBox->addMenuItem(menuItem, firework->getObjectID());
	}

	suiBox->setCallback(new FireworkShowReorderShowSuiCallback(player->getZoneServer()));
	ghost->addSuiBox(suiBox);
	player->sendMessage(suiBox->generateMessage());
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:38,代码来源:FireworkShowMenuComponent.cpp

示例13: reportStructureStatus

void StructureManager::reportStructureStatus(CreatureObject* creature,
		StructureObject* structure) {
	ManagedReference<PlayerObject*> ghost = creature->getPlayerObject();

	if (ghost == NULL)
		return;

	//Close the window if it is already open.
	ghost->closeSuiWindowType(SuiWindowType::STRUCTURE_STATUS);

	ManagedReference<SuiListBox*> status = new SuiListBox(creature,
			SuiWindowType::STRUCTURE_STATUS);
	status->setPromptTitle("@player_structure:structure_status_t"); //Structure Status
	status->setPromptText(
			"@player_structure:structure_name_prompt "
					+ structure->getDisplayedName()); //Structure Name:
	status->setUsingObject(structure);
	status->setOkButton(true, "@refresh");
	status->setCancelButton(true, "@cancel");
	status->setCallback(new StructureStatusSuiCallback(server));

	ManagedReference<SceneObject*> ownerObject = server->getObject(
			structure->getOwnerObjectID());

	if (ownerObject != NULL && ownerObject->isCreatureObject()) {
		CreatureObject* owner = cast<CreatureObject*>(ownerObject.get());
		status->addMenuItem(
				"@player_structure:owner_prompt " + owner->getFirstName());
	}

	uint64 declaredOidResidence = ghost->getDeclaredResidence();

	ManagedReference<BuildingObject*> declaredResidence =
			server->getObject(declaredOidResidence).castTo<BuildingObject*>();

	if (declaredResidence == structure) {
		status->addMenuItem("@player_structure:declared_residency"); //You have declared your residency here.
	}

	if (structure->isPrivateStructure() && !structure->isCivicStructure()) {
		status->addMenuItem("@player_structure:structure_private"); //This structure is private
	} else {
		status->addMenuItem("@player_structure:structure_public"); //This structure is public
	}

	status->addMenuItem(
			"@player_structure:condition_prompt "
					+ String::valueOf(structure->getDecayPercentage()) + "%");

	if (!structure->isCivicStructure()) {

		// property tax
		float propertytax = 0.f;
		if(!structure->isCivicStructure() && structure->getCityRegion() != NULL){
			ManagedReference<CityRegion*> city = structure->getCityRegion().get();
			if(city != NULL){
				propertytax = city->getPropertyTax()/ 100.f * structure->getMaintenanceRate();
				status->addMenuItem(
							"@city/city:property_tax_prompt : "
									+ String::valueOf(ceil(propertytax))
									+  " cr/hr");
			}
		}

		// maintenance
		float secsRemainingMaint = 0.f;
		if( structure->getSurplusMaintenance() > 0 ){
			float totalrate = (float)structure->getMaintenanceRate() + propertytax;
			secsRemainingMaint = ((float)structure->getSurplusMaintenance() / totalrate)*3600;
		}

		status->addMenuItem(
			"@player_structure:maintenance_pool_prompt "
					+ String::valueOf( (int) floor( (float) structure->getSurplusMaintenance()))
					+ " "
					+ getTimeString( (uint32)secsRemainingMaint ) );

		status->addMenuItem(
			"@player_structure:maintenance_rate_prompt "
					+ String::valueOf(structure->getMaintenanceRate())
					+ " cr/hr");

		status->addMenuItem(
			"@player_structure:maintenance_mods_prompt "
					+ structure->getMaintenanceMods());
	}


	if (structure->isInstallationObject() && !structure->isGeneratorObject() && !structure->isCivicStructure()) {
		InstallationObject* installation = cast<InstallationObject*>(structure);

		float secsRemainingPower = 0.f;
		if( installation->getSurplusPower() > 0 ){
			secsRemainingPower = ((float)installation->getSurplusPower() / (float)installation->getBasePowerRate())*3600;
		}

		status->addMenuItem(
				"@player_structure:power_reserve_prompt "
						+ String::valueOf( (int) installation->getSurplusPower())
						+ " "
//.........这里部分代码省略.........
开发者ID:Skyyyr,项目名称:GR-Core-TC1,代码行数:101,代码来源:StructureManager.cpp

示例14: handleDisplayStatus

void VendorManager::handleDisplayStatus(CreatureObject* player, TangibleObject* vendor) {

	if(vendor->getZone() == NULL) {
		error("NULL zone in VendorManager::handleDisplayStatus");
		return;
	}

	DataObjectComponentReference* data = vendor->getDataObjectComponent();
	if(data == NULL || data->get() == NULL || !data->get()->isVendorData()) {
		error("Vendor has no data component");
		return;
	}

	VendorDataComponent* vendorData = cast<VendorDataComponent*>(data->get());
	if(vendorData == NULL) {
		error("Vendor has wrong data component");
		return;
	}

	ManagedReference<SuiListBox*> statusBox = new SuiListBox(player, SuiWindowType::STRUCTURE_VENDOR_STATUS);
	statusBox->setUsingObject(vendor);
	statusBox->setPromptTitle("@player_structure:vendor_status");
	statusBox->setPromptText("Vendor Status");

	ManagedReference<CreatureObject*> owner = server->getZoneServer()->getObject(vendorData->getOwnerId()).castTo<CreatureObject*>();
	String ownerName;

	if (owner == NULL)
		ownerName = "NULL";
	else
		ownerName = owner->getFirstName();

	statusBox->addMenuItem("Owner: " + ownerName);

	int condition = (((float)vendor->getMaxCondition() - (float)vendor->getConditionDamage()) / (float)vendor->getMaxCondition()) * 100;
	statusBox->addMenuItem("Condition: " + String::valueOf(condition) + "%");

	float secsRemaining = 0.f;
	if( vendorData->getMaint() > 0 ){
		secsRemaining = (vendorData->getMaint() / vendorData->getMaintenanceRate())*3600;
	}

	statusBox->addMenuItem("Maintenance Pool: " +
			               String::valueOf(vendorData->getMaint()) +
			               "cr " + getTimeString( (uint32)secsRemaining ) );
	statusBox->addMenuItem("Maintenance Rate: " + String::valueOf((int)vendorData->getMaintenanceRate()) + " cr/hr");

	ManagedReference<AuctionManager*> auctionManager = server->getZoneServer()->getAuctionManager();
	if(auctionManager == NULL) {
		error("null auction manager");
		return;
	}
	ManagedReference<AuctionsMap*> auctionsMap = auctionManager->getAuctionMap();
	if(auctionsMap == NULL) {
		error("null auctionsMap");
		return;
	}

	String planet = vendor->getZone()->getZoneName();
	String region = "@planet_n:" + vendor->getZone()->getZoneName();


	ManagedReference<CityRegion*> regionObject = vendor->getCityRegion();
	if(regionObject != NULL)
		region = regionObject->getRegionName();

	TerminalListVector vendorList = auctionsMap->getVendorTerminalData(planet, region, vendor);

	uint32 itemsForSaleCount = 0;

	if(vendorList.size() > 0) {

		Reference<TerminalItemList*> list = vendorList.get(0);
		if (list != NULL) {

			for (int j = 0; j < list->size(); ++j) {
				ManagedReference<AuctionItem*> item = list->get(j);
				if (item == NULL)
					continue;

				int itemSize = item->getSize();

				if (itemSize > 50)
					itemsForSaleCount += 50;
				else if (itemSize > 0)
					itemsForSaleCount += itemSize;
				else
					itemsForSaleCount++;
			}
		}
	}


	statusBox->addMenuItem("Number of Items For Sale: " + String::valueOf(itemsForSaleCount));

	if (vendorData->isVendorSearchEnabled())
		statusBox->addMenuItem("@player_structure:vendor_search_enabled");
	else
		statusBox->addMenuItem("@player_structure:vendor_search_disabled");

//.........这里部分代码省略.........
开发者ID:SWGChoice,项目名称:Core3,代码行数:101,代码来源:VendorManager.cpp

示例15: handleObjectMenuSelect

int DroidMaintenanceModuleDataComponent::handleObjectMenuSelect(CreatureObject* player, byte selectedID, PetControlDevice* controller) {

	ManagedReference<DroidObject*> droid = getDroidObject();
	if( droid == NULL ){
		info( "Droid is null");
		return 0;
	}

	Locker dlock( droid, player );

	// Perform Maintenance Run
	if( selectedID == MAINT_MODULE_PERFORM ){

		// Init Maintenance Run Session
		//droid->getCooldownTimerMap()->updateToCurrentAndAddMili("Droid_Cooldown",1800000);
		// Interplanetary Time + 1 hour 40 minutes, 33 seconds
		// Local time: distance < 432 == 15 mins + (1s per 3 meters to next structure for that planet @ < 432m from first structure)
		// Local time: distance > 432 == 48 minutes 20 seconds
		// Start a session for the player and this module!
		ManagedReference<DroidMaintenanceSession*> session = new DroidMaintenanceSession(this, player);
		session->initialize();
		player->addActiveSession(SessionFacadeType::DROIDMAINTENANCERUN, session);
		session->sendMaintanceRunBox();
		return 0;
	}
	// Edit Maintenance List
	else if( selectedID == MAINT_MODULE_EDIT ){

		if( assignedStructures.isEmpty() ){
			player->sendSystemMessage( "@pet/droid_modules:droid_maint_empty_list" ); // The maintenance list for this droid is empty. Go to one of your structures and assign this droid to maintain it.
			return 0;
		}

		// Build List of Assigned Structures
		ManagedReference<SuiListBox*> box = new SuiListBox(player, SuiWindowType::DROID_EDIT_ASSIGNED_STRUCTURES, SuiListBox::HANDLETWOBUTTON);
		box->setCallback(new RemoveDroidStructureSuiCallback(player->getZoneServer(), this));
		box->setPromptTitle("@pet/droid_modules:droid_maint_edit_title"); // Edit Maintenance List
		box->setPromptText("@pet/droid_modules:droid_maint_edit_prompt"); // Please select a structure to remove from this droid's maintenance list.

		box->setOkButton(true, "@delete");
		box->setCancelButton(true, "@cancel");

		for (int i = 0; i < assignedStructures.size(); i++) {

			uint64 objectId = assignedStructures.elementAt(i);
			ManagedReference<SceneObject*> obj = player->getZoneServer()->getObject(objectId);
			if( obj != NULL && obj->isStructureObject() ){
				StructureObject* structureObject = cast<StructureObject*>(obj.get());
				if( structureObject != NULL ){
					box->addMenuItem( structureObject->getDisplayedName(), objectId );
				}
			}
		}

		box->setUsingObject(droid);
		player->getPlayerObject()->addSuiBox(box);
		player->sendMessage(box->generateMessage());

	}

	return 0;
}
开发者ID:blacknightownzjoo,项目名称:SWGOOW,代码行数:62,代码来源:DroidMaintenanceModuleDataComponent.cpp


注:本文中的ManagedReference::addMenuItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。