refactor: ♻️ restructure character data files, move shared functionality into library
This commit is contained in:
parent
23c06bcd3a
commit
d7d00046b1
9 changed files with 239 additions and 312 deletions
|
@ -1,6 +1,17 @@
|
|||
import {
|
||||
getDateOfBirth,
|
||||
getFullName,
|
||||
getHeight,
|
||||
getTailLength,
|
||||
getWeight,
|
||||
getWingspan,
|
||||
toInch
|
||||
} from '../includes/util.js';
|
||||
|
||||
const firstName = 'Sebin',
|
||||
middleName = 'Antario',
|
||||
lastName = 'Nyshkim',
|
||||
fullName = getFullName(firstName, middleName, lastName),
|
||||
species = 'Anthro Dragon',
|
||||
dateOfBirth = new Date('1993-10-17'),
|
||||
gender = 'male',
|
||||
|
@ -11,19 +22,14 @@ const firstName = 'Sebin',
|
|||
weight = 124, // kg
|
||||
tailLength = 104, // cm
|
||||
wingspan = 417, // cm
|
||||
colors = {
|
||||
hairPrimary: '#4b608f',
|
||||
hairSecondary: '#6684c0',
|
||||
eyes: '#31c215',
|
||||
scalesPrimary: '#c64c35',
|
||||
scalesSecondary: '#eda958',
|
||||
eyebrows: '#eda958',
|
||||
tailspikes: '#7f4539',
|
||||
horns: '#413a3a',
|
||||
claws: '#413a3a',
|
||||
nipples: '#413a3a',
|
||||
penis: '#413a3a'
|
||||
},
|
||||
colors = [
|
||||
{ name: 'Scales', value: '#c64c35' },
|
||||
{ name: 'Chest, Membranes, Facial Spikes', value: '#eda958' },
|
||||
{ name: 'Hair', value: '#4b608f' },
|
||||
{ name: 'Eyes', value: '#31c215' },
|
||||
{ name: 'Horns, Claws, Nipples', value: '#413a3a' },
|
||||
{ name: 'Tail Spikes', value: '#7f4539' }
|
||||
],
|
||||
penis = {
|
||||
shape: 'humanoid',
|
||||
type: 'grower',
|
||||
|
@ -32,7 +38,55 @@ const firstName = 'Sebin',
|
|||
girth: 5 // cm
|
||||
},
|
||||
description = 'Learn all about that derg!',
|
||||
profile = [
|
||||
{ icon: 'fa6-solid:cake-candles', type: 'Date of Birth', text: getDateOfBirth(dateOfBirth) },
|
||||
{ icon: 'fa6-solid:mars', type: 'Sex/Gender', text: `${gender} (${pronouns})` },
|
||||
{ icon: 'fa6-solid:ruler', type: 'Height', text: getHeight(height) },
|
||||
{ icon: 'fa6-solid:weight-hanging', type: 'Weight', text: getWeight(weight) }
|
||||
],
|
||||
hobbies = [
|
||||
{ icon: 'fa6-solid:dumbbell', type: 'Hobby', text: 'working out' },
|
||||
{ icon: 'fa6-solid:plane', type: 'Hobby', text: 'traveling' },
|
||||
{ icon: 'fa6-solid:campground', type: 'Hobby', text: 'camping' },
|
||||
{ icon: 'fa6-solid:gamepad', type: 'Hobby', text: 'video games' },
|
||||
{ icon: 'fa6-solid:laptop-code', type: 'Hobby', text: 'tech' }
|
||||
],
|
||||
anatomy = [
|
||||
{ icon: 'fa6-solid:ruler', type: 'Tail Length', text: getTailLength(tailLength) },
|
||||
{ icon: 'fa6-solid:shoe-prints', type: 'Walk', text: 'plantigrade' },
|
||||
{ icon: 'fa6-solid:info', type: 'Claws', text: 'sharp, hands & feet' },
|
||||
{ icon: 'fa6-solid:info', type: 'Nipples', text: 'yes' }
|
||||
],
|
||||
wings = [
|
||||
{ icon: 'fa6-solid:ruler', type: 'Wingspan', text: getWingspan(wingspan) },
|
||||
{ icon: 'fa6-solid:feather', type: 'Arms', text: 2 },
|
||||
{ icon: 'fa6-solid:feather', type: 'Fingers', text: 3 },
|
||||
{ icon: 'fa6-solid:star', type: 'Special Features', text: 'talon on top' }
|
||||
],
|
||||
head = [
|
||||
{ icon: 'fa6-solid:eye', type: 'Pupils', text: 'round' },
|
||||
{ icon: 'fa6-solid:eye', type: 'Eyebrows', text: 'yellow spikes' },
|
||||
{ icon: 'fa6-solid:info', type: 'Cheeks', text: 'yellow spikes' },
|
||||
{ icon: 'fa6-solid:dragon', type: 'Horns', text: 'curved' },
|
||||
{ icon: 'fa6-solid:info', type: 'Hair', text: 'mid-long, mullet' },
|
||||
{ icon: 'fa6-solid:ear-listen', type: 'Ears', text: 'long, pointy, movable' },
|
||||
{ icon: 'fa6-solid:tooth', type: 'Teeth', text: 'sharp fangs' },
|
||||
{ icon: 'fa6-solid:face-grin-tongue', type: 'Tongue', text: 'pointy tip' }
|
||||
],
|
||||
muscle = [
|
||||
{ icon: 'fa6-solid:dumbbell', type: 'Build', text: 'muscular' },
|
||||
{ icon: 'fa6-solid:dumbbell', type: 'Pecs', text: 'big' },
|
||||
{ icon: 'fa6-solid:dumbbell', type: 'abs', text: 'defined' }
|
||||
],
|
||||
naughty = [
|
||||
{ icon: 'fa6-solid:ruler', type: 'Length', text: `${penis.size} cm (${toInch(penis.size)})` },
|
||||
{ icon: 'fa6-solid:ruler', type: 'Girth', text: `${penis.girth} cm (${toInch(penis.girth)})` },
|
||||
{ icon: 'fa6-solid:shapes', type: 'Shape', text: penis.shape },
|
||||
{ icon: 'fa6-solid:maximize', type: 'Type', text: penis.type },
|
||||
{ icon: 'fa6-solid:star', type: 'Special Features', text: penis.special }
|
||||
],
|
||||
kinks = [
|
||||
// 0 = No, 1 = Maybe, 2 = Yes, 3 = Love
|
||||
{ name: 'Absorption', rating: 0 },
|
||||
{ name: 'Anal', rating: 3, receive: true, give: true },
|
||||
{ name: 'Auto-Fellatio', rating: 2 },
|
||||
|
@ -61,11 +115,12 @@ const firstName = 'Sebin',
|
|||
{ name: 'Growth', rating: 3, receive: true },
|
||||
{ name: 'Handjobs', rating: 2, receive: true, give: true },
|
||||
{ name: 'Hotdogging', rating: 2, give: true },
|
||||
{ name: 'Hyper', rating: 3 },
|
||||
{ name: 'Kissing', rating: 2, receive: true, give: true },
|
||||
{ name: 'Macro', rating: 3 },
|
||||
{ name: 'Milking', rating: 2 },
|
||||
{ name: 'Muscle Growth', rating: 3, receive: true, give: true },
|
||||
{ name: 'Muscle Worship', rating: 2, receive: true, give: true },
|
||||
{ name: 'Muscle Worship', rating: 3, receive: true, give: true },
|
||||
{ name: 'Nipple Play', rating: 2, receive: true, give: true },
|
||||
{ name: 'Oral', rating: 3, receive: true, give: true },
|
||||
{ name: 'Rough', rating: 2, receive: true, give: true },
|
||||
|
@ -81,149 +136,35 @@ const firstName = 'Sebin',
|
|||
{ name: 'Vore', rating: 0 }
|
||||
];
|
||||
|
||||
const getClientLocale = () => {
|
||||
return navigator.languages.length > 0 ? navigator.languages[0] : 'en-US';
|
||||
};
|
||||
|
||||
const getAge = (dateOfBirth) => {
|
||||
const today = new Date();
|
||||
|
||||
const thisYear = today.getFullYear();
|
||||
const thisMonth = today.getMonth();
|
||||
const thisDay = today.getDate();
|
||||
|
||||
const dobYear = dateOfBirth.getFullYear();
|
||||
const dobMonth = dateOfBirth.getMonth();
|
||||
const dobDay = dateOfBirth.getDate();
|
||||
|
||||
let age = thisYear - dobYear;
|
||||
|
||||
if (thisMonth < dobMonth) age--;
|
||||
if (thisMonth === dobMonth && thisDay < dobDay) age--;
|
||||
|
||||
return age;
|
||||
};
|
||||
|
||||
const toImperial = (cm) => {
|
||||
const realFeet = (cm * 0.3937) / 12;
|
||||
const feet = Math.floor(realFeet);
|
||||
const inches = Math.round((realFeet - feet) * 12);
|
||||
|
||||
return `${feet}'${inches}"`;
|
||||
};
|
||||
|
||||
const toInch = (cm) => {
|
||||
return `${Math.round(cm / 2.45)} in`;
|
||||
};
|
||||
|
||||
const toLbs = (kg) => {
|
||||
const nearExact = kg / 0.45359237;
|
||||
const lbs = Math.floor(nearExact);
|
||||
|
||||
return lbs;
|
||||
};
|
||||
|
||||
const toFahrenheit = (celsius) => {
|
||||
return celsius * 1.8 + 32;
|
||||
};
|
||||
|
||||
const dateFormat = new Intl.DateTimeFormat(getClientLocale(), {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: '2-digit'
|
||||
});
|
||||
|
||||
const getFullName = () => `${firstName} ${middleName} ${lastName}`;
|
||||
const getDateOfBirth = () => `${dateFormat.format(dateOfBirth)} (${getAge(dateOfBirth)})`;
|
||||
const getHeight = () => `${height} cm (${toImperial(height)})`;
|
||||
const getWeight = () => `${weight} kg (${toLbs(weight)} lbs)`;
|
||||
const getTailLength = () => `${tailLength / 100} m (${toImperial(tailLength)})`;
|
||||
const getWingspan = () => `${wingspan / 100} m (${toImperial(wingspan)})`;
|
||||
|
||||
const getTraits = (type) => {
|
||||
switch (type) {
|
||||
case 'hobbies':
|
||||
return [
|
||||
{ icon: 'fa6-solid:dumbbell', type: 'Hobby', text: 'working out' },
|
||||
{ icon: 'fa6-solid:plane', type: 'Hobby', text: 'traveling' },
|
||||
{ icon: 'fa6-solid:campground', type: 'Hobby', text: 'camping' },
|
||||
{ icon: 'fa6-solid:gamepad', type: 'Hobby', text: 'video games' },
|
||||
{ icon: 'fa6-solid:laptop-code', type: 'Hobby', text: 'tech' }
|
||||
];
|
||||
|
||||
case 'general':
|
||||
return [
|
||||
{ icon: 'fa6-solid:ruler', type: 'Tail Length', text: getTailLength() },
|
||||
{ icon: 'fa6-solid:shoe-prints', type: 'Walk', text: 'plantigrade' },
|
||||
{ icon: 'fa6-solid:info', type: 'Claws', text: 'sharp, hands & feet' },
|
||||
{ icon: 'fa6-solid:info', type: 'Nipples', text: 'yes' }
|
||||
];
|
||||
|
||||
return hobbies;
|
||||
case 'anatomy':
|
||||
return anatomy;
|
||||
case 'wings':
|
||||
return [
|
||||
{ icon: 'fa6-solid:ruler', type: 'Wingspan', text: getWingspan() },
|
||||
{ icon: 'fa6-solid:feather', type: 'Arms', text: 2 },
|
||||
{ icon: 'fa6-solid:feather', type: 'Fingers', text: 3 },
|
||||
{ icon: 'fa6-solid:star', type: 'Special Features', text: 'talon on top' }
|
||||
];
|
||||
|
||||
return wings;
|
||||
case 'head':
|
||||
return [
|
||||
{ icon: 'fa6-solid:eye', type: 'Pupils', text: 'round' },
|
||||
{ icon: 'fa6-solid:eye', type: 'Eyebrows', text: 'yellow spikes' },
|
||||
{ icon: 'fa6-solid:info', type: 'Cheeks', text: 'yellow spikes' },
|
||||
{ icon: 'fa6-solid:dragon', type: 'Horns', text: 'curved' },
|
||||
{ icon: 'fa6-solid:info', type: 'Hair', text: 'mid-long, mullet' },
|
||||
{ icon: 'fa6-solid:ear-listen', type: 'Ears', text: 'long, pointy, movable' },
|
||||
{ icon: 'fa6-solid:tooth', type: 'Teeth', text: 'sharp fangs' },
|
||||
{ icon: 'fa6-solid:face-grin-tongue', type: 'Tongue', text: 'pointy tip' }
|
||||
];
|
||||
|
||||
return head;
|
||||
case 'muscle':
|
||||
return [
|
||||
{ icon: 'fa6-solid:dumbbell', type: 'Build', text: 'muscular' },
|
||||
{ icon: 'fa6-solid:dumbbell', type: 'Pecs', text: 'big' },
|
||||
{ icon: 'fa6-solid:dumbbell', type: 'abs', text: 'defined' }
|
||||
];
|
||||
|
||||
return muscle;
|
||||
case 'naughty':
|
||||
return [
|
||||
{ icon: 'fa6-solid:ruler', type: 'Length', text: `${penis.size} cm (${toInch(penis.size)})` },
|
||||
{ icon: 'fa6-solid:ruler', type: 'Girth', text: `${penis.girth} cm (${toInch(penis.girth)})` },
|
||||
{ icon: 'fa6-solid:shapes', type: 'Shape', text: penis.shape },
|
||||
{ icon: 'fa6-solid:maximize', type: 'Type', text: penis.type },
|
||||
{ icon: 'fa6-solid:star', type: 'Special Features', text: penis.special }
|
||||
];
|
||||
|
||||
return naughty;
|
||||
default:
|
||||
return [
|
||||
{ icon: 'fa6-solid:cake-candles', type: 'Date of Birth', text: getDateOfBirth() },
|
||||
{ icon: 'fa6-solid:mars', type: 'Sex/Gender', text: `${gender} (${pronouns})` },
|
||||
{ icon: 'fa6-solid:ruler', type: 'Height', text: getHeight() },
|
||||
{ icon: 'fa6-solid:weight-hanging', type: 'Weight', text: getWeight() }
|
||||
];
|
||||
return profile;
|
||||
}
|
||||
};
|
||||
|
||||
const getColors = () => [
|
||||
{ name: 'Scales', value: colors.scalesPrimary },
|
||||
{ name: 'Chest, Membranes, Facial Spikes', value: colors.scalesSecondary },
|
||||
{ name: 'Hair', value: colors.hairPrimary },
|
||||
{ name: 'Eyes', value: colors.eyes },
|
||||
{ name: 'Horns, Claws, Nipples', value: colors.horns },
|
||||
{ name: 'Tail Spikes', value: colors.tailspikes }
|
||||
];
|
||||
|
||||
export default {
|
||||
firstName,
|
||||
fullName,
|
||||
species,
|
||||
gender,
|
||||
pronouns,
|
||||
orientation,
|
||||
position,
|
||||
colors,
|
||||
kinks,
|
||||
description,
|
||||
getFullName,
|
||||
getTraits,
|
||||
getColors
|
||||
getTraits
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue