Beispiel #1
0
 public Language(Inventory inventory, Syllable syllable, Rules rules, Affixes affixes)
 {
     this.inventory = inventory;
     this.syllable  = syllable;
     this.rules     = rules;
     this.affixes   = affixes;
 }
Beispiel #2
0
        public static RolledEquipment Get(string baseName, string prefixName, string suffixName)
        {
            var prefix = prefixName == null ? null : Affixes.Get(prefixName);
            var suffix = suffixName == null ? null : Affixes.Get(suffixName);

            return(new RolledEquipment(Get(baseName), prefix, suffix));
        }
Beispiel #3
0
        /// <summary>
        /// Запрос данных и возврат их в качестве поля
        /// </summary>
        /// <returns></returns>
        public async Task <DiscordEmbedBuilder> AffixRequest()
        {
            var embed = new DiscordEmbedBuilder
            {
                Color = new DiscordColor("#3AE6DB"),
                Title = "Модификаторы эпохальных подземелий",
                //Description = "11",
                Timestamp = DateTime.UtcNow
            };
            var plusAddiction   = new[] { " (+2) ", " (+4) ", " (+7) ", " (+10) " };
            var responseContent =
                RioRequest.Request("https://raider.io/api/v1/mythic-plus/affixes?region=eu&locale=ru").Result;

            // Собираем ответ
            using var reader = new StreamReader(await responseContent.ReadAsStreamAsync());
            var  serializedAffixes = Affixes.FromJson(await reader.ReadToEndAsync());
            long affix4            = 0;
            long affix7            = 0;

            for (var i = 0; i < serializedAffixes.AffixDetails.Length; i++)
            {
                var namePlusAffixLevel = plusAddiction[i] + serializedAffixes.AffixDetails[i].Name;
                embed.AddField(namePlusAffixLevel, serializedAffixes.AffixDetails[i].Description);
                switch (i)
                {
                case 1: affix4 = serializedAffixes.AffixDetails[i].Id; break;

                case 2: affix7 = serializedAffixes.AffixDetails[i].Id; break;
                }
            }
            embed.WithFooter("by Raider.IO", "https://cdnassets.raider.io/images/brand/Mark_2ColorWhite.png");
            embed.AddField("Модификаторы следующей недели:", NextWeekAffix(affix4, affix7));
            return(embed);
        }
        public void GenerateFullItemName_AllNameElements()
        {
            // Arrange
            Affixes affixes = new Affixes
            {
                FirstPrefix = new FirstPrefix
                {
                    AffixName = "Soldier's"
                },
                SecondaryPrefix = new SecondaryPrefix
                {
                    AffixName = "Steel"
                },
                Suffix = new Suffix
                {
                    AffixName = "of Brotherhood"
                }
            };

            string testName = "Soldier's Steel Dagger of Brotherhood";

            // Act
            ItemName itemName = new ItemName("Dagger", affixes);

            // Assert
            Assert.Equal(testName, itemName.FullItemName);
        }
Beispiel #5
0
        public void Activate(string eventName)
        {
            var affixes = Affixes.FindAll(x => x.AffixData.Activators != null && x.AffixData.Activators.Contains(eventName));

            foreach (var affix in Affixes)
            {
                affix.Activate();
            }
        }
Beispiel #6
0
        public int GetAffixTier(string affixName)
        {
            var affix = Affixes.Find(x => x.AffixData.Name == affixName);

            if (affix != null)
            {
                return(affix.Tier);
            }
            return(-1);
        }
Beispiel #7
0
        public void RemoveAffix(Affix affix)
        {
            if (!Affixes.Contains(affix))
            {
                return;
            }

            affix.Disable();
            Affixes.Remove(affix);
            Dirty = true;
        }
        public void GenerateFullItemName_BaseNameOnly()
        {
            // Arrange
            Affixes affixes  = new Affixes();
            string  testName = "Dagger";

            // Act
            ItemName itemName = new ItemName("Dagger", affixes);

            // Assert
            Assert.Equal(testName, itemName.FullItemName);
        }
Beispiel #9
0
        public Affix UpdateAffix(string affixName, int tier)
        {
            var multiple = Affixes.Count(x => x.AffixData.Name == affixName);

            if (multiple > 1)
            {
                throw new Exception("Don't use string identifier for common affixes sharing a name");
            }

            RemoveAffix(affixName);
            Dirty = true;

            return(AddAffix(affixName, tier));
        }
