Пример #1
0
        private static void WorldItem(PacketReader p, PacketHandlerEventArgs args)
        {
            Item item = World.FindItem(p.ReadUInt32() & 0x7FFFFFFF);

            if (item == null || item.ItemID != 0x2006 || item.DistanceTo(World.Player) > 2 ||
                items.Find(c => c.ItemID == item.Amount) == null)
            {
                return;
            }

            Item carver = World.FindItem(ConfigEx.GetElement <uint>(0, "BoneCarver"));

            carved.RemoveAll(i => !World.Items.ContainsKey(i));
            if (carver != null && !carved.Contains(item.Serial))
            {
                Targeting.CancelTarget();
                Targeting.QueuedTarget = () =>
                {
                    Targeting.Target(item);
                    carved.Add(item.Serial);
                    return(true);
                };
                WorldEx.SendToServer(new DoubleClick(carver.Serial));
            }
        }
Пример #2
0
 private SkillIcon(SkillName skill)
 {
     this.skill = skill;
     table.Controls.Add(new LabelEx(skill.ToString(), ConfigEx.GetElement(8, "SkillIconSize")));
     Location = new Point(ConfigEx.GetAttribute(Location.X, "locX", "Skills", skill.ToString()),
                          ConfigEx.GetAttribute(Location.Y, "locY", "Skills", skill.ToString()));
 }
Пример #3
0
        public static void AfterInit()
        {
            ConfigAgent.AddItem(false, "PotionStack");
            if (!ConfigEx.GetElement(false, "PotionStack"))
            {
                return;
            }

            AddFakeItem("Revitalize", 0x0F06, 0x000C, 0x0F0E, 0x000C);
            AddFakeItem("TMR", 0x0F0B, 0x012E, 0x0F0E, 0x012E);
            AddFakeItem("MR", 0x0F0B, 0x0130, 0x0F0E, 0x005F);
            AddFakeItem("GH", 0x0F0C, 0x0000, 0x0F0E, 0x0035);

            liftRequest = (ArrayList)PacketHandler.m_ClientViewers[7];
            PacketHandler.m_ClientViewers[7] = new ArrayList(new PacketViewerCallback[] { LiftRequest });
            dropRequest = (ArrayList)PacketHandler.m_ClientViewers[8];
            PacketHandler.m_ClientViewers[8] = new ArrayList(new PacketViewerCallback[] { DropRequest });
            clientDoubleClick = (ArrayList)PacketHandler.m_ClientViewers[6];
            PacketHandler.m_ClientViewers[6] = new ArrayList(new PacketViewerCallback[] { ClientDoubleClick });
            PacketHandler.RegisterClientToServerViewer(9, ClientSingleClick);
            PacketHandler.RegisterServerToClientFilter(0x25, ContainerContentUpdate);
            PacketHandler.RegisterServerToClientFilter(0x3C, ContainerContent);
            PacketHandler.RegisterClientToServerViewer(0x6C, TargetResponse);
            Event.RemoveObject += Event_RemoveObject;
        }
Пример #4
0
        private static bool IsShitResource(Item item)
        {
            if (ConfigEx.GetElement(true, "CleanerResources") &&
                (Array.IndexOf(resources, item.ItemID) != -1 ||
                 (item.ItemID == 0x26B4 && item.Hue != 0x08B0 && item.Hue != 0x0A11) ||
                 (item.ItemID == 0x1BF2 && item.Hue != 0x0578) ||
                 (item.ItemID == 0x19B9 && item.Hue != 0x0A54 && item.Hue != 0x047E)))//chromit a honor
            {
                return(true);
            }
            if (ConfigEx.GetElement(true, "CleanerFood") &&
                (IsFood(item.ItemID) && (item.ItemID != 0x09B9 || item.Hue != 0x09B7) && (item.ItemID != 0x09C1 || item.Hue != 0x0A3E)))
            {
                return(true);
            }
            if (ConfigEx.GetElement(true, "CleanerRunics") && IsShitRunic(item) == true)
            {
                return(true);
            }

            byte min = ConfigEx.GetElement <byte>(30, "CleanerTalismans");

            if (item.Hue != 0 || item.ItemID < 0x2F58 || item.ItemID > 0x2F5B || min == 0)
            {
                return(false);
            }
            foreach (ObjectPropertyList.OPLEntry prop in item.ObjPropList.m_Content)
            {
                if ((prop.Number == 1072394 || prop.Number == 1072395) && int.Parse(prop.Args.Split('\t')[1]) >= min)
                {
                    return(false);
                }
            }
            return(true);
        }
