Beispiel #1
0
        public static string Safe_UnitName(WoWPartyMember pm)
        {
            if (pm == null)
            {
                return("(null)");
            }

            WoWPlayer p = pm.ToPlayer();

            if (p != null)
            {
                return(Safe_UnitName(p));
            }

            return(GetGroupRoleAssigned(pm).ToString() + " (max health:" + pm.HealthMax + ")");
        }
Beispiel #2
0
        public static string Safe_UnitName(WoWPartyMember pm)
        {
            if (pm == null)
                return "(null)";

            WoWPlayer p = pm.ToPlayer();
            if (p != null)
                return Safe_UnitName(p);

            return GetGroupRoleAssigned(pm).ToString() + " (max health:" + pm.HealthMax + ")";
        }
Beispiel #3
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);
            }
        }