public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadEncodedInt(); if (reader.ReadInt() == 1) { PlayerMobile pm = reader.ReadMobile <PlayerMobile>(); GreaterBraceletOfBinding brac = reader.ReadItem <GreaterBraceletOfBinding>(); if (pm != null && brac != null) { Pending = new BindEntry(pm, brac); } } for (int i = 0; i < Friends.Length; i++) { if (reader.ReadInt() == 0) { continue; } PlayerMobile pm = reader.ReadMobile <PlayerMobile>(); GreaterBraceletOfBinding brac = reader.ReadItem <GreaterBraceletOfBinding>(); if (pm != null && brac != null) { Friends[i] = new BindEntry(pm, brac); } } }
public GreaterBraceletOfBindingGump(PlayerMobile pm, GreaterBraceletOfBinding bracelet, BindEntry entry) : base(pm, 100, 100) { Bracelet = bracelet; Entry = entry; Choose = true; }
public ConfirmBindGump(PlayerMobile user, PlayerMobile from, int index, GreaterBraceletOfBinding bracelet, bool remove) : base(user, 200, 200) { Bracelet = bracelet; From = from; RemoveFromBracelet = remove; Index = index; }
public override void OnResponse(RelayInfo info) { switch (info.ButtonID) { case 1: if (RemoveFromBracelet) { GreaterBraceletOfBinding bracelet = User.FindItemOnLayer(Layer.Bracelet) as GreaterBraceletOfBinding; if (bracelet != null && bracelet.Friends[Index] != null) { var entry = bracelet.Friends[Index]; if (entry.Bracelet is GreaterBraceletOfBinding) { PlayerMobile pm = entry.Mobile; GreaterBraceletOfBinding gbr = entry.Bracelet as GreaterBraceletOfBinding; gbr.Remove(User); if (pm != null && pm.NetState != null) { var gump = pm.FindGump <GreaterBraceletOfBindingGump>(); if (gump != null) { gump.Refresh(); } } } bracelet.Remove(entry.Mobile); BaseGump.SendGump(new GreaterBraceletOfBindingGump(User, bracelet)); } } else { BraceletOfBinding brac = User.FindItemOnLayer(Layer.Bracelet) as BraceletOfBinding; if (brac != null) { var entry = new BindEntry(User, brac); Bracelet.Add(entry, Index); var g = From.FindGump <GreaterBraceletOfBindingGump>(); if (g != null) { g.Refresh(); } if (brac is GreaterBraceletOfBinding && !((GreaterBraceletOfBinding)brac).IsBound(From)) { entry = new BindEntry(From, Bracelet); ((GreaterBraceletOfBinding)brac).Pending = entry; BaseGump.SendGump(new GreaterBraceletOfBindingGump(User, (GreaterBraceletOfBinding)brac, entry)); } else { brac.Bound = Bracelet; } } else { User.SendLocalizedMessage(1151772); // You must be wearing this item to bind to another character. From.SendLocalizedMessage(1151771); // The target player must be wearing a Bracelet of Binding or Greater Bracelet of Binding for the device to work. } } break; case 2: if (!RemoveFromBracelet) { From.SendLocalizedMessage(1151778, User.Name); // ~1_val~ has declined your request to bind bracelets. } break; } }
public GreaterBraceletOfBindingGump(PlayerMobile pm, GreaterBraceletOfBinding bracelet) : base(pm, 100, 100) { Bracelet = bracelet; Choose = false; }