Exemplo n.º 1
0
        private void btnSetLeader_Click(object sender, EventArgs e)
        {
            if (listView.SelectedItems.Count == 0)
            {
                MessageBox.Show("Choose a Player before clicking Set Leader");
                listView.Focus();
            }
            else
            {
                // WoWPlayer chosenPlayer = (WoWPlayer)listView.SelectedItems[0].Tag;
                ulong guid = (ulong)listView.SelectedItems[0].Tag;
                try
                {
                    Tank.Guid = guid;
                    Tank.SetAsLeader();
                    LazyRaider.IamTheTank = (StyxWoW.Me.Guid == guid);
                    LazyRaider.Log("User selected tank named {0}", LazyRaider.Safe_UnitName(Tank.Current));
                    TreeRoot.StatusText = String.Format("[lr] tank is {0}", LazyRaider.Safe_UnitName(Tank.Current));
                }
                catch
                {
                    listView.SelectedItems[0].Remove();
                }

                this.Hide();
            }
        }
Exemplo n.º 2
0
        private void LoadListView()
        {
            listView.Items.Clear();

            AddRow(LazyRaider.Me.Guid, "-ME-", LazyRaider.Me.Class.ToString(), LazyRaider.GetGroupRoleAssigned(LazyRaider.Me).ToString(), LazyRaider.Me.MaxHealth.ToString());

            if (StyxWoW.IsInGame && StyxWoW.Me != null)
            {
                ObjectManager.Update();

                LazyRaider.Dlog("-- Group Count: {0}", LazyRaider.GroupMemberInfos.Count());

                foreach (WoWPartyMember pm in LazyRaider.GroupMemberInfos)
                {
                    if (pm == null || pm.Guid == LazyRaider.Me.Guid)
                    {
                        continue;
                    }

                    WoWPlayer p      = pm.ToPlayer();
                    string    sName  = p == null ? "-out of range-" : p.Name;
                    string    sRole  = LazyRaider.GetGroupRoleAssigned(pm).ToString();
                    string    sClass = p == null ? "-n/a-" : p.Class.ToString();
                    LazyRaider.Dlog("-- Group Member: {0}.{1:X3} hp={2} is {3}", sClass, pm.Guid, pm.HealthMax, sRole);

                    AddRow(pm.Guid, sName, sClass, sRole, pm.HealthMax.ToString());
                }
            }

            this.listView.ListViewItemSorter = new ListViewItemComparer(2);
            listView.Sort();
            btnSetLeader.Enabled = true;
        }
        private void LoadListView()
        {
            listView.Items.Clear();

            AddRow(null, "-ME-", LazyRaider.Me.Class.ToString(), LazyRaider.GetGroupRoleAssigned(LazyRaider.Me).ToString(), LazyRaider.Me.MaxHealth.ToString());

            if (ObjectManager.IsInGame && ObjectManager.Me != null)
            {
                ObjectManager.Update();

                Logging.WriteDebug(Color.Chocolate, "-- Group Count: {0}", LazyRaider.GroupMembers.Count);

                foreach (WoWPartyMember pm in LazyRaider.GroupMemberInfos)
                {
                    WoWPlayer p = pm.ToPlayer();
                    if (pm == null || p == null || p.IsMe)
                    {
                        continue;
                    }

                    string sRole = LazyRaider.GetGroupRoleAssigned(pm).ToString().ToUpper();
                    Logging.WriteDebug(Color.Chocolate, "-- Group Member: {0} hp={1} is {2}", p.Class.ToString(), p.MaxHealth, sRole);

                    AddRow(p, p.Name, p.Class.ToString(), sRole, p.MaxHealth.ToString());
                }
            }

            btnSetLeader.Enabled = true;
        }
Exemplo n.º 4
0
        public static void Clear()
        {
            LazyRaider.Dlog("Tank.Clear:  cleared tank");

            RaFHelper.ClearLeader();
            Tank.Guid = 0;
        }
