Example #1
0
        public override void Update(Task caller)
        {
            // Get related Location resource
            Place place = ParentQuest.GetPlace(placeSymbol);
            // Get related Person resource
            Person person = ParentQuest.GetPerson(npcSymbol);
            // Get related Item resource
            Item item = ParentQuest.GetItem(itemSymbol);

            string namePlace = "", namePerson = "", nameItem = "";

            // add dialog for resources
            if (place != null)
            {
                namePlace = place.SiteDetails.locationName;
                GameManager.Instance.TalkManager.AddDialogForQuestInfoResource(ParentQuest.UID, namePlace, TalkManager.QuestInfoResourceType.Location, false);
            }
            if (person != null)
            {
                namePerson = person.DisplayName;
                GameManager.Instance.TalkManager.AddDialogForQuestInfoResource(ParentQuest.UID, namePerson, TalkManager.QuestInfoResourceType.Person, false);
            }
            if (item != null)
            {
                nameItem = item.DaggerfallUnityItem.ItemName;
                GameManager.Instance.TalkManager.AddDialogForQuestInfoResource(ParentQuest.UID, nameItem, TalkManager.QuestInfoResourceType.Thing, false);
            }

            SetComplete();
        }
Example #2
0
        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();
        }
Example #3
0
        public override void Update(Task caller)
        {
            base.Update(caller);

            // Add related Person or Foe resource
            if (personSymbol != null && !string.IsNullOrEmpty(personSymbol.Name))
            {
                Person person = ParentQuest.GetPerson(personSymbol);
                if (person != null)
                {
                    DaggerfallUI.Instance.DaggerfallHUD.EscortingFaces.AddFace(person);
                }
            }
            else if (foeSymbol != null && !string.IsNullOrEmpty(foeSymbol.Name))
            {
                Foe foe = ParentQuest.GetFoe(foeSymbol);
                if (foe != null)
                {
                    DaggerfallUI.Instance.DaggerfallHUD.EscortingFaces.AddFace(foe);
                }
            }

            // Popup saying message
            if (sayingID != 0)
            {
                ParentQuest.ShowMessagePopup(sayingID);
            }

            SetComplete();
        }
Example #4
0
        public override bool CheckTrigger(Task caller)
        {
            // Always return true once owning Task is triggered
            // Another action will need to rearm/unset this task if another click is required
            // This seems to fit how classic works based on current observation
            if (caller.IsSet)
            {
                return(true);
            }

            // Get related Person resource
            Person person = ParentQuest.GetPerson(npcSymbol);

            if (person == null)
            {
                return(false);
            }

            // Check player clicked flag
            if (person.HasPlayerClicked)
            {
                person.RearmPlayerClick();
                return(true);
            }

            return(false);
        }
Example #5
0
        public override void Update(Task caller)
        {
            // Get related Location resource
            Place place = ParentQuest.GetPlace(placeSymbol);
            // Get related Person resource
            Person person = ParentQuest.GetPerson(npcSymbol);
            // Get related Item resource
            Item item = ParentQuest.GetItem(itemSymbol);

            // add dialog for resources
            if (place != null)
            {
                GameManager.Instance.TalkManager.AddDialogForQuestInfoResource(ParentQuest.UID, place.Symbol.Name, TalkManager.QuestInfoResourceType.Location, false);
            }
            if (person != null)
            {
                GameManager.Instance.TalkManager.AddDialogForQuestInfoResource(ParentQuest.UID, person.Symbol.Name, TalkManager.QuestInfoResourceType.Person, false);
            }
            if (item != null)
            {
                GameManager.Instance.TalkManager.AddDialogForQuestInfoResource(ParentQuest.UID, item.Symbol.Name, TalkManager.QuestInfoResourceType.Thing, false);
            }

            SetComplete();
        }
Example #6
0
        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();
        }
