Exemple #1
0
        public PFBLoader()
        {
			try
			{
				Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

                string path = Logging.ApplicationPath + @"\Bots\PoolFishingBuddy\PoolFishingBuddy.dll";

				Assembly asm = Assembly.LoadFrom(path);

                if (asm != null)
                {
                    foreach (Type t in asm.GetTypes())
                    {
                        if (t.IsSubclassOf(typeof(BotBase)) && t.IsClass)
                        {
                            var obj = Activator.CreateInstance(t);
                            _botBase = (BotBase)obj;
                        }
                        
                    }
                }
                else
                {
                    Logging.Write(Color.DarkRed, "An error occured while loading PoolFishingBuddy! asm is null!");
                }
                
			}
			catch (System.Threading.ThreadAbortException) { throw; }
			catch (Exception e)
			{
                Logging.Write(Color.DarkRed, "An error occured while loading PoolFishingBuddy!");
                Logging.WriteDebug(e.ToString());
			}
        }
 public static Session GetInstance(LocalPlayer player, BotBase bot )
 {
     Session s = new Session();
     s.botBase = bot.Name;
     s.botDebug = "";
     s.map = player.CurrentMap.Name;
     s.id = 0;
     s.isEnd = 0;
     return s;
 }
Exemple #3
0
        static void Main(string[] args)
        {
            var bot = new BotBase("128682096:AAE_LP3sW5kM-d2Zd_sjhG9slwq4-xsXdWs");
            bot.GetUpdates(new GetUpdatesParameter());
            bot.SendDocument<CustomeKeyboard, SendDocumentParameter<CustomeKeyboard>>
            (new SendDocumentParameter<CustomeKeyboard>(56751056,File.OpenRead(@"C:\Users\Ehsan\Desktop\Photo1067.jpg"), "Photo1067.jpg")
            {

            });

            string baseAddress = "http://localhost:9000/";

            using (WebApp.Start<Startup>(url: baseAddress))
            {

            }

            Console.ReadLine();
        }
Exemple #4
0
        private static void LoadBotBase()
        {
            lock (ObjectLock)
            {
                if (BotBase != null)
                {
                    return;
                }

                BotBase = Load();

                _loaded = true;

                if (BotBase == null)
                {
                    return;
                }

                BotBaseStart  = BotBase.GetType().GetMethod("Start");
                BotBaseStop   = BotBase.GetType().GetMethod("Stop");
                BotBaseButton = BotBase.GetType().GetMethod("OnButtonPress");
                BotBaseRoot   = BotBase.GetType().GetMethod("GetRoot");
            }
        }
Exemple #5
0
        /// <summary>
        /// Tells the bots to randomly decide the positions and directions of their ships.
        /// </summary>
        protected override void SetupShipPlacements()
        {
            ShipType[] shipTypes = (ShipType[])Enum.GetValues(typeof(ShipType));

            // For each ship type..
            foreach (ShipType shipType in shipTypes)
            {
                // Have both bots randomly place ships.
                for (int i = 0; i < MAX_PLAYERS; i++)
                {
                    PlaceShipRequest placeRequest = new PlaceShipRequest();
                    placeRequest.ShipType = shipType;

                    ShipPlacement?placeResponse = null;

                    do
                    {
                        placeRequest.Coordinate = BotBase.GetRandomCoordinate();
                        placeRequest.Direction  = BotBase.GetRandomDirection();
                        placeResponse           = players[i].Board.PlaceShip(placeRequest);
                    } while (placeResponse != ShipPlacement.Ok);
                }
            }
        }
Exemple #6
0
 private void OnStop(BotBase bot)
 {
     StopMainOverlay();
     TogglesViewModel.Instance.SaveToggles();
 }
Exemple #7
0
 private static void TreeRootOnStop(BotBase bot)
 {
     updateWindows = RaptureAtkUnitManager.Update;
 }
Exemple #8
0
 /// <summary>Creates service definition that can be registered with a server</summary>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static grpc::ServerServiceDefinition BindService(BotBase serviceImpl)
 {
     return(grpc::ServerServiceDefinition.CreateBuilder()
            .AddMethod(__Method_Ask, serviceImpl.Ask).Build());
 }
Exemple #9
0
 public static void Initialize(BotBase bot)
 {
     CurrentBot = bot;
 }
Exemple #10
0
 public List<BotBase> GetTeamExcept(BotBase exceptBot)
 {
     List<BotBase> members = new List<BotBase>();
     for (int i = 0; i < _teamMembers.Count; i++) {
         if (exceptBot != _teamMembers[i]) {
             members.Add(_teamMembers[i]);
         }
     }
     return members;
 }
