public HarvestTarget( Item tool, HarvestSystem system ) : base( -1, true, TargetFlags.None )
		{
			m_Tool = tool;
			m_System = system;

			DisallowMultis = true;
		}
		protected virtual int GetProgress(ConquestState state, Item item, CraftResource res, HarvestSystem harvest)
		{
			if (item == null || harvest == null)
			{
				return 0;
			}

            if (state.User == null)
                return 0;

			if (ItemType.IsNotNull && !item.TypeEquals(ItemType, ItemChildren))
			{
				if (ItemChangeReset)
				{
					return -state.Progress;
				}

				return 0;
			}

			if (Resource != CraftResource.None && res != Resource)
			{
				return 0;
			}

			if (HarvestSystem.IsNotNull && !harvest.TypeEquals(HarvestSystem, false))
			{
				return 0;
			}

			return item.Amount;
		}
示例#3
0
		public HarvestTarget( Item tool, HarvestSystem system ) : base( -1, true, TargetFlags.None )
		{
			m_Tool = tool;
			m_System = system;

			DisallowMultis = true;
		}
示例#4
0
        public override Item Construct(Type type, Mobile from, Item tool, HarvestDefinition def, HarvestBank bank, HarvestResource resource)
        {
            if (UseLumberjackingCaptcha)
            {
                Item item = base.Construct(type, from, tool, def, bank, resource);

                if (item == null)
                {
                    return(null);
                }

                Server.Mobiles.PlayerMobile pm = from as Server.Mobiles.PlayerMobile;

                if (pm != null && !pm.HarvestLockedout)
                {
                    pm.TempStashedHarvestDef = def;
                    pm.TempStashedHarvest    = item;

                    item.Amount = bank.Current;
                    bank.Consume(bank.Current, from);
                    HarvestSystem.WearTool(from, tool, def);
                }

                return(null);
            }

            else
            {
                return(base.Construct(type, from, tool, def, bank, resource));
            }
        }
示例#5
0
        public List <HarvestScanGumpEntry> BuildList(Mobile owner)
        {
            var harvesters = new List <Mobile>();
            var amounts    = new List <int>();

            switch (ResourceType)
            {
            case HarvestScanType.Ore:
                HarvestSystem.GetSortedLists(HarvestSystem.PlayerOreHarvested, harvesters, amounts);
                break;

            case HarvestScanType.Wood:
                HarvestSystem.GetSortedLists(HarvestSystem.PlayerLogsHarvested, harvesters, amounts);
                break;

            case HarvestScanType.Wool:
                HarvestSystem.GetSortedLists(HarvestSystem.PlayerWoolHarvested, harvesters, amounts);
                break;

            case HarvestScanType.Lockpicking:
                HarvestSystem.GetSortedLists(HarvestSystem.PlayerLockpicking, harvesters, amounts);
                break;
            }

            return(harvesters.Select((t, i) => new HarvestScanGumpEntry(t, amounts[i])).ToList());
        }
示例#6
0
 public HarvestRestart(Mobile from, Item tool, object toHarvest, HarvestSystem sys) : base(TimeSpan.FromSeconds(1))
 {
     this.from      = from;
     this.tool      = tool;
     this.toHarvest = toHarvest;
     this.sys       = sys;
 }
示例#7
0
		public HarvestTarget( Item tool, HarvestSystem system ) : base( -1, true, TargetFlags.None )
		{
			m_Tool = tool;
			m_System = system;

			DisallowMultis = true;

			if ( system is Mining )
				CheckLOS = false;
		}
示例#8
0
		public HarvestSoundTimer( Mobile from, Item tool, HarvestSystem system, HarvestDefinition def, object toHarvest, object locked, bool last ) : base( def.EffectSoundDelay )
		{
			m_From = from;
			m_Tool = tool;
			m_System = system;
			m_Definition = def;
			m_ToHarvest = toHarvest;
			m_Locked = locked;
			m_Last = last;
		}
示例#9
0
		public HarvestTimer( Mobile from, Item tool, HarvestSystem system, HarvestDefinition def, object toHarvest, object locked ) : base( TimeSpan.Zero, def.EffectDelay )
		{
			m_From = from;
			m_Tool = tool;
			m_System = system;
			m_Definition = def;
			m_ToHarvest = toHarvest;
			m_Locked = locked;
			m_Count = Utility.RandomList( def.EffectCounts );
		}
示例#10
0
 public HarvestTimer(Mobile from, Item tool, HarvestSystem system, HarvestDefinition def, object toHarvest, object locked) : base(TimeSpan.FromSeconds(4), def.EffectDelay)
 {
     m_From       = from;
     m_Tool       = tool;
     m_System     = system;
     m_Definition = def;
     m_ToHarvest  = toHarvest;
     m_Locked     = locked;
     m_Count      = Utility.RandomList(def.EffectCounts);
 }
示例#11
0
 public HarvestSoundTimer(Mobile from, Item tool, HarvestSystem system, HarvestDefinition def, object toHarvest, object locked, bool last) : base(def.EffectSoundDelay)
 {
     m_From       = from;
     m_Tool       = tool;
     m_System     = system;
     m_Definition = def;
     m_ToHarvest  = toHarvest;
     m_Locked     = locked;
     m_Last       = last;
 }
示例#12
0
        public HarvestTarget(Item tool, HarvestSystem system) : base(-1, true, TargetFlags.None)
        {
            m_Tool   = tool;
            m_System = system;

            DisallowMultis = true;

            if (system is Mining)
            {
                CheckLOS = false;
            }
        }
