コード例 #1
0
        public override void OnResponse(Server.Network.NetState state, RelayInfo info)
        {
            if (m_Collection == null || !m_Owner.InRange(m_Location, 2))
            {
                return;
            }

            if (info.ButtonID == (int)Buttons.Rewards)
            {
                m_Owner.SendGump(new CommunityCollectionGump(m_Owner, m_Collection, m_Location, Section.Rewards));
            }
            else if (info.ButtonID == (int)Buttons.Status)
            {
                m_Owner.SendGump(new CommunityCollectionGump(m_Owner, m_Collection, m_Location, Section.Donates));
            }
            else if (info.ButtonID >= 300 && m_Collection.Donations != null && info.ButtonID - 300 < m_Collection.Donations.Count && m_Section == Section.Donates)
            {
                CollectionItem item = m_Collection.Donations[info.ButtonID - 300];

                m_Owner.SendLocalizedMessage(1073178); // Please enter how much of that item you wish to donate:
                m_Owner.Prompt = new InternalPrompt(m_Collection, item, m_Location);
            }
            else if (info.ButtonID >= 200 && m_Collection.Rewards != null && info.ButtonID - 200 < m_Collection.Rewards.Count && m_Section == Section.Rewards)
            {
                CollectionItem item   = m_Collection.Rewards[info.ButtonID - 200];
                int            points = m_Owner.GetCollectionPoints(m_Collection.CollectionID);

                if (item.CanSelect(m_Owner))
                {
                    if (item.Points <= points)
                    {
                        if (item is CollectionHuedItem)
                        {
                            m_Owner.SendGump(new CommunityCollectionGump(m_Owner, m_Collection, m_Location, Section.Hues, (CollectionHuedItem)item));
                        }
                        else
                        {
                            m_Owner.CloseGump(typeof(ConfirmRewardGump));
                            m_Owner.SendGump(new ConfirmRewardGump(m_Collection, m_Location, item, 0));
                        }
                    }
                    else
                    {
                        m_Owner.SendLocalizedMessage(1073122); // You don't have enough points for that!
                    }
                }
            }
            else if (info.ButtonID >= 100 && m_Item != null && info.ButtonID - 200 < m_Item.Hues.Length && m_Section == Section.Hues)
            {
                m_Owner.CloseGump(typeof(ConfirmRewardGump));
                m_Owner.SendGump(new ConfirmRewardGump(m_Collection, m_Location, m_Item, m_Item.Hues[info.ButtonID - 100]));
            }
        }
コード例 #2
0
        public override int LabelNumber => 1074975; // Are you sure you wish to select this?

        public override void Confirm(Mobile from)
        {
            if (m_Collection == null || !from.InRange(m_Location, 2))
            {
                return;
            }

            if (from is PlayerMobile player)
            {
                if (player.GetCollectionPoints(m_Collection.CollectionID) < m_Item.Points)
                {
                    player.SendLocalizedMessage(1073122); // You don't have enough points for that!
                }
                else if (m_Item.CanSelect(player))
                {
                    m_Collection.Reward(player, m_Item, m_Hue);
                }
            }
        }
コード例 #3
0
        public void DisplayRewardPage()
        {
            int points = m_Owner.GetCollectionPoints(m_Collection.CollectionID);

            AddPage(m_Page);

            // title
            AddHtmlLocalized(50, 65, 150, 20, 1072843, 0x1, false, false); // Your Reward Points:
            AddLabel(230, 65, 0x64, points.ToString());
            AddImageTiled(35, 85, 270, 2, 0x23C5);
            AddHtmlLocalized(35, 90, 270, 20, 1072844, 0x1, false, false); // Please Choose a Reward:

            // rewards
            int offset = 110;
            int next   = 0;

            while (offset + next < 300 && m_Index < m_Collection.Rewards.Count)
            {
                CollectionItem item = m_Collection.Rewards[m_Index];

                if (item.QuestItem && SkipQuestReward(m_Owner, item))
                {
                    m_Index++;
                    continue;
                }

                int height = Math.Max(item.Height, 20);

                if (points >= item.Points && item.CanSelect(m_Owner))
                {
                    AddButton(35, offset + height / 2 - 5, 0x837, 0x838, 200 + m_Index, GumpButtonType.Reply, 0);
                    AddTooltip(item.Tooltip);
                }

                int y = offset - item.Y;

                if (item.Height < 20)
                {
                    y += (20 - item.Height) / 2;
                }

                AddItem(55 - item.X + m_Max / 2 - item.Width / 2, y, item.ItemID, points >= item.Points ? item.Hue : 0x3E9);
                AddTooltip(item.Tooltip);
                AddLabel(65 + m_Max, offset + height / 2 - 10, points >= item.Points ? 0x64 : 0x21, item.Points.ToString());
                AddTooltip(item.Tooltip);

                offset  += 5 + height;
                m_Index += 1;

                if (m_Index < m_Collection.Donations.Count)
                {
                    next = Math.Max(m_Collection.Donations[m_Index].Height, 20);
                }
                else
                {
                    next = 0;
                }
            }

            // buttons
            AddButton(50, 335, 0x15E3, 0x15E7, (int)Buttons.Status, GumpButtonType.Reply, 0);
            AddHtmlLocalized(75, 335, 100, 20, 1072845, 0x1, false, false); // Status

            if (m_Page > 1)
            {
                AddButton(150, 335, 0x15E3, 0x15E7, (int)Buttons.Next, GumpButtonType.Page, m_Page - 1);
                AddHtmlLocalized(170, 335, 60, 20, 1074880, 0x1, false, false); // Previous
            }

            m_Page += 1;

            if (m_Index < m_Collection.Rewards.Count)
            {
                AddButton(300, 335, 0x15E1, 0x15E5, (int)Buttons.Next, GumpButtonType.Page, m_Page);
                AddHtmlLocalized(240, 335, 60, 20, 1072854, 0x1, false, false); // <div align=right>Next</div>
            }
        }