Beispiel #1
0
        public static void DoCommands(int[] selections, GumpType type, Mobile from)
        {
            World.Broadcast(0x35, false, "The world is generating. This may take some time...");
            string prefix = Server.Commands.CommandSystem.Prefix;

            foreach (int sel in selections)
            {
                foreach (CreateWorld.CommandEntry entry in CreateWorld.Commands)
                {
                    if (entry.checkId == sel)
                    {
                        switch (type)
                        {
                        case CreateWorld.GumpType.Create:
                            from.Say("Generating " + entry.Name);
                            CommandSystem.Handle(from, prefix + entry.CreateCommand);

                            if (CreateWorldData.CreateTable.ContainsKey(entry.checkId))
                            {
                                CreateWorldData.CreateTable[sel] = true;
                            }

                            break;

                        case CreateWorld.GumpType.Delete:
                            if (!String.IsNullOrEmpty(entry.DeleteCommand))
                            {
                                from.Say("Deleting " + entry.Name);
                                CommandSystem.Handle(from, prefix + entry.DeleteCommand);

                                if (CreateWorldData.CreateTable.ContainsKey(entry.checkId))
                                {
                                    CreateWorldData.CreateTable[sel] = false;
                                }
                            }
                            break;

                        case CreateWorld.GumpType.Recreate:
                            if (!String.IsNullOrEmpty(entry.DeleteCommand))
                            {
                                from.Say("Recreating " + entry.Name);
                                CommandSystem.Handle(from, prefix + entry.DeleteCommand);
                                CommandSystem.Handle(from, prefix + entry.CreateCommand);

                                if (CreateWorldData.CreateTable.ContainsKey(entry.checkId))
                                {
                                    CreateWorldData.CreateTable[sel] = true;
                                }
                            }
                            break;
                        }
                    }
                }
            }
            World.Broadcast(0x35, false, "World generation complete.");
        }
Beispiel #2
0
        public static void DoAllCommands(GumpType type, Mobile from)
        {
            List <int> ids = new List <int>();

            foreach (CommandEntry entry in Commands)
            {
                ids.Add(entry.checkId);
            }
            DoCommands(ids.ToArray(), type, from);
        }
Beispiel #3
0
        public static void DoAllCommands(GumpType type, Mobile from)
        {
            List <int> ids = new List <int>();

            for (var index = 0; index < Commands.Count; index++)
            {
                CommandEntry entry = Commands[index];

                ids.Add(entry.CheckID);
            }

            DoCommands(ids.ToArray(), type, from);
        }
        public SurnameRegistrarGump(Mobile from, GumpType gtype)
            : base(0, 0)
        {
            caller   = from;
            gumpType = gtype;

            GenerateNameList();

            if (gumpType == GumpType.Scroll)
            {
                this.Closable   = true;
                this.Disposable = true;
                this.Dragable   = true;
                this.Resizable  = false;

                this.AddPage(0);
                this.AddBackground(68, 2, 367, 298, 9380);
                this.AddTextEntry(262, 186, 138, 18, 0, (int)Buttons.NameEntry, @"");
                this.AddButton(335, 216, 247, 248, (int)Buttons.Okay, GumpButtonType.Reply, 0);
                this.AddHtml(275, 66, 121, 106, @"If you'd like to register your character's surname, please type it in below and hit the okay button. If it is currently in use, you will have to wait for the acceptance of the name's originator.", true, true);
                this.AddHtml(107, 62, 136, 179, @"" + nameList, true, true);
            }

            if (gumpType == GumpType.Book)
            {
                this.Closable   = true;
                this.Disposable = true;
                this.Dragable   = true;
                this.Resizable  = false;

                this.AddPage(0);
                this.AddImage(79, 48, 2200);
                this.AddTextEntry(262, 186, 138, 18, 0, (int)Buttons.NameEntry, @"");
                this.AddButton(335, 216, 247, 248, (int)Buttons.Okay, GumpButtonType.Reply, 0);
                this.AddHtml(275, 66, 121, 106, @"<BASEFONT COLOR=#101010>If you'd like to register your character's surname, please type it in below and hit the okay button. If it is currently in use, you will have to wait for the acceptance of the name's originator.</font>", false, true);
                this.AddHtml(107, 62, 136, 179, @"<BASEFONT COLOR=#101010>" + nameList, false, true);
            }
        }