Example #7
0
        public override void Update(Task caller)
        {
            // Get related Location resource
            Place place = ParentQuest.GetPlace(placeSymbol);
            // Get related Person resource
            Person person = ParentQuest.GetPerson(npcSymbol);
            // Get related Item resource
            Item item = ParentQuest.GetItem(itemSymbol);

            string namePlace = "", namePerson = "", nameItem = "";

            // first create dialog link for just the separated resources (which will hide them)
            if (place != null)
            {
                /*
                 * namePlace = place.SiteDetails.buildingName; // use building name as default
                 * if (namePlace == null) // no building?
                 *  namePlace = place.SiteDetails.locationName; // use dungeon name
                 */
                GameManager.Instance.TalkManager.DialogLinkForQuestInfoResource(ParentQuest.UID, place.Symbol.Name, TalkManager.QuestInfoResourceType.Location);
            }
            if (person != null)
            {
                namePerson = person.DisplayName;
                GameManager.Instance.TalkManager.DialogLinkForQuestInfoResource(ParentQuest.UID, person.Symbol.Name, TalkManager.QuestInfoResourceType.Person);
            }
            if (item != null)
            {
                nameItem = item.DaggerfallUnityItem.ItemName;
                GameManager.Instance.TalkManager.DialogLinkForQuestInfoResource(ParentQuest.UID, item.Symbol.Name, TalkManager.QuestInfoResourceType.Thing);
            }

            // then create dialog links between the resources
            if ((place != null) && (person != null))
            {
                // register both links (location -> person as well as person -> location)
                GameManager.Instance.TalkManager.DialogLinkForQuestInfoResource(ParentQuest.UID, namePlace, TalkManager.QuestInfoResourceType.Location, namePerson, TalkManager.QuestInfoResourceType.Person);
                GameManager.Instance.TalkManager.DialogLinkForQuestInfoResource(ParentQuest.UID, namePerson, TalkManager.QuestInfoResourceType.Person, namePlace, TalkManager.QuestInfoResourceType.Location);
            }
            if ((place != null) && (item != null))
            {
                // register both links (location -> item as well as item -> location)
                GameManager.Instance.TalkManager.DialogLinkForQuestInfoResource(ParentQuest.UID, namePlace, TalkManager.QuestInfoResourceType.Location, nameItem, TalkManager.QuestInfoResourceType.Thing);
                GameManager.Instance.TalkManager.DialogLinkForQuestInfoResource(ParentQuest.UID, nameItem, TalkManager.QuestInfoResourceType.Thing, namePlace, TalkManager.QuestInfoResourceType.Location);
            }
            if ((person != null) && (item != null))
            {
                // register both links (person -> item as well as item -> person)
                GameManager.Instance.TalkManager.DialogLinkForQuestInfoResource(ParentQuest.UID, namePerson, TalkManager.QuestInfoResourceType.Person, nameItem, TalkManager.QuestInfoResourceType.Thing);
                GameManager.Instance.TalkManager.DialogLinkForQuestInfoResource(ParentQuest.UID, nameItem, TalkManager.QuestInfoResourceType.Thing, namePerson, TalkManager.QuestInfoResourceType.Person);
            }

            SetComplete();
        }
