Stránka 1 z 1

Inscript

Napsal: 08 srp 2010 09:58
od Smoce
Komu nejde má smůlu..... mě jde :-)

Kód: Vybrat vše

 using System;
using System.Collections.Generic;
using System.Text;
using Phoenix;
using Phoenix.WorldData;
using System.Linq;
using Phoenix.Communication;
using Phoenix.Runtime;
using Phoenix.Runtime.Reflection;

namespace Script.Inscript_od_luna
{ 
    public class Inscripters
    {//by smoce
        public struct BP
        {
            public const ushort type = 0x0F7A;
            public const string name = "Black Pearl";
        }
        public struct BM
        {
            public const ushort type = 0x0F7B;
            public const string name = "Blood Moss";
        }
        public struct GA
        {
            public const ushort type = 0x0F84;
            public const string name = "Garlic";
        }
        public struct GI
        {
            public const ushort type = 0x0F85;
            public const string name = "Ginseng";
        }
        public struct MR
        {
            public const ushort type = 0x0F86;
            public const string name = "Mandrake Root";
        }
        public struct NS
        {
            public const ushort type = 0x0F88;
            public const string name = "Night Shade";
        }
        public struct SA
        {
            public const ushort type = 0x0F8C;
            public const string name = "Surfurous Ash";
        }
        public struct SS
        {
            public const ushort type = 0x0F8D;
            public const string name = "Spider Silk";
        }
        public struct nic
        {
            public const ushort type = 0x0000;
            public const string name = "Proste nic";
        }


        public const ushort plnaflaska = 0x0F09;
        public const ushort plna_flaska = 0x0F09;
        public const ushort tmr_barva = 0x0003;
        public const ushort mr_barva = 0x0005;
        public const int uspesnostssa = 0;

        // Nastaveni  Nastaveni  Nastaveni  Nastaveni  Nastaveni  Nastaveni  Nastaveni Nastaveni 

        public const int ZPUSOB = 2; // Proste nech dvojku !


        public const int MED = 1;
        //MED - nastaveni, jestli bude v pauzach, 
        //kdy nemuze pit dalsi flasku, meditovat
        //1 - povoleni meditace
        //0 - zakazani meditace


//sablona jak na to **************************************************************
//        [Executable]
//        public static void insc_NightSight()
//        {
//            UO.PrintInformation("ZVOL BOX S BLANKY !!!");
//            UOItem box = new UOItem(UIManager.TargetObject());
//            UO.Wait(500);
//            Inscript("Spell Circle 1<kruh ve kterém je kouzlo >", "Night Sight<název svítku>", 1<pocet regu 1>, SS.type<nazev regu 1 .. REG.type>, 1<pocet regu 2>,1, SA.type,0 , nic.type, 0, nic.type, 0x1F33<type svítku>, 4<minimalni pocet many na svitek>, box);
//        }
//********************************************************************************





