Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public void OfferQuest(QuestOffer offer)
        {
            if (!offer.QuestName.Contains('@'))
            {
                offer.QuestName = $"{offer.QuestName}@{this.ModUid}";
            }

            this.QuestOfferManager.AddOffer(offer);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 5
0
 public static QuestOffer <JObject> TranslateOffer(ITranslationHelper translation, QuestOffer <JObject> offer)
 {
     return(Translate(translation, JObject.FromObject(offer))
            .ToObject <QuestOffer <JObject> >());
 }