Exemplo n.º 5
0
        private void SelectTankForm_VisibleChanged(object sender, EventArgs e)
        {
            isVisible = !isVisible;

            if (isVisible)
            {
                chkAutoSelectTank.Checked           = LazyRaiderSettings.Instance.AutoTankSelect;
                chkAutoFollow.Checked               = LazyRaiderSettings.Instance.FollowTank;
                chkAutoTarget.Checked               = LazyRaiderSettings.Instance.AutoTarget;
                chkAutoTargetOnlyIfNotValid.Checked = LazyRaiderSettings.Instance.AutoTargetOnlyIfNotValidTarget;
                numFollowDistance.Value             = LazyRaiderSettings.Instance.FollowDistance;

                LoadComboBoxWithEnum <LazyRaiderSettings.Keypress>(cboKeyPause);
                SetComboBoxEnum(cboKeyPause, LazyRaiderSettings.Instance.PauseKey);

                chkDisablePlugins.Checked = LazyRaiderSettings.Instance.DisablePlugins;
                chkLockMemory.Checked     = LazyRaiderSettings.Instance.LockMemory;
                numFPS.Value = LazyRaiderSettings.Instance.FPS;
                chkRaidBotLikeBehavior.Checked = LazyRaiderSettings.Instance.RaidBot;

                LoadListView();

                chkRunWithoutTank.Checked = LazyRaiderSettings.Instance.NoTank;

                HandleEnablingOfControls();

                if (listView.Enabled)
                {
                    listView.Focus();
                }
                else
                {
                    chkRaidBotLikeBehavior.Focus();
                }
            }
            else
            {
                LazyRaiderSettings.Instance.NoTank         = chkRunWithoutTank.Checked;
                LazyRaiderSettings.Instance.FollowTank     = chkAutoFollow.Checked;
                LazyRaiderSettings.Instance.FollowDistance = (int)numFollowDistance.Value;
                LazyRaiderSettings.Instance.AutoTankSelect = chkAutoSelectTank.Checked;
                LazyRaiderSettings.Instance.AutoTarget     = chkAutoTarget.Checked;
                LazyRaiderSettings.Instance.AutoTargetOnlyIfNotValidTarget = chkAutoTargetOnlyIfNotValid.Checked;
                LazyRaiderSettings.Instance.PauseKey       = (LazyRaiderSettings.Keypress)GetComboBoxEnum(cboKeyPause);
                LazyRaiderSettings.Instance.DisablePlugins = chkDisablePlugins.Checked;
                LazyRaiderSettings.Instance.LockMemory     = chkLockMemory.Checked;
                LazyRaiderSettings.Instance.FPS            = (int)numFPS.Value;
                LazyRaiderSettings.Instance.RaidBot        = chkRaidBotLikeBehavior.Checked;

                LazyRaiderSettings.Instance.Save();

                // now force a hot reinitialize
                LazyRaider.RefreshSettingsCache();
            }

            return;
        }
Exemplo n.º 6
0
        private void btnClose_Click(object sender, EventArgs e)
        {
            if (chkRunWithoutTank.Checked)
            {
                LazyRaider.Log("selected -ME-, leader cleared");
                Tank.Clear();
            }

            this.Hide();
        }
Exemplo n.º 7
0
        private void btnAutoSetup_Click(object sender, EventArgs e)
        {
            chkRaidBotLikeBehavior.Checked = false;
            chkRunWithoutTank.Checked      = (LazyRaider.GetGroupRoleAssigned(StyxWoW.Me) == WoWPartyMember.GroupRole.Tank);

            int fps = (int)Math.Round(LazyRaider.GetFramerate());

            if (fps < 15)
            {
                fps = 15;
            }
            else if (fps > 30)
            {
                fps = 30;
            }

            numFPS.Value = fps;
            chkDisablePlugins.Checked = true;
            chkLockMemory.Checked     = true;
        }
