本文整理汇总了C++中ManagedReference::checkForNewSpawns方法的典型用法代码示例。如果您正苦于以下问题:C++ ManagedReference::checkForNewSpawns方法的具体用法?C++ ManagedReference::checkForNewSpawns怎么用?C++ ManagedReference::checkForNewSpawns使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ManagedReference
的用法示例。
在下文中一共展示了ManagedReference::checkForNewSpawns方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: spawnLair
SceneObject* CreatureManagerImplementation::spawnLair(unsigned int lairTemplate, int difficultyLevel, int difficulty, float x, float z, float y, float size) {
LairTemplate* lairTmpl = creatureTemplateManager->getLairTemplate(lairTemplate);
if (lairTmpl == NULL || lairTmpl->getBuildingType() != LairTemplate::LAIR)
return NULL;
String buildingToSpawn;
Vector<String>* mobiles = lairTmpl->getWeightedMobiles();
if (mobiles->size() == 0)
return NULL;
buildingToSpawn = lairTmpl->getBuilding((uint32)difficulty);
if (buildingToSpawn.isEmpty()) {
error("error spawning " + buildingToSpawn);
return NULL;
}
ManagedReference<LairObject*> building = zoneServer->createObject(buildingToSpawn.hashCode(), 0).castTo<LairObject*>();
if (building == NULL) {
error("error spawning " + buildingToSpawn);
return NULL;
}
Locker blocker(building);
building->setFaction(lairTmpl->getFaction());
building->setPvpStatusBitmask(CreatureFlag::ATTACKABLE);
building->setOptionsBitmask(0, false);
building->setMaxCondition(difficultyLevel * (900 + System::random(200)));
building->setConditionDamage(0, false);
building->initializePosition(x, z, y);
building->setDespawnOnNoPlayersInRange(true);
ManagedReference<LairObserver*> lairObserver = new LairObserver();
lairObserver->deploy();
lairObserver->setLairTemplate(lairTmpl);
lairObserver->setDifficulty(difficulty);
lairObserver->setObserverType(ObserverType::LAIR);
lairObserver->setSize(size);
building->registerObserver(ObserverEventType::OBJECTDESTRUCTION, lairObserver);
building->registerObserver(ObserverEventType::DAMAGERECEIVED, lairObserver);
building->registerObserver(ObserverEventType::AIMESSAGE, lairObserver);
building->registerObserver(ObserverEventType::OBJECTREMOVEDFROMZONE, lairObserver);
zone->transferObject(building, -1, false);
lairObserver->checkForNewSpawns(building, NULL, true);
return building;
}
示例2: spawnLair
void DestroyMissionObjectiveImplementation::spawnLair() {
ManagedReference<MissionObject* > mission = this->mission.get();
ManagedReference<MissionSpawnActiveArea* > spawnActiveArea = this->spawnActiveArea;
if (spawnActiveArea == NULL)
return;
if (lairObject != NULL && lairObject->getZone() != NULL)
return;
Zone* zone = spawnActiveArea->getZone();
Locker locker(spawnActiveArea);
spawnActiveArea->destroyObjectFromWorld(true);
Vector3 pos = findValidSpawnPosition(zone);
ManagedReference<WaypointObject*> waypoint = mission->getWaypointToMission();
if (waypoint == NULL) {
waypoint = mission->createWaypoint();
}
waypoint->setPosition(pos.getX(), 0, pos.getY());
mission->updateMissionLocation();
mission->setStartPosition(pos.getX(), pos.getY());
//TODO: find correct string id
ManagedReference<CreatureObject*> player = getPlayerOwner();
if (player != NULL) {
player->sendSystemMessage("Transmission Received: Mission Target has been located. Mission waypoint has been updated to exact location");
}
LairTemplate* lair = CreatureTemplateManager::instance()->getLairTemplate(lairTemplate.hashCode());
if (lair == NULL) {
error("incorrect lair template in destroy mission objective " + lairTemplate);
abort();
return;
}
if (lairObject == NULL) {
String buildingToSpawn = lair->getMissionBuilding(difficulty);
if (buildingToSpawn.isEmpty()) {
error("error spawning " + buildingToSpawn);
abort();
return;
}
lairObject = zone->getZoneServer()->createObject(buildingToSpawn.hashCode(), 0).castTo<LairObject*>();
if (lairObject == NULL) {
error("error spawning " + buildingToSpawn);
abort();
return;
}
Locker locker(lairObject);
lairObject->setFaction(lair->getFaction());
lairObject->setPvpStatusBitmask(CreatureFlag::ATTACKABLE);
lairObject->setOptionsBitmask(0, false);
lairObject->setMaxCondition(difficultyLevel * (900 + System::random(200)));
lairObject->setConditionDamage(0, false);
lairObject->initializePosition(pos.getX(), pos.getZ(), pos.getY());
lairObject->setDespawnOnNoPlayersInRange(false);
ManagedReference<MissionObserver*> observer = new MissionObserver(_this.get());
addObserver(observer, true);
lairObject->registerObserver(ObserverEventType::OBJECTDESTRUCTION, observer);
ManagedReference<DestroyMissionLairObserver*> lairObserver = new DestroyMissionLairObserver();
lairObserver->deploy();
lairObserver->setLairTemplate(lair);
lairObserver->setDifficulty(difficulty);
lairObserver->setObserverType(ObserverType::LAIR);
lairObserver->setSize(mission->getSize());
lairObject->registerObserver(ObserverEventType::OBJECTDESTRUCTION, lairObserver);
lairObject->registerObserver(ObserverEventType::DAMAGERECEIVED, lairObserver);
lairObject->registerObserver(ObserverEventType::AIMESSAGE, lairObserver);
lairObject->registerObserver(ObserverEventType::OBJECTREMOVEDFROMZONE, lairObserver);
zone->transferObject(lairObject, -1, true);
lairObserver->checkForNewSpawns(lairObject, NULL, true);
}
if (lairObject != NULL && lairObject->getZone() == NULL) {
zone->transferObject(lairObject, -1, true);
}
}