示例#1
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));
     }
 }
示例#2
0
        internal static void ReadPlayerDress()
        {
            if (World.Player == null)             // non loggato
            {
                AddLog("You are not logged in game!");
                return;
            }

            RazorEnhanced.Settings.Dress.ItemClear(Assistant.Engine.MainWindow.DressListSelect.Text);

            foreach (Layer l in LayerList)
            {
                Assistant.Item layeritem = Assistant.World.Player.GetItemOnLayer(l);
                if (layeritem == null)                 // slot vuoto
                {
                    continue;
                }

                RazorEnhanced.Dress.DressItemNew itemtoinsert = new DressItemNew(layeritem.Name, l, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            RazorEnhanced.Dress.RefreshItems();
        }
示例#3
0
        internal static void AutoRun()
        {
            if (!Assistant.Engine.Running)
            {
                return;
            }

            // Genero filtro item
            m_itemfilter.RangeMax = MaxRange;

            // Check bag
            Assistant.Item bag = Assistant.World.FindItem(ScavengerBag);
            if (bag != null)
            {
                if (bag.RootContainer != World.Player)
                {
                    if (Settings.General.ReadBool("ShowMessageFieldCheckBox"))
                    {
                        Misc.SendMessage("Scavenger: Invalid Bag, Switch to backpack", 945);
                    }
                    AddLog("Invalid Bag, Switch to backpack");
                    ScavengerBag = (int)World.Player.Backpack.Serial.Value;
                }
            }
            else
            {
                if (Settings.General.ReadBool("ShowMessageFieldCheckBox"))
                {
                    Misc.SendMessage("Scavenger: Invalid Bag, Switch to backpack", 945);
                }
                AddLog("Invalid Bag, Switch to backpack");
                ScavengerBag = (int)World.Player.Backpack.Serial.Value;
            }

            Engine(Settings.Scavenger.ItemsRead(ScavengerListName), ScavengerDelay, m_itemfilter);
        }
示例#4
0
        internal static Assistant.Item FindUsedLayer()
        {
            Assistant.Item layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Shoes);
            if (layeritem != null)
            {
                return(layeritem);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Pants);
            if (layeritem != null)
            {
                return(layeritem);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Shirt);
            if (layeritem != null)
            {
                return(layeritem);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Head);
            if (layeritem != null)
            {
                return(layeritem);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Gloves);
            if (layeritem != null)
            {
                return(layeritem);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Ring);
            if (layeritem != null)
            {
                return(layeritem);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Neck);
            if (layeritem != null)
            {
                return(layeritem);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Waist);
            if (layeritem != null)
            {
                return(layeritem);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.InnerTorso);
            if (layeritem != null)
            {
                return(layeritem);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Bracelet);
            if (layeritem != null)
            {
                return(layeritem);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.MiddleTorso);
            if (layeritem != null)
            {
                return(layeritem);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Earrings);
            if (layeritem != null)
            {
                return(layeritem);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Arms);
            if (layeritem != null)
            {
                return(layeritem);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Cloak);
            if (layeritem != null)
            {
                return(layeritem);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.OuterTorso);
            if (layeritem != null)
            {
                return(layeritem);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.OuterLegs);
            if (layeritem != null)
            {
                return(layeritem);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.InnerLegs);
            if (layeritem != null)
            {
                return(layeritem);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.RightHand);
            if (layeritem != null)
            {
                return(layeritem);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.LeftHand);
            if (layeritem != null)
            {
                return(layeritem);
            }

            return(null);
        }
示例#5
0
 internal EnhancedItemInspector(Assistant.Item itemTarg)
 {
     InitializeComponent();
     MaximizeBox = false;
     m_itemTarg  = itemTarg;
 }
示例#6
0
        internal static void AutoRun()
        {
            if (World.Player.IsGhost)
            {
                Thread.Sleep(2000);
                return;
            }

            if (AutoLootSerialCorpseRefresh.Count > 0 && Assistant.Engine.MainWindow.AutolootCheckBox.Checked && !Targeting.HasTarget && Player.Visible)
            {
                try
                {
                    int itemserial = 0;
                    if (AutoLootSerialCorpseRefresh.TryPeek(out itemserial))
                    {
                        Assistant.Item item = Assistant.World.FindItem(itemserial);

                        if (item == null)
                        {
                            AutoLootSerialCorpseRefresh.TryDequeue(out itemserial);
                            return;
                        }

                        if (Utility.InRange(new Assistant.Point2D(World.Player.Position.X, World.Player.Position.Y), new Assistant.Point2D(item.Position.X, item.Position.Y), AutoLoot.MaxRange) && CheckZLevel(item.Position.Z, World.Player.Position.Z))
                        {
                            RazorEnhanced.Items.WaitForContents(Items.FindBySerial(itemserial), 1000);
                            AutoLoot.AddLog("- Refresh Corpse: 0x" + itemserial.ToString("X8"));
                            Thread.Sleep(AutoLoot.AutoLootDelay);
                            if (item.Updated)
                            {
                                AutoLootSerialCorpseRefresh.TryDequeue(out itemserial);
                            }
                        }
                        else
                        {
                            AutoLootSerialCorpseRefresh.TryDequeue(out itemserial);
                            AutoLootSerialCorpseRefresh.Enqueue(itemserial);
                        }
                    }
                }
                catch { }
            }

            if (AutoLoot.SerialToGrabList.Count > 0 && Assistant.Engine.MainWindow.AutolootCheckBox.Checked && Player.Visible)
            {
                try
                {
                    AutoLoot.SerialToGrab data;
                    if (AutoLoot.SerialToGrabList.TryPeek(out data))
                    {
                        Assistant.Item item = Assistant.World.FindItem(data.ItemSerial);

                        if (item == null)
                        {
                            AutoLoot.SerialToGrabList.TryDequeue(out data);
                            return;
                        }

                        if (item.RootContainer == World.Player)
                        {
                            AutoLoot.SerialToGrabList.TryDequeue(out data);
                            return;
                        }

                        Assistant.Item corpse = Assistant.World.FindItem(data.CorpseSerial);

                        if (corpse == null)
                        {
                            AutoLoot.SerialToGrabList.TryDequeue(out data);
                            return;
                        }

                        if (Utility.InRange(new Assistant.Point2D(World.Player.Position.X, World.Player.Position.Y), new Assistant.Point2D(corpse.Position.X, corpse.Position.Y), AutoLoot.MaxRange) && CheckZLevel(corpse.Position.Z, World.Player.Position.Z))
                        {
                            if ((World.Player.MaxWeight - World.Player.Weight) < 5)
                            {
                                RazorEnhanced.AutoLoot.AddLog("- Max weight reached, Wait untill free some space");
                                RazorEnhanced.Misc.SendMessage("AUTOLOOT: Max weight reached, Wait untill free some space");
                                Thread.Sleep(2000);
                            }
                            else
                            {
                                RazorEnhanced.AutoLoot.AddLog("- Item Match found (" + item.Serial.ToString() + ") ... Looting");
                                RazorEnhanced.Items.Move(item.Serial, AutoLoot.AutoLootBag, 0);
                                Thread.Sleep(AutoLoot.AutoLootDelay);
                                AutoLoot.SerialToGrabList.TryDequeue(out data);
                            }
                        }
                        else
                        {
                            AutoLoot.SerialToGrabList.TryDequeue(out data);
                            AutoLoot.SerialToGrabList.Enqueue(data);
                        }
                    }
                }
                catch { }
            }

            if (ScavengerSerialToGrab.Count > 0 && Assistant.Engine.MainWindow.ScavengerCheckBox.Checked)
            {
                try
                {
                    int itemserial = 0;
                    if (ScavengerSerialToGrab.TryPeek(out itemserial))
                    {
                        Assistant.Item item = Assistant.World.FindItem(itemserial);

                        if (item == null)
                        {
                            ScavengerSerialToGrab.TryDequeue(out itemserial);
                            return;
                        }

                        if (item.RootContainer == World.Player)
                        {
                            ScavengerSerialToGrab.TryDequeue(out itemserial);
                            return;
                        }

                        if (Utility.InRange(new Assistant.Point2D(World.Player.Position.X, World.Player.Position.Y), new Assistant.Point2D(item.Position.X, item.Position.Y), Scavenger.MaxRange) && CheckZLevel(item.Position.Z, World.Player.Position.Z))
                        {
                            if ((World.Player.MaxWeight - World.Player.Weight) < 5)
                            {
                                RazorEnhanced.Scavenger.AddLog("- Max weight reached, Wait untill free some space");
                                RazorEnhanced.Misc.SendMessage("SCAVENGER: Max weight reached, Wait untill free some space");
                                Thread.Sleep(2000);
                            }
                            else
                            {
                                RazorEnhanced.Scavenger.AddLog("- Item Match found (" + item.Serial.ToString() + ") ... Grabbing");
                                RazorEnhanced.Items.Move(item.Serial, Scavenger.ScavengerBag, 0);
                                Thread.Sleep(Scavenger.ScavengerDelay);
                                ScavengerSerialToGrab.TryDequeue(out itemserial);
                            }
                        }
                        else
                        {
                            ScavengerSerialToGrab.TryDequeue(out itemserial);
                            ScavengerSerialToGrab.Enqueue(itemserial);
                        }
                    }
                }
                catch { }
            }

            if (CorpseToCutSerial.Count > 0 && Filters.AutoCarver)
            {
                try
                {
                    int itemserial = 0;
                    if (CorpseToCutSerial.TryPeek(out itemserial))
                    {
                        Assistant.Item item = Assistant.World.FindItem(itemserial);

                        if (item == null)
                        {
                            CorpseToCutSerial.TryDequeue(out itemserial);
                            return;
                        }

                        if (Utility.InRange(new Assistant.Point2D(Assistant.World.Player.Position.X, Assistant.World.Player.Position.Y), new Assistant.Point2D(item.Position.X, item.Position.Y), 1) && CheckZLevel(item.Position.Z, World.Player.Position.Z))
                        {
                            Items.UseItem(Items.FindBySerial(Filters.AutoCarverBlade));
                            Target.WaitForTarget(1000, true);
                            Target.TargetExecute(item.Serial);
                            Items.Message(item.Serial, 10, "*Cutting*");
                            CorpseToCutSerial.TryDequeue(out itemserial);
                            Thread.Sleep(RazorEnhanced.Settings.General.ReadInt("ObjectDelay"));
                        }
                        else
                        {
                            CorpseToCutSerial.TryDequeue(out itemserial);
                            CorpseToCutSerial.Enqueue(itemserial);
                        }
                    }
                }
                catch { }
            }
        }
示例#7
0
 internal Item(Assistant.Item item)
     : base(item)
 {
     m_AssistantItem = item;
 }
示例#8
0
        /*public static void Move(int source, int destination, int amount, int x, int y)
         * {
         *      Assistant.Item bag = Assistant.World.FindItem(destination);
         *      Assistant.Item item = Assistant.World.FindItem(source);
         *      int serialdestination = 0;
         *
         *      if (item == null)
         *      {
         *              Scripts.SendMessageScriptError("Script Error: Move: Source Item  not found");
         *              return;
         *      }
         *
         *      if (bag != null)
         *      {
         *              serialdestination = bag.Serial;
         *      }
         *      else
         *      {
         *              Assistant.Mobile mbag = Assistant.World.FindMobile(destination);
         *              if (mbag != null)
         *              {
         *                      serialdestination = mbag.Serial;
         *              }
         *              else
         *              {
         *                      Scripts.SendMessageScriptError("Script Error: Move: Destination not found");
         *                      return;
         *              }
         *      }
         *
         *      Assistant.Point3D loc = Assistant.Point3D.MinusOne;
         *      if (x != -1 && y != -1)
         *              loc = new Assistant.Point3D(x, y, 0);
         *
         *      if (amount == 0)
         *      {
         *              Assistant.Client.Instance.SendToServerWait(new LiftRequest(item.Serial, item.Amount));
         *              Assistant.Client.Instance.SendToServerWait(new DropRequest(item.Serial, loc, serialdestination));
         *      }
         *      else
         *      {
         *              if (item.Amount < amount)
         *              {
         *                      amount = item.Amount;
         *              }
         *              Assistant.Client.Instance.SendToServerWait(new LiftRequest(item.Serial, amount));
         *              Assistant.Client.Instance.SendToServerWait(new DropRequest(item.Serial, loc, serialdestination));
         *      }
         * }*/

        public static void Move(int source, int destination, int amount, int x, int y)
        {
            Assistant.Item   bag  = Assistant.World.FindItem(destination);
            Assistant.Item   item = Assistant.World.FindItem(source);
            Assistant.Mobile mbag = null;

            int  serialdestination = 0;
            bool isMobile          = false;
            bool onLocation        = false;
            int  newamount         = 0;

            if (item == null)
            {
                Scripts.SendMessageScriptError("Script Error: Move: Source Item  not found");
                return;
            }

            if (bag != null)
            {
                serialdestination = bag.Serial;
            }
            else
            {
                mbag = Assistant.World.FindMobile(destination);
                if (mbag != null)
                {
                    isMobile          = true;
                    serialdestination = mbag.Serial;
                }
            }

            if (serialdestination == 0)
            {
                Scripts.SendMessageScriptError("Script Error: Move: Destination not found");
                return;
            }

            Assistant.Point3D loc = Assistant.Point3D.MinusOne;
            if (x != -1 && y != -1)
            {
                onLocation = true;
                loc        = new Assistant.Point3D(x, y, 0);
            }

            // calcolo amount
            if (amount == 0)
            {
                newamount = item.Amount;
            }
            else
            {
                if (item.Amount < amount)
                {
                    newamount = item.Amount;
                }
                else
                {
                    newamount = amount;
                }
            }

            if (isMobile)
            {
                Assistant.DragDropManager.DragDrop(item, newamount, mbag.Serial);
            }
            else if (onLocation)
            {
                Assistant.DragDropManager.DragDrop(item, newamount, bag, loc);
            }
            else
            {
                Assistant.DragDropManager.DragDrop(item, newamount, bag);
            }
        }
示例#9
0
文件: Item.cs 项目: mozkandemir/RE
        public static int GetPropValue(int serial, string name)
        {
            Assistant.Item assistantItem = Assistant.World.FindItem((uint)serial);

            if (assistantItem != null)
            {
                List <Assistant.ObjectPropertyList.OPLEntry> props = assistantItem.ObjPropList.Content;

                foreach (Assistant.ObjectPropertyList.OPLEntry prop in props.ToList())
                {
                    if (!prop.ToString().ToLower().Contains(name.ToLower()))
                    {
                        continue;
                    }


                    if (prop.Args == null)                      // Props esiste ma non ha valore
                    {
                        return(1);
                    }

                    string propstring = prop.Args;
                    bool   subprops   = false;
                    int    i          = 0;

                    if (propstring.Length > 7)
                    {
                        subprops = true;
                    }

                    try                      // Etraggo il valore
                    {
                        string number = string.Empty;
                        foreach (char str in propstring)
                        {
                            if (subprops)
                            {
                                if (i > 7)
                                {
                                    if (char.IsDigit(str))
                                    {
                                        number += str.ToString();
                                    }
                                }
                            }
                            else
                            {
                                if (char.IsDigit(str))
                                {
                                    number += str.ToString();
                                }
                                else
                                {
                                    break;
                                }
                            }

                            i++;
                        }
                        return(Convert.ToInt32(number));
                    }
                    catch
                    {
                        return(1);                         // errore di conversione ma esiste
                    }
                }
            }
            return(0);             // Non esiste o null item
        }
示例#10
0
        // Dress

        internal static void DressEngine(List <Dress.DressItemNew> items, int mseconds, int undressbagserial, bool conflict)
        {
            try
            {
                if (RazorEnhanced.Settings.General.ReadBool("UO3dEquipUnEquip"))
                {
                    // Problem with uo3d is the serveuo servers don't swap 1hand/2hand properly
                    // but OSI does, so if delay is 0 let OSI swap fast otherwise handle udress for weapons
                    if (m_dressdelay == 0)
                    {
                        List <uint>    itemserial = new List <uint>();
                        Assistant.Item lefth      = Assistant.World.Player.GetItemOnLayer(Layer.LeftHand);
                        Assistant.Item righth     = Assistant.World.Player.GetItemOnLayer(Layer.RightHand);

                        foreach (DressItemNew item in items)
                        {
                            var existingItem = Assistant.World.Player.GetItemOnLayer(item.Layer);
                            if (existingItem == null || item.Serial != existingItem.Serial)
                            {
                                itemserial.Add((uint)item.Serial);
                            }
                        }
                        if (itemserial.Count > 0)
                        {
                            RazorEnhanced.Dress.AddLog("Dressing...");
                            Assistant.Client.Instance.SendToServerWait(new EquipItemMacro(itemserial));
                        }
                    }
                    else
                    {
                        // This logic is terrible .. The plan is
                        // If your swapping weapons, and new weapon 1hand/2hand not equal to new 1/hand/2hand
                        // then undress the existing weapons first
                        List <uint>    itemserial = new List <uint>();
                        Assistant.Item lefth      = Assistant.World.Player.GetItemOnLayer(Layer.LeftHand);
                        Assistant.Item righth     = Assistant.World.Player.GetItemOnLayer(Layer.RightHand);

                        bool dropWeaponL = false;
                        bool twoHandLeft = false;
                        bool dropWeaponR = false;
                        //Assistant.Item newLeft = null;
                        foreach (DressItemNew item in items)
                        {
                            var existingItem = Assistant.World.Player.GetItemOnLayer(item.Layer);
                            if (existingItem == null || item.Serial != existingItem.Serial)
                            {
                                itemserial.Add((uint)item.Serial);
                            }
                            if (item.Layer == Layer.LeftHand)
                            {
                                if (lefth == null || item.Serial != lefth.Serial)
                                {
                                    twoHandLeft = Assistant.World.FindItem(item.Serial).IsTwoHanded;
                                }
                            }

                            if (item.Layer == Layer.LeftHand && lefth != null && item.Serial != lefth.Serial)
                            {
                                dropWeaponL = true;
                            }
                            if (item.Layer == Layer.RightHand && righth != null && item.Serial != righth.Serial)
                            {
                                dropWeaponR = true;
                            }
                        }

                        List <ushort> dropLayer = new List <ushort>();
                        if (dropWeaponL || twoHandLeft)
                        {
                            dropLayer.Add((ushort)Layer.LeftHand);
                        }
                        if (dropWeaponR || twoHandLeft)
                        {
                            dropLayer.Add((ushort)Layer.RightHand);
                        }
                        if (dropLayer.Count > 0)
                        {
                            Assistant.Client.Instance.SendToServerWait(new UnEquipItemMacro(dropLayer));
                            Thread.Sleep(m_dressdelay);
                        }

                        if (itemserial.Count > 0)
                        {
                            RazorEnhanced.Dress.AddLog("Dressing...");
                            Assistant.Client.Instance.SendToServerWait(new EquipItemMacro(itemserial));
                        }
                    }
                }
                else
                {
                    foreach (DressItemNew item in items)
                    {
                        if (!item.Selected)
                        {
                            continue;
                        }

                        if (item.Name == "UNDRESS")                                  // Caso undress slot
                        {
                            Assistant.Item itemtomove = Assistant.World.Player.GetItemOnLayer(item.Layer);

                            if (itemtomove == null)
                            {
                                continue;
                            }

                            if (!itemtomove.Movable)
                            {
                                continue;
                            }

                            RazorEnhanced.Dress.AddLog("Item 0x" + itemtomove.Serial.Value.ToString("X8") + " on Layer: " + item.Layer.ToString() + " undressed!");
                            RazorEnhanced.Items.Move(itemtomove.Serial, undressbagserial, 0);
                            Thread.Sleep(mseconds);
                        }
                        else
                        {
                            if (World.FindItem(item.Serial) == null)
                            {
                                continue;
                            }

                            if (conflict)                                   // Caso abilitato controllo conflitto
                            {
                                Assistant.Item itemonlayer = Assistant.World.Player.GetItemOnLayer(World.FindItem(item.Serial).Layer);
                                if (itemonlayer != null)
                                {
                                    if (itemonlayer.Serial == item.Serial)
                                    {
                                        continue;
                                    }
                                }

                                if (World.FindItem(item.Serial).Layer == Layer.RightHand || World.FindItem(item.Serial).Layer == Layer.LeftHand)                                        // Check armi per controlli twohand
                                {
                                    Assistant.Item lefth  = Assistant.World.Player.GetItemOnLayer(Layer.LeftHand);
                                    Assistant.Item righth = Assistant.World.Player.GetItemOnLayer(Layer.RightHand);

                                    if (Assistant.World.FindItem(item.Serial).IsTwoHanded)
                                    {
                                        if (lefth != null && lefth.Movable)
                                        {
                                            RazorEnhanced.Dress.AddLog("Item 0x" + lefth.Serial.Value.ToString("X8") + " on Layer: LeftHand undressed!");
                                            RazorEnhanced.Items.Move(lefth.Serial, undressbagserial, 0);
                                            Thread.Sleep(mseconds);
                                        }
                                        if (righth != null && righth.Movable)
                                        {
                                            RazorEnhanced.Dress.AddLog("Item 0x" + righth.Serial.Value.ToString("X8") + " on Layer: RightHand undressed!");
                                            RazorEnhanced.Items.Move(righth.Serial, undressbagserial, 0);
                                            Thread.Sleep(mseconds);
                                        }
                                    }
                                    else if ((lefth != null && lefth.IsTwoHanded) || (righth != null && righth.IsTwoHanded))
                                    {
                                        if (lefth != null && lefth.Movable)
                                        {
                                            RazorEnhanced.Dress.AddLog("Item 0x" + lefth.Serial.Value.ToString("X8") + " on Layer: LeftHand undressed!");
                                            RazorEnhanced.Items.Move(lefth.Serial, undressbagserial, 0);
                                            Thread.Sleep(mseconds);
                                        }
                                        if (righth != null && righth.Movable)
                                        {
                                            RazorEnhanced.Dress.AddLog("Item 0x" + righth.Serial.Value.ToString("X8") + " on Layer: RightHand undressed!");
                                            RazorEnhanced.Items.Move(righth.Serial, undressbagserial, 0);
                                            Thread.Sleep(mseconds);
                                        }
                                    }
                                }

                                Assistant.Item itemtomove = Assistant.World.Player.GetItemOnLayer(item.Layer);
                                if (itemtomove != null)
                                {
                                    if (itemtomove.Serial == item.Serial)
                                    {
                                        continue;
                                    }

                                    if (!itemtomove.Movable)
                                    {
                                        continue;
                                    }

                                    RazorEnhanced.Dress.AddLog("Item 0x" + itemtomove.Serial.Value.ToString("X8") + " on Layer: " + item.Layer.ToString() + " undressed!");
                                    RazorEnhanced.Items.Move(itemtomove.Serial, undressbagserial, 0);
                                    Thread.Sleep(mseconds);
                                    RazorEnhanced.Player.EquipItem(item.Serial);
                                    RazorEnhanced.Dress.AddLog("Item 0x" + item.Serial.ToString("X8") + " Equipped on layer: " + item.Layer.ToString());
                                    Thread.Sleep(mseconds);
                                }
                                else
                                {
                                    RazorEnhanced.Player.EquipItem(item.Serial);
                                    RazorEnhanced.Dress.AddLog("Item 0x" + item.Serial.ToString("X8") + " Equipped on layer: " + item.Layer.ToString());
                                    Thread.Sleep(mseconds);
                                }
                            }
                            else
                            {
                                Assistant.Item itemtomove = Assistant.World.Player.GetItemOnLayer(item.Layer);
                                if (itemtomove != null)
                                {
                                    continue;
                                }

                                RazorEnhanced.Dress.AddLog("Item 0x" + item.Serial.ToString("X8") + " Equipped on layer: " + item.Layer.ToString());
                                RazorEnhanced.Player.EquipItem(item.Serial);
                                Thread.Sleep(mseconds);
                            }
                        }
                    }
                }
                RazorEnhanced.Dress.AddLog("Finish!");
                if (Assistant.Engine.MainWindow.ShowAgentMessageCheckBox.Checked)
                {
                    RazorEnhanced.Misc.SendMessage("Enhanced Dress: Finish!", 945, true);
                }
                Assistant.Engine.MainWindow.UndressFinishWork();
            }

            catch { }
        }
示例#11
0
        private static void OnVendorSell(PacketReader pvSrc, PacketHandlerEventArgs args)
        {
            if (!Engine.MainWindow.SellCheckBox.Checked)             // Filtro disabilitato
            {
                return;
            }

            Assistant.Item bag = new Assistant.Item(SellBag);
            if (bag == null)             // Verifica HotBag
            {
                AddLog("Invalid or not accessible Container");
                return;
            }

            int  total  = 0;
            uint serial = pvSrc.ReadUInt32();

            Assistant.Mobile vendor = Assistant.World.FindMobile(serial);
            if (vendor == null)
            {
                Assistant.World.AddMobile(vendor = new Assistant.Mobile(serial));
            }

            int count = pvSrc.ReadUInt16();

            if (count == 0)             // Il vendor non compra nulla
            {
                return;
            }

            int sold = 0;

            List <Assistant.SellListItem> list = new List <Assistant.SellListItem>(count);                              // Lista item checkati per vendita (non so dove sia dichiarata)
            List <RazorEnhanced.SellAgent.SellAgentItem> templist = new List <RazorEnhanced.SellAgent.SellAgentItem>(); // Lista temporanea per controlli amount

            AddLog("Container: 0x" + SellBag.ToString("X8"));

            for (int i = 0; i < count; i++)             // Scansione item in lista menu vendor
            {
                uint   ser    = pvSrc.ReadUInt32();
                ushort gfx    = pvSrc.ReadUInt16();
                ushort hue    = pvSrc.ReadUInt16();
                ushort amount = pvSrc.ReadUInt16();
                ushort price  = pvSrc.ReadUInt16();
                pvSrc.ReadString(pvSrc.ReadUInt16());                 //name

                Assistant.Item item = Assistant.World.FindItem(ser);

                List <SellAgent.SellAgentItem> items = Settings.SellAgent.ItemsRead(SellListName);

                foreach (SellAgentItem sellItem in items)                 // Scansione item presenti in lista agent item
                {
                    if (!sellItem.Selected)
                    {
                        continue;
                    }

                    if (gfx != sellItem.Graphics || (item == null || item == bag || !item.IsChildOf(bag)) || !RazorEnhanced.SellAgent.ColorCheck(sellItem.Color, hue))
                    {
                        continue;
                    }

                    int  amountLeft  = int.MaxValue;
                    int  index       = 0;
                    bool alreadySold = false;

                    for (int y = 0; y < templist.Count; y++)                     // Controllo che non ho gia venduto item simili
                    {
                        if (templist[y].Graphics != gfx || !RazorEnhanced.SellAgent.ColorCheck(templist[y].Color, hue))
                        {
                            continue;
                        }

                        alreadySold = true;
                        amountLeft  = templist[y].Amount;
                        index       = y;
                    }

                    if (amountLeft == int.MaxValue)                     // Valore limite e inizzializzazione
                    {
                        amountLeft = sellItem.Amount;
                    }

                    if (amountLeft <= 0)
                    {
                        continue;
                    }

                    if (alreadySold)                     // Gia venduto oggetto stessa grafica
                    {
                        AddLog("Item match: 0x" + sellItem.Graphics.ToString("X4") + " - Amount: " + sellItem.Amount);
                        if (amount < amountLeft)                                // In caso che quella listata nel vendor sia minore di quella che voglio vendere vendo il massimo possibile
                        {
                            int amountTemp = amountLeft - amount;
                            list.Add(new SellListItem(ser, amount));                                        // Lista processo vendita
                            templist.RemoveAt(index);
                            templist.Insert(index, new SellAgentItem(sellItem.Name, gfx, amountTemp, sellItem.Color, sellItem.Selected));
                            total += amount * price;
                            sold  += amount;
                        }
                        else                                                               // Caso che quella listata nel vendor sia maggiore vendo solo quella mancante
                        {
                            list.Add(new SellListItem(ser, Convert.ToUInt16(amountLeft))); // Lista processo vendita
                            templist.RemoveAt(index);
                            templist.Insert(index, new SellAgentItem(sellItem.Name, gfx, 0, sellItem.Color, sellItem.Selected));
                            total += amountLeft * price;
                            sold  += amountLeft;
                        }
                    }
                    else                     // Mai venduto oggetto stessa grafica
                    {
                        AddLog("Item match: 0x" + sellItem.Graphics.ToString("X4") + " - Amount: " + sellItem.Amount);
                        if (amount < sellItem.Amount)                         // In caso che quella listata nel vendor sia minore di quella che voglio vendere vendo il massimo possibile
                        {
                            list.Add(new SellListItem(ser, amount));          // Lista processo vendita
                            templist.Add(new SellAgentItem(sellItem.Name, gfx, (sellItem.Amount - amount), sellItem.Color, sellItem.Selected));
                            total += amount * price;
                            sold  += amount;
                        }
                        else                                                                    // Caso che quella listata nel vendor sia maggiore vendo solo quella mancante
                        {
                            list.Add(new SellListItem(ser, Convert.ToUInt16(sellItem.Amount))); // Lista processo vendita
                            templist.Add(new SellAgentItem(sellItem.Name, gfx, 0, sellItem.Color, sellItem.Selected));
                            total += sellItem.Amount * price;
                            sold  += sellItem.Amount;
                        }
                    }
                }
            }

            if (list.Count <= 0)
            {
                return;
            }

            Assistant.Client.Instance.SendToServer(new VendorSellResponse(vendor, list));
            AddLog("Sold " + sold.ToString() + " items for " + total.ToString() + " gold coins");
            string message = "Enhanced Sell Agent: sold " + sold.ToString() + " items for " + total.ToString() + " gold coins";

            World.Player.Journal.Enqueue(new RazorEnhanced.Journal.JournalEntry(message, "System", 1, "Vendor", vendor.Serial));                      // Journal buffer
            World.Player.SendMessage(message);
            args.Block = true;
        }
示例#12
0
        private static void DisplayBuy(PacketReader p, PacketHandlerEventArgs args)
        {
            if (!Engine.MainWindow.BuyCheckBox.Checked)             // Filtro disabilitato
            {
                return;
            }

            Assistant.Serial serial = p.ReadUInt32();
            ushort           gump   = p.ReadUInt16();

            Assistant.Mobile vendor = Assistant.World.FindMobile(serial);
            if (vendor == null)
            {
                return;
            }

            Assistant.Item pack = vendor.GetItemOnLayer(Layer.ShopBuy);
            if (pack == null || pack.Contains == null || pack.Contains.Count <= 0)
            {
                return;
            }

            int total = 0;
            int cost  = 0;
            List <Assistant.VendorBuyItem> buyList = new List <Assistant.VendorBuyItem>();           // Lista definita altrove (non rimuovere se si fa pulizia in giro)

            for (int i = 0; i < pack.Contains.Count; i++)
            {
                if (pack.Contains[i] == null)
                {
                    continue;
                }

                List <BuyAgent.BuyAgentItem> items = Settings.BuyAgent.ItemsRead(m_listname);

                foreach (BuyAgentItem buyItem in items)                 // Scansione item presenti in lista agent item
                {
                    if (!buyItem.Selected)
                    {
                        continue;
                    }

                    if (buyItem.Graphics != pack.Contains[i].ItemID || !RazorEnhanced.BuyAgent.ColorCheck(buyItem.Color, pack.Contains[i].Hue))
                    {
                        continue;
                    }

                    if (pack.Contains[i].Amount >= buyItem.Amount)                     // Caso che il vendor abbia piu' item di quelli richiesti
                    {
                        AddLog("Item match: 0x" + buyItem.Graphics.ToString("X4") + " - Amount: " + pack.Contains[i].Amount + " - Buyed: " + buyItem.Amount);
                        buyList.Add(new VendorBuyItem(pack.Contains[i].Serial, buyItem.Amount, pack.Contains[i].Price));
                        total += buyItem.Amount;
                        cost  += pack.Contains[i].Price * buyItem.Amount;
                    }
                    else                     // Caso che il vendor ne abbia di meno (Li compro tutti)
                    {
                        AddLog("Item match: 0x" + buyItem.Graphics.ToString("X4") + " - Amount: " + pack.Contains[i].Amount + " - Buyed: " + pack.Contains[i].Amount);
                        buyList.Add(new VendorBuyItem(pack.Contains[i].Serial, pack.Contains[i].Amount, pack.Contains[i].Price));
                        total += pack.Contains[i].Amount;
                        cost  += pack.Contains[i].Price * pack.Contains[i].Amount;
                    }
                }
            }

            if (buyList.Count <= 0)
            {
                return;
            }

            args.Block = true;
            Assistant.Client.Instance.SendToServer(new VendorBuyResponse(serial, buyList));

            string message = "Enhanced Buy Agent: bought " + total.ToString() + " items for " + cost.ToString() + " gold coins";

            World.Player.Journal.Enqueue(new RazorEnhanced.Journal.JournalEntry(message, "System", 1, "Vendor", vendor.Serial));                      // Journal buffer
            World.Player.SendMessage(message);
            AddLog("Bought " + total.ToString() + " items for " + cost.ToString() + " gold coins");
        }
示例#13
0
文件: Dress.cs 项目: mozkandemir/RE
        // Dress

        internal static int DressEngine(List <Dress.DressItem> items, int mseconds, int undressbagserial, bool conflict)
        {
            if (RazorEnhanced.Settings.General.ReadBool("UO3dEquipUnEquip"))
            {
                List <uint> itemserial = new List <uint>();

                foreach (DressItem oggettolista in items)
                {
                    itemserial.Add((uint)oggettolista.Serial);
                }

                if (itemserial.Count > 0)
                {
                    RazorEnhanced.Dress.AddLog("Dressing...");
                    ClientCommunication.SendToServerWait(new EquipItemMacro(itemserial));
                }
            }
            else
            {
                foreach (DressItem oggettolista in items)
                {
                    if (!oggettolista.Selected)
                    {
                        continue;
                    }

                    if (oggettolista.Name == "UNDRESS")                              // Caso undress slot
                    {
                        Assistant.Item itemtomove = Assistant.World.Player.GetItemOnLayer(LayerNumberToLayer(oggettolista.Layer));

                        if (itemtomove == null)
                        {
                            continue;
                        }

                        if (!itemtomove.Movable)
                        {
                            continue;
                        }

                        RazorEnhanced.Dress.AddLog("Item 0x" + itemtomove.Serial.Value.ToString("X8") + " on Layer: " + LayerIntToLayerString(oggettolista.Layer) + " undressed!");
                        RazorEnhanced.Items.Move(itemtomove.Serial, undressbagserial, 0);
                        Thread.Sleep(mseconds);
                    }
                    else
                    {
                        if (World.FindItem(oggettolista.Serial) == null)
                        {
                            continue;
                        }

                        if (conflict)                               // Caso abilitato controllo conflitto
                        {
                            Assistant.Item itemonlayer = Assistant.World.Player.GetItemOnLayer(World.FindItem(oggettolista.Serial).Layer);
                            if (itemonlayer != null)
                            {
                                if (itemonlayer.Serial == oggettolista.Serial)
                                {
                                    continue;
                                }
                            }

                            if (World.FindItem(oggettolista.Serial).Layer == Layer.RightHand || World.FindItem(oggettolista.Serial).Layer == Layer.LeftHand)                                    // Check armi per controlli twohand
                            {
                                Assistant.Item lefth  = Assistant.World.Player.GetItemOnLayer(Layer.LeftHand);
                                Assistant.Item righth = Assistant.World.Player.GetItemOnLayer(Layer.RightHand);

                                if (Assistant.World.FindItem(oggettolista.Serial).IsTwoHanded)
                                {
                                    if (lefth != null && lefth.Movable)
                                    {
                                        RazorEnhanced.Dress.AddLog("Item 0x" + lefth.Serial.Value.ToString("X8") + " on Layer: " + LayerIntToLayerString(LayerLayerToInt(Layer.LeftHand)) + " undressed!");
                                        RazorEnhanced.Items.Move(lefth.Serial, undressbagserial, 0);
                                        Thread.Sleep(mseconds);
                                    }
                                    if (righth != null && righth.Movable)
                                    {
                                        RazorEnhanced.Dress.AddLog("Item 0x" + righth.Serial.Value.ToString("X8") + " on Layer: " + LayerIntToLayerString(LayerLayerToInt(Layer.RightHand)) + " undressed!");
                                        RazorEnhanced.Items.Move(righth.Serial, undressbagserial, 0);
                                        Thread.Sleep(mseconds);
                                    }
                                }
                                else if ((lefth != null && lefth.IsTwoHanded) || (righth != null && righth.IsTwoHanded))
                                {
                                    if (lefth != null && lefth.Movable)
                                    {
                                        RazorEnhanced.Dress.AddLog("Item 0x" + lefth.Serial.Value.ToString("X8") + " on Layer: " + LayerIntToLayerString(LayerLayerToInt(Layer.LeftHand)) + " undressed!");
                                        RazorEnhanced.Items.Move(lefth.Serial, undressbagserial, 0);
                                        Thread.Sleep(mseconds);
                                    }
                                    if (righth != null && righth.Movable)
                                    {
                                        RazorEnhanced.Dress.AddLog("Item 0x" + righth.Serial.Value.ToString("X8") + " on Layer: " + LayerIntToLayerString(LayerLayerToInt(Layer.RightHand)) + " undressed!");
                                        RazorEnhanced.Items.Move(righth.Serial, undressbagserial, 0);
                                        Thread.Sleep(mseconds);
                                    }
                                }
                            }

                            Assistant.Item itemtomove = Assistant.World.Player.GetItemOnLayer(LayerNumberToLayer(oggettolista.Layer));
                            if (itemtomove != null)
                            {
                                if (itemtomove.Serial == oggettolista.Serial)
                                {
                                    continue;
                                }

                                if (!itemtomove.Movable)
                                {
                                    continue;
                                }

                                RazorEnhanced.Dress.AddLog("Item 0x" + itemtomove.Serial.Value.ToString("X8") + " on Layer: " + LayerIntToLayerString(oggettolista.Layer) + " undressed!");
                                RazorEnhanced.Items.Move(itemtomove.Serial, undressbagserial, 0);
                                Thread.Sleep(mseconds);
                                RazorEnhanced.Player.EquipItem(oggettolista.Serial);
                                RazorEnhanced.Dress.AddLog("Item 0x" + oggettolista.Serial.ToString("X8") + " Equipped on layer: " + LayerIntToLayerString(oggettolista.Layer));
                                Thread.Sleep(mseconds);
                            }
                            else
                            {
                                RazorEnhanced.Player.EquipItem(oggettolista.Serial);
                                RazorEnhanced.Dress.AddLog("Item 0x" + oggettolista.Serial.ToString("X8") + " Equipped on layer: " + LayerIntToLayerString(oggettolista.Layer));
                                Thread.Sleep(mseconds);
                            }
                        }
                        else
                        {
                            Assistant.Item itemtomove = Assistant.World.Player.GetItemOnLayer(LayerNumberToLayer(oggettolista.Layer));
                            if (itemtomove != null)
                            {
                                continue;
                            }

                            RazorEnhanced.Dress.AddLog("Item 0x" + oggettolista.Serial.ToString("X8") + " Equipped on layer: " + LayerIntToLayerString(oggettolista.Layer));
                            RazorEnhanced.Player.EquipItem(oggettolista.Serial);
                            Thread.Sleep(mseconds);
                        }
                    }
                }
            }
            RazorEnhanced.Dress.AddLog("Finish!");
            RazorEnhanced.Misc.SendMessage("Enhanced Dress: Finish!", 945);
            Assistant.Engine.MainWindow.UndressFinishWork();
            return(0);
        }
        //	internal static volatile bool HoldingItem = false;

        internal static void AutoRun()
        {
            if (World.Player == null || !Client.Running)
            {
                return;
            }

            if (World.Player.IsGhost)
            {
                Thread.Sleep(2000);
                return;
            }

            bool lootHidden = RazorEnhanced.Settings.General.ReadBool("AllowHiddenLooting");

            if (AutoLootSerialCorpseRefresh.Count > 0 &&
                Assistant.Engine.MainWindow.AutolootCheckBox.Checked &&
                !Targeting.HasTarget &&
                (Player.Visible || lootHidden))
            {
                try
                {
                    if (AutoLootSerialCorpseRefresh.TryPeek(out int itemserial))
                    {
                        Assistant.Item item = Assistant.World.FindItem(itemserial);

                        if (item == null)
                        {
                            AutoLootSerialCorpseRefresh.TryDequeue(out itemserial);
                            return;
                        }

                        if (Utility.Distance(World.Player.Position.X, World.Player.Position.Y, item.Position.X, item.Position.Y) <= AutoLoot.MaxRange && CheckZLevel(item.Position.Z, World.Player.Position.Z))
                        {
                            RazorEnhanced.Items.WaitForContents(Items.FindBySerial(itemserial), 1000);
                            AutoLoot.AddLog("- Refresh Corpse: 0x" + itemserial.ToString("X8"));
                            Thread.Sleep(AutoLoot.AutoLootDelay);
                            if (item.Updated)
                            {
                                AutoLootSerialCorpseRefresh.TryDequeue(out itemserial);
                            }
                        }
                        else
                        {
                            AutoLootSerialCorpseRefresh.TryDequeue(out itemserial);
                            AutoLootSerialCorpseRefresh.Enqueue(itemserial);
                        }
                    }
                }
                catch { }
            }
            uint lootbag = AutoLoot.GetLootBag();

            // at login, backpack is sometimes null
            if (lootbag != 0)
            {
                ProcessLootList(lootbag);
            }

            if (ScavengerSerialToGrab.Count > 0 && Assistant.Engine.MainWindow.ScavengerCheckBox.Checked)
            {
                try
                {
                    if (ScavengerSerialToGrab.TryPeek(out int itemserial))
                    {
                        Assistant.Item item = Assistant.World.FindItem(itemserial);

                        if (item == null)
                        {
                            ScavengerSerialToGrab.TryDequeue(out itemserial);
                            return;
                        }

                        if (item.IsLootableTarget)
                        {
                            ScavengerSerialToGrab.TryDequeue(out itemserial);
                            return;
                        }

                        if (Utility.Distance(World.Player.Position.X, World.Player.Position.Y, item.Position.X, item.Position.Y) <= Scavenger.MaxRange && CheckZLevel(item.Position.Z, World.Player.Position.Z))
                        {
                            if ((World.Player.MaxWeight - World.Player.Weight) < 5)
                            {
                                RazorEnhanced.Scavenger.AddLog("- Max weight reached, Wait untill free some space");
                                RazorEnhanced.Misc.SendMessage("SCAVENGER: Max weight reached, Wait untill free some space", true);
                                Thread.Sleep(2000);
                            }
                            else
                            {
                                RazorEnhanced.Scavenger.AddLog("- Item Match found (" + item.Serial.ToString() + ") ... Grabbing");
                                RazorEnhanced.Items.Move(item.Serial, Convert.ToInt32(Scavenger.GetScavengerBag()), 0);
                                Thread.Sleep(Scavenger.ScavengerDelay);
                                ScavengerSerialToGrab.TryDequeue(out itemserial);
                            }
                        }
                        else
                        {
                            ScavengerSerialToGrab.TryDequeue(out itemserial);
                            ScavengerSerialToGrab.Enqueue(itemserial);
                        }
                    }
                }
                catch { }
            }

            if (CorpseToCutSerial.Count > 0 && Filters.AutoCarver)
            {
                try
                {
                    if (CorpseToCutSerial.TryPeek(out int itemserial))
                    {
                        Assistant.Item item = Assistant.World.FindItem(itemserial);

                        if (item == null)
                        {
                            CorpseToCutSerial.TryDequeue(out itemserial);
                            return;
                        }

                        if (Utility.Distance(World.Player.Position.X, World.Player.Position.Y, item.Position.X, item.Position.Y) <= 1 && CheckZLevel(item.Position.Z, World.Player.Position.Z))
                        {
                            Items.UseItem(Items.FindBySerial(Filters.AutoCarverBlade));
                            Target.WaitForTarget(1000, true);
                            Target.TargetExecute(item.Serial);
                            Items.Message(item.Serial, 10, "*Cutting*");
                            CorpseToCutSerial.TryDequeue(out itemserial);
                            Thread.Sleep(RazorEnhanced.Settings.General.ReadInt("ObjectDelay"));
                        }
                        else
                        {
                            CorpseToCutSerial.TryDequeue(out itemserial);
                            CorpseToCutSerial.Enqueue(itemserial);
                        }
                    }
                }
                catch { }
            }
            Thread.Sleep(250);
        }
示例#15
0
文件: Dress.cs 项目: mozkandemir/RE
        // Undress

        internal static int UndressEngine(int mseconds, int undressbagserial)
        {
            List <int>    itemtoundress  = new List <int>();
            List <ushort> layertoundress = new List <ushort>();

            Assistant.Item itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.RightHand);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.RightHand);
                itemtoundress.Add(itemtomove.Serial);
            }

            itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.LeftHand);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.LeftHand);
                itemtoundress.Add(itemtomove.Serial);
            }

            itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.Shoes);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.Shoes);
                itemtoundress.Add(itemtomove.Serial);
            }

            itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.Pants);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.Pants);
                itemtoundress.Add(itemtomove.Serial);
            }

            itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.Shirt);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.Shirt);
                itemtoundress.Add(itemtomove.Serial);
            }

            itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.Head);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.Head);
                itemtoundress.Add(itemtomove.Serial);
            }

            itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.Gloves);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.Gloves);
                itemtoundress.Add(itemtomove.Serial);
            }

            itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.Ring);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.Ring);
                itemtoundress.Add(itemtomove.Serial);
            }

            itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.Neck);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.Neck);
                itemtoundress.Add(itemtomove.Serial);
            }

            itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.Waist);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.Waist);
                itemtoundress.Add(itemtomove.Serial);
            }

            itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.InnerTorso);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.InnerTorso);
                itemtoundress.Add(itemtomove.Serial);
            }

            itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.Bracelet);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.Bracelet);
                itemtoundress.Add(itemtomove.Serial);
            }

            itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.MiddleTorso);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.MiddleTorso);
                itemtoundress.Add(itemtomove.Serial);
            }

            itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.Earrings);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.Earrings);
                itemtoundress.Add(itemtomove.Serial);
            }

            itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.Arms);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.Arms);
                itemtoundress.Add(itemtomove.Serial);
            }

            itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.Cloak);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.Cloak);
                itemtoundress.Add(itemtomove.Serial);
            }

            itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.OuterTorso);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.OuterTorso);
                itemtoundress.Add(itemtomove.Serial);
            }

            itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.OuterLegs);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.OuterLegs);
                itemtoundress.Add(itemtomove.Serial);
            }

            itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.InnerLegs);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.InnerLegs);
                itemtoundress.Add(itemtomove.Serial);
            }

            itemtomove = Assistant.World.Player.GetItemOnLayer(Layer.Unused_x9);
            if (itemtomove != null && itemtomove.Movable)
            {
                layertoundress.Add((ushort)Layer.Unused_x9);
                itemtoundress.Add(itemtomove.Serial);
            }

            if (itemtoundress.Count > 0)
            {
                if (RazorEnhanced.Settings.General.ReadBool("UO3dEquipUnEquip"))
                {
                    RazorEnhanced.Dress.AddLog("UnDressing...");
                    ClientCommunication.SendToServerWait(new UnEquipItemMacro(layertoundress));
                }
                else
                {
                    foreach (int serial in itemtoundress)
                    {
                        RazorEnhanced.Dress.AddLog("Item 0x" + serial.ToString("X8") + " undressed!");
                        RazorEnhanced.Items.Move(serial, undressbagserial, 0);
                        Thread.Sleep(mseconds);
                    }
                }
            }
            RazorEnhanced.Dress.AddLog("Finish!");
            RazorEnhanced.Misc.SendMessage("Enhanced UnDress: Finish!");
            Assistant.Engine.MainWindow.UndressFinishWork();
            return(0);
        }
