Esempio n. 1
0
 /// <summary>
 /// Get packet based generic gump with specified ID from target client.
 /// </summary>
 /// <param name="client">Target client.</param>
 /// <param name="gumpID">ID of gump to get.</param>
 /// <param name="gump">Gump (out).</param>
 /// <returns>True on success.</returns>
 public static bool GetGump(int client, int gumpID, out Gump gump)
 {
     ClientInfo ci;
     if (ClientInfoCollection.GetClient(client, out ci))
     {
         return ci.GenericGumps.GetGump(gumpID, out gump);
     }
     gump = null;
     return false;
 }
Esempio n. 2
0
        public override void RenderOutline(Gump gump)
        {
            if (!Background)
            {
                gump.AddImageTiled(X, Y,               (int)Width, 1, 2621);
                gump.AddImageTiled(X, Y + (int)Height, (int)Width, 1, 2621);

                gump.AddImageTiled(X,              Y, 1, (int)Height, 2623);
                gump.AddImageTiled(X + (int)Width, Y, 1, (int)Height, 2623); 
            }
        }
Esempio n. 3
0
 internal static void OnCustomGump(int client, Gump gump)
 {
     lock (myCustomGumpLock)
     {
         dGenericGump handler = myGenericGumpEvent;
         try
         {
             if (handler != null) handler(client, gump);
         }
         catch (Exception) { }
     }
 }
Esempio n. 4
0
        public void WillParseAuctionSafeGump()
        {
            const string localPath = @"C:\Users\johns\Desktop\KvG Client 2.0";

            if (!Directory.Exists(localPath))
            {
                Debug.WriteLine("Not running test, requires Cliloc.enu");
                return;
            }

            Cliloc.Initialize(localPath);

            const string layout =
                "{ resizepic 0 0 9300 400 600 }{ xmfhtmltok 10 10 400 18 0 0 22660 1114513 @Heritage Raffle@ }{ xmfhtmltok 0 70 198 18 0 0 22660 1114514 @Can Buy Unlimited Tickets:@ }{ htmlgump 202 70 200 18 0 0 0 }{ xmfhtmltok 0 100 198 18 0 0 22660 1114514 @Currency Type:@ }{ htmlgump 202 100 200 18 1 0 0 }{ xmfhtmltok 0 130 198 18 0 0 22660 1114514 @Ticket Price:@ }{ htmlgump 202 130 200 18 2 0 0 }{ xmfhtmltok 0 160 198 18 0 0 22660 1114514 @Tickets Bought:@ }{ htmlgump 202 160 200 18 3 0 0 }{ xmfhtmltok 0 190 200 18 0 0 22660 1114514 @Odds of Winning:@ }{ htmlgump 202 190 200 18 4 0 0 }{ xmfhtmltok 0 220 198 18 0 0 22660 1114514 @Raffled Item:@ }{ xmfhtmltok 202 220 200 20 0 0 16 1114779 @The Lucky Sovereign Steed@ }{ tilepichue 90 314 8413 1152 }{ itemproperty 1074292781 }{ xmfhtmltok 200 243 200 18 0 0 22660 1154645 @Raffled Item Description:@ }{ htmlgump 202 263 197 140 5 1 1 }{ xmfhtmltok 0 450 198 18 0 0 22660 1114514 @Raffle Ticket Amount@ }{ resizepic 202 450 9350 193 22 }{ textentry 204 450 192 20 0 0 6 }{ button 168 480 4005 4007 1 0 1 }{ htmlgump 202 480 198 18 7 0 0 }{ xmfhtmltok 0 530 198 18 0 0 22660 1114514 @Raffle Ends:@ }{ htmlgump 202 530 198 18 8 0 0 }{ button 360 570 4020 4022 1 0 0 }{ xmfhtmltok 250 570 100 20 0 0 0 1114514 @#1060675@ }";

            Gump gump = GumpParser.Parse(0x01, 0x01, 1, 1, layout,
                                         new[] { "unknown", "unknown", "unknown", "unknown", "unknown", "unknown", "", "", "" });
        }
Esempio n. 5
0
        public void Can_publish_event_after_receiving_gump()
        {
            var  testProxy  = new InfusionTestProxy();
            var  journal    = testProxy.Api.CreateEventJournal();
            Gump resultGump = null;

            var task = Task.Run(() =>
            {
                journal.When <Events.GumpReceivedEvent>(e => resultGump = e.Gump)
                .WaitAny();
            });

            journal.AwaitingStarted.WaitOne(100).Should().BeTrue();
            testProxy.PacketReceivedFromServer(SendGumpMenuDialogPackets.Explevel);
            task.Wait(100).Should().BeTrue();

            resultGump.Should().NotBeNull();
        }
Esempio n. 6
0
        public override void WriteToGump(Gump g, ref int y)
        {
            m_Objective.WriteToGump(g, ref y);
            y -= 16;

            if (m_Objective.ShowDetailed)
            {
                base.WriteToGump(g, ref y);

                g.AddHtmlLocalized(103, y, 120, 16, 3000087, 0x15F90, false, false); // Total
                g.AddLabel(223, y, 0x481, GetCurrentTotal().ToString());
                y += 16;

                g.AddHtmlLocalized(103, y, 120, 16, 1074782, 0x15F90, false, false); // Return to
                g.AddLabel(223, y, 0x481, QuesterNameAttribute.GetQuesterNameFor(Instance.QuesterType));
                y += 16;
            }
        }
Esempio n. 7
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.InRange(this.GetWorldLocation(), 3))
            {
                Gump g = new Gump(100, 100);

                if (_Type == CardType.Krampus)
                {
                    g.AddImage(0, 0, 39914);
                }
                else
                {
                    g.AddImage(0, 0, 39904 + (int)_Type);
                }

                from.SendGump(g);
            }
        }
Esempio n. 8
0
        public PvPRestrictionListGump(
            PlayerMobile user,
            PvPBattleRestrictionsBase <TKey> res,
            Gump parent     = null,
            bool locked     = true,
            bool useConfirm = true)
            : base(
                user,
                parent,
                emptyText: "There are no restrictions to display.",
                title: (res != null) ? res.ToString() : "Restrictions")
        {
            Restrictions     = res;
            Locked           = locked;
            UseConfirmDialog = useConfirm;

            ForceRecompile = true;
        }
Esempio n. 9
0
        public bool Close()
        {
            Gump g = Gump.GetGump(GumpType);

            if (g != null)
            {
                if (!g.Serial.Equals(0))
                {
                    g.Close();
                }
            }
            StealthAPI.Stealth.Client.Wait(1000);
            if (!Gump.WaitForGumpClose(GumpType, GumpDelay))
            {
                return(false);
            }
            return(true);
        }
Esempio n. 10
0
        public PvPProfileListGump(
            Mobile user,
            PvPSeason season,
            Gump parent     = null,
            bool useConfirm = true,
            PvPProfileRankOrder sortOrder = PvPProfileRankOrder.None)
            : base(user, parent, emptyText: "There are no profiles to display.", title: "PvP Profiles")
        {
            Season = season ?? AutoPvP.CurrentSeason;

            RankSortOrder = sortOrder != PvPProfileRankOrder.None ? sortOrder : AutoPvP.CMOptions.Advanced.Profiles.RankingOrder;

            UseConfirmDialog = useConfirm;

            CanSearch = User.AccessLevel > AccessLevel.Player || AutoPvP.CMOptions.Advanced.Profiles.AllowPlayerSearch;

            ForceRecompile = true;
        }