Example #8
0
        public override void Update(Task caller)
        {
            // Get related Location resource
            Place place = ParentQuest.GetPlace(placeSymbol);
            // Get related Person resource
            Person person = ParentQuest.GetPerson(npcSymbol);
            // Get related Item resource
            Item item = ParentQuest.GetItem(itemSymbol);

            string namePlace = "", namePerson = "", nameItem = "";

            // first create dialog link for just the separated resources (which will hide them)
            if (place != null)
            {
                namePlace = place.SiteDetails.locationName;
                if (namePlace == null)
                {
                    namePlace = place.Name; // workaround to prevent exception, TODO: correct name resolving for local houses/residences
                }
                GameManager.Instance.TalkManager.DialogLinkForQuestInfoResource(ParentQuest.UID, namePlace, TalkManager.QuestInfoResourceType.Location);
            }
            if (person != null)
            {
                namePerson = person.DisplayName;
                GameManager.Instance.TalkManager.DialogLinkForQuestInfoResource(ParentQuest.UID, namePerson, TalkManager.QuestInfoResourceType.Person);
            }
            if (item != null)
            {
                nameItem = item.DaggerfallUnityItem.ItemName;
                GameManager.Instance.TalkManager.DialogLinkForQuestInfoResource(ParentQuest.UID, nameItem, TalkManager.QuestInfoResourceType.Thing);
            }

            // then create dialog links between the resources
            if ((place != null) && (person != null))
            {
                // register both links (location -> person as well as person -> location)
                GameManager.Instance.TalkManager.DialogLinkForQuestInfoResource(ParentQuest.UID, namePlace, TalkManager.QuestInfoResourceType.Location, namePerson, TalkManager.QuestInfoResourceType.Person);
                GameManager.Instance.TalkManager.DialogLinkForQuestInfoResource(ParentQuest.UID, namePerson, TalkManager.QuestInfoResourceType.Person, namePlace, TalkManager.QuestInfoResourceType.Location);
            }
            if ((place != null) && (item != null))
            {
                // register both links (location -> item as well as item -> location)
                GameManager.Instance.TalkManager.DialogLinkForQuestInfoResource(ParentQuest.UID, namePlace, TalkManager.QuestInfoResourceType.Location, nameItem, TalkManager.QuestInfoResourceType.Thing);
                GameManager.Instance.TalkManager.DialogLinkForQuestInfoResource(ParentQuest.UID, nameItem, TalkManager.QuestInfoResourceType.Thing, namePlace, TalkManager.QuestInfoResourceType.Location);
            }
            if ((person != null) && (item != null))
            {
                // register both links (person -> item as well as item -> person)
                GameManager.Instance.TalkManager.DialogLinkForQuestInfoResource(ParentQuest.UID, namePerson, TalkManager.QuestInfoResourceType.Person, nameItem, TalkManager.QuestInfoResourceType.Thing);
                GameManager.Instance.TalkManager.DialogLinkForQuestInfoResource(ParentQuest.UID, nameItem, TalkManager.QuestInfoResourceType.Thing, namePerson, TalkManager.QuestInfoResourceType.Person);
            }

            SetComplete();
        }
Example #9
0
        public override bool CheckTrigger(Task caller)
        {
            // Always return true once owning Task is triggered
            // Another action will need to rearm/unset this task if another click is required
            // This seems to fit how classic works based on current observation
            if (caller.IsTriggered)
            {
                return(true);
            }

            // Get related Person resource
            Person person = ParentQuest.GetPerson(npcSymbol);

            if (person == null)
            {
                return(false);
            }

            // Check player clicked flag
            if (person.HasPlayerClicked)
            {
                // When a gold amount and task is specified, the player must have that amount of gold or another task is called
                if (goldAmount > 0 && taskSymbol != null && !string.IsNullOrEmpty(taskSymbol.Name))
                {
                    // Does player have enough gold?
                    if (GameManager.Instance.PlayerEntity.GoldPieces >= goldAmount)
                    {
                        // Then deduct gold and fire trigger
                        GameManager.Instance.PlayerEntity.GoldPieces -= goldAmount;
                    }
                    else
                    {
                        // Otherwise trigger secondary task and exit without firing trigger
                        ParentQuest.StartTask(taskSymbol);
                        return(false);
                    }
                }

                if (id != 0)
                {
                    ParentQuest.ShowMessagePopup(id);
                }

                // Rearm person click after current task
                ParentQuest.ScheduleClickRearm(person);

                return(true);
            }

            return(false);
        }
Example #10
0
        public override void RearmAction()
        {
            base.RearmAction();

            // Get related Person resource
            Person person = ParentQuest.GetPerson(npcSymbol);

            if (person == null)
            {
                SetComplete();
                return;
            }

            // Perform action changes
            person.IsMuted = false;
        }
Example #11
0
        public override void Update(Task caller)
        {
            // Get related Person resource
            Person person = ParentQuest.GetPerson(npcSymbol);

            if (person == null)
            {
                SetComplete();
                return;
            }

            // Perform action changes
            person.IsMuted = true;

            SetComplete();
        }
        public override void Update(Task caller)
        {
            // Get related Person resource
            Person person = ParentQuest.GetPerson(target);
            if (person == null)
            {
                // Stop if Person does not exist
                SetComplete();
                return;
            }

            // Change reputation with target
            GameManager.Instance.PlayerEntity.FactionData.ChangeReputation(person.FactionData.id, amount, true);

            SetComplete();
        }
Example #13
0
        public override void Update(Task caller)
        {
            base.Update(caller);

            // Get related Person resource
            Person person = ParentQuest.GetPerson(personSymbol);

            if (person == null)
            {
                return;
            }

            // Drop face from HUD
            DaggerfallUI.Instance.DaggerfallHUD.EscortingFaces.DropFace(person);

            SetComplete();
        }
