ShamanBoost Automat

Datum: 25/02/2020 20:42:32

Staženo: 7x

Popis:

Script dělaný na ObscuroPhoenix (http://www.obscurophoenix.www3.cz)

Nejnovější verze na bitbucketu

Nastavení:

Jde o to mít v phoenixovi soubor Players.txt kde se zapisujou jména hráčů kteří mají dovoleno používat boost. O nic víc není třeba se starat, samosebou přenastavit některé proměnné + hlavy se musí dávat do batohu odkud si ten hráč "potvrdí" že opravdu se mu bude házet boost.

Jelikož na Ereboru nehraju, tak lidi co mají shamana asi budou vědět co a jak.

Script je dokonale univerzální, stačí jen měnit soubor a o zbytek se stará script.

Script byl vytvořen aby předčil všechny dosud vytvořené scripty, bohužel byl na zakázku a majitel si mě místo zaplacení hodil do ignoru tak ho dávám veřejně :)


Hodnocení: 1.3/10 (4 hlasy)

Download file:cs

Příkazy:

  • ,start_shaman

Kód:

using System;
using System.Collections.Generic;
using Phoenix;
using Phoenix.WorldData;
using System.IO;
using System.Linq;

namespace Phoenix.Scriptss
{
    public struct PlayerData
    {
        public Serial Head;
        public Serial Player;

        public PlayerData(Serial aHead, Serial aPlayer)
        {
            this.Head = aHead;
            this.Player = aPlayer;
        }
    }

    public struct BoostData
    {
        public Boost Boost;
        public Serial Player;

        public BoostData(Boost aBoost, Serial aPlayer)
        {
            this.Boost = aBoost;
            this.Player = aPlayer;
        }
    }

    public enum Boost : byte
    {
        Str = 0,
        Dex = 1,
        Int = 2,
        Ar = 3
    }

    public class Shaman
    {
        // true = ON | false = OFF
        bool m_Active = true;

        string m_Players = Path.Combine(Core.Directory, "Players.txt");
        string m_PlayersData = Path.Combine(Core.Directory, "PlayersData.txt");

        List<string> m_AvailablePlayers = new List<string>();
        List<PlayerData> m_Data = new List<PlayerData>();
        List<BoostData> m_BoostData = new List<BoostData>();
        List<BoostData> m_TempBoostData = new List<BoostData>();

        ushort[] m_Potions = new ushort[4];
        ushort[] m_PotionsColor = new ushort[4];
        ushort[] m_Heads = new ushort[2];

        DateTime m_FoodTime = DateTime.Now;

        // Uživatelské proměnné
        uint m_Bag = 0x40073871; // bag kde budou hlavy

        public Shaman()
        {
            if (!m_Active)
            {
                UO.Print("ShamanBoosts disabled!");
                return;
            }

            Initialize();

            Journal.EntryAdded += Journal_EntryAdded;
            UO.Print("ShamanBoosts initialize");
        }

        public void Initialize()
        {
            m_Potions[0] = 0x0F0E; // str
            m_Potions[1] = 0x0F0E; // dex
            m_Potions[2] = 0x0F0E; // int
            m_Potions[3] = 0x0F0E; // ar

            m_PotionsColor[0] = 0x0835;
            m_PotionsColor[1] = 0x0006;
            m_PotionsColor[2] = 0x06C2;
            m_PotionsColor[3] = 0x0999;

            m_Heads[0] = 0x1DAE; // graphic hlavy
            m_Heads[1] = 0x1CE1; // graphic hlavy
        }

        [Command]
        public void Start_Shaman()
        {
            StreamReader lSr;
            string lLine;

            if (File.Exists(m_Players))
            {
                m_AvailablePlayers.Clear();
                lSr = new StreamReader(m_Players);
                while ((lLine = lSr.ReadLine()) != null)
                {
                    m_AvailablePlayers.Add(lLine);
                    UO.Print("Registred: " + lLine);
                }
                lSr.Close();
            }

            if (File.Exists(m_PlayersData))
            {
                m_Data.Clear();
                lSr = new StreamReader(m_PlayersData);
                while ((lLine = lSr.ReadLine()) != null)
                    m_Data.Add(new PlayerData(Convert.ToUInt32(lLine.Split(',')[0], 16), Convert.ToUInt32(lLine.Split(',')[1], 16)));
                lSr.Close();
                UO.Print("PlayerData loaded!");
            }

            while (!World.Player.DeathStatus)
            {
                foreach (BoostData lBoost in m_BoostData)
                    MakeBoost(lBoost.Boost, lBoost.Player);
                m_BoostData.Clear();
                if (m_TempBoostData.Count > 0)
                {
                    m_BoostData.AddRange(m_TempBoostData);
                    m_TempBoostData.Clear();
                }
                UO.Wait(1000);
                CheckBag();

                if (m_FoodTime < DateTime.Now)
                {
                    Feeding();
                    m_FoodTime = DateTime.Now.AddMinutes(15);
                }
            }
        }

        public void Feeding()
        {
            ushort lFood = 0x097B;

            UOItem lMeat = World.Ground.FindType(lFood);
            while (lMeat != null)
            {
                UO.DeleteJournal();
                lMeat.Use();
                lMeat = World.Ground.FindType(lFood);
                UO.Wait(500);
                if (UO.InJournal("You are simply too full to eat any more"))
                    lMeat = null;
            }
        }

