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


C++ ManagedReference::destroyObjectFromDatabase方法代码示例

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


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

示例1: addStartingItems

void PlayerCreationManager::addStartingItems(CreatureObject* creature,
		const String& clientTemplate, bool equipmentOnly) {
	SortedVector < String > *items = NULL;

	if (!defaultCharacterEquipment.contains(clientTemplate))
		items = &defaultCharacterEquipment.get(0);
	else
		items = &defaultCharacterEquipment.get(clientTemplate);

	for (int i = 0; i < items->size(); ++i) {
		String itemTemplate = items->get(i);

		//instance()->info("Add Starting Items: " + itemTemplate, true);

		ManagedReference<SceneObject*> item = zoneServer->createObject(
				itemTemplate.hashCode(), 1);

		if (item != NULL) {
			String error;
			if (creature->canAddObject(item, 4, error) == 0) {
				creature->transferObject(item, 4, false);
			} else {
				item->destroyObjectFromDatabase(true);
			}
		}

	}

	// Get inventory.
	if (!equipmentOnly) {
		SceneObject* inventory = creature->getSlottedObject("inventory");
		if (inventory == NULL) {
			return;
		}

		//Add common starting items.
		for (int itemNumber = 0; itemNumber < commonStartingItems.size();
				itemNumber++) {
			ManagedReference<SceneObject*> item = zoneServer->createObject(
					commonStartingItems.get(itemNumber).hashCode(), 1);
			if (item != NULL) {
				if (!inventory->transferObject(item, -1, false)) {
					item->destroyObjectFromDatabase(true);
				}
			}
		}
	}
}
开发者ID:angelsounds777,项目名称:Core3-CU,代码行数:48,代码来源:PlayerCreationManager.cpp

示例2: destroyObjectFromDatabase

void PetControlDeviceImplementation::destroyObjectFromDatabase(bool destroyContainedObjects) {
	ManagedReference<TangibleObject*> controlledObject = this->controlledObject.get();

	if (controlledObject != NULL) {
		Locker locker(controlledObject);

		ManagedReference<CreatureObject*> object = controlledObject->getSlottedObject("rider").castTo<CreatureObject*>();

		if (object != NULL) {
			Locker clocker(object, controlledObject);

			object->executeObjectControllerAction(STRING_HASHCODE("dismount"));

			object = controlledObject->getSlottedObject("rider").castTo<CreatureObject*>();

			if (object != NULL) {
				controlledObject->removeObject(object, NULL, true);

				Zone* zone = getZone();

				if (zone != NULL)
					zone->transferObject(object, -1, false);
			}
		}

		controlledObject->destroyObjectFromDatabase(true);
	}

	IntangibleObjectImplementation::destroyObjectFromDatabase(destroyContainedObjects);
}
开发者ID:Marott1,项目名称:Core3,代码行数:30,代码来源:PetControlDeviceImplementation.cpp

示例3: destroyAllPlayerItems

void CellObjectImplementation::destroyAllPlayerItems() {
	ManagedReference<SceneObject*> strongParent = getParent().get();

	if (strongParent == NULL)
		return;

	int containerSize = getContainerObjectsSize();

	for (int j = containerSize - 1; j >= 0; --j) {
		ReadLocker rlocker(getContainerLock());
		ManagedReference<SceneObject*> containerObject = getContainerObject(j);
		rlocker.release();

		if (strongParent->containsChildObject(containerObject))
			continue;

		if (containerObject->isCreatureObject())
			continue;

		containerObject->destroyObjectFromWorld(true);
		//containerObject->broadcastDestroy(containerObject, false);
		//removeObject(containerObject, false);

		containerObject->destroyObjectFromDatabase(true);
	}
}
开发者ID:Skyyyr,项目名称:GR-Core-TC1,代码行数:26,代码来源:CellObjectImplementation.cpp

示例4: handleUseClamp

void SlicingSessionImplementation::handleUseClamp() {
	ManagedReference<CreatureObject*> player = this->player.get();
	ManagedReference<TangibleObject*> tangibleObject = this->tangibleObject.get();


	if (player == NULL || tangibleObject == NULL)
		return;

	ManagedReference<SceneObject*> inventory = player->getSlottedObject("inventory");

	Locker inventoryLocker(inventory);

	for (int i = 0; i < inventory->getContainerObjectsSize(); ++i) {
		ManagedReference<SceneObject*> sceno = inventory->getContainerObject(i);

		uint32 objType = sceno->getGameObjectType();

		if (objType == SceneObjectType::MOLECULARCLAMP) {
			Locker locker(sceno);
			sceno->destroyObjectFromWorld(true);
			sceno->destroyObjectFromDatabase(true);

			player->sendSystemMessage("@slicing/slicing:used_clamp");
			usedClamp = true;
			return;
		}
	}

	player->sendSystemMessage("@slicing/slicing:no_clamp");
}
开发者ID:Mesagoppinmypants,项目名称:mtgtestserver,代码行数:30,代码来源:SlicingSessionImplementation.cpp