示例#13
0
        public HarvestTarget(Item tool, HarvestSystem system) : base(-1, true, TargetFlags.None)
        {
            m_Tool   = tool;
            m_System = system;

            DisallowMultis = true;

            if (tool is Pickaxe || tool is Shovel || tool is SturdyPickaxe || tool is SturdyShovel ||
                tool is ProspectorsTool || tool is DiamondPickaxe || tool is DiamondShovel)
            {
                CheckLOS = false;
            }
        }
示例#14
0
 public HarvestTimer(
     Mobile from, Item tool, HarvestSystem system, HarvestDefinition def, object toHarvest,
     object locked
     ) : base(TimeSpan.Zero, def.EffectDelay)
 {
     m_From       = from;
     m_Tool       = tool;
     m_System     = system;
     m_Definition = def;
     m_ToHarvest  = toHarvest;
     m_Locked     = locked;
     m_Count      = def.EffectCounts.RandomElement();
 }
示例#15
0
        public static void TargetByResource(TargetByResourceMacroEventArgs e)
        {
            Mobile m = e.Mobile;
            Item tool = e.Tool;

            HarvestSystem system = null;
            HarvestDefinition def = null;
            object toHarvest;

            if (tool is IHarvestTool)
            {
                system = ((IHarvestTool)tool).HarvestSystem;
            }

            if (system != null)
            {
                switch (e.ResourceType)
                {
                    case 0: // ore
                        if (system is Mining)
                            def = ((Mining)system).OreAndStone;
                        break;
                    case 1: // sand
                        if (system is Mining)
                            def = ((Mining)system).Sand;
                        break;
                    case 2: // wood
                        if (system is Lumberjacking)
                            def = ((Lumberjacking)system).Definition;
                        break;
                    case 3: // grave
                        if (TryHarvestGrave(m))
                            return;
                        break;
                    case 4: // red shrooms
                        if (TryHarvestShrooms(m))
                            return;
                        break;
                }

                if (def != null && FindValidTile(m, def, out toHarvest))
                {
                    system.StartHarvesting(m, tool, toHarvest);
                    return;
                }

                system.OnBadHarvestTarget(m, tool, new LandTarget(new Point3D(0, 0, 0), Map.Felucca));
            }
        }
示例#16
0
        public HarvestTimer(Mobile from, Item tool, HarvestSystem system, HarvestDefinition def, object toHarvest, object locked)
            : base(TimeSpan.Zero, def.EffectDelay)
        {
            m_From = from;
            m_Tool = tool;
            m_System = system;
            m_Definition = def;
            m_ToHarvest = toHarvest;
            m_Locked = locked;
            //m_Count = Utility.RandomList( def.EffectCounts );
            m_Count = 1 + Utility.Random(1, 5);

            //Update the action
            if (from is PlayerMobile)
                ((PlayerMobile)from).ResetPlayerAction(this);
        }
示例#17
0
        public static void AddContextMenuEntries(Mobile from, Item item, List<ContextMenus.ContextMenuEntry> list, HarvestSystem system)
        {
            if ( system != Mining.System )
                return;

            if ( !item.IsChildOf( from.Backpack ) && item.Parent != from )
                return;

            PlayerMobile pm = from as PlayerMobile;

            if ( pm == null )
                return;

            list.Add( new ContextMenuEntry( pm.ToggleMiningStone ? 6179 : 6178 ) );
            list.Add( new ToggleMiningStoneEntry( pm, false, 6176 ) );
            list.Add( new ToggleMiningStoneEntry( pm, true, 6177 ) );
        }
示例#18
0
        public HarvestTimer(Mobile from, Item tool, HarvestSystem system, HarvestDefinition def, object toHarvest, object locked)
            : base(TimeSpan.Zero, def.EffectDelay)
        {
            m_From       = from;
            m_Tool       = tool;
            m_System     = system;
            m_Definition = def;
            m_ToHarvest  = toHarvest;
            m_Locked     = locked;
            //m_Count = Utility.RandomList( def.EffectCounts );
            m_Count = 1 + Utility.Random(1, 5);

            //Update the action
            if (from is PlayerMobile)
            {
                ((PlayerMobile)from).ResetPlayerAction(this);
            }
        }
示例#19
0
        public static int CheckHarvest(Mobile from, Type type, HarvestSystem system)
        {
            if (system != Lumberjacking.System)
                return 0;

            CraftResource res = CraftResources.GetFromType(type);
            WoodsmansTalisman talisman = from.FindItemOnLayer(Layer.Talisman) as WoodsmansTalisman;

            if (talisman != null && talisman.UsesRemaining > 0 && res == talisman.Resource)
            {
                talisman.UsesRemaining--;
                from.SendLocalizedMessage(1152625); // The magic of your talisman guides your hands as you cut the wood.
                return Utility.RandomMinMax(2, 5);
            }

            return 0;
        }
示例#20
0
        public static void AddContextMenuEntries(Mobile from, Item item, List<ContextMenuEntry> list, HarvestSystem system)
        {
            if (system != Mining.System)
                return;

            if (!item.IsChildOf(from.Backpack) && item.Parent != from)
                return;

            PlayerMobile pm = from as PlayerMobile;

            if (pm == null)
                return;

            int typeentry = 0;

            if (pm.ToggleMiningStone)
                typeentry = 6179;
            if (pm.ToggleMiningGem)
                typeentry = 1112239;
            if (!pm.ToggleMiningStone && !pm.ToggleMiningGem)
                typeentry = 6178;

            ContextMenuEntry miningEntry = new ContextMenuEntry(typeentry);
            miningEntry.Color = 0x421F;
            list.Add(miningEntry);

            list.Add(new ToggleMiningStoneEntry(pm, false, false, 6176));
            list.Add(new ToggleMiningStoneEntry(pm, true, false, 6177));
            list.Add(new ToggleMiningStoneEntry(pm, false, true, 1112237));
        }