示例#1
0
        //---------------------------------------------------------------------------------------------

        public static void PrintHitsMessage(this UOCharacter character, string message, params object[] args)
        {
            string test         = message + String.Empty;
            bool   needBranches = test.Contains("[");
            bool   needSpaces   = test.Contains("..") || test.Contains(".") || test.Contains("[ ");

            test = test.Replace("[", "").Replace("]", "").Replace("....", "").Replace("...", "").Replace("..", "").Replace(".", "").Trim(new char[] { ' ' });
            //.ToLower();
            //if (needBranches)
            //  test = test.ToLower();

            if (!String.IsNullOrEmpty(test) && needBranches)
            {
                test = "[" + (needSpaces ? " " : "") + test + (needSpaces ? " " : "") + "]";
            }

            UOColor color = Game.Val_GreenBlue;

            if (character.Notoriety == Notoriety.Murderer || character.Notoriety == Notoriety.Enemy)
            {
                color = Game.GetEnemyColorByHits(character);
            }
            else
            {
                color = Game.GetAlieColorByHits(character);
            }

            //character.Print("");//reset 1
            //character.Print("");//reset 2
            character.Print(color, test, args);
        }
示例#2
0
        //---------------------------------------------------------------------------------------------

        public static void PrintHitsMessage(this UOCharacter character, string message, params object[] args)
        {
            UOColor color = Game.Val_GreenBlue;

            if (character.Notoriety == Notoriety.Murderer || character.Notoriety == Notoriety.Enemy)
            {
                color = Game.GetEnemyColorByHits(character);
            }
            else
            {
                color = Game.GetAlieColorByHits(character);
            }

            //character.Print("");//reset 1
            //character.Print("");//reset 2
            character.Print(color, message, args);
        }
示例#3
0
        //---------------------------------------------------------------------------------------------

        protected bool KillCharacter(UOCharacter character)
        {
            UOItem wepn = new UOItem(Serial.Invalid);

            foreach (UOItemType t in ItemLibrary.WeaponsFenc)
            {
                wepn = UO.Backpack.AllItems.FindType(t.Graphic);
                if (wepn.Exist)
                {
                    break;
                }
                else
                {
                    wepn = World.Player.Layers[Layer.LeftHand].Graphic == t.Graphic ? World.Player.Layers[Layer.LeftHand] : wepn;//.FindType(t.Graphic);
                    if (wepn.Exist)
                    {
                        break;
                    }
                    else
                    {
                        wepn = World.Player.Layers[Layer.RightHand].Graphic == t.Graphic ? World.Player.Layers[Layer.RightHand] : wepn;
                        if (wepn.Exist)
                        {
                            break;
                        }
                    }
                }
            }
            bool isArch = false;

            if (!wepn.Exist)
            {
                foreach (UOItemType t in ItemLibrary.WeaponsArch)
                {
                    wepn = UO.Backpack.AllItems.FindType(t.Graphic);
                    if (wepn.Exist)
                    {
                        isArch = true;
                        break;
                    }
                    else
                    {
                        wepn = World.Player.Layers[Layer.LeftHand].Graphic == t.Graphic ? World.Player.Layers[Layer.LeftHand] : wepn;//.FindType(t.Graphic);
                        if (wepn.Exist)
                        {
                            break;
                        }
                        else
                        {
                            wepn = World.Player.Layers[Layer.RightHand].Graphic == t.Graphic ? World.Player.Layers[Layer.RightHand] : wepn;
                            if (wepn.Exist)
                            {
                                break;
                            }
                        }
                    }
                }
            }

            if (wepn.Exist)
            {
                UO.WaitTargetObject(character);
                if (wepn.Layer != Layer.RightHand || wepn.Layer != Layer.LeftHand)
                {
                    wepn.Use();
                    Game.Wait();
                }
                int killTries = 0;
                while (character.Exist && character.Distance < 8 && character.Hits > -1 && killTries < 50)
                {
                    Game.PrintMessage("Kill " + character.Name + " Trie:" + killTries);

                    if (isArch)
                    {
                        Ranger.EnsureArcherAmmo();
                        Game.Wait(Game.SmallestWait);
                    }

                    World.Player.ChangeWarmode(WarmodeChange.War);
                    Game.Wait();


                    UO.Attack(character);
                    Game.Wait();
                    new Robot().GoTo(character.X, character.Y, 1, 4);
                    character.Print("{0}/{1}", character.Hits, character.MaxHits);
                    killTries++;

                    Game.Wait(5000);
                }

                if (!character.Exist)
                {
                    Game.Wait(500);
                    new Loot().LootGround(Loot.LootType.Quick, true);

                    return(true);
                }
            }
            else
            {
                Game.PrintMessage("Nemas u sebe Kryss");
            }

            return(false);
        }
示例#4
0
        public static CallbackResult onHpChanged(byte[] data, CallbackResult prevResult)//0xa1
        {
            UOCharacter character = new UOCharacter(Phoenix.ByteConverter.BigEndian.ToUInt32(data, 1));
            //if (character.Serial == World.Player.Serial) return CallbackResult.Normal;
            ushort maxHits = 100; // Nejvyssi HITS bez nakouzleni
            ushort hits    = Phoenix.ByteConverter.BigEndian.ToUInt16(data, 7);

            ushort[] color = new ushort[4];
            color[0] = 0x0026; //red
            color[2] = 0x0175; //green
            color[1] = 0x099;  //yellow
            color[3] = 0x0FAB; //fialova - enemy;
            int col = 0;



            if (Math.Abs(character.Hits - hits) > 2)
            {
                if (character.Renamable)
                {
                    character.Print(0x005d, "[{0}% HP]   {1}", ((maxHits / 100) * hits), (hits - character.Hits));
                    return(CallbackResult.Normal);
                }
                if (character.Hits > hits)
                {
                    if (character.Poisoned)
                    {
                        col = 2;
                    }
                    else
                    {
                        col = 0;
                    }
                }
                else
                {
                    if (character.Poisoned)
                    {
                        col = 2;
                    }
                    else
                    {
                        col = 1;
                    }
                }

                if ((character.Model == 0x0190 || character.Model == 0x0191))
                {
                    if (character.Serial == World.Player.Serial)
                    {
                        character.Print(color[col], "[{0}% HP]   {1}", ((maxHits / 100) * hits), (hits - character.Hits));
                    }
                    else
                    {
                        character.Print(color[col], "{2} [{0}% HP]   {1}", ((maxHits / 100) * hits), (hits - character.Hits), character.Name);
                    }
                }



                if (character.Serial == Aliases.LastAttack)
                {
                    character.Print(color[3], "[{0}% HP]   {1}", ((maxHits / 100) * hits), (hits - character.Hits));
                }
            }
            return(CallbackResult.Normal);
        }