private string UseMoonstone(Moonstone moonstone, out bool bMoonstoneBuried) { bool isAllowedToBuryMoongate() { if (State.TheVirtualMap.LargeMapOverUnder == LargeMap.Maps.Small) { return(false); } if (State.TheVirtualMap.IsAnyExposedItems(State.TheVirtualMap.CurrentPosition)) { return(false); } TileReference tileRef = State.TheVirtualMap.GetTileReferenceOnCurrentTile(); return(SpriteTileReferences.IsMoonstoneBuriable(tileRef.Index)); } bMoonstoneBuried = false; if (!isAllowedToBuryMoongate()) { return(DataOvlRef.StringReferences.GetString((DataOvlReference.ExclaimStrings.MOONSTONE_SPACE)) + DataOvlRef.StringReferences.GetString((DataOvlReference .ExclaimStrings.CANNOT_BE_BURIED_HERE_BANG_N))); } State.TheMoongates.SetMoonstoneBuried(moonstone.MoongateIndex, true, State.TheVirtualMap.GetCurrent3DPosition()); bMoonstoneBuried = true; return(DataOvlRef.StringReferences.GetString((DataOvlReference.ExclaimStrings.MOONSTONE_SPACE)) + DataOvlRef.StringReferences.GetString((DataOvlReference .ExclaimStrings.BURIED_BANG_N))); }
protected override void OnTarget(Mobile from, object targeted) { if (m_ItemSrc.Deleted) { return; } if (targeted is Moonstone) { Moonstone stone = (Moonstone)targeted; if (!(m_ItemSrc is RecallRune)) { from.SendMessage("You cannot copy that to a moonstone."); } else if (!((RecallRune)m_ItemSrc).Marked) { from.SendMessage("You cannot copy an unmarked recall rune."); } else if (Inscribe.GetUser(stone) != null) { from.SendLocalizedMessage(501621); // Someone else is inscribing that item. } else { if (from.Mana < 20) { from.SendMessage("You have insufficient mana to copy the recall rune."); return; } Container pack = from.Backpack; if (pack == null) { from.SendMessage("You have no backpack! Contact a GM immediately."); return; } if (pack.ConsumeUpTo(typeof(PowderOfTranslocation), 1) != 1) { from.SendMessage("You must have some powder of translocation to mark the moonstone."); return; } from.Mana -= 20; if (Utility.RandomDouble() * 100 >= (100.0 - ((from.Skills[SkillName.Inscribe].Value + from.Skills[SkillName.Magery].Value) / 2.0)) * 2.0) { RecallRune rune = (RecallRune)m_ItemSrc; stone.Marked = true; stone.Description = "a moonstone for " + rune.Description; stone.Destination = rune.Target; from.SendMessage("You copy the rune."); from.PlaySound(0x1FA); Effects.SendLocationEffect(rune, rune.Map, 14201, 16); Effects.SendLocationEffect(stone, stone.Map, 14201, 16); } else { from.SendMessage("You fail to copy the recall rune."); } } } else if (targeted is BaseBook) { BaseBook bookDst = (BaseBook)targeted; if (!(m_ItemSrc is BaseBook)) { from.SendMessage("You cannot copy that to a book."); } else if (Inscribe.IsEmpty(m_ItemSrc as BaseBook)) { from.SendLocalizedMessage(501611); // Can't copy an empty book. } else if (bookDst == m_ItemSrc) { from.SendLocalizedMessage(501616); // Cannot copy a book onto itself. } else if (!bookDst.Writable) { from.SendLocalizedMessage(501614); // Cannot write into that book. } else if (Inscribe.GetUser(bookDst) != null) { from.SendLocalizedMessage(501621); // Someone else is inscribing that item. } else { if (from.CheckTargetSkill(SkillName.Inscribe, bookDst, 0, 50)) { Inscribe.CopyBook(m_ItemSrc as BaseBook, bookDst); from.SendLocalizedMessage(501618); // You make a copy of the book. from.PlaySound(0x249); } else { from.SendLocalizedMessage(501617); // You fail to make a copy of the book. } } } else { from.SendMessage("You are unable to copy those two items."); } }
public static void RetargetRunes_OnCommand(CommandEventArgs e) { ArrayList regionList = new ArrayList(); if (HaveRegions(e, regionList)) { try { LogHelper Logger = new LogHelper("retarget.log", e.Mobile, true); foreach (Item item in World.Items.Values) { if (item is RecallRune) { RecallRune rune = (RecallRune)item; for (int ix = 0; ix < regionList.Count; ix++) { if (rune.Marked && rune.TargetMap != null && (regionList[ix] as Region).Contains(rune.Target)) { object root = item.RootParent; if (root is Mobile) { if (((Mobile)root).AccessLevel < AccessLevel.GameMaster) { Logger.Log(LogType.Item, rune, rune.Description); rune.Target = new Point3D(0, 0, 0); } } else { Logger.Log(LogType.Item, rune, rune.Description); rune.Target = new Point3D(0, 0, 0); } } } } else if (item is Moonstone) { Moonstone stone = (Moonstone)item; for (int ix = 0; ix < regionList.Count; ix++) { if (stone.Marked && (regionList[ix] as Region).Contains(stone.Destination)) { object root = item.RootParent; if (root is Mobile) { if (((Mobile)root).AccessLevel < AccessLevel.GameMaster) { Logger.Log(LogType.Item, stone, stone.Description); stone.Destination = new Point3D(0, 0, 0); } } else { Logger.Log(LogType.Item, stone, stone.Description); stone.Destination = new Point3D(0, 0, 0); } } } } else if (item is Runebook) { Runebook book = (Runebook)item; for (int ix = 0; ix < regionList.Count; ix++) { for (int i = 0; i < book.Entries.Count; ++i) { RunebookEntry entry = (RunebookEntry)book.Entries[i]; if (entry.Map != null && (regionList[ix] as Region).Contains(entry.Location)) { object root = item.RootParent; if (root is Mobile) { if (((Mobile)root).AccessLevel < AccessLevel.GameMaster) { Logger.Log(LogType.Item, item, string.Format("{0}:{1}:{2}", i, entry.Description, book.Description)); entry.Location = new Point3D(0, 0, 0); } } else { Logger.Log(LogType.Item, item, string.Format("{0}:{1}:{2}", i, entry.Description, book.Description)); entry.Location = new Point3D(0, 0, 0); } } } } } } Logger.Finish(); e.Mobile.SendMessage("DONE search for runes."); return; } catch (Exception exc) { LogHelper.LogException(exc); e.Mobile.SendMessage("Exception in [Retarget -- see console."); System.Console.WriteLine("Exception in [Retarget: {0}", exc.Message); System.Console.WriteLine(exc.StackTrace); return; } } else { e.Mobile.SendMessage("Usage: [Retarget <-regionName|-type|-point|-RegionUID> <name|type|point|uid>"); } }
public static void WipeMagicToTarget(Mobile from, object target) { try { Region region = null; if (target is HouseSign) { BaseHouse bh = (target as HouseSign).Structure; if (bh == null) { from.SendMessage("This house sign is not associated with any house."); return; } region = bh.Region; if (region == null) { from.SendMessage("This house is not associated with any region."); return; } } else if (target is TownshipStone) { region = (target as TownshipStone).MyRegion; if (region == null) { from.SendMessage("This township stone is not associated with any region."); return; } } from.SendMessage("Searching for runes marked for this region"); LogHelper Logger = new LogHelper("WipeMagicToTarget.log", from, false); foreach (Item item in World.Items.Values) { if (item is RecallRune) { RecallRune rune = (RecallRune)item; if (rune.Marked && rune.TargetMap != null && region.Contains(rune.Target)) { object root = item.RootParent; if (root is Mobile) { if (((Mobile)root).AccessLevel < AccessLevel.GameMaster) { Logger.Log(LogType.Item, rune, rune.Description); rune.Target = new Point3D(0, 0, 0); } } else { Logger.Log(LogType.Item, rune, rune.Description); rune.Target = new Point3D(0, 0, 0); } } } else if (item is Moonstone) { Moonstone stone = (Moonstone)item; if (stone.Marked && region.Contains(stone.Destination)) { object root = item.RootParent; if (root is Mobile) { if (((Mobile)root).AccessLevel < AccessLevel.GameMaster) { Logger.Log(LogType.Item, stone, stone.Description); stone.Destination = new Point3D(0, 0, 0); } } else { Logger.Log(LogType.Item, stone, stone.Description); stone.Destination = new Point3D(0, 0, 0); } } } else if (item is Runebook) { Runebook book = (Runebook)item; for (int i = 0; i < book.Entries.Count; ++i) { RunebookEntry entry = (RunebookEntry)book.Entries[i]; if (entry.Map != null && region.Contains(entry.Location)) { object root = item.RootParent; if (root is Mobile) { if (((Mobile)root).AccessLevel < AccessLevel.GameMaster) { Logger.Log(LogType.Item, item, string.Format("{0}:{1}:{2}", i, entry.Description, book.Description)); entry.Location = new Point3D(0, 0, 0); } } else { Logger.Log(LogType.Item, item, string.Format("{0}:{1}:{2}", i, entry.Description, book.Description)); entry.Location = new Point3D(0, 0, 0); } } } } } Logger.Finish(); from.SendMessage("Done searching for runes withing house regions"); // okay, now turn off all house security //int houseschecked = Server.Multis.BaseHouse.SetSecurity(false); //e.Mobile.SendMessage("Setting {0} houses to insecure",houseschecked); return; } catch (Exception exc) { from.SendMessage("Exception in [findrunes -- see console."); System.Console.WriteLine("Exception in [findrunes: {0}", exc.Message); System.Console.WriteLine(exc.StackTrace); return; } }