Esempio n. 1
0
		internal static void Record_EquipRequest(Assistant.Item item, Assistant.Layer l, Assistant.Mobile m)
		{
			if (m == World.Player)
				AddLog("Player.EquipItem(0x"+ item.Serial.Value.ToString("X8") + ")");
			else
				AddLog("Player.UnEquipItemByLayer("+ l.ToString() + ")");
		}
Esempio n. 2
0
 /// <summary>
 /// Returns the Item associated with a Mobile Layer.
 /// </summary>
 /// <param name="layer">
 /// Layers:
 ///    Layername
 ///    RightHand
 ///    LeftHand
 ///    Shoes
 ///    Pants
 ///    Shirt
 ///    Head
 ///    Gloves
 ///    Ring
 ///    Neck
 ///    Waist
 ///    InnerTorso
 ///    Bracelet
 ///    MiddleTorso
 ///    Earrings
 ///    Arms
 ///    Cloak
 ///    OuterTorso
 ///    OuterLegs
 ///    InnerLegs
 /// </param>
 /// <returns>Item for the layer. Return null if not found or Layer invalid.</returns>
 public Item GetItemOnLayer(string layer)
 {
     Assistant.Layer assistantLayer = GetAssistantLayer(layer);
     if (assistantLayer != Assistant.Layer.Invalid)
     {
         Assistant.Item assistantItem = m_AssistantMobile.GetItemOnLayer(assistantLayer);
         if (assistantItem == null)
         {
             return(null);
         }
         else
         {
             RazorEnhanced.Item enhancedItem = new RazorEnhanced.Item(assistantItem);
             return(enhancedItem);
         }
     }
     else
     {
         return(null);
     }
 }
Esempio n. 3
0
        private static Assistant.Layer GetAssistantLayer(string layer)
        {
            Assistant.Layer result = Assistant.Layer.Invalid;

            switch (layer)
            {
            case "RightHand":
                result = Assistant.Layer.RightHand;
                break;

            case "LeftHand":
                result = Assistant.Layer.LeftHand;
                break;

            case "Shoes":
                result = Assistant.Layer.Shoes;
                break;

            case "Pants":
                result = Assistant.Layer.Pants;
                break;

            case "Shirt":
                result = Assistant.Layer.Shirt;
                break;

            case "Head":
                result = Assistant.Layer.Head;
                break;

            case "Gloves":
                result = Assistant.Layer.Gloves;
                break;

            case "Ring":
                result = Assistant.Layer.Ring;
                break;

            case "Neck":
                result = Assistant.Layer.Neck;
                break;

            case "Hair":
                result = Assistant.Layer.Hair;
                break;

            case "Waist":
                result = Assistant.Layer.Waist;
                break;

            case "InnerTorso":
                result = Assistant.Layer.InnerTorso;
                break;

            case "Bracelet":
                result = Assistant.Layer.Bracelet;
                break;

            case "FacialHair":
                result = Assistant.Layer.FacialHair;
                break;

            case "MiddleTorso":
                result = Assistant.Layer.MiddleTorso;
                break;

            case "Earrings":
                result = Assistant.Layer.Earrings;
                break;

            case "Arms":
                result = Assistant.Layer.Arms;
                break;

            case "Cloak":
                result = Assistant.Layer.Cloak;
                break;

            case "OuterTorso":
                result = Assistant.Layer.OuterTorso;
                break;

            case "OuterLegs":
                result = Assistant.Layer.OuterLegs;
                break;

            case "InnerLegs":
                result = Assistant.Layer.InnerLegs;
                break;

            default:
                result = Assistant.Layer.Invalid;
                break;
            }

            return(result);
        }