示例#16
0
文件: Dress.cs 项目: mozkandemir/RE
        internal static void ReadPlayerDress()
        {
            RazorEnhanced.Settings.Dress.ItemClear(Assistant.Engine.MainWindow.DressListSelect.Text);

            Assistant.Item layeritem = Assistant.World.Player.GetItemOnLayer(Layer.RightHand);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 0, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.LeftHand);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 1, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Shoes);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 2, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Pants);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 3, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Shirt);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 4, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Head);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 5, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Gloves);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 6, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Ring);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 7, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Neck);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 8, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Waist);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 9, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.InnerTorso);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 10, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Bracelet);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 11, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.MiddleTorso);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 12, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Earrings);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 13, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Arms);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 14, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Cloak);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 15, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.OuterTorso);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 16, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.OuterLegs);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 17, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.InnerLegs);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 18, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }

            layeritem = Assistant.World.Player.GetItemOnLayer(Layer.Unused_x9);
            if (layeritem != null)
            {
                RazorEnhanced.Dress.DressItem itemtoinsert = new DressItem(layeritem.Name, 19, layeritem.Serial, true);
                RazorEnhanced.Settings.Dress.ItemInsert(Assistant.Engine.MainWindow.DressListSelect.Text, itemtoinsert);
            }
            RazorEnhanced.Dress.RefreshItems();
        }
