コード例 #1
0
 public override void SetStaticDefaults()
 {
     Tooltip.SetDefault("Reduces defense to 0\n" +
                        $"{ModHelpers.ToPercentage(dmgIncPercentage)}% of depleted defense is converted to melee damage\n" +
                        "The wearer will feel tremendous strength, but their fate will be under the command of something else.\n" +
                        "Artifact of the Devil");
 }
コード例 #2
0
 public override void SetStaticDefaults()
 {
     Tooltip.SetDefault($"Attacking enemies has a {ModHelpers.ToPercentage(chance)}% chance to hasten attack speed\n" +
                        $"Critical rate is reduced by {critDecrease}%\n" +
                        "One of the relics known to summon an evil being.\n" +
                        "Artifact of the Vampire");
 }
コード例 #3
0
        public void PrepareKeysForModset_SingleModWithoutKeyWithExternalKey_ExternalBikeyCopied()
        {
            var mod = ModHelpers.CreateTestMod(
                _fixture,
                ModType.Required,
                _modsDirectory);

            CreateDirectoryForMod(_fileSystem, mod, createBikey: false);

            var modset = ModsetHelpers.CreateModsetWithMods(_fixture, mod.AsList());

            CreateExternalKeyForMod(_fileSystem, _externalKeysDirectory, mod);

            var keysPreparer = _serviceProvider.GetService <IKeysPreparer>() !;

            var result = keysPreparer.PrepareKeysForModset(modset);

            using (new AssertionScope())
            {
                result.ShouldBeSuccess();

                var expectedBikeyNames = new List <string>
                {
                    KeysConstants.ArmaKey,
                    $"{mod.Name}{KeysConstants.KeyExtension}"
                };

                AssertCorrectBikeysInDirectory(
                    _fileSystem,
                    _keysDirectory,
                    expectedBikeyNames);
            }
        }
コード例 #4
0
 public CoreMod(HarmonyInstance harmonyInstance, string directory, string settings, string name) : base(
         harmonyInstance, directory, settings, name, new List <IModFeature <IModFeatureSettings> >())
 {
     MechAppearanceData =
         MechModel.ProcessAvailabilityFile(ModHelpers.ModResourceFilePath(this.ModSettings.MechAppearanceFile));
     CoreModSingleton = this;
 }
コード例 #5
0
 public override void SetStaticDefaults()
 {
     Tooltip.SetDefault("Reduces damage reduction to 0%\n" +
                        $"{ModHelpers.ToPercentage(dmgIncPercentage)}% of depleted damage reduction is converted to bonus melee damage %\n" +
                        "Great power is within the shackles, and sacrificing sanity is the key to unleash it.\n" +
                        "Artifact of the Devil");
 }
コード例 #6
0
 public override void SetStaticDefaults()
 {
     Tooltip.SetDefault($"{ModHelpers.ToPercentage(regenMultiplier)}% increased total health regeneration\n" +
                        $"{ModHelpers.ToPercentage(damageMultiplier)}% decreased damage\n" +
                        "The wearer will always feel great, but their energy is drained.\n" +
                        "Artifact of the Succubus");
 }
コード例 #7
0
 public override void SetStaticDefaults()
 {
     Tooltip.SetDefault($"{ModHelpers.ToPercentage(lifeMultiplier)}% increased total health\n" +
                        $"{ModHelpers.ToPercentage(manaMultiplier)}% decreased total mana\n" +
                        "The wearer will feel proud of their physical build, eventually losing their thoughts completely.\n" +
                        "Artifact of the Succubus");
 }
コード例 #8
0
        ////////////////

        public void LoadModListAsync()
        {
            //Task.Run( () => {
            ThreadPool.QueueUserWorkItem(_ => {
                this.IsPopulatingList = true;

                lock (UIControlPanel.ModDataListLock) {
                    this.ModDataList.Clear();
                }

                int i = 1;

                foreach (var mod in ModHelpers.GetAllMods())
                {
                    UIModData moditem = this.CreateModListItem(i++, mod);

                    lock (UIControlPanel.ModDataListLock) {
                        this.ModDataList.Add(moditem);
                    }

                    //if( ModMetaDataManager.HasGithub( moditem.Mod ) ) {
                    moditem.CheckForNewVersionAsync();
                }

                this.ModListUpdateRequired = true;
                this.IsPopulatingList      = false;
            });
        }
コード例 #9
0
 public override void SetStaticDefaults()
 {
     Tooltip.SetDefault("Slightly increases health regeneration\n" +
                        "Lost health % is converted to defense and damage reduction\n" +
                        $"{ModHelpers.ToPercentage(critDmgReduction)}% decreased critical damage\n" +
                        "This ring is said to have enslaved the heart and mind of the beholder.\n" +
                        "Artifact of the Succubus");
 }
