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


C++ Quest类代码示例

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


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

示例1: GAMEDATAMGR

SBYTE CUIQuestBook::GetQuestType(const INDEX& iQuestIndex)
{
	CUIManager* pUIManager = CUIManager::getSingleton();
	Quest* pQuest = GAMEDATAMGR()->GetQuest();

	if (pQuest == NULL)
		return 0;

	int iTempIndex = -1;
	int count;

	count = pQuest->GetCompleteQuestCount();

	for( int iComplete = 0; iComplete < count; ++iComplete )
	{
		iTempIndex = pQuest->GetCompleteQuestIndex(iComplete);

		if( iQuestIndex == iTempIndex )
			return 2;
	}

	count = pQuest->GetProceedQuestCount();
	for( int iNew = 0; iNew < count; ++iNew )
	{
		iTempIndex = pQuest->GetProceedQuestIndex(iNew);

		if( iQuestIndex == iTempIndex )
			return 1;
	}

	return 0;
}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:32,代码来源:UIQuestBookNew.cpp

示例2: process

	CeGuiString SetProcessor::process(DOMNode* node,Match* match, const CeGuiString& str, NaturalLanguageProcessor* nlp)
	{
		CeGuiString propertyType = XmlHelper::getAttributeValueAsString( 
				static_cast<DOMElement*>(node), "type" );
		
		CeGuiString propertyName = XmlHelper::getAttributeValueAsString( 
				static_cast<DOMElement*>(node), "name" );

		CeGuiString propertyValue;
		
		DOMNode* childNode = node->getFirstChild();
		if( childNode->getNodeType() == DOMNode::TEXT_NODE ) 
		{
			propertyValue = XmlHelper::transcodeToString(
						static_cast<DOMText*>(childNode)->getData());
		}

		if(propertyType == "quest")
		{
			Quest* quest = RulesSubsystem::getSingletonPtr()->getQuestBook()
				->getQuest(propertyName);
			if(quest != NULL)
			{
				Quest::State state = static_cast<Quest::State>(
					Quest::getStateFromName(propertyValue));
				quest->setState(state);
			}
		}
		else
		{
			nlp->getPredicates().setPredicate(propertyName, "default", propertyValue);
		}

		return "";
	}
开发者ID:BackupTheBerlios,项目名称:dsa-hl-svn,代码行数:35,代码来源:SetProcessor.cpp

示例3: finishQuest

void PlayerQuests::finishQuest(int16_t questid, int32_t npcid) {
	Quest *questinfo = QuestDataProvider::Instance()->getInfo(questid);

	if (!giveRewards(questid, false)) { // Failed, don't complete the quest yet
		return;
	}

	if (questinfo->hasMobRequests()) {
		for (MobRequests::iterator i = questinfo->getMobBegin(); i != questinfo->getMobEnd(); i++) {
			for (size_t k = 0; k < m_mobtoquest[i->first].size(); k++) {
				if (m_mobtoquest[i->first][k] == questid) {
					if (m_mobtoquest[i->first].size() == 1) { // Only one quest for this mob
						m_mobtoquest.erase(i->first);
					}
					else {
						m_mobtoquest[i->first].erase(m_mobtoquest[i->first].begin() + k);
					}
					break;
				}
			}
		}
	}
	m_quests.erase(questid);
	int64_t endtime = TimeUtilities::getServerTime();
	m_completed[questid] = endtime;
	QuestsPacket::questFinish(m_player, questid, npcid, questinfo->getNextQuest(), endtime);
}
开发者ID:JakeShirley,项目名称:Vana,代码行数:27,代码来源:PlayerQuests.cpp

示例4: process

CeGuiString GetProcessor::process(DOMNode* node,Match* match, const CeGuiString& str, NaturalLanguageProcessor* nlp)
{
    CeGuiString propertyType = XmlHelper::getAttributeValueAsString(
                                   static_cast<DOMElement*>(node), "type" );

    CeGuiString propertyName = XmlHelper::getAttributeValueAsString(
                                   static_cast<DOMElement*>(node), "name" );

    CeGuiString rVal;

    if(propertyType == "quest")
    {
        Quest* quest = RulesSubsystem::getSingletonPtr()->getQuestBook()
                       ->getQuest(propertyName);
        if(quest != NULL)
        {
            rVal = quest->getState();
        }
    }
    else
    {
        rVal = nlp->getPredicates().getPredicate(propertyName, "default");
    }

    return rVal;
}
开发者ID:BackupTheBerlios,项目名称:dsa-hl-svn,代码行数:26,代码来源:GetProcessor.cpp

示例5: QSortFilterProxyModel

/**
 * @brief Creates a quest files model.
 * @param parent Path of the quest to represent.
 */
