예제 #1
0
        /// <summary>
        /// Handles bot-start
        /// </summary>
        /// <param name="bot"></param>
        private void BotMain_OnStart(IBot bot)
        {
            LeaderComposite.ReplaceBotBehavior();
            if (Enabled)
            {
                Logr.Log("Bot Starting");
                SharedComposites.OutOfGameHookReplaced = false;
                SharedComposites.CheckReplaceOutOfGameHook();
                LeaderService.LeaderOutOfGameUpdate();

                ServiceBase.Communicate();
            }
        }
예제 #2
0
 private void OnHooksCleared(object sender, EventArgs e)
 {
     LeaderComposite.ReplaceBotBehavior();
 }
예제 #3
0
        /// <summary>
        /// Used by leaders and followers to pass updates
        /// </summary>
        /// <returns></returns>
        public static Message GetMessage()
        {
            try
            {
                Message m;

                if (!ZetaDia.Service.IsValid || !ZetaDia.Service.Platform.IsConnected)
                {
                    m = new Message
                    {
                        LastTimeUpdated = DateTime.UtcNow,
                        IsInGame        = false
                    };
                    return(m);
                }
                if (ZetaDia.IsInGame && !ZetaDia.IsLoadingWorld && ZetaDia.Me.IsFullyValid())
                {
                    m = new Message
                    {
                        LastTimeUpdated       = DateTime.UtcNow,
                        LastTimeInGame        = DateTime.UtcNow,
                        IsInGame              = ZetaDia.IsInGame,
                        BattleTagHash         = ZetaDia.Service.Hero.BattleTagName.GetHashCode(),
                        IsInParty             = Social.IsInParty,
                        NumPartymembers       = Social.NumPartyMembers,
                        IsLoadingWorld        = ZetaDia.IsLoadingWorld,
                        ActorClass            = ZetaDia.Me.ActorClass,
                        ActorSNO              = ZetaDia.Me.ActorSNO,
                        GameId                = ZetaDia.Service.CurrentGameId,
                        HitpointsCurrent      = ZetaDia.Me.HitpointsCurrent,
                        HitpointsMaxTotal     = ZetaDia.Me.HitpointsMaxTotal,
                        LevelAreaId           = Player.LevelAreaId,
                        IsInTown              = Player.LevelAreaId != 55313 && ZetaDia.IsInTown, // A2 Caldeum Bazaar
                        Position              = ZetaDia.Me.Position,
                        ProfilePosition       = GetProfilePosition(),
                        ProfileActorSNO       = GetProfileActorSNO(),
                        ProfilePathPrecision  = GetProfilePathPrecision(),
                        ProfileWaypointNumber = GetProfileWaypointNumber(),
                        ProfileTagName        = GetProfileTagname(),
                        IsInCombat            = GetIsInCombat(),
                        WorldId               = ZetaDia.CurrentWorldId,
                        IsVendoring           = BrainBehavior.IsVendoring,
                        IsInGreaterRift       = Player.IsInGreaterRift,
                        CPlayerIndex          = ZetaDia.CPlayer.Index,
                    };

                    if (m.IsInTown)
                    {
                        List <ACDItem> riftKeys = ZetaDia.Me.Inventory.StashItems.Where(i => i.IsValid && i.ItemType == ItemType.KeystoneFragment).ToList();
                        riftKeys.AddRange(ZetaDia.Me.Inventory.Backpack.Where(i => i.IsValid && i.GoodFood == 0xCEFAEDFE && i.ItemType == ItemType.KeystoneFragment).ToList());
                        m.HasRiftKeys = riftKeys.Any();
                        int maxLevel = -1;
                        try
                        {
                            // m.HighestLevelTieredRiftKey = riftKeys.Any() ? riftKeys.Max(i => i.TieredLootRunKeyLevel) : -1;
                            foreach (var key in riftKeys)
                            {
                                try
                                {
                                    int level = key.TieredLootRunKeyLevel;
                                    if (level > maxLevel)
                                    {
                                        maxLevel = level;
                                    }
                                }
                                catch {
                                    // Tell me you love me
                                }
                            }
                        }
                        catch
                        {
                            // You lose!!
                        }
                        m.HighestLevelTieredRiftKey = maxLevel;

                        if (SimpleFollow.IsLeader)
                        {
                            m.RequestOpenRift         = LeaderComposite.ShouldFollowerOpenRift();
                            m.RiftKeyPriority         = QuestToolsSettings.Instance.RiftKeyPriority;
                            m.UseHighestKeystone      = QuestToolsSettings.Instance.UseHighestKeystone;
                            m.MinimumGemChance        = QuestToolsSettings.Instance.MinimumGemChance;
                            m.EnableLimitRiftLevel    = QuestToolsSettings.Instance.EnableLimitRiftLevel;
                            m.LimitRiftLevel          = QuestToolsSettings.Instance.LimitRiftLevel;
                            m.EnableTrialRiftMaxLevel = QuestToolsSettings.Instance.EnableTrialRiftMaxLevel;
                            m.TrialRiftMaxLevel       = QuestToolsSettings.Instance.TrialRiftMaxLevel;
                        }
                    }
                }
                else if (ZetaDia.IsInGame && ZetaDia.IsLoadingWorld)
                {
                    m = new Message
                    {
                        IsInGame        = true,
                        IsLoadingWorld  = true,
                        GameId          = ZetaDia.Service.CurrentGameId,
                        LastTimeInGame  = DateTime.UtcNow,
                        BattleTagHash   = ZetaDia.Service.Hero.BattleTagName.GetHashCode(),
                        IsInTown        = false,
                        WorldId         = -1,
                        LevelAreaId     = -1,
                        LastTimeUpdated = DateTime.UtcNow,
                        IsInParty       = Social.IsInParty,
                        NumPartymembers = Social.NumPartyMembers,
                        ActorClass      = ZetaDia.Service.Hero.Class,
                    };
                }
                else
                {
                    m = new Message
                    {
                        IsInGame        = false,
                        IsInTown        = false,
                        BattleTagHash   = ZetaDia.Service.Hero.BattleTagName.GetHashCode(),
                        WorldId         = -1,
                        LastTimeUpdated = DateTime.UtcNow,
                        IsInParty       = Social.IsInParty,
                        NumPartymembers = Social.NumPartyMembers,
                        ActorClass      = ZetaDia.Service.Hero.Class,
                    };
                }
                return(m);
            }
            catch (Exception ex)
            {
                Logr.Log("Exception in GetMessage() {0}", ex);
                return(new Message());
            }
        }