internal static void AddBotRuntimeSkills(this IServiceCollection services, SkillSettings skillSettings)
 {
     services.AddSingleton(sp => new AuthenticationConfiguration {
         ClaimsValidator = new AllowedCallersClaimsValidator(skillSettings?.AllowedCallers)
     });
     services.AddSingleton <SkillConversationIdFactoryBase, SkillConversationIdFactory>();
     services.AddHttpClient <BotFrameworkClient, SkillHttpClient>();
     services.AddSingleton <ChannelServiceHandler, SkillHandler>();
 }
Пример #2
0
        protected bool IsReasonToUse(SkillSettings settings, Skill skill)
        {
            var routine = Core.Routines.CurrentRoutine;

            if (settings.Reasons.HasFlag(UseReasons.Elites) && TargetUtil.AnyElitesInRange(40f))
            {
                return(true);
            }

            if (settings.Reasons.HasFlag(UseReasons.Trash) && TargetUtil.ClusterExists(routine.TrashRange, routine.TrashRange, routine.ClusterSize))
            {
                return(true);
            }

            if (settings.Reasons.HasFlag(UseReasons.Surrounded) && TargetUtil.NumMobsInRange(25f) >= Math.Max(ClusterSize, 5))
            {
                return(true);
            }

            if (settings.Reasons.HasFlag(UseReasons.Avoiding) && IsCurrentlyAvoiding)
            {
                return(true);
            }

            if (settings.Reasons.HasFlag(UseReasons.Blocked) && PlayerMover.IsBlocked)
            {
                return(true);
            }

            if (settings.Reasons.HasFlag(UseReasons.DumpResource) && Player.PrimaryResourcePct < 0.8f)
            {
                return(true);
            }

            if (settings.Reasons.HasFlag(UseReasons.Goblins) && WeightedUnits.Any(u => u.IsTreasureGoblin))
            {
                return(true);
            }

            if (settings.Reasons.HasFlag(UseReasons.HealthEmergency) && Player.CurrentHealthPct < TrinityCombat.Routines.Current.EmergencyHealthPct)
            {
                return(true);
            }

            if (settings.Reasons.HasFlag(UseReasons.Buff) && settings.BuffCondition != null && settings.BuffCondition())
            {
                return(true);
            }

            return(false);
        }
 public SkillController(ISkillService skillService, IUserService userService, IMediaService mediaService, MediaSettings mediaSettings, IUserSkillService userSkillService, GeneralSettings generalSettings, IPermalinkService permalinkService, IFollowService followService, ILikeService likeService, ICommentService commentService, SkillSettings skillSettings)
 {
     _skillService     = skillService;
     _userService      = userService;
     _mediaService     = mediaService;
     _mediaSettings    = mediaSettings;
     _userSkillService = userSkillService;
     _generalSettings  = generalSettings;
     _permalinkService = permalinkService;
     _followService    = followService;
     _likeService      = likeService;
     _commentService   = commentService;
     _skillSettings    = skillSettings;
 }