示例5: hasArmorUpgradeKit

bool SlicingSessionImplementation::hasArmorUpgradeKit() {
	ManagedReference<CreatureObject*> player = this->player.get();
	ManagedReference<TangibleObject*> tangibleObject = this->tangibleObject.get();


	if (player == NULL)
		return false;

	ManagedReference<SceneObject*> inventory = player->getSlottedObject("inventory");

	if (inventory == NULL)
		return false;

	for (int i = 0; i < inventory->getContainerObjectsSize(); ++i) {
		ManagedReference<SceneObject*> sceno = inventory->getContainerObject(i);

		uint32 objType = sceno->getGameObjectType();

		if (objType == SceneObjectType::ARMORUPGRADEKIT) {
			Locker locker(sceno);
			sceno->destroyObjectFromWorld(true);
			sceno->destroyObjectFromDatabase(true);
			return true;
		}
	}

	return false;

}
开发者ID:Mesagoppinmypants,项目名称:mtgtestserver,代码行数:29,代码来源:SlicingSessionImplementation.cpp

示例6: createCreatureChildrenObjects

bool CreatureManagerImplementation::createCreatureChildrenObjects(CreatureObject* creature, uint32 templateCRC, bool persistent, uint32 mobileTemplateCRC) {
	if (creature->hasSlotDescriptor("default_weapon")) {

		uint32 defaultWeaponCRC = 0;
		if (creature->isNonPlayerCreatureObject()) {
			defaultWeaponCRC = STRING_HASHCODE("object/weapon/melee/unarmed/unarmed_default.iff");
		} else {
			defaultWeaponCRC = STRING_HASHCODE("object/weapon/creature/creature_default_weapon.iff");
		}
		ManagedReference<SceneObject*> defaultWeapon = zoneServer->createObject(defaultWeaponCRC, persistent);
		ManagedReference<SceneObject*> otherWeapon;

		if(mobileTemplateCRC != 0) {
			CreatureTemplate* creoTempl = creatureTemplateManager->getTemplate(mobileTemplateCRC);

			if(creoTempl != NULL && creoTempl->getDefaultWeapon() != ""){
				uint32 otherWeaponCRC = String(creoTempl->getDefaultWeapon()).hashCode();
				otherWeapon = zoneServer->createObject(otherWeaponCRC, persistent);
			}
		}

		if(otherWeapon != NULL) {
			if (defaultWeapon != NULL && defaultWeapon->isPersistent()) {
				Locker clocker(defaultWeapon, creature);
				defaultWeapon->destroyObjectFromDatabase(true);
			}

			defaultWeapon = otherWeapon;
		}

		if (defaultWeapon == NULL) {
			error("could not create creature default weapon");
			return false;
		}

		Locker clocker(defaultWeapon, creature);

		creature->transferObject(defaultWeapon, 4);
	}

	if (creature->hasSlotDescriptor("inventory")) {
		Reference<SceneObject*> creatureInventory = zoneServer->createObject(STRING_HASHCODE("object/tangible/inventory/creature_inventory.iff"), persistent);

		if (creatureInventory == NULL) {
			error("could not create creature inventory");

			return false;
		}

		Locker clocker(creatureInventory, creature);

		creatureInventory->setContainerDefaultDenyPermission(ContainerPermissions::MOVECONTAINER);
		creatureInventory->setContainerDenyPermission("owner", ContainerPermissions::MOVECONTAINER);
		creatureInventory->setContainerInheritPermissionsFromParent(false);

		creature->transferObject(creatureInventory, 4);
	}

	return true;
}
开发者ID:angelsounds777,项目名称:Core3-CU,代码行数:60,代码来源:CreatureManagerImplementation.cpp

示例7:

