public ValorTitleItemEdit(ValorRewardController mValorRewardController, ValorTitleItem mtitle, ValorItem mVItem, bool addingItem)
            : base(820, 300)
        {
            _mIsAdd          = addingItem;
            _MValorRc        = mValorRewardController;
            _MValorTitleItem = mtitle;
            _mVItem          = mVItem;

            Closable   = true;
            Disposable = false;
            Dragable   = true;
            Resizable  = false;

            AddBackground(0, 0, 500, 450, 2620);
            if (mVItem == null)
            {
                EditTitle();
            }
            else
            {
                EditItem();
            }

            AddButton(350, 400, 4023, 4024, 1, GumpButtonType.Reply, 0);             //ok
            AddButton(430, 400, 4017, 4018, 0, GumpButtonType.Reply, 0);             //cancel
        }
Example #2
0
        public ValorRewardController()
            : base(0xEDC)
        {
            Name         = "Rewards Controller";
            Movable      = false;
            Visible      = false;
            MTitle       = new TitleCollection();
            _mValorItems = new ValorItemCollection();
            Categories   = new Dictionary <int, string>
            {
                { 0, "Titles" }
            };

            if (_mInstance != null)
            {
                // there can only be one RewardController game stone in the world
                _mInstance.Location = Location;
                CommandHandlers.BroadcastMessage(
                    AccessLevel.GameMaster, 0x489, "Existing Title Controller has been moved to this location (DON'T DELETE IT!).");
                Timer.DelayCall(TimeSpan.FromSeconds(1), UpdateInstancePosition, this);
            }
            else
            {
                _mInstance = this;
            }
        }
Example #3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            MTitle       = new TitleCollection();
            _mValorItems = new ValorItemCollection();
            switch (version)
            {
            case 2:
            {
                int categoryCount = reader.ReadInt();

                if (categoryCount > 0)
                {
                    Categories = new Dictionary <int, string>();

                    for (int i = 0; i < categoryCount; i++)
                    {
                        int    num   = reader.ReadInt();
                        string title = reader.ReadString();
                        Categories.Add(num, title);
                    }
                }
                goto case 1;
            }

            case 1:
            {
                int count = reader.ReadInt();
                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        var r = (ValorItem)reader.ReadItem();
                        _mValorItems.Add(r);
                    }
                }
                goto case 0;
            }

            case 0:
            {
                int count = reader.ReadInt();
                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        var r = (ValorTitleItem)reader.ReadItem();
                        MTitle.Add(r);
                    }
                }
            }
                _mInstance = this;
                break;
            }
        }
Example #4
0
        public ValorBoardGumpSide(Mobile mob, Mobile from, ValorRewardController controller)
            : base(600, 300)
        {
            var pm = (PlayerMobile)mob;

            if (pm == null)
            {
                return;
            }

            _Controller = controller;

            Closable   = true;
            Disposable = false;
            Dragable   = true;
            Resizable  = false;
            //Main container
            AddBackground(0, 0, 200, 275, 5170);
            AddLabel(27, 20, 88, @"Detailed Valor Statistics");

            AddLabel(24, 35, 55, @"Name");
            AddBackground(23, 50, 75, 25, 9350);
            AddLabel(26, 53, 0, pm.Name.Trim());

            AddLabel(104, 35, 55, @"Rank");
            AddBackground(103, 50, 75, 25, 9350);
            AddLabel(106, 53, 0, pm.ValorRank == 0 ? @"Unranked" : pm.ValorTitle);

            AddLabel(24, 75, 55, @"Valor Points");
            AddBackground(23, 90, 75, 25, 9350);
            AddLabel(26, 93, 0, pm.ValorPoints.ToString(CultureInfo.InvariantCulture));

            AddLabel(104, 75, 55, @"Valor Title");
            AddBackground(103, 90, 75, 25, 9350);
            AddLabel(106, 93, 0, pm.ValorTitle ?? @"Untitled");

            AddLabel(24, 115, 55, @"Reds Killed");
            AddBackground(23, 130, 75, 25, 9350);
            AddLabel(26, 133, 32, pm.MurderersKilled.ToString(CultureInfo.InvariantCulture));

            AddLabel(104, 115, 55, @"Valor Quests");
            AddBackground(103, 130, 75, 25, 9350);
            AddLabel(106, 133, 0, pm.ValorQuests.ToString(CultureInfo.InvariantCulture));

            AddLabel(24, 155, 55, @"Overall Valor Rating");
            AddBackground(23, 171, 155, 25, 9350);
            AddLabel(26, 174, _RatingColor[pm.ValorRating], pm.ValorRating == 0 ? @"Unrated" : _Rating[pm.ValorRating]);

            //if clicked mob is player, show options just for him
            if (mob != from)
            {
                return;
            }

            AddLabel(41, 202, 77, @"Redeem Valor Points");
            AddButton(24, 205, 0x15e1, 0x15e5, 1, GumpButtonType.Reply, 0);
        }