Пример #5
0
        private static void OnCommand(string[] args)
        {
            bool enabled = !ConfigEx.GetElement(false, "AutoGrab");

            ConfigEx.SetElement(enabled, "AutoGrab");
            WorldEx.SendMessage("Autograb " + (enabled ? "enabled." : "disabled."));
            OnChange(enabled);
        }
Пример #6
0
        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);
        }
Пример #7
0
 public override bool Perform()
 {
     if (ConfigEx.GetElement(false, "FishingTracking") && (Used = !Used))
     {
         skill.Perform();
     }
     return(true);
 }
Пример #8
0
 public override bool Perform()
 {
     if (!ConfigEx.GetElement(false, "FishingTracking") || !track.Used)
     {
         return(true);
     }
     ClientCommunication.SendToClient(new CloseGump(World.Player.CurrentGumpI));
     ClientCommunication.SendToServer(new GumpResponse(World.Player.CurrentGumpS, World.Player.CurrentGumpI, 1, new int[0], new GumpTextEntry[0]));
     World.Player.HasGump = false;
     return(true);
 }
Пример #9
0
            public override bool Perform()
            {
                Item item = World.FindItem(ConfigEx.GetElement <uint>(0, "BoneCarver"));

                if (item != null)
                {
                    Targeting.CancelTarget();
                    WorldEx.SendToServer(new DoubleClick(item.Serial));
                }
                return(true);
            }
Пример #10
0
 private static bool IsSOSCrap(Item item)
 {
     if (item.ItemID >= 0x1F2D && item.ItemID <= 0x1F72 && item.Hue == 0)//svitky
     {
         return(true);
     }
     if (item.ItemID >= 0x0F0F && item.ItemID <= 0x0F30 && item.Hue == 0)//small diamonds
     {
         return(true);
     }
     return(!ConfigEx.GetElement(false, "LootBigDiamonds") && IsBigDiamonds(item));
 }
Пример #11
0
        private static void OnGumpResponse(Packet p, PacketHandlerEventArgs args)
        {
            p.ReadUInt32();
            if (p.ReadUInt32() != gumpID)
            {
                return;
            }
            uint buttonID = p.ReadUInt32();

            if ((buttonID - 2) % 6 == 0)
            {
                p.Seek(-4, SeekOrigin.Current);
                p.Write(buttonID + (uint)ConfigEx.GetElement(TeleportType.Default, "RuneBook"));
            }
        }
Пример #12
0
        private static void Carve(Item item)
        {
            Item carver = World.FindItem(ConfigEx.GetElement <uint>(0, "BoneCarver"));

            carved.RemoveAll(i => !World.Items.ContainsKey(i));
            if (carver != null && !carved.Contains(item.Serial))
            {
                Targeting.CancelTarget();
                Targeting.QueuedTarget = () =>
                {
                    Targeting.Target(item);
                    carved.Add(item.Serial);
                    return(true);
                };
                WorldEx.SendToServer(new DoubleClick(carver.Serial));
            }
        }
Пример #13
0
 private SpellIcon(Spell spell)
 {
     this.spell = spell;
     table.Controls.Add(gump = new ArtBox((ushort)GetID(), 0, ConfigEx.GetElement(false, "SmallSpellIcon") ? 35 : -1, true));
     Location = new Point(ConfigEx.GetAttribute(Location.X, "locX", "Spells", "Spell_" + spell.GetID()),
                          ConfigEx.GetAttribute(Location.Y, "locY", "Spells", "Spell_" + spell.GetID()));
     if (IsUsable)
     {
         WeaponMoves.Changed    += SetGump;
         Event.LocalizedMessage += Event_LocalizedMessage;
         if (IsPrimaryAbility || IsSecondaryAbility)
         {
             WeaponAbilities.WeaponSwitched += SetGump;
         }
     }
     if (spell.GetID() == 403)//evasion
     {
         Event.LocalizedMessage += OnEvasion;
     }
 }
Пример #14
0
        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 {}
        }
Пример #15
0
        private static void DoIt(Item item)
        {
            Item tool = null;

            if (item.IsElementalBody())
            {
                tool = World.FindItem(ConfigEx.GetElement <uint>(0, "LegendaryPickaxe"));
            }
            else if (item.IsSomeTreeishBody())
            {
                tool = World.FindItem(ConfigEx.GetElement <uint>(0, "LegendaryHatchet"));
            }

            if (tool != null)
            {
                Targeting.CancelTarget();
                Targeting.QueuedTarget = () =>
                {
                    Targeting.Target(item);
                    return(true);
                };
                WorldEx.SendToServer(new DoubleClick(tool.Serial));
            }
        }
