public DDRelicBook() : base(0xFBD) { Weight = 5; RelicGoldValue = Server.Misc.RelicItems.RelicValue(); ItemID = RandomThings.GetRandomBookItemID(); Hue = RandomThings.GetRandomColor(0); Name = Server.Misc.RandomThings.GetBookTitle(); }
public virtual void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked) { from.EndAction(locked); if (!CheckHarvest(from, tool)) { return; } int tileID; Map map; Point3D loc; if (!GetHarvestDetails(from, tool, toHarvest, out tileID, out map, out loc)) { OnBadHarvestTarget(from, tool, toHarvest); return; } else if (!def.Validate(tileID)) { OnBadHarvestTarget(from, tool, toHarvest); return; } if (!CheckRange(from, tool, def, map, loc, true)) { return; } else if (!CheckResources(from, tool, def, map, loc, true)) { return; } else if (!CheckHarvest(from, tool, def, toHarvest)) { return; } if (SpecialHarvest(from, tool, def, map, loc)) { return; } HarvestBank bank = def.GetBank(map, loc.X, loc.Y); if (bank == null) { return; } HarvestVein vein = bank.Vein; if (vein != null) { vein = MutateVein(from, tool, def, bank, toHarvest, vein); } if (vein == null) { return; } HarvestResource primary = vein.PrimaryResource; HarvestResource fallback = vein.FallbackResource; HarvestResource resource = MutateResource(from, tool, def, map, loc, vein, primary, fallback); double skillBase = from.Skills[def.Skill].Base; double skillValue = from.Skills[def.Skill].Value; Type type = null; if (skillBase >= resource.ReqSkill && from.CheckSkill(def.Skill, resource.MinSkill, resource.MaxSkill)) { type = GetResourceType(from, tool, def, map, loc, resource); if (type != null) { type = MutateType(type, from, tool, def, map, loc, resource); } if (type != null) { Item item = Construct(type, from); if (item == null) { type = null; } else { if (item.Stackable) { Region reg = Region.Find(from.Location, from.Map); int amount = def.ConsumedPerHarvest; int feluccaAmount = def.ConsumedPerLodorHarvest; int racialAmount = (int)Math.Ceiling(amount * 1.1); int feluccaRacialAmount = (int)Math.Ceiling(feluccaAmount * 1.1); bool eligableForRacialBonus = (def.RaceBonus && from.Race == Race.Human); bool inLodor = (map == Map.IslesDread); if (item is BlankScroll) { amount = Utility.RandomMinMax(amount, (int)(amount + (from.Skills[SkillName.Inscribe].Value / 10))); from.SendMessage("You find some blank scrolls."); } if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Isles of Dread" && bank.Current >= feluccaAmount) { item.Amount = feluccaAmount; } else if (reg.IsPartOf("the Mines of Morinia") && item is BaseOre && Utility.RandomMinMax(1, 3) > 1) { item.Amount = 2 * amount; } else { item.Amount = amount; } bool FindSpecialOre = false; if ((item is AgapiteOre || item is VeriteOre || item is ValoriteOre) && Utility.RandomMinMax(1, 2) == 1) { FindSpecialOre = true; } bool FindSpecialGranite = false; if ((item is AgapiteGranite || item is VeriteGranite || item is ValoriteGranite) && Utility.RandomMinMax(1, 2) == 1) { FindSpecialGranite = true; } bool FindGhostLog = false; if ((item is WalnutLog) || (item is RosewoodLog) || (item is PineLog) || (item is OakLog)) { FindGhostLog = true; } bool FindBlackLog = false; if ((item is AshLog) || (item is CherryLog) || (item is GoldenOakLog) || (item is HickoryLog) || (item is MahoganyLog)) { FindBlackLog = true; } bool FindToughLog = false; if (!(item is Log)) { FindToughLog = true; } if (Worlds.IsExploringSeaAreas(from) && item is BaseLog) { int driftWood = item.Amount; item.Delete(); item = new DriftwoodLog(driftWood); from.SendMessage("You chop some driftwood logs."); } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Underworld" && FindSpecialOre && item is BaseOre && from.Map == Map.SavagedEmpire) { int xormiteOre = item.Amount; item.Delete(); item = new XormiteOre(xormiteOre); from.SendMessage("You dig up some xormite ore."); } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Underworld" && FindSpecialOre && item is BaseOre) { int mithrilOre = item.Amount; item.Delete(); item = new MithrilOre(mithrilOre); from.SendMessage("You dig up some mithril ore."); } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Serpent Island" && FindSpecialOre && item is BaseOre) { int obsidianOre = item.Amount; item.Delete(); item = new ObsidianOre(obsidianOre); from.SendMessage("You dig up some obsidian ore."); } else if (Worlds.IsExploringSeaAreas(from) && FindSpecialOre && item is BaseOre) { int nepturiteOre = item.Amount; item.Delete(); item = new NepturiteOre(nepturiteOre); from.SendMessage("You dig up some nepturite ore."); } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Underworld" && FindSpecialGranite && item is BaseGranite && from.Map == Map.SavagedEmpire) { int xormiteGranite = item.Amount; item.Delete(); item = new XormiteGranite(xormiteGranite); from.SendMessage("You dig up xormite granite."); } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Underworld" && FindSpecialGranite && item is BaseGranite) { int mithrilGranite = item.Amount; item.Delete(); item = new MithrilGranite(mithrilGranite); from.SendMessage("You dig up mithril granite."); } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Serpent Island" && FindSpecialGranite && item is BaseGranite) { int obsidianGranite = item.Amount; item.Delete(); item = new ObsidianGranite(obsidianGranite); from.SendMessage("You dig up obsidian granite."); } else if (Worlds.IsExploringSeaAreas(from) && FindSpecialGranite && item is BaseGranite) { int nepturiteGranite = item.Amount; item.Delete(); item = new NepturiteGranite(nepturiteGranite); from.SendMessage("You dig up nepturite granite."); } else if (reg.IsPartOf(typeof(NecromancerRegion)) && FindBlackLog && item is BaseLog) { int blackLog = item.Amount; item.Delete(); item = new EbonyLog(blackLog); from.SendMessage("You chop some ebony logs."); } else if (reg.IsPartOf(typeof(NecromancerRegion)) && FindGhostLog && item is BaseLog) { int ghostLog = item.Amount; item.Delete(); item = new GhostLog(ghostLog); from.SendMessage("You chop some ghost logs."); } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Underworld" && FindToughLog && item is BaseLog) { int toughLog = item.Amount; item.Delete(); item = new PetrifiedLog(toughLog); from.SendMessage("You chop some petrified logs."); } else if ((reg.IsPartOf("Shipwreck Grotto") || reg.IsPartOf("Barnacled Cavern")) && FindToughLog && item is BaseLog) { int driftWood = item.Amount; item.Delete(); item = new DriftwoodLog(driftWood); from.SendMessage("You chop some driftwood logs."); } else if ((reg.IsPartOf("Shipwreck Grotto") || reg.IsPartOf("Barnacled Cavern") || reg.IsPartOf("Savage Sea Docks") || reg.IsPartOf("Serpent Sail Docks") || reg.IsPartOf("Anchor Rock Docks") || reg.IsPartOf("Kraken Reef Docks") || reg.IsPartOf("the Forgotten Lighthouse")) && FindSpecialGranite && item is BaseGranite) { int nepturiteGranite = item.Amount; item.Delete(); item = new NepturiteGranite(nepturiteGranite); from.SendMessage("You dig up nepturite granite."); } else if ((reg.IsPartOf("Shipwreck Grotto") || reg.IsPartOf("Barnacled Cavern") || reg.IsPartOf("Savage Sea Docks") || reg.IsPartOf("Serpent Sail Docks") || reg.IsPartOf("Anchor Rock Docks") || reg.IsPartOf("Kraken Reef Docks") || reg.IsPartOf("the Forgotten Lighthouse")) && FindSpecialOre && item is BaseOre) { int nepturiteOre = item.Amount; item.Delete(); item = new NepturiteOre(nepturiteOre); from.SendMessage("You dig up some nepturite ore."); } else if (item is IronOre) { from.SendMessage("You dig up some ore."); } else if (item is DullCopperOre) { from.SendMessage("You dig up some dull copper ore."); } else if (item is ShadowIronOre) { from.SendMessage("You dig up some shadow iron ore."); } else if (item is CopperOre) { from.SendMessage("You dig up some copper ore."); } else if (item is BronzeOre) { from.SendMessage("You dig up some bronze ore."); } else if (item is GoldOre) { from.SendMessage("You dig up some golden ore."); } else if (item is AgapiteOre) { from.SendMessage("You dig up some agapite ore."); } else if (item is VeriteOre) { from.SendMessage("You dig up some verite ore."); } else if (item is ValoriteOre) { from.SendMessage("You dig up some valorite ore."); } else if (item is Granite) { from.SendMessage("You dig up granite."); } else if (item is DullCopperGranite) { from.SendMessage("You dig up dull copper granite."); } else if (item is ShadowIronGranite) { from.SendMessage("You dig up shadow iron granite."); } else if (item is CopperGranite) { from.SendMessage("You dig up copper granite."); } else if (item is BronzeGranite) { from.SendMessage("You dig up bronze granite."); } else if (item is GoldGranite) { from.SendMessage("You dig up golden granite."); } else if (item is AgapiteGranite) { from.SendMessage("You dig up agapite granite."); } else if (item is VeriteGranite) { from.SendMessage("You dig up verite granite."); } else if (item is ValoriteGranite) { from.SendMessage("You dig up valorite granite."); } else if (item is Log) { from.SendMessage("You chop some logs."); } else if (item is AshLog) { from.SendMessage("You chop some ash logs."); } else if (item is CherryLog) { from.SendMessage("You chop some cherry logs."); } else if (item is EbonyLog) { from.SendMessage("You chop some ebony logs."); } else if (item is GoldenOakLog) { from.SendMessage("You chop some golden oak logs."); } else if (item is HickoryLog) { from.SendMessage("You chop some hickory logs."); } else if (item is MahoganyLog) { from.SendMessage("You chop some mahogany logs."); } else if (item is OakLog) { from.SendMessage("You chop some oak logs."); } else if (item is PineLog) { from.SendMessage("You chop some pine logs."); } else if (item is RosewoodLog) { from.SendMessage("You chop some rosewood logs."); } else if (item is WalnutLog) { from.SendMessage("You chop some walnut logs."); } else if (item is ElvenLog) { from.SendMessage("You chop some elven logs."); } if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Savaged Empire" && from.Skills[SkillName.Mining].Value > Utility.RandomMinMax(1, 500)) { Container pack = from.Backpack; DugUpCoal coal = new DugUpCoal(Utility.RandomMinMax(1, 2)); from.AddToBackpack(coal); from.SendMessage("You dig up some coal."); } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Island of Umber Veil" && from.Skills[SkillName.Mining].Value > Utility.RandomMinMax(1, 500)) { Container pack = from.Backpack; DugUpZinc zinc = new DugUpZinc(Utility.RandomMinMax(1, 2)); from.AddToBackpack(zinc); from.SendMessage("You dig up some zinc."); } if (tool is FishingPole && Server.Engines.Harvest.Fishing.IsNearHugeShipWreck(from) && from.Skills[SkillName.Fishing].Value >= Utility.RandomMinMax(1, 250)) { Server.Engines.Harvest.Fishing.FishUpFromMajorWreck(from); } else if (tool is FishingPole && Server.Engines.Harvest.Fishing.IsNearSpaceCrash(from) && from.Skills[SkillName.Fishing].Value >= Utility.RandomMinMax(1, 250)) { Server.Engines.Harvest.Fishing.FishUpFromSpaceship(from); } else if (tool is FishingPole && Server.Engines.Harvest.Fishing.IsNearUnderwaterRuins(from) && from.Skills[SkillName.Fishing].Value >= Utility.RandomMinMax(1, 250)) { Server.Engines.Harvest.Fishing.FishUpFromRuins(from); } } else if (item is BlueBook || item is LoreBook || item is DDRelicBook || item is MyNecromancerSpellbook || item is MySpellbook || item is MyNinjabook || item is MySamuraibook || item is MyPaladinbook || item is MySongbook || item is ArtifactManual) { from.SendMessage("You find a book."); if (item is DDRelicBook) { ((DDRelicBook)item).RelicGoldValue = ((DDRelicBook)item).RelicGoldValue + Utility.RandomMinMax(1, (int)(from.Skills[SkillName.Inscribe].Value * 2)); } else if (item is BlueBook) { item.Name = "Book"; item.Hue = Utility.RandomColor(0); item.ItemID = RandomThings.GetRandomBookItemID(); } } else if (item is SomeRandomNote || item is ScrollClue || item is LibraryScroll1 || item is LibraryScroll2 || item is LibraryScroll3 || item is LibraryScroll4 || item is LibraryScroll5 || item is LibraryScroll6 || item is DDRelicScrolls) { from.SendMessage("You find a scroll."); if (item is DDRelicScrolls) { ((DDRelicScrolls)item).RelicGoldValue = ((DDRelicScrolls)item).RelicGoldValue + Utility.RandomMinMax(1, (int)(from.Skills[SkillName.Inscribe].Value * 2)); } } bank.Consume(item.Amount, from); if (Give(from, item, def.PlaceAtFeetIfFull)) { SendSuccessTo(from, item, resource); } else { SendPackFullTo(from, item, def, resource); item.Delete(); } BonusHarvestResource bonus = def.GetBonusResource(); if (bonus != null && bonus.Type != null && skillBase >= bonus.ReqSkill) { Item bonusItem = Construct(bonus.Type, from); if (Give(from, bonusItem, true)) //Bonuses always allow placing at feet, even if pack is full irregrdless of def { bonus.SendSuccessTo(from); } else { item.Delete(); } } if (tool is IUsesRemaining) { IUsesRemaining toolWithUses = (IUsesRemaining)tool; toolWithUses.ShowUsesRemaining = true; if (toolWithUses.UsesRemaining > 0) { --toolWithUses.UsesRemaining; } if (toolWithUses.UsesRemaining < 1) { tool.Delete(); def.SendMessageTo(from, def.ToolBrokeMessage); } } } } } if (type == null) { def.SendMessageTo(from, def.FailMessage); } OnHarvestFinished(from, tool, def, vein, bank, resource, toHarvest); }