Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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");
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
		public Container GetPlacementContainer( GrabFlag flag )
		{
			if( ContainerTable.ContainsKey( flag ) )
				return ContainerTable[flag];

			return null;
		}
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
        public Container GetPlacementContainer(GrabFlag flag)
        {
            if (ContainerTable.ContainsKey(flag))
            {
                return(ContainerTable[flag]);
            }

            return(null);
        }
Ejemplo n.º 7
0
		public void SetFlag( GrabFlag flag, bool value )
		{
			if( value )
			{
				if( flag == GrabFlag.Everything )
					Flags = GrabFlag.Everything;
				else
					Flags |= flag;
			}
			else
			{
				Flags &= flag;
			}
		}
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
		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;
		} 
Ejemplo n.º 10
0
 public void SetFlag(GrabFlag flag, bool value)
 {
     if (value)
     {
         if (flag == GrabFlag.Everything)
         {
             Flags = GrabFlag.Everything;
         }
         else
         {
             Flags |= flag;
         }
     }
     else
     {
         Flags &= flag;
     }
 }
Ejemplo n.º 11
0
 public bool GetFlag(GrabFlag flag)
 {
     return((Flags & flag) != 0);
 }
Ejemplo n.º 12
0
 public GrabOptions(Mobile m, GrabFlag flags)
 {
     _containerTable = new Dictionary <GrabFlag, Container>();
     _flags          = flags;
     _mobile         = m;
 }
Ejemplo n.º 13
0
 public void SetPlacementContainer(GrabFlag flag, Container cont)
 {
     ContainerTable[flag] = cont;
 }
Ejemplo n.º 14
0
		public void SetPlacementContainer( GrabFlag flag, Container cont )
		{
			ContainerTable[flag] = cont;
		} 
Ejemplo n.º 15
0
		public bool GetFlag( GrabFlag flag )
		{
			return ((Flags & flag) != 0);
		}
Ejemplo n.º 16
0
		public GrabOptions( Mobile m, GrabFlag flags )
		{
			_containerTable = new Dictionary<GrabFlag, Container>();
			_flags = flags;
			_mobile = m;
		}