void PetDeedImplementation::updateCraftingValues(CraftingValues* values, bool firstUpdate) { ManagedReference<ManufactureSchematic*> manufact = values->getManufactureSchematic(); float clFactor = 0; for (int i = 0; i < manufact->getSlotCount(); ++i) { // Dna Component Slots Reference<IngredientSlot* > iSlot = manufact->getSlot(i); if (iSlot->isComponentSlot()) { ComponentSlot* cSlot = cast<ComponentSlot*>(iSlot.get()); ManagedReference<TangibleObject*> tano = cSlot->getPrototype(); ManagedReference<GeneticComponent*> component = cast<GeneticComponent*>( tano.get()); // Now we can suck in the values clFactor = component->getLevel(); quality = component->getQuality(); chanceHit = component->getHit(); attackSpeed = component->getSpeed(); damageMin = component->getMinDamage(); damageMax = component->getMaxDamage(); armor = component->getArmor(); kinResist = round(component->getKinetic()); energyResist = round(component->getEnergy()); blastResist = round(component->getBlast()); coldResist = round(component->getCold()); heatResist = round(component->getHeat()); elecResist = round(component->getElectrical()); acidResist = round(component->getAcid()); stunResist = round(component->getStun()); saberResist = round(component->getSaber()); health = component->getHealth(); action = component->getAction(); mind = component->getMind(); special1 = component->getSpecial1(); special2 = component->getSpecial2(); ranged = component->getRanged(); cleverness = component->getCleverness(); endurance = component->getEndurance(); fierceness = component->getFierceness(); power = component->getPower(); intelligence = component->getIntelligence(); courage = component->getCourage(); dependency = component->getDependency(); dexterity = component->getDexterity(); fortitude = component->getFortitude(); hardiness = component->getHardiness(); if (component->isSpecialResist(WeaponObject::KINETIC)) setSpecialResist(WeaponObject::KINETIC); if (component->isSpecialResist(WeaponObject::ELECTRICITY)) setSpecialResist(WeaponObject::ELECTRICITY); if (component->isSpecialResist(WeaponObject::ENERGY)) setSpecialResist(WeaponObject::ENERGY); if (component->isSpecialResist(WeaponObject::ACID)) setSpecialResist(WeaponObject::ACID); if (component->isSpecialResist(WeaponObject::BLAST)) setSpecialResist(WeaponObject::BLAST); if (component->isSpecialResist(WeaponObject::COLD)) setSpecialResist(WeaponObject::COLD); if (component->isSpecialResist(WeaponObject::HEAT)) setSpecialResist(WeaponObject::HEAT); if (component->isSpecialResist(WeaponObject::LIGHTSABER)) setSpecialResist(WeaponObject::LIGHTSABER); if (component->isSpecialResist(WeaponObject::STUN)) setSpecialResist(WeaponObject::STUN); level = Genetics::calculatePetLevel(component); } } CreatureTemplateManager* creatureTemplateManager = CreatureTemplateManager::instance(); ManagedReference<CreatureTemplate*> petTemplate = creatureTemplateManager->getTemplate( mobileTemplate.hashCode() ); if (petTemplate != NULL) { // get min CL from the template int skinFactor = petTemplate->getLevel(); if (level > 75) { level = 75; } if (level < skinFactor) { level = skinFactor; } } // setup attack map setupAttacks(); }
void PetControlDeviceImplementation::fillAttributeList(AttributeListMessage* alm, CreatureObject* object) { SceneObjectImplementation::fillAttributeList(alm, object); if (petType == PetManager::DROIDPET) { alm->insertAttribute("creature_vitality", String::valueOf(vitality) + "/" + String::valueOf(maxVitality)); ManagedReference<DroidObject*> droid = this->controlledObject.get().castTo<DroidObject*>(); if (droid != NULL) { alm->insertAttribute("challenge_level", droid->getLevel()); alm->insertAttribute("creature_health", droid->getBaseHAM(0)); alm->insertAttribute("creature_action", droid->getBaseHAM(3)); alm->insertAttribute("creature_mind", droid->getBaseHAM(6)); droid->fillAttributeList(alm, object); } } else { ManagedReference<AiAgent*> pet = cast<AiAgent*>(this->controlledObject.get().get()); if (pet != NULL) { alm->insertAttribute("challenge_level", pet->getLevel()); if (petType == PetManager::CREATUREPET) alm->insertAttribute("creature_vitality", String::valueOf(vitality) + "/" + String::valueOf(maxVitality)); alm->insertAttribute("creature_health", pet->getBaseHAM(0)); alm->insertAttribute("creature_action", pet->getBaseHAM(3)); alm->insertAttribute("creature_mind", pet->getBaseHAM(6)); int armor = pet->getArmor(); if (armor == 0) alm->insertAttribute("armor_rating", "None"); else if (armor == 1) alm->insertAttribute("armor_rating", "Light"); else if (armor == 2) alm->insertAttribute("armor_rating", "Medium"); else if (armor == 3) alm->insertAttribute("armor_rating", "Heavy"); if (pet->getKinetic() < 0) alm->insertAttribute("dna_comp_armor_kinetic", "Vulnerable"); else alm->insertAttribute("dna_comp_armor_kinetic", pet->getKinetic()); if (pet->getEnergy() < 0) alm->insertAttribute("dna_comp_armor_energy", "Vulnerable"); else alm->insertAttribute("dna_comp_armor_energy", pet->getEnergy()); if (pet->getBlast() < 0) alm->insertAttribute("dna_comp_armor_blast", "Vulnerable"); else alm->insertAttribute("dna_comp_armor_blast", pet->getBlast()); if (pet->getHeat() < 0) alm->insertAttribute("dna_comp_armor_heat", "Vulnerable"); else alm->insertAttribute("dna_comp_armor_heat", pet->getHeat()); if (pet->getCold() < 0) alm->insertAttribute("dna_comp_armor_cold", "Vulnerable"); else alm->insertAttribute("dna_comp_armor_cold", pet->getCold()); if (pet->getElectricity() < 0) alm->insertAttribute("dna_comp_armor_electric", "Vulnerable"); else alm->insertAttribute("dna_comp_armor_electric", pet->getElectricity()); if (pet->getAcid() < 0) alm->insertAttribute("dna_comp_armor_acid", "Vulnerable"); else alm->insertAttribute("dna_comp_armor_acid", pet->getAcid()); if (pet->getStun() < 0) alm->insertAttribute("dna_comp_armor_stun", "Vulnerable"); else alm->insertAttribute("dna_comp_armor_stun", pet->getStun()); if (pet->getLightSaber() < 0) alm->insertAttribute("dna_comp_armor_saber", "Vulnerable"); else alm->insertAttribute("dna_comp_armor_saber", pet->getLightSaber()); ManagedReference<WeaponObject*> weapon = pet->getWeapon(); if (weapon != NULL){ StringBuffer displayValue; displayValue << Math::getPrecision(weapon->getAttackSpeed(), 2); alm->insertAttribute("creature_attack", displayValue); } StringBuffer displayValue; displayValue << Math::getPrecision(pet->getChanceHit(), 2); alm->insertAttribute("creature_tohit", displayValue); alm->insertAttribute("creature_damage", String::valueOf(pet->getDamageMin()) + " - " + String::valueOf(pet->getDamageMax())); if (petType == PetManager::CREATUREPET) { CreatureAttackMap* attMap = pet->getAttackMap(); if (attMap != NULL && attMap->size() > 0) { String cmd = attMap->getCommand(0); if (cmd.isEmpty()) { alm->insertAttribute("spec_atk_1", " ---"); } else { String str = StringIdManager::instance()->getStringId(("@combat_effects:" + cmd).hashCode()).toString(); alm->insertAttribute("spec_atk_1", str); } } else { alm->insertAttribute("spec_atk_1", " ---"); } if (attMap != NULL && attMap->size() > 1) { String cmd = attMap->getCommand(1); if (cmd.isEmpty()) { alm->insertAttribute("spec_atk_1", " ---"); } else { String str = StringIdManager::instance()->getStringId(("@combat_effects:" + cmd).hashCode()).toString(); alm->insertAttribute("spec_atk_2", str); } } else { alm->insertAttribute("spec_atk_2", " ---"); } // TODO set this up to check for the actual ranged weapon if (pet->hasRangedWeapon()) alm->insertAttribute("dna_comp_ranged_attack", "Yes"); else alm->insertAttribute("dna_comp_ranged_attack", "No"); } } } // Trained Commands if ( trainedCommands.size() > 0) { alm->insertAttribute("pet_command", "" ); } if( trainedCommands.contains(PetManager::STAY) ){ alm->insertAttribute("pet_command_1", trainedCommands.get(PetManager::STAY) ); } if( trainedCommands.contains(PetManager::FOLLOW) ){ alm->insertAttribute("pet_command_0", trainedCommands.get(PetManager::FOLLOW) ); } if( trainedCommands.contains(PetManager::STORE) ){ alm->insertAttribute("pet_command_11", trainedCommands.get(PetManager::STORE) ); } if( trainedCommands.contains(PetManager::ATTACK) ){ alm->insertAttribute("pet_command_4", trainedCommands.get(PetManager::ATTACK) ); } if( trainedCommands.contains(PetManager::GUARD) ){ alm->insertAttribute("pet_command_2", trainedCommands.get(PetManager::GUARD) ); } if( trainedCommands.contains(PetManager::FRIEND) ){ alm->insertAttribute("pet_command_3", trainedCommands.get(PetManager::FRIEND) ); } if( trainedCommands.contains(PetManager::FOLLOWOTHER) ){ alm->insertAttribute("pet_command_17", trainedCommands.get(PetManager::FOLLOWOTHER) ); } if( trainedCommands.contains(PetManager::TRICK1) ){ alm->insertAttribute("pet_command_12", trainedCommands.get(PetManager::TRICK1) ); } if( trainedCommands.contains(PetManager::TRICK2) ){ alm->insertAttribute("pet_command_13", trainedCommands.get(PetManager::TRICK2) ); } if( trainedCommands.contains(PetManager::PATROL) ){ alm->insertAttribute("pet_command_5", trainedCommands.get(PetManager::PATROL) ); } if( trainedCommands.contains(PetManager::GETPATROLPOINT) ){ alm->insertAttribute("pet_command_6", trainedCommands.get(PetManager::GETPATROLPOINT) ); } if( trainedCommands.contains(PetManager::CLEARPATROLPOINTS) ){ alm->insertAttribute("pet_command_7", trainedCommands.get(PetManager::CLEARPATROLPOINTS) ); } if( trainedCommands.contains(PetManager::FORMATION1) ){ alm->insertAttribute("pet_command_8", trainedCommands.get(PetManager::FORMATION1) ); } if( trainedCommands.contains(PetManager::FORMATION2) ){ alm->insertAttribute("pet_command_9", trainedCommands.get(PetManager::FORMATION2) ); } if( trainedCommands.contains(PetManager::SPECIAL_ATTACK1) ){ alm->insertAttribute("pet_command_18", trainedCommands.get(PetManager::SPECIAL_ATTACK1) ); } if( trainedCommands.contains(PetManager::SPECIAL_ATTACK2) ){ alm->insertAttribute("pet_command_19", trainedCommands.get(PetManager::SPECIAL_ATTACK2) ); } if( trainedCommands.contains(PetManager::RANGED_ATTACK) ){ alm->insertAttribute("pet_command_20", trainedCommands.get(PetManager::RANGED_ATTACK) ); } if( trainedCommands.contains(PetManager::GROUP) ){ alm->insertAttribute("pet_command_16", trainedCommands.get(PetManager::GROUP) ); } if( trainedCommands.contains(PetManager::RECHARGEOTHER) ){ alm->insertAttribute("@pet/pet_menu:menu_recharge_other", trainedCommands.get(PetManager::RECHARGEOTHER) ); } if( trainedCommands.contains(PetManager::TRANSFER) ){ alm->insertAttribute("pet_command_10", trainedCommands.get(PetManager::TRANSFER) ); } if( trainedCommands.contains(PetManager::REPAIR) ){ alm->insertAttribute("pet_command_13", trainedCommands.get(PetManager::REPAIR) ); // Droid Repair really was listed as Trick 2 } if( trainedCommands.contains(PetManager::THROWTRAP) ){ alm->insertAttribute("pet_command_22", trainedCommands.get(PetManager::THROWTRAP) ); } if( trainedCommands.contains(PetManager::HARVEST) ){ alm->insertAttribute("pet_command_21", trainedCommands.get(PetManager::HARVEST) ); } }