Esempio n. 11
0
 public BattlesRewardsUI(
     PlayerMobile user,
     PlayerEventScoreProfile profile,
     Gump parent  = null,
     int?x        = null,
     int?y        = null,
     string title = null,
     string html  = null,
     int icon     = 7004,
     Action <GumpButton> onAccept = null,
     Action <GumpButton> onCancel = null)
     : base(user, parent, 400, 400, title, html, icon, onAccept, onCancel)
 {
     CanMove     = true;
     Closable    = true;
     Modal       = false;
     UserProfile = profile;
 }
Esempio n. 12
0
        public void AddGump(Gump g)
        {
            if (m_Gumps == null)
            {
                return;
            }

            if (m_Gumps.Count >= m_GumpCap)
            {
                log.WarnFormat("Client: {0}: Exceeded gump cap, disconnecting...",
                               this);
                Dispose();
            }
            else
            {
                m_Gumps.Add(g);
            }
        }
Esempio n. 13
0
        public static Packet Compile(this Gump g, NetState ns = null)
        {
            IGumpWriter disp = new DisplayGumpFast(g);

            // IGumpWriter disp = new DisplayGumpPacked(g);

            if (!g.Draggable)
            {
                disp.AppendLayout(Gump.NoMove);
            }

            if (!g.Closable)
            {
                disp.AppendLayout(Gump.NoClose);
            }

            if (!g.Disposable)
            {
                disp.AppendLayout(Gump.NoDispose);
            }

            if (!g.Resizable)
            {
                disp.AppendLayout(Gump.NoResize);
            }

            var count   = g.Entries.Count;
            var strings = new List <string>();

            for (var i = 0; i < count; ++i)
            {
                var e = g.Entries[i];

                disp.AppendLayout(m_BeginLayout);
                e.AppendToByType(disp, strings);
                disp.AppendLayout(m_EndLayout);
            }

            disp.WriteStrings(strings);

            disp.Flush();

            return((Packet)disp);
        }
Esempio n. 14
0
        public TimeBoostsUI(
            Mobile user,
            Gump parent = null,
            TimeBoostProfile profile         = null,
            Func <ITimeBoost, bool> canApply = null,
            Action <ITimeBoost> boostUsed    = null,
            Func <TimeSpan> getTime          = null,
            Action <TimeSpan> setTime        = null)
            : base(user, parent)
        {
            Profile = profile;

            CanApply  = canApply;
            BoostUsed = boostUsed;

            GetTime = getTime;
            SetTime = setTime;

            Title       = DefaultTitle;
            SubTitle    = DefaultSubTitle;
            EmptyText   = DefaultEmptyText;
            SummaryText = DefaultSummaryText;

            TitleColor       = DefaultTitleColor;
            SubTitleColor    = DefaultSubTitleColor;
            EmptyTextColor   = DefaultEmptyTextColor;
            BoostTextColor   = DefaultBoostTextColor;
            BoostCountColor  = DefaultBoostCountColor;
            SummaryTextColor = DefaultSummaryTextColor;

            EntriesPerPage = 4;

            Sorted = true;

            CanClose   = true;
            CanDispose = true;
            CanMove    = true;
            CanResize  = false;

            AutoRefreshRate = TimeSpan.FromMinutes(1.0);
            AutoRefresh     = true;

            ForceRecompile = true;
        }
Esempio n. 15
0
        public MenuGump(Mobile user, Gump parent = null, IEnumerable <ListGumpEntry> list = null, GumpButton clicked = null)
            : base(user, parent, DefaultX, DefaultY, list)
        {
            Clicked = clicked;

            if (Clicked != null)
            {
                if (Clicked.Parent != null)
                {
                    X = Clicked.Parent.X + Clicked.X;
                    Y = Clicked.Parent.Y + Clicked.Y;

                    if (Parent == null)
                    {
                        Parent = Clicked.Parent;
                    }
                }
                else if (Parent != null)
                {
                    X = Parent.X;
                    Y = Parent.Y;
                }
                else
                {
                    X = DefaultX;
                    Y = DefaultY;
                }
            }
            else if (Parent != null)
            {
                X = Parent.X;
                Y = Parent.Y;
            }
            else
            {
                X = DefaultX;
                Y = DefaultY;
            }

            ForceRecompile = true;
            CanMove        = false;
            CanResize      = false;
            Modal          = true;
        }
Esempio n. 16
0
 public ScoreGumpPlayerScores(
     PlayerMobile user,
     double score,
     Gump parent  = null,
     int?x        = null,
     int?y        = null,
     string title = null,
     string html  = null,
     int icon     = 7004,
     Action <GumpButton> onAccept = null,
     Action <GumpButton> onCancel = null)
     : base(user, parent, 0, 0, title, html, icon, onAccept, onCancel)
 {
     CanMove        = true;
     Closable       = true;
     Modal          = false;
     ForceRecompile = true;
     _Score         = score;
 }
Esempio n. 17
0
        protected void Animate()
        {
            if (!_Animated)
            {
                _Animated = true;

                if (State != null && State.Animating)
                {
                    OnAnimate();

                    if (Gump != null)
                    {
                        Gump.OnAnimate(this);
                    }

                    State.Animated();
                }
            }
        }
Esempio n. 18
0
        public PvPBattleBoundsGump(PlayerMobile user, PvPBattle battle, Gump parent = null)
            : base(
                user,
                parent,
                list: battle.Options.Locations.BattleBounds,
                emptyText: "There are no bounds in the list.",
                title: "Battle Region Bounds")
        {
            Battle = battle;

            InputMap = Battle.Map;

            Preview       = true;
            PreviewHue    = TextHue;
            PreviewEffect = 3259;
            PreviewName   = String.Format("Battle Region Preview: {0} ({1})", Battle.Name, Battle.Serial);

            ForceRecompile = true;
        }
Esempio n. 19
0
        public Rect2DListGump(
            Mobile user,
            Gump parent = null,
            int?x       = null,
            int?y       = null,
            IEnumerable <Rectangle2D> list = null,
            string emptyText = null,
            string title     = null,
            IEnumerable <ListGumpEntry> opts = null,
            bool canAdd    = true,
            bool canRemove = true,
            bool canClear  = true,
            Action <Rectangle2D> addCallback           = null,
            Action <Rectangle2D> removeCallback        = null,
            Action <List <Rectangle2D> > applyCallback = null,
            Action clearCallback = null)
            : base(
                user,
                parent,
                x,
                y,
                list,
                emptyText,
                title,
                opts,
                canAdd,
                canRemove,
                canClear,
                addCallback,
                removeCallback,
                applyCallback,
                clearCallback)
        {
            InputMap = User.Map;

            Preview       = false;
            PreviewHue    = TextHue;
            PreviewEffect = 1801;
            PreviewRender = EffectRender.SemiTransparent;
            PreviewName   = "Preview Region";

            ForceRecompile = true;
        }
Esempio n. 20
0
        public void AddGump(Gump gump)
        {
            if (m_Gumps == null)
            {
                m_Gumps = new List <Gump>();
            }

            if (m_Gumps.Count < m_GumpCap)
            {
                m_Gumps.Add(gump);
            }
            else
            {
                Utility.PushColor(ConsoleColor.DarkRed);
                WriteConsole("Exceeded gump cap, disconnecting...");
                Utility.PopColor();
                Dispose();
            }
        }
