protected override void OnTick() { int z = m_Map.GetAverageZ(m_X, m_Y); bool canFit = m_Map.CanFit(m_X, m_Y, z, 6, false, false); for (int i = -3; !canFit && i <= 3; ++i) { canFit = m_Map.CanFit(m_X, m_Y, z + i, 6, false, false); if (canFit) { z += i; } } if (!canFit) { return; } Item g = new Gold(100, 200); g.Delete(); int r1 = (int)(Utility.RandomMinMax(80, 160) * (MyServerSettings.GetGoldCutRate() * .01)); int r2 = (int)(Utility.RandomMinMax(200, 400) * (MyServerSettings.GetGoldCutRate() * .01)); int r3 = (int)(Utility.RandomMinMax(400, 800) * (MyServerSettings.GetGoldCutRate() * .01)); int r4 = (int)(Utility.RandomMinMax(800, 1200) * (MyServerSettings.GetGoldCutRate() * .01)); int r5 = (int)(Utility.RandomMinMax(1200, 1600) * (MyServerSettings.GetGoldCutRate() * .01)); switch (Utility.Random(21)) { case 0: g = new Crystals(r1); break; case 1: g = new DDGemstones(r2); break; case 2: g = new DDJewels(r2); break; case 3: g = new DDGoldNuggets(r3); break; case 4: g = new Gold(r3); break; case 5: g = new Gold(r3); break; case 6: g = new Gold(r3); break; case 7: g = new DDSilver(r4); break; case 8: g = new DDSilver(r4); break; case 9: g = new DDSilver(r4); break; case 10: g = new DDSilver(r4); break; case 11: g = new DDSilver(r4); break; case 12: g = new DDSilver(r4); break; case 13: g = new DDCopper(r5); break; case 14: g = new DDCopper(r5); break; case 15: g = new DDCopper(r5); break; case 16: g = new DDCopper(r5); break; case 17: g = new DDCopper(r5); break; case 18: g = new DDCopper(r5); break; case 19: g = new DDCopper(r5); break; case 20: g = new DDCopper(r5); break; } g.MoveToWorld(new Point3D(m_X, m_Y, z), m_Map); if (0.5 >= Utility.RandomDouble()) { switch (Utility.Random(3)) { case 0: // Fire column { Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052); Effects.PlaySound(g, g.Map, 0x208); break; } case 1: // Explosion { Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36BD, 20, 10, 5044); Effects.PlaySound(g, g.Map, 0x307); break; } case 2: // Ball of fire { Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36FE, 10, 10, 5052); break; } } } }
public override void OnDoubleClick(Mobile from) { if (from.Blessed) { from.SendMessage("You cannot look through that while in this state."); } else if (!from.InRange(GetWorldLocation(), 3)) { from.SendMessage("You will have to get closer to it!"); } else if (m_Uses < 5) { m_Uses++; if (Server.Misc.GetPlayerInfo.LuckyPlayer(from.Luck) && Utility.RandomBool()) { m_Uses--; } from.PlaySound(0x2E5); from.SendMessage("You pull something from the treasure hoard!"); Item item = null; switch (Utility.Random(17)) { case 0: item = Loot.RandomArty(); break; case 1: item = DungeonLoot.RandomSlayer(); break; case 2: item = Loot.RandomSArty(); break; case 3: if (Server.Misc.GetPlayerInfo.EvilPlay(from) == true && Utility.RandomMinMax(0, 10) == 10) { item = DungeonLoot.RandomEvil(); } else { item = Loot.RandomRelic(); if (item is DDRelicWeapon && Server.Misc.GetPlayerInfo.OrientalPlay(from) == true) { Server.Items.DDRelicWeapon.MakeOriental(item); } else if (item is DDRelicStatue && Server.Misc.GetPlayerInfo.OrientalPlay(from) == true) { Server.Items.DDRelicStatue.MakeOriental(item); } else if (item is DDRelicBanner && item.ItemID != 0x2886 && item.ItemID != 0x2887 && Server.Misc.GetPlayerInfo.OrientalPlay(from) == true) { Server.Items.DDRelicBanner.MakeOriental(item); } } break; case 4: item = DungeonLoot.RandomRare(); if (item.Stackable == true) { item.Amount = Utility.RandomMinMax(5, 20); } break; case 5: item = DungeonLoot.RandomLoreBooks(); break; case 6: if (Utility.Random(4) != 1) { item = Loot.RandomScroll(0, 7, SpellbookType.Regular); } else { item = Loot.RandomScroll(0, 17, SpellbookType.Necromancer); } break; case 7: int luckMod = from.Luck; if (luckMod > 2000) { luckMod = 2000; } if ((Region.Find(from.Location, from.Map)).IsPartOf("the Ancient Crash Site") || (Region.Find(from.Location, from.Map)).IsPartOf("the Ancient Sky Ship")) { item = new DDXormite((luckMod + Utility.RandomMinMax(333, 666))); } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Mines of Morinia") { item = new Crystals((luckMod + Utility.RandomMinMax(200, 400))); } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Underworld") { item = new DDJewels((luckMod + Utility.RandomMinMax(500, 1000))); } else { item = new Gold((luckMod + Utility.RandomMinMax(1000, 2000))); } break; case 8: case 9: case 10: case 11: item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(Server.LootPackEntry.IsInIslesDread(from)); ContainerFunctions.LootMutate(from, Server.LootPack.GetRegularLuckChance(from), item, from.Backpack, Utility.RandomMinMax(5, 10)); break; case 12: item = Loot.RandomInstrument(); int attributeCount; int min, max; Server.Misc.ContainerFunctions.GetRandomAOSStats(out attributeCount, out min, out max, 6); BaseInstrument instr = (BaseInstrument)item; int cHue = 0; int cUse = 0; switch (instr.Resource) { case CraftResource.AshTree: cHue = MaterialInfo.GetMaterialColor("ash", "", 0); cUse = 20; break; case CraftResource.CherryTree: cHue = MaterialInfo.GetMaterialColor("cherry", "", 0); cUse = 40; break; case CraftResource.EbonyTree: cHue = MaterialInfo.GetMaterialColor("ebony", "", 0); cUse = 60; break; case CraftResource.GoldenOakTree: cHue = MaterialInfo.GetMaterialColor("gold", "", 0); cUse = 80; break; case CraftResource.HickoryTree: cHue = MaterialInfo.GetMaterialColor("hickory", "", 0); cUse = 100; break; case CraftResource.MahoganyTree: cHue = MaterialInfo.GetMaterialColor("mahogany", "", 0); cUse = 120; break; case CraftResource.DriftwoodTree: cHue = MaterialInfo.GetMaterialColor("driftwood", "", 0); cUse = 120; break; case CraftResource.OakTree: cHue = MaterialInfo.GetMaterialColor("oak", "", 0); cUse = 140; break; case CraftResource.PineTree: cHue = MaterialInfo.GetMaterialColor("pine", "", 0); cUse = 160; break; case CraftResource.RosewoodTree: cHue = MaterialInfo.GetMaterialColor("rosewood", "", 0); cUse = 180; break; case CraftResource.WalnutTree: cHue = MaterialInfo.GetMaterialColor("walnute", "", 0); cUse = 200; break; } if (!(Server.Misc.Worlds.IsOnSpaceship(from.Location, from.Map))) { if (cHue > 0) { item.Hue = cHue; } else if (Utility.RandomMinMax(1, 4) == 1) { item.Hue = Utility.RandomColor(0); } Server.Misc.MorphingTime.MakeOrientalItem(item, from); item.Name = LootPackEntry.MagicItemName(item, from, Region.Find(from.Location, from.Map)); } else { string newName = "odd alien"; switch (Utility.RandomMinMax(0, 6)) { case 0: newName = "odd"; break; case 1: newName = "unusual"; break; case 2: newName = "bizarre"; break; case 3: newName = "curious"; break; case 4: newName = "peculiar"; break; case 5: newName = "strange"; break; case 6: newName = "weird"; break; } switch (Utility.RandomMinMax(1, 4)) { case 1: item = new Pipes(); item.Name = newName + " " + Server.Misc.RandomThings.GetRandomAlienRace() + " pipes"; break; case 2: item = new Pipes(); item.Name = newName + " " + Server.Misc.RandomThings.GetRandomAlienRace() + " pan flute"; break; case 3: item = new Fiddle(); item.Name = newName + " " + Server.Misc.RandomThings.GetRandomAlienRace() + " violin"; break; case 4: item = new Fiddle(); item.Name = newName + " " + Server.Misc.RandomThings.GetRandomAlienRace() + " fiddle"; break; } BaseInstrument lute = (BaseInstrument)item; lute.Resource = CraftResource.None; item.Hue = Utility.RandomColor(0); } instr.UsesRemaining = instr.UsesRemaining + cUse; BaseRunicTool.ApplyAttributesTo((BaseInstrument)item, attributeCount, min, max); SlayerName slayer = BaseRunicTool.GetRandomSlayer(); instr.Quality = InstrumentQuality.Regular; if (Utility.RandomMinMax(1, 4) == 1) { instr.Quality = InstrumentQuality.Exceptional; } if (Utility.RandomMinMax(1, 4) == 1) { instr.Slayer = slayer; } break; case 13: item = Loot.RandomGem(); break; case 14: item = Loot.RandomPotion(); break; case 15: item = Loot.RandomWand(); Server.Misc.MaterialInfo.ColorMetal(item, 0); string wandOwner = ""; if (Utility.RandomMinMax(1, 3) == 1) { wandOwner = Server.LootPackEntry.MagicWandOwner() + " "; } item.Name = wandOwner + item.Name; break; case 16: m_Uses = 6; // STOP GIVING LOOT WHEN THEY GET A CONTAINER int chestLuck = Server.Misc.GetPlayerInfo.LuckyPlayerArtifacts(from.Luck); if (chestLuck < 3) { chestLuck = 3; } if (chestLuck > 8) { chestLuck = 8; } item = new LootChest(Utility.RandomMinMax(3, chestLuck)); item.ItemID = Utility.RandomList(0x9AB, 0xE40, 0xE41, 0xE7C); item.Hue = Utility.RandomList(0x961, 0x962, 0x963, 0x964, 0x965, 0x966, 0x967, 0x968, 0x969, 0x96A, 0x96B, 0x96C, 0x96D, 0x96E, 0x96F, 0x970, 0x971, 0x972, 0x973, 0x974, 0x975, 0x976, 0x977, 0x978, 0x979, 0x97A, 0x97B, 0x97C, 0x97D, 0x97E, 0x4AA); Region reg = Region.Find(from.Location, from.Map); string box = "hoard chest"; switch (Utility.RandomMinMax(0, 7)) { case 0: box = "hoard chest"; break; case 1: box = "treasure chest"; break; case 2: box = "secret chest"; break; case 3: box = "fabled chest"; break; case 4: box = "legendary chest"; break; case 5: box = "mythical chest"; break; case 6: box = "lost chest"; break; case 7: box = "stolen chest"; break; } if (Server.Misc.Worlds.IsOnSpaceship(from.Location, from.Map)) { Server.Misc.ContainerFunctions.MakeSpaceCrate(((LockableContainer)item)); box = item.Name; } switch (Utility.RandomMinMax(0, 1)) { case 0: item.Name = box + " from " + Server.Misc.Worlds.GetRegionName(from.Map, from.Location); break; case 1: item.Name = box + " of " + HoardName; break; } int xTraCash = Utility.RandomMinMax(5000, 8000); int zone = 0; if (Worlds.IsOnSpaceship(from.Location, from.Map)) { zone = 1; } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Underworld") { zone = 2; } ContainerFunctions.AddGoldToContainer(xTraCash, (LootChest)item, zone, from); int artychance = GetPlayerInfo.LuckyPlayerArtifacts(from.Luck) + 10; if (Utility.RandomMinMax(0, 100) < artychance) { Item artys = Loot.RandomArty(); ((LootChest)item).DropItem(artys); BaseContainer.DropItemFix(artys, from, ((LootChest)item).ItemID, ((LootChest)item).GumpID); } break; } if (item != null) { if (Worlds.IsOnSpaceship(from.Location, from.Map)) { Server.Misc.MorphingTime.MakeSpaceAceItem(item, from); } if (item is Container) { item.MoveToWorld(from.Location, from.Map); } else { from.AddToBackpack(item); } } else { if (Worlds.IsOnSpaceship(from.Location, from.Map)) { item = new DDXormite((from.Luck + Utility.RandomMinMax(333, 666))); } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Underworld") { item = new DDJewels((from.Luck + Utility.RandomMinMax(500, 1000))); } else { item = new Gold((from.Luck + Utility.RandomMinMax(1000, 2000))); } if (item != null) { from.AddToBackpack(item); } } } else { from.SendMessage("There is nothing else worth taking from this pile!"); this.Delete(); } }
public override void OnDoubleClick(Mobile from) { int runes = HasCompassion + HasHonesty + HasHonor + HasHumility + HasJustice + HasSacrifice + HasSpirituality + HasValor; bool inVirtues = (from.Map == Map.Sosaria && from.X >= 2587 && from.Y >= 3846 && from.X <= 2604 && from.Y <= 3863); bool inCorrupt = (from.Map == Map.Sosaria && from.X >= 2858 && from.Y >= 3463 && from.X <= 2875 && from.Y <= 3478); if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it. } else if (RuneBoxOwner != from) { from.SendMessage("This chest does not belong to you so it vanishes!"); bool remove = true; foreach (Account a in Accounts.GetAccounts()) { if (a == null) { break; } int index = 0; for (int i = 0; i < a.Length; ++i) { Mobile m = a[i]; if (m == null) { continue; } if (m == RuneBoxOwner) { m.AddToBackpack(this); remove = false; } ++index; } } if (remove) { this.Delete(); } } else if ((inVirtues || inCorrupt) && runes > 7) { string side = "good"; int morality = 0; int color = 0; int tint = 0; string virtue1 = "Compassion"; string virtue2 = "Honesty"; string virtue3 = "Honor"; string virtue4 = "Humility"; string virtue5 = "Justice"; string virtue6 = "Sacrifice"; string virtue7 = "Spirituality"; string virtue8 = "Valor"; VirtueStoneChest box = new VirtueStoneChest(); if (inVirtues) { from.Fame = 15000; from.Karma = 15000; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You have cleansed the Runes in the Chamber of Virtue."); from.FixedParticles(0x3709, 10, 30, 5052, 0x480, 0, EffectLayer.LeftFoot); from.PlaySound(0x208); CharacterDatabase.SetKeys(from, "Virtue", true); from.Kills = 0; from.Criminal = false; if (((PlayerMobile)from).Profession == 1) { ((PlayerMobile)from).Profession = 0; from.Profile = ""; CharacterDatabase DB = Server.Items.CharacterDatabase.GetDB(from); DB.BardsTaleQuest = "0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#"; } from.SendMessage("You have gained a really large amount of fame and karma."); } else { from.Fame = 15000; from.Karma = -15000; side = "evil"; morality = 1; color = 0xB20; tint = 0x8B3; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You have corrupted the Runes of Virtue."); Effects.SendLocationEffect(from.Location, from.Map, 0x2A4E, 30, 10, 0xB00, 0); from.PlaySound(0x029); CharacterDatabase.SetKeys(from, "Corrupt", true); box.Name = "chest of corruption"; box.Hue = color; from.SendMessage("You have gain a really large amount of fame and lost a really large amount of karma."); virtue1 = "Cruelty"; virtue2 = "Deceit"; virtue3 = "Scorn"; virtue4 = "Arrogance"; virtue5 = "Oppression"; virtue6 = "Neglect"; virtue7 = "Sacrilege"; virtue8 = "Fear"; } QuestSouvenir.GiveReward(from, "Rune of " + virtue1, color, 0x5319); QuestSouvenir.GiveReward(from, "Rune of " + virtue2, color, 0x530F); QuestSouvenir.GiveReward(from, "Rune of " + virtue3, color, 0x531B); QuestSouvenir.GiveReward(from, "Rune of " + virtue4, color, 0x5313); QuestSouvenir.GiveReward(from, "Rune of " + virtue5, color, 0x5311); QuestSouvenir.GiveReward(from, "Rune of " + virtue6, color, 0x5315); QuestSouvenir.GiveReward(from, "Rune of " + virtue7, color, 0x530D); QuestSouvenir.GiveReward(from, "Rune of " + virtue8, color, 0x5317); List <Item> belongings = new List <Item>(); foreach (Item i in from.Backpack.Items) { if (i is QuestSouvenir && (i.Name).Contains("Rune of")) { belongings.Add(i); } } foreach (Item stuff in belongings) { box.DropItem(stuff); BaseContainer.DropItemFix(stuff, from, box.ItemID, box.GumpID); } DDRelicPainting tapestry1 = new DDRelicPainting(); tapestry1.Name = "Tapestry of " + virtue1; tapestry1.ItemID = 0x49A8; tapestry1.RelicGoldValue = Utility.RandomMinMax(10, 20) * 50; tapestry1.Hue = tint; box.DropItem(tapestry1); BaseContainer.DropItemFix(tapestry1, from, box.ItemID, box.GumpID); DDRelicPainting tapestry2 = new DDRelicPainting(); tapestry2.Name = "Tapestry of " + virtue2; tapestry2.ItemID = 0x49A2; tapestry2.RelicGoldValue = Utility.RandomMinMax(10, 20) * 50; tapestry2.Hue = tint; box.DropItem(tapestry2); BaseContainer.DropItemFix(tapestry2, from, box.ItemID, box.GumpID); DDRelicPainting tapestry3 = new DDRelicPainting(); tapestry3.Name = "Tapestry of " + virtue3; tapestry3.ItemID = 0x49B2; tapestry3.RelicGoldValue = Utility.RandomMinMax(10, 20) * 50; tapestry3.Hue = tint; box.DropItem(tapestry3); BaseContainer.DropItemFix(tapestry3, from, box.ItemID, box.GumpID); DDRelicPainting tapestry4 = new DDRelicPainting(); tapestry4.Name = "Tapestry of " + virtue4; tapestry4.ItemID = 0x49A3; tapestry4.RelicGoldValue = Utility.RandomMinMax(10, 20) * 50; tapestry4.Hue = tint; box.DropItem(tapestry4); BaseContainer.DropItemFix(tapestry4, from, box.ItemID, box.GumpID); DDRelicPainting tapestry5 = new DDRelicPainting(); tapestry5.Name = "Tapestry of " + virtue5; tapestry5.ItemID = 0x49A7; tapestry5.RelicGoldValue = Utility.RandomMinMax(10, 20) * 50; tapestry5.Hue = tint; box.DropItem(tapestry5); BaseContainer.DropItemFix(tapestry5, from, box.ItemID, box.GumpID); DDRelicPainting tapestry6 = new DDRelicPainting(); tapestry6.Name = "Tapestry of " + virtue6; tapestry6.ItemID = 0x49A0; tapestry6.RelicGoldValue = Utility.RandomMinMax(10, 20) * 50; tapestry6.Hue = tint; box.DropItem(tapestry6); BaseContainer.DropItemFix(tapestry6, from, box.ItemID, box.GumpID); DDRelicPainting tapestry7 = new DDRelicPainting(); tapestry7.Name = "Tapestry of " + virtue7; tapestry7.ItemID = 0x49A1; tapestry7.RelicGoldValue = Utility.RandomMinMax(10, 20) * 50; tapestry7.Hue = tint; box.DropItem(tapestry7); BaseContainer.DropItemFix(tapestry7, from, box.ItemID, box.GumpID); DDRelicPainting tapestry8 = new DDRelicPainting(); tapestry8.Name = "Tapestry of " + virtue8; tapestry8.ItemID = 0x49B3; tapestry8.RelicGoldValue = Utility.RandomMinMax(10, 20) * 50; tapestry8.Hue = tint; box.DropItem(tapestry8); BaseContainer.DropItemFix(tapestry8, from, box.ItemID, box.GumpID); RuneOfVirtue reward = new RuneOfVirtue(); reward.ItemOwner = from; reward.ItemSide = morality; RuneOfVirtue.RuneLook(reward); box.DropItem(reward); BaseContainer.DropItemFix(reward, from, box.ItemID, box.GumpID); Item crystals = new Crystals(Utility.RandomMinMax(1000, 2000)); box.DropItem(crystals); BaseContainer.DropItemFix(crystals, from, box.ItemID, box.GumpID); Item jewels = new DDJewels(Utility.RandomMinMax(2000, 4000)); box.DropItem(jewels); BaseContainer.DropItemFix(jewels, from, box.ItemID, box.GumpID); Item gold = new Gold(Utility.RandomMinMax(4000, 6000)); box.DropItem(gold); BaseContainer.DropItemFix(gold, from, box.ItemID, box.GumpID); Item silver = new DDSilver(Utility.RandomMinMax(6000, 8000)); box.DropItem(silver); BaseContainer.DropItemFix(silver, from, box.ItemID, box.GumpID); Item copper = new DDCopper(Utility.RandomMinMax(8000, 10000)); box.DropItem(copper); BaseContainer.DropItemFix(copper, from, box.ItemID, box.GumpID); Item gemstones = new DDGemstones(Utility.RandomMinMax(1000, 2000)); box.DropItem(gemstones); BaseContainer.DropItemFix(gemstones, from, box.ItemID, box.GumpID); Item goldnuggets = new DDGoldNuggets(Utility.RandomMinMax(2000, 30000)); box.DropItem(goldnuggets); BaseContainer.DropItemFix(goldnuggets, from, box.ItemID, box.GumpID); from.AddToBackpack(box); LoggingFunctions.LogRuneOfVirtue(from, side); this.Delete(); } else { from.SendSound(0x5AA); from.CloseGump(typeof(RuneBoxGump)); from.SendGump(new RuneBoxGump(this, from)); } }