Пример #1
0
        public static async Task <bool> TakeReward()
        {
            if (World.Act6.LioneyeWatch.IsCurrentArea)
            {
                await _townLilly.Position.ComeAtOnce();

                if (_townLilly.NpcObject == null)
                {
                    if (_townLilly == TownNpcs.LillyRoth)
                    {
                        GlobalLog.Error("[FallenFromGrace] Unknown error. There is no Lilly Roth.");
                        ErrorManager.ReportCriticalError();
                        return(true);
                    }
                    GlobalLog.Warn("[FallenFromGrace] There is no Lilly Roth near ship. Now going to her default position.");
                    _townLilly = TownNpcs.LillyRoth;
                    return(true);
                }

                return(await Helpers.TakeQuestReward(
                           World.Act6.LioneyeWatch,
                           _townLilly,
                           "Twilight Strand Reward",
                           book : QuestItemMetadata.BookFallenFromGrace));
            }
            await Travel.To(World.Act6.LioneyeWatch);

            return(true);
        }
 //action to execute if the player press the action button
 void ExecuteAction()
 {
     if (actualShopNpc != null && Vector3.Distance(actualShopNpc.transform.position, transform.position) < actualShopNpc.interactDistance)
     {
         actualShopNpc.Interact();
     }
     else if (actualTownNpc != null && Vector3.Distance(actualTownNpc.transform.position, transform.position) < actualTownNpc.talkDistance)
     {
         actualTownNpc.NPCPushTalk();
     }
     else if (actualEnterBuilding != null && Vector3.Distance(actualEnterBuilding.transform.position, transform.position) < actualEnterBuilding.detectionDistance)
     {
         actualEnterBuilding.Execute();
     }
     else if (actualExitLocation != null && Vector3.Distance(actualExitLocation.transform.position, transform.position) < actualExitLocation.detectionDistance)
     {
         actualExitLocation.Execute();
     }
     else
     {
         actualShopNpc       = null;
         actualTownNpc       = null;
         actualEnterBuilding = null;
         actualExitLocation  = null;
     }
 }
Пример #3
0
        public static async Task <bool> TakeQuestReward(AreaInfo area, TownNpc npc, string dialog, string questId = null, string book = null)
        {
            if (area.IsCurrentArea)
            {
                if (book != null && PlayerHasQuestItem(book))
                {
                    if (!await UseQuestItem(book))
                    {
                        ErrorManager.ReportError();
                    }
                }
                else
                {
                    var reward = questId != null?Settings.Instance.GetRewardForQuest(questId) : null;

                    if (!await npc.TakeReward(reward, dialog))
                    {
                        ErrorManager.ReportError();
                    }
                }
                return(false);
            }
            await Travel.To(area);

            return(true);
        }
 public void SetNpc(TownNpc npc)
 {
     actualTownNpc = npc;
 }