public ServerEntryGump(ServerListEntry entry, byte font, ushort normal_hue, ushort selected_hue)
            {
                _entry = entry;

                _buttonId = entry.Index;

                Add(_serverName = new HoveredLabel(entry.Name, false, normal_hue, selected_hue, selected_hue, font: font)
                {
                    X = 74,
                    AcceptMouseInput = false
                });
                Add(_server_ping = new HoveredLabel("-", false, normal_hue, selected_hue, selected_hue, font: font)
                {
                    X = 250,
                    AcceptMouseInput = false
                });
                Add(_server_packet_loss = new HoveredLabel("-", false, normal_hue, selected_hue, selected_hue, font: font)
                {
                    X = 320,
                    AcceptMouseInput = false
                });


                AcceptMouseInput = true;
                Width            = 393;
                Height           = 25;

                WantUpdateSize = false;
            }
            public CityControl(CityInfo c, int x, int y, int index)
            {
                CanMove = false;


                Add(_button = new Button(2 + index, 0x04B9, 0x04BA, 0x04BA)
                {
                    ButtonAction = ButtonAction.Activate,
                    X            = x,
                    Y            = y
                });

                y -= 20;

                _label = new HoveredLabel(c.City, false, 0x0058, 0x0099, 0x0481, font: 3)
                {
                    X   = x,
                    Y   = y,
                    Tag = index
                };

                if (_label.X + _label.Width >= 383)
                {
                    _label.X -= 60;
                }

                _label.MouseUp += (sender, e) =>
                {
                    _label.IsSelected = true;
                    int idx = (int)_label.Tag;
                    OnButtonClick(idx + 2);
                };
                Add(_label);
            }
Exemple #3
0
        private void BuildGump()
        {
            Width  = 88;
            Height = 44;

            Add(new ResizePic(0x24B8)
            {
                Width            = Width,
                Height           = Height,
                AcceptMouseInput = true,
                CanMove          = true
            });

            HoveredLabel label;

            Add(label = new HoveredLabel(_skill.Name, true, 0, 1151, Width, 1, FontStyle.None, TEXT_ALIGN_TYPE.TS_CENTER)
            {
                X                = 0,
                Y                = 0,
                Width            = Width - 10,
                AcceptMouseInput = true,
                CanMove          = true
            });
            label.Y = (Height >> 1) - (label.Height >> 1);
        }
Exemple #4
0
        private void BuildGump()
        {
            Width  = 88;
            Height = 44;

            Add(_buttonBackgroundNormal = new ResizePic(0x24B8)
            {
                Width  = Width,
                Height = Height
            });

            Add(_buttonBackgroundOver = new ResizePic(0x24EA)
            {
                Width  = Width,
                Height = Height
            });

            Add(_label = new HoveredLabel(_skill.Name, true, 0, 1151, Width - 10, 1, FontStyle.None, TEXT_ALIGN_TYPE.TS_CENTER)
            {
                X                = 5,
                Y                = 5,
                Width            = Width - 10,
                AcceptMouseInput = true,
                CanMove          = true
            });
            _label.Y = (Height / 2) - (_label.Height / 2);
        }
Exemple #5
0
            public ServerEntryGump(ServerListEntry entry)
            {
                _buttonId = entry.Index;

                Add(_serverName = new HoveredLabel($"{entry.Name}     -      -", false, NORMAL_COLOR, SELECTED_COLOR, NORMAL_COLOR, font: 5));
                _serverName.X   = 74;
                _serverName.Y   = 250;

                AcceptMouseInput = true;
                Width            = 393;
                Height           = 25;

                WantUpdateSize = false;
            }
