示例#1
0
        public virtual void RaiseNewTargetEntity(TargetEntity e)
        {
            var targetEntityEvent = new TargetEntityEvent(this, e);
            var handler           = NewTargetEntity;

            if (handler != null)
            {
                handler(this, targetEntityEvent);
            }
        }
示例#2
0
 private static void OnNewTargetEntity(object sender, TargetEntityEvent targetEntityEvent)
 {
     // delegate event from target info from ram, not required to subsribe
     // this includes the full entities for current, previous, mouseover, focus targets (if 0+ are found)
     // it also includes a list of upto 16 targets that currently have hate on the currently targeted monster
     // these hate values are realtime and change based on the action used
     // this updates 10x a second and only sends data when the newly read data is differen than what was previously sent
     if (sender == null)
     {
         return;
     }
     var targetEntity = targetEntityEvent.TargetEntity;
 }
        private static void OnNewTargetEntity(object sender, TargetEntityEvent targetEntityEvent)
        {
            // delegate event from target info from ram, not required to subsribe
            // this includes the full entities for current, previous, mouseover, focus targets (if 0+ are found)
            // it also includes a list of upto 16 targets that currently have hate on the currently targeted monster
            // these hate values are realtime and change based on the action used
            // this updates 10x a second and only sends data when the newly read data is differen than what was previously sent
            if (sender == null)
            {
                return;
            }
            var targetEntity = targetEntityEvent.TargetEntity;

            XIVInfoViewModel.Instance.EnmityEntries   = new ObservableCollection <EnmityEntry>(targetEntity.EnmityEntries ?? new List <EnmityEntry>());
            XIVInfoViewModel.Instance.CurrentTarget   = targetEntity.CurrentTarget ?? new ActorEntity();
            XIVInfoViewModel.Instance.MouseOverTarget = targetEntity.MouseOverTarget ?? new ActorEntity();
            XIVInfoViewModel.Instance.FocusTarget     = targetEntity.FocusTarget ?? new ActorEntity();
            XIVInfoViewModel.Instance.PreviousTarget  = targetEntity.PreviousTarget ?? new ActorEntity();
        }
        //private static void OnNewPlayerEntity(object sender, PlayerEntityEvent playerEntityEvent)
        //{
        //    // delegate event from player info from ram, not required to subsribe
        //    // this is for YOU and includes all your stats and your agro list with hate values as %
        //    // this updates 10x a second and only sends data when the newly read data is differen than what was previously sent
        //    if (sender == null)
        //    {
        //        return;
        //    }
        //    var playerEntity = playerEntityEvent.PlayerEntity;
        //}

        private static void OnNewTargetEntity(object sender, TargetEntityEvent targetEntityEvent)
        {
            // delegate event from target info from ram, not required to subsribe
            // this includes the full entities for current, previous, mouseover, focus targets (if 0+ are found)
            // it also includes a list of upto 16 targets that currently have hate on the currently targeted monster
            // these hate values are realtime and change based on the action used
            // this updates 10x a second and only sends data when the newly read data is differen than what was previously sent
            if (sender == null)
            {
                return;
            }
            var targetEntity = targetEntityEvent.TargetEntity;
            var emptyEntity  = new TargetEntity();

            // assign empty entity
            EnmityWidgetViewModel.Instance.TargetEntity        = emptyEntity;
            FocusTargetWidgetViewModel.Instance.TargetEntity   = emptyEntity;
            CurrentTargetWidgetViewModel.Instance.TargetEntity = emptyEntity;
            // assign default current/focus target info
            EnmityWidgetViewModel.Instance.EnmityTargetIsValid           = false;
            EnmityWidgetViewModel.Instance.EnmityTargetHPPercent         = 0;
            EnmityWidgetViewModel.Instance.EnmityTargetDistance          = 0;
            FocusTargetWidgetViewModel.Instance.FocusTargetIsValid       = false;
            FocusTargetWidgetViewModel.Instance.FocusTargetHPPercent     = 0;
            FocusTargetWidgetViewModel.Instance.FocusTargetDistance      = 0;
            CurrentTargetWidgetViewModel.Instance.CurrentTargetIsValid   = false;
            CurrentTargetWidgetViewModel.Instance.CurrentTargetHPPercent = 0;
            CurrentTargetWidgetViewModel.Instance.CurrentTargetDistance  = 0;
            // if valid assign actual current target info
            if (targetEntity.CurrentTarget != null && targetEntity.CurrentTarget.IsValid && Settings.Default.ShowEnmityWidgetOnLoad)
            {
                EnmityWidgetViewModel.Instance.TargetEntity          = targetEntity;
                EnmityWidgetViewModel.Instance.EnmityTargetIsValid   = true;
                EnmityWidgetViewModel.Instance.EnmityTargetHPPercent = (double)targetEntity.CurrentTarget.HPPercent;
                try
                {
                    EnmityWidgetViewModel.Instance.EnmityTargetDistance = XIVInfoViewModel.Instance.CurrentUser.GetDistanceTo(targetEntity.CurrentTarget);
                }
                catch (Exception ex)
                {
                }
            }
            // if valid assign actual current target info
            if (targetEntity.CurrentTarget != null && targetEntity.CurrentTarget.IsValid && Settings.Default.ShowCurrentTargetWidgetOnLoad)
            {
                CurrentTargetWidgetViewModel.Instance.TargetEntity           = targetEntity;
                CurrentTargetWidgetViewModel.Instance.CurrentTargetIsValid   = true;
                CurrentTargetWidgetViewModel.Instance.CurrentTargetHPPercent = (double)targetEntity.CurrentTarget.HPPercent;
                try
                {
                    CurrentTargetWidgetViewModel.Instance.CurrentTargetDistance = XIVInfoViewModel.Instance.CurrentUser.GetDistanceTo(targetEntity.CurrentTarget);
                }
                catch (Exception ex)
                {
                }
            }
            // if valid assign actual focus target info
            if (targetEntity.FocusTarget != null && targetEntity.FocusTarget.IsValid && Settings.Default.ShowFocusTargetWidgetOnLoad)
            {
                FocusTargetWidgetViewModel.Instance.TargetEntity         = targetEntity;
                FocusTargetWidgetViewModel.Instance.FocusTargetIsValid   = true;
                FocusTargetWidgetViewModel.Instance.FocusTargetHPPercent = (double)targetEntity.FocusTarget.HPPercent;
                try
                {
                    FocusTargetWidgetViewModel.Instance.FocusTargetDistance = XIVInfoViewModel.Instance.CurrentUser.GetDistanceTo(targetEntity.FocusTarget);
                }
                catch (Exception ex)
                {
                }
            }
        }