Bläddra i källkod

Update generator

Robert Carnecky 10 år sedan
förälder
incheckning
a26c198d41

+ 19
- 1
generator/css/cards.css Visa fil

@@ -158,10 +158,13 @@
158 158
     font-weight: normal;
159 159
     letter-spacing: 1px;
160 160
     margin: 0;
161
-    margin-bottom: -0.2em;
162 161
     border-color: inherit;
163 162
 }
164 163
 
164
+.card-section + .card-element {
165
+    margin-top: 0.3em;
166
+}
167
+
165 168
 .card-p {
166 169
 
167 170
 }
@@ -200,6 +203,21 @@
200 203
     margin-right: 0.3em;
201 204
 }
202 205
 
206
+.card-stats {
207
+    width: 100%
208
+}
209
+
210
+.card-stats-header {
211
+    text-align: center;
212
+    padding: 0;
213
+    width: 16.6%;
214
+}
215
+
216
+.card-stats-cell {
217
+    text-align: center;
218
+    padding: 0;
219
+}
220
+
203 221
 .card-bullet-line {
204 222
     font-size: inherit;
205 223
     color: black;

+ 12
- 0
generator/css/class-icons.css Visa fil

@@ -0,0 +1,12 @@
1
+.icon-class-barbarian { background-image: url(../img/classes/barbarian.png);}
2
+.icon-class-bard { background-image: url(../img/classes/bard.png);}
3
+.icon-class-cleric { background-image: url(../img/classes/cleric.png);}
4
+.icon-class-druid { background-image: url(../img/classes/druid.png);}
5
+.icon-class-fighter { background-image: url(../img/classes/fighter.png);}
6
+.icon-class-monk { background-image: url(../img/classes/monk.png);}
7
+.icon-class-paladin { background-image: url(../img/classes/paladin.png);}
8
+.icon-class-ranger { background-image: url(../img/classes/ranger.png);}
9
+.icon-class-rogue { background-image: url(../img/classes/rogue.png);}
10
+.icon-class-sorcerer { background-image: url(../img/classes/sorcerer.png);}
11
+.icon-class-warlock { background-image: url(../img/classes/warlock.png);}
12
+.icon-class-wizard { background-image: url(../img/classes/wizard.png);}

+ 22
- 0
generator/data/card_data_example.js Visa fil

@@ -129,5 +129,27 @@ var card_data_example = [
129 129
             "text | Drinking or administering a potion takes 1 action.",
130 130
             "fill | 3"
131 131
         ]
132
+    },
133
+    {
134
+        "count": 1,
135
+        "color": "black",
136
+        "title": "Goblin",
137
+        "icon": "imp-laugh",
138
+        "contents": [
139
+            "subtitle | Small humanoid (goblinoid)",
140
+            "rule",
141
+            "property | Armor class | 15 (leather armor, shield)",
142
+            "property | Hit points | 7 (2d6)",
143
+            "rule",
144
+            "dndstats | 8 | 14 | 10 | 10 | 8 | 8",
145
+            "rule",
146
+            "property | Skills | Stealth +6",
147
+            "property | Challenge | 1/4 (50 XP)",
148
+            "rule",
149
+            "description | Nimble escape | Disengage or Hide as bonus action",
150
+            "fill | 2",
151
+            "section | Actions",
152
+            "description | Scimitar | Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) slashing damage"
153
+        ]
132 154
     }
133 155
 ];

+ 41
- 4
generator/generate.html Visa fil

@@ -26,6 +26,7 @@
26 26
     <link href="css/cards.css" rel="stylesheet" />
27 27
     <link href="css/card-size.css" rel="stylesheet" />
28 28
     <link href="css/icons.css" rel="stylesheet" />
29
+	<link href="css/class-icons.css" rel="stylesheet" />
29 30
     <link href="css/custom-icons.css" rel="stylesheet" />
30 31
     <!-- Fonts -->
