Skip to content

Commit

Permalink
1.8.0-beta.0: implement airship with level
Browse files Browse the repository at this point in the history
  • Loading branch information
taroxd committed Feb 29, 2016
1 parent bb5c0a9 commit ca50d87
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 56 deletions.
5 changes: 4 additions & 1 deletion assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@ img.svg {
.item-level-span {
display: inline-block;
color: #6cf;
min-width: 12px;
text-align: center;
}

.item-alv-img {
width: 11px;
height: 14px;
vertical-align: -3px;
}
Expand All @@ -86,6 +87,8 @@ img.svg {
.item-alv-0 {
color: #888;
font-size: 80%;
width: 11px;
display: inline-block;
}

.equip-list-number {
Expand Down
2 changes: 1 addition & 1 deletion index.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports =
displayName: <span><FontAwesome name='rocket' key={0} />{' ' + __('Equipment Info')}</span>
author: 'taroxd'
link: 'https://github.com/taroxd'
version: '1.7.1'
version: '1.8.0-beta.0'
description: __ 'Show detailed information of all owned equipment'
handleClick: ->
window.itemInfoWindow.show()
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "poi-plugin-item-info",
"version": "1.7.1",
"version": "1.8.0-beta.0",
"description": "Show detailed information of all owned equipment.",
"main": "index.cjsx",
"scripts": {
Expand Down
23 changes: 14 additions & 9 deletions views/index.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,20 @@ ItemInfoArea = React.createClass
updateSlot: (slot) ->
return unless @slotShouldDisplay slot.api_locked
slotItemId = slot.api_slotitem_id
isAlv = slot.api_alv
level = isAlv || slot.api_level || 0
alv = slot.api_alv || 0
level = slot.api_level || 0
if @rows[slotItemId]?
row = @rows[slotItemId]
row.total++
if isAlv
row.isAlv = true
if row.levelCount[level]?
row.levelCount[level]++
if level
row.hasNoLevel = false
if alv
row.hasNoAlv = false
alvList = row.levelCount[alv] ?= []
if alvList[level]?
alvList[level]++
else
row.levelCount[level] = 1
alvList[level] = 1
else
itemInfo = $slotitems[slotItemId]
row =
Expand All @@ -54,8 +57,10 @@ ItemInfoArea = React.createClass
used: 0
ships: []
levelCount: []
isAlv: isAlv
row.levelCount[level] = 1
hasNoLevel: !level
hasNoAlv: !alv
alvList = row.levelCount[alv] ?= []
alvList[level] = 1
@rows[slotItemId] = row
updateShips: ->
return if !window._ships? or @rows.length == 0
Expand Down
91 changes: 47 additions & 44 deletions views/item-info-table-area.cjsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{Grid, Table, Input} = ReactBootstrap
{SlotitemIcon} = require "#{ROOT}/views/components/etc/icon"
Divider = require './divider'
path = require 'path'

ItemInfoTable = React.createClass
shouldComponentUpdate: (nextProps) ->
Expand All @@ -18,51 +19,52 @@ ItemInfoTable = React.createClass
<Table id='equip-table'>
<tbody>
{
for count, level in @props.levelCount
if count?
number = ' × ' + count
<tr key={level}>
{
if level is 0 and count is @props.total
<td style={width: '13%'}></td>
else if !@props.isAlv
if level is 10
prefix = '★max'
for alvList, alv in @props.levelCount
continue unless alvList?
for count, level in alvList
if count?
<tr key={level}>
{
if @props.hasNoAlv and @props.hasNoLevel
<td style={width: '13%'}></td>
else
prefix = '' + level
<td style={width: '13%'}><span className='item-level-span'>{prefix}</span>{number}</td>
else if level is 0
<td style={width: '13%'}><span className='item-alv-0 item-level-span'>O</span>{number}</td>
else if level <= 7
<td style={width: '13%'}>
<span className='item-level-span'>
<img className='item-alv-img' src={
path = require 'path'
path.join(ROOT, 'assets', 'img', 'airplane', "alv#{level}.png")
alvPrefix = if @props.hasNoAlv
''
else if alv is 0
<span className='item-alv-0'>O</span>
else if alv <= 7
<img className='item-alv-img' src={
path.join(ROOT, 'assets', 'img', 'airplane', "alv#{alv}.png")
}
/>
else # unreachable
''

levelPrefix = if @props.hasNoLevel
''
else if level is 10
'★max'
else
'' + level

<td style={width: '13%'}><span className='item-level-span'>{alvPrefix} {levelPrefix}</span> × {count}</td>
}
<td>
{
if @props.ships[level]?
for ship in @props.ships[level]
<div key={ship.id} className='equip-list-div'>
<span className='equip-list-div-span'>Lv.{ship.level}</span>
{ship.name}
{
if ship.count > 1
<span className='equip-list-number'>×{ship.count}</span>
}
/>
</span>
{number}
</td>
else # unreachable
<td style={width: '13%'}></td>
}
<td>
{
if @props.ships[level]?
for ship in @props.ships[level]
<div key={ship.id} className='equip-list-div'>
<span className='equip-list-div-span'>{'Lv.' + ship.level}</span>
{ship.name}
{
if ship.count > 1
<span className='equip-list-number'>{'×' + ship.count}</span>
}
</div>
}
</td>
</tr>
}
</div>
}
</td>
</tr>
}
</tbody>
</Table>
</td>
Expand Down Expand Up @@ -122,7 +124,8 @@ ItemInfoTableArea = React.createClass
rest = {row.total - row.used}
ships = {row.ships}
levelCount = {row.levelCount}
isAlv = {row.isAlv}
hasNoLevel = {row.hasNoLevel}
hasNoAlv = {row.hasNoAlv}
iconIndex = {row.iconIndex}
/>
}
Expand Down

0 comments on commit ca50d87

Please sign in to comment.