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); } } }
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); } } } }
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); } } } }