Пример #4
0
        public override bool OnMoveOver(Mobile m)
        {
            if (this.Profile != null)
            {
                for (int i = 0; i < 52; i++)
                {
                    m.Skills[i].Base = 0;
                }
                if (Profile.StatEnable)
                {
                    m.RawStr = Profile.StrVal;
                    m.RawDex = Profile.DexVal;
                    m.RawInt = Profile.IntVal;
                }
                if (Profile.SkillEnable)
                {
                    IEnumerator ie = Profile.MasterHash.GetEnumerator();
                    while (ie.MoveNext())
                    {
                        KeyValuePair <string, TMSkillInfo> kvp = (KeyValuePair <string, TMSkillInfo>)ie.Current;
                        if (kvp.Value.SkillEnable)
                        {
                            int value = kvp.Value.SkillValue;
                            int ID    = kvp.Value.SkillID;

                            m.Skills[ID].Base = value;
                        }
                    }
                }
                if (m_SendMap != null && m_SendMap != Map.Internal)
                {
                    m.MoveToWorld(m_SendTo, m_SendMap);
                    //m.Map = m_SendMap;
                    //m.Location = new Point3D( m_SendTo.X, m_SendTo.Y, m_SendTo.Z );
                    //m.MoveToWorld( m_SendTo, m_SendMap );
                    SkillSettings.DoTell("Current x: " + m.X + " Target x: " + m_SendTo.X);
                    //m.X = m_SendTo.X;
                    SkillSettings.DoTell("Current y: " + m.Y + " Target y: " + m_SendTo.Y);
                    //m.Y = m_SendTo.Y;
                    SkillSettings.DoTell("Current z: " + m.Z + " Target z: " + m_SendTo.Z);
                    //m.Z = m_SendTo.Z;
                }
            }
            else
            {
                m.SendMessage("Nothing Happens");
            }
            return(false);
        }
        /// <summary>
        /// A helper utility for checking common skill conditions.
        /// </summary>
        protected bool AllowedToUse(SkillSettings settings, Skill skill)
        {
            if (settings == null || skill == null)
            {
                return(true);
            }

            if (settings.UseMode == UseTime.Always)
            {
                return(true);
            }

            if (settings.UseMode == UseTime.Never)
            {
                return(false);
            }

            if (IsRestricted(settings, skill))
            {
                return(false);
            }

            if (IsReasonToUse(settings, skill))
            {
                return(true);
            }

            if (settings.UseMode == UseTime.Selective)
            {
                return(false);
            }

            if (settings.UseMode == UseTime.OutOfCombat && IsInCombat)
            {
                return(false);
            }

            if (settings.UseMode == UseTime.InCombat && !IsInCombat)
            {
                return(false);
            }

            return(true);
        }
Пример #6
0
        protected bool IsRestricted(SkillSettings settings, Skill skill)
        {
            if (Player.PrimaryResourcePct < settings.PrimaryResourcePct / 100)
            {
                return(true);
            }

            if (Player.SecondaryResourcePct < settings.SecondaryResourcePct / 100)
            {
                return(true);
            }

            if (Player.CurrentHealthPct > settings.HealthPct)
            {
                return(true);
            }

            if (SpellHistory.TimeSinceUse(skill.SNOPower).TotalMilliseconds < settings.RecastDelayMs)
            {
                return(true);
            }

            if (settings.ClusterSize > 0 &&
                !TargetUtil.ClusterExists(15f, settings.ClusterSize))
            {
                return(true);
            }

            if (settings.WaitForConvention == ConventionMode.GreaterRift &&
                !Core.Rift.IsGreaterRift)
            {
                return(true);
            }

            if (settings.WaitForConvention != ConventionMode.Never &&
                settings.ConventionCondition != null &&
                !settings.ConventionCondition())
            {
                return(true);
            }

            return(false);
        }
Пример #7
0
        private Target GetTarget(SkillSettings settings)
        {
            var    maxRange = Math.Max(TrashRange, EliteRange);
            Target target   = null;

            if (settings.Target.HasFlag(UseTarget.Default))
            {
                target = new Target(CurrentTarget);
            }

            else if (settings.Target.HasFlag(UseTarget.CurrentTarget))
            {
                target = new Target(CurrentTarget);
            }

            else if (settings.Target.HasFlag(UseTarget.BestCluster))
            {
                target = new Target(TargetUtil.GetBestClusterUnit(maxRange));
            }

            else if (settings.Target.HasFlag(UseTarget.ClosestMonster))
            {
                target = new Target(TargetUtil.ClosestUnit(maxRange));
            }

            else if (settings.Target.HasFlag(UseTarget.ElitesOnly))
            {
                target = new Target(TargetUtil.BestEliteInRange(maxRange));
            }

            else if (settings.Target.HasFlag(UseTarget.Self))
            {
                target = new Target(Player.Actor);
            }

            else if (settings.Target.HasFlag(UseTarget.SafeSpot))
            {
                target = new Target(Avoider.SafeSpot);
            }

            return(target);
        }
