Пример #1
0
        private static string getSpecialOrderDetails(SpecialOrder order)
        {
            int    daysLeft             = order.GetDaysLeft();
            string description          = order.GetDescription();
            string objectiveDescription = "";
            string name        = order.GetName();
            int    moneyReward = order.GetMoneyReward();

            // Get each objectives
            for (int i = 0; i < order.GetObjectiveDescriptions().Count; i++)
            {
                objectiveDescription += order.GetObjectiveDescriptions()[i] + ", \n";
            }

            string toReturn = $"{name}\n\tDescription:{description}\n\tObjectives: {objectiveDescription}";

            if (order.IsTimedQuest())
            {
                toReturn = $"{toReturn}\n\tTime: {daysLeft} days";
            }

            if (order.HasMoneyReward())
            {
                toReturn = $"{toReturn}\n\tReward: {moneyReward}g";
            }

            return(toReturn);
        }
Пример #2
0
        public void DrawQuestDetails(SpriteBatch b, SpecialOrder order, int x)
        {
            bool dehighlight = false;
            bool found_match = false;

            foreach (SpecialOrder active_order in Game1.player.team.specialOrders)
            {
                if (active_order.questState.Value != 0)
                {
                    continue;
                }
                foreach (SpecialOrder available_order in Game1.player.team.availableSpecialOrders)
                {
                    if (!(available_order.orderType.Value != GetOrderType()) && active_order.questKey.Value == available_order.questKey.Value)
                    {
                        if (order.questKey != active_order.questKey)
                        {
                            dehighlight = true;
                        }
                        found_match = true;
                        break;
                    }
                }
                if (found_match)
                {
                    break;
                }
            }
            if (!found_match && Game1.player.team.acceptedSpecialOrderTypes.Contains(GetOrderType()))
            {
                dehighlight = true;
            }
            SpriteFont font             = ((LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ko) ? Game1.smallFont : Game1.dialogueFont);
            Color      font_color       = Game1.textColor;
            float      shadow_intensity = 0.5f;
            float      graphic_alpha    = 1f;

            if (dehighlight)
            {
                font_color       = Game1.textColor * 0.25f;
                shadow_intensity = 0f;
                graphic_alpha    = 0.25f;
            }
            if (boardType == "Qi")
            {
                font_color       = Color.White;
                shadow_intensity = 0f;
                if (dehighlight)
                {
                    font_color    = Color.White * 0.25f;
                    graphic_alpha = 0.25f;
                }
            }
            int    header_y   = yPositionOnScreen + 128;
            string order_name = order.GetName();
            KeyValuePair <Texture2D, Rectangle>?drawn_portrait = GetPortraitForRequester(order.requester.Value);

            if (drawn_portrait.HasValue)
            {
                Utility.drawWithShadow(b, drawn_portrait.Value.Key, new Vector2(x, header_y), drawn_portrait.Value.Value, Color.White * graphic_alpha, 0f, Vector2.Zero, 4f, flipped: false, -1f, -1, -1, shadow_intensity * 0.6f);
            }
            Utility.drawTextWithShadow(b, order_name, font, new Vector2((float)(x + 256) - font.MeasureString(order_name).X / 2f, header_y), font_color, 1f, -1f, -1, -1, shadow_intensity);
            string raw_description = order.GetDescription();
            string description     = Game1.parseText(raw_description, font, 512);
            float  height          = font.MeasureString(description).Y;
            float  scale           = 1f;
            float  max_height      = 400f;

            while (height > max_height && !(scale <= 0.25f))
            {
                scale      -= 0.05f;
                description = Game1.parseText(raw_description, font, (int)(512f / scale));
                height      = font.MeasureString(description).Y;
            }
            Utility.drawTextWithShadow(b, description, font, new Vector2(x, yPositionOnScreen + 192), font_color, scale, -1f, -1, -1, shadow_intensity);
            if (dehighlight)
            {
                return;
            }
            int days_left           = order.GetDaysLeft();
            int due_date_y_position = yPositionOnScreen + 576;

            Utility.drawWithShadow(b, Game1.mouseCursors, new Vector2(x, due_date_y_position), new Rectangle(410, 501, 9, 9), Color.White, 0f, Vector2.Zero, 4f, flipped: false, 0.99f, -1, -1, shadow_intensity * 0.6f);
            Utility.drawTextWithShadow(b, Game1.parseText((days_left > 1) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:QuestLog.cs.11374", days_left) : Game1.content.LoadString("Strings\\StringsFromCSFiles:QuestLog.cs.11375", days_left), Game1.dialogueFont, width - 128), Game1.dialogueFont, new Vector2(x + 48, due_date_y_position), font_color, 1f, -1f, -1, -1, shadow_intensity);
            if (!(boardType == "Qi"))
            {
                return;
            }
            int        reward = -1;
            GemsReward gems   = null;

            foreach (OrderReward r in order.rewards)
            {
                if (r is GemsReward)
                {
                    gems = r as GemsReward;
                    break;
                }
            }
            if (gems != null)
            {
                reward = gems.amount;
            }
            if (reward != -1)
            {
                Utility.drawWithShadow(b, Game1.objectSpriteSheet, new Vector2((float)x + 512f / scale - Game1.dialogueFont.MeasureString(string.Concat(reward)).X - 12f - 60f, due_date_y_position - 8), new Rectangle(288, 561, 15, 15), Color.White, 0f, Vector2.Zero, 4f, flipped: false, 0.99f, -1, -1, shadow_intensity * 0.6f);
                Utility.drawTextWithShadow(b, Game1.parseText(string.Concat(reward), Game1.dialogueFont, width - 128), Game1.dialogueFont, new Vector2((float)x + 512f / scale - Game1.dialogueFont.MeasureString(string.Concat(reward)).X - 4f, due_date_y_position), font_color, 1f, -1f, -1, -1, shadow_intensity);
                Utility.drawTextWithShadow(b, Game1.parseText(Utility.loadStringShort("StringsFromCSFiles", "QuestLog.cs.11376"), Game1.dialogueFont, width - 128), Game1.dialogueFont, new Vector2((float)x + 512f / scale - Game1.dialogueFont.MeasureString(Utility.loadStringShort("StringsFromCSFiles", "QuestLog.cs.11376")).X + 8f, due_date_y_position - 60), font_color * 0.6f, 1f, -1f, -1, -1, shadow_intensity);
            }
        }