Esempio n. 4
0
        public static List <Item> ApplyFilter(Filter filter)
        {
            List <Item> result = new List <Item>();

            List <Assistant.Item> assistantItems = Assistant.World.Items.Values.ToList();

            if (filter.Enabled)
            {
                if (filter.Serials.Count > 0)
                {
                    assistantItems = assistantItems.Where((i) => filter.Serials.Contains((int)i.Serial.Value)).ToList();
                }
                else
                {
                    if (filter.Name != "")
                    {
                        Regex rgx = new Regex(filter.Name, RegexOptions.IgnoreCase);
                        List <Assistant.Item> list = new List <Assistant.Item>();
                        foreach (Assistant.Item i in assistantItems)
                        {
                            if (rgx.IsMatch(i.Name))
                            {
                                list.Add(i);
                            }
                        }
                        assistantItems = list;
                    }

                    if (filter.Graphics.Count > 0)
                    {
                        assistantItems = assistantItems.Where((i) => filter.Graphics.Contains(i.ItemID.Value)).ToList();
                    }

                    if (filter.Hues.Count > 0)
                    {
                        assistantItems = assistantItems.Where((i) => filter.Hues.Contains(i.Hue)).ToList();
                    }

                    if (filter.RangeMin != -1)
                    {
                        assistantItems = assistantItems.Where((i) =>
                                                              Utility.DistanceSqrt
                                                                  (new Assistant.Point2D(Assistant.World.Player.Position.X, Assistant.World.Player.Position.Y), new Assistant.Point2D(i.Position.X, i.Position.Y)) >= filter.RangeMin
                                                              ).ToList();
                    }

                    if (filter.RangeMax != -1)
                    {
                        assistantItems = assistantItems.Where((i) =>
                                                              Utility.DistanceSqrt
                                                                  (new Assistant.Point2D(Assistant.World.Player.Position.X, Assistant.World.Player.Position.Y), new Assistant.Point2D(i.Position.X, i.Position.Y)) <= filter.RangeMax
                                                              ).ToList();
                    }

                    assistantItems = assistantItems.Where((i) => i.Movable == filter.Movable).ToList();

                    if (filter.Layers.Count > 0)
                    {
                        List <Assistant.Layer> list = new List <Assistant.Layer>();

                        foreach (string text in filter.Layers)
                        {
                            Assistant.Layer layer = RazorEnhanced.Player.GetAssistantLayer(text);
                            if (layer != Assistant.Layer.Invalid)
                            {
                                list.Add(layer);
                            }
                        }

                        assistantItems = assistantItems.Where((i) => list.Contains(i.Layer)).ToList();
                    }

                    if (filter.OnGround != -1)
                    {
                        assistantItems = assistantItems.Where((i) => i.OnGround == Convert.ToBoolean(filter.OnGround)).ToList();
                    }

                    if (filter.IsContainer != -1)
                    {
                        assistantItems = assistantItems.Where((i) => i.IsContainer == Convert.ToBoolean(filter.IsContainer)).ToList();
                    }

                    if (filter.IsCorpse != -1)
                    {
                        assistantItems = assistantItems.Where((i) => i.IsCorpse == Convert.ToBoolean(filter.IsCorpse)).ToList();
                    }
                }
            }

            foreach (Assistant.Item assistantItem in assistantItems)
            {
                RazorEnhanced.Item enhancedItem = new RazorEnhanced.Item(assistantItem);
                result.Add(enhancedItem);
            }

            return(result);
        }
Esempio n. 5
0
        private static int LayerLayerToInt(Assistant.Layer layer)
        {
            switch (layer)
            {
            case Assistant.Layer.RightHand:
                return(0);

            case Assistant.Layer.LeftHand:
                return(1);

            case Assistant.Layer.Shoes:
                return(2);

            case Assistant.Layer.Pants:
                return(3);

            case Assistant.Layer.Shirt:
                return(4);

            case Assistant.Layer.Head:
                return(5);

            case Assistant.Layer.Gloves:
                return(6);

            case Assistant.Layer.Ring:
                return(7);

            case Assistant.Layer.Neck:
                return(8);

            case Assistant.Layer.Waist:
                return(9);

            case Assistant.Layer.InnerTorso:
                return(10);

            case Assistant.Layer.Bracelet:
                return(11);

            case Assistant.Layer.MiddleTorso:
                return(12);

            case Assistant.Layer.Earrings:
                return(13);

            case Assistant.Layer.Arms:
                return(14);

            case Assistant.Layer.Cloak:
                return(15);

            case Assistant.Layer.OuterTorso:
                return(16);

            case Assistant.Layer.OuterLegs:
                return(17);

            case Assistant.Layer.InnerLegs:
                return(18);

            case Assistant.Layer.Unused_x9:
                return(19);

            default:
                return(-1);
            }
        }