Exemple #11
0
 private void Awake()
 {
     myBot = GetComponentInParent <BotBase>();
 }
 private void setHooks(BotBase bot)
 {
     Log("Setting Hooks");
     TreeHooks.Instance.AddHook("DeathReviveLogic", deathCoroutine);
 }
        public override void Initialize()
        {
            try
            {
                if (!_init)
                {
                    PBLog.Debug("Initializing ...");
                    Util.ScanForOffsets();
                    if (!Directory.Exists(BotPath))
                    {
                        Directory.CreateDirectory(BotPath);
                    }
                    DynamicCodeCompiler.WipeTempFolder();
                    // force Tripper.Tools.dll to load........
                    new Vector3(0, 0, 0);

                    MySettings =
                        new ProfessionBuddySettings(
                            Path.Combine(
                                Utilities.AssemblyDirectory,
                                string.Format(@"Settings\{0}\{0}[{1}-{2}].xml", Name, Me.Name, Lua.GetReturnVal <string>("return GetRealmName()", 0))));

                    IsTradeSkillsLoaded = false;
                    LoadTradeSkills();
                    DataStore = new DataStore();
                    DataStore.ImportDataStore();
                    LoadTradeskillTools();
                    // load localized strings
                    LoadStrings();

                    // load the previous
                    BotBase bot =
                        BotManager.Instance.Bots.Values.FirstOrDefault(
                            b => b.Name.IndexOf(MySettings.LastBotBase, StringComparison.InvariantCultureIgnoreCase) >= 0);

                    if (bot == null)
                    {
                        // look for combat bot, otherwise select first bot if combat bot is not found
                        bot = BotManager.Instance.Bots.Values.FirstOrDefault(b => b.GetType().ToString() == "CombatBot")
                              ?? BotManager.Instance.Bots.Values.FirstOrDefault();
                        MySettings.LastBotBase = bot.Name;
                        MySettings.Save();
                    }
                    SecondaryBot = bot;

                    bot.DoInitialize();

                    try
                    {
                        if (!string.IsNullOrEmpty(_profileToLoad))
                        {
                            LoadPBProfile(_profileToLoad);
                        }
                        else if (!string.IsNullOrEmpty(MySettings.LastProfile))
                        {
                            LoadPBProfile(MySettings.LastProfile);
                        }
                    }
                    catch (Exception ex)
                    {
                        PBLog.Warn(ex.ToString());
                    }

                    _init = true;
                }
            }
            catch (Exception ex)
            {
                Logging.Write(Colors.Red, ex.ToString());
            }
        }
Exemple #14
0
 private void OnBotStart(BotBase bot)
 {
     AddHooks();
 }
Exemple #15
0
 private void OnBotStop(BotBase bot)
 {
     Logger.BokoLog(@"Stopping Boko!");
     FormManager.SaveFormInstances();
 }
Exemple #16
0
 private void OnBotStop(BotBase bot)
 {
     RemoveHooks();
 }
Exemple #17
0
 /// <summary>
 ///     Determines if the current bot base is Enyo or Raid Bot.
 /// </summary>
 public static bool IsRoutineBased(this BotBase thisBotBase)
 {
     return
         (thisBotBase.Name.ToUpper().Contains("ENYO") ||
          thisBotBase.Name.ToUpper().Contains("RAID BOT"));
 }
 public PbRootComposite(PbDecorator pbBotBase, BotBase secondaryBot)
     : base(pbBotBase, secondaryBot == null ? new PrioritySelector() : secondaryBot.Root)
 {
     _secondaryBot = secondaryBot;
 }
Exemple #19
0
 public static void Initialize(BotBase bot)
 {
     CurrentBot = bot;
 }
