Пример #1
0
        public void InvalidateRewardInfo()
        {
            Rewards.RemoveAll(t => t == null || !t.IsConstructable());

            Rewards.ForEach(
                type =>
            {
                ConquestRewardInfo info = ConquestRewardInfo.EnsureInfo(this, type);

                if (info == null)
                {
                    Rewards.Remove(type);
                }
            });
        }
Пример #2
0
        protected virtual void CompileConquestLayout(
            SuperGumpLayout layout, int length, int index, int pIndex, int yOffset, ConquestState entry)
        {
            layout.Add(
                "conquest/entry/" + index,
                () =>
            {
                AddBackground(313, yOffset, 394, 87, 9200);

                AddItem(
                    328 + entry.Conquest.ItemIDOffset.X,
                    yOffset + 6 + entry.Conquest.ItemIDOffset.Y,
                    entry.Conquest.ItemID,
                    entry.Conquest.Hue);

                if (entry.TierMax > 1)
                {
                    AddLabel(333, yOffset + 55, 2049, "Tier");
                    AddLabel(336, yOffset + 67, 2049, entry.Tier + "/" + entry.TierMax);
                }

                if (entry.Completed)
                {
                    AddItem(619, yOffset + 69, 4655);                             // Blood
                }

                AddImage(627, yOffset + 4, 1417);                         // Disc

                if (entry.Completed)
                {
                    AddLabel(550, yOffset - 1, entry.Completed ? 1258 : 2049, entry.CompletedDate.ToShortDateString());
                }

                ConquestRewardInfo[] rewards =
                    entry.Conquest.Rewards.Select(t => ConquestRewardInfo.EnsureInfo(entry.Conquest, t))
                    .Where(r => r != null)
                    .ToArray();
                ConquestRewardInfo displayReward =
                    rewards.FirstOrDefault(r => r.TypeOf.IsEqualOrChildOf <Item>() || r.TypeOf.IsEqualOrChildOf <Mobile>());

                if (displayReward != null)
                {
                    AddHtml(
                        637,
                        yOffset + 19,
                        60,
                        40,
                        String.Format("{0:#,0}", entry.Conquest.Points)
                        .WrapUOHtmlTag("CENTER")
                        .WrapUOHtmlColor(entry.Completed ? Color.OrangeRed : Color.White),
                        false,
                        false);

                    if (displayReward.ItemID > 0)
                    {
                        AddItem(645, yOffset + 39, displayReward.ItemID, displayReward.Hue);
                    }

                    if (String.IsNullOrWhiteSpace(displayReward.Name) && displayReward.Label > 0)
                    {
                        AddTooltip(displayReward.Label);
                    }

                    if (displayReward.Amount > 1)
                    {
                        AddHtml(
                            637,
                            yOffset + 49,
                            60,
                            40,
                            String.Format("{0:#,0} x", displayReward.Amount)
                            .WrapUOHtmlTag("CENTER")
                            .WrapUOHtmlColor(entry.Completed ? Color.Yellow : Color.White),
                            false,
                            false);
                    }
                }
                else
                {
                    AddHtml(
                        637,
                        yOffset + 34,
                        60,
                        40,
                        String.Format("{0:#,0}", entry.Conquest.Points)
                        .WrapUOHtmlTag("CENTER")
                        .WrapUOHtmlColor(entry.Completed ? Color.OrangeRed : Color.White),
                        false,
                        false);
                }

                string desc = entry.Conquest.Desc ?? String.Empty;

                if (!entry.Completed)
                {
                    if (!String.IsNullOrWhiteSpace(desc))
                    {
                        desc += "\n";
                    }

                    desc += "Current Progress: " + entry.Progress + "/" + entry.ProgressMax;
                }

                if (rewards.Length > 0)
                {
                    if (!String.IsNullOrWhiteSpace(desc))
                    {
                        desc += "\n\n";
                    }

                    desc += "Rewards:\n";
                    desc += String.Join("\n", rewards.Select(r => r.ToString()));
                }

                if (entry.WorldFirst)
                {
                    if (!String.IsNullOrWhiteSpace(desc))
                    {
                        desc += "\n\n";
                    }

                    desc += "*****WORLD FIRST*****";
                }

                if (!String.IsNullOrWhiteSpace(desc))
                {
                    AddHtml(389, yOffset + 28, 229, 53, desc, true, true);
                }

                if (!String.IsNullOrWhiteSpace(entry.Conquest.Name))
                {
                    AddLabel(389, yOffset + 12, entry.Completed ? 1258 : 2049, entry.Conquest.Name);
                }
            });

            layout.Add(
                "conquest/entry/progress/" + index,
                () =>
            {
                const int height = 77;

                int hOffset = (int)Math.Ceiling(height * (entry.Progress / (double)entry.ProgressMax));

                if (hOffset >= height)
                {
                    AddImageTiled(316, yOffset + 5, 8, height, 9742);
                }
                else
                {
                    AddImageTiled(316, yOffset + 5, 8, height, 9740);

                    if (hOffset > 0)
                    {
                        AddImageTiled(316, (yOffset + 5) + (height - hOffset), 8, hOffset, 9743);

                        if (hOffset < height)
                        {
                            AddImageTiled(316, (yOffset + 5) + (height - hOffset), 8, 2, 9742);                                     // Borderline
                        }
                    }
                }

                // Markers for 25%, 50% and 75%

                /*
                 * AddImageTiled(316, yOffset + 23, 4, 2, 10722);
                 * AddImageTiled(316, yOffset + 43, 4, 2, 10722);
                 * AddImageTiled(316, yOffset + 63, 4, 2, 10722);
                 */
            });

            if (entry.TierMax > 1)
            {
                layout.Add(
                    "conquest/entry/tier/" + index,
                    () =>
                {
                    const int height = 77;

                    var hOffset = (int)Math.Ceiling(height * (entry.Tier / (double)entry.TierMax));

                    if (hOffset >= height)
                    {
                        AddImageTiled(326, yOffset + 5, 8, height, 9742);
                    }
                    else
                    {
                        AddImageTiled(326, yOffset + 5, 8, height, 9740);

                        if (hOffset > 0)
                        {
                            AddImageTiled(326, (yOffset + 5) + (height - hOffset), 8, hOffset, 9741);

                            if (hOffset < height)
                            {
                                AddImageTiled(326, (yOffset + 5) + (height - hOffset), 8, 2, 9742);                                         // Borderline
                            }
                        }
                    }

                    // Markers for 25%, 50% and 75%

                    /*
                     * AddImageTiled(326, yOffset + 23, 4, 2, 10722);
                     * AddImageTiled(326, yOffset + 43, 4, 2, 10722);
                     * AddImageTiled(326, yOffset + 63, 4, 2, 10722);
                     */
                });
            }
        }