示例#17
0
        internal static Packet MobileIncomingItemColorize(Packet p, Assistant.Mobile m, bool newmobincoming, Assistant.Item item = null)
        {
            int ltHue = Engine.MainWindow.LTHilight;

            if (newmobincoming)
            {
                if (ltHue != 0 && Targeting.IsLastTarget(m))
                {
                    p = RewriteColor(p, (ushort)ltHue);
                }
                else
                {
                    // Blocco Color Highlight flag
                    if ((m != World.Player && Engine.MainWindow.ColorFlagsHighlightCheckBox.Checked) || (m == World.Player && Engine.MainWindow.ColorFlagsSelfHighlightCheckBox.Checked))
                    {
                        if (m.Poisoned)
                        {
                            p = RewriteColor(p, (ushort)HighLightColor.Poison);
                        }

                        else if (m.Paralized)
                        {
                            p = RewriteColor(p, (ushort)HighLightColor.Paralized);
                        }

                        else if (m.Blessed)                         // Mortal
                        {
                            p = RewriteColor(p, (ushort)HighLightColor.Mortal);
                        }
                    }
                }
            }
            else
            {
                if (m.IsGhost)                 // Non eseguire azione se fantasma
                {
                    return(p);
                }

                if (ltHue != 0 && Targeting.IsLastTarget(m))
                {
                    Assistant.Client.Instance.SendToClient(new EquipmentItem(item, (ushort)(ltHue & 16383), m.Serial));
                }
                else
                {
                    int color = 0;
                    if (m.Poisoned)
                    {
                        color = (int)HighLightColor.Poison;
                    }
                    else if (m.Paralized)
                    {
                        color = (int)HighLightColor.Paralized;
                    }
                    else if (m.Blessed)                     // Mortal
                    {
                        color = (int)HighLightColor.Mortal;
                    }

                    if (color != 0)
                    {
                        Assistant.Client.Instance.SendToClient(new EquipmentItem(item, (ushort)color, m.Serial));
                    }
                }
            }
            return(p);
        }