Exemple #20
0
 /// <summary>
 /// Handles plugin stop.
 /// </summary>
 /// <param name="bot"></param>
 private void HandleStop(BotBase bot)
 {
     RoutineManager.PickRoutineFired -= HandleRoutineSelection;
 }
        public override void Pulse()
        {
// ------------ Deactivate if not in Game etc
            if (Me == null || !StyxWoW.IsInGame)
            {
                return;
            }

// ------------ Deactivate Plugin in BGs, Inis, while Casting and on Transport
            if (Battlegrounds.IsInsideBattleground || Me.IsInInstance || Me.IsOnTransport)
            {
                return;
            }

// ------------ Deactivate Plugin if in Combat, Dead or Ghost
            if (inCombat)
            {
                return;
            }

            if (!hasItBeenInitialized && Settings.Active1)
            {
                // ------------ Deactivate ProfileChanger if Profile Swapper is enabled or Questbot etc is choosen
                List <PluginContainer> _pluginList = PluginManager.Plugins;
                foreach (PluginContainer _pluginMe in _pluginList)
                {
                    if (_pluginMe.Plugin.Name == "Profile Changer")
                    {
                        PluginMe = _pluginMe;
                    }
                }

                BotBase bot = TreeRoot.Current;
                if (bot.Name == "PartyBot" || bot.Name == "Multibox Follower" || bot.Name == "Multibox Leader" ||
                    bot.Name == "Mixed Mode" || bot.Name == "DungeonBuddy" || bot.Name == "BGBuddy" || bot.Name == "ArchaeologieBuddy" ||
                    bot.Name == "Tyrael" || bot.Name == "LazyRaider" || bot.Name == "Combat Bot" || bot.Name == "Fpsware's LazyBoxer" ||
                    bot.Name == "Raid Bot")
                {
                    Logging.Write(Colors.LightSkyBlue, "{0} is choosen, so deactivate Profile Changer", bot.Name);
                    PluginMe.Enabled = false;
                    return;
                }

                foreach (PluginContainer _plugin in _pluginList)
                {
                    if (_plugin.Enabled && _plugin.Plugin.Name == "Brodieman's Profile Swapper")
                    {
                        Logging.Write(Colors.LightSkyBlue, "Brodieman's Profile Swapper is activated, so deactivate Profile Changer");
                        PluginMe.Enabled = false;
                        return;
                    }
                }

                SWProfile1.Reset();
                SWProfile2.Reset();
                SWProfile3.Reset();
                SWProfile4.Reset();
                SWProfile5.Reset();
                SWProfile6.Reset();
                SWProfile7.Reset();
                SWProfile8.Reset();
                SWProfile9.Reset();
                SWProfile10.Reset();
                SWProfile11.Reset();
                SWProfile12.Reset();
                SWProfile1.Start();

                ChangeProfile(Settings.Profile1);
                hasItBeenInitialized = true;
                Logging.WriteDiagnostic(Colors.LightSkyBlue, "Profile Changer: Init Done");
            }

            if (!SWProfile1.IsRunning && !SWProfile2.IsRunning && !SWProfile3.IsRunning && !SWProfile4.IsRunning && !SWProfile5.IsRunning && !SWProfile6.IsRunning &&
                !SWProfile7.IsRunning && !SWProfile8.IsRunning && !SWProfile9.IsRunning && !SWProfile10.IsRunning && !SWProfile11.IsRunning && !SWProfile12.IsRunning &&
                Settings.Active1)
            {
                Logging.Write(Colors.LightSkyBlue, "Profile Changer: A failure occured. Init and then switch to Profile 1 and restart Timer1");
                hasItBeenInitialized = false;
            }

            if (Settings.Active1)
            {
                if ((SWProfile1.Elapsed.TotalMinutes > Convert.ToInt16(Settings.Minutes1) && !Settings.RandomTime) || (SWProfile1.Elapsed.TotalMinutes > NextRandomTime && Settings.RandomTime))
                {
                    Logging.Write(Colors.LightSkyBlue, "Profile Changer: Change Profile");
                    if (Settings.RandomProfile)
                    {
                        ChangeRandomProfile();
                    }
                    else if (Settings.Active2)
                    {
                        ChangeProfile(Settings.Profile2);
                    }
                    else
                    {
                        if (Settings.StopBot)
                        {
                            WoWMovement.MoveStop();
                            Logging.Write(Colors.LightSkyBlue, "Profile Changer: Log Out Now, bb");
                            Lua.DoString("ForceQuit()");
                            return;
                        }
                        else
                        {
                            ChangeProfile(Settings.Profile1);
                        }
                    }

                    Logging.WriteDiagnostic(Colors.LightSkyBlue, "Profile Changer: Reset Timer");
                    SWProfile1.Reset();
                    if (Settings.RandomProfile)
                    {
                        StartRandomProfileTimer();
                    }
                    else if (Settings.Active2)
                    {
                        SWProfile2.Start();
                    }
                    else
                    {
                        SWProfile1.Start();
                    }
                }
            }
            if (Settings.Active2)
            {
                if ((SWProfile2.Elapsed.TotalMinutes > Convert.ToInt32(Settings.Minutes2) && !Settings.RandomTime) || (SWProfile2.Elapsed.TotalMinutes > NextRandomTime && Settings.RandomTime))
                {
                    Logging.Write(Colors.LightSkyBlue, "Profile Changer: Change Profile");
                    if (Settings.RandomProfile)
                    {
                        ChangeRandomProfile();
                    }
                    else if (Settings.Active3)
                    {
                        ChangeProfile(Settings.Profile3);
                    }
                    else
                    {
                        if (Settings.StopBot)
                        {
                            WoWMovement.MoveStop();
                            Logging.Write(Colors.LightSkyBlue, "Profile Changer: Log Out Now, bb");
                            Lua.DoString("ForceQuit()");
                            return;
                        }
                        else
                        {
                            ChangeProfile(Settings.Profile1);
                        }
                    }

                    Logging.WriteDiagnostic(Colors.LightSkyBlue, "Profile Changer: Reset Timer");
                    SWProfile2.Reset();
                    if (Settings.RandomProfile)
                    {
                        StartRandomProfileTimer();
                    }
                    else if (Settings.Active3)
                    {
                        SWProfile3.Start();
                    }
                    else
                    {
                        SWProfile1.Start();
                    }
                }
            }
            if (Settings.Active3)
            {
                if ((SWProfile3.Elapsed.TotalMinutes > Convert.ToInt32(Settings.Minutes3) && !Settings.RandomTime) || (SWProfile3.Elapsed.TotalMinutes > NextRandomTime && Settings.RandomTime))
                {
                    Logging.Write(Colors.LightSkyBlue, "Profile Changer: Change Profile");
                    if (Settings.RandomProfile)
                    {
                        ChangeRandomProfile();
                    }
                    else if (Settings.Active4)
                    {
                        ChangeProfile(Settings.Profile4);
                    }
                    else
                    {
                        if (Settings.StopBot)
                        {
                            WoWMovement.MoveStop();
                            Logging.Write(Colors.LightSkyBlue, "Profile Changer: Log Out Now, bb");
                            Lua.DoString("ForceQuit()");
                            return;
                        }
                        else
                        {
                            ChangeProfile(Settings.Profile1);
                        }
                    }

                    Logging.WriteDiagnostic(Colors.LightSkyBlue, "Profile Changer: Reset Timer");
                    SWProfile3.Reset();
                    if (Settings.RandomProfile)
                    {
                        StartRandomProfileTimer();
                    }
                    else if (Settings.Active4)
                    {
                        SWProfile4.Start();
                    }
                    else
                    {
                        SWProfile1.Start();
                    }
                }
            }
            if (Settings.Active4)
            {
                if ((SWProfile4.Elapsed.TotalMinutes > Convert.ToInt32(Settings.Minutes4) && !Settings.RandomTime) || (SWProfile4.Elapsed.TotalMinutes > NextRandomTime && Settings.RandomTime))
                {
                    Logging.Write(Colors.LightSkyBlue, "Profile Changer: Change Profile");
                    if (Settings.RandomProfile)
                    {
                        ChangeRandomProfile();
                    }
                    else if (Settings.Active5)
                    {
                        ChangeProfile(Settings.Profile5);
                    }
                    else
                    {
                        if (Settings.StopBot)
                        {
                            WoWMovement.MoveStop();
                            Logging.Write(Colors.LightSkyBlue, "Profile Changer: Log Out Now, bb");
                            Lua.DoString("ForceQuit()");
                            return;
                        }
                        else
                        {
                            ChangeProfile(Settings.Profile1);
                        }
                    }

                    Logging.WriteDiagnostic(Colors.LightSkyBlue, "Profile Changer: Reset Timer");
                    SWProfile4.Reset();
                    if (Settings.RandomProfile)
                    {
                        StartRandomProfileTimer();
                    }
                    else if (Settings.Active5)
                    {
                        SWProfile5.Start();
                    }
                    else
                    {
                        SWProfile1.Start();
                    }
                }
            }
            if (Settings.Active5)
            {
                if ((SWProfile5.Elapsed.TotalMinutes > Convert.ToInt32(Settings.Minutes5) && !Settings.RandomTime) || (SWProfile5.Elapsed.TotalMinutes > NextRandomTime && Settings.RandomTime))
                {
                    Logging.Write(Colors.LightSkyBlue, "Profile Changer: Change Profile");
                    if (Settings.RandomProfile)
                    {
                        ChangeRandomProfile();
                    }
                    else if (Settings.Active6)
                    {
                        ChangeProfile(Settings.Profile6);
                    }
                    else
                    {
                        if (Settings.StopBot)
                        {
                            WoWMovement.MoveStop();
                            Logging.Write(Colors.LightSkyBlue, "Profile Changer: Log Out Now, bb");
                            Lua.DoString("ForceQuit()");
                            return;
                        }
                        else
                        {
                            ChangeProfile(Settings.Profile1);
                        }
                    }

                    Logging.WriteDiagnostic(Colors.LightSkyBlue, "Profile Changer: Reset Timer");
                    SWProfile5.Reset();
                    if (Settings.RandomProfile)
                    {
                        StartRandomProfileTimer();
                    }
                    else if (Settings.Active6)
                    {
                        SWProfile6.Start();
                    }
                    else
                    {
                        SWProfile1.Start();
                    }
                }
            }
            if (Settings.Active6)
            {
                if ((SWProfile6.Elapsed.TotalMinutes > Convert.ToInt32(Settings.Minutes6) && !Settings.RandomTime) || (SWProfile6.Elapsed.TotalMinutes > NextRandomTime && Settings.RandomTime))
                {
                    Logging.Write(Colors.LightSkyBlue, "Profile Changer: Change Profile");
                    if (Settings.RandomProfile)
                    {
                        ChangeRandomProfile();
                    }
                    else if (Settings.Active7)
                    {
                        ChangeProfile(Settings.Profile7);
                    }
                    else
                    {
                        if (Settings.StopBot)
                        {
                            WoWMovement.MoveStop();
                            Logging.Write(Colors.LightSkyBlue, "Profile Changer: Log Out Now, bb");
                            Lua.DoString("ForceQuit()");
                            return;
                        }
                        else
                        {
                            ChangeProfile(Settings.Profile1);
                        }
                    }

                    Logging.WriteDiagnostic(Colors.LightSkyBlue, "Profile Changer: Reset Timer");
                    SWProfile6.Reset();
                    if (Settings.RandomProfile)
                    {
                        StartRandomProfileTimer();
                    }
                    else if (Settings.Active7)
                    {
                        SWProfile7.Start();
                    }
                    else
                    {
                        SWProfile1.Start();
                    }
                }
            }
            if (Settings.Active7)
            {
                if ((SWProfile7.Elapsed.TotalMinutes > Convert.ToInt32(Settings.Minutes7) && !Settings.RandomTime) || (SWProfile7.Elapsed.TotalMinutes > NextRandomTime && Settings.RandomTime))
                {
                    Logging.Write(Colors.LightSkyBlue, "Profile Changer: Change Profile");
                    if (Settings.RandomProfile)
                    {
                        ChangeRandomProfile();
                    }
                    else if (Settings.Active8)
                    {
                        ChangeProfile(Settings.Profile8);
                    }
                    else
                    {
                        if (Settings.StopBot)
                        {
                            WoWMovement.MoveStop();
                            Logging.Write(Colors.LightSkyBlue, "Profile Changer: Log Out Now, bb");
                            Lua.DoString("ForceQuit()");
                            return;
                        }
                        else
                        {
                            ChangeProfile(Settings.Profile1);
                        }
                    }

                    Logging.WriteDiagnostic(Colors.LightSkyBlue, "Profile Changer: Reset Timer");
                    SWProfile7.Reset();
                    if (Settings.RandomProfile)
                    {
                        StartRandomProfileTimer();
                    }
                    else if (Settings.Active8)
                    {
                        SWProfile8.Start();
                    }
                    else
                    {
                        SWProfile1.Start();
                    }
                }
            }
            if (Settings.Active8)
            {
                if ((SWProfile8.Elapsed.TotalMinutes > Convert.ToInt32(Settings.Minutes8) && !Settings.RandomTime) || (SWProfile8.Elapsed.TotalMinutes > NextRandomTime && Settings.RandomTime))
                {
                    Logging.Write(Colors.LightSkyBlue, "Profile Changer: Change Profile");
                    if (Settings.RandomProfile)
                    {
                        ChangeRandomProfile();
                    }
                    else if (Settings.Active9)
                    {
                        ChangeProfile(Settings.Profile9);
                    }
                    else
                    {
                        if (Settings.StopBot)
                        {
                            WoWMovement.MoveStop();
                            Logging.Write(Colors.LightSkyBlue, "Profile Changer: Log Out Now, bb");
                            Lua.DoString("ForceQuit()");
                            return;
                        }
                        else
                        {
                            ChangeProfile(Settings.Profile1);
                        }
                    }

                    Logging.WriteDiagnostic(Colors.LightSkyBlue, "Profile Changer: Reset Timer");
                    SWProfile8.Reset();
                    if (Settings.RandomProfile)
                    {
                        StartRandomProfileTimer();
                    }
                    else if (Settings.Active9)
                    {
                        SWProfile9.Start();
                    }
                    else
                    {
                        SWProfile1.Start();
                    }
                }
            }
            if (Settings.Active9)
            {
                if ((SWProfile9.Elapsed.TotalMinutes > Convert.ToInt32(Settings.Minutes9) && !Settings.RandomTime) || (SWProfile9.Elapsed.TotalMinutes > NextRandomTime && Settings.RandomTime))
                {
                    Logging.Write(Colors.LightSkyBlue, "Profile Changer: Change Profile");
                    if (Settings.RandomProfile)
                    {
                        ChangeRandomProfile();
                    }
                    else if (Settings.Active10)
                    {
                        ChangeProfile(Settings.Profile10);
                    }
                    else
                    {
                        if (Settings.StopBot)
                        {
                            WoWMovement.MoveStop();
                            Logging.Write(Colors.LightSkyBlue, "Profile Changer: Log Out Now, bb");
                            Lua.DoString("ForceQuit()");
                            return;
                        }
                        else
                        {
                            ChangeProfile(Settings.Profile1);
                        }
                    }

                    Logging.WriteDiagnostic(Colors.LightSkyBlue, "Profile Changer: Reset Timer");
                    SWProfile9.Reset();
                    if (Settings.RandomProfile)
                    {
                        StartRandomProfileTimer();
                    }
                    else if (Settings.Active10)
                    {
                        SWProfile10.Start();
                    }
                    else
                    {
                        SWProfile1.Start();
                    }
                }
            }
            if (Settings.Active10)
            {
                if ((SWProfile10.Elapsed.TotalMinutes > Convert.ToInt32(Settings.Minutes10) && !Settings.RandomTime) || (SWProfile10.Elapsed.TotalMinutes > NextRandomTime && Settings.RandomTime))
                {
                    Logging.Write(Colors.LightSkyBlue, "Profile Changer: Change Profile");
                    if (Settings.RandomProfile)
                    {
                        ChangeRandomProfile();
                    }
                    else if (Settings.Active11)
                    {
                        ChangeProfile(Settings.Profile11);
                    }
                    else
                    {
                        if (Settings.StopBot)
                        {
                            WoWMovement.MoveStop();
                            Logging.Write(Colors.LightSkyBlue, "Profile Changer: Log Out Now, bb");
                            Lua.DoString("ForceQuit()");
                            return;
                        }
                        else
                        {
                            ChangeProfile(Settings.Profile1);
                        }
                    }

                    Logging.WriteDiagnostic(Colors.LightSkyBlue, "Profile Changer: Reset Timer");
                    SWProfile10.Reset();
                    if (Settings.RandomProfile)
                    {
                        StartRandomProfileTimer();
                    }
                    else if (Settings.Active11)
                    {
                        SWProfile11.Start();
                    }
                    else
                    {
                        SWProfile1.Start();
                    }
                }
            }
            if (Settings.Active11)
            {
                if ((SWProfile11.Elapsed.TotalMinutes > Convert.ToInt32(Settings.Minutes11) && !Settings.RandomTime) || (SWProfile11.Elapsed.TotalMinutes > NextRandomTime && Settings.RandomTime))
                {
                    Logging.Write(Colors.LightSkyBlue, "Profile Changer: Change Profile");
                    if (Settings.RandomProfile)
                    {
                        ChangeRandomProfile();
                    }
                    else if (Settings.Active12)
                    {
                        ChangeProfile(Settings.Profile12);
                    }
                    else
                    {
                        if (Settings.StopBot)
                        {
                            WoWMovement.MoveStop();
                            Logging.Write(Colors.LightSkyBlue, "Profile Changer: Log Out Now, bb");
                            Lua.DoString("ForceQuit()");
                            return;
                        }
                        else
                        {
                            ChangeProfile(Settings.Profile1);
                        }
                    }

                    Logging.WriteDiagnostic(Colors.LightSkyBlue, "Profile Changer: Reset Timer");
                    SWProfile11.Reset();
                    if (Settings.RandomProfile)
                    {
                        StartRandomProfileTimer();
                    }
                    else if (Settings.Active12)
                    {
                        SWProfile12.Start();
                    }
                    else
                    {
                        SWProfile1.Start();
                    }
                }
            }

            if (Settings.Active12)
            {
                if ((SWProfile12.Elapsed.TotalMinutes > Convert.ToInt32(Settings.Minutes12) && !Settings.RandomTime) || (SWProfile12.Elapsed.TotalMinutes > NextRandomTime && Settings.RandomTime))
                {
                    Logging.Write(Colors.LightSkyBlue, "Profile Changer: Change Profile");
                    if (Settings.RandomProfile)
                    {
                        ChangeRandomProfile();
                    }
                    else if (Settings.StopBot)
                    {
                        WoWMovement.MoveStop();
                        Logging.Write(Colors.LightSkyBlue, "Profile Changer: Log Out Now, bb");
                        Lua.DoString("ForceQuit()");
                        return;
                    }
                    else
                    {
                        ChangeProfile(Settings.Profile1);
                    }

                    Logging.WriteDiagnostic(Colors.LightSkyBlue, "Profile Changer: Reset Timer");
                    SWProfile12.Reset();
                    if (Settings.RandomProfile)
                    {
                        StartRandomProfileTimer();
                    }
                    else
                    {
                        SWProfile1.Start();
                    }
                }
            }
        }
