本文整理汇总了C++中SharedTangibleObjectTemplate类的典型用法代码示例。如果您正苦于以下问题:C++ SharedTangibleObjectTemplate类的具体用法?C++ SharedTangibleObjectTemplate怎么用?C++ SharedTangibleObjectTemplate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SharedTangibleObjectTemplate类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
VectorMap<String, int>* TangibleObjectImplementation::getTemplateSkillMods() {
SharedTangibleObjectTemplate* tano = dynamic_cast<SharedTangibleObjectTemplate*>(templateObject.get());
if (tano == NULL)
return NULL;
return tano->getSkillMods();
}
示例2: addWearableItem
bool CreatureManagerImplementation::addWearableItem(CreatureObject* creature, TangibleObject* clothing) {
if (!clothing->isWearableObject() && !clothing->isWeaponObject())
return false;
ChatManager* chatMan = zoneServer->getChatManager();
SharedTangibleObjectTemplate* tanoData = dynamic_cast<SharedTangibleObjectTemplate*>(clothing->getObjectTemplate());
Vector<uint32>* races = tanoData->getPlayerRaces();
String race = creature->getObjectTemplate()->getFullTemplateString();
if(clothing->isWearableObject()) {
if (!races->contains(race.hashCode())) {
UnicodeString message;
if(creature->getObjectTemplate()->getFullTemplateString().contains("ithorian"))
message = "@player_structure:wear_not_ithorian";
else
message = "@player_structure:wear_no";
chatMan->broadcastMessage(creature, message, clothing->getObjectID(), creature->getMoodID(), 0);
return false;
}
}
ManagedReference<SceneObject*> clothingParent = clothing->getParent();
if (clothingParent == NULL)
return false;
for (int i = 0; i < clothing->getArrangementDescriptorSize(); ++i) {
Vector<String> descriptors = clothing->getArrangementDescriptor(i);
for (int j = 0; j < descriptors.size(); ++j) {
ManagedReference<SceneObject*> slot = creature->getSlottedObject(descriptors.get(j));
if (slot != NULL) {
slot->destroyObjectFromWorld(true);
slot->destroyObjectFromDatabase(true);
}
}
}
creature->transferObject(clothing, 4, false);
creature->doAnimation("pose_proudly");
creature->broadcastObject(clothing, true);
UnicodeString message;
if(clothing->isWeaponObject())
message = "@player_structure:wear_yes_weapon";
else
message = "@player_structure:wear_yes";
chatMan->broadcastMessage(creature, message, clothing->getObjectID(), creature->getMoodID(), 0);
return true;
}
示例3: getGameObjectType
Reference<FactoryCrate*> TangibleObjectImplementation::createFactoryCrate(bool insertSelf) {
String file;
uint32 type = getGameObjectType();
if(type & SceneObjectType::ARMOR)
file = "object/factory/factory_crate_armor.iff";
else if(type == SceneObjectType::CHEMICAL || type == SceneObjectType::PHARMACEUTICAL || type == SceneObjectType::PETMEDECINE)
file = "object/factory/factory_crate_chemicals.iff";
else if(type & SceneObjectType::CLOTHING)
file = "object/factory/factory_crate_clothing.iff";
else if(type == SceneObjectType::ELECTRONICS)
file = "object/factory/factory_crate_electronics.iff";
else if(type == SceneObjectType::FOOD || type == SceneObjectType::DRINK)
file = "object/factory/factory_crate_food.iff";
else if(type == SceneObjectType::FURNITURE)
file = "object/factory/factory_crate_furniture.iff";
else if(type & SceneObjectType::INSTALLATION)
file = "object/factory/factory_crate_installation.iff";
else if(type & SceneObjectType::WEAPON)
file = "object/factory/factory_crate_weapon.iff";
else
file = "object/factory/factory_crate_generic_items.iff";
ObjectManager* objectManager = ObjectManager::instance();
Reference<FactoryCrate*> crate = (getZoneServer()->createObject(file.hashCode(), 2)).castTo<FactoryCrate*>();
if (crate == NULL)
return NULL;
SharedTangibleObjectTemplate* tanoData = dynamic_cast<SharedTangibleObjectTemplate*>(templateObject.get());
if (tanoData == NULL)
return NULL;
crate->setMaxCapacity(tanoData->getFactoryCrateSize());
if (insertSelf) {
crate->transferObject(_this.get(), -1, false);
} else {
ManagedReference<TangibleObject*> protoclone = cast<TangibleObject*>( objectManager->cloneObject(_this.get()));
if (protoclone == NULL)
return NULL;
protoclone->setParent(NULL);
crate->transferObject(protoclone, -1, false);
}
crate->setCustomObjectName(getCustomObjectName(), false);
crate->setUseCount(1);
return crate;
}
示例4: loadTemplateData
void TangibleObjectImplementation::loadTemplateData(SharedObjectTemplate* templateData) {
SceneObjectImplementation::loadTemplateData(templateData);
SharedTangibleObjectTemplate* tanoData = dynamic_cast<SharedTangibleObjectTemplate*>(templateData);
if (tanoData == NULL)
return;
targetable = tanoData->getTargetable();
maxCondition = tanoData->getMaxCondition();
invisible = tanoData->isInvisible();
useCount = tanoData->getUseCount();
optionsBitmask = tanoData->getOptionsBitmask();
pvpStatusBitmask = tanoData->getPvpStatusBitmask();
sliceable = tanoData->getSliceable();
faction = tanoData->getFaction();
threatMap = NULL;
}
示例5: removeTemplateSkillMods
void TangibleObjectImplementation::removeTemplateSkillMods(TangibleObject* targetObject) {
SharedTangibleObjectTemplate* tano = dynamic_cast<SharedTangibleObjectTemplate*>(templateObject.get());
if (tano == NULL)
return;
VectorMap<String, int>* mods = tano->getSkillMods();
for (int i = 0; i < mods->size(); ++i) {
VectorMapEntry<String, int> entry = mods->elementAt(i);
targetObject->removeSkillMod(SkillModManager::TEMPLATE, entry.getKey(), entry.getValue());
}
}
示例6: setInitialObjectStats
void LootManagerImplementation::setInitialObjectStats(LootItemTemplate* templateObject, CraftingValues* craftingValues, TangibleObject* prototype) {
SharedTangibleObjectTemplate* tanoTemplate = dynamic_cast<SharedTangibleObjectTemplate*>(prototype->getObjectTemplate());
if (tanoTemplate != NULL) {
Vector<String>* titles = tanoTemplate->getExperimentalGroupTitles();
Vector<String>* props = tanoTemplate->getExperimentalSubGroupTitles();
Vector<float>* mins = tanoTemplate->getExperimentalMin();
Vector<float>* maxs = tanoTemplate->getExperimentalMax();
Vector<short>* prec = tanoTemplate->getExperimentalPrecision();
for (int i = 0; i < props->size(); ++i) {
String title = titles->get(i);
String property = props->get(i);
if (craftingValues->hasProperty(property))
continue;
craftingValues->addExperimentalProperty(property, property, mins->get(i), maxs->get(i), prec->get(i), false, CraftingManager::LINEARCOMBINE);
if (title == "null")
craftingValues->setHidden(property);
}
}
Vector<String>* customizationData = templateObject->getCustomizationStringNames();
Vector<Vector<int> >* customizationValues = templateObject->getCustomizationValues();
for (int i = 0; i < customizationData->size(); ++i) {
String customizationString = customizationData->get(i);
Vector<int>* values = &customizationValues->get(i);
if (values->size() > 0) {
int randomValue = values->get(System::random(values->size() - 1));
prototype->setCustomizationVariable(customizationString, randomValue, false);
}
}
}
示例7: canAddObject
int PlayerContainerComponent::canAddObject(SceneObject* sceneObject, SceneObject* object, int containmentType, String& errorDescription) {
CreatureObject* creo = dynamic_cast<CreatureObject*>(sceneObject);
if (object->isTangibleObject() && containmentType == 4) {
TangibleObject* wearable = cast<TangibleObject*>( object);
SharedTangibleObjectTemplate* tanoData = dynamic_cast<SharedTangibleObjectTemplate*>(wearable->getObjectTemplate());
Vector<uint32>* races = tanoData->getPlayerRaces();
String race = creo->getObjectTemplate()->getFullTemplateString();
if (!races->contains(race.hashCode())) {
errorDescription = "You lack the necessary requirements to wear this object";
return TransferErrorCode::PLAYERUSEMASKERROR;
}
if (creo->isPlayerCreature()) {
if (!wearable->isNeutral()) {
ManagedReference<PlayerObject*> playerObject = creo->getPlayerObject();
if (wearable->isImperial() && (playerObject->getFactionStatus() == FactionStatus::ONLEAVE || !creo->isImperial())) {
errorDescription = "You lack the necessary requirements to wear this object";
return TransferErrorCode::PLAYERUSEMASKERROR;
}
if (wearable->isRebel() && (playerObject->getFactionStatus() == FactionStatus::ONLEAVE || !creo->isRebel())) {
errorDescription = "You lack the necessary requirements to wear this object";
return TransferErrorCode::PLAYERUSEMASKERROR;
}
}
}
}
if (object->isArmorObject() && containmentType == 4) {
PlayerManager* playerManager = sceneObject->getZoneServer()->getPlayerManager();
if (!playerManager->checkEncumbrancies(dynamic_cast<CreatureObject*>(sceneObject), cast<ArmorObject*>( object))) {
errorDescription = "You lack the necessary secondary stats to equip this item";
return TransferErrorCode::NOTENOUGHENCUMBRANCE;
}
}
if (object->isRobeObject() && containmentType == 4) {
ManagedReference<RobeObject*> robe = cast<RobeObject*>( object);
String skillRequired = robe->getSkillRequired();
if (!creo->hasSkill(skillRequired) && skillRequired != ""){
errorDescription = "You are not eligible to wear this robe.";
return TransferErrorCode::PLAYERUSEMASKERROR;
}
}
if (object->isWeaponObject() && containmentType == 4) {
ManagedReference<WeaponObject*> weapon = cast<WeaponObject*>( object);
int bladeColor = weapon->getBladeColor();
if (weapon->isJediWeapon()){
if (bladeColor == 31) {
errorDescription = "@jedi_spam:lightsaber_no_color";
return TransferErrorCode::PLAYERUSEMASKERROR;
}
if (weapon->getCraftersName() != creo->getFirstName()) {
errorDescription = "@jedi_spam:not_your_lightsaber";
return TransferErrorCode::PLAYERUSEMASKERROR;
}
}
}
return ContainerComponent::canAddObject(sceneObject, object, containmentType, errorDescription);
}
示例8: canAddObject
int PlayerContainerComponent::canAddObject(SceneObject* sceneObject, SceneObject* object, int containmentType, String& errorDescription) {
CreatureObject* creo = dynamic_cast<CreatureObject*>(sceneObject);
if (object->isTangibleObject() && containmentType == 4) {
TangibleObject* wearable = cast<TangibleObject*>( object);
SharedTangibleObjectTemplate* tanoData = dynamic_cast<SharedTangibleObjectTemplate*>(wearable->getObjectTemplate());
Vector<uint32>* races = tanoData->getPlayerRaces();
String race = creo->getObjectTemplate()->getFullTemplateString();
if (!races->contains(race.hashCode())) {
errorDescription = "You lack the necessary requirements to wear this object";
return TransferErrorCode::PLAYERUSEMASKERROR;
}
if (creo->isPlayerCreature()) {
if (!wearable->isNeutral()) {
ManagedReference<PlayerObject*> playerObject = creo->getPlayerObject();
if (wearable->isImperial() && (playerObject->getFactionStatus() == FactionStatus::ONLEAVE || !creo->isImperial())) {
errorDescription = "You lack the necessary requirements to wear this object";
return TransferErrorCode::PLAYERUSEMASKERROR;
}
if (wearable->isRebel() && (playerObject->getFactionStatus() == FactionStatus::ONLEAVE || !creo->isRebel())) {
errorDescription = "You lack the necessary requirements to wear this object";
return TransferErrorCode::PLAYERUSEMASKERROR;
}
}
}
}
if (object->isArmorObject() && containmentType == 4) {
PlayerManager* playerManager = sceneObject->getZoneServer()->getPlayerManager();
if (!playerManager->checkEncumbrancies(dynamic_cast<CreatureObject*>(sceneObject), cast<ArmorObject*>( object))) {
errorDescription = "You lack the necessary secondary stats to equip this item";
return TransferErrorCode::NOTENOUGHENCUMBRANCE;
}
}
if (object->isWearableObject() && containmentType == 4) {
ManagedReference<WearableObject*> wearable = cast<WearableObject*>( object);
SharedTangibleObjectTemplate* wearableData = dynamic_cast<SharedTangibleObjectTemplate*>(wearable->getObjectTemplate());
Vector<String> skillsRequired = wearableData->getCertificationsRequired();
if (skillsRequired.size() > 0) {
bool hasSkill = false;
for (int i = 0; i < skillsRequired.size(); i++) {
String skill = skillsRequired.get(i);
if (!skill.isEmpty() && creo->hasSkill(skill)) {
hasSkill = true;
break;
}
}
if (!hasSkill) {
errorDescription = "@error_message:insufficient_skill"; // You lack the skill to use this item.
return TransferErrorCode::PLAYERUSEMASKERROR;
}
}
}
if (object->isWeaponObject() && containmentType == 4) {
ManagedReference<WeaponObject*> weapon = cast<WeaponObject*>( object);
int bladeColor = weapon->getBladeColor();
if (weapon->isJediWeapon()){
if (bladeColor == 31) {
errorDescription = "@jedi_spam:lightsaber_no_color";
return TransferErrorCode::PLAYERUSEMASKERROR;
}
if (weapon->getCraftersName() != creo->getFirstName()) {
errorDescription = "@jedi_spam:not_your_lightsaber";
return TransferErrorCode::PLAYERUSEMASKERROR;
}
}
}
return ContainerComponent::canAddObject(sceneObject, object, containmentType, errorDescription);
}
示例9: int
void CraftingSessionImplementation::initialAssembly(int clientCounter) {
ManagedReference<CraftingTool*> craftingTool = this->craftingTool.get();
ManagedReference<CreatureObject*> crafter = this->crafter.get();
ManagedReference<PlayerObject*> crafterGhost = this->crafterGhost.get();
ManagedReference<CraftingStation*> craftingStation = this->craftingStation.get();
ManagedReference<ManufactureSchematic*> manufactureSchematic = this->manufactureSchematic.get();
ManagedReference<TangibleObject*> prototype = this->prototype.get();
// Get the appropriate number of Experimentation points from Skill
ManagedReference<DraftSchematic*> draftSchematic = manufactureSchematic->getDraftSchematic();
// Set crafter
manufactureSchematic->setCrafter(crafter);
String expskill = draftSchematic->getExperimentationSkill();
experimentationPointsTotal = int(crafter->getSkillMod(expskill) / 10);
experimentationPointsUsed = 0;
// Calculate exp failure for red bars
int experimentalFailureRate = craftingManager.get()->calculateExperimentationFailureRate(crafter, manufactureSchematic, 0);
// Get the level of customization
String custskill = draftSchematic->getCustomizationSkill();
int custpoints = int(crafter->getSkillMod(custskill));
// Determine the outcome of the craft, Amazing through Critical
assemblyResult = craftingManager.get()->calculateAssemblySuccess(crafter,
draftSchematic, craftingTool->getEffectiveness());
Locker locker(prototype);
Locker schLock(manufactureSchematic);
//Set initial crafting percentages
craftingManager.get()->setInitialCraftingValues(prototype,manufactureSchematic,assemblyResult);
//prototype->setInitialCraftingValues(manufactureSchematic, assemblyResult);
Reference<CraftingValues*> craftingValues = manufactureSchematic->getCraftingValues();
craftingValues->setManufactureSchematic(manufactureSchematic);
craftingValues->setPlayer(crafter);
// Flag to get the experimenting window
if (craftingStation != NULL && (craftingValues->getVisibleExperimentalPropertyTitleSize() > 0 || manufactureSchematic->allowFactoryRun()))
// Assemble with Experimenting
state = 3;
else
// Assemble without Experimenting
state = 4;
// Start DPLAY9 ***********************************************************
// Updates the stage of crafting, sets the number of experimentation points
PlayerObjectDeltaMessage9* dplay9 = new PlayerObjectDeltaMessage9(crafter->getPlayerObject());
dplay9->setCraftingState(state); // 3 If Experimenting is active, 4 if already experimented/ No experimenting
dplay9->setExperimentationPoints(experimentationPointsTotal);
dplay9->close();
crafter->sendMessage(dplay9);
// End DPLAY9 *************************************************************
// Set Crafter name and generate serial number
String name = crafter->getFirstName();
prototype->setCraftersName(name);
String serial = craftingManager.get()->generateSerial();
prototype->setSerialNumber(serial);
// Update the prototype with new values
prototype->updateCraftingValues(craftingValues, true);
addSkillMods();
addWeaponDots();
// Set default customization
SharedTangibleObjectTemplate* templateData =
cast<SharedTangibleObjectTemplate*>(prototype->getObjectTemplate());
if (templateData == NULL) {
error("No template for: " + String::valueOf(prototype->getServerObjectCRC()));
return;
}
AssetCustomizationManagerTemplate::instance()->getCustomizationVariables(templateData->getAppearanceFilename().hashCode(), variables, true);
for (int i = 0; i < variables.size(); ++i) {
Reference<RangedIntCustomizationVariable*> var = cast<RangedIntCustomizationVariable*>(variables.get(i).get());
if(var != NULL) {
prototype->setCustomizationVariable(variables.elementAt(i).getKey(), var->getDefaultValue());
}
}
prototype->setComplexity(manufactureSchematic->getComplexity());
// Start DMSCO3 ***********************************************************
// Sends the updated values to the crafting screen
ManufactureSchematicObjectDeltaMessage3* dMsco3 =
new ManufactureSchematicObjectDeltaMessage3(manufactureSchematic);
dMsco3->updateCraftingValues(manufactureSchematic);
dMsco3->updateComplexity(manufactureSchematic->getComplexity());
dMsco3->close();
crafter->sendMessage(dMsco3);
//.........这里部分代码省略.........