Пример #16
0
        private static void Loot(Item bag)
        {
            if (bag == null)
            {
                return;
            }
            Item backpack;

            if (bag != World.Player.Backpack)
            {
                backpack = World.FindItem(LootBag.Bag);
                Clean(backpack, bag.FindItems(i => Looting.Items.Any(l => i.ItemID == l.Graphic && (i.Hue == l.Color || l.Color == 0xFFFF))));
                Clean(backpack, bag.FindItems(0x0E34));                  //kousky map
                Clean(backpack, bag.FindItems(0x26B8));                  //dusty
                Clean(backpack, bag.FindItems(0x0E76));                  //bagly
                Clean(backpack, bag.FindItems(0x14F0));                  //pska
                Clean(backpack, bag.FindItems(0x0FAB));                  //barvy
                Clean(backpack, bag.FindItems(0x0DCA, 0x0481));          //bila sit
                Clean(backpack, bag.FindItems(0x226E, 0x0065));          //kousky sos
                Clean(backpack, bag.FindItems(0x0F8B, 0x043D));          //moony
                Clean(backpack, bag.FindItems(0x3155, 0x048D));          //slzy
                Clean(backpack, bag.FindItems(0x1BC4, 0x0482));          //holy shield
                Clean(backpack, bag.FindItems(0x0F61, 0x0482));          //holy sword
                Clean(backpack, bag.FindItems(0x0F87, 0x0000));          //eye of newt
                Clean(backpack, bag.FindItems(0x1422, 0x0481));          //token
                Clean(backpack, bag.FindItems(0x1006, 0x0973));          //durab picovina
                Clean(backpack, bag.FindItems(0x1869, 0x04AE));          //sb
                Clean(backpack, bag.FindItems(0x0F0E, 0x099F));          //redidlo
                Clean(backpack, bag.FindItems(0x0EF0, 0x09F0));          //cechy
                Clean(backpack, bag.FindItems(0x097C, 0x09E2));          //fragmenty
                Clean(backpack, bag.FindItems(0x26B4, 0x0A11));          //charmy
                Clean(backpack, bag.FindItems(0x09EC, 0x0265));          //lestidlo 1
                Clean(backpack, bag.FindItems(0x09EC, 0x0247));          //lestidlo 2
                Clean(backpack, bag.FindItems(0x1877, i => i.Hue != 0)); //draty
                Clean(backpack, bag.FindItems(0x1F3D, i => i.Hue != 0)); //svitky
                Clean(backpack, bag.FindItems(IsLevel));
                Clean(backpack, bag.FindItems(i => IsShitRunic(i) == null));

                if (ConfigEx.GetElement(false, "LootBigDiamonds"))
                {
                    Clean(backpack, bag.FindItems(IsBigDiamonds));
                }

                foreach (Item item in bag.FindItems(IsSOSCrap))
                {
                    WorldEx.SendToClient(new RemoveObject(item.Serial));
                }
            }

            backpack = World.Player.Backpack;
            Clean(backpack.FindItem(0x0E3B, 0x0489), bag.FindItems(i => Array.IndexOf(regs, i.ItemID) != -1));             //reagents
            Clean(backpack.FindItem(0x0E3B, 0x0489), bag.FindItems(0x0E76, i => i.Contains.Count == 0 && !i.IsBlessed())); //empty bags
            Clean(backpack.FindItem(0x0E79, 0x001A), bag.FindItems(0x0F0E, 0x0000));                                       //empty bottles
            Clean(backpack.FindItem(0x0E79, 0x001A), bag.FindItems(0x0C64, 0x0490));                                       //zoogi vejce
            Clean(backpack.FindItem(0x0E79, 0x001A), bag.FindItems(0x2808, 0));                                            //smoke bomb
            Clean(backpack.FindItem(0x0E79, 0x001A), bag.FindItems(0x0F0B, 0x0367));                                       //pet res
            Clean(backpack.FindItem(0x0E79, 0x001A), bag.FindItems(0x0F0B, 0x0774));                                       //repair
            Clean(backpack.FindItem(0x2252, 0x08AC), bag.FindItems(0x0EF0, 0x0000));                                       //silver
            Item quiver = World.Player.GetItemOnLayer(Layer.MiddleTorso);

            if (quiver == null || (!quiver.IsQuiver() && !IsQuiverSash(quiver)))
            {
                quiver = backpack.FindItem(i => i.IsQuiver() || IsQuiverSash(i));
            }
            Clean(quiver, bag.FindItems(i => i.ItemID == 0x0F3F || i.ItemID == 0x1BFB)); //ammo

            Item gpBag = World.FindItem(ConfigEx.GetElement <uint>(0, "GPBag"));

            Clean(gpBag, bag.FindItems(0x0EED, 0x0000, i => i.Container != gpBag)); //gp

            Item whiteBall = backpack.FindItem(0x0E73, 0x0702, recurse: false);

            if (whiteBall != null)
            {
                Clean(backpack, bag.FindItems(0x0E73, 0x0702, i => i != whiteBall));
            }
            else
            {
                Clean(backpack.FindItem(0x0E79, 0x001A), bag.FindItems(0x0E73, 0x0702));
            }

            Item brownBall = backpack.FindItem(0x0E73, 0x0629, recurse: false);

            if (brownBall != null)
            {
                Clean(backpack, bag.FindItems(0x0E73, 0x0629, i => i != brownBall));
            }
            else
            {
                Clean(backpack.FindItem(0x0E79, 0x001A), bag.FindItems(0x0E73, 0x0629));
            }

            Item medovina = backpack.FindItem(0x09EC, 0x002C, recurse: false);

            if (medovina != null)
            {
                Clean(backpack, bag.FindItems(0x09EC, 0x002C, i => i != medovina));
            }
            else
            {
                Clean(backpack.FindItem(0x0E79, 0x001A), bag.FindItems(0x09EC, 0x002C));
            }

            Clean(backpack.FindItem(0x0E79, 0x0488), bag.FindItems(i => Array.IndexOf(petPlant, i.ItemID) != -1));                                        //petplant
            Clean(backpack.FindItem(0x24D7, 0x0556), bag.FindItems(i => (IsFish(i.ItemID) && !IsBigFish(i)) || (i.ItemID == 0x0DCA && i.Hue == 0x08A0))); //fishbag + site
            Clean(backpack.FindItem(0x09B0, 0x048E), bag.FindItems(IsShitResource));                                                                      //food+resources

            Clean(backpack.FindItem(0x2252, 0x0492), bag.FindItems(0x14EC, 0));                                                                           //mapky
            if (!ConfigEx.GetElement(false, "CleanerSOS"))
            {
                Clean(backpack.FindItem(0x22C5, IsSOSBook), bag.FindItems(0x14ED, recurse: false)); //sosky vsechny
            }
            else
            {
                Clean(backpack.FindItem(0x09B0, 0x048E), bag.FindItems(0x14ED, 0, recurse: false));                  //trash obyc
                Clean(backpack.FindItem(0x22C5, IsSOSBook), bag.FindItems(0x14ED, i => i.Hue != 0, recurse: false)); //uklid ostatni
            }

            foreach (Item item in bag.FindItems(0x099F))//flasky se soskama
            {
                ActionQueue.DoubleClick(true, item.Serial);
            }

            foreach (Item item in backpack.FindItems(0x0ECF, 0)) //kosti
            {
                Clean(backpack.FindItem(0x09B0, 0x048E), item.FindItems(0x1EFD, 0x04D1));
                Clean(backpack.FindItem(0x09B0, 0x048E), item.FindItems(0x170D, 0x0000));
                Clean(backpack.FindItem(0x09B0, 0x048E), item.FindItems(0x1539, 0x045E));
                Clean(backpack.FindItem(0x09B0, 0x048E), item.FindItems(0x171B, 0x0006));
                Clean(backpack.FindItem(0x09B0, 0x048E), item.FindItems(IsSextant));
            }
        }
