Example #1
0
        private static bool ItemDeliveryQuestLoadPrefix(ref ItemDeliveryQuest __instance)
        {
            // pick random quest from loaded quests
            var quests = ModEntry.AddedQuests
                         .Where(q => q.Type == QuestType.ItemDelivery)
                         .ToList();

            var quest = quests[Game1.random.Next(quests.Count())];

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

            quest = ModEntry.ResolveQuestTextTags(quest);

            // don't set the quest title here otherwise it will be used in the questlog. we want to default title, 'Delivery', not the user submitted one in the quest log
            __instance.questDescription   = ModEntry.ConstructDescriptionString(quest);
            __instance.currentObjective   = quest.Objective;
            __instance.dailyQuest.Value   = true;
            __instance.daysLeft.Value     = quest.DaysToComplete;
            __instance.moneyReward.Value  = quest.MoneyReward;
            __instance.deliveryItem.Value = new Object(quest.DeliveryItem, 1);
            __instance.target.Value       = quest.Requester;

            return(false);
        }
Example #2
0
        public override void draw(SpriteBatch b)
        {
            // dark background
            b.Draw(
                texture: Game1.fadeToBlackRect,
                destinationRectangle: Game1.graphics.GraphicsDevice.Viewport.Bounds,
                color: Color.Black * 0.75f
                );

            // note background
            b.Draw(
                texture: NoteBackgroundTexture,
                position: new Vector2(this.xPositionOnScreen, this.yPositionOnScreen),
                sourceRectangle: new Rectangle(0, 0, NoteBackgroundTexture.Width, NoteBackgroundTexture.Height),
                color: Color.White,
                rotation: 0,
                origin: Vector2.Zero,
                scale: 4,
                effects: SpriteEffects.None,
                layerDepth: 1
                );

            // quest title
            string questTitle = Game1.parseText(
                text: Quest.Title,
                whichFont: Game1.dialogueFont,
                width: 640
                );

            Utility.drawTextWithColoredShadow(
                b: b,
                text: questTitle,
                font: Game1.dialogueFont,
                position: new Vector2(this.xPositionOnScreen + NoteBackgroundTexture.Width / 2 * 4 - QuestTitleTextDimensions.X / 2 * 1.5f, this.yPositionOnScreen + 64),
                color: Game1.textColor,
                scale: 1.5f,
                shadowColor: new Color(151, 151, 151)
                );

            // quest description
            string questDescription = Game1.parseText(
                text: ModEntry.ConstructDescriptionString(Quest),
                whichFont: Game1.dialogueFont,
                width: 500
                );

            Utility.drawTextWithColoredShadow(
                b: b,
                text: questDescription,
                font: Game1.dialogueFont,
                position: new Vector2(this.xPositionOnScreen + 32, this.yPositionOnScreen + 128),
                color: Game1.textColor,
                shadowColor: new Color(151, 151, 151)
                );

            // accept button button
            IClickableMenu.drawTextureBox(
                b: b,
                texture: AcceptQuestButtonTexture,
                sourceRect: new Rectangle(0, 0, 9, 9),
                x: AcceptQuestButton.bounds.X,
                y: AcceptQuestButton.bounds.Y,
                width: AcceptQuestButton.bounds.Width,
                height: AcceptQuestButton.bounds.Height,
                color: AcceptQuestButton.scale > 1 ? Color.LightPink : Color.White, // when hovering over the acceptQuest button, it should be pink
                scale: 4f * AcceptQuestButton.scale,
                drawShadow: true
                );

            // accept quest text
            Utility.drawTextWithColoredShadow(
                b: b,
                text: "Accept Quest",
                font: Game1.dialogueFont,
                position: new Vector2((float)(AcceptQuestButton.bounds.X + 12), (float)(AcceptQuestButton.bounds.Y + 16)),
                color: Game1.textColor,
                shadowColor: AcceptQuestButton.scale > 1 ? new Color(171, 93, 104) : new Color(151, 151, 151) // text shadow colour is a dark pink when hovering over accept quest button
                );

            // close button
            base.draw(b);

            // cursor
            this.drawMouse(b);
        }