Esempio n. 21
0
        public HtmlPanelGump(
            Mobile user,
            Gump parent      = null,
            int?x            = null,
            int?y            = null,
            int width        = 420,
            int height       = 420,
            string html      = null,
            string emptyText = null,
            string title     = null,
            IEnumerable <ListGumpEntry> opts = null,
            T selected = default(T))
            : base(user, parent, x, y, width, height, emptyText, title, opts, selected)
        {
            HtmlColor      = DefaultHtmlColor;
            HtmlBackground = false;

            Html = html ?? String.Empty;
        }
Esempio n. 22
0
 public InputDialogGump(
     Mobile user,
     Gump parent  = null,
     int?x        = null,
     int?y        = null,
     string title = null,
     string html  = null,
     string input = null,
     int limit    = 0,
     int icon     = 7020,
     Action <GumpButton> onAccept         = null,
     Action <GumpButton> onCancel         = null,
     Action <GumpButton, string> callback = null)
     : base(user, parent, x, y, title, html, icon, onAccept, onCancel)
 {
     InputText = input ?? String.Empty;
     Limit     = limit;
     Callback  = callback;
 }
Esempio n. 23
0
        public static void AppendTo(this GumpImage g, IGumpWriter disp, List <string> strings)
        {
            disp.AppendLayout(Gump.StringToBuffer("gumppic"));
            disp.AppendLayout(g.X);
            disp.AppendLayout(g.Y);
            disp.AppendLayout(g.GumpID);

            if (g.Hue != 0)
            {
                disp.AppendLayoutNS(" hue=");
                disp.AppendLayoutNS(g.Hue);
            }

            if (!string.IsNullOrEmpty(g.Class))
            {
                disp.AppendLayoutNS(" class=");
                disp.AppendLayout(Gump.StringToBuffer(g.Class));
            }
        }
Esempio n. 24
0
 public GumpTimer(Mobile Staff, Mobile From, byte RetryCount, byte MaxRetries, int TotalSeconds, int MaxSeconds, string userphrase, bool Kick, bool Jail, Point3D MoveTo, Map MoveToMap, string Website, string passphrase, Gump afkgump, byte seconds, TimeSpan delay)
     : base(delay)
 {
     Priority       = TimerPriority.OneSecond;
     m_Staff        = Staff;
     m_From         = From;
     m_afkgump      = afkgump;
     m_RetryCount   = RetryCount;
     m_MaxRetries   = MaxRetries;
     m_TotalSeconds = TotalSeconds;
     m_MaxSeconds   = MaxSeconds;
     m_Kick         = Kick;
     m_Jail         = Jail;
     m_MoveTo       = MoveTo;
     m_MoveToMap    = MoveToMap;
     m_Website      = Website;
     m_passphrase   = passphrase;
     m_seconds      = seconds;
 }
Esempio n. 25
0
        public ZombieClueGiverUI(
            PlayerMobile user, ZombieAvatar avatar,
            string title = null,
            string html  = null,
            Gump parent  = null,
            int?x        = null,
            int?y        = null,
            Action <GumpButton> onAccept = null)
            : base(user, parent, 0, 0, title, null, 0, onAccept)
        {
            Title    = title;
            CanMove  = true;
            Closable = true;
            Modal    = false;

            HTML = html;

            Avatar = avatar;
        }
Esempio n. 26
0
        private Packet?FilterSendGumpMenuDialog(Packet rawPacket)
        {
            if (rawPacket.Id == PacketDefinitions.GeneralInformationPacket.Id && rawPacket.Payload[4] == 4)
            {
                var packet = new CloseGenericGumpPacket();
                packet.Deserialize(rawPacket);

                eventSource.Publish(new ServerRequestedGumpCloseEvent(packet.GumpTypeId));
            }
            if (rawPacket.Id == PacketDefinitions.SendGumpMenuDialog.Id)
            {
                var nextGumpNotVisible = false;

                lock (gumpLock)
                {
                    var packet = PacketDefinitionRegistry.Materialize <SendGumpMenuDialogPacket>(rawPacket);
                    var gump   = new Gump(packet.GumpId, packet.GumpTypeId, packet.Commands, packet.TextLines);
                    CurrentGump = gump;
                    eventSource.Publish(new GumpReceivedEvent(gump));

                    if (!showNextAwaitedGump)
                    {
                        currentGumpVisible  = false;
                        nextGumpNotVisible  = true;
                        showNextAwaitedGump = true;
                    }
                    else
                    {
                        currentGumpVisible = true;
                    }
                }

                gumpReceivedEvent.Set();

                if (nextGumpNotVisible)
                {
                    return(null);
                }
            }

            return(rawPacket);
        }
Esempio n. 27
0
        public LoginGump() : base(0, 0)
        {
            loginScene             = Service.Get <LoginScene>();
            CanCloseWithRightClick = false;

            // Background
            AddChildren(new GumpPicTiled(0, 0, 640, 480, 0x0E14));
            // Border
            AddChildren(new GumpPic(0, 0, 0x157C, 0));
            AddChildren(currentStepGump = GetGumpForStep(loginScene.CurrentLoginStep));

            // UO Flag
            AddChildren(new GumpPic(0, 4, 0x15A0, 0));

            // Quit Button
            AddChildren(new Button(0, 0x1589, 0x158B, 0x158A)
            {
                X = 555, Y = 4
            });
        }
Esempio n. 28
0
        public DigitalNumericDisplayGump(
            PlayerMobile user,
            Gump parent          = null,
            int?x                = null,
            int?y                = null,
            int numericWidth     = 30,
            int numericHeight    = 60,
            int displayID        = 10004,
            int numericDisplayID = 30073,
            params int[] numbers)
            : base(user, parent, x, y)
        {
            NumericWidth     = numericWidth;
            NumericHeight    = numericHeight;
            Numerics         = numbers ?? new int[0];
            DisplayID        = displayID;
            NumericDisplayID = numericDisplayID;

            ForceRecompile = true;
        }
Esempio n. 29
0
        public ListGump(
            Mobile user,
            Gump parent                      = null,
            int?x                            = null,
            int?y                            = null,
            IEnumerable <T> list             = null,
            string emptyText                 = null,
            string title                     = null,
            IEnumerable <ListGumpEntry> opts = null)
            : base(user, parent, x, y, list)
        {
            SearchResults = new List <T>();
            EmptyText     = emptyText ?? DefaultEmptyText;
            Title         = title ?? DefaultTitle;
            Minimized     = false;
            CanMove       = false;
            CanSearch     = true;

            Options = opts != null ? new MenuGumpOptions(opts) : new MenuGumpOptions();
        }
Esempio n. 30
0
        public virtual Gump GetGump()
        {
            if (this.m_Gump != null)
            {
                return(this.m_Gump);
            }
            if (this.m_Text == null || this.m_Text.Length <= 0)
            {
                return(this.m_Gump = (Gump)null);
            }
            this.m_Gump = (Gump) new GAlphaBackground(0, 0, 100, 100);
            GWrappedLabel gwrappedLabel = new GWrappedLabel(this.m_Text, (IFont)Engine.GetUniFont(1), Hues.Load(1153), 4, 4, this.m_WrapWidth);

            gwrappedLabel.X   -= gwrappedLabel.Image.xMin;
            gwrappedLabel.Y   -= gwrappedLabel.Image.yMin;
            this.m_Gump.Width  = gwrappedLabel.Image.xMax - gwrappedLabel.Image.xMin + 9;
            this.m_Gump.Height = gwrappedLabel.Image.yMax - gwrappedLabel.Image.yMin + 9;
            this.m_Gump.Children.Add((Gump)gwrappedLabel);
            return(this.m_Gump);
        }