31 32
     <link href='https://fonts.googleapis.com/css?family=Noto+Sans:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
@@ -37,9 +38,8 @@
37 38
         <div class="row">
38 39
             <div class="alert alert-warning alert-dismissible" role="alert">
39 40
                 <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
40
-                <strong>Warning!</strong>
41
-                Some RPG systems are protected by copyright.
42
-                Even if some spell/item data is freely available, it does not mean you may redistribute cards containing such data.
41
+                <strong>Note</strong>
42
+                Click on "Open help" to display some information about how to use this generator and what to do if you have a feature request or found a bug.
43 43
             </div>
44 44
         </div>
45 45
         <div class="row">
@@ -313,7 +313,7 @@
313 313
         </div>
314 314
     </div>
315 315
     <!-- Modal -->
316
-    <div class="modal" id="print-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
316
+    <div class="modal" id="print-modal" tabindex="-1" role="dialog">
317 317
         <div class="modal-dialog">
318 318
             <div class="modal-content">
319 319
                 <div class="modal-header">
@@ -340,5 +340,42 @@
340 340
             </div>
341 341
         </div>
342 342
     </div>
343
+    <!-- Modal -->
344
+    <div class="modal" id="help-modal" tabindex="-1" role="dialog">
345
+        <div class="modal-dialog">
346
+            <div class="modal-content">
347
+                <div class="modal-header">
348
+                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
349
+                    <h4 class="modal-title" id="myModalLabel">RGP card generator</h4>
350
+                </div>
351
+                <div class="modal-body">
352
+                    <ul>
353
+                        <li>Some RPG systems are protected by copyright. Even if some spell/item data is freely available, it does not mean you may redistribute cards containing such data.</li>
354
+                        <li>If you find a bug or have a feature request, post them at the <a href="https://github.com/crobi/rpg-cards/issues">Github project site</a>.</li>
355
+                        <li>
356
+                            The user interface consists of three columns: 
357
+                            <img alt="help" src="img/help/help.png" style="max-width:95%; display:block; padding: 5px; margin: 10px 0 10px 0; border: 1px solid #ebebeb; box-shadow: 0 0 5px #ebebeb;"/>
358
+                            The left column contains the menu and global settings.
359
+                            In the middle menu, you can select and edit individual cards.
360
+                            The right column contains a preview of the selected card.
361
+                        </li>
362
+                        <li>
363
+                            To use the generator, either load the sample card deck ("Load sample"),
364
+                            load a card deck from a file ("Load from file"),
365
+                            or manually add some cards.
366
+                            When you're done, click on "Generate" to generate a document with all your cards, which can then be printed.
367
+                        </li>
368
+                        <li>
369
+                            To learn about what features are available to define a card, inspect the sample deck or
370
+                            read some basic documentation at the <a href="http://crobi.github.io/rpg-cards/">project site</a>.
371
+                        </li>
372
+                    </ul>
373
+                </div>
374
+                <div class="modal-footer">
375
+                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
376
+                </div>
377
+            </div>
378
+        </div>
379
+    </div>
343 380
 </body>
344 381
 </html>

Binär
generator/img/classes/barbarian.png Visa fil


Binär
generator/img/classes/bard.png Visa fil


Binär
generator/img/classes/cleric.png Visa fil


Binär
generator/img/classes/druid.png Visa fil


Binär
generator/img/classes/fighter.png Visa fil


Binär
generator/img/classes/monk.png Visa fil


Binär
generator/img/classes/paladin.png Visa fil


Binär
generator/img/classes/ranger.png Visa fil


Binär
generator/img/classes/rogue.png Visa fil


Binär
generator/img/classes/sorcerer.png Visa fil


Binär
generator/img/classes/warlock.png Visa fil


Binär
generator/img/classes/wizard.png Visa fil


Binär
generator/img/help/help.png Visa fil


+ 38
- 0
generator/js/cards.js Visa fil