Exemple #22
0
 public virtual void OnHitEnemy(Vector3 contactPoint, BotBase botBase)
 {
 }
Exemple #23
0
        public BotLoader()
        {
            string HonorbuddyDirectory = Utilities.AssemblyDirectory;
            string MeiamCoreRuntimeFolder = Path.Combine(Utilities.AssemblyDirectory, "Bots\\AutoArena\\Files\\MeiamCoreRuntime.dll");
            string MeiamCoreRuntimeRoot = Path.Combine(Utilities.AssemblyDirectory, "MeiamCoreRuntime.dll");

            if (File.Exists(MeiamCoreRuntimeRoot))
            {
                FileInfo f = new FileInfo(MeiamCoreRuntimeRoot);
                long s1 = f.Length;

                if (s1 != 678912)
                {
                    try
                    {
                        File.Delete(MeiamCoreRuntimeRoot);
                    }
                    catch (IOException ex)
                    {
                        Logging.Write(ex.ToString()); // Write error
                    }

                    try
                    {
                        File.Copy(MeiamCoreRuntimeFolder, MeiamCoreRuntimeRoot);
                    }
                    catch (IOException ex)
                    {
                        Logging.Write(ex.ToString()); // Write error
                    }
                }
            }
            else
            {
                try
                {
                    File.Copy(MeiamCoreRuntimeFolder, MeiamCoreRuntimeRoot);
                }
                catch (IOException ex)
                {
                    Logging.Write(ex.ToString()); // Write error
                }
            }

            string settingsDirectory = Path.Combine(Utilities.AssemblyDirectory, "Bots\\AutoArena");
            string path = settingsDirectory + @"\AutoArena.dll";

            if (TreeRoot.IsRunning)
            {
                LoggingWarning("运行中,请先停止!");
            }
            else
            {
                LoggingInfo("Load Bot: " + path);

                try
                {
                    byte[] data = File.ReadAllBytes(path);
                    Assembly assembly = Assembly.Load(data);
                    DllLoader<BotBase> loader = new DllLoader<BotBase>(assembly, null);

                    if (0 < loader.Count)
                    {
                        _bot = loader.First();
                    }
                    else
                    {
                        LoggingError("Load Error: " + path);
                    }
                }
                catch (Exception error)
                {
                    LoggingError(error.Message);
                }
            }
        }
 private static void OnBotStart(BotBase bot)
 {
     Logging.Write(Colors.Chocolate, $"[LisbethOrderTag] {bot.Name} Started");
     tempbool = true;
 }