示例#18
0
        internal static bool MakeWallStatic(Assistant.Item wall)
        {
            switch (wall.ItemID)
            {
            case 0x0080:
            case 0x0082:
                wall.ItemID = WallStaticIDStone;
                wall.Hue    = (ushort)WallColor.Stone;
                Assistant.Client.Instance.SendToClient(new WorldItem(wall));
                if (Engine.MainWindow.ShowMessageFieldCheckBox.Checked)
                {
                    Assistant.Client.Instance.SendToClient(new UnicodeMessage(wall.Serial, wall.ItemID, MessageType.Regular, (ushort)WallColor.Stone, 3,
                                                                              Language.CliLocName, wall.Name, "[Wall Of Stone]"));
                }
                return(true);

            case 0x3996:
            case 0x398C:
                wall.ItemID = WallStaticID;
                wall.Hue    = (ushort)WallColor.Fire;
                Assistant.Client.Instance.SendToClient(new WorldItem(wall));
                if (Engine.MainWindow.ShowMessageFieldCheckBox.Checked)
                {
                    Assistant.Client.Instance.SendToClient(new UnicodeMessage(wall.Serial, wall.ItemID, MessageType.Regular, (ushort)WallColor.Fire, 3, Language.CliLocName, wall.Name, "[Fire Field]"));
                }
                return(true);

            case 0x3915:
            case 0x3920:
            case 0x3922:
                wall.ItemID = WallStaticID;
                wall.Hue    = (ushort)WallColor.Poison;
                Assistant.Client.Instance.SendToClient(new WorldItem(wall));
                if (Engine.MainWindow.ShowMessageFieldCheckBox.Checked)
                {
                    Assistant.Client.Instance.SendToClient(new UnicodeMessage(wall.Serial, wall.ItemID, MessageType.Regular, (ushort)WallColor.Poison, 3, Language.CliLocName, wall.Name, "[Poison Field]"));
                }
                return(true);

            case 0x3967:
            case 0x3979:
                wall.ItemID = WallStaticID;
                wall.Hue    = (ushort)WallColor.Paralyze;
                Assistant.Client.Instance.SendToClient(new WorldItem(wall));
                if (Engine.MainWindow.ShowMessageFieldCheckBox.Checked)
                {
                    Assistant.Client.Instance.SendToClient(new UnicodeMessage(wall.Serial, wall.ItemID, MessageType.Regular, (ushort)WallColor.Paralyze, 3, Language.CliLocName, wall.Name, "[Paralyze Field]"));
                }
                return(true);

            case 0x3946:
            case 0x3956:
                wall.ItemID = WallStaticID;
                wall.Hue    = (ushort)WallColor.Energy;
                Assistant.Client.Instance.SendToClient(new WorldItem(wall));
                if (Engine.MainWindow.ShowMessageFieldCheckBox.Checked)
                {
                    Assistant.Client.Instance.SendToClient(new UnicodeMessage(wall.Serial, wall.ItemID, MessageType.Regular, (ushort)WallColor.Energy, 3, Language.CliLocName, wall.Name, "[Energy Field]"));
                }
                return(true);

            default:
                return(false);
            }
        }
        internal static void ProcessLootList(uint lootbag)
        {
            if (Monitor.TryEnter(autolootLock))
            {
                try
                {
                    bool lootHidden = RazorEnhanced.Settings.General.ReadBool("AllowHiddenLooting");

                    if ((Player.Visible || lootHidden) && AutoLoot.SerialToGrabList.Count > 0)
                    {
                        try
                        {
                            if (AutoLoot.SerialToGrabList.TryPeek(out AutoLoot.SerialToGrab data))
                            {
                                Assistant.Item item = Assistant.World.FindItem(data.ItemSerial);

                                if (item == null)
                                {
                                    AutoLoot.SerialToGrabList.TryDequeue(out data);
                                    return;
                                }

                                if (item.IsLootableTarget)
                                {
                                    AutoLoot.SerialToGrabList.TryDequeue(out data);
                                    return;
                                }

                                Assistant.Item corpse = Assistant.World.FindItem(data.CorpseSerial);

                                if (corpse == null)
                                {
                                    AutoLoot.SerialToGrabList.TryDequeue(out data);
                                    return;
                                }

                                if (Utility.Distance(World.Player.Position.X, World.Player.Position.Y, corpse.Position.X, corpse.Position.Y) <= AutoLoot.MaxRange && CheckZLevel(corpse.Position.Z, World.Player.Position.Z))
                                {
                                    if ((World.Player.MaxWeight - World.Player.Weight) < 5)
                                    {
                                        RazorEnhanced.AutoLoot.AddLog("- Max weight reached, Wait untill free some space");
                                        RazorEnhanced.Misc.SendMessage("AUTOLOOT: Max weight reached, Wait untill free some space", true);
                                        Thread.Sleep(2000);
                                    }
                                    else
                                    {
                                        RazorEnhanced.AutoLoot.AddLog("- Item Match found (" + item.Name.ToString() + ") ... Looting");
                                        int            lootBagOverride = data.DestContainerOverride;
                                        Assistant.Item destCont        = Assistant.World.FindItem(data.DestContainerOverride);
                                        if (destCont != null)
                                        {
                                            RazorEnhanced.Items.Move(item.Serial, Convert.ToInt32(lootBagOverride), 0);
                                        }
                                        else
                                        {
                                            RazorEnhanced.Items.Move(item.Serial, Convert.ToInt32(lootbag), 0);
                                        }
                                        Thread.Sleep(AutoLoot.AutoLootDelay);
                                        AutoLoot.SerialToGrabList.TryDequeue(out data);
                                    }
                                }
                                else
                                {
                                    AutoLoot.SerialToGrabList.TryDequeue(out data);
                                    AutoLoot.SerialToGrabList.Enqueue(data);
                                }
                            }
                        }
                        catch { }
                    }
                }
                finally
                {
                    Monitor.Exit(autolootLock);
                }
            }
        }