QuestFilesModel::QuestFilesModel(Quest& quest):
  QSortFilterProxyModel(nullptr),
  quest(quest),
  source_model(new QFileSystemModel) {

  // Watch changes on the filesystem.
  source_model->setRootPath(quest.get_data_path());  // Only watch changes in the data directory.
  source_model->setReadOnly(false);
  setSourceModel(source_model);

  // Watch changes in resources.
  connect(&quest.get_resources(), SIGNAL(element_added(ResourceType, QString, QString)),
          this, SLOT(resource_element_added(ResourceType, QString, QString)));
  connect(&quest.get_resources(), SIGNAL(element_removed(ResourceType, QString)),
          this, SLOT(resource_element_removed(ResourceType, QString)));
  connect(&quest.get_resources(), SIGNAL(element_renamed(ResourceType, QString, QString)),
          this, SLOT(resource_element_renamed(ResourceType, QString, QString)));
  connect(&quest.get_resources(), SIGNAL(element_description_changed(ResourceType, QString, QString)),
          this, SLOT(resource_element_description_changed(ResourceType, QString, QString)));

  // This model adds extra items for files missing on the filesystem.
  // To ensure we have an extra item if and only if the file is missing,
  // we need to watch files creations and destructions.
  connect(source_model, SIGNAL(rowsInserted(QModelIndex, int, int)),
          SLOT(source_model_rows_inserted(QModelIndex, int, int)));
  connect(source_model, SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int)),
          SLOT(source_model_rows_about_to_be_removed(QModelIndex, int, int)));
}
开发者ID:christopho,项目名称:solarus-quest-editor,代码行数:32,代码来源:quest_files_model.cpp

示例6: UE_LOG

//Quest
void UQuestManager::loadQuests(AActor* worldSource) {
	UE_LOG(LogQuestSystem, Log, TEXT("start loading quests"));
	QuestConverter* converter = QuestConverter::getInstance();

	TArray<DDObject*> loaded = DDReg::load("quests");

	if (loaded.Num() <= 0) {
		UE_LOG(LogQuestSystem, Error, TEXT("No Quests have been loaded."));
		UE_LOG(LogQuestSystem, Error, TEXT("  This might be because of errors in the JSON-File."));
		UE_LOG(LogQuestSystem, Error, TEXT("  Check if there are missplaced commas, brackets or tags."));
	}

	for (DDObject* ddo : loaded) {
		Quest* quest = static_cast<Quest*>(ddo);
		UE_LOG(LogQuestSystem, Log, TEXT("  quests %s"), *quest->getID());
		
		if (quest != NULL) {
			UBlueprintQuest* bpQuest = quest->getBlueprint();

			bpQuest->setWorld(worldSource->GetWorld());

			_questsMap.Add(quest->getID(), quest->getBlueprint());
		}
	}
	UE_LOG(LogQuestSystem, Log, TEXT("end loading quests"));
}
开发者ID:JustInToCoding,项目名称:UnionGame,代码行数:27,代码来源:QuestManager.cpp

示例7: open_strings_editor

/**
 * @brief Opens a file with a language strings list editor in a new tab.
 * @param quest A Solarus quest.
 * @param language_id Language id of the strings file to open.
 */
void EditorTabs::open_strings_editor(
    Quest& quest, const QString& language_id) {

  // Get the strings file path.
  QString path = quest.get_strings_path(language_id);

  if (!quest.is_in_root_path(path)) {
    // Not a file of this quest.
    return;
  }

  // Find the existing tab if any.
  int index = find_editor(path);
  if (index != -1) {
    // Already open.
    setCurrentIndex(index);
    return;
  }

  try {
    add_editor(new StringsEditor(quest, language_id));
  }
  catch (const EditorException& ex) {
    ex.show_dialog();
  }
}
开发者ID:Plague78,项目名称:solarus-quest-editor,代码行数:31,代码来源:editor_tabs.cpp

示例8: Quest_finish_quest

	/**
	 * Sets that the quest has been finished, this will return false is the quest has already
	 * been finished. If the quest is finished then the "finishQuest" event will be fired.
	 *
	 * @returns boolean True if the quest was finished, false indicates that the quest has alrady been finished.
	 */
	int Quest_finish_quest(lua_State *lua)
	{
		Quest *quest = castUData<Quest>(lua, 1);
		if (quest)
		{
			lua_pushboolean(lua, quest->finishQuest());
			return 1;
		}
		return LuaState::expectedContext(lua, "finish_quest", "am.quest");
	}
开发者ID:astrellon,项目名称:Rouge,代码行数:16,代码来源:lua_quest.cpp

示例9: Quest_has_event_listener

	/**
	 * Returns true when there is an event listener for the given event name.
	 * @param string event_name The event type to look up.
	 * @returns boolean True if there is any event listener 
	 * that will be trigged by this event type.
	 */
	int Quest_has_event_listener(lua_State *lua)
	{
		Quest *quest = castUData<Quest>(lua, 1);
		if (quest && lua_isstr(lua, 2))
		{
			lua_pushboolean(lua, quest->hasEventListener(lua_tostring(lua, 2)));
			return 1;
		}
		return LuaState::expectedContext(lua, "has_event_listener", "am.quest");
	}
开发者ID:astrellon,项目名称:Rouge,代码行数:16,代码来源:lua_quest.cpp