Exemple #25
0
    // Should the input enemy spawn in a swarm
    public static bool EnemyDoesSwarmSpawn(BotBase bot)
    {
        if(bot == null) {
            return false;
        }

        System.Type botType = bot.GetType();

        // Add any other evaluations here
        if(botType == typeof(Spider)) {
            return true;
        }

        return false;
    }
Exemple #26
0
 private void OnBotStop(BotBase bot)
 {
     RemoveHooks();
 }
Exemple #27
0
 private void Awake()
 {
     CurrentDurability = startingDurability;
     MyBot             = GetComponentInParent <BotBase>();
 }
        static void Main(string[] args)
        {
            BotBase <Start> bb = new BotBase <Start>(APIKey);

            bb.BotCommands.Add(new BotCommand()
            {
                Command = "start", Description = "Starts the bot"
            });
            bb.BotCommands.Add(new BotCommand()
            {
                Command = "form1", Description = "Opens test form 1"
            });
            bb.BotCommands.Add(new BotCommand()
            {
                Command = "form2", Description = "Opens test form 2"
            });
            bb.BotCommands.Add(new BotCommand()
            {
                Command = "params", Description = "Returns all send parameters as a message."
            });

            bb.BotCommand += async(s, en) =>
            {
                switch (en.Command)
                {
                case "/start":

                    var start = new Menu();

                    await en.Device.ActiveForm.NavigateTo(start);

                    break;

                case "/form1":

                    var form1 = new TestForm();

                    await en.Device.ActiveForm.NavigateTo(form1);

                    break;

                case "/form2":

                    var form2 = new TestForm2();

                    await en.Device.ActiveForm.NavigateTo(form2);

                    break;

                case "/params":

                    String m = en.Parameters.DefaultIfEmpty("").Aggregate((a, b) => a + " and " + b);

                    await en.Device.Send("Your parameters are: " + m, replyTo : en.Device.LastMessageId);

                    en.Handled = true;

                    break;
                }
            };

            //Update Bot commands to botfather
            bb.UploadBotCommands().Wait();

            bb.SetSetting(TelegramBotBase.Enums.eSettings.LogAllMessages, true);

            bb.Message += (s, en) =>
            {
                Console.WriteLine(en.DeviceId + " " + en.Message.MessageText + " " + (en.Message.RawData ?? ""));
            };

            bb.Start();



            Console.WriteLine("Telegram Bot started...");

            Console.WriteLine("Press q to quit application.");


            Console.ReadLine();

            bb.Stop();
        }
 private static void OnBotStart(BotBase bot)
 {
     Logger.Info($"{bot.Name} Started");
     botRunning = true;
     Pulser.Abort();
 }
