예제 #1
0
        public GridLootGump(uint local) : base(local, 0)
        {
            _corpse = World.Items.Get(local);

            if (_corpse == null)
            {
                Dispose();

                return;
            }

            if (World.Player.ManualOpenedCorpses.Contains(LocalSerial))
            {
                World.Player.ManualOpenedCorpses.Remove(LocalSerial);
            }
            else if (World.Player.AutoOpenedCorpses.Contains
                         (LocalSerial) && ProfileManager.CurrentProfile != null && ProfileManager.CurrentProfile.SkipEmptyCorpse)
            {
                IsVisible    = false;
                _hideIfEmpty = true;
            }

            X = _lastX;
            Y = _lastY;

            CanMove                = true;
            AcceptMouseInput       = true;
            WantUpdateSize         = true;
            CanCloseWithRightClick = true;
            _background            = new AlphaBlendControl();
            //_background.Width = MAX_WIDTH;
            //_background.Height = MAX_HEIGHT;
            // ## BEGIN - END ## //
            if (ProfileManager.CurrentProfile.UOClassicCombatAL_EnableGridLootColoring)
            {
                if (_corpse.LootFlag != 0xFF && _corpse.LootFlag == ProfileManager.CurrentProfile.UOClassicCombatAL_SL_Gray)  //grey
                {
                    _background.Hue = 0x0040;                                                                                 //green
                }
                if (_corpse.LootFlag != 0xFF && _corpse.LootFlag == ProfileManager.CurrentProfile.UOClassicCombatAL_SL_Red)   //red
                {
                    _background.Hue = 0x0040;                                                                                 //green
                }
                if (_corpse.LootFlag != 0xFF && _corpse.LootFlag == ProfileManager.CurrentProfile.UOClassicCombatAL_SL_Green) //green
                {
                    _background.Hue = 0x0040;                                                                                 //green
                }
                if (_corpse.LootFlag != 0xFF && _corpse.LootFlag == ProfileManager.CurrentProfile.UOClassicCombatAL_SL_Blue)  //blue
                {
                    _background.Hue = 0x0021;                                                                                 //red
                }
            }
            //TRIGGER AL IF ENABLED
            if (ProfileManager.CurrentProfile.UOClassicCombatAL)
            {
                UOClassicCombatAL UOClassicCombatAL = UIManager.GetGump <UOClassicCombatAL>();
                UOClassicCombatAL?.OpenCorpseTrigger(_corpse.Serial);
            }
            // ## BEGIN - END ## //

            Add(_background);

            Width  = _background.Width;
            Height = _background.Height;

            _setlootbag = new NiceButton(3, Height - 23, 100, 20, ButtonAction.Activate, ResGumps.SetLootBag)
            {
                ButtonParameter = 2, IsSelectable = false
            };

            Add(_setlootbag);

            _buttonPrev = new NiceButton(Width - 80, Height - 20, 40, 20, ButtonAction.Activate, ResGumps.Prev)
            {
                ButtonParameter = 0, IsSelectable = false
            };

            _buttonNext = new NiceButton(Width - 40, Height - 20, 40, 20, ButtonAction.Activate, ResGumps.Next)
            {
                ButtonParameter = 1, IsSelectable = false
            };

            _buttonNext.IsVisible = _buttonPrev.IsVisible = false;


            Add(_buttonPrev);
            Add(_buttonNext);

            Add
            (
                _currentPageLabel = new Label("1", true, 999, align: TEXT_ALIGN_TYPE.TS_CENTER)
            {
                X = Width / 2 - 5,
                Y = Height - 20
            }
            );
        }
예제 #2
0
        protected override void UpdateContents()
        {
            // ## BEGIN - END ## //
            //TRIGGER AL IF ENABLED
            if (ProfileManager.CurrentProfile.UOClassicCombatAL)
            {
                UOClassicCombatAL UOClassicCombatAL = UIManager.GetGump <UOClassicCombatAL>();
                UOClassicCombatAL?.UpdateCorpseTrigger(_corpse.Serial);
            }
            // ## BEGIN - END ## //

            const int GRID_ITEM_SIZE = 50;

            int x = 20;
            int y = 20;

            foreach (GridLootItem gridLootItem in Children.OfType <GridLootItem>())
            {
                gridLootItem.Dispose();
            }

            int count = 0;

            _pagesCount = 1;

            _background.Width  = x;
            _background.Height = y;

            int line = 1;
            int row  = 0;

            for (LinkedObject i = _corpse.Items; i != null; i = i.Next)
            {
                Item it = (Item)i;

                if (it.IsLootable)
                {
                    GridLootItem gridItem = new GridLootItem(it, GRID_ITEM_SIZE);

                    if (x >= MAX_WIDTH - 20)
                    {
                        x = 20;
                        ++line;

                        y += gridItem.Height + 20;

                        if (y >= MAX_HEIGHT - 40)
                        {
                            _pagesCount++;
                            y = 20;
                            //line = 1;
                        }
                    }

                    gridItem.X = x;
                    gridItem.Y = y;
                    Add(gridItem, _pagesCount);

                    x += gridItem.Width + 20;
                    ++row;
                    ++count;
                }
            }

            _background.Width  = (GRID_ITEM_SIZE + 20) * row + 20;
            _background.Height = 20 + 40 + (GRID_ITEM_SIZE + 20) * line + 20;


            if (_background.Height >= MAX_HEIGHT - 40)
            {
                _background.Height = MAX_HEIGHT;
            }

            _background.Width = MAX_WIDTH;

            if (ActivePage <= 1)
            {
                ActivePage            = 1;
                _buttonNext.IsVisible = _pagesCount > 1;
                _buttonPrev.IsVisible = false;
            }
            else if (ActivePage >= _pagesCount)
            {
                ActivePage            = _pagesCount;
                _buttonNext.IsVisible = false;
                _buttonPrev.IsVisible = _pagesCount > 1;
            }
            else if (ActivePage > 1 && ActivePage < _pagesCount)
            {
                _buttonNext.IsVisible = true;
                _buttonPrev.IsVisible = true;
            }

            if (count == 0)
            {
                GameActions.Print(ResGumps.CorpseIsEmpty);
                Dispose();
            }
            else if (_hideIfEmpty && !IsVisible)
            {
                IsVisible = true;
            }
        }