Reference<SceneObject*> PlanetManagerImplementation::createTicket(const String& departurePoint, const String& arrivalPlanet, const String& arrivalPoint) {
	ManagedReference<SceneObject*> obj = server->getZoneServer()->createObject(STRING_HASHCODE("object/tangible/travel/travel_ticket/base/base_travel_ticket.iff"), 1);

	if (obj == NULL)
		return NULL;

	if (!obj->isTangibleObject()) {
		obj->destroyObjectFromDatabase(true);
		return NULL;
	}

	TangibleObject* tano = cast<TangibleObject*>( obj.get());

	if (!tano->isTicketObject()) {
		tano->destroyObjectFromDatabase(true);
		return NULL;
	}

	TicketObject* ticket = cast<TicketObject*>( tano);
	ticket->setDeparturePlanet(zone->getZoneName());
	ticket->setDeparturePoint(departurePoint);
	ticket->setArrivalPlanet(arrivalPlanet);
	ticket->setArrivalPoint(arrivalPoint);

	return ticket;
}
开发者ID:Mesagoppinmypants,项目名称:mtgtestserver,代码行数:26,代码来源:PlanetManagerImplementation.cpp

示例8: createChildObjects

void WeaponObjectImplementation::createChildObjects() {
	// Create any child objects in a weapon.

	ZoneServer* zoneServer = server->getZoneServer();

		for (int i = 0; i < templateObject->getChildObjectsSize(); ++i) {
			ChildObject* child = templateObject->getChildObject(i);

			if (child == NULL)
				continue;

			ManagedReference<SceneObject*> obj = zoneServer->createObject(
					child->getTemplateFile().hashCode(), getPersistenceLevel());

			if (obj == NULL)
				continue;

			ContainerPermissions* permissions = obj->getContainerPermissions();
			permissions->setOwner(getObjectID());
			permissions->setInheritPermissionsFromParent(true);
			permissions->setDefaultDenyPermission(ContainerPermissions::MOVECONTAINER);
			permissions->setDenyPermission("owner", ContainerPermissions::MOVECONTAINER);

			if (!transferObject(obj, child->getContainmentType())) {
				obj->destroyObjectFromDatabase(true);
				continue;
			}

			childObjects.put(obj);

			obj->initializeChildObject(_this.getReferenceUnsafeStaticCast());
		}

}
开发者ID:Mesagoppinmypants,项目名称:mtgtestserver,代码行数:34,代码来源:WeaponObjectImplementation.cpp

示例9: updateHairObject

TangibleObject* ImageDesignManager::updateHairObject(CreatureObject* creo, TangibleObject* hairObject) {
	if (creo == NULL)
		return NULL;

	ManagedReference<TangibleObject*> hair = creo->getSlottedObject("hair").castTo<TangibleObject*>();

	if (hair == hairObject) {
		return hairObject;
	}

	if (hair != NULL) {
		Locker locker(hair);
		hair->destroyObjectFromWorld(true);
		hair->destroyObjectFromDatabase(true);
	}

	if (hairObject == NULL)
		return NULL;

	// Some race condition in the client prevents both the destroy and transfer from happening too close together
	// Without it placing a hair object in the inventory.
	ManagedReference<CreatureObject*> strongCreo = creo;
	ManagedReference<TangibleObject*> strongHair = hairObject;
	Core::getTaskManager()->scheduleTask([strongCreo, strongHair]{
		Locker locker(strongCreo);
		Locker cLocker(strongCreo, strongHair);
		strongCreo->transferObject(strongHair, 4);
		strongCreo->broadcastObject(strongHair, true);
	}, "TransferHairTask", 100);

	return hair;
}
开发者ID:Marott1,项目名称:Core3,代码行数:32,代码来源:ImageDesignManager.cpp

示例10: destroyObjectFromDatabase

void SceneObjectImplementation::destroyObjectFromDatabase(bool destroyContainedObjects) {
	//info("deleting from database", true);

	if (isPlayerCreature()) {
		assert(0 && "attempting to delete a player creature from database");
	}

	if(dataObjectComponent != NULL) {
		dataObjectComponent->notifyObjectDestroyingFromDatabase();
	}

	ZoneServer* server = getZoneServer();

	server->destroyObjectFromDatabase(getObjectID());

	_this.get()->setPersistent(0);

	if (!destroyContainedObjects)
		return;

	SortedVector<ManagedReference<SceneObject*> > destroyedObjects;
	destroyedObjects.setNoDuplicateInsertPlan();

	for (int i = 0; i < getSlottedObjectsSize(); ++i) {
		ManagedReference<SceneObject*> object = getSlottedObject(i);

		if (destroyedObjects.put(object) != -1)
			object->destroyObjectFromDatabase(true);
	}

	for (int j = 0; j < getContainerObjectsSize(); ++j) {
		ManagedReference<SceneObject*> object = getContainerObject(j);

		if (destroyedObjects.put(object) != -1)
			object->destroyObjectFromDatabase(true);
	}

	//Remove all child objects from database
	for (int i = 0; i < childObjects.size(); ++i) {
		ManagedReference<SceneObject*> child = childObjects.get(i);

		if (child == NULL)
			continue;

		child->destroyObjectFromDatabase(true);
	}
}
开发者ID:blacknightownzjoo,项目名称:SWGOOW,代码行数:47,代码来源:SceneObjectImplementation.cpp