Пример #17
0
        protected override void OnPaint(PaintEventArgs e)
        {
            if (Current == null)
            {
                return;
            }

            position = Current.Position;
            Point point  = new Point(position.X % 8, position.Y % 8);
            Point start  = new Point((position.X / 8) - (Width / 16), (position.Y / 8) - (Height / 16));
            Point center = new Point((position.X - (start.X * 8)) - point.X, (position.Y - (start.Y * 8)) - point.Y);

            e.Graphics.TranslateTransform(-Width / 2F, -Height / 2F, MatrixOrder.Append);
            e.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
            e.Graphics.ScaleTransform(1.5F, 1.5F, MatrixOrder.Append);
            e.Graphics.RotateTransform(45F, MatrixOrder.Append);
            e.Graphics.TranslateTransform(Width / 2F, Height / 2F, MatrixOrder.Append);
            Ultima.Map map = Map.GetMap(Current.Map) ?? Ultima.Map.Trammel;
            e.Graphics.DrawImage(map.GetImage(start.X, start.Y, Width / 8 + point.X, Height / 8 + point.Y, true), -point.X, -point.Y);
            e.Graphics.ScaleTransform(1F, 1F, MatrixOrder.Append);
            e.Graphics.FillRectangle(GetBrush(Current), center.X - 1, center.Y - 1, 2, 2);
            if (Current != World.Player)
            {
                e.Graphics.DrawString(Current.GetName(), Font, Brushes.Silver, center.X, center.Y);
            }

            party.Clear();
            foreach (Serial serial in Party)
            {
                Mobile  mobile = World.FindMobile(serial);
                Point3D pos    = mobile != null ? mobile.Position : Point3D.Zero;
                party.Add(serial, pos);
                if (pos != Point3D.Zero && mobile != Current)
                {
                    DrawPoint(e.Graphics, pos, mobile != null ? mobile.GetName() : "(Unknown)", GetBrush(mobile), center);
                }
            }

            if ((PositionCheck.InFire || PositionCheck.InKhaldun) && ConfigEx.GetElement(true, "RadarArcheologyGrid"))
            {
                for (int x = center.X - position.X + (position.X - Width) + 40 - (position.X - Width) % 40; x < Width; x += 40)
                {
                    e.Graphics.DrawLine(Pens.Gray, x, center.Y - Height, x, center.Y + Height);
                }

                for (int y = center.Y - position.Y + (position.Y - Height) + 40 - (position.Y - Height) % 40; y < Height; y += 40)
                {
                    e.Graphics.DrawLine(Pens.Gray, center.X - Width, y, center.X + Width, y);
                }
            }

            foreach (Item sos in World.Player.Backpack.FindItems(0x14ED))
            {
                FishingSOS.SOSInfo info;
                if (FishingSOS.List.TryGetValue(sos.Serial, out info) && info.Felucca.HasValue)
                {
                    DrawPoint(e.Graphics, info.Location, null, Brushes.Gold, center);
                }
            }

            e.Graphics.ResetTransform();
            e.Graphics.DrawString("W", bigFont, Brushes.DeepPink, 0, 0);
            e.Graphics.DrawString("S", bigFont, Brushes.DeepPink, 0, Height - bigFont.Height);
            e.Graphics.DrawString("N", bigFont, Brushes.DeepPink, Width - bigFont.Height, 0);
            e.Graphics.DrawString("E", bigFont, Brushes.DeepPink, Width - bigFont.Height, Height - bigFont.Height);

            position = World.Player.Position;
        }
