- ServUO Version
- Publish 57
- Ultima Expansion
- Endless Journey
So I created a deed/gump taken mostly from the heritage token and I am trying to delete the deed on response, however I can't seem to figure out how to delete it.. anyone smarter than me want to take a look at this for me?
C#:
#region References
using System;
using Server;
using Server.Network;
using Server.Commands;
using System.Collections.Generic;
using Server.Items;
using Server.Gumps;
#endregion
namespace Server.Items
{
public class ShieldChoiceToken : Item
{
[Constructable]
public ShieldChoiceToken()
: base(0x14F0)
{
LootType = LootType.Blessed;
Weight = 1.0;
Name = "Shield Choice Token";
}
public ShieldChoiceToken(Serial serial)
: base(serial)
{
}
public override void OnDoubleClick(Mobile from)
{
if (this.IsChildOf(from.Backpack))
{
from.CloseGump(typeof(ShieldChoiceGump));
from.SendGump(new ShieldChoiceGump(from));
}
else
from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
list.Add("<BASEFONT COLOR=#7CFC00>Use this to redeem your shield</BASEFONT>");
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
}
}
namespace Server.Gumps
{
public class ShieldChoiceGump : Gump
{
private readonly Mobile m_User;
public static void Configure()
{
CommandSystem.Register("ShieldChoiceGump", AccessLevel.Administrator, e => DisplayTo(e.Mobile));
}
public static ShieldChoiceGump DisplayTo(Mobile user)
{
if (user == null || user.Deleted || !user.Player || user.NetState == null)
return null;
user.CloseGump(typeof(ShieldChoiceGump));
var gump = new ShieldChoiceGump(user);
user.SendGump(gump);
return gump;
}
public Mobile User { get; }
public ShieldChoiceGump(Mobile from)
: base(0, 0)
{
m_User = from;
AddPage(0);
AddBackground(0, 0, 520, 145, 0x13BE);
AddImageTiled(10, 10, 500, 20, 0xA40);
AddImageTiled(10, 40, 500, 75, 0xA40);
AddImageTiled(10, 114, 500, 20, 0xA40);
AddAlphaRegion(10, 10, 500, 95);
AddAlphaRegion(10, 114, 500, 20);
AddButton(10, 114, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 115, 160, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddLabel(14, 12, 1152, "Choose your item from the following:");
AddPage(1);
AddImageTiledButton(14, 44, 0x918, 0x919, 1, GumpButtonType.Reply, 0, 7030, 0x0, 18, 8);
AddLabel(98, 44, 1152, "Heater Shield");
AddImageTiledButton(264, 44, 0x918, 0x919, 2, GumpButtonType.Reply, 0, 43057, 0x0, 18, 12);
AddLabel(348, 44, 1152, "Hildebrandt Shield");
}
public override void OnResponse(NetState sender, RelayInfo info)
{
switch (info.ButtonID)
{
case 1:
sender.Mobile.AddToBackpack(new PlateShield());
break;
case 2:
sender.Mobile.AddToBackpack(new HildebrandtShield());
break;
}
}
}
}