Esempio n. 31
0
        public void WillParseXmfHtmlTokCliloc()
        {
            const string localPath = @"C:\Users\johns\Desktop\KvG Client 2.0";

            if (!Directory.Exists(localPath))
            {
                Debug.WriteLine("Not running test, requires Cliloc.enu");
                return;
            }

            Cliloc.Initialize(localPath);

            const string layout = "{ xmfhtmltok 250 570 100 20 0 0 0 1114514 @#1060675@ }";

            Gump gump = GumpParser.Parse(0x01, 0x01, 1, 1, layout, new string[] { });

            GumpElement ge = gump.GetElementByXY(250, 570);

            Assert.AreEqual("<DIV ALIGN=RIGHT>CLOSE</DIV>", ge.Text);
        }
Esempio n. 32
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.InRange(Location, 3))
            {
                if (FellowshipMedallion.IsDressed(from))
                {
                    Gump g = new Gump(100, 100);
                    g.AddBackground(0, 0, 570, 295, 0x2454);
                    g.AddImage(0, 0, 0x9CD6);
                    g.AddHtmlLocalized(335, 24, 223, 261, 1159381, 0xC63, false, true); // *squeak squeak* Have you come to play the instruments? *squeak squeak* I bet you are as good as Iolo! “Practice! Practice!” he would say, “Practice your musical scales!” *squeak squeak* My fingers were too tiny for the lute, but I could sing! Do Re Mi Fa So La Ti Do! *squeak squeak*  <br><br>Long ago, I was supposed to perform at the wedding of Shamino and Princess Beatrix. Ready to go at noon on the nose I would have been, but that was before...everything. *frowns* Sometimes I still visit Castle Sallé Dacil through a secret door in Ilshenar. Even though the castle has seen better days, I am still reminded of the Pure Love Princess Beatrix had for Shamino! *squeak squeak*

                    from.SendGump(g);
                    from.PlaySound(1664);
                }
                else
                {
                    PrivateOverheadMessage(MessageType.Regular, 0x47E, 1159380, from.NetState); // * You attempt to understand the spirit but your connection to them is weak... *
                }
            }
        }
Esempio n. 33
0
        public void WillParseXmfHtmlTokString()
        {
            const string localPath = @"C:\Users\johns\Desktop\KvG Client 2.0";

            if (!Directory.Exists(localPath))
            {
                Debug.WriteLine("Not running test, requires Cliloc.enu");
                return;
            }

            Cliloc.Initialize(localPath);

            const string layout = "{ xmfhtmltok 10 10 400 18 0 0 22660 1114513 @Heritage Raffle@ }";

            Gump gump = GumpParser.Parse(0x01, 0x01, 1, 1, layout, new string[] { });

            GumpElement ge = gump.GetElementByXY(10, 10);

            Assert.AreEqual("<DIV ALIGN=CENTER>Heritage Raffle</DIV>", ge.Text);
        }
Esempio n. 34
0
        private void newToolStripButton1_Click(object sender, EventArgs e)
        {
            CreateGumpDialog cgd = new CreateGumpDialog();

            string myGumpsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "My Gumps");

            if (!Directory.Exists(myGumpsPath))
            {
                Directory.CreateDirectory(myGumpsPath);
            }

            cgd.Path = Program.Settings.GetValue<string>("last_path", myGumpsPath);

            if (cgd.ShowDialog(this) == DialogResult.OK)
            {

                Program.Settings.SetValue<string>("last_path", cgd.Path);
                if (this.Gump != null && this.Gump.Modified)
                {
                    DialogResult res = MessageBox.Show(this, "Do you wish to save changes to your current gump?", "RunUO: GDK", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);

                    if (res == DialogResult.Cancel)
                    {
                        return;
                    }
                    else if (res == DialogResult.Yes)
                    {
                        this.Gump.Save(Gump.FileName);
                    }
                }

                Gump g = new Gump();
                g.Resolution = cgd.Resolution;
                g.Name = cgd.GumpName;
                //g.FileName = Path.Combine(cgd.Path, g.Name);

                Gump = g;

                Invalidate(true);
            }
        }
Esempio n. 35
0
 public BaseGumpsSelectedEventArgs(Gump gump)
     : base()
 {
     this.gump = gump;
 }
Esempio n. 36
0
 public HotKeyEventArgs(Gump gump, DesignerFrame designer, KeyData keyData)
 {
     this.gump = gump;
     this.designer = designer;
     this.keyData = keyData;
 }
Esempio n. 37
0
        private void openToolStripMenuItem2_Click(object sender, EventArgs e)
        {
            DialogResult res = openFileDialog.ShowDialog();

            if (res == DialogResult.OK)
            {
                string file = openFileDialog.FileName;

                if (this.Gump != null && this.Gump.Modified)
                {
                    DialogResult res2 = MessageBox.Show(this, "Do you wish to save changes to your current gump?", "RunUO: GDK", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);

                    if (res2 == DialogResult.Cancel)
                    {
                        return;
                    }
                    else if (res2 == DialogResult.Yes)
                    {
                        this.Gump.Save(Gump.FileName);
                    }
                }

                Gump g = new Gump();
                bool success = g.Load(file);

                if (!success)
                {
                    MessageBox.Show(this, "The file you were trying to load was either not a gdk file or is corrupt.", "RunUO: GDK");
                    return;
                }

                Gump = g;

                Invalidate();
            }
        }