Beispiel #5
0
        protected BaseVendorRentalGump(GumpType type, VendorRentalDuration duration, int price, int renewalPrice,
                                       IEntity landlord, IEntity renter, bool landlordRenew, bool renterRenew, bool renew)
            : base(100, 100)
        {
            if (type == GumpType.Offer)
            {
                Closable = false;
            }

            AddPage(0);

            AddImage(0, 0, 0x1F40);
            AddImageTiled(20, 37, 300, 308, 0x1F42);
            AddImage(20, 325, 0x1F43);

            AddImage(35, 8, 0x39);
            AddImageTiled(65, 8, 257, 10, 0x3A);
            AddImage(290, 8, 0x3B);

            AddImageTiled(70, 55, 230, 2, 0x23C5);

            AddImage(32, 33, 0x2635);
            AddHtmlLocalized(70, 35, 270, 20, 1062353, 0x1, false, false); // Vendor Rental Contract

            AddPage(1);

            if (type != GumpType.UnlockedContract)
            {
                AddImage(65, 60, 0x827);
                AddHtmlLocalized(79, 58, 270, 20, 1062370, 0x1, false, false); // Landlord:
                AddLabel(150, 58, 0x64, landlord != null ? landlord.Name : "");

                AddImageTiled(70, 80, 230, 2, 0x23C5);
            }

            if (type == GumpType.UnlockedContract || type == GumpType.LockedContract)
            {
                AddButton(30, 96, 0x15E1, 0x15E5, 0, GumpButtonType.Page, 2);
            }
            AddHtmlLocalized(50, 95, 150, 20, 1062354, 0x1, false, false); // Contract Length
            AddHtmlLocalized(230, 95, 270, 20, duration.Name, 0x1, false, false);

            if (type == GumpType.UnlockedContract || type == GumpType.LockedContract)
            {
                AddButton(30, 116, 0x15E1, 0x15E5, 1, GumpButtonType.Reply, 0);
            }
            AddHtmlLocalized(50, 115, 150, 20, 1062356, 0x1, false, false); // Price Per Rental
            AddLabel(230, 115, 0x64, price > 0 ? price.ToString() : "FREE");

            AddImageTiled(50, 160, 250, 2, 0x23BF);

            if (type == GumpType.Offer)
            {
                AddButton(67, 180, 0x482, 0x483, 2, GumpButtonType.Reply, 0);
                AddHtmlLocalized(100, 180, 270, 20, 1049011, 0x28, false, false); // I accept!

                AddButton(67, 210, 0x47F, 0x480, 0, GumpButtonType.Reply, 0);
                AddHtmlLocalized(100, 210, 270, 20, 1049012, 0x28, false, false); // No thanks, I decline.
            }
            else
            {
                AddImage(49, 170, 0x61);
                AddHtmlLocalized(60, 170, 250, 20, 1062355, 0x1, false, false); // Renew On Expiration?

                if (type == GumpType.LockedContract || type == GumpType.UnlockedContract || type == GumpType.VendorLandlord)
                {
                    AddButton(30, 192, 0x15E1, 0x15E5, 3, GumpButtonType.Reply, 0);
                }
                AddHtmlLocalized(85, 190, 250, 20, 1062359, 0x1, false, false);                            // Landlord:
                AddHtmlLocalized(230, 190, 270, 20, landlordRenew ? 1049717 : 1049718, 0x1, false, false); // YES / NO

                if (type == GumpType.VendorRenter)
                {
                    AddButton(30, 212, 0x15E1, 0x15E5, 4, GumpButtonType.Reply, 0);
                }
                AddHtmlLocalized(85, 210, 250, 20, 1062360, 0x1, false, false);                          // Renter:
                AddHtmlLocalized(230, 210, 270, 20, renterRenew ? 1049717 : 1049718, 0x1, false, false); // YES / NO

                if (renew)
                {
                    AddImage(49, 233, 0x939);
                    AddHtmlLocalized(70, 230, 250, 20, 1062482, 0x1, false, false); // Contract WILL renew
                }
                else
                {
                    AddImage(49, 233, 0x938);
                    AddHtmlLocalized(70, 230, 250, 20, 1062483, 0x1, false, false); // Contract WILL NOT renew
                }
            }

            AddImageTiled(30, 283, 257, 30, 0x5D);
            AddImage(285, 283, 0x5E);
            AddImage(20, 288, 0x232C);

            if (type == GumpType.LockedContract)
            {
                AddButton(67, 295, 0x15E1, 0x15E5, 5, GumpButtonType.Reply, 0);
                AddHtmlLocalized(85, 294, 270, 20, 1062358, 0x28, false, false); // Offer Contract To Someone
            }
            else if (type == GumpType.VendorLandlord || type == GumpType.VendorRenter)
            {
                if (type == GumpType.VendorLandlord)
                {
                    AddButton(30, 250, 0x15E1, 0x15E1, 6, GumpButtonType.Reply, 0);
                }
                AddHtmlLocalized(85, 250, 250, 20, 1062499, 0x1, false, false); // Renewal Price
                AddLabel(230, 250, 0x64, renewalPrice.ToString());

                AddHtmlLocalized(60, 294, 270, 20, 1062369, 0x1, false, false); // Renter:
                AddLabel(120, 293, 0x64, renter != null ? renter.Name : "");
            }

            if (type == GumpType.UnlockedContract || type == GumpType.LockedContract)
            {
                AddPage(2);

                for (int i = 0; i < VendorRentalDuration.Instances.Length; i++)
                {
                    VendorRentalDuration durationItem = VendorRentalDuration.Instances[i];

                    AddButton(30, 76 + i * 20, 0x15E1, 0x15E5, 0x10 | i, GumpButtonType.Reply, 1);
                    AddHtmlLocalized(50, 75 + i * 20, 150, 20, durationItem.Name, 0x1, false, false);
                }
            }
        }
