public void AddQuestBlueprint(QuestBlueprint blueprint) { if (_questBlueprints.ContainsKey(blueprint.Id)) { Log.Default.WriteLine(LogLevels.Error, $"Quest blueprint duplicate {blueprint.Id}!!!"); } else { _questBlueprints.Add(blueprint.Id, blueprint); } }
public Quest(QuestBlueprint blueprint, ICharacter character, ICharacter giver) { _character = character; Blueprint = blueprint; Giver = giver; _killObjectivesKilled = blueprint.KillObjectives?.ToDictionary(x => x.CharacterBlueprintId, x => 0); _objectives = new List <QuestObjectiveBase>(); if (Blueprint.ItemObjectives != null) { foreach (QuestItemObjective itemObjective in Blueprint.ItemObjectives) { ItemBlueprintBase itemBlueprint = Repository.World.GetItemBlueprint(itemObjective.ItemBlueprintId); if (itemBlueprint != null) { _objectives.Add(new ItemQuestObjective { Blueprint = itemBlueprint, Count = character.Content.Where(x => x.Blueprint != null).Count(x => x.Blueprint.Id == itemObjective.ItemBlueprintId), // should always be 0 Total = itemObjective.Count }); } else { Log.Default.WriteLine(LogLevels.Warning, $"Item objective {itemObjective.ItemBlueprintId} doesn't exist for quest {blueprint.Id}"); } } } if (Blueprint.KillObjectives != null) { foreach (QuestKillObjective killObjective in Blueprint.KillObjectives) { CharacterBlueprint characterBlueprint = Repository.World.GetCharacterBlueprint(killObjective.CharacterBlueprintId); if (characterBlueprint != null) { _objectives.Add(new KillQuestObjective { Blueprint = characterBlueprint, Count = 0, Total = killObjective.Count }); } else { Log.Default.WriteLine(LogLevels.Warning, $"Item objective {killObjective.CharacterBlueprintId} doesn't exist for quest {blueprint.Id}"); } } } }
public void AddQuestBlueprint(QuestBlueprint blueprint) { throw new NotImplementedException(); }
public Quest(QuestBlueprint blueprint, ICharacter character, ICharacter giver) { _character = character; Blueprint = blueprint; Giver = giver; _objectives = new List <QuestObjectiveBase>(); if (Blueprint.ItemObjectives != null) { foreach (QuestItemObjectiveBlueprint itemObjective in Blueprint.ItemObjectives) { if (DependencyContainer.Instance.GetInstance <IWorld>().GetItemBlueprint(itemObjective.ItemBlueprintId) is ItemQuestBlueprint itemBlueprint) { _objectives.Add(new ItemQuestObjective { Blueprint = itemBlueprint, Count = character.Content.Where(x => x.Blueprint != null).Count(x => x.Blueprint.Id == itemObjective.ItemBlueprintId), // should always be 0 Total = itemObjective.Count }); } else { Log.Default.WriteLine(LogLevels.Warning, $"Loot objective {itemObjective.ItemBlueprintId} doesn't exist (or is not quest item) for quest {blueprint.Id}"); } } } if (Blueprint.KillObjectives != null) { foreach (QuestKillObjectiveBlueprint killObjective in Blueprint.KillObjectives) { CharacterBlueprint characterBlueprint = DependencyContainer.Instance.GetInstance <IWorld>().GetCharacterBlueprint(killObjective.CharacterBlueprintId); if (characterBlueprint != null) { _objectives.Add(new KillQuestObjective { Blueprint = characterBlueprint, Count = 0, Total = killObjective.Count }); } else { Log.Default.WriteLine(LogLevels.Warning, $"Kill objective {killObjective.CharacterBlueprintId} doesn't exist for quest {blueprint.Id}"); } } } if (Blueprint.LocationObjectives != null) { foreach (QuestLocationObjectiveBlueprint locationObjective in Blueprint.LocationObjectives) { RoomBlueprint roomBlueprint = DependencyContainer.Instance.GetInstance <IWorld>().GetRoomBlueprint(locationObjective.RoomBlueprintId); if (roomBlueprint != null) { _objectives.Add(new LocationQuestObjective { Blueprint = roomBlueprint, Explored = character.Room?.Blueprint?.Id == roomBlueprint.Id }); } else { Log.Default.WriteLine(LogLevels.Warning, $"Location objective {locationObjective.RoomBlueprintId} doesn't exist for quest {blueprint.Id}"); } } } }