Пример #18
0
 private static void PetCommand(string cmd, ushort keyword)
 {
     WorldEx.SendToServer(new EncodedMessage(ConfigEx.GetElement(cmd.Insert(3, " ").ToLower(), "PetCommands", cmd), keyword));
 }
Пример #19
0
 private static void Release()
 {
     WorldEx.SendToServer(new EncodedMessage(World.Player.Name + " " + ConfigEx.GetElement("release", "PetCommands", "Release"), 0x16D));
 }
Пример #20
0
 private static void OnCommand(string[] args)
 {
     enabled = !ConfigEx.GetElement(true, "Healing");
     ConfigEx.SetElement(enabled, "Healing");
     WorldEx.SendMessage("Healing " + (enabled ? "enabled." : "disabled."));
 }
Пример #21
0
 public override bool Perform()
 {
     return(!ConfigEx.GetElement(false, "FishingTracking") || !track.Used || !PerformWait());
 }
Пример #22
0
 private class MacroTargetPet : SpellTarget { protected override void Target()
                                              {
                                                  Targeting.Target(World.FindMobile((uint)ConfigEx.GetElement(0, "Pet")));
                                              }
Пример #23
0
            public override bool Perform()
            {
                Mobile pet = World.FindMobile((uint)ConfigEx.GetElement(0, "Pet"));

                return(pet != null && (pet.Hits < pet.HitsMax || pet.Poisoned) && new MacroCastSpellAction(pet.Poisoned ? 25 : 29).Perform());
            }