Пример #8
0
        private ValidatedSkill ValidateSkill(SkillSettings settings, Predicate <SkillSettings> condition = null)
        {
            var skill = settings.Skill;

            if (skill == null)
            {
                return(null);
            }

            if (!skill.CanCast())
            {
                return(null);
            }

            if (condition != null && !condition(settings))
            {
                return(null);
            }

            if (!AllowedToUse(settings, skill))
            {
                return(null);
            }

            var target = GetTarget(settings);

            if (target == null)
            {
                return(null);
            }

            var result = new ValidatedSkill
            {
                Skill    = skill,
                Settings = settings,
                Target   = target,
            };

            return(result);
        }
Пример #9
0
    // Use this for initialization
    void Awake()
    {
        thisImg     = GetComponent <Image>();
        normalColor = thisImg.color;//记录此时的颜色
        skillIcon   = transform.Find("Icon").GetComponent <Image>();

        // print("activeSelf: "+skillIcon.gameObject.activeSelf);
        // print("activeInHierarchy: "+skillIcon.gameObject.activeInHierarchy);
        //existSkill = skillIcon.gameObject.activeInHierarchy;
        if (!isActive)
        {
            thisImg.color -= new Color(0, 0, 0, thisImg.color.a);           //将未启用且空的技能图标透明化
        }
        thisRect  = thisImg.rectTransform;
        normalPos = thisRect.anchoredPosition;
        Transform canvas = GameManager.Instance.UICanvas;

        wr = GameManager.Instance.wRatio;
        hr = GameManager.Instance.hRatio;
        gr = canvas.GetComponent <GraphicRaycaster>();

        skillsSetting = GameObject.FindObjectOfType <SkillSettings>();
    }
Пример #10
0
        public void UpdateData(SkillSettings settings, int index)
        {
            Settings = settings;
            if (settings == null)
            {
                _icon.enabled = false;
                _bg.color     = _gray;
            }
            else
            {
                if (settings.Quality == 1)
                {
                    _bg.color = _green;
                }
                else if (settings.Quality == 2)
                {
                    _bg.color = _blue;
                }
                else if (settings.Quality == 3)
                {
                    _bg.color = _yellow;
                }
                _icon.sprite  = settings.Icon;
                _icon.enabled = true;
            }

            if (index < BattleScene.Instance.Player.UnitInfo.SkillCount)
            {
                _lock.gameObject.SetActive(false);
            }
            else
            {
                _lock.gameObject.SetActive(true);
                _bg.color = _gray;
            }
        }
 public VentriloquismLineBotApp(ILineMessagingClient client, SkillSettings settings, ILoggerFactory loggerFactory)
     : base(client, settings.ChannelSecret)
 {
     Logger = loggerFactory.CreateLogger(LogCategories.CreateFunctionUserCategory(nameof(LineBotFunctions)));
 }
Пример #12
0
 public override void LoadDefaults()
 {
     base.LoadDefaults();
     Akarats     = AkaratsDefaults.Clone();
     SteedCharge = SteedChargeDefaults.Clone();
 }
Пример #13
0
 public override void LoadDefaults()
 {
     base.LoadDefaults();
     Epiphany = EpiphanyDefaults.Clone();
 }
Пример #14
0
 public override void LoadDefaults()
 {
     base.LoadDefaults();
     WrathOfTheBerserker = WrathOfTheBerserkerDefaults.Clone();
 }
Пример #15
0
 public override void LoadDefaults()
 {
     base.LoadDefaults();
     SpiritWalk = DefaultSpiritWalkSettings.Clone();
 }
Пример #16
0
 public override void LoadDefaults()
 {
     base.LoadDefaults();
     FuriousCharge = VaultDefaults.Clone();
 }