コード例 #10
0
 public override void SetStaticDefaults()
 {
     Tooltip.SetDefault($"{ModHelpers.ToPercentage(lifeStealMultiplier)}% life steal\n" +
                        $"{ModHelpers.ToPercentage(statsMultiplier)}% decreased damage reduction and knockback\n" +
                        $"Total defense cut down by {ModHelpers.ToPercentage(statsMultiplier)}%\n" +
                        "It will grant the wearer the powers of a weakened night stalker.\n" +
                        "Artifact of the Vampire");
 }
コード例 #11
0
 public override void SetStaticDefaults()
 {
     Tooltip.SetDefault($"Attacking enemies has a {ModHelpers.ToPercentage(chance)}% chance to inflict Bleeding, Poisoned or Venom\n" +
                        $"Max Life decreased by {healthDecrease}\n" +
                        $"Slightly reduces health regeneration\n" +
                        "A hideous artifact required for reviving an ancient evil.\n" +
                        "Artifact of the Vampire");
 }
コード例 #12
0
 public override void SetStaticDefaults()
 {
     Tooltip.SetDefault("Slightly increases mana regeneration\n" +
                        $"Received damage has a {ModHelpers.ToPercentage(redirectChance)}% chance to be " +
                        "redirected to mana instead of health\n" +
                        $"{ModHelpers.ToPercentage(speedReduction)}% decreased running acceleration and deceleration\n" +
                        "This fine jewelry is known to protect the wearer in exchange for their inner energy.\n" +
                        "Artifact of the Succubus");
 }
コード例 #13
0
 public override void SetStaticDefaults()
 {
     Tooltip.SetDefault("Reduces melee critical rate to 0%\n" +
                        $"Critical rate will increase by {incCrit}% for every successful hit with a melee weapon\n" +
                        $"Critical rate will reset back to 0% after not landing a hit for " +
                        $"{ModHelpers.ToSeconds(tickReset)} {ModHelpers.PluralizeSecond(tickReset)}\n" +
                        "The horns themselves come from the devil itself.\n" +
                        "Natural hate over everything will be built upon the owner's heart." +
                        "Artifact of the Devil");
 }
コード例 #14
0
 public override void SetStaticDefaults()
 {
     Tooltip.SetDefault("Reduces melee critical damage to 0%\n" +
                        $"Critical damage will increase by {ModHelpers.ToPercentage(incCritDmg)}% every " +
                        $"{ModHelpers.ToSeconds(tickInc)} {ModHelpers.PluralizeSecond(tickInc)} when in battle\n" +
                        $"Critical damage will decrease by {ModHelpers.ToPercentage(decCritDmg)}% if hurt\n" +
                        "The very garments of the evil one.\n" +
                        "The wearer will have the same power as the evil one, but at what cost?\n" +
                        "Artifact of the Devil");
 }
コード例 #15
0
        public static void ReportIssue(Mod mod, string issue_title, string issue_body, Action <string> on_success, Action <Exception, string> on_error, Action on_completion = null)
        {
            if (!ModMetaDataManager.HasGithub(mod))
            {
                throw new Exception("Mod is not eligable for submitting issues.");
            }

            int max_lines = HamstarHelpersMod.Instance.Config.ModIssueReportErrorLogMaxLines;

            IEnumerable <Mod> mods        = ModHelpers.GetAllMods();
            string            body_info   = string.Join("\n \n", InfoHelpers.GetGameData(mods).ToArray());
            string            body_errors = string.Join("\n", InfoHelpers.GetErrorLog(max_lines).ToArray());

            string url   = "http://hamstar.pw/hamstarhelpers/issue_submit/";
            string title = "In-game: " + issue_title;
            string body  = body_info;

            body += "\n \n \n \n" + "Recent error logs:\n```\n" + body_errors + "\n```";
            body += "\n \n" + issue_body;

            var json = new GithubModIssueReportData {
                githubuser    = ModMetaDataManager.GetGithubUserName(mod),
                githubproject = ModMetaDataManager.GetGithubProjectName(mod),
                title         = title,
                body          = body
            };
            string json_str = JsonConvert.SerializeObject(json, Formatting.Indented);

            byte[] json_bytes = Encoding.UTF8.GetBytes(json_str);

            Action <String> on_response = (output) => {
                JObject resp_json = JObject.Parse(output);
                //JToken data = resp_json.SelectToken( "Data.html_url" );
                JToken msg = resp_json.SelectToken("Msg");

                /*if( data != null ) {
                 *      string post_at_url = data.ToObject<string>();
                 *      if( !string.IsNullOrEmpty( post_at_url ) ) {
                 *              SystemHelpers.Start( post_at_url );
                 *      }
                 * }*/

                if (msg == null)
                {
                    on_success("Failure.");
                }
                else
                {
                    on_success(msg.ToObject <string>());
                }
            };

            NetHelpers.NetHelpers.MakePostRequestAsync(url, json_bytes, on_response, on_error, on_completion);
        }
