forked from poooi/plugin-prophet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.cjsx
580 lines (537 loc) · 21.1 KB
/
index.cjsx
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
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
Promise = require 'bluebird'
async = Promise.coroutine
request = Promise.promisifyAll require('request')
{relative, join} = require 'path-extra'
path = require 'path-extra'
fs = require 'fs-extra'
{_, $, $$, React, ReactBootstrap, ROOT, resolveTime, layout, toggleModal} = window
{Table, ProgressBar, Grid, Input, Col, Alert, Button, Divider} = ReactBootstrap
{APPDATA_PATH, SERVER_HOSTNAME} = window
i18n = require './node_modules/i18n'
{__} = i18n
BottomAlert = require './parts/bottom-alert'
ProphetPanel = require './parts/prophet-panel'
i18n.configure
locales: ['en-US', 'ja-JP', 'zh-CN']
defaultLocale: 'zh-CN'
directory: path.join(__dirname, 'assets', 'i18n')
updateFiles: false
indent: '\t'
extension: '.json'
i18n.setLocale(window.language)
window.addEventListener 'layout.change', (e) ->
{layout} = e.detail
formation = [
__("Unknown Formation"),
__("Line Ahead"),
__("Double Line"),
__("Diamond"),
__("Echelon"),
__("Line Abreast"),
__("Cruising Formation 1"),
__("Cruising Formation 2"),
__("Cruising Formation 3"),
__("Cruising Formation 4")
]
intercept = [
__("Unknown Engagement"),
__("Parallel Engagement"),
__("Head-on Engagement"),
__("Crossing the T (Advantage)"),
__("Crossing the T (Disadvantage)")
]
dropCount = [
0, 1, 1, 2, 2, 3, 4
]
dispSeiku = [
__("Air Parity"),
__("AS+"),
__("AS"),
__("Air Incapability"),
__("Air Denial")
]
initHp =
now: [0, 0, 0, 0, 0, 0]
max: [0, 0, 0, 0, 0, 0]
dmg: [0, 0, 0, 0, 0, 0]
initInfo =
lv: [-1, -1, -1, -1, -1, -1]
name: [0, 0, 0, 0, 0, 0]
initPlaneCount =
seiku: -1
sortie: [0, 0]
enemy: [0, 0]
initId = [-1, -1, -1, -1, -1, -1]
initData = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
getEnemyInfo = (enemyHp, enemyInfo, body, isPractice) ->
{$ships, _ships} = window
enemyInfo.lv = Object.clone body.api_ship_ke.slice(1, 7)
enemyHp.now = Object.clone body.api_maxhps.slice(7, 13)
enemyHp.max = Object.clone body.api_maxhps.slice(7, 13)
for shipId, i in enemyInfo.lv
continue if shipId == -1
enemyInfo.name[i] = $ships[shipId].api_name
if $ships[shipId].api_yomi != '-' && !isPractice
enemyInfo.name[i] = enemyInfo.name[i] + $ships[shipId].api_yomi
enemyInfo.lv = Object.clone body.api_ship_lv.slice(1, 7)
getResult = (sortieHp, enemyHp, combinedHp, leastHp) ->
sortieDrop = enemyDrop = 0
sortieCnt = enemyCnt = 0
sortieDmg = enemyDmg = 0.0
sortieTot = enemyTot = 0.0
for i in [0..5]
if sortieHp.now[i] + sortieHp.dmg[i] > 0
sortieCnt += 1
sortieTot += (sortieHp.now[i] + sortieHp.dmg[i])
enemyDmg += sortieHp.dmg[i]
if sortieHp.now[i] <= 0
enemyDmg += sortieHp.now[i]
sortieDrop += 1
sortieHp.now[i] = 0
if combinedHp.now[i] + combinedHp.dmg[i] > 0
sortieCnt += 1
sortieTot += (combinedHp.now[i] + combinedHp.dmg[i])
enemyDmg += combinedHp.dmg[i]
if combinedHp.now[i] <= 0
enemyDmg += combinedHp.now[i]
sortieDrop += 1
combinedHp.now[i] = 0
if enemyHp.now[i] + enemyHp.dmg[i] > 0
enemyCnt += 1
enemyTot += (enemyHp.now[i] + enemyHp.dmg[i])
sortieDmg += enemyHp.dmg[i]
if enemyHp.now[i] <= 0
sortieDmg += (enemyHp.now[i] - leastHp)
enemyDrop += 1
enemyHp.now[i] = 0
result = 'D'
if enemyDrop == enemyCnt
result = 'S'
else if enemyDrop >= dropCount[enemyCnt]
result = 'A'
else if sortieDmg != 0 && (enemyHp.now[0] <= 0 || (sortieDmg * sortieTot >= 2.5 * enemyDmg * enemyTot))
result = 'B'
else if sortieDmg != 0 && (sortieDmg * sortieTot >= 1.0 * enemyDmg * enemyTot)
result = 'C'
result
koukuAttack = (sortieHp, enemyHp, kouku) ->
if kouku.api_edam?
for damage, i in kouku.api_edam
damage = Math.floor(damage)
continue if damage <= 0
enemyHp.dmg[i - 1] += damage
enemyHp.now[i - 1] -= damage
if kouku.api_fdam?
for damage, i in kouku.api_fdam
damage = Math.floor(damage)
continue if damage <= 0
sortieHp.dmg[i - 1] += damage
sortieHp.now[i - 1] -= damage
supportAttack = (enemyHp, support) ->
for damage, i in support
damage = Math.floor(damage)
continue if damage <= 0
continue if i > 6
enemyHp.dmg[i - 1] += damage
enemyHp.now[i - 1] -= damage
raigekiAttack = (sortieHp, enemyHp, raigeki) ->
if raigeki.api_edam?
for damage, i in raigeki.api_edam
damage = Math.floor(damage)
continue if damage <= 0
enemyHp.dmg[i - 1] += damage
enemyHp.now[i - 1] -= damage
if raigeki.api_fdam?
for damage, i in raigeki.api_fdam
damage = Math.floor(damage)
continue if damage <= 0
sortieHp.dmg[i - 1] += damage
sortieHp.now[i - 1] -= damage
hougekiAttack = (sortieHp, enemyHp, hougeki) ->
for damageFrom, i in hougeki.api_at_list
continue if damageFrom == -1
for damage, j in hougeki.api_damage[i]
damage = Math.floor(damage)
damageTo = hougeki.api_df_list[i][j]
continue if damage <= 0
if damageTo < 7
sortieHp.dmg[damageTo - 1] += damage
sortieHp.now[damageTo - 1] -= damage
else
enemyHp.dmg[damageTo - 7] += damage
enemyHp.now[damageTo - 7] -= damage
getShipInfo = (sortieHp, sortieInfo) ->
{_ships} = window
for shipId, i in sortieInfo
if shipId == -1
sortieHp.now[i] = sortieHp.max[i] = 0
else
sortieHp.now[i] = _ships[shipId].api_nowhp
sortieHp.max[i] = _ships[shipId].api_maxhp
simulateKouku = (api_kouku, planeCount) ->
# [seiku, f_left, f_all, e_left, e_all]
if api_kouku.api_stage2?
planeCount.sortie[0] -= api_kouku.api_stage2.api_f_lostcount
planeCount.enemy[0] -= api_kouku.api_stage2.api_e_lostcount
checkDamageControl = (info, hp) ->
{_ships} = window
{_slotitems} = window
for i in [0..5]
continue if info[i] == -1 or hp.now[i] > 0
slot = Object.clone _ships[info[i]].api_slot
slot.push _ships[info[i]].api_slot_ex
# According to wiki, if both damage control and goddess are equipped,
# they will be consumed from top to bottom.
for id in slot
# For normal slots, -1 means empty or not usable.
# For the ex slot, 0 means not available, -1 means empty.
if id > 0
x = _slotitems[id].api_slotitem_id
# Repair Team
if x == 42
hp.now[i] = Math.floor(hp.max[i] / 5)
hp.dmg[i] = 0
break
# Repair Goddess
if x == 43
hp.now[i] = hp.max[i]
hp.dmg[i] = 0
break
checkRepair = (sortieHp, combinedHp, sortieInfo, combinedInfo) ->
checkDamageControl sortieInfo, sortieHp
checkDamageControl combinedInfo, combinedHp
simulateBattle = (sortieHp, enemyHp, combinedHp, isCombined, isWater, body, leastHp, planeCount, sortieInfo, combinedInfo) ->
# First air battle
if body.api_kouku?
if body.api_kouku.api_stage1?
tmp = body.api_kouku.api_stage1
planeCount.seiku = tmp.api_disp_seiku
planeCount.sortie[0] = tmp.api_f_count - tmp.api_f_lostcount
planeCount.sortie[1] = tmp.api_f_count
planeCount.enemy[0] = tmp.api_e_count - tmp.api_e_lostcount
planeCount.enemy[1] = tmp.api_e_count
simulateKouku body.api_kouku, planeCount
checkRepair sortieHp, combinedHp, sortieInfo, combinedInfo
if body.api_kouku.api_stage3?
koukuAttack sortieHp, enemyHp, body.api_kouku.api_stage3
if body.api_kouku.api_stage3_combined?
koukuAttack combinedHp, enemyHp, body.api_kouku.api_stage3_combined
checkRepair sortieHp, combinedHp, sortieInfo, combinedInfo
# Second air battle
if body.api_kouku2?
simulateKouku body.api_kouku2, planeCount
if body.api_kouku2.api_stage3?
koukuAttack sortieHp, enemyHp, body.api_kouku2.api_stage3
if body.api_kouku2.api_stage3_combined?
koukuAttack combinedHp, enemyHp, body.api_kouku2.api_stage3_combined
checkRepair sortieHp, combinedHp, sortieInfo, combinedInfo
# Support battle
if body.api_support_info?
if body.api_support_info.api_support_airatack?
supportAttack enemyHp, body.api_support_info.api_support_airatack.api_stage3.api_edam
else if body.api_support_info.api_support_hourai?
supportAttack enemyHp, body.api_support_info.api_support_hourai.api_damage
else
supportAttack enemyHp, body.api_support_info.api_damage
checkRepair sortieHp, combinedHp, sortieInfo, combinedInfo
# Opening battle
if body.api_opening_atack?
if isCombined
raigekiAttack combinedHp, enemyHp, body.api_opening_atack
else
raigekiAttack sortieHp, enemyHp, body.api_opening_atack
checkRepair sortieHp, combinedHp, sortieInfo, combinedInfo
# Night battle
if body.api_hougeki?
if isCombined
hougekiAttack combinedHp, enemyHp, body.api_hougeki
else
hougekiAttack sortieHp, enemyHp, body.api_hougeki
checkRepair sortieHp, combinedHp, sortieInfo, combinedInfo
# First hougeki battle
if body.api_hougeki1?
if isCombined && !isWater
hougekiAttack combinedHp, enemyHp, body.api_hougeki1
else
hougekiAttack sortieHp, enemyHp, body.api_hougeki1
checkRepair sortieHp, combinedHp, sortieInfo, combinedInfo
# Second hougeki battle
if body.api_hougeki2?
hougekiAttack sortieHp, enemyHp, body.api_hougeki2
checkRepair sortieHp, combinedHp, sortieInfo, combinedInfo
# Combined hougeki battle
if body.api_hougeki3?
if isCombined && isWater
hougekiAttack combinedHp, enemyHp, body.api_hougeki3
else
hougekiAttack sortieHp, enemyHp, body.api_hougeki3
checkRepair sortieHp, combinedHp, sortieInfo, combinedInfo
# Raigeki battle
if body.api_raigeki?
if isCombined
raigekiAttack combinedHp, enemyHp, body.api_raigeki
else
raigekiAttack sortieHp, enemyHp, body.api_raigeki
checkRepair sortieHp, combinedHp, sortieInfo, combinedInfo
getResult sortieHp, enemyHp, combinedHp, leastHp
escapeId = -1
towId = -1
module.exports =
name: 'prophet'
priority: 1
displayName: <span><FontAwesome key={0} name='compass' />{' ' + __("Prophet")}</span>
description: __ "Sortie Prophet"
version: '3.0.0'
author: 'Chiba'
link: 'https://github.com/Chibaheit'
reactClass: React.createClass
getInitialState: ->
sortieHp: Object.clone initHp
enemyHp: Object.clone initHp
combinedHp: Object.clone initHp
sortieInfo: Object.clone initId
enemyInfo: Object.clone initInfo
combinedInfo: Object.clone initId
getShip: null
planeCount: Object.clone initPlaneCount
sortiePlane: ''
enemyPlane: ''
seiku: null
enemyFormation: 0
enemyIntercept: 0
enemyName: __("Enemy Vessel")
result: null
enableProphetDamaged: config.get 'plugin.prophet.notify.damaged', true
prophetCondShow: config.get 'plugin.prophet.show.cond', true
combinedFlag: 0
goBack: Object.clone initData
compactMode: false
handleResponse: (e) ->
{method, path, body, postBody} = e.detail
{sortieHp, enemyHp, combinedHp, sortieInfo, enemyInfo, combinedInfo, getShip, planeCount, enemyFormation, enemyIntercept, enemyName, result, enableProphetDamaged, prophetCondShow, combinedFlag, goBack} = @state
enableProphetDamaged = config.get 'plugin.prophet.notify.damaged', true
prophetCondShow = config.get 'plugin.prophet.show.cond', true
flag = false
switch path
# First enter map in battle
when '/kcsapi/api_req_map/start'
flag = true
if parseInt(postBody.api_deck_id) != 1
combinedFlag = 0
if combinedFlag == 0
sortieInfo = Object.clone window._decks[postBody.api_deck_id - 1].api_ship
combinedInfo = Object.clone initId
else
sortieInfo = Object.clone window._decks[0].api_ship
combinedInfo = Object.clone window._decks[1].api_ship
getShipInfo sortieHp, sortieInfo
getShipInfo combinedHp, combinedInfo
sortieHp.dmg[i] = enemyHp.dmg[i] = combinedHp.dmg[i] = 0 for i in [0..5]
enemyInfo.lv = Object.clone initId
enemyFormation = enemyIntercept = 0
enemyName = __ 'Enemy Vessel'
result = null
getShip = null
planeCount = Object.clone initPlaneCount
# Enter next point in battle
when '/kcsapi/api_req_map/next'
flag = true
sortieHp.dmg[i] = enemyHp.dmg[i] = combinedHp.dmg[i] = 0 for i in [0..5]
enemyInfo.lv = Object.clone initId
enemyFormation = enemyIntercept = 0
enemyName = __ 'Enemy Vessel'
result = null
getShip = null
planeCount = Object.clone initPlaneCount
# Some ship while go back
when '/kcsapi/api_req_combined_battle/goback_port'
flag = true
if escapeId != -1 && towId != -1
goBack[escapeId] = goBack[towId] = 1
# Normal battle
when '/kcsapi/api_req_sortie/airbattle', '/kcsapi/api_req_battle_midnight/sp_midnight', '/kcsapi/api_req_sortie/battle', '/kcsapi/api_req_battle_midnight/battle'
flag = true
# The damage in day battle
daySortieDmg = Object.clone sortieHp.dmg
dayEnemyDmg = Object.clone enemyHp.dmg
dayCombinedDmg = Object.clone combinedHp.dmg
if path != '/kcsapi/api_req_battle_midnight/battle'
getEnemyInfo enemyHp, enemyInfo, body, false
result = simulateBattle sortieHp, enemyHp, combinedHp, false, false, body, 0, planeCount, sortieInfo, combinedInfo
for i in [0..5]
sortieHp.dmg[i] -= daySortieDmg[i]
enemyHp.dmg[i] -= dayEnemyDmg[i]
combinedHp.dmg[i] -= dayCombinedDmg[i]
# Practice battle
when '/kcsapi/api_req_practice/battle', '/kcsapi/api_req_practice/midnight_battle'
flag = true
# If practice
if path == '/kcsapi/api_req_practice/battle'
sortieHp.dmg[i] = enemyHp.dmg[i] = combinedHp.dmg[i] = 0 for i in [0..5]
enemyName = __ 'PvP'
combinedFlag = 0
sortieInfo = Object.clone window._decks[postBody.api_deck_id - 1].api_ship
getShipInfo sortieHp, sortieInfo
getEnemyInfo enemyHp, enemyInfo, body, true
daySortieDmg = Object.clone sortieHp.dmg
dayEnemyDmg = Object.clone enemyHp.dmg
dayCombinedDmg = Object.clone combinedHp.dmg
result = simulateBattle sortieHp, enemyHp, combinedHp, false, false, body, 1, planeCount, sortieInfo, combinedInfo
for i in [0..5]
sortieHp.dmg[i] -= daySortieDmg[i]
enemyHp.dmg[i] -= dayEnemyDmg[i]
combinedHp.dmg[i] -= dayCombinedDmg[i]
# Combined battle
when '/kcsapi/api_req_combined_battle/airbattle', '/kcsapi/api_req_combined_battle/sp_midnight', '/kcsapi/api_req_combined_battle/battle', '/kcsapi/api_req_combined_battle/battle_water', '/kcsapi/api_req_combined_battle/midnight_battle'
flag = true
escapeId = towId = -1
isWater = false
# If water combined
if path == '/kcsapi/api_req_combined_battle/battle_water'
isWater = true
daySortieDmg = Object.clone sortieHp.dmg
dayEnemyDmg = Object.clone enemyHp.dmg
dayCombinedDmg = Object.clone combinedHp.dmg
if path != '/kcsapi/api_req_combined_battle/midnight_battle'
getEnemyInfo enemyHp, enemyInfo, body, false
result = simulateBattle sortieHp, enemyHp, combinedHp, true, isWater, body, 1, planeCount, sortieInfo, combinedInfo
for i in [0..5]
sortieHp.dmg[i] -= daySortieDmg[i]
enemyHp.dmg[i] -= dayEnemyDmg[i]
combinedHp.dmg[i] -= dayCombinedDmg[i]
# Battle Result
when '/kcsapi/api_req_practice/battle_result', '/kcsapi/api_req_sortie/battleresult', '/kcsapi/api_req_combined_battle/battleresult'
flag = true
if path != '/kcsapi/api_req_practice/battle_result'
if body.api_escape_flag? && body.api_escape_flag > 0
escapeId = body.api_escape.api_escape_idx[0] - 1
towId = body.api_escape.api_tow_idx[0] - 1
tmpShip = ""
for i in [0..5]
if sortieHp.now[i] < (0.2500001 * sortieHp.max[i]) && goBack[i] == 0
tmpShip = tmpShip + _ships[sortieInfo[i]].api_name + " "
if combinedHp.now[i] < (0.2500001 * combinedHp.max[i]) && goBack[6 + i] == 0
tmpShip = tmpShip + _ships[combinedInfo[i]].api_name + " "
if tmpShip != ""
notify "#{tmpShip}" + __('Heavily damaged'),
type: 'damaged'
icon: join(ROOT, 'views', 'components', 'ship', 'assets', 'img', 'state', '4.png')
if body.api_get_ship?
getShip = body.api_get_ship
result = body.api_win_rank
# Return to port
when '/kcsapi/api_port/port'
flag = true
goBack = Object.clone initData
combinedFlag = body.api_combined_flag
combinedFlag ?= 0
if combinedFlag == 0
sortieInfo = Object.clone window._decks[0].api_ship
combinedInfo = Object.clone initId
else
sortieInfo = Object.clone window._decks[0].api_ship
combinedInfo = Object.clone window._decks[1].api_ship
getShipInfo sortieHp, sortieInfo
getShipInfo combinedHp, combinedInfo
sortieHp.dmg[i] = enemyHp.dmg[i] = combinedHp.dmg[i] = 0 for i in [0..5]
enemyInfo.lv = Object.clone initId
enemyFormation = enemyIntercept = 0
enemyName = __ 'Enemy Vessel'
result = null
getShip = null
planeCount = Object.clone initPlaneCount
if body.api_formation?
enemyFormation = body.api_formation[1]
enemyIntercept = body.api_formation[2]
sortiePlane = enemyPlane = ""
seiku = __ "Unknown FC"
if planeCount.seiku != -1
if planeCount.sortie[1] != 0
sortiePlane = " #{planeCount.sortie[0]}/#{planeCount.sortie[1]}"
if planeCount.enemy[1] != 0
enemyPlane = " #{planeCount.enemy[0]}/#{planeCount.enemy[1]}"
seiku = dispSeiku[planeCount.seiku]
if flag
@setState
sortieHp: sortieHp
enemyHp: enemyHp
combinedHp: combinedHp
sortieInfo: sortieInfo
enemyInfo: enemyInfo
combinedInfo: combinedInfo
getShip: getShip
planeCount: planeCount
sortiePlane: sortiePlane
enemyPlane: enemyPlane
seiku: seiku
enemyFormation: enemyFormation
enemyIntercept: enemyIntercept
enemyName: enemyName
result: result
enableProphetDamaged: enableProphetDamaged
prophetCondShow: prophetCondShow
combinedFlag: combinedFlag
goBack: goBack
handleDisplayModeSwitch: ->
@setState
compactMode: !@state.compactMode
componentDidMount: ->
window.addEventListener 'game.response', @handleResponse
render: ->
<div onDoubleClick={@handleDisplayModeSwitch}>
<link rel="stylesheet" href={join(relative(ROOT, __dirname), 'assets', 'prophet.css')} />
<ProphetPanel
sortieHp={@state.sortieHp}
enemyHp={@state.enemyHp}
combinedHp={@state.combinedHp}
sortieInfo={@state.sortieInfo}
enemyInfo={@state.enemyInfo}
combinedInfo={@state.combinedInfo}
HP={__ "HP"}
sortieFleet={__ "Sortie Fleet"}
enemyName={@state.enemyName}
sortiePlane={@state.sortiePlane}
enemyPlane={@state.enemyPlane}
cols={if @state.combinedFlag == 0 then 0 else 1}
lay={if layout == 'horizonal' || window.doubleTabbed then 0 else 1}
goBack={@state.goBack}
compactMode={@state.compactMode} />
<BottomAlert
admiral={__ "Admiral"}
getShip={@state.getShip}
joinFleet={__ "Join fleet"}
formationNum={@state.enemyFormation}
formation={formation[@state.enemyFormation]}
intercept={intercept[@state.enemyIntercept]}
seiku={@state.seiku}
result={@state.result} />
</div>
settingsClass: React.createClass
getInitialState: ->
enableProphetDamaged: config.get 'plugin.prophet.notify.damaged', true
prophetCondShow: config.get 'plugin.prophet.show.cond', true
handleSetProphetDamaged: ->
{enableProphetDamaged} = @state
config.set 'plugin.prophet.notify.damaged', !enableProphetDamaged
@setState
enableProphetDamaged: !enableProphetDamaged
handleSetProphetCond: ->
{prophetCondShow} = @state
config.set 'plugin.prophet.show.cond', !prophetCondShow
@setState
prophetCondShow: !prophetCondShow
render: ->
<div className="form-group">
<Grid>
<Col xs={6}>
<Button bsStyle={if @state.enableProphetDamaged then 'success' else 'danger'} onClick={@handleSetProphetDamaged} style={width: '100%'}>
{if @state.enableProphetDamaged then '√ ' else ''}开启大破通知
</Button>
</Col>
<Col xs={6}>
<Button bsStyle={if @state.prophetCondShow then 'success' else 'danger'} onClick={@handleSetProphetCond} style={width: '100%'}>
{if @state.prophetCondShow then '√ ' else ''}开启Cond显示
</Button>
</Col>
</Grid>
</div>