Esempio n. 1
0
        public override Type GetResourceType(Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, HarvestResource resource)
        {
            if (def == OreAndStone)
            {
                #region Void Pool Items
                HarvestMap hmap = HarvestMap.CheckMapOnHarvest(from, loc, def);

                if (hmap != null && hmap.Resource >= CraftResource.Iron && hmap.Resource <= CraftResource.Valorite)
                {
                    hmap.UsesRemaining--;
                    hmap.InvalidateProperties();

                    CraftResourceInfo info = CraftResources.GetInfo(hmap.Resource);

                    if (info != null)
                    {
                        return(info.ResourceTypes[1]);
                    }
                }
                #endregion

                PlayerMobile pm = from as PlayerMobile;

                if (tool is ImprovedRockHammer)
                {
                    if (from.Skills[SkillName.Mining].Base >= 100.0)
                    {
                        return(resource.Types[1]);
                    }
                    else
                    {
                        return(null);
                    }
                }

                if (pm != null && pm.GemMining && pm.ToggleMiningGem && from.Skills[SkillName.Mining].Base >= 100.0 && 0.1 > Utility.RandomDouble())
                {
                    return(Loot.GemTypes[Utility.Random(Loot.GemTypes.Length)]);
                }

                double chance = tool is RockHammer ? 0.50 : 0.15;

                if (pm != null && pm.StoneMining && (pm.ToggleMiningStone || pm.ToggleStoneOnly) && from.Skills[SkillName.Mining].Base >= 100.0 && chance > Utility.RandomDouble())
                {
                    return(resource.Types[1]);
                }

                if (pm != null && pm.ToggleStoneOnly)
                {
                    return(null);
                }

                return(resource.Types[0]);
            }

            return(base.GetResourceType(from, tool, def, map, loc, resource));
        }
Esempio n. 2
0
        public override Type GetResourceType(Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, HarvestResource resource)
        {
            #region Void Pool Items
            HarvestMap hmap = HarvestMap.CheckMapOnHarvest(from, loc, def);

            if (hmap != null && hmap.Resource >= CraftResource.RegularWood && hmap.Resource <= CraftResource.Frostwood)
            {
                hmap.UsesRemaining--;
                hmap.InvalidateProperties();

                CraftResourceInfo info = CraftResources.GetInfo(hmap.Resource);

                if (info != null)
                {
                    return(info.ResourceTypes[0]);
                }
            }
            #endregion

            return(base.GetResourceType(from, tool, def, map, loc, resource));
        }
Esempio n. 3
0
        public override Type GetResourceType(Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, HarvestResource resource)
        {
            if (def == this.m_OreAndStone)
            {
                #region Void Pool Items
                HarvestMap hmap = HarvestMap.CheckMapOnHarvest(from, loc, def);

                if (hmap != null && hmap.Resource >= CraftResource.Iron && hmap.Resource <= CraftResource.Valorite)
                {
                    hmap.UsesRemaining--;
                    hmap.InvalidateProperties();

                    CraftResourceInfo info = CraftResources.GetInfo(hmap.Resource);

                    if (info != null)
                    {
                        return(info.ResourceTypes[1]);
                    }
                }
                #endregion

                PlayerMobile pm = from as PlayerMobile;

                if (pm != null && pm.GemMining && pm.ToggleMiningGem && from.Skills[SkillName.Mining].Base >= 100.0 && 0.1 > Utility.RandomDouble())
                {
                    return(Loot.RandomGem().GetType());
                }

                if (pm != null && pm.StoneMining && pm.ToggleMiningStone && from.Skills[SkillName.Mining].Base >= 100.0 && 0.15 > Utility.RandomDouble())
                {
                    return(resource.Types[1]);
                }

                return(resource.Types[0]);
            }

            return(base.GetResourceType(from, tool, def, map, loc, resource));
        }