Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

examples removed from source.

menu removed.
tree structure fixes.
  • Loading branch information...
commit e7ae206d1f2f49f507f2ed17489d64d730651f4c 1 parent 429f128
authored

Showing 37 changed files with 31 additions and 1,231 deletions. Show diff stats Hide diff stats

  1. +4 2 Makefile
  2. +0 112 css/menu.css
  3. +0 25 examples/example1.twr/LICENSE
  4. +0 13 examples/example1.twr/README
  5. +0 36 examples/example1.twr/elements/core.xml
  6. +0 19 examples/example1.twr/elements/equipment.xml
  7. +0 4 examples/example1.twr/elements/heroes.xml
  8. +0 4 examples/example1.twr/elements/magic.xml
  9. BIN  examples/example1.twr/favicon.png
  10. +0 107 examples/example1.twr/info.xml
  11. 0  examples/example1.twr/scripts/helpers.js
  12. 0  examples/example1.twr/scripts/validator.js
  13. +0 25 examples/example2.twr/LICENSE
  14. +0 17 examples/example2.twr/README
  15. +0 160 examples/example2.twr/elements/core_units.xml
  16. +0 4 examples/example2.twr/elements/equipment.xml
  17. +0 4 examples/example2.twr/elements/heroes.xml
  18. +0 4 examples/example2.twr/elements/special_units.xml
  19. +0 4 examples/example2.twr/elements/templates.xml
  20. +0 4 examples/example2.twr/elements/tournament.xml
  21. 0  examples/example2.twr/errors.xml
  22. BIN  examples/example2.twr/icons/icon16.png
  23. BIN  examples/example2.twr/icons/icon32.png
  24. BIN  examples/example2.twr/icons/icon64.png
  25. +0 171 examples/example2.twr/info.xml
  26. +0 3  examples/example2.twr/lang/en.xml
  27. +0 3  examples/example2.twr/lang/pl.xml
  28. 0  examples/example2.twr/scripts/display.js
  29. 0  examples/example2.twr/scripts/helpers1.js
  30. 0  examples/example2.twr/scripts/validator.js
  31. +4 102 src/armycalc.js
  32. +0 275 src/dep.instance.js
  33. +6 2 src/instance.js
  34. +3 17 tests/index.css
  35. +1 1  tests/index.html
  36. +10 104 web/armycalc.js
  37. +3 9 web/template.html
6 Makefile
@@ -23,7 +23,6 @@ JS_FILES = ${SRC_DIR}/armycalc.js\
23 23 ${SRC_DIR}/sandbox.js
24 24
25 25 CSS_FILES = ${CSS_DIR}/layout.css\
26   - ${CSS_DIR}/menu.css\
27 26 ${CSS_DIR}/statusbar.css\
28 27 ${CSS_DIR}/toolbar.css\
29 28 ${CSS_DIR}/validation.css\
@@ -89,4 +88,7 @@ doc:
89 88 clean:
90 89 @@echo "Cleaning up"
91 90 @@rm ${AC}
92   -
  91 + @@rm ${AC_CSS}
  92 + @@rm ${AC_MIN}
  93 + @@rm ${AC_CSS_MIN}
  94 +