        [Executable]
        public static void insc_NightSight()
        {
            UO.PrintInformation("ZVOL BOX S BLANKY !!!");
            UOItem box = new UOItem(UIManager.TargetObject());
            UO.Wait(500);
            Inscript("Spell Circle 1", "Night Sight", 1, SS.type, 1, SA.type, 0, nic.type, 0, nic.type, 0x1F33, 4, box);

        }
        [Executable]
        public static void insc_MagicArrow()
        {
            UO.PrintInformation("ZVOL BOX S BLANKY !!!");
            UOItem box = new UOItem(UIManager.TargetObject());
            UO.Wait(500);
            Inscript("Spell Circle 1", "Magic Arrow", 1, BP.type, 1, NS.type, 0, nic.type, 0, nic.type, 0x1F32, 4, box);

        }
        [Executable]
        public static void insc_heal()
        {
            UO.PrintInformation("ZVOL BOX S BLANKY !!!");
            UOItem box = new UOItem(UIManager.TargetObject());
            UO.Wait(500);
            Inscript("Spell Circle 1", "Heal", 1, GA.type, 1, SS.type, 1, GI.type, 0, nic.type, 0x1F31, 4, box);

        }
        [Executable]
        public static void insc_Agilitka()
        {
            UO.PrintInformation("ZVOL BOX S BLANKY !!!");
            UOItem box = new UOItem(UIManager.TargetObject());
            UO.Wait(500);
            Inscript("Spell Circle 2", "Agility", 1, BM.type, 1, MR.type, 0, GI.type, 0, nic.type, 0x1F32, 4, box);

        }
        [Executable]
        public static void insc_Harm()
        {
            UO.PrintInformation("ZVOL BOX S BLANKY !!!");
            UOItem box = new UOItem(UIManager.TargetObject());
            UO.Wait(500);
            Inscript("Spell Circle 2", "Harm", 1, SS.type, 1, SS.type, 0, nic.type, 0, nic.type, 0x1F38, 6, box);

        }
        [Executable]
        public static void insc_Fireball()
        {
            UO.PrintInformation("ZVOL BOX S BLANKY !!!");
            UOItem box = new UOItem(UIManager.TargetObject());
            UO.Wait(500);
            Inscript("Spell Circle 3", "Fireball", 1, BP.type, 1, SA.type, 0, nic.type, 0, nic.type, 0x1F3E, 9, box);

        }
        [Executable]
        public static void insc_Teleport()
        {
            UO.PrintInformation("ZVOL BOX S BLANKY !!!");
            UOItem box = new UOItem(UIManager.TargetObject());
            UO.Wait(500);
            Inscript("Spell Circle 3", "Teleport", 1, BM.type, 1, MR.type, 0, nic.type, 0, nic.type, 0x1F42, 9, box);

        }
        [Executable]
        public static void insc_Wall_of_Stone()
        {
            UO.PrintInformation("ZVOL BOX S BLANKY !!!");
            UOItem box = new UOItem(UIManager.TargetObject());
            UO.Wait(500);
            Inscript("Spell Circle 3", "Wall of Stone", 5, BM.type, 5, GA.type, 0, nic.type, 0, nic.type, 0x1F44, 9, box);

        }
        [Executable]
        public static void insc_Lightning()
        {
            UO.PrintInformation("ZVOL BOX S BLANKY !!!");
            UOItem box = new UOItem(UIManager.TargetObject());
            UO.Wait(500);
            Inscript("Spell Circle 4", "Lightning", 1, BP.type, 1, MR.type, 1, SA.type, 0, nic.type, 0x1F4A, 11, box);

        }
        [Executable]
        public static void insc_Recall()
        {
            UO.PrintInformation("ZVOL BOX S BLANKY !!!");
            UOItem box = new UOItem(UIManager.TargetObject());
            UO.Wait(500);
            Inscript("Spell Circle 4", "Recall", 1, BP.type, 1, MR.type, 1, BM.type, 0, nic.type, 0x1F4C, 11, box);

        }
        [Executable]
        public static void insc_Mark()
        {
            UO.PrintInformation("ZVOL BOX S BLANKY !!!");
            UOItem box = new UOItem(UIManager.TargetObject());
            UO.Wait(500);
            Inscript("Spell Circle 6", "Mark", 1, BP.type, 1, MR.type, 1, BM.type, 0, nic.type, 0x1F4C, 11, box);

        }
        [Executable]
        public static void insc_Greater_Heal()
        {
            UO.PrintInformation("ZVOL BOX S BLANKY !!!");
            UOItem box = new UOItem(UIManager.TargetObject());
            UO.Wait(500);
            Inscript("Spell Circle 4", "Greater Heal", 1, GA.type, 1, GI.type, 1, MR.type, 1, SS.type, 0x1F49, 11, box);

        }
        [Executable]
        public static void insc_Magic_Reflect()
        {
            UO.PrintInformation("ZVOL BOX S BLANKY !!!");
            UOItem box = new UOItem(UIManager.TargetObject());
            UO.Wait(500);
            Inscript("Spell Circle 5", "Magic Reflect", 1, GA.type, 1, SS.type, 1, MR.type, 0, nic.type, 0x1F50, 14, box);

        }
        [Executable]
        public static void insc_Paralyze()
        {
            UO.PrintInformation("ZVOL BOX S BLANKY !!!");
            UOItem box = new UOItem(UIManager.TargetObject());
            UO.Wait(500);
            Inscript("Spell Circle 5", "Paralyze", 1, GA.type, 1, SS.type, 1, MR.type, 0, nic.type, 0x1F52, 14, box);

        }
        [Executable]
        public static void insc_Blade_Spirit()
        {
            UO.PrintInformation("ZVOL BOX S BLANKY !!!");
            UOItem box = new UOItem(UIManager.TargetObject());
            UO.Wait(500);
            Inscript("Spell Circle 5", "Blade Spirit", 1, NS.type, 1, BP.type, 1, MR.type, 0, nic.type, 0x1F52, 40, box);

        }
        [Executable]
        public static void insc_ParalyzeField()
        {
            UO.PrintInformation("ZVOL BOX S BLANKY !!!");
            UOItem box = new UOItem(UIManager.TargetObject());
            UO.Wait(500);
            Inscript("Spell Circle 6", "Paralyze Field", 5, BP.type, 5, GI.type, 5, SS.type, 0, nic.type, 0x1F5B, 20, box);

        }
        [Executable]
        public static void insc__Flame_Strike()
        {
            UO.PrintInformation("ZVOL BOX S BLANKY !!!");
            UOItem box = new UOItem(UIManager.TargetObject());
            UO.Wait(500);
            Inscript("Spell Circle 7", "Flame Strike", 5, SS.type, 5, SA.type, 0, nic.type, 0, nic.type, 0x1F5F, 40, box);

        }
        [Executable]
        public static void insc__Resurrectio()
        {
            UO.PrintInformation("ZVOL BOX S BLANKY !!!");
            UOItem box = new UOItem(UIManager.TargetObject());
            UO.Wait(500);
            Inscript("Spell Circle 8", "Resurrection", 1, BM.type, 1, GA.type, 1, GI.type, 0, nic.type, 0x1F67, 50, box);

        }