Exemple #30
0
 private void OnBotStop(BotBase bot)
 {
     botRunning = false;
     Unhook();
 }
 public PbRootComposite(PbDecorator pbBotBase, BotBase secondaryBot)
     : base(pbBotBase, secondaryBot == null ? new PrioritySelector() : secondaryBot.Root)
 {
     _secondaryBot = secondaryBot;
 }
Exemple #32
0
 private void OnBotStart(BotBase bot)
 {
     botRunning = true;
     Hook();
 }
Exemple #33
0
 private void OnBotStart(BotBase bot)
 {
     AddHooks();
 }
        public override void Pulse()
        {
            #region Pulse - check for conditions that we should not Pulse during

            /*
             * if (!StyxWoW.IsInGame)
             * {
             *  if (DateTime.UtcNow > _nextNotInGameMsgAllowed)
             *  {
             *      Logger.WriteDebug(Color.HotPink, "info: not in game");
             *      _nextNotInGameMsgAllowed = DateTime.UtcNow.AddSeconds(30);
             *  }
             *  return;
             * }
             * _nextNotInGameMsgAllowed = DateTime.MinValue;
             *
             * if (!StyxWoW.IsInWorld)
             * {
             *  if (DateTime.UtcNow > _nextNotInWorldMsgAllowed)
             *  {
             *      Logger.WriteDebug(Color.HotPink, "info: not in world");
             *      _nextNotInWorldMsgAllowed = DateTime.UtcNow.AddSeconds(30);
             *  }
             *  return;
             * }
             * _nextNotInWorldMsgAllowed = DateTime.MinValue;
             */

            #endregion

            _pulsePhase++;

            if (_pulsePhase == 1)
            {
                if (WaitForLatencyCheck.IsFinished)
                {
                    Latency = StyxWoW.WoWClient.Latency;
                    WaitForLatencyCheck.Reset();
                }

                // output messages about pulldistance and behaviorflag changes here
                MonitorPullDistance();
                MonitorBehaviorFlags();

/*
 *              // now if combat disabled, bail out
 *              bool combatDisabled = Bots.Grind.BehaviorFlags.Combat != (Bots.Grind.LevelBot.BehaviorFlags & Bots.Grind.BehaviorFlags.Combat);
 *              if (combatDisabled != _lastCombatDisabledState)
 *              {
 *                  _lastCombatDisabledState = combatDisabled;
 *                  Logger.Write(Color.HotPink,
 *                      combatDisabled
 *                          ? "info: botbase disabled BehaviorFlags.Combat"
 *                          : "info: botbase enabled BehaviorFlags.Combat"
 *                      );
 *              }
 */
                // check time since last call and be sure user knows if Singular isn't being called
                if (SingularSettings.Debug)
                {
                    TimeSpan since = CallWatch.TimeSpanSinceLastCall;
                    if (since.TotalSeconds > (4 * CallWatch.SecondsBetweenWarnings))
                    {
                        if (!Me.IsGhost && !Me.Mounted && !Me.IsFlying && DateTime.UtcNow > _nextNoCallMsgAllowed)
                        {
                            Logger.WriteDebug(Color.HotPink, "info: {0:F0} seconds since {1} BotBase last called Singular", since.TotalSeconds, GetBotName());
                            _nextNoCallMsgAllowed = DateTime.UtcNow.AddSeconds(4 * CallWatch.SecondsBetweenWarnings);
                        }
                    }
                }

                UpdateDiagnosticFPS();
            }
            else if (_pulsePhase == 2)
            {
                // talentmanager.Pulse() intense if does work, so return if true
                if (TalentManager.Pulse())
                {
                    return;
                }

                // check and output casting state information
                UpdateDiagnosticCastingState();

                UpdatePullMoreConditionals();

                // Update the current context, check if we need to rebuild any behaviors.
                UpdateContext();
            }
            else if (_pulsePhase == 3)
            {
                _pulsePhase = 0;

                // Pulse our StopAt manager
                StopMoving.Pulse();

                PetManager.Pulse();

                // Double cast maintenance
                Spell.MaintainDoubleCast();

                HotkeyDirector.Pulse();

                WatchAurasForProcs();
            }

            if (Me.Class == WoWClass.Warlock)
            {
                ClassSpecific.Warlock.Common.CancelBurningRushIfNeeded(fromPulse: true);
            }

            // Output if Target changed
            CheckCurrentTarget();

            // Output if Pet or Pet Target changed
            CheckCurrentPet();

            // check Targeting pulses
            if (HealerManager.NeedHealTargeting)
            {
                BotBase bot = GetCurrentBotBase();
                if (bot != null && (bot.PulseFlags & PulseFlags.Targeting) != PulseFlags.Targeting)
                {
                    HealerManager.Instance.Pulse();
                }
            }
            else if (TankManager.NeedTankTargeting && Group.MeIsTank)
            {
                BotBase bot = GetCurrentBotBase();
                if (bot != null && (bot.PulseFlags & PulseFlags.Targeting) != PulseFlags.Targeting)
                {
                    TankManager.Instance.Pulse();
                }
            }
        }