Exemple #6
0
        private void CreateBook()
        {
            Clear();
            _pageCornerLeft = _pageCornerRight = null;
            GetBookInfo(_spellBookType, out Graphic bookGraphic, out Graphic minimizedGraphic, out Graphic iconStartGraphic, out int maxSpellsCount, out int spellsOnPage, out int dictionaryPagesCount);
            Add(new GumpPic(0, 0, bookGraphic, 0));
            Add(_pageCornerLeft                = new GumpPic(50, 8, 0x08BB, 0));
            _pageCornerLeft.LocalSerial        = 0;
            _pageCornerLeft.Page               = int.MaxValue;
            _pageCornerLeft.MouseUp           += PageCornerOnMouseClick;
            _pageCornerLeft.MouseDoubleClick  += PageCornerOnMouseDoubleClick;
            Add(_pageCornerRight               = new GumpPic(321, 8, 0x08BC, 0));
            _pageCornerRight.LocalSerial       = 1;
            _pageCornerRight.Page              = 1;
            _pageCornerRight.MouseUp          += PageCornerOnMouseClick;
            _pageCornerRight.MouseDoubleClick += PageCornerOnMouseDoubleClick;
            int totalSpells = 0;

            for (int circle = 0; circle < 8; circle++)
            {
                for (int i = 1; i <= 8; i++)
                {
                    if (_spellBook.HasSpell(circle, i))
                    {
                        _spells[circle * 8 + i - 1] = true;
                        totalSpells++;
                    }
                }
            }

            _maxPage = (dictionaryPagesCount >> 1) + ((totalSpells + 1) >> 1);

            int offs = 0;

            if (_spellBookType == SpellBookType.Magery)
            {
                Add(new Button((int)ButtonCircle.Circle_1_2, 0x08B1, 0x08B1)
                {
                    X = 58, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 1
                });

                Add(new Button((int)ButtonCircle.Circle_1_2, 0x08B2, 0x08B2)
                {
                    X = 93, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 1
                });

                Add(new Button((int)ButtonCircle.Circle_3_4, 0x08B3, 0x08B3)
                {
                    X = 130, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 2
                });

                Add(new Button((int)ButtonCircle.Circle_3_4, 0x08B4, 0x08B4)
                {
                    X = 164, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 2
                });

                Add(new Button((int)ButtonCircle.Circle_5_6, 0x08B5, 0x08B5)
                {
                    X = 227, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 3
                });

                Add(new Button((int)ButtonCircle.Circle_5_6, 0x08B6, 0x08B6)
                {
                    X = 260, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 3
                });

                Add(new Button((int)ButtonCircle.Circle_7_8, 0x08B7, 0x08B7)
                {
                    X = 297, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 4
                });

                Add(new Button((int)ButtonCircle.Circle_7_8, 0x08B8, 0x08B8)
                {
                    X = 332, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 4
                });
            }

            int spellDone = 0;

            for (int i = 1; i <= dictionaryPagesCount >> 1; i++)
            {
                int page = i;

                for (int j = 0; j < 2; j++)
                {
                    if (page == 1 && _spellBookType == SpellBookType.Chivalry)
                    {
                        Label label = new Label("Tithing points\nAvailable: " + World.Player.TithingPoints, false, 0x0288, font: 6)
                        {
                            X = 62, Y = 162
                        };
                        Add(label, page);
                    }

                    int indexX = 106;
                    int dataX  = 62;
                    int y      = 0;

                    if (j % 2 != 0)
                    {
                        indexX = 269;
                        dataX  = 225;
                    }

                    Label text = new Label("INDEX", false, 0x0288, font: 6)
                    {
                        X = indexX, Y = 10
                    };
                    Add(text, page);

                    if (_spellBookType == SpellBookType.Magery)
                    {
                        text = new Label(SpellsMagery.CircleNames[(i - 1) * 2 + j % 2], false, 0x0288, font: 6)
                        {
                            X = dataX, Y = 30
                        };
                        Add(text, page);
                    }

                    int topage = (dictionaryPagesCount >> 1) + ((spellDone + 1) >> 1);

                    for (int k = 0; k < spellsOnPage; k++)
                    {
                        if (_spells[offs])
                        {
                            GetSpellNames(offs, out string name, out string abbreviature, out string reagents);

                            if (spellDone % 2 == 0)
                            {
                                topage++;
                            }

                            spellDone++;

                            text = new HoveredLabel(name, false, 0x0288, 0x33, font: 9)
                            {
                                X = dataX, Y = 52 + y, LocalSerial = (uint)topage, AcceptMouseInput = true, Tag = offs + 1
                            };

                            text.MouseUp          += OnClicked;
                            text.MouseDoubleClick += OnDoubleClicked;
                            Add(text, page);
                            y += 15;
                        }

                        offs++;
                    }
                }
            }

            int page1    = (dictionaryPagesCount >> 1) + 1;
            int topTextY = 6;

            for (int i = 0, spellsDone = 0; i < maxSpellsCount; i++)
            {
                if (!_spells[i])
                {
                    continue;
                }

                int  iconX      = 62;
                int  topTextX   = 87;
                int  iconTextX  = 112;
                uint iconSerial = 100 + (uint)i;

                if (spellsDone > 0)
                {
                    if (spellsDone % 2 != 0)
                    {
                        iconX      = 225;
                        topTextX   = 224;
                        iconTextX  = 275;
                        iconSerial = 1000 + (uint)i;
                    }
                    else
                    {
                        page1++;
                    }
                }

                spellsDone++;

                GetSpellNames(i, out string name, out string abbreviature, out string reagents);

                switch (_spellBookType)
                {
                case SpellBookType.Magery:

                {
                    Label text = new Label(SpellsMagery.CircleNames[i >> 3], false, 0x0288, font: 6)
                    {
                        X = topTextX,
                        Y = topTextY + 4
                    };
                    Add(text, page1);

                    text = new Label(name, false, 0x0288, 80, 6)
                    {
                        X = iconTextX,
                        Y = 34
                    };
                    Add(text, page1);
                    int abbreviatureY = 26;

                    if (text.Height < 24)
                    {
                        abbreviatureY = 31;
                    }
                    abbreviatureY += text.Height;

                    text = new Label(abbreviature, false, 0x0288, font: 8)
                    {
                        X = iconTextX,
                        Y = abbreviatureY
                    };
                    Add(text, page1);

                    break;
                }

                case SpellBookType.Bardic:

                {
                    Label text = new Label(SpellsBardic.GetUsedSkillName(i), false, 0x0288, font: 6)
                    {
                        X = topTextX,
                        Y = topTextY + 4
                    };
                    Add(text, page1);

                    text = new Label(name, false, 0x0288, 80, 6)
                    {
                        X = iconTextX,
                        Y = 34
                    };
                    Add(text, page1);

                    break;
                }

                default:

                {
                    Label text = new Label(name, false, 0x0288, font: 6)
                    {
                        X = topTextX,
                        Y = topTextY
                    };
                    Add(text, page1);

                    if (!string.IsNullOrEmpty(abbreviature))
                    {
                        text = new Label(abbreviature, false, 0x0288, 80, 6)
                        {
                            X = iconTextX,
                            Y = 34
                        };
                        Add(text, page1);
                    }

                    break;
                }
                }

                GumpPic icon = new GumpPic(iconX, 40, (Graphic)(iconStartGraphic + i), 0)
                {
                    X = iconX, Y = 40, LocalSerial = iconSerial
                };

                GetSpellToolTip(out int toolTipCliloc);

                if (toolTipCliloc > 0)
                {
                    string tooltip = FileManager.Cliloc.GetString(toolTipCliloc + i);
                    icon.SetTooltip(tooltip, 150);
                }

                icon.MouseDoubleClick += (sender, e) =>
                {
                    if (e.Button == MouseButton.Left)
                    {
                        SpellDefinition def = GetSpellDefinition(sender as Control);

                        if (def != null)
                        {
                            GameActions.CastSpell(def.ID);
                        }
                    }
                };

                icon.DragBegin += (sender, e) =>
                {
                    if (Engine.UI.IsDragging)
                    {
                        return;
                    }

                    SpellDefinition def = GetSpellDefinition(sender as Control);

                    if (def == null)
                    {
                        return;
                    }

                    UseSpellButtonGump gump = new UseSpellButtonGump(def)
                    {
                        X = Mouse.Position.X - 22, Y = Mouse.Position.Y - 22
                    };

                    Engine.UI.Add(gump);
                    Engine.UI.AttemptDragControl(gump, Mouse.Position, true);
                };

                Add(icon, page1);

                if (!string.IsNullOrEmpty(reagents))
                {
                    Add(new GumpPicTiled(iconX, 88, 120, 5, 0x0835), page1);

                    Label text = new Label("Reagents:", false, 0x0288, font: 6)
                    {
                        X = iconX, Y = 92
                    };
                    Add(text, page1);

                    text = new Label(reagents, false, 0x0288, font: 9)
                    {
                        X = iconX, Y = 114
                    };
                    Add(text, page1);
                }

                if (_spellBookType != SpellBookType.Magery)
                {
                    GetSpellRequires(i, out int requiriesY, out string requires);

                    Label text = new Label(requires, false, 0x0288, font: 6)
                    {
                        X = iconX, Y = requiriesY
                    };
                    Add(text, page1);
                }
            }

            SetActivePage(1);
        }