        [Executable]
        public static void Inscript(string circle, string name, int reg1_pocet, ushort reg1, int reg2_pocet, ushort reg2, int reg3_pocet, ushort reg3, int reg4_pocet, ushort reg4, ushort scroll, ushort min_mana, UOItem box)
        {
            UO.Print("Inscript zahajen");
            UO.Wait(100);

            int y = 0;
            int ok = 0;
            int fizz = 0;
        zacateks:
            do
            {
                if (UO.Count(0x0E34) == 0)
                {
                    box.Use();
                    UO.PrintInformation("Dosly blanky.Pokusim se prenest s baglu svitky do boxu a blanky s boxu do baglu.");
                    if (UO.Count(scroll) > 0)
                    {
                        //// svitky jsou preneseny do boxu - Z
                        UOItem svitecky = World.Player.Backpack.AllItems.FindType(scroll, 0x0000);
                        UO.MoveItem(svitecky, 0, box);
                        UO.Wait(1000);
                        //// svitky jsou preneseny do boxu - K
                    }
                    else
                    {
                        UO.Print("Nemas u sebe napsane svitky tak jen vemem blanky");
                        UO.Wait(100);
                    }
                    smocelsk(box);
                    UO.Wait(1000);
                }


                UO.DeleteJournal();
                string[] incs = { "Spell Circles", circle, circle, name };
                UO.WaitMenu(incs);
                UOItem blankya = World.Player.Backpack.AllItems.FindType(0x0E34);
                blankya.Use();
                string[] hlaskys = { "You put", "You fail" };
                Journal.WaitForText(true, hlaskys);

                if (UO.InJournal("You put"))
                {
                    ok++;
                }
                else
                {
                    fizz++;
                }
                y++;
                statistics(ok, fizz, 0);
            }
            while (World.Player.Mana >= min_mana);
            UO.Print("Dosla mana jdem ji doplnit TMR a Meditaci");
            jetomaterial(reg1_pocet, reg1, reg2_pocet, reg2, reg3_pocet, reg3, reg4_pocet, reg4, scroll, min_mana);

            if (World.Player.Mana > min_mana)
            {
                goto zacateks;
            }
        }
        [Command]
        public static void smocelsk(UOItem box)
        {
            UOItem tod = new UOItem(World.Player.Backpack);
            foreach (KeyValuePair<Graphic, string> items in new Dictionary<Graphic, string>
                                                           {
                                                               {0x0E34, "20"}
                                                                
                                                           })
                MoveItemsd(box, tod, items);

        }