Exemple #35
0
 public void OnStop(BotBase bot)
 {
     OverlayManager.StopMainOverlay();
     OverlayManager.StopCombatMessageOverlay();
     TogglesViewModel.Instance.SaveToggles();
 }
Exemple #36
0
 private void OnBotStop(BotBase bot)
 {
     Logger.SwitcharooLog(@"Stopping Switcharoo!");
     FormManager.SaveFormInstances();
     RoutineManager.PickRoutineFired -= RoutinePickFired;
 }
Exemple #37
0
        /// <summary>
        /// Switches to a different character on same account
        /// </summary>
        /// <param name="character"></param>
        /// <param name="server"></param>
        /// <param name="botName">Name of bot to use on that character</param>
        public static void SwitchCharacter(string character, string server, string botName)
        {
            if (_isSwitchingToons)
            {
                Professionbuddy.Log("Already switching characters");
                return;
            }
            string loginLua = string.Format(LoginLua, character, server);

            _isSwitchingToons = true;
            // reset all actions
            Professionbuddy.Instance.IsRunning = false;
            Professionbuddy.Instance.PbBehavior.Reset();

            Application.Current.Dispatcher.Invoke(
                new Action(() =>
            {
                TreeRoot.Stop();
                BotBase bot =
                    BotManager.Instance.Bots.FirstOrDefault(
                        b => b.Key.IndexOf(botName, StringComparison.OrdinalIgnoreCase) >= 0).Value;
                if (bot != null)
                {
                    if (Professionbuddy.Instance.SecondaryBot.Name != bot.Name)
                    {
                        Professionbuddy.Instance.SecondaryBot = bot;
                    }
                    if (!bot.Initialized)
                    {
                        bot.Initialize();
                    }
                    if (ProfessionBuddySettings.Instance.LastBotBase != bot.Name)
                    {
                        ProfessionBuddySettings.Instance.LastBotBase = bot.Name;
                        ProfessionBuddySettings.Instance.Save();
                    }
                }
                else
                {
                    Professionbuddy.Err("Could not find bot with name {0}", botName);
                }

                Lua.DoString("Logout()");

                new Thread(() =>
                {
                    while (ObjectManager.IsInGame)
                    {
                        Thread.Sleep(2000);
                    }
                    while (!ObjectManager.IsInGame)
                    {
                        Lua.DoString(loginLua);
                        Thread.Sleep(2000);
                    }
                    TreeRoot.Start();
                    Professionbuddy.Instance.OnTradeSkillsLoaded +=
                        Professionbuddy.Instance.Professionbuddy_OnTradeSkillsLoaded;
                    Professionbuddy.Instance.LoadTradeSkills();
                    _isSwitchingToons = false;
                    Professionbuddy.Instance.IsRunning = true;
                })
                {
                    IsBackground = true
                }.Start();
            }));
        }
