Ejemplo n.º 1
0
        public bool UseReflexRing()
        {
            List <string> types = new List <string>();

            if (World.Player.Backpack.AllItems.FindType(GRR.Graphic, GRR.Color).Exist)
            {
                types.Add("GRR");
            }
            if (World.Player.Backpack.AllItems.FindType(GRR2.Graphic, GRR2.Color).Exist)
            {
                types.Add("GRR2");
            }
            if (World.Player.Backpack.AllItems.FindType(RR.Graphic, RR.Color).Exist)
            {
                types.Add("RR");
            }

            string  useType = "GRR";
            UOColor c       = GRR.Color;

            int index = 0;

            for (int i = 0; i < types.Count; i++)
            {
                if (lastRRInfo != null && lastRRInfo.Title == types[i] && i < types.Count - 1)
                {
                    index = i + 1;
                    break;
                }
            }

            if (types.Count > index)
            {
                useType = types[index];
            }

            if (useType == "GRR")
            {
                c = GRR.Color;
            }
            else if (useType == "GRR2")
            {
                c = GRR2.Color;
            }
            else
            {
                c = RR.Color;
            }

            lastRRInfo = UseJewlery(useType, 0x108A, c, "Ring");

            return(lastRRInfo.Success);
        }
Ejemplo n.º 2
0
        public static UseJewleryInfo UseRemoveJewlery(UOItem item, Layer l)
        {
            UseJewleryInfo result      = new UseJewleryInfo();
            UOItem         equipedItem = World.Player.Layers[l];
            UOItem         jewlery     = item;

            Journal.Clear();

            if (jewlery.Exist)
            {
                ushort origX = jewlery.X;
                ushort origY = jewlery.Y;

                //jewlery.Move(1, World.Player.Backpack);
                //Game.Wait(250);
                jewlery.Use();
                if (!Journal.WaitForText(true, 250, "The item should be equipped to use", "It too soon to use it again", "You have to wait", "You must recharge it"))
                {
                    result.Success = true;
                }
                else
                {
                    if (Journal.Contains(true, "You must recharge it"))
                    {
                        result.OutOfCharges = true;
                        Game.PrintMessage("OutOfCharges");
                    }
                }


                jewlery.Move(1, World.Player.Backpack, origX, origY);
                //Game.Wait(250);
            }
            else
            {
                Game.PrintMessage("Nemas sperk!");
            }

            if (l != Layer.None && equipedItem.Exist && equipedItem.Container == World.Player.Backpack)
            {
                equipedItem.Use();
            }

            return(result);
        }
Ejemplo n.º 3
0
        //---------------------------------------------------------------------------------------------


        public UseJewleryInfo UseJewlery(string title, Graphic graphic, UOColor color, Layer l, ref List <Serial> usedList)
        {
            List <UOItem> jewelries    = new List <UOItem>();
            List <Serial> outOfCharges = new List <Serial>();

            UOItem         jewelry = null;
            UseJewleryInfo result  = new UseJewleryInfo();
            string         key     = graphic.ToString() + "|" + color.ToString();

            if (UniversalOutOfCharges.ContainsKey(key))
            {
                outOfCharges = UniversalOutOfCharges[key];
            }
            else
            {
                UniversalOutOfCharges.Add(key, outOfCharges);
            }

            foreach (UOItem item in World.Player.Backpack.AllItems)
            {
                if (item.Graphic == graphic && item.Color == color && !outOfCharges.Contains(item.Serial))
                {
                    jewelries.Add(item);
                }
            }

            Game.PrintMessage(title + ": " + jewelries.Count + " Used: " + usedList.Count + " Out:" + outOfCharges.Count);
            foreach (UOItem item in jewelries)
            {
                if (!usedList.Contains(item.Serial))
                {
                    jewelry = item;
                    break;
                }
            }

            if (jewelry == null)
            {
                usedList.Clear();
                Game.PrintMessage(title + " reset");
                if (jewelries.Count > 0)
                {
                    jewelry = jewelries[0];
                }
            }

            if (jewelry != null)
            {
                usedList.Add(jewelry.Serial);
                result           = UseRemoveJewlery(jewelry, l);
                result.LastInRow = jewelries.Count == usedList.Count;
                result.Title     = title;

                if (result.OutOfCharges)
                {
                    outOfCharges.Add(jewelry.Serial);
                }

                result.Depleted = jewelries.Count == outOfCharges.Count;
            }

            if (result.Success)
            {
                World.Player.PrintMessage(String.Format("{0} [{1}/{2}] OK", title, usedList.Count, jewelries.Count));
            }
            else
            {
                World.Player.PrintMessage(String.Format("{0} [{1}/{2}] Fail", title, usedList.Count, jewelries.Count), (ushort)Game.Val_LightGreen);
            }

            return(result);
        }