From f89ebf581aef93dc9e2e62f23ef37970c6d6c9a4 Mon Sep 17 00:00:00 2001 From: Alexander Yakovlev Date: Mon, 10 Sep 2018 22:22:57 +0700 Subject: [PATCH] Fantasy town in Russian + better check script --- distribution.coffee | 42 ++++++++++++++++++-------- game/procgen/ru/bar_title.cson | 7 +++++ game/procgen/ru/bath_title.cson | 6 ++++ game/procgen/ru/description.cson | 11 +++++-- game/procgen/ru/exterior_title.cson | 27 +++++++++++++++++ game/procgen/ru/guild_title.cson | 6 ++++ game/procgen/ru/honor_title.cson | 11 +++++++ game/procgen/ru/interior_title.cson | 46 +++++++++++++++++++++++++++++ game/procgen/ru/loctitle.cson | 17 +++++++++++ game/procgen/ru/saint_title.cson | 8 +++++ game/procgen/ru/workshop_title.cson | 7 +++++ 11 files changed, 173 insertions(+), 15 deletions(-) create mode 100644 game/procgen/ru/bar_title.cson create mode 100644 game/procgen/ru/bath_title.cson create mode 100644 game/procgen/ru/exterior_title.cson create mode 100644 game/procgen/ru/guild_title.cson create mode 100644 game/procgen/ru/honor_title.cson create mode 100644 game/procgen/ru/interior_title.cson create mode 100644 game/procgen/ru/loctitle.cson create mode 100644 game/procgen/ru/saint_title.cson create mode 100644 game/procgen/ru/workshop_title.cson diff --git a/distribution.coffee b/distribution.coffee index 5b0dd0d..18e3761 100644 --- a/distribution.coffee +++ b/distribution.coffee @@ -3,9 +3,18 @@ # Ignores tags!!! The assessment could be above real value. CSON = require 'cson' -glob = require 'glob' +glob = require('glob-fs')({ + builtins: false +}) + +# params +# Точки старта +start = [ + "description" + "loctitle" +] +# end params -distribution = {} template = (phrase) -> if phrase == undefined or phrase == '' return [] @@ -46,10 +55,14 @@ parseGroup = (group) -> for groupdata in spec[filename].groups parseGroup(groupdata) -filedir = 'game/procgen' -languages = glob.sync(filedir) +filedir = './game/procgen/*' +languages = glob.readdirSync(filedir) for language in languages - files = glob.sync(language+'/*.cson') + console.log language + console.log '---------------' + files = glob.readdirSync(language+'/*.cson') + # unset first element, it's current folder + files.shift() spec = {} for file in files data = CSON.parseCSONFile(file) @@ -60,15 +73,20 @@ for language in languages tags: [], phrases: data.phrases }) - data.phrases = null + delete data.phrases key = file.substr(0, file.lastIndexOf('.')) || file key = key.replace(filedir, '') spec[key] = data -if spec.game? - for group in spec.game.groups - parseGroup(group) + for startPoint in start + start_file = language+'/'+startPoint + distribution = {} -for filename, value of distribution - distribution[filename] = Math.round(value * 1000) / 1000 -console.log distribution + if spec[start_file]? + for group in spec[start_file].groups + parseGroup(group) + + for filename, value of distribution + distribution[filename] = Math.round(value * 1000) / 1000 + console.log startPoint + console.log distribution diff --git a/game/procgen/ru/bar_title.cson b/game/procgen/ru/bar_title.cson new file mode 100644 index 0000000..065594c --- /dev/null +++ b/game/procgen/ru/bar_title.cson @@ -0,0 +1,7 @@ +# Названия пивнушек +phrases: [ + "Брыкастая Лошадь" + "Пьяная Кошка" + "Добрый Ктулху" + "Щедрый путник" +] diff --git a/game/procgen/ru/bath_title.cson b/game/procgen/ru/bath_title.cson new file mode 100644 index 0000000..dc0ba6d --- /dev/null +++ b/game/procgen/ru/bath_title.cson @@ -0,0 +1,6 @@ +# Названия бань +phrases: [ + "Чистая душа" + "Мокрый мех" + "Мыло!" +] diff --git a/game/procgen/ru/description.cson b/game/procgen/ru/description.cson index 8bd6ad5..ef945a4 100644 --- a/game/procgen/ru/description.cson +++ b/game/procgen/ru/description.cson @@ -1,4 +1,9 @@ -phrases: [ - "[:adjective] [:adjective]" - "[:adjective]" +groups: [ + tags: [ + ['type', 'square'] + ] + phrases: [ + "[:adjective] [:adjective]" + "[:adjective]" + ] ] diff --git a/game/procgen/ru/exterior_title.cson b/game/procgen/ru/exterior_title.cson new file mode 100644 index 0000000..51ba63c --- /dev/null +++ b/game/procgen/ru/exterior_title.cson @@ -0,0 +1,27 @@ +# Название наружней локации +groups: [ + tags: [ + ['type', 'square'] + ] + phrases: [ + "Площадь [:honor_title]" + ] + , + tags: [ + ['type', 'fountain'] + ] + phrases: [ + # нам важно, что это фонтан, но дальше не уточняем + "Фонтан" + ] + , + tags: [ + ['type', 'street'] + ] + phrases: [ + # нам важно, что это улица, но не важно, какого типа + "Улица [:honor_title]" + "Переулок [:honor_title]" + "Поворот [:honor_title]" + ] +] diff --git a/game/procgen/ru/guild_title.cson b/game/procgen/ru/guild_title.cson new file mode 100644 index 0000000..ff2f97c --- /dev/null +++ b/game/procgen/ru/guild_title.cson @@ -0,0 +1,6 @@ +# Названия гильдий +phrases: [ + "магов" + "торговцев" + "воинов" +] diff --git a/game/procgen/ru/honor_title.cson b/game/procgen/ru/honor_title.cson new file mode 100644 index 0000000..c337692 --- /dev/null +++ b/game/procgen/ru/honor_title.cson @@ -0,0 +1,11 @@ +# Названия улиц и площадей +phrases: [ + "имени Древнего Ужаса" + "Ленина" # в любом городе есть улица Ленина. В ЛЮБОМ. + "Убийцы Драконов" + "Матери Драконов" + "Дяди Драконов" + "Того, Чего Не Может Быть" + "Того, Кто Не Должен Быть Помянут" + "Проклятой Крысы" +] diff --git a/game/procgen/ru/interior_title.cson b/game/procgen/ru/interior_title.cson new file mode 100644 index 0000000..7324ef3 --- /dev/null +++ b/game/procgen/ru/interior_title.cson @@ -0,0 +1,46 @@ +# Название внутренней локации. Мы стоим внутри строения. +groups: [ + tags: [ + ['type', 'tavern'] + ] + phrases: [ + "Таверна «[:bar_title]»" + "Бар «[:bar_title]»" + ] + , + tags: [ + ['type', 'bath'] + ] + phrases: [ + "Баня «[:bath_title]»" + "Сауна «[:bath_title]»" + ] + , + tags: [ + ['type', 'guild'] + ] + phrases: [ + "Гильдия [:guild_title]" + ] + , + tags: [ + ['type', 'hospital'] + ] + phrases: [ + "Госпиталь [:saint_title]" + ] + , + tags: [ + ['type', 'workshop'] + ] + phrases: [ + "Мастерская [:workshop_title]" + ] + , + tags: [ + ['type', 'chapel'] + ] + phrases: [ + "Часовня [:saint_title]" + ] +] diff --git a/game/procgen/ru/loctitle.cson b/game/procgen/ru/loctitle.cson new file mode 100644 index 0000000..2e1f421 --- /dev/null +++ b/game/procgen/ru/loctitle.cson @@ -0,0 +1,17 @@ +# Название локации +groups: [ + # Общий тип локации: наружная + tags: [ + ['position', 'exterior'] + ] + phrases: [ + "[:exterior_title]" + ] + , + tags: [ + ['position', 'interior'] + ] + phrases: [ + "[:interior_title]" + ] +] diff --git a/game/procgen/ru/saint_title.cson b/game/procgen/ru/saint_title.cson new file mode 100644 index 0000000..9c57313 --- /dev/null +++ b/game/procgen/ru/saint_title.cson @@ -0,0 +1,8 @@ +# Названия часовен и госпиталей +phrases: [ + "святого Георгия" + "святого Урука" + "святой Марии" + "святого Перуна" + "Того, Кто Не Должен Быть Помянут" +] diff --git a/game/procgen/ru/workshop_title.cson b/game/procgen/ru/workshop_title.cson new file mode 100644 index 0000000..b72b670 --- /dev/null +++ b/game/procgen/ru/workshop_title.cson @@ -0,0 +1,7 @@ +# Названия ремесленных и мастерских +phrases: [ + "кожевника" + "кузнеца" + "гробовщика" + "алхимика" +]