public override void OnResponse(NetState sender, RelayInfo info) { object toSet; bool shouldSet, shouldSend = true; switch (info.ButtonID) { case 1: { TextRelay text = info.GetTextEntry(0); if (text != null) { try { toSet = XmlPropertiesGump.GetObjectFromString(this.m_Property.PropertyType, text.Text); shouldSet = true; } catch { toSet = null; shouldSet = false; this.m_Mobile.SendMessage("Bad format"); } } else { toSet = null; shouldSet = false; } break; } case 2: // Null { toSet = null; shouldSet = true; break; } case 3: // Hue Picker { toSet = null; shouldSet = false; shouldSend = false; this.m_Mobile.SendHuePicker(new InternalPicker(this.m_Property, this.m_Mobile, this.m_Object, this.m_Stack, this.m_Page, this.m_List)); break; } case 4: // Body Picker { toSet = null; shouldSet = false; shouldSend = false; this.m_Mobile.SendGump(new SetBodyGump(this.m_Property, this.m_Mobile, this.m_Object, this.m_Stack, this.m_Page, this.m_List)); break; } default: { toSet = null; shouldSet = false; break; } } if (shouldSet) { try { CommandLogging.LogChangeProperty(this.m_Mobile, this.m_Object, this.m_Property.Name, toSet == null ? "(null)" : toSet.ToString()); this.m_Property.SetValue(this.m_Object, toSet, null); } catch { this.m_Mobile.SendMessage("An exception was caught. The property may not have changed."); } } if (shouldSend) { this.m_Mobile.SendGump(new XmlPropertiesGump(this.m_Mobile, this.m_Object, this.m_Stack, this.m_List, this.m_Page)); } }
public override void OnResponse(NetState sender, RelayInfo info) { if (m_Mobile.Deleted) { m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Mobile)); return; } else if (!BaseCommand.IsAccessible(m_From, m_Mobile)) { m_From.SendMessage("That is no longer accessible."); m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Mobile)); return; } switch (info.ButtonID) { case 0: case 1: { m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Mobile)); break; } case 2: // Properties { m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile)); m_From.SendGump(new PropertiesGump(m_From, m_Mobile)); break; } case 3: // Delete { if (!m_Mobile.Player) { CommandLogging.WriteLine(m_From, "{0} {1} deleting {2}", m_From.AccessLevel, CommandLogging.Format(m_From), CommandLogging.Format(m_Mobile)); m_Mobile.Delete(); m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Mobile)); } break; } case 4: // Go there { m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile)); InvokeCommand(String.Format("Go {0}", m_Mobile.Serial.Value)); break; } case 5: // Bring them here { if (m_From.Map == null || m_From.Map == Map.Internal) { m_From.SendMessage("You cannot bring that person here."); } else { m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile)); m_Mobile.MoveToWorld(m_From.Location, m_From.Map); } break; } case 6: // Move to target { m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile)); m_From.Target = new MoveTarget(m_Mobile); break; } case 7: // Kill { if (m_From == m_Mobile || m_From.AccessLevel > m_Mobile.AccessLevel) { m_Mobile.Kill(); } m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile)); break; } case 8: // Res { if (m_From == m_Mobile || m_From.AccessLevel > m_Mobile.AccessLevel) { m_Mobile.PlaySound(0x214); m_Mobile.FixedEffect(0x376A, 10, 16); m_Mobile.Resurrect(); } m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile)); break; } case 9: // Client { m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile)); if (m_Mobile.NetState != null) { m_From.SendGump(new ClientGump(m_From, m_Mobile.NetState)); } break; } } }
protected override void OnTarget(Mobile from, object o) { IPoint3D p = o as IPoint3D; if (p != null) { if (!BaseCommand.IsAccessible(from, m_Object)) { from.SendLocalizedMessage(500447); // That is not accessible. return; } if (p is Item) { p = ((Item)p).GetWorldTop(); } CommandLogging.WriteLine(from, "{0} {1} moving {2} to {3}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(m_Object), new Point3D(p)); if (m_Object is Item) { Item item = (Item)m_Object; if (!item.Deleted) { from.SendMessage("Item moved."); item.MoveToWorld(new Point3D(p), from.Map); } else { from.SendLocalizedMessage(1154965); // Invalid item. } } else if (m_Object is Mobile) { Mobile m = (Mobile)m_Object; if (!m.Deleted) { from.SendMessage("Mobile moved."); m.MoveToWorld(new Point3D(p), from.Map); } else { from.SendMessage("Invalid Mobile."); } } } }
public override void Execute(CommandEventArgs e, object obj) { var mob = (Mobile)obj; var from = e.Mobile; if (m_Value) { if (!mob.Alive) { LogFailure("They are already dead."); } else if (!mob.CanBeDamaged()) { LogFailure("They cannot be harmed."); } else { CommandLogging.WriteLine( from, "{0} {1} killing {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(mob)); mob.Kill(); AddResponse("They have been killed."); } } else { if (mob.IsDeadBondedPet) { var bc = mob as BaseCreature; if (bc != null) { CommandLogging.WriteLine( from, "{0} {1} resurrecting {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(mob)); bc.PlaySound(0x214); bc.FixedEffect(0x376A, 10, 16); bc.ResurrectPet(); AddResponse("It has been resurrected."); } } else if (!mob.Alive) { CommandLogging.WriteLine( from, "{0} {1} resurrecting {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(mob)); mob.PlaySound(0x214); mob.FixedEffect(0x376A, 10, 16); mob.Resurrect(); AddResponse("They have been resurrected."); } else { LogFailure("They are not dead."); } } }
private static void AllSpells_OnTarget(Mobile from, object obj) { if (obj is Spellbook) { Spellbook book = (Spellbook)obj; if (book.BookCount == 64) { book.Content = ulong.MaxValue; } else { book.Content = (1ul << book.BookCount) - 1; } from.SendMessage("The spellbook has been filled."); CommandLogging.WriteLine( from, "{0} {1} filling spellbook {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(book)); } else { from.BeginTarget(-1, false, TargetFlags.None, AllSpells_OnTarget); from.SendMessage("That is not a spellbook. Try again."); } }
public override void Execute(CommandEventArgs e, object obj) { if (obj is Item) { CommandLogging.WriteLine(e.Mobile, "{0} {1} deleting {2}", e.Mobile.AccessLevel, CommandLogging.Format(e.Mobile), CommandLogging.Format(obj)); ((Item)obj).Delete(); AddResponse("The item has been deleted."); } else if (obj is Mobile && !((Mobile)obj).Player) { CommandLogging.WriteLine(e.Mobile, "{0} {1} deleting {2}", e.Mobile.AccessLevel, CommandLogging.Format(e.Mobile), CommandLogging.Format(obj)); ((Mobile)obj).Delete(); AddResponse("The mobile has been deleted."); } else { LogFailure("That cannot be deleted."); } }
public override void OnResponse(NetState sender, RelayInfo info) { Point2D toSet; bool shouldSet, shouldSend; switch (info.ButtonID) { case 1: // Current location { toSet = new Point2D(m_Mobile.Location); shouldSet = true; shouldSend = true; break; } case 2: // Pick location { m_Mobile.Target = new InternalTarget(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List); toSet = Point2D.Zero; shouldSet = false; shouldSend = false; break; } case 3: // Use values { TextRelay x = info.GetTextEntry(0); TextRelay y = info.GetTextEntry(1); toSet = new Point2D(x == null ? 0 : Utility.ToInt32(x.Text), y == null ? 0 : Utility.ToInt32(y.Text)); shouldSet = true; shouldSend = true; break; } default: { toSet = Point2D.Zero; shouldSet = false; shouldSend = true; break; } } if (shouldSet) { try { CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet.ToString()); m_Property.SetValue(m_Object, toSet, null); } catch { m_Mobile.SendMessage("An exception was caught. The property may not have changed."); } } if (shouldSend) { m_Mobile.SendGump(new XmlPropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page)); } }
public static void Freeze(Mobile from, Map targetMap, Point3D start3d, Point3D end3d) { Hashtable mapTable = new Hashtable(); if (start3d == NullP3D && end3d == NullP3D) { if (targetMap == null) { CommandLogging.WriteLine(from, "{0} {1} invoking freeze for every item in every map", from.AccessLevel, CommandLogging.Format(from)); } else { CommandLogging.WriteLine(from, "{0} {1} invoking freeze for every item in {0}", from.AccessLevel, CommandLogging.Format(from), targetMap); } foreach (Item item in World.Items.Values) { if (targetMap != null && item.Map != targetMap) { continue; } if (item.Parent != null) { continue; } if (item is Static || item is BaseFloor || item is BaseWall) { Map itemMap = item.Map; if (itemMap == null || itemMap == Map.Internal) { continue; } Hashtable table = (Hashtable)mapTable[itemMap]; if (table == null) { mapTable[itemMap] = table = new Hashtable(); } Point2D p = new Point2D(item.X >> 3, item.Y >> 3); DeltaState state = (DeltaState)table[p]; if (state == null) { table[p] = state = new DeltaState(p); } state.m_List.Add(item); } } } else if (targetMap != null) { Point2D start = targetMap.Bound(new Point2D(start3d)), end = targetMap.Bound(new Point2D(end3d)); CommandLogging.WriteLine(from, "{0} {1} invoking freeze from {2} to {3} in {4}", from.AccessLevel, CommandLogging.Format(from), start, end, targetMap); IPooledEnumerable eable = targetMap.GetItemsInBounds(new Rectangle2D(start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1)); foreach (Item item in eable) { if (item is Static || item is BaseFloor || item is BaseWall) { Map itemMap = item.Map; if (itemMap == null || itemMap == Map.Internal) { continue; } Hashtable table = (Hashtable)mapTable[itemMap]; if (table == null) { mapTable[itemMap] = table = new Hashtable(); } Point2D p = new Point2D(item.X >> 3, item.Y >> 3); DeltaState state = (DeltaState)table[p]; if (state == null) { table[p] = state = new DeltaState(p); } state.m_List.Add(item); } } eable.Free(); } if (mapTable.Count == 0) { from.SendGump(new NoticeGump(1060637, 30720, "No freezable items were found. Only the following item types are frozen:<br> - Static<br> - BaseFloor<br> - BaseWall", 0xFFC000, 320, 240, null, null)); return; } bool badDataFile = false; int totalFrozen = 0; foreach (DictionaryEntry de in mapTable) { Map map = (Map)de.Key; Hashtable table = (Hashtable)de.Value; TileMatrix matrix = map.Tiles; using (FileStream idxStream = OpenWrite(matrix.IndexStream)) { using (FileStream mulStream = OpenWrite(matrix.DataStream)) { if (idxStream == null || mulStream == null) { badDataFile = true; continue; } BinaryReader idxReader = new BinaryReader(idxStream); BinaryWriter idxWriter = new BinaryWriter(idxStream); BinaryWriter mulWriter = new BinaryWriter(mulStream); foreach (DeltaState state in table.Values) { int oldTileCount; StaticTile[] oldTiles = ReadStaticBlock(idxReader, mulStream, state.m_X, state.m_Y, matrix.BlockWidth, matrix.BlockHeight, out oldTileCount); if (oldTileCount < 0) { continue; } int newTileCount = 0; StaticTile[] newTiles = new StaticTile[state.m_List.Count]; for (int i = 0; i < state.m_List.Count; ++i) { Item item = state.m_List[i]; int xOffset = item.X - (state.m_X * 8); int yOffset = item.Y - (state.m_Y * 8); if (xOffset < 0 || xOffset >= 8 || yOffset < 0 || yOffset >= 8) { continue; } StaticTile newTile = new StaticTile((ushort)item.ItemID, (byte)xOffset, (byte)yOffset, (sbyte)item.Z, (short)item.Hue); newTiles[newTileCount++] = newTile; item.Delete(); ++totalFrozen; } int mulPos = -1; int length = -1; int extra = 0; if ((oldTileCount + newTileCount) > 0) { mulWriter.Seek(0, SeekOrigin.End); mulPos = (int)mulWriter.BaseStream.Position; length = (oldTileCount + newTileCount) * 7; extra = 1; for (int i = 0; i < oldTileCount; ++i) { StaticTile toWrite = oldTiles[i]; mulWriter.Write((ushort)toWrite.ID); mulWriter.Write((byte)toWrite.X); mulWriter.Write((byte)toWrite.Y); mulWriter.Write((sbyte)toWrite.Z); mulWriter.Write((short)toWrite.Hue); } for (int i = 0; i < newTileCount; ++i) { StaticTile toWrite = newTiles[i]; mulWriter.Write((ushort)toWrite.ID); mulWriter.Write((byte)toWrite.X); mulWriter.Write((byte)toWrite.Y); mulWriter.Write((sbyte)toWrite.Z); mulWriter.Write((short)toWrite.Hue); } mulWriter.Flush(); } int idxPos = ((state.m_X * matrix.BlockHeight) + state.m_Y) * 12; idxWriter.Seek(idxPos, SeekOrigin.Begin); idxWriter.Write(mulPos); idxWriter.Write(length); idxWriter.Write(extra); idxWriter.Flush(); matrix.SetStaticBlock(state.m_X, state.m_Y, null); } } } } if (totalFrozen == 0 && badDataFile) { from.SendGump(new NoticeGump(1060637, 30720, "Output data files could not be opened and the freeze operation has been aborted.<br><br>This probably means your server and client are using the same data files. Instructions on how to resolve this can be found in the first warning window.", 0xFFC000, 320, 240, null, null)); } else { from.SendGump(new NoticeGump(1060637, 30720, String.Format("Freeze operation completed successfully.<br><br>{0} item{1} frozen.<br><br>You must restart your client and update it's data files to see the changes.", totalFrozen, totalFrozen != 1 ? "s were" : " was"), 0xFFC000, 320, 240, null, null)); } }
public static void HWInfo_OnTarget(Mobile from, object obj) { if (obj is Mobile && ((Mobile)obj).Player) { Mobile m = (Mobile)obj; Account acct = m.Account as Account; string hwInfoTag = acct.GetTag(HardwareInfo.AccountTagName); if (hwInfoTag != null) { // check it against all other accounts: string[] hwInfoTags = hwInfoTag.Split('|'); foreach (string tag in hwInfoTags) { int tagNumber = -1; if (tag == String.Empty) { continue; } try { tagNumber = int.Parse(tag); } catch (Exception e) { Console.WriteLine("HWInfo error with tag " + tag + ": " + e.Message); Console.WriteLine(e.StackTrace); continue; } foreach (Account account in Accounts.GetAccounts()) { if (HasHWInfoInstance(account, tagNumber)) { from.SendMessage(account.Username + " " + tagNumber); } } } } if (acct != null) { HardwareInfo hwInfo = acct.HardwareInfo; if (hwInfo != null) { CommandLogging.WriteLine(from, "{0} {1} viewing hardware info of {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(m)); } if (hwInfo != null) { from.SendGump(new Gumps.PropertiesGump(from, hwInfo)); } else { from.SendMessage("No hardware information for that account was found."); } } else { from.SendMessage("No account has been attached to that player."); } } else { from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(HWInfo_OnTarget)); from.SendMessage("That is not a player. Try again."); } }
public void CompleteCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CustomCraft customCraft) { int badCraft = craftSystem.CanCraft(from, tool, m_Type); if (badCraft > 0) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, badCraft)); } else { from.SendLocalizedMessage(badCraft); } return; } int checkResHue = 0, checkMaxAmount = 0; object checkMessage = null; // Not enough resource to craft it if (!ConsumeRes(from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage)); } else if (checkMessage is int && (int)checkMessage > 0) { from.SendLocalizedMessage((int)checkMessage); } else if (checkMessage is string) { from.SendMessage((string)checkMessage); } return; } else if (!ConsumeAttributes(from, ref checkMessage, false)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage)); } else if (checkMessage is int && (int)checkMessage > 0) { from.SendLocalizedMessage((int)checkMessage); } else if (checkMessage is string) { from.SendMessage((string)checkMessage); } return; } bool toolBroken = false; int ignored = 1; int endquality = 1; bool allRequiredSkills = true; if (CheckSkills(from, typeRes, craftSystem, ref ignored, ref allRequiredSkills)) { // Resource int resHue = 0; int maxAmount = 0; object message = null; // Not enough resource to craft it if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, message)); } else if (message is int && (int)message > 0) { from.SendLocalizedMessage((int)message); } else if (message is string) { from.SendMessage((string)message); } return; } else if (!ConsumeAttributes(from, ref message, true)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, message)); } else if (message is int && (int)message > 0) { from.SendLocalizedMessage((int)message); } else if (message is string) { from.SendMessage((string)message); } return; } tool.UsesRemaining--; if (craftSystem is DefBlacksmithy) { AncientSmithyHammer hammer = from.FindItemOnLayer(Layer.OneHanded) as AncientSmithyHammer; if (hammer != null && hammer != tool) { hammer.UsesRemaining--; if (hammer.UsesRemaining < 1) { hammer.Delete(); } } } if (tool.UsesRemaining < 1) { toolBroken = true; } if (toolBroken) { tool.Delete(); } int num = 0; Item item; if (customCraft != null) { item = customCraft.CompleteCraft(out num); } else if (typeof(MapItem).IsAssignableFrom(ItemType) && from.Map != Map.Trammel && from.Map != Map.Felucca) { item = new IndecipherableMap(); from.SendLocalizedMessage(1070800); // The map you create becomes mysteriously indecipherable. } else { item = Activator.CreateInstance(ItemType) as Item; } if (item != null) { if (item is ICraftable) { endquality = ((ICraftable)item).OnCraft(quality, makersMark, from, craftSystem, typeRes, tool, this, resHue); } else if (item.Hue == 0) { item.Hue = resHue; } if (maxAmount > 0) { if (!item.Stackable && item is IUsesRemaining) { ((IUsesRemaining)item).UsesRemaining *= maxAmount; } else { item.Amount = maxAmount; } } from.AddToBackpack(item); if (from.AccessLevel > AccessLevel.Player) { CommandLogging.WriteLine(from, "Crafting {0} with craft system {1}", CommandLogging.Format(item), craftSystem.GetType().Name); } //from.PlaySound( 0x57 ); } if (num == 0) { num = craftSystem.PlayEndingEffect(from, false, true, toolBroken, endquality, makersMark, this); } bool queryFactionImbue = false; int availableSilver = 0; FactionItemDefinition def = null; Faction faction = null; if (item is IFactionItem) { def = FactionItemDefinition.Identify(item); if (def != null) { faction = Faction.Find(from); if (faction != null) { Town town = Town.FromRegion(from.Region); if (town != null && town.Owner == faction) { Container pack = from.Backpack; if (pack != null) { availableSilver = pack.GetAmount(typeof(Silver)); if (availableSilver >= def.SilverCost) { queryFactionImbue = Faction.IsNearType(from, def.VendorType, 12); } } } } } } // TODO: Scroll imbuing if (queryFactionImbue) { from.SendGump(new FactionImbueGump(quality, item, from, craftSystem, tool, num, availableSilver, faction, def)); } else if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, num)); } else if (num > 0) { from.SendLocalizedMessage(num); } } else if (!allRequiredSkills) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, 1044153)); } else { from.SendLocalizedMessage(1044153); // You don't have the required skills to attempt this item. } } else { ConsumeType consumeType = (UseAllRes ? ConsumeType.Half : ConsumeType.All); int resHue = 0; int maxAmount = 0; object message = null; // Not enough resource to craft it if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, true)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, message)); } else if (message is int && (int)message > 0) { from.SendLocalizedMessage((int)message); } else if (message is string) { from.SendMessage((string)message); } return; } tool.UsesRemaining--; if (tool.UsesRemaining < 1) { toolBroken = true; } if (toolBroken) { tool.Delete(); } // SkillCheck failed. int num = craftSystem.PlayEndingEffect(from, true, true, toolBroken, endquality, false, this); if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, num)); } else if (num > 0) { from.SendLocalizedMessage(num); } } }
public static void Unfreeze(Mobile from, Map map, Point3D start, Point3D end) { int totalUnfrozen = 0; bool badDataFile = false; if (map == null) { CommandLogging.WriteLine(from, "{0} {1} invoking unfreeze for every item in every map", from.AccessLevel, CommandLogging.Format(from)); DoUnfreeze(Map.Felucca, ref badDataFile, ref totalUnfrozen); DoUnfreeze(Map.Trammel, ref badDataFile, ref totalUnfrozen); DoUnfreeze(Map.Ilshenar, ref badDataFile, ref totalUnfrozen); DoUnfreeze(Map.Malas, ref badDataFile, ref totalUnfrozen); DoUnfreeze(Map.Tokuno, ref badDataFile, ref totalUnfrozen); } else if (start == NullP3D && end == NullP3D) { CommandLogging.WriteLine(from, "{0} {1} invoking unfreeze for every item in {2}", from.AccessLevel, CommandLogging.Format(from), map); DoUnfreeze(map, ref badDataFile, ref totalUnfrozen); } else { CommandLogging.WriteLine(from, "{0} {1} invoking unfreeze from {2} to {3} in {4}", from.AccessLevel, CommandLogging.Format(from), new Point2D(start), new Point2D(end), map); DoUnfreeze(map, new Point2D(start), new Point2D(end), ref badDataFile, ref totalUnfrozen); } if (totalUnfrozen == 0 && badDataFile) { from.SendGump(new NoticeGump(1060637, 30720, "Output data files could not be opened and the unfreeze operation has been aborted.<br><br>This probably means your server and client are using the same data files. Instructions on how to resolve this can be found in the first warning window.", 0xFFC000, 320, 240, null, null)); } else { from.SendGump(new NoticeGump(1060637, 30720, String.Format("Unfreeze operation completed successfully.<br><br>{0} item{1} unfrozen.<br><br>You must restart your client and update it's data files to see the changes.", totalUnfrozen, totalUnfrozen != 1 ? "s were" : " was"), 0xFFC000, 320, 240, null, null)); } }
public override void OnResponse(NetState sender, RelayInfo info) { object toSet; bool shouldSet, shouldSend = true; object viewProps = null; switch (info.ButtonID) { case 0: // closed { m_Mobile.SendGump(new XmlPropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page)); toSet = null; shouldSet = false; shouldSend = false; break; } case 1: // Change by Target { m_Mobile.Target = new XmlSetObjectTarget(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List); toSet = null; shouldSet = false; shouldSend = false; break; } case 2: // Change by Serial { toSet = null; shouldSet = false; shouldSend = false; m_Mobile.SendMessage("Enter the serial you wish to find:"); m_Mobile.Prompt = new InternalPrompt(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List); break; } case 3: // Nullify { toSet = null; shouldSet = true; break; } case 4: // View Properties { toSet = null; shouldSet = false; object obj = m_Property.GetValue(m_Object, null); if (obj == null) { m_Mobile.SendMessage("The property is null and so you cannot view its properties."); } else if (!BaseCommand.IsAccessible(m_Mobile, obj)) { m_Mobile.SendMessage("You may not view their properties."); } else { viewProps = obj; } break; } default: { toSet = null; shouldSet = false; break; } } if (shouldSet) { try { CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, m_Property.GetValue(m_Object, null).ToString(), toSet == null ? "(null)" : toSet.ToString()); m_Property.SetValue(m_Object, toSet, null); } catch { m_Mobile.SendMessage("An exception was caught. The property may not have changed."); } } if (shouldSend) { m_Mobile.SendGump(new XmlSetObjectGump(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List)); } if (viewProps != null) { m_Mobile.SendGump(new XmlPropertiesGump(m_Mobile, viewProps)); } }
public override void OnResponse(NetState sender, RelayInfo info) { TimeSpan toSet; bool shouldSet, shouldSend; TextRelay h = info.GetTextEntry(0); TextRelay m = info.GetTextEntry(1); TextRelay s = info.GetTextEntry(2); switch (info.ButtonID) { case 1: // Zero { toSet = TimeSpan.Zero; shouldSet = true; shouldSend = true; break; } case 2: // From H:M:S { bool successfulParse = false; if (h != null && m != null && s != null) { successfulParse = TimeSpan.TryParse(h.Text + ":" + m.Text + ":" + s.Text, out toSet); } else { toSet = TimeSpan.Zero; } shouldSet = shouldSend = successfulParse; break; } case 3: // From H { if (h != null) { try { toSet = TimeSpan.FromHours(Utility.ToDouble(h.Text)); shouldSet = true; shouldSend = true; break; } catch { } } toSet = TimeSpan.Zero; shouldSet = false; shouldSend = false; break; } case 4: // From M { if (m != null) { try { toSet = TimeSpan.FromMinutes(Utility.ToDouble(m.Text)); shouldSet = true; shouldSend = true; break; } catch { } } toSet = TimeSpan.Zero; shouldSet = false; shouldSend = false; break; } case 5: // From S { if (s != null) { try { toSet = TimeSpan.FromSeconds(Utility.ToDouble(s.Text)); shouldSet = true; shouldSend = true; break; } catch { } } toSet = TimeSpan.Zero; shouldSet = false; shouldSend = false; break; } default: { toSet = TimeSpan.Zero; shouldSet = false; shouldSend = true; break; } } if (shouldSet) { try { CommandLogging.LogChangeProperty(this.m_Mobile, this.m_Object, this.m_Property.Name, toSet.ToString()); this.m_Property.SetValue(this.m_Object, toSet, null); PropertiesGump.OnValueChanged(this.m_Object, this.m_Property, this.m_Stack); } catch { this.m_Mobile.SendMessage("An exception was caught. The property may not have changed."); } } if (shouldSend) { this.m_Mobile.SendGump(new PropertiesGump(this.m_Mobile, this.m_Object, this.m_Stack, this.m_List, this.m_Page)); } }
public void CompleteCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CustomCraft customCraft) { int badCraft = craftSystem.CanCraft(from, tool, m_Type); if (badCraft > 0) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, badCraft)); } else { from.SendLocalizedMessage(badCraft); } return; } int checkResHue = 0, checkMaxAmount = 0; object checkMessage = null; // Not enough resource to craft it if (!ConsumeRes(from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage)); } else if (checkMessage is int && (int)checkMessage > 0) { from.SendLocalizedMessage((int)checkMessage); } else if (checkMessage is string) { from.SendMessage((string)checkMessage); } return; } else if (!ConsumeAttributes(from, ref checkMessage, false)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage)); } else if (checkMessage is int && (int)checkMessage > 0) { from.SendLocalizedMessage((int)checkMessage); } else if (checkMessage is string) { from.SendMessage((string)checkMessage); } return; } bool toolBroken = false; int ignored = 1; int endquality = 1; bool allRequiredSkills = true; if (CheckSkills(from, typeRes, craftSystem, ref ignored, ref allRequiredSkills)) { // Resource int resHue = 0; int maxAmount = 0; object message = null; // Not enough resource to craft it if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, message)); } else if (message is int && (int)message > 0) { from.SendLocalizedMessage((int)message); } else if (message is string) { from.SendMessage((string)message); } return; } else if (!ConsumeAttributes(from, ref message, true)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, message)); } else if (message is int && (int)message > 0) { from.SendLocalizedMessage((int)message); } else if (message is string) { from.SendMessage((string)message); } return; } tool.UsesRemaining--; if (craftSystem is DefBlacksmithy) { AncientSmithyHammer hammer = from.FindItemOnLayer(Layer.OneHanded) as AncientSmithyHammer; if (hammer != null && hammer != tool) { hammer.UsesRemaining--; if (hammer.UsesRemaining < 1) { hammer.Delete(); } } } if (tool.UsesRemaining < 1) { toolBroken = true; } if (toolBroken) { tool.Delete(); } int num = 0; Item item; if (customCraft != null) { item = customCraft.CompleteCraft(out num); } else if (typeof(MapItem).IsAssignableFrom(ItemType) && from.Map != Map.Trammel && from.Map != Map.Felucca) { item = new IndecipherableMap(); from.SendLocalizedMessage(1070800); // The map you create becomes mysteriously indecipherable. } else { item = Activator.CreateInstance(ItemType) as Item; } if (item != null) { if (item is ICraftable) { endquality = ((ICraftable)item).OnCraft(quality, makersMark, from, craftSystem, typeRes, tool, this, resHue); //TEST: CHECK THIS if (craftSystem is DefCarpentry) { item.Hue = resHue; } } else if (item.Hue == 0 && resHue != 0) { item.Hue = resHue; } if (maxAmount > 0) { if (!item.Stackable && item is IUsesRemaining) { ((IUsesRemaining)item).UsesRemaining *= maxAmount; } else { item.Amount = maxAmount; } } item.CraftedBy = from; item.CrafterName = from.RawName; item.ItemGroup = ItemGroupType.Crafted; if (m_Count > 1) { if (item.Stackable) { item.Amount = m_Count; from.AddToBackpack(item); } else { for (int a = 0; a < m_Count; a++) { Item duplicate = Dupe.DupeItem(item); if (duplicate != null) { from.AddToBackpack(duplicate); } } } } else { from.AddToBackpack(item); } if (from.AccessLevel > AccessLevel.Player) { CommandLogging.WriteLine(from, "Crafting {0} with craft system {1}", CommandLogging.Format(item), craftSystem.GetType().Name); } } if (num == 0) { num = craftSystem.PlayEndingEffect(from, false, true, toolBroken, endquality, makersMark, this); } bool queryFactionImbue = false; int availableSilver = 0; if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, num)); } else if (num > 0) { from.SendLocalizedMessage(num); } } else if (!allRequiredSkills) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, 1044153)); } else { from.SendLocalizedMessage(1044153); // You don't have the required skills to attempt this item. } } else { ConsumeType consumeType = (UseAllRes ? ConsumeType.Half : ConsumeType.All); int resHue = 0; int maxAmount = 0; object message = null; // Not enough resource to craft it if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, true)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, message)); } else if (message is int && (int)message > 0) { from.SendLocalizedMessage((int)message); } else if (message is string) { from.SendMessage((string)message); } return; } tool.UsesRemaining--; if (tool.UsesRemaining < 1) { toolBroken = true; } if (toolBroken) { tool.Delete(); } int num = craftSystem.PlayEndingEffect(from, true, true, toolBroken, endquality, false, this); if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, num)); } else if (num > 0) { from.SendLocalizedMessage(num); } } }
public override void Execute(CommandEventArgs e, object obj) { Mobile from = e.Mobile; Mobile mob = (Mobile)obj; CommandLogging.WriteLine(from, "{0} {1} dismounting {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(mob)); bool takenAction = false; for (int i = 0; i < mob.Items.Count; ++i) { Item item = mob.Items[i]; if (item is IMountItem) { IMount mount = ((IMountItem)item).Mount; if (mount != null) { mount.Rider = null; takenAction = true; } if (mob.Items.IndexOf(item) == -1) { --i; } } } for (int i = 0; i < mob.Items.Count; ++i) { Item item = mob.Items[i]; if (item.Layer == Layer.Mount) { takenAction = true; item.Delete(); --i; } } if (takenAction) { AddResponse("They have been dismounted."); } else { LogFailure("They were not mounted."); } }
public override void Execute(CommandEventArgs e, object obj) { Mobile mob = (Mobile)obj; Mobile from = e.Mobile; CommandLogging.WriteLine(from, "{0} {1} telling {2} \"{3}\"", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(mob), e.ArgString); mob.SendAsciiMessage(from.SpeechHue, String.Format("{0} says to you: {1}", from.Name, e.ArgString)); }
public override void Execute(CommandEventArgs e, object obj) { if (obj is BaseVendor) { CommandLogging.WriteLine(e.Mobile, "{0} {1} restocking {2}", e.Mobile.AccessLevel, CommandLogging.Format(e.Mobile), CommandLogging.Format(obj)); ((BaseVendor)obj).Restock(); AddResponse("The vendor has been restocked."); } else { AddResponse("That is not a vendor."); } }
public override void Execute(CommandEventArgs e, object obj) { Mobile m = (Mobile)obj; CommandLogging.WriteLine(e.Mobile, "{0} {1} {2} {3}", e.Mobile.AccessLevel, CommandLogging.Format(e.Mobile), m_Value ? "hiding" : "unhiding", CommandLogging.Format(m)); Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y, m.Z + 4), m.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y, m.Z), m.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y, m.Z - 4), m.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(m.X, m.Y + 1, m.Z + 4), m.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(m.X, m.Y + 1, m.Z), m.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(m.X, m.Y + 1, m.Z - 4), m.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y + 1, m.Z + 11), m.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y + 1, m.Z + 7), m.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y + 1, m.Z + 3), m.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y + 1, m.Z - 1), m.Map, 0x3728, 13); m.PlaySound(0x228); m.Hidden = m_Value; if (m_Value) { AddResponse("They have been hidden."); } else { AddResponse("They have been revealed."); } }
public static void HWInfo_OnTarget(Mobile from, object obj) { if (obj is Mobile && ((Mobile)obj).Player) { Mobile m = (Mobile)obj; Account acct = m.Account as Account; if (acct != null) { HardwareInfo hwInfo = acct.HardwareInfo; if (hwInfo != null) { CommandLogging.WriteLine(from, "{0} {1} viewing hardware info of {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(m)); } if (hwInfo != null) { from.SendGump(new Gumps.PropertiesGump(from, hwInfo)); } else { from.SendMessage("No hardware information for that account was found."); } } else { from.SendMessage("No account has been attached to that player."); } } else { from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(HWInfo_OnTarget)); from.SendMessage("That is not a player. Try again."); } }
public override void Execute(CommandEventArgs e, object obj) { Mobile from = e.Mobile; Mobile targ = (Mobile)obj; NetState state = targ.NetState; if (state != null) { CommandLogging.WriteLine(from, "{0} {1} firewalling {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targ)); try { Firewall.Add(state.Address); AddResponse("They have been firewalled."); } catch (Exception ex) { LogFailure(ex.Message); } } else { LogFailure("They are not online."); } }
public override void Execute(CommandEventArgs e, object obj) { Mobile from = e.Mobile; PlayerMobile pm = obj as PlayerMobile; if (pm == null) { LogFailure("That is not a player."); return; } CommandLogging.WriteLine(from, "{0} {1} viewing quest overview of {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(pm)); from.SendGump(new QuestLogGump(pm, false)); }
public override void Execute(CommandEventArgs e, object obj) { Mobile from = e.Mobile; Mobile targ = (Mobile)obj; if (from.AccessLevel > targ.AccessLevel) { NetState fromState = from.NetState, targState = targ.NetState; if (fromState != null && targState != null) { Account fromAccount = fromState.Account as Account; Account targAccount = targState.Account as Account; if (fromAccount != null && targAccount != null) { CommandLogging.WriteLine(from, "{0} {1} {2} {3}", from.AccessLevel, CommandLogging.Format(from), m_Ban ? "banning" : "kicking", CommandLogging.Format(targ)); targ.Say("I've been {0}!", m_Ban ? "banned" : "kicked"); AddResponse(String.Format("They have been {0}.", m_Ban ? "banned" : "kicked")); targState.Dispose(); if (m_Ban) { targAccount.Banned = true; targAccount.SetUnspecifiedBan(from); from.SendGump(new BanDurationGump(targAccount)); } } } else if (targState == null) { LogFailure("They are not online."); } } else { LogFailure("You do not have the required access level to do this."); } }
public override void OnResponse(NetState state, RelayInfo info) { if (m_State == null) { return; } Mobile focus = m_State.Mobile; Mobile from = state.Mobile; if (focus == null) { from.SendMessage("That character is no longer online."); return; } else if (focus.Deleted) { from.SendMessage("That character no longer exists."); return; } else if (from != focus && focus.Hidden && from.AccessLevel < focus.AccessLevel && (!(focus is PlayerMobile) || !((PlayerMobile)focus).VisibilityList.Contains(from))) { from.SendMessage("That character is no longer visible."); return; } switch (info.ButtonID) { case 1: // Tell { TextRelay text = info.GetTextEntry(0); if (text != null) { focus.SendMessage(0x482, "{0} tells you:", from.Name); focus.SendMessage(0x482, text.Text); CommandLogging.WriteLine(from, "{0} {1} telling {2} \"{3}\" ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), text.Text); } from.SendGump(new ClientGump(from, m_State)); break; } case 4: // Props { Resend(from, info); if (!BaseCommand.IsAccessible(from, focus)) { from.SendMessage("That is not accessible."); } else { from.SendGump(new PropertiesGump(from, focus)); CommandLogging.WriteLine(from, "{0} {1} opening properties gump of {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus)); } break; } case 5: // Go to { if (focus.Map == null || focus.Map == Map.Internal) { from.SendMessage("That character is not in the world."); } else { from.MoveToWorld(focus.Location, focus.Map); Resend(from, info); CommandLogging.WriteLine(from, "{0} {1} going to {2}, Location {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), focus.Location, focus.Map); } break; } case 6: // Get { if (from.Map == null || from.Map == Map.Internal) { from.SendMessage("You cannot bring that person here."); } else { focus.MoveToWorld(from.Location, from.Map); Resend(from, info); CommandLogging.WriteLine(from, "{0} {1} bringing {2} to Location {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), from.Location, from.Map); } break; } case 7: // Move { from.Target = new MoveTarget(focus); Resend(from, info); break; } case 8: // Kick { if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel) { focus.Say("I've been kicked!"); m_State.Dispose(); CommandLogging.WriteLine(from, "{0} {1} kicking {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus)); } break; } case 9: // Kill { if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel) { focus.Kill(); CommandLogging.WriteLine(from, "{0} {1} killing {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus)); } Resend(from, info); break; } case 10: //Res { if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel) { focus.PlaySound(0x214); focus.FixedEffect(0x376A, 10, 16); focus.Resurrect(); CommandLogging.WriteLine(from, "{0} {1} resurrecting {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus)); } Resend(from, info); break; } case 11: // Skills { Resend(from, info); if (from.AccessLevel > focus.AccessLevel) { from.SendGump(new SkillsGump(from, focus)); CommandLogging.WriteLine(from, "{0} {1} Opening Skills gump of {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus)); } break; } } }
public void Execute(CommandEventArgs e, object obj, bool echo) { if (e.Length == 1) { Mobile mob = (Mobile)obj; Mobile from = e.Mobile; if (mob.Player) { NetState ns = mob.NetState; if (ns == null) { LogFailure("That player is not online."); } else { string url = e.GetString(0); CommandLogging.WriteLine(from, "{0} {1} requesting to open web browser of {2} to {3}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(mob), url); if (echo) { AddResponse("Awaiting user confirmation..."); } else { AddResponse("Open web browser request sent."); } mob.SendGump(new WarningGump(1060637, 30720, String.Format("A game master is requesting to open your web browser to the following URL:<br>{0}", url), 0xFFC000, 320, 240, new WarningGumpCallback(OpenBrowser_Callback), new object[] { from, url, echo })); } } else { LogFailure("That is not a player."); } } else { LogFailure("Format: OpenBrowser <url>"); } }
public override void OnResponse(NetState sender, RelayInfo info) { if (m_Item.Deleted) { m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Item)); return; } else if (!BaseCommand.IsAccessible(m_From, m_Item)) { m_From.SendMessage("That is no longer accessible."); m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Item)); return; } switch (info.ButtonID) { case 0: case 1: { m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Item)); break; } case 2: // Properties { m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item)); m_From.SendGump(new PropertiesGump(m_From, m_Item)); break; } case 3: // Delete { CommandLogging.WriteLine(m_From, "{0} {1} deleting {2}", m_From.AccessLevel, CommandLogging.Format(m_From), CommandLogging.Format(m_Item)); m_Item.Delete(); m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Item)); break; } case 4: // Go there { m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item)); InvokeCommand(String.Format("Go {0}", m_Item.Serial.Value)); break; } case 5: // Move to target { m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item)); m_From.Target = new MoveTarget(m_Item); break; } case 6: // Bring to pack { Mobile owner = m_Item.RootParent as Mobile; if (owner != null && (owner.Map != null && owner.Map != Map.Internal) && !BaseCommand.IsAccessible(m_From, owner) /* !m_From.CanSee( owner )*/) { m_From.SendMessage("You can not get what you can not see."); } else if (owner != null && (owner.Map == null || owner.Map == Map.Internal) && owner.Hidden && owner.AccessLevel >= m_From.AccessLevel) { m_From.SendMessage("You can not get what you can not see."); } else { m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item)); m_From.AddToBackpack(m_Item); } break; } } }
public override void Execute(CommandEventArgs e, object obj) { Mobile from = e.Mobile; if (e.Length == 1) { int index = e.GetInt32(0); Mobile mob = (Mobile)obj; CommandLogging.WriteLine(from, "{0} {1} playing sound {2} for {3}", from.AccessLevel, CommandLogging.Format(from), index, CommandLogging.Format(mob)); mob.Send(new PlaySound(index, mob.Location)); } else { from.SendMessage("Format: PrivSound <index>"); } }
public void CompleteBuild(int quality, bool makersMark, Mobile from, BuildSystem buildSystem, Type typeRes, BaseBuildingTool tool, CustomBuild customBuild) { int badBuild = buildSystem.CanBuild(from, tool, m_Type); if (badBuild > 0) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new BuildGump(from, buildSystem, tool, badBuild)); } else { from.SendLocalizedMessage(badBuild); } return; } int checkResHue = 0, checkMaxAmount = 0; object checkMessage = null; // Not enough resource to build it if (!ConsumeRes(from, typeRes, buildSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new BuildGump(from, buildSystem, tool, checkMessage)); } else if (checkMessage is int && (int)checkMessage > 0) { from.SendLocalizedMessage((int)checkMessage); } else if (checkMessage is string) { from.SendMessage((string)checkMessage); } return; } else if (!ConsumeAttributes(from, ref checkMessage, false)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new BuildGump(from, buildSystem, tool, checkMessage)); } else if (checkMessage is int && (int)checkMessage > 0) { from.SendLocalizedMessage((int)checkMessage); } else if (checkMessage is string) { from.SendMessage((string)checkMessage); } return; } bool toolBroken = false; int ignored = 1; int endquality = 1; bool allRequiredLokaiSkills = true; if (CheckLokaiSkills(from, typeRes, buildSystem, ref ignored, ref allRequiredLokaiSkills)) { // Resource int resHue = 0; int maxAmount = 0; object message = null; // Not enough resource to build it if (!ConsumeRes(from, typeRes, buildSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new BuildGump(from, buildSystem, tool, message)); } else if (message is int && (int)message > 0) { from.SendLocalizedMessage((int)message); } else if (message is string) { from.SendMessage((string)message); } return; } else if (!ConsumeAttributes(from, ref message, true)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new BuildGump(from, buildSystem, tool, message)); } else if (message is int && (int)message > 0) { from.SendLocalizedMessage((int)message); } else if (message is string) { from.SendMessage((string)message); } return; } tool.UsesRemaining--; if (tool.UsesRemaining < 1) { toolBroken = true; } if (toolBroken) { tool.Delete(); } int num = 0; Item item; if (customBuild != null) { item = customBuild.CompleteBuild(out num); } else if (typeof(MapItem).IsAssignableFrom(ItemType) && from.Map != Map.Trammel && from.Map != Map.Felucca) { item = new IndecipherableMap(); from.SendLocalizedMessage(1070800); // The map you create becomes mysteriously indecipherable. } else { if (m_Arg != null) { item = Activator.CreateInstance(ItemType, new object[] { m_Arg }) as Item; } else { item = Activator.CreateInstance(ItemType) as Item; } } if (item != null) { if (item is IBuildable) { endquality = ((IBuildable)item).OnBuild(quality, makersMark, from, buildSystem, typeRes, tool, this, resHue); } else if (item.Hue == 0) { item.Hue = resHue; } if (maxAmount > 0) { item.Amount = maxAmount; } from.AddToBackpack(item); if (from.AccessLevel > AccessLevel.Player) { CommandLogging.WriteLine(from, "Building {0} with build system {1}", CommandLogging.Format(item), buildSystem.GetType().Name); } //from.PlaySound( 0x57 ); } if (num == 0) { num = buildSystem.PlayEndingEffect(from, false, true, toolBroken, endquality, makersMark, this); } if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new BuildGump(from, buildSystem, tool, num)); } else if (num > 0) { from.SendLocalizedMessage(num); } } else if (!allRequiredLokaiSkills) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new BuildGump(from, buildSystem, tool, 1044153)); } else { from.SendLocalizedMessage(1044153); // You don't have the required lokaiSkills to attempt this item. } } else { ConsumeType consumeType = (UseAllRes ? ConsumeType.Half : ConsumeType.All); int resHue = 0; int maxAmount = 0; object message = null; // Not enough resource to build it if (!ConsumeRes(from, typeRes, buildSystem, ref resHue, ref maxAmount, consumeType, ref message, true)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new BuildGump(from, buildSystem, tool, message)); } else if (message is int && (int)message > 0) { from.SendLocalizedMessage((int)message); } else if (message is string) { from.SendMessage((string)message); } return; } tool.UsesRemaining--; if (tool.UsesRemaining < 1) { toolBroken = true; } if (toolBroken) { tool.Delete(); } // LokaiSkillCheck failed. int num = buildSystem.PlayEndingEffect(from, true, true, toolBroken, endquality, false, this); if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new BuildGump(from, buildSystem, tool, num)); } else if (num > 0) { from.SendLocalizedMessage(num); } } }
public override void Execute(CommandEventArgs e, object obj) { Mobile mob = (Mobile)obj; Mobile from = e.Mobile; CommandLogging.WriteLine(from, "{0} {1} {2} {3} \"{4}\"", from.AccessLevel, CommandLogging.Format(from), m_InGump ? "messaging" : "telling", CommandLogging.Format(mob), e.ArgString); if (m_InGump) { mob.SendGump(new MessageSentGump(mob, from.Name, e.ArgString)); } else { mob.SendMessage(e.ArgString); } }
protected override void OnTarget(Mobile from, object targeted) { PlayerMobile pm = targeted as PlayerMobile; if (pm == null) { from.SendMessage("Speech logs aren't supported on that target."); } else if (from != targeted && from.AccessLevel <= pm.AccessLevel && from.AccessLevel != AccessLevel.Owner) { from.SendMessage("You don't have the required access level to view {0} speech log.", pm.Female ? "her" : "his"); } else if (pm.SpeechLog == null) { from.SendMessage("{0} has no speech log.", pm.Female ? "She" : "He"); } else { CommandLogging.WriteLine(from, "{0} {1} viewing speech log of {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targeted)); Gump gump = new SpeechLogGump(pm, pm.SpeechLog); from.SendGump(gump); } }
public override void OnResponse(NetState sender, RelayInfo info) { int index = info.ButtonID - 1; if (index == -1) { m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page)); } else if (index >= 0 && index < 4) { if (m_Monster == null) { LoadLists(); } ModelBodyType type; ArrayList list; switch (index) { default: case 0: type = ModelBodyType.Monsters; list = m_Monster; break; case 1: type = ModelBodyType.Animals; list = m_Animal; break; case 2: type = ModelBodyType.Sea; list = m_Sea; break; case 3: type = ModelBodyType.Human; list = m_Human; break; } m_Mobile.SendGump(new SetBodyGump(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List, 0, list, type)); } else if (m_OurList != null) { index -= 4; if (index == 0 && m_OurPage > 0) { m_Mobile.SendGump(new SetBodyGump(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List, m_OurPage - 1, m_OurList, m_OurType)); } else if (index == 1 && ((m_OurPage + 1) * 12) < m_OurList.Count) { m_Mobile.SendGump(new SetBodyGump(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List, m_OurPage + 1, m_OurList, m_OurType)); } else { index -= 2; if (index >= 0 && index < m_OurList.Count) { try { InternalEntry entry = (InternalEntry)m_OurList[index]; CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, entry.Body.ToString()); m_Property.SetValue(m_Object, entry.Body, null); PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack); } catch { m_Mobile.SendMessage("An exception was caught. The property may not have changed."); } m_Mobile.SendGump(new SetBodyGump(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List, m_OurPage, m_OurList, m_OurType)); } } } }