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


C++ BaseDroidModuleComponent类代码示例

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


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

示例1: getSlottedObject

void DroidObjectImplementation::initDroidModules(bool init){
	modules.removeAll();
	ManagedReference<SceneObject*> container = getSlottedObject("crafted_components");
	if(container != NULL && container->getContainerObjectsSize() > 0) {
		SceneObject* satchel = container->getContainerObject(0);
		if(satchel != NULL && satchel->getContainerObjectsSize() > 0) {
			for (int i = 0; i < satchel->getContainerObjectsSize(); ++i) {
				ManagedReference<SceneObject*> sceno = satchel->getContainerObject(i);
				if( sceno == NULL ){
					continue;
				}
				DataObjectComponentReference* data = sceno->getDataObjectComponent();
				if(data == NULL || data->get() == NULL || !data->get()->isDroidModuleData() ){
					continue;
				}
				BaseDroidModuleComponent* module = cast<BaseDroidModuleComponent*>(data->get());
				if( module != NULL ){
					modules.add(module);
					if (init) {
						module->initialize( _this.get());
					}
				}
			}
		} else {
			// no modules, so disable some combat stats.
			setResists(0);
			setHitChance(0);
		}
	}
}
开发者ID:duffstone01,项目名称:duffEMU,代码行数:30,代码来源:DroidObjectImplementation.cpp

示例2: runModulePowerDrain

void DroidObjectImplementation::runModulePowerDrain() {
	for( int i=0; i<modules.size(); i++){
		BaseDroidModuleComponent* module = modules.get(i);
		int drain = module->getBatteryDrain();
		if(drain > 0)
			usePower(drain);
	}
}
开发者ID:duffstone01,项目名称:duffEMU,代码行数:8,代码来源:DroidObjectImplementation.cpp

示例3: isMerchantBarker

bool DroidObjectImplementation::isMerchantBarker() {
	for( int i=0; i<modules.size(); i++){
		BaseDroidModuleComponent* module = modules.get(i);
		if(module->getModuleName() == "merchant_barker") {
			return true;
		}
	}
	return false;
}
开发者ID:Mesagoppinmypants,项目名称:mtgserver,代码行数:9,代码来源:DroidObjectImplementation.cpp

示例4: isMaintenanceDroid

bool DroidObjectImplementation::isMaintenanceDroid() {
	for( int i=0; i<modules.size(); i++){
		BaseDroidModuleComponent* module = modules.get(i);
		if(module->getModuleName() == "maintenance_module") {
			return true;
		}
	}
	return false;
}
开发者ID:duffstone01,项目名称:duffEMU,代码行数:9,代码来源:DroidObjectImplementation.cpp

示例5: getModule

BaseDroidModuleComponent* DroidObjectImplementation::getModule(const String& name) {
	for(int i=0;i<modules.size();i++) {
		BaseDroidModuleComponent* module = modules.get(i);
		if(module->getModuleName() == name) {
			return module;
		}
	}
	return NULL;
}
开发者ID:duffstone01,项目名称:duffEMU,代码行数:9,代码来源:DroidObjectImplementation.cpp

示例6: hasStorage

bool DroidObjectImplementation::hasStorage() {
	for( int i=0; i<modules.size(); i++){
		BaseDroidModuleComponent* module = modules.get(i);
		if(module->getModuleName() == "item_storage_module") {
			return true;
		}
	}
	return false;
}
开发者ID:duffstone01,项目名称:duffEMU,代码行数:9,代码来源:DroidObjectImplementation.cpp

示例7: getControlDevice

int DroidObjectImplementation::handleObjectMenuSelect(CreatureObject* player, byte selectedID){

	// Allow modules to handle radials if desired
	PetControlDevice* pcd = getControlDevice().get().castTo<PetControlDevice*>();
	for( int i=0; i<modules.size(); i++){
		BaseDroidModuleComponent* module = modules.get(i);
		module->handleObjectMenuSelect(player, selectedID, pcd);
	}

	return SceneObjectImplementation::handleObjectMenuSelect(player, selectedID); // PetMenuComponent

}
开发者ID:duffstone01,项目名称:duffEMU,代码行数:12,代码来源:DroidObjectImplementation.cpp

示例8: isStructureAssigned