Exemple #38
0
        /// <summary>
        ///     Switches to a different character on same account
        /// </summary>
        /// <param name="character"></param>
        /// <param name="server"></param>
        /// <param name="botName">Name of bot to use on that character. The bot class type name will also work.</param>
        public static void SwitchCharacter(string character, string server, string botName)
        {
            if (_isSwitchingToons)
            {
                PBLog.Log("Already switching characters");
                return;
            }
            string loginLua = string.Format(LoginLua, character, server);

            _isSwitchingToons = true;
            // reset all actions
            ProfessionbuddyBot.Instance.IsRunning = false;
            ProfessionbuddyBot.Instance.Reset();

            Application.Current.Dispatcher.BeginInvoke(
                new Action(
                    () =>
            {
                Lua.DoString("Logout()");

                new Thread(
                    () =>
                {
                    while (StyxWoW.IsInGame)
                    {
                        Thread.Sleep(2000);
                    }
                    while (!StyxWoW.IsInGame)
                    {
                        Lua.DoString(loginLua);
                        Thread.Sleep(2000);
                    }
                    BotBase bot = Util.GetBotByName(botName);
                    if (bot != null)
                    {
                        if (ProfessionbuddyBot.Instance.SecondaryBot.Name != bot.Name)
                        {
                            ProfessionbuddyBot.Instance.SecondaryBot = bot;
                        }
                        if (!bot.Initialized)
                        {
                            bot.DoInitialize();
                        }
                        if (ProfessionBuddySettings.Instance.LastBotBase != bot.Name)
                        {
                            ProfessionBuddySettings.Instance.LastBotBase = bot.Name;
                            ProfessionBuddySettings.Instance.Save();
                        }
                    }
                    else
                    {
                        PBLog.Warn("Could not find bot with name {0}", botName);
                    }
                    TreeRoot.Start();
                    ProfessionbuddyBot.Instance.OnTradeSkillsLoaded += ProfessionbuddyBot.Instance.Professionbuddy_OnTradeSkillsLoaded;
                    ProfessionbuddyBot.Instance.LoadTradeSkills();
                    _isSwitchingToons = false;
                    ProfessionbuddyBot.Instance.IsRunning = true;
                })
                {
                    IsBackground = true
                }.Start();
            }));
            TreeRoot.Stop();
        }
Exemple #39
0
 void OnBotStart(BotBase bot)
 {
     Logging.Write(LogColor, $"[{Name}] timer failed because we started again");
     quitwatch.Stop();
 }
Exemple #40
0
 public StartUp(BotSelector botConfigurer, NiDbContext dbContext)
 {
     // init db
     dbContext.Database.Migrate();
     Bot = botConfigurer.SelectBot();
 }