Exemplo n.º 1
0
        //---------------------------------------------------------------------------------------------

        protected void World_ItemAdded(object sender, ObjectChangedEventArgs e)
        {
            lock (SyncRoot)
            {
                this.possbileGolems = null;
            }
        }
Exemplo n.º 2
0
        //Serial: 0x4035D7D5  Name: "Chachumbabu's warrior's brace"  Position: 79.137.0  Flags: 0x0000  Color: 0x0480  Graphic: 0x1086  Amount: 1  Layer: None  Container: 0x40322584

        // VYRESIT Naramek + schozeni ?

        //---------------------------------------------------------------------------------------------

        public List <UOItem> GetCurrentWeapons()//params string[] filter)
        {
            List <UOItem>        items       = new List <UOItem>();
            List <UOItem>        searchItems = new List <UOItem>();
            UOItemTypeCollection toEquipColl = this.GetWeaponTypes();

            searchItems.Add(World.Player.Layers[Layer.LeftHand]);
            searchItems.Add(World.Player.Layers[Layer.RightHand]);

            foreach (UOItem item in World.Player.Backpack.Items)
            {
                if (item != null && item.Exist && item.Graphic != null)
                {
                    searchItems.Add(item);
                }
            }

            foreach (UOItem item in World.Ground)
            {
                if (item != null && item.Exist && item.Graphic != null && item.Distance < 3)
                {
                    searchItems.Add(item);
                }
            }

            foreach (UOItem item in searchItems)
            {
                if (item.IsItemType(ItemLibrary.DeathsServantBardiche))//bad idea :]
                {
                    continue;
                }


                if (item != null && item.Exist && item.Graphic != null && toEquipColl.FindItem(item.Graphic) != null)
                {
                    items.Add(item);
                }
            }

            items.Sort(delegate(UOItem x, UOItem y) {
                if (x.Serial < y.Serial)
                {
                    return(-1);
                }
                else if (x.Serial == y.Serial)
                {
                    return(0);
                }
                else
                {
                    return(1);
                }
            });

            return(items);
        }
Exemplo n.º 3
0
        //---------------------------------------------------------------------------------------------

        protected UOItemTypeCollection GetWeaponTypes()
        {
            UOItemTypeCollection list = new UOItemTypeCollection();

            list.AddRange(ItemLibrary.WeaponsFenc);
            list.AddRange(ItemLibrary.WeaponsSword);
            list.AddRange(ItemLibrary.WeaponsMace);
            list.AddRange(ItemLibrary.WeaponsArch);
            return(list);
        }
Exemplo n.º 4
0
        //---------------------------------------------------------------------------------------------

        public List <UOItem> GetCurrentShields()
        {
            List <UOItem>        items       = new List <UOItem>();
            List <UOItem>        searchItems = new List <UOItem>();
            UOItemTypeCollection toEquipColl = ItemLibrary.Shields;

            searchItems.Add(World.Player.Layers[Layer.LeftHand]);

            foreach (UOItem item in World.Player.Backpack.Items)
            {
                if (item != null && item.Exist && item.Graphic != null)
                {
                    searchItems.Add(item);
                }
            }

            foreach (UOItem item in World.Ground)
            {
                if (item != null && item.Exist && item.Graphic != null && item.Distance < 3)
                {
                    searchItems.Add(item);
                }
            }

            foreach (UOItem item in searchItems)
            {
                if (item.IsItemType(ItemLibrary.GoldenscaleShield))//supina :]
                {
                    continue;
                }

                if (item != null && item.Exist && item.Graphic != null && toEquipColl.FindItem(item.Graphic) != null)
                {
                    items.Add(item);
                }
            }

            items.Sort(delegate(UOItem x, UOItem y) {
                if (x.Serial < y.Serial)
                {
                    return(-1);
                }
                else if (x.Serial == y.Serial)
                {
                    return(0);
                }
                else
                {
                    return(1);
                }
            });

            return(items);
        }
Exemplo n.º 5
0
 private static bool IsFromTypeCollection(UOItem item, UOItemTypeCollection collection)
 {
     foreach (UOItemType type in collection)
     {
         if (type.Is(item))
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 6
0
        public static void EquipWeapon(params string[] filter)
        {
            List <UOItem>        searchItems = new List <UOItem>();
            UOItemTypeCollection toEquipColl = new UOItemTypeCollection();

            foreach (UOItem item in World.Player.Backpack.AllItems)
            {
                if (item != null && item.Exist && item.Graphic != null)
                {
                    searchItems.Add(item);
                }
            }

            foreach (UOItem item in World.Ground)
            {
                if (item != null && item.Exist && item.Graphic != null && item.Distance < 3)
                {
                    searchItems.Add(item);
                }
            }

            bool useFilter = filter.Length > 0;

            if (!useFilter || Array.IndexOf(filter, "weaponfenc") > -1)
            {
                toEquipColl.AddRange(ItemLibrary.WeaponsFenc);
            }

            if (!useFilter || Array.IndexOf(filter, "weaponsword") > -1)
            {
                toEquipColl.AddRange(ItemLibrary.WeaponsSword);
            }

            if (!useFilter || Array.IndexOf(filter, "weaponmace") > -1)
            {
                toEquipColl.AddRange(ItemLibrary.WeaponsMace);
            }

            UOItem leftHand  = World.Player.Layers[Layer.LeftHand];
            UOItem rightHand = World.Player.Layers[Layer.RightHand];

            int counter = 0;

            if (!rightHand.Serial.IsValid || !rightHand.Exist)
            {
                foreach (UOItem item in searchItems)
                {
                    if (item != null && item.Exist && item.Graphic != null)
                    {
                        if (toEquipColl.FindItem(item.Graphic) != null)//Array.IndexOf(toEquipColl.GraphicArray, item.Graphic) > -1)
                        {
                            item.Use();
                            Game.Wait();
                            counter++;
                            break;
                        }
                    }
                }
            }
            else
            {
                World.Player.PrintMessage("* Uz mas zbran *");
            }

            if (counter > 0)
            {
                World.Player.PrintMessage("* Zbran nahozena *");
            }
            else
            {
                World.Player.PrintMessage("* Neni zbran *");
            }
        }