public override void Update(Task caller) { base.Update(caller); // Create SiteLink if not already present if (!QuestMachine.HasSiteLink(ParentQuest, placeSymbol)) { QuestMachine.CreateSiteLink(ParentQuest, placeSymbol); } // Attempt to get Foe resource Foe foe = ParentQuest.GetFoe(foeSymbol); if (foe == null) { SetComplete(); throw new Exception(string.Format("Could not find Foe resource symbol {0}", foeSymbol)); } // Attempt to get Place resource Place place = ParentQuest.GetPlace(placeSymbol); if (place == null) { SetComplete(); throw new Exception(string.Format("Could not find Place resource symbol {0}", placeSymbol)); } // Assign Foe to Place place.AssignQuestResource(foeSymbol, marker); SetComplete(); }
public override void Update(Task caller) { base.Update(caller); // Attempt to get Person resource Person person = ParentQuest.GetPerson(npcSymbol); if (person == null) { SetComplete(); throw new Exception(string.Format("Could not find Person resource symbol {0}", npcSymbol)); } // Assign Person to their own home Place (if any) bool result = person.PlaceAtHome(); if (result) { QuestMachine.LogFormat(ParentQuest, "CreateNpc automatically placed {0} [{1}] at '{2}/{3}' in building '{4}'", person.Symbol.Original, person.DisplayName, person.HomeRegionName, person.HomeTownName, person.HomeBuildingName); } else { QuestMachine.LogFormat(ParentQuest, "CreateNpc could not automatically place {0} [{1}] as they have no home Place generated", person.Symbol.Original, person.DisplayName); } SetComplete(); }
public override void Update(Task caller) { base.Update(caller); // Create SiteLink if not already present if (!QuestMachine.HasSiteLink(ParentQuest, placeSymbol)) { QuestMachine.CreateSiteLink(ParentQuest, placeSymbol); } // Attempt to get Item resource Item item = ParentQuest.GetItem(itemSymbol); if (item == null) { throw new Exception(string.Format("Could not find Item resource symbol {0}", itemSymbol)); } // Attempt to get Place resource Place place = ParentQuest.GetPlace(placeSymbol); if (place == null) { throw new Exception(string.Format("Could not find Place resource symbol {0}", placeSymbol)); } // Assign Item to Place place.AssignQuestResource(item.Symbol); SetComplete(); }
public override void Update(Task caller) { base.Update(caller); // Create SiteLink if not already present if (!QuestMachine.HasSiteLink(ParentQuest, placeSymbol)) { QuestMachine.CreateSiteLink(ParentQuest, placeSymbol); } // Attempt to get Person resource Person person = ParentQuest.GetPerson(npcSymbol); if (person == null) { SetComplete(); throw new Exception(string.Format("Could not find Person resource symbol {0}", npcSymbol)); } // Do nothing if Person is destroyed if (person.IsDestroyed) { SetComplete(); return; } // Attempt to get Place resource Place place = ParentQuest.GetPlace(placeSymbol); if (place == null) { SetComplete(); throw new Exception(string.Format("Could not find Place resource symbol {0}", placeSymbol)); } // Is target an individual NPC that is supposed to be at home // Daggerfall never seems to use "create npc at" or "place npc" for "athome" NPCs // Treating this as an error and logging as such, but don't throw an exception // Just log, terminate action, and get out of dodge if (person.IsIndividualNPC && person.IsIndividualAtHome) { Debug.LogErrorFormat("Quest tried to place Person {0} [_{1}_] at Place _{2}_ but they are supposed to be atHome", person.DisplayName, person.Symbol.Name, place.Symbol.Name); SetComplete(); return; } // Assign Person to Place place.AssignQuestResource(person.Symbol, marker); person.SetAssignedPlaceSymbol(placeSymbol); // Person is also unhidden when placed person.IsHidden = false; TalkManager.Instance.ForceTopicListsUpdate(); SetComplete(); }
public QuestMachineInspectorWindow(IUserInterfaceManager uiManager, DaggerfallBaseWindow previous = null, int screenWidth = 640, int screenHeight = 400) : base(uiManager, previous, screenWidth, screenHeight) { // Get reference to questmachine questMachine = QuestMachine.Instance; if (!questMachine) { throw new Exception("QuestMachine instance not found in scene."); } }
public override void Update(Task caller) { base.Update(caller); // Reserve SiteLink for Place resource // This will also be done automatically by "place npc", "place foe", etc. if (!QuestMachine.HasSiteLink(ParentQuest, placeSymbol)) { QuestMachine.CreateSiteLink(ParentQuest, placeSymbol); } // Possible historical note: // Many quests are very strict about first reserving a site using "create npc at" // before placing a quest resource like an NPC, Foe, Item at that site. // More developed quests (e.g. guild quests) don't seem to have this requirement. // One likely reason is that quest writers would commonly forget to reserve the site first, // leading to developers making this a more automated process down the track. // Daggerfall Unity will create a SiteLink either way to support both formats. SetComplete(); }
public static void InitMod(bool bedSleeping, bool archery, bool riding, bool encumbrance, bool bandaging, bool shipPorts, bool expulsion, bool climbing, bool weaponSpeed, bool weaponMaterials, bool equipDamage, bool enemyAppearance, bool purifyPot, bool autoExtinguishLight, bool classicStrDmgBonus, bool variantNpcs) { Debug.Log("Begin mod init: RoleplayRealism"); Mod rrItemsMod = ModManager.Instance.GetMod("RoleplayRealismItems"); ModSettings rrItemsSettings = rrItemsMod != null?rrItemsMod.GetSettings() : null; if (bedSleeping) { PlayerActivate.RegisterCustomActivation(mod, 41000, BedActivation); PlayerActivate.RegisterCustomActivation(mod, 41001, BedActivation); PlayerActivate.RegisterCustomActivation(mod, 41002, BedActivation); } if (archery) { // Override adjust to hit and damage formulas FormulaHelper.RegisterOverride(mod, "AdjustWeaponHitChanceMod", (Func <DaggerfallEntity, DaggerfallEntity, int, int, DaggerfallUnityItem, int>)AdjustWeaponHitChanceMod); FormulaHelper.RegisterOverride(mod, "AdjustWeaponAttackDamage", (Func <DaggerfallEntity, DaggerfallEntity, int, int, DaggerfallUnityItem, int>)AdjustWeaponAttackDamage); } if (riding) { GameObject playerAdvGO = GameObject.Find("PlayerAdvanced"); if (playerAdvGO) { EnhancedRiding enhancedRiding = playerAdvGO.AddComponent <EnhancedRiding>(); if (enhancedRiding != null) { enhancedRiding.RealisticMovement = mod.GetSettings().GetBool("EnhancedRiding", "RealisticMovement"); enhancedRiding.TerrainFollowing = mod.GetSettings().GetBool("EnhancedRiding", "followTerrainEnabled"); enhancedRiding.SetFollowTerrainSoftenFactor(mod.GetSettings().GetInt("EnhancedRiding", "followTerrainSoftenFactor")); } } } if (encumbrance) { EntityEffectBroker.OnNewMagicRound += EncumbranceEffects_OnNewMagicRound; } if (rrItemsMod == null && bandaging) { DaggerfallUnity.Instance.ItemHelper.RegisterItemUseHandler((int)UselessItems2.Bandage, UseBandage); } if (shipPorts) { GameManager.Instance.TransportManager.ShipAvailiable = IsShipAvailiable; } if (expulsion) { // Register the TG/DB Guild classes if (!GuildManager.RegisterCustomGuild(FactionFile.GuildGroups.GeneralPopulace, typeof(ThievesGuildRR))) { throw new Exception("GuildGroup GeneralPopulace is already overridden, unable to register ThievesGuildRR guild class."); } if (!GuildManager.RegisterCustomGuild(FactionFile.GuildGroups.DarkBrotherHood, typeof(DarkBrotherhoodRR))) { throw new Exception("GuildGroup DarkBrotherHood is already overridden, unable to register DarkBrotherhoodRR guild class."); } } if (climbing) { FormulaHelper.RegisterOverride(mod, "CalculateClimbingChance", (Func <PlayerEntity, int, int>)CalculateClimbingChance); } if (weaponSpeed && (rrItemsSettings == null || !rrItemsSettings.GetBool("Modules", "weaponBalance"))) { FormulaHelper.RegisterOverride(mod, "GetMeleeWeaponAnimTime", (Func <PlayerEntity, WeaponTypes, ItemHands, float>)GetMeleeWeaponAnimTime); } if (weaponMaterials) { FormulaHelper.RegisterOverride(mod, "CalculateWeaponToHit", (Func <DaggerfallUnityItem, int>)CalculateWeaponToHit); } if (equipDamage) { FormulaHelper.RegisterOverride(mod, "ApplyConditionDamageThroughPhysicalHit", (Func <DaggerfallUnityItem, DaggerfallEntity, int, bool>)ApplyConditionDamageThroughPhysicalHit); } if (enemyAppearance) { UpdateEnemyClassAppearances(); } if (purifyPot) { GameManager.Instance.EntityEffectBroker.RegisterEffectTemplate(new CureDiseaseRR(), true); } if (autoExtinguishLight) { PlayerEnterExit.OnTransitionDungeonExterior += OnTransitionToDungeonExterior_ExtinguishLight; } if (classicStrDmgBonus) { FormulaHelper.RegisterOverride(mod, "DamageModifier", (Func <int, int>)DamageModifier_classicDisplay); } if (variantNpcs) { PlayerEnterExit.OnTransitionInterior += OnTransitionToInterior_VariantNPCsprites; } // Initialise the FG master quest. if (!QuestListsManager.RegisterQuestList("RoleplayRealism")) { throw new Exception("Quest list name is already in use, unable to register RoleplayRealism quest list."); } RegisterFactionIds(); // Add additional data into the quest machine for the quests QuestMachine questMachine = GameManager.Instance.QuestMachine; questMachine.PlacesTable.AddIntoTable(placesTable); questMachine.FactionsTable.AddIntoTable(factionsTable); // Register the custom armor service Services.RegisterMerchantService(1022, CustomArmorService, "Custom Armor"); Debug.Log("Finished mod init: RoleplayRealism"); }
public static void InitMod(bool bedSleeping, bool archery, bool riding, bool encumbrance, bool bandaging, bool shipPorts, bool expulsion, bool climbing, bool weaponSpeed, bool equipDamage) { Debug.Log("Begin mod init: RoleplayRealism"); if (bedSleeping) { PlayerActivate.RegisterModelActivation(41000, BedActivation); PlayerActivate.RegisterModelActivation(41001, BedActivation); PlayerActivate.RegisterModelActivation(41002, BedActivation); } if (archery) { // Override adjust to hit and damage formulas FormulaHelper.RegisterOverride(mod, "AdjustWeaponHitChanceMod", (Func <DaggerfallEntity, DaggerfallEntity, int, int, DaggerfallUnityItem, int>)AdjustWeaponHitChanceMod); FormulaHelper.RegisterOverride(mod, "AdjustWeaponAttackDamage", (Func <DaggerfallEntity, DaggerfallEntity, int, int, DaggerfallUnityItem, int>)AdjustWeaponAttackDamage); } if (riding) { GameObject playerAdvGO = GameObject.Find("PlayerAdvanced"); if (playerAdvGO) { EnhancedRiding enhancedRiding = playerAdvGO.AddComponent <EnhancedRiding>(); if (enhancedRiding != null) { enhancedRiding.TerrainFollowing = mod.GetSettings().GetBool("EnhancedRiding", "followTerrainEnabled"); enhancedRiding.SetFollowTerrainSoftenFactor(mod.GetSettings().GetInt("EnhancedRiding", "followTerrainSoftenFactor")); } } } if (encumbrance) { EntityEffectBroker.OnNewMagicRound += EncumbranceEffects_OnNewMagicRound; } Mod lootRealism = ModManager.Instance.GetMod("LootRealism"); if (lootRealism == null && bandaging) { if (!DaggerfallUnity.Instance.ItemHelper.RegisterItemUseHander((int)UselessItems2.Bandage, UseBandage)) { Debug.LogWarning("RoleplayRealism: Unable to register bandage use handler."); } } if (shipPorts) { GameManager.Instance.TransportManager.ShipAvailiable = IsShipAvailiable; } if (expulsion) { // Register the TG/DB Guild classes if (!GuildManager.RegisterCustomGuild(FactionFile.GuildGroups.GeneralPopulace, typeof(ThievesGuildRR))) { throw new Exception("GuildGroup GeneralPopulace is already overridden, unable to register ThievesGuildRR guild class."); } if (!GuildManager.RegisterCustomGuild(FactionFile.GuildGroups.DarkBrotherHood, typeof(DarkBrotherhoodRR))) { throw new Exception("GuildGroup DarkBrotherHood is already overridden, unable to register DarkBrotherhoodRR guild class."); } } if (climbing) { FormulaHelper.RegisterOverride(mod, "CalculateClimbingChance", (Func <PlayerEntity, int, int>)CalculateClimbingChance); } if (weaponSpeed) { FormulaHelper.RegisterOverride(mod, "GetMeleeWeaponAnimTime", (Func <PlayerEntity, WeaponTypes, ItemHands, float>)GetMeleeWeaponAnimTime); } if (equipDamage) { FormulaHelper.RegisterOverride(mod, "ApplyConditionDamageThroughPhysicalHit", (Func <DaggerfallUnityItem, DaggerfallEntity, int, bool>)ApplyConditionDamageThroughPhysicalHit); } // Initialise the FG master quest. if (!QuestListsManager.RegisterQuestList("RoleplayRealism")) { throw new Exception("Quest list name is already in use, unable to register RoleplayRealism quest list."); } RegisterFactionIds(); // Add additional data into the quest machine for the quests QuestMachine questMachine = GameManager.Instance.QuestMachine; questMachine.PlacesTable.AddIntoTable(placesTable); questMachine.FactionsTable.AddIntoTable(factionsTable); // Register the custom armor service Services.RegisterMerchantService(1022, CustomArmorService, "Custom Armor"); Debug.Log("Finished mod init: RoleplayRealism"); }