Ejemplo n.º 1
0
    void Journal::addEntry (const std::string& id, int index, const MWWorld::Ptr& actor)
    {
        // bail out if we already have heard this...
        std::string infoId = JournalEntry::idFromIndex (id, index);
        for (TEntryIter i = mJournal.begin (); i != mJournal.end (); ++i)
            if (i->mTopic == id && i->mInfoId == infoId)
            {
                if (getJournalIndex(id) < index)
                {
                    setJournalIndex(id, index);
                    MWBase::Environment::get().getWindowManager()->messageBox ("#{sJournalEntry}");
                }
                return;
            }

        StampedJournalEntry entry = StampedJournalEntry::makeFromQuest (id, index, actor);

        Quest& quest = getQuest (id);
        quest.addEntry (entry); // we are doing slicing on purpose here

        // there is no need to show empty entries in journal
        if (!entry.getText().empty())
        {
            mJournal.push_back (entry);
            MWBase::Environment::get().getWindowManager()->messageBox ("#{sJournalEntry}");
        }
    }
Ejemplo n.º 2
0
    void Journal::readRecord (ESM::ESMReader& reader, uint32_t type)
    {
        if (type==ESM::REC_JOUR || type==ESM::REC_JOUR_LEGACY)
        {
            ESM::JournalEntry record;
            record.load (reader);

            if (isThere (record.mTopic, record.mInfo))
                switch (record.mType)
                {
                    case ESM::JournalEntry::Type_Quest:

                        getQuest (record.mTopic).insertEntry (record);
                        break;

                    case ESM::JournalEntry::Type_Journal:

                        mJournal.push_back (record);
                        break;

                    case ESM::JournalEntry::Type_Topic:

                        getTopic (record.mTopic).insertEntry (record);
                        break;
                }
        }
        else if (type==ESM::REC_QUES)
        {
            ESM::QuestState record;
            record.load (reader);

            if (isThere (record.mTopic))
                mQuests.insert (std::make_pair (record.mTopic, record));
        }
    }
Ejemplo n.º 3
0
    void Journal::addEntry (const std::string& id, int index)
    {
        StampedJournalEntry entry = StampedJournalEntry::makeFromQuest (id, index);

        mJournal.push_back (entry);

        Quest& quest = getQuest (id);

        quest.addEntry (entry); // we are doing slicing on purpose here

        std::vector<std::string> empty;
        std::string notification = MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sJournalEntry")->str;
        MWBase::Environment::get().getWindowManager()->messageBox (notification, empty);
    }
Ejemplo n.º 4
0
    void Journal::addEntry (const std::string& id, int index)
    {
        StampedJournalEntry entry =
            StampedJournalEntry::makeFromQuest (id, index, *mEnvironment.mWorld);

        mJournal.push_back (entry);

        Quest& quest = getQuest (id);

        quest.addEntry (entry, *mEnvironment.mWorld); // we are doing slicing on purpose here
        
        std::vector<std::string> empty;
        std::string notification = "Your Journal has been updated.";
        mEnvironment.mWindowManager->messageBox (notification, empty);
    }
Ejemplo n.º 5
0
Quest* QuestBook::getQuest(Quest* parent, const CeGuiString& id)
{
	if (parent->getId().compare(id) == 0)
		return parent;

	QuestVector children = parent->getSubquests();
	for(QuestVector::iterator it = children.begin(); it != children.end(); it++)
	{
		Quest* subquest = getQuest(*it, id);
		if (subquest != NULL)
			return subquest;
	}

	return NULL;
}
Ejemplo n.º 6
0
    void Journal::addEntry (const std::string& id, int index)
    {
        // bail out of we already have heard this...
        std::string infoId = JournalEntry::idFromIndex (id, index);
        for (TEntryIter i = mJournal.begin (); i != mJournal.end (); ++i)
            if (i->mTopic == id && i->mInfoId == infoId)
                return;

        StampedJournalEntry entry = StampedJournalEntry::makeFromQuest (id, index);

        mJournal.push_back (entry);

        Quest& quest = getQuest (id);

        quest.addEntry (entry); // we are doing slicing on purpose here

        MWBase::Environment::get().getWindowManager()->messageBox ("#{sJournalEntry}");
    }