Пример #17
0
 public override void LoadDefaults()
 {
     base.LoadDefaults();
     Epiphany      = EpiphanyDefaults.Clone();
     DashingStrike = DashingStrikeDefaults.Clone();
 }
 public VentriloquismClova(ILineMessagingClient lineMessagingClient, SkillSettings settings, ILoggerFactory loggerFactory)
 {
     LineMessagingClient = lineMessagingClient;
     AudioUrl            = settings.AudioUrl;
     Logger = loggerFactory.CreateLogger(LogCategories.CreateFunctionUserCategory(nameof(ClovaFunctions)));
 }
        public static SkillWithUsersModel ToSkillWithUsersModel(this Skill skill, IUserSkillService userSkillService, IMediaService mediaService,
                                                                MediaSettings mediaSettings, GeneralSettings generalSettings, SkillSettings skillSettings, IFollowService followService, ILikeService likeService, ICommentService commentService)
        {
            var currentUser = ApplicationContext.Current.CurrentUser;
            var model       = new SkillWithUsersModel()
            {
                Skill = skill.ToModel(),
                FeaturedMediaImageUrl = skill.FeaturedImageId > 0 ? mediaService.GetPictureUrl(skill.FeaturedImageId) : mediaSettings.DefaultSkillCoverUrl
            };

            var perPage = skillSettings.NumberOfUsersPerPageOnSinglePage;
            //by default we'll send data for 15 users. rest can be queried with paginated request
            //todo: make this thing configurable to set number of users to return with this response
            var userSkills = userSkillService.Get(x => x.SkillId == skill.Id, page: 1, count: perPage, earlyLoad: x => x.User).ToList();

            model.UserSkills =
                userSkills.Select(x => x.ToModel(mediaService, mediaSettings, generalSettings, false, true, true, false)).ToList();

            model.CurrentPage   = 1;
            model.UsersPerPage  = perPage;
            model.TotalUsers    = userSkillService.Count(x => x.SkillId == skill.Id);
            model.FollowerCount = followService.GetFollowerCount <Skill>(skill.Id);

            if (currentUser != null)
            {
                //does this user follow this skill?
                var userFollow = followService.GetCustomerFollow <Skill>(currentUser.Id, skill.Id);
                model.CanFollow    = currentUser.Id != skill.UserId;
                model.FollowStatus = userFollow == null ? 0 : 1;

                model.LikeStatus = likeService.GetCustomerLike <Skill>(currentUser.Id, skill.Id) == null ? 0 : 1;

                model.HasSkill = userSkills.Any(x => x.UserId == currentUser.Id);
            }


            model.TotalComments = commentService.GetCommentsCount(skill.Id, "skill");

            model.TotalLikes = likeService.GetLikeCount <Skill>(skill.Id);

            return(model);
        }
Пример #20
0
 public void GetStatusValue()
 {
     XmlDocument xmlDoc = new XmlDocument();
     xmlDoc.LoadXml(GameAsset.text);
     XmlNodeList setting_values = xmlDoc.GetElementsByTagName(skillsSettingsTag);
     skillsSettings = new List<SkillSettings>();
     foreach (XmlNode setting_value in setting_values) {
         XmlNodeList status_contents = setting_value.ChildNodes;
         SkillSettings skillSettings = new SkillSettings();
         skillSettings.statusValues = new Dictionary<string, string>();
         foreach (XmlNode status_content in status_contents) {
             foreach (string tag_name in Enum.GetNames(typeof(TagNames))) {
                 if (status_content.Name == tag_name) {
                     skillSettings.statusValues.Add(tag_name, status_content.InnerText);
                 }
             }
         }
         skillsSettings.Add(skillSettings);
     }
 }
Пример #21
0
 private bool TryValidateSkill(SkillSettings skillSettings, out ValidatedSkill validatedSkill)
 {
     return((validatedSkill = ValidateSkill(skillSettings)) != null);
 }
 public override void LoadDefaults()
 {
     base.LoadDefaults();
     Teleport = TeleportDefaults.Clone();
 }
Пример #23
0
 public override void LoadDefaults()
 {
     base.LoadDefaults();
     BloodRush = BloodRushDefaults.Clone();
 }