zig 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,6 @@
1
+ *.gem
2
+ .bundle
3
+ .config
4
+ .yardoc
5
+ Gemfile.lock
6
+ pkg
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Tim Lossen
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,21 @@
1
+ # ZIG
2
+
3
+ ZIG is a simple data format. It is designed to be edited by hand.
4
+ (Is is also quite easy to parse and generate, though.)
5
+
6
+ Here is a short example:
7
+
8
+ ```
9
+ {
10
+ type: 'error'
11
+ color: {
12
+ r: 255
13
+ g: 192
14
+ b: 0
15
+ description: "
16
+ Check your Internet connection. Restart any router, modem,
17
+ or other network devices you may be using.
18
+ codes: [
19
+ 118
20
+ 192
21
+ ```
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs = ["lib"]
6
+ t.test_files = FileList['test/*_test.rb']
7
+ t.verbose = true
8
+ end
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ require "json"
3
+
4
+ begin
5
+ require "zig"
6
+ rescue LoadError
7
+ $:.unshift File.expand_path('../lib', File.dirname(__FILE__))
8
+ require "zig"
9
+ end
10
+
11
+ data = JSON.parse(File.read(ARGV[0]))
12
+ ZIG.print(data)
@@ -0,0 +1,830 @@
1
+ {
2
+ "items": [
3
+ {
4
+ "type": "Farm",
5
+ "level": 1,
6
+ "x": 40,
7
+ "y": 54,
8
+ "damage": 0,
9
+ "contracts": {
10
+ "production": {
11
+ "owner": "Farm",
12
+ "level": -1,
13
+ "type": "production",
14
+ "requirements": {
15
+ "user_level": 1
16
+ },
17
+ "costs": {
18
+ "deposits": {
19
+ "gold": 10
20
+ },
21
+ "duration": 5
22
+ },
23
+ "option": 0,
24
+ "product": "Pumpkin",
25
+ "finished_at": 1347615487,
26
+ "energy_used": 0,
27
+ "rewards": {
28
+ "food": 15
29
+ }
30
+ }
31
+ }
32
+ },
33
+ {
34
+ "type": "House",
35
+ "level": 1,
36
+ "x": 47,
37
+ "y": 52,
38
+ "description": "The nearest market town is Mansle, which can be reached\n within 10 minutes (11kms) where the local produce market is on twice\n weekly. In the town, there are 2 main supermarkets, several bars,\n restaurants, office de tourism, hotel, horse race course, camping site,\n chemist and bakery."
39
+ },
40
+ {
41
+ "type": "House",
42
+ "level": 1,
43
+ "x": 53,
44
+ "y": 47,
45
+ "damage": 0,
46
+ "contracts": {
47
+ "production": {
48
+ "owner": "House",
49
+ "level": 1,
50
+ "type": "production",
51
+ "costs": {
52
+ "deposits": {
53
+ "food": 5
54
+ },
55
+ "duration": 5
56
+ },
57
+ "finished_at": 1347615490,
58
+ "energy_used": 0,
59
+ "rewards": {
60
+ "gold": 30
61
+ }
62
+ }
63
+ }
64
+ },
65
+ {
66
+ "type": "Academy",
67
+ "level": 0,
68
+ "x": 73,
69
+ "y": 45,
70
+ "damage": 0,
71
+ "contracts": {
72
+ "upgrade": {
73
+ "owner": "Academy",
74
+ "level": 0,
75
+ "type": "upgrade",
76
+ "asset_id": "ConstructionSite",
77
+ "costs": {
78
+ "deposits": {
79
+ "wood": 1000
80
+ },
81
+ "duration": 2,
82
+ "energy": 4,
83
+ "remainders": {
84
+ "sword": 3,
85
+ "helmet": 3,
86
+ "training_dummy": 3
87
+ }
88
+ },
89
+ "requirements": {
90
+ "user_level": 8,
91
+ "townhall_level": 2
92
+ },
93
+ "finished_at": 1,
94
+ "energy_used": 0,
95
+ "rewards": {
96
+ },
97
+ "decoration_boost": 0
98
+ }
99
+ }
100
+ },
101
+ {
102
+ "type": "Barracks",
103
+ "level": 0,
104
+ "x": 64,
105
+ "y": 52,
106
+ "damage": 0,
107
+ "contracts": {
108
+ "upgrade": {
109
+ "owner": "Barracks",
110
+ "level": 0,
111
+ "type": "upgrade",
112
+ "asset_id": "ConstructionSite",
113
+ "costs": {
114
+ "deposits": {
115
+ "wood": 100
116
+ },
117
+ "duration": 2,
118
+ "energy": 4,
119
+ "remainders": {
120
+ "sword": 3,
121
+ "helmet": 3,
122
+ "training_dummy": 3
123
+ }
124
+ },
125
+ "requirements": {
126
+ "user_level": 1,
127
+ "townhall_level": 1
128
+ },
129
+ "finished_at": 1,
130
+ "energy_used": 0,
131
+ "rewards": {
132
+ },
133
+ "decoration_boost": 0
134
+ }
135
+ }
136
+ },
137
+ {
138
+ "type": "Barracks",
139
+ "level": 0,
140
+ "x": 24,
141
+ "y": 44,
142
+ "damage": 0,
143
+ "contracts": {
144
+ "upgrade": {
145
+ "owner": "Barracks",
146
+ "level": 0,
147
+ "type": "upgrade",
148
+ "asset_id": "ConstructionSite",
149
+ "costs": {
150
+ "deposits": {
151
+ "wood": 2000
152
+ },
153
+ "duration": 2,
154
+ "energy": 4,
155
+ "remainders": {
156
+ "sword": 3,
157
+ "helmet": 3,
158
+ "training_dummy": 3
159
+ }
160
+ },
161
+ "requirements": {
162
+ "user_level": 20,
163
+ "townhall_level": 3
164
+ },
165
+ "finished_at": 1,
166
+ "energy_used": 0,
167
+ "rewards": {
168
+ },
169
+ "decoration_boost": 0
170
+ }
171
+ }
172
+ },
173
+ {
174
+ "type": "Lumbermill",
175
+ "level": 0,
176
+ "x": 82,
177
+ "y": 75,
178
+ "damage": 0,
179
+ "contracts": {
180
+ "upgrade": {
181
+ "owner": "Lumbermill",
182
+ "level": 0,
183
+ "type": "upgrade",
184
+ "asset_id": "ConstructionSite",
185
+ "costs": {
186
+ "deposits": {
187
+ "wood": 50
188
+ },
189
+ "duration": 2,
190
+ "energy": 4,
191
+ "remainders": {
192
+ "shovel": 3,
193
+ "saw": 3,
194
+ "pickaxe": 3
195
+ }
196
+ },
197
+ "requirements": {
198
+ "user_level": 1,
199
+ "townhall_level": 1
200
+ },
201
+ "finished_at": 1,
202
+ "energy_used": 0,
203
+ "rewards": {
204
+ },
205
+ "decoration_boost": 0
206
+ }
207
+ }
208
+ },
209
+ {
210
+ "type": "Lumbermill",
211
+ "level": 0,
212
+ "x": 65,
213
+ "y": 40,
214
+ "damage": 0,
215
+ "contracts": {
216
+ "upgrade": {
217
+ "owner": "Lumbermill",
218
+ "level": 0,
219
+ "type": "upgrade",
220
+ "asset_id": "ConstructionSite",
221
+ "costs": {
222
+ "deposits": {
223
+ "wood": 50
224
+ },
225
+ "duration": 2,
226
+ "energy": 4,
227
+ "remainders": {
228
+ "shovel": 3,
229
+ "saw": 3,
230
+ "pickaxe": 3
231
+ }
232
+ },
233
+ "requirements": {
234
+ "user_level": 1,
235
+ "townhall_level": 1
236
+ },
237
+ "finished_at": 1,
238
+ "energy_used": 0,
239
+ "rewards": {
240
+ },
241
+ "decoration_boost": 0
242
+ }
243
+ }
244
+ },
245
+ {
246
+ "type": "Lumbermill",
247
+ "level": 0,
248
+ "x": 32,
249
+ "y": 64,
250
+ "damage": 0,
251
+ "contracts": {
252
+ "upgrade": {
253
+ "owner": "Lumbermill",
254
+ "level": 0,
255
+ "type": "upgrade",
256
+ "asset_id": "ConstructionSite",
257
+ "costs": {
258
+ "deposits": {
259
+ "wood": 50
260
+ },
261
+ "duration": 2,
262
+ "energy": 4,
263
+ "remainders": {
264
+ "shovel": 3,
265
+ "saw": 3,
266
+ "pickaxe": 3
267
+ }
268
+ },
269
+ "requirements": {
270
+ "user_level": 1,
271
+ "townhall_level": 1
272
+ },
273
+ "finished_at": 1,
274
+ "energy_used": 0,
275
+ "rewards": {
276
+ },
277
+ "decoration_boost": 0
278
+ }
279
+ }
280
+ },
281
+ {
282
+ "type": "Quarry",
283
+ "level": 0,
284
+ "x": 44,
285
+ "y": 74,
286
+ "damage": 0,
287
+ "contracts": {
288
+ "upgrade": {
289
+ "owner": "Quarry",
290
+ "level": 0,
291
+ "type": "upgrade",
292
+ "asset_id": "ConstructionSite",
293
+ "costs": {
294
+ "deposits": {
295
+ "wood": 50
296
+ },
297
+ "duration": 2,
298
+ "energy": 4,
299
+ "remainders": {
300
+ "shovel": 3,
301
+ "saw": 3,
302
+ "pickaxe": 3
303
+ }
304
+ },
305
+ "requirements": {
306
+ "user_level": 1,
307
+ "townhall_level": 1
308
+ },
309
+ "finished_at": 1,
310
+ "energy_used": 0,
311
+ "rewards": {
312
+ },
313
+ "decoration_boost": 0
314
+ }
315
+ }
316
+ },
317
+ {
318
+ "type": "Quarry",
319
+ "level": 0,
320
+ "x": 74,
321
+ "y": 13,
322
+ "damage": 0,
323
+ "contracts": {
324
+ "upgrade": {
325
+ "owner": "Quarry",
326
+ "level": 0,
327
+ "type": "upgrade",
328
+ "asset_id": "ConstructionSite",
329
+ "costs": {
330
+ "deposits": {
331
+ "wood": 50
332
+ },
333
+ "duration": 2,
334
+ "energy": 4,
335
+ "remainders": {
336
+ "shovel": 3,
337
+ "saw": 3,
338
+ "pickaxe": 3
339
+ }
340
+ },
341
+ "requirements": {
342
+ "user_level": 1,
343
+ "townhall_level": 1
344
+ },
345
+ "finished_at": 1,
346
+ "energy_used": 0,
347
+ "rewards": {
348
+ },
349
+ "decoration_boost": 0
350
+ }
351
+ }
352
+ },
353
+ {
354
+ "type": "Quarry",
355
+ "level": 0,
356
+ "x": 35,
357
+ "y": 32,
358
+ "damage": 0,
359
+ "contracts": {
360
+ "upgrade": {
361
+ "owner": "Quarry",
362
+ "level": 0,
363
+ "type": "upgrade",
364
+ "asset_id": "ConstructionSite",
365
+ "costs": {
366
+ "deposits": {
367
+ "wood": 50
368
+ },
369
+ "duration": 2,
370
+ "energy": 4,
371
+ "remainders": {
372
+ "shovel": 3,
373
+ "saw": 3,
374
+ "pickaxe": 3
375
+ }
376
+ },
377
+ "requirements": {
378
+ "user_level": 1,
379
+ "townhall_level": 1
380
+ },
381
+ "finished_at": 1,
382
+ "energy_used": 0,
383
+ "rewards": {
384
+ },
385
+ "decoration_boost": 0
386
+ }
387
+ }
388
+ },
389
+ {
390
+ "type": "Quarry",
391
+ "level": 0,
392
+ "x": 14,
393
+ "y": 23,
394
+ "damage": 0,
395
+ "contracts": {
396
+ "upgrade": {
397
+ "owner": "Quarry",
398
+ "level": 0,
399
+ "type": "upgrade",
400
+ "asset_id": "ConstructionSite",
401
+ "costs": {
402
+ "deposits": {
403
+ "wood": 50
404
+ },
405
+ "duration": 2,
406
+ "energy": 4,
407
+ "remainders": {
408
+ "shovel": 3,
409
+ "saw": 3,
410
+ "pickaxe": 3
411
+ }
412
+ },
413
+ "requirements": {
414
+ "user_level": 1,
415
+ "townhall_level": 1
416
+ },
417
+ "finished_at": 1,
418
+ "energy_used": 0,
419
+ "rewards": {
420
+ },
421
+ "decoration_boost": 0
422
+ }
423
+ }
424
+ },
425
+ {
426
+ "type": "Townhall",
427
+ "level": 1,
428
+ "x": 47,
429
+ "y": 44
430
+ },
431
+ {
432
+ "type": "House",
433
+ "level": 1,
434
+ "x": 51,
435
+ "y": 64
436
+ },
437
+ {
438
+ "type": "Wall",
439
+ "level": 1,
440
+ "x": 57,
441
+ "y": 47
442
+ },
443
+ {
444
+ "type": "Wall",
445
+ "level": 1,
446
+ "x": 58,
447
+ "y": 47
448
+ },
449
+ {
450
+ "type": "Wall",
451
+ "level": 1,
452
+ "x": 59,
453
+ "y": 47
454
+ },
455
+ {
456
+ "type": "Wall",
457
+ "level": 1,
458
+ "x": 59,
459
+ "y": 48
460
+ },
461
+ {
462
+ "type": "Wall",
463
+ "level": 1,
464
+ "x": 59,
465
+ "y": 49
466
+ },
467
+ {
468
+ "type": "Road",
469
+ "x": 44,
470
+ "y": 50
471
+ },
472
+ {
473
+ "type": "Road",
474
+ "x": 46,
475
+ "y": 50
476
+ },
477
+ {
478
+ "type": "Road",
479
+ "x": 48,
480
+ "y": 50
481
+ },
482
+ {
483
+ "type": "Road",
484
+ "x": 50,
485
+ "y": 50
486
+ },
487
+ {
488
+ "type": "Road",
489
+ "x": 52,
490
+ "y": 50
491
+ },
492
+ {
493
+ "type": "Road",
494
+ "x": 54,
495
+ "y": 50
496
+ },
497
+ {
498
+ "type": "Road",
499
+ "x": 56,
500
+ "y": 50
501
+ },
502
+ {
503
+ "type": "Road",
504
+ "x": 58,
505
+ "y": 50
506
+ },
507
+ {
508
+ "type": "Road",
509
+ "x": 60,
510
+ "y": 50
511
+ },
512
+ {
513
+ "type": "Road",
514
+ "x": 62,
515
+ "y": 50
516
+ },
517
+ {
518
+ "type": "Road",
519
+ "x": 64,
520
+ "y": 50
521
+ },
522
+ {
523
+ "type": "Road",
524
+ "x": 66,
525
+ "y": 50
526
+ },
527
+ {
528
+ "type": "Road",
529
+ "x": 68,
530
+ "y": 50
531
+ },
532
+ {
533
+ "type": "Road",
534
+ "x": 70,
535
+ "y": 50
536
+ },
537
+ {
538
+ "type": "Road",
539
+ "x": 72,
540
+ "y": 50
541
+ },
542
+ {
543
+ "type": "Road",
544
+ "x": 74,
545
+ "y": 50
546
+ },
547
+ {
548
+ "type": "Road",
549
+ "x": 76,
550
+ "y": 50
551
+ },
552
+ {
553
+ "type": "Road",
554
+ "x": 78,
555
+ "y": 50
556
+ },
557
+ {
558
+ "type": "Road",
559
+ "x": 80,
560
+ "y": 50
561
+ },
562
+ {
563
+ "type": "Road",
564
+ "x": 82,
565
+ "y": 50
566
+ },
567
+ {
568
+ "type": "Road",
569
+ "x": 84,
570
+ "y": 50
571
+ },
572
+ {
573
+ "type": "Road",
574
+ "x": 86,
575
+ "y": 50
576
+ },
577
+ {
578
+ "type": "Road",
579
+ "x": 88,
580
+ "y": 50
581
+ },
582
+ {
583
+ "type": "Road",
584
+ "x": 54,
585
+ "y": 52
586
+ },
587
+ {
588
+ "type": "Wall",
589
+ "level": 1,
590
+ "x": 56,
591
+ "y": 52
592
+ },
593
+ {
594
+ "type": "Road",
595
+ "x": 88,
596
+ "y": 52
597
+ },
598
+ {
599
+ "type": "Wall",
600
+ "level": 1,
601
+ "x": 56,
602
+ "y": 53
603
+ },
604
+ {
605
+ "type": "Road",
606
+ "x": 88,
607
+ "y": 53
608
+ },
609
+ {
610
+ "type": "Road",
611
+ "x": 90,
612
+ "y": 53
613
+ },
614
+ {
615
+ "type": "Road",
616
+ "x": 92,
617
+ "y": 53
618
+ },
619
+ {
620
+ "type": "Road",
621
+ "x": 94,
622
+ "y": 53
623
+ },
624
+ {
625
+ "type": "Road",
626
+ "x": 96,
627
+ "y": 53
628
+ },
629
+ {
630
+ "type": "Road",
631
+ "x": 98,
632
+ "y": 53
633
+ },
634
+ {
635
+ "type": "Road",
636
+ "x": 54,
637
+ "y": 54
638
+ },
639
+ {
640
+ "type": "Wall",
641
+ "level": 1,
642
+ "x": 56,
643
+ "y": 54
644
+ },
645
+ {
646
+ "type": "Wall",
647
+ "level": 1,
648
+ "x": 57,
649
+ "y": 54
650
+ },
651
+ {
652
+ "type": "Road",
653
+ "x": 54,
654
+ "y": 56
655
+ },
656
+ {
657
+ "type": "Road",
658
+ "x": 54,
659
+ "y": 62
660
+ },
661
+ {
662
+ "type": "Road",
663
+ "x": 54,
664
+ "y": 64
665
+ },
666
+ {
667
+ "type": "Wall",
668
+ "level": 1,
669
+ "x": 66,
670
+ "y": 67
671
+ },
672
+ {
673
+ "type": "Wall",
674
+ "level": 1,
675
+ "x": 64,
676
+ "y": 68
677
+ },
678
+ {
679
+ "type": "Wall",
680
+ "level": 1,
681
+ "x": 65,
682
+ "y": 68
683
+ },
684
+ {
685
+ "type": "Wall",
686
+ "level": 1,
687
+ "x": 66,
688
+ "y": 68
689
+ },
690
+ {
691
+ "type": "Port",
692
+ "level": 1,
693
+ "x": 54,
694
+ "y": 81
695
+ }
696
+ ],
697
+ "map_expansions": [
698
+ [
699
+ 0,
700
+ 0,
701
+ 0,
702
+ 0,
703
+ 0,
704
+ 0,
705
+ 0,
706
+ 0
707
+ ],
708
+ [
709
+ 0,
710
+ 0,
711
+ 0,
712
+ 0,
713
+ 0,
714
+ 0,
715
+ 0,
716
+ 0
717
+ ],
718
+ [
719
+ 0,
720
+ 0,
721
+ 0,
722
+ 0,
723
+ 0,
724
+ 0,
725
+ 0,
726
+ 0
727
+ ],
728
+ [
729
+ 0,
730
+ 0,
731
+ 0,
732
+ 1,
733
+ 1,
734
+ 0,
735
+ 0,
736
+ 0
737
+ ],
738
+ [
739
+ 0,
740
+ 0,
741
+ 0,
742
+ 1,
743
+ 1,
744
+ 0,
745
+ 0,
746
+ 0
747
+ ],
748
+ [
749
+ 0,
750
+ 0,
751
+ 0,
752
+ 0,
753
+ 0,
754
+ 0,
755
+ 0,
756
+ 0
757
+ ],
758
+ [
759
+ 0,
760
+ 0,
761
+ 0,
762
+ 0,
763
+ 0,
764
+ 0,
765
+ 0,
766
+ 0
767
+ ],
768
+ [
769
+ 0,
770
+ 0,
771
+ 0,
772
+ 0,
773
+ 0,
774
+ 0,
775
+ 0,
776
+ 0
777
+ ]
778
+ ],
779
+ "resources": {
780
+ "gold": 200,
781
+ "food": 200,
782
+ "wood": 200,
783
+ "stone": 0,
784
+ "xp": 0,
785
+ "shovel": 1000,
786
+ "wheelbarrow": 1000,
787
+ "saw": 1000,
788
+ "pickaxe": 1000,
789
+ "rope": 1000,
790
+ "wheel": 1000,
791
+ "candle": 1000,
792
+ "beer_barrel": 1000,
793
+ "oak_door": 1000,
794
+ "goblet": 1000,
795
+ "mirror": 1000,
796
+ "tapestry": 1000,
797
+ "painting": 1000,
798
+ "marble_pillar": 1000,
799
+ "marble_statue": 1000,
800
+ "bread_loaf": 1000,
801
+ "beef_stew": 1000,
802
+ "leg_of_mutton": 1000,
803
+ "roasted_chicken": 1000,
804
+ "shield": 1000,
805
+ "sword": 1000,
806
+ "helmet": 1000,
807
+ "training_dummy": 1000,
808
+ "horseshoe": 1000,
809
+ "saddle": 1000,
810
+ "jousting_lance": 1000,
811
+ "arrow": 1000,
812
+ "bow": 1000,
813
+ "archery_target": 1000,
814
+ "royal_seal": 10,
815
+ "land_deed": 1000,
816
+ "spyglass": 1000,
817
+ "compass": 1000,
818
+ "quill_pen": 1000,
819
+ "map": 1000,
820
+ "parchment": 1000,
821
+ "carrier_pigeon": 1000
822
+ },
823
+ "units": [
824
+ {
825
+ "amount": 10,
826
+ "level": 1,
827
+ "type": "Peasant"
828
+ }
829
+ ]
830
+ }