Exemplo n.º 8
0
        public static void SetAsLeader(ulong guidNew)
        {
            WoWPlayer p = null;

            Tank.Guid = guidNew;

            if (Tank.Guid != 0)
            {
                p = Tank.Current.ToPlayer();
            }

            if (p == null)
            {
                LazyRaider.Dlog("Tank.SetAsLeader:  out of range and cannot resolve {0}", LazyRaider.Safe_UnitName(Tank.Current));
                RaFHelper.ClearLeader();
            }
            else
            {
                LazyRaider.Dlog("Tank.SetAsLeader:  setting tank {0}", LazyRaider.Safe_UnitName(p));
                RaFHelper.SetLeader(p);
                invalidDelegate = new ObjectInvalidateDelegate(RaFLeader_OnInvalidate);
                RaFHelper.Leader.OnInvalidate += invalidDelegate;
            }
        }
        private void btnSetLeader_Click(object sender, EventArgs e)
        {
            if (listView.SelectedItems.Count == 0)
            {
                MessageBox.Show("Choose a Player before clicking Set Leader");
                listView.Focus();
            }
            else
            {
                WoWPlayer chosenPlayer = (WoWPlayer)listView.SelectedItems[0].Tag;
                try
                {
                    if (chosenPlayer != null)
                    {
                        RaFHelper.SetLeader(chosenPlayer);
                        LazyRaider.IamTheTank = false;
                        Logging.Write(Color.Blue, "[LazyRaider] Tank set to {0}, max health {1}", LazyRaider.Safe_UnitName(RaFHelper.Leader), RaFHelper.Leader.MaxHealth);
                    }
                    else // == null
                    {
                        RaFHelper.ClearLeader();
                        LazyRaider.IamTheTank = true;
                        Logging.Write(Color.Blue, "[LazyRaider] selected -ME-, leader cleared");
                    }
                }
                catch
                {
                    listView.SelectedItems[0].Remove();
                }

                this.Hide();
            }
        }
Exemplo n.º 10
0
 public static void RaFLeader_OnInvalidate()
 {
     LazyRaider.Dlog("RaFLeader_OnInvalidate: tank reference now invalid, resetting");
     RaFHelper.ClearLeader();
     invalidDelegate = null;
 }
Exemplo n.º 11
0
        private static bool SyncTankWithRaFLeader()
        {
            try
            {
                // check if Tank we saved is now in range
                if (Tank.Current != null && Tank.Current.ToPlayer() != null)
                {
                    Dlog("SyncTankWithRaFLeader: Tank now in range, so setting RaFHelper");
                    Tank.SetAsLeader();
                    return(false);
                }

                // otherwise, tank out of range pointer for WoWPlayer so clear
                if (RaFHelper.Leader != null)
                {
                    Dlog("SyncTankWithRaFLeader: Tank doesn't match RaFHelper so clearing");
                    RaFHelper.ClearLeader();
                }

                // user wants to control choosing new when we lost tank
                if (!LazyRaiderSettings.Instance.AutoTankSelect)
                {
                    if (haveFoundTankAtGroupForming)
                    {
                        return(false);
                    }
                }

                // have Tank, so keep it until user changes
                if (Tank.Current != null && Tank.Current.IsOnline)
                {
                    return(false);
                }

                WoWPartyMember tank = (from pm in GroupMemberInfos
                                       where GetGroupRoleAssigned(pm) == WoWPartyMember.GroupRole.Tank &&
                                       pm.Guid != Me.Guid &&
                                       pm.IsOnline &&
                                       pm.ToPlayer() != null
                                       orderby pm.Location3D.Distance(Me.Location) ascending
                                       select pm).FirstOrDefault();
                if (tank != null)
                {
                    haveFoundTankAtGroupForming = true;

                    Tank.Current = tank;
                    Log("Tank set to {0} based upon role", LazyRaider.Safe_UnitName(Tank.Current));
                    TreeRoot.StatusText = String.Format("[lr] tank is {0}", Safe_UnitName(tank));
                    return(true);
                }

#if DONT_SET_BY_MAX_HEALTH_FOR_NOW
                tank = (from pm in GroupMemberInfos
                        where pm.Guid != Me.Guid &&
                        pm.IsOnline &&
                        pm.ToPlayer() != null
                        orderby pm.HealthMax descending
                        select pm).FirstOrDefault();
                if (tank != null)
                {
                    Log("Tank set to {0} based upon Max Health", tank.ToPlayer().Class);
                    Tank.Current        = tank;
                    TreeRoot.StatusText = String.Format("[lr] tank is {0}", Safe_UnitName(tank));
                    return(true);
                }
#endif
                return(false);
            }
            catch
            {
                return(true);
            }
        }