private void OnContainerSelect(Mobile from, object target, object state) { if (target is Container) { Container cont = (Container)target; if (!cont.IsChildOf(from.Backpack) && cont != from.Backpack) { from.SendMessage("You may only drop grabbed loot into containers in your pack."); } else { GrabOptions options = Grab.GetOptions(from); GrabFlag containerFlag = Grab.ParseInt32((int)state); options.SetPlacementContainer(containerFlag, cont); from.SendMessage("You have selected a new container for '{0}'.", Enum.GetName(typeof(GrabFlag), containerFlag)); } } else { from.SendMessage("Loot can only be dropped into containers."); } from.SendGump(new GrabOptionsGump(from)); }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { Mobile m = sender.Mobile; GrabOptions options = Grab.GetOptions(m); if (m == null || info.ButtonID <= 0 || info.ButtonID == 100) { return; } //store flags options.ResetFlags(); if (info.Switches.Length > 0) { for (int i = 0; i < info.Switches.Length; i++) { if (info.Switches[i] == 1) { options.SetFlag(GrabFlag.Everything, true); break; } options.SetFlag(Grab.ParseInt32(info.Switches[i]), true); } } else { options.SetFlag(GrabFlag.Everything, true); } //handle buttons if (info.ButtonID == 105) //OK { Grab.SaveOptions(m, options); m.SendMessage("You have updated your Grab options."); } else //placement container selection { m.SendMessage("Select the container to place this type of loot in."); m.BeginTarget(-1, false, Server.Targeting.TargetFlags.None, new TargetStateCallback(OnContainerSelect), info.ButtonID); } }