示例10: Quest_dtor

	/**
	 * Releases the reference on the internal quest.
	 */
	int Quest_dtor(lua_State *lua)
	{
		Quest *quest = castUData<Quest>(lua, 1);
		if (quest)
		{
			quest->release();
			return 0;
		}
		return LuaState::expectedContext(lua, "__gc", "am.quest");
	}
开发者ID:astrellon,项目名称:Rouge,代码行数:13,代码来源:lua_quest.cpp

示例11: addQuestMobs

void PlayerQuests::addQuestMobs(int16_t questid) {
	Quest *questinfo = QuestDataProvider::Instance()->getInfo(questid);
	if (questinfo->hasMobRequests()) {
		size_t index = 0;
		for (MobRequests::iterator i = questinfo->getMobBegin(); i != questinfo->getMobEnd(); i++) {
			m_quests[questid].kills[i->first] = 0;
			m_mobtoquest[i->first].push_back(questid);
		}
	}
}
开发者ID:JakeShirley,项目名称:Vana,代码行数:10,代码来源:PlayerQuests.cpp

示例12: Quest

Quest* QuestManager::CreateQuest(string name, string startText, string completedText, string denyText)
{
    Quest* pQuest = new Quest(name, startText, completedText, denyText);
	pQuest->SetNPCManager(m_pNPCManager);
	pQuest->SetInventoryManager(m_pInventoryManager);
	pQuest->SetQuestJournal(m_pQuestJournal);

    m_vpQuestList.push_back(pQuest);

    return pQuest;
}
开发者ID:AlwaysGeeky,项目名称:Vox,代码行数:11,代码来源:QuestManager.cpp

示例13: if

void PlayerQuests::checkDone(ActiveQuest &quest) {
	Quest *questinfo = QuestDataProvider::Instance()->getInfo(quest.id);
	quest.done = true;
	if (!questinfo->hasRequests()) {
		return;
	}
	if (questinfo->hasItemRequests()) {
		int32_t iid = 0;
		int16_t iamt = 0;
		for (ItemRequests::iterator i = questinfo->getItemBegin(); i != questinfo->getItemEnd(); i++) {
			iid = i->first;
			iamt = i->second;
			if ((m_player->getInventory()->getItemAmount(iid) < iamt && iamt > 0) || (iamt == 0 && m_player->getInventory()->getItemAmount(iid) != 0)) {
				quest.done = false;
				break;
			}
		}
	}
	else if (questinfo->hasMobRequests()) {
		int32_t killed = 0;
		for (MobRequests::iterator i = questinfo->getMobBegin(); i != questinfo->getMobEnd(); i++) {
			if (quest.kills[i->first] < i->second) {
				quest.done = false;
				break;
			}
		}
	}
	if (quest.done) {
		QuestsPacket::doneQuest(m_player, quest.id);
	}
}
开发者ID:JakeShirley,项目名称:Vana,代码行数:31,代码来源:PlayerQuests.cpp

示例14: SendQuestEvent

void Map::SendQuestEvent(const std::string &obj, short type) {
	for (auto it = quests.begin(); it != quests.end(); it++) {
		Quest *q = *it;
		if (q->GetType() == type && q->GetObjective() == obj) {
			int progress = q->Progress();
			if (progress == 0) {
				it = quests.erase(it);
				delete q;
				if (it == quests.end())
					return;
			}
		}
	}
}
开发者ID:adamjedlicka,项目名称:yarpg,代码行数:14,代码来源:map.cpp

示例15: QDialog

/**
 * @brief Creates a change source image dialog.
 * @param initial_source_image Initial value of the source image.
 * @param parent Parent object or nullptr.
 */
ChangeSourceImageDialog::ChangeSourceImageDialog(
    const Quest &quest, const QString& initial_source_image,
    QWidget* parent) :
  QDialog(parent),
  image_path(quest.get_sprite_image_path("")) {

  ui.setupUi(this);

  file_system_model.setRootPath(image_path);
  file_system_model.setNameFilters(QStringList("*.png"));
  file_system_model.setNameFilterDisables(false);

  ui.file_tree_view->setModel(&file_system_model);
  ui.file_tree_view->setRootIndex(file_system_model.index(image_path));

  ui.file_tree_view->setSelectionMode(QAbstractItemView::SingleSelection);
  ui.file_tree_view->setHeaderHidden(true);
  ui.file_tree_view->setColumnHidden(1, true);
  ui.file_tree_view->setColumnHidden(2, true);
  ui.file_tree_view->setColumnHidden(3, true);

  scene.addItem(&image_item);
  ui.image_view->setScene(&scene);

  set_source_image(initial_source_image);

  connect(ui.tileset_value, SIGNAL(clicked()),
          this, SLOT(change_is_tileset_requested()));
  connect(ui.image_value, SIGNAL(clicked()),
          this, SLOT(change_is_tileset_requested()));

  connect(ui.file_tree_view->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
          this, SLOT(change_source_image_requested()));
}
开发者ID:MORTAL2000,项目名称:solarus-quest-editor,代码行数:39,代码来源:change_source_image_dialog.cpp


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