private void addTarget(bool location, Serial serial, Point3D p, ushort gfxid) { Mobile mobile = World.FindMobile(serial); if (mobile != null && !string.IsNullOrEmpty(mobile.Name)) { CorpseItem corpse = new CorpseItem(mobile.Body, mobile.Name); if (items.Find(c => c.ItemID == corpse.ItemID) == null) { items.Add(corpse); listBox.Items.Add(corpse); XElement parent = ConfigEx.GetXElement(true, "Carving"); parent.RemoveAll(); parent.SetAttributeValue("enabled", enabled); foreach (CorpseItem item in items) { parent.Add(new XElement("Corpse", new XAttribute("itemID", item.ItemID.Value.ToString("X4")), item.Name)); } } } else { WorldEx.SendMessage("Invalid target"); } }
private static void OnCompressedGump(PacketReader p, PacketHandlerEventArgs e) { p.Seek(7, SeekOrigin.Begin); if (p.ReadUInt32() != 0x776CCCC1) { return; } p.Seek(19, SeekOrigin.Begin); p.Seek(p.ReadInt32(), SeekOrigin.Current); int lines = p.ReadInt32(), cLen = p.ReadInt32(), dLen = p.ReadInt32(); byte[] buffer = new byte[dLen]; ZLib.uncompress(buffer, ref dLen, p.CopyBytes(p.Position, cLen - 4), cLen - 4); for (int i = 0, pos = 0; i < lines; i++) { int strLen = (buffer[pos++] << 8) | buffer[pos++]; string str = Encoding.BigEndianUnicode.GetString(buffer, pos, strLen * 2); if (str.Trim() == "a sea horse") { WorldEx.SendMessage("Sea Horse!!! " + World.Player.Position); } pos += strLen * 2; } }
private static void OnCommand(string[] args) { bool enabled = !ConfigEx.GetElement(false, "BlockFriendlyFire"); ConfigEx.SetElement(enabled, "BlockFriendlyFire"); WorldEx.SendMessage("Friendly fire " + (enabled ? "blocked." : "allowed.")); OnChange(enabled); }
private static void OnCommand(string[] args) { bool enabled = !ConfigEx.GetElement(false, "AutoGrab"); ConfigEx.SetElement(enabled, "AutoGrab"); WorldEx.SendMessage("Autograb " + (enabled ? "enabled." : "disabled.")); OnChange(enabled); }
private static void UseKey() { lock (list) { Item item = World.Player.Backpack.FindItem(i => IsKey(i) && !IsLockpick(i) && !list.Contains(i.Serial)); if (item == null && list.Count > 0) { list.Clear(); item = World.Player.Backpack.FindItem(i => IsKey(i) && !IsLockpick(i) && !list.Contains(i.Serial)); } if (item == null) { item = World.Player.Backpack.FindItem(i => IsKey(i) && !list.Contains(i.Serial)); } if (item != null) { door = WorldEx.FindItem(i => i.IsDoor && i.DistanceTo(World.Player) <= 1); if (door != null) { timer.Start(); } else { Item item2 = WorldEx.FindItemsG(i => IsSwitch(i) && i.DistanceTo(World.Player) < 3) .OrderBy(i => Utility.DistanceSqrt(i.Position, World.Player.Position)) .FirstOrDefault(); if (item2 != null) { item = item2; } } if (!IsSwitch(item)) { list.Add(item.Serial); list.RemoveAll(i => !World.Items.ContainsKey(i)); } WorldEx.SendToServer(new DoubleClick(item.Serial)); } else { item = WorldEx.FindItemsG(i => IsSwitch(i) && i.DistanceTo(World.Player) < 3) .OrderBy(i => Utility.DistanceSqrt(i.Position, World.Player.Position)) .FirstOrDefault(); if (item != null) { WorldEx.SendToServer(new DoubleClick(item.Serial)); } else { WorldEx.SendMessage("No key found."); } } } }
private static void OnGet(string[] args) { bool felucca; int count; try { felucca = Convert.ToBoolean(byte.Parse(args[0])); count = byte.Parse(args[1]); } catch { return; } Serial closest = Serial.Zero; foreach (KeyValuePair <Serial, SOSInfo> sos in list) { if (sos.Value.Felucca == felucca && (!list.ContainsKey(closest) || sos.Value.Distance() < list[closest].Distance())) { closest = sos.Key; } } if (!list.ContainsKey(closest)) { return; } List <Serial> chosen = new List <Serial> { closest }; List <Serial> toAdd = GetInRange(list[closest].Location, felucca).Where(s => !chosen.Contains(s)).ToList(); while (toAdd.Count > 0) { chosen.AddRange(toAdd); toAdd.Clear(); foreach (Serial serial in chosen) { toAdd.AddRange(GetInRange(list[serial].Location, felucca).Where(s => !chosen.Contains(s) && !toAdd.Contains(s))); } } while (chosen.Count > count) { Serial farest = Serial.Zero; foreach (Serial serial in chosen) { if (!list.ContainsKey(farest) || list[closest].Distance(list[farest].Location) < list[serial].Distance(list[farest].Location)) { farest = serial; } } chosen.Remove(farest); } chosen.ForEach(s => DragDrop.Move(World.FindItem(s), Fixes.LootBag.Bag)); WorldEx.SendMessage(chosen.Count + " SOS messages found."); }
private static void OnCommand(string[] args) { try { new SpellIcon(int.Parse(args[0]) == 100 ? new Spell((char)Spell.SpellFlag.None, int.Parse(args[1]), 100, null, null) : Spell.Get(int.Parse(args[0]), int.Parse(args[1]))).ShowUnlocked(); } catch (Exception) { WorldEx.SendMessage("Invalid spell!"); } }
private static void OnAttack(PacketReader p, PacketHandlerEventArgs args) { Mobile mobile = World.FindMobile(p.ReadUInt32()); if (mobile != null && (FriendsAgent.IsFriend(mobile) || mobile.Notoriety == 1 || mobile.Notoriety == 2 || mobile.Renamable)) { WorldEx.SendMessage("Attack blocked."); args.Block = true; } }
private static void OnCommand() { if (responseID != 0) { ClientCommunication.SendToClient(new CloseGump(gumpID)); WorldEx.SendToServer(new GumpResponse(responseID, gumpID, 2, new int[0], new GumpTextEntry[0])); } else { WorldEx.SendMessage("You are not wielding the Spectral Scimitar!"); } }
private static void MapPlot(PacketReader p, PacketHandlerEventArgs args) { p.ReadUInt32(); if (p.ReadByte() == 1 && p.ReadByte() == 0) { x += (ushort)(p.ReadUInt16() * 2); y += (ushort)(p.ReadUInt16() * 2); Point2D map = new Point2D(x, y); Point2D closest = positions.Aggregate((min, next) => Utility.Distance(map, min) < Utility.Distance(map, next) ? min : next); WorldEx.SendMessage(string.Format("Map opened to {0}, {1}. ({2})", x, y, positions.IndexOf(closest) + 1)); WorldEx.SendToClient(new QuestArrow(true, x, y)); } }
private static void Bank(string[] args) { Item item = World.Player.Backpack.FindItem(0x1F1C, 0x0489) ?? WorldEx.FindItemG(0x1F1C, 0x0489, i => i.DistanceTo(World.Player) < 5); if (item != null) { WorldEx.SendToServer(new DoubleClick(item.Serial)); } else { WorldEx.SendMessage("No bank crystal found."); } }
private static void FireBlast(string[] args) { Item spellBook = World.Player.Backpack.FindItem(0x2253, 0x0872); if (spellBook != null) { Targeting.CancelTarget(); new ContextMenuAction(spellBook, 0, 0).Perform(); } else { WorldEx.SendMessage("Arcanum Ignis not found."); } }
private static void DressInternal(Serial serial) { Item item = World.FindItem(serial); if (item == null || (item.IsInBank && !Bank.Opened)) { return; } Layer layer = GetLayer(item); Item original = World.Player.GetItemOnLayer(layer); if (PositionCheck.InMages && !IsAllowedInMages(item, layer)) { WorldEx.SendMessage("Dress blocked."); return; } if (original != null) { if (original.Serial == item.Serial) { return; } else { Undress(original); } } if (layer == Layer.LeftHand && !item.IsShield()) { original = World.Player.GetItemOnLayer(Layer.FirstValid); if (original != null) { Undress(original); } } if (layer == Layer.FirstValid) { original = World.Player.GetItemOnLayer(Layer.LeftHand); if (original != null && !original.IsShield()) { Undress(original); } } Dress(item); }
private static void OnCommand(string[] args) { if (args.Length == 0 || string.IsNullOrEmpty(args[0])) { return; } string skillName = Enum.GetNames(typeof(SkillName)).FirstOrDefault(skill => skill.StartsWith(args[0], true, null)); if (skillName == null) { WorldEx.SendMessage("Invalid skill!"); } else { new SkillIcon((SkillName)Enum.Parse(typeof(SkillName), skillName)).ShowUnlocked(); } }
public override bool Perform() { Item barrel = WorldEx.FindItemG(0x0E77, 0x0847, i => i.DistanceTo(World.Player) < 3); if (barrel == null) { WorldEx.SendMessage("Sud nenalezen."); Parent.Stop(); } foreach (Item item in World.Player.Backpack.FindItems(i => IsFish(i.ItemID))) { if (!DragDropManager.HasDragFor(item.Serial)) { DragDrop.Move(item, barrel); } } return(true); }
private static void OnProps(PacketReader p, PacketHandlerEventArgs args) { try { p.Seek(5, SeekOrigin.Begin); Item item = World.FindItem(p.ReadUInt32()); if (item == null) { return; } item.ReadPropertyList(p); if (item.RootContainer != World.Player || item.IsInBank) { return; } ObjectPropertyList.OPLEntry opl = item.ObjPropList.m_Content.OfType <ObjectPropertyList.OPLEntry>().FirstOrDefault(o => o.Number == 1060639); if (opl == null) { return; } string str = opl.Args.Trim(); int start, end; while ((start = str.IndexOf('<')) != -1 && (end = str.IndexOf('>')) != -1) { str = str.Remove(start, end - start + 1).Trim(); } string[] durab = str.Split(new[] { '\t' }, StringSplitOptions.RemoveEmptyEntries); double current, max; if (double.TryParse(durab[0], out current) && double.TryParse(durab[1], out max) && (((current / max) * 100) < ConfigEx.GetElement(25, "MinDurability") && current < max)) { opl = (ObjectPropertyList.OPLEntry)item.ObjPropList.m_Content[0]; string[] name = opl.Args.Split(new[] { '\t' }, StringSplitOptions.RemoveEmptyEntries); WorldEx.SendMessage(string.Format("!{0} {1}/{2}!", FormatString(name.Last()), current, max)); } } catch {} }
private static void OnCommand(string[] args) { ConfigEx.SetElement(enabled = !enabled, "Filter"); WorldEx.SendMessage("Filter " + (enabled ? "enabled." : "disabled.")); }
private static void OnCommand(string[] args) { enabled = !ConfigEx.GetElement(true, "Healing"); ConfigEx.SetElement(enabled, "Healing"); WorldEx.SendMessage("Healing " + (enabled ? "enabled." : "disabled.")); }
private static void ShowPosition(int x, int y) { WorldEx.SendMessage(string.Format("SOS position: {0}, {1} ({2})", x, y, Utility.Distance(World.Player.Position.X, World.Player.Position.Y, x, y))); WorldEx.SendToClient(new QuestArrow(true, (ushort)x, (ushort)y)); }
private static void OnStats(string[] args) { WorldEx.SendMessage(list.Count(s => s.Value.Felucca == true) + " sos messages on Felucca."); WorldEx.SendMessage(list.Count(s => s.Value.Felucca == false) + " sos messages on Trammel."); WorldEx.SendMessage(list.Count(s => s.Value.Felucca == null) + " sos messages Unknown."); }