Spiel erweitert
This commit is contained in:
@@ -267,73 +267,81 @@ async function initializeFalukantProducts() {
|
||||
}
|
||||
|
||||
async function initializeFalukantTitles() {
|
||||
await TitleOfNobility.bulkCreate([
|
||||
{ labelTr: "noncivil" },
|
||||
{ labelTr: "civil" },
|
||||
{ labelTr: "sir" },
|
||||
{ labelTr: "townlord" },
|
||||
{ labelTr: "by" },
|
||||
{ labelTr: "landlord" },
|
||||
{ labelTr: "knight" },
|
||||
{ labelTr: "baron" },
|
||||
{ labelTr: "count" },
|
||||
{ labelTr: "palsgrave" },
|
||||
{ labelTr: "margrave" },
|
||||
{ labelTr: "landgrave" },
|
||||
{ labelTr: "ruler" },
|
||||
{ labelTr: "elector" },
|
||||
{ labelTr: "imperial-prince" },
|
||||
{ labelTr: "duke" },
|
||||
{ labelTr: "grand-duke" },
|
||||
{ labelTr: "prince-regent" },
|
||||
{ labelTr: "king" },
|
||||
], {
|
||||
updateOnDuplicate: ['labelTr'],
|
||||
});
|
||||
try {
|
||||
await TitleOfNobility.bulkCreate([
|
||||
{ labelTr: "noncivil", level: 1 },
|
||||
{ labelTr: "civil", level: 2 },
|
||||
{ labelTr: "sir", level: 3 },
|
||||
{ labelTr: "townlord", level: 4 },
|
||||
{ labelTr: "by", level: 5 },
|
||||
{ labelTr: "landlord", level: 6 },
|
||||
{ labelTr: "knight", level: 7 },
|
||||
{ labelTr: "baron", level: 8 },
|
||||
{ labelTr: "count", level: 9 },
|
||||
{ labelTr: "palsgrave", level: 10 },
|
||||
{ labelTr: "margrave", level: 11 },
|
||||
{ labelTr: "landgrave", level: 12 },
|
||||
{ labelTr: "ruler", level: 13 },
|
||||
{ labelTr: "elector", level: 14 },
|
||||
{ labelTr: "imperial-prince", level: 15 },
|
||||
{ labelTr: "duke", level: 16 },
|
||||
{ labelTr: "grand-duke", level: 17 },
|
||||
{ labelTr: "prince-regent", level: 18 },
|
||||
{ labelTr: "king", level: 19 },
|
||||
], {
|
||||
updateOnDuplicate: ['labelTr'],
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error initializing Falukant titles:', error);
|
||||
}
|
||||
}
|
||||
|
||||
async function initializeFalukantTitleRequirements() {
|
||||
const titleRequirements = [
|
||||
{ labelTr: "civil", requirements: [{ type: "money", value: 500 }] },
|
||||
{ labelTr: "sir", requirements: [{ type: "branches", value: 2 }] },
|
||||
{ labelTr: "townlord", requirements: [] },
|
||||
{ labelTr: "by", requirements: [] },
|
||||
{ labelTr: "landlord", requirements: [] },
|
||||
{ labelTr: "knight", requirements: [] },
|
||||
{ labelTr: "baron", requirements: [{ type: "branches", value: 4 }] },
|
||||
{ labelTr: "count", requirements: [] },
|
||||
{ labelTr: "palsgrave", requirements: [] },
|
||||
{ labelTr: "margrave", requirements: [] },
|
||||
{ labelTr: "landgrave", requirements: [] },
|
||||
{ labelTr: "ruler", requirements: [] },
|
||||
{ labelTr: "elector", requirements: [] },
|
||||
{ labelTr: "imperial-prince", requirements: [] },
|
||||
{ labelTr: "duke", requirements: [] },
|
||||
{ labelTr: "grand-duke", requirements: [] },
|
||||
{ labelTr: "prince-regent", requirements: [] },
|
||||
{ labelTr: "king", requirements: [] },
|
||||
{ labelTr: "civil", requirements: [{ type: "money", value: 5000 }, { type: "cost", value: 500 }] },
|
||||
{ labelTr: "sir", requirements: [{ type: "branches", value: 2 }, { type: "cost", value: 1000 }] },
|
||||
{ labelTr: "townlord", requirements: [{ type: "cost", value: 3000 }] },
|
||||
{ labelTr: "by", requirements: [{ type: "cost", value: 6000 }] },
|
||||
{ labelTr: "landlord", requirements: [{ type: "cost", value: 9000 }] },
|
||||
{ labelTr: "knight", requirements: [{ type: "cost", value: 11000 }] },
|
||||
{ labelTr: "baron", requirements: [{ type: "branches", value: 4 }, { type: "cost", value: 15000 }] },
|
||||
{ labelTr: "count", requirements: [{ type: "cost", value: 19000 }] },
|
||||
{ labelTr: "palsgrave", requirements: [{ type: "cost", value: 25000 }] },
|
||||
{ labelTr: "margrave", requirements: [{ type: "cost", value: 33000 }] },
|
||||
{ labelTr: "landgrave", requirements: [{ type: "cost", value: 47000 }] },
|
||||
{ labelTr: "ruler", requirements: [{ type: "cost", value: 66000 }] },
|
||||
{ labelTr: "elector", requirements: [{ type: "cost", value: 79000 }] },
|
||||
{ labelTr: "imperial-prince", requirements: [{ type: "cost", value: 99999 }] },
|
||||
{ labelTr: "duke", requirements: [{ type: "cost", value: 130000 }] },
|
||||
{ labelTr: "grand-duke",requirements: [{ type: "cost", value: 170000 }] },
|
||||
{ labelTr: "prince-regent", requirements: [{ type: "cost", value: 270000 }] },
|
||||
{ labelTr: "king", requirements: [{ type: "cost", value: 500000 }] },
|
||||
];
|
||||
|
||||
const titles = await TitleOfNobility.findAll();
|
||||
const requirementsToInsert = [];
|
||||
|
||||
for (let i = 0; i < titleRequirements.length; i++) {
|
||||
const titleRequirement = titleRequirements[i];
|
||||
const title = titles.find(t => t.labelTr === titleRequirement.labelTr);
|
||||
const titleReq = titleRequirements[i];
|
||||
const title = titles.find(t => t.labelTr === titleReq.labelTr);
|
||||
if (!title) continue;
|
||||
|
||||
if (i > 1) {
|
||||
const moneyRequirement = {
|
||||
type: "money",
|
||||
titleReq.requirements.push({
|
||||
type: "money",
|
||||
value: 5000 * Math.pow(3, i - 1),
|
||||
};
|
||||
titleRequirement.requirements.push(moneyRequirement);
|
||||
});
|
||||
}
|
||||
for (const requirement of titleRequirement.requirements) {
|
||||
|
||||
for (const req of titleReq.requirements) {
|
||||
requirementsToInsert.push({
|
||||
titleId: title.id,
|
||||
requirementType: requirement.type,
|
||||
requirementValue: requirement.value,
|
||||
titleId: title.id,
|
||||
requirementType: req.type,
|
||||
requirementValue: req.value,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
await TitleRequirement.bulkCreate(requirementsToInsert, { ignoreDuplicates: true });
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ import PromotionalGiftCharacterTrait from "../../models/falukant/predefine/promo
|
||||
import PromotionalGiftMood from "../../models/falukant/predefine/promotional_gift_mood.js";
|
||||
import HouseType from '../../models/falukant/type/house.js';
|
||||
import TitleOfNobility from "../../models/falukant/type/title_of_nobility.js";
|
||||
import PartyType from "../../models/falukant/type/party.js";
|
||||
import MusicType from "../../models/falukant/type/music.js";
|
||||
import BanquetteType from "../../models/falukant/type/banquette.js";
|
||||
import LearnRecipient from "../../models/falukant/type/learn_recipient.js";
|
||||
|
||||
export const initializeFalukantTypes = async () => {
|
||||
await initializeFalukantTypeRegions();
|
||||
@@ -17,6 +21,10 @@ export const initializeFalukantTypes = async () => {
|
||||
await initializeFalukantPromotionalGifts();
|
||||
await initializePromotionalGiftMoodLinks();
|
||||
await initializeFalukantHouseTypes();
|
||||
await initializeFalukantPartyTypes();
|
||||
await initializeFalukantMusicTypes();
|
||||
await initializeFalukantBanquetteTypes();
|
||||
await initializeLearnerTypes();
|
||||
};
|
||||
|
||||
const regionTypes = [];
|
||||
@@ -208,15 +216,44 @@ const promotionalGiftMoodLinks = [
|
||||
];
|
||||
|
||||
const houseTypes = [
|
||||
{ labelTr: 'Unter der Brücke', abbr: 'under_bridge', cost: 10, position: 1, minimumTitle: 'noncivil' },
|
||||
{ labelTr: 'Strohhütte', abbr: 'straw_hut', cost: 20, position: 2, minimumTitle: 'noncivil' },
|
||||
{ labelTr: 'Holzhaus', abbr: 'wooden_house', cost: 50, position: 3, minimumTitle: 'civil' },
|
||||
{ labelTr: 'Hinterhofzimmer', abbr: 'backyard_room', cost: 5, position: 4, minimumTitle: 'civil' },
|
||||
{ labelTr: 'Kleines Familienhaus', abbr: 'family_house', cost: 100, position: 5, minimumTitle: 'sir' },
|
||||
{ labelTr: 'Stadthaus', abbr: 'townhouse', cost: 200, position: 6, minimumTitle: 'townlord' },
|
||||
{ labelTr: 'Villa', abbr: 'villa', cost: 500, position: 7, minimumTitle: 'knight' },
|
||||
{ labelTr: 'Herrenhaus', abbr: 'mansion', cost: 1000, position: 8, minimumTitle: 'ruler' },
|
||||
{ labelTr: 'Schloss', abbr: 'castle', cost: 5000, position: 9, minimumTitle: 'prince-regent' },
|
||||
{ labelTr: 'Unter der Brücke', abbr: 'under_bridge', cost: 0, position: 1, minimumTitle: 'noncivil' },
|
||||
{ labelTr: 'Strohhütte', abbr: 'straw_hut', cost: 100, position: 2, minimumTitle: 'noncivil' },
|
||||
{ labelTr: 'Holzhaus', abbr: 'wooden_house', cost: 5000, position: 3, minimumTitle: 'civil' },
|
||||
{ labelTr: 'Hinterhofzimmer', abbr: 'backyard_room', cost: 75000, position: 4, minimumTitle: 'civil' },
|
||||
{ labelTr: 'Kleines Familienhaus', abbr: 'family_house', cost: 273000, position: 5, minimumTitle: 'sir' },
|
||||
{ labelTr: 'Stadthaus', abbr: 'townhouse', cost: 719432, position: 6, minimumTitle: 'townlord' },
|
||||
{ labelTr: 'Villa', abbr: 'villa', cost: 3500000, position: 7, minimumTitle: 'knight' },
|
||||
{ labelTr: 'Herrenhaus', abbr: 'mansion', cost: 18000000, position: 8, minimumTitle: 'ruler' },
|
||||
{ labelTr: 'Schloss', abbr: 'castle', cost: 500000000, position: 9, minimumTitle: 'prince-regent' },
|
||||
];
|
||||
|
||||
const partyTypes = [
|
||||
{ labelTr: 'wedding', cost: 50, forMarriage: true, reputationGrowth: 5 },
|
||||
{ labelTr: 'ball', cost: 250, forMarriage: false, reputationGrowth: 7 },
|
||||
{ labelTr: 'town fair', cost: 1000, forMarriage: false, reputationGrowth: 10 },
|
||||
{ labelTr: 'royal feast', cost: 50000, forMarriage: false, reputationGrowth: 25 },
|
||||
];
|
||||
|
||||
const musicTypes = [
|
||||
{ type: 'none', cost: 0, reputationGrowth: 0 },
|
||||
{ type: 'bard', cost: 100, reputationGrowth: 2 },
|
||||
{ type: 'villageBand', cost: 2500, reputationGrowth: 5 },
|
||||
{ type: 'chamberOrchestra', cost: 12000, reputationGrowth: 10 },
|
||||
{ type: 'symphonyOrchestra', cost: 37000, reputationGrowth: 15 },
|
||||
{ type: 'symphonyOrchestraWithChorusAndSolists', cost: 500000, reputationGrowth: 25 },
|
||||
];
|
||||
|
||||
const banquetteTypes = [
|
||||
{ type: 'bread', cost: 5, reputationGrowth: 0 },
|
||||
{ type: 'roastWithBeer', cost: 200, reputationGrowth: 5 },
|
||||
{ type: 'poultryWithVegetablesAndWine', cost: 5000, reputationGrowth: 10 },
|
||||
{ type: 'extensiveBuffet', cost: 100000, reputationGrowth: 20 }
|
||||
];
|
||||
|
||||
const learnerTypes = [
|
||||
{ tr: 'self', },
|
||||
{ tr: 'children', },
|
||||
{ tr: 'director', },
|
||||
];
|
||||
|
||||
{
|
||||
@@ -379,7 +416,7 @@ export const initializePromotionalGiftMoodLinks = async () => {
|
||||
};
|
||||
|
||||
export const initializeFalukantHouseTypes = async () => {
|
||||
for (const ht of houseTypes) {
|
||||
for (const ht of houseTypes) {
|
||||
const [record, created] = await HouseType.findOrCreate({
|
||||
where: { labelTr: ht.abbr },
|
||||
defaults: {
|
||||
@@ -391,3 +428,54 @@ export const initializeFalukantHouseTypes = async () => {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export const initializeFalukantPartyTypes = async () => {
|
||||
for (const pt of partyTypes) {
|
||||
const [record, created] = await PartyType.findOrCreate({
|
||||
where: { tr: pt.labelTr },
|
||||
defaults: {
|
||||
cost: pt.cost,
|
||||
tr: pt.labelTr,
|
||||
forMarriage: pt.forMarriage,
|
||||
reputationGrowth: pt.reputationGrowth,
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const initializeFalukantMusicTypes = async () => {
|
||||
for (const mt of musicTypes) {
|
||||
const [record, created] = await MusicType.findOrCreate({
|
||||
where: { tr: mt.type },
|
||||
defaults: {
|
||||
cost: mt.cost,
|
||||
tr: mt.type,
|
||||
reputationGrowth: mt.reputationGrowth,
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const initializeFalukantBanquetteTypes = async () => {
|
||||
for (const bt of banquetteTypes) {
|
||||
const [record, created] = await BanquetteType.findOrCreate({
|
||||
where: { tr: bt.type },
|
||||
defaults: {
|
||||
tr: bt.type,
|
||||
cost: bt.cost,
|
||||
reputationGrowth: bt.reputationGrowth,
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export const initializeLearnerTypes = async () => {
|
||||
for (const lt of learnerTypes) {
|
||||
const [record, created] = await LearnRecipient.findOrCreate({
|
||||
where: { tr: lt.tr },
|
||||
defaults: {
|
||||
tr: lt.tr,
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user