示例#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);
        }
        public void OfferQuest(QuestOffer offer)
        {
            if (!offer.QuestName.Contains('@'))
            {
                offer.QuestName = $"{offer.QuestName}@{this.ModUid}";
            }

            this.QuestOfferManager.AddOffer(offer);
        }
        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> >());
 }