@@ -137,6 +137,43 @@ function card_element_text(params, card_data, options) {
137 137
     return result;
138 138
 }
139 139
 
140
+function card_element_dndstats(params, card_data, options) {
141
+    var stats = [10, 10, 10, 10, 10, 10];
142
+    var mods = [0,0,0,0,0,0];
143
+    for (var i = 0; i < 6; ++i) {
144
+        stats[i] = parseInt(params[i], 10) || 0;
145
+        var mod = Math.floor(((stats[i] - 10) / 2));
146
+        if (mod >= 0) {
147
+            mod = "+" + mod;
148
+        } else {
149
+            mod = "" + mod;
150
+        }
151
+        mods[i] = "&nbsp;(" + mod + ")";
152
+    }
153
+
154
+    var result = "";
155
+    result += '<table class="card-stats">';
156
+    result += '    <tbody><tr>';
157
+    result += '      <th class="card-stats-header">STR</th>';
158
+    result += '      <th class="card-stats-header">DEX</th>';
159
+    result += '      <th class="card-stats-header">CON</th>';
160
+    result += '      <th class="card-stats-header">INT</th>';
161
+    result += '      <th class="card-stats-header">WIS</th>';
162
+    result += '      <th class="card-stats-header">CHA</th>';
163
+    result += '    </tr>';
164
+    result += '    <tr>';
165
+    result += '      <td class="card-stats-cell">' + stats[0] + mods[0] + '</td>';
166
+    result += '      <td class="card-stats-cell">' + stats[1] + mods[1] + '</td>';
167
+    result += '      <td class="card-stats-cell">' + stats[2] + mods[2] + '</td>';
168
+    result += '      <td class="card-stats-cell">' + stats[3] + mods[3] + '</td>';
169
+    result += '      <td class="card-stats-cell">' + stats[4] + mods[4] + '</td>';
170
+    result += '      <td class="card-stats-cell">' + stats[5] + mods[5] + '</td>';
171
+    result += '    </tr>';
172
+    result += '  </tbody>';
173
+    result += '</table>';
174
+    return result;
175
+}
176
+
140 177
 function card_element_bullet(params, card_data, options) {
141 178
     var result = "";
142 179
     result += '<ul class="card-element card-bullet-line">';
@@ -171,6 +208,7 @@ var card_element_generators = {
171 208
     ruler: card_element_ruler,
172 209
     boxes: card_element_boxes,
173 210
     description: card_element_description,
211
+    dndstats: card_element_dndstats,
174 212
     text: card_element_text,
175 213
     bullet: card_element_bullet,
176 214
     fill: card_element_fill,

+ 18
- 1
generator/js/icons.js Visa fil

@@ -1316,4 +1316,21 @@ var icon_names = [
1316 1316
     "zeus-sword",
1317 1317
     "zigzag-leaf",
1318 1318
     "zigzag-tune"
1319
-];
1319
+];
1320
+
1321
+var class_icon_names = [
1322
+	"class-barbarian",
1323
+	"class-bard",
1324
+	"class-cleric",
1325
+	"class-druid",
1326
+	"class-fighter",
1327
+	"class-monk",
1328
+	"class-paladin",
1329
+	"class-ranger",
1330
+	"class-rogue",
1331
+	"class-sorcerer",
1332
+	"class-warlock",
1333
+	"class-wizard"
1334
+];
1335
+
1336
+icon_names = icon_names.concat(class_icon_names);

+ 1
- 1
generator/js/ui.js Visa fil

@@ -184,7 +184,7 @@ function ui_render_selected_card() {
184 184
 }
185 185
 
186 186
 function ui_open_help() {
187
-    window.open("http://crobi.github.io/rpg-cards/", "_blank");
187
+    $("#help-modal").modal('show');
188 188
 }
189 189
 
190 190
 function ui_select_icon() {

Loading…
Avbryt
Spara