Beispiel #6
0
        public static void DoCommands(int[] selections, GumpType type, Mobile from)
        {
            World.Broadcast(0x35, false, "The world is generating. This may take some time...");
            string prefix = Server.Commands.CommandSystem.Prefix;

            string error = null;

            WorldCreating = true;

            foreach (int sel in selections)
            {
                foreach (CreateWorld.CommandEntry entry in CreateWorld.Commands)
                {
                    if (entry.CheckID == sel)
                    {
                        switch (type)
                        {
                        case CreateWorld.GumpType.Create:
                            from.Say("Generating " + entry.Name);

                            if (CanGenerate(entry, ref error))
                            {
                                if (entry.Delay > 0)
                                {
                                    DoDelayedCommand(from, TimeSpan.FromMinutes(entry.Delay), prefix + entry.CreateCommand);
                                }
                                else
                                {
                                    CommandSystem.Handle(from, prefix + entry.CreateCommand);
                                }

                                if (CreateWorldData.CreateTable.ContainsKey(sel))
                                {
                                    CreateWorldData.CreateTable[sel] = true;
                                }
                            }

                            break;

                        case CreateWorld.GumpType.Delete:
                            if (!String.IsNullOrEmpty(entry.DeleteCommand))
                            {
                                from.Say("Deleting " + entry.Name);
                                CommandSystem.Handle(from, prefix + entry.DeleteCommand);

                                if (CreateWorldData.CreateTable.ContainsKey(sel))
                                {
                                    CreateWorldData.CreateTable[sel] = false;
                                }
                            }
                            break;
                        }
                    }
                }
            }

            if (error != null)
            {
                from.SendGump(new BasicInfoGump(error, "World Generation Error"));
            }

            WorldCreating = false;
            World.Broadcast(0x35, false, "World generation complete.");
        }
        protected BaseVendorRentalGump(GumpType type, VendorRentalDuration duration, int price, int renewalPrice,
            Mobile landlord, Mobile renter, bool landlordRenew, bool renterRenew, bool renew)
            : base(100, 100)
        {
            /*0*/
            Intern("");
            /*1*/
            Intern("0");
            /*2*/
            Intern(price > 0 ? price.ToString() : "FREE");
            /*3*/
            Intern(landlord != null ? landlord.Name : "");
            /*4*/
            Intern(renter != null ? renter.Name : "");

            if (type == GumpType.VendorLandlord || type == GumpType.VendorRenter)
                /*5*/
                Intern(renewalPrice.ToString());

            AddPage(0);

            if (type == GumpType.Offer)
                Closable = false;

            AddImage(0, 0, 0x1F40);
            AddImageTiled(20, 37, 300, 308, 0x1F42);
            AddImage(20, 325, 0x1F43);

            AddImage(35, 8, 0x39);
            AddImageTiled(65, 8, 257, 10, 0x3A);
            AddImage(290, 8, 0x3B);

            AddImage(32, 33, 0x2635);

            AddImageTiled(70, 55, 230, 2, 0x23C5);

            AddHtmlLocalized(70, 35, 270, 20, 1062353, 0x1, false, false); // Vendor Rental Contract

            AddPage(1);

            AddImageTiled(30, 283, 257, 30, 0x5D);
            AddImage(285, 283, 0x5E);
            AddImage(20, 288, 0x232C);

            AddHtmlLocalized(50, 95, 150, 20, 1062354, 0x1, false, false); // Contract Length
            AddHtmlLocalized(50, 115, 150, 20, 1062356, 0x1, false, false); // Price Per Rental
            AddHtmlLocalized(230, 95, 270, 20, duration.Name, 0x1, false, false);

            AddLabelIntern(230, 115, 0x64, 2);

            if (type != GumpType.Offer)
            {
                AddHtmlLocalized(230, 190, 270, 20, landlordRenew ? 1049717 : 1049718, 0x1, false, false); // YES / NO
                AddHtmlLocalized(230, 210, 270, 20, renterRenew ? 1049717 : 1049718, 0x1, false, false); // YES / NO
            }
            else
            {
                AddKRHtmlLocalized(0, 0, 0, 0, -1, false, false);
                AddKRHtmlLocalized(0, 0, 0, 0, -1, false, false);
            }

            if (type != GumpType.UnlockedContract)
            {
                AddImage(65, 60, 0x827);
                AddHtmlLocalized(79, 58, 270, 20, 1062370, 0x1, false, false); // Landlord:
                AddLabelIntern(150, 58, 0x64, 3);

                AddImageTiled(70, 80, 230, 2, 0x23C5);
            }
            else
            {
                AddKRHtmlLocalized(0, 0, 0, 0, -1, false, false);
            }

            if (type == GumpType.VendorLandlord || type == GumpType.VendorRenter)
            {
                AddHtmlLocalized(60, 294, 270, 20, 1062369, 0x1, false, false); // Renter:

                AddLabelIntern(120, 293, 0x64, 4);
                AddLabelIntern(230, 250, 0x64, 5);
            }
            else
            {
                AddKRHtmlLocalized(0, 0, 0, 0, -1, false, false);
            }

            AddImageTiled(50, 160, 250, 2, 0x23BF);

            if (type != GumpType.Offer)
            {
                AddImage(49, 170, 0x61);

                AddHtmlLocalized(60, 170, 250, 20, 1062355, 0x1, false, false); // Renew On Expiration?
                AddHtmlLocalized(85, 190, 250, 20, 1062359, 0x1, false, false); // Landlord:
                AddHtmlLocalized(85, 210, 250, 20, 1062360, 0x1, false, false); // Renter:

                if (type == GumpType.VendorLandlord || type == GumpType.VendorRenter)
                    AddHtmlLocalized(85, 250, 250, 20, 1062499, 0x1, false, false); // Renewal Price
                else
                    AddKRHtmlLocalized(0, 0, 0, 0, -1, false, false);

                if (renew)
                {
                    AddImage(49, 233, 0x939);
                    AddHtmlLocalized(70, 230, 250, 20, 1062482, 0x1, false, false); // Contract WILL renew
                }
                else
                {
                    AddImage(49, 233, 0x938);
                    AddHtmlLocalized(70, 230, 250, 20, 1062483, 0x1, false, false); // Contract WILL NOT renew
                }

                if (type == GumpType.UnlockedContract || type == GumpType.LockedContract)
                {
                    AddButton(30, 96, 0x15E1, 0x15E5, 5, GumpButtonType.Page, 2);
                    AddButton(30, 116, 0x15E1, 0x15E5, 6, GumpButtonType.Reply, 1);
                }
                else
                {
                    AddKRButton(0, 0, 0, 0, -666, GumpButtonType.Page, 0);
                    AddKRButton(0, 0, 0, 0, -666, GumpButtonType.Page, 0);
                }

                if (type != GumpType.VendorRenter)
                {
                    AddButton(30, 192, 0x15E1, 0x15E5, 9, GumpButtonType.Reply, 1);
                    AddKRButton(0, 0, 0, 0, -666, GumpButtonType.Page, 0);
                }
                else
                {
                    AddKRButton(0, 0, 0, 0, -666, GumpButtonType.Page, 0);
                    AddButton(30, 212, 0x15E1, 0x15E5, 8, GumpButtonType.Reply, 1);
                }

                if (type == GumpType.VendorLandlord)
                    AddButton(30, 250, 0x15E1, 0x15E1, 13, GumpButtonType.Reply, 1);
                else
                    AddKRButton(0, 0, 0, 0, -666, GumpButtonType.Page, 0);

                if (type == GumpType.LockedContract)
                {
                    AddHtmlLocalized(85, 294, 270, 20, 1062358, 0x28, false, false); // Offer Contract To Someone
                    AddButton(67, 295, 0x15E1, 0x15E5, 10, GumpButtonType.Reply, 1);
                }
                else
                {
                    AddKRButton(0, 0, 0, 0, -666, GumpButtonType.Page, 0);
                    AddKRHtmlLocalized(0, 0, 0, 0, -1, false, false);
                }

                AddPage(2);

                for (int i = 0; i < VendorRentalDuration.Instances.Length; i++)
                {
                    VendorRentalDuration durationItem = VendorRentalDuration.Instances[i];

                    AddButton(30, 76 + i * 20, 0x15E1, 0x15E5, i + 1, GumpButtonType.Reply, 1);
                    AddHtmlLocalized(50, 75 + i * 20, 150, 20, durationItem.Name, 0x1, false, false);
                }
            }
            else
            {
                AddHtmlLocalized(100, 180, 270, 20, 1049011, 0x28, false, false); // I accept!
                AddButton(67, 180, 0x482, 0x483, 11, GumpButtonType.Reply, 0);

                AddHtmlLocalized(100, 210, 270, 20, 1049012, 0x28, false, false); // No thanks, I decline.
                AddButton(67, 210, 0x47F, 0x480, 12, GumpButtonType.Reply, 0);
            }
            /*
            if (type == GumpType.Offer)
                this.Closable = false;

            this.AddPage(0);

            this.AddImage(0, 0, 0x1F40);
            this.AddImageTiled(20, 37, 300, 308, 0x1F42);
            this.AddImage(20, 325, 0x1F43);

            this.AddImage(35, 8, 0x39);
            this.AddImageTiled(65, 8, 257, 10, 0x3A);
            this.AddImage(290, 8, 0x3B);

            this.AddImageTiled(70, 55, 230, 2, 0x23C5);

            this.AddImage(32, 33, 0x2635);
            this.AddHtmlLocalized(70, 35, 270, 20, 1062353, 0x1, false, false); // Vendor Rental Contract

            this.AddPage(1);

            if (type != GumpType.UnlockedContract)
            {
                this.AddImage(65, 60, 0x827);
                this.AddHtmlLocalized(79, 58, 270, 20, 1062370, 0x1, false, false); // Landlord:
                this.AddLabel(150, 58, 0x64, landlord != null ? landlord.Name : "");

                this.AddImageTiled(70, 80, 230, 2, 0x23C5);
            }

            if (type == GumpType.UnlockedContract || type == GumpType.LockedContract)
                this.AddButton(30, 96, 0x15E1, 0x15E5, 0, GumpButtonType.Page, 2);
            this.AddHtmlLocalized(50, 95, 150, 20, 1062354, 0x1, false, false); // Contract Length
            this.AddHtmlLocalized(230, 95, 270, 20, duration.Name, 0x1, false, false);

            if (type == GumpType.UnlockedContract || type == GumpType.LockedContract)
                this.AddButton(30, 116, 0x15E1, 0x15E5, 1, GumpButtonType.Reply, 0);
            this.AddHtmlLocalized(50, 115, 150, 20, 1062356, 0x1, false, false); // Price Per Rental
            this.AddLabel(230, 115, 0x64, price > 0 ? price.ToString() : "FREE");

            this.AddImageTiled(50, 160, 250, 2, 0x23BF);

            if (type == GumpType.Offer)
            {
                this.AddButton(67, 180, 0x482, 0x483, 2, GumpButtonType.Reply, 0);
                this.AddHtmlLocalized(100, 180, 270, 20, 1049011, 0x28, false, false); // I accept!

                this.AddButton(67, 210, 0x47F, 0x480, 0, GumpButtonType.Reply, 0);
                this.AddHtmlLocalized(100, 210, 270, 20, 1049012, 0x28, false, false); // No thanks, I decline.
            }
            else
            {
                this.AddImage(49, 170, 0x61);
                this.AddHtmlLocalized(60, 170, 250, 20, 1062355, 0x1, false, false); // Renew On Expiration?

                if (type == GumpType.LockedContract || type == GumpType.UnlockedContract || type == GumpType.VendorLandlord)
                    this.AddButton(30, 192, 0x15E1, 0x15E5, 3, GumpButtonType.Reply, 0);
                this.AddHtmlLocalized(85, 190, 250, 20, 1062359, 0x1, false, false); // Landlord:
                this.AddHtmlLocalized(230, 190, 270, 20, landlordRenew ? 1049717 : 1049718, 0x1, false, false); // YES / NO

                if (type == GumpType.VendorRenter)
                    this.AddButton(30, 212, 0x15E1, 0x15E5, 4, GumpButtonType.Reply, 0);
                this.AddHtmlLocalized(85, 210, 250, 20, 1062360, 0x1, false, false); // Renter:
                this.AddHtmlLocalized(230, 210, 270, 20, renterRenew ? 1049717 : 1049718, 0x1, false, false); // YES / NO

                if (renew)
                {
                    this.AddImage(49, 233, 0x939);
                    this.AddHtmlLocalized(70, 230, 250, 20, 1062482, 0x1, false, false); // Contract WILL renew
                }
                else
                {
                    this.AddImage(49, 233, 0x938);
                    this.AddHtmlLocalized(70, 230, 250, 20, 1062483, 0x1, false, false); // Contract WILL NOT renew
                }
            }

            this.AddImageTiled(30, 283, 257, 30, 0x5D);
            this.AddImage(285, 283, 0x5E);
            this.AddImage(20, 288, 0x232C);

            if (type == GumpType.LockedContract)
            {
                this.AddButton(67, 295, 0x15E1, 0x15E5, 5, GumpButtonType.Reply, 0);
                this.AddHtmlLocalized(85, 294, 270, 20, 1062358, 0x28, false, false); // Offer Contract To Someone
            }
            else if (type == GumpType.VendorLandlord || type == GumpType.VendorRenter)
            {
                if (type == GumpType.VendorLandlord)
                    this.AddButton(30, 250, 0x15E1, 0x15E1, 6, GumpButtonType.Reply, 0);
                this.AddHtmlLocalized(85, 250, 250, 20, 1062499, 0x1, false, false); // Renewal Price
                this.AddLabel(230, 250, 0x64, renewalPrice.ToString());

                this.AddHtmlLocalized(60, 294, 270, 20, 1062369, 0x1, false, false); // Renter:
                this.AddLabel(120, 293, 0x64, renter != null ? renter.Name : "");
            }

            if (type == GumpType.UnlockedContract || type == GumpType.LockedContract)
            {
                this.AddPage(2);

                for (int i = 0; i < VendorRentalDuration.Instances.Length; i++)
                {
                    VendorRentalDuration durationItem = VendorRentalDuration.Instances[i];

                    this.AddButton(30, 76 + i * 20, 0x15E1, 0x15E5, 0x10 | i, GumpButtonType.Reply, 1);
                    this.AddHtmlLocalized(50, 75 + i * 20, 150, 20, durationItem.Name, 0x1, false, false);
                }
            }
             */
        }
