本文整理汇总了C++中ZoneServer::getZone方法的典型用法代码示例。如果您正苦于以下问题:C++ ZoneServer::getZone方法的具体用法?C++ ZoneServer::getZone怎么用?C++ ZoneServer::getZone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZoneServer
的用法示例。
在下文中一共展示了ZoneServer::getZone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: spawnTarget
void BountyMissionObjectiveImplementation::spawnTarget(const String& zoneName) {
Locker locker(&syncMutex);
ManagedReference<MissionObject* > mission = this->mission.get();
if ((npcTarget != NULL && npcTarget->isInQuadTree()) || isPlayerTarget()) {
return;
}
ZoneServer* zoneServer = getPlayerOwner().get()->getZoneServer();
Zone* zone = zoneServer->getZone(zoneName);
CreatureManager* cmng = zone->getCreatureManager();
if (npcTarget == NULL) {
Vector3 position = getTargetPosition();
try {
npcTarget = cast<AiAgent*>(zone->getCreatureManager()->spawnCreatureWithAi(mission->getTargetOptionalTemplate().hashCode(), position.getX(), zone->getHeight(position.getX(), position.getY()), position.getY(), 0));
} catch (Exception& e) {
fail();
ManagedReference<CreatureObject*> player = getPlayerOwner();
if (player != NULL) {
player->sendSystemMessage("ERROR: could not find template for target. Please report this on Mantis to help us track down the root cause.");
}
error("Template error: " + e.getMessage() + " Template = '" + mission->getTargetOptionalTemplate() +"'");
}
if (npcTarget != NULL) {
npcTarget->setCustomObjectName(mission->getTargetName(), true);
//TODO add observer to catch player kill and fail mission in that case.
addObserverToCreature(ObserverEventType::OBJECTDESTRUCTION, npcTarget);
addObserverToCreature(ObserverEventType::DAMAGERECEIVED, npcTarget);
} else {
fail();
ManagedReference<CreatureObject*> player = getPlayerOwner();
if (player != NULL) {
player->sendSystemMessage("ERROR: could not find template for target. Please report this on Mantis to help us track down the root cause.");
}
error("Could not spawn template: '" + mission->getTargetOptionalTemplate() + "'");
}
}
}
示例2: handleObjectMenuSelect
int ForceShrineMenuComponent::handleObjectMenuSelect(SceneObject* sceneObject, CreatureObject* creature, byte selectedID) {
if (selectedID != 213)
return 0;
if (creature->getPosture() != CreaturePosture::CROUCHED){
creature->sendSystemMessage("@jedi_trials:show_respect"); // Must show respect
return 0;
}
ManagedReference<PlayerObject*> ghost = creature->getPlayerObject();
if (ghost == NULL)
return 0;
if (creature->getScreenPlayState("VillageJediProgression") && !creature->hasSkill("force_title_jedi_rank_02")){
ManagedReference<SuiMessageBox*> box = new SuiMessageBox(creature, SuiWindowType::NONE);
box->setPromptTitle("@jedi_trials:padawan_trials_title"); // Jedi Trials
box->setPromptText("@jedi_trials:padawan_trials_completed");
ghost->addSuiBox(box);
creature->sendMessage(box->generateMessage());
SkillManager::instance()->awardSkill("force_title_jedi_rank_02", creature, true, true, true);
creature->playEffect("clienteffect/entertainer_dazzle_level_3.cef", ""); // Not sure if it's the right one for this.
PlayMusicMessage* pmm = new PlayMusicMessage("sound/intro.snd");
creature->sendMessage(pmm);
ghost->setJediState(2);
// Trainer number. Pick a random trainer, there are at least 600 in the galaxy.
ZoneServer* zoneServer = ghost->getZoneServer();
int randomZone = System::random(zoneServer->getZoneCount() - 1);
ManagedReference<Zone*> zone = zoneServer->getZone(randomZone);
Vector3 randomTrainer = zone->getCreatureManager()->getRandomJediTrainer();
if ((randomTrainer.getX() == 0) && (randomTrainer.getY() == 0)) { // No trainers on the zone.
ManagedReference<Zone*> zone = zoneServer->getZone(0);
Vector3 randomTrainer = zone->getCreatureManager()->getRandomJediTrainer();
}
Vector3 trainerPositionFinal(randomTrainer.getX(), randomTrainer.getY(), 0);
String zoneName = zone->getZoneName();
ghost->setTrainerCoordinates(trainerPositionFinal);
ghost->setTrainerZoneName(zoneName); // For the Waypoint.
ManagedReference<SceneObject*> inventory = creature->getSlottedObject("inventory");
//Check if inventory is full.
if (inventory->hasFullContainerObjects()) {
creature->sendSystemMessage("@jedi_spam:inventory_full_jedi_robe"); // You have too many items in your inventory. In order to get your Padawan Robe you must clear out at least one free slot.
return 0;
}
ZoneServer* zserv = creature->getZoneServer();
String PadawanRobe = "object/tangible/wearables/robe/robe_jedi_padawan.iff";
ManagedReference<SceneObject*> padawanRobe = zserv->createObject(PadawanRobe.hashCode(), 1);
if (inventory->transferObject(padawanRobe, -1)) {
inventory->broadcastObject(padawanRobe, true);
} else {
padawanRobe->destroyObjectFromDatabase(true);
}
}
else if (!creature->hasSkill("force_title_jedi_novice")){
int rand = System::random(14) + 1;
StringBuffer sysmsg;
sysmsg << "@jedi_trials:force_shrine_wisdom_" << rand;
creature->sendSystemMessage(sysmsg.toString());
}
else if (creature->hasSkill("force_title_jedi_rank_02")){
ManagedReference<SceneObject*> inventory = creature->getSlottedObject("inventory");
//Check if inventory is full.
if (inventory->hasFullContainerObjects()) {
creature->sendSystemMessage("@jedi_spam:inventory_full_jedi_robe"); // You have too many items in your inventory. In order to get your Padawan Robe you must clear out at least one free slot.
return 0;
}
ZoneServer* zserv = creature->getZoneServer();
String PadawanRobe = "object/tangible/wearables/robe/robe_jedi_padawan.iff";
ManagedReference<SceneObject*> padawanRobe = zserv->createObject(PadawanRobe.hashCode(), 1);
if (inventory->transferObject(padawanRobe, -1)) {
inventory->broadcastObject(padawanRobe, true);
} else {
//.........这里部分代码省略.........