コード例 #1
0
        public bool TryOfferNpcQuest(NPC npc, out QuestOffer <NpcOfferAttributes> offer)
        {
            offer = this.QuestOffers.FirstOrDefault(o => o.OfferDetails.NpcName == npc.Name);

            this.RefreshActiveIndicators();
            return(offer != null);
        }
コード例 #2
0
        public void OfferQuest(QuestOffer offer)
        {
            if (!offer.QuestName.Contains('@'))
            {
                offer.QuestName = $"{offer.QuestName}@{this.ModUid}";
            }

            this.QuestOfferManager.AddOffer(offer);
        }
コード例 #3
0
        public void AddOffer(QuestOffer schedule)
        {
            if (QuestFrameworkMod.Instance.Status < State.LAUNCHING)
            {
                throw new InvalidOperationException($"Unable to add quest schedule in state `{QuestFrameworkMod.Instance.Status}`.");
            }

            this.Offers.Add(schedule);
            QuestFrameworkMod.InvalidateCache();
        }
コード例 #4
0
        private void OnQuestAccepted(object sender, QuestEventArgs e)
        {
            if (!e.IsManaged || this._npcQuestOffers.Value.Count == 0)
            {
                return;
            }

            CustomQuest quest = e.GetManagedQuest();
            QuestOffer <NpcOfferAttributes> offer = this.QuestOffers.FirstOrDefault(o => o.QuestName == quest.GetFullName());

            if (offer != null)
            {
                this.QuestOffers.Remove(offer);
                this.RefreshActiveIndicators();
            }
        }
コード例 #5
0
 public static QuestOffer <JObject> TranslateOffer(ITranslationHelper translation, QuestOffer <JObject> offer)
 {
     return(Translate(translation, JObject.FromObject(offer))
            .ToObject <QuestOffer <JObject> >());
 }