Exemple #7
0
        private void BuildGump()
        {
            Add(new GumpPic(0, 0, 0x2B02, 0));


            Add(_pageCornerLeft                = new GumpPic(50, 8, 0x08BB, 0));
            _pageCornerLeft.LocalSerial        = 0;
            _pageCornerLeft.Page               = int.MaxValue;
            _pageCornerLeft.MouseClick        += PageCornerOnMouseClick;
            _pageCornerLeft.MouseDoubleClick  += PageCornerOnMouseDoubleClick;
            Add(_pageCornerRight               = new GumpPic(321, 8, 0x08BC, 0));
            _pageCornerRight.LocalSerial       = 1;
            _pageCornerRight.Page              = 1;
            _pageCornerRight.MouseClick       += PageCornerOnMouseClick;
            _pageCornerRight.MouseDoubleClick += PageCornerOnMouseDoubleClick;

            int offs = 0;

            for (int page = 1; page <= _dictionaryPagesCount; page++)
            {
                for (int j = 0; j < 2; j++)
                {
                    int indexX       = 96;
                    int dataX        = 52;
                    int y            = 0;
                    int spellsOnPage = 9;

                    if (j % 2 != 0)
                    {
                        indexX       = 259;
                        dataX        = 215;
                        spellsOnPage = 4;
                    }

                    Label text = new Label("INDEX", false, 0x0288, font: 6)
                    {
                        X = indexX, Y = 6
                    };
                    Add(text, page);

                    for (int i = 0; i < spellsOnPage; i++)
                    {
                        if (offs >= _abilityCount)
                        {
                            break;
                        }

                        text = new HoveredLabel(AbilityData.Abilities[offs].Name, false, 0x0288, 0x33, font: 9)
                        {
                            X = dataX, Y = 42 + y, AcceptMouseInput = true,
                        };

                        Add(text, page);

                        y += 15;
                        offs++;
                    }

                    if (spellsOnPage == 4)
                    {
                        _primAbility = new GumpPic(215, 105, (ushort)(0x5200 + ((byte)World.Player.PrimaryAbility & 0x7F) - 1), 0);
                        text         = new Label("Primary Ability Icon", false, 0x0288, 80, 6)
                        {
                            X = 265, Y = 105
                        };
                        Add(_primAbility);
                        Add(text, page);

                        _primAbility.DragBegin += (sender, e) =>
                        {
                            AbilityDefinition def = AbilityData.Abilities[((byte)World.Player.PrimaryAbility & 0x7F) - 1];

                            UseAbilityButtonGump gump = new UseAbilityButtonGump(def, true)
                            {
                                X = Mouse.Position.X - 22, Y = Mouse.Position.Y - 22
                            };
                            Engine.UI.Add(gump);
                            Engine.UI.AttemptDragControl(gump, Mouse.Position, true);
                        };

                        _secAbility = new GumpPic(215, 150, (ushort)(0x5200 + ((byte)World.Player.SecondaryAbility & 0x7F) - 1), 0);
                        text        = new Label("Secondary Ability Icon", false, 0x0288, 80, 6)
                        {
                            X = 265, Y = 150
                        };
                        Add(_secAbility);
                        Add(text, page);

                        _secAbility.DragBegin += (sender, e) =>
                        {
                            AbilityDefinition def = AbilityData.Abilities[((byte)World.Player.SecondaryAbility & 0x7F) - 1];

                            UseAbilityButtonGump gump = new UseAbilityButtonGump(def, false)
                            {
                                X = Mouse.Position.X - 22,
                                Y = Mouse.Position.Y - 22
                            };
                            Engine.UI.Add(gump);
                            Engine.UI.AttemptDragControl(gump, Mouse.Position, true);
                        };
                    }
                }
            }
        }
        private void BuildGump()
        {
            Add(new GumpPic(0, 0, 0x2B29, 0));

            Add(_pageCornerLeft                = new GumpPic(50, 8, 0x08BB, 0));
            _pageCornerLeft.LocalSerial        = 0;
            _pageCornerLeft.Page               = int.MaxValue;
            _pageCornerLeft.MouseUp           += PageCornerOnMouseClick;
            _pageCornerLeft.MouseDoubleClick  += PageCornerOnMouseDoubleClick;
            Add(_pageCornerRight               = new GumpPic(321, 8, 0x08BC, 0));
            _pageCornerRight.LocalSerial       = 1;
            _pageCornerRight.Page              = 1;
            _pageCornerRight.MouseUp          += PageCornerOnMouseClick;
            _pageCornerRight.MouseDoubleClick += PageCornerOnMouseDoubleClick;

            int    abilityOnPage    = 0;
            ushort iconStartGraphic = 0;

            GetSummaryBookInfo(ref abilityOnPage, ref iconStartGraphic);

            _pagesCount = _dictionaryPagesCount + (_abilityCount >> 1);
            //_pagesCount >>= 1;

            int offs = 0;

            for (int page = 1; page <= _dictionaryPagesCount; page++)
            {
                for (int j = 0; j < 2; j++)
                {
                    int indexX = 106;
                    int dataX  = 62;
                    int y      = 0;

                    if (j % 2 != 0)
                    {
                        indexX = 269;
                        dataX  = 225;
                    }


                    Label text = new Label("INDEX", false, 0x0288, font: 6)
                    {
                        X = indexX, Y = 10
                    };
                    Add(text, page);

                    for (int i = 0; i < abilityOnPage; i++)
                    {
                        if (offs >= _abilityCount)
                        {
                            break;
                        }

                        bool passive = true;

                        text = new HoveredLabel(GetAbilityName(offs, ref passive), false, 0x0288, 0x33, font: 9)
                        {
                            X = dataX,
                            Y = 52 + y,
                            AcceptMouseInput = true
                        };

                        Add(text, page);

                        y += 15;
                        offs++;
                    }
                }
            }

            int page1 = _dictionaryPagesCount;

            for (int i = 0; i < _abilityCount; i++)
            {
                int iconX     = 62;
                int iconTextX = 112;

                if (i > 0 && i % 2 != 0)
                {
                    iconX     = 225;
                    iconTextX = 275;
                }
                else
                {
                    page1++;
                }


                bool   passive   = true;
                string spellName = GetAbilityName(i, ref passive);

                Label text = new Label(spellName, false, 0x0288, 100, 6)
                {
                    X = iconTextX, Y = 34
                };
                Add(text, page1);

                if (passive)
                {
                    text = new Label("(Passive)", false, 0x0288, font: 6)
                    {
                        X = iconTextX,
                        Y = 64
                    };
                    Add(text, page1);
                }


                GumpPic pic = new GumpPic(iconX, 40, iconStartGraphic, 0);

                Add(pic, page1);
                pic.SetTooltip(UOFileManager.Cliloc.GetString(_tooltipOffset + i), 150);
                Add(new GumpPicTiled(iconX, 88, 120, 4, 0x0835), page1);
            }
        }
        private void BuildGump()
        {
            Add(new GumpPic(0, 0, 0x2B02, 0));


            Add(_pageCornerLeft                = new GumpPic(50, 8, 0x08BB, 0));
            _pageCornerLeft.LocalSerial        = 0;
            _pageCornerLeft.Page               = int.MaxValue;
            _pageCornerLeft.MouseUp           += PageCornerOnMouseClick;
            _pageCornerLeft.MouseDoubleClick  += PageCornerOnMouseDoubleClick;
            Add(_pageCornerRight               = new GumpPic(321, 8, 0x08BC, 0));
            _pageCornerRight.LocalSerial       = 1;
            _pageCornerRight.Page              = 1;
            _pageCornerRight.MouseUp          += PageCornerOnMouseClick;
            _pageCornerRight.MouseDoubleClick += PageCornerOnMouseDoubleClick;

            int offs = 0;

            int maxPages = _dictionaryPagesCount + 1;

            for (int page = 1; page <= _dictionaryPagesCount; page++)
            {
                for (int j = 0; j < 2; j++)
                {
                    int indexX       = 96;
                    int dataX        = 52;
                    int y            = 0;
                    int spellsOnPage = 9;

                    if (j % 2 != 0)
                    {
                        indexX       = 259;
                        dataX        = 215;
                        spellsOnPage = 4;
                    }

                    Label text = new Label(ResGumps.Index, false, 0x0288, font: 6)
                    {
                        X = indexX, Y = 6
                    };
                    Add(text, page);

                    for (int i = 0; i < spellsOnPage; i++)
                    {
                        if (offs >= _abilityCount)
                        {
                            break;
                        }

                        text = new HoveredLabel
                               (
                            AbilityData.Abilities[offs].Name,
                            false,
                            0x0288,
                            0x33,
                            0x0288,
                            font: 9
                               )
                        {
                            X           = dataX, Y = 42 + y, AcceptMouseInput = true,
                            LocalSerial = (uint)maxPages++,
                            Tag         = offs
                        };

                        text.MouseUp += (s, e) =>
                        {
                            if (s is HoveredLabel l && e.Button == MouseButtonType.Left)
                            {
                                _clickTiming += Mouse.MOUSE_DELAY_DOUBLE_CLICK;

                                if (_clickTiming > 0)
                                {
                                    _lastPressed = l;
                                }
                            }
                        };

                        Add(text, page);
                        text.SetTooltip(ClilocLoader.Instance.GetString(1061693 + offs), 150);

                        y += 15;
                        offs++;
                    }

                    if (spellsOnPage == 4)
                    {
                        byte bab1 = (byte)(((byte)World.Player.PrimaryAbility & 0x7F) - 1);

                        _primAbility = new GumpPic(215, 105, (ushort)(0x5200 + bab1), 0);

                        text = new Label
                               (
                            ResGumps.PrimaryAbilityIcon,
                            false,
                            0x0288,
                            80,
                            6
                               )
                        {
                            X = 265, Y = 105
                        };

                        Add(_primAbility, page);
                        Add(text, page);
                        _primAbility.SetTooltip(ClilocLoader.Instance.GetString(1028838 + bab1));
                        _primAbility.DragBegin += OnGumpicDragBeginPrimary;


                        byte bab2 = (byte)(((byte)World.Player.SecondaryAbility & 0x7F) - 1);

                        _secAbility = new GumpPic(215, 150, (ushort)(0x5200 + bab2), 0);

                        text = new Label
                               (
                            ResGumps.SecondaryAbilityIcon,
                            false,
                            0x0288,
                            80,
                            6
                               )
                        {
                            X = 265, Y = 150
                        };

                        Add(_secAbility, page);
                        Add(text, page);
                        _secAbility.SetTooltip(ClilocLoader.Instance.GetString(1028838 + bab2));
                        _secAbility.DragBegin += OnGumpicDragBeginSecondary;
                    }
                }
            }


            int pageW = _dictionaryPagesCount + 1;

            _dictionaryPagesCount += _abilityCount;

            for (int i = 0; i < _abilityCount; i++, pageW++)
            {
                if (i >= AbilityData.Abilities.Length)
                {
                    break;
                }

                GumpPic icon = new GumpPic(62, 40, (ushort)(0x5200 + i), 0);
                Add(icon, pageW);
                icon.SetTooltip(ClilocLoader.Instance.GetString(1061693 + i), 150);

                Label text = new Label
                             (
                    StringHelper.CapitalizeAllWords(AbilityData.Abilities[i].Name),
                    false,
                    0x0288,
                    80,
                    6
                             )
                {
                    X = 110,
                    Y = 34
                };

                Add(text, pageW);

                Add
                (
                    new GumpPicTiled(0x0835)
                {
                    X     = 62,
                    Y     = 88,
                    Width = 128
                },
                    pageW
                );


                List <ushort> list           = GetItemsList((byte)i);
                int           maxStaticCount = TileDataLoader.Instance.StaticData.Length;

                int textX = 62;
                int textY = 98;


                for (int j = 0; j < list.Count; j++)
                {
                    if (j == 6)
                    {
                        textX = 215;
                        textY = 34;
                    }

                    ushort id = list[j];

                    if (id >= maxStaticCount)
                    {
                        continue;
                    }

                    text = new Label(StringHelper.CapitalizeAllWords(TileDataLoader.Instance.StaticData[id].Name), false, 0x0288, font: 9)
                    {
                        X = textX,
                        Y = textY
                    };

                    Add(text, pageW);

                    textY += 16;
                }
            }
        }