112 css/menu.css
... ... @@ -1,112 +0,0 @@
1   -/* MENU */
2   -
3   -div.acCanvas div.menucontainer {
4   - background: black;
5   - min-height: 25px;
6   - color: white;
7   - line-height: 22px;
8   - margin-bottom: 7px;
9   -}
10   -
11   -div.acCanvas div.menu {
12   - position:absolute;
13   - z-index:10;
14   - /*
15   - left:20px;
16   - margin-left:-2.5em;
17   - width:80%;
18   - */
19   -}
20   -
21   -div.acCanvas div.menu #acElements li>ul {
22   - top: auto;
23   - left: auto;
24   -}
25   -
26   -div.acCanvas div.menu #acElements {
27   - list-style: none;
28   -}
29   -
30   -div.acCanvas div.menu #acElements ul {
31   - padding: 0;
32   - margin:0;
33   - list-style: none;
34   - width:10em;
35   - z-index:99;
36   - position:relative;
37   - overflow:visible;
38   -}
39   -
40   -div.acCanvas div.menu #acElements li {
41   - margin:0;
42   - position: relative;
43   - float:left;
44   - width: 10em;
45   - background-color: black;
46   - border:solid 1px #444;
47   - display:block;
48   - height:auto;
49   -}
50   -
51   -div.acCanvas div.menu #acElements ul li{
52   - background-color: black;
53   -}
54   -
55   -div.acCanvas div.menu #acElements ul li{
56   - border-width:1px 1px 0 0;
57   -}
58   -
59   -div.acCanvas div.menu #acElements ul ul li{
60   - border-width:1px 1px 0 1px;
61   -}
62   -
63   -div.acCanvas div.menu #acElements ul ul li:last-child {
64   - border-width:1px;
65   -}
66   -
67   -div.acCanvas div.menu #acElements a {
68   - text-align: center;
69   - text-decoration:none;
70   - display:block;
71   - color: white;
72   - white-space: nowrap;
73   - /* padding: 0.1em;
74   - margin:0.2em 0 0.2em 0.1em;
75   - width:11.5em;
76   - height:1.05em; */
77   -}
78   -
79   -div.acCanvas div.menu #acElements a:hover {
80   - background-color: white;
81   - color: black;
82   -}
83   -/* div.acCanvas div.menu #acElements a:hover, div.acCanvas div.menu #acElements li:hover, div.acCanvas div.menu #acElements ul li:hover, div.acCanvas div.menu #acElements ul li a:hover */
84   -
85   -div.acCanvas div.menu #acElements ul{
86   - display:none;
87   -}
88   -
89   -/*all see this */
90   -div.acCanvas div.menu #acElements ul ul, div.acCanvas div.menu #acElements ul ul ul{
91   - display:none;
92   - position:absolute;
93   - margin-top:-1.8em;
94   - margin-left:10em;
95   -}
96   -
97   -/* non-IE browsers see this */
98   -div.acCanvas div.menu #acElements ul li>ul, div.acCanvas div.menu #acElements ul ul li>ul {
99   - margin-top:-1.35em;
100   -}
101   -
102   -
103   -div.acCanvas div.menu #acElements li:hover ul ul, div.acCanvas div.menu #acElements li:hover ul ul ul, div.acCanvas div.menu #acElements li:hover ul ul ul ul, div.acCanvas div.menu #acElements li:hover ul ul ul ul ul {
104   - display:none;
105   -}
106   -
107   -div.acCanvas div.menu #acElements li:hover ul, div.acCanvas div.menu #acElements ul li:hover ul, div.acCanvas div.menu #acElements ul ul li:hover ul, div.acCanvas div.menu #acElements ul ul ul li:hover ul, div.acCanvas div.menu #acElements ul ul ul ul li:hover ul {
108   - /* display:block; */
109   -}
110   -
111   -
112   -
25 examples/example1.twr/LICENSE
... ... @@ -1,25 +0,0 @@
1   -Copyright 2011 CadoSolutions. All rights reserved.
2   -
3   -Redistribution and use in source and binary forms, with or without modification, are
4   -permitted provided that the following conditions are met:
5   -
6   - 1. Redistributions of source code must retain the above copyright notice, this list of
7   - conditions and the following disclaimer.
8   -
9   - 2. Redistributions in binary form must reproduce the above copyright notice, this list
10   - of conditions and the following disclaimer in the documentation and/or other materials
11   - provided with the distribution.
12   -
13   -THIS SOFTWARE IS PROVIDED BY CadoSolutions "AS IS" AND ANY EXPRESS OR IMPLIED
14   -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
15   -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CadoSolutions OR
16   -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17   -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18   -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19   -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20   -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
21   -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22   -
23   -The views and conclusions contained in the software and documentation are those of the
24   -authors and should not be interpreted as representing official policies, either expressed
25   -or implied, of CadoSolutions.
13 examples/example1.twr/README
... ... @@ -1,13 +0,0 @@
1   -
2   -twr3examples
3   -this repository contains examples of TWR 3.0 files to share between clients
4   -part of the ArmyCalc project
5   -Copyright 2011 CadoSolutions. All rights reserved.
6   -released under terms of Simplified BSD License
7   -
8   -developer: Franciszek Szczepan Wawrzak <frank@wawrzak.com>
9   -project website: http://armycalc.com/
10   -
11   -
12   -
13   -
36 examples/example1.twr/elements/core.xml
... ... @@ -1,36 +0,0 @@
1   -<?xml version="1.0" encoding="UTF-8" ?>
2   -<elements version="3.0">
3   -
4   - <element id="warrior" minCount="1" maxCount="5" minSize="1" defaultSize="5" maxSize="20">
5   -
6   - <name>Warrior</name>
7   - <description>There have to be at least one and maximum 5 units of
8   - warriors in the army. Each unit can contain from 1 to 20 warriors.
9   - </description>
10   -
11   - <stats><stat id="str">5</stat><stat id="sta">5</stat><stat id="spe">5</stat><stat id="hp">10</stat></stats>
12   - <costs><cost id="pts">10</cost><cost id="gc">1</cost></costs>
13   -
14   - <thumbnail src="media/warrior.jpg"></thumbnail>
15   -
16   - <group extends="weapon"/>
17   -
18   - <group id="command">
19   - <element id="chieftain" minCount="0" maxCount="1" minSize="1" maxSize="1">
20   - <name>Chieftain</name>
21   - <stats><stat id="str">6</stat><stat id="sta">6</stat><stat id="spe">6</stat><stat id="hp">10</stat></stats>
22   -
23   - <element id="squire" minCount="1" maxCount="1" minSize="1" maxSize="1">
24   - <name>Chieftain's squire</name>
25   - <stats><stat id="str">1</stat><stat id="sta">1</stat><stat id="spe">1</stat><stat id="hp">1</stat></stats>
26   - </element>
27   - </element>
28   -
29   - <element id="musician" minCount="0" maxCount="1" minSize="1" maxSize="1">
30   - <name>Musician</name>
31   - </element>
32   - </group>
33   -
34   - </element>
35   -
36   -</elements>
19 examples/example1.twr/elements/equipment.xml
... ... @@ -1,19 +0,0 @@
1   -<?xml version="1.0" encoding="UTF-8" ?>
2   -<elements version="3.0">
3   -
4   - <group id="weapon" minTotalCount="0" maxTotalCount="1">
5   - <element id="shield" size="inherit" afterAppend="that.parent.stat('sta',that.parent.stat('sta')+1);"
6   - beforeRemove="that.parent.stat('sta',that.parent.stat('sta')-1);">
7   - <name>Shield</name>
8   - <description>Shield is a common equipment</description>
9   - <costs><cost id="pts">2</cost><cost id="gc">0</cost></costs>
10   - </element>
11   -
12   - <element id="2hWpn" size="inherit">
13   - <name>2 handed weapon</name>
14   - <description>Shield is a common equipment</description>
15   - <costs><cost id="pts">2</cost><cost id="gc">0</cost></costs>
16   - </element>
17   - </group>
18   -
19   -</elements>
4 examples/example1.twr/elements/heroes.xml
... ... @@ -1,4 +0,0 @@
1   -<?xml version="1.0" encoding="UTF-8" ?>
2   -<elements version="3.0">
3   -
4   -</elements>
4 examples/example1.twr/elements/magic.xml
... ... @@ -1,4 +0,0 @@
1   -<?xml version="1.0" encoding="UTF-8" ?>
2   -<elements version="3.0">
3   -
4   -</elements>
BIN  examples/example1.twr/favicon.png
107 examples/example1.twr/info.xml
... ... @@ -1,107 +0,0 @@
1   -<?xml version="1.0" encoding="UTF-8" ?>
2   -<ruleset version="3.0">
3   -
4   - <identity>
5   - <uid>armycalc.twr3.test01</uid>
6   - <revision>3</revision>
7   - <url></url>
8   - </identity>
9   -
10   - <languages>
11   - <language id="pl">
12   - <transtab src="lang/polish.xml" />
13   - <name>Polski (polish)</name>
14   - </language>
15   - <language id="en" default="true">
16   - <transtab src="lang/english.xml" />
17   - <name>English</name>
18   - </language>
19   - </languages>
20   -
21   - <info>
22   - <name>Example TWR 3.0</name>
23   - <author>
24   - <name>francio</name>
25   - <email>francio@armycalc.com</email>
26   - <www></www>
27   - </author>
28   - <description>
29   - <short></short>
30   - <full></full>
31   - </description>
32   - <favicon src="favicon.png" />
33   - </info>
34   -
35   - <stats>
36   - <stat id="str" display="true">
37   - <name>strength</name>
38   - <shortname>Str</shortname>
39   - <default>5</default>
40   - </stat>
41   - <stat id="sta" display="true">
42   - <name>stamina</name>
43   - <shortname>Sta</shortname>
44   - <default>5</default>
45   - </stat>
46   - <stat id="spe" display="true">
47   - <name>speed</name>
48   - <shortname>Spe</shortname>
49   - <default>5</default>
50   - </stat>
51   - <stat id="hp" display="true">
52   - <name>hitpoints</name>
53   - <name>HP</name>
54   - <shortname>HP</shortname>
55   - <default>10</default>
56   - </stat>
57   - <stat id="us">
58   - <name>unit size</name>
59   - <name>US</name>
60   - <shortname>US</shortname>
61   - <default>1</default>
62   - </stat>
63   - </stats>
64   -
65   - <costs>
66   - <cost id="pts" default="true">
67   - <name>Points</name>
68   - <shortname>pts</shortname>
69   - <unit>pts</unit>
70   - <default>0</default>
71   - </cost>
72   - <cost id="gc">
73   - <name>Gold Coins</name>
74   - <shortname>GC</shortname>
75   - <unit>coins</unit>
76   - <default>0</default>
77   - </cost>
78   - </costs>
79   -
80   - <data>
81   - <elements>
82   - <elements src="elements/equipment.xml" />
83   - <elements src="elements/magic.xml" />
84   - <elements src="elements/core.xml" />
85   - <elements src="elements/heroes.xml" />
86   - </elements>
87   - <scripts>
88   - <script src="scripts/helpers.js" />
89   - <script src="scripts/validator.js" />
90   - </scripts>
91   - </data>
92   -
93   - <armies>
94   - <army id="defaultArmy">
95   - <group id="coreUnits">
96   - <name>Core Units</name>
97   - <element extends="warriors" />
98   - <element extends="archers" />
99   - </group>
100   - <element extends="hero" />
101   - </army>
102   - <army id="tournamentArmy" extends="defaultArmy">
103   - <element extends="specialHero" />
104   - </army>
105   - </armies>
106   -
107   -</ruleset>
0  examples/example1.twr/scripts/helpers.js
No changes.
0  examples/example1.twr/scripts/validator.js
No changes.
25 examples/example2.twr/LICENSE
... ... @@ -1,25 +0,0 @@
1   -Copyright 2011 CadoSolutions. All rights reserved.
2   -
3   -Redistribution and use in source and binary forms, with or without modification, are
4   -permitted provided that the following conditions are met:
5   -
6   - 1. Redistributions of source code must retain the above copyright notice, this list of
7   - conditions and the following disclaimer.
8   -
9   - 2. Redistributions in binary form must reproduce the above copyright notice, this list
10   - of conditions and the following disclaimer in the documentation and/or other materials
11   - provided with the distribution.
12   -
13   -THIS SOFTWARE IS PROVIDED BY CadoSolutions "AS IS" AND ANY EXPRESS OR IMPLIED
14   -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
15   -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CadoSolutions OR
16   -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17   -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18   -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19   -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20   -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
21   -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22   -
23   -The views and conclusions contained in the software and documentation are those of the
24   -authors and should not be interpreted as representing official policies, either expressed
25   -or implied, of CadoSolutions.
17 examples/example2.twr/README
... ... @@ -1,17 +0,0 @@
1   -README
2   -
3   -This archive is a TWR file containing tabletop wargame data.
4   -This file is added to every TWR and it is not the part of the ruleset itself.
5   -
6   -####################
7   -List of required files that should be in this package:
8   -
9   -README - this file.
10   -LICENCE - licence of this data choosen by the author.
11   -info.xml - most important ruleset info.
12   -
13   -every other file here is specific to this game and should be referenced in info.xml in data section
14   -
15   -####################
16   -This file was build on armycalc.net a collaborative space for wargame players
17   -Please visit armycalc.net for more info
160 examples/example2.twr/elements/core_units.xml
... ... @@ -1,160 +0,0 @@
1   -<?xml version="1.0" encoding="utf-8"?>
2   -<elements xmlns="armycalc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="armycalc http://armycalc.org/xmls/twr3elements.xsd" version="3.0">
3   -
4   - <element id="warrior" minCount="1" maxCount="5" defaultSize="5" maxSize="20">
5   - <name>Warrior</name>
6   - <description>There have to be at least one and maximum 5 units of warriors in the army. Each unit can contain from 1 to 20 warriors.</description>
7   - <stats>
8   - <stat id="str">5</stat>
9   - <stat id="sta">5</stat>
10   - <stat id="spe">5</stat>
11   - <stat id="hp">10</stat>
12   - </stats>
13   -
14   - <cost id="pts">10</cost>
15   - <cost id="gc">1</cost>
16   -
17   - <thumbnail src="media/warrior.jpg"></thumbnail>
18   -
19   - <elements>
20   - <element minCount="0" maxCount="1" minSize="1" maxSize="1">
21   - <uid>chieftain</uid>
22   - <name>Chieftain</name>
23   - <stats>
24   - <stat id="str">6</stat>
25   - <stat id="sta">6</stat>
26   - <stat id="spe">6</stat>
27   - <stat id="hp">10</stat>
28   - </stats>
29   -
30   - <elements>
31   - <element minCount="1" maxCount="1" minSize="1" maxSize="1">
32   - <uid>chieftains-squire</uid>
33   - <name>Chieftain's squire</name>
34   - <stats>
35   - <stat id="str">1</stat>
36   - <stat id="sta">1</stat>
37   - <stat id="spe">1</stat>
38   - <stat id="hp">1</stat>
39   - </stats>
40   - </element>
41   - </elements>
42   -
43   - </element>
44   - </elements>
45   -
46   - <elements maxTotalCount="1">
47   -
48   - <element minCount="0" maxCount="1" size="inherit"
49   - afterAppend = "that.parent.stat('sta',that.parent.stat('sta')+1);"
50   - beforeRemove = "that.parent.stat('sta',that.parent.stat('sta')-1);">
51   - <uid>shield</uid>
52   - <name>Shield</name>
53   - <cost id="pts">1</cost>
54   - </element>
55   -
56   - <element minCount="0" maxCount="1" size="inherit"
57   - afterAppend = "that.parent.stat('str',that.parent.stat('str')+1);"
58   - beforeRemove = "that.parent.stat('str',that.parent.stat('str')-1);">
59   - <uid>two-handed-weapon</uid>
60   - <name>Two handed weapon</name>
61   - <cost id="pts">1</cost>
62   -
63   - </element>
64   -
65   - </elements>
66   -
67   - </element>
68   -
69   - <element id="archer" minCount="0" maxCount="2" minSize="1" defaultSize="3" maxSize="20">
70   -
71   - <name>Archer</name>
72   - <description></description>
73   -
74   - <menu id="menu-infantry-units" />
75   -
76   - <stats>
77   - <stat id="str">4</stat>
78   - <stat id="sta">6</stat>
79   - <stat id="spe">5</stat>
80   - <stat id="hp">5</stat>
81   - </stats>
82   -
83   - <cost id="pts">10</cost>
84   - <cost id="gc">1</cost>
85   -
86   - <thumbnail src="media/archer.jpg"></thumbnail>
87   -
88   - <elements>
89   - <element minCont="0" maxCount="1" minSize="1" maxSize="1">
90   - <uid>chieftain</uid>
91   - <name>Chieftain</name>
92   - <stats>
93   - <stat id="str">6</stat>
94   - <stat id="sta">6</stat>
95   - <stat id="spe">6</stat>
96   - <stat id="hp">10</stat>
97   - </stats>
98   - </element>
99   - </elements>
100   -
101   - </element>
102   -
103   - <element id="peon" minCount="0" minSize="5" defaultSize="10">
104   -
105   - <name>Peon</name>
106   -
107   - <description></description>
108   -
109   - <menu id="menu-infantry-units" />
110   -
111   - <stats>
112   - <stat id="str">2</stat>
113   - <stat id="sta">2</stat>
114   - <stat id="spe">2</stat>
115   - <stat id="hp">4</stat>
116   - </stats>
117   -
118   - <cost id="pts">1</cost>
119   - <cost id="gc">0</cost>
120   -
121   - <thumbnail src="media/peon.jpg"></thumbnail>
122   -
123   - </element>
124   -
125   - <element id="horseman" minCount="0" maxCount="2" minSize="3" defaultSize="5" maxSize="10">
126   -
127   - <name>Horseman</name>
128   -
129   - <description></description>
130   -
131   - <menu id="menu-cavalry-units" />
132   -
133   - <stats>
134   - <stat id="str">3</stat>
135   - <stat id="sta">3</stat>
136   - <stat id="spe">3</stat>
137   - <stat id="hp">6</stat>
138   - </stats>
139   -
140   - <cost id="pts">1</cost>
141   - <cost id="gc">0</cost>
142   -
143   - <thumbnail src="media/horseman.jpg"></thumbnail>
144   -
145   - <elements>
146   - <element minCount="1" maxCount="1" size="inherit">
147   - <uid>horse</uid>
148   - <name>Horse</name>
149   - <stats>
150   - <stat id="str">0</stat>
151   - <stat id="sta">0</stat>
152   - <stat id="spe">25</stat>
153   - <stat id="hp">2</stat>
154   - </stats>
155   - </element>
156   - </elements>
157   -
158   - </element>
159   -
160   -</elements>
4 examples/example2.twr/elements/equipment.xml
... ... @@ -1,4 +0,0 @@
1   -<?xml version="1.0" encoding="utf-8"?>
2   -<elements xmlns="armycalc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="armycalc http://armycalc.org/xmls/twr3elements.xsd" version="3.0">
3   -
4   -</elements>
4 examples/example2.twr/elements/heroes.xml
... ... @@ -1,4 +0,0 @@
1   -<?xml version="1.0" encoding="utf-8"?>
2   -<elements xmlns="armycalc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="armycalc http://armycalc.org/xmls/twr3elements.xsd" version="3.0">
3   -
4   -</elements>
4 examples/example2.twr/elements/special_units.xml
... ... @@ -1,4 +0,0 @@
1   -<?xml version="1.0" encoding="utf-8"?>
2   -<elements xmlns="armycalc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="armycalc http://armycalc.org/xmls/twr3elements.xsd" version="3.0">
3   -
4   -</elements>
4 examples/example2.twr/elements/templates.xml
... ... @@ -1,4 +0,0 @@
1   -<?xml version="1.0" encoding="utf-8"?>
2   -<elements xmlns="armycalc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="armycalc http://armycalc.org/xmls/twr3elements.xsd" version="3.0">
3   -
4   -</elements>
4 examples/example2.twr/elements/tournament.xml
... ... @@ -1,4 +0,0 @@
1   -<?xml version="1.0" encoding="utf-8"?>
2   -<elements xmlns="armycalc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="armycalc http://armycalc.org/xmls/twr3elements.xsd" version="3.0">
3   -
4   -</elements>
0  examples/example2.twr/errors.xml
No changes.
BIN  examples/example2.twr/icons/icon16.png
BIN  examples/example2.twr/icons/icon32.png
BIN  examples/example2.twr/icons/icon64.png
171 examples/example2.twr/info.xml
... ... @@ -1,171 +0,0 @@
1   -<?xml version="1.0" encoding="utf-8"?>
2   -<ruleset xmlns="armycalc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="armycalc http://armycalc.org/xsd/twr3info.xsd" version="3.0">
3   -
4   - <!--
5   - This section contains various information to help identify the ruleset in various application.
6   - When application opens an army it uses this section to find correspoding ruleset.
7   - -->
8   - <identity>
9   - <uid>123</uid>
10   - <revision>1</revision>
11   - <origin>git.armycalc.net/twr3/123.git</origin>
12   - <url>http://armycalc.net/game/123/files/</url>
13   - </identity>
14   -
15   - <!--
16   - further sections are for information purposes only.
17   - -->
18   - <name>Example Ruleset</name>
19   -
20   - <author>
21   - <name>francio</name>
22   - <email>francio@armycalc.com</email>
23   - <netid>1</netid>
24   - <login>francio</login>
25   - <url>http://armycalc.net/user/francio</url>
26   - </author>
27   -
28   - <description>
29   - <full tid="info_description_full">This is an example Ruleset. It contains example units, add-ons and validation script for the abstract game system.</full>
30   - <short tid="info_description_short">This is an example Ruleset. It contains example units, add-ons and validation script for the abstrac...</short>
31   - </description>
32   -
33   - <icons>
34   - <tiny src="icons/icon16.png"/>
35   - <small src="icons/icon32.png"/>
36   - <large src="icons/icon64.png"/>
37   - </icons>
38   -
39   -
40   - <!--
41   - Stat fields that would be possible to define for every element.
42   - The display attribute will make this stat shown on the default army list and in the editor
43   - -->
44   - <stats>
45   - <stat id="str" display="true">
46   - <name>strength</name>
47   - <shortname>Str</shortname>
48   - <default>5</default>
49   - </stat>
50   - <stat id="sta" display="true">
51   - <name>stamina</name>
52   - <shortname>Sta</shortname>
53   - <default>5</default>
54   - </stat>
55   - <stat id="spe" display="true">
56   - <name>speed</name>
57   - <shortname>Spe</shortname>
58   - <default>5</default>
59   - </stat>
60   - <stat id="hp" display="true">
61   - <name>hitpoints</name>
62   - <shortname>HP</shortname>
63   - <default>10</default>
64   - </stat>
65   - <stat id="xx">
66   - <name>hidden stat</name>
67   - <shortname>XX</shortname>
68   - <default>0</default>
69   - </stat>
70   - </stats>
71   -
72   - <!--
73   - costs are similar to stats. except that application would be using elements sizes to sum up their values.
74   - it is also possible to limit max and min cost for an element
75   - unit is a suffix for display purposes
76   - -->
77   - <costs>
78   - <cost id="pts">
79   - <name>Points</name>
80   - <shortname>pts</shortname>
81   - <unit>pts</unit>
82   - <default>0</default>
83   - </cost>
84   - <cost id="gc">
85   - <name>Gold Coins</name>
86   - <shortname>GC</shortname>
87   - <unit>coins</unit>
88   - <default>0</default>
89   - </cost>
90   - <cost id="us">
91   - <name>Unit Size</name>
92   - <shortname>US</shortname>
93   - <unit>us</unit>
94   - <default>0</default>
95   - </cost>
96   - </costs>
97   -
98   - <!--
99   - data files script includes
100   - order of this is important for the inheritance!
101   - -->
102   - <data>
103   - <elements>
104   - <elements src="elements/equipment.xml"></elements>
105   - <elements src="elements/templates.xml"></elements>
106   - <elements src="elements/core_units.xml"></elements>
107   - <elements src="elements/special_units.xml"></elements>
108   - <elements src="elements/heroes.xml"></elements>
109   - <elements src="elements/tournament.xml"></elements>
110   - </elements>
111   -
112   - <scripts>
113   - <script src="scripts/helpers1.js"/>
114   - <script>
115   - //<!--
116   - //scripts can be as well defined inline
117   - //-->
118   - </script>
119   - <script src="scripts/validator.js"/>
120   - <script src="scripts/display.js"/>
121   - </scripts>
122   - <errors>
123   - <errors src="errors.xml"/>
124   - </errors>
125   - <!--
126   - twr uses ISO 639-1 language codes (the code parameter)
127   - this will for example open this ruleset in preffered user language when editing online.
128   - http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
129   - -->
130   - <languages>
131   - <language code="pl" src="lang/pl.xml"/>
132   - <language code="en" default="true" src="lang/en.xml"/>
133   - </languages>
134   -
135   - </data>
136   -
137   - <!--
138   - this defines available armies. its syntax is very similar to the element syntax.
139   - all available sub-elements and groupd will be available in the main menu
140   - this adds some extra flexibility.
141   - army elements can extend each other same way elements can.
142   - this way you can create special models for tournaments etc.
143   - if you are creating a simple game system you can also use this to keep all races in single ruleset.
144   - if your game system is complex it is recommended to create separate rulesets for each race
145   - -->
146   - <armies>
147   -
148   - <army id="default-army">
149   - <name>Army</name>
150   - <maxCosts>
151   - <cost id="pts">1500</cost>
152   - <cost id="gc">10</cost>
153   - </maxCosts>
154   - <group id="root-core-units" extends="core-units"/>
155   - <group id="root-special-units" extends="special-units"/>
156   - <group id="root-heroes-units" extends="heroes-units"/>
157   - </army>
158   -
159   - <army id="tournament-army" extends="default-army">
160   - <name>Tournament Army</name>
161   - <maxCosts>
162   - <cost id="pts">2000</cost>
163   - <cost id="gc">20</cost>
164   - </maxCosts>
165   - <!-- other groups are inherited from default-army we just override the heroes group-->
166   - <group id="root-heroes-units" extends="tournament-heroes-units"/>
167   - </army>
168   -
169   - </armies>
170   -
171   -</ruleset>
3  examples/example2.twr/lang/en.xml
... ... @@ -1,3 +0,0 @@
1   -<?xml version="1.0"?>
2   -<language>
3   -</language>
3  examples/example2.twr/lang/pl.xml
... ... @@ -1,3 +0,0 @@
1   -<?xml version="1.0"?>
2   -<language>
3   -</language>
0  examples/example2.twr/scripts/display.js
No changes.
0  examples/example2.twr/scripts/helpers1.js
No changes.
0  examples/example2.twr/scripts/validator.js
No changes.
106 src/armycalc.js
@@ -20,10 +20,8 @@ var ArmyCalc = (function() {
20 20
21 21 this.canvas.find('#acMaximize').click(function(){that.setFullscreen(true); return false;});
22 22 this.canvas.find('#acMinimize').click(function(){that.setFullscreen(false); return false;});
23   -
24 23 this.canvas.find('#acNew').click(function(){that.newArmy(); return false;});
25 24 this.canvas.find('#acRevalidate').click(function(){that.revalidate(); return false;});
26   -
27 25 this.canvas.find('#acPrint').click(function(){that.print(); return false;});
28 26
29 27 this.canvas.find('#acDec').click( function(){ _focused_element.size(_focused_element.size()-1); return false;}).hide();
@@ -44,8 +42,8 @@ var ArmyCalc = (function() {
44 42 }).hide();
45 43
46 44 this.twr = new ArmyCalc.TwrReader({
47   - 'onProgress' : function(percent){ console.log('progress: ' + percent + '%'); },
48   - 'onLoaded' : function(){ console.log('DONE'); }
  45 + 'onProgress' : function(percent){ that.setStatus('loading ' + that.twrUrl + ' (' + Math.round(percent) + '%)'); },
  46 + 'onLoaded' : function(){ that.setStatus(that.twrUrl + ' loaded.'); }
49 47 });
50 48
51 49 this.army = null;
@@ -108,14 +106,9 @@ var ArmyCalc = (function() {
108 106 setError : function( text ){
109 107 this.statusElem.html('<b style="color:red">'+text+'</b>');
110 108 },
111   - calcLoadUnitsXml : function( xml ){
112   - console.log(xml);
113   - },
114 109 loadTWR : function( url ){
115   -
116   - this.twr.load( url );
117   - this.setStatus( 'loading '+url );
118   -
  110 + this.twrUrl = url;
  111 + this.twr.load( this.twrUrl );
119 112 },
120 113 revalidate : function( ){
121 114 if(! this.army ){
@@ -133,15 +126,11 @@ var ArmyCalc = (function() {
133 126
134 127 },
135 128 print : function( ){
136   -
137 129 if(! this.army ){
138 130 this.flashMsg( "Please create new army first!" );
139 131 return;
140 132 }
141   -
142   -
143 133 acPrintText(this.canvas.find(".unitslist").html());
144   -
145 134 },
146 135 newArmy : function( ){
147 136
@@ -174,93 +163,6 @@ var ArmyCalc = (function() {
174 163 for (id in costInputs ) {
175 164 that.army.maxTotalCosts[id] = costInputs[id].val();
176 165 }
177   -
178   -
179   - function appendToMenu(ul, children, path){
180   - for (var id in children) {
181   - if (children[id] instanceof ArmyCalc.ElementTemplate) {
182   - var menu_elem = $("<a rel='" + id + "'href='#'>"+children[id].name+"</a>");
183   - ul.append($("<li></li>").append(menu_elem));
184   - menu_elem.click(function(){
185   - var group = that.army;
186   - for (var i=0; i<path.length; i++)
187   - group = group.children[path[i]];
188   - var inst = group.appendElement($(this).attr('rel'));
189   - $('.submm').hide();
190   - inst.focus();
191   - return false;
192   - });
193   - }
194   - else if (children[id] instanceof ArmyCalc.GroupTemplate) {
195   - var subm = $("<ul class='submm'></ul>");
196   - appendToMenu(subm, children[id].children, path.concat(id));
197   - var menu_elem = $("<a href='#'>"+children[id].name+"</a>");
198   - menu_elem.click(function(){return false;});
199   - ul.append($("<li></li>").append(menu_elem).append(subm).hover( function(){
200   - $(this).children("ul").show();
201   - }, function(){
202   - $(this).children("ul").hide();
203   - }));
204   - }
205   - }
206   - }
207   - that.canvas.find('#acElements').html();
208   - appendToMenu(that.canvas.find('#acElements'), that.army.template.children, []);
209   - /*
210   - var menu_ul_by_id = {};
211   - // we are buliding the menu and populating the menu_ul_by_id table
212   - // TODO make this recurrent to populate multiple menu levels?
213   - $.each(calc.model.mainmenu,function( id, item ){
214   -
215   - menu_ul_by_id[id] = $("<ul class='submm'></ul>");
216   -
217   - var menu_elem = $("<a href='#'>"+item.name+"</a>");
218   -
219   - calc.canvas.find('#acElements').append(
220   - $("<li></li>")
221   - .append(menu_elem)
222   - .append(menu_ul_by_id[id])
223   - .hover(function(){ $(this).children("ul").show();},function(){$(this).children("ul").hide();})
224   - );
225   -
226   - $.each(item.submenus,function( child_id, child ){
227   - menu_ul_by_id[child_id] = $("<ul class='submm'></ul>");
228   - var menu_elem = $("<a href='#'>"+child.name+"</a>");
229   -
230   - menu_ul_by_id[id].append(
231   - $("<li></li>")
232   - .append(menu_elem)
233   - .append(menu_ul_by_id[child_id])
234   - .hover(function(){ $(this).children("ul").show();},function(){$(this).children("ul").hide();})
235   - );
236   -
237   - });
238   -
239   - });
240   -
241   - // we are appending all elements that have menu defined to the menu
242   - $.each(calc.army.element.elements,function( id, item ){
243   - $.each(item.elements,function( id, item ){
244   - if(item.menu_id){
245   - var appendButton = $("<a href='#'>"+item.name+"</a>");
246   - menu_ul_by_id[item.menu_id].append($("<li></li>").append(appendButton));
247   - appendButton.click( function(){
248   - calc.army.append( id );
249   - $('.submm').hide();
250   - } );
251   - }
252   - });
253   - });
254   -
255   - //in case a model does not define any units for a menu we remove it from the dom tree
256   - $.each(menu_ul_by_id,function( id, item ){
257   - if($(item).children('li').length == 0)
258   - $(item).parent().remove();
259   - });
260   - */
261   -
262   -
263   -
264 166 });
265 167
266 168 body.append($("<div class='submit'></div>").append(createButton));
275 src/dep.instance.js
... ... @@ -1,275 +0,0 @@
1   -
2   -function acInstance( calc, ruleset, parent, element ){
3   -
4   - var that = this;
5   - this.parent = parent;
6   - this.isArmy = ( this.parent == null );
7   - this.calc = calc;
8   - this.army = calc.army;
9   - this.ruleset = ruleset;
10   -
11   -
12   - this.element = element;
13   - this.name = element.name;
14   -
15   -
16   - this._size = parseInt( element.defaultSize );
17   -
18   - this.size = function( newsize ){
19   - if( typeof newsize === 'undefined' )
20   - return this._size;
21   -
22   -
23   - this._size = newsize;
24   - this._dom_size.html( this._size );
25   -
26   -
27   -
28   - $.each( this.child, function( id, item ){
29   - $.each( item, function( id, item ){
30   - if(item.element.size === 'inherit')
31   - item.size(newsize);
32   - });
33   - });
34   -
35   - if((typeof(_focused_element) !== 'undefined') && (_focused_element == this )){
36   - $('#acDec').toggle( this.size() != this.element.minSize );
37   - $('#acInc').toggle( this.size() != this.element.maxSize );
38   - }
39   -
40   -
41   -
42   - $.each( this._costs_spans, function( id, item){
43   - if( that._size * that.element.cost[id] > 0 )
44   - item.text( that._size * that.element.cost[id] );
45   - else
46   - item.html( '&nbsp;' );
47   - });
48   -
49   - //$each()
50   -
51   - }
52   -
53   - this.stat = function( statid, newvalue ){
54   -
55   -
56   - if( typeof newvalue === 'undefined' )
57   - return this._stats[ statid ];
58   -
59   - if( statid in this._stats ){
60   - this._stats[ statid ] = newvalue;
61   - this._stats_spans[ statid ].text( this._stats[statid] );
62   - }
63   -
64   - }
65   -
66   - this._rebuildSubmenu = function(){
67   -
68   -
69   - }
70   -
71   - this._rebuildListElem = function(){
72   -
73   - }
74   -
75   -
76   - if(! this.isArmy ){
77   -
78   - this._subul = $("<ul></ul>");
79   - this._dom_size = $("<span>" + this._size + "</span>");
80   -
81   - this._anchor = $("<a href='#'> x "+this.name+"</a>").prepend( this._dom_size );
82   -
83   - this._costs_spans = {};
84   -
85   - $.each( this.ruleset.costs, function( id, item){
86   -
87   - that._costs_spans[ id ] = $("<span class='cst'>"+"</span>");
88   - that._anchor.append( that._costs_spans[ id ] );
89   -
90   - } );
91   -
92   -
93   - this._stats_spans = {};
94   -
95   - if( this.element.stats ){
96   -
97   - this._stats = {};
98   - for(id in this.element.stats)
99   - this._stats[id] = this.element.stats[id];
100   -
101   - $.each( this.ruleset.stats, function( id, item){
102   -
103   - that._stats_spans[ id ] = $("<span class='st'>"+that._stats[id]+"</span>");
104   - that._anchor.append( that._stats_spans[ id ] );
105   -
106   - });
107   - }
108   -
109   -
110   - this._li = $("<li></li>").append(this._anchor).append(this._subul);
111   -
112   -
113   -
114   - //TODO
115   - //should we keep submenus in memory or generate them on the fly on each click?
116   - this._submenu = $("<ul></ul>");
117   -
118   - if(this.element.thumbnail)
119   - this._submenu.append($("<li>"+this.element.thumbnail+"</li>"));
120   -
121   - if(this.element.description)
122   - this._submenu.append($("<li>"+this.element.description+"</li>"));
123   -
124   -
125   - //this._submenu.append($("<li><b>append:</b></li>"));
126   -
127   - $.each(this.element.elements,function( id, item ){
128   - $.each( item.elements, function( id, item ){
129   - var button = $("<a href='#'>"+item.name+"</a>");
130   - button.click( function(){ that.append(id);} );
131   - that._submenu.append($("<li></li>").append(button));
132   - });
133   - });
134   -
135   - calc.submenuElem.append(this._submenu);
136   -
137   - this._submenu.hide();
138   -
139   - this._anchor.click(function(){ that._focus(); return false; });
140   -
141   -
142   - } else {
143   -
144   - this._subul = $('#acUnits');
145   -
146   - }
147   -
148   - this._errorsul = $("<ul class='errors'></ul>");
149   -
150   -
151   - this.clear = function() {
152   - this.child={}
153   - var that = this;
154   - $.each( this.element.elements, function( id, item ){
155   - $.each( item.elements, function( id, item ){
156   - that.child[id] = [];
157   - });
158   - });
159   -
160   - }
161   -
162   - this.clear();
163   -
164   - this.toggleError = function( uid, on ){
165   -
166   - this._errorsul.find( '.' + uid ).remove();
167   - if(on)
168   - this._errorsul.append( "<li class='" + uid + " " + this.ruleset.errors[uid]['class'] + "'>" + this.ruleset.errors[uid]['message'] + "</li>" );
169   - }
170   -
171   - this.remove = function(){
172   -
173   - //checking if minCount was reached
174   - if( this.parent.child[this.element.uid].length > this.element.minCount ){
175   -
176   - if( this.element.beforeRemove )
177   - acSandbox( this.element.beforeRemove, { 'that':this, 'army':this.army } );
178   -
179   - this.clear();
180   - this.parent.child[this.element.uid].splice( this.parent.child[this.element.uid].indexOf( this ), 1 );
181   - this._li.remove();
182   - this._submenu.remove();
183   -
184   - } else
185   - this.calc.flashMsg( "Minimum count of "+this.element.name+" is "+this.element.minCount );
186   - }
187   -
188   -
189   - this.count = function( uid ) {
190   -
191   - if( typeof uid === 'undefined' )
192   - return this.parent.child[this.element.uid].length;
193   -
194   - if(uid in this.child)
195   - return this.child[uid].length;
196   -
197   - return 0;
198   - }
199   -
200   - this.append = function( uid ) {
201   -
202   - var element_to_append = null;
203   - var that = this;
204   -
205   - $.each( this.element.elements, function( id, item ){
206   - if(item.elements[uid]){
207   - element_to_append = item.elements[uid];
208   - //check if element group total count is reached
209   - var elements_group_count = 0;
210   - $.each( item.elements, function( id, item){
211   - elements_group_count += that.child[id].length;
212   - });
213   - //if so we do not append
214   - if( elements_group_count === item.maxTotalCount){
215   - that.calc.flashMsg("Maximum total count of group "+item.name+" reached ("+item.maxTotalCount+")");
216   - element_to_append = null;
217   - }
218   - }
219   - });
220   -
221   - if(!element_to_append)
222   - return;
223   -
224   - //checking if maxCount was reached
225   - if( (element_to_append.maxCount == null) || (this.child[uid].length < element_to_append.maxCount) ){
226   -
227   - var instance = new acInstance( calc, ruleset, this, element_to_append );
228   - this.child[uid].push( instance );
229