public void OnTileClicked(Mobile from, PuzzleTile tile) { if (Sequencing) { return; } if (from is PlayerMobile) { var quest = QuestHelper.GetQuest <PristineCrystalLotusQuest>((PlayerMobile)from); if (quest != null) { if (!PlayerOrder.ContainsKey(from)) { PlayerOrder[from] = new PuzzleTile[Order.Length]; } var list = PlayerOrder[from]; for (int i = 0; i < Order.Length; i++) { var actual = Order[i]; if (list[i] == null) { list[i] = tile; if (i == Order.Length - 1) { if (CheckMatch(list)) { from.SendLocalizedMessage(1151304); // You matched that pattern correctly. quest.PuzzlesComplete++; if (quest.PuzzlesComplete >= 5) { from.SendLocalizedMessage(1151306); // You may now retrieve a Pristine Crystal Lotus. } } else { from.SendLocalizedMessage(1151305); // You did not complete the pattern correctly. } } break; } } } } }
private void DoSequence() { if (Region != null && Region.GetPlayerCount() == 0) { Timer.DelayCall(TimeSpan.FromSeconds(10), DoSequence); return; } Sequencing = true; var seqCount = Utility.RandomMinMax(4, 7); Order = new PuzzleTile[seqCount]; PlayerOrder = new Dictionary <Mobile, PuzzleTile[]>(); for (int i = 0; i < seqCount; i++) { Order[i] = Tiles[Utility.Random(Tiles.Count)]; Timer.DelayCall(TimeSpan.FromSeconds(i * WhiteLength), (tile, index) => { tile.Hue = White; Timer.DelayCall(TimeSpan.FromSeconds(WhiteLength), t => { t.Hue = tile.OriginalHue; }, tile); if (index == seqCount - 1) { Sequencing = false; IPooledEnumerable eable = Map.TerMur.GetClientsInRange(Location, 20); foreach (NetState ns in eable) { if (ns.Mobile != null && ns.Mobile is PlayerMobile && QuestHelper.HasQuest <PristineCrystalLotusQuest>((PlayerMobile)ns.Mobile)) { ns.Mobile.SendLocalizedMessage(1151300, "", White); // Complete the puzzle to obtain a Pristine Crystal Lotus. } } eable.Free(); Timer.DelayCall(TimeSpan.FromSeconds(Math.Max(SequenceLength, seqCount * 3)), DoSequence); } }, Order[i], i); } }
private void LoadTiles() { var map = Map.TerMur; //West PuzzleTile tile = new PuzzleTile(this, 33, 0); tile.MoveToWorld(new Point3D(971, 2876, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 14, 0); tile.MoveToWorld(new Point3D(971, 2878, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 1195, 0); tile.MoveToWorld(new Point3D(972, 2877, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 63, 0); tile.MoveToWorld(new Point3D(973, 2876, 37), map); Tiles.Add(tile); // NorthWest tile = new PuzzleTile(this, 63, 1); tile.MoveToWorld(new Point3D(978, 2868, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 1195, 1); tile.MoveToWorld(new Point3D(979, 2868, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 14, 1); tile.MoveToWorld(new Point3D(979, 2869, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 33, 1); tile.MoveToWorld(new Point3D(980, 2870, 37), map); Tiles.Add(tile); // NorthEast tile = new PuzzleTile(this, 33, 2); tile.MoveToWorld(new Point3D(985, 2870, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 1195, 2); tile.MoveToWorld(new Point3D(986, 2870, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 63, 2); tile.MoveToWorld(new Point3D(985, 2871, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 14, 2); tile.MoveToWorld(new Point3D(986, 2871, 37), map); Tiles.Add(tile); // East tile = new PuzzleTile(this, 14, 3); tile.MoveToWorld(new Point3D(985, 2876, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 33, 3); tile.MoveToWorld(new Point3D(986, 2877, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 63, 3); tile.MoveToWorld(new Point3D(987, 2878, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 1195, 3); tile.MoveToWorld(new Point3D(988, 2879, 37), map); Tiles.Add(tile); // SouthEast tile = new PuzzleTile(this, 1195, 4); tile.MoveToWorld(new Point3D(982, 2881, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 33, 4); tile.MoveToWorld(new Point3D(982, 2882, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 63, 4); tile.MoveToWorld(new Point3D(982, 2883, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 14, 4); tile.MoveToWorld(new Point3D(981, 2883, 37), map); Tiles.Add(tile); // SouthWest tile = new PuzzleTile(this, 33, 5); tile.MoveToWorld(new Point3D(975, 2882, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 14, 5); tile.MoveToWorld(new Point3D(976, 2883, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 63, 5); tile.MoveToWorld(new Point3D(975, 2884, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 1195, 5); tile.MoveToWorld(new Point3D(976, 2885, 37), map); Tiles.Add(tile); Teleporter tele = new Teleporter(new Point3D(1050, 2940, 38), map, false); tele.MoveToWorld(new Point3D(1018, 2915, 38), map); Static sparkles = new Static(0x373A); sparkles.MoveToWorld(new Point3D(1018, 2915, 38), map); tele = new Teleporter(new Point3D(1018, 2915, 38), map, false); tele.MoveToWorld(new Point3D(1050, 2940, 38), map); sparkles = new Static(0x373A); sparkles.MoveToWorld(new Point3D(1050, 2940, 38), map); }