コード例 #16
0
        private IModsCache PrepareMockedModsCache()
        {
            var mock = new Mock <ModsCache>();

            var mods = ModHelpers.CreateModsList(_fixture);

            mock
            .Setup(x => x.Mods)
            .Returns(mods);

            return(mock.Object);
        }
コード例 #17
0
        ////////////////

        public override void Action(CommandCaller caller, string input, string[] args)
        {
            IList <Mod> mods    = ModHelpers.GetAllMods().ToList();
            int         arg_idx = 1;

            string title = CommandsHelpers.GetQuotedStringFromArgsAt(args, arg_idx, out arg_idx);

            if (arg_idx == -1)
            {
                caller.Reply("Invalid issue report title string", Color.Red);
                return;
            }

            string body = CommandsHelpers.GetQuotedStringFromArgsAt(args, arg_idx, out arg_idx);

            if (arg_idx == -1)
            {
                caller.Reply("Invalid issue report description string", Color.Red);
                return;
            }

            int mod_idx;

            if (!int.TryParse(args[0], out mod_idx))
            {
                caller.Reply(args[arg_idx] + " is not an integer", Color.Red);
                return;
            }
            if (mod_idx <= 0 || mod_idx > mods.Count)
            {
                caller.Reply(args[arg_idx] + " is not a mod entry; out of range", Color.Red);
                return;
            }

            Action <string> on_success = delegate(string output) {
                if (output != "Done?")
                {
                    caller.Reply(output, Color.GreenYellow);
                }
                else
                {
                    caller.Reply("Issue report was not sent", Color.Red);
                }
            };
            Action <Exception, string> on_fail = (e, output) => {
                caller.Reply(e.Message, Color.Red);
            };

            GithubModIssueReports.ReportIssue(mods[mod_idx - 1], title, body, on_success, on_fail);
        }
コード例 #18
0
        public ModsCacheTests()
        {
            _fileSystemMock.Directory.CreateDirectory(_workingDirectory);
            _settingsMock = CreateSettings();

            _testServiceProvider = new ServiceCollection()
                                   .AddLogging()
                                   .AddArmaServer()
                                   .AddTransient <IModsCache, ModsCache>()
                                   .AddOrReplaceSingleton(_settingsMock)
                                   .AddSingleton(_fileSystemMock)
                                   .BuildServiceProvider();

            _mod = ModHelpers.CreateTestMod(_fixture);
        }
コード例 #19
0
        public void RequiredMods_ModsAndDlcs_Matches()
        {
            var modsList = ModHelpers.CreateModsList(_fixture);
            var dlcsList = DlcHelpers.CreateDlcsList(_fixture);

            var expectedCombinedList = modsList
                                       .Where(x => x.Type == ModType.Required)
                                       .Concat(dlcsList)
                                       .ToList();

            var modset = new Modset
            {
                Mods = modsList.Cast <IMod>().ToHashSet(),
                Dlcs = dlcsList.ToHashSet()
            };

            modset.RequiredMods.Should().BeEquivalentTo(expectedCombinedList);
        }
コード例 #20
0
        public async Task AddOrUpdateModsInCache_SomeModsDataChanged_CacheUpdated()
        {
            var mods = ModHelpers.CreateModsList(_fixture);

            foreach (var mod in mods)
            {
                _fileSystemMock.Directory.CreateDirectory(mod.Directory);
                mod.Directory = _fixture.Create <string>();
            }

            var newMods = ModHelpers.CreateModsList(_fixture);
            var allMods = mods.Concat(newMods).ToList();

            var modsCache = GetModsCache();

            var result = await modsCache.AddOrUpdateModsInCache(allMods);

            result.ShouldBeSuccess(allMods.Cast <IMod>().ToList());
        }
コード例 #21
0
        public override void ModifyTooltips(List <TooltipLine> tooltips)
        {
            AccessoryModPlayer modPlayer = ItemOwner(Main.player[item.owner]);

            if (modPlayer.sashOfTheEvilOne)
            {
                TooltipLine newLine = new TooltipLine(mod, "Tracker", $"Current Critical Damage: {ModHelpers.ToPercentage(modPlayer.sashOfTheEvilOneCritDmg)}%");
                tooltips.Add(newLine);
            }
        }