示例11: handleObjectMenuSelect

int WeaponObjectMenuComponent::handleObjectMenuSelect(SceneObject* sceneObject, CreatureObject* player, byte selectedID) {
    if (!sceneObject->isTangibleObject())
        return 0;

    ManagedReference<WeaponObject*> weapon = cast<WeaponObject*>(sceneObject);
    if(weapon == NULL)
        return 1;

    if(weapon->isASubChildOf(player)) {

        if (selectedID == 69 && player->hasSkill("combat_smuggler_slicing_02")) {
            if (weapon->isSliced()) {
                player->sendSystemMessage("@slicing/slicing:already_sliced");
                return 0;
            }

            ManagedReference<Facade*> facade = player->getActiveSession(SessionFacadeType::SLICING);
            ManagedReference<SlicingSession*> session = dynamic_cast<SlicingSession*>(facade.get());

            if (session != NULL) {
                player->sendSystemMessage("@slicing/slicing:already_slicing");
                return 0;
            }

            //Create Session
            session = new SlicingSession(player);
            session->initalizeSlicingMenu(player, weapon);

            return 0;

        }

        if(selectedID == 70) {

            weapon->repair(player);
            return 1;
        }

        if(selectedID == 71) {

            ManagedReference<PowerupObject*> pup = weapon->removePowerup();
            if(pup == NULL)
                return 1;

            Locker locker(pup);

            pup->destroyObjectFromWorld( true );
            pup->destroyObjectFromDatabase( true );

            StringIdChatParameter message("powerup", "prose_remove_powerup"); //You detach your powerup from %TT.
            message.setTT(weapon->getDisplayedName());
            player->sendSystemMessage(message);

            return 1;
        }
    }

    return TangibleObjectMenuComponent::handleObjectMenuSelect(sceneObject, player, selectedID);
}
开发者ID:Tatwi,项目名称:legend-of-hondo-classic,代码行数:59,代码来源:WeaponObjectMenuComponent.cpp

示例12: 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;
}
开发者ID:SWGChoice,项目名称:Core3,代码行数:58,代码来源:CreatureManagerImplementation.cpp

示例13: killPet

void PetManagerImplementation::killPet(TangibleObject* attacker, AiAgent* pet) {

	// TODO REMOVE AFTER TESTING
	bool attackerIsAdmin = false;
	// END REMOVE

	StringIdChatParameter stringId;

	if (attacker->isPlayerCreature()) {
		stringId.setStringId("base_player", "prose_target_dead");
		stringId.setTT(pet->getObjectID());
		(cast<CreatureObject*>(attacker))->sendSystemMessage(stringId);

		// TODO REMOVE AFTER TESTING
		//ManagedReference<PlayerObject*> ghost = (cast<CreatureObject*>(attacker))->getPlayerObject();
		//if (ghost != NULL && ghost->isPrivileged())
		//	attackerIsAdmin = true;
		// END REMOVE
	}

	pet->setCurrentSpeed(0);
	pet->clearCombatState(true);
	pet->setPosture(CreaturePosture::DEAD, true);
	pet->updateLocomotion();

	pet->updateTimeOfDeath();
	pet->clearBuffs(false);



	ManagedReference<PetControlDevice*> petControlDevice = pet->getControlDevice().get().castTo<PetControlDevice*>();

	if (petControlDevice != NULL) {

		if (petControlDevice->getPetType() == FACTIONPET) {
			ManagedReference<CreatureObject*> owner = zoneServer->getObject(pet->getCreatureLinkID()).castTo<CreatureObject*>();

			if (owner != NULL)
				petControlDevice->storeObject(owner, true);

			petControlDevice->destroyObjectFromWorld(true);
			petControlDevice->destroyObjectFromDatabase(true);

		} else if ( (!attacker->isPlayerCreature() && !attacker->isPet()) || attackerIsAdmin) { // TODO REMOVE attackerIsAdmin AFTER TESTING

			if (pet->getCooldownTimerMap() != NULL && pet->getCooldownTimerMap()->isPast("vitalityLossCooldown")) {

				petControlDevice->setVitality(petControlDevice->getVitality() - 2);
				pet->getCooldownTimerMap()->updateToCurrentAndAddMili("vitalityLossCooldown", 300000);
			}
		}

	}

	pet->notifyObjectKillObservers(attacker);

}
开发者ID:dogg-jr,项目名称:GR-Core,代码行数:57,代码来源:PetManagerImplementation.cpp

