public static void PickSearchLocation(SearchPage scroll, string DungeonNow, Mobile from) { string thisWorld = "the Land of Sosaria"; string thisPlace = "the Dungeon of Doom"; Map thisMap = Map.Trammel; int aCount = 0; ArrayList targets = new ArrayList(); foreach (Item target in World.Items.Values) { if (target is SearchBase && (DifficultyLevel.GetDifficultyLevel(target.Location, target.Map) <= GetPlayerInfo.GetPlayerDifficulty(from))) { string tWorld = Worlds.GetMyWorld(target.Map, target.Location, target.X, target.Y); Region region = Region.Find(target.Location, target.Map); targets.Add(target); aCount++; } } aCount = Utility.RandomMinMax(1, aCount); int xCount = 0; for (int i = 0; i < targets.Count; ++i) { xCount++; if (xCount == aCount) { Item finding = ( Item )targets[i]; thisWorld = Worlds.GetMyWorld(finding.Map, finding.Location, finding.X, finding.Y); thisMap = finding.Map; thisPlace = Server.Misc.Worlds.GetRegionName(finding.Map, finding.Location); } } string Word1 = "Legends"; switch (Utility.RandomMinMax(1, 4)) { case 1: Word1 = "Rumors"; break; case 2: Word1 = "Myths"; break; case 3: Word1 = "Tales"; break; case 4: Word1 = "Stories"; break; } string Word2 = "lost"; switch (Utility.RandomMinMax(1, 4)) { case 1: Word2 = "kept"; break; case 2: Word2 = "seen"; break; case 3: Word2 = "taken"; break; case 4: Word2 = "hidden"; break; } string Word3 = "deep in"; switch (Utility.RandomMinMax(1, 4)) { case 1: Word3 = "within"; break; case 2: Word3 = "somewhere in"; break; case 3: Word3 = "somehow in"; break; case 4: Word3 = "far in"; break; } string Word4 = "centuries ago"; switch (Utility.RandomMinMax(1, 4)) { case 1: Word4 = "thousands of years ago"; break; case 2: Word4 = "decades ago"; break; case 3: Word4 = "millions of years ago"; break; case 4: Word4 = "many years ago"; break; } string sMessage = scroll.SearchDungeon = thisPlace; scroll.SearchWorld = thisWorld; scroll.DungeonMap = thisMap; string EntranceLocation = Worlds.GetAreaEntrance(scroll.SearchDungeon, scroll.DungeonMap); string OldMessage = "<br><br><br><br><br><br>" + scroll.SearchMessage; scroll.SearchMessage = scroll.SearchItem + "<br><br>" + Word1 + " tell of the " + scroll.SearchItem + " being " + Word2 + " " + Word3; scroll.SearchMessage = scroll.SearchMessage + " " + scroll.SearchDungeon + " " + Word4 + " by " + QuestCharacters.QuestGiver() + "."; scroll.SearchMessage = scroll.SearchMessage + " in " + scroll.SearchWorld + " at the below sextant coordinates.<br><br>" + EntranceLocation + OldMessage; scroll.InvalidateProperties(); }
public override void OnComponentUsed(AddonComponent ac, Mobile from) { bool creatureWarned = true; if (from.Blessed) { from.SendMessage("You cannot open that while in this state."); } else if (!from.InRange(GetWorldLocation(), 2)) { from.SendMessage("You will have to get closer to open that."); } else if (from.Backpack.FindItemByType(typeof(SearchPage)) != null || from.Backpack.FindItemByType(typeof(DDRelicTablet)) != null || from.Backpack.FindItemByType(typeof(VortexCube)) != null || from.Backpack.FindItemByType(typeof(AlienEgg)) != null || from.Backpack.FindItemByType(typeof(DragonEgg)) != null || from.Backpack.FindItemByType(typeof(CourierMail)) != null) { int EmptyBox = 1; if (from.Backpack.FindItemByType(typeof(CourierMail)) != null) { Item mail = from.Backpack.FindItemByType(typeof(CourierMail)); CourierMail envelope = (CourierMail)mail; int monsters = 0; foreach (Mobile monster in this.GetMobilesInRange(5)) { if (monster is BaseCreature) { Mobile leader = ((BaseCreature)monster).GetMaster(); if (leader is PlayerMobile) { } else { ++monsters; } } } if (monsters > 0 && creatureWarned) { creatureWarned = false; from.SendMessage("You cannot open this with too many creatures around."); } else if (envelope.SearchDungeon == Server.Misc.Worlds.GetRegionName(from.Map, from.Location) && envelope.owner == from && envelope.DungeonMap == from.Map && envelope.MsgComplete == 0) { envelope.MsgComplete = 1; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the " + envelope.SearchItem + "."); from.SendSound(0x3D); EmptyBox = 0; } } if (from.Backpack.FindItemByType(typeof(VortexCube)) != null) { Item cubes = from.Backpack.FindItemByType(typeof(VortexCube)); VortexCube cube = (VortexCube)cubes; int monsters = 0; foreach (Mobile monster in this.GetMobilesInRange(5)) { if (monster is BaseCreature) { Mobile leader = ((BaseCreature)monster).GetMaster(); if (leader is PlayerMobile) { } else { ++monsters; } } } if (monsters > 0 && creatureWarned) { creatureWarned = false; from.SendMessage("You cannot open this with too many creatures around."); } else if (cube.CubeOwner == from) { if (cube.LocationKeyLaw == Server.Misc.Worlds.GetRegionName(from.Map, from.Location) && cube.HasKeyLaw == 0) { cube.HasKeyLaw = 1; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the Key of Law!"); from.SendSound(0x3D); LoggingFunctions.LogGeneric(from, "has found the Key of Law."); EmptyBox = 0; } if (cube.LocationKeyBalance == Server.Misc.Worlds.GetRegionName(from.Map, from.Location) && cube.HasKeyBalance == 0) { cube.HasKeyBalance = 1; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the Key of Balance!"); from.SendSound(0x3D); LoggingFunctions.LogGeneric(from, "has found the Key of Balance."); EmptyBox = 0; } if (cube.LocationKeyChaos == Server.Misc.Worlds.GetRegionName(from.Map, from.Location) && cube.HasKeyChaos == 0) { cube.HasKeyChaos = 1; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the Key of Chaos!"); from.SendSound(0x3D); LoggingFunctions.LogGeneric(from, "has found the Key of Chaos."); EmptyBox = 0; } int crystals = cube.HasCrystalRed + cube.HasCrystalBlue + cube.HasCrystalGreen + cube.HasCrystalYellow + cube.HasCrystalWhite + cube.HasCrystalPurple; if (crystals < 6 && cube.LocationCrystal == Server.Misc.Worlds.GetRegionName(from.Map, from.Location)) { if (cube.HasCrystalRed == 0) { cube.HasCrystalRed = 1; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the red Void Crystal!"); from.SendSound(0x3D); LoggingFunctions.LogGeneric(from, "has found the red Void Crystal."); EmptyBox = 0; } else if (cube.HasCrystalBlue == 0) { cube.HasCrystalBlue = 1; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the blue Void Crystal!"); from.SendSound(0x3D); LoggingFunctions.LogGeneric(from, "has found the blue Void Crystal."); EmptyBox = 0; } else if (cube.HasCrystalBlue == 0) { cube.HasCrystalBlue = 1; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the blue Void Crystal!"); from.SendSound(0x3D); LoggingFunctions.LogGeneric(from, "has found the blue Void Crystal."); EmptyBox = 0; } else if (cube.HasCrystalGreen == 0) { cube.HasCrystalGreen = 1; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the green Void Crystal!"); from.SendSound(0x3D); LoggingFunctions.LogGeneric(from, "has found the green Void Crystal."); EmptyBox = 0; } else if (cube.HasCrystalYellow == 0) { cube.HasCrystalYellow = 1; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the yellow Void Crystal!"); from.SendSound(0x3D); LoggingFunctions.LogGeneric(from, "has found the yellow Void Crystal."); EmptyBox = 0; } else if (cube.HasCrystalWhite == 0) { cube.HasCrystalWhite = 1; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the white Void Crystal!"); from.SendSound(0x3D); LoggingFunctions.LogGeneric(from, "has found the white Void Crystal."); EmptyBox = 0; } else if (cube.HasCrystalPurple == 0) { cube.HasCrystalPurple = 1; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the purple Void Crystal!"); from.SendSound(0x3D); LoggingFunctions.LogGeneric(from, "has found the purple Void Crystal."); EmptyBox = 0; } cube.TextCrystal = Server.Items.CubeOnCorpse.GetRumor(); cube.LocationCrystal = Server.Items.CubeOnCorpse.PickDungeon(); int crystal = cube.HasCrystalRed + cube.HasCrystalBlue + cube.HasCrystalGreen + cube.HasCrystalYellow + cube.HasCrystalWhite + cube.HasCrystalPurple; if (crystal > 5) { cube.TextCrystal = ""; cube.LocationCrystal = ""; } } } } if (from.Backpack.FindItemByType(typeof(AlienEgg)) != null) { Item eggs = from.Backpack.FindItemByType(typeof(AlienEgg)); AlienEgg egg = (AlienEgg)eggs; int monsters = 0; foreach (Mobile monster in this.GetMobilesInRange(5)) { if (monster is BaseCreature) { Mobile leader = ((BaseCreature)monster).GetMaster(); if (leader is PlayerMobile) { } else { ++monsters; } } } if (monsters > 0 && creatureWarned) { creatureWarned = false; from.SendMessage("You cannot open this with too many creatures around."); } else if (egg.PieceLocation == Server.Misc.Worlds.GetRegionName(from.Map, from.Location)) { bool pickNewEggSpot = false; if (egg.HaveRod < 1) { pickNewEggSpot = true; egg.HaveRod = 1; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the rod of amber!"); from.SendSound(0x3D); EmptyBox = 0; } else if (egg.HaveYellowCrystal < 1) { pickNewEggSpot = true; egg.HaveYellowCrystal = 1; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the sun crystal!"); from.SendSound(0x3D); EmptyBox = 0; } else if (egg.HaveRedCrystal < 1) { pickNewEggSpot = true; egg.HaveRedCrystal = 1; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the blood crystal!"); from.SendSound(0x3D); EmptyBox = 0; } else if (egg.HavePotion < 1) { pickNewEggSpot = true; egg.HavePotion = 1; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the potion of growth!"); from.SendSound(0x3D); EmptyBox = 0; } if (pickNewEggSpot) { egg.PieceRumor = Server.Items.CubeOnCorpse.GetRumor(); egg.PieceLocation = Server.Items.CubeOnCorpse.PickDungeon(); } } } else { EmptyBox++; } if (from.Backpack.FindItemByType(typeof(DragonEgg)) != null) { Item eggs = from.Backpack.FindItemByType(typeof(DragonEgg)); DragonEgg egg = (DragonEgg)eggs; int monsters = 0; foreach (Mobile monster in this.GetMobilesInRange(5)) { if (monster is BaseCreature) { Mobile leader = ((BaseCreature)monster).GetMaster(); if (leader is PlayerMobile) { } else { ++monsters; } } } if (monsters > 0 && creatureWarned) { creatureWarned = false; from.SendMessage("You cannot open this with too many creatures around."); } else if (egg.PieceLocation == Server.Misc.Worlds.GetRegionName(from.Map, from.Location)) { bool pickNewEggSpot = false; if (egg.HavePotionA < 1) { pickNewEggSpot = true; egg.HavePotionA = 1; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the elixir of the flame!"); from.SendSound(0x3D); EmptyBox = 0; } else if (egg.HavePotionB < 1) { pickNewEggSpot = true; egg.HavePotionB = 1; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the potion of the earth!"); from.SendSound(0x3D); EmptyBox = 0; } else if (egg.HavePotionC < 1) { pickNewEggSpot = true; egg.HavePotionC = 1; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the mixture of the sea!"); from.SendSound(0x3D); EmptyBox = 0; } else if (egg.HavePotionD < 1) { pickNewEggSpot = true; egg.HavePotionD = 1; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the oil of the winds!"); from.SendSound(0x3D); EmptyBox = 0; } if (pickNewEggSpot) { egg.PieceRumor = Server.Items.CubeOnCorpse.GetRumor(); egg.PieceLocation = Server.Items.CubeOnCorpse.PickDungeon(); } } } if (from.Backpack.FindItemByType(typeof(DDRelicTablet)) != null) { Container pack = from.Backpack; List <DDRelicTablet> rock = pack.FindItemsByType <DDRelicTablet>(); for (int i = 0; i < rock.Count; ++i) { DDRelicTablet stone = rock[i]; int monsters = 0; foreach (Mobile monster in this.GetMobilesInRange(5)) { if (monster is BaseCreature) { Mobile leader = ((BaseCreature)monster).GetMaster(); if (leader is PlayerMobile) { } else { ++monsters; } } } if (monsters > 0 && creatureWarned) { creatureWarned = false; from.SendMessage("You cannot open this with too many creatures around."); } else if (stone.SearchDungeon == Server.Misc.Worlds.GetRegionName(from.Map, from.Location)) { if (stone.SearchReal >= Utility.RandomMinMax(1, 100)) { Item item = null; string itemName = stone.SearchType; Type itemType = ScriptCompiler.FindTypeByName(itemName); if (itemType != null) { item = (Item)Activator.CreateInstance(itemType); from.AddToBackpack(item); LoggingFunctions.LogFoundItemQuest(from, stone.SearchItem); from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the " + stone.SearchItem + "."); from.SendSound(0x3D); } } else if (1 == Utility.RandomMinMax(1, 2)) { Item item = null; string itemName = stone.SearchType; Type itemType = ScriptCompiler.FindTypeByName(itemName); if (itemType != null) { item = (Item)Activator.CreateInstance(itemType); Item fake = new BrokenGear(); fake.ItemID = item.ItemID; fake.Hue = item.Hue; fake.Weight = item.Weight; fake.Name = "Fake " + stone.SearchItem; item.Delete(); from.AddToBackpack(fake); } from.LocalOverheadMessage(MessageType.Emote, 1150, true, "The " + stone.SearchItem + " appears to be a fake."); from.SendSound(0x5B3); } else { from.SendMessage(""); from.LocalOverheadMessage(MessageType.Emote, 0x22, true, "The tablet for the " + stone.SearchItem + " seems to be false."); from.PlaySound(0x5B3); } from.SendMessage("The tablet crumbles to dust!"); stone.Delete(); EmptyBox = 0; } } } if (from.Backpack.FindItemByType(typeof(SearchPage)) != null) { Item scroll = from.Backpack.FindItemByType(typeof(SearchPage)); SearchPage page = (SearchPage)scroll; int LeadToAnotherSpot = 100 - page.LegendPercent; int monsters = 0; foreach (Mobile monster in this.GetMobilesInRange(5)) { if (monster is BaseCreature) { Mobile leader = ((BaseCreature)monster).GetMaster(); if (leader is PlayerMobile) { } else { ++monsters; } } } if (monsters > 0 && creatureWarned) { creatureWarned = false; from.SendMessage("You cannot open this with too many creatures around."); } else if (LeadToAnotherSpot >= Utility.RandomMinMax(1, 100)) { from.PlaySound(0x249); SearchPage.PickSearchLocation(page, page.SearchDungeon, from); from.SendMessage("You didn't find it, but you did get another clue."); from.SendMessage("so you update your notes for the new place to search."); EmptyBox = 0; } else if (page.SearchDungeon == Server.Misc.Worlds.GetRegionName(from.Map, from.Location) && page.owner == from && page.DungeonMap == from.Map) { if (page.LegendReal == 1) { Item item = null; string itemName = page.SearchType; Type itemType = ScriptCompiler.FindTypeByName(itemName); if (itemType != null) { item = (Item)Activator.CreateInstance(itemType); from.AddToBackpack(item); LoggingFunctions.LogFoundItemQuest(from, page.SearchItem); from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found the " + page.SearchItem + "."); from.SendSound(0x3D); } } else if (page.LegendPercent >= Utility.RandomMinMax(1, 200)) { int nGold = page.LegendPercent * 100; string sGold = nGold.ToString(); from.LocalOverheadMessage(MessageType.Emote, 1150, true, "The legend was false, but there was " + sGold + " gold in here."); from.SendSound(0x2E6); from.AddToBackpack(new Gold(nGold)); } else if (1 == Utility.RandomMinMax(1, 2)) { Item item = null; string itemName = page.SearchType; Type itemType = ScriptCompiler.FindTypeByName(itemName); if (itemType != null) { item = (Item)Activator.CreateInstance(itemType); Item fake = new BrokenGear(); fake.ItemID = item.ItemID; fake.Hue = item.Hue; fake.Weight = item.Weight; fake.Name = "Fake " + page.SearchItem; item.Delete(); from.AddToBackpack(fake); } from.LocalOverheadMessage(MessageType.Emote, 1150, true, "The " + page.SearchItem + " appears to be a fake."); from.SendSound(0x3D); } else { from.SendMessage(""); from.LocalOverheadMessage(MessageType.Emote, 0x22, true, "The legends of the " + page.SearchItem + " seemed to be false."); from.PlaySound(0x249); } scroll.Delete(); SearchPage.ArtifactQuestTimeAllowed(from); EmptyBox = 0; } } if (EmptyBox == 1) { from.SendMessage("The chest appears to be empty."); } } else { from.SendMessage("The chest appears to be empty."); } }