        private static void MoveItemsd(UOItem from, UOItem to, KeyValuePair<Graphic, string> item)
        {
            if (string.IsNullOrEmpty(item.Value))
                return;
            int count = ushort.Parse(item.Value) - to.AllItems.Count(item.Key);
            if (count > 0)
                MoveItem(from.AllItems.FindType(item.Key), count, to);
            else if (count < 0)
                MoveItem(to.AllItems.FindType(item.Key), count, from);
        }

        private static void MoveItem(UOItem item, int count, UOItem dest)
        {
            if (!item.Exist)
                return;
            ushort tomove = Math.Min((ushort)Math.Abs(count), item.Amount);
            using (ItemUpdateEventWaiter ew = new ItemUpdateEventWaiter(item))
            {
                item.Move(tomove, dest);
                if (ew.Wait(5000))
                    UO.PrintInformation(item.Graphic + " - " + tomove);
                UO.Wait(500);
            }
        }

        [Command]
        public static void statistics(int ok, int fizz, int uspesnostssa)
        {

            if (ok > 0)
            {
                uspesnostssa = (ok / (ok + fizz)) * 100;
            }
            else
            {
                uspesnostssa = 0;
            }

            UO.Print("Povedene:Nepovedene - " + ok + ":" + fizz);
            UO.Print("Uspesnost: " + uspesnostssa + "%");

        }


        [Command]
        public static void jetomaterial(int reg1_pocet, ushort reg1, int reg2_pocet, ushort reg2, int reg3_pocet, ushort reg3, int reg4_pocet, ushort reg4, ushort scroll, ushort min_mana)
        {

            if (UO.Count(0x0E34) == 0)
            {
                UO.Print("Dosly blanky");
            }


            if (UO.Count(reg1) < reg1_pocet)
            {
                UO.Print("Dosly reagenty");

            }

            if (UO.Count(reg2) < reg2_pocet)
            {
                UO.Print("Dosly reagenty");

            }

            if (reg3 != 0x0000)
            {
                if (UO.Count(reg3) < reg3_pocet)
                {
                    UO.Print("Dosly reagenty");

                }
            }

            if (reg4 != 0x0000)
            {
                if (UO.Count(reg4) < reg4_pocet)
                {
                    UO.Print("Dosly reagenty");

                }
            }

            if (World.Player.Mana <= min_mana)
            {
                mana(min_mana);
            }

        }

        [Command]
        public static void mana(ushort min_mana)
        {
            UO.Print("Nalejvam/Piju TMR");

            if (UO.Count(plna_flaska, tmr_barva) == 0)
            {
                if (Journal.Contains("You are preoccupied with thoughts of battle."))
                {
                    World.Player.ChangeWarmode(0);

                    UO.Print("Neni lahvicka!");
                }
                else
                {
                    UO.UseType(0x1843, 0x0003);
                    UO.WaitTargetType(0x0f0e);
                    UO.Print("Prelito" + UO.Count(0x0F09, 0x0003) + "  Total Mana Refles.");
                    UO.Wait(2000);
                }

                UO.UseType(0x0F09, 0x0003);
                UO.Wait(100);
                UO.Print("Zbyva " + UO.Count(0x0F09, 0x0003) + " Total Mana Refles.");

            }
            else
            {
                UO.UseType(0x0F09, 0x0003);
                UO.Wait(100);
                UO.Print("Zbyva " + UO.Count(0x0F09, 0x0003) + " Total Mana Refles.");
            }

            if (MED == 1)
            {
                UO.Print("Medituju");
                do
                {
                    meditation();
                }
                while (World.Player.Mana < World.Player.MaxMana);
            }

        }



        [Command]
        public static void meditation()
        {

            UO.DeleteJournal();
            UO.UseSkill("Meditation");
            CekanisJournal("You enter|You must wait");

            do
            {
                UO.Wait(100);
            }
            while ((UO.InJournal("You lose|You must wait")));
            UO.Wait(500);
        }




        [Command]
        public static void CekanisJournal(string text)
        {

            do
            {
                UO.Wait(200);
            }
            while (UO.InJournal(text));
            UO.Wait(500);
        }






    }
}

Re: Inscript

Napsal: 22 kvě 2014 23:14
od Stalagnite
Nevíte proč v tom scriptu nefrčí meditace v průběhu toho trejnu ? jednou jí hodí ale tím to končí :(