Esempio n. 38
0
        public static Gump Parse(int client, int serial, int ID, int x, int y, string layout, string[] text)
        {
            bool closable = true, movable = true, disposable = true, resizable = true;

            List<GumpPage> pageList = new List<GumpPage>();
            List<GumpElement> gumpElementList = new List<GumpElement>();
            GumpElement lastGumpElement = null;
            GumpPage currentPage = null;
            if (String.IsNullOrEmpty(layout)) return null;
            string[] split = layout.Substring(layout.IndexOf('{')).TrimEnd('}', ' ').Split(new char[] { '}' }, StringSplitOptions.RemoveEmptyEntries);
            string[] formatted;
            for (int i = 0; i < split.Length; i++)
            {
                split[i] = split[i].TrimStart('{', ' ').Trim();
                formatted = split[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                for (int j = 0; j < formatted.Length; j++)
                    formatted[j] = formatted[j].Trim();

                switch (formatted[0])
                {
                    case "noclose":
                        closable = false;
                        break;
                    case "nodispose":
                        disposable = false;
                        break;
                    case "nomove":
                        movable = false;
                        break;
                    case "noresize":
                        resizable = false;
                        break;
                    case "button":
                        try
                        {
                            int gbX, gbY, gbNormalID, gbPressedID, gbID, gbType, gbParam;
                            if (Int32.TryParse(formatted[1], out gbX) &&
                                Int32.TryParse(formatted[2], out gbY) &&
                                Int32.TryParse(formatted[3], out gbNormalID) &&
                                Int32.TryParse(formatted[4], out gbPressedID) &&
                                Int32.TryParse(formatted[5], out gbType) &&
                                Int32.TryParse(formatted[6], out gbParam) &&
                                Int32.TryParse(formatted[7], out gbID))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.button;
                                ge.ParentPage = currentPage;
                                ge.X = gbX;
                                ge.Y = gbY;
                                ge.InactiveID = gbNormalID;
                                ge.ActiveID = gbPressedID;
                                ge.ElementID = gbID;
                                ge.ButtonType = gbType;
                                ge.Param = gbParam;
                                gumpElementList.Add(ge);
                            }
                            else OnError("button", layout);
                        }
                        catch { OnError("button", layout); }
                        break;
                    case "buttontileart":
                        try
                        {
                            int btX, btY, btNormalID, btPressedID, btID, btType, btParam, btItemID, btHue, btWidth, btHeight;
                            if (Int32.TryParse(formatted[1], out btX) &&
                                Int32.TryParse(formatted[2], out btY) &&
                                Int32.TryParse(formatted[3], out btNormalID) &&
                                Int32.TryParse(formatted[4], out btPressedID) &&
                                Int32.TryParse(formatted[5], out btType) &&
                                Int32.TryParse(formatted[6], out btParam) &&
                                Int32.TryParse(formatted[7], out btID) &&
                                Int32.TryParse(formatted[8], out btItemID) &&
                                Int32.TryParse(formatted[9], out btHue) &&
                                Int32.TryParse(formatted[10], out btWidth) &&
                                Int32.TryParse(formatted[11], out btHeight))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.buttontileart;
                                ge.ParentPage = currentPage;
                                ge.X = btX;
                                ge.Y = btY;
                                ge.ElementID = btID;
                                ge.ButtonType = btType;
                                ge.Height = btHeight;
                                ge.Width = btWidth;
                                ge.Hue = btHue;
                                ge.ItemID = btItemID;
                                ge.InactiveID = btNormalID;
                                ge.Param = btParam;
                                ge.ActiveID = btPressedID;
                                gumpElementList.Add(ge);
                                lastGumpElement = ge;
                            }
                            else OnError("buttontileart", layout);
                        }
                        catch { OnError("buttontileart", layout); }
                        break;
                    case "checkertrans":
                        try
                        {
                            int ctX, ctY, ctWidth, ctHeight;
                            if (Int32.TryParse(formatted[1], out ctX) &&
                                Int32.TryParse(formatted[2], out ctY) &&
                                Int32.TryParse(formatted[3], out ctWidth) &&
                                Int32.TryParse(formatted[4], out ctHeight))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.checkertrans;
                                ge.ParentPage = currentPage;
                                ge.X = ctX;
                                ge.Y = ctY;
                                ge.Width = ctWidth;
                                ge.Height = ctHeight;
                                gumpElementList.Add(ge);
                            }
                            else OnError("checkertrans", layout);
                        }
                        catch { OnError("checkertrans", layout); }
                        break;
                    case "croppedtext":
                        try
                        {
                            int crX, crY, crWidth, crHeight, crHue, crText;
                            if (Int32.TryParse(formatted[1], out crX) &&
                                Int32.TryParse(formatted[2], out crY) &&
                                Int32.TryParse(formatted[3], out crWidth) &&
                                Int32.TryParse(formatted[4], out crHeight) &&
                                Int32.TryParse(formatted[5], out crHue) &&
                                Int32.TryParse(formatted[6], out crText))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.croppedtext;
                                ge.ParentPage = currentPage;
                                ge.X = crX;
                                ge.Y = crY;
                                ge.Height = crHeight;
                                ge.Width = crWidth;
                                ge.Hue = crHue;
                                ge.Text = text[crText];
                                gumpElementList.Add(ge);
                            }
                            else OnError("croppedtext", layout);
                        }
                        catch { OnError("croppedtext", layout); }
                        break;
                    case "checkbox":
                        try
                        {
                            int cbX, cbY, cbInactiveID, cbActiveID, cbID, cbState;
                            if (Int32.TryParse(formatted[1], out cbX) &&
                                Int32.TryParse(formatted[2], out cbY) &&
                                Int32.TryParse(formatted[3], out cbInactiveID) &&
                                Int32.TryParse(formatted[4], out cbActiveID) &&
                                Int32.TryParse(formatted[5], out cbState) &&
                                Int32.TryParse(formatted[6], out cbID))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.checkbox;
                                ge.ParentPage = currentPage;
                                ge.X = cbX;
                                ge.Y = cbY;
                                ge.InactiveID = cbInactiveID;
                                ge.ActiveID = cbActiveID;
                                ge.ElementID = cbID;
                                ge.InitialState = cbState == 1;
                                gumpElementList.Add(ge);
                            }
                            else OnError("checkbox", layout);
                        }
                        catch { OnError("checkbox", layout); }
                        break;
                    case "page":
                        if (currentPage == null)
                            currentPage = new GumpPage();
                        else
                        {
                            currentPage.GumpElements = gumpElementList.ToArray();
                            pageList.Add(currentPage);
                            currentPage = new GumpPage();
                            gumpElementList = new List<GumpElement>();
                        }
                        int page;
                        if (Int32.TryParse(formatted[1], out page))
                        {
                            currentPage.Page = page;
                        }
                        else OnError("page", layout);
                        break;
                    case "gumppic":
                        try
                        {
                            int gpX, gpY, gpID, gpHue;
                            if (Int32.TryParse(formatted[1], out gpX) &&
                                Int32.TryParse(formatted[2], out gpY) &&
                                Int32.TryParse(formatted[3], out gpID))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.gumppic;
                                ge.ParentPage = currentPage;
                                if (formatted.Length > 4)
                                {
                                    for (int gp = 4; gp < formatted.Length; gp++)
                                    {
                                        if (formatted[gp].Contains("hue"))
                                        {
                                            if (GetInt(formatted[gp], out gpHue))
                                                ge.Hue = gpHue;
                                            else OnError("gumppic", layout);
                                        }
                                        else ge.Args = formatted[gp];
                                    }
                                }
                                ge.X = gpX;
                                ge.Y = gpY;
                                ge.ElementID = gpID;
                                gumpElementList.Add(ge);
                            }
                            else OnError("gumppic", layout);
                        }
                        catch { OnError("gumppic", layout); }
                        break;
                    case "gumppictiled":
                        try
                        {
                            int gtX, gtY, gtWidth, gtHeight, gtID;
                            if (Int32.TryParse(formatted[1], out gtX) &&
                                Int32.TryParse(formatted[2], out gtY) &&
                                Int32.TryParse(formatted[3], out gtWidth) &&
                                Int32.TryParse(formatted[4], out gtHeight) &&
                                Int32.TryParse(formatted[5], out gtID))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.gumppictiled;
                                ge.ParentPage = currentPage;
                                ge.X = gtX;
                                ge.Y = gtY;
                                ge.Width = gtWidth;
                                ge.Height = gtHeight;
                                ge.ElementID = gtID;
                                gumpElementList.Add(ge);
                            }
                            else OnError("gumppictiled", layout);
                        }
                        catch { OnError("gumppictiled", layout); }
                        break;
                    case "kr_xmfhtmlgump":
                        try
                        {
                            int xgX, xgY, xgWidth, xgHeight, xgCliloc, xgBackground, xgScrollbar;
                            if (Int32.TryParse(formatted[1], out xgX) &&
                               Int32.TryParse(formatted[2], out xgY) &&
                               Int32.TryParse(formatted[3], out xgWidth) &&
                               Int32.TryParse(formatted[4], out xgHeight) &&
                               Int32.TryParse(formatted[5], out xgCliloc) &&
                               Int32.TryParse(formatted[6], out xgBackground) &&
                               Int32.TryParse(formatted[7], out xgScrollbar))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.kr_xmfhtmlgump;
                                ge.ParentPage = currentPage;
                                ge.X = xgX;
                                ge.Y = xgY;
                                ge.Width = xgWidth;
                                ge.Height = xgHeight;
                                ge.Cliloc = xgCliloc;
                                ge.Background = xgBackground == 1;
                                ge.ScrollBar = xgScrollbar == 1;
                                if (xgCliloc != 0)
                                    ge.Text = Cliloc.GetProperty(xgCliloc);
                                gumpElementList.Add(ge);
                            }
                            else OnError("kr_xmfhtmlgump", layout);
                        }
                        catch { OnError("kr_xmfhtmlgump", layout); }
                        break;
                    case "mastergump":
                        try
                        {
                            int mgID;
                            if (Int32.TryParse(formatted[1], out mgID))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.mastergump;
                                ge.ParentPage = currentPage;
                                ge.ElementID = mgID;
                                gumpElementList.Add(ge);
                            }
                            else OnError("mastergump", layout);
                        }
                        catch { OnError("mastergump", layout); }
                        break;
                    case "radio":
                        try
                        {
                            int rX, rY, rInactiveID, rActiveID, rID, rState;
                            if (Int32.TryParse(formatted[1], out rX) &&
                                Int32.TryParse(formatted[2], out rY) &&
                                Int32.TryParse(formatted[3], out rInactiveID) &&
                                Int32.TryParse(formatted[4], out rActiveID) &&
                                Int32.TryParse(formatted[5], out rState) &&
                                Int32.TryParse(formatted[6], out rID))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.radio;
                                ge.ParentPage = currentPage;
                                ge.X = rX;
                                ge.Y = rY;
                                ge.InactiveID = rInactiveID;
                                ge.ActiveID = rActiveID;
                                ge.ElementID = rID;
                                ge.InitialState = rState == 1;
                                gumpElementList.Add(ge);
                            }
                            else OnError("radio", layout);
                        }
                        catch { OnError("radio", layout); }
                        break;
                    case "resizepic":
                        try
                        {
                            int rpX, rpY, rpWidth, rpHeight, rpID;
                            if (Int32.TryParse(formatted[1], out rpX) &&
                                Int32.TryParse(formatted[2], out rpY) &&
                                Int32.TryParse(formatted[3], out rpID) &&
                                Int32.TryParse(formatted[4], out rpWidth) &&
                                Int32.TryParse(formatted[5], out rpHeight))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.resizepic;
                                ge.ParentPage = currentPage;
                                ge.X = rpX;
                                ge.Y = rpY;
                                ge.Width = rpWidth;
                                ge.Height = rpWidth;
                                ge.ElementID = rpID;
                                gumpElementList.Add(ge);
                            }
                            else OnError("resizepic", layout);
                        }
                        catch { OnError("resizepic", layout); }
                        break;
                    case "text":
                        try
                        {
                            int tX, tY, tHue, tText;
                            if (Int32.TryParse(formatted[1], out tX) &&
                                Int32.TryParse(formatted[2], out tY) &&
                                Int32.TryParse(formatted[3], out tHue) &&
                                Int32.TryParse(formatted[4], out tText))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.text;
                                ge.ParentPage = currentPage;
                                ge.X = tX;
                                ge.Y = tY;
                                ge.Hue = tHue;
                                ge.Text = text[tText];
                                gumpElementList.Add(ge);
                            }
                            else OnError("text", layout);
                        }
                        catch { OnError("text", layout); }
                        break;
                    case "tooltip":
                        try
                        {
                            int tooltip;
                            if (Int32.TryParse(formatted[1], out tooltip) && lastGumpElement != null)
                            {
                                lastGumpElement.Tooltip = tooltip;
                                lastGumpElement.Text = Cliloc.GetProperty(tooltip);
                            }
                            else OnError("tooltip", layout);
                        }
                        catch { OnError("tooltip", layout); }
                        break;
                    case "htmlgump":
                        try
                        {
                            int hgX, hgY, hgWidth, hgHeight, hgText, hgBackground, hgScrollbar;
                            if (Int32.TryParse(formatted[1], out hgX) &&
                                Int32.TryParse(formatted[2], out hgY) &&
                                Int32.TryParse(formatted[3], out hgWidth) &&
                                Int32.TryParse(formatted[4], out hgHeight) &&
                                Int32.TryParse(formatted[5], out hgText) &&
                                Int32.TryParse(formatted[6], out hgBackground) &&
                                Int32.TryParse(formatted[7], out hgScrollbar))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.htmlgump;
                                ge.ParentPage = currentPage;
                                ge.X = hgX;
                                ge.Y = hgY;
                                ge.Width = hgWidth;
                                ge.Height = hgHeight;
                                ge.Text = text[hgText];
                                ge.ScrollBar = hgScrollbar == 1;
                                ge.Background = hgBackground == 1;
                                gumpElementList.Add(ge);
                            }
                            else OnError("htmlgump", layout);
                        }
                        catch { OnError("htmlgump", layout); }
                        break;
                    case "textentry":
                        try
                        {
                            int teX, teY, teWidth, teHeight, teText, teHue, teID;
                            if (Int32.TryParse(formatted[1], out teX) &&
                               Int32.TryParse(formatted[2], out teY) &&
                               Int32.TryParse(formatted[3], out teWidth) &&
                               Int32.TryParse(formatted[4], out teHeight) &&
                               Int32.TryParse(formatted[5], out teHue) &&
                               Int32.TryParse(formatted[6], out teID) &&
                               Int32.TryParse(formatted[7], out teText))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.textentry;
                                ge.ParentPage = currentPage;
                                ge.X = teX;
                                ge.Y = teY;
                                ge.Height = teHeight;
                                ge.Width = teWidth;
                                ge.Hue = teHue;
                                ge.ElementID = teID;
                                ge.Text = text[teText];
                                gumpElementList.Add(ge);
                            }
                            else OnError("textentry", layout);
                        }
                        catch { OnError("textentry", layout); }
                        break;
                    case "textentrylimited":
                        try
                        {
                            int tlX, tlY, tlWidth, tlHeight, tlText, tlHue, tlID, tlSize;
                            if (Int32.TryParse(formatted[1], out tlX) &&
                               Int32.TryParse(formatted[2], out tlY) &&
                               Int32.TryParse(formatted[3], out tlWidth) &&
                               Int32.TryParse(formatted[4], out tlHeight) &&
                               Int32.TryParse(formatted[5], out tlHue) &&
                               Int32.TryParse(formatted[6], out tlID) &&
                               Int32.TryParse(formatted[7], out tlText) &&
                               Int32.TryParse(formatted[8], out tlSize))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.textentrylimited;
                                ge.ParentPage = currentPage;
                                ge.X = tlX;
                                ge.Y = tlY;
                                ge.Height = tlHeight;
                                ge.Width = tlWidth;
                                ge.Hue = tlHue;
                                ge.ElementID = tlID;
                                ge.Text = text[tlText];
                                ge.Size = tlSize;
                                gumpElementList.Add(ge);
                            }
                            else OnError("textentrylimited", layout);
                        }
                        catch { OnError("textentrylimited", layout); }
                        break;
                    case "tilepic":
                        try
                        {
                            int tpX, tpY, tpID;
                            if (Int32.TryParse(formatted[1], out tpX) &&
                               Int32.TryParse(formatted[2], out tpY) &&
                               Int32.TryParse(formatted[3], out tpID))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.tilepic;
                                ge.ParentPage = currentPage;
                                ge.X = tpX;
                                ge.Y = tpY;
                                ge.ElementID = tpID;
                                gumpElementList.Add(ge);
                            }
                            else OnError("tilepic", layout);
                        }
                        catch { OnError("tilepic", layout); }
                        break;
                    case "tilepichue":
                        try
                        {
                            int tpX, tpY, tpID, tpHue;
                            if (Int32.TryParse(formatted[1], out tpX) &&
                               Int32.TryParse(formatted[2], out tpY) &&
                               Int32.TryParse(formatted[3], out tpID) &&
                               Int32.TryParse(formatted[4], out tpHue))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.tilepichue;
                                ge.ParentPage = currentPage;
                                ge.X = tpX;
                                ge.Y = tpY;
                                ge.ElementID = tpID;
                                ge.Hue = tpHue;
                                gumpElementList.Add(ge);
                            }
                            else OnError("tilepichue", layout);
                        }
                        catch { OnError("tilepichue", layout); }
                        break;
                    case "xmfhtmlgump":
                        try
                        {
                            int xgX, xgY, xgWidth, xgHeight, xgCliloc, xgBackground, xgScrollbar;
                            if (Int32.TryParse(formatted[1], out xgX) &&
                               Int32.TryParse(formatted[2], out xgY) &&
                               Int32.TryParse(formatted[3], out xgWidth) &&
                               Int32.TryParse(formatted[4], out xgHeight) &&
                               Int32.TryParse(formatted[5], out xgCliloc) &&
                               Int32.TryParse(formatted[6], out xgBackground) &&
                               Int32.TryParse(formatted[7], out xgScrollbar))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.xmfhtmlgump;
                                ge.ParentPage = currentPage;
                                ge.X = xgX;
                                ge.Y = xgY;
                                ge.Width = xgWidth;
                                ge.Height = xgHeight;
                                ge.Cliloc = xgCliloc;
                                ge.Background = xgBackground == 1;
                                ge.ScrollBar = xgScrollbar == 1;
                                if (xgCliloc != 0)
                                    ge.Text = Cliloc.GetProperty(xgCliloc);
                                gumpElementList.Add(ge);
                            }
                            else OnError("xmfhtmlgump", layout);
                        }
                        catch { OnError("xmfhtmlgump", layout); }
                        break;
                    case "xmfhtmlgumpcolor":
                        try
                        {
                            int xcX, xcY, xcWidth, xcHeight, xcCliloc, xcBackground, xcScrollbar, xcHue;
                            if (Int32.TryParse(formatted[1], out xcX) &&
                               Int32.TryParse(formatted[2], out xcY) &&
                               Int32.TryParse(formatted[3], out xcWidth) &&
                               Int32.TryParse(formatted[4], out xcHeight) &&
                               Int32.TryParse(formatted[5], out xcCliloc) &&
                               Int32.TryParse(formatted[6], out xcBackground) &&
                               Int32.TryParse(formatted[7], out xcScrollbar) &&
                               Int32.TryParse(formatted[8], out xcHue))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.xmfhtmlgumpcolor;
                                ge.ParentPage = currentPage;
                                ge.X = xcX;
                                ge.Y = xcY;
                                ge.Width = xcWidth;
                                ge.Height = xcHeight;
                                ge.Cliloc = xcCliloc;
                                ge.Background = xcBackground == 1;
                                ge.ScrollBar = xcScrollbar == 1;
                                ge.Hue = xcHue;
                                if (xcCliloc != 0)
                                    ge.Text = Cliloc.GetProperty(xcCliloc);
                                gumpElementList.Add(ge);
                            }
                            else OnError("xmfhtmlgumpcolor", layout);
                        }
                        catch { OnError("xmfhtmlgumpcolor", layout); }
                        break;
                    case "xmfhtmltok":
                        try
                        {
                            int xtX, xtY, xtWidth, xtHeight, xtCliloc, xtBackground, xtScrollbar, xtHue;
                            if (Int32.TryParse(formatted[1], out xtX) &&
                               Int32.TryParse(formatted[2], out xtY) &&
                               Int32.TryParse(formatted[3], out xtWidth) &&
                               Int32.TryParse(formatted[4], out xtHeight) &&
                               Int32.TryParse(formatted[5], out xtCliloc) &&
                               Int32.TryParse(formatted[6], out xtBackground) &&
                               Int32.TryParse(formatted[7], out xtScrollbar) &&
                               Int32.TryParse(formatted[8], out xtHue))
                            {
                                GumpElement ge = new GumpElement();
                                ge.Type = ElementType.xmfhtmltok;
                                ge.ParentPage = currentPage;
                                string[] args = GetTokens(formatted[9]);
                                ge.Text = Cliloc.GetLocalString(xtCliloc, args);
                                ge.Args = formatted[9];
                                ge.X = xtX;
                                ge.Y = xtY;
                                ge.Width = xtWidth;
                                ge.Height = xtHeight;
                                ge.Hue = xtHue;
                                ge.Cliloc = xtCliloc;
                                ge.ScrollBar = xtScrollbar == 1;
                                ge.Background = xtBackground == 1;
                                gumpElementList.Add(ge);
                            }
                            else OnError("xmfhtmltok", layout);
                        }
                        catch { OnError("xmfhtmltok", layout); }
                        break;
                    case "itemproperty":
                        int itemserial;
                        if (Int32.TryParse(formatted[1], out itemserial))
                        {
                            GumpElement ge = new GumpElement();
                            ge.Type = ElementType.itemproperty;
                            ge.Serial = itemserial;
                            gumpElementList.Add(ge);
                        }
                        break;
                    default:
                        Log.LogMessage(string.Format("Unknown element \"{0}\" in custom gump layout:\r\n\r\n{1}", formatted[0], layout));
                        break;
                }
            }

            if (currentPage != null)
            {
                currentPage.GumpElements = gumpElementList.ToArray();
                pageList.Add(currentPage);
            }
            Gump g = new Gump(client, x, y, ID, serial, layout, text, gumpElementList.ToArray(), pageList.ToArray());
            g.Closable = closable;
            g.Disposable = disposable;
            g.Movable = movable;
            g.Resizable = resizable;
            return g;
        }