bool DroidObjectImplementation::isStructureAssigned( StructureObject* structure ){
	for( int i=0; i<modules.size(); i++){
		BaseDroidModuleComponent* module = modules.get(i);
		if(module->getModuleName() == "maintenance_module") {
			DroidMaintenanceModuleDataComponent* maintModule = dynamic_cast<DroidMaintenanceModuleDataComponent*>(module);
			if( maintModule != NULL ){
				return maintModule->isAssignedTo( structure->getObjectID() );
			}
		}
	}
	return false;
}
开发者ID:duffstone01,项目名称:duffEMU,代码行数:12,代码来源:DroidObjectImplementation.cpp

示例9: isCombatDroid

bool DroidObjectImplementation::isCombatDroid() {
	for( int i=0; i<modules.size(); i++){
		BaseDroidModuleComponent* module = modules.get(i);
		if(module->isCombatModule()) {
			return true;
		}
	}
	// inante comabt ability, regardless of module installed
	if (getSpecies() == PROBOT || getSpecies() == DZ70)
		return true;

	return false;
}
开发者ID:duffstone01,项目名称:duffEMU,代码行数:13,代码来源:DroidObjectImplementation.cpp

示例10: processModule

void DroidDeedImplementation::processModule(BaseDroidModuleComponent* module, uint32 crc) {
	if (module == NULL)
		return;
	if (module->isStackable()) {
		if (modules.containsKey(module->getModuleName())) {
			// add to the stack if stackable.
			DroidComponent* comp = modules.get(module->getModuleName());
			BaseDroidModuleComponent* bmodule = cast<BaseDroidModuleComponent*>(comp->getDataObjectComponent()->get());
			bmodule->addToStack(module);
		} else {
			ManagedReference<DroidComponent*> dcomp = (this->getZoneServer()->createObject(crc,1)).castTo<DroidComponent*>();
			dcomp->setParent(NULL);
			BaseDroidModuleComponent* bmodule = cast<BaseDroidModuleComponent*>(dcomp->getDataObjectComponent()->get());
			bmodule->copy(module);
			bmodule->setSpecies(species);
			modules.put(module->getModuleName(),dcomp);
		}
	} else {
		ManagedReference<DroidComponent*> dcomp = (this->getZoneServer()->createObject(crc,1)).castTo<DroidComponent*>();
		dcomp->setParent(NULL);
		BaseDroidModuleComponent* bmodule = cast<BaseDroidModuleComponent*>(dcomp->getDataObjectComponent()->get());
		bmodule->copy(module);
		bmodule->setSpecies(species);
		modules.put(module->getModuleName(),dcomp);
	}

}
开发者ID:Chilastra-Reborn,项目名称:Chilastra-source-code,代码行数:27,代码来源:DroidDeedImplementation.cpp

示例11: showFlyText

void DroidObjectImplementation::handleLowPower(){

	// Send fly text
	showFlyText("npc_reaction/flytext","low_power", 204, 0, 0);  // "*Low Power*"
	doAnimation("power_down");

	// Stop following
	setOblivious();

	// Deactivate all modules
	for( int i=0; i<modules.size(); i++){
		BaseDroidModuleComponent* module = modules.get(i);
		module->deactivate();
	}

	return;
}
开发者ID:duffstone01,项目名称:duffEMU,代码行数:17,代码来源:DroidObjectImplementation.cpp

示例12: fillAttributeList

