public void Prospect(Mobile from, object toProspect) { if (!IsChildOf(from.Backpack) && Parent != from) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. return; } HarvestSystem system = Mining.System; int tileID; Map map; Point3D loc; if (!system.GetHarvestDetails(from, this, toProspect, out tileID, out map, out loc)) { from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that. return; } HarvestDefinition def = system.GetDefinition(tileID); if (def == null || def.Veins.Length <= 1) { from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that. return; } HarvestBank bank = def.GetBank(map, loc.X, loc.Y); if (bank == null) { from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that. return; } HarvestVein vein = bank.Vein, defaultVein = bank.DefaultVein; if (vein == null || defaultVein == null) { from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that. return; } else if (vein != defaultVein) { from.SendLocalizedMessage(1049049); // That ore looks to be prospected already. return; } int veinIndex = Array.IndexOf(def.Veins, vein); if (veinIndex < 0) { from.SendLocalizedMessage(1049048); // You cannot use your prospector tool on that. } else if (veinIndex >= (def.Veins.Length - 1)) { from.SendMessage("You cannot this vein through prospecting."); // You cannot improve valorite ore through prospecting. } else { bank.Vein = def.Veins[veinIndex + 1]; switch (veinIndex + 1) { default: from.SendMessage("You sift through the ore and find ferite deposits."); break; case 0: from.SendMessage("You sift through the ore and find ferite deposits."); break; case 1: from.SendMessage("You sift through the ore and find malachite deposits."); break; case 2: from.SendMessage("You sift through the ore and find pyrite deposits."); break; case 3: from.SendMessage("You sift through the ore and find umbrite deposits."); break; case 4: from.SendMessage("You sift through the ore and find amirite deposits."); break; } --UsesRemaining; if (UsesRemaining <= 0) { from.SendLocalizedMessage(1049062); // You have used up your prospector's tool. Delete(); } } }
public void DoMining() { if (Map == null || Map == Map.Internal) { return; } // We may not mine while we are fighting if (Combatant != null) { return; } HarvestSystem system = Mining.System; HarvestDefinition def = Mining.System.OreAndStone; // Our target is the land tile under us Map map = Map; Point3D loc = Location; int x = 0, y = 0; GetMiningOffset(Direction, ref x, ref y); loc.X += x; loc.Y += y; int tileId = map.Tiles.GetLandTile(loc.X, loc.Y).ID & 0x3FFF; if (!def.Validate(tileId)) { return; } HarvestBank bank = def.GetBank(map, loc.X, loc.Y); if (bank == null || bank.Current < def.ConsumedPerHarvest) { return; } HarvestVein vein = bank.Vein; if (vein == null) { return; } HarvestResource primary = vein.PrimaryResource; HarvestResource fallback = def.Resources[0]; HarvestResource resource = system.MutateResource(this, null, def, map, loc, vein, primary, fallback); double skillBase = Skills[def.Skill].Base; Type type = null; if (skillBase >= resource.ReqSkill && CheckSkill(def.Skill, resource.MinSkill, resource.MaxSkill)) { type = system.GetResourceType(this, null, def, map, loc, resource); if (type != null) { type = system.MutateType(type, this, null, def, map, loc, resource); } if (type != null) { Item item = system.Construct(type, this, null); if (item == null) { type = null; } else { if (item.Stackable) { int amount = def.ConsumedPerHarvest; int feluccaAmount = def.ConsumedPerFeluccaHarvest; bool inFelucca = (map == Map.Felucca); if (inFelucca) { item.Amount = feluccaAmount; } else { item.Amount = amount; } } bank.Consume(item.Amount, this); item.MoveToWorld(loc, map); system.DoHarvestingEffect(this, null, def, map, loc); system.DoHarvestingSound(this, null, def, null); // Mine for gems BonusHarvestResource bonus = def.GetBonusResource(); if (bonus != null && bonus.Type != null && skillBase >= bonus.ReqSkill) { Item bonusItem = system.Construct(bonus.Type, this, null); bonusItem.MoveToWorld(loc, map); } } } } }
public bool DoDisposeOre(int x, int y, int z, Map map, Mobile from) { if (!IsMiningTile(x, y, map)) { this.Say("I can not mine here !"); m_Mine = false; this.Hue = 0; ControlOrder = OrderType.Follow; return(false); } HarvestBank bank = Mining.System.OreAndStone.GetBank(map, x, y); if (bank == null) { this.Say("I can not mine here !"); m_Mine = false; this.Hue = 0; ControlOrder = OrderType.Follow; return(false); } if (bank.Current <= 0) { this.Say("No Ore remains !"); m_Mine = false; this.Hue = 0; ControlOrder = OrderType.Follow; return(false); } HarvestVein vein = bank.DefaultVein; if (vein == null) { this.Say("I can not mine here !"); m_Mine = false; this.Hue = 0; ControlOrder = OrderType.Follow; return(false); } HarvestDefinition def = Mining.System.OreAndStone; HarvestResource res = vein.PrimaryResource; BaseOre ore = Mining.System.Construct(res.Types[0], null) as BaseOre; if (ore == null) { this.Say("I can not mine here !"); m_Mine = false; this.Hue = 0; ControlOrder = OrderType.Follow; return(false); } if (ore.Resource > CraftResource.Iron) { double minskill = 0.0; double minskill2 = 0.0; double maxskill = 0.0; double skillbase = this.Skills.Mining.Base; switch (ore.Resource) { case CraftResource.Iron: { minskill = 00.0; minskill2 = 00.0; maxskill = 100.0; } break; case CraftResource.DullCopper: { minskill = 60.0; minskill2 = 25.0; maxskill = 105.0; } break; case CraftResource.ShadowIron: { minskill = 65.0; minskill2 = 30.0; maxskill = 110.0; } break; case CraftResource.Copper: { minskill = 70.0; minskill2 = 35.0; maxskill = 115.0; } break; case CraftResource.Gold: { minskill = 75.0; minskill2 = 40.0; maxskill = 120.0; } break; case CraftResource.Agapite: { minskill = 80.0; minskill2 = 45.0; maxskill = 120.0; } break; case CraftResource.Verite: { minskill = 85.0; minskill2 = 50.0; maxskill = 120.0; } break; case CraftResource.Valorite: { minskill = 90.0; minskill2 = 55.0; maxskill = 120.0; } break; } if (Utility.RandomDouble() <= 0.30 || skillbase < minskill) { ore = new IronOre(); minskill = 00.0; minskill2 = 00.0; maxskill = 100.0; } if (!(from.CheckSkill(SkillName.Mining, minskill2, maxskill))) { ore.Delete(); return(false); } } ore.Amount = (map == Map.Felucca ? 2 : 1); if (from != null) { from.AddToBackpack(ore); } else { ore.Delete(); } bank.Consume(ore.Amount, this); this.Hue = ore.Hue; return(true); }