Esempio n. 39
0
        internal void AppendTo(Gump.IGumpWriter disp)
        {
            switch (Type)
            {
                case ElementType.textentrylimited:
                    {
                        disp.AppendLayout( Gump.StringToBuffer( "textentrylimited" ) );
                        disp.AppendLayout( myX );
                        disp.AppendLayout( myY );
                        disp.AppendLayout( myWidth );
                        disp.AppendLayout( myHeight );
                        disp.AppendLayout( myHue );
                        disp.AppendLayout( myElementID );
                        disp.AppendLayout( ParentGump.Intern( myText ) );
                        disp.AppendLayout( mySize );
                        disp.TextEntries++;
                        break;
                    }
                case ElementType.textentry:
                    {
                        disp.AppendLayout( Gump.StringToBuffer( "textentry" ) );
                        disp.AppendLayout( myX );
                        disp.AppendLayout( myY );
                        disp.AppendLayout( myWidth );
                        disp.AppendLayout( myHeight );
                        disp.AppendLayout( myHue );
                        disp.AppendLayout( myElementID );
                        disp.AppendLayout( ParentGump.Intern( myText ) );
                        disp.TextEntries++;
                        break;
                    }
                case ElementType.radio:
                    {
                        disp.AppendLayout( Gump.StringToBuffer( "radio" ) );
                        disp.AppendLayout( myX );
                        disp.AppendLayout( myY );
                        disp.AppendLayout( myInactiveID );
                        disp.AppendLayout( myActiveID );
                        disp.AppendLayout( myInitialState );
                        disp.AppendLayout( myElementID );
                        disp.Switches++;
                        break;
                    }
                case ElementType.croppedtext:
                    {
                        disp.AppendLayout( Gump.StringToBuffer( "croppedtext" ) );
                        disp.AppendLayout( myX );
                        disp.AppendLayout( myY );
                        disp.AppendLayout( myWidth );
                        disp.AppendLayout( myHeight );
                        disp.AppendLayout( myHue );
                        disp.AppendLayout( ParentGump.Intern( myText ) );
                        break;
                    }
                case ElementType.buttontileart:
                    {
                        disp.AppendLayout( Gump.StringToBuffer("buttontileart") );
                        disp.AppendLayout( myX );
                        disp.AppendLayout( myY );
                        disp.AppendLayout( myInactiveID );
                        disp.AppendLayout( myActiveID );
                        disp.AppendLayout( myButtonType );
                        disp.AppendLayout( myParam );
                        disp.AppendLayout( myElementID );
                        disp.AppendLayout( myItemID );
                        disp.AppendLayout( myHue );
                        disp.AppendLayout( myWidth );
                        disp.AppendLayout( myHeight );

                        if (myCliloc != -1)
                        {
                            disp.AppendLayout( Gump.StringToBuffer( " }{ tooltip" ));
                            disp.AppendLayout( myCliloc );
                        }
                        break;
                    }
                case ElementType.tilepic:
                case ElementType.tilepichue:
                    {
                        disp.AppendLayout( Gump.StringToBuffer( myHue == 0 ? "tilepic" : "tilepichue" ) );
                        disp.AppendLayout( myX );
                        disp.AppendLayout( myY );
                        disp.AppendLayout( myItemID );

                        if (myHue != 0)
                            disp.AppendLayout( myHue );
                        break;
                    }
                case ElementType.itemproperty:
                    {
                        disp.AppendLayout( Gump.StringToBuffer( "itemproperty" ) );
                        disp.AppendLayout( mySerial );
                        break;
                    }
                case ElementType.gumppictiled:
                    {
                        disp.AppendLayout( Gump.StringToBuffer( "gumppictiled" ) );
                        disp.AppendLayout( myX );
                        disp.AppendLayout( myY );
                        disp.AppendLayout( myWidth );
                        disp.AppendLayout( myHeight );
                        disp.AppendLayout( myElementID );
                        break;
                    }
                case ElementType.gumppic:
                    {
                        disp.AppendLayout( Gump.StringToBuffer( "gumppic" ) );
                        disp.AppendLayout( myX );
                        disp.AppendLayout( myY );
                        disp.AppendLayout( myElementID );

                        if (myHue != 0)
                        {
                            disp.AppendLayout( Gump.StringToBuffer( " hue=" ) );
                            disp.AppendLayoutNS( myHue );
                        }
                        break;
                    }
                case ElementType.xmfhtmlgump:
                    {
                        disp.AppendLayout( Gump.StringToBuffer( "xmfhtmlgump" ) );
                        disp.AppendLayout( myX );
                        disp.AppendLayout( myY );
                        disp.AppendLayout( myWidth );
                        disp.AppendLayout( myHeight );
                        disp.AppendLayout( myCliloc );
                        disp.AppendLayout( myBackground );
                        disp.AppendLayout( myScrollBar );
                        break;
                    }
                case ElementType.xmfhtmlgumpcolor:
                    {
                        disp.AppendLayout( Gump.StringToBuffer( "xmfhtmlgumpcolor" ) );
                        disp.AppendLayout( myX );
                        disp.AppendLayout( myY );
                        disp.AppendLayout( myWidth );
                        disp.AppendLayout( myHeight );
                        disp.AppendLayout( myCliloc );
                        disp.AppendLayout( myBackground );
                        disp.AppendLayout( myScrollBar );
                        disp.AppendLayout( myHue );
                        break;
                    }
                case ElementType.xmfhtmltok:
                    {
                        disp.AppendLayout( Gump.StringToBuffer( "xmfhtmltok" ) );
                        disp.AppendLayout( myX );
                        disp.AppendLayout( myY );
                        disp.AppendLayout( myWidth );
                        disp.AppendLayout( myHeight );
                        disp.AppendLayout( myBackground );
                        disp.AppendLayout( myScrollBar );
                        disp.AppendLayout( myHue );
                        disp.AppendLayout( myCliloc );
                        disp.AppendLayout( myArgs );
                        break;
                    }
                case ElementType.htmlgump:
                    {
                        disp.AppendLayout( Gump.StringToBuffer( "htmlgump" ) );
                        disp.AppendLayout( myX );
                        disp.AppendLayout( myY );
                        disp.AppendLayout( myWidth );
                        disp.AppendLayout( myHeight );
                        disp.AppendLayout( ParentGump.Intern( myText ) );
                        disp.AppendLayout( myBackground );
                        disp.AppendLayout( myScrollBar );
                        break;
                    }
                case ElementType.tooltip:
                    {
                        disp.AppendLayout( Gump.StringToBuffer( "tooltip" ) );
                        disp.AppendLayout( myCliloc );
                        break;
                    }
                case ElementType.group:
                    {
                        disp.AppendLayout( Gump.StringToBuffer( "group" ) );
                        disp.AppendLayout( myGroup );
                        break;
                    }
                case ElementType.resizepic:
                    {
                        disp.AppendLayout( Gump.StringToBuffer( "resizepic" ) );
                        disp.AppendLayout( myX );
                        disp.AppendLayout( myY );
                        disp.AppendLayout( myElementID );
                        disp.AppendLayout( myWidth );
                        disp.AppendLayout( myHeight );
                        break;
                    }
                case ElementType.checkertrans:
                    {
                        disp.AppendLayout( Gump.StringToBuffer( "checkertrans" ) );
                        disp.AppendLayout( myX );
                        disp.AppendLayout( myY );
                        disp.AppendLayout( myWidth );
                        disp.AppendLayout( myHeight );
                        break;
                    }
                case ElementType.page:
                    {
                        disp.AppendLayout( Gump.StringToBuffer( "page" ) );
                        disp.AppendLayout( myPageNumber );
                        break;
                    }
                case ElementType.button:
                    {
                        disp.AppendLayout( Gump.StringToBuffer("button") );
                        disp.AppendLayout( myX );
                        disp.AppendLayout( myY );
                        disp.AppendLayout( myInactiveID );
                        disp.AppendLayout( myActiveID );
                        disp.AppendLayout( myButtonType );
                        disp.AppendLayout( myParam );
                        disp.AppendLayout( myElementID );
                        break;
                    }
                case ElementType.text:
                    {
                        disp.AppendLayout( Gump.StringToBuffer( "text" ) );
                        disp.AppendLayout( myX );
                        disp.AppendLayout( myY );
                        disp.AppendLayout( myHue );
                        disp.AppendLayout( ParentGump.Intern( myText ) );
                        break;
                    }
                default:
                    break;
            }
        }
        public virtual void RenderOutline(Gump gump)
        {

        }
Esempio n. 41
0
 private void UnsubscribeToGump(Gump gump)
 {
     gump.AllItemsDeselected -= new EventHandler<EventArgs>(Gump_AllItemsDeselected);
     gump.AllItemsSelected -= new EventHandler<EventArgs>(Gump_AllItemsSelected);
     gump.Invalidated -= new EventHandler<EventArgs>(Gump_Invalidated);
     gump.ItemAdded -= new EventHandler<GumpCollectionEventArgs>(Gump_ItemAdded);
     gump.ItemRemoved -= new EventHandler<GumpCollectionEventArgs>(Gump_ItemRemoved);
     gump.LoadCompleted -= new EventHandler<EventArgs>(Gump_LoadCompleted);
     gump.LoadStarted -= new EventHandler<EventArgs>(Gump_LoadStarted);
     gump.SavingCompleted -= new EventHandler<EventArgs>(Gump_SavingCompleted);
     gump.SavingStarted -= new EventHandler<EventArgs>(Gump_SavingStarted);
 }