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


C++ BaseDroidModuleComponent::fillAttributeList方法代码示例

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


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

示例1: 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

示例2: 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

示例3: fillAttributeList

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

	AiAgentImplementation::fillAttributeList( msg, object );

	ManagedReference<ControlDevice*> device = getControlDevice().get();

	if (device != NULL && device->isASubChildOf(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);
		}

		for( int i=0; i<modules.size(); i++){
			BaseDroidModuleComponent* module = modules.get(i);
			if( module != NULL ){
				module->fillAttributeList(msg, object);
			}
		}
	}
}
开发者ID:Mesagoppinmypants,项目名称:mtgserver,代码行数:22,代码来源:DroidObjectImplementation.cpp


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