void CraftingSessionImplementation::addSkillMods() { ManagedReference<ManufactureSchematic*> manufactureSchematic = this->manufactureSchematic.get(); ManagedReference<TangibleObject*> prototype = this->prototype.get(); ManagedReference<DraftSchematic*> draftSchematic = manufactureSchematic->getDraftSchematic(); VectorMap<String, int>* skillMods = draftSchematic->getDraftSchematicTemplate()->getSkillMods(); for (int i = 0; i < skillMods->size(); i++) { VectorMapEntry<String, int> mod = skillMods->elementAt(i); if (prototype->isWearableObject()) { WearableObject* wearable = prototype.castTo<WearableObject*>(); VectorMap<String, int>* wearableMods = wearable->getWearableSkillMods(); if (wearableMods->contains(mod.getKey())) { int oldValue = wearableMods->get(mod.getKey()); int newValue = mod.getValue() + oldValue; if (newValue > 25) newValue = 25; wearableMods->put(mod.getKey(), newValue); continue; } } prototype->addSkillMod(SkillModManager::WEARABLE, mod.getKey(), mod.getValue(), false); } }
void RingObjectMenuComponent::fillObjectMenuResponse(SceneObject* sceneObject, ObjectMenuResponse* menuResponse, CreatureObject* player) const { if (!sceneObject->isTangibleObject()) return; WearableObject* wearable = cast<WearableObject*>(sceneObject); if (wearable == NULL) return; ZoneServer* server = player->getZoneServer(); PlayerObject* ghost = player->getPlayerObject(); if (server == NULL || ghost == NULL) return; if (!wearable->isEquipped() && !wearable->isNoTrade()) { if (ghost->isMarried()) { menuResponse->addRadialMenuItem(234, 3, "@unity:mnu_divorce"); // Divorce } else { uint64 targetID = player->getTargetID(); ManagedReference<CreatureObject*> target = server->getObject(targetID, true).castTo<CreatureObject*>(); if (target != NULL && target->isPlayerCreature()) menuResponse->addRadialMenuItem(22, 3, "@unity:mnu_propose"); // Propose Unity } } TangibleObjectMenuComponent::fillObjectMenuResponse(sceneObject, menuResponse, player); }
bool ResourceLabratory::applyComponentStats(TangibleObject* prototype, ManufactureSchematic* manufactureSchematic) { if(manufactureSchematic == NULL || manufactureSchematic->getDraftSchematic() == NULL) return false; float max, min, currentvalue, propertyvalue; int precision; bool modified = false; bool hidden; String experimentalTitle, property; CraftingValues* craftingValues = manufactureSchematic->getCraftingValues(); ManagedReference<DraftSchematic* > draftSchematic = manufactureSchematic->getDraftSchematic(); for (int i = 0; i < manufactureSchematic->getSlotCount(); ++i) { Reference<IngredientSlot* > ingredientSlot = manufactureSchematic->getSlot(i); Reference<DraftSlot* > draftSlot = draftSchematic->getDraftSlot(i); if(ingredientSlot == NULL || !ingredientSlot->isComponentSlot() || !ingredientSlot->isFull()) continue; ComponentSlot* compSlot = cast<ComponentSlot*>(ingredientSlot.get()); if(compSlot == NULL) continue; ManagedReference<TangibleObject*> tano = compSlot->getPrototype(); if (tano == NULL || !tano->isComponent()) continue; ManagedReference<Component*> component = cast<Component*>( tano.get()); if (prototype->isWearableObject() && !prototype->isArmorObject()) { if (component->getObjectTemplate()->getObjectName() == "@craft_clothing_ingredients_n:reinforced_fiber_panels" || component->getObjectTemplate()->getObjectName() == "@craft_clothing_ingredients_n:synthetic_cloth"){ for (int k = 0; k < component->getPropertyCount(); ++k) { const String property = component->getProperty(k); if (property == "" || property == "null") { continue; } String key = checkBioSkillMods(property); if (key == "") { continue; } else { currentvalue = component->getAttributeValue(property); precision = component->getAttributePrecision(property); int preciseValue = Math::getPrecision(currentvalue, precision); WearableObject* clothing = cast<WearableObject*>(prototype); VectorMap<String, int>* clothingMods = clothing->getWearableSkillMods(); int existingValue = 0; if(clothingMods->contains(key)) { existingValue = clothingMods->get(key); } preciseValue += existingValue; if (preciseValue > 25) preciseValue = 25; clothing->addSkillMod(SkillModManager::WEARABLE, key, preciseValue); } } } } else { for (int j = 0; j < component->getPropertyCount(); ++j) { property = component->getProperty(j); // charges modified = true; if (craftingValues->hasProperty(property)) { max = craftingValues->getMaxValue(property); min = craftingValues->getMinValue(property); hidden = craftingValues->isHidden(property); currentvalue = craftingValues->getCurrentValue(property); propertyvalue = component->getAttributeValue(property) * draftSlot->getContribution(); short combineType = craftingValues->getCombineType(property); switch(combineType) { case CraftingManager::LINEARCOMBINE: currentvalue += propertyvalue; min += propertyvalue; max += propertyvalue; craftingValues->setMinValue(property, min); craftingValues->setMaxValue(property, max); craftingValues->setCurrentValue(property, currentvalue); break; case CraftingManager::PERCENTAGECOMBINE: currentvalue += propertyvalue; min += propertyvalue; max += propertyvalue; craftingValues->setMinValue(property, min); craftingValues->setMaxValue(property, max); craftingValues->setCurrentPercentage(property, currentvalue); break; case CraftingManager::BITSETCOMBINE: currentvalue = (int)currentvalue | (int)propertyvalue; craftingValues->setCurrentValue(property , currentvalue); break; case CraftingManager::OVERRIDECOMBINE: // Do nothing because the values should override whatever is // on the component break; default: break; } } else { currentvalue = component->getAttributeValue(property); precision = component->getAttributePrecision(property); experimentalTitle = component->getAttributeTitle(property); craftingValues->addExperimentalProperty(experimentalTitle, property, currentvalue, currentvalue, precision, component->getAttributeHidden(property), CraftingManager::LINEARCOMBINE); craftingValues->setCurrentPercentage(property, 0); craftingValues->setMaxPercentage(property, 0); craftingValues->setCurrentValue(property, currentvalue); } } } } return modified; }
int HeroRingMenuComponent::handleObjectMenuSelect(SceneObject* sceneObject, CreatureObject* player, byte selectedID) const { if (selectedID == 20) { // Restore Life if (!sceneObject->isASubChildOf(player)) return 0; WearableObject* wearable = cast<WearableObject*>(sceneObject); if (wearable == NULL) return 0; HeroRingDataComponent* data = cast<HeroRingDataComponent*>(wearable->getDataObjectComponent()->get()); if (data == NULL || !data->isHeroRingData()) return 0; int charges = data->getCharges(); if (charges <= 0) return 0; if (!wearable->isEquipped()) { player->sendSystemMessage("@quest/hero_of_tatooine/system_messages:restore_not_equipped"); return 0; } if (!player->isDead()) { player->sendSystemMessage("@quest/hero_of_tatooine/system_messages:restore_not_dead"); return 0; } if (!player->checkCooldownRecovery("mark_of_hero")) { Time* timeRemaining = player->getCooldownTime("mark_of_hero"); StringIdChatParameter cooldown("quest/hero_of_tatooine/system_messages", "restore_not_yet"); cooldown.setTO(getCooldownString(timeRemaining->miliDifference() * -1)); player->sendSystemMessage(cooldown); return 0; } player->healDamage(player, CreatureAttribute::HEALTH, 200); player->healDamage(player, CreatureAttribute::ACTION, 200); player->healDamage(player, CreatureAttribute::MIND, 200); data->setCharges(charges - 1); String hardpoint = ""; if (player->getSlottedObject("ring_r") != NULL && player->getSlottedObject("ring_r")->getObjectID() == sceneObject->getObjectID()) hardpoint = "hold_r"; else if (player->getSlottedObject("ring_l") != NULL && player->getSlottedObject("ring_l")->getObjectID() == sceneObject->getObjectID()) hardpoint = "hold_l"; PlayClientEffectObjectMessage* effect = new PlayClientEffectObjectMessage(player, "clienteffect/item_ring_hero_mark.cef", hardpoint); player->broadcastMessage(effect, false); player->sendSystemMessage("@quest/hero_of_tatooine/system_messages:restore_msg"); player->addCooldown("mark_of_hero", 23 * 3600 * 1000); // 23 hours return 0; } else { return TangibleObjectMenuComponent::handleObjectMenuSelect(sceneObject, player, selectedID); } }