Example #5
0
 public static void UpdateInstancePosition(ValorRewardController attemptedConstruct)
 {
     if (attemptedConstruct == null)
     {
         return;
     }
     if (_mInstance == null)             // should never happen, but if it does, make this the instance
     {
         _mInstance = attemptedConstruct;
     }
     else if (attemptedConstruct.Location != new Point3D(0, 0, 0))
     // move the instance to it's location and delete it
     {
         _mInstance.Location = attemptedConstruct.Location;
         attemptedConstruct.Delete();
     }
 }
Example #6
0
        public ValorBoardGumpViewItem(Mobile user, ValorRewardController controller, ValorTitleItem titleItem, ValorItem item)
            : base(820, 300)
        {
            _Controller = controller;
            _TitleItem  = titleItem;
            _Item       = item;

            _User = user as PlayerMobile;

            Closable   = true;
            Disposable = false;
            Dragable   = true;
            Resizable  = false;

            if (_Item != null)
            {
                ViewItem();
            }
            else if (_TitleItem != null)
            {
                ViewTitle();
            }
        }
        public ValorTitleRewardAdmin(
            ValorRewardController mValorRewardController,
            List <ValorItem> vlist,
            int listPageCat,
            int listPageItem,
            string scurrcat,
            string soldcat)
            : base(820, 300)
        {
            Closable   = true;
            Disposable = false;
            Dragable   = true;
            Resizable  = false;

            _mListPageCat  = listPageCat;
            _vList         = vlist;
            _iListPageItem = listPageItem;
            _MValorRc      = mValorRewardController;
            _scurrcat      = scurrcat;
            _soldcat       = soldcat;

            if (_scurrcat == null && _MValorRc.Categories != null)
            {
                _scurrcat = _MValorRc.Categories[0];
            }

            if (_scurrcat != "Titles" && _vList != null && !_vList.Exists(x => x.Cat == _scurrcat) ||
                _vList == null && _scurrcat != "Titles")
            {
                List <ValorItem> a = _MValorRc.GetValorItems.Where(x => x.Cat == _scurrcat).ToList();
                _vList = a;
            }
            //Main container
            AddBackground(0, 0, 300, 425, 2620);
            AddLabel(40, 20, 5, @"Titles & Valor Items Administration");

            AddLabel(10, 45, 52, @"Categories");
            CatGen();

            if (_scurrcat == "Titles")
            {
                TitleGen();
            }
            else
            {
                ItemGen();
            }
            PageGen();

            //H and V bars
            AddBackground(140, 45, 2, 196, 9300);
            AddBackground(3, 63, 293, 2, 9300);
            AddBackground(3, 240, 293, 2, 9300);

            AddLabel(10, 247, 32, @"Add Category");
            AddBackground(5, 280, 95, 25, 9350);
            AddLabel(7, 263, 55, @"Category Name");
            AddTextEntry(7, 285, 90, 20, 2622, 0, "");             //cat name
            AddButton(6, 307, 4005, 4006, 21, GumpButtonType.Reply, 0);

            AddLabel(10, 327, 32, @"Delete Category");
            AddBackground(5, 360, 95, 25, 9350);
            AddLabel(7, 343, 55, @"Category Name");
            AddTextEntry(7, 365, 90, 20, 2622, 1, "");             //cat delete name
            AddButton(6, 387, 4005, 4006, 22, GumpButtonType.Reply, 0);

            AddLabel(150, 247, 32, @"Add Item");
            AddButton(210, 246, 4005, 4006, 23, GumpButtonType.Reply, 0);

            AddLabel(150, 287, 32, @"Add Title");
            AddButton(210, 286, 4005, 4006, 24, GumpButtonType.Reply, 0);
        }
Example #8
0
 public AddRewardTarget(ValorRewardController valorRewardController)
     : this()
 {
     _IValorRewardController = valorRewardController;
 }
Example #9
0
        public ValorBoardGumpBuyMenu(
            ValorRewardController mrc,
            List <ValorTitleItem> vtlist,
            List <ValorItem> vlist,
            Mobile user,
            int listCategoryPage,
            int listItemPage,
            string category)
            : base(600, 300)
        {
            Closable   = true;
            Disposable = false;
            Dragable   = true;
            Resizable  = false;

            _User = user as PlayerMobile;

            _Titles       = vtlist;
            _Items        = vlist;
            _Controller   = mrc;
            _CategoryPage = listCategoryPage;
            _ItemPage     = listItemPage;
            _Category     = category;

            if (_Category == null && _Controller.Categories[0] != null)
            {
                _Category = _Controller.Categories[0];
            }

            if (_Category != "Titles" && _Items != null && !_Items.Exists(x => x.Cat == _Category) ||
                _Items == null && _Category != "Titles")
            {
                List <ValorItem> a = _Controller.GetValorItems.Where(x => x.Cat == _Category).ToList();
                _Items = a;
            }

            if (_Titles == null)
            {
                List <ValorTitleItem> a = _Controller.GetTitles.Where(x => x.ValorCost > 0).ToList();
                _Titles = a;
            }

            //Main container
            AddBackground(0, 0, 380, 325, 5170);
            AddLabel(130, 20, 5, @"Valor Rewards Menu");

            AddLabel(27, 45, 52, @"Categories");

            CatGen();
            PageGen();

            if (_Category == "Titles")
            {
                TitleGen();
            }
            else
            {
                ItemGen();
            }

            //H and V bars
            AddBackground(140, 45, 2, 201, 2620);
            AddBackground(18, 63, 345, 2, 2620);
            AddBackground(18, 245, 345, 2, 2620);

            if (_User == null)
            {
                return;
            }

            AddLabel(30, 260, 10, @"Current Valor Points:");
            AddLabel(165, 260, 88, _User.ValorPoints.ToString(CultureInfo.InvariantCulture));
        }