Beispiel #8
0
        public List <Gump> ReadGumps(string path)
        {
            List <Gump> gumps = new List <Gump>();

            // load skillsgroup
            SkillsGroupManager.Load();

            // load gumps
            string gumpsXmlPath = Path.Combine(path, "gumps.xml");

            if (File.Exists(gumpsXmlPath))
            {
                XmlDocument doc = new XmlDocument();

                try
                {
                    doc.Load(gumpsXmlPath);
                }
                catch (Exception ex)
                {
                    Log.Error(ex.ToString());

                    return(gumps);
                }

                XmlElement root = doc["gumps"];

                if (root != null)
                {
                    foreach (XmlElement xml in root.ChildNodes /*.GetElementsByTagName("gump")*/)
                    {
                        if (xml.Name != "gump")
                        {
                            continue;
                        }

                        try
                        {
                            GumpType type   = (GumpType)int.Parse(xml.GetAttribute(nameof(type)));
                            int      x      = int.Parse(xml.GetAttribute(nameof(x)));
                            int      y      = int.Parse(xml.GetAttribute(nameof(y)));
                            uint     serial = uint.Parse(xml.GetAttribute(nameof(serial)));

                            Gump gump = null;

                            switch (type)
                            {
                            case GumpType.Buff:
                                gump = new BuffGump();

                                break;

                            case GumpType.Container:
                                gump = new ContainerGump();

                                break;

                            case GumpType.CounterBar:
                                gump = new CounterBarGump();

                                break;

                            case GumpType.HealthBar:
                                if (CustomBarsToggled)
                                {
                                    gump = new HealthBarGumpCustom();
                                }
                                else
                                {
                                    gump = new HealthBarGump();
                                }

                                break;

                            case GumpType.InfoBar:
                                gump = new InfoBarGump();

                                break;

                            case GumpType.Journal:
                                gump = new JournalGump();

                                break;

                            case GumpType.MacroButton:
                                gump = new MacroButtonGump();

                                break;

                            case GumpType.MiniMap:
                                gump = new MiniMapGump();

                                break;

                            case GumpType.PaperDoll:
                                gump = new PaperDollGump();

                                break;

                            case GumpType.SkillMenu:
                                if (StandardSkillsGump)
                                {
                                    gump = new StandardSkillsGump();
                                }
                                else
                                {
                                    gump = new SkillGumpAdvanced();
                                }

                                break;

                            case GumpType.SpellBook:
                                gump = new SpellbookGump();

                                break;

                            case GumpType.StatusGump:
                                gump = StatusGumpBase.AddStatusGump(0, 0);

                                break;

                            //case GumpType.TipNotice:
                            //    gump = new TipNoticeGump();
                            //    break;
                            case GumpType.AbilityButton:
                                gump = new UseAbilityButtonGump();

                                break;

                            case GumpType.SpellButton:
                                gump = new UseSpellButtonGump();

                                break;

                            case GumpType.SkillButton:
                                gump = new SkillButtonGump();

                                break;

                            case GumpType.RacialButton:
                                gump = new RacialAbilityButton();

                                break;

                            case GumpType.WorldMap:
                                gump = new WorldMapGump();

                                break;

                            case GumpType.Debug:
                                gump = new DebugGump(100, 100);

                                break;

                            case GumpType.NetStats:
                                gump = new NetworkStatsGump(100, 100);

                                break;
                            }

                            if (gump == null)
                            {
                                continue;
                            }

                            gump.LocalSerial = serial;
                            gump.Restore(xml);
                            gump.X = x;
                            gump.Y = y;

                            if (gump.LocalSerial != 0)
                            {
                                UIManager.SavePosition(gump.LocalSerial, new Point(x, y));
                            }

                            if (!gump.IsDisposed)
                            {
                                gumps.Add(gump);
                            }
                        }
                        catch (Exception ex)
                        {
                            Log.Error(ex.ToString());
                        }
                    }

                    foreach (XmlElement group in root.GetElementsByTagName("anchored_group_gump"))
                    {
                        int matrix_width  = int.Parse(group.GetAttribute("matrix_w"));
                        int matrix_height = int.Parse(group.GetAttribute("matrix_h"));

                        AnchorManager.AnchorGroup ancoGroup = new AnchorManager.AnchorGroup();
                        ancoGroup.ResizeMatrix(matrix_width, matrix_height, 0, 0);

                        foreach (XmlElement xml in group.GetElementsByTagName("gump"))
                        {
                            try
                            {
                                GumpType type   = (GumpType)int.Parse(xml.GetAttribute("type"));
                                int      x      = int.Parse(xml.GetAttribute("x"));
                                int      y      = int.Parse(xml.GetAttribute("y"));
                                uint     serial = uint.Parse(xml.GetAttribute("serial"));

                                int matrix_x = int.Parse(xml.GetAttribute("matrix_x"));
                                int matrix_y = int.Parse(xml.GetAttribute("matrix_y"));

                                AnchorableGump gump = null;

                                switch (type)
                                {
                                case GumpType.SpellButton:
                                    gump = new UseSpellButtonGump();

                                    break;

                                case GumpType.SkillButton:
                                    gump = new SkillButtonGump();

                                    break;

                                case GumpType.HealthBar:
                                    if (CustomBarsToggled)
                                    {
                                        gump = new HealthBarGumpCustom();
                                    }
                                    else
                                    {
                                        gump = new HealthBarGump();
                                    }

                                    break;

                                case GumpType.AbilityButton:
                                    gump = new UseAbilityButtonGump();

                                    break;

                                case GumpType.MacroButton:
                                    gump = new MacroButtonGump();

                                    break;
                                }

                                if (gump != null)
                                {
                                    gump.LocalSerial = serial;
                                    gump.Restore(xml);
                                    gump.X = x;
                                    gump.Y = y;

                                    if (!gump.IsDisposed)
                                    {
                                        if (UIManager.AnchorManager[gump] == null && ancoGroup.IsEmptyDirection(matrix_x, matrix_y))
                                        {
                                            gumps.Add(gump);
                                            UIManager.AnchorManager[gump] = ancoGroup;
                                            ancoGroup.AddControlToMatrix(matrix_x, matrix_y, gump);
                                        }
                                        else
                                        {
                                            gump.Dispose();
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                Log.Error(ex.ToString());
                            }
                        }
                    }
                }
            }

            return(gumps);
        }
Beispiel #9
0
		public static void DoCommands(int[] selections, GumpType type, Mobile from)
		{
			World.Broadcast(0x35, false, "The world is generating. This may take some time...");
			string prefix = Server.Commands.CommandSystem.Prefix;
			foreach (int sel in selections)
			{
				foreach (CreateWorld.CommandEntry entry in CreateWorld.Commands)
				{
					if (entry.checkId == sel)
					{
						switch (type)
						{
							case CreateWorld.GumpType.Create:
								from.Say("Generating " + entry.Name);
								CommandSystem.Handle(from, prefix + entry.CreateCommand);
								break;
							case CreateWorld.GumpType.Delete:
								if (!String.IsNullOrEmpty(entry.DeleteCommand))
								{
									from.Say("Deleting " + entry.Name);
									CommandSystem.Handle(from, prefix + entry.DeleteCommand);
								}
								break;
							case CreateWorld.GumpType.Recreate:
								if (!String.IsNullOrEmpty(entry.DeleteCommand))
								{
									from.Say("Recreating " + entry.Name);
									CommandSystem.Handle(from, prefix + entry.DeleteCommand);
									CommandSystem.Handle(from, prefix + entry.CreateCommand);
								}
								break;
						}
					}
				}
			}
			World.Broadcast(0x35, false, "World generation complete.");
		}
Beispiel #10
0
		public static void DoAllCommands(GumpType type, Mobile from)
		{
			List<int> ids = new List<int>();
			foreach (CommandEntry entry in Commands)
			{
				ids.Add(entry.checkId);
			}
			DoCommands(ids.ToArray(), type, from);
		}
Beispiel #11
0
        public List <Gump> ReadGumps(string path)
        {
            List <Gump> gumps = new List <Gump>();


            // #########################################################
            // [FILE_FIX]
            // TODO: this code is a workaround to port old macros to the new xml system.
            string skillsGroupsPath = Path.Combine(path, "skillsgroups.bin");

            if (File.Exists(skillsGroupsPath))
            {
                try
                {
                    using (BinaryReader reader = new BinaryReader(File.OpenRead(skillsGroupsPath)))
                    {
                        int version = reader.ReadInt32();

                        int groupCount = reader.ReadInt32();

                        for (int i = 0; i < groupCount; i++)
                        {
                            int    entriesCount = reader.ReadInt32();
                            string groupName    = reader.ReadUTF8String(reader.ReadInt32());

                            SkillsGroup g = new SkillsGroup();
                            g.Name = groupName;

                            for (int j = 0; j < entriesCount; j++)
                            {
                                byte idx = (byte)reader.ReadInt32();
                                g.Add(idx);
                            }

                            g.Sort();

                            SkillsGroupManager.Add(g);
                        }
                    }
                }
                catch (Exception e)
                {
                    SkillsGroupManager.MakeDefault();
                    Log.Error(e.StackTrace);
                }


                SkillsGroupManager.Save();

                try
                {
                    File.Delete(skillsGroupsPath);
                }
                catch
                {
                }
            }

            string binpath = Path.Combine(path, "gumps.bin");

            if (File.Exists(binpath))
            {
                using (BinaryReader reader = new BinaryReader(File.OpenRead(binpath)))
                {
                    if (reader.BaseStream.Position + 12 < reader.BaseStream.Length)
                    {
                        GumpsVersion = reader.ReadUInt32();
                        uint empty = reader.ReadUInt32();

                        int count = reader.ReadInt32();

                        for (int i = 0; i < count; i++)
                        {
                            try
                            {
                                int    typeLen  = reader.ReadUInt16();
                                string typeName = reader.ReadUTF8String(typeLen);
                                int    x        = reader.ReadInt32();
                                int    y        = reader.ReadInt32();

                                Type type = Type.GetType(typeName, true);
                                Gump gump = (Gump)Activator.CreateInstance(type);
                                gump.Restore(reader);
                                gump.X = x;
                                gump.Y = y;

                                //gump.SetInScreen();

                                if (gump.LocalSerial != 0)
                                {
                                    UIManager.SavePosition(gump.LocalSerial, new Point(x, y));
                                }

                                if (!gump.IsDisposed)
                                {
                                    gumps.Add(gump);
                                }
                            }
                            catch (Exception e)
                            {
                                Log.Error(e.StackTrace);
                            }
                        }
                    }
                }

                SaveGumps(path);

                gumps.Clear();

                try
                {
                    File.Delete(binpath);
                }
                catch
                {
                }
            }
            // #########################################################


            // load skillsgroup
            //SkillsGroupManager.Load();
            SkillsGroupManager.Load();

            // load gumps
            string gumpsXmlPath = Path.Combine(path, "gumps.xml");

            if (File.Exists(gumpsXmlPath))
            {
                XmlDocument doc = new XmlDocument();

                try
                {
                    doc.Load(gumpsXmlPath);
                }
                catch (Exception ex)
                {
                    Log.Error(ex.ToString());

                    return(gumps);
                }

                XmlElement root = doc["gumps"];

                if (root != null)
                {
                    foreach (XmlElement xml in root.ChildNodes /*.GetElementsByTagName("gump")*/)
                    {
                        if (xml.Name != "gump")
                        {
                            continue;
                        }

                        try
                        {
                            GumpType type   = (GumpType)int.Parse(xml.GetAttribute(nameof(type)));
                            int      x      = int.Parse(xml.GetAttribute(nameof(x)));
                            int      y      = int.Parse(xml.GetAttribute(nameof(y)));
                            uint     serial = uint.Parse(xml.GetAttribute(nameof(serial)));

                            Gump gump = null;

                            switch (type)
                            {
                            case GumpType.Buff:
                                gump = new BuffGump();

                                break;

                            case GumpType.Container:
                                gump = new ContainerGump();

                                break;

                            case GumpType.CounterBar:
                                gump = new CounterBarGump();

                                break;

                            case GumpType.HealthBar:
                                if (CustomBarsToggled)
                                {
                                    gump = new HealthBarGumpCustom();
                                }
                                else
                                {
                                    gump = new HealthBarGump();
                                }

                                break;

                            case GumpType.InfoBar:
                                gump = new InfoBarGump();

                                break;

                            case GumpType.Journal:
                                gump = new JournalGump();

                                break;

                            case GumpType.MacroButton:
                                gump = new MacroButtonGump();

                                break;

                            case GumpType.MiniMap:
                                gump = new MiniMapGump();

                                break;

                            case GumpType.PaperDoll:
                                gump = new PaperDollGump();

                                break;

                            case GumpType.SkillMenu:
                                if (StandardSkillsGump)
                                {
                                    gump = new StandardSkillsGump();
                                }
                                else
                                {
                                    gump = new SkillGumpAdvanced();
                                }

                                break;

                            case GumpType.SpellBook:
                                gump = new SpellbookGump();

                                break;

                            case GumpType.StatusGump:
                                gump = StatusGumpBase.AddStatusGump(0, 0);

                                break;

                            //case GumpType.TipNotice:
                            //    gump = new TipNoticeGump();
                            //    break;
                            case GumpType.AbilityButton:
                                gump = new UseAbilityButtonGump();

                                break;

                            case GumpType.SpellButton:
                                gump = new UseSpellButtonGump();

                                break;

                            case GumpType.SkillButton:
                                gump = new SkillButtonGump();

                                break;

                            case GumpType.RacialButton:
                                gump = new RacialAbilityButton();

                                break;

                            case GumpType.WorldMap:
                                gump = new WorldMapGump();

                                break;

                            case GumpType.Debug:
                                gump = new DebugGump(100, 100);

                                break;

                            case GumpType.NetStats:
                                gump = new NetworkStatsGump(100, 100);

                                break;
                            }

                            if (gump == null)
                            {
                                continue;
                            }

                            gump.LocalSerial = serial;
                            gump.Restore(xml);
                            gump.X = x;
                            gump.Y = y;

                            if (gump.LocalSerial != 0)
                            {
                                UIManager.SavePosition(gump.LocalSerial, new Point(x, y));
                            }

                            if (!gump.IsDisposed)
                            {
                                gumps.Add(gump);
                            }
                        }
                        catch (Exception ex)
                        {
                            Log.Error(ex.ToString());
                        }
                    }

                    foreach (XmlElement group in root.GetElementsByTagName("anchored_group_gump"))
                    {
                        int matrix_width  = int.Parse(group.GetAttribute("matrix_w"));
                        int matrix_height = int.Parse(group.GetAttribute("matrix_h"));

                        AnchorManager.AnchorGroup ancoGroup = new AnchorManager.AnchorGroup();
                        ancoGroup.ResizeMatrix(matrix_width, matrix_height, 0, 0);

                        foreach (XmlElement xml in group.GetElementsByTagName("gump"))
                        {
                            try
                            {
                                GumpType type   = (GumpType)int.Parse(xml.GetAttribute("type"));
                                int      x      = int.Parse(xml.GetAttribute("x"));
                                int      y      = int.Parse(xml.GetAttribute("y"));
                                uint     serial = uint.Parse(xml.GetAttribute("serial"));

                                int matrix_x = int.Parse(xml.GetAttribute("matrix_x"));
                                int matrix_y = int.Parse(xml.GetAttribute("matrix_y"));

                                AnchorableGump gump = null;

                                switch (type)
                                {
                                case GumpType.SpellButton:
                                    gump = new UseSpellButtonGump();

                                    break;

                                case GumpType.SkillButton:
                                    gump = new SkillButtonGump();

                                    break;

                                case GumpType.HealthBar:
                                    if (CustomBarsToggled)
                                    {
                                        gump = new HealthBarGumpCustom();
                                    }
                                    else
                                    {
                                        gump = new HealthBarGump();
                                    }

                                    break;

                                case GumpType.AbilityButton:
                                    gump = new UseAbilityButtonGump();

                                    break;

                                case GumpType.MacroButton:
                                    gump = new MacroButtonGump();

                                    break;
                                }

                                if (gump != null)
                                {
                                    gump.LocalSerial = serial;
                                    gump.Restore(xml);
                                    gump.X = x;
                                    gump.Y = y;

                                    if (!gump.IsDisposed)
                                    {
                                        if (UIManager.AnchorManager[gump] == null && ancoGroup.IsEmptyDirection(matrix_x, matrix_y))
                                        {
                                            gumps.Add(gump);
                                            UIManager.AnchorManager[gump] = ancoGroup;
                                            ancoGroup.AddControlToMatrix(matrix_x, matrix_y, gump);
                                        }
                                        else
                                        {
                                            gump.Dispose();
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                Log.Error(ex.ToString());
                            }
                        }
                    }
                }
            }

            return(gumps);
        }
        public SurnameRegistrarGump( Mobile from, GumpType gtype)
            : base(0, 0)
        {
            caller = from;
            gumpType = gtype;

            GenerateNameList();

            if (gumpType == GumpType.Scroll)
            {
                this.Closable = true;
                this.Disposable = true;
                this.Dragable = true;
                this.Resizable = false;

                this.AddPage(0);
                this.AddBackground(68, 2, 367, 298, 9380);
                this.AddTextEntry(262, 186, 138, 18, 0, (int)Buttons.NameEntry, @"");
                this.AddButton(335, 216, 247, 248, (int)Buttons.Okay, GumpButtonType.Reply, 0);
                this.AddHtml(275, 66, 121, 106, @"If you'd like to register your character's surname, please type it in below and hit the okay button. If it is currently in use, you will have to wait for the acceptance of the name's originator.", true, true);
                this.AddHtml(107, 62, 136, 179, @"" + nameList, true, true);
            }

            if (gumpType == GumpType.Book)
            {
                this.Closable = true;
                this.Disposable = true;
                this.Dragable = true;
                this.Resizable = false;

                this.AddPage(0);
                this.AddImage(79, 48, 2200);
                this.AddTextEntry(262, 186, 138, 18, 0, (int)Buttons.NameEntry, @"");
                this.AddButton(335, 216, 247, 248, (int)Buttons.Okay, GumpButtonType.Reply, 0);
                this.AddHtml(275, 66, 121, 106, @"<BASEFONT COLOR=#101010>If you'd like to register your character's surname, please type it in below and hit the okay button. If it is currently in use, you will have to wait for the acceptance of the name's originator.</font>", false, true);
                this.AddHtml(107, 62, 136, 179, @"<BASEFONT COLOR=#101010>" + nameList, false, true);
            }
        }
Beispiel #13
0
        public void RefreshGump(Mobile from)
        {
            if (from.Name == MobPlayer.Name)
            {
                BBGUMP = new BBGump(GumpID1, GumpID2, GumpWidth, GumpHeight, GumpText, GumpHue, GumpType.ToString(), GumpPositionX, GumpPositionY);

                from.SendGump(BBGUMP);
            }
        }