Exemple #10
0
        private void CreateBook()
        {
            Clear();
            _pageCornerLeft = _pageCornerRight = null;
            GetBookInfo(_spellBookType, out Graphic bookGraphic, out Graphic minimizedGraphic, out Graphic iconStartGraphic, out int maxSpellsCount, out int spellIndexOffset, out int spellsOnPage, out int dictionaryPagesCount);
            AddChildren(new GumpPic(0, 0, bookGraphic, 0));
            AddChildren(_pageCornerLeft        = new GumpPic(50, 8, 0x08BB, 0));
            _pageCornerLeft.LocalSerial        = 0;
            _pageCornerLeft.Page               = int.MaxValue;
            _pageCornerLeft.MouseClick        += PageCornerOnMouseClick;
            _pageCornerLeft.MouseDoubleClick  += PageCornerOnMouseDoubleClick;
            AddChildren(_pageCornerRight       = new GumpPic(321, 8, 0x08BC, 0));
            _pageCornerRight.LocalSerial       = 1;
            _pageCornerRight.Page              = 1;
            _pageCornerRight.MouseClick       += PageCornerOnMouseClick;
            _pageCornerRight.MouseDoubleClick += PageCornerOnMouseDoubleClick;
            int totalSpells = 0;

            for (int circle = 0; circle < 8; circle++)
            {
                for (int i = 1; i <= 8; i++)
                {
                    if (_spellBook.HasSpell(circle, i))
                    {
                        _spells[circle * 8 + i - 1] = 1;
                        totalSpells++;
                    }
                }
            }

            _maxPage = (dictionaryPagesCount >> 1) + ((totalSpells + 1) >> 1);
            int  offs            = 0;
            bool isMageSpellbook = false;

            if (_spellBookType == SpellBookType.Magery)
            {
                isMageSpellbook = true;

                AddChildren(new Button((int)ButtonCircle.Circle_1_2, 0x08B1, 0x08B1)
                {
                    X = 58, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 1
                });

                AddChildren(new Button((int)ButtonCircle.Circle_1_2, 0x08B2, 0x08B2)
                {
                    X = 93, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 1
                });

                AddChildren(new Button((int)ButtonCircle.Circle_3_4, 0x08B3, 0x08B3)
                {
                    X = 130, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 2
                });

                AddChildren(new Button((int)ButtonCircle.Circle_3_4, 0x08B4, 0x08B4)
                {
                    X = 164, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 2
                });

                AddChildren(new Button((int)ButtonCircle.Circle_5_6, 0x08B5, 0x08B5)
                {
                    X = 227, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 3
                });

                AddChildren(new Button((int)ButtonCircle.Circle_5_6, 0x08B6, 0x08B6)
                {
                    X = 260, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 3
                });

                AddChildren(new Button((int)ButtonCircle.Circle_7_8, 0x08B7, 0x08B7)
                {
                    X = 297, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 4
                });

                AddChildren(new Button((int)ButtonCircle.Circle_7_8, 0x08B8, 0x08B8)
                {
                    X = 332, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 4
                });
            }

            for (int i = 1; i <= (dictionaryPagesCount >> 1); i++)
            {
                int page = i;

                for (int j = 0; j < 2; j++)
                {
                    if (page == 1 && _spellBookType == SpellBookType.Chivalry)
                    {
                        Label label = new Label("Tithing points\nAvailable: " + World.Player.TithingPoints, false, 0x0288, font: 6)
                        {
                            X = 62, Y = 162
                        };
                        AddChildren(label, page);
                    }

                    int  indexX      = 106;
                    int  dataX       = 62;
                    int  y           = 0;
                    uint spellSerial = 100;

                    if (j % 2 != 0)
                    {
                        indexX      = 269;
                        dataX       = 225;
                        spellSerial = 1000;
                    }

                    Label text = new Label("INDEX", false, 0x0288, font: 6)
                    {
                        X = indexX, Y = 10
                    };
                    AddChildren(text, page);

                    if (isMageSpellbook)
                    {
                        text = new Label(SpellsMagery.CircleNames[(i - 1) * 2 + j % 2], false, 0x0288, font: 6)
                        {
                            X = dataX, Y = 30
                        };
                        AddChildren(text, page);
                    }

                    for (int k = 0; k < spellsOnPage; k++)
                    {
                        if (_spells[offs] > 0)
                        {
                            GetSpellNames(offs, out string name, out string abbreviature, out string reagents);

                            text = new HoveredLabel(name, false, 0x0288, 0x33, font: 9)
                            {
                                X = dataX, Y = 52 + y, LocalSerial = (uint)((dictionaryPagesCount >> 1) + (offs >> 1) + 1), AcceptMouseInput = true
                            };

                            text.MouseClick += (sender, e) =>
                            {
                                HoveredLabel l = (HoveredLabel)sender;
                                SetActivePage((int)l.LocalSerial.Value);
                            };
                            AddChildren(text, page);
                            y += 15;
                        }

                        offs++;
                    }
                }
            }

            int  page1            = (dictionaryPagesCount >> 1) + 1;
            int  topTextY         = _spellBookType == SpellBookType.Magery ? 10 : 6;
            bool haveReagents     = _spellBookType <= SpellBookType.Necromancy;
            bool haveAbbreviature = _spellBookType != SpellBookType.Bushido && _spellBookType != SpellBookType.Ninjitsu;

            for (int i = 0; i < maxSpellsCount; i++)
            {
                if (_spells[i] <= 0)
                {
                    continue;
                }

                int  iconX      = 62;
                int  topTextX   = 87;
                int  iconTextX  = 112;
                uint iconSerial = 100 + (uint)i;


                if (i > 0)
                {
                    if (i % 2 != 0)
                    {
                        iconX      = 225;
                        topTextX   = 244 - 20;
                        iconTextX  = 275;
                        iconSerial = 1000 + (uint)(i);
                    }
                    else
                    {
                        page1++;
                    }
                }

                GetSpellNames(i, out string name, out string abbreviature, out string reagents);

                if (isMageSpellbook)
                {
                    Label text = new Label(SpellsMagery.CircleNames[i >> 3], false, 0x0288, font: 6)
                    {
                        X = topTextX, Y = topTextY
                    };
                    AddChildren(text, page1);

                    text = new Label(name, false, 0x0288, 80, 6)
                    {
                        X = iconTextX, Y = 34
                    };
                    AddChildren(text, page1);
                    int abbreviatureY = 26;

                    if (text.Height < 24)
                    {
                        abbreviatureY = 31;
                    }
                    abbreviatureY += text.Height;

                    text = new Label(abbreviature, false, 0x0288, font: 8)
                    {
                        X = iconTextX, Y = abbreviatureY
                    };
                    AddChildren(text, page1);
                }
                else
                {
                    Label text = new Label(name, false, 0x0288, font: 6)
                    {
                        X = topTextX, Y = topTextY
                    };
                    AddChildren(text, page1);

                    if (haveAbbreviature)
                    {
                        text = new Label(abbreviature, false, 0x0288, 80, 6)
                        {
                            X = iconTextX, Y = 34
                        };
                        AddChildren(text, page1);
                    }
                }

                GumpPic icon = new GumpPic(iconX, 40, (Graphic)(iconStartGraphic + i), 0)
                {
                    X = iconX, Y = 40, LocalSerial = iconSerial
                };

                icon.DragBegin += (sender, e) =>
                {
                    GumpControl     ctrl = (GumpControl)sender;
                    int             idx  = (int)(ctrl.LocalSerial > 1000 ? ctrl.LocalSerial - 1000 : ctrl.LocalSerial - 100) + 1;
                    SpellDefinition?def  = null;

                    switch (_spellBookType)
                    {
                    case SpellBookType.Magery:
                        def = SpellsMagery.GetSpell(idx);

                        break;

                    case SpellBookType.Necromancy:
                        def = SpellsNecromancy.GetSpell(idx);

                        break;

                    case SpellBookType.Chivalry:
                        def = SpellsChivalry.GetSpell(idx);

                        break;

                    case SpellBookType.Bushido:
                        def = SpellsBushido.GetSpell(idx);

                        break;

                    case SpellBookType.Ninjitsu:
                        def = SpellsNinjitsu.GetSpell(idx);

                        break;

                    case SpellBookType.Spellweaving:
                        def = SpellsSpellweaving.GetSpell(idx);

                        break;

                    case SpellBookType.Mysticism:
                        def = SpellsMysticism.GetSpell(idx);

                        break;

                    default:

                        throw new ArgumentOutOfRangeException();
                    }

                    UseSpellButtonGump gump = new UseSpellButtonGump(def.Value)
                    {
                        X = Mouse.Position.X - 22, Y = Mouse.Position.Y - 22
                    };
                    UIManager.Add(gump);
                    UIManager.AttemptDragControl(gump, Mouse.Position, true);
                };
                AddChildren(icon, page1);

                if (haveReagents)
                {
                    AddChildren(new GumpPicTiled(iconX, 88, 120, 5, 0x0835), page1);

                    Label text = new Label("Reagents:", false, 0x0288, font: 6)
                    {
                        X = iconX, Y = 92
                    };
                    AddChildren(text, page1);

                    text = new Label(reagents, false, 0x0288, font: 9)
                    {
                        X = iconX, Y = 114
                    };
                    AddChildren(text, page1);
                }

                if (!isMageSpellbook)
                {
                    GetSpellRequires(i, out int requiriesY, out string requires);

                    Label text = new Label(requires, false, 0x0288, font: 6)
                    {
                        X = iconX, Y = requiriesY
                    };
                    AddChildren(text, page1);
                }
            }

            SetActivePage(1);
        }
        private void BuildGump()
        {
            Add(new GumpPic(0, 0, 0x2B29, 0));

            Add(_pageCornerLeft                = new GumpPic(50, 8, 0x08BB, 0));
            _pageCornerLeft.LocalSerial        = 0;
            _pageCornerLeft.Page               = int.MaxValue;
            _pageCornerLeft.MouseUp           += PageCornerOnMouseClick;
            _pageCornerLeft.MouseDoubleClick  += PageCornerOnMouseDoubleClick;
            Add(_pageCornerRight               = new GumpPic(321, 8, 0x08BC, 0));
            _pageCornerRight.LocalSerial       = 1;
            _pageCornerRight.Page              = 1;
            _pageCornerRight.MouseUp          += PageCornerOnMouseClick;
            _pageCornerRight.MouseDoubleClick += PageCornerOnMouseDoubleClick;

            int    abilityOnPage    = 0;
            ushort iconStartGraphic = 0;

            GetSummaryBookInfo(ref abilityOnPage, ref iconStartGraphic);

            _pagesCount = _dictionaryPagesCount + (_abilityCount >> 1);

            int offs = 0;

            for (int page = 1, topage = _dictionaryPagesCount - 1; page <= _dictionaryPagesCount; page++)
            {
                for (int j = 0; j < 2; j++)
                {
                    int indexX = 106;
                    int dataX  = 62;
                    int y      = 0;

                    if (j % 2 != 0)
                    {
                        indexX = 269;
                        dataX  = 225;
                    }


                    Label text = new Label(ResGumps.Index, false, 0x0288, font: 6)
                    {
                        X = indexX, Y = 10
                    };
                    Add(text, page);

                    for (int i = 0; i < abilityOnPage; i++)
                    {
                        if (offs >= _abilityCount)
                        {
                            break;
                        }

                        if (offs % 2 == 0)
                        {
                            topage++;
                        }

                        bool passive = true;

                        text = new HoveredLabel(GetAbilityName(offs, ref passive), false, 0x0288, 0x33, 0x0288, font: 9)
                        {
                            X = dataX,
                            Y = 52 + y,
                            AcceptMouseInput = true,
                            LocalSerial      = (uint)topage
                        };

                        text.MouseUp += OnClicked;
                        Add(text, page);

                        y += 15;
                        offs++;
                    }
                }
            }

            int page1 = _dictionaryPagesCount - 1;

            for (int i = 0; i < _abilityCount; i++)
            {
                int iconX     = 62;
                int iconTextX = 112;

                if (i > 0 && i % 2 != 0)
                {
                    iconX     = 225;
                    iconTextX = 275;
                }
                else
                {
                    page1++;
                }


                bool   passive   = true;
                string spellName = GetAbilityName(i, ref passive);

                Label text = new Label(spellName, false, 0x0288, 100, 6)
                {
                    X = iconTextX, Y = 34
                };

                Add(text, page1);

                if (passive)
                {
                    text = new Label(ResGumps.Passive, false, 0x0288, font: 6)
                    {
                        X = iconTextX,
                        Y = 64
                    };

                    Add(text, page1);
                }

                ushort graphic = (ushort)(iconStartGraphic + i);

                GumpPic pic = new GumpPic(iconX, 40, graphic, 0)
                {
                    LocalSerial = graphic
                };

                if (!passive)
                {
                    pic.DragBegin += (sender, e) =>
                    {
                        if (UIManager.IsDragging)
                        {
                            return;
                        }

                        RacialAbilityButton gump = new RacialAbilityButton((ushort)((GumpPic)sender).LocalSerial)
                        {
                            X = Mouse.LDropPosition.X - 20,
                            Y = Mouse.LDropPosition.Y - 20
                        };

                        UIManager.Add(gump);
                        UIManager.AttemptDragControl(gump, Mouse.Position, true);
                    };

                    pic.MouseDoubleClick += (sender, e) =>
                    {
                        if ((ushort)((GumpPic)sender).LocalSerial == 0x5DDA && World.Player.Race == RaceType.GARGOYLE)
                        {
                            NetClient.Socket.Send(new PToggleGargoyleFlying());
                            e.Result = true;
                        }
                    };
                }

                Add(pic, page1);
                pic.SetTooltip(ClilocLoader.Instance.GetString(_tooltipOffset + i), 150);
                Add(new GumpPicTiled(iconX, 88, 120, 4, 0x0835), page1);
            }
        }