Example #10
0
        public ValorBoardGump(
            ValorRewardController controller, int listPage, List <Mobile> namelist, List <Mobile> list, string nameFind, bool check)
            : base(300, 300)
        {
            _Controller = controller;
            _List       = list;
            _Names      = namelist;
            _Page       = listPage;
            _NameFind   = nameFind;
            _Check      = check;

            Closable   = true;
            Disposable = false;
            Dragable   = false;
            Resizable  = false;

            AddPage(0);
            //container
            AddBackground(0, 0, 262, 280, 83);
            //vertical bar
            AddImageTiled(128, 7, 1, 193, 2620);
            //horizontal bar
            AddImageTiled(5, 25, 252, 2, 2620);
            AddLabel(10, 7, 200, @"Name");
            AddLabel(134, 7, 200, @"Valor Points");
            //horizontal bar
            AddImageTiled(5, 200, 252, 2, 2620);
            //sort by
            AddButton(9, 205, 4005, 4006, 6, GumpButtonType.Reply, 0);
            AddLabel(40, 205, 1149, @"Sort by Name");
            AddButton(134, 205, 4005, 4006, 7, GumpButtonType.Reply, 0);
            AddLabel(164, 205, 1149, @"Sort by Points");
            //search by name
            AddLabel(9, 225, 1149, @"Search by Name");
            AddButton(9, 245, 4005, 4006, 8, GumpButtonType.Reply, 0);
            AddBackground(40, 245, 150, 25, 3000);
            AddTextEntry(42, 248, 150, 20, 2622, 0, "");             //searchbyname

            if (_List == null)
            {
                //gather and sort all players with an active account, not a murderer and have valor points
                List <Mobile> a = (from person in World.Mobiles.Values.OfType <PlayerMobile>()
                                   let gather = person
                                                let acct = person.Account as Account
                                                           where acct != null
                                                           let inactive = DateTime.UtcNow - acct.LastLogin
                                                                          where
                                                                          gather.AccessLevel == AccessLevel.Player && gather.Kills <= 4 && gather.ValorPoints > 0 &&
                                                                          inactive < TimeSpan.FromDays(60.0)
                                                                          select gather).Cast <Mobile>().ToList();

                _List = a;
            }
            //generate a list from the gathered players with players matching name
            if (nameFind != null && _Check)
            {
                List <Mobile> b =
                    _List.Where(
                        person => person is PlayerMobile && person.Name.IndexOf(_NameFind, StringComparison.OrdinalIgnoreCase) >= 0)
                    .Cast <PlayerMobile>()
                    .Cast <Mobile>()
                    .ToList();

                _Names = b;
            }

            _Check = false;             //check is used to ensure list doesn't generate constantly

            //page generation here
            if (listPage > 0)
            {
                AddButton(94, 177, 4014, 4015, 9, GumpButtonType.Reply, 0);
                AddLabel(34, 179, 1149, @"Last Page");
            }

            int k = nameFind == null ? _List.Count : _Names.Count;

            if ((listPage + 1) * 5 < k)
            {
                AddButton(134, 177, 4005, 4006, 10, GumpButtonType.Reply, 0);
                AddLabel(164, 179, 1149, @"Next Page");
            }

            //generate player list here, if namefind null, use full list of players

            for (int i = 0, j = 0, index = ((listPage * 5)); i < 5 && index < k && j >= 0; ++j, i++, ++index)
            {
                Mobile mob = nameFind == null ? _List[index] : _Names[index];

                if (!(mob is PlayerMobile))
                {
                    continue;
                }

                var m            = (PlayerMobile)mob;
                int offsetbg     = 30 + (i * 30);
                int offsetlbl    = 35 + (i * 30);
                int offsetbutton = 38 + (i * 30);
                int l            = i + 1;      //offset for available buttons

                //name container
                AddBackground(7, offsetbg, 120, 30, 9300);
                //points container
                AddBackground(131, offsetbg, 125, 30, 9300);
                AddLabel(10, offsetlbl, 1149, m.Name);
                AddButton(108, offsetbutton, 0x846, 0x845, l, GumpButtonType.Reply, 0);
                AddLabel(137, offsetlbl, 1149, m.ValorPoints.ToString(CultureInfo.InvariantCulture));
                _Index = index;
            }
        }