Example #14
0
        public override void Update(Task caller)
        {
            base.Update(caller);

            // Get related Person resource
            Person person = ParentQuest.GetPerson(npcSymbol);

            if (person == null)
            {
                return;
            }

            // Restore this Person
            person.IsHidden = false;

            SetComplete();
        }
Example #15
0
        public override bool CheckTrigger(Task caller)
        {
            // Always return true once owning Task is triggered
            // Another action will need to rearm/unset this task if another click is required
            // This seems to fit how classic works based on current observation
            if (caller.IsTriggered)
            {
                return(true);
            }

            // Get related Person resource
            Person person = ParentQuest.GetPerson(npcSymbol);

            if (person == null)
            {
                return(false);
            }

            // Get related Item resource
            Item item = ParentQuest.GetItem(itemSymbol);

            if (item == null)
            {
                return(false);
            }

            // Check player clicked flag
            if (person.HasPlayerClicked)
            {
                // Check if player has item
                if (GameManager.Instance.PlayerEntity.Items.Contains(item))
                {
                    // Rearm person click after current task
                    ParentQuest.ScheduleClickRearm(person);

                    // Show message popup, remove item, return true on trigger
                    ParentQuest.ShowMessagePopup(id);
                    GameManager.Instance.PlayerEntity.ReleaseQuestItemForReoffer(item.DaggerfallUnityItem);
                    return(true);
                }
            }

            return(false);
        }
Example #16
0
        public override bool CheckTrigger(Task caller)
        {
            // Always return true once owning Task is triggered
            // Another action will need to rearm/unset this task if another click is required
            // This seems to fit how classic works based on current observation
            if (caller.IsTriggered)
            {
                return(true);
            }

            // Get related Person resource
            Person person = ParentQuest.GetPerson(npcSymbol);

            if (person == null)
            {
                return(false);
            }

            // Get related Item resource
            Item item = ParentQuest.GetItem(itemSymbol);

            if (item == null)
            {
                return(false);
            }

            // Check player clicked flag
            if (person.HasPlayerClicked)
            {
                //person.RearmPlayerClick();
                if (GameManager.Instance.PlayerEntity.Items.Contains(item))
                {
                    ParentQuest.ShowMessagePopup(id);
                    return(true);
                }
            }

            return(false);
        }
Example #17
0
        public override void Update(Task caller)
        {
            // Get related Person resource
            Person person = ParentQuest.GetPerson(npcSymbol);

            if (person == null)
            {
                return;
            }

            // Check faction with this NPC
            // Note: Believe this should be >= check despite name of action - to confirm
            if (GameManager.Instance.PlayerEntity.FactionData.GetReputation(person.FactionData.id) < minReputation)
            {
                return;
            }

            // Start target task
            ParentQuest.StartTask(taskSymbol);

            SetComplete();
        }
Example #18
0
        public override void Update(Task caller)
        {
            base.Update(caller);

            // Get related Person resource
            Person person = ParentQuest.GetPerson(personSymbol);

            if (person == null)
            {
                return;
            }

            // Add face to HUD
            DaggerfallUI.Instance.DaggerfallHUD.EscortingFaces.AddFace(person);

            // Popup saying message
            if (sayingID != 0)
            {
                ParentQuest.ShowMessagePopup(sayingID);
            }

            SetComplete();
        }
Example #19
0
        public override void Update(Task caller)
        {
            base.Update(caller);

            // Drop related Person or Foe resource
            if (personSymbol != null && !string.IsNullOrEmpty(personSymbol.Name))
            {
                Person person = ParentQuest.GetPerson(personSymbol);
                if (person != null)
                {
                    DaggerfallUI.Instance.DaggerfallHUD.EscortingFaces.DropFace(person);
                }
            }
            else if (foeSymbol != null && !string.IsNullOrEmpty(foeSymbol.Name))
            {
                Foe foe = ParentQuest.GetFoe(foeSymbol);
                if (foe != null)
                {
                    DaggerfallUI.Instance.DaggerfallHUD.EscortingFaces.DropFace(foe);
                }
            }

            SetComplete();
        }