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


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

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


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

示例1: abort

void DestroyMissionObjectiveImplementation::abort() {
	MissionObjectiveImplementation::abort();

	if (hasObservers()) {
		ManagedReference<MissionObserver*> observer = getObserver(0);

		ManagedReference<CreatureObject*> player = getPlayerOwner();

		ManagedReference<LairObject*> lair = lairObject;

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

			lair->dropObserver(ObserverEventType::OBJECTDESTRUCTION, observer);
			lair->destroyObjectFromWorld(true);

			lair = NULL;

			dropObserver(observer, true);
		}
			//spawnActiveArea->destroyObjectFromDatabase(true);
	}

	ManagedReference<MissionSpawnActiveArea* > spawnActiveArea = this->spawnActiveArea;

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

		spawnActiveArea->destroyObjectFromWorld(true);
	}
}
开发者ID:blacknightownzjoo,项目名称:SWGOOW,代码行数:31,代码来源:DestroyMissionObjectiveImplementation.cpp

示例2: clearSession

int CraftingSessionImplementation::clearSession() {
	Locker slocker(_this.get());

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

	if (manufactureSchematic != NULL) {

		Locker locker(manufactureSchematic);

		if (manufactureSchematic->getParent() == craftingTool) {
			manufactureSchematic->setDraftSchematic(NULL);
			manufactureSchematic->cleanupIngredientSlots(crafter);
			manufactureSchematic->destroyObjectFromWorld(true);
		}

		this->manufactureSchematic = NULL;
	}

	if (craftingTool != NULL) {
		Locker locker2(craftingTool);

		// Remove all items that aren't the prototype
		while (craftingTool->getContainerObjectsSize() > 1) {
			craftingTool->getContainerObject(1)->destroyObjectFromWorld(true);
		}

		craftingTool->dropSlottedObject("crafted_components");

		if (prototype != NULL) {

			Locker locker3(prototype);

			if (craftingTool->isReady()) {

				if (prototype->getParent() == craftingTool) {
					prototype->destroyObjectFromWorld(true);
				}

				this->prototype = NULL;
			}
		}
	}

	if(crafterGhost != NULL && crafterGhost->getDebug()) {
		crafter->sendSystemMessage("*** Clearing crafting session ***");
	}

	return 0;
}
开发者ID:Skyyyr,项目名称:GR-Core-TC1,代码行数:54,代码来源:CraftingSessionImplementation.cpp

示例3: 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

示例4: storeObject

void ShipControlDeviceImplementation::storeObject(CreatureObject* player, bool force) {
	player->clearState(CreatureState::PILOTINGSHIP);

	ManagedReference<TangibleObject*> controlledObject = this->controlledObject.get();

	if (controlledObject == NULL)
		return;

	Locker clocker(controlledObject, player);

	if (!controlledObject->isInQuadTree())
		return;

	Zone* zone = player->getZone();

	if (zone == NULL)
		return;

	zone->transferObject(player, -1, false);
	
	controlledObject->destroyObjectFromWorld(true);

	transferObject(controlledObject, 4, true);
	
	updateStatus(0);
}
开发者ID:Nifdoolb,项目名称:Core3,代码行数:26,代码来源:ShipControlDeviceImplementation.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: storeObject

void VehicleControlDeviceImplementation::storeObject(CreatureObject* player, bool force) {
	ManagedReference<TangibleObject*> controlledObject = this->controlledObject.get();

	if (controlledObject == NULL)
		return;

	/*if (!controlledObject->isInQuadTree())
		return;*/

	if (player->isRidingMount() && player->getParent() == controlledObject) {

		if (!force && !player->checkCooldownRecovery("mount_dismount"))
			return;

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

		if (player->isRidingMount())
			return;
	}

	Locker crossLocker(controlledObject, player);

	controlledObject->destroyObjectFromWorld(true);

	if (controlledObject->isCreatureObject())
		(cast<CreatureObject*>(controlledObject.get()))->setCreatureLink(NULL);

	updateStatus(0);
}
开发者ID:Nifdoolb,项目名称:Server,代码行数:29,代码来源:VehicleControlDeviceImplementation.cpp

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: createManufactureSchematic

void CraftingSessionImplementation::createManufactureSchematic(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();
	ManagedReference<CraftingManager*> craftingManager = this->craftingManager.get();

	if (manufactureSchematic == NULL) {
		sendSlotMessage(0, IngredientSlot::NOSCHEMATIC);
		return;
	}

	if (prototype == NULL) {
		sendSlotMessage(0, IngredientSlot::PROTOTYPENOTFOUND);
		return;
	}

	if (!craftingManager.get()->allowManufactureSchematic(manufactureSchematic)){
		sendSlotMessage(0, IngredientSlot::NOSCHEMATIC);
		return;
	}

	Locker locker(_this.get());

	if (manufactureSchematic->isAssembled()
			&& !manufactureSchematic->isCompleted()) {

		//Object Controller
		ObjectControllerMessage* objMsg = new ObjectControllerMessage(
				crafter->getObjectID(), 0x1B, 0x010C);
		objMsg->insertInt(0x10B);
		objMsg->insertInt(1);
		objMsg->insertByte(clientCounter);

		crafter->sendMessage(objMsg);

		ManagedReference<SceneObject*> datapad = crafter->getSlottedObject("datapad");

		prototype->destroyObjectFromWorld(0);

		manufactureSchematic->setPersistent(2);
		prototype->setPersistent(2);

		datapad->transferObject(manufactureSchematic, -1, true);
		manufactureSchematic->setPrototype(prototype);

	} else {

		closeCraftingWindow(clientCounter);

		sendSlotMessage(clientCounter, IngredientSlot::WEIRDFAILEDMESSAGE);
	}

	cancelSession();
}
开发者ID:Skyyyr,项目名称:GR-Core-TC1,代码行数:57,代码来源:CraftingSessionImplementation.cpp

