Esempio n. 1
0
        private bool ActorIsLeader(DiaPlayer p)
        {
            if (p == null)
                return false;
            if (!p.IsValid)
                return false;
            if (!p.IsACDBased)
                return false;
            if (p.CommonData == null)
                return false;

            double hitPointsmaxTotal;
            int actorId;
            try
            {
                hitPointsmaxTotal = p.HitpointsMaxTotal;
                actorId = p.ActorSNO;
            }
            catch
            {
                return false;
            }

            return hitPointsmaxTotal == Leader.HitpointsMaxTotal && actorId == Leader.ActorSNO;
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the leader from the RActorList with known data
        /// </summary>
        /// <returns></returns>
        private Composite LocalDataUpdateSequence()
        {
            return new Action(ret =>
                {
                    ServiceBase.Communicate();
                    Me.Update();

                    if (LeaderPortal != null)
                        LeaderPortal.Update();

                    bool readyForUpdate = DateTime.UtcNow.Subtract(LastLocalDataUpdate).TotalMilliseconds > Settings.Instance.UpdateInterval;
                    if (ZetaDia.IsInTown)
                        GetLeaderIndex();
                    if (readyForUpdate || _diaLeader == null || (_diaLeader != null && !_diaLeader.IsValid))
                    {
                        _diaPlayers = ZetaDia.Actors.GetActorsOfType<DiaPlayer>().Where(ActorIsLeader).ToList();

                        if (_diaPlayers != null && _diaPlayers.Count > 0)
                            _diaLeader = _diaPlayers.FirstOrDefault();

                        _headstones = ZetaDia.Actors.GetActorsOfType<DiaGizmo>().Where(h => h.ActorSNO == 4860).OrderBy(h => h.Distance);
                    }
                }
            );
        }