Beispiel #10
0
        static MyvarEditEngine()
        {
            Input.KeyPress = KeyPress;
            Input.SendKey  = SendKey;
            var sw = new Stopwatch();

            sw.Start();
            WebstersEnglishDictionary =
                JsonConvert.DeserializeObject <Dictionary <string, string> >(File.ReadAllText("dictionary_compact.json"));
            sw.Stop();
            Console.WriteLine($"Loading Dict took {sw.ElapsedMilliseconds}ms.");
            Console.WriteLine(WebstersEnglishDictionary.Count);

            Affixes.AddRange(File.ReadAllLines("afixes"));
        }
Beispiel #11
0
        public Affix AddAffix(string affixName, int tier = 0, int roll = 0)
        {
            var affix = Hellforge.GenerateAffix(this, affixName, tier, roll);

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

            Affixes.Add(affix);

            Dirty = true;

            return(affix);
        }
        public void GenerateFullItemName_BaseNameAndSuffix()
        {
            // Arrange
            Affixes affixes = new Affixes
            {
                Suffix = new Suffix
                {
                    AffixName = "of Brotherhood"
                }
            };

            string testName = "Dagger of Brotherhood";

            // Act
            ItemName itemName = new ItemName("Dagger", affixes);

            // Assert
            Assert.Equal(testName, itemName.FullItemName);
        }
        public void GenerateFullItemName_SecondaryPrefixAndBaseName()
        {
            // Arrange
            Affixes affixes = new Affixes
            {
                SecondaryPrefix = new SecondaryPrefix
                {
                    AffixName = "Steel"
                }
            };

            string testName = "Steel Dagger";

            // Act
            ItemName itemName = new ItemName("Dagger", affixes);

            // Assert
            Assert.Equal(testName, itemName.FullItemName);
        }
        public void GenerateFullItemName_FirstPrefixAndBaseName()
        {
            // Arrange
            Affixes affixes = new Affixes
            {
                FirstPrefix = new FirstPrefix
                {
                    AffixName = "Soldier's"
                }
            };

            string testName = "Soldier's Dagger";

            // Act
            ItemName itemName = new ItemName("Dagger", affixes);

            // Assert
            Assert.Equal(testName, itemName.FullItemName);
        }
Beispiel #15
0
        public void RemoveAffix(string affixName)
        {
            var multiple = Affixes.Count(x => x.AffixData.Name == affixName);

            if (multiple > 1)
            {
                throw new Exception("Don't use string identifier for common affixes sharing a name");
            }

            var affix = GetAffix(affixName);

            if (affix == null)
            {
                return;
            }

            affix.Disable();
            Affixes.Remove(affix);
            Dirty = true;
        }
Beispiel #16
0
        private string GenerateFullItemName(string baseItemName, Affixes affixes)
        {
            var separator = " ";
            var sb        = new StringBuilder();

            if (affixes.FirstPrefix != null)
            {
                sb.Append(affixes.FirstPrefix.AffixName + separator);
            }
            if (affixes.SecondaryPrefix != null)
            {
                sb.Append(affixes.SecondaryPrefix.AffixName + separator);
            }
            sb.Append(baseItemName);
            if (affixes.Suffix != null)
            {
                sb.Append(separator + affixes.Suffix.AffixName);
            }

            return(sb.ToString());
        }
Beispiel #17
0
 public ItemName(string baseItemName, Affixes affixes)
 {
     FullItemName = GenerateFullItemName(baseItemName, affixes);
 }
Beispiel #18
0
    public static void Main(string[] args)
    {
        // build up a very simple vowel inventory
        // make sure features are within simple set in Inventory's place/manner/voicing
        Inventory inventory = new Inventory();

        inventory.AddConsonant("b", "voiced", "bilabial", "plosive");
        inventory.AddConsonant("p", "voiceless", "bilabial", "plosive");
        inventory.AddConsonant("g", "voiced", "velar", "plosive");
        inventory.AddConsonant("k", "voiceless", "velar", "plosive");
        inventory.AddConsonant("d", "voiced", "dental", "plosive");
        inventory.AddConsonant("t", "voiceless", "dental", "plosive");
        inventory.AddConsonant("h", "voiceless", "glottal", "fricative");
        inventory.AddConsonant("l", "voiced", "alveolar", "lateral");
        inventory.AddConsonant("r", "voiced", "alveolar", "approximant");
        inventory.AddConsonant("w", "voiced", "velar", "approximant");
        // build up very simple consonant inventory
        // make sure features are within simple set in Inventory's height/backness/rounding
        inventory.AddVowel("i", "close", "front", "unrounded");
        inventory.AddVowel("a", "open", "central", "unrounded");
        inventory.AddVowel("u", "close", "back", "rounded");

        // recall features using any letter
        Debug.Log(inventory.GetFeatures("b"));

        // This finds "b":
        List <string> testFeaturesList = new List <string> {
            "voiced", "bilabial", "plosive"
        };

        inventory.GetLetter(testFeaturesList);
        // This will not find "b":
        testFeaturesList [0] = "bilabial";
        testFeaturesList [1] = "voiced";
        inventory.GetLetter(testFeaturesList);

        Syllable syllableStructure = new Syllable();

        syllableStructure.AddStructure(new List <string> {
            "C", "V"
        });
        syllableStructure.AddStructure(new List <string> {
            "C", "V", "V"
        });
        syllableStructure.AddStructure(new List <string> {
            "C", "V", "C"
        });
        syllableStructure.AddStructure(new List <string> {
            "C", "V", "V", "C"
        });

        Rules rules = new Rules();

        rules.AddRule("voiced", "voiceless", "_ voiceless");

        Affixes affixes = new Affixes();

        // add prefixes and suffixes
        // trusts you to use only characters found in inventory (matters for rule application)
        affixes.AddAffix("human", "-", "g", "u", "d");
        affixes.AddAffix("nonhuman", "-", "i", "d");
        affixes.AddAffix("strong", "t", "-");
        affixes.AddAffix("small", "l", "-");
        affixes.AddAffix("strange", "g", "-");

        // TODO structure language
        Language language = new Language(inventory, syllableStructure, rules, affixes);

        // build a long proper noun
        List <string> properNoun = language.BuildWord(3, true, "strong", "nonhuman");

        Debug.Log(string.Join("", properNoun.ToArray()));

        // build a short regular noun
        List <string> justSomeNoun = language.BuildWord(2);

        // add both to the dictionary
        language.AddEntry(properNoun, "Wolf");
        language.AddEntry(justSomeNoun, "food");
        Debug.Log(language.PrintDictionary());
    }
Beispiel #19
0
        static void Main(string[] args)
        {
            var manager = new FileManager(@"C:\Hellgate");

            manager.BeginAllDatReadAccess();
            manager.LoadTableFiles();
            manager.EndAllDatAccess();

            //TODO: hp/power regen is messed up when displaying the full formula because I guess the itemdisplay formula isn't used

            //note: "display dmg" is ilvl multi*item dmg*dmg% (before "increments" are applied), where dmg% is the first or second argument in dmg_elec(100,100)

            //TODO: weapon ranges
            //TODO: add affix names to properties
            //TODO: sword attack rates
            //TODO: wtf is up with ilvls that don't match any of the listed numbers (maxlevel, fixedlevel, level)?

            //long term TODO: assign unit types so "isa" functions (among other things) work

            args = new[] { "ITEMS" };

            //new Items(manager).WriteAllUniqueLegendaryItemPages();
            //return;

            string     sqlStatement;
            WikiScript script;

            foreach (string arg in args)
            {
                switch (arg)
                {
                case "ACHIEVEMENTS":
                    script = new Achievements(manager);
                    break;

                case "AFFIXES":
                    script = new Affixes(manager);
                    break;

                case "BASEWAVES":
                    script = new BaseDefenseWaves(manager);
                    break;

                case "MONSTERAFFIXES":
                    script = new MonsterAffixes(manager);
                    break;

                case "ARMORAFFIXES":
                    script = new ArmorAffixes(manager);
                    break;

                case "ITEMLEVELS":
                    script = new ItemLevels(manager);
                    break;

                case "LEVELS":
                    script = new Levels(manager);
                    break;

                case "MONSTERS":
                    script = new Monsters(manager);
                    break;

                case "PVPRANKS":
                    script = new PVPRanks(manager);
                    break;

                case "LEVELSCALING":
                    script = new LevelScaling(manager);
                    break;

                case "ITEMS":
                    script = new Items(manager);
                    break;

                case "ITEM_QUALITY":
                    script = new ItemQuality(manager);
                    break;

                case "TREASURE":
                    script = new NewTreasure(manager);
                    break;

                case "MONSTER_QUALITY":
                    script = new MonsterQuality(manager);
                    break;

                case "RECIPES":
                    script = new Recipes(manager);
                    break;

                case "ITEM_SETS":
                    script = new Sets(manager);
                    break;

                default:
                    throw new Exception("Unknown WikiScript: " + arg);
                }

                sqlStatement = script.ExportTableInsertScript();

                File.WriteAllText(arg.ToLower() + ".sql", sqlStatement);
            }

            return;
        }
Beispiel #20
0
 public Affix GetAffix(string affixName)
 {
     return(Affixes.Find(x => x.AffixData.Name == affixName));
 }