Ejemplo n.º 7
0
    void Journal::readRecord (ESM::ESMReader& reader, uint32_t type)
    {
        if (type==ESM::REC_JOUR || type==ESM::REC_JOUR_LEGACY)
        {
            ESM::JournalEntry record;
            record.load (reader);

            if (isThere (record.mTopic, record.mInfo))
                switch (record.mType)
                {
                    case ESM::JournalEntry::Type_Quest:

                        getQuest (record.mTopic).insertEntry (record);
                        break;

                    case ESM::JournalEntry::Type_Journal:

                        mJournal.push_back (record);
                        break;

                    case ESM::JournalEntry::Type_Topic:

                        getTopic (record.mTopic).insertEntry (record);
                        break;
                }
        }
        else if (type==ESM::REC_QUES)
        {
            ESM::QuestState record;
            record.load (reader);

            if (isThere (record.mTopic))
            {
                std::pair<TQuestContainer::iterator, bool> result = mQuests.insert (std::make_pair (record.mTopic, record));
                // reapply quest index, this is to handle users upgrading from only
                // Morrowind.esm (no quest states) to Morrowind.esm + Tribunal.esm
                result.first->second.setIndex(record.mState);
            }
        }
    }
Ejemplo n.º 8
0
void game_hub::gameLoop()
{
	startGame();
	bool in_town = true;
	while (in_town)
	{
		printf("Hub Town\n");
		printf("----------------------\n");
		int hub_sel = getSel("1. Free Exploration", "2. Marketplace",
									"3. Quest Hall", "4. Inn", "5. Home",
									"6. Open Menu", "7. Quit");
		switch (hub_sel)
		{
			case 1://Free Exploration
			{
				areaMenu();	
				break;
			}
			case 2://Marketplace
			{
				shopMenu();
//				Shops[0]->enterShop(Team);
				break;
			}
			case 3://Quest Hall
			{
				Hall->enterQuestHall(Team);
				break;
				//--------------------------------------------
				printf("Welcome to the quest hall, what would you like to do?\n");
				int sel = getSel("1. Recruit new party member", "2. Take Quest",
									  "3. Leave");
				if (sel == 1)
				{
					printf("\n");
					int sel_c = getSel("1. Make new player", "2. Make random player",
											 "3. Cancel action");
					switch(sel_c)
					{
						case 1:
						{
							player *player_n = getNewPlayer();
							player *test;
							test = Team->recievePlayer(player_n);
							if (test != NULL)
								delete test;
							break;
						}
						case 2:
						{
							printf("**DEBUG** Generating random party member...\n");
							player *random = getRandomPlayer();
							player *test;
							test = Team->recievePlayer(random);
							if (test != NULL)
								delete test;
							break;
						}
/*
						case 3:
						{
							quest *temp = getQuest(1);
							printf("Accept quest: '%s'?\n", temp->getName());
							int sel = getSel("1. Yes", "2. No");
							if (sel == 1)
							{
								Team->acceptQuest(temp);
							}
							else
							{
								printf("Did not accept '%s'...\n", temp->getName());
								delete temp;
							}
							break;
						}
*/
						case 3:
						{
							printf("Cancelling action...\n");
							break;
						}
					}
				}
				else if (sel == 2)
				{
					quest *temp = getQuest(1);
					printf("Accept quest: '%s'?\n", temp->getName());
					int sel = getSel("1. Yes", "2. No");
					if (sel == 1)
					{
						Team->acceptQuest(temp);
					}
					else
					{
						printf("Did not accept '%s'...\n", temp->getName());
						delete temp;
					}
				}
				else
					printf("Leaving quest hall...\n");
				break;
			}
			case 4://Inn
			{
				Inn->enterInn(Team);
				break;
			}
			case 5://Home
			{
				Home->enterHome(Team);
				break;
			}
			case 6://Open Menu
			{
				hubMenu();
				break;
			}
			case 7:
			{
				printf("Are you sure you want to quit?\n");
				int sel = getSel("1. Yes", "2. No");
				if (sel == 1)
					in_town = false;
				else
					printf("Cancelling action...\n");
				break;
			}	
		}
		if (Team->checkGameOver())
        {
            printf("Game Over...");
			in_town = false;	
        }

	}	
}
Ejemplo n.º 9
0
    void Journal::setJournalIndex (const std::string& id, int index)
    {
        Quest& quest = getQuest (id);

        quest.setIndex (index, *mEnvironment.mWorld);
    }
Ejemplo n.º 10
0
    void Journal::setJournalIndex (const std::string& id, int index)
    {
        Quest& quest = getQuest (id);

        quest.setIndex (index);
    }
Ejemplo n.º 11
0
Quest* QuestBook::getQuest(const CeGuiString& id)
{
	return getQuest(mRootQuest, id);
}
Ejemplo n.º 12
0
void UQuestManager::activate(FString questID) {
	UBlueprintQuest* quest = getQuest(questID);

	quest->activate();
}