mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-16 17:31:24 +01:00
1.1.14
This commit is contained in:
parent
b6ed03258a
commit
aadae58072
32 changed files with 1938 additions and 1577 deletions
448
icons.css
448
icons.css
|
|
@ -10,7 +10,6 @@
|
|||
font-family: "icons";
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
speak: none;
|
||||
display: inline-block;
|
||||
text-decoration: inherit;
|
||||
width: 1em;
|
||||
|
|
@ -25,238 +24,235 @@
|
|||
line-height: 1em;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
|
||||
}
|
||||
|
||||
/* Font Awesome icons */
|
||||
.icon-pencil:before { content: '\e800'; } /* '' */
|
||||
.icon-font:before { content: '\e801'; } /* '' */
|
||||
.icon-arrows-cw:before { content: '\e802'; } /* '' */
|
||||
.icon-doc:before { content: '\e803'; } /* '' */
|
||||
.icon-trash-empty:before { content: '\e804'; } /* '' */
|
||||
.icon-ok:before { content: '\e805'; } /* '' */
|
||||
.icon-ok-circled:before { content: '\e806'; } /* '' */
|
||||
.icon-ok-circled2:before { content: '\e807'; } /* '' */
|
||||
.icon-link:before { content: '\e808'; } /* '' */
|
||||
.icon-globe:before { content: '\e809'; } /* '' */
|
||||
.icon-plus:before { content: '\e80a'; } /* '' */
|
||||
.icon-plus-circled:before { content: '\e80b'; } /* '' */
|
||||
.icon-minus-circled:before { content: '\e80c'; } /* '' */
|
||||
.icon-minus:before { content: '\e80d'; } /* '' */
|
||||
.icon-text-height:before { content: '\e80e'; } /* '' */
|
||||
.icon-adjust:before { content: '\e80f'; } /* '' */
|
||||
.icon-tag:before { content: '\e810'; } /* '' */
|
||||
.icon-tags:before { content: '\e811'; } /* '' */
|
||||
.icon-logout:before { content: '\e812'; } /* '' */
|
||||
.icon-download:before { content: '\e813'; } /* '' */
|
||||
.icon-down-circled2:before { content: '\e814'; } /* '' */
|
||||
.icon-upload:before { content: '\e815'; } /* '' */
|
||||
.icon-up-circled2:before { content: '\e816'; } /* '' */
|
||||
.icon-cancel-circled2:before { content: '\e817'; } /* '' */
|
||||
.icon-cancel-circled:before { content: '\e818'; } /* '' */
|
||||
.icon-cancel:before { content: '\e819'; } /* '' */
|
||||
.icon-check:before { content: '\e81a'; } /* '' */
|
||||
.icon-align-left:before { content: '\e81b'; } /* '' */
|
||||
.icon-align-center:before { content: '\e81c'; } /* '' */
|
||||
.icon-align-right:before { content: '\e81d'; } /* '' */
|
||||
.icon-align-justify:before { content: '\e81e'; } /* '' */
|
||||
.icon-star:before { content: '\e81f'; } /* '' */
|
||||
.icon-star-empty:before { content: '\e820'; } /* '' */
|
||||
.icon-search:before { content: '\e821'; } /* '' */
|
||||
.icon-mail:before { content: '\e822'; } /* '' */
|
||||
.icon-eye:before { content: '\e823'; } /* '' */
|
||||
.icon-eye-off:before { content: '\e824'; } /* '' */
|
||||
.icon-pin:before { content: '\e825'; } /* '' */
|
||||
.icon-lock-open:before { content: '\e826'; } /* '' */
|
||||
.icon-lock:before { content: '\e827'; } /* '' */
|
||||
.icon-attach:before { content: '\e828'; } /* '' */
|
||||
.icon-home:before { content: '\e829'; } /* '' */
|
||||
.icon-info-circled:before { content: '\e82a'; } /* '' */
|
||||
.icon-help-circled:before { content: '\e82b'; } /* '' */
|
||||
.icon-shuffle:before { content: '\e82c'; } /* '' */
|
||||
.icon-ccw:before { content: '\e82d'; } /* '' */
|
||||
.icon-cw:before { content: '\e82e'; } /* '' */
|
||||
.icon-play:before { content: '\e82f'; } /* '' */
|
||||
.icon-play-circled2:before { content: '\e830'; } /* '' */
|
||||
.icon-down-big:before { content: '\e831'; } /* '' */
|
||||
.icon-left-big:before { content: '\e832'; } /* '' */
|
||||
.icon-right-big:before { content: '\e833'; } /* '' */
|
||||
.icon-up-big:before { content: '\e834'; } /* '' */
|
||||
.icon-up-open:before { content: '\e835'; } /* '' */
|
||||
.icon-right-open:before { content: '\e836'; } /* '' */
|
||||
.icon-left-open:before { content: '\e837'; } /* '' */
|
||||
.icon-down-open:before { content: '\e838'; } /* '' */
|
||||
.icon-cloud:before { content: '\e839'; } /* '' */
|
||||
.icon-text-width:before { content: '\e83a'; } /* '' */
|
||||
.icon-italic:before { content: '\e83b'; } /* '' */
|
||||
.icon-bold:before { content: '\e83c'; } /* '' */
|
||||
.icon-retweet:before { content: '\e83d'; } /* '' */
|
||||
.icon-user:before { content: '\e83e'; } /* '' */
|
||||
.icon-users:before { content: '\e83f'; } /* '' */
|
||||
.icon-flag:before { content: '\e840'; } /* '' */
|
||||
.icon-heart:before { content: '\e841'; } /* '' */
|
||||
.icon-heart-empty:before { content: '\e842'; } /* '' */
|
||||
.icon-edit:before { content: '\e843'; } /* '' */
|
||||
.icon-export:before { content: '\e844'; } /* '' */
|
||||
.icon-cog:before { content: '\e845'; } /* '' */
|
||||
.icon-cog-alt:before { content: '\e846'; } /* '' */
|
||||
.icon-wrench:before { content: '\e847'; } /* '' */
|
||||
.icon-resize-vertical:before { content: '\e848'; } /* '' */
|
||||
.icon-resize-small:before { content: '\e849'; } /* '' */
|
||||
.icon-resize-full:before { content: '\e84a'; } /* '' */
|
||||
.icon-resize-horizontal:before { content: '\e84b'; } /* '' */
|
||||
.icon-target:before { content: '\e84c'; } /* '' */
|
||||
.icon-signal:before { content: '\e84d'; } /* '' */
|
||||
.icon-umbrella:before { content: '\e84e'; } /* '' */
|
||||
.icon-leaf:before { content: '\e84f'; } /* '' */
|
||||
.icon-book:before { content: '\e850'; } /* '' */
|
||||
.icon-asterisk:before { content: '\e851'; } /* '' */
|
||||
.icon-chart-bar:before { content: '\e852'; } /* '' */
|
||||
.icon-key:before { content: '\e853'; } /* '' */
|
||||
.icon-hammer:before { content: '\e854'; } /* '' */
|
||||
.icon-star-half:before { content: '\e855'; } /* '' */
|
||||
.icon-move:before { content: '\f047'; } /* '' */
|
||||
.icon-expand-1:before { content: '\f065'; } /* '' */
|
||||
.icon-link-ext:before { content: '\f08e'; } /* '' */
|
||||
.icon-check-empty:before { content: '\f096'; } /* '' */
|
||||
.icon-resize-full-alt:before { content: '\f0b2'; } /* '' */
|
||||
.icon-flask:before { content: '\f0c3'; } /* '' */
|
||||
.icon-docs:before { content: '\f0c5'; } /* '' */
|
||||
.icon-list-bullet:before { content: '\f0ca'; } /* '' */
|
||||
.icon-mail-alt:before { content: '\f0e0'; } /* '' */
|
||||
.icon-sitemap:before { content: '\f0e8'; } /* '' */
|
||||
.icon-exchange:before { content: '\f0ec'; } /* '' */
|
||||
.icon-download-cloud:before { content: '\f0ed'; } /* '' */
|
||||
.icon-upload-cloud:before { content: '\f0ee'; } /* '' */
|
||||
.icon-plus-squared:before { content: '\f0fe'; } /* '' */
|
||||
.icon-circle-empty:before { content: '\f10c'; } /* '' */
|
||||
.icon-folder-empty:before { content: '\f114'; } /* '' */
|
||||
.icon-folder-open-empty:before { content: '\f115'; } /* '' */
|
||||
.icon-flag-empty:before { content: '\f11d'; } /* '' */
|
||||
.icon-star-half-alt:before { content: '\f123'; } /* '' */
|
||||
.icon-fork:before { content: '\f126'; } /* '' */
|
||||
.icon-unlink:before { content: '\f127'; } /* '' */
|
||||
.icon-help:before { content: '\f128'; } /* '' */
|
||||
.icon-info:before { content: '\f129'; } /* '' */
|
||||
.icon-eraser:before { content: '\f12d'; } /* '' */
|
||||
.icon-rocket:before { content: '\f135'; } /* '' */
|
||||
.icon-anchor:before { content: '\f13d'; } /* '' */
|
||||
.icon-lock-open-alt:before { content: '\f13e'; } /* '' */
|
||||
.icon-play-circled:before { content: '\f144'; } /* '' */
|
||||
.icon-minus-squared:before { content: '\f146'; } /* '' */
|
||||
.icon-minus-squared-alt:before { content: '\f147'; } /* '' */
|
||||
.icon-level-up:before { content: '\f148'; } /* '' */
|
||||
.icon-level-down:before { content: '\f149'; } /* '' */
|
||||
.icon-ok-squared:before { content: '\f14a'; } /* '' */
|
||||
.icon-pencil-squared:before { content: '\f14b'; } /* '' */
|
||||
.icon-compass:before { content: '\f14e'; } /* '' */
|
||||
.icon-expand:before { content: '\f150'; } /* '' */
|
||||
.icon-collapse:before { content: '\f151'; } /* '' */
|
||||
.icon-expand-right:before { content: '\f152'; } /* '' */
|
||||
.icon-sort-alt-up:before { content: '\f160'; } /* '' */
|
||||
.icon-sort-alt-down:before { content: '\f161'; } /* '' */
|
||||
.icon-female:before { content: '\f182'; } /* '' */
|
||||
.icon-male:before { content: '\f183'; } /* '' */
|
||||
.icon-sun:before { content: '\f185'; } /* '' */
|
||||
.icon-box:before { content: '\f187'; } /* '' */
|
||||
.icon-bug:before { content: '\f188'; } /* '' */
|
||||
.icon-right-circled2:before { content: '\f18e'; } /* '' */
|
||||
.icon-left-circled2:before { content: '\f190'; } /* '' */
|
||||
.icon-collapse-left:before { content: '\f191'; } /* '' */
|
||||
.icon-dot-circled:before { content: '\f192'; } /* '' */
|
||||
.icon-plus-squared-alt:before { content: '\f196'; } /* '' */
|
||||
.icon-bank:before { content: '\f19c'; } /* '' */
|
||||
.icon-child:before { content: '\f1ae'; } /* '' */
|
||||
.icon-paw:before { content: '\f1b0'; } /* '' */
|
||||
.icon-tree:before { content: '\f1bb'; } /* '' */
|
||||
.icon-history:before { content: '\f1da'; } /* '' */
|
||||
.icon-header:before { content: '\f1dc'; } /* '' */
|
||||
.icon-sliders:before { content: '\f1de'; } /* '' */
|
||||
.icon-trash:before { content: '\f1f8'; } /* '' */
|
||||
.icon-brush:before { content: '\f1fc'; } /* '' */
|
||||
.icon-chart-area:before { content: '\f1fe'; } /* '' */
|
||||
.icon-chart-pie:before { content: '\f200'; } /* '' */
|
||||
.icon-chart-line:before { content: '\f201'; } /* '' */
|
||||
.icon-ship:before { content: '\f21a'; } /* '' */
|
||||
.icon-user-secret:before { content: '\f21b'; } /* '' */
|
||||
.icon-venus:before { content: '\f221'; } /* '' */
|
||||
.icon-mars:before { content: '\f222'; } /* '' */
|
||||
.icon-venus-mars:before { content: '\f228'; } /* '' */
|
||||
.icon-neuter:before { content: '\f22c'; } /* '' */
|
||||
.icon-user-plus:before { content: '\f234'; } /* '' */
|
||||
.icon-user-times:before { content: '\f235'; } /* '' */
|
||||
.icon-object-ungroup:before { content: '\f248'; } /* '' */
|
||||
.icon-clone:before { content: '\f24d'; } /* '' */
|
||||
.icon-balance-scale:before { content: '\f24e'; } /* '' */
|
||||
.icon-hourglass-1:before { content: '\f251'; } /* '' */
|
||||
.icon-hand-grab-o:before { content: '\f255'; } /* '' */
|
||||
.icon-hand-paper-o:before { content: '\f256'; } /* '' */
|
||||
.icon-wikipedia-w:before { content: '\f266'; } /* '' */
|
||||
.icon-calendar-check-o:before { content: '\f274'; } /* '' */
|
||||
.icon-map-pin:before { content: '\f276'; } /* '' */
|
||||
.icon-map-signs:before { content: '\f277'; } /* '' */
|
||||
.icon-map-o:before { content: '\f278'; } /* '' */
|
||||
.icon-map:before { content: '\f279'; } /* '' */
|
||||
.icon-fort-awesome:before { content: '\f286'; } /* '' */
|
||||
.icon-percent:before { content: '\f295'; } /* '' */
|
||||
.icon-shield-alt:before { content: '\f3ed'; } /* '' */
|
||||
.icon-chess-bishop:before { content: '\f43a'; } /* '' */
|
||||
.icon-chess-king:before { content: '\f43f'; } /* '' */
|
||||
.icon-chess-knight:before { content: '\f441'; } /* '' */
|
||||
.icon-chess-pawn:before { content: '\f443'; } /* '' */
|
||||
.icon-chess-queen:before { content: '\f445'; } /* '' */
|
||||
.icon-chess-rook:before { content: '\f447'; } /* '' */
|
||||
.icon-sign:before { content: '\f4d9'; } /* '' */
|
||||
.icon-user-friends:before { content: '\f500'; } /* '' */
|
||||
.icon-user-shield:before { content: '\f505'; } /* '' */
|
||||
.icon-crow:before { content: '\f520'; } /* '' */
|
||||
.icon-crown:before { content: '\f521'; } /* '' */
|
||||
.icon-ruler:before { content: '\f545'; } /* '' */
|
||||
.icon-store:before { content: '\f54e'; } /* '' */
|
||||
.icon-bezier-curve:before { content: '\f55b'; } /* '' */
|
||||
.icon-drafting-compass:before { content: '\f568'; } /* '' */
|
||||
.icon-globe-africa:before { content: '\f57c'; } /* '' */
|
||||
.icon-monument:before { content: '\f5a6'; } /* '' */
|
||||
.icon-mortar-pestle:before { content: '\f5a7'; } /* '' */
|
||||
.icon-paint-roller:before { content: '\f5aa'; } /* '' */
|
||||
.icon-pen-fancy:before { content: '\f5ac'; } /* '' */
|
||||
.icon-pen-nib:before { content: '\f5ad'; } /* '' */
|
||||
.icon-pencil-ruler:before { content: '\f5ae'; } /* '' */
|
||||
.icon-draw-polygon:before { content: '\f5ee'; } /* '' */
|
||||
.icon-layer-group:before { content: '\f5fd'; } /* '' */
|
||||
.icon-menorah:before { content: '\f676'; } /* '' */
|
||||
.icon-mosque:before { content: '\f678'; } /* '' */
|
||||
.icon-place-of-worship:before { content: '\f67f'; } /* '' */
|
||||
.icon-synagogue:before { content: '\f69b'; } /* '' */
|
||||
.icon-book-dead:before { content: '\f6b7'; } /* '' */
|
||||
.icon-campground:before { content: '\f6bb'; } /* '' */
|
||||
.icon-mountain:before { content: '\f6fc'; } /* '' */
|
||||
.icon-network-wired:before { content: '\f6ff'; } /* '' */
|
||||
.icon-temperature-high:before { content: '\f769'; } /* '' */
|
||||
.icon-temperature-low:before { content: '\f76b'; } /* '' */
|
||||
.icon-pencil:before {content:'\e800';} /* '' */
|
||||
.icon-font:before {content:'\e801';} /* '' */
|
||||
.icon-arrows-cw:before {content:'\e802';} /* '' */
|
||||
.icon-doc:before {content:'\e803';} /* '' */
|
||||
.icon-trash-empty:before {content:'\e804';} /* '' */
|
||||
.icon-ok:before {content:'\e805';} /* '' */
|
||||
.icon-ok-circled:before {content:'\e806';} /* '' */
|
||||
.icon-ok-circled2:before {content:'\e807';} /* '' */
|
||||
.icon-link:before {content:'\e808';} /* '' */
|
||||
.icon-globe:before {content:'\e809';} /* '' */
|
||||
.icon-plus:before {content:'\e80a';} /* '' */
|
||||
.icon-plus-circled:before {content:'\e80b';} /* '' */
|
||||
.icon-minus-circled:before {content:'\e80c';} /* '' */
|
||||
.icon-minus:before {content:'\e80d';} /* '' */
|
||||
.icon-text-height:before {content:'\e80e';} /* '' */
|
||||
.icon-adjust:before {content:'\e80f';} /* '' */
|
||||
.icon-tag:before {content:'\e810';} /* '' */
|
||||
.icon-tags:before {content:'\e811';} /* '' */
|
||||
.icon-logout:before {content:'\e812';} /* '' */
|
||||
.icon-download:before {content:'\e813';} /* '' */
|
||||
.icon-down-circled2:before {content:'\e814';} /* '' */
|
||||
.icon-upload:before {content:'\e815';} /* '' */
|
||||
.icon-up-circled2:before {content:'\e816';} /* '' */
|
||||
.icon-cancel-circled2:before {content:'\e817';} /* '' */
|
||||
.icon-cancel-circled:before {content:'\e818';} /* '' */
|
||||
.icon-cancel:before {content:'\e819';} /* '' */
|
||||
.icon-check:before {content:'\e81a';} /* '' */
|
||||
.icon-align-left:before {content:'\e81b';} /* '' */
|
||||
.icon-align-center:before {content:'\e81c';} /* '' */
|
||||
.icon-align-right:before {content:'\e81d';} /* '' */
|
||||
.icon-align-justify:before {content:'\e81e';} /* '' */
|
||||
.icon-star:before {content:'\e81f';} /* '' */
|
||||
.icon-star-empty:before {content:'\e820';} /* '' */
|
||||
.icon-search:before {content:'\e821';} /* '' */
|
||||
.icon-mail:before {content:'\e822';} /* '' */
|
||||
.icon-eye:before {content:'\e823';} /* '' */
|
||||
.icon-eye-off:before {content:'\e824';} /* '' */
|
||||
.icon-pin:before {content:'\e825';} /* '' */
|
||||
.icon-lock-open:before {content:'\e826';} /* '' */
|
||||
.icon-lock:before {content:'\e827';} /* '' */
|
||||
.icon-attach:before {content:'\e828';} /* '' */
|
||||
.icon-home:before {content:'\e829';} /* '' */
|
||||
.icon-info-circled:before {content:'\e82a';} /* '' */
|
||||
.icon-help-circled:before {content:'\e82b';} /* '' */
|
||||
.icon-shuffle:before {content:'\e82c';} /* '' */
|
||||
.icon-ccw:before {content:'\e82d';} /* '' */
|
||||
.icon-cw:before {content:'\e82e';} /* '' */
|
||||
.icon-play:before {content:'\e82f';} /* '' */
|
||||
.icon-play-circled2:before {content:'\e830';} /* '' */
|
||||
.icon-down-big:before {content:'\e831';} /* '' */
|
||||
.icon-left-big:before {content:'\e832';} /* '' */
|
||||
.icon-right-big:before {content:'\e833';} /* '' */
|
||||
.icon-up-big:before {content:'\e834';} /* '' */
|
||||
.icon-up-open:before {content:'\e835';} /* '' */
|
||||
.icon-right-open:before {content:'\e836';} /* '' */
|
||||
.icon-left-open:before {content:'\e837';} /* '' */
|
||||
.icon-down-open:before {content:'\e838';} /* '' */
|
||||
.icon-cloud:before {content:'\e839';} /* '' */
|
||||
.icon-text-width:before {content:'\e83a';} /* '' */
|
||||
.icon-italic:before {content:'\e83b';} /* '' */
|
||||
.icon-bold:before {content:'\e83c';} /* '' */
|
||||
.icon-retweet:before {content:'\e83d';} /* '' */
|
||||
.icon-user:before {content:'\e83e';} /* '' */
|
||||
.icon-users:before {content:'\e83f';} /* '' */
|
||||
.icon-flag:before {content:'\e840';} /* '' */
|
||||
.icon-heart:before {content:'\e841';} /* '' */
|
||||
.icon-heart-empty:before {content:'\e842';} /* '' */
|
||||
.icon-edit:before {content:'\e843';} /* '' */
|
||||
.icon-export:before {content:'\e844';} /* '' */
|
||||
.icon-cog:before {content:'\e845';} /* '' */
|
||||
.icon-cog-alt:before {content:'\e846';} /* '' */
|
||||
.icon-wrench:before {content:'\e847';} /* '' */
|
||||
.icon-resize-vertical:before {content:'\e848';} /* '' */
|
||||
.icon-resize-small:before {content:'\e849';} /* '' */
|
||||
.icon-resize-full:before {content:'\e84a';} /* '' */
|
||||
.icon-resize-horizontal:before {content:'\e84b';} /* '' */
|
||||
.icon-target:before {content:'\e84c';} /* '' */
|
||||
.icon-signal:before {content:'\e84d';} /* '' */
|
||||
.icon-umbrella:before {content:'\e84e';} /* '' */
|
||||
.icon-leaf:before {content:'\e84f';} /* '' */
|
||||
.icon-book:before {content:'\e850';} /* '' */
|
||||
.icon-asterisk:before {content:'\e851';} /* '' */
|
||||
.icon-chart-bar:before {content:'\e852';} /* '' */
|
||||
.icon-key:before {content:'\e853';} /* '' */
|
||||
.icon-hammer:before {content:'\e854';} /* '' */
|
||||
.icon-star-half:before {content:'\e855';} /* '' */
|
||||
.icon-move:before {content:'\f047';} /* '' */
|
||||
.icon-expand-1:before {content:'\f065';} /* '' */
|
||||
.icon-link-ext:before {content:'\f08e';} /* '' */
|
||||
.icon-check-empty:before {content:'\f096';} /* '' */
|
||||
.icon-resize-full-alt:before {content:'\f0b2';} /* '' */
|
||||
.icon-flask:before {content:'\f0c3';} /* '' */
|
||||
.icon-docs:before {content:'\f0c5';} /* '' */
|
||||
.icon-list-bullet:before {content:'\f0ca';} /* '' */
|
||||
.icon-mail-alt:before {content:'\f0e0';} /* '' */
|
||||
.icon-sitemap:before {content:'\f0e8';} /* '' */
|
||||
.icon-exchange:before {content:'\f0ec';} /* '' */
|
||||
.icon-download-cloud:before {content:'\f0ed';} /* '' */
|
||||
.icon-upload-cloud:before {content:'\f0ee';} /* '' */
|
||||
.icon-plus-squared:before {content:'\f0fe';} /* '' */
|
||||
.icon-circle-empty:before {content:'\f10c';} /* '' */
|
||||
.icon-folder-empty:before {content:'\f114';} /* '' */
|
||||
.icon-folder-open-empty:before {content:'\f115';} /* '' */
|
||||
.icon-flag-empty:before {content:'\f11d';} /* '' */
|
||||
.icon-star-half-alt:before {content:'\f123';} /* '' */
|
||||
.icon-fork:before {content:'\f126';} /* '' */
|
||||
.icon-unlink:before {content:'\f127';} /* '' */
|
||||
.icon-help:before {content:'\f128';} /* '' */
|
||||
.icon-info:before {content:'\f129';} /* '' */
|
||||
.icon-eraser:before {content:'\f12d';} /* '' */
|
||||
.icon-rocket:before {content:'\f135';} /* '' */
|
||||
.icon-anchor:before {content:'\f13d';} /* '' */
|
||||
.icon-lock-open-alt:before {content:'\f13e';} /* '' */
|
||||
.icon-play-circled:before {content:'\f144';} /* '' */
|
||||
.icon-minus-squared:before {content:'\f146';} /* '' */
|
||||
.icon-minus-squared-alt:before {content:'\f147';} /* '' */
|
||||
.icon-level-up:before {content:'\f148';} /* '' */
|
||||
.icon-level-down:before {content:'\f149';} /* '' */
|
||||
.icon-ok-squared:before {content:'\f14a';} /* '' */
|
||||
.icon-pencil-squared:before {content:'\f14b';} /* '' */
|
||||
.icon-compass:before {content:'\f14e';} /* '' */
|
||||
.icon-expand:before {content:'\f150';} /* '' */
|
||||
.icon-collapse:before {content:'\f151';} /* '' */
|
||||
.icon-expand-right:before {content:'\f152';} /* '' */
|
||||
.icon-sort-alt-up:before {content:'\f160';} /* '' */
|
||||
.icon-sort-alt-down:before {content:'\f161';} /* '' */
|
||||
.icon-female:before {content:'\f182';} /* '' */
|
||||
.icon-male:before {content:'\f183';} /* '' */
|
||||
.icon-sun:before {content:'\f185';} /* '' */
|
||||
.icon-box:before {content:'\f187';} /* '' */
|
||||
.icon-bug:before {content:'\f188';} /* '' */
|
||||
.icon-right-circled2:before {content:'\f18e';} /* '' */
|
||||
.icon-left-circled2:before {content:'\f190';} /* '' */
|
||||
.icon-collapse-left:before {content:'\f191';} /* '' */
|
||||
.icon-dot-circled:before {content:'\f192';} /* '' */
|
||||
.icon-plus-squared-alt:before {content:'\f196';} /* '' */
|
||||
.icon-bank:before {content:'\f19c';} /* '' */
|
||||
.icon-child:before {content:'\f1ae';} /* '' */
|
||||
.icon-paw:before {content:'\f1b0';} /* '' */
|
||||
.icon-tree:before {content:'\f1bb';} /* '' */
|
||||
.icon-history:before {content:'\f1da';} /* '' */
|
||||
.icon-header:before {content:'\f1dc';} /* '' */
|
||||
.icon-sliders:before {content:'\f1de';} /* '' */
|
||||
.icon-trash:before {content:'\f1f8';} /* '' */
|
||||
.icon-brush:before {content:'\f1fc';} /* '' */
|
||||
.icon-chart-area:before {content:'\f1fe';} /* '' */
|
||||
.icon-chart-pie:before {content:'\f200';} /* '' */
|
||||
.icon-chart-line:before {content:'\f201';} /* '' */
|
||||
.icon-ship:before {content:'\f21a';} /* '' */
|
||||
.icon-user-secret:before {content:'\f21b';} /* '' */
|
||||
.icon-venus:before {content:'\f221';} /* '' */
|
||||
.icon-mars:before {content:'\f222';} /* '' */
|
||||
.icon-venus-mars:before {content:'\f228';} /* '' */
|
||||
.icon-neuter:before {content:'\f22c';} /* '' */
|
||||
.icon-user-plus:before {content:'\f234';} /* '' */
|
||||
.icon-user-times:before {content:'\f235';} /* '' */
|
||||
.icon-object-ungroup:before {content:'\f248';} /* '' */
|
||||
.icon-clone:before {content:'\f24d';} /* '' */
|
||||
.icon-balance-scale:before {content:'\f24e';} /* '' */
|
||||
.icon-hourglass-1:before {content:'\f251';} /* '' */
|
||||
.icon-hand-grab-o:before {content:'\f255';} /* '' */
|
||||
.icon-hand-paper-o:before {content:'\f256';} /* '' */
|
||||
.icon-wikipedia-w:before {content:'\f266';} /* '' */
|
||||
.icon-calendar-check-o:before {content:'\f274';} /* '' */
|
||||
.icon-map-pin:before {content:'\f276';} /* '' */
|
||||
.icon-map-signs:before {content:'\f277';} /* '' */
|
||||
.icon-map-o:before {content:'\f278';} /* '' */
|
||||
.icon-map:before {content:'\f279';} /* '' */
|
||||
.icon-fort-awesome:before {content:'\f286';} /* '' */
|
||||
.icon-percent:before {content:'\f295';} /* '' */
|
||||
.icon-shield-alt:before {content:'\f3ed';} /* '' */
|
||||
.icon-chess-bishop:before {content:'\f43a';} /* '' */
|
||||
.icon-chess-king:before {content:'\f43f';} /* '' */
|
||||
.icon-chess-knight:before {content:'\f441';} /* '' */
|
||||
.icon-chess-pawn:before {content:'\f443';} /* '' */
|
||||
.icon-chess-queen:before {content:'\f445';} /* '' */
|
||||
.icon-chess-rook:before {content:'\f447';} /* '' */
|
||||
.icon-sign:before {content:'\f4d9';} /* '' */
|
||||
.icon-user-friends:before {content:'\f500';} /* '' */
|
||||
.icon-user-shield:before {content:'\f505';} /* '' */
|
||||
.icon-crow:before {content:'\f520';} /* '' */
|
||||
.icon-crown:before {content:'\f521';} /* '' */
|
||||
.icon-ruler:before {content:'\f545';} /* '' */
|
||||
.icon-store:before {content:'\f54e';} /* '' */
|
||||
.icon-bezier-curve:before {content:'\f55b';} /* '' */
|
||||
.icon-drafting-compass:before {content:'\f568';} /* '' */
|
||||
.icon-globe-africa:before {content:'\f57c';} /* '' */
|
||||
.icon-monument:before {content:'\f5a6';} /* '' */
|
||||
.icon-mortar-pestle:before {content:'\f5a7';} /* '' */
|
||||
.icon-paint-roller:before {content:'\f5aa';} /* '' */
|
||||
.icon-pen-fancy:before {content:'\f5ac';} /* '' */
|
||||
.icon-pen-nib:before {content:'\f5ad';} /* '' */
|
||||
.icon-pencil-ruler:before {content:'\f5ae';} /* '' */
|
||||
.icon-draw-polygon:before {content:'\f5ee';} /* '' */
|
||||
.icon-layer-group:before {content:'\f5fd';} /* '' */
|
||||
.icon-menorah:before {content:'\f676';} /* '' */
|
||||
.icon-mosque:before {content:'\f678';} /* '' */
|
||||
.icon-place-of-worship:before {content:'\f67f';} /* '' */
|
||||
.icon-synagogue:before {content:'\f69b';} /* '' */
|
||||
.icon-book-dead:before {content:'\f6b7';} /* '' */
|
||||
.icon-campground:before {content:'\f6bb';} /* '' */
|
||||
.icon-mountain:before {content:'\f6fc';} /* '' */
|
||||
.icon-network-wired:before {content:'\f6ff';} /* '' */
|
||||
.icon-temperature-high:before {content:'\f769';} /* '' */
|
||||
.icon-temperature-low:before {content:'\f76b';} /* '' */
|
||||
|
||||
/* Amended FA icons */
|
||||
.icon-sort-name-up:after { font-size: .9em; content: '\f15d'; }
|
||||
.icon-sort-name-down:after { font-size: .9em; content: '\f15e'; }
|
||||
.icon-sort-number-up:after { font-size: .9em; content: '\f162'; }
|
||||
.icon-sort-number-down:after { font-size: .9em; content: '\f163'; }
|
||||
.icon-sort-name-up:after {font-size:.9em;content:'\f15d';}
|
||||
.icon-sort-name-down:after {font-size:.9em;content:'\f15e';}
|
||||
.icon-sort-number-up:after {font-size:.9em;content:'\f162';}
|
||||
.icon-sort-number-down:after {font-size:.9em;content:'\f163';}
|
||||
|
||||
/* Custom icons */
|
||||
.icon-w:before { font-style: italic; content: 'w:'; }
|
||||
.icon-f:before { font-style: italic; content: 'f:'; }
|
||||
.icon-n:before { font-style: italic; content: 'n:'; }
|
||||
.icon-i:before { font-style: italic; content: 'i:'; }
|
||||
.icon-s:before { font-style: italic; content: 's:'; }
|
||||
.icon-r:before { font-style: italic; content: 'r:'; }
|
||||
.icon-a:before { font-style: italic; content: 'a:'; }
|
||||
.icon-smooth:before {font-weight: bold; content: '∼'; }
|
||||
.icon-disrupt:before {font-weight: bold; content: '෴'; }
|
||||
.icon-if:before {font-style: italic; font-weight: bold; content: 'if'; }
|
||||
.icon-fleur:before {content: '⚜'; font-size: 1.1em; margin: -2px; }
|
||||
|
||||
.icon-curve:before {content: 'C'; }
|
||||
.icon-area:before {content: 'O'; }
|
||||
|
||||
.icon-w:before {font-style:italic;content:'w:';}
|
||||
.icon-f:before {font-style:italic;content:'f:';}
|
||||
.icon-n:before {font-style:italic;content:'n:';}
|
||||
.icon-i:before {font-style:italic;content:'i:';}
|
||||
.icon-s:before {font-style:italic;content:'s:';}
|
||||
.icon-r:before {font-style:italic;content:'r:';}
|
||||
.icon-a:before {font-style:italic;content:'a:';}
|
||||
.icon-smooth:before {font-weight: bold;content:'∼';}
|
||||
.icon-disrupt:before {font-weight: bold;content:'෴';}
|
||||
.icon-if:before {font-style: italic; font-weight: bold;content:'if';}
|
||||
.icon-fleur:before {content: '⚜'; font-size: 1.1em; margin: -2px;}
|
||||
.icon-curve:before {content: 'C';}
|
||||
.icon-area:before {content: 'O';}
|
||||
.icon-curve:before,
|
||||
.icon-area:before {
|
||||
font-size: 1.5em;
|
||||
|
|
|
|||
27
index.css
27
index.css
|
|
@ -29,6 +29,7 @@ input {
|
|||
background-color: #000000;
|
||||
mask-mode: alpha;
|
||||
mask-clip: no-clip;
|
||||
fill-rule: evenodd;
|
||||
}
|
||||
|
||||
#canvas {
|
||||
|
|
@ -47,7 +48,7 @@ input {
|
|||
position: absolute;
|
||||
}
|
||||
|
||||
input, button, select, a {
|
||||
input, button, select, a, textarea {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
|
|
@ -72,21 +73,17 @@ button, select, a {
|
|||
|
||||
#biomes {
|
||||
stroke-width: .7;
|
||||
fill-rule: evenodd;
|
||||
}
|
||||
|
||||
#landmass {
|
||||
mask: url(#land);
|
||||
fill-rule: evenodd;
|
||||
}
|
||||
|
||||
#lakes,
|
||||
#coastline {
|
||||
#lakes, #coastline {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#temperature {
|
||||
fill-rule: evenodd;
|
||||
font-family: sans-serif;
|
||||
font-weight: 700;
|
||||
text-anchor: middle;
|
||||
|
|
@ -94,10 +91,6 @@ button, select, a {
|
|||
text-shadow: 0px 0px 10px white;
|
||||
}
|
||||
|
||||
#oceanLayers {
|
||||
fill-rule: evenodd;
|
||||
}
|
||||
|
||||
#coastline {
|
||||
fill: none;
|
||||
stroke-linejoin: round;
|
||||
|
|
@ -109,7 +102,7 @@ button, select, a {
|
|||
|
||||
#statesBody, #provincesBody {
|
||||
stroke-width: 2;
|
||||
fill-rule: evenodd;
|
||||
|
||||
mask: url(#land);
|
||||
}
|
||||
|
||||
|
|
@ -696,15 +689,8 @@ fieldset {
|
|||
background-color: #ffffff !important;
|
||||
}
|
||||
|
||||
.overflow-div {
|
||||
height: 300px;
|
||||
overflow-y: auto;
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
.overflow-table {
|
||||
width: 100%;
|
||||
font-size: smaller;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
|
@ -997,7 +983,6 @@ i.resetButton:active {
|
|||
}
|
||||
|
||||
.ui-dialog input[type="range"] {
|
||||
outline: none;
|
||||
height: 2px;
|
||||
background: #d4d4d4;
|
||||
top: -.35em;
|
||||
|
|
@ -1575,7 +1560,7 @@ div.states > div.biomeArea {
|
|||
|
||||
#ruler .planimeter {
|
||||
fill: lightblue;
|
||||
fill-rule: evenodd;
|
||||
|
||||
fill-opacity: 0.5;
|
||||
stroke: #737373;
|
||||
}
|
||||
|
|
@ -1761,12 +1746,10 @@ input[type="checkbox"] {
|
|||
div.textual select,
|
||||
div.textual textarea {
|
||||
font-family: Copperplate, monospace;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
div.textual input {
|
||||
font-family: Copperplate, monospace;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
div.textual fieldset {
|
||||
|
|
|
|||
111
index.html
111
index.html
File diff suppressed because one or more lines are too long
169
main.js
169
main.js
|
|
@ -157,7 +157,7 @@ void function checkLoadParameters() {
|
|||
if (blob) {
|
||||
console.warn("Load last saved map");
|
||||
try {
|
||||
uploadFile(blob);
|
||||
uploadMap(blob);
|
||||
}
|
||||
catch(error) {
|
||||
console.error(error);
|
||||
|
|
@ -183,7 +183,7 @@ function loadMapFromURL(maplink, random) {
|
|||
.then(response => {
|
||||
if(response.ok) return response.blob();
|
||||
throw new Error("Cannot load map from URL");
|
||||
}).then(blob => uploadFile(blob))
|
||||
}).then(blob => uploadMap(blob))
|
||||
.catch(error => {
|
||||
showUploadErrorMessage(error.message, URL, random);
|
||||
if (random) generateMapOnLoad();
|
||||
|
|
@ -200,7 +200,7 @@ function showUploadErrorMessage(error, URL, random) {
|
|||
}
|
||||
|
||||
function generateMapOnLoad() {
|
||||
applyDefaultStyle(); // apply style
|
||||
applyStyleOnLoad(); // apply default of previously selected style
|
||||
generate(); // generate map
|
||||
focusOn(); // based on searchParams focus on point, cell or burg from MFCG
|
||||
applyPreset(); // apply saved layers preset
|
||||
|
|
@ -315,105 +315,6 @@ function applyDefaultBiomesSystem() {
|
|||
return {i:d3.range(0, name.length), name, color, biomesMartix, habitability, iconsDensity, icons, cost};
|
||||
}
|
||||
|
||||
// restore initial style
|
||||
function applyDefaultStyle() {
|
||||
biomes.attr("opacity", null).attr("filter", null);
|
||||
stateBorders.attr("opacity", .8).attr("stroke", "#56566d").attr("stroke-width", 1).attr("stroke-dasharray", "2").attr("stroke-linecap", "butt").attr("filter", null);
|
||||
provinceBorders.attr("opacity", .8).attr("stroke", "#56566d").attr("stroke-width", .2).attr("stroke-dasharray", "1").attr("stroke-linecap", "butt").attr("filter", null);
|
||||
cells.attr("opacity", null).attr("stroke", "#808080").attr("stroke-width", .1).attr("filter", null).attr("mask", null);
|
||||
|
||||
gridOverlay.attr("opacity", .8).attr("stroke", "#808080").attr("stroke-width", .5).attr("stroke-dasharray", null).attr("transform", null).attr("filter", null).attr("mask", null);
|
||||
coordinates.attr("opacity", 1).attr("data-size", 12).attr("font-size", 12).attr("stroke", "#d4d4d4").attr("stroke-width", 1).attr("stroke-dasharray", 5).attr("filter", null).attr("mask", null);
|
||||
compass.attr("opacity", .8).attr("transform", null).attr("filter", null).attr("mask", "url(#water)").attr("shape-rendering", "optimizespeed");
|
||||
if (!d3.select("#initial").size()) d3.select("#rose").attr("transform", "translate(80 80) scale(.25)");
|
||||
|
||||
relig.attr("opacity", .7).attr("stroke", "#404040").attr("stroke-width", .7).attr("filter", null).attr("fill-rule", "evenodd");
|
||||
cults.attr("opacity", .6).attr("stroke", "#777777").attr("stroke-width", .5).attr("filter", null).attr("fill-rule", "evenodd");
|
||||
icons.selectAll("g").attr("opacity", null).attr("fill", "#ffffff").attr("stroke", "#3e3e4b").attr("filter", null).attr("mask", null);
|
||||
landmass.attr("opacity", 1).attr("fill", "#eef6fb").attr("filter", null);
|
||||
markers.attr("opacity", null).attr("filter", "url(#dropShadow01)");
|
||||
styleRescaleMarkers.checked = true;
|
||||
prec.attr("opacity", null).attr("stroke", "#000000").attr("stroke-width", .1).attr("fill", "#003dff").attr("filter", null);
|
||||
population.attr("opacity", null).attr("stroke-width", 1.6).attr("stroke-dasharray", null).attr("stroke-linecap", "butt").attr("filter", null);
|
||||
population.select("#rural").attr("stroke", "#0000ff");
|
||||
population.select("#urban").attr("stroke", "#ff0000");
|
||||
|
||||
lakes.select("#freshwater").attr("opacity", .5).attr("fill", "#a6c1fd").attr("stroke", "#5f799d").attr("stroke-width", .7).attr("filter", null);
|
||||
lakes.select("#salt").attr("opacity", .5).attr("fill", "#409b8a").attr("stroke", "#388985").attr("stroke-width", .7).attr("filter", null);
|
||||
lakes.select("#sinkhole").attr("opacity", 1).attr("fill", "#5bc9fd").attr("stroke", "#53a3b0").attr("stroke-width", .7).attr("filter", null);
|
||||
lakes.select("#frozen").attr("opacity", .95).attr("fill", "#cdd4e7").attr("stroke", "#cfe0eb").attr("stroke-width", 0).attr("filter", null);
|
||||
lakes.select("#lava").attr("opacity", .7).attr("fill", "#90270d").attr("stroke", "#f93e0c").attr("stroke-width", 2).attr("filter", "url(#crumpled)");
|
||||
|
||||
coastline.select("#sea_island").attr("opacity", .5).attr("stroke", "#1f3846").attr("stroke-width", .7).attr("filter", "url(#dropShadow)");
|
||||
coastline.select("#lake_island").attr("opacity", 1).attr("stroke", "#7c8eaf").attr("stroke-width", .35).attr("filter", null);
|
||||
styleCoastlineAuto.checked = true;
|
||||
|
||||
terrain.attr("opacity", null).attr("filter", null).attr("mask", null);
|
||||
rivers.attr("opacity", null).attr("fill", "#5d97bb").attr("filter", null);
|
||||
roads.attr("opacity", .9).attr("stroke", "#d06324").attr("stroke-width", .7).attr("stroke-dasharray", "2").attr("stroke-linecap", "butt").attr("filter", null);
|
||||
ruler.attr("opacity", null).attr("filter", null);
|
||||
searoutes.attr("opacity", .8).attr("stroke", "#ffffff").attr("stroke-width", .45).attr("stroke-dasharray", "1 2").attr("stroke-linecap", "round").attr("filter", null);
|
||||
|
||||
regions.attr("opacity", .4).attr("filter", null);
|
||||
statesHalo.attr("stroke-width", 10).attr("opacity", 1);
|
||||
provs.attr("opacity", .6).attr("filter", null);
|
||||
|
||||
temperature.attr("opacity", null).attr("fill", "#000000").attr("stroke-width", 1.8).attr("fill-opacity", .3).attr("font-size", "8px").attr("stroke-dasharray", null).attr("filter", null).attr("mask", null);
|
||||
texture.attr("opacity", null).attr("filter", null).attr("mask", "url(#land)");
|
||||
texture.select("image").attr("x", 0).attr("y", 0);
|
||||
zones.attr("opacity", .6).attr("stroke", "#333333").attr("stroke-width", 0).attr("stroke-dasharray", null).attr("stroke-linecap", "butt").attr("filter", null).attr("mask", null);
|
||||
trails.attr("opacity", .9).attr("stroke", "#d06324").attr("stroke-width", .25).attr("stroke-dasharray", ".8 1.6").attr("stroke-linecap", "butt").attr("filter", null);
|
||||
|
||||
// ocean and svg default style
|
||||
svg.attr("background-color", "#000000").attr("filter", null);
|
||||
const mapFilter = document.querySelector("#mapFilters .pressed");
|
||||
if (mapFilter) mapFilter.classList.remove("pressed");
|
||||
ocean.attr("opacity", null);
|
||||
oceanLayers.select("rect").attr("fill", "#53679f");
|
||||
oceanLayers.attr("filter", null);
|
||||
oceanPattern.attr("opacity", null);
|
||||
oceanLayers.selectAll("path").attr("display", null);
|
||||
styleOceanPattern.value = "url(#pattern1)";
|
||||
svg.select("#oceanic rect").attr("filter", "url(#pattern1)");
|
||||
|
||||
// heightmap style
|
||||
terrs.attr("opacity", null).attr("filter", null).attr("mask", "url(#land)").attr("stroke", "none");
|
||||
const changed = styleHeightmapSchemeInput.value !== "bright" ||
|
||||
styleHeightmapTerracingInput.value != 0 ||
|
||||
styleHeightmapSkipInput.value != 5 ||
|
||||
styleHeightmapSimplificationInput.value != 0 ||
|
||||
styleHeightmapCurveInput.value != 0;
|
||||
styleHeightmapSchemeInput.value = "bright";
|
||||
styleHeightmapTerracingInput.value = styleHeightmapTerracingOutput.value = 0;
|
||||
styleHeightmapSkipInput.value = styleHeightmapSkipOutput.value = 5;
|
||||
styleHeightmapSimplificationInput.value = styleHeightmapSimplificationOutput.value = 0;
|
||||
styleHeightmapCurveInput.value = 0;
|
||||
if (changed) drawHeightmap();
|
||||
|
||||
// legend
|
||||
legend.attr("font-family", "Almendra SC").attr("data-font", "Almendra+SC").attr("font-size", 13).attr("data-size", 13).attr("data-x", 99).attr("data-y", 93).attr("stroke-width", 2.5).attr("stroke", "#812929").attr("stroke-dasharray", "0 4 10 4").attr("stroke-linecap", "round");
|
||||
styleLegendBack.value = "#ffffff";
|
||||
styleLegendOpacity.value = styleLegendOpacityOutput.value = .8;
|
||||
styleLegendColItems.value = styleLegendColItemsOutput.value = 8;
|
||||
if (legend.selectAll("*").size() && window.redrawLegend) redrawLegend();
|
||||
|
||||
const citiesSize = Math.max(rn(8 - regionsInput.value / 20), 3);
|
||||
burgLabels.select("#cities").attr("fill", "#3e3e4b").attr("opacity", 1).attr("font-family", "Almendra SC").attr("data-font", "Almendra+SC").attr("font-size", citiesSize).attr("data-size", citiesSize);
|
||||
burgIcons.select("#cities").attr("opacity", 1).attr("size", 1).attr("stroke-width", .24).attr("fill", "#ffffff").attr("stroke", "#3e3e4b").attr("fill-opacity", .7).attr("stroke-dasharray", "").attr("stroke-linecap", "butt");
|
||||
anchors.select("#cities").attr("opacity", 1).attr("fill", "#ffffff").attr("stroke", "#3e3e4b").attr("stroke-width", 1.2).attr("size", 2);
|
||||
|
||||
burgLabels.select("#towns").attr("fill", "#3e3e4b").attr("opacity", 1).attr("font-family", "Almendra SC").attr("data-font", "Almendra+SC").attr("font-size", 3).attr("data-size", 4);
|
||||
burgIcons.select("#towns").attr("opacity", 1).attr("size", .5).attr("stroke-width", .12).attr("fill", "#ffffff").attr("stroke", "#3e3e4b").attr("fill-opacity", .7).attr("stroke-dasharray", "").attr("stroke-linecap", "butt");
|
||||
anchors.select("#towns").attr("opacity", 1).attr("fill", "#ffffff").attr("stroke", "#3e3e4b").attr("stroke-width", 1.2).attr("size", 1);
|
||||
|
||||
const stateLabelSize = Math.max(rn(24 - regionsInput.value / 6), 6);
|
||||
labels.select("#states").attr("fill", "#3e3e4b").attr("opacity", 1).attr("stroke", "#3a3a3a").attr("stroke-width", 0).attr("font-family", "Almendra SC").attr("data-font", "Almendra+SC").attr("font-size", stateLabelSize).attr("data-size", stateLabelSize).attr("filter", null);
|
||||
labels.select("#addedLabels").attr("fill", "#3e3e4b").attr("opacity", 1).attr("stroke", "#3a3a3a").attr("stroke-width", 0).attr("font-family", "Almendra SC").attr("data-font", "Almendra+SC").attr("font-size", 18).attr("data-size", 18).attr("filter", null);
|
||||
invokeActiveZooming();
|
||||
|
||||
fogging.attr("opacity", .8).attr("fill", "#000000").attr("stroke-width", 5);
|
||||
}
|
||||
|
||||
function showWelcomeMessage() {
|
||||
const link = 'https://www.reddit.com/r/FantasyMapGenerator/comments/daf6g2/update_new_version_is_published_v_11'; // announcement on Reddit
|
||||
alertMessage.innerHTML = `The Fantasy Map Generator is updated up to version <b>${version}</b>.
|
||||
|
|
@ -450,6 +351,8 @@ function zoomed() {
|
|||
const transform = d3.event.transform;
|
||||
const scaleDiff = scale - transform.k;
|
||||
const positionDiff = viewX - transform.x | viewY - transform.y;
|
||||
if (!positionDiff && !scaleDiff) return;
|
||||
|
||||
scale = transform.k;
|
||||
viewX = transform.x;
|
||||
viewY = transform.y;
|
||||
|
|
@ -463,6 +366,16 @@ function zoomed() {
|
|||
invokeActiveZooming();
|
||||
drawScaleBar();
|
||||
}
|
||||
|
||||
// zoom image converter overlay
|
||||
const canvas = document.getElementById("canvas");
|
||||
if (canvas && +canvas.style.opacity) {
|
||||
const img = document.getElementById("image");
|
||||
const ctx = canvas.getContext("2d");
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
ctx.setTransform(scale, 0, 0, scale, viewX, viewY);
|
||||
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
||||
}
|
||||
}
|
||||
|
||||
// Zoom to a specific point
|
||||
|
|
@ -485,10 +398,9 @@ function getViewBoxExtent() {
|
|||
|
||||
// active zooming feature
|
||||
function invokeActiveZooming() {
|
||||
if (styleCoastlineAuto.checked) {
|
||||
if (coastline.select("#sea_island").size() && +coastline.select("#sea_island").attr("auto-filter")) {
|
||||
// toggle shade/blur filter for coatline on zoom
|
||||
let filter = scale > 2.6 ? "url(#blurFilter)" : "url(#dropShadow)";
|
||||
if (scale > 1.5 && scale <= 2.6) filter = null;
|
||||
const filter = scale > 1.5 && scale <= 2.6 ? null : scale > 2.6 ? "url(#blurFilter)" : "url(#dropShadow)";
|
||||
coastline.select("#sea_island").attr("filter", filter);
|
||||
}
|
||||
|
||||
|
|
@ -509,12 +421,12 @@ function invokeActiveZooming() {
|
|||
|
||||
// change states halo width
|
||||
if (!customization) {
|
||||
const haloSize = rn(styleStatesHaloWidth.value / scale, 1);
|
||||
const haloSize = rn(statesHalo.attr("data-width") / scale, 1);
|
||||
statesHalo.attr("stroke-width", haloSize).style("display", haloSize > 3 ? "block" : "none");
|
||||
}
|
||||
|
||||
// rescale map markers
|
||||
if (styleRescaleMarkers.checked && markers.style("display") !== "none") {
|
||||
if (+markers.attr("rescale") && markers.style("display") !== "none") {
|
||||
markers.selectAll("use").each(function(d) {
|
||||
const x = +this.dataset.x, y = +this.dataset.y, desired = +this.dataset.size;
|
||||
const size = Math.max(desired * 5 + 25 / scale, 1);
|
||||
|
|
@ -565,7 +477,7 @@ void function addDragToUpload() {
|
|||
// all good - show uploading text and load the map
|
||||
$("#map-dragged > p").text("Uploading<span>.</span><span>.</span><span>.</span>");
|
||||
closeDialogs();
|
||||
uploadFile(file, function onUploadFinish() {
|
||||
uploadMap(file, function onUploadFinish() {
|
||||
$("#map-dragged > p").text("Drop to upload");
|
||||
});
|
||||
});
|
||||
|
|
@ -601,6 +513,9 @@ function generate() {
|
|||
Cultures.expand();
|
||||
BurgsAndStates.generate();
|
||||
Religions.generate();
|
||||
BurgsAndStates.defineStateForms();
|
||||
BurgsAndStates.generateProvinces();
|
||||
BurgsAndStates.defineBurgFeatures();
|
||||
|
||||
drawStates();
|
||||
drawBorders();
|
||||
|
|
@ -697,7 +612,10 @@ function markFeatures() {
|
|||
cells.f[e] = i;
|
||||
queue.push(e);
|
||||
}
|
||||
if (land && !eLand) {cells.t[q] = 1; cells.t[e] = -1;}
|
||||
if (land && !eLand) {
|
||||
cells.t[q] = 1;
|
||||
cells.t[e] = -1;
|
||||
}
|
||||
});
|
||||
}
|
||||
const type = land ? "island" : border ? "ocean" : "lake";
|
||||
|
|
@ -1072,7 +990,7 @@ function reMarkFeatures() {
|
|||
console.time("reMarkFeatures");
|
||||
const cells = pack.cells, features = pack.features = [0];
|
||||
cells.f = new Uint16Array(cells.i.length); // cell feature number
|
||||
cells.t = new Int8Array(cells.i.length); // cell type: 1 = land along coast; -1 = water along coast;
|
||||
cells.t = new Int16Array(cells.i.length); // cell type: 1 = land along coast; -1 = water along coast;
|
||||
cells.haven = new Uint16Array(cells.i.length); // cell haven (opposite water cell);
|
||||
cells.harbor = new Uint16Array(cells.i.length); // cell harbor (number of adjacent water cells);
|
||||
|
||||
|
|
@ -1088,11 +1006,6 @@ function reMarkFeatures() {
|
|||
if (cells.b[q]) border = true;
|
||||
cells.c[q].forEach(function(e) {
|
||||
const eLand = cells.h[e] >= 20;
|
||||
if (land === eLand && cells.f[e] === 0) {
|
||||
cells.f[e] = i;
|
||||
queue.push(e);
|
||||
cellNumber++;
|
||||
}
|
||||
if (land && !eLand) {
|
||||
cells.t[q] = 1;
|
||||
cells.t[e] = -1;
|
||||
|
|
@ -1102,6 +1015,11 @@ function reMarkFeatures() {
|
|||
if (!cells.t[e] && cells.t[q] === 1) cells.t[e] = 2;
|
||||
else if (!cells.t[q] && cells.t[e] === 1) cells.t[q] = 2;
|
||||
}
|
||||
if (land === eLand && cells.f[e] === 0) {
|
||||
cells.f[e] = i;
|
||||
queue.push(e);
|
||||
cellNumber++;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -1140,15 +1058,12 @@ function elevateLakes() {
|
|||
console.time('elevateLakes');
|
||||
const cells = pack.cells, features = pack.features;
|
||||
const maxCells = cells.i.length / 100; // size limit; let big lakes be closed (endorheic)
|
||||
const lakes = cells.i
|
||||
.filter(i => features[cells.f[i]].group === "freshwater" && features[cells.f[i]].cells < maxCells)
|
||||
.sort(highest); // highest cells go first
|
||||
|
||||
for (const i of lakes) {
|
||||
//debug.append("circle").attr("cx", cells.p[i][0]).attr("cy", cells.p[i][1]).attr("r", 1).attr("fill", "blue");
|
||||
const hs = cells.c[i].filter(isLand).map(c => cells.h[c]);
|
||||
cells.h[i] = Math.max(d3.min(hs) - 5, 20) || 20;
|
||||
}
|
||||
cells.i.forEach(i => {
|
||||
if (cells.h[i] >= 20) return;
|
||||
if (features[cells.f[i]].group !== "freshwater" || features[cells.f[i]].cells > maxCells) return;
|
||||
cells.h[i] = 20;
|
||||
//debug.append("circle").attr("cx", cells.p[i][0]).attr("cy", cells.p[i][1]).attr("r", .5).attr("fill", "blue");
|
||||
});
|
||||
|
||||
console.timeEnd('elevateLakes');
|
||||
}
|
||||
|
|
@ -1721,7 +1636,7 @@ function addZones(number = 1) {
|
|||
|
||||
cells.c[q].forEach(e => {
|
||||
if (used[e]) return;
|
||||
if (cells.h[e] >= 20 && !cells.t[e]) return;
|
||||
if (cells.t[e] > 2) return;
|
||||
if (pack.features[cells.f[e]].type === "lake") return;
|
||||
used[e] = 1;
|
||||
queue.push(e);
|
||||
|
|
@ -1756,7 +1671,9 @@ function showStatistics() {
|
|||
States: ${pack.states.length-1}
|
||||
Provinces: ${pack.provinces.length-1}
|
||||
Burgs: ${pack.burgs.length-1}
|
||||
Religions: ${pack.religions.length-1}`;
|
||||
Religions: ${pack.religions.length-1}
|
||||
Culture set: ${culturesSet.selectedOptions[0].innerText}
|
||||
Cultures: ${pack.cultures.length-1}`;
|
||||
mapHistory.push({seed, width:graphWidth, height:graphHeight, template, created: Date.now()});
|
||||
console.log(stats);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,20 +16,17 @@
|
|||
const capitalRoutes = Routes.getRoads();
|
||||
|
||||
placeTowns();
|
||||
expandStates();
|
||||
normalizeStates();
|
||||
const townRoutes = Routes.getTrails();
|
||||
specifyBurgs();
|
||||
|
||||
const oceanRoutes = Routes.getSearoutes();
|
||||
|
||||
expandStates();
|
||||
normalizeStates();
|
||||
collectStatistics();
|
||||
assignColors();
|
||||
|
||||
generateDiplomacy();
|
||||
defineStateForms();
|
||||
generateProvinces();
|
||||
|
||||
Routes.draw(capitalRoutes, townRoutes, oceanRoutes);
|
||||
drawBurgs();
|
||||
|
||||
|
|
@ -106,7 +103,7 @@
|
|||
const score = new Int16Array(cells.s.map(s => s * gauss(1,3,0,20,3))); // a bit randomized cell score for towns placement
|
||||
const sorted = cells.i.filter(i => !cells.burg[i] && score[i] > 0 && cells.culture[i]).sort((a, b) => score[b] - score[a]); // filtered and sorted array of indexes
|
||||
|
||||
const desiredNumber = manorsInput.value == 1000 ? rn(sorted.length / 8 / (grid.points.length / 10000) ** .8) : manorsInput.valueAsNumber;
|
||||
const desiredNumber = manorsInput.value == 1000 ? rn(sorted.length / 5 / (grid.points.length / 10000) ** .8) : manorsInput.valueAsNumber;
|
||||
const burgsNumber = Math.min(desiredNumber, sorted.length); // towns to generate
|
||||
let burgsAdded = 0;
|
||||
|
||||
|
|
@ -172,8 +169,6 @@
|
|||
if (i%2) b.x = rn(b.x + shift, 2); else b.x = rn(b.x - shift, 2);
|
||||
if (cells.r[i]%2) b.y = rn(b.y + shift, 2); else b.y = rn(b.y - shift, 2);
|
||||
}
|
||||
|
||||
defineFeatures(b);
|
||||
}
|
||||
|
||||
// de-assign port status if it's the only one on feature
|
||||
|
|
@ -188,13 +183,17 @@
|
|||
console.timeEnd("specifyBurgs");
|
||||
}
|
||||
|
||||
const defineFeatures = function(b) {
|
||||
const pop = b.population;
|
||||
b.citadel = pop > 50 && Math.random() < .75 || Math.random() < .5 ? 1 : 0;
|
||||
b.plaza = pop > 50 || pop > 30 && Math.random() < .75 || pop > 10 && Math.random() < .5 || Math.random() < .25 ? 1 : 0;
|
||||
b.walls = b.capital || pop > 30 || pop > 20 && Math.random() < .75 || pop > 10 && Math.random() < .5 || Math.random() < .2 ? 1 : 0;
|
||||
b.shanty = pop > 30 || pop > 20 && Math.random() < .75 || b.walls && Math.random() < .75 ? 1 : 0;
|
||||
b.temple = pop > 100 || pop > 80 && Math.random() < .75 || pop > 50 && Math.random() < .5 ? 1 : 0;
|
||||
const defineBurgFeatures = function() {
|
||||
pack.burgs.filter(b => b.i && !b.removed).forEach(b => {
|
||||
const pop = b.population;
|
||||
b.citadel = b.capital || pop > 50 && Math.random() < .75 || Math.random() < .5 ? 1 : 0;
|
||||
b.plaza = pop > 50 || pop > 30 && Math.random() < .75 || pop > 10 && Math.random() < .5 || Math.random() < .25 ? 1 : 0;
|
||||
b.walls = b.capital || pop > 30 || pop > 20 && Math.random() < .75 || pop > 10 && Math.random() < .5 || Math.random() < .2 ? 1 : 0;
|
||||
b.shanty = pop > 30 || pop > 20 && Math.random() < .75 || b.walls && Math.random() < .75 ? 1 : 0;
|
||||
const religion = pack.cells.religion[b.cell];
|
||||
const theocracy = pack.states[b.state].form === "Theocracy";
|
||||
b.temple = religion && theocracy || pop > 50 || pop > 35 && Math.random() < .75 || pop > 20 && Math.random() < .5 ? 1 : 0;
|
||||
});
|
||||
}
|
||||
|
||||
const drawBurgs = function() {
|
||||
|
|
@ -208,7 +207,7 @@
|
|||
// capitals
|
||||
const capitals = pack.burgs.filter(b => b.capital);
|
||||
const capitalIcons = burgIcons.select("#cities");
|
||||
const capitalLabels = burgLabels.select("#cities");
|
||||
const capitalLabels = burgLabels.select("#cities");
|
||||
const capitalSize = capitalIcons.attr("size") || 1;
|
||||
const capitalAnchors = anchors.selectAll("#cities");
|
||||
const caSize = capitalAnchors.attr("size") || 2;
|
||||
|
|
@ -274,7 +273,7 @@
|
|||
if (cells.state[e] && e === states[cells.state[e]].center) return; // do not overwrite capital cells
|
||||
|
||||
const cultureCost = states[s].culture === cells.culture[e] ? -9 : 700;
|
||||
const biomeCost = getBiomeCost(cells.road[e], b, cells.biome[e], type);
|
||||
const biomeCost = getBiomeCost(b, cells.biome[e], type);
|
||||
const heightCost = getHeightCost(pack.features[cells.f[e]], cells.h[e], type);
|
||||
const riverCost = getRiverCost(cells.r[e], e, type);
|
||||
const typeCost = getTypeCost(cells.t[e], type);
|
||||
|
|
@ -286,18 +285,13 @@
|
|||
if (cells.h[e] >= 20) cells.state[e] = s; // assign state to cell
|
||||
cost[e] = totalCost;
|
||||
queue.queue({e, p:totalCost, s, b});
|
||||
//const points = [cells.p[n][0], cells.p[n][1], (cells.p[n][0]+cells.p[e][0])/2, (cells.p[n][1]+cells.p[e][1])/2, cells.p[e][0], cells.p[e][1]];
|
||||
//debug.append("text").attr("x", (cells.p[n][0]+cells.p[e][0])/2 - 1).attr("y", (cells.p[n][1]+cells.p[e][1])/2 - 1).text(rn(totalCost-p)).attr("font-size", .8);
|
||||
//debug.append("polyline").attr("points", points).attr("marker-mid", "url(#arrow)").attr("opacity", .6);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//debug.selectAll(".text").data(cost).enter().append("text").attr("x", (d, e) => cells.p[e][0]-1).attr("y", (d, e) => cells.p[e][1]-1).text(d => d ? rn(d) : "").attr("font-size", 2);
|
||||
burgs.filter(b => b.i && !b.removed).forEach(b => b.state = cells.state[b.cell]); // assign state to burgs
|
||||
|
||||
function getBiomeCost(r, b, biome, type) {
|
||||
if (r > 5) return 0; // no penalty if there is a road;
|
||||
function getBiomeCost(b, biome, type) {
|
||||
if (b === biome) return 10; // tiny penalty for native biome
|
||||
if (type === "Hunting") return biomesData.cost[biome] * 2; // non-native biome penalty for hunters
|
||||
if (type === "Nomadic" && biome > 4 && biome < 10) return biomesData.cost[biome] * 3; // forest biome penalty for nomads
|
||||
|
|
@ -322,10 +316,10 @@
|
|||
return Math.min(Math.max(cells.fl[i] / 10, 20), 100) // river penalty from 20 to 100 based on flux
|
||||
}
|
||||
|
||||
function getTypeCost(ctype, type) {
|
||||
if (ctype === 1) return type === "Naval" || type === "Lake" ? 0 : type === "Nomadic" ? 60 : 20; // penalty for coastline
|
||||
if (ctype === 2) return type === "Naval" || type === "Nomadic" ? 30 : 0; // low penalty for land level 2 for Navals and nomads
|
||||
if (ctype !== -1) return type === "Naval" || type === "Lake" ? 100 : 0; // penalty for mainland for navals
|
||||
function getTypeCost(t, type) {
|
||||
if (t === 1) return type === "Naval" || type === "Lake" ? 0 : type === "Nomadic" ? 60 : 20; // penalty for coastline
|
||||
if (t === 2) return type === "Naval" || type === "Nomadic" ? 30 : 0; // low penalty for land level 2 for Navals and nomads
|
||||
if (t !== -1) return type === "Naval" || type === "Lake" ? 100 : 0; // penalty for mainland for navals
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -449,6 +443,7 @@
|
|||
if (!displayed) toggleLabels();
|
||||
|
||||
if (!list) {
|
||||
// remove all labels and textpaths
|
||||
g.selectAll("text").remove();
|
||||
t.selectAll("path[id*='stateLabel']").remove();
|
||||
}
|
||||
|
|
@ -740,8 +735,8 @@
|
|||
const states = pack.states.filter(s => s.i && !s.removed);
|
||||
if (states.length < 1) return;
|
||||
|
||||
const generic = {Monarchy:25, Republic:2, Union:1, Theocracy:2};
|
||||
const naval = {Monarchy:25, Republic:8, Union:3, Theocracy:1};
|
||||
const generic = {Monarchy:25, Republic:2, Union:1};
|
||||
const naval = {Monarchy:25, Republic:8, Union:3};
|
||||
const genericArray = [], navalArray = []; // turn weighted array into simple array
|
||||
for (const t in generic) {for (let j=0; j < generic[t]; j++) {genericArray.push(t);}}
|
||||
for (const t in naval) {for (let j=0; j < naval[t]; j++) {navalArray.push(t);}}
|
||||
|
|
@ -760,7 +755,9 @@
|
|||
|
||||
for (const s of states) {
|
||||
if (list && !list.includes(s.i)) continue;
|
||||
s.form = s.type === "Naval" ? ra(navalArray) : ra(genericArray);
|
||||
const religion = pack.cells.religion[s.center];
|
||||
const theocracy = religion && pack.religions[religion].expansion === "state" || (Math.random() < .1 && pack.religions[religion].type === "Organized");
|
||||
s.form = theocracy ? "Theocracy" : s.type === "Naval" ? ra(navalArray) : ra(genericArray);
|
||||
s.formName = selectForm(s);
|
||||
s.fullName = getFullName(s);
|
||||
}
|
||||
|
|
@ -780,6 +777,7 @@
|
|||
if (base === 16 && (form === "Empire" || form === "Kingdom")) return "Sultanate"; // Turkic
|
||||
if (base === 5 && (form === "Empire" || form === "Kingdom")) return "Tsardom"; // Ruthenian
|
||||
if (base === 31 && (form === "Empire" || form === "Kingdom")) return "Khaganate"; // Mongolian
|
||||
if (base === 12 && (form === "Kingdom" || form === "Grand Duchy")) return "Shogunate"; // Japanese
|
||||
if ([18, 17].includes(base) && form === "Empire") return "Caliphate"; // Arabic, Berber
|
||||
if (base === 18 && (form === "Grand Duchy" || form === "Duchy")) return "Emirate"; // Arabic
|
||||
if (base === 7 && (form === "Grand Duchy" || form === "Duchy")) return "Despotate"; // Greek
|
||||
|
|
@ -804,7 +802,7 @@
|
|||
if (s.form === "Union") return rw(union);
|
||||
|
||||
if (s.form === "Theocracy") {
|
||||
// Default name is "Theocracy", some culture bases have special names
|
||||
// default name is "Theocracy", some culture bases have special names
|
||||
if ([0, 1, 2, 3, 4, 6, 8, 9, 13, 15, 20].includes(base)) return "Diocese"; // Euporean
|
||||
if ([7, 5].includes(base)) return "Eparchy"; // Greek, Ruthenian
|
||||
if ([21, 16].includes(base)) return "Imamah"; // Nigerian, Turkish
|
||||
|
|
@ -820,7 +818,7 @@
|
|||
if (!s.formName) return s.name;
|
||||
if (!s.name && s.formName) return "The " + s.formName;
|
||||
// state forms requiring Adjective + Name, all other forms use scheme Form + Of + Name
|
||||
const adj = ["Empire", "Sultanate", "Khaganate", "Caliphate", "Despotate", "Theocracy", "Oligarchy", "Union", "Confederation", "Trade Company", "League", "Tetrarchy", "Triumvirate", "Diarchy", "Horde"];
|
||||
const adj = ["Empire", "Sultanate", "Khaganate", "Shogunate", "Caliphate", "Despotate", "Theocracy", "Oligarchy", "Union", "Confederation", "Trade Company", "League", "Tetrarchy", "Triumvirate", "Diarchy", "Horde"];
|
||||
return adj.includes(s.formName) ? getAdjective(s.name) + " " + s.formName : s.formName + " of " + s.name;
|
||||
}
|
||||
|
||||
|
|
@ -910,7 +908,6 @@
|
|||
const max = d3.max(competitors);
|
||||
if (buddies >= max) continue;
|
||||
cells.province[i] = adversaries[competitors.indexOf(max)];
|
||||
//debug.append("circle").attr("cx", cells.p[i][0]).attr("cy", cells.p[i][1]).attr("r", .5);
|
||||
}
|
||||
|
||||
// add "wild" provinces if some cells don't have a province assigned
|
||||
|
|
@ -925,7 +922,6 @@
|
|||
const center = burgCell ? burgCell : stateNoProvince[0];
|
||||
const burg = burgCell ? cells.burg[burgCell] : 0;
|
||||
cells.province[center] = province;
|
||||
//debug.append("circle").attr("cx", cells.p[center][0]).attr("cy", cells.p[center][1]).attr("r", .3).attr("fill", "blue");
|
||||
|
||||
// expand province
|
||||
const cost = []; cost[center] = 1;
|
||||
|
|
@ -933,9 +929,6 @@
|
|||
while (queue.length) {
|
||||
const next = queue.dequeue(), n = next.e, p = next.p;
|
||||
|
||||
// debug.append("circle").attr("cx", cells.p[n][0]).attr("cy", cells.p[n][1]).attr("r", .5);
|
||||
// debug.append("text").attr("x", cells.p[n][0]).attr("y", cells.p[n][1]).text(p).attr("font-size", 2).attr("fill", "white");
|
||||
|
||||
cells.c[n].forEach(function(e) {
|
||||
if (cells.province[e]) return;
|
||||
const land = cells.h[e] >= 20;
|
||||
|
|
@ -991,7 +984,7 @@
|
|||
}
|
||||
|
||||
return {generate, expandStates, normalizeStates, assignColors,
|
||||
drawBurgs, specifyBurgs, defineFeatures, drawStateLabels, collectStatistics,
|
||||
drawBurgs, specifyBurgs, defineBurgFeatures, drawStateLabels, collectStatistics,
|
||||
generateDiplomacy, defineStateForms, getFullName, generateProvinces};
|
||||
|
||||
})));
|
||||
|
|
|
|||
|
|
@ -166,104 +166,108 @@
|
|||
];
|
||||
}
|
||||
|
||||
if (culturesSet.value === "antique") {
|
||||
return [
|
||||
{name:"Roman", base:8, odd: 1},
|
||||
{name:"Roman", base:8, odd: 1},
|
||||
{name:"Roman", base:8, odd: 1},
|
||||
{name:"Roman", base:8, odd: 1},
|
||||
{name:"Hellenic", base:7, odd: 1}, // Greek
|
||||
{name:"Hellenic", base:7, odd: 1}, // Greek
|
||||
{name:"Macedonian", base:7, odd: .5}, // Greek
|
||||
{name:"Celtic", base:22, odd: 1},
|
||||
{name:"Germanic", base:0, odd: 1},
|
||||
{name:"Persian", base:24, odd: .8}, // Iranian
|
||||
{name:"Scythian", base:24, odd: .5}, // Iranian
|
||||
{name:"Cantabrian", base: 20, odd: .5}, // Basque
|
||||
{name:"Estian", base: 9, odd: .2}, // Finnic
|
||||
{name:"Carthaginian", base: 17, odd: .3}, // Berber (the closest we have)
|
||||
{name:"Mesopotamian", base: 23, odd: .2} // Mesopotamian
|
||||
];
|
||||
}
|
||||
|
||||
if (culturesSet.value === "highFantasy") {
|
||||
return [
|
||||
{name:ra(["Umbar","Vanya","Wroda","Cronmi","Etarn","Fauln","Gondin","Hernami","Ithinda","Jaundal"]), base:32, odd: 1},
|
||||
{name:ra(["Mithlun","Deru","Baen","Nimic","Amdar","Nevaer","Pendra","Morid","Enad","Tullid"]), base:32, odd: .8},
|
||||
{name:ra(["Kelim","Lemra","Ondan","Quixot","Ranoy","Hondan","Talmun","Arba","Gruni","Tacha"]), base:32, odd: .5},
|
||||
{name:Names.getBaseShort(32), base:32, odd: .2},
|
||||
// Human African cultures (Swahili, Nigerian)
|
||||
{name:ra(["Unbu","Fala","Yabir","Nadi","Turu","Nubir","Bertu","Swada","Guon","Duir"]), base:ra([28,21]), odd: .5},
|
||||
{name:ra(["Misaad","Tiga","Yana","Julo","Tanu","Danga","Ezaza","Yud","Oroba","Zula"]), base:ra([28,21]), odd: .3},
|
||||
{name:Names.getBaseShort(28), base:28, odd: .1},
|
||||
// Human oriental cultures (Chinese, Korean, Japanese)
|
||||
{name:ra(["Quian","Nihan", "Akai","Huin","Jandai","Kuita","Feng","Sang","Yuhong","Zhonyu"]), base:ra([11,10,12]), odd: .5},
|
||||
{name:ra(["Jumun", "Usei","Rinu","Yataro","Jaelin","Sasung","Oyo","Yaun","Lamlei","Ochato"]), base:ra([11,10,12]), odd: .3},
|
||||
{name:Names.getBaseShort(11), base:11, odd: .1},
|
||||
// Human nomadic cultures (Berber, Arabic, Turkish, Mongolian)
|
||||
{name:ra(["Yird","Zaja","Omuk","Daziji","Harad", "Burja","Khosat","Ongal","Jingan", "Bagharin"]), base:ra([17,18,16,31]), odd: .5},
|
||||
{name:ra(["Dal", "Qeduin","Damar","Yeduin","Buzakh","Argol","Monthar","Suul", "Azurid","Oran"]), base:ra([17,18,16,31]), odd: .3},
|
||||
{name:Names.getBaseShort(31), base:31, odd: .1},
|
||||
// Elven cultures (Elven, Dark Elven)
|
||||
{name:ra(["Lossal","Aeval","Alar","Taltari","Elavar","Selane","Lahsa","Vendilae","Endaree","Altawe","Aldar"]), base:33, odd: .9},
|
||||
{name:ra(["Dokkal","Drauga","Ulsin","Undril","Eldazan","Velas","Waendir","Cindil","Dhantyr","Uldar"]), base:34, odd: .9},
|
||||
{name:Names.getBaseShort(33), base:33, odd: .1},
|
||||
{name:Names.getBaseShort(34), base:34, odd: .1},
|
||||
// Dwarven cultures
|
||||
{name:ra(["Garadur","Kalemund","Khazram","Norgath","Zardum","Ulthar","Tumunz","Shatharn","Nuldalar","Azkadun"]), base:35, odd: 1},
|
||||
{name:Names.getBaseShort(35), base:35, odd: .1},
|
||||
// Orcic cultures
|
||||
{name:ra(["Oruk","Ulg","Quigg","Rughar","Rikagh","Brundh","Kaldag","Umogg","Verug","Rekh"]), base:37, odd: .8},
|
||||
{name:Names.getBaseShort(37), base:37, odd: .1},
|
||||
// Goblin cultures
|
||||
{name:ra(["Grubi","Gobbun","Bogog","Katong","Ziggag","Nildac","Blygg","Yagnob","Dulb","Gibog"]), base:36, odd: .7},
|
||||
{name:Names.getBaseShort(36), base:36, odd: .1},
|
||||
// Draconic cultures
|
||||
{name:ra(["Drache","Alduun","Tiranax","Firosos","Daavor","Sakaal","Oruniin","Rigaal","Diiru","Velrit"]), base:39, odd: .3},
|
||||
{name:Names.getBaseShort(39), base:39, odd: .05},
|
||||
// Arachnid cultures
|
||||
{name:ra(["Aranee","Yoraz","Zhizu","On'Omi","Xantha","Qalan","Yeqir","Zheer","Shirrox","Khra'La"]), base:40, odd: .2},
|
||||
{name:Names.getBaseShort(40), base:40, odd: .05},
|
||||
// Serpents (snakes) cultures
|
||||
{name:ra(["Najar","Saj","Vultess","Solkush","Vekis","Zeriss","Ci'Kush","Kophyss","Sal'Har","Surresh"]), base:41, odd: .2},
|
||||
{name:Names.getBaseShort(41), base:41, odd: .05},
|
||||
// Giants cultures
|
||||
{name:ra(["Gorth","Volkar","Barak","Suvrok","Dughal","Ranag","Undur","Kakarn","Dalken","Grimgar"]), base:38, odd: .2},
|
||||
{name:Names.getBaseShort(38), base:38, odd: .05}
|
||||
// fantasy races
|
||||
{name:"Quenian", base: 33, odd: 1}, // Elves
|
||||
{name:"Eldar", base: 33, odd: 1}, // Elves
|
||||
{name:"Lorian", base: 33, odd: .5}, // Elves
|
||||
{name:"Trow", base: 34, odd: .9}, // Dark Elves
|
||||
{name:"Dokalfar", base: 34, odd: .3}, // Dark Elves
|
||||
{name:"Durinn", base: 35, odd: 1}, // Dwarven
|
||||
{name:"Khazadur", base: 35, odd: 1}, // Dwarven
|
||||
{name:"Kobblin", base: 36, odd: 1}, // Goblin
|
||||
{name:"Uruk", base: 37, odd: 1}, // Orc
|
||||
{name:"Ugluk", base: 37, odd: .7}, // Orc
|
||||
{name:"Yotunn", base: 38, odd: .9}, // Giant
|
||||
{name:"Drake", base: 39, odd: .7}, // Draconic
|
||||
{name:"Rakhnid", base: 40, odd: .9}, // Arachnid
|
||||
{name:"Aj'Snaga", base: 41, odd: .9}, // Serpents
|
||||
// common fantasy human
|
||||
{name:"Gozdor", base:32, odd: 1},
|
||||
{name:"Anor", base:32, odd: 1},
|
||||
{name:"Dail", base:32, odd: 1},
|
||||
{name:"Duland", base:32, odd: 1},
|
||||
{name:"Rohand", base:32, odd: 1},
|
||||
// rare real-world western
|
||||
{name:"Norse", base:6, odd: .5},
|
||||
{name:"Izenlute", base:0, odd: .1},
|
||||
{name:"Lurian", base:2, odd: .1},
|
||||
{name:"Getalian", base:3, odd: .1},
|
||||
{name:"Astelan", base:4, odd: .05},
|
||||
// rare real-world exotic
|
||||
{name:"Yoruba", base:21, odd: .05},
|
||||
{name:"Ryoko", base:10, odd: .05},
|
||||
{name:"Toyamo", base:12, odd: .05},
|
||||
{name:"Guan-Tsu", base:30, odd: .05},
|
||||
{name:"Ulus-Khan", base:31, odd: .05},
|
||||
{name:"Turan", base: 16, odd: .05},
|
||||
{name:"Al'Uma", base: 18, odd: .05},
|
||||
{name:"Druidas", base: 22, odd: .05},
|
||||
{name:"Gorodian", base:5, odd: .05}
|
||||
];
|
||||
}
|
||||
|
||||
if (culturesSet.value === "darkFantasy") {
|
||||
const west = ra([0,1,2,3,4,6]); // real-world western
|
||||
const east = ra([10,11,12,26,29,30]); // real-world oriental
|
||||
const randReal = rand(31); // reql-world random
|
||||
const randFantasy = rand(35, 39); // fantasy random (except frequently used)
|
||||
|
||||
return [
|
||||
{name:ra(["Gluum","Dregg","Crimna","Grimmer","Plagan","Gretan","Maeldar","Peyon","Waeri","Creven"]), base:32, odd: 1},
|
||||
{name:Names.getBaseShort(32), base:32, odd: .4},
|
||||
{name:Names.getBaseShort(west), base:west, odd: .4},
|
||||
{name:Names.getBaseShort(west), base:west, odd: 4},
|
||||
{name:Names.getBaseShort(west), base:west, odd: .4},
|
||||
{name:Names.getBaseShort(east), base:east, odd: .4},
|
||||
{name:Names.getBaseShort(randReal), base:randReal, odd: .4},
|
||||
{name:Names.getBaseShort(randReal), base:randReal, odd: .4},
|
||||
{name:Names.getBaseShort(randFantasy), base:randFantasy, odd: .4},
|
||||
{name:ra(["Drauer","Svartal","Ulsin","Druchan","Eldazar","Velaz","Waendir","Cryndil","Vhantyr","Uldaga"]), base: 34, odd: .8},
|
||||
{name:Names.getBaseShort(34), base:34, odd: .2},
|
||||
{name:ra(["Necrin","Yoraz","Zhizu","On'Omi","Xantha","Qalan","Yeqir","Zheer","Shirrox","Khra'La"]), base:40, odd: .6},
|
||||
{name:Names.getBaseShort(40), base:40, odd: .1},
|
||||
{name:ra(["Najaq","Saja","Zultesh","Solkuss","Sekrys","Verish","Ji'Suu","Kophress","Sul'Vhas","Surraj"]), base:41, odd: .6},
|
||||
{name:Names.getBaseShort(41), base:41, odd: .1}
|
||||
]
|
||||
}
|
||||
|
||||
if (culturesSet.value === "lowFantasy") {
|
||||
return [
|
||||
// real-world cultures
|
||||
{name:ra(["Misaad","Tiga","Yana","Julo","Tanu","Danga","Ezaza","Yud","Oroba","Zula"]), base:ra([28,21]), odd: .7},
|
||||
{name:ra(["Unbu","Fala","Yabir","Nadi","Turu","Nubir","Bertu","Swada","Guon","Duir"]), base:ra([28,21]), odd: .4},
|
||||
{name:ra(["Jumun", "Usei","Rinu","Yataro","Jaelin","Sasung","Oyo","Yaun","Lamlei","Ochato"]), base:ra([11,10,12]), odd: .7},
|
||||
{name:ra(["Quian","Nihan", "Akai","Huin","Jandai","Kuita","Feng","Sang","Yuhong","Zhonyu"]), base:ra([11,10,12]), odd: .4},
|
||||
{name:ra(["Dal", "Qeduin","Damar","Yeduin","Buzakh","Argol","Monthar","Suul", "Azurid","Oran"]), base:ra([18,16,31]), odd: .7},
|
||||
{name:ra(["Yird","Zaja","Omuk","Daziji","Harad", "Burja","Khosat","Ongal","Jingan", "Bagharin"]), base:ra([18,16,31]), odd: .4},
|
||||
{name:ra(["Muerid","Atau","Olvid","Carani","Incora","Fastama","Tusange","Captiur","Tristei","Duila"]), base:ra([2,3,4]), odd: .6},
|
||||
{name:ra(["Vergen","Todir","Angest","Duncein","Mordane","Ungeran","Slaktan","Pijini","Joldamor","Kelfang"]), base:ra([0,6]), odd: .5},
|
||||
{name:ra(["Vaer","Hayal","Fajalan","Banta","Feled","Unohda","Kuolemi","Hatamur","Inhortu","Rienau"]), base:ra([9,15]),odd: .5},
|
||||
{name:ra(["Semerta","Rezyn","Stragh","Otchza","Rabini","Yamak","Nocht","Erstoz","Vozha","Vukod"]), base:5, odd: .6},
|
||||
{name:ra(["Itzil","Itoza","Beldur","Minaz","Etsipian","Gurean","Morrai","Hiloga","Gurrusi","Beldurn"]), base:20, odd: .2},
|
||||
{name:ra(["Kongji","Qishin","Moushi","Wuhui","Zhaozei","Tushada","Shai","Xingzhi","Jukong","Tiantao"]), base:ra([30, 11]), odd: .5},
|
||||
// human cultures
|
||||
{name:ra(["Mithlun","Deru","Baen","Nimic","Amdar","Nevaer","Pendra"]), base:32, odd: 1},
|
||||
{name:ra(["Morid","Enad","Tullid","Kelim","Lemra","Ondan","Fargunia"]), base:32, odd: 1},
|
||||
{name:ra(["Quixot","Ranoy","Hondan","Talmun","Arba","Gruni","Tacha"]), base:32, odd: 1},
|
||||
{name:ra(["Gluum","Dregg","Crimna","Grimmer","Plagan","Gretan","Jaundal"]), base:32, odd: .5},
|
||||
{name:ra(["Cronmi","Etarn","Fauln","Gondin","Hernami","Ithinda"]), base:32, odd: .5},
|
||||
{name:ra(["Peyon","Waeri","Creven","Umbar","Vanya","Wroda","Maeldar"]), base:32, odd: .5},
|
||||
// non-human cultures
|
||||
{name:ra(["Lossal","Aeval","Alar","Taltari","Elavar","Selane","Lahsa","Vendilae","Endaree","Altawe","Aldar"]), base:33, odd: .2},
|
||||
{name:ra(["Garadur","Kalemund","Khazram","Norgath","Zardum","Ulthar","Tumunz","Shatharn","Nuldalar","Azkadun"]), base:35, odd: .2},
|
||||
{name:ra(["Gorth","Volkar","Barak","Suvrok","Dughal","Ranag","Undur","Kakarn","Dalken","Grimgar"]), base:38, odd: .2}
|
||||
// common real-world English
|
||||
{name:"Angshire", base:1, odd: 1},
|
||||
{name:"Enlandic", base:1, odd: 1},
|
||||
{name:"Westen", base:1, odd: 1},
|
||||
{name:"Nortumbic", base:1, odd: 1},
|
||||
{name:"Mercian", base:1, odd: 1},
|
||||
{name:"Kentian", base:1, odd: 1},
|
||||
// rare real-world western
|
||||
{name:"Norse", base:6, odd: .7},
|
||||
{name:"Schwarzen", base:0, odd: .3},
|
||||
{name:"Luarian", base:2, odd: .3},
|
||||
{name:"Hetallian", base:3, odd: .3},
|
||||
{name:"Astellian", base:4, odd: .3},
|
||||
// rare real-world exotic
|
||||
{name:"Kiswaili", base:28, odd: .05},
|
||||
{name:"Yoruba", base:21, odd: .05},
|
||||
{name:"Koryo", base:10, odd: .05},
|
||||
{name:"Hantzu", base:11, odd: .05},
|
||||
{name:"Yamoto", base:12, odd: .05},
|
||||
{name:"Guantzu", base:30, odd: .05},
|
||||
{name:"Ulus", base:31, odd: .05},
|
||||
{name:"Turan", base: 16, odd: .05},
|
||||
{name:"Berberan", base: 17, odd: .05},
|
||||
{name:"Eurabic", base: 18, odd: .05},
|
||||
{name:"Slovan", base:5, odd: .05},
|
||||
{name:"Keltan", base: 22, odd: .1},
|
||||
{name:"Elladan", base:7, odd: .2},
|
||||
{name:"Romian", base:8, odd: .2},
|
||||
// fantasy races
|
||||
{name:"Eldar", base: 33, odd: .5}, // Elves
|
||||
{name:"Trow", base: 34, odd: .8}, // Dark Elves
|
||||
{name:"Durinn", base: 35, odd: .8}, // Dwarven
|
||||
{name:"Kobblin", base: 36, odd: .8}, // Goblin
|
||||
{name:"Uruk", base: 37, odd: .8}, // Orc
|
||||
{name:"Yotunn", base: 38, odd: .8}, // Giant
|
||||
{name:"Drake", base: 39, odd: .9}, // Draconic
|
||||
{name:"Rakhnid", base: 40, odd: .9}, // Arachnid
|
||||
{name:"Aj'Snaga", base: 41, odd: .9}, // Serpents
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -297,7 +301,7 @@
|
|||
{name:"Eurabic", base: 18, odd: .2},
|
||||
{name:"Inuk", base: 19, odd: .05},
|
||||
{name:"Euskati", base: 20, odd: .05},
|
||||
{name:"Negarian", base: 21, odd: .05},
|
||||
{name:"Yoruba", base: 21, odd: .05},
|
||||
{name:"Keltan", base: 22, odd: .05},
|
||||
{name:"Efratic", base: 23, odd: .05},
|
||||
{name:"Tehrani", base: 24, odd: .1},
|
||||
|
|
@ -380,13 +384,13 @@
|
|||
return Math.min(Math.max(cells.fl[i] / 10, 20), 100) // river penalty from 20 to 100 based on flux
|
||||
}
|
||||
|
||||
function getTypeCost(ctype, type) {
|
||||
if (ctype === 1) return type === "Naval" || type === "Lake" ? 0 : type === "Nomadic" ? 60 : 20; // penalty for coastline
|
||||
if (ctype === 2) return type === "Naval" || type === "Nomadic" ? 30 : 0; // low penalty for land level 2 for Navals and nomads
|
||||
if (ctype !== -1) return type === "Naval" || type === "Lake" ? 100 : 0; // penalty for mainland for navals
|
||||
function getTypeCost(t, type) {
|
||||
if (t === 1) return type === "Naval" || type === "Lake" ? 0 : type === "Nomadic" ? 60 : 20; // penalty for coastline
|
||||
if (t === 2) return type === "Naval" || type === "Nomadic" ? 30 : 0; // low penalty for land level 2 for Navals and nomads
|
||||
if (t !== -1) return type === "Naval" || type === "Lake" ? 100 : 0; // penalty for mainland for navals
|
||||
return 0;
|
||||
}
|
||||
|
||||
return {generate, expand, getDefault};
|
||||
|
||||
})));
|
||||
})));
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@
|
|||
case 10: return .93;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const addHill = function(count, height, rangeX, rangeY) {
|
||||
count = getNumberInRange(count);
|
||||
const power = getBlobPower();
|
||||
|
|
|
|||
|
|
@ -139,13 +139,16 @@
|
|||
else if (base === 12) return vowel(name.slice(-1)) ? name : name + "u"; // Japanese ends on any vowel or -u
|
||||
else if (base === 18 && Math.random() < .4) name = vowel(name.slice(0,1).toLowerCase()) ? "Al" + name.toLowerCase() : "Al " + name; // Arabic starts with -Al
|
||||
|
||||
// no suffix for fantasy bases
|
||||
if (base > 32 && base < 42) return name;
|
||||
|
||||
// define if suffix should be used
|
||||
if (name.length > 3 && vowel(name.slice(-1))) {
|
||||
if (vowel(name.slice(-2,-1)) && Math.random() < .85) name = name.slice(0,-2); // 85% for vv
|
||||
else if (Math.random() < .7) name = name.slice(0,-1); // ~60% for cv
|
||||
else return name;
|
||||
} else if (Math.random() < .4) return name; // 60% for cc and vc
|
||||
|
||||
|
||||
// define suffix
|
||||
let suffix = "ia"; // standard suffix
|
||||
|
||||
|
|
@ -157,13 +160,14 @@
|
|||
else if (base === 0 && rnd < .5 && l < 7) suffix = "land"; // German
|
||||
else if (base === 1 && rnd < .4 && l < 7 ) suffix = "land"; // English
|
||||
else if (base === 6 && rnd < .3 && l < 7) suffix = "land"; // Nordic
|
||||
else if (base === 32 && rnd < .1 && l < 7) suffix = "land"; // generic Human
|
||||
else if (base === 7 && rnd < .1) suffix = "eia"; // Greek
|
||||
else if (base === 9 && rnd < .35) suffix = "maa"; // Finnic
|
||||
else if (base === 15 && rnd < .6 && l < 6) suffix = "orszag"; // Hungarian
|
||||
else if (base === 16) suffix = rnd < .5 ? "stan" : "ya"; // Turkish
|
||||
else if (base === 15 && rnd < .4 && l < 6) suffix = "orszag"; // Hungarian
|
||||
else if (base === 16) suffix = rnd < .6 ? "stan" : "ya"; // Turkish
|
||||
else if (base === 10) suffix = "guk"; // Korean
|
||||
else if (base === 11) suffix = " Guo"; // Chinese
|
||||
else if (base === 14) suffix = rnd < .6 && l < 6 ? "tlan" : "co"; // Nahuatl
|
||||
else if (base === 14) suffix = rnd < .5 && l < 6 ? "tlan" : "co"; // Nahuatl
|
||||
else if (base === 17 && rnd < .8) suffix = "a"; // Berber
|
||||
else if (base === 18 && rnd < .8) suffix = "a"; // Arabic
|
||||
|
||||
|
|
@ -236,7 +240,7 @@
|
|||
{name: "Cantonese", i: 30, min: 5, max: 11, d: "", m: 0, b: "Chaiwan,Chekham,Cheungshawan,Chingchung,Chinghoi,Chingsen,Chingshing,Chiunam,Chiuon,Chiuyeung,Chiyuen,Choihung,Chuehoi,Chuiman,Chungfa,Chungfu,Chungsan,Chunguktsuen,Dakhing,Daopo,Daumun,Dingwu,Dinpak,Donggun,Dongyuen,Duenchau,Fachau,Fado,Fanling,Fatgong,Fatshan,Fotan,Fuktien,Fumun,Funggong,Funghoi,Fungshun,Fungtei,Gamtin,Gochau,Goming,Gonghoi,Gongshing,Goyiu,Hanghau,Hangmei,Hashan,Hengfachuen,Hengon,Heungchau,Heunggong,Heungkiu,Hingning,Hohfuktong,Hoichue,Hoifung,Hoiping,Hokong,Hokshan,Homantin,Hotin,Hoyuen,Hunghom,Hungshuikiu,Jiuling,Kamping,Kamsheung,Kamwan,Kaulongtong,Keilun,Kinon,Kinsang,Kityeung,Kongmun,Kukgong,Kwaifong,Kwaihing,Kwongchau,Kwongling,Kwongming,Kwuntong,Laichikok,Laiking,Laiwan,Lamtei,Lamtin,Leitung,Leungking,Limkong,Linchau,Linnam,Linping,Linshan,Loding,Lokcheong,Lokfu,Lokmachau,Longchuen,Longgong,Longmun,Longping,Longwa,Longwu,Lowu,Luichau,Lukfung,Lukho,Lungmun,Macheung,Maliushui,Maonshan,Mauming,Maunam,Meifoo,Mingkum,Mogong,Mongkok,Muichau,Muigong,Muiyuen,Naiwai,Namcheong,Namhoi,Namhong,Namo,Namsha,Namshan,Nganwai,Ngchuen,Ngoumun,Ngwa,Nngautaukok,Onting,Pakwun,Paotoishan,Pingshan,Pingyuen,Poklo,Polam,Pongon,Poning,Potau,Puito,Punyue,Saiwanho,Saiyingpun,Samshing,Samshui,Samtsen,Samyuenlei,Sanfung,Sanhing,Sanhui,Sanwai,Sanwui,Seiwui,Shamshuipo,Shanmei,Shantau,Shatin,Shatinwai,Shaukeiwan,Shauking,Shekkipmei,Shekmun,Shekpai,Sheungshui,Shingkui,Shiuhing,Shundak,Shunyi,Shupinwai,Simshing,Siuhei,Siuhong,Siukwan,Siulun,Suikai,Taihing,Taikoo,Taipo,Taishuihang,Taiwai,Taiwo,Taiwohau,Tinhau,Tinho,Tinking,Tinshuiwai,Tiukengleng,Toishan,Tongfong,Tonglowan,Tsakyoochung,Tsamgong,Tsangshing,Tseungkwano,Tsihing,Tsimshatsui,Tsinggong,Tsingshantsuen,Tsingwun,Tsingyi,Tsingyuen,Tsiuchau,Tsuenshekshan,Tsuenwan,Tuenmun,Tungchung,Waichap,Waichau,Waidong,Wailoi,Waishing,Waiyeung,Wanchai,Wanfau,Wanon,Wanshing,Wingon,Wongchukhang,Wongpo,Wongtaisin,Woping,Wukaisha,Yano,Yaumatei,Yauoi,Yautong,Yenfa,Yeungchun,Yeungdong,Yeunggong,Yeungsai,Yeungshan,Yimtin,Yingdak,Yiuping,Yongshing,Yongyuen,Yuenlong,Yuenshing,Yuetsau,Yuknam,Yunping,Yuyuen"},
|
||||
{name: "Mongolian", i: 31, min: 5, max: 12, d: "aou", m: .3, b: "Adaatsag,Airag,Alag Erdene,Altai,Altanshiree,Altantsogts,Arbulag,Baatsagaan,Batnorov,Batshireet,Battsengel,Bayan Adarga,Bayan Agt,Bayanbulag,Bayandalai,Bayandun,Bayangovi,Bayanjargalan,Bayankhongor,Bayankhutag,Bayanlig,Bayanmonkh,Bayannuur,Bayan Ondor,Bayan Ovoo,Bayantal,Bayantsagaan,Bayantumen,Bayan Uul,Bayanzurkh,Berkh,Biger,Binder,Bogd,Bombogor,Bor Ondor,Bugat,Bulgan,Buregkhangai,Burentogtokh,Buutsagaan,Buyant,Chandmani,Chandmani Ondor,Choibalsan,Chuluunkhoroot,Chuluut,Dadal,Dalanjargalan,Dalanzadgad,Darkhan,Darvi,Dashbalbar,Dashinchilen,Delger,Delgerekh,Delgerkhaan,Delgerkhangai,Delgertsogt,Deluun,Deren,Dorgon,Duut,Erdene,Erdenebulgan,Erdeneburen,Erdenedalai,Erdenemandal,Erdenetsogt,Galshar,Galt,Galuut,Govi Ugtaal,Gurvan,Gurvanbulag,Gurvansaikhan,Gurvanzagal,Ikhkhet,Ikh Tamir,Ikh Uul,Jargalan,Jargalant,Jargaltkhaan,Jinst,Khairkhan,Khalhgol,Khaliun,Khanbogd,Khangai,Khangal,Khankh,Khankhongor,Khashaat,Khatanbulag,Khatgal,Kherlen,Khishig Ondor,Khokh,Kholonbuir,Khongor,Khotont,Khovd,Khovsgol,Khuld,Khureemaral,Khurmen,Khutag Ondor,Luus,Mandakh,Mandal Ovoo,Mankhan,Manlai,Matad,Mogod,Monkhkhairkhan,Moron,Most,Myangad,Nogoonnuur,Nomgon,Norovlin,Noyon,Ogii,Olgii,Olziit,Omnodelger,Ondorkhaan,Ondorshil,Ondor Ulaan,Orgon,Orkhon,Rashaant,Renchinlkhumbe,Sagsai,Saikhan,Saikhandulaan,Saikhan Ovoo,Sainshand,Saintsagaan,Selenge,Sergelen,Sevrei,Sharga,Sharyngol,Shine Ider,Shinejinst,Shiveegovi,Sumber,Taishir,Tarialan,Tariat,Teshig,Togrog,Tolbo,Tomorbulag,Tonkhil,Tosontsengel,Tsagaandelger,Tsagaannuur,Tsagaan Ovoo,Tsagaan Uur,Tsakhir,Tseel,Tsengel,Tsenkher,Tsenkhermandal,Tsetseg,Tsetserleg,Tsogt,Tsogt Ovoo,Tsogttsetsii,Tunel,Tuvshruulekh,Ulaanbadrakh,Ulaankhus,Ulaan Uul,Uyench,Yesonbulag,Zag,Zamyn Uud,Zereg"},
|
||||
// fantasy bases by Dopu:
|
||||
{name: "Fantasy", i: 32, min: 6, max: 11, d: "peolst", m: 0, b: "Grimegrove,Cliffshear,Eaglevein,Basinborn,Whalewich,Faypond,Pondshade,Earthfield,Dustwatch,Houndcall,Oakenbell,Wildwell,Direwallow,Springmire,Bayfrost,Fearwich,Ghostdale,Cursespell,Shadowvein,Freygrave,Freyshell,Tradewick,Grasswallow,Kilshell,Flatwall,Mosswind,Edgehaven,Newfalls,Flathand,Lostcairn,Grimeshore,Littleshade,Millstrand,Snowbay,Quickbell,Crystalrock,Snakewharf,Oldwall,Whitvalley,Stagport,Deadkeep,Claymond,Angelhand,Ebonhold,Shimmerrun,Honeywater,Gloomburn,Arrowburgh,Slyvein,Dawnforest,Dirtshield,Southbreak,Clayband,Oakenrun,Graypost,Deepcairn,Lagoonpass,Cavewharf,Thornhelm,Smoothwallow,Lightfront,Irongrave,Stonespell,Cavemeadow,Millbell,Shimmerwell,Eldermere,Roguehaven,Dogmeadow,Pondside,Springview,Embervault,Dryhost,Bouldermouth,Stormhand,Oakenfall,Clearguard,Lightvale,Freyshear,Flameguard,Bellcairn,Bridgeforest,Scorchwich,Mythgulch,Maplesummit,Mosshand,Iceholde,Knightlight,Dawnwater,Laststar,Westpoint,Goldbreach,Falsevale,Pinegarde,Shroudrock,Whitwharf,Autumnband,Oceanstar,Rosedale,Snowtown,Chillstrand,Saltmouth,Crystalsummit,Redband,Thorncairn,Beargarde,Pearlhaven,Lostward,Northpeak,Sandhill,Cliffgate,Sandminster,Cloudcrest,Mythshear,Dragonward,Coldholde,Knighttide,Boulderharbor,Faybarrow,Dawnpass,Pondtown,Timberside,Madfair,Crystalspire,Shademeadow,Dragonbreak,Castlecross,Dogwell,Caveport,Wildlight,Mudfront,Eldermere,Midholde,Ravenwall,Mosstide,Everborn,Lastmere,Dawncall,Autumnkeep,Oldwatch,Shimmerwood,Eldergate,Deerchill,Fallpoint,Silvergulch,Cavemire,Deerbrook,Pinepond,Ravenside,Thornyard,Scorchstall,Swiftwell,Roguereach,Cloudwood,Smoothtown,Kilhill,Ironhollow,Stillhall,Rustmore,Ragefair,Ghostward,Deadford,Smallmire,Barebreak,Westforest,Bonemouth,Evercoast,Sleekgulch,Neverfront,Lostshield,Icelight,Quickgulch,Brinepeak,Hollowstorm,Limeband,Basinmore,Steepmoor,Blackford,Stormtide,Wildyard,Wolfpass,Houndburn,Pondfalls,Pureshell,Silvercairn,Houndwallow,Dewmere,Fearpeak,Bellstall,Diredale,Crowgrove,Moongulf,Kilholde,Sungulf,Baremore,Bleakwatch,Farrun,Grimeshire,Roseborn,Heartford,Scorchpost,Cloudbay,Whitlight,Timberham,Cloudmouth,Curseminster,Basinfrost,Maplevein,Sungarde,Cloudstar,Bellport,Silkwich,Ragehall,Bellreach,Swampmaw,Snakemere,Highbourne,Goldyard,Lakemond,Shadeville,Mightmouth,Nevercrest,Pinemount,Claymouth,Rosereach,Oldreach,Brittlehelm,Heartfall,Bonegulch,Silkhollow,Crystalgulf,Mutewell,Flameside,Blackwatch,Greenwharf,Moonacre,Beachwick,Littleborough,Castlefair,Stoneguard,Nighthall,Cragbury,Swanwall,Littlehall,Mudford,Shadeforest,Mightglen,Millhand,Easthill,Amberglen,Nighthall,Cragbury,Swanwall,Littlehall,Mudford,Shadeforest,Mightglen,Millhand,Easthill,Amberglen,Smoothcliff,Lakecross,Quicklight,Eaglecall,Silentkeep,Dragonshear,Ebonfront,Oakenmeadow,Cliffshield,Stormhorn,Cavefell,Wildedenn,Earthgate,Brittlecall,Swangarde,Steamwallow,Demonfall,Sleethallow,Mossstar,Dragonhold,Smoothgrove,Sleetrun,Flamewell,Mistvault,Heartvault,Newborough,Deeppoint,Littlehold,Westshell,Caveminster,Swiftshade,Grimwood,Littlemire,Bridgefalls,Lastmere,Fayyard,Madham,Curseguard,Earthpass,Silkbrook,Winterview,Grimeborough,Dustcross,Dogcoast,Dirtstall,Oxlight,Pondstall,Sleetglen,Ghostpeak,Snowshield,Loststar,Chillwharf,Sleettide,Millgulch,Whiteshore,Sunmond,Moonwell,Grassdrift,Westmeadow,Crowvault,Everchill,Bearmire,Bronzegrasp,Oxbrook,Cursefield,Steammouth,Smoothham,Arrowdenn,Stillstrand,Mudwich"},
|
||||
{name: "Human Generic", i: 32, min: 6, max: 11, d: "peolst", m: 0, b: "Grimegrove,Cliffshear,Eaglevein,Basinborn,Whalewich,Faypond,Pondshade,Earthfield,Dustwatch,Houndcall,Oakenbell,Wildwell,Direwallow,Springmire,Bayfrost,Fearwich,Ghostdale,Cursespell,Shadowvein,Freygrave,Freyshell,Tradewick,Grasswallow,Kilshell,Flatwall,Mosswind,Edgehaven,Newfalls,Flathand,Lostcairn,Grimeshore,Littleshade,Millstrand,Snowbay,Quickbell,Crystalrock,Snakewharf,Oldwall,Whitvalley,Stagport,Deadkeep,Claymond,Angelhand,Ebonhold,Shimmerrun,Honeywater,Gloomburn,Arrowburgh,Slyvein,Dawnforest,Dirtshield,Southbreak,Clayband,Oakenrun,Graypost,Deepcairn,Lagoonpass,Cavewharf,Thornhelm,Smoothwallow,Lightfront,Irongrave,Stonespell,Cavemeadow,Millbell,Shimmerwell,Eldermere,Roguehaven,Dogmeadow,Pondside,Springview,Embervault,Dryhost,Bouldermouth,Stormhand,Oakenfall,Clearguard,Lightvale,Freyshear,Flameguard,Bellcairn,Bridgeforest,Scorchwich,Mythgulch,Maplesummit,Mosshand,Iceholde,Knightlight,Dawnwater,Laststar,Westpoint,Goldbreach,Falsevale,Pinegarde,Shroudrock,Whitwharf,Autumnband,Oceanstar,Rosedale,Snowtown,Chillstrand,Saltmouth,Crystalsummit,Redband,Thorncairn,Beargarde,Pearlhaven,Lostward,Northpeak,Sandhill,Cliffgate,Sandminster,Cloudcrest,Mythshear,Dragonward,Coldholde,Knighttide,Boulderharbor,Faybarrow,Dawnpass,Pondtown,Timberside,Madfair,Crystalspire,Shademeadow,Dragonbreak,Castlecross,Dogwell,Caveport,Wildlight,Mudfront,Eldermere,Midholde,Ravenwall,Mosstide,Everborn,Lastmere,Dawncall,Autumnkeep,Oldwatch,Shimmerwood,Eldergate,Deerchill,Fallpoint,Silvergulch,Cavemire,Deerbrook,Pinepond,Ravenside,Thornyard,Scorchstall,Swiftwell,Roguereach,Cloudwood,Smoothtown,Kilhill,Ironhollow,Stillhall,Rustmore,Ragefair,Ghostward,Deadford,Smallmire,Barebreak,Westforest,Bonemouth,Evercoast,Sleekgulch,Neverfront,Lostshield,Icelight,Quickgulch,Brinepeak,Hollowstorm,Limeband,Basinmore,Steepmoor,Blackford,Stormtide,Wildyard,Wolfpass,Houndburn,Pondfalls,Pureshell,Silvercairn,Houndwallow,Dewmere,Fearpeak,Bellstall,Diredale,Crowgrove,Moongulf,Kilholde,Sungulf,Baremore,Bleakwatch,Farrun,Grimeshire,Roseborn,Heartford,Scorchpost,Cloudbay,Whitlight,Timberham,Cloudmouth,Curseminster,Basinfrost,Maplevein,Sungarde,Cloudstar,Bellport,Silkwich,Ragehall,Bellreach,Swampmaw,Snakemere,Highbourne,Goldyard,Lakemond,Shadeville,Mightmouth,Nevercrest,Pinemount,Claymouth,Rosereach,Oldreach,Brittlehelm,Heartfall,Bonegulch,Silkhollow,Crystalgulf,Mutewell,Flameside,Blackwatch,Greenwharf,Moonacre,Beachwick,Littleborough,Castlefair,Stoneguard,Nighthall,Cragbury,Swanwall,Littlehall,Mudford,Shadeforest,Mightglen,Millhand,Easthill,Amberglen,Nighthall,Cragbury,Swanwall,Littlehall,Mudford,Shadeforest,Mightglen,Millhand,Easthill,Amberglen,Smoothcliff,Lakecross,Quicklight,Eaglecall,Silentkeep,Dragonshear,Ebonfront,Oakenmeadow,Cliffshield,Stormhorn,Cavefell,Wildedenn,Earthgate,Brittlecall,Swangarde,Steamwallow,Demonfall,Sleethallow,Mossstar,Dragonhold,Smoothgrove,Sleetrun,Flamewell,Mistvault,Heartvault,Newborough,Deeppoint,Littlehold,Westshell,Caveminster,Swiftshade,Grimwood,Littlemire,Bridgefalls,Lastmere,Fayyard,Madham,Curseguard,Earthpass,Silkbrook,Winterview,Grimeborough,Dustcross,Dogcoast,Dirtstall,Oxlight,Pondstall,Sleetglen,Ghostpeak,Snowshield,Loststar,Chillwharf,Sleettide,Millgulch,Whiteshore,Sunmond,Moonwell,Grassdrift,Westmeadow,Crowvault,Everchill,Bearmire,Bronzegrasp,Oxbrook,Cursefield,Steammouth,Smoothham,Arrowdenn,Stillstrand,Mudwich"},
|
||||
{name: "Elven", i: 33, min: 6, max: 12, d: "lenmsrg", m: 0, b: "Adrindest,Aethel,Afranthemar,Aggar,Aiqua,Alari,Allanar,Allanbelle,Almalian,Alora,Alyanasari,Alyelona,Alyran,Amenalenora,Ammar,Amymabelle,Ancalen,AnhAlora,Anore,Anyndell,Arasari,Aren,Ashesari,Ashletheas,Ashmebel,Asrannore,Athelle,Aymlume,Baethei,Bel-Didhel,Belanore,Borethanil,Brinorion,Caelora,Chaggaust,Chaulssad,Chaundra,ChetarIthlin,Cyhmel,Cyla,Cyonore,Cyrangroth,Doladress,Dolarith,Dolasea,Dolonde,Dorthore,Dorwine,Draethe,Dranzan,Draugaust,Dreghei,Drelhei,Dryndlu,E'ana,E'ebel,Eahil,Edhil,Edraithion,Efho,Efranluma,Efvanore,Einyallond,Elathlume,Eld-Sinnocrin,Elddrinn,Elelthyr,Elheinn,Ellanalin,Ellena,Ellheserin,Ellnlin,Ellorthond,Elralara,Elstyr,Eltaesi,Elunore,Eman,EmneLenora,Emyel,Emyranserine,Enhethyr,Ennore,Entheas,Eriargond,Erranlenor,ErrarIthinn,Esari,Esath,Eserius,Eshsalin,Eshthalas,Esseavad,Esyana,EsyseAiqua,Evraland,Faellenor,Faladhell,Famelenora,Fethalas,Filranlean,Filsaqua,Formarion,Ferdor,Gafetheas,GafSerine,Gansari,Geliene,Gondorwin,Guallu,Haeth,Hanluna,Haulssad,Helatheas,Hellerien,Heloriath,Himlarien,Himliene,Hinnead,Hlaughei,Hlinas,Hloireenil,Hluihei,Hluitar,Hlurthei,Hlynead,Iaenarion,Ifrennoris,IllaAncalen,Illanathaes,Illfanora,Imlarlon,Imyfaluna,Imyse,Imyvelian,Inferius,Inhalon,Inllune,Inlurth,innsshe,Inransera,Iralserin,Irethtalos,Irholona,Ishal,Ishlashara,Isyenshara,Ithelion,Iymerius,Iaron,Iulil,Jaal,Jamkadi,Kaalume,Kaansera,Kalthalas,Karanthanil,Karnosea,Kasethyr,Keatheas,Kelsya,KethAiqua,Kmlon,Kyathlenor,Kyhasera,Lahetheas,Lammydr,Lefdorei,Lelhamelle,Lelon,Lenora,Lilean,Lindoress,Lindeenil,Lirillaquen,Litys,Llaughei,Llurthei,Lya,Lyenalon,Lyfa,Lylharion,Lylmhil,Lynathalas,Lir,Machei,Masenoris,Mathathlona,Mathethil,Mathntheas,Meethalas,Melelume,Menyamar,Menzithl,Minthyr,Mithlonde,Mornetheas,Mytha,Mythnserine,Mythsemelle,Mythsthas,Myvanas,Naahona,Nalore,NasadIlaurth,Nasin,Nathemar,Navethas,Neadar,Neanor,Neilon,Nelalon,Nellean,Nelnetaesi,Nfanor,Nilenathyr,Nionande,Nurtaleewe,Nylm,Nytenanas,Nythanlenor,Nythfelon,Nythodorei,Nytlenor,Nidiel,Noruiben,O'anlenora,O'lalona,Obeth,Ofaenathyr,Oflhone,Ollethlune,Ollmarion,Ollmnaes,Ollsmel,Olranlune,Olyaneas,Olynahil,Omanalon,Omyselon,Onelion,Onelond,Onylanor,Orlormel,Orlynn,Ormrion,Oshana,Oshmahona,Oshvamel,Raethei,Raineas,Rauguall,Rauthe,Rauthei,Reisera,Reslenora,Rrharrvhei,Ryanasera,Rymaserin,Sahnor,Saselune,Sel-Zedraazin,Selananor,Sellerion,Selmaluma,Serin,Serine,Shaeras,Shemnas,Shemserin,Sheosari,Sileltalos,Siriande,Siriathil,Sohona,Srannor,Sshanntyr,Sshaulssin,Sshaulu,Syholume,Sylharius,Sylranbel,Symdorei,Syranbel,Szoberr,Silon,Taesi,Thalas,Thalor,Thalore,Tharenlon,Tharlarast,Thelethlune,Thelhohil,Thelnora,Themar,Thene,Thilfalean,Thilnaenor,Thvethalas,Thylathlond,Tiregul,Tirion,Tlauven,Tlindhe,Ulal,Ullallanar,Ullmatalos,Ullve,Ulmetheas,Ulrenserine,Ulssin,Umnalin,Umye,Umyheserine,Unanneas,Unarith,Undraeth,Unysarion,Vel-Shonidor,Venas,Vinargothr,Waethe,Wasrion,Wlalean,Y'maqua,Yaeluma,Yeelume,Yele,Yethrion,Ymserine,Yueghed,Yuereth,Yuerran,Yuethin,Nandeedil,Olwen,Yridhremben"},
|
||||
{name: "Dark Elven", i: 34, min: 6, max: 14, d: "nrslamg", m: .2, b: "Abaethaggar,Abburth,Afranthemar,Aharasplit,Aidanat,Ald'ruhn,Ashamanu,Ashesari,Ashletheas,Baerario,Baereghel,Baethei,Bahashae,Balmora,Bel-Didhel,Borethanil,Buiyrandyn,Caellagith,Caellathala,Caergroth,Caldras,Chaggar,Chaggaust,Channtar,Charrvhel'raugaust,Chaulssin,Chaundra,ChedNasad,ChetarIthlin,ChethRrhinn,Chymaer,Clarkarond,Cloibbra,Commoragh,Cyrangroth,Cilben,D'eldarc,Daedhrog,Dalkyn,Do'Urden,Doladress,Dolarith,Dolonde,Draethe,Dranzan,Dranzithl,Draugaust,Dreghei,Drelhei,Dryndlu,Dusklyngh,DyonG'ennivalz,Edraithion,Eld-Sinnocrin,Ellorthond,Enhethyr,Entheas,ErrarIthinn,Eryndlyn,Faladhell,Faneadar,Fethalas,Filranlean,Formarion,Ferdor,Gafetheas,Ghrond,Gilranel,Glamordis,Gnaarmok,Gnisis,Golothaer,Gondorwin,Guallidurth,Guallu,Gulshin,Haeth,Haggraef,Harganeth,Harkaldra,Haulssad,Haundrauth,Heloriath,Hlammachar,Hlaughei,Hloireenil,Hluitar,Inferius,innsshe,Ithilaughym,Iz'aiogith,Jaal,Jhachalkhyn,Kaerabrae,Karanthanil,Karondkar,Karsoluthiyl,Kellyth,Khuul,Lahetheas,Lidurth,Lindeenil,Lirillaquen,LithMy'athar,LlurthDreier,Lolth,Lothuial,Luihaulen'tar,Maeralyn,Maerimydra,Mathathlona,Mathethil,Mellodona,Menagith,Menegwen,Menerrendil,Menzithl,Menzoberranzan,Mila-Nipal,Mithryn,Molagmar,Mundor,Myvanas,Naggarond,NasadIlaurth,Nauthor,Navethas,Neadar,Nurtaleewe,Nidiel,Noruiben,O'lalona,Obeth,Ofaenathyr,Orlormel,Orlytlar,Pelagiad,Raethei,Raugaust,Rauguall,Rilauven,Rrharrvhei,Sadrith,Sel-Zedraazin,Seydaneen,Shaz'rir,Skaal,Sschindylryn,Shamath,Shamenz,Shanntur,Sshanntynlan,Sshanntyr,Shaulssin,SzithMorcane,Szithlin,Szobaeth,Sirdhemben,T'lindhet,Tebh'zhor,Telmere,Telnarquel,Tharlarast,Thylathlond,Tlaughe,Trizex,Tyrybblyn,Ugauth,Ughym,Ullmatalos,Ulmetheas,Ulrenserine,Uluitur,Undraeth,Undraurth,Undrek'Thoz,Ungethal,UstNatha,V'elddrinnsshar,Vaajha,Vel-Shonidor,Velddra,Velothi,Venead,Vhalth'vha,Vinargothr,Vojha,Waethe,Waethei,Xaalkis,Yakaridan,Yeelume,Yuethin,Yuethindrynn,Zirnakaynin,Nandeedil,olwen,Uhaelben,Uthaessien,Yridhremben"},
|
||||
{name: "Dwarven", i: 35, min: 4, max: 11, d: "dk", m: 0, b: "Addundad,Ahagzad,Ahazil,Akil,Akzizad,Anumush,Araddush,Arar,Arbhur,Badushund,Baragzig,Baragzund,Barakinb,Barakzig,Barakzinb,Barakzir,Baramunz,Barazinb,Barazir,Bilgabar,Bilgatharb,Bilgathaz,Bilgila,Bilnaragz,Bilnulbar,Bilnulbun,Bizaddum,Bizaddush,Bizanarg,Bizaram,Bizinbiz,Biziram,Bunaram,Bundinar,Bundushol,Bundushund,Bundushur,Buzaram,Buzundab,Buzundush,Gabaragz,Gabaram,Gabilgab,Gabilgath,Gabizir,Gabunal,Gabunul,Gabuzan,Gatharam,Gatharbhur,Gathizdum,Gathuragz,Gathuraz,Gila,Giledzir,Gilukkhath,Gilukkhel,Gunala,Gunargath,Gunargil,Gundumunz,Gundusharb,Gundushizd,Kharbharbiln,Kharbhatharb,Kharbhela,Kharbilgab,Kharbuzadd,Khatharbar,Khathizdin,Khathundush,Khazanar,Khazinbund,Khaziragz,Khaziraz,Khizdabun,Khizdusharbh,Khizdushath,Khizdushel,Khizdushur,Kholedzar,Khundabiln,Khundabuz,Khundinarg,Khundushel,Khuragzig,Khuramunz,Kibarak,Kibilnal,Kibizar,Kibunarg,Kibundin,Kibuzan,Kinbadab,Kinbaragz,Kinbarakz,Kinbaram,Kinbizah,Kinbuzar,Nala,Naledzar,Naledzig,Naledzinb,Naragzah,Naragzar,Naragzig,Narakzah,Narakzar,Naramunz,Narazar,Nargabad,Nargabar,Nargatharb,Nargila,Nargundum,Nargundush,Nargunul,Narukthar,Narukthel,Nula,Nulbadush,Nulbaram,Nulbilnarg,Nulbunal,Nulbundab,Nulbundin,Nulbundum,Nulbuzah,Nuledzah,Nuledzig,Nulukkhaz,Nulukkhund,Nulukkhur,Sharakinb,Sharakzar,Sharamunz,Sharbarukth,Shatharbhizd,Shatharbiz,Shathazah,Shathizdush,Shathola,Shaziragz,Shizdinar,Shizdushund,Sholukkharb,Shundinulb,Shundushund,Shurakzund,Shuramunz,Tumunzadd,Tumunzan,Tumunzar,Tumunzinb,Tumunzir,Ukthad,Ulbirad,Ulbirar,Ulunzar,Ulur,Umunzad,Undalar,Undukkhil,Undun,Undur,Unduzur,Unzar,Unzathun,Usharar,Zaddinarg,Zaddushur,Zaharbad,Zaharbhizd,Zarakib,Zarakzar,Zaramunz,Zarukthel,Zinbarukth,Zirakinb,Zirakzir,Ziramunz,Ziruktharbh,Zirukthur,Zundumunz"},
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
let cells, vertices, pointsN, used;
|
||||
|
||||
var OceanLayers = function OceanLayers() {
|
||||
const outline = outlineLayersInput.value;
|
||||
const OceanLayers = function OceanLayers() {
|
||||
const outline = oceanLayers.attr("layers");
|
||||
if (outline === "none") return;
|
||||
console.time("drawOceanLayers");
|
||||
|
||||
|
|
@ -21,18 +21,16 @@
|
|||
|
||||
for (const i of cells.i) {
|
||||
const t = cells.t[i];
|
||||
if (t > 0) continue;
|
||||
if (used[i] || !limits.includes(t)) continue;
|
||||
const start = findStart(i, t);
|
||||
if (!start) continue;
|
||||
used[i] = 1;
|
||||
//debug.append("circle").attr("r", 3).attr("cx", vertices.p[start.c][0]).attr("cy", vertices.p[start.c][1]).attr("fill", "red").attr("stroke", "black").attr("stroke-width", .3);
|
||||
|
||||
const chain = connectVertices(start, t); // vertices chain to form a path
|
||||
const relaxation = 1 + t * -2; // select only n-th point
|
||||
const relaxed = chain.filter((v, i) => i % relaxation === 0 || vertices.c[v].some(c => c >= pointsN));
|
||||
if (relaxed.length >= 3) chains.push([t, relaxed.map(v => vertices.p[v])]);
|
||||
}
|
||||
//debug.selectAll("text").data(cells.i).enter().append("text").attr("font-size", 2).attr("x", d => grid.points[d][0]).attr("y", d => grid.points[d][1]).text(d => cells.t[d]+","+used[d]);
|
||||
|
||||
for (const t of limits) {
|
||||
const path = chains.filter(c => c[0] === t).map(c => round(lineGen(c[1]))).join();
|
||||
|
|
|
|||
|
|
@ -74,7 +74,10 @@
|
|||
return;
|
||||
}
|
||||
|
||||
const sorted = cells.i.filter(i => cells.s[i] > 2).sort((a, b) => cells.s[b] - cells.s[a]); // filtered and sorted array of indexes
|
||||
const burgs = pack.burgs.filter(b => b.i && !b.removed);
|
||||
const sorted = burgs.length > +religionsInput.value
|
||||
? burgs.sort((a, b) => b.population - a.population).map(b => b.cell)
|
||||
: cells.i.filter(i => cells.s[i] > 2).sort((a, b) => cells.s[b] - cells.s[a]);
|
||||
const religionsTree = d3.quadtree();
|
||||
const spacing = (graphWidth + graphHeight) / 6 / religionsInput.value; // base min distance between towns
|
||||
const cultsCount = Math.floor(rand(10, 40) / 100 * religionsInput.value);
|
||||
|
|
@ -264,6 +267,7 @@
|
|||
const cells = pack.cells, religions = pack.religions;
|
||||
|
||||
religions.filter(r => r.i).forEach(r => {
|
||||
// generate religion code (abbreviation)
|
||||
r.code = getCode(r.name);
|
||||
|
||||
// move religion center if it's not within religion area after expansion
|
||||
|
|
|
|||
|
|
@ -8,7 +8,23 @@
|
|||
console.time('generateRivers');
|
||||
Math.seedrandom(seed);
|
||||
const cells = pack.cells, p = cells.p, features = pack.features;
|
||||
resolveDepressions();
|
||||
|
||||
// build distance field in cells from water (cells.t)
|
||||
void function markupLand() {
|
||||
const q = t => cells.i.filter(i => cells.t[i] === t);
|
||||
for (let t = 2, queue = q(t); queue.length; t++, queue = q(t)) {
|
||||
queue.forEach(i => cells.c[i].forEach(c => {
|
||||
if (!cells.t[c]) cells.t[c] = t+1;
|
||||
}));
|
||||
}
|
||||
}()
|
||||
|
||||
// height with added t value to make map less depressed
|
||||
const h = Array.from(cells.h)
|
||||
.map((h, i) => h < 20 || cells.t[i] < 1 ? h : h + cells.t[i] / 100)
|
||||
.map((h, i) => h < 20 || cells.t[i] < 1 ? h : h + d3.mean(cells.c[i].map(c => cells.t[c])) / 10000);
|
||||
|
||||
resolveDepressions(h);
|
||||
features.forEach(f => {delete f.river; delete f.flux;});
|
||||
|
||||
const riversData = []; // rivers data
|
||||
|
|
@ -18,8 +34,7 @@
|
|||
let riverNext = 1; // first river id is 1, not 0
|
||||
|
||||
void function drainWater() {
|
||||
const land = cells.i.filter(isLand).sort(highest);
|
||||
|
||||
const land = cells.i.filter(i => h[i] >= 20).sort((a,b) => h[b] - h[a]);
|
||||
land.forEach(function(i) {
|
||||
cells.fl[i] += grid.cells.prec[cells.g[i]]; // flux from precipitation
|
||||
const x = p[i][0], y = p[i][1];
|
||||
|
|
@ -38,8 +53,9 @@
|
|||
return;
|
||||
}
|
||||
|
||||
const min = cells.c[i][d3.scan(cells.c[i], (a, b) => cells.h[a] - cells.h[b])]; // downhill cell
|
||||
|
||||
//const min = cells.c[i][d3.scan(cells.c[i], (a, b) => h[a] - h[b])]; // downhill cell
|
||||
let min = cells.c[i][d3.scan(cells.c[i], (a, b) => h[a] - h[b])]; // downhill cell
|
||||
|
||||
// allow only one river can flow thought a lake
|
||||
const cf = features[cells.f[i]]; // current cell feature
|
||||
if (cf.river && cf.river !== cells.r[i]) {
|
||||
|
|
@ -47,7 +63,7 @@
|
|||
}
|
||||
|
||||
if (cells.fl[i] < 30) {
|
||||
if (cells.h[min] >= 20) cells.fl[min] += cells.fl[i];
|
||||
if (h[min] >= 20) cells.fl[min] += cells.fl[i];
|
||||
return; // flux is too small to operate as river
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +82,7 @@
|
|||
} else cells.r[min] = cells.r[i]; // assign the river to the downhill cell
|
||||
|
||||
const nx = p[min][0], ny = p[min][1];
|
||||
if (cells.h[min] < 20) {
|
||||
if (h[min] < 20) {
|
||||
// pour water to the sea haven
|
||||
riversData.push({river: cells.r[i], cell: cells.haven[i], x: nx, y: ny});
|
||||
} else {
|
||||
|
|
@ -107,34 +123,36 @@
|
|||
.append("path").attr("d", d => d[1]).attr("id", d => "river"+d[0])
|
||||
.attr("data-width", d => d[2]).attr("data-increment", d => d[3]);
|
||||
}()
|
||||
|
||||
|
||||
console.timeEnd('generateRivers');
|
||||
}
|
||||
|
||||
// depression filling algorithm (for a correct water flux modeling)
|
||||
const resolveDepressions = function() {
|
||||
const resolveDepressions = function(h) {
|
||||
console.time('resolveDepressions');
|
||||
const cells = pack.cells;
|
||||
const land = cells.i.filter(i => cells.h[i] >= 20 && cells.h[i] < 95 && !cells.b[i]); // exclude near-border cells
|
||||
land.sort(highest); // highest cells go first
|
||||
const land = cells.i.filter(i => h[i] >= 20 && h[i] < 100 && !cells.b[i]); // exclude near-border cells
|
||||
land.sort((a,b) => h[b] - h[a]); // highest cells go first
|
||||
let depressed = false;
|
||||
const depressions = [];
|
||||
|
||||
for (let l = 0, depression = Infinity; depression > 1 && l < 100; l++) {
|
||||
for (let l = 0, depression = Infinity; depression && l < 100; l++) {
|
||||
depression = 0;
|
||||
for (const i of land) {
|
||||
const minHeight = d3.min(cells.c[i].map(c => cells.h[c]));
|
||||
const minHeight = d3.min(cells.c[i].map(c => h[c]));
|
||||
if (minHeight === 100) continue; // already max height
|
||||
if (cells.h[i] <= minHeight) {
|
||||
cells.h[i] = minHeight + 1;
|
||||
if (h[i] <= minHeight) {
|
||||
h[i] = minHeight + 1;
|
||||
depression++;
|
||||
depressed = true;
|
||||
}
|
||||
}
|
||||
depressions.push(depression);
|
||||
}
|
||||
|
||||
console.log(depressions);
|
||||
|
||||
console.timeEnd('resolveDepressions');
|
||||
//const depressed = cells.i.filter(i => cells.h[i] >= 20 && cells.h[i] < 95 && !cells.b[i] && cells.h[i] <= d3.min(cells.c[i].map(c => cells.h[c])));
|
||||
//debug.selectAll(".deps").data(depressed).enter().append("circle").attr("r", 0.8).attr("cx", d => cells.p[d][0]).attr("cy", d => cells.p[d][1]);
|
||||
return depressed;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
const getTrails = function() {
|
||||
console.time("generateTrails");
|
||||
const cells = pack.cells, burgs = pack.burgs.filter(b => b.i && !b.removed);
|
||||
if (burgs.length < 2) return []; // not enought capitals to build main roads
|
||||
if (burgs.length < 2) return []; // not enought burgs to build trails
|
||||
|
||||
let paths = []; // array to store path segments
|
||||
for (const f of pack.features.filter(f => f.land)) {
|
||||
|
|
@ -38,12 +38,14 @@
|
|||
isle.forEach(function(b, i) {
|
||||
let path = [];
|
||||
if (!i) {
|
||||
// build trail from the first burg on island to the farthest one on the same island
|
||||
const farthest = d3.scan(isle, (a, c) => ((c.y - b.y) ** 2 + (c.x - b.x) ** 2) - ((a.y - b.y) ** 2 + (a.x - b.x) ** 2));
|
||||
const to = isle[farthest].cell;
|
||||
if (cells.road[to]) return;
|
||||
const [from, exit] = findLandPath(b.cell, to, null);
|
||||
path = restorePath(b.cell, exit, "small", from);
|
||||
} else {
|
||||
// build trail from all other burgs to the closest road on the same island
|
||||
if (cells.road[b.cell]) return;
|
||||
const [from, exit] = findLandPath(b.cell, null, true);
|
||||
if (exit === null) return;
|
||||
|
|
@ -157,12 +159,11 @@
|
|||
|
||||
return {getRoads, getTrails, getSearoutes, draw, regenerate};
|
||||
|
||||
// Dijkstra's algorithm to find a land path
|
||||
// Find a land path to a specific cell (exit), to a closest road (toRoad), or to all reachable cells (null, null)
|
||||
function findLandPath(start, exit = null, toRoad = null) {
|
||||
const cells = pack.cells;
|
||||
const queue = new PriorityQueue({comparator: (a, b) => a.p - b.p});
|
||||
const cost = [], from = [];
|
||||
const basicCost = 10;
|
||||
queue.queue({e: start, p: 0});
|
||||
|
||||
while (queue.length) {
|
||||
|
|
@ -171,9 +172,10 @@
|
|||
|
||||
for (const c of cells.c[n]) {
|
||||
if (cells.h[c] < 20) continue; // ignore water cells
|
||||
const habitedCost = 100 - biomesData.habitability[cells.biome[c]];
|
||||
const heightCost = Math.abs(cells.h[c] - cells.h[n]) * 10;
|
||||
const cellCoast = basicCost + habitedCost + heightCost;
|
||||
const stateChangeCost = cells.state && cells.state[c] !== cells.state[n] ? 400 : 0; // trails tend to lay within the same state
|
||||
const habitedCost = Math.max(100 - biomesData.habitability[cells.biome[c]], 0); // routes tend to lay within populated areas
|
||||
const heightChangeCost = Math.abs(cells.h[c] - cells.h[n]) * 10; // routes tend to avoid elevation changes
|
||||
const cellCoast = 10 + stateChangeCost + habitedCost + heightChangeCost;
|
||||
const totalCost = p + (cells.road[c] || cells.burg[c] ? cellCoast / 3 : cellCoast);
|
||||
|
||||
if (from[c] || totalCost >= cost[c]) continue;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ function saveAsImage(type) {
|
|||
|
||||
// load fonts as dataURI so they will be available in downloaded svg/png
|
||||
GFontToDataURI(getFontsToLoad()).then(cssRules => {
|
||||
clone.select("defs").append("style").text(cssRules.join('\n'));
|
||||
if (cssRules) clone.select("defs").append("style").text(cssRules.join('\n'));
|
||||
clone.append("metadata").text("<dc:format>image/svg+xml</dc:format>");
|
||||
const serialized = (new XMLSerializer()).serializeToString(clone.node());
|
||||
const svg_xml = `<?xml version="1.0" encoding="UTF-8" standalone="no"?>` + serialized;
|
||||
|
|
@ -59,7 +59,6 @@ function saveAsImage(type) {
|
|||
const blob = new Blob([svg_xml], {type: 'image/svg+xml;charset=utf-8'});
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const link = document.createElement("a");
|
||||
link.target = "_blank";
|
||||
|
||||
if (type === "png") {
|
||||
const canvas = document.createElement("canvas");
|
||||
|
|
@ -111,11 +110,13 @@ function getFontsToLoad() {
|
|||
});
|
||||
const legendFont = legend.attr("data-font");
|
||||
if (!webSafe.includes(legendFont)) fontsInUse.add();
|
||||
return "https://fonts.googleapis.com/css?family=" + [...fontsInUse].join("|");
|
||||
const fonts = [...fontsInUse];
|
||||
return fonts.length ? "https://fonts.googleapis.com/css?family=" + fonts.join("|") : null;
|
||||
}
|
||||
|
||||
// code from Kaiido's answer https://stackoverflow.com/questions/42402584/how-to-use-google-fonts-in-canvas-when-drawing-dom-objects-in-svg
|
||||
function GFontToDataURI(url) {
|
||||
if (!url) return Promise.resolve();
|
||||
return fetch(url) // first fecth the embed stylesheet page
|
||||
.then(resp => resp.text()) // we only need the text of it
|
||||
.then(text => {
|
||||
|
|
@ -284,14 +285,8 @@ function saveGeoJSON_Cells() {
|
|||
data = data.substring(0, data.length - 2)+"\n"; // remove trailing comma
|
||||
data += "]}";
|
||||
|
||||
const dataBlob = new Blob([data], {type: "application/json"});
|
||||
const url = window.URL.createObjectURL(dataBlob);
|
||||
const link = document.createElement("a");
|
||||
document.body.appendChild(link);
|
||||
link.download = getFileName("Cells") + ".geojson";
|
||||
link.href = url;
|
||||
link.click();
|
||||
window.setTimeout(function() {window.URL.revokeObjectURL(url);}, 2000);
|
||||
const name = getFileName("Cells") + ".geojson";
|
||||
downloadFile(data, name, "application/json");
|
||||
}
|
||||
|
||||
function saveGeoJSON_Roads() {
|
||||
|
|
@ -310,14 +305,8 @@ function saveGeoJSON_Roads() {
|
|||
data = data.substring(0, data.length - 2)+"\n"; // remove trailing comma
|
||||
data += "]}";
|
||||
|
||||
const dataBlob = new Blob([data], {type: "application/json"});
|
||||
const url = window.URL.createObjectURL(dataBlob);
|
||||
const link = document.createElement("a");
|
||||
document.body.appendChild(link);
|
||||
link.download = getFileName("Routes") + ".geojson";
|
||||
link.href = url;
|
||||
link.click();
|
||||
window.setTimeout(function() {window.URL.revokeObjectURL(url);}, 2000);
|
||||
const name = getFileName("Routes") + ".geojson";
|
||||
downloadFile(data, name, "application/json");
|
||||
}
|
||||
|
||||
function saveGeoJSON_Rivers() {
|
||||
|
|
@ -335,18 +324,11 @@ function saveGeoJSON_Rivers() {
|
|||
data = data.substring(0, data.length - 2)+"\n"; // remove trailing comma
|
||||
data += "]}";
|
||||
|
||||
const dataBlob = new Blob([data], {type: "application/json"});
|
||||
const url = window.URL.createObjectURL(dataBlob);
|
||||
const link = document.createElement("a");
|
||||
document.body.appendChild(link);
|
||||
link.download = getFileName("Rivers") + ".geojson";
|
||||
link.href = url;
|
||||
link.click();
|
||||
window.setTimeout(function() {window.URL.revokeObjectURL(url);}, 2000);
|
||||
const name = getFileName("Rivers") + ".geojson";
|
||||
downloadFile(data, name, "application/json");
|
||||
}
|
||||
|
||||
function saveGeoJSON_Markers() {
|
||||
|
||||
let data = "{ \"type\": \"FeatureCollection\", \"features\": [\n";
|
||||
|
||||
markers._groups[0][0].childNodes.forEach(n => {
|
||||
|
|
@ -363,14 +345,8 @@ function saveGeoJSON_Markers() {
|
|||
data = data.substring(0, data.length - 2)+"\n"; // remove trailing comma
|
||||
data += "]}";
|
||||
|
||||
const dataBlob = new Blob([data], {type: "application/json"});
|
||||
const url = window.URL.createObjectURL(dataBlob);
|
||||
const link = document.createElement("a");
|
||||
document.body.appendChild(link);
|
||||
link.download = getFileName("Markers") + ".geojson";
|
||||
link.href = url;
|
||||
link.click();
|
||||
window.setTimeout(function() {window.URL.revokeObjectURL(url);}, 2000);
|
||||
const name = getFileName("Markers") + ".geojson";
|
||||
downloadFile(data, name, "application/json");
|
||||
}
|
||||
|
||||
function getRoadPoints(node) {
|
||||
|
|
@ -437,7 +413,7 @@ function loadMapPrompt(blob) {
|
|||
function loadLastSavedMap() {
|
||||
console.warn("Load last saved map");
|
||||
try {
|
||||
uploadFile(blob);
|
||||
uploadMap(blob);
|
||||
}
|
||||
catch(error) {
|
||||
console.error(error);
|
||||
|
|
@ -479,19 +455,8 @@ function toggleSaveReminder() {
|
|||
}
|
||||
}
|
||||
|
||||
function getFileName(dataType) {
|
||||
const name = mapName.value;
|
||||
const type = dataType ? dataType + " " : "";
|
||||
const date = new Date();
|
||||
const datFormatter = new Intl.DateTimeFormat("en", {month: "short", day: "numeric"});
|
||||
const timeFormatter = new Intl.DateTimeFormat("ru", {hour: "numeric", minute: "numeric"});
|
||||
const day = datFormatter.format(date).replace(" ", "");
|
||||
const time = timeFormatter.format(date).replace(":", "-");
|
||||
return name + " " + type + day + " " + time;
|
||||
}
|
||||
|
||||
function uploadFile(file, callback) {
|
||||
uploadFile.timeStart = performance.now();
|
||||
function uploadMap(file, callback) {
|
||||
uploadMap.timeStart = performance.now();
|
||||
|
||||
const fileReader = new FileReader();
|
||||
fileReader.onload = function(fileLoadedEvent) {
|
||||
|
|
@ -806,7 +771,7 @@ function parseLoadedData(data) {
|
|||
biomesData.habitability.push(12);
|
||||
}
|
||||
|
||||
if (version == 1) {
|
||||
if (version < 1.1) {
|
||||
// v 1.0 initial code had a bug with religion layer id
|
||||
if (!relig.size()) relig = viewbox.insert("g", "#terrain").attr("id", "relig");
|
||||
|
||||
|
|
@ -859,13 +824,21 @@ function parseLoadedData(data) {
|
|||
lakes.selectAll("path").remove();
|
||||
drawCoastline();
|
||||
}
|
||||
|
||||
if (version < 1.2) {
|
||||
// v 1.1 added new attributes
|
||||
terrs.attr("scheme", "bright").attr("terracing", 0).attr("skip", 5).attr("relax", 0).attr("curve", 0);
|
||||
svg.select("#oceanic > rect").attr("id", "oceanicPattern");
|
||||
oceanLayers.attr("layers", "-6,-3,-1");
|
||||
}
|
||||
|
||||
}()
|
||||
|
||||
changeMapSize();
|
||||
if (window.restoreDefaultEvents) restoreDefaultEvents();
|
||||
invokeActiveZooming();
|
||||
|
||||
console.warn(`TOTAL: ${rn((performance.now()-uploadFile.timeStart)/1000,2)}s`);
|
||||
console.warn(`TOTAL: ${rn((performance.now()-uploadMap.timeStart)/1000,2)}s`);
|
||||
showStatistics();
|
||||
console.groupEnd("Loaded Map " + seed);
|
||||
tip("Map is successfully loaded", true, "success", 7000);
|
||||
|
|
|
|||
|
|
@ -274,14 +274,8 @@ function editBiomes() {
|
|||
data += el.dataset.population + "\n";
|
||||
});
|
||||
|
||||
const dataBlob = new Blob([data], {type: "text/plain"});
|
||||
const url = window.URL.createObjectURL(dataBlob);
|
||||
const link = document.createElement("a");
|
||||
document.body.appendChild(link);
|
||||
link.download = getFileName("Biomes") + ".csv";
|
||||
link.href = url;
|
||||
link.click();
|
||||
window.setTimeout(function() {window.URL.revokeObjectURL(url);}, 2000);
|
||||
const name = getFileName("Biomes") + ".csv";
|
||||
downloadFile(data, name);
|
||||
}
|
||||
|
||||
function enterBiomesCustomizationMode() {
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ function editBurgs() {
|
|||
document.getElementById("regenerateBurgNames").addEventListener("click", regenerateNames);
|
||||
document.getElementById("addNewBurg").addEventListener("click", enterAddBurgMode);
|
||||
document.getElementById("burgsExport").addEventListener("click", downloadBurgsData);
|
||||
document.getElementById("burgNamesImport").addEventListener("click", e => burgsListToLoad.click());
|
||||
document.getElementById("burgsListToLoad").addEventListener("change", importBurgNames);
|
||||
document.getElementById("burgNamesImport").addEventListener("click", renameBurgsInBulk);
|
||||
document.getElementById("burgsListToLoad").addEventListener("change", function() {uploadFile(this, importBurgNames)});
|
||||
document.getElementById("burgsRemoveAll").addEventListener("click", triggerAllBurgsRemove);
|
||||
|
||||
function refreshBurgsEditor() {
|
||||
|
|
@ -368,7 +368,7 @@ function editBurgs() {
|
|||
}
|
||||
|
||||
function downloadBurgsData() {
|
||||
let data = "Id,Burg,Province,State,Culture,Religion,Population,Longitude,Latitude,Elevation ("+heightUnit.value+"),Capital,Port\n"; // headers
|
||||
let data = "Id,Burg,Province,State,Culture,Religion,Population,Longitude,Latitude,Elevation ("+heightUnit.value+"),Capital,Port,Citadel,Walls,Plaza,Temple,Shanty Town\n"; // headers
|
||||
const valid = pack.burgs.filter(b => b.i && !b.removed); // all valid burgs
|
||||
|
||||
valid.forEach(b => {
|
||||
|
|
@ -388,61 +388,70 @@ function editBurgs() {
|
|||
|
||||
// add status data
|
||||
data += b.capital ? "capital," : ",";
|
||||
data += b.port ? "port\n" : "\n";
|
||||
data += b.port ? "port," : ",";
|
||||
data += b.citadel ? "citadel," : ",";
|
||||
data += b.walls ? "walls," : ",";
|
||||
data += b.plaza ? "plaza," : ",";
|
||||
data += b.temple ? "temple," : ",";
|
||||
data += b.shanty ? "shanty town\n" : "\n";
|
||||
});
|
||||
|
||||
const dataBlob = new Blob([data], {type: "text/plain"});
|
||||
const url = window.URL.createObjectURL(dataBlob);
|
||||
const link = document.createElement("a");
|
||||
document.body.appendChild(link);
|
||||
link.download = getFileName("Burgs") + ".csv";
|
||||
link.href = url;
|
||||
link.click();
|
||||
window.setTimeout(function() {window.URL.revokeObjectURL(url);}, 2000);
|
||||
const name = getFileName("Burgs") + ".csv";
|
||||
downloadFile(data, name);
|
||||
}
|
||||
|
||||
function importBurgNames() {
|
||||
const el = document.getElementById("burgsListToLoad");
|
||||
const fileToLoad = el.files[0];
|
||||
el.value = "";
|
||||
function renameBurgsInBulk() {
|
||||
const message = `Download burgs list as a text file, make changes and re-upload the file.
|
||||
If you do not want to change the name, just leave it as is`;
|
||||
alertMessage.innerHTML = message;
|
||||
|
||||
const fileReader = new FileReader();
|
||||
|
||||
fileReader.onload = function(e) {
|
||||
const dataLoaded = e.target.result;
|
||||
const data = dataLoaded.split("\r\n");
|
||||
if (!data.length) {tip("Cannot parse the list, please check the file format", false, "error"); return;}
|
||||
|
||||
let change = [];
|
||||
let message = `Burgs will be renamed as below. Please confirm;
|
||||
<div class="overflow-div"><table class="overflow-table"><tr><th>Id</th><th>Current name</th><th>New Name</th></tr>`;
|
||||
|
||||
for (let i=0; i < data.length && i <= pack.burgs.length; i++) {
|
||||
const v = data[i];
|
||||
if (!v || !pack.burgs[i+1] || v == pack.burgs[i+1].name) continue;
|
||||
change.push({id:i+1, name: v});
|
||||
message += `<tr><td style="width:20%">${i+1}</td><td style="width:40%">${pack.burgs[i+1].name}</td><td style="width:40%">${v}</td></tr>`;
|
||||
$("#alert").dialog({title: "Burgs bulk renaming", width:"22em",
|
||||
position: {my: "center", at: "center", of: "svg"},
|
||||
buttons: {
|
||||
Download: function() {
|
||||
const data = pack.burgs.filter(b => b.i && !b.removed).map(b => b.name).join("\r\n");
|
||||
const name = getFileName("Burg names") + ".txt";
|
||||
downloadFile(data, name);
|
||||
},
|
||||
Upload: () => burgsListToLoad.click(),
|
||||
Cancel: function() {$(this).dialog("close");}
|
||||
}
|
||||
message += `</tr></table></div>`;
|
||||
alertMessage.innerHTML = message;
|
||||
});
|
||||
}
|
||||
|
||||
$("#alert").dialog({title: "Burgs bulk renaming", position: {my: "center", at: "center", of: "svg"},
|
||||
buttons: {
|
||||
Cancel: function() {$(this).dialog("close");},
|
||||
Confirm: function() {
|
||||
for (let i=0; i < change.length; i++) {
|
||||
const id = change[i].id;
|
||||
pack.burgs[id].name = change[i].name;
|
||||
burgLabels.select("[data-id='" + id + "']").text(change[i].name);
|
||||
}
|
||||
$(this).dialog("close");
|
||||
burgsEditorAddLines();
|
||||
}
|
||||
}
|
||||
});
|
||||
function importBurgNames(dataLoaded) {
|
||||
if (!dataLoaded) {tip("Cannot load the file, please check the format", false, "error"); return;}
|
||||
const data = dataLoaded.split("\r\n");
|
||||
if (!data.length) {tip("Cannot parse the list, please check the file format", false, "error"); return;}
|
||||
|
||||
let change = [], message = `Burgs will be renamed as below. Please confirm`;
|
||||
message += `<table class="overflow-table"><tr><th>Id</th><th>Current name</th><th>New Name</th></tr>`;
|
||||
const burgs = pack.burgs.filter(b => b.i && !b.removed);
|
||||
for (let i=0; i < data.length && i <= burgs.length; i++) {
|
||||
const v = data[i];
|
||||
if (!v || !burgs[i] || v == burgs[i].name) continue;
|
||||
change.push({id:burgs[i].i, name: v});
|
||||
message += `<tr><td style="width:20%">${burgs[i].i}</td><td style="width:40%">${burgs[i].name}</td><td style="width:40%">${v}</td></tr>`;
|
||||
}
|
||||
message += `</tr></table>`;
|
||||
if (!change.length) message = "No changes found in the file. Please change some names to get a result"
|
||||
alertMessage.innerHTML = message;
|
||||
|
||||
fileReader.readAsText(fileToLoad, "UTF-8");
|
||||
$("#alert").dialog({title: "Burgs bulk renaming", width:"22em",
|
||||
position: {my: "center", at: "center", of: "svg"},
|
||||
buttons: {
|
||||
Cancel: function() {$(this).dialog("close");},
|
||||
Confirm: function() {
|
||||
for (let i=0; i < change.length; i++) {
|
||||
const id = change[i].id;
|
||||
pack.burgs[id].name = change[i].name;
|
||||
burgLabels.select("[data-id='" + id + "']").text(change[i].name);
|
||||
}
|
||||
$(this).dialog("close");
|
||||
burgsEditorAddLines();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function triggerAllBurgsRemove() {
|
||||
|
|
|
|||
|
|
@ -537,14 +537,8 @@ function editCultures() {
|
|||
data += nameBases[base].name + "\n";
|
||||
});
|
||||
|
||||
const dataBlob = new Blob([data], {type: "text/plain"});
|
||||
const url = window.URL.createObjectURL(dataBlob);
|
||||
const link = document.createElement("a");
|
||||
document.body.appendChild(link);
|
||||
link.download = getFileName("Cultures") + ".csv";
|
||||
link.href = url;
|
||||
link.click();
|
||||
window.setTimeout(function() {window.URL.revokeObjectURL(url);}, 2000);
|
||||
const name = getFileName("Cultures") + ".csv";
|
||||
downloadFile(data, name);
|
||||
}
|
||||
|
||||
function closeCulturesEditor() {
|
||||
|
|
|
|||
|
|
@ -222,15 +222,9 @@ function editDiplomacy() {
|
|||
$("#alert").dialog({title: "Relations history", position: {my: "center", at: "center", of: "svg"},
|
||||
buttons: {
|
||||
Save: function() {
|
||||
const text = this.querySelector("div").innerText.split("\n").join("\r\n");
|
||||
const dataBlob = new Blob([text], {type: "text/plain"});
|
||||
const url = window.URL.createObjectURL(dataBlob);
|
||||
const link = document.createElement("a");
|
||||
document.body.appendChild(link);
|
||||
link.download = getFileName("Relations history") + ".txt";
|
||||
link.href = url;
|
||||
link.click();
|
||||
window.setTimeout(function() {window.URL.revokeObjectURL(url);}, 2000);
|
||||
const data = this.querySelector("div").innerText.split("\n").join("\r\n");
|
||||
const name = getFileName("Relations history") + ".txt";
|
||||
downloadFile(data, name);
|
||||
},
|
||||
Clear: function() {pack.states[0].diplomacy = []; $(this).dialog("close");},
|
||||
Close: function() {$(this).dialog("close");}
|
||||
|
|
@ -277,14 +271,8 @@ function editDiplomacy() {
|
|||
data += s.name + "," + rels.join(",") + "\n";
|
||||
});
|
||||
|
||||
const dataBlob = new Blob([data], {type: "text/plain"});
|
||||
const url = window.URL.createObjectURL(dataBlob);
|
||||
const link = document.createElement("a");
|
||||
document.body.appendChild(link);
|
||||
link.download = getFileName("Relations") + ".csv";
|
||||
link.href = url;
|
||||
link.click();
|
||||
window.setTimeout(function() {window.URL.revokeObjectURL(url);}, 2000);
|
||||
const name = getFileName("Relations") + ".csv";
|
||||
downloadFile(data, name);
|
||||
}
|
||||
|
||||
function closeDiplomacyEditor() {
|
||||
|
|
|
|||
|
|
@ -125,9 +125,10 @@ function addBurg(point) {
|
|||
const state = cells.state[cell];
|
||||
const feature = cells.f[cell];
|
||||
|
||||
const temple = pack.states[state].form === "Theocracy";
|
||||
const population = Math.max((cells.s[cell] + cells.road[cell]) / 3 + i / 1000 + cell % 100 / 1000, .1);
|
||||
|
||||
pack.burgs.push({name, cell, x, y, state, i, culture, feature, capital: 0, port: 0, population});
|
||||
pack.burgs.push({name, cell, x, y, state, i, culture, feature, capital: 0, port: 0, temple, population});
|
||||
cells.burg[cell] = i;
|
||||
|
||||
const townSize = burgIcons.select("#towns").attr("size") || 0.5;
|
||||
|
|
@ -254,7 +255,8 @@ function drawLegend(name, data) {
|
|||
const width = bbox.width + colOffset * 2;
|
||||
const height = bbox.height + colOffset / 2 + vOffset;
|
||||
|
||||
legend.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", width).attr("height", height)
|
||||
legend.insert("rect", ":first-child").attr("id", "legendBox")
|
||||
.attr("x", 0).attr("y", 0).attr("width", width).attr("height", height)
|
||||
.attr("fill", backClr).attr("fill-opacity", opacity);
|
||||
|
||||
fitLegendBox();
|
||||
|
|
@ -272,6 +274,7 @@ function fitLegendBox() {
|
|||
|
||||
// draw legend with the same data, but using different settings
|
||||
function redrawLegend() {
|
||||
if (!legend.select("rect").size()) return;
|
||||
const name = legend.select("#legendLabel").text();
|
||||
const data = legend.attr("data").split("|").map(l => l.split(","));
|
||||
drawLegend(name, data);
|
||||
|
|
@ -526,4 +529,32 @@ function unfog() {
|
|||
defs.select("#fog").selectAll("path").remove();
|
||||
fogging.selectAll("path").remove();
|
||||
fogging.attr("display", "none");
|
||||
}
|
||||
|
||||
function getFileName(dataType) {
|
||||
const name = mapName.value;
|
||||
const type = dataType ? dataType + " " : "";
|
||||
const date = new Date();
|
||||
const datFormatter = new Intl.DateTimeFormat("en", {month: "short", day: "numeric"});
|
||||
const timeFormatter = new Intl.DateTimeFormat("ru", {hour: "numeric", minute: "numeric"});
|
||||
const day = datFormatter.format(date).replace(" ", "");
|
||||
const time = timeFormatter.format(date).replace(":", "-");
|
||||
return name + " " + type + day + " " + time;
|
||||
}
|
||||
|
||||
function downloadFile(data, name, type = "text/plain") {
|
||||
const dataBlob = new Blob([data], {type});
|
||||
const url = window.URL.createObjectURL(dataBlob);
|
||||
const link = document.createElement("a");
|
||||
link.download = name;
|
||||
link.href = url;
|
||||
link.click();
|
||||
window.setTimeout(() => window.URL.revokeObjectURL(url), 2000);
|
||||
}
|
||||
|
||||
function uploadFile(el, callback) {
|
||||
const fileReader = new FileReader();
|
||||
fileReader.readAsText(el.files[0], "UTF-8");
|
||||
el.value = "";
|
||||
fileReader.onload = loaded => callback(loaded.target.result);
|
||||
}
|
||||
|
|
@ -103,7 +103,7 @@ function showMapTooltip(point, e, i, g) {
|
|||
|
||||
// covering elements
|
||||
if (layerIsOn("togglePrec") && land) tip("Annual Precipitation: "+ getFriendlyPrecipitation(i)); else
|
||||
if (layerIsOn("togglePopulation")) tip("Population: "+ getFriendlyPopulation(i)); else
|
||||
if (layerIsOn("togglePopulation")) tip(getPopulationTip(i)); else
|
||||
if (layerIsOn("toggleTemp")) tip("Temperature: " + convertTemperature(grid.cells.temp[g])); else
|
||||
if (layerIsOn("toggleBiomes") && pack.cells.biome[i]) tip("Biome: " + biomesData.name[pack.cells.biome[i]]); else
|
||||
if (layerIsOn("toggleReligions") && pack.cells.religion[i]) {
|
||||
|
|
@ -119,7 +119,6 @@ function showMapTooltip(point, e, i, g) {
|
|||
} else
|
||||
if (layerIsOn("toggleCultures") && pack.cells.culture[i]) tip("Culture: " + pack.cultures[pack.cells.culture[i]].name); else
|
||||
if (layerIsOn("toggleHeight")) tip("Height: " + getFriendlyHeight(point));
|
||||
//if (pack.cells.t[i] === 1 && !tooltip.textContent) tip("Click to edit the coastline");
|
||||
}
|
||||
|
||||
// get cell info on mouse move
|
||||
|
|
@ -176,7 +175,13 @@ function getFriendlyPrecipitation(i) {
|
|||
function getFriendlyPopulation(i) {
|
||||
const rural = pack.cells.pop[i] * populationRate.value;
|
||||
const urban = pack.cells.burg[i] ? pack.burgs[pack.cells.burg[i]].population * populationRate.value * urbanization.value : 0;
|
||||
return si(rural+urban);
|
||||
return `${si(rural+urban)} (${si(rural)} rural, urban ${si(urban)})`;
|
||||
}
|
||||
|
||||
function getPopulationTip(i) {
|
||||
const rural = pack.cells.pop[i] * populationRate.value;
|
||||
const urban = pack.cells.burg[i] ? pack.burgs[pack.cells.burg[i]].population * populationRate.value * urbanization.value : 0;
|
||||
return `Cell population: ${si(rural+urban)}; Rural: ${si(rural)}; Urban: ${si(urban)}`;
|
||||
}
|
||||
|
||||
// assign lock behavior
|
||||
|
|
@ -225,10 +230,10 @@ function stored(option) {
|
|||
}
|
||||
|
||||
// apply drop-down menu option. If the value is not in options, add it
|
||||
function applyOption(select, option) {
|
||||
const custom = !Array.from(select.options).some(o => o.value == option);
|
||||
if (custom) select.options.add(new Option(option, option));
|
||||
select.value = option;
|
||||
function applyOption(select, id, name = id) {
|
||||
const custom = !Array.from(select.options).some(o => o.value == id);
|
||||
if (custom) select.options.add(new Option(name, id));
|
||||
select.value = id;
|
||||
}
|
||||
|
||||
// show info about the generator in a popup
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@
|
|||
"use strict";
|
||||
|
||||
function editHeightmap() {
|
||||
const heights = viewbox.select("#heights").size()
|
||||
? viewbox.select("#heights")
|
||||
: viewbox.insert("g", "#terrs").attr("id", "heights");
|
||||
|
||||
void function selectEditMode() {
|
||||
alertMessage.innerHTML = `<p>Heightmap is a core element on which all other data (rivers, burgs, states etc) is based.
|
||||
So the best edit approach is to <i>erase</i> the secondary data and let the system automatically regenerate it on edit completion.</p>
|
||||
|
|
@ -53,14 +57,12 @@ function editHeightmap() {
|
|||
heightmapEditMode.innerHTML = type;
|
||||
|
||||
if (type === "erase") {
|
||||
terrs.attr("mask", null);
|
||||
undraw();
|
||||
changeOnlyLand.checked = false;
|
||||
} else if (type === "keep") {
|
||||
viewbox.selectAll("#landmass, #lakes").attr("display", "none");
|
||||
changeOnlyLand.checked = true;
|
||||
} else if (type === "risk") {
|
||||
terrs.attr("mask", null);
|
||||
defs.selectAll("#land, #water").selectAll("path").remove();
|
||||
viewbox.selectAll("#coastline path, #lakes path, #oceanLayers path").remove();
|
||||
changeOnlyLand.checked = false;
|
||||
|
|
@ -108,7 +110,7 @@ function getHeight(h) {
|
|||
|
||||
// Exit customization mode
|
||||
function finalizeHeightmap() {
|
||||
if (terrs.selectAll("*").size() < 200) {
|
||||
if (heights.selectAll("*").size() < 200) {
|
||||
tip("Insufficient land area! There should be at least 200 land cells to finalize the heightmap", null, "error");
|
||||
return;
|
||||
}
|
||||
|
|
@ -131,7 +133,7 @@ function getHeight(h) {
|
|||
else if (mode === "risk") restoreRiskedData();
|
||||
|
||||
// restore initial layers
|
||||
terrs.selectAll("*").remove();
|
||||
heights.selectAll("*").remove();
|
||||
turnButtonOff("toggleHeight");
|
||||
document.getElementById("mapLayers").querySelectorAll("li").forEach(function(e) {
|
||||
if (editHeightmap.layers.includes(e.id) && !layerIsOn(e.id)) e.click(); // turn on
|
||||
|
|
@ -143,7 +145,6 @@ function getHeight(h) {
|
|||
function regenerateErasedData() {
|
||||
console.group("Edit Heightmap");
|
||||
console.time("regenerateErasedData");
|
||||
terrs.attr("mask", "url(#land)");
|
||||
|
||||
const change = changeHeights.checked;
|
||||
markFeatures();
|
||||
|
|
@ -171,6 +172,10 @@ function getHeight(h) {
|
|||
Cultures.expand();
|
||||
BurgsAndStates.generate();
|
||||
Religions.generate();
|
||||
BurgsAndStates.defineStateForms();
|
||||
BurgsAndStates.generateProvinces();
|
||||
BurgsAndStates.defineBurgFeatures();
|
||||
|
||||
drawStates();
|
||||
drawBorders();
|
||||
BurgsAndStates.drawStateLabels();
|
||||
|
|
@ -190,7 +195,6 @@ function getHeight(h) {
|
|||
function restoreRiskedData() {
|
||||
console.group("Edit Heightmap");
|
||||
console.time("restoreRiskedData");
|
||||
terrs.attr("mask", "url(#land)");
|
||||
|
||||
// assign pack data to grid cells
|
||||
const l = grid.cells.i.length;
|
||||
|
|
@ -374,7 +378,7 @@ function getHeight(h) {
|
|||
function mockHeightmap() {
|
||||
const data = renderOcean.checked ? grid.cells.i : grid.cells.i.filter(i => grid.cells.h[i] >= 20);
|
||||
const scheme = getColorScheme();
|
||||
terrs.selectAll("polygon").data(data).join("polygon").attr("points", d => getGridPolygon(d))
|
||||
heights.selectAll("polygon").data(data).join("polygon").attr("points", d => getGridPolygon(d))
|
||||
.attr("id", d => "cell"+d).attr("fill", d => getColor(grid.cells.h[d], scheme));
|
||||
}
|
||||
|
||||
|
|
@ -384,9 +388,9 @@ function getHeight(h) {
|
|||
const scheme = getColorScheme();
|
||||
|
||||
selection.forEach(function(i) {
|
||||
let cell = terrs.select("#cell"+i);
|
||||
let cell = heights.select("#cell"+i);
|
||||
if (!ocean && grid.cells.h[i] < 20) {cell.remove(); return;}
|
||||
if (!cell.size()) cell = terrs.append("polygon").attr("points", getGridPolygon(i)).attr("id", "cell"+i);
|
||||
if (!cell.size()) cell = heights.append("polygon").attr("points", getGridPolygon(i)).attr("id", "cell"+i);
|
||||
cell.attr("fill", getColor(grid.cells.h[i], scheme));
|
||||
});
|
||||
}
|
||||
|
|
@ -569,10 +573,10 @@ function getHeight(h) {
|
|||
const someHeights = grid.cells.h.some(h => h);
|
||||
if (!someHeights) {tip("Heightmap is already cleared, please do not click twice if not required", false, "error"); return;}
|
||||
grid.cells.h = new Uint8Array(grid.cells.i.length);
|
||||
terrs.selectAll("*").remove();
|
||||
heights.selectAll("*").remove();
|
||||
updateHistory();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function openTemplateEditor() {
|
||||
|
|
@ -614,8 +618,8 @@ function getHeight(h) {
|
|||
document.getElementById("templateSelect").addEventListener("change", e => selectTemplate(e));
|
||||
document.getElementById("templateRun").addEventListener("click", executeTemplate);
|
||||
document.getElementById("templateSave").addEventListener("click", downloadTemplate);
|
||||
document.getElementById("templateLoad").addEventListener("click", e => templateToLoad.click());
|
||||
document.getElementById("templateToLoad").addEventListener("change", uploadTemplate);
|
||||
document.getElementById("templateLoad").addEventListener("click", () => templateToLoad.click());
|
||||
document.getElementById("templateToLoad").addEventListener("change", function() {uploadFile(this, uploadTemplate)});
|
||||
|
||||
function addStepOnClick(e) {
|
||||
if (e.target.tagName !== "BUTTON") return;
|
||||
|
|
@ -868,7 +872,7 @@ function getHeight(h) {
|
|||
const steps = body.querySelectorAll("#templateBody > div");
|
||||
if (!steps.length) return;
|
||||
|
||||
let stepsData = "";
|
||||
let data = "";
|
||||
for (const s of steps) {
|
||||
if (s.style.opacity == .5) continue;
|
||||
const type = s.getAttribute("data-type");
|
||||
|
|
@ -881,37 +885,23 @@ function getHeight(h) {
|
|||
const x = templateX ? templateX.value : "0";
|
||||
const templateY = s.querySelector(".templateY");
|
||||
const y = templateY ? templateY.value : "0";
|
||||
stepsData += `${type} ${count} ${arg3} ${x} ${y}\r\n`;
|
||||
data += `${type} ${count} ${arg3} ${x} ${y}\r\n`;
|
||||
}
|
||||
|
||||
const dataBlob = new Blob([stepsData], {type: "text/plain"});
|
||||
const url = window.URL.createObjectURL(dataBlob);
|
||||
const link = document.createElement("a");
|
||||
link.download = "template_" + Date.now() + ".txt";
|
||||
link.href = url;
|
||||
link.click();
|
||||
const name = "template_" + Date.now() + ".txt";
|
||||
downloadFile(data, name);
|
||||
}
|
||||
|
||||
function uploadTemplate(c) {
|
||||
const body = document.getElementById("templateBody");
|
||||
const el = document.getElementById("templateToLoad");
|
||||
const fileToLoad = el.files[0];
|
||||
el.value = "";
|
||||
const fileReader = new FileReader();
|
||||
|
||||
fileReader.onload = function(e) {
|
||||
const dataLoaded = e.target.result;
|
||||
const steps = dataLoaded.split("\r\n");
|
||||
if (!steps.length) {tip("Cannot parse the template, please check the file", false, "error"); return;}
|
||||
body.innerHTML = "";
|
||||
for (const s of steps) {
|
||||
const step = s.split(" ");
|
||||
if (step.length !== 5) {console.error("Cannot parse step, wrong arguments count", s); continue;}
|
||||
addStep(step[0], step[1], step[2], step[3], step[4]);
|
||||
}
|
||||
function uploadTemplate(dataLoaded) {
|
||||
const steps = dataLoaded.split("\r\n");
|
||||
if (!steps.length) {tip("Cannot parse the template, please check the file", false, "error"); return;}
|
||||
templateBody.innerHTML = "";
|
||||
for (const s of steps) {
|
||||
const step = s.split(" ");
|
||||
if (step.length !== 5) {console.error("Cannot parse step, wrong arguments count", s); continue;}
|
||||
addStep(step[0], step[1], step[2], step[3], step[4]);
|
||||
}
|
||||
|
||||
fileReader.readAsText(fileToLoad, "UTF-8");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -930,14 +920,20 @@ function getHeight(h) {
|
|||
canvas.width = graphWidth;
|
||||
canvas.height = graphHeight;
|
||||
document.body.insertBefore(canvas, optionsContainer);
|
||||
|
||||
const img = new Image;
|
||||
img.id = "image";
|
||||
img.style.display = "none";
|
||||
document.body.appendChild(img);
|
||||
|
||||
setOverlayOpacity(0);
|
||||
|
||||
|
||||
document.getElementById("convertImageLoad").classList.add("glow"); // add glow effect
|
||||
tip('Image Converter is opened. Upload the image and assign the colors to desired heights', true, "warn"); // main tip
|
||||
|
||||
// remove all heights
|
||||
grid.cells.h = new Uint8Array(grid.cells.i.length);
|
||||
terrs.selectAll("*").remove();
|
||||
heights.selectAll("*").remove();
|
||||
updateHistory();
|
||||
|
||||
if (modules.openImageConverter) return;
|
||||
|
|
@ -973,7 +969,6 @@ function getHeight(h) {
|
|||
const file = this.files[0];
|
||||
this.value = ""; // reset input value to get triggered if the file is re-uploaded
|
||||
const reader = new FileReader();
|
||||
const img = new Image;
|
||||
|
||||
img.onload = function() {
|
||||
const ctx = document.getElementById("canvas").getContext("2d");
|
||||
|
|
@ -992,7 +987,7 @@ function getHeight(h) {
|
|||
const imageData = ctx.getImageData(0, 0, graphWidth, graphHeight);
|
||||
const data = imageData.data;
|
||||
|
||||
terrs.selectAll("*").remove();
|
||||
heights.selectAll("*").remove();
|
||||
d3.select("#imageConverter").selectAll("div.color-div").remove();
|
||||
colorsSelect.style.display = "block";
|
||||
colorsUnassigned.style.display = "block";
|
||||
|
|
@ -1008,7 +1003,8 @@ function getHeight(h) {
|
|||
const cmap = MMCQ.quantize(gridColors, count);
|
||||
const usedColors = new Set();
|
||||
|
||||
terrs.selectAll("polygon").data(grid.cells.i).join("polygon").attr("points", d => getGridPolygon(d))
|
||||
heights.selectAll("polygon").data(grid.cells.i).join("polygon")
|
||||
.attr("points", d => getGridPolygon(d))
|
||||
.attr("id", d => "cell"+d).attr("fill", d => {
|
||||
const clr = `rgb(${cmap.nearest(gridColors[d])})`;
|
||||
usedColors.add(clr);
|
||||
|
|
@ -1031,7 +1027,7 @@ function getHeight(h) {
|
|||
}
|
||||
|
||||
function colorClicked() {
|
||||
terrs.selectAll(".selectedCell").attr("class", null);
|
||||
heights.selectAll(".selectedCell").attr("class", null);
|
||||
const unselect = this.classList.contains("selectedColor");
|
||||
|
||||
const selectedColor = imageConverter.querySelector("div.selectedColor");
|
||||
|
|
@ -1050,8 +1046,8 @@ function getHeight(h) {
|
|||
}
|
||||
|
||||
const color = this.getAttribute("data-color");
|
||||
terrs.selectAll("polygon.selectedCell").classed("selectedCell", 0);
|
||||
terrs.selectAll("polygon[fill='" + color + "']").classed("selectedCell", 1);
|
||||
heights.selectAll("polygon.selectedCell").classed("selectedCell", 0);
|
||||
heights.selectAll("polygon[fill='" + color + "']").classed("selectedCell", 1);
|
||||
}
|
||||
|
||||
function assignHeight() {
|
||||
|
|
@ -1062,7 +1058,7 @@ function getHeight(h) {
|
|||
selectedColor.setAttribute("data-color", rgb);
|
||||
selectedColor.setAttribute("data-height", height);
|
||||
|
||||
terrs.selectAll(".selectedCell").each(function() {
|
||||
heights.selectAll(".selectedCell").each(function() {
|
||||
this.setAttribute("fill", rgb);
|
||||
this.setAttribute("data-height", height);
|
||||
});
|
||||
|
|
@ -1086,7 +1082,7 @@ function getHeight(h) {
|
|||
const colorTo = color(1 - (normalized < .2 ? normalized-.05 : normalized));
|
||||
const heightTo = normalized * 100;
|
||||
|
||||
terrs.selectAll("polygon[fill='" + colorFrom + "']").attr("fill", colorTo).attr("data-height", heightTo);
|
||||
heights.selectAll("polygon[fill='" + colorFrom + "']").attr("fill", colorTo).attr("data-height", heightTo);
|
||||
el.style.backgroundColor = colorTo;
|
||||
el.setAttribute("data-color", colorTo);
|
||||
el.setAttribute("data-height", heightTo);
|
||||
|
|
@ -1098,9 +1094,9 @@ function getHeight(h) {
|
|||
}
|
||||
|
||||
function setConvertColorsNumber() {
|
||||
const number = +prompt(`Please provide a desired number of colors. Min value is 3, max is 255. An actual number depends on color scheme and may vary from desired number`,
|
||||
convertColors.value);
|
||||
if (Number.isNaN(number) || number < 3 || number > 255) {tip("The number should be an integer in 3-255 range", false, "error"); return;}
|
||||
const text = "Please provide a desired number of colors. Min value is 3, max is 255. An actual number depends on color scheme and may vary from desired number";
|
||||
const number = Math.max(Math.min(+prompt(text, convertColors.value), 255), 3);
|
||||
if (Number.isNaN(number)) {tip("The number should be an integer", false, "error"); return;}
|
||||
convertColors.value = number;
|
||||
heightsFromImage(number);
|
||||
}
|
||||
|
|
@ -1113,6 +1109,8 @@ function getHeight(h) {
|
|||
function closeImageConverter() {
|
||||
const canvas = document.getElementById("canvas");
|
||||
if (canvas) canvas.remove(); else return;
|
||||
const img = document.getElementById("image");
|
||||
if (img) img.remove(); else return;
|
||||
|
||||
d3.select("#imageConverter").selectAll("div.color-div").remove();
|
||||
colorsAssigned.style.display = "none";
|
||||
|
|
@ -1121,13 +1119,13 @@ function getHeight(h) {
|
|||
viewbox.style("cursor", "default").on(".drag", null);
|
||||
tip('Heightmap edit mode is active. Click on "Exit Customization" to finalize the heightmap', true);
|
||||
|
||||
terrs.selectAll("polygon").each(function() {
|
||||
heights.selectAll("polygon").each(function() {
|
||||
const height = +this.getAttribute("data-height") || 0;
|
||||
const i = +this.id.slice(4);
|
||||
grid.cells.h[i] = height;
|
||||
});
|
||||
|
||||
terrs.selectAll("polygon").remove();
|
||||
heights.selectAll("polygon").remove();
|
||||
updateHeightmap();
|
||||
}
|
||||
|
||||
|
|
@ -1201,7 +1199,6 @@ function getHeight(h) {
|
|||
|
||||
const imgBig = canvas.toDataURL("image/png");
|
||||
const link = document.createElement("a");
|
||||
link.target = "_blank";
|
||||
link.download = getFileName("Heightmap") + ".png";
|
||||
link.href = imgBig;
|
||||
document.body.appendChild(link);
|
||||
|
|
|
|||
|
|
@ -134,10 +134,10 @@ function drawHeightmap() {
|
|||
const paths = new Array(101).fill("");
|
||||
|
||||
const scheme = getColorScheme();
|
||||
const terracing = +styleHeightmapTerracingInput.value / 10; // add additional shifted darker layer for pseudo-3d effect
|
||||
const skip = +styleHeightmapSkipOutput.value + 1;
|
||||
const simplification = +styleHeightmapSimplificationInput.value;
|
||||
switch (+styleHeightmapCurveInput.value) {
|
||||
const terracing = terrs.attr("terracing") / 10; // add additional shifted darker layer for pseudo-3d effect
|
||||
const skip = +terrs.attr("skip") + 1;
|
||||
const simplification = +terrs.attr("relax");
|
||||
switch (+terrs.attr("curve")) {
|
||||
case 0: lineGen.curve(d3.curveBasisClosed); break;
|
||||
case 1: lineGen.curve(d3.curveLinear); break;
|
||||
case 2: lineGen.curve(d3.curveStep); break;
|
||||
|
|
@ -199,11 +199,12 @@ function drawHeightmap() {
|
|||
}
|
||||
|
||||
function getColorScheme() {
|
||||
const scheme = styleHeightmapSchemeInput.value;
|
||||
const scheme = terrs.attr("scheme");
|
||||
if (scheme === "bright") return d3.scaleSequential(d3.interpolateSpectral);
|
||||
if (scheme === "light") return d3.scaleSequential(d3.interpolateRdYlGn);
|
||||
if (scheme === "green") return d3.scaleSequential(d3.interpolateGreens);
|
||||
if (scheme === "monochrome") return d3.scaleSequential(d3.interpolateGreys);
|
||||
return d3.scaleSequential(d3.interpolateSpectral);
|
||||
}
|
||||
|
||||
function getColor(value, scheme = getColorScheme()) {
|
||||
|
|
@ -977,12 +978,11 @@ function toggleCompass(event) {
|
|||
turnButtonOn("toggleCompass");
|
||||
$('#compass').fadeIn();
|
||||
if (!compass.selectAll("*").size()) {
|
||||
const tr = `translate(80 80) scale(.25)`;
|
||||
d3.select("#rose").attr("transform", tr);
|
||||
compass.append("use").attr("xlink:href","#rose");
|
||||
// prolongate rose lines
|
||||
svg.select("g#rose > g#sL > line#sL1").attr("y1", -19000).attr("y2", 19000);
|
||||
svg.select("g#rose > g#sL > line#sL2").attr("x1", -19000).attr("x2", 19000);
|
||||
shiftCompass();
|
||||
}
|
||||
if (event && event.ctrlKey) editStyle("compass");
|
||||
} else {
|
||||
|
|
@ -1010,8 +1010,11 @@ function toggleTexture(event) {
|
|||
turnButtonOn("toggleTexture");
|
||||
// append default texture image selected by default. Don't append on load to not harm performance
|
||||
if (!texture.selectAll("*").size()) {
|
||||
texture.append("image").attr("x", 0).attr("y", 0).attr("width", graphWidth).attr("height", graphHeight)
|
||||
.attr('xlink:href', getDefaultTexture()).attr('preserveAspectRatio', "xMidYMid slice");
|
||||
const x = +styleTextureShiftX.value, y = +styleTextureShiftY.value;
|
||||
const href = styleTextureInput.value === "default" ? getDefaultTexture() : setBase64Texture(styleTextureInput.value);
|
||||
texture.append("image").attr("id", "textureImage")
|
||||
.attr("x", x).attr("y", y).attr("width", graphWidth - x).attr("height", graphHeight - y)
|
||||
.attr("xlink:href", href).attr("preserveAspectRatio", "xMidYMid slice");
|
||||
}
|
||||
$('#texture').fadeIn();
|
||||
zoom.scaleBy(svg, 1.00001); // enforce browser re-draw
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ function editNamesbase() {
|
|||
document.getElementById("namesbaseAdd").addEventListener("click", namesbaseAdd);
|
||||
document.getElementById("namesbaseDefault").addEventListener("click", namesbaseRestoreDefault);
|
||||
document.getElementById("namesbaseDownload").addEventListener("click", namesbaseDownload);
|
||||
document.getElementById("namesbaseUpload").addEventListener("click", e => namesbaseToLoad.click());
|
||||
document.getElementById("namesbaseToLoad").addEventListener("change", namesbaseUpload);
|
||||
document.getElementById("namesbaseUpload").addEventListener("click", () => namesbaseToLoad.click());
|
||||
document.getElementById("namesbaseToLoad").addEventListener("change", function() {uploadFile(this, namesbaseUpload)});
|
||||
|
||||
createBasesList();
|
||||
updateInputs();
|
||||
|
|
@ -138,36 +138,23 @@ function editNamesbase() {
|
|||
}
|
||||
|
||||
function namesbaseDownload() {
|
||||
const data = nameBases.map((b,i) => `${b.name}|${b.min}|${b.max}|${b.d}|${b.m}|${b.b}`);
|
||||
const dataBlob = new Blob([data.join("\r\n")], {type:"text/plain"});
|
||||
const url = window.URL.createObjectURL(dataBlob);
|
||||
const link = document.createElement("a");
|
||||
link.download = getFileName("Namesbase") + ".txt";
|
||||
link.href = url;
|
||||
link.click();
|
||||
const data = nameBases.map((b,i) => `${b.name}|${b.min}|${b.max}|${b.d}|${b.m}|${b.b}`).join("\r\n");
|
||||
const name = getFileName("Namesbase") + ".txt";
|
||||
downloadFile(data, name);
|
||||
}
|
||||
|
||||
function namesbaseUpload() {
|
||||
const fileToLoad = this.files[0];
|
||||
this.value = "";
|
||||
const fileReader = new FileReader();
|
||||
function namesbaseUpload(dataLoaded) {
|
||||
const data = dataLoaded.split("\r\n");
|
||||
if (!data || !data[0]) {tip("Cannot load a namesbase. Please check the data format", false, "error"); return;}
|
||||
|
||||
fileReader.onload = function(fileLoadedEvent) {
|
||||
const dataLoaded = fileLoadedEvent.target.result;
|
||||
const data = dataLoaded.split("\r\n");
|
||||
if (!data || !data[0]) {tip("Cannot load a namesbase. Please check the data format", false, "error"); return;}
|
||||
Names.clearChains();
|
||||
nameBases = [];
|
||||
data.forEach(d => {
|
||||
const e = d.split("|");
|
||||
nameBases.push({name:e[0], min:e[1], max:e[2], d:e[3], m:e[4], b:e[5]});
|
||||
});
|
||||
|
||||
Names.clearChains();
|
||||
nameBases = [];
|
||||
data.forEach(d => {
|
||||
const e = d.split("|");
|
||||
nameBases.push({name:e[0], min:e[1], max:e[2], d:e[3], m:e[4], b:e[5]});
|
||||
});
|
||||
|
||||
createBasesList();
|
||||
updateInputs();
|
||||
};
|
||||
|
||||
fileReader.readAsText(fileToLoad, "UTF-8");
|
||||
}
|
||||
createBasesList();
|
||||
updateInputs();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ function editNotes(id, name) {
|
|||
document.getElementById("notesFocus").addEventListener("click", validateHighlightElement);
|
||||
document.getElementById("notesDownload").addEventListener("click", downloadLegends);
|
||||
document.getElementById("notesUpload").addEventListener("click", () => legendsToLoad.click());
|
||||
document.getElementById("legendsToLoad").addEventListener("change", uploadLegends);
|
||||
document.getElementById("legendsToLoad").addEventListener("change", function() {uploadFile(this, uploadLegends)});
|
||||
document.getElementById("notesRemove").addEventListener("click", triggernotesRemove);
|
||||
|
||||
function changeObject() {
|
||||
|
|
@ -104,30 +104,16 @@ function editNotes(id, name) {
|
|||
}
|
||||
|
||||
function downloadLegends() {
|
||||
const legendString = JSON.stringify(notes);
|
||||
const dataBlob = new Blob([legendString],{type:"text/plain"});
|
||||
const url = window.URL.createObjectURL(dataBlob);
|
||||
const link = document.createElement("a");
|
||||
link.download = getFileName("Notes") + ".txt";
|
||||
link.href = url;
|
||||
link.click();
|
||||
const data = JSON.stringify(notes);
|
||||
const name = getFileName("Notes") + ".txt";
|
||||
downloadFile(data, name);
|
||||
}
|
||||
|
||||
function uploadLegends() {
|
||||
const fileToLoad = this.files[0];
|
||||
this.value = "";
|
||||
const fileReader = new FileReader();
|
||||
fileReader.onload = function(fileLoadedEvent) {
|
||||
const dataLoaded = fileLoadedEvent.target.result;
|
||||
if (dataLoaded) {
|
||||
notes = JSON.parse(dataLoaded);
|
||||
document.getElementById("notesSelect").options.length = 0;
|
||||
editNotes(notes[0].id, notes[0].name);
|
||||
} else {
|
||||
tip("Cannot load a file. Please check the data format", false, "error")
|
||||
}
|
||||
}
|
||||
fileReader.readAsText(fileToLoad, "UTF-8");
|
||||
function uploadLegends(dataLoaded) {
|
||||
if (!dataLoaded) {tip("Cannot load the file. Please check the data format", false, "error"); return;}
|
||||
notes = JSON.parse(dataLoaded);
|
||||
document.getElementById("notesSelect").options.length = 0;
|
||||
editNotes(notes[0].id, notes[0].name);
|
||||
}
|
||||
|
||||
function triggernotesRemove() {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// UI module to control the options (style, preferences)
|
||||
// UI module to control the options (preferences)
|
||||
"use strict";
|
||||
|
||||
$("#optionsContainer").draggable({handle: ".drag-trigger", snap: "svg", snapMode: "both"});
|
||||
|
|
@ -82,605 +82,6 @@ function collapse(e) {
|
|||
}
|
||||
}
|
||||
|
||||
// select element to be edited
|
||||
function editStyle(element, group) {
|
||||
showOptions();
|
||||
styleTab.click();
|
||||
styleElementSelect.value = element;
|
||||
if (group) styleGroupSelect.options.add(new Option(group, group, true, true));
|
||||
selectStyleElement();
|
||||
|
||||
styleElementSelect.classList.add("glow");
|
||||
if (group) styleGroupSelect.classList.add("glow");
|
||||
setTimeout(() => {
|
||||
styleElementSelect.classList.remove("glow");
|
||||
if (group) styleGroupSelect.classList.remove("glow");
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
// Toggle style sections on element select
|
||||
styleElementSelect.addEventListener("change", selectStyleElement);
|
||||
function selectStyleElement() {
|
||||
const sel = styleElementSelect.value;
|
||||
let el = d3.select("#"+sel);
|
||||
|
||||
styleElements.querySelectorAll("tbody").forEach(e => e.style.display = "none"); // hide all sections
|
||||
const off = el.style("display") === "none" || !el.selectAll("*").size(); // check if layer is off
|
||||
if (off) {
|
||||
styleIsOff.style.display = "block";
|
||||
setTimeout(() => styleIsOff.style.display = "none", 1500);
|
||||
}
|
||||
|
||||
// active group element
|
||||
const group = styleGroupSelect.value;
|
||||
if (sel == "ocean") el = oceanLayers.select("rect");
|
||||
else if (sel == "routes" || sel == "labels" || sel === "coastline" || sel == "lakes" || sel == "anchors" || sel == "burgIcons" || sel == "borders") {
|
||||
el = d3.select("#"+sel).select("g#"+group).size()
|
||||
? d3.select("#"+sel).select("g#"+group)
|
||||
: d3.select("#"+sel).select("g");
|
||||
}
|
||||
|
||||
if (sel !== "landmass" && sel !== "legend") {
|
||||
// opacity
|
||||
styleOpacity.style.display = "block";
|
||||
styleOpacityInput.value = styleOpacityOutput.value = el.attr("opacity") || 1;
|
||||
|
||||
// filter
|
||||
styleFilter.style.display = "block";
|
||||
if (sel == "ocean") el = oceanLayers;
|
||||
styleFilterInput.value = el.attr("filter") || "";
|
||||
}
|
||||
|
||||
// fill
|
||||
if (sel === "rivers" || sel === "lakes" || sel === "landmass" || sel === "prec" || sel === "fogging") {
|
||||
styleFill.style.display = "block";
|
||||
styleFillInput.value = styleFillOutput.value = el.attr("fill");
|
||||
}
|
||||
|
||||
// stroke color and width
|
||||
if (sel === "routes" || sel === "lakes" || sel === "borders" || sel === "relig" || sel === "cults" || sel === "cells" || sel === "gridOverlay" || sel === "coastline" || sel === "prec" || sel === "icons" || sel === "coordinates"|| sel === "zones") {
|
||||
styleStroke.style.display = "block";
|
||||
styleStrokeInput.value = styleStrokeOutput.value = el.attr("stroke");
|
||||
styleStrokeWidth.style.display = "block";
|
||||
styleStrokeWidthInput.value = styleStrokeWidthOutput.value = el.attr("stroke-width") || "";
|
||||
}
|
||||
|
||||
// stroke width
|
||||
if (sel === "fogging") {
|
||||
styleStrokeWidth.style.display = "block";
|
||||
styleStrokeWidthInput.value = styleStrokeWidthOutput.value = el.attr("stroke-width") || "";
|
||||
}
|
||||
|
||||
// stroke dash
|
||||
if (sel === "routes" || sel === "borders" || sel === "gridOverlay" || sel === "temperature" || sel === "legend" || sel === "population" || sel === "coordinates"|| sel === "zones") {
|
||||
styleStrokeDash.style.display = "block";
|
||||
styleStrokeDasharrayInput.value = el.attr("stroke-dasharray") || "";
|
||||
styleStrokeLinecapInput.value = el.attr("stroke-linecap") || "inherit";
|
||||
}
|
||||
|
||||
// clipping
|
||||
if (sel === "cells" || sel === "gridOverlay" || sel === "coordinates" || sel === "compass" || sel === "terrain" || sel === "temperature" || sel === "routes" || sel === "texture" || sel === "biomes"|| sel === "zones") {
|
||||
styleClipping.style.display = "block";
|
||||
styleClippingInput.value = el.attr("mask") || "";
|
||||
}
|
||||
|
||||
// shift (translate)
|
||||
if (sel === "gridOverlay") {
|
||||
styleShift.style.display = "block";
|
||||
const tr = parseTransform(el.attr("transform"));
|
||||
styleShiftX.value = tr[0];
|
||||
styleShiftY.value = tr[1];
|
||||
}
|
||||
|
||||
if (sel === "compass") {
|
||||
styleCompass.style.display = "block";
|
||||
const tr = parseTransform(d3.select("#rose").attr("transform"));
|
||||
styleCompassShiftX.value = tr[0];
|
||||
styleCompassShiftY.value = tr[1];
|
||||
styleCompassSizeInput.value = styleCompassSizeOutput.value = tr[2];
|
||||
}
|
||||
|
||||
// show specific sections
|
||||
if (sel === "terrs") styleHeightmap.style.display = "block";
|
||||
if (sel === "gridOverlay") styleGrid.style.display = "block";
|
||||
if (sel === "terrain") styleRelief.style.display = "block";
|
||||
if (sel === "texture") styleTexture.style.display = "block";
|
||||
if (sel === "routes" || sel === "labels" || sel == "anchors" || sel == "burgIcons" || sel === "coastline" || sel === "lakes" || sel === "borders") styleGroup.style.display = "block";
|
||||
if (sel === "markers") styleMarkers.style.display = "block";
|
||||
|
||||
if (sel === "population") {
|
||||
stylePopulation.style.display = "block";
|
||||
stylePopulationRuralStrokeInput.value = stylePopulationRuralStrokeOutput.value = population.select("#rural").attr("stroke");
|
||||
stylePopulationUrbanStrokeInput.value = stylePopulationUrbanStrokeOutput.value = population.select("#urban").attr("stroke");
|
||||
styleStrokeWidth.style.display = "block";
|
||||
styleStrokeWidthInput.value = styleStrokeWidthOutput.value = el.attr("stroke-width") || "";
|
||||
}
|
||||
|
||||
if (sel === "regions") {
|
||||
styleStates.style.display = "block";
|
||||
styleStatesHaloWidth.value = styleStatesHaloWidthOutput.value = statesHalo.attr("stroke-width");
|
||||
styleStatesHaloOpacity.value = styleStatesHaloOpacityOutput.value = statesHalo.attr("opacity");
|
||||
}
|
||||
|
||||
if (sel === "labels") {
|
||||
styleFill.style.display = "block";
|
||||
styleStroke.style.display = "block";
|
||||
styleStrokeWidth.style.display = "block";
|
||||
loadDefaultFonts();
|
||||
styleFont.style.display = "block";
|
||||
styleSize.style.display = "block";
|
||||
styleVisibility.style.display = "block";
|
||||
styleFillInput.value = styleFillOutput.value = el.attr("fill") || "#3e3e4b";
|
||||
styleStrokeInput.value = styleStrokeOutput.value = el.attr("stroke") || "#3a3a3a";
|
||||
styleStrokeWidthInput.value = styleStrokeWidthOutput.value = el.attr("stroke-width") || 0;
|
||||
styleSelectFont.value = fonts.indexOf(el.attr("data-font"));
|
||||
styleInputFont.style.display = "none";
|
||||
styleInputFont.value = "";
|
||||
styleFontSize.value = el.attr("data-size");
|
||||
}
|
||||
|
||||
if (sel == "burgIcons") {
|
||||
styleFill.style.display = "block";
|
||||
styleStroke.style.display = "block";
|
||||
styleStrokeWidth.style.display = "block";
|
||||
styleStrokeDash.style.display = "block";
|
||||
styleRadius.style.display = "block";
|
||||
styleFillInput.value = styleFillOutput.value = el.attr("fill") || "#ffffff";
|
||||
styleStrokeInput.value = styleStrokeOutput.value = el.attr("stroke") || "#3e3e4b";
|
||||
styleStrokeWidthInput.value = styleStrokeWidthOutput.value = el.attr("stroke-width") || .24;
|
||||
styleStrokeDasharrayInput.value = el.attr("stroke-dasharray") || "";
|
||||
styleStrokeLinecapInput.value = el.attr("stroke-linecap") || "inherit";
|
||||
styleRadiusInput.value = el.attr("size") || 1;
|
||||
}
|
||||
|
||||
if (sel == "anchors") {
|
||||
styleFill.style.display = "block";
|
||||
styleStroke.style.display = "block";
|
||||
styleStrokeWidth.style.display = "block";
|
||||
styleIconSize.style.display = "block";
|
||||
styleFillInput.value = styleFillOutput.value = el.attr("fill") || "#ffffff";
|
||||
styleStrokeInput.value = styleStrokeOutput.value = el.attr("stroke") || "#3e3e4b";
|
||||
styleStrokeWidthInput.value = styleStrokeWidthOutput.value = el.attr("stroke-width") || .24;
|
||||
styleIconSizeInput.value = el.attr("size") || 2;
|
||||
}
|
||||
|
||||
if (sel === "legend") {
|
||||
styleStroke.style.display = "block";
|
||||
styleStrokeWidth.style.display = "block";
|
||||
loadDefaultFonts();
|
||||
styleFont.style.display = "block";
|
||||
styleSize.style.display = "block";
|
||||
styleLegend.style.display = "block";
|
||||
|
||||
styleStrokeInput.value = styleStrokeOutput.value = el.attr("stroke") || "#111111";
|
||||
styleStrokeWidthInput.value = styleStrokeWidthOutput.value = el.attr("stroke-width") || .5;
|
||||
styleSelectFont.value = fonts.indexOf(el.attr("data-font"));
|
||||
styleInputFont.style.display = "none";
|
||||
styleInputFont.value = "";
|
||||
styleFontSize.value = el.attr("data-size");
|
||||
}
|
||||
|
||||
if (sel === "ocean") {
|
||||
styleOcean.style.display = "block";
|
||||
styleOceanBack.value = styleOceanBackOutput.value = svg.attr("background-color");
|
||||
styleOceanFore.value = styleOceanForeOutput.value = oceanLayers.select("rect").attr("fill");
|
||||
}
|
||||
|
||||
if (sel === "coastline") {
|
||||
if (styleGroupSelect.value === "sea_island") {
|
||||
styleCoastline.style.display = "block";
|
||||
if (styleCoastlineAuto.checked) styleFilter.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
if (sel === "temperature") {
|
||||
styleStrokeWidth.style.display = "block";
|
||||
styleTemperature.style.display = "block";
|
||||
styleStrokeWidthInput.value = styleStrokeWidthOutput.value = el.attr("stroke-width") || "";
|
||||
styleTemperatureFillOpacityInput.value = styleTemperatureFillOpacityOutput.value = el.attr("fill-opacity") || .1;
|
||||
styleTemperatureFillInput.value = styleTemperatureFillOutput.value = el.attr("fill") || "#000";
|
||||
styleTemperatureFontSizeInput.value = styleTemperatureFontSizeOutput.value = el.attr("font-size") || "8px";;
|
||||
}
|
||||
|
||||
if (sel === "coordinates") {
|
||||
styleSize.style.display = "block";
|
||||
styleFontSize.value = el.attr("data-size");
|
||||
}
|
||||
|
||||
// update group options
|
||||
styleGroupSelect.options.length = 0; // remove all options
|
||||
if (sel === "routes" || sel === "labels" || sel === "coastline" || sel === "lakes" || sel === "anchors" || sel === "burgIcons" || sel === "borders") {
|
||||
document.getElementById(sel).querySelectorAll("g").forEach(el => {
|
||||
if (el.id === "burgLabels") return;
|
||||
const count = el.childElementCount;
|
||||
styleGroupSelect.options.add(new Option(`${el.id} (${count})`, el.id, false, false));
|
||||
});
|
||||
styleGroupSelect.value = el.attr("id");
|
||||
} else {
|
||||
styleGroupSelect.options.add(new Option(sel, sel, false, true));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Handle style inputs change
|
||||
styleGroupSelect.addEventListener("change", selectStyleElement);
|
||||
|
||||
function getEl() {
|
||||
const el = styleElementSelect.value, g = styleGroupSelect.value;
|
||||
if (g === el) return svg.select("#"+el); else return svg.select("#"+el).select("#"+g);
|
||||
}
|
||||
|
||||
styleFillInput.addEventListener("input", function() {
|
||||
styleFillOutput.value = this.value;
|
||||
getEl().attr('fill', this.value);
|
||||
});
|
||||
|
||||
styleStrokeInput.addEventListener("input", function() {
|
||||
styleStrokeOutput.value = this.value;
|
||||
getEl().attr('stroke', this.value);
|
||||
});
|
||||
|
||||
styleStrokeWidthInput.addEventListener("input", function() {
|
||||
styleStrokeWidthOutput.value = this.value;
|
||||
getEl().attr('stroke-width', +this.value);
|
||||
});
|
||||
|
||||
styleStrokeDasharrayInput.addEventListener("input", function() {
|
||||
getEl().attr('stroke-dasharray', this.value);
|
||||
});
|
||||
|
||||
styleStrokeLinecapInput.addEventListener("change", function() {
|
||||
getEl().attr('stroke-linecap', this.value);
|
||||
});
|
||||
|
||||
styleOpacityInput.addEventListener("input", function() {
|
||||
styleOpacityOutput.value = this.value;
|
||||
getEl().attr('opacity', this.value);
|
||||
});
|
||||
|
||||
styleFilterInput.addEventListener("change", function() {
|
||||
if (styleGroupSelect.value === "ocean") {oceanLayers.attr('filter', this.value); return;}
|
||||
getEl().attr('filter', this.value);
|
||||
});
|
||||
|
||||
styleTextureInput.addEventListener("change", function() {
|
||||
if (this.value === "none") texture.select("image").attr("xlink:href", ""); else
|
||||
if (this.value === "default") texture.select("image").attr("xlink:href", getDefaultTexture()); else
|
||||
setBase64Texture(this.value);
|
||||
});
|
||||
|
||||
styleTextureShiftX.addEventListener("input", function() {
|
||||
texture.select("image").attr("x", this.value).attr("width", graphWidth - this.valueAsNumber);
|
||||
});
|
||||
|
||||
styleTextureShiftY.addEventListener("input", function() {
|
||||
texture.select("image").attr("y", this.value).attr("height", graphHeight - this.valueAsNumber);
|
||||
});
|
||||
|
||||
styleClippingInput.addEventListener("change", function() {
|
||||
getEl().attr('mask', this.value);
|
||||
});
|
||||
|
||||
styleGridType.addEventListener("change", function() {
|
||||
if (layerIsOn("toggleGrid")) drawGrid();
|
||||
calculateFriendlyGridSize();
|
||||
});
|
||||
|
||||
styleGridSize.addEventListener("input", function() {
|
||||
if (layerIsOn("toggleGrid")) drawGrid();
|
||||
calculateFriendlyGridSize();
|
||||
});
|
||||
|
||||
function calculateFriendlyGridSize() {
|
||||
const square = styleGridType.value === "square";
|
||||
const size = square ? styleGridSize.value : styleGridSize.value * Math.cos(30 * Math.PI / 180) * 2;
|
||||
const friendly = `${rn(size * distanceScaleInput.value, 2)} ${distanceUnitInput.value}`;
|
||||
styleGridSizeFriendly.value = friendly;
|
||||
}
|
||||
|
||||
styleShiftX.addEventListener("input", shiftElement);
|
||||
styleShiftY.addEventListener("input", shiftElement);
|
||||
|
||||
function shiftElement() {
|
||||
const x = styleShiftX.value || 0;
|
||||
const y = styleShiftY.value || 0;
|
||||
getEl().attr("transform", `translate(${x},${y})`);
|
||||
}
|
||||
|
||||
styleOceanBack.addEventListener("input", function() {
|
||||
svg.style("background-color", this.value);
|
||||
styleOceanBackOutput.value = this.value;
|
||||
});
|
||||
|
||||
styleOceanFore.addEventListener("input", function() {
|
||||
oceanLayers.select("rect").attr("fill", this.value);
|
||||
styleOceanForeOutput.value = this.value;
|
||||
});
|
||||
|
||||
styleOceanPattern.addEventListener("change", function() {
|
||||
svg.select("pattern#oceanic rect").attr("filter", this.value);
|
||||
});
|
||||
|
||||
outlineLayersInput.addEventListener("change", function() {
|
||||
oceanLayers.selectAll("path").remove();
|
||||
OceanLayers();
|
||||
});
|
||||
|
||||
styleReliefSet.addEventListener("change", function() {
|
||||
ReliefIcons();
|
||||
if (!layerIsOn("toggleRelief")) toggleRelief();
|
||||
});
|
||||
|
||||
styleReliefSizeInput.addEventListener("input", function() {
|
||||
styleReliefSizeOutput.value = this.value;
|
||||
const size = +this.value;
|
||||
|
||||
terrain.selectAll("use").each(function(d) {
|
||||
const newSize = this.getAttribute("data-size") * size;
|
||||
const shift = (newSize - +this.getAttribute("width")) / 2;
|
||||
this.setAttribute("width", newSize);
|
||||
this.setAttribute("height", newSize);
|
||||
const x = +this.getAttribute("x");
|
||||
const y = +this.getAttribute("y");
|
||||
this.setAttribute("x", x - shift);
|
||||
this.setAttribute("y", y - shift);
|
||||
});
|
||||
});
|
||||
|
||||
styleReliefDensityInput.addEventListener("input", function() {
|
||||
styleReliefDensityOutput.value = rn(this.value * 100) + "%";
|
||||
ReliefIcons();
|
||||
if (!layerIsOn("toggleRelief")) toggleRelief();
|
||||
});
|
||||
|
||||
styleTemperatureFillOpacityInput.addEventListener("input", function() {
|
||||
temperature.attr("fill-opacity", this.value);
|
||||
styleTemperatureFillOpacityOutput.value = this.value;
|
||||
});
|
||||
|
||||
styleTemperatureFontSizeInput.addEventListener("input", function() {
|
||||
temperature.attr("font-size", this.value + "px");
|
||||
styleTemperatureFontSizeOutput.value = this.value + "px";
|
||||
});
|
||||
|
||||
styleTemperatureFillInput.addEventListener("input", function() {
|
||||
temperature.attr("fill", this.value);
|
||||
styleTemperatureFillOutput.value = this.value;
|
||||
});
|
||||
|
||||
stylePopulationRuralStrokeInput.addEventListener("input", function() {
|
||||
population.select("#rural").attr("stroke", this.value);
|
||||
stylePopulationRuralStrokeOutput.value = this.value;
|
||||
});
|
||||
|
||||
stylePopulationUrbanStrokeInput.addEventListener("input", function() {
|
||||
population.select("#urban").attr("stroke", this.value);
|
||||
stylePopulationUrbanStrokeOutput.value = this.value;
|
||||
});
|
||||
|
||||
styleCompassSizeInput.addEventListener("input", function() {
|
||||
styleCompassSizeOutput.value = this.value;
|
||||
shiftCompass();
|
||||
});
|
||||
|
||||
styleCompassShiftX.addEventListener("input", shiftCompass);
|
||||
styleCompassShiftY.addEventListener("input", shiftCompass);
|
||||
|
||||
function shiftCompass() {
|
||||
const tr = `translate(${styleCompassShiftX.value} ${styleCompassShiftY.value}) scale(${styleCompassSizeInput.value})`;
|
||||
d3.select("#rose").attr("transform", tr);
|
||||
}
|
||||
|
||||
styleLegendColItems.addEventListener("input", function() {
|
||||
styleLegendColItemsOutput.value = this.value;
|
||||
redrawLegend();
|
||||
});
|
||||
|
||||
styleLegendBack.addEventListener("input", function() {
|
||||
legend.select("rect").attr("fill", this.value)
|
||||
});
|
||||
|
||||
styleLegendOpacity.addEventListener("input", function() {
|
||||
styleLegendOpacityOutput.value = this.value;
|
||||
legend.select("rect").attr("fill-opacity", this.value)
|
||||
});
|
||||
|
||||
styleSelectFont.addEventListener("change", changeFont);
|
||||
function changeFont() {
|
||||
const value = styleSelectFont.value;
|
||||
const font = fonts[value].split(':')[0].replace(/\+/g, " ");
|
||||
getEl().attr("font-family", font).attr("data-font", fonts[value]);
|
||||
if (styleElementSelect.value === "legend") redrawLegend();
|
||||
}
|
||||
|
||||
styleFontAdd.addEventListener("click", function() {
|
||||
if (styleInputFont.style.display === "none") {
|
||||
styleInputFont.style.display = "inline-block";
|
||||
styleInputFont.focus();
|
||||
styleSelectFont.style.display = "none";
|
||||
} else {
|
||||
styleInputFont.style.display = "none";
|
||||
styleSelectFont.style.display = "inline-block";
|
||||
}
|
||||
});
|
||||
|
||||
styleInputFont.addEventListener("change", function() {
|
||||
if (!this.value) {tip("Please provide a valid Google font name or link to a @font-face declaration"); return;}
|
||||
fetchFonts(this.value).then(fetched => {
|
||||
if (!fetched) return;
|
||||
styleFontAdd.click();
|
||||
styleInputFont.value = "";
|
||||
if (fetched !== 1) return;
|
||||
styleSelectFont.value = fonts.length-1;
|
||||
changeFont(); // auto-change font if 1 font is fetched
|
||||
});
|
||||
});
|
||||
|
||||
styleFontSize.addEventListener("change", function() {
|
||||
changeFontSize(+this.value);
|
||||
});
|
||||
|
||||
styleFontPlus.addEventListener("click", function() {
|
||||
const size = Math.max(rn(getEl().attr("data-size") * 1.1, 2), 1);
|
||||
changeFontSize(size);
|
||||
});
|
||||
|
||||
styleFontMinus.addEventListener("click", function() {
|
||||
const size = Math.max(rn(getEl().attr("data-size") * .9, 2), 1);
|
||||
changeFontSize(size);
|
||||
});
|
||||
|
||||
function changeFontSize(size) {
|
||||
const legend = styleElementSelect.value === "legend";
|
||||
const coords = styleElementSelect.value === "coordinates";
|
||||
|
||||
const desSize = legend ? size : coords ? rn(size / scale ** .8, 2) : rn(size + (size / scale));
|
||||
getEl().attr("data-size", size).attr("font-size", desSize);
|
||||
styleFontSize.value = size;
|
||||
if (legend) redrawLegend();
|
||||
}
|
||||
|
||||
styleRadiusInput.addEventListener("change", function() {
|
||||
changeRadius(+this.value);
|
||||
});
|
||||
|
||||
styleRadiusPlus.addEventListener("click", function() {
|
||||
const size = Math.max(rn(getEl().attr("size") * 1.1, 2), .2);
|
||||
changeRadius(size);
|
||||
});
|
||||
|
||||
styleRadiusMinus.addEventListener("click", function() {
|
||||
const size = Math.max(rn(getEl().attr("size") * .9, 2), .2);
|
||||
changeRadius(size);
|
||||
});
|
||||
|
||||
function changeRadius(size) {
|
||||
getEl().attr("size", size)
|
||||
getEl().selectAll("circle").each(function() {this.setAttribute("r", size)});
|
||||
styleRadiusInput.value = size;
|
||||
const group = getEl().attr("id");
|
||||
burgLabels.select("g#"+group).selectAll("text").each(function() {this.setAttribute("dy", `${size * -1.5}px`)});
|
||||
changeIconSize(size * 2, group); // change also anchor icons
|
||||
}
|
||||
|
||||
styleIconSizeInput.addEventListener("change", function() {
|
||||
changeIconSize(+this.value);
|
||||
});
|
||||
|
||||
styleIconSizePlus.addEventListener("click", function() {
|
||||
const size = Math.max(rn(getEl().attr("size") * 1.1, 2), .2);
|
||||
changeIconSize(size);
|
||||
});
|
||||
|
||||
styleIconSizeMinus.addEventListener("click", function() {
|
||||
const size = Math.max(rn(getEl().attr("size") * .9, 2), .2);
|
||||
changeIconSize(size);
|
||||
});
|
||||
|
||||
function changeIconSize(size, group) {
|
||||
const el = group ? anchors.select("#"+group) : getEl();
|
||||
const oldSize = +el.attr("size");
|
||||
const shift = (size - oldSize) / 2;
|
||||
el.attr("size", size);
|
||||
el.selectAll("use").each(function() {
|
||||
const x = +this.getAttribute("x");
|
||||
const y = +this.getAttribute("y");
|
||||
this.setAttribute("x", x - shift);
|
||||
this.setAttribute("y", y - shift);
|
||||
this.setAttribute("width", size);
|
||||
this.setAttribute("height", size);
|
||||
});;
|
||||
styleIconSizeInput.value = size;
|
||||
}
|
||||
|
||||
styleStatesHaloWidth.addEventListener("input", function() {
|
||||
styleStatesHaloWidthOutput.value = this.value;
|
||||
statesHalo.attr("stroke-width", +this.value);
|
||||
});
|
||||
|
||||
styleStatesHaloOpacity.addEventListener("input", function() {
|
||||
styleStatesHaloOpacityOutput.value = this.value;
|
||||
statesHalo.attr("opacity", +this.value);
|
||||
});
|
||||
|
||||
// request to restore default style on button click
|
||||
function askToRestoreDefaultStyle() {
|
||||
if (customization) {tip("Please exit the customization mode first", false, "error"); return;}
|
||||
alertMessage.innerHTML = "Are you sure you want to restore default style for all elements?";
|
||||
$("#alert").dialog({resizable: false, title: "Restore default style",
|
||||
buttons: {
|
||||
Restore: function() {
|
||||
applyDefaultStyle();
|
||||
selectStyleElement();
|
||||
$(this).dialog("close");
|
||||
},
|
||||
Cancel: function() {$(this).dialog("close");}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// request a URL to image to be used as a texture
|
||||
function textureProvideURL() {
|
||||
alertMessage.innerHTML = `Provide an image URL to be used as a texture:
|
||||
<input id="textureURL" type="url" style="width: 24em" placeholder="http://www.example.com/image.jpg" oninput="fetchTextureURL(this.value)">
|
||||
<div style="border: 1px solid darkgrey; height: 144px; margin-top: 2px"><canvas id="preview" width="256px" height="144px"></canvas></div>`;
|
||||
$("#alert").dialog({resizable: false, title: "Load custom texture", width: "26em",
|
||||
buttons: {
|
||||
Apply: function() {
|
||||
const name = textureURL.value.split("/").pop();
|
||||
if (!name || name === "") {tip("Please provide a valid URL", false, "error"); return;}
|
||||
const opt = document.createElement("option");
|
||||
opt.value = textureURL.value;
|
||||
opt.text = name.slice(0, 20);
|
||||
styleTextureInput.add(opt);
|
||||
styleTextureInput.value = textureURL.value;
|
||||
setBase64Texture(textureURL.value);
|
||||
zoom.scaleBy(svg, 1.00001); // enforce browser re-draw
|
||||
$(this).dialog("close");
|
||||
},
|
||||
Cancel: function() {$(this).dialog("close");}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function setBase64Texture(url) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onload = function() {
|
||||
var reader = new FileReader();
|
||||
reader.onloadend = function() {
|
||||
texture.select("image").attr("xlink:href", reader.result);
|
||||
}
|
||||
reader.readAsDataURL(xhr.response);
|
||||
};
|
||||
xhr.open('GET', url);
|
||||
xhr.responseType = 'blob';
|
||||
xhr.send();
|
||||
};
|
||||
|
||||
function fetchTextureURL(url) {
|
||||
console.log("Provided URL is", url);
|
||||
const img = new Image();
|
||||
img.onload = function () {
|
||||
const canvas = document.getElementById("preview");
|
||||
const ctx = canvas.getContext("2d");
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
||||
};
|
||||
img.src = url;
|
||||
}
|
||||
|
||||
// Style map filters handler
|
||||
mapFilters.addEventListener("click", applyMapFilter);
|
||||
function applyMapFilter(event) {
|
||||
if (event.target.tagName !== "BUTTON") return;
|
||||
const button = event.target;
|
||||
svg.attr("filter", null);
|
||||
if (button.classList.contains("pressed")) {button.classList.remove("pressed"); return;}
|
||||
mapFilters.querySelectorAll(".pressed").forEach(button => button.classList.remove("pressed"));
|
||||
button.classList.add("pressed");
|
||||
svg.attr("filter", "url(#filter-" + button.id + ")");
|
||||
}
|
||||
|
||||
// Option listeners
|
||||
const optionsContent = document.getElementById("optionsContent");
|
||||
optionsContent.addEventListener("input", function(event) {
|
||||
|
|
@ -883,6 +284,9 @@ function applyStoredOptions() {
|
|||
if (input) input.value = value;
|
||||
if (output) output.value = value;
|
||||
lock(stored);
|
||||
|
||||
// add saved style presets to options
|
||||
if(stored.slice(0,5) === "style") applyOption(stylePreset, stored, stored.slice(5));
|
||||
}
|
||||
|
||||
if (localStorage.getItem("winds")) winds = localStorage.getItem("winds").split(",").map(w => +w);
|
||||
|
|
@ -907,10 +311,11 @@ function randomizeOptions() {
|
|||
if (!locked("power")) powerInput.value = powerOutput.value = gauss(3, 2, 0, 10);
|
||||
if (!locked("neutral")) neutralInput.value = neutralOutput.value = rn(1 + Math.random(), 1);
|
||||
if (!locked("cultures")) culturesInput.value = culturesOutput.value = gauss(12, 3, 5, 30);
|
||||
if (!locked("culturesSet")) culturesSet.value = ra(Array.from(culturesSet.options)).value;
|
||||
changeCultureSet();
|
||||
|
||||
// 'Configure World' settings
|
||||
if (!locked("prec")) precInput.value = precOutput.value = gauss(100, 20, 5, 500);
|
||||
if (!locked("prec")) precInput.value = precOutput.value = gauss(120, 20, 5, 500);
|
||||
const tMax = +temperatureEquatorOutput.max, tMin = +temperatureEquatorOutput.min; // temperature extremes
|
||||
if (!locked("temperatureEquator")) temperatureEquatorOutput.value = temperatureEquatorInput.value = rand(tMax-6, tMax);
|
||||
if (!locked("temperaturePole")) temperaturePoleOutput.value = temperaturePoleInput.value = rand(tMin, tMin+10);
|
||||
|
|
@ -932,91 +337,6 @@ function restoreDefaultOptions() {
|
|||
location.reload();
|
||||
}
|
||||
|
||||
// FONTS
|
||||
// fetch default fonts if not done before
|
||||
function loadDefaultFonts() {
|
||||
if (!$('link[href="fonts.css"]').length) {
|
||||
$("head").append('<link rel="stylesheet" type="text/css" href="fonts.css">');
|
||||
const fontsToAdd = ["Amatic+SC:700", "IM+Fell+English", "Great+Vibes", "MedievalSharp", "Metamorphous",
|
||||
"Nova+Script", "Uncial+Antiqua", "Underdog", "Caesar+Dressing", "Bitter", "Yellowtail", "Montez",
|
||||
"Shadows+Into+Light", "Fredericka+the+Great", "Orbitron", "Dancing+Script:700",
|
||||
"Architects+Daughter", "Kaushan+Script", "Gloria+Hallelujah", "Satisfy", "Comfortaa:700", "Cinzel"];
|
||||
fontsToAdd.forEach(function(f) {if (fonts.indexOf(f) === -1) fonts.push(f);});
|
||||
updateFontOptions();
|
||||
}
|
||||
}
|
||||
|
||||
function fetchFonts(url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (url === "") {
|
||||
tip("Use a direct link to any @font-face declaration or just font name to fetch from Google Fonts");
|
||||
return;
|
||||
}
|
||||
if (url.indexOf("http") === -1) {
|
||||
url = url.replace(url.charAt(0), url.charAt(0).toUpperCase()).split(" ").join("+");
|
||||
url = "https://fonts.googleapis.com/css?family=" + url;
|
||||
}
|
||||
const fetched = addFonts(url).then(fetched => {
|
||||
if (fetched === undefined) {
|
||||
tip("Cannot fetch font for this value!", false, "error");
|
||||
return;
|
||||
}
|
||||
if (fetched === 0) {
|
||||
tip("Already in the fonts list!", false, "error");
|
||||
return;
|
||||
}
|
||||
updateFontOptions();
|
||||
if (fetched === 1) {
|
||||
tip("Font " + fonts[fonts.length - 1] + " is fetched");
|
||||
} else if (fetched > 1) {
|
||||
tip(fetched + " fonts are added to the list");
|
||||
}
|
||||
resolve(fetched);
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function addFonts(url) {
|
||||
$("head").append('<link rel="stylesheet" type="text/css" href="' + url + '">');
|
||||
return fetch(url)
|
||||
.then(resp => resp.text())
|
||||
.then(text => {
|
||||
let s = document.createElement('style');
|
||||
s.innerHTML = text;
|
||||
document.head.appendChild(s);
|
||||
let styleSheet = Array.prototype.filter.call(
|
||||
document.styleSheets,
|
||||
sS => sS.ownerNode === s)[0];
|
||||
let FontRule = rule => {
|
||||
let family = rule.style.getPropertyValue('font-family');
|
||||
let font = family.replace(/['"]+/g, '').replace(/ /g, "+");
|
||||
let weight = rule.style.getPropertyValue('font-weight');
|
||||
if (weight !== "400") font += ":" + weight;
|
||||
if (fonts.indexOf(font) == -1) {
|
||||
fonts.push(font);
|
||||
fetched++
|
||||
}
|
||||
};
|
||||
let fetched = 0;
|
||||
for (let r of styleSheet.cssRules) {FontRule(r);}
|
||||
document.head.removeChild(s);
|
||||
return fetched;
|
||||
})
|
||||
.catch(function() {});
|
||||
}
|
||||
|
||||
// Update font list for Label and Burg Editors
|
||||
function updateFontOptions() {
|
||||
styleSelectFont.innerHTML = "";
|
||||
for (let i=0; i < fonts.length; i++) {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = i;
|
||||
const font = fonts[i].split(':')[0].replace(/\+/g, " ");
|
||||
opt.style.fontFamily = opt.innerHTML = font;
|
||||
styleSelectFont.add(opt);
|
||||
}
|
||||
}
|
||||
|
||||
// Sticked menu Options listeners
|
||||
document.getElementById("sticked").addEventListener("click", function(event) {
|
||||
const id = event.target.id;
|
||||
|
|
@ -1039,6 +359,7 @@ document.getElementById("sticked").addEventListener("click", function(event) {
|
|||
});
|
||||
|
||||
function regeneratePrompt() {
|
||||
if (customization) {tip("New map cannot be generated when edit mode is active, please exit the mode and retry", false, "error"); return;}
|
||||
const workingTime = (Date.now() - last(mapHistory).created) / 60000; // minutes
|
||||
if (workingTime < 5) {regenerateMap(); return;}
|
||||
|
||||
|
|
@ -1100,5 +421,5 @@ document.getElementById("mapToLoad").addEventListener("change", function() {
|
|||
const fileToLoad = this.files[0];
|
||||
this.value = "";
|
||||
closeDialogs();
|
||||
uploadFile(fileToLoad);
|
||||
uploadMap(fileToLoad);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -405,7 +405,7 @@ function editProvinces() {
|
|||
const displayed = provinceNameEditorCustomForm.style.display === "inline-block";
|
||||
provinceNameEditorCustomForm.style.display = displayed ? "none" : "inline-block";
|
||||
provinceNameEditorSelectForm.style.display = displayed ? "inline-block" : "none";
|
||||
if (displayed && value) applyOption(provinceNameEditorSelectForm, value);
|
||||
if (displayed) applyOption(provinceNameEditorSelectForm, value);
|
||||
}
|
||||
|
||||
function regenerateFullName() {
|
||||
|
|
@ -761,9 +761,10 @@ function editProvinces() {
|
|||
|
||||
function downloadProvincesData() {
|
||||
const unit = areaUnit.value === "square" ? distanceUnitInput.value + "2" : areaUnit.value;
|
||||
let data = "Id,Province,Form,State,Color,Capital,Area "+unit+",Population\n"; // headers
|
||||
let data = "Id,Province,Form,State,Color,Capital,Area "+unit+",Total Population,Rural Population,Urban Population\n"; // headers
|
||||
|
||||
body.querySelectorAll(":scope > div").forEach(function(el) {
|
||||
let key = parseInt(el.dataset.id)
|
||||
data += el.dataset.id + ",";
|
||||
data += el.dataset.name + ",";
|
||||
data += el.dataset.form + ",";
|
||||
|
|
@ -771,17 +772,13 @@ function editProvinces() {
|
|||
data += el.dataset.color + ",";
|
||||
data += el.dataset.capital + ",";
|
||||
data += el.dataset.area + ",";
|
||||
data += el.dataset.population + "\n";
|
||||
data += el.dataset.population + ",";
|
||||
data += `${Math.round(pack.provinces[key].rural*populationRate.value)},`
|
||||
data += `${Math.round(pack.provinces[key].urban*populationRate.value * urbanization.value)}\n`
|
||||
});
|
||||
|
||||
const dataBlob = new Blob([data], {type: "text/plain"});
|
||||
const url = window.URL.createObjectURL(dataBlob);
|
||||
const link = document.createElement("a");
|
||||
document.body.appendChild(link);
|
||||
link.download = getFileName("Provinces") + ".csv";
|
||||
link.href = url;
|
||||
link.click();
|
||||
window.setTimeout(function() {window.URL.revokeObjectURL(url);}, 2000);
|
||||
const name = getFileName("Provinces") + ".csv";
|
||||
downloadFile(data, name);
|
||||
}
|
||||
|
||||
function removeAllProvinces() {
|
||||
|
|
|
|||
|
|
@ -611,14 +611,8 @@ function editReligions() {
|
|||
data += el.dataset.population + "\n";
|
||||
});
|
||||
|
||||
const dataBlob = new Blob([data], {type: "text/plain"});
|
||||
const url = window.URL.createObjectURL(dataBlob);
|
||||
const link = document.createElement("a");
|
||||
document.body.appendChild(link);
|
||||
link.download = getFileName("Religions") + ".csv";
|
||||
link.href = url;
|
||||
link.click();
|
||||
window.setTimeout(function() {window.URL.revokeObjectURL(url);}, 2000);
|
||||
const name = getFileName("Religions") + ".csv";
|
||||
downloadFile(data, name);
|
||||
}
|
||||
|
||||
function closeReligionsEditor() {
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ function editStates() {
|
|||
const displayed = stateNameEditorCustomForm.style.display === "inline-block";
|
||||
stateNameEditorCustomForm.style.display = displayed ? "none" : "inline-block";
|
||||
stateNameEditorSelectForm.style.display = displayed ? "inline-block" : "none";
|
||||
if (displayed && value) applyOption(stateNameEditorSelectForm, value);
|
||||
if (displayed) applyOption(stateNameEditorSelectForm, value);
|
||||
}
|
||||
|
||||
function regenerateFullName() {
|
||||
|
|
@ -869,9 +869,10 @@ function editStates() {
|
|||
|
||||
function downloadStatesData() {
|
||||
const unit = areaUnit.value === "square" ? distanceUnitInput.value + "2" : areaUnit.value;
|
||||
let data = "Id,State,Color,Capital,Culture,Type,Expansionism,Cells,Burgs,Area "+unit+",Population\n"; // headers
|
||||
let data = "Id,State,Color,Capital,Culture,Type,Expansionism,Cells,Burgs,Area "+unit+",Total Population,Rural Population,Urban Population\n"; // headers
|
||||
|
||||
body.querySelectorAll(":scope > div").forEach(function(el) {
|
||||
let key = parseInt(el.dataset.id)
|
||||
data += el.dataset.id + ",";
|
||||
data += el.dataset.name + ",";
|
||||
data += el.dataset.color + ",";
|
||||
|
|
@ -882,17 +883,13 @@ function editStates() {
|
|||
data += el.dataset.cells + ",";
|
||||
data += el.dataset.burgs + ",";
|
||||
data += el.dataset.area + ",";
|
||||
data += el.dataset.population + "\n";
|
||||
data += el.dataset.population + ",";
|
||||
data += `${Math.round(pack.states[key].rural*populationRate.value)},`;
|
||||
data += `${Math.round(pack.states[key].urban*populationRate.value * urbanization.value)}\n`;
|
||||
});
|
||||
|
||||
const dataBlob = new Blob([data], {type: "text/plain"});
|
||||
const url = window.URL.createObjectURL(dataBlob);
|
||||
const link = document.createElement("a");
|
||||
document.body.appendChild(link);
|
||||
link.download = getFileName("States") + ".csv";
|
||||
link.href = url;
|
||||
link.click();
|
||||
window.setTimeout(function() {window.URL.revokeObjectURL(url);}, 2000);
|
||||
const name = getFileName("States") + ".csv";
|
||||
downloadFile(data, name);
|
||||
}
|
||||
|
||||
function closeStatesEditor() {
|
||||
|
|
|
|||
1089
modules/ui/style.js
Normal file
1089
modules/ui/style.js
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -66,9 +66,9 @@ function processFeatureRegeneration(button) {
|
|||
}
|
||||
|
||||
function regenerateRivers() {
|
||||
const heights = new Uint8Array(pack.cells.h);
|
||||
const heights = new Float32Array(pack.cells.h);
|
||||
Rivers.generate();
|
||||
pack.cells.h = new Uint8Array(heights);
|
||||
pack.cells.h = new Float32Array(heights);
|
||||
if (!layerIsOn("toggleRivers")) toggleRivers();
|
||||
}
|
||||
|
||||
|
|
@ -95,8 +95,8 @@ function regenerateBurgs() {
|
|||
|
||||
const score = new Int16Array(cells.s.map(s => s * Math.random())); // cell score for capitals placement
|
||||
const sorted = cells.i.filter(i => score[i] > 0 && cells.culture[i]).sort((a, b) => score[b] - score[a]); // filtered and sorted array of indexes
|
||||
const burgsCount = manorsInput.value == 1000 ? rn(sorted.length / 10 / (grid.points.length / 10000) ** .8) + states.length : +manorsInput.value + states.length;
|
||||
const spacing = (graphWidth + graphHeight) / 200 / (burgsCount / 500); // base min distance between towns
|
||||
const burgsCount = manorsInput.value == 1000 ? rn(sorted.length / 5 / (grid.points.length / 10000) ** .8) + states.length : +manorsInput.value + states.length;
|
||||
const spacing = (graphWidth + graphHeight) / 150 / (burgsNumber ** .7 / 66); // base min distance between towns
|
||||
|
||||
for (let i=0; i < sorted.length && burgs.length < burgsCount; i++) {
|
||||
const id = burgs.length;
|
||||
|
|
@ -128,6 +128,7 @@ function regenerateBurgs() {
|
|||
});
|
||||
|
||||
BurgsAndStates.specifyBurgs();
|
||||
BurgsAndStates.defineBurgFeatures();
|
||||
BurgsAndStates.drawBurgs();
|
||||
Routes.regenerate();
|
||||
|
||||
|
|
@ -156,6 +157,25 @@ function regenerateStates() {
|
|||
b.capital = 0;
|
||||
});
|
||||
|
||||
unfog();
|
||||
|
||||
// if desired states number is 0
|
||||
if (regionsInput.value == 0) {
|
||||
tip(`Cannot generate zero states. Please check the <i>States Number</i> option`, false, "warn");
|
||||
pack.states = pack.states.slice(0,1); // remove all except of neutrals
|
||||
pack.states[0].diplomacy = []; // clear diplomacy
|
||||
pack.provinces = [0]; // remove all provinces
|
||||
pack.cells.state = new Uint16Array(pack.cells.i.length); // reset cells data
|
||||
borders.selectAll("path").remove(); // remove borders
|
||||
regions.selectAll("path").remove(); // remove states fill
|
||||
labels.select("#states").selectAll("text"); // remove state labels
|
||||
defs.select("#textPaths").selectAll("path[id*='stateLabel']").remove(); // remove state labels paths
|
||||
|
||||
if (document.getElementById("burgsEditorRefresh").offsetParent) burgsEditorRefresh.click();
|
||||
if (document.getElementById("statesEditorRefresh").offsetParent) statesEditorRefresh.click();
|
||||
return;
|
||||
}
|
||||
|
||||
const neutral = pack.states[0].name;
|
||||
const count = Math.min(+regionsInput.value, burgs.length);
|
||||
let spacing = (graphWidth + graphHeight) / 2 / count; // min distance between capitals
|
||||
|
|
@ -183,7 +203,6 @@ function regenerateStates() {
|
|||
return {i, name, type, capital:capital.i, center:capital.cell, culture, expansionism};
|
||||
});
|
||||
|
||||
unfog();
|
||||
BurgsAndStates.expandStates();
|
||||
BurgsAndStates.normalizeStates();
|
||||
BurgsAndStates.collectStatistics();
|
||||
|
|
@ -374,7 +393,7 @@ function addRiverOnClick() {
|
|||
Keep: function() {$(this).dialog("close");},
|
||||
Restore: function() {
|
||||
$(this).dialog("close");
|
||||
pack.cells.h = new Uint8Array(heights);
|
||||
pack.cells.h = new Float32Array(heights);
|
||||
if (layerIsOn("toggleHeight")) drawHeightmap();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ function editWorld() {
|
|||
elevateLakes();
|
||||
const heights = new Uint8Array(pack.cells.h);
|
||||
Rivers.generate();
|
||||
pack.cells.h = new Uint8Array(heights);
|
||||
pack.cells.h = new Float32Array(heights);
|
||||
defineBiomes();
|
||||
|
||||
if (layerIsOn("toggleTemp")) drawTemp();
|
||||
|
|
|
|||
|
|
@ -345,14 +345,8 @@ function editZones() {
|
|||
data += el.dataset.population + "\n";
|
||||
});
|
||||
|
||||
const dataBlob = new Blob([data], {type: "text/plain"});
|
||||
const url = window.URL.createObjectURL(dataBlob);
|
||||
const link = document.createElement("a");
|
||||
document.body.appendChild(link);
|
||||
link.download = getFileName("Zones") + ".csv";
|
||||
link.href = url;
|
||||
link.click();
|
||||
window.setTimeout(function() {window.URL.revokeObjectURL(url);}, 2000);
|
||||
const name = getFileName("Zones") + ".csv";
|
||||
downloadFile(data, name);
|
||||
}
|
||||
|
||||
function toggleEraseMode() {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue