-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
359 lines (315 loc) · 17.6 KB
/
index.html
1
2
3
4
5
6
7
8
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="A tool to make custom ships for Endless Sky">
<title>Endless Sky Ship Maker</title>
<link rel="stylesheet" href="include/css/style.css" type="text/css">
<link rel="stylesheet" href="include/css/section.css" type="text/css">
<link rel="stylesheet" href="include/css/ui.css" type="text/css">
</head>
<body>
<header>
<div id="app-title" class="section-content">
<h1>Endless Sky Ship Maker</h1><sub style="margin-top:-5px;position:absolute;">By Stanislaus Krisna</sub><br>
</div>
<div id="app-generator-tab-container" class="section-content">
<ul id="app-generator-tab">
<li class="app-generator-tab-items" onClick="app.toggleTab(0)">Ship Attribute</li>
<li class="app-generator-tab-items" onClick="app.toggleTab(1)">Weapon & Engine</li>
<li class="app-generator-tab-items" onClick="app.toggleTab(2)">Ship Equipment</li>
<li class="app-generator-tab-items" onClick="app.toggleTab(4)">Ship Explosion</li>
<li class="app-generator-tab-items" onClick="app.toggleTab(3)">Get code</li>
</ul>
</div>
</header>
<div id="app-page-content">
<div id="app-generator-shipAttr" class="section-content app-content">
<h2>Ship Attribute</h2>
<hr>
<label for="ship-desc"><h3>Ship Description</h3></label><br><br><textarea id="ship-desc" style="width: 353px; height: 120px;"></textarea><br><br>
<h3 style="display: inline;">Ship Information</h3> <span style="display: inline; cursor: default;" onClick="if(document.getElementById('ship-info-container').style.display == 'block'){document.getElementById('ship-info-container').style.display = 'none'}else{document.getElementById('ship-info-container').style.display = 'block'}">Show/Hide</span><br>
<div id="ship-info-container" style="display: none;">
<label for="ship-inf-category">Ship Category: </label> <select id="ship-inf-category" style="margin-left: -4px;"></select><br>
<label for="ship-inf-name">Ship Name: </label><input type="text" id="ship-inf-name"><br>
<label for="ship-inf-cost">Ship Cost: </label><input type="text" id="ship-inf-cost"><br>
<label for="ship-inf-shield">Ship Shield: </label><input type="text" id="ship-inf-shield"><br>
<label for="ship-inf-mass">Ship Mass: </label><input type="text" id="ship-inf-mass"><br>
<label for="ship-inf-drag">Ship Drag: </label><input type="text" id="ship-inf-drag"><br>
<label for="ship-inf-heat">Ship Heat Dissipation: </label><input type="text" id="ship-inf-heat"><br>
<label for="ship-inf-hull">Ship Hull: </label><input type="text" id="ship-inf-hull"><br>
<label for="ship-inf-disable">Ship can be disabled? </label><input type="checkbox" id="ship-inf-disable"><br>
<label for="ship-inf-auto">Ship can be automated? </label><input type="checkbox" id="ship-inf-auto"><br><br><br>
</div>
<h3 style="display: inline;">Crew</h3> <span style="display: inline; cursor: default;" onClick="if(document.getElementById('ship-crew-container').style.display == 'block'){document.getElementById('ship-crew-container').style.display = 'none'}else{document.getElementById('ship-crew-container').style.display = 'block'}">Show/Hide</span><br>
<div id="ship-crew-container" style="display: none;">
<label for="ship-crew-min">Ship Minimum Crew: </label><input type="text" id="ship-crew-min"><br>
<label for="ship-crew-bunk">Ship Bunk: </label><input type="text" id="ship-crew-bunk"><br><br><br>
</div>
<h3 style="display: inline;">Capacity</h3> <span style="display: inline; cursor: default;" onClick="if(document.getElementById('ship-capacity-container').style.display == 'block'){document.getElementById('ship-capacity-container').style.display = 'none'}else{document.getElementById('ship-capacity-container').style.display = 'block'}">Show/Hide</span><br>
<div id="ship-capacity-container" style="display: none;">
<label for="ship-res-fuel">Ship Fuel Capacity: </label><input type="text" id="ship-res-fuel"><br>
<label for="ship-res-cargo">Ship Cargo Space: </label><input type="text" id="ship-res-cargo"><br>
<label for="ship-res-outfit">Ship Outfit Space: </label><input type="text" id="ship-res-outfit"><br>
<label for="ship-res-weapon">Ship Weapon Capacity: </label><input type="text" id="ship-res-weapon"><br>
<label for="ship-res-ngin">Ship Engine Capacity: </label><input type="text" id="ship-res-ngin"><br>
</div>
</div>
<div id="app-generator-shipWep" class="section-content app-content app-content-hidden">
<h2>Weapon & Engine</h2>
<hr>
<h3>Ship hardpoint editor</h3><br>
<p>Making your own custom hardpoint is easy! Follow the guides bellow to start making your own custom hardpoint.</p><br>
<p><b>Step 1: </b> <input type="file" id="app-generator-nodeEditor-imageLoader"></p><br>
<p><b>Step 2: </b> Click to add new point</p>
<div>
<style>
#app-generator-nodeEditor-buttons li{list-style: none;}
#app-generator-nodeEditor-buttons li:first-child button{
border-radius: 3px 3px 0px 0px !important;
margin-right: -2px;
margin-top: 125px;
outline: none;
box-shadow: 0 0 0 1px #d1d1d1;
}
#app-generator-nodeEditor-buttons li:last-child button{
border-radius: 0px 0px 3px 3px !important;
margin-right: -2px;
outline: none;
box-shadow: 0 0 0 1px #d1d1d1;
}
#app-generator-nodeEditor-buttons li:not(:first-child) button{margin: 0 0 0 0}
#app-generator-nodeEditor-buttons li button{width: 60px}
#app-generator-nodeEditor-buttons{display: inline-block}
#app-generator-nodeEditor-canvas{
/*outline: solid 1px #e1e1e1;*/
vertical-align: middle;
max-height: calc(100% - 20px);
max-width: calc(100% - 20px);
margin-left: -3px;
}
#app-generator-nodeEditor-canvas.loaded{cursor: crosshair;}
.app-generator-nodeEditor-container{
width: calc(50% - 40px);
background: #efefef;
position: relative;
height: 300px;
padding: 10px 0px;
border-radius: 5px;
margin: 20px 0px;
box-shadow: inset 0px 0px 7px -2px #000
}
#app-generator-nodeEditor-imageHolder{
float:left;
margin-right: 10px;
text-align: center;
}
#app-generator-nodeEditor-nodeList{
float:right;
margin-left: 10px;
}
#app-generator-nodeEditor-nodeList-container{
width: calc(100% - 20px);
margin-left: 10px;
}
#app-generator-nodeEditor-nodeList-container li{
list-style: none;
padding: 7px 10px 0px 10px;
border-bottom: solid 1px grey;
background: transparent;
height: 40px;
}
#app-generator-nodeEditor-imageHolder-helper{
display: inline-block;
height: 100%;
vertical-align: middle;
}
</style>
<div id="app-generator-nodeEditor-imageHolder" class="app-generator-nodeEditor-container">
<span id="app-generator-nodeEditor-imageHolder-helper"></span>
<canvas id="app-generator-nodeEditor-canvas" width="300px" height="150px">Canvas not supported...</canvas>
</div>
<ul id="app-generator-nodeEditor-buttons">
<li><button id="app-generator-nodeEditor-gunAddNode">Gun</button></li>
<li><button id="app-generator-nodeEditor-turretAddNode">Turret</button></li>
<li><button id="app-generator-nodeEditor-engineAddNode">Engine</button></li>
</ul>
<div id="app-generator-nodeEditor-nodeList" class="app-generator-nodeEditor-container">
<div style="overflow-y: scroll; height: calc(100% + 20px); margin-top: -10px;">
<ul id="app-generator-nodeEditor-nodeList-container">
</ul>
</div>
</div>
</div>
<!-- <p>Use the <a href="http://endless-sky.github.io/ship_builder.html" target="_blank">ship builder</a> to generate the ship hardpoint. Once done, you can copy the code generated from that page then paste it in the box bellow. Then you can assign weapons and engine to each point. --><br>
<textarea id="ship-hardpoint-raw" style="width: 353px; height: 120px; display: none;" placeholder="paste your code here!"></textarea><br><br>
<p style="margin-top: 90px;"><b>Step 3: </b> Press the button below!</p><br>
<button id="app-generator-nodeEditor-applyButton">Apply Hardpoint</button> <button class="danger" id="app-generator-nodeEditor-resetButton">Reset Hardpoint</button><br><br>
<hr>
<h3 style="margin-bottom:5px;">Gun</h3>
<ul id="ship-mount-gun-container" class="ship-mount-container">
<li>No point loaded...</li>
</ul><br><br>
<h3 style="margin-bottom:5px;">Turret</h3>
<ul id="ship-mount-turret-container" class="ship-mount-container">
<li>No point loaded...</li>
</ul><br><br>
<h3 style="margin-bottom:5px;">Engine</h3>
<ul id="ship-mount-ngin-container" class="ship-mount-container">
<li>No point loaded...</li>
</ul><br><br>
</div>
<div id="app-generator-shipOutf" class="section-content app-content app-content-hidden">
<h2>Ship Equipment</h2>
<hr>
<ul id="ship-equipt-list" data-ecount="0">
<li>Empty list...</li>
</ul><br><br>
<label for="item-selector">Equipment List</label><br>
<select id="item-selector">
</select><br><br>
<label for="item-count">Equipment Count</label><br>
<input type="number" id="item-count" min="1" value="1"><br>
<button style="margin-top: 10px;" onClick="app.addEquipment('ship-equipt-list',document.getElementById('item-selector').selectedOptions[0].value,document.getElementById('item-count').value)">Add equipment</button>
</div>
<div id="app-generator-code" class="section-content app-content app-content-hidden">
<h2>Code Copy</h2>
<hr>
<textarea id="app-generatedCode" readonly placeholder="Your generated code will be here..." style="background: #002b36; color: #2aa198;"></textarea>
</div>
<div id="app-generator-explosion" class="section-content app-content app-content-hidden">
<h2>Ship Explosion</h2>
<hr>
<ul id="ship-explosion-list" data-ecount="0">
<li>Empty list...</li>
</ul><br><br>
<label for="ship-inf-explosion">Ship Explosion: </label><br>
<select id="ship-inf-explosion"></select><br><br><br>
<label for="explosion-spawn-count">Spawn Count</label><br>
<input type="number" id="explosion-spawn-count" min="1" value="1"><br>
<button style="margin-top: 10px;" onClick="app.addExplosion('ship-explosion-list',document.getElementById('ship-inf-explosion').value,document.getElementById('explosion-spawn-count').value)">Add explosion</button>
</div>
<div id="app-generator-generate" class="section-content">
<hr><br>
<button class="safe" onClick="app.generate();app.toggleTab(3)">Generate!</button>
</div>
</div>
<footer id="app-footer">
<span class="section-content">
<center style="margin-top: 20px;">Endless Sky Ship Maker, Version 160512<br>A space ship modding tool for <a href="http://endless-sky.github.io/" target="_blank">Endless Sky</a>.<br>Another project by <a href="http://krisnaslife.cu.cc" target="_blank">Stanislaus Krisna</a>.</center>
</span>
</footer>
<script src="include/js/app.js"></script>
<script src="include/js/ship_tracer.js"></script>
<script>
var app = new App({
tabClass: 'app-content',
hiddenClass: 'app-content-hidden',
codeGenID: 'app-generatedCode',
shipParam: {
name: 'ship-inf-name',
can_disable: 'ship-inf-disable',
can_automate: 'ship-inf-auto',
cost: 'ship-inf-cost',
shields: 'ship-inf-shield',
mass: 'ship-inf-mass',
drag: 'ship-inf-drag',
heat_dissipation: 'ship-inf-heat',
hull: 'ship-inf-hull',
required_crew: 'ship-crew-min',
bunks: 'ship-crew-bunk',
fuel: 'ship-res-fuel',
cargo: 'ship-res-cargo',
outfit: 'ship-res-outfit',
weapon: 'ship-res-weapon',
engine: 'ship-res-ngin',
desc: 'ship-desc'
},
hardpoint: 'ship-hardpoint-raw',
mountPointContainer: {gun:'ship-mount-gun-container',turret:'ship-mount-turret-container',engine:'ship-mount-ngin-container'}
})
function itemAdd(e,type){
document.getElementById('item-selector').innerHTML += '<option disabled></option><option disabled style="font-weight:bold;">'+type.capitalisation()+'</option>'
for(var i = 0; i < e.length; i++){
document.getElementById('item-selector').innerHTML += '<option value="'+e[i]+'">'+e[i]+'</option>'
}
}
document.getElementById('item-selector').innerHTML = '<option disabled selected>Select Equipment...</option>'
app.listItems('power',itemAdd)
app.listItems('systems',itemAdd)
app.listItems('ammunition',itemAdd)
app.listItems('special',itemAdd)
app.getShipClasses(function(e){
document.getElementById('ship-inf-category').innerHTML = '<option disabled selected>Select Category...</option>'
for(var i = 0; i < e.length; i++){
switch(e[i]){
case 'Transport':
document.getElementById('ship-inf-category').innerHTML += '<option disabled></option><option disabled style="font-weight:bold;">Civilian Ship</option>'
break;
case 'Interceptor':
document.getElementById('ship-inf-category').innerHTML += '<option disabled></option><option disabled style="font-weight:bold;">War Ship</option>'
break;
case 'Fighter':
document.getElementById('ship-inf-category').innerHTML += '<option disabled></option><option disabled style="font-weight:bold;">Other</option>'
break;
}
document.getElementById('ship-inf-category').innerHTML += '<option value="'+i+'">'+e[i]+'</option>'
}
document.getElementById('ship-inf-category').addEventListener('change',function(){
app.ship_class_id = this.value
})
})
app.getShipClassList(function(e){
document.getElementById('ship-inf-explosion').innerHTML = '<option disabled selected>Select Explosion...</option>'
for(var i = 0; i < e.length; i++){
document.getElementById('ship-inf-explosion').innerHTML += '<option value="'+e[i]+'">'+e[i]+'</option>'
}
document.getElementById('ship-inf-explosion').addEventListener('change',function(){
// app.ship_explosion_id = this.value
console.log(this.value.includes('final explosion'))
document.getElementById('explosion-spawn-count').value = document.getElementById('explosion-spawn-count').disabled = (this.value.includes('final explosion') == true ? 1 : 0)
})
})
function resetHardpointData(){
document.getElementById('app-generator-nodeEditor-nodeList-container').innerHTML = ''
document.getElementById('ship-hardpoint-raw').value = ''
var ele = document.getElementsByClassName('ship-mount-container')
for(var i = 0; i < ele.length; i++){
ele[i].innerHTML = '<li>No point loaded...</li>'
}
app.mountPoints = []
}
var st = new ShipTracer({
canvasObject: document.getElementById('app-generator-nodeEditor-canvas'),
imageInput: document.getElementById('app-generator-nodeEditor-imageLoader'),
imageInputOnChange: resetHardpointData
})
function addNode(nodeName){
// Read data from canvas and write the data to the container
document.getElementById('app-generator-nodeEditor-nodeList-container').innerHTML += '<li><span class="app-generator-nodeEditor-hardpoint-list" style="width: calc(100% - 70px); display: block; float: left; padding-top: 10px;">'+nodeName+' '+st.currentPosition.x+' '+st.currentPosition.y+'</span> <button style="float: right;" class="danger" onclick="this.parentNode.remove()">Remove</button></li>'
}
document.getElementById('app-generator-nodeEditor-gunAddNode').addEventListener('click',function(){
addNode('gun')
})
document.getElementById('app-generator-nodeEditor-turretAddNode').addEventListener('click',function(){
addNode('turret')
})
document.getElementById('app-generator-nodeEditor-engineAddNode').addEventListener('click',function(){
addNode('engine')
})
document.getElementById('app-generator-nodeEditor-applyButton').addEventListener('click', function(){
// Print data in container to the hidden textarea
var hp = document.getElementsByClassName('app-generator-nodeEditor-hardpoint-list')
// Reset textarea innerHTML
document.getElementById('ship-hardpoint-raw').value = ''
for(var i = 0; i < hp.length; i++){
document.getElementById('ship-hardpoint-raw').value += hp[i].innerHTML + '\n'
}
app.loadHardpoint()
})
document.getElementById('app-generator-nodeEditor-resetButton').addEventListener('click', resetHardpointData)
</script>
</body>
</html>