Ejemplo n.º 1
0
//=================================================================================================
cstring Quest_Goblins::FormatString(const string& str)
{
	if(str == "target_loc")
		return GetTargetLocationName();
	else if(str == "target_dir")
		return GetTargetLocationDir();
	else if(str == "start_loc")
		return GetStartLocationName();
	else
	{
		assert(0);
		return nullptr;
	}
}
Ejemplo n.º 2
0
//=================================================================================================
cstring Quest_Orcs::FormatString(const string& str)
{
	if(str == "target_loc")
		return GetTargetLocationName();
	else if(str == "target_dir")
		return GetTargetLocationDir();
	else if(str == "naszego_miasta")
		return LocationHelper::IsCity(GetStartLocation()) ? game->txQuest[72] : game->txQuest[73];
	else
	{
		assert(0);
		return nullptr;
	}
}
Ejemplo n.º 3
0
//=================================================================================================
void Quest_Orcs::SetProgress(int prog2)
{
	switch(prog2)
	{
	case Progress::TalkedWithGuard:
		{
			if(prog != Progress::None)
				return;
			if(QM.RemoveQuestRumor(R_ORCS))
				game->gui->journal->AddRumor(Format(game->txQuest[189], GetStartLocationName()));
			QM.quest_orcs2->orcs_state = Quest_Orcs2::State::GuardTalked;
		}
		break;
	case Progress::NotAccepted:
		{
			if(QM.RemoveQuestRumor(R_ORCS))
				game->gui->journal->AddRumor(Format(game->txQuest[190], GetStartLocationName()));
			// mark guard to remove
			Unit*& u = QM.quest_orcs2->guard;
			if(u)
			{
				u->auto_talk = AutoTalkMode::No;
				u->temporary = true;
				u = nullptr;
			}
			QM.quest_orcs2->orcs_state = Quest_Orcs2::State::GuardTalked;
		}
		break;
	case Progress::Started:
		{
			OnStart(game->txQuest[191]);
			// remove rumor from pool
			QM.RemoveQuestRumor(R_ORCS);
			// mark guard to remove
			Unit*& u = QM.quest_orcs2->guard;
			if(u)
			{
				u->auto_talk = AutoTalkMode::No;
				u->temporary = true;
				u = nullptr;
			}
			// generate location
			Location& tl = *W.CreateLocation(L_DUNGEON, GetStartLocation().pos, 64.f, HUMAN_FORT, SG_ORCS, false);
			tl.SetKnown();
			tl.st = 8;
			tl.active_quest = this;
			target_loc = tl.index;
			location_event_handler = this;
			at_level = tl.GetLastLevel();
			dungeon_levels = at_level + 1;
			levels_cleared = 0;
			whole_location_event_handler = true;
			item_to_give[0] = Item::Get("q_orkowie_klucz");
			spawn_item = Quest_Event::Item_GiveSpawned2;
			unit_to_spawn = UnitData::Get("q_orkowie_gorush");
			spawn_unit_room = RoomTarget::Prison;
			unit_dont_attack = true;
			unit_to_spawn2 = g_spawn_groups[SG_ORCS].GetSpawnLeader(10);
			unit_spawn_level2 = -3;
			QM.quest_orcs2->orcs_state = Quest_Orcs2::State::Accepted;
			// questowe rzeczy
			msgs.push_back(Format(game->txQuest[192], GetStartLocationName(), W.GetDate()));
			msgs.push_back(Format(game->txQuest[193], GetStartLocationName(), GetTargetLocationName(), GetTargetLocationDir()));
		}
		break;
	case Progress::ClearedLocation:
		// oczyszczono lokacjê
		{
			OnUpdate(Format(game->txQuest[194], GetTargetLocationName(), GetStartLocationName()));
		}
		break;
	case Progress::Finished:
		// ukoñczono - nagroda
		{
			state = Quest::Completed;

			Team.AddReward(4000, 12000);
			OnUpdate(game->txQuest[195]);
			W.AddNews(Format(game->txQuest[196], GetTargetLocationName(), GetStartLocationName()));

			if(QM.quest_orcs2->orcs_state == Quest_Orcs2::State::OrcJoined)
			{
				QM.quest_orcs2->orcs_state = Quest_Orcs2::State::CompletedJoined;
				QM.quest_orcs2->days = Random(30, 60);
				GetTargetLocation().active_quest = nullptr;
				target_loc = -1;
			}
			else
				QM.quest_orcs2->orcs_state = Quest_Orcs2::State::Completed;
		}
		break;
	}

	prog = prog2;
}
Ejemplo n.º 4
0
//=================================================================================================
void Quest_Goblins::SetProgress(int prog2)
{
	prog = prog2;
	switch(prog2)
	{
	case Progress::NotAccepted:
		// nie zaakceptowano
		{
			if(QM.RemoveQuestRumor(R_GOBLINS))
				game->gui->journal->AddRumor(Format(game->txQuest[211], GetStartLocationName()));
		}
		break;
	case Progress::Started:
		// zaakceptowano
		{
			OnStart(game->txQuest[212]);
			// usuñ plotkê
			QM.RemoveQuestRumor(R_GOBLINS);
			// dodaj lokalizacje
			target_loc = W.GetNearestLocation(GetStartLocation().pos, 1 << L_FOREST, true);
			Location& target = GetTargetLocation();
			target.SetKnown();
			target.reset = true;
			target.active_quest = this;
			target.st = 7;
			spawn_item = Quest_Event::Item_OnGround;
			item_to_give[0] = Item::Get("q_gobliny_luk");
			// questowe rzeczy
			msgs.push_back(Format(game->txQuest[217], GetStartLocationName(), W.GetDate()));
			msgs.push_back(Format(game->txQuest[218], GetTargetLocationName(), GetTargetLocationDir()));
			// encounter
			Encounter* e = W.AddEncounter(enc);
			e->check_func = CzyMajaStaryLuk;
			e->dialog = GameDialog::TryGet("q_goblins_encounter");
			e->dont_attack = true;
			e->group = SG_GOBLINS;
			e->location_event_handler = nullptr;
			e->pos = GetStartLocation().pos;
			e->quest = static_cast<Quest*>(this);
			e->chance = 10000;
			e->range = 32.f;
			e->text = game->txQuest[219];
			e->timed = false;
			e->st = 6;
		}
		break;
	case Progress::BowStolen:
		// gobliny ukrad³y ³uk
		{
			Team.RemoveQuestItem(Item::Get("q_gobliny_luk"));
			OnUpdate(game->txQuest[220]);
			W.RemoveEncounter(enc);
			enc = -1;
			GetTargetLocation().active_quest = nullptr;
			W.AddNews(game->txQuest[221]);
			Team.AddExp(1000);
		}
		break;
	case Progress::TalkedAboutStolenBow:
		// poinformowano o kradzie¿y
		{
			state = Quest::Failed;
			OnUpdate(game->txQuest[222]);
			goblins_state = State::Counting;
			days = Random(15, 30);
		}
		break;
	case Progress::InfoAboutGoblinBase:
		// pos³aniec dostarczy³ info o bazie goblinów
		{
			state = Quest::Started;
			target_loc = W.GetRandomSpawnLocation(GetStartLocation().pos, SG_GOBLINS);
			Location& target = GetTargetLocation();
			target.state = LS_KNOWN;
			target.st = 10;
			target.reset = true;
			target.active_quest = this;
			done = false;
			spawn_item = Quest_Event::Item_GiveSpawned;
			unit_to_spawn = g_spawn_groups[SG_GOBLINS].GetSpawnLeader(11);
			unit_spawn_level = -3;
			item_to_give[0] = Item::Get("q_gobliny_luk");
			at_level = target.GetLastLevel();
			OnUpdate(Format(game->txQuest[223], target.name.c_str(), GetTargetLocationDir(), GetStartLocationName()));
			goblins_state = State::MessengerTalked;
		}
		break;
	case Progress::GivenBow:
		// oddano ³uk
		{
			state = Quest::Completed;
			const Item* item = Item::Get("q_gobliny_luk");
			DialogContext::current->pc->unit->RemoveItem(item, 1);
			DialogContext::current->talker->AddItem(item, 1, true);
			Team.AddReward(500, 2500);
			OnUpdate(game->txQuest[224]);
			goblins_state = State::GivenBow;
			GetTargetLocation().active_quest = nullptr;
			target_loc = -1;
			W.AddNews(game->txQuest[225]);
		}
		break;
	case Progress::DidntTalkedAboutBow:
		// nie chcia³eœ powiedzieæ o ³uku
		{
			OnUpdate(game->txQuest[226]);
			goblins_state = State::MageTalkedStart;
		}
		break;
	case Progress::TalkedAboutBow:
		// powiedzia³eœ o ³uku
		{
			state = Quest::Started;
			OnUpdate(game->txQuest[227]);
			goblins_state = State::MageTalked;
		}
		break;
	case Progress::PayedAndTalkedAboutBow:
		// zap³aci³eœ i powiedzia³eœ o ³uku
		{
			DialogContext::current->pc->unit->ModGold(-100);

			state = Quest::Started;
			OnUpdate(game->txQuest[228]);
			goblins_state = State::MageTalked;
		}
		break;
	case Progress::TalkedWithInnkeeper:
		// pogadano z karczmarzem
		{
			goblins_state = State::KnownLocation;
			Location& target = *W.CreateLocation(L_DUNGEON, W.GetWorldPos(), 128.f, THRONE_FORT, SG_GOBLINS, false);
			target.st = 12;
			target.SetKnown();
			target.active_quest = this;
			target_loc = target.index;
			done = false;
			unit_to_spawn = UnitData::Get("q_gobliny_szlachcic2");
			spawn_unit_room = RoomTarget::Throne;
			callback = DodajStraznikow;
			unit_dont_attack = true;
			unit_auto_talk = true;
			unit_event_handler = this;
			item_to_give[0] = nullptr;
			spawn_item = Quest_Event::Item_DontSpawn;
			at_level = target.GetLastLevel();
			OnUpdate(Format(game->txQuest[229], target.name.c_str(), GetTargetLocationDir(), GetStartLocationName()));
		}
		break;
	case Progress::KilledBoss:
		// zabito szlachcica
		{
			state = Quest::Completed;
			OnUpdate(game->txQuest[230]);
			GetTargetLocation().active_quest = nullptr;
			QM.EndUniqueQuest();
			W.AddNews(game->txQuest[231]);
			Team.AddLearningPoint();
			Team.AddExp(15000);
		}
		break;
	}
}