示例14: createCreature

CreatureObject* CreatureManagerImplementation::createCreature(uint32 templateCRC,  bool persistent, uint32 mobileTemplateCRC) {
	ManagedReference<SceneObject*> object = zoneServer->createObject(templateCRC, persistent);

	if (object == NULL) {
		StringBuffer errMsg;
		errMsg << "could not spawn creature... wrong template? 0x" << hex << templateCRC;

		error(errMsg.toString());

		return NULL;
	}

	Locker locker(object);

	if (!object->isCreatureObject()) {
		StringBuffer errMsg;
		errMsg << "server did not create a creature object wrong template? 0x" << hex << templateCRC;

		error(errMsg.toString());

		if (object->isPersistent()) {
			object->destroyObjectFromDatabase(true);
		}

		return NULL;
	}

	CreatureObject* creature = cast<CreatureObject*>( object.get());

	if (!createCreatureChildrenObjects(creature, templateCRC, creature->isPersistent(), mobileTemplateCRC)) {
		StringBuffer errMsg;
		errMsg << "could not create children objects for creature... 0x" << templateCRC;
		error(errMsg.toString());

		if (object->isPersistent()) {
			object->destroyObjectFromDatabase(true);
		}

		return NULL;
	}

	return creature;
}
开发者ID:angelsounds777,项目名称:Core3-CU,代码行数:43,代码来源:CreatureManagerImplementation.cpp

示例15: createHairObject

TangibleObject* ImageDesignManager::createHairObject(CreatureObject* imageDesigner, CreatureObject* targetObject, const String& hairTemplate, const String& hairCustomization) {
	Reference<TangibleObject*> oldHair = targetObject->getSlottedObject("hair").castTo<TangibleObject*>();

	HairAssetData* hairAssetData = CustomizationIdManager::instance()->getHairAssetData(hairTemplate);

	if (hairTemplate.isEmpty()) {
		if (!CustomizationIdManager::instance()->canBeBald(getSpeciesGenderString(targetObject)))
			return oldHair;
		else
			return NULL;
	}

	if (hairAssetData == NULL)
		return oldHair;

	int skillMod = hairAssetData->getSkillModValue();

	if (imageDesigner->getSkillMod("hair") < skillMod)
		return oldHair;

	if (hairAssetData->getServerPlayerTemplate() != targetObject->getObjectTemplate()->getFullTemplateString()) {
		error("hair " + hairTemplate + " is not compatible with this creature player " + targetObject->getObjectTemplate()->getFullTemplateString());
		return oldHair;
	}

	ManagedReference<SceneObject*> hair = imageDesigner->getZoneServer()->createObject(hairTemplate.hashCode(), 1);

	//TODO: Validate hairCustomization
	if (hair == NULL || !hair->isTangibleObject()) {
		if (hair != NULL) {
			Locker locker(hair);
			hair->destroyObjectFromDatabase(true);
		}

		return oldHair;
	}

	TangibleObject* tanoHair = cast<TangibleObject*>( hair.get());

	Locker locker(tanoHair);

	tanoHair->setContainerDenyPermission("owner", ContainerPermissions::MOVECONTAINER);
	tanoHair->setContainerDefaultDenyPermission(ContainerPermissions::MOVECONTAINER);

	String appearanceFilename = tanoHair->getObjectTemplate()->getAppearanceFilename();

	CustomizationVariables data;

	data.parseFromClientString(hairCustomization);

	if (validateCustomizationString(&data, appearanceFilename, getSkillLevel(imageDesigner, "hair")))
		tanoHair->setCustomizationString(hairCustomization);

	return tanoHair;
}
开发者ID:Marott1,项目名称:Core3,代码行数:55,代码来源:ImageDesignManager.cpp


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