Exemple #12
0
        public ServerSelectionGump() : base(0, 0)
        {
            //AddChildren(new LoginBackground(true));

            Add(new Button((int)Buttons.Prev, 0x15A1, 0x15A3, 0x15A2)
            {
                X = 586, Y = 445, ButtonAction = ButtonAction.Activate
            });

            Add(new Button((int)Buttons.Next, 0x15A4, 0x15A6, 0x15A5)
            {
                X = 610, Y = 445, ButtonAction = ButtonAction.Activate
            });

            if (Client.Version >= ClientVersion.CV_500A)
            {
                ushort textColor = 0xFFFF;

                Add(new Label(ClilocLoader.Instance.GetString(1044579), true, textColor, font: 1)
                {
                    X = 155, Y = 70
                }); // "Select which shard to play on:"

                Add(new Label(ClilocLoader.Instance.GetString(1044577), true, textColor, font: 1)
                {
                    X = 400, Y = 70
                }); // "Latency:"

                Add(new Label(ClilocLoader.Instance.GetString(1044578), true, textColor, font: 1)
                {
                    X = 470, Y = 70
                }); // "Packet Loss:"

                Add(new Label(ClilocLoader.Instance.GetString(1044580), true, textColor, font: 1)
                {
                    X = 153, Y = 368
                }); // "Sort by:"
            }
            else
            {
                ushort textColor = 0x0481;

                Add(new Label("Select which shard to play on:", false, textColor, font: 9)
                {
                    X = 155, Y = 70
                });

                Add(new Label("Latency:", false, textColor, font: 9)
                {
                    X = 400, Y = 70
                });

                Add(new Label("Packet Loss:", false, textColor, font: 9)
                {
                    X = 470, Y = 70
                });

                Add(new Label("Sort by:", false, textColor, font: 9)
                {
                    X = 153, Y = 368
                });
            }

            Add(new Button((int)Buttons.SortTimeZone, 0x093B, 0x093C, 0x093D)
            {
                X = 230, Y = 366
            });

            Add(new Button((int)Buttons.SortFull, 0x093E, 0x093F, 0x0940)
            {
                X = 338, Y = 366
            });

            Add(new Button((int)Buttons.SortConnection, 0x0941, 0x0942, 0x0943)
            {
                X = 446, Y = 366
            });

            // World Pic Bg
            Add(new GumpPic(150, 390, 0x0589, 0));

            // Earth
            Add(new Button((int)Buttons.Earth, 0x15E8, 0x15EA, 0x15E9)
            {
                X = 160, Y = 400, ButtonAction = ButtonAction.Activate
            });

            // Sever Scroll Area Bg
            Add(new ResizePic(0x0DAC)
            {
                X = 150, Y = 90, Width = 393 - 14, Height = 271
            });
            // Sever Scroll Area
            ScrollArea scrollArea = new ScrollArea(150, 100, 383, 271, true);
            LoginScene loginScene = Client.Game.GetScene <LoginScene>();

            foreach (ServerListEntry server in loginScene.Servers)
            {
                HoveredLabel label;
                scrollArea.Add(label = new HoveredLabel($"{server.Name}                         -           -", false, NORMAL_COLOR, SELECTED_COLOR, NORMAL_COLOR, font: 5)
                {
                    X = 74,
                    //Y = 250
                });

                label.MouseUp += (sender, e) => { OnButtonClick((int)(Buttons.Server + server.Index)); };
            }

            Add(scrollArea);

            if (loginScene.Servers.Length != 0)
            {
                int index = Settings.GlobalSettings.LastServerNum - 1;

                if (index < 0 || index >= loginScene.Servers.Length)
                {
                    index = 0;
                }

                Add(new Label(loginScene.Servers[index].Name, false, 0x0481, font: 9)
                {
                    X = 243,
                    Y = 420
                });

                //if (loginScene.Servers.Last().Index < loginScene.Servers.Count())
                //{
                //    Add(new Label(loginScene.Servers.Last().Name, false, 0x0481, font: 9)
                //    {
                //        X = 243, Y = 420
                //    });
                //}
                //else
                //{
                //    Add(new Label(loginScene.Servers.First().Name, false, 0x0481, font: 9)
                //    {
                //        X = 243, Y = 420
                //    });
                //}
            }

            AcceptKeyboardInput    = true;
            CanCloseWithRightClick = false;
        }