        public void Journal_EntryAdded(object sender, JournalEntryAddedEventArgs e)
        {
            bool lReact = false;
            foreach (PlayerData lData in m_Data)
            {
                if (lData.Player == e.Entry.Serial)
                {
                    UOCharacter lChar = new UOCharacter(e.Entry.Serial);
                    if (lChar.Name == null)
                    {
                        lChar.RequestStatus();
                        UO.Wait(250);
                    }

                    if (m_AvailablePlayers.Contains(lChar.Name))
                    {
                        lReact = true;
                        break;
                    }
                    else
                    {
                        lReact = false;
                        break;
                    }
                }
            }

            if (lReact)
            {
                UOCharacter lPlayer = new UOCharacter(e.Entry.Serial);
                if (lPlayer.Name == null)
                {
                    lPlayer.RequestStatus();
                    UO.Wait(250);
                }

                switch (e.Entry.Text.ToLower().Trim())
                {
                    case "str":
                        m_TempBoostData.Add(new BoostData(Boost.Str, e.Entry.Serial));
                        UO.Print("Added 'STR' boost to '" + lPlayer.Name + "'");
                        break;
                    case "dex":
                        m_TempBoostData.Add(new BoostData(Boost.Dex, e.Entry.Serial));
                        UO.Print("Added 'DEX' boost to '" + lPlayer.Name + "'");
                        break;
                    case "int":
                        m_TempBoostData.Add(new BoostData(Boost.Int, e.Entry.Serial));
                        UO.Print("Added 'INT' boost to '" + lPlayer.Name + "'");
                        break;
                    case "ar":
                        m_TempBoostData.Add(new BoostData(Boost.Ar, e.Entry.Serial));
                        UO.Print("Added 'AR' boost to '" + lPlayer.Name + "'");
                        break;
                }
            }
        }

        public void MakeBoost(Boost aBoost, Serial aPlayer)
        {
            foreach (PlayerData lData in m_Data)
            {
                if (lData.Player == aPlayer)
                {
                MakeBoostAgain:

                    UOCharacter lChar = new UOCharacter(aPlayer);
                    if (lChar.Name == null)
                    {
                        lChar.RequestStatus();
                        UO.Wait(250);
                    }
                    UO.Say("Hazim '" + aBoost.ToString() + "' playerovi " + lChar.Name);

                    UO.DeleteJournal();
                    UO.WaitTargetType(m_Potions[(byte)aBoost], m_PotionsColor[(byte)aBoost]);
                    UO.UseObject(lData.Head);

                    bool lWait = true;
                    while (lWait)
                    {
                        UO.Wait(100);
                        if (UO.InJournal("Cil podlehl voodoo") || UO.InJournal("Nepovedlo se") || UO.InJournal("Prokleti nenalezlo cil"))
                            lWait = false;
                    }

                    if (UO.InJournal("Nepovedlo se"))
                    {
                        UO.Say("Boost se nepovedl, hazim znova!");
                        goto MakeBoostAgain;
                    }

                    break;
                }
            }
        }

        public void CheckBag()
        {
            UOItem lBag = new UOItem(m_Bag);
            if (!lBag.Opened)
            {
                lBag.Use();
                UO.Wait(1000);
            }
            bool lNewHead = false;
            for (int i = 0; i < m_Heads.Length; i++)
            {
                IEnumerable<UOItem> lHeads = lBag.AllItems.Where(x => x.Graphic == m_Heads[i]);
                if (lHeads != null && lHeads.Count() > 0)
                {
                    List<UOItem> lFoundedHeads = lHeads.ToList();
                    foreach (UOItem lHead in lFoundedHeads)
                    {
                        if (lHead.Name == null)
                        {
                            lHead.Click();
                            UO.Wait(1000);
                        }

                        string lHeadName = lHead.Name;
                        if (m_AvailablePlayers.Contains(lHeadName))
                        {
                            // Hlava existuje v seznamu lidí 
                            bool lHeadExistInData = false;

                            if (m_Data.Count() > 0)
                            {
                                foreach (PlayerData lData in m_Data)
                                {
                                    if (lData.Head == lHead.Serial)
                                    {
                                        lHeadExistInData = true;
                                        break;
                                    }
                                }
                            }

                            if (!lHeadExistInData)
                            {
                                UOCharacter lChar = FindPlayer(lHeadName);
                                if (lChar != null)
                                {
                                    m_Data.Add(new PlayerData(lHead.Serial, lChar.Serial));
                                    UO.Say("Registred: " + lHeadName);
                                    lHead.Move(lHead.Amount, World.Player.Backpack);
                                    UO.Wait(1000);
                                    lNewHead = true;
                                }
                                else
                                    UO.Print(lHeadName + " nebyl nalezen v blizkem okoli");
                            }
                        }
                    }
                }
            }

            if (lNewHead)
                SaveData();
        }

        public UOCharacter FindPlayer(string aName)
        {
            foreach (UOCharacter lChar in World.Characters)
            {
                if (lChar.Name == null)
                {
                    lChar.RequestStatus();
                    UO.Wait(1000);
                }
                if (lChar.Name == aName)
                    return lChar;
            }
            return null;
        }

        public void SaveData()
        {
            StreamWriter lWr = new StreamWriter(File.Open(m_PlayersData, FileMode.OpenOrCreate));
            foreach (PlayerData lData in m_Data)
                lWr.WriteLine(lData.Head.ToString() + "," + lData.Player.ToString());
            lWr.Close();
            UO.Print("Data updated!!!");
        }
    }
}
Zde ještě není žádný komentář.

Nový komentář