void DroidDeedImplementation::fillAttributeList(AttributeListMessage* alm, CreatureObject* object) {
	DeedImplementation::fillAttributeList(alm, object);

	// @TODO Add attributes
	// Deed needs to show a few important bits
	// 1.) HAM
	int maxHam = DroidMechanics::determineHam(overallQuality,species);
	alm->insertAttribute("challenge_level", level);
	alm->insertAttribute("creature_health", maxHam);
	alm->insertAttribute("creature_action", maxHam);
	alm->insertAttribute("creature_mind", maxHam);
	if(combatRating > 0 || (species == DroidObject::DZ70 || species == DroidObject::PROBOT) ) {
		StringBuffer attdisplayValue;
		float attackSpeed = DroidMechanics::determineSpeed(species,maxHam);
		float chanceHit = DroidMechanics::determineHit(species,maxHam);
		// do we have a combat module installed?
		float damageMin = DroidMechanics::determineMinDamage(species,combatRating);
		float damageMax = DroidMechanics::determineMaxDamage(species,combatRating);
		attdisplayValue << Math::getPrecision(attackSpeed, 2);
		StringBuffer hitdisplayValue;
		hitdisplayValue << Math::getPrecision(chanceHit, 2);
		alm->insertAttribute("creature_attack", attdisplayValue);
		alm->insertAttribute("creature_tohit", hitdisplayValue);
		alm->insertAttribute("creature_damage", String::valueOf(damageMin) + " - " + String::valueOf(damageMax));
	}
	// hit and speed?
	// if object is the master
	String key;
	ManagedReference<DroidComponent*> comp = NULL;
	HashTableIterator<String, ManagedReference<DroidComponent*> > iterator = modules.iterator();
	for(int i = 0; i < modules.size(); ++i) {
		iterator.getNextKeyAndValue(key, comp);
		if (comp) {
			DataObjectComponentReference* data = comp->getDataObjectComponent();
			BaseDroidModuleComponent* module = NULL;
			if(data != NULL && data->get() != NULL && data->get()->isDroidModuleData() ){
				module = cast<BaseDroidModuleComponent*>(data->get());
			}
			if (module == NULL) {
				continue;
			}
			module->fillAttributeList(alm,object);
		}
	}
}
开发者ID:Chilastra-Reborn,项目名称:Chilastra-source-code,代码行数:45,代码来源:DroidDeedImplementation.cpp

示例13: getControlDevice

int DroidObjectImplementation::handleObjectMenuSelect(CreatureObject* player, byte selectedID){

	PetControlDevice* pcd = getControlDevice().get().castTo<PetControlDevice*>();
	if (getLinkedCreature().get() == player) {
		// Allow modules to handle radials if desired
		for( int i=0; i<modules.size(); i++){
			BaseDroidModuleComponent* module = modules.get(i);
			module->handleObjectMenuSelect(player, selectedID, pcd);
		}
	}
	else if (isMerchantBarker()) {
		BaseDroidModuleComponent* module = getModule("merchant_barker");
		if(module != NULL)
			module->handleObjectMenuSelect(player, selectedID, pcd);
	}
	return SceneObjectImplementation::handleObjectMenuSelect(player, selectedID); // PetMenuComponent

}
开发者ID:Mesagoppinmypants,项目名称:mtgserver,代码行数:18,代码来源:DroidObjectImplementation.cpp

示例14: getCraftingStation

CraftingStation* DroidObjectImplementation::getCraftingStation(int type){
	for( int i=0; i<modules.size(); i++){
		BaseDroidModuleComponent* module = modules.get(i);
		if( module != NULL && module->actsAsCraftingStation()){
			DroidCraftingModuleDataComponent* craftingModule = dynamic_cast<DroidCraftingModuleDataComponent*>(module);
			if( craftingModule != NULL ){
				CraftingStation* craftingStation = craftingModule->getCraftingStation();
				if (craftingStation != NULL) {
					// case here to check each type
					if (craftingModule->validCraftingType(type) || (type == CraftingTool::JEDI && craftingModule->isWeaponDroidGeneric()) || (type == CraftingTool::GENERIC && craftingModule->isWeaponDroidGeneric()))
					{
						return craftingStation;
					}
				}
			}
		}
	}
	return NULL;
}
开发者ID:duffstone01,项目名称:duffEMU,代码行数:19,代码来源:DroidObjectImplementation.cpp

示例15: fillAttributeList

void DroidObjectImplementation::fillAttributeList(AttributeListMessage* msg, CreatureObject* object){

	AiAgentImplementation::fillAttributeList( msg, object );

	float percentPower = ((float)power/(float)MAX_POWER)*100.0;
	msg->insertAttribute("@obj_attr_n:battery_power", String::valueOf((int)percentPower) + "%");

	if (paintCount > 0){
		msg->insertAttribute("customization_cnt", paintCount);
	}
	// only the owner should see module stats. AiAgent will fill in normal stuff
	if (getLinkedCreature().get() == object || getLinkedCreature().get() == NULL || object == NULL) {
		for( int i=0; i<modules.size(); i++){
			BaseDroidModuleComponent* module = modules.get(i);
			if( module != NULL ){
				module->fillAttributeList(msg, object);
			}
		}
	}
}
开发者ID:duffstone01,项目名称:duffEMU,代码行数:20,代码来源:DroidObjectImplementation.cpp


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