Exemple #13
0
        private void BuildGump()
        {
            Add(new GumpPic(0, 0, 0x2B02, 0));


            Add(_pageCornerLeft                = new GumpPic(50, 8, 0x08BB, 0));
            _pageCornerLeft.LocalSerial        = 0;
            _pageCornerLeft.Page               = int.MaxValue;
            _pageCornerLeft.MouseUp           += PageCornerOnMouseClick;
            _pageCornerLeft.MouseDoubleClick  += PageCornerOnMouseDoubleClick;
            Add(_pageCornerRight               = new GumpPic(321, 8, 0x08BC, 0));
            _pageCornerRight.LocalSerial       = 1;
            _pageCornerRight.Page              = 1;
            _pageCornerRight.MouseUp          += PageCornerOnMouseClick;
            _pageCornerRight.MouseDoubleClick += PageCornerOnMouseDoubleClick;

            int offs = 0;

            for (int page = 1; page <= _dictionaryPagesCount; page++)
            {
                for (int j = 0; j < 2; j++)
                {
                    int indexX       = 96;
                    int dataX        = 52;
                    int y            = 0;
                    int spellsOnPage = 9;

                    if (j % 2 != 0)
                    {
                        indexX       = 259;
                        dataX        = 215;
                        spellsOnPage = 4;
                    }

                    Label text = new Label("INDEX", false, 0x0288, font: 6)
                    {
                        X = indexX, Y = 6
                    };
                    Add(text, page);

                    for (int i = 0; i < spellsOnPage; i++)
                    {
                        if (offs >= _abilityCount)
                        {
                            break;
                        }

                        text = new HoveredLabel(AbilityData.Abilities[offs].Name, false, 0x0288, 0x33, font: 9)
                        {
                            X = dataX, Y = 42 + y, AcceptMouseInput = true
                        };

                        Add(text, page);

                        y += 15;
                        offs++;
                    }

                    if (spellsOnPage == 4)
                    {
                        _primAbility = new GumpPic(215, 105, (ushort)(0x5200 + ((byte)World.Player.PrimaryAbility & 0x7F) - 1), 0);
                        text         = new Label("Primary Ability Icon", false, 0x0288, 80, 6)
                        {
                            X = 265, Y = 105
                        };
                        Add(_primAbility);
                        Add(text, page);

                        _primAbility.DragBegin += (sender, e) =>
                        {
                            if (Engine.UI.IsDragging)
                            {
                                return;
                            }

                            ref readonly AbilityDefinition def = ref AbilityData.Abilities[((byte)World.Player.PrimaryAbility & 0x7F) - 1];