├── .gitignore
├── favicon
├── favicon.ico
├── apple-icon.png
├── favicon-16x16.png
├── favicon-32x32.png
├── favicon-96x96.png
├── ms-icon-70x70.png
├── ms-icon-144x144.png
├── ms-icon-150x150.png
├── ms-icon-310x310.png
├── android-icon-36x36.png
├── android-icon-48x48.png
├── android-icon-72x72.png
├── android-icon-96x96.png
├── apple-icon-114x114.png
├── apple-icon-120x120.png
├── apple-icon-144x144.png
├── apple-icon-152x152.png
├── apple-icon-180x180.png
├── apple-icon-57x57.png
├── apple-icon-60x60.png
├── apple-icon-72x72.png
├── apple-icon-76x76.png
├── android-icon-144x144.png
├── android-icon-192x192.png
├── apple-icon-precomposed.png
├── browserconfig.xml
└── manifest.json
├── img
├── homm2-border.png
├── homm2-radio.png
├── homm2-sprite.png
├── homm2-void.png
├── homm2-wait.png
├── homm3-border.png
├── homm3-sprite.png
├── homm3-void.png
├── homm3-wait.png
├── homm2-checkbox.png
├── homm2-panel-bg.png
├── homm2-textarea.png
├── homm3-checkbox.png
├── homm2-big-buttons.png
├── homm3-border-bg.png
├── homm3-button-bg.png
├── homm3-players
│ ├── red.png
│ ├── blue.png
│ ├── brown.png
│ ├── green.png
│ ├── pink.png
│ ├── teal.png
│ ├── orange.png
│ └── violet.png
├── homm2-textarea-left.png
├── homm2-textarea-top.png
├── homm2-textarea-bottom.png
├── homm2-textarea-right.png
├── homm2-textarea-top-left.png
├── homm2-textarea-top-right.png
├── homm2-textarea-bottom-left.png
└── homm2-textarea-bottom-right.png
├── js
├── script.js
├── HommMessageGeneratorDispatcher.js
├── Homm2MessageGenerator.js
└── Homm3MessageGenerator.js
├── README.md
├── index.html
└── css
└── homm-message-generator.css
/.gitignore:
--------------------------------------------------------------------------------
1 | /psd
2 | /fonts
3 | /research
--------------------------------------------------------------------------------
/favicon/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/favicon.ico
--------------------------------------------------------------------------------
/img/homm2-border.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm2-border.png
--------------------------------------------------------------------------------
/img/homm2-radio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm2-radio.png
--------------------------------------------------------------------------------
/img/homm2-sprite.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm2-sprite.png
--------------------------------------------------------------------------------
/img/homm2-void.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm2-void.png
--------------------------------------------------------------------------------
/img/homm2-wait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm2-wait.png
--------------------------------------------------------------------------------
/img/homm3-border.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm3-border.png
--------------------------------------------------------------------------------
/img/homm3-sprite.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm3-sprite.png
--------------------------------------------------------------------------------
/img/homm3-void.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm3-void.png
--------------------------------------------------------------------------------
/img/homm3-wait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm3-wait.png
--------------------------------------------------------------------------------
/js/script.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | var generator = new HommMessageGeneratorDispatcher();
3 | }());
--------------------------------------------------------------------------------
/favicon/apple-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/apple-icon.png
--------------------------------------------------------------------------------
/img/homm2-checkbox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm2-checkbox.png
--------------------------------------------------------------------------------
/img/homm2-panel-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm2-panel-bg.png
--------------------------------------------------------------------------------
/img/homm2-textarea.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm2-textarea.png
--------------------------------------------------------------------------------
/img/homm3-checkbox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm3-checkbox.png
--------------------------------------------------------------------------------
/favicon/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/favicon-16x16.png
--------------------------------------------------------------------------------
/favicon/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/favicon-32x32.png
--------------------------------------------------------------------------------
/favicon/favicon-96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/favicon-96x96.png
--------------------------------------------------------------------------------
/favicon/ms-icon-70x70.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/ms-icon-70x70.png
--------------------------------------------------------------------------------
/img/homm2-big-buttons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm2-big-buttons.png
--------------------------------------------------------------------------------
/img/homm3-border-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm3-border-bg.png
--------------------------------------------------------------------------------
/img/homm3-button-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm3-button-bg.png
--------------------------------------------------------------------------------
/img/homm3-players/red.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm3-players/red.png
--------------------------------------------------------------------------------
/favicon/ms-icon-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/ms-icon-144x144.png
--------------------------------------------------------------------------------
/favicon/ms-icon-150x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/ms-icon-150x150.png
--------------------------------------------------------------------------------
/favicon/ms-icon-310x310.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/ms-icon-310x310.png
--------------------------------------------------------------------------------
/img/homm2-textarea-left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm2-textarea-left.png
--------------------------------------------------------------------------------
/img/homm2-textarea-top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm2-textarea-top.png
--------------------------------------------------------------------------------
/img/homm3-players/blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm3-players/blue.png
--------------------------------------------------------------------------------
/img/homm3-players/brown.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm3-players/brown.png
--------------------------------------------------------------------------------
/img/homm3-players/green.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm3-players/green.png
--------------------------------------------------------------------------------
/img/homm3-players/pink.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm3-players/pink.png
--------------------------------------------------------------------------------
/img/homm3-players/teal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm3-players/teal.png
--------------------------------------------------------------------------------
/favicon/android-icon-36x36.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/android-icon-36x36.png
--------------------------------------------------------------------------------
/favicon/android-icon-48x48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/android-icon-48x48.png
--------------------------------------------------------------------------------
/favicon/android-icon-72x72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/android-icon-72x72.png
--------------------------------------------------------------------------------
/favicon/android-icon-96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/android-icon-96x96.png
--------------------------------------------------------------------------------
/favicon/apple-icon-114x114.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/apple-icon-114x114.png
--------------------------------------------------------------------------------
/favicon/apple-icon-120x120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/apple-icon-120x120.png
--------------------------------------------------------------------------------
/favicon/apple-icon-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/apple-icon-144x144.png
--------------------------------------------------------------------------------
/favicon/apple-icon-152x152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/apple-icon-152x152.png
--------------------------------------------------------------------------------
/favicon/apple-icon-180x180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/apple-icon-180x180.png
--------------------------------------------------------------------------------
/favicon/apple-icon-57x57.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/apple-icon-57x57.png
--------------------------------------------------------------------------------
/favicon/apple-icon-60x60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/apple-icon-60x60.png
--------------------------------------------------------------------------------
/favicon/apple-icon-72x72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/apple-icon-72x72.png
--------------------------------------------------------------------------------
/favicon/apple-icon-76x76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/apple-icon-76x76.png
--------------------------------------------------------------------------------
/img/homm2-textarea-bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm2-textarea-bottom.png
--------------------------------------------------------------------------------
/img/homm2-textarea-right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm2-textarea-right.png
--------------------------------------------------------------------------------
/img/homm3-players/orange.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm3-players/orange.png
--------------------------------------------------------------------------------
/img/homm3-players/violet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm3-players/violet.png
--------------------------------------------------------------------------------
/favicon/android-icon-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/android-icon-144x144.png
--------------------------------------------------------------------------------
/favicon/android-icon-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/android-icon-192x192.png
--------------------------------------------------------------------------------
/img/homm2-textarea-top-left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm2-textarea-top-left.png
--------------------------------------------------------------------------------
/img/homm2-textarea-top-right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm2-textarea-top-right.png
--------------------------------------------------------------------------------
/favicon/apple-icon-precomposed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/favicon/apple-icon-precomposed.png
--------------------------------------------------------------------------------
/img/homm2-textarea-bottom-left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm2-textarea-bottom-left.png
--------------------------------------------------------------------------------
/img/homm2-textarea-bottom-right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lehazyo/homm3-messages/HEAD/img/homm2-textarea-bottom-right.png
--------------------------------------------------------------------------------
/favicon/browserconfig.xml:
--------------------------------------------------------------------------------
1 |
2 | #ffffff
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Heroes of Might and Magic style message generator
2 |
3 | This tool helps create messages that replicate visual style of Heroes of Might and Magic II/III video games. I made this just for fun, because I like HoMM II and III and their messages style.
4 |
5 | Try it: [generate HoMM style message online](https://lehazyo.github.io/homm3-messages/)
6 |
7 | ## Usage
8 |
9 | Input desired text in text field, select visual style of HoMM part II or part III and select additional features (box color, good/evil theme, buttons, shadow).
10 |
11 | New image is instantly generated on the right. You can either screenshot it or download generated image using button in the bottom left corner.
12 |
13 | ## Supported characters
14 |
15 | * Latin, Cyrillic, Polish, Hungarian alphabets
16 | * Digits
17 | * ASCII special characters
--------------------------------------------------------------------------------
/favicon/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "App",
3 | "icons": [
4 | {
5 | "src": "\/favicon\/android-icon-36x36.png",
6 | "sizes": "36x36",
7 | "type": "image\/png",
8 | "density": "0.75"
9 | },
10 | {
11 | "src": "\/favicon\/android-icon-48x48.png",
12 | "sizes": "48x48",
13 | "type": "image\/png",
14 | "density": "1.0"
15 | },
16 | {
17 | "src": "\/favicon\/android-icon-72x72.png",
18 | "sizes": "72x72",
19 | "type": "image\/png",
20 | "density": "1.5"
21 | },
22 | {
23 | "src": "\/favicon\/android-icon-96x96.png",
24 | "sizes": "96x96",
25 | "type": "image\/png",
26 | "density": "2.0"
27 | },
28 | {
29 | "src": "\/favicon\/android-icon-144x144.png",
30 | "sizes": "144x144",
31 | "type": "image\/png",
32 | "density": "3.0"
33 | },
34 | {
35 | "src": "\/favicon\/android-icon-192x192.png",
36 | "sizes": "192x192",
37 | "type": "image\/png",
38 | "density": "4.0"
39 | }
40 | ]
41 | }
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | HoMM message generator
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
36 |
37 |
38 |
39 |
56 |
57 |
72 |
73 |
97 |
98 |
115 |
116 |
121 |
122 |
123 |
124 |
125 | About tool
126 |
127 |
128 | Close
129 |
130 |
131 |
132 |
133 | This text imitates style of message window from 'Heroes of Might and Magic III' video game.
134 |
135 |
136 | Known bugs:
137 |
138 | - it is possible to make only cancel button, which is impossible in the original game, but I don't care
139 | - wrong window sizing for texts with very wide words and with many line breaks
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
--------------------------------------------------------------------------------
/js/HommMessageGeneratorDispatcher.js:
--------------------------------------------------------------------------------
1 | class HommMessageGeneratorDispatcher {
2 | constructor() {
3 | this.input = document.getElementById("input");
4 | this.input.addEventListener("input", this.render.bind(this));
5 | this.canvas = document.getElementById("canvas");
6 | this.context = this.canvas.getContext("2d");
7 |
8 | this.renderer = null;
9 | this.homm3 = new Homm3MessageGenerator(this);
10 | this.homm2 = new Homm2MessageGenerator(this);
11 |
12 | this.split_words = []; // text split into separate words and spaces blocks
13 |
14 | this.setRenderer("homm3");
15 |
16 | this.color = "red";
17 | this.buttons_show = {
18 | "ok": true,
19 | "cancel": false
20 | };
21 | this.draw_shadow = false;
22 |
23 | this.initControls();
24 |
25 | // this.setTestText("alphabets");
26 | }
27 |
28 |
29 | setRenderer(type) {
30 | if(!type.match(/^homm[23]$/)) {
31 | return;
32 | }
33 | if(this.renderer !== null) {
34 | this.renderer.is_current_renderer = false;
35 | }
36 |
37 | this.renderer = this[type];
38 | this.renderer.is_current_renderer = true;
39 | this.renderer.render();
40 |
41 | document.querySelector("body").classList.remove("homm2", "homm3");
42 | document.querySelector("body").classList.add(type);
43 | }
44 |
45 | render() {
46 | this.breakInputIntoWordsAndSpaces();
47 |
48 | this.renderer.render();
49 | }
50 |
51 |
52 | /**
53 | * Sets event listeners for controls
54 | * @return {undefined}
55 | */
56 | initControls() {
57 | var colors = document.querySelectorAll(".color-item");
58 | for(var i=0;i= text_height) {
95 | this.middles_count = i;
96 | break;
97 | }
98 | }
99 | var width = sections.width;
100 | var height =
101 | sections.top.size[1]
102 | + sections.bottom.size[1]
103 | + this.middles_count * sections.middle.size[1];
104 | if(this.dispatcher.draw_shadow) {
105 | width += sections.shadow_width;
106 | height += sections.bottom.shadows[1].size[1];
107 | }
108 | this.canvas.width = width;
109 | this.canvas.height = height;
110 | }
111 |
112 |
113 | /**
114 | * Gets padding from single direction
115 | * @param {string} which - direction (top / right / bottom / left)
116 | * @return {undefined}
117 | */
118 | getPadding(which) {
119 | var padding_to_return = 0;
120 | var sections_info = Homm2MessageGenerator.sections_info[this.theme];
121 | if(which == "bottom" && this.dispatcher.isButtonsVisible()) {
122 | which = "bottom_with_buttons";
123 | } else if(which == "forced_bottom") {
124 | which = "bottom";
125 | } else if(which == "left_with_shadow") {
126 | if(this.dispatcher.draw_shadow) {
127 | padding_to_return += sections_info.shadow_width;
128 | }
129 | which = "left";
130 | }
131 | padding_to_return += sections_info.padding[which];
132 | return padding_to_return;
133 | }
134 |
135 |
136 | splitTextToLines() {
137 | var current_line = [];
138 | var current_space_string = "";
139 | var is_new_line = false;
140 | var is_space_block = false;
141 | var block = "";
142 | var is_line_last = false;
143 | var current_line_with_block = "";
144 | var current_line_with_block_width = 0;
145 | var last_line_width = 0;
146 |
147 | this.text_by_lines = [];
148 |
149 | if(this.dispatcher.split_words.length === 0) {
150 | return;
151 | }
152 |
153 | current_line = [];
154 | current_space_string = "";
155 | is_new_line = false;
156 | is_space_block = false;
157 | block = "";
158 |
159 | for(var i=0;i this.getPopupWidthWithoutPadding()) {
179 | current_line.push(current_space_string);
180 | this.text_by_lines.push(current_line);
181 | current_line = [];
182 | current_space_string = "";
183 | }
184 | }
185 | if(current_space_string !== "") {
186 | current_line.push(current_space_string);
187 | current_space_string = "";
188 | }
189 | } else { // regular word
190 | if(current_line_with_block_width < this.getPopupWidthWithoutPadding()) {
191 | current_line.push(block);
192 | } else {
193 | if(current_line.length) {
194 | this.text_by_lines.push(current_line);
195 | }
196 | current_line = [block];
197 | }
198 | }
199 | }
200 |
201 | if(current_line.length) {
202 | this.text_by_lines.push(current_line);
203 | }
204 | }
205 |
206 | getStringWidth(string) {
207 | var width = 0;
208 | for(var i=0;i 0)) {
307 | current_x += char_info.marginLeft;
308 | }
309 |
310 | if(typeof char_info.width !== "undefined") {
311 | var x_to_draw = this.getPadding("left_with_shadow") + current_x;
312 | var y_to_draw = this.getLetterY(line_index);
313 | var char_x = this.getCharX(char_info);
314 | var char_y = this.getCharY(char_info);
315 | var char_height = Homm2MessageGenerator.line_height;
316 |
317 | var extraHeightUp = (typeof char_info.extraHeightUp === "undefined") ? 0 : char_info.extraHeightUp;
318 | var extraHeightDown = (typeof char_info.extraHeightDown === "undefined") ? 0 : char_info.extraHeightDown;
319 | this.context.drawImage(
320 | this.sprite,
321 | char_x,
322 | char_y - extraHeightUp,
323 | char_info.width,
324 | char_height + extraHeightUp + extraHeightDown,
325 | x_to_draw,
326 | y_to_draw - extraHeightUp,
327 | char_info.width,
328 | char_height + extraHeightUp + extraHeightDown,
329 | );
330 | this.context.drawImage(
331 | this.sprite,
332 | char_x - 1,
333 | this.getCharShadowY(char_info) - extraHeightUp + 1,
334 | char_info.width,
335 | char_height + extraHeightUp + extraHeightDown - 1,
336 | x_to_draw - 1,
337 | y_to_draw - extraHeightUp + 1,
338 | char_info.width,
339 | char_height + extraHeightUp + extraHeightDown - 1,
340 | );
341 | }
342 |
343 | current_x += char_info.width;
344 | current_x += Homm2MessageGenerator.letter_spacing;
345 |
346 | return current_x;
347 | }
348 |
349 | getLetterY(line_index) {
350 | if(!this.dispatcher.isButtonsVisible()) {
351 | return line_index * Homm2MessageGenerator.line_height + this.getPadding("top") + Math.round((this.getPopupHeightWithoutPadding() - this.text_by_lines.length * Homm2MessageGenerator.line_height)/2);
352 | }
353 | return this.getPadding("top") + line_index * Homm2MessageGenerator.line_height;
354 | }
355 |
356 | getCharX(char_info) {
357 | return Homm2MessageGenerator.letters_offset_x + char_info.x * Homm2MessageGenerator.letter_container_width;
358 | }
359 |
360 | getCharY(char_info) {
361 | return Homm2MessageGenerator.letters_offset_y + char_info.y * Homm2MessageGenerator.line_height;
362 | }
363 |
364 | getCharShadowY(char_info) {
365 | return Homm2MessageGenerator.letters_shadow_offset_y + char_info.y * Homm2MessageGenerator.line_height;
366 | }
367 |
368 | drawMessageSections(theme_sections) {
369 | var sections_name = ["top", "middle", "bottom"];
370 |
371 | var y_to_draw = 0;
372 | for(var i=0;i this.getPopupWidthWithoutPadding()) {
146 | current_line.push(current_space_string);
147 | this.text_by_lines.push(current_line);
148 | current_line = [];
149 | current_space_string = "";
150 | }
151 | }
152 | if(current_space_string !== "") {
153 | current_line.push(current_space_string);
154 | current_space_string = "";
155 | }
156 | } else { // regular word
157 | if(current_line_with_block_width < this.getPopupWidthWithoutPadding()) {
158 | current_line.push(block);
159 | } else {
160 | if(current_line.length) {
161 | this.text_by_lines.push(current_line);
162 | }
163 | current_line = [block];
164 | }
165 | }
166 |
167 | // if width with space block is enough to trigger resize, let's trigger it
168 | if(resize_at &&
169 | (current_line_with_space_block_width >= resize_at
170 | || current_line_with_block_width >= resize_at)
171 | ) {
172 | break;
173 | }
174 |
175 | if(half_at &&
176 | (current_line_with_space_block_width >= half_at
177 | || current_line_with_block_width >= half_at)
178 | ) {
179 | this.raise_by_half_line = true;
180 | }
181 | }
182 |
183 | // line remainder makes the new line
184 | if(current_line.length) {
185 | this.text_by_lines.push(current_line);
186 |
187 | last_line_width = this.getStringWidth(current_line.join(""));
188 |
189 | resize_at = this.getResizeAt();
190 | if(resize_at && last_line_width >= resize_at) {
191 | continue; // trying next message size
192 | }
193 |
194 | half_at = this.getHalfAt();
195 | this.raise_by_half_line = (half_at && last_line_width >= half_at);
196 | }
197 |
198 | if(this.text_by_lines.length > this.message_size.max_text_lines) {
199 | suitable_size_found = false;
200 |
201 | this.text_by_lines.splice(this.message_size.max_text_lines, this.text_by_lines.length - this.message_size.max_text_lines);
202 | }
203 |
204 | if(suitable_size_found) {
205 | // if suitable size is found, we don't need to search bigger sizes
206 | break;
207 | }
208 | }
209 | }
210 |
211 | drawText() {
212 | for(var line_index=0;line_index 0)) {
238 | current_x += char_info.marginLeft;
239 | }
240 |
241 | if(typeof char_info.width !== "undefined" && typeof char_info.height !== "undefined") {
242 | var x_to_draw = this.getPadding("left") + current_x;
243 | var y_to_draw = this.getLetterY(line_index, char_info);
244 |
245 |
246 | this.context.drawImage(
247 | this.sprite,
248 | char_info.x,
249 | char_info.y,
250 | char_info.width,
251 | char_info.height,
252 | x_to_draw,
253 | y_to_draw,
254 | char_info.width,
255 | char_info.height,
256 | );
257 | }
258 |
259 | current_x += char_info.width;
260 | current_x += this.letter_spacing;
261 | if(typeof char_info.marginRight !== "undefined") {
262 | current_x += char_info.marginRight;
263 | }
264 | }
265 | }
266 | }
267 | }
268 |
269 |
270 | /**
271 | * Check if there is a line that has no word-breaks and forces window to become wider
272 | */
273 | checkForcedWidth() {
274 | var maximum_string_width = 0;
275 |
276 | for(var i=0;i maximum_string_width) {
289 | this.forced_width = i;
290 | break;
291 | }
292 | }
293 | }
294 |
295 | setPopupHeight() {
296 | var proposed_height = 0;
297 | var text_height = this.text_by_lines.length * this.line_height;
298 | var subtractor = this.getPadding("top") + this.getPadding("bottom") + (this.dispatcher.isButtonsVisible() ? this.button_size[1] : 0);
299 | for(var i=1;i<(this.max_height+1);i++) {
300 | proposed_height = this.border_size * i - subtractor;
301 | if (proposed_height > text_height) {
302 | if(this.message_size.height < i) {
303 | this.message_size.height = i;
304 | }
305 | return;
306 | }
307 | }
308 |
309 | // если не нашлось подходящего размера, ставим максимальный, при котором есть скролл (64 * 5 = 320)
310 | this.message_size.height = this.max_height;
311 | }
312 |
313 | getCharInfo(char) {
314 | return this.dispatcher.getCharInfo(Homm3MessageGenerator, char);
315 | }
316 |
317 | getStringWidth(string) {
318 | var width = 0;
319 | for(var i=0;i 2) {
858 | y_to_draw += 14 + (this.message_size.height - 2) * this.line_height;
859 | }
860 |
861 | // sorry, I don't care anymore.............
862 | if(this.message_size.width == 5) {
863 | if (this.text_by_lines.length >= 9) {
864 | y_to_draw += this.line_height;
865 | } else if (this.text_by_lines.length >= 5) {
866 | y_to_draw += this.line_height / 2;
867 | }
868 | } else if(this.message_size.width == 7) {
869 | if (this.text_by_lines.length >= 9) {
870 | y_to_draw += this.line_height;
871 | } else if (this.text_by_lines.length >= 7) {
872 | y_to_draw += this.line_height / 2;
873 | }
874 | } else if(this.message_size.width == 10) {
875 | if (this.text_by_lines.length >= 9) {
876 | y_to_draw += this.line_height / 2;
877 | }
878 | }
879 |
880 | // raise by half-line
881 | if (this.raise_by_half_line) {
882 | y_to_draw -= this.line_height / 2;
883 | }
884 |
885 | return y_to_draw;
886 | }
887 | }
888 |
889 | Homm3MessageGenerator.letters = {
890 | " ": {
891 | "width": 3
892 | },
893 |
894 | // digits
895 | "0": {
896 | "width": 7,
897 | "height": 10,
898 | "x": 0,
899 | "y": 265,
900 | "marginRight": 1
901 | },
902 | "1": {
903 | "width": 7,
904 | "height": 10,
905 | "x": 7,
906 | "y": 265,
907 | "marginLeft": -1
908 | },
909 | "2": {
910 | "width": 7,
911 | "height": 10,
912 | "x": 14,
913 | "y": 265
914 | },
915 | "3": {
916 | "width": 7,
917 | "height": 10,
918 | "x": 21,
919 | "y": 265
920 | },
921 | "4": {
922 | "width": 7,
923 | "height": 10,
924 | "x": 28,
925 | "y": 265
926 | },
927 | "5": {
928 | "width": 7,
929 | "height": 10,
930 | "x": 35,
931 | "y": 265
932 | },
933 | "6": {
934 | "width": 7,
935 | "height": 10,
936 | "x": 42,
937 | "y": 265,
938 | "marginRight": 1
939 | },
940 | "7": {
941 | "width": 7,
942 | "height": 10,
943 | "x": 49,
944 | "y": 265,
945 | "marginRight": -1
946 | },
947 | "8": {
948 | "width": 7,
949 | "height": 10,
950 | "x": 56,
951 | "y": 265
952 | },
953 | "9": {
954 | "width": 7,
955 | "height": 10,
956 | "x": 63,
957 | "y": 265
958 | },
959 |
960 | // signs
961 | "&": {
962 | "width": 10,
963 | "height": 10,
964 | "x": 70,
965 | "y": 265
966 | },
967 | "*": {
968 | "width": 6,
969 | "height": 5,
970 | "x": 80,
971 | "y": 265,
972 | "translateY": -5
973 | },
974 | "@": {
975 | "width": 10,
976 | "height": 10,
977 | "x": 86,
978 | "y": 265
979 | },
980 | "[": {
981 | "width": 4,
982 | "height": 13,
983 | "x": 96,
984 | "y": 262,
985 | "translateY": 3,
986 | "marginLeft": 1
987 | },
988 | "]": {
989 | "width": 4,
990 | "height": 13,
991 | "x": 100,
992 | "y": 262,
993 | "translateY": 3
994 | },
995 | ":": {
996 | "width": 2,
997 | "height": 7,
998 | "x": 104,
999 | "y": 268
1000 | },
1001 | ",": {
1002 | "width": 4,
1003 | "height": 5,
1004 | "x": 106,
1005 | "y": 272,
1006 | "translateY": 2,
1007 | "marginRight": -1
1008 | },
1009 | "-": {
1010 | "width": 5,
1011 | "height": 2,
1012 | "x": 110,
1013 | "y": 269,
1014 | "translateY": -3,
1015 | "marginRight": -1
1016 | },
1017 | "–": {
1018 | "width": 7,
1019 | "height": 2,
1020 | "x": 247,
1021 | "y": 269,
1022 | "translateY": -3,
1023 | "marginLeft": 1,
1024 | "marginRight": -1
1025 | },
1026 | "$": {
1027 | "width": 6,
1028 | "height": 12,
1029 | "x": 115,
1030 | "y": 263
1031 | },
1032 | ".": {
1033 | "width": 2,
1034 | "height": 2,
1035 | "x": 121,
1036 | "y": 273,
1037 | "marginLeft": 1
1038 | },
1039 | "=": {
1040 | "width": 8,
1041 | "height": 4,
1042 | "x": 123,
1043 | "y": 268,
1044 | "translateY": -5
1045 | },
1046 | "!": {
1047 | "width": 2,
1048 | "height": 10,
1049 | "x": 131,
1050 | "y": 265,
1051 | "marginLeft": 1,
1052 | "marginRight": 1
1053 | },
1054 | "<": {
1055 | "width": 7,
1056 | "height": 8,
1057 | "x": 133,
1058 | "y": 267
1059 | },
1060 | "#": {
1061 | "width": 8,
1062 | "height": 10,
1063 | "x": 140,
1064 | "y": 265
1065 | },
1066 | ">": {
1067 | "width": 7,
1068 | "height": 8,
1069 | "x": 148,
1070 | "y": 267
1071 | },
1072 | "(": {
1073 | "width": 4,
1074 | "height": 13,
1075 | "x": 155,
1076 | "y": 264,
1077 | "translateY": 3
1078 | },
1079 | ")": {
1080 | "width": 4,
1081 | "height": 13,
1082 | "x": 159,
1083 | "y": 264,
1084 | "translateY": 3,
1085 | "marginLeft": 1,
1086 | "marginRight": -1
1087 | },
1088 | "%": {
1089 | "width": 10,
1090 | "height": 10,
1091 | "x": 163,
1092 | "y": 265
1093 | },
1094 | "+": {
1095 | "width": 8,
1096 | "height": 8,
1097 | "x": 173,
1098 | "y": 266,
1099 | "translateY": -1
1100 | },
1101 | "^": {
1102 | "width": 6,
1103 | "height": 6,
1104 | "x": 181,
1105 | "y": 264,
1106 | "translateY": -5
1107 | },
1108 | "?": {
1109 | "width": 5,
1110 | "height": 10,
1111 | "x": 187,
1112 | "y": 265
1113 | },
1114 | "`": {
1115 | "width": 3,
1116 | "height": 3,
1117 | "x": 192,
1118 | "y": 265,
1119 | "translateY": -7
1120 | },
1121 | "\"": {
1122 | "width": 4,
1123 | "height": 5,
1124 | "x": 195,
1125 | "y": 265,
1126 | "translateY": -6
1127 | },
1128 | "'": {
1129 | "width": 2,
1130 | "height": 5,
1131 | "x": 199,
1132 | "y": 265,
1133 | "translateY": -6
1134 | },
1135 | "«": {
1136 | "width": 6,
1137 | "height": 4,
1138 | "x": 201,
1139 | "y": 268,
1140 | "translateY": -3
1141 | },
1142 | "»": {
1143 | "width": 6,
1144 | "height": 4,
1145 | "x": 207,
1146 | "y": 265,
1147 | "translateY": -3
1148 | },
1149 | ";": {
1150 | "width": 4,
1151 | "height": 9,
1152 | "x": 213,
1153 | "y": 268,
1154 | "translateY": 2
1155 | },
1156 | "/": {
1157 | "width": 6,
1158 | "height": 13,
1159 | "x": 217,
1160 | "y": 265,
1161 | "translateY": 2
1162 | },
1163 | "\\": {
1164 | "width": 6,
1165 | "height": 13,
1166 | "x": 264,
1167 | "y": 265,
1168 | "translateY": 2
1169 | },
1170 | "~": {
1171 | "width": 8,
1172 | "height": 3,
1173 | "x": 229,
1174 | "y": 267,
1175 | "translateY": -5
1176 | },
1177 | "_": {
1178 | "width": 8,
1179 | "height": 2,
1180 | "x": 237,
1181 | "y": 273
1182 | },
1183 | "|": {
1184 | "width": 2,
1185 | "height": 13,
1186 | "x": 245,
1187 | "y": 264,
1188 | "translateY": 2
1189 | },
1190 |
1191 | // eng lowercase
1192 | "a": {
1193 | "width": 7,
1194 | "height": 7,
1195 | "x": 0,
1196 | "y": 250
1197 | },
1198 | "b": {
1199 | "width": 7,
1200 | "height": 10,
1201 | "x": 7,
1202 | "y": 247
1203 | },
1204 | "c": {
1205 | "width": 6,
1206 | "height": 7,
1207 | "x": 14,
1208 | "y": 250
1209 | },
1210 | "d": {
1211 | "width": 7,
1212 | "height": 10,
1213 | "x": 20,
1214 | "y": 247,
1215 | "marginLeft": 1
1216 | },
1217 | "e": {
1218 | "width": 6,
1219 | "height": 7,
1220 | "x": 27,
1221 | "y": 250
1222 | },
1223 | "f": {
1224 | "width": 5,
1225 | "height": 10,
1226 | "x": 33,
1227 | "y": 247,
1228 | "marginRight": -1
1229 | },
1230 | "g": {
1231 | "width": 7,
1232 | "height": 11,
1233 | "x": 38,
1234 | "y": 250,
1235 | "translateY": 4
1236 | },
1237 | "h": {
1238 | "width": 8,
1239 | "height": 10,
1240 | "x": 45,
1241 | "y": 247
1242 | },
1243 | "i": {
1244 | "width": 4,
1245 | "height": 9,
1246 | "x": 53,
1247 | "y": 248
1248 | },
1249 | "j": {
1250 | "width": 4,
1251 | "height": 13,
1252 | "x": 57,
1253 | "y": 248,
1254 | "translateY": 4,
1255 | "marginLeft": -1
1256 | },
1257 | "k": {
1258 | "width": 8,
1259 | "height": 10,
1260 | "x": 61,
1261 | "y": 247,
1262 | "marginRight": -1
1263 | },
1264 | "l": {
1265 | "width": 4,
1266 | "height": 10,
1267 | "x": 69,
1268 | "y": 247
1269 | },
1270 | "m": {
1271 | "width": 12,
1272 | "height": 7,
1273 | "x": 73,
1274 | "y": 250,
1275 | "marginRight": -1
1276 | },
1277 | "n": {
1278 | "width": 8,
1279 | "height": 7,
1280 | "x": 85,
1281 | "y": 250
1282 | },
1283 | "o": {
1284 | "width": 7,
1285 | "height": 7,
1286 | "x": 93,
1287 | "y": 250
1288 | },
1289 | "p": {
1290 | "width": 8,
1291 | "height": 11,
1292 | "x": 100,
1293 | "y": 250,
1294 | "translateY": 4
1295 | },
1296 | "q": {
1297 | "width": 8,
1298 | "height": 11,
1299 | "x": 108,
1300 | "y": 250,
1301 | "translateY": 4,
1302 | "marginRight": -1
1303 | },
1304 | "r": {
1305 | "width": 6,
1306 | "height": 7,
1307 | "x": 116,
1308 | "y": 250,
1309 | "marginRight": -1
1310 | },
1311 | "s": {
1312 | "width": 5,
1313 | "height": 7,
1314 | "x": 122,
1315 | "y": 250,
1316 | "marginRight": 1
1317 | },
1318 | "t": {
1319 | "width": 5,
1320 | "height": 9,
1321 | "x": 127,
1322 | "y": 248,
1323 | "marginLeft": -1
1324 | },
1325 | "u": {
1326 | "width": 8,
1327 | "height": 7,
1328 | "x": 132,
1329 | "y": 250
1330 | },
1331 | "v": {
1332 | "width": 8,
1333 | "height": 7,
1334 | "x": 140,
1335 | "y": 250,
1336 | "marginRight": -1
1337 | },
1338 | "w": {
1339 | "width": 11,
1340 | "height": 7,
1341 | "x": 148,
1342 | "y": 250
1343 | },
1344 | "x": {
1345 | "width": 7,
1346 | "height": 7,
1347 | "x": 159,
1348 | "y": 250
1349 | },
1350 | "y": {
1351 | "width": 8,
1352 | "height": 11,
1353 | "x": 166,
1354 | "y": 250,
1355 | "translateY": 4,
1356 | "marginRight": -1
1357 | },
1358 | "z": {
1359 | "width": 7,
1360 | "height": 7,
1361 | "x": 174,
1362 | "y": 250
1363 | },
1364 |
1365 | // eng uppercase
1366 | "A": {
1367 | "width": 10,
1368 | "height": 10,
1369 | "x": 181,
1370 | "y": 247
1371 | },
1372 | "B": {
1373 | "width": 8,
1374 | "height": 10,
1375 | "x": 191,
1376 | "y": 247
1377 | },
1378 | "C": {
1379 | "width": 9,
1380 | "height": 10,
1381 | "x": 199,
1382 | "y": 247
1383 | },
1384 | "D": {
1385 | "width": 10,
1386 | "height": 10,
1387 | "x": 208,
1388 | "y": 247
1389 | },
1390 | "E": {
1391 | "width": 8,
1392 | "height": 10,
1393 | "x": 218,
1394 | "y": 247
1395 | },
1396 | "F": {
1397 | "width": 7,
1398 | "height": 10,
1399 | "x": 226,
1400 | "y": 247
1401 | },
1402 | "G": {
1403 | "width": 10,
1404 | "height": 10,
1405 | "x": 233,
1406 | "y": 247
1407 | },
1408 | "H": {
1409 | "width": 11,
1410 | "height": 10,
1411 | "x": 243,
1412 | "y": 247
1413 | },
1414 | "I": {
1415 | "width": 4,
1416 | "height": 10,
1417 | "x": 254,
1418 | "y": 247
1419 | },
1420 | "J": {
1421 | "width": 5,
1422 | "height": 13,
1423 | "x": 258,
1424 | "y": 247,
1425 | "translateY": 3,
1426 | "marginLeft": -1
1427 | },
1428 | "K": {
1429 | "width": 10,
1430 | "height": 10,
1431 | "x": 263,
1432 | "y": 247,
1433 | "marginRight": -1
1434 | },
1435 | "L": {
1436 | "width": 8,
1437 | "height": 10,
1438 | "x": 273,
1439 | "y": 247
1440 | },
1441 | "M": {
1442 | "width": 12,
1443 | "height": 10,
1444 | "x": 281,
1445 | "y": 247
1446 | },
1447 | "N": {
1448 | "width": 11,
1449 | "height": 10,
1450 | "x": 293,
1451 | "y": 247
1452 | },
1453 | "O": {
1454 | "width": 10,
1455 | "height": 10,
1456 | "x": 304,
1457 | "y": 247
1458 | },
1459 | "P": {
1460 | "width": 8,
1461 | "height": 10,
1462 | "x": 314,
1463 | "y": 247
1464 | },
1465 | "Q": {
1466 | "width": 10,
1467 | "height": 12,
1468 | "x": 322,
1469 | "y": 247,
1470 | "translateY": 2
1471 | },
1472 | "R": {
1473 | "width": 9,
1474 | "height": 10,
1475 | "x": 332,
1476 | "y": 247
1477 | },
1478 | "S": {
1479 | "width": 7,
1480 | "height": 10,
1481 | "x": 341,
1482 | "y": 247
1483 | },
1484 | "T": {
1485 | "width": 8,
1486 | "height": 10,
1487 | "x": 348,
1488 | "y": 247
1489 | },
1490 | "U": {
1491 | "width": 10,
1492 | "height": 10,
1493 | "x": 356,
1494 | "y": 247
1495 | },
1496 | "V": {
1497 | "width": 10,
1498 | "height": 10,
1499 | "x": 366,
1500 | "y": 247,
1501 | "marginRight": -1
1502 | },
1503 | "W": {
1504 | "width": 14,
1505 | "height": 10,
1506 | "x": 376,
1507 | "y": 247,
1508 | "marginRight": -1
1509 | },
1510 | "X": {
1511 | "width": 9,
1512 | "height": 10,
1513 | "x": 390,
1514 | "y": 247
1515 | },
1516 | "Y": {
1517 | "width": 9,
1518 | "height": 10,
1519 | "x": 399,
1520 | "y": 247
1521 | },
1522 | "Z": {
1523 | "width": 9,
1524 | "height": 10,
1525 | "x": 408,
1526 | "y": 247
1527 | },
1528 |
1529 | // rus lowercase
1530 | "а": {
1531 | "same_as": "a"
1532 | },
1533 | "б": {
1534 | "width": 6,
1535 | "height": 10,
1536 | "x": 0,
1537 | "y": 283,
1538 | "marginLeft": 1
1539 | },
1540 | "в": {
1541 | "width": 6,
1542 | "height": 7,
1543 | "x": 6,
1544 | "y": 286
1545 | },
1546 | "г": {
1547 | "width": 7,
1548 | "height": 7,
1549 | "x": 12,
1550 | "y": 286,
1551 | "marginRight": -1
1552 | },
1553 | "д": {
1554 | "width": 8,
1555 | "height": 9,
1556 | "x": 19,
1557 | "y": 286,
1558 | "translateY": 2,
1559 | "marginRight": -1
1560 | },
1561 | "е": {
1562 | "same_as": "e"
1563 | },
1564 | "ё": {
1565 | "width": 6,
1566 | "height": 9,
1567 | "x": 27,
1568 | "y": 284
1569 | },
1570 | "ж": {
1571 | "width": 10,
1572 | "height": 7,
1573 | "x": 33,
1574 | "y": 286
1575 | },
1576 | "з": {
1577 | "width": 5,
1578 | "height": 7,
1579 | "x": 43,
1580 | "y": 286
1581 | },
1582 | "и": {
1583 | "width": 8,
1584 | "height": 7,
1585 | "x": 48,
1586 | "y": 286
1587 | },
1588 | "й": {
1589 | "width": 8,
1590 | "height": 9,
1591 | "x": 56,
1592 | "y": 284
1593 | },
1594 | "к": {
1595 | "width": 8,
1596 | "height": 7,
1597 | "x": 64,
1598 | "y": 286,
1599 | "marginRight": -1
1600 | },
1601 | "л": {
1602 | "width": 7,
1603 | "height": 7,
1604 | "x": 72,
1605 | "y": 286
1606 | },
1607 | "м": {
1608 | "width": 10,
1609 | "height": 7,
1610 | "x": 79,
1611 | "y": 286,
1612 | "marginRight": -1
1613 | },
1614 | "н": {
1615 | "width": 8,
1616 | "height": 7,
1617 | "x": 89,
1618 | "y": 286
1619 | },
1620 | "о": {
1621 | "same_as": "o"
1622 | },
1623 | "п": {
1624 | "width": 8,
1625 | "height": 7,
1626 | "x": 97,
1627 | "y": 286
1628 | },
1629 | "р": {
1630 | "same_as": "p"
1631 | },
1632 | "с": {
1633 | "same_as": "c"
1634 | },
1635 | "т": {
1636 | "width": 6,
1637 | "height": 7,
1638 | "x": 105,
1639 | "y": 286
1640 | },
1641 | "у": {
1642 | "same_as": "y"
1643 | },
1644 | "ф": {
1645 | "width": 11,
1646 | "height": 14,
1647 | "x": 121,
1648 | "y": 283,
1649 | "translateY": 4
1650 | },
1651 | "х": {
1652 | "same_as": "x"
1653 | },
1654 | "ц": {
1655 | "width": 8,
1656 | "height": 9,
1657 | "x": 132,
1658 | "y": 286,
1659 | "translateY": 2
1660 | },
1661 | "ч": {
1662 | "width": 8,
1663 | "height": 7,
1664 | "x": 140,
1665 | "y": 286,
1666 | "marginRight": -1
1667 | },
1668 | "ш": {
1669 | "width": 12,
1670 | "height": 7,
1671 | "x": 148,
1672 | "y": 286,
1673 | "marginRight": -1
1674 | },
1675 | "щ": {
1676 | "width": 12,
1677 | "height": 9,
1678 | "x": 160,
1679 | "y": 286,
1680 | "translateY": 2,
1681 | "marginLeft": -1
1682 | },
1683 | "ъ": {
1684 | "width": 7,
1685 | "height": 7,
1686 | "x": 172,
1687 | "y": 286
1688 | },
1689 | "ы": {
1690 | "width": 11,
1691 | "height": 7,
1692 | "x": 179,
1693 | "y": 286,
1694 | "marginRight": -1
1695 | },
1696 | "ь": {
1697 | "width": 6,
1698 | "height": 7,
1699 | "x": 190,
1700 | "y": 286
1701 | },
1702 | "э": {
1703 | "width": 6,
1704 | "height": 7,
1705 | "x": 196,
1706 | "y": 286
1707 | },
1708 | "ю": {
1709 | "width": 10,
1710 | "height": 7,
1711 | "x": 202,
1712 | "y": 286
1713 | },
1714 | "я": {
1715 | "width": 8,
1716 | "height": 7,
1717 | "x": 212,
1718 | "y": 286,
1719 | "marginRight": -1
1720 | },
1721 |
1722 | // rus uppercase
1723 | "А": {
1724 | "same_as": "A"
1725 | },
1726 | "Б": {
1727 | "width": 8,
1728 | "height": 10,
1729 | "x": 220,
1730 | "y": 283
1731 | },
1732 | "В": {
1733 | "same_as": "B"
1734 | },
1735 | "Г": {
1736 | "width": 8,
1737 | "height": 10,
1738 | "x": 228,
1739 | "y": 283,
1740 | "marginRight": -1
1741 | },
1742 | "Д": {
1743 | "width": 10,
1744 | "height": 12,
1745 | "x": 236,
1746 | "y": 283,
1747 | "translateY": 2
1748 | },
1749 | "Е": {
1750 | "same_as": "E"
1751 | },
1752 | "Ё": {
1753 | "width": 8,
1754 | "height": 12,
1755 | "x": 246,
1756 | "y": 281
1757 | },
1758 | "Ж": {
1759 | "width": 14,
1760 | "height": 10,
1761 | "x": 254,
1762 | "y": 283,
1763 | "marginRight": -1
1764 | },
1765 | "З": {
1766 | "width": 7,
1767 | "height": 10,
1768 | "x": 268,
1769 | "y": 283
1770 | },
1771 | "И": {
1772 | "width": 11,
1773 | "height": 10,
1774 | "x": 275,
1775 | "y": 283
1776 | },
1777 | "Й": {
1778 | "width": 11,
1779 | "height": 12,
1780 | "x": 286,
1781 | "y": 281
1782 | },
1783 | "К": {
1784 | "same_as": "K"
1785 | },
1786 | "Л": {
1787 | "width": 10,
1788 | "height": 10,
1789 | "x": 297,
1790 | "y": 283
1791 | },
1792 | "М": {
1793 | "same_as": "M"
1794 | },
1795 | "Н": {
1796 | "same_as": "H"
1797 | },
1798 | "О": {
1799 | "same_as": "O"
1800 | },
1801 | "П": {
1802 | "width": 11,
1803 | "height": 10,
1804 | "x": 307,
1805 | "y": 283
1806 | },
1807 | "Р": {
1808 | "same_as": "P"
1809 | },
1810 | "С": {
1811 | "same_as": "C"
1812 | },
1813 | "Т": {
1814 | "same_as": "T"
1815 | },
1816 | "У": {
1817 | "width": 10,
1818 | "height": 13,
1819 | "x": 318,
1820 | "y": 283,
1821 | "translateY": 3,
1822 | "marginRight": -1
1823 | },
1824 | "Ф": {
1825 | "width": 12,
1826 | "height": 10,
1827 | "x": 328,
1828 | "y": 283,
1829 | "marginRight": -1
1830 | },
1831 | "Х": {
1832 | "same_as": "X"
1833 | },
1834 | "Ц": {
1835 | "width": 12,
1836 | "height": 12,
1837 | "x": 340,
1838 | "y": 283,
1839 | "translateY": 2,
1840 | "marginRight": -1
1841 | },
1842 | "Ч": {
1843 | "width": 10,
1844 | "height": 10,
1845 | "x": 352,
1846 | "y": 283
1847 | },
1848 | "Ш": {
1849 | "width": 14,
1850 | "height": 10,
1851 | "x": 362,
1852 | "y": 283
1853 | },
1854 | "Щ": {
1855 | "width": 15,
1856 | "height": 12,
1857 | "x": 376,
1858 | "y": 283,
1859 | "translateY": 2,
1860 | "marginRight": -1
1861 | },
1862 | "Ъ": {
1863 | "width": 9,
1864 | "height": 10,
1865 | "x": 391,
1866 | "y": 283
1867 | },
1868 | "Ы": {
1869 | "width": 11,
1870 | "height": 10,
1871 | "x": 400,
1872 | "y": 283,
1873 | "marginRight": 1
1874 | },
1875 | "Ь": {
1876 | "width": 8,
1877 | "height": 10,
1878 | "x": 411,
1879 | "y": 283,
1880 | "marginLeft": 1
1881 | },
1882 | "Э": {
1883 | "width": 9,
1884 | "height": 10,
1885 | "x": 419,
1886 | "y": 283
1887 | },
1888 | "Ю": {
1889 | "width": 15,
1890 | "height": 10,
1891 | "x": 428,
1892 | "y": 283
1893 | },
1894 | "Я": {
1895 | "width": 9,
1896 | "height": 10,
1897 | "x": 443,
1898 | "y": 283
1899 | },
1900 | "{": {
1901 | "width": 3,
1902 | "height": 11,
1903 | "x": 262,
1904 | "y": 264,
1905 | },
1906 | "}": {
1907 | "width": 3,
1908 | "height": 11,
1909 | "x": 265,
1910 | "y": 264,
1911 | },
1912 | "Ђ": {
1913 | "width": 10,
1914 | "height": 11,
1915 | "x": 0,
1916 | "y": 304,
1917 | "translateY": 1
1918 | },
1919 | "Ѓ": {
1920 | "width": 8,
1921 | "height": 13,
1922 | "x": 10,
1923 | "y": 301,
1924 | },
1925 | "‚": {
1926 | "width": 3,
1927 | "height": 4,
1928 | "x": 29,
1929 | "y": 311,
1930 | "translateY": 1
1931 | },
1932 | "ѓ": {
1933 | "width": 7,
1934 | "height": 10,
1935 | "x": 22,
1936 | "y": 304,
1937 | },
1938 | "„": {
1939 | "width": 6,
1940 | "height": 4,
1941 | "x": 29,
1942 | "y": 311,
1943 | "translateY": 1
1944 | },
1945 | "…": {
1946 | "width": 10,
1947 | "height": 2,
1948 | "x": 35,
1949 | "y": 312,
1950 | },
1951 | "†": {
1952 | "width": 6,
1953 | "height": 12,
1954 | "x": 45,
1955 | "y": 304,
1956 | "translateY": 2
1957 | },
1958 | "‡": {
1959 | "width": 6,
1960 | "height": 12,
1961 | "x": 51,
1962 | "y": 304,
1963 | "translateY": 2
1964 | },
1965 | "€": {
1966 | "width": 8,
1967 | "height": 10,
1968 | "x": 57,
1969 | "y": 304,
1970 | },
1971 | "‰": {
1972 | "width": 15,
1973 | "height": 10,
1974 | "x": 65,
1975 | "y": 304,
1976 | },
1977 | "Љ": {
1978 | "width": 13,
1979 | "height": 10,
1980 | "x": 80,
1981 | "y": 304,
1982 | },
1983 | "‹": {
1984 | "width": 3,
1985 | "height": 4,
1986 | "x": 297,
1987 | "y": 309,
1988 | },
1989 | "Њ": {
1990 | "width": 14,
1991 | "height": 10,
1992 | "x": 96,
1993 | "y": 304,
1994 | },
1995 | "Ќ": {
1996 | "width": 10,
1997 | "height": 13,
1998 | "x": 110,
1999 | "y": 301,
2000 | },
2001 | "Ћ": {
2002 | "width": 10,
2003 | "height": 10,
2004 | "x": 120,
2005 | "y": 304,
2006 | },
2007 | "Џ": {
2008 | "width": 10,
2009 | "height": 12,
2010 | "x": 130,
2011 | "y": 304,
2012 | "translateY": 2
2013 | },
2014 | "ђ": {
2015 | "width": 7,
2016 | "height": 11,
2017 | "x": 140,
2018 | "y": 304,
2019 | "translateY": 1
2020 | },
2021 | "‘": {
2022 | "width": 3,
2023 | "height": 4,
2024 | "x": 29,
2025 | "y": 311,
2026 | "translateY": -6
2027 | },
2028 | "’": {
2029 | "same_as": "‘"
2030 | },
2031 | "“": {
2032 | "width": 6,
2033 | "height": 4,
2034 | "x": 29,
2035 | "y": 311,
2036 | "translateY": -6
2037 | },
2038 | "”": {
2039 | "same_as": "“"
2040 | },
2041 | "•": {
2042 | "width": 5,
2043 | "height": 5,
2044 | "x": 147,
2045 | "y": 306,
2046 | "translateY": -3
2047 | },
2048 | "—": {
2049 | "width": 10,
2050 | "height": 2,
2051 | "x": 159,
2052 | "y": 309,
2053 | "translateY": -3
2054 | },
2055 | "˜": {
2056 | "width": 8,
2057 | "height": 9,
2058 | "x": 169,
2059 | "y": 305,
2060 | },
2061 | "™": {
2062 | "width": 13,
2063 | "height": 6,
2064 | "x": 177,
2065 | "y": 304,
2066 | "translateY": -4
2067 | },
2068 | "љ": {
2069 | "width": 10,
2070 | "height": 7,
2071 | "x": 190,
2072 | "y": 307,
2073 | },
2074 | "›": {
2075 | "width": 3,
2076 | "height": 4,
2077 | "x": 381,
2078 | "y": 308,
2079 | "translateY": -1
2080 | },
2081 | "њ": {
2082 | "width": 11,
2083 | "height": 7,
2084 | "x": 203,
2085 | "y": 307,
2086 | },
2087 | "ќ": {
2088 | "width": 8,
2089 | "height": 10,
2090 | "x": 214,
2091 | "y": 304,
2092 | },
2093 | "ћ": {
2094 | "width": 8,
2095 | "height": 10,
2096 | "x": 222,
2097 | "y": 304,
2098 | },
2099 | "џ": {
2100 | "width": 8,
2101 | "height": 9,
2102 | "x": 230,
2103 | "y": 307,
2104 | "translateY": 2
2105 | },
2106 | "Ӯ": {
2107 | "width": 10,
2108 | "height": 15,
2109 | "x": 238,
2110 | "y": 302,
2111 | "translateY": 3
2112 | },
2113 | "ӯ": {
2114 | "width": 7,
2115 | "height": 13,
2116 | "x": 248,
2117 | "y": 305,
2118 | "translateY": 4
2119 | },
2120 | "Ј": {
2121 | "same_as": "J"
2122 | },
2123 | "¤": {
2124 | "width": 8,
2125 | "height": 8,
2126 | "x": 256,
2127 | "y": 305,
2128 | "translateY": -1
2129 | },
2130 | "Ґ": {
2131 | "width": 6,
2132 | "height": 11,
2133 | "x": 264,
2134 | "y": 303,
2135 | },
2136 | "¦": {
2137 | "same_as": "|"
2138 | },
2139 | "§": {
2140 | "width": 7,
2141 | "height": 12,
2142 | "x": 270,
2143 | "y": 304,
2144 | "translateY": 2
2145 | },
2146 | "©": {
2147 | "width": 11,
2148 | "height": 10,
2149 | "x": 277,
2150 | "y": 304,
2151 | },
2152 | "Є": {
2153 | "width": 9,
2154 | "height": 10,
2155 | "x": 288,
2156 | "y": 304,
2157 | },
2158 | "«": {
2159 | "width": 6,
2160 | "height": 4,
2161 | "x": 297,
2162 | "y": 309,
2163 | "translateY": -1
2164 | },
2165 | "¬": {
2166 | "width": 8,
2167 | "height": 4,
2168 | "x": 303,
2169 | "y": 307,
2170 | "translateY": -3
2171 | },
2172 | "®": {
2173 | "width": 11,
2174 | "height": 10,
2175 | "x": 311,
2176 | "y": 304,
2177 | },
2178 | "Ї": {
2179 | "width": 5,
2180 | "height": 12,
2181 | "x": 322,
2182 | "y": 302,
2183 | },
2184 | "°": {
2185 | "width": 5,
2186 | "height": 5,
2187 | "x": 327,
2188 | "y": 303,
2189 | "translateY": -5
2190 | },
2191 | "±": {
2192 | "width": 8,
2193 | "height": 10,
2194 | "x": 332,
2195 | "y": 303,
2196 | },
2197 | "І": {
2198 | "same_as": "I"
2199 | },
2200 | "і": {
2201 | "same_as": "i"
2202 | },
2203 | "ґ": {
2204 | "width": 5,
2205 | "height": 8,
2206 | "x": 340,
2207 | "y": 305,
2208 | },
2209 | "µ": {
2210 | "width": 6,
2211 | "height": 9,
2212 | "x": 345,
2213 | "y": 306,
2214 | "translateY": 2
2215 | },
2216 | "¶": {
2217 | "width": 7,
2218 | "height": 13,
2219 | "x": 351,
2220 | "y": 303,
2221 | "translateY": 3
2222 | },
2223 | "·": {
2224 | "width": 2,
2225 | "height": 2,
2226 | "x": 358,
2227 | "y": 309,
2228 | "translateY": -2
2229 | },
2230 | "№": {
2231 | "width": 15,
2232 | "height": 10,
2233 | "x": 360,
2234 | "y": 303,
2235 | },
2236 | "є": {
2237 | "width": 6,
2238 | "height": 7,
2239 | "x": 375,
2240 | "y": 306,
2241 | },
2242 | "»": {
2243 | "width": 6,
2244 | "height": 4,
2245 | "x": 381,
2246 | "y": 308,
2247 | "translateY": -1
2248 | },
2249 | "ј": {
2250 | "same_as": "j"
2251 | },
2252 | "Ѕ": {
2253 | "same_as": "S"
2254 | },
2255 | "ѕ": {
2256 | "same_as": "s"
2257 | },
2258 | "ї": {
2259 | "width": 5,
2260 | "height": 9,
2261 | "x": 387,
2262 | "y": 304,
2263 | },
2264 | "ą": {
2265 | "width": 8,
2266 | "height": 10,
2267 | "x": 0,
2268 | "y": 322,
2269 | "translateY": 3
2270 | },
2271 | "ć": {
2272 | "width": 6,
2273 | "height": 10,
2274 | "x": 8,
2275 | "y": 319,
2276 | },
2277 | "ę": {
2278 | "width": 6,
2279 | "height": 10,
2280 | "x": 14,
2281 | "y": 322,
2282 | "translateY": 3
2283 | },
2284 | "ł": {
2285 | "width": 6,
2286 | "height": 10,
2287 | "x": 20,
2288 | "y": 319,
2289 | },
2290 | "ń": {
2291 | "width": 8,
2292 | "height": 10,
2293 | "x": 26,
2294 | "y": 319,
2295 | },
2296 | "ó": {
2297 | "width": 7,
2298 | "height": 10,
2299 | "x": 34,
2300 | "y": 319,
2301 | },
2302 | "ś": {
2303 | "width": 5,
2304 | "height": 10,
2305 | "x": 41,
2306 | "y": 319,
2307 | },
2308 | "ź": {
2309 | "width": 7,
2310 | "height": 10,
2311 | "x": 46,
2312 | "y": 319,
2313 | },
2314 | "ż": {
2315 | "width": 7,
2316 | "height": 10,
2317 | "x": 53,
2318 | "y": 319,
2319 | },
2320 | "Ą": {
2321 | "width": 10,
2322 | "height": 14,
2323 | "x": 60,
2324 | "y": 319,
2325 | "translateY": 4
2326 | },
2327 | "Ć": {
2328 | "width": 9,
2329 | "height": 13,
2330 | "x": 70,
2331 | "y": 316,
2332 | },
2333 | "Ę": {
2334 | "width": 9,
2335 | "height": 14,
2336 | "x": 79,
2337 | "y": 319,
2338 | "translateY": 4
2339 | },
2340 | "Ł": {
2341 | "width": 10,
2342 | "height": 10,
2343 | "x": 88,
2344 | "y": 319,
2345 | },
2346 | "Ń": {
2347 | "width": 11,
2348 | "height": 13,
2349 | "x": 98,
2350 | "y": 316,
2351 | },
2352 | "Ó": {
2353 | "width": 10,
2354 | "height": 13,
2355 | "x": 109,
2356 | "y": 316,
2357 | },
2358 | "Ś": {
2359 | "width": 7,
2360 | "height": 13,
2361 | "x": 119,
2362 | "y": 316,
2363 | },
2364 | "Ź": {
2365 | "width": 9,
2366 | "height": 13,
2367 | "x": 126,
2368 | "y": 316,
2369 | },
2370 | "Ż": {
2371 | "width": 9,
2372 | "height": 13,
2373 | "x": 135,
2374 | "y": 316,
2375 | },
2376 | "á": {
2377 | "width": 7,
2378 | "height": 10,
2379 | "x": 144,
2380 | "y": 319,
2381 | },
2382 | "é": {
2383 | "width": 6,
2384 | "height": 10,
2385 | "x": 151,
2386 | "y": 319,
2387 | },
2388 | "í": {
2389 | "width": 4,
2390 | "height": 10,
2391 | "x": 157,
2392 | "y": 319,
2393 | },
2394 | "ö": {
2395 | "width": 7,
2396 | "height": 9,
2397 | "x": 161,
2398 | "y": 320,
2399 | },
2400 | "ő": {
2401 | "width": 7,
2402 | "height": 10,
2403 | "x": 168,
2404 | "y": 319,
2405 | },
2406 | "ü": {
2407 | "width": 8,
2408 | "height": 9,
2409 | "x": 175,
2410 | "y": 320,
2411 | },
2412 | "ú": {
2413 | "width": 8,
2414 | "height": 10,
2415 | "x": 183,
2416 | "y": 319,
2417 | },
2418 | "ű": {
2419 | "width": 8,
2420 | "height": 10,
2421 | "x": 191,
2422 | "y": 319,
2423 | },
2424 | "Á": {
2425 | "width": 10,
2426 | "height": 13,
2427 | "x": 199,
2428 | "y": 316,
2429 | },
2430 | "É": {
2431 | "width": 8,
2432 | "height": 13,
2433 | "x": 209,
2434 | "y": 316,
2435 | },
2436 | "Í": {
2437 | "width": 4,
2438 | "height": 13,
2439 | "x": 217,
2440 | "y": 316,
2441 | },
2442 | "Ö": {
2443 | "width": 10,
2444 | "height": 12,
2445 | "x": 221,
2446 | "y": 317,
2447 | },
2448 | "Ő": {
2449 | "width": 10,
2450 | "height": 13,
2451 | "x": 231,
2452 | "y": 316,
2453 | },
2454 | "Ü": {
2455 | "width": 10,
2456 | "height": 12,
2457 | "x": 241,
2458 | "y": 317,
2459 | },
2460 | "Ú": {
2461 | "width": 10,
2462 | "height": 13,
2463 | "x": 251,
2464 | "y": 316,
2465 | },
2466 | "Ű": {
2467 | "width": 10,
2468 | "height": 13,
2469 | "x": 261,
2470 | "y": 316,
2471 | },
2472 | }
2473 |
2474 | Homm3MessageGenerator.colors = {
2475 | "red": {
2476 | "corners_offset": [192, 0],
2477 | "horizontals_offset": 95,
2478 | "verticals_offset": 0,
2479 | "flag": ""
2480 | },
2481 | "blue": {
2482 | "corners_offset": [192, 114],
2483 | "horizontals_offset": 107,
2484 | "verticals_offset": 10,
2485 | "flag": ""
2486 | },
2487 | "brown": {
2488 | "corners_offset": [306, 0],
2489 | "horizontals_offset": 119,
2490 | "verticals_offset": 20,
2491 | "flag": ""
2492 | },
2493 | "green": {
2494 | "corners_offset": [306, 114],
2495 | "horizontals_offset": 131,
2496 | "verticals_offset": 30,
2497 | "flag": ""
2498 | },
2499 | "orange": {
2500 | "corners_offset": [420, 0],
2501 | "horizontals_offset": 143,
2502 | "verticals_offset": 40,
2503 | "flag": ""
2504 | },
2505 | "violet": {
2506 | "corners_offset": [420, 114],
2507 | "horizontals_offset": 155,
2508 | "verticals_offset": 50,
2509 | "flag": ""
2510 | },
2511 | "teal": {
2512 | "corners_offset": [534, 0],
2513 | "horizontals_offset": 167,
2514 | "verticals_offset": 60,
2515 | "flag": ""
2516 | },
2517 | "pink": {
2518 | "corners_offset": [534, 114],
2519 | "horizontals_offset": 179,
2520 | "verticals_offset": 70,
2521 | "flag": ""
2522 | },
2523 | };
2524 |
2525 | Homm3MessageGenerator.sizes = [
2526 | {
2527 | "width": 4,
2528 | "height": 2,
2529 | "max_text_lines": 1,
2530 | "last_line_width": 202
2531 | },
2532 | {
2533 | "width": 5,
2534 | "height": 2,
2535 | "max_text_lines": 1,
2536 | "padding": {
2537 | "right": 19,
2538 | "left": 18
2539 | }
2540 | },
2541 | {
2542 | "width": 5,
2543 | "height": 3,
2544 | "max_text_lines": 4,
2545 | "lines": {
2546 | 2: {
2547 | "half": 242
2548 | },
2549 | 3: {
2550 | "half": 222
2551 | },
2552 | 4: {
2553 | "resize": 206
2554 | }
2555 | },
2556 | },
2557 | {
2558 | "width": 5,
2559 | "height": 4,
2560 | "max_text_lines": 8,
2561 | "lines": {
2562 | 5: {
2563 | "half": 190
2564 | },
2565 | 6: {
2566 | "half": 174
2567 | },
2568 | 7: {
2569 | "half": 158
2570 | },
2571 | 8: {
2572 | "resize": 142
2573 | }
2574 | },
2575 | "padding": {
2576 | "top": 16,
2577 | }
2578 | },
2579 | {
2580 | "width": 5,
2581 | "height": 5,
2582 | "max_text_lines": 9,
2583 | "lines": {
2584 | 9: {
2585 | "resize": 126
2586 | }
2587 | },
2588 | "padding": {
2589 | "top": 21,
2590 | }
2591 | },
2592 | {
2593 | "width": 7,
2594 | "height": 4,
2595 | "max_text_lines": 8,
2596 | "lines": {
2597 | 7: {
2598 | "half": 286
2599 | },
2600 | 8: {
2601 | "resize": 270
2602 | }
2603 | },
2604 | "padding": {
2605 | "top": 16
2606 | }
2607 | },
2608 | {
2609 | "width": 7,
2610 | "height": 5,
2611 | "max_text_lines": 11,
2612 | "lines": {
2613 | 9: {
2614 | "half": 254
2615 | },
2616 | 10: {
2617 | "half": 238
2618 | },
2619 | 11: {
2620 | "resize": 222
2621 | }
2622 | },
2623 | "padding": {
2624 | "top": 21
2625 | }
2626 | },
2627 | {
2628 | "width": 10,
2629 | "height": 4,
2630 | "max_text_lines": 8,
2631 | "lines": {
2632 | 8: {
2633 | "resize": 466
2634 | },
2635 | },
2636 | "padding": {
2637 | "top": 25
2638 | }
2639 | },
2640 | {
2641 | "width": 10,
2642 | "height": 5,
2643 | "max_text_lines": 11,
2644 | "lines": {
2645 | 9: {
2646 | "half": 446
2647 | },
2648 | 10: {
2649 | "half": 430
2650 | },
2651 | 11: {
2652 | "resize": 414
2653 | }
2654 | },
2655 | "padding": {
2656 | "top": 30
2657 | }
2658 | },
2659 | {
2660 | "width": 10,
2661 | "height": 5,
2662 | "scroll": true,
2663 | "max_text_lines": 11,
2664 | "padding": {
2665 | "top": 29,
2666 | "right": 38,
2667 | "left": 11
2668 | }
2669 | }
2670 | ];
--------------------------------------------------------------------------------