From eb6101acfbe05fa322d3f87dce8b3f4cd8041aa9 Mon Sep 17 00:00:00 2001 From: Starciad Date: Tue, 23 Jan 2024 18:44:16 -0300 Subject: [PATCH] feat: Add utilities and collection files. --- .../collections/names/EUANamesCollection.js | 323 ++++++++++++++++++ scripts/core/dataGenerator.js | 57 ++++ scripts/core/pageUpdater.js | 3 + scripts/math/random.js | 5 + 4 files changed, 388 insertions(+) create mode 100644 scripts/collections/names/EUANamesCollection.js create mode 100644 scripts/core/dataGenerator.js create mode 100644 scripts/core/pageUpdater.js create mode 100644 scripts/math/random.js diff --git a/scripts/collections/names/EUANamesCollection.js b/scripts/collections/names/EUANamesCollection.js new file mode 100644 index 0000000..ef91b96 --- /dev/null +++ b/scripts/collections/names/EUANamesCollection.js @@ -0,0 +1,323 @@ +export const EUANamesCollection = Object.freeze({ + maleNames: [ + "James", + "John", + "Robert", + "Michael", + "William", + "David", + "Richard", + "Joseph", + "Charles", + "Thomas", + "Christopher", + "Daniel", + "Matthew", + "Donald", + "Brian", + "Mark", + "George", + "Steven", + "Edward", + "Paul", + "Kenneth", + "Andrew", + "Joshua", + "Kevin", + "Jeffrey", + "Ryan", + "Jacob", + "Gary", + "Nicholas", + "Eric", + "Stephen", + "Jonathan", + "Larry", + "Justin", + "Scott", + "Brandon", + "Benjamin", + "Samuel", + "Frank", + "Gregory", + "Raymond", + "Alexander", + "Patrick", + "Jack", + "Dennis", + "Jerry", + "Tyler", + "Aaron", + "Henry", + "Douglas", + "Peter", + "Jose", + "Adam", + "Walter", + "Zachary", + "Harold", + "Keith", + "Jeremy", + "Roger", + "Johnny", + "Bobby", + "Dylan", + "Phillip", + "Shawn", + "Jesse", + "Eugene", + "Bradley", + "Ray", + "Russell", + "Alan", + "Micheal", + "Philip", + "Randy", + "Travis", + "Ricky", + "Tony", + "Luis", + "Martin", + "Joe", + "Billy", + "Willie", + "Gabriel", + "Logan", + "Carl", + "Tom", + "Johnny", + "Craig", + "Terry", + "Dean", + "Allen", + "Frederick", + "Eddie", + "Neil", + "Darrell", + "Jerome", + "Leo", + "Victor", + "Cody", + "Milton", + "Alex", + ], + femaleNames: [ + "Mary", + "Patricia", + "Jennifer", + "Linda", + "Elizabeth", + "Barbara", + "Susan", + "Jessica", + "Sarah", + "Karen", + "Nancy", + "Lisa", + "Margaret", + "Betty", + "Dorothy", + "Sandra", + "Ashley", + "Kimberly", + "Donna", + "Emily", + "Carol", + "Michelle", + "Amanda", + "Melissa", + "Deborah", + "Stephanie", + "Rebecca", + "Laura", + "Helen", + "Sharon", + "Cynthia", + "Kathleen", + "Amy", + "Shirley", + "Angela", + "Ruth", + "Anna", + "Virginia", + "Brenda", + "Pamela", + "Nicole", + "Catherine", + "Christine", + "Samantha", + "Janet", + "Debra", + "Amanda", + "Carolyn", + "Diana", + "Frances", + "Alice", + "Julie", + "Heather", + "Teresa", + "Doris", + "Gloria", + "Evelyn", + "Jean", + "Cheryl", + "Mildred", + "Katherine", + "Joan", + "Ashley", + "Judith", + "Rose", + "Janice", + "Kelly", + "Nicole", + "Judy", + "Christina", + "Kathy", + "Theresa", + "Beverly", + "Denise", + "Tammy", + "Irene", + "Jane", + "Lori", + "Rachel", + "Marilyn", + "Andrea", + "Kathryn", + "Louise", + "Sara", + "Anne", + "Jacqueline", + "Wanda", + "Bonnie", + "Julia", + "Ruby", + "Lois", + "Tina", + "Phyllis", + "Norma", + "Paula", + "Diana", + "Annie", + "Lillian", + "Emily", + "Linda", + ], + lastNames: [ + "Smith", + "Johnson", + "Williams", + "Brown", + "Jones", + "Miller", + "Davis", + "GarcĂ­a", + "Rodriguez", + "Martinez", + "Hernandez", + "Lopez", + "Gonzalez", + "Wilson", + "Anderson", + "Thomas", + "Taylor", + "Moore", + "Jackson", + "White", + "Harris", + "Martin", + "Thompson", + "Garcia", + "Martinez", + "Robinson", + "Clark", + "Rodriguez", + "Lewis", + "Lee", + "Walker", + "Hall", + "Allen", + "Young", + "Hernandez", + "King", + "Wright", + "Lopez", + "Hill", + "Scott", + "Green", + "Adams", + "Baker", + "Gonzalez", + "Nelson", + "Carter", + "Mitchell", + "Perez", + "Roberts", + "Turner", + "Phillips", + "Campbell", + "Parker", + "Evans", + "Edwards", + "Collins", + "Stewart", + "Sanchez", + "Morris", + "Rogers", + "Reed", + "Cook", + "Morgan", + "Bell", + "Murphy", + "Bailey", + "Rivera", + "Cooper", + "Richardson", + "Cox", + "Howard", + "Ward", + "Torres", + "Peterson", + "Gray", + "Ramirez", + "James", + "Watson", + "Brooks", + "Kelly", + "Sanders", + "Price", + "Bennett", + "Wood", + "Barnes", + "Ross", + "Henderson", + "Coleman", + "Jenkins", + "Perry", + "Powell", + "Long", + "Patterson", + "Hughes", + "Flores", + "Washington", + "Butler", + "Simmons", + "Foster", + "Gonzales" + ], + + getRandomMaleName: function () { + const randomIndex = Math.floor(Math.random() * this.maleNames.length); + return this.maleNames[randomIndex]; + }, + + getRandomFemaleName: function () { + const randomIndex = Math.floor(Math.random() * this.femaleNames.length); + return this.femaleNames[randomIndex]; + }, + + getRandomLastName: function () { + const randomIndex = Math.floor(Math.random() * this.lastNames.length); + return this.lastNames[randomIndex]; + }, +}); \ No newline at end of file diff --git a/scripts/core/dataGenerator.js b/scripts/core/dataGenerator.js new file mode 100644 index 0000000..4823007 --- /dev/null +++ b/scripts/core/dataGenerator.js @@ -0,0 +1,57 @@ +import { EUANamesCollection } from "../collections/names/EUANamesCollection.js"; +import { random } from "../math/random.js"; + +export function SCSGenerator(nameStyleType, sexType, ageRangeType) { + let char_fullname = getRandomName(nameStyleType, sexType); + let char_age = getRandomAge(ageRangeType); +} + +function getRandomName(nameStyleType, sexType) { + let firstName; + let lastName; + + switch (nameStyleType) { + case "USA": + if (sexType === "masculine") { + firstName = EUANamesCollection.getRandomMaleName(); + } else if (sexType === "feminine") { + firstName = EUANamesCollection.getRandomFemaleName(); + } + break; + + default: + break; + } + + lastName = EUANamesCollection.getRandomLastName(); + + return { + firstName, + lastName + } +} + +function getRandomAge(ageRangeType) { + switch (ageRangeType) { + case "random": + return random.getRandomNumber(0, 100); + + case "child": + return random.getRandomNumber(1, 12); + + case "teenager": + return random.getRandomNumber(13, 19); + + case "youngAdult": + return random.getRandomNumber(20, 35); + + case "adult": + return random.getRandomNumber(36, 60); + + case "elderly": + return random.getRandomNumber(61, 100); + + default: + return random.getRandomNumber(0, 100); + } +} diff --git a/scripts/core/pageUpdater.js b/scripts/core/pageUpdater.js new file mode 100644 index 0000000..c3eb618 --- /dev/null +++ b/scripts/core/pageUpdater.js @@ -0,0 +1,3 @@ +export function updateCharacterSheet(characterInfos) { + +} \ No newline at end of file diff --git a/scripts/math/random.js b/scripts/math/random.js new file mode 100644 index 0000000..41e3897 --- /dev/null +++ b/scripts/math/random.js @@ -0,0 +1,5 @@ +export const random = Object.freeze({ + getRandomNumber: function (min, max) { + return Math.floor(Math.random() * (max - min + 1)) + min; + }, +}); \ No newline at end of file