RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

client keeps crashing

Nordby

Sorceror
client keeps crashing

every time i double click this item my client crashes...
Code:
using System;
using Server;
using Server.Gumps;
using Server.Network;

namespace Server.Items
{

    public class ArtifactDeed : Item
    {

        [Constructable]
        public ArtifactDeed()
            : this(null)
        {
        }

        [Constructable]
        public ArtifactDeed(string name)
            : base(0x14F0)
        {
            Name = "Artifact Deed";
            LootType = LootType.Blessed;
            Hue = 1152;
        }

        public ArtifactDeed(Serial serial)
            : base(serial)
        {
        }

        public override void OnDoubleClick(Mobile from)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);
            }
            else
            {
                from.SendGump(new KeeperGump(from, this));
            }
        }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)0);
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();
        }
    }
}

this is the gump script
Code:
using System;
using System.Net;
using Server;
using Server.Accounting;
using Server.Gumps;
using Server.Items;
using Server.Mobiles;
using Server.Network;

namespace Server.Gumps
{
	public class KeeperGump : Gump
	{
        public KeeperGump(Mobile mob, Item item)
			: base( 0, 0 )
		{
			this.Closable=true;
			this.Disposable=true;
			this.Dragable=true;
			this.Resizable=false;
			this.AddPage(0);
            this.AddBackground(-2, -1, 593, 577, 9270);
			this.AddAlphaRegion(11, 12, 566, 551);
			this.AddLabel(224, 18, 0, @"Keeper Of Artifacts");
			this.AddLabel(36, 54, 0, @"Ægis Shield");
			this.AddLabel(36, 74, 0, @"Arcane Shield");
			this.AddLabel(37, 94, 0, @"Armor of Fortune");
			this.AddLabel(36, 114, 0, @"Axe of the Heavens");
			this.AddLabel(35, 134, 0, @"Blade of Insanity");
			this.AddLabel(36, 154, 0, @"Blade of the Righteous");
			this.AddLabel(36, 174, 0, @"Bone Crusher");
			this.AddLabel(36, 194, 0, @"Bracelet of Health");
			this.AddLabel(36, 214, 0, @"Breath of the Dead");
			this.AddLabel(36, 234, 0, @"Divine Countenance");
			this.AddLabel(36, 254, 0, @"Frostbringer");
			this.AddLabel(36, 274, 0, @"Gauntlets of Nobility");
			this.AddLabel(36, 294, 0, @"Hat of the Magi");
			this.AddLabel(36, 314, 0, @"Helm of Insight");
			this.AddLabel(36, 334, 0, @"Holy Knight's Breastplate");
			this.AddLabel(36, 354, 0, @"Hunter's Headdress");
			this.AddLabel(36, 374, 0, @"Jackal's Collar");
			this.AddLabel(36, 394, 0, @"Legacy of the Dread Lord");
			this.AddButton(20, 57, 1209, 1210, (int)Buttons.ButtonAegis, GumpButtonType.Reply, 1);
			this.AddButton(20, 76, 1209, 1210, (int)Buttons.ButtonArcane, GumpButtonType.Reply, 2);
			this.AddButton(20, 97, 1209, 1210, (int)Buttons.ButtonAOF, GumpButtonType.Reply, 3);
			this.AddButton(20, 117, 1209, 1210, (int)Buttons.ButtonAOTH, GumpButtonType.Reply, 4);
			this.AddButton(20, 137, 1209, 1210, (int)Buttons.ButtonBladeofInsanity, GumpButtonType.Reply, 5);
			this.AddButton(20, 157, 1209, 1210, (int)Buttons.ButtonBOTR, GumpButtonType.Reply, 6);
			this.AddButton(20, 177, 1209, 1210, (int)Buttons.ButtonBoneCrusher, GumpButtonType.Reply, 7);
			this.AddButton(20, 197, 1209, 1210, (int)Buttons.ButtonBraceofHealth, GumpButtonType.Reply, 8);
			this.AddButton(20, 217, 1209, 1210, (int)Buttons.Buttonbreathofdead, GumpButtonType.Reply, 9);
			this.AddButton(20, 237, 1209, 1210, (int)Buttons.Buttondivinecount, GumpButtonType.Reply, 10);
			this.AddButton(20, 257, 1209, 1210, (int)Buttons.Buttonfrostbringer, GumpButtonType.Reply, 11);
			this.AddButton(20, 277, 1209, 1210, (int)Buttons.Buttonnobility, GumpButtonType.Reply, 12);
			this.AddButton(20, 297, 1209, 1210, (int)Buttons.ButtonHOTM, GumpButtonType.Reply, 13);
			this.AddButton(20, 317, 1209, 1210, (int)Buttons.ButtonHelmofInsight, GumpButtonType.Reply, 14);
			this.AddButton(20, 337, 1209, 1210, (int)Buttons.ButtonHolyKnight, GumpButtonType.Reply, 15);
			this.AddButton(20, 357, 1209, 1210, (int)Buttons.ButtonHuntersHeaddress, GumpButtonType.Reply, 16);
			this.AddButton(20, 377, 1209, 1210, (int)Buttons.ButtonJackalsCollar, GumpButtonType.Reply, 17);
			this.AddButton(20, 397, 1209, 1210, (int)Buttons.ButtonLoTDL, GumpButtonType.Reply, 18);
			this.AddLabel(349, 54, 0, @"Leggings of Bane");
			this.AddLabel(350, 74, 0, @"Midnight Bracers");
			this.AddLabel(350, 94, 0, @"Ornament of the Magician");
			this.AddLabel(350, 114, 0, @"Ornate Crown of the Harrower");
			this.AddLabel(350, 134, 0, @"Ring of the Elements");
			this.AddLabel(350, 154, 0, @"Ring of the Vile");
			this.AddLabel(350, 174, 0, @"Serpent's Fang");
			this.AddLabel(350, 194, 0, @"Shadow Dancer Leggings");
			this.AddLabel(350, 214, 0, @"Spirit of the Totem");
			this.AddLabel(350, 234, 0, @"Staff of the Magi");
			this.AddLabel(350, 254, 0, @"The Berserker's Maul");
			this.AddLabel(350, 274, 0, @"The Dragon Slayer");
			this.AddLabel(350, 294, 0, @"The Dryad Bow");
			this.AddLabel(350, 314, 0, @"The Inquisitor's Resolution");
			this.AddLabel(350, 334, 0, @"The Taskmaster");
			this.AddLabel(350, 354, 0, @"Titan's Hammer");
			this.AddLabel(350, 374, 0, @"Tunic of Fire");
			this.AddLabel(350, 394, 0, @"Voice of the Fallen King");
			this.AddLabel(363, 414, 0, @"Zyronic Claw");
			this.AddImageTiled(19, 444, 549, 1, 2700);
			this.AddLabel(224, 450, 0, @"Custom Artifacts");
			this.AddButton(333, 57, 1209, 1210, (int)Buttons.ButtonLOB, GumpButtonType.Reply, 19);
			this.AddButton(333, 77, 1209, 1210, (int)Buttons.ButtonBracers, GumpButtonType.Reply, 20);
			this.AddButton(333, 97, 1209, 1210, (int)Buttons.ButtonOrny, GumpButtonType.Reply, 21);
			this.AddButton(333, 117, 1209, 1210, (int)Buttons.ButtonCrownOfHarrower, GumpButtonType.Reply, 22);
			this.AddButton(333, 137, 1209, 1210, (int)Buttons.ButtonRingofElements, GumpButtonType.Reply, 23);
			this.AddButton(333, 157, 1209, 1210, (int)Buttons.Buttonringofvile, GumpButtonType.Reply, 24);
			this.AddButton(333, 177, 1209, 1210, (int)Buttons.Buttonserpfang, GumpButtonType.Reply, 25);
			this.AddButton(333, 197, 1209, 1210, (int)Buttons.Buttondancerleggings, GumpButtonType.Reply, 26);
			this.AddButton(333, 217, 1209, 1210, (int)Buttons.Buttontotem, GumpButtonType.Reply, 27);
			this.AddButton(333, 237, 1209, 1210, (int)Buttons.Buttonstaffofmagi, GumpButtonType.Reply, 28);
			this.AddButton(333, 257, 1209, 1210, (int)Buttons.Buttonberserkersmaul, GumpButtonType.Reply, 29);
			this.AddButton(333, 277, 1209, 1210, (int)Buttons.Buttondragslayer, GumpButtonType.Reply, 30);
			this.AddButton(333, 297, 1209, 1210, (int)Buttons.Buttondryadbow, GumpButtonType.Reply, 31);
			this.AddButton(333, 317, 1209, 1210, (int)Buttons.Buttoninquis, GumpButtonType.Reply, 32);
			this.AddButton(333, 337, 1209, 1210, (int)Buttons.Buttontaskmaster, GumpButtonType.Reply, 33);
			this.AddButton(333, 357, 1209, 1210, (int)Buttons.Buttontitanshammer, GumpButtonType.Reply, 34);
			this.AddButton(333, 377, 1209, 1210, (int)Buttons.ButtonTOF, GumpButtonType.Reply, 35);
			this.AddButton(333, 397, 1209, 1210, (int)Buttons.Buttonfallenking, GumpButtonType.Reply, 36);
			this.AddButton(333, 417, 1209, 1210, (int)Buttons.ButtonClaw, GumpButtonType.Reply, 37);

		}

        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            switch (info.ButtonID)
            {
                case 1: // Aegis Shield
                    {
                        Item item = new Aegis();
                        item.LootType = LootType.Blessed;
                        from.AddToBackpack(item);
                        from.CloseGump(typeof(KeeperGump));
                        break;
                    }
            }
        }

