public static GrabFlag ParseInt32(int num) { GrabFlag flag = (GrabFlag)0; switch (num) { case 1: flag = GrabFlag.Everything; break; case 2: flag = GrabFlag.Coins; break; case 3: flag = GrabFlag.Armor; break; case 4: flag = GrabFlag.Clothing; break; case 5: flag = GrabFlag.Jewelry; break; case 6: flag = GrabFlag.Weapons; break; case 7: flag = GrabFlag.Gems; break; case 8: flag = GrabFlag.Instruments; break; case 9: flag = GrabFlag.Potions; break; case 10: flag = GrabFlag.Reagents; break; case 11: flag = GrabFlag.Scrolls; break; } return(flag); }
public GrabOptionsGump(Mobile m) : base(10, 10) { GrabOptions options = Grab.GetOptions(m); AddPage(1); AddBackground(0, 0, 330, 405, 9250); AddLabel(120, 15, LabelHue, "Grab Options"); AddImageTiled(15, 35, 300, 4, 9151); AddAlphaRegion(15, 45, 160, 20); AddLabel(15, 45, LabelHue, "Loot to Grab"); AddAlphaRegion(180, 45, 135, 20); AddLabel(180, 45, LabelHue, "Placement Container"); string[] types = Enum.GetNames(typeof(GrabFlag)); for (int i = 0, y = 75; i < types.Length; i++, y += 25) { GrabFlag flag = (GrabFlag)Enum.Parse(typeof(GrabFlag), types[i], true); AddCheck(15, y, 210, 211, options.GetFlag(flag), (i + 1)); AddLabel(40, y, LabelHue, types[i]); AddLabelCropped(185, y, 100, 20, LabelHue, Grab.GetContainerName(m, flag)); AddButton(295, y, 9762, 9763, (i + 1), GumpButtonType.Reply, 0); } AddButton(15, 370, 4020, 4022, 100, GumpButtonType.Reply, 0); AddLabel(50, 370, LabelHue, "Cancel"); AddButton(285, 370, 4023, 4025, 105, GumpButtonType.Reply, 0); AddLabel(190, 370, LabelHue, "Apply Changes"); }
public static string GetContainerName(Mobile m, GrabFlag flag) { GrabOptions options = GetOptions(m); Container cont = options.GetPlacementContainer(flag); string res = "(not set)"; if (cont == null || !cont.IsChildOf(m.Backpack)) { res = "(not set)"; } else if (cont == m.Backpack) { res = "(main backpack)"; } else if (!String.IsNullOrEmpty(cont.Name)) { res = cont.Name; } else { res = cont.ItemData.Name; } return(res); }
public Container GetPlacementContainer( GrabFlag flag ) { if( ContainerTable.ContainsKey( flag ) ) return ContainerTable[flag]; return null; }
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 Container GetPlacementContainer(GrabFlag flag) { if (ContainerTable.ContainsKey(flag)) { return(ContainerTable[flag]); } return(null); }
public void SetFlag( GrabFlag flag, bool value ) { if( value ) { if( flag == GrabFlag.Everything ) Flags = GrabFlag.Everything; else Flags |= flag; } else { Flags &= flag; } }
public static GrabFlag ParseType(Item i) { GrabFlag flag = GrabFlag.Everything; if (i is Server.Currency.BaseCoin) { flag = GrabFlag.Coins; } else if (i is BaseArmor) { flag = GrabFlag.Armor; } else if (i is BaseClothing) { flag = GrabFlag.Clothing; } else if (i is BaseJewel) { flag = GrabFlag.Jewelry; } else if (i is BaseWeapon) { flag = GrabFlag.Weapons; } else if (i.ItemID >= 3855 && i.ItemID <= 3888) { flag = GrabFlag.Gems; } else if (i is BaseInstrument) { flag = GrabFlag.Instruments; } else if (i is BasePotion) { flag = GrabFlag.Potions; } else if (i is BaseReagent) { flag = GrabFlag.Reagents; } else if (i is SpellScroll) { flag = GrabFlag.Scrolls; } return(flag); }
public static string GetContainerName( Mobile m, GrabFlag flag ) { GrabOptions options = GetOptions( m ); Container cont = options.GetPlacementContainer( flag ); string res = "(not set)"; if( cont == null || !cont.IsChildOf( m.Backpack ) ) res = "(not set)"; else if( cont == m.Backpack ) res = "(main backpack)"; else if( !String.IsNullOrEmpty( cont.Name ) ) res = cont.Name; else res = cont.ItemData.Name; return res; }
public void SetFlag(GrabFlag flag, bool value) { if (value) { if (flag == GrabFlag.Everything) { Flags = GrabFlag.Everything; } else { Flags |= flag; } } else { Flags &= flag; } }
public bool GetFlag(GrabFlag flag) { return((Flags & flag) != 0); }
public GrabOptions(Mobile m, GrabFlag flags) { _containerTable = new Dictionary <GrabFlag, Container>(); _flags = flags; _mobile = m; }
public void SetPlacementContainer(GrabFlag flag, Container cont) { ContainerTable[flag] = cont; }
public void SetPlacementContainer( GrabFlag flag, Container cont ) { ContainerTable[flag] = cont; }
public bool GetFlag( GrabFlag flag ) { return ((Flags & flag) != 0); }
public GrabOptions( Mobile m, GrabFlag flags ) { _containerTable = new Dictionary<GrabFlag, Container>(); _flags = flags; _mobile = m; }