public override bool OnDragDrop(Mobile from, Item item) { if (PackAnimal.CheckAccess(this, from)) { if (item is BaseOre) { BaseOre m_Ore = item as BaseOre; int toConsume = m_Ore.Amount; if (toConsume > 30000) { toConsume = 30000; } else if (m_Ore.Amount < 2) { from.SendLocalizedMessage(501989); // You burn away the impurities but are left with no useable metal. m_Ore.Delete(); return(true); } BaseIngot ingot = m_Ore.GetIngot(); ingot.Amount = toConsume * 2; m_Ore.Consume(toConsume); from.PlaySound(0x57); AddToBackpack(ingot); return(true); } } return(base.OnDragDrop(from, item)); }
public void Smelt(Item ore) { int toConsume = ore.Amount; if (toConsume >= 1) { if (toConsume > 30000) { toConsume = 30000; } int ingotAmount; if (ore.ItemID == 0x19B7) { ingotAmount = toConsume / 2; if (toConsume % 2 != 0) { --toConsume; } } else if (ore.ItemID == 0x19B9) { ingotAmount = toConsume * 2; } else { ingotAmount = toConsume; } BaseOre baseOre = (BaseOre)ore; BaseIngot ingot = baseOre.GetIngot(); ingot.Amount = ingotAmount; baseOre.Consume(toConsume); this.AddToBackpack(ingot); //from.PlaySound( 0x57 ); } }
public static string ComputeName(BaseOre ba) { if (!string.IsNullOrEmpty(ba.Name)) { return(ba.Name); } string name = "ore"; if (ba.Amount > 1) { name = name + "s"; } var resource = string.Empty; if (ba.Resource != CraftResource.None) { resource = CraftResources.GetName(ba.Resource); name = string.Format("{0} {1} {2}", ba.Amount, resource, name.ToLower()); } return(name); }
public bool DoDisposeOre(int x, int y, int z, Map map, Mobile from) { HarvestBank bank = Mining.System.OreAndStone.GetBank(map, x, y); if (bank == null) { this.Say("I can not mine here"); return(false); } if (bank.Current <= 0) { return(false); } HarvestVein vein = bank.DefaultVein; if (vein == null) { this.Say("I can not mine here"); 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) { 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; if (this.Skills.Mining.Base < 120.0) { this.Say("skill = {0}", Convert.ToString(skillbase)); } 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; case CraftResource.Nepturite: { minskill = 114.0; minskill2 = 64.0; maxskill = 120.0; } break; case CraftResource.Obsidian: { minskill = 119.0; minskill2 = 69.0; maxskill = 120.0; } break; case CraftResource.Mithril: { minskill = 123.0; minskill2 = 74.0; maxskill = 120.0; } break; case CraftResource.Xormite: { minskill = 128.0; minskill2 = 78.0; maxskill = 120.0; } break; case CraftResource.Dwarven: { minskill = 133.0; minskill2 = 83.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); }
public void ConvertOretoIngot(Mobile from) { this.Skills.Mining.Cap = 120; Container backpack = this.Backpack; BankBox bank = from.BankBox; IronOre item = (IronOre)backpack.FindItemByType(typeof(IronOre)); if (item is BaseOre) { BaseOre m_Ore = item as BaseOre; int toConsume = m_Ore.Amount; if (toConsume > 30000) { toConsume = 30000; } else if (m_Ore.Amount < 2) { m_Ore.Delete(); } BaseIngot ingot = m_Ore.GetIngot(); ingot.Amount = toConsume * 2; m_Ore.Consume(toConsume); this.PlaySound(0x57); this.AddToBackpack(item); this.AddToBackpack(ingot); } ShadowOre item1 = (ShadowOre)backpack.FindItemByType(typeof(ShadowOre)); if (item1 is BaseOre) { BaseOre m_Ore = item1 as BaseOre; int toConsume = m_Ore.Amount; if (toConsume > 30000) { toConsume = 30000; } else if (m_Ore.Amount < 2) { m_Ore.Delete(); } BaseIngot ingot = m_Ore.GetIngot(); ingot.Amount = toConsume * 2; m_Ore.Consume(toConsume); this.PlaySound(0x57); this.AddToBackpack(item); this.AddToBackpack(ingot); } BronzeOre item2 = (BronzeOre)backpack.FindItemByType(typeof(BronzeOre)); if (item2 is BaseOre) { BaseOre m_Ore = item2 as BaseOre; int toConsume = m_Ore.Amount; if (toConsume > 30000) { toConsume = 30000; } else if (m_Ore.Amount < 2) { m_Ore.Delete(); } BaseIngot ingot = m_Ore.GetIngot(); ingot.Amount = toConsume * 2; m_Ore.Consume(toConsume); this.PlaySound(0x57); this.AddToBackpack(item); this.AddToBackpack(ingot); } CopperOre item3 = (CopperOre)backpack.FindItemByType(typeof(CopperOre)); if (item3 is BaseOre) { BaseOre m_Ore = item3 as BaseOre; int toConsume = m_Ore.Amount; if (toConsume > 30000) { toConsume = 30000; } else if (m_Ore.Amount < 2) { m_Ore.Delete(); } BaseIngot ingot = m_Ore.GetIngot(); ingot.Amount = toConsume * 2; m_Ore.Consume(toConsume); this.PlaySound(0x57); this.AddToBackpack(item); this.AddToBackpack(ingot); } GoldOre item4 = (GoldOre)backpack.FindItemByType(typeof(GoldOre)); if (item4 is BaseOre) { BaseOre m_Ore = item4 as BaseOre; int toConsume = m_Ore.Amount; if (toConsume > 30000) { toConsume = 30000; } else if (m_Ore.Amount < 2) { m_Ore.Delete(); } BaseIngot ingot = m_Ore.GetIngot(); ingot.Amount = toConsume * 2; m_Ore.Consume(toConsume); this.PlaySound(0x57); this.AddToBackpack(item); this.AddToBackpack(ingot); } DullcopperOre item5 = (DullcopperOre)backpack.FindItemByType(typeof(DullcopperOre)); if (item5 is BaseOre) { BaseOre m_Ore = item5 as BaseOre; int toConsume = m_Ore.Amount; if (toConsume > 30000) { toConsume = 30000; } else if (m_Ore.Amount < 2) { m_Ore.Delete(); } BaseIngot ingot = m_Ore.GetIngot(); ingot.Amount = toConsume * 2; m_Ore.Consume(toConsume); this.PlaySound(0x57); this.AddToBackpack(item); this.AddToBackpack(ingot); } AgapiteOre item6 = (AgapiteOre)backpack.FindItemByType(typeof(AgapiteOre)); if (item6 is BaseOre) { BaseOre m_Ore = item6 as BaseOre; int toConsume = m_Ore.Amount; if (toConsume > 30000) { toConsume = 30000; } else if (m_Ore.Amount < 2) { m_Ore.Delete(); } BaseIngot ingot = m_Ore.GetIngot(); ingot.Amount = toConsume * 2; m_Ore.Consume(toConsume); this.PlaySound(0x57); this.AddToBackpack(item); this.AddToBackpack(ingot); } VeriteOre item7 = (VeriteOre)backpack.FindItemByType(typeof(VeriteOre)); if (item7 is BaseOre) { BaseOre m_Ore = item7 as BaseOre; int toConsume = m_Ore.Amount; if (toConsume > 30000) { toConsume = 30000; } else if (m_Ore.Amount < 2) { m_Ore.Delete(); } BaseIngot ingot = m_Ore.GetIngot(); ingot.Amount = toConsume * 2; m_Ore.Consume(toConsume); this.PlaySound(0x57); this.AddToBackpack(item); this.AddToBackpack(ingot); } ValoriteOre item8 = (ValoriteOre)backpack.FindItemByType(typeof(ValoriteOre)); if (item8 is BaseOre) { BaseOre m_Ore = item8 as BaseOre; int toConsume = m_Ore.Amount; if (toConsume > 30000) { toConsume = 30000; } else if (m_Ore.Amount < 2) { m_Ore.Delete(); } BaseIngot ingot = m_Ore.GetIngot(); ingot.Amount = toConsume * 2; m_Ore.Consume(toConsume); this.PlaySound(0x57); this.AddToBackpack(item); this.AddToBackpack(ingot); } }
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.MIron) { double minskill = 0.0; double minskill2 = 0.0; double maxskill = 0.0; double skillbase = this.Skills.Mining.Base; switch (ore.Resource) { case CraftResource.MIron: { minskill = 00.0; minskill2 = 00.0; maxskill = 100.0; } break; case CraftResource.MDullcopper: { minskill = 60.0; minskill2 = 25.0; maxskill = 105.0; } break; case CraftResource.MShadow: { minskill = 65.0; minskill2 = 30.0; maxskill = 110.0; } break; case CraftResource.MCopper: { minskill = 70.0; minskill2 = 35.0; maxskill = 115.0; } break; case CraftResource.MGold: { minskill = 75.0; minskill2 = 40.0; maxskill = 120.0; } break; case CraftResource.MAgapite: { minskill = 80.0; minskill2 = 45.0; maxskill = 120.0; } break; case CraftResource.MVerite: { minskill = 85.0; minskill2 = 50.0; maxskill = 120.0; } break; case CraftResource.MValorite: { 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); }
public static double HarvestExp(Mobile m, Item i, HarvestDefinition def, Map map, Point3D loc, HarvestResource resource) { double rtn = 0; PlayerMobile pm = m as PlayerMobile; if (resource is BaseOre) { BaseOre bo = i as BaseOre; if (bo.Resource == CraftResource.Iron) { rtn += 1; } else if (bo.Resource == CraftResource.DullCopper) { rtn += 2; } else if (bo.Resource == CraftResource.ShadowIron) { rtn += 3; } else if (bo.Resource == CraftResource.Copper) { rtn += 4; } else if (bo.Resource == CraftResource.Bronze) { rtn += 5; } else if (bo.Resource == CraftResource.Gold) { rtn += 6; } else if (bo.Resource == CraftResource.Agapite) { rtn += 7; } else if (bo.Resource == CraftResource.Verite) { rtn += 8; } else if (bo.Resource == CraftResource.Valorite) { rtn += 9; } } if (i is Fish) { rtn += 0.2; } if (i is Log) { Log lo = i as Log; if (lo.Resource == CraftResource.RegularWood) { rtn += 1; /* * else if (lo.Resource == CraftResource.OakWood) * rtn += 2; * else if (lo.Resource == CraftResource.AshWood) * rtn += 3; * else if (lo.Resource == CraftResource.YewWood) * rtn += 4; * else if (lo.Resource == CraftResource.Heartwood) * rtn += 5; * else if (lo.Resource == CraftResource.Bloodwood) * rtn += 6; * else if (lo.Resource == CraftResource.Frostwood) * rtn += 7;*/ } } return(rtn); }
public InternalTarget(BaseOre ore) : base(2, false, TargetFlags.None) => m_Ore = ore;
protected override void OnTarget(Mobile from, object targ) { if (!(targ is BaseOre)) { from.SendMessage("This can only be used on ore."); } else if (targ is TAVOre) { m_Ore = targ as TAVOre; if (!from.InRange(m_Ore.GetWorldLocation(), 2)) { from.SendLocalizedMessage(501976); // The ore is too far away. return; } int toConsume = m_Ore.Amount; int Volume = 0; int count = 0; double Success = 2; //from.Say("success value : {0}%", Success* 100); -- Debug Text for Smelting for (int i = 0; i < TAVOre.GetLength(m_Ore); ++i) { Volume = (int)(toConsume * Success * TAVOre.GetCon(i, m_Ore)); if (Volume > 0) { Item ingot = TAVOre.GetMetals(i, m_Ore); ingot.Amount = Volume; from.AddToBackpack(ingot); count++; } } m_Ore.Consume(toConsume); opot.TargetDrink = true; opot.Drink(from); } else { ore = (BaseOre)targ; if (!from.InRange(ore.GetWorldLocation(), 2)) { from.SendLocalizedMessage(501976); // The ore is too far away. return; } int toConsume = ore.Amount; if (toConsume > 50) { toConsume = 50; } BaseIngot ingot = ore.GetIngot(); ingot.Amount = toConsume * 2; ore.Consume(toConsume); from.AddToBackpack(ingot); opot.TargetDrink = true; opot.Drink(from); } }