        public enum Buttons
		{
			ButtonAegis,
			ButtonArcane,
			ButtonAOF,
			ButtonAOTH,
			ButtonBladeofInsanity,
			ButtonBOTR,
			ButtonBoneCrusher,
			ButtonBraceofHealth,
			Buttonbreathofdead,
			Buttondivinecount,
			Buttonfrostbringer,
			Buttonnobility,
			ButtonHOTM,
			ButtonHelmofInsight,
			ButtonHolyKnight,
			ButtonHuntersHeaddress,
			ButtonJackalsCollar,
			ButtonLoTDL,
			ButtonLOB,
			ButtonBracers,
			ButtonOrny,
			ButtonCrownOfHarrower,
			ButtonRingofElements,
			Buttonringofvile,
			Buttonserpfang,
			Buttondancerleggings,
			Buttontotem,
			Buttonstaffofmagi,
			Buttonberserkersmaul,
			Buttondragslayer,
			Buttondryadbow,
			Buttoninquis,
			Buttontaskmaster,
			Buttontitanshammer,
			ButtonTOF,
			Buttonfallenking,
			ButtonClaw,
		}

	}
}

when i remove this it doesnt crash on dbl click only on button click ...what am i doing wrong
Code:
public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            switch (info.ButtonID)
            {
                case 1: // Aegis Shield
                    {
                        Item item = new Aegis();
                        item.LootType = LootType.Blessed;
                        from.AddToBackpack(item);
                        from.CloseGump(typeof(KeeperGump));
                        break;
                    }
            }
        }
 

daat99

Moderator
Staff member
Try to change the code to give you a different item and see if that still crashes.
 
you do not need this line in there:
from.CloseGump(typeof(KeeperGump));
because it auto closes the gump when a button is pushed
also the ages button is actualy 0 not 1 (computers start at 0) and you do not want an item assigned to 0, becsause that is also the default close button
so just add this line in red also
Code:
        public enum Buttons
		{
			[COLOR="Red"]buttonclose,[/COLOR]
			ButtonAegis,
			ButtonArcane,
 
Top