示例12: 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

示例13: notifyObserverEvent

int InstrumentObserverImplementation::notifyObserverEvent(unsigned int eventType, Observable* observable, ManagedObject* arg1, int64 arg2) {
	if (eventType != ObserverEventType::POSITIONCHANGED && eventType != ObserverEventType::OBJECTREMOVEDFROMZONE) {
		return 0;
	}

	SceneObject* creature = cast<SceneObject*>(observable);

	if (creature == NULL) {
		return 0;
	}

	ManagedReference<Instrument* > instrument = this->instrument.get();

	if (instrument == NULL || instrument->getZone() == NULL) {
		if (eventType == ObserverEventType::OBJECTREMOVEDFROMZONE) {
			creature->dropObserver(ObserverEventType::POSITIONCHANGED, _this.getReferenceUnsafeStaticCast());
		} else if (eventType == ObserverEventType::POSITIONCHANGED) {
			creature->dropObserver(ObserverEventType::OBJECTREMOVEDFROMZONE, _this.getReferenceUnsafeStaticCast());
		}

		return 1;
	} else {
		Locker locker(instrument);

		if (eventType == ObserverEventType::POSITIONCHANGED) {
			if (creature->getDistanceTo(instrument) > 8) {
				instrument->destroyObjectFromWorld(true);

				creature->dropObserver(ObserverEventType::OBJECTREMOVEDFROMZONE, _this.getReferenceUnsafeStaticCast());

				return 1;
			}
		} else if (eventType == ObserverEventType::OBJECTREMOVEDFROMZONE) {
			instrument->destroyObjectFromWorld(true);

			creature->dropObserver(ObserverEventType::POSITIONCHANGED, _this.getReferenceUnsafeStaticCast());

			return 1;
		}
	}

	return 0;
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:43,代码来源:InstrumentObserverImplementation.cpp

示例14: destroyActiveAreas

void CityRegionImplementation::destroyActiveAreas() {
	for (int i = 0; i < regions.size(); ++i) {
		ManagedReference<Region*> aa = regions.get(i);

		if (aa != NULL) {
			Locker clocker(aa, _this.getReferenceUnsafeStaticCast());
			aa->destroyObjectFromWorld(false);
			aa->destroyObjectFromDatabase(true);
		}
	}

	regions.removeAll();
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:13,代码来源:CityRegionImplementation.cpp

示例15: beginShowLaunch

void FireworkObjectImplementation::beginShowLaunch(CreatureObject* player) {
	if (player == NULL || player->getParent() != NULL)
		return;

	ManagedReference<FireworkObject*> fireworkShow = _this.getReferenceUnsafeStaticCast();

	if (fireworkShow == NULL)
		return;

	DataObjectComponent* data = fireworkShow->getDataObjectComponent()->get();

	if(data == NULL || !data->isFireworkShowData())
		return;

	FireworkShowDataComponent* fireworkShowData = cast<FireworkShowDataComponent*>(data);

	if (fireworkShowData->getTotalFireworkCount() == 0)
		return;

	ManagedReference<StaticObject*> showLauncherObject = (getZoneServer()->createObject(fireworkObject.hashCode(), 0)).castTo<StaticObject*>();

	if (showLauncherObject == NULL)
		return;

	player->setPosture(CreaturePosture::CROUCHED);
	player->doAnimation("manipulate_low");

	float angle = player->getDirectionAngle();

	if (angle > 360)
		angle = angle - 360;

	float distance = 2.0;

	angle = 2 * M_PI * angle / 360;

	int x = player->getPositionX() + sin(angle) * (distance);
	int y = player->getPositionY() + cos(angle) * (distance);
	int z = player->getZone()->getHeight(x, y);
	Locker locker(showLauncherObject);
	showLauncherObject->initializePosition(x, z, y);
	player->getZone()->transferObject(showLauncherObject, -1, true);

	fireworkShow->destroyObjectFromWorld(true);

	int launchDelay = fireworkShowData->getFireworkDelay(0);
	Reference<FireworkShowLaunchFireworkEvent*> fireworkShowLaunchFireworkEvent = new FireworkShowLaunchFireworkEvent(player, fireworkShow, fireworkShowData, showLauncherObject);
	fireworkShowLaunchFireworkEvent->schedule(launchDelay);

}
开发者ID:ModTheGalaxy,项目名称:mtgserver,代码行数:50,代码来源:FireworkObjectImplementation.cpp


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