   description: "远征信息查询"
   author: "马里酱"
   link: "https://github.com/malichan"
-  version: "1.1.0"
+  version: "1.2.0"
   reactClass: React.createClass
     getInitialState: ->
       fs = require "fs-extra"

        expeditions: expeditions
        expedition_information: []
        expedition_constraints: []
        fleet_status: [true, false, false]
      }
    checkFlagshipLv: (status, flagship_lv, decks, ships) ->
      for fleet, idx in decks[1..3]
        flagship_id = fleet.api_ship[0]
        if flagship_id isnt -1
          _flagship_lv = ships[flagship_id].api_lv
          if _flagship_lv >= flagship_lv
            status[idx] &= true
          else
            status[idx] &= false
        else
          status[idx] &= false
    checkFleetLv: (status, fleet_lv, decks, ships) ->
      for fleet, idx in decks[1..3]
        _fleet_lv = 0
        for ship_id in fleet.api_ship when ship_id isnt -1
          ship_lv = ships[ship_id].api_lv
          _fleet_lv += ship_lv
        if _fleet_lv >= fleet_lv
          status[idx] &= true
        else
          status[idx] &= false
    checkFlagshipShiptype: (status, flagship_shiptype, decks, ships, Ships) ->
      for fleet, idx in decks[1..3]
        flagship_id = fleet.api_ship[0]
        if flagship_id isnt -1
          flagship_shipid = ships[flagship_id].api_ship_id
          _flagship_shiptype = Ships[flagship_shipid].api_stype
          if _flagship_shiptype is flagship_shiptype
            status[idx] &= true
          else
            status[idx] &= false
        else
          status[idx] &= false
    checkShipCount: (status, ship_count, decks) ->
      for fleet, idx in decks[1..3]
        _ship_count = 0
        for ship_id in fleet.api_ship when ship_id isnt -1
          _ship_count += 1
        if _ship_count >= ship_count
          status[idx] &= true
        else
          status[idx] &= false
    checkDrumShipCount: (status, drum_ship_count, decks, ships, slotitems) ->
      for fleet, idx in decks[1..3]
        _drum_ship_count = 0
        for ship_id in fleet.api_ship when ship_id isnt -1
          for slotitem_id in ships[ship_id].api_slot when slotitem_id isnt -1
            slotitem_slotitemid = slotitems[slotitem_id].api_slotitem_id
            if slotitem_slotitemid is 75
              _drum_ship_count += 1
              break
        if _drum_ship_count >= drum_ship_count
          status[idx] &= true
        else
          status[idx] &= false
    checkDrumCount: (status, drum_count, decks, ships, slotitems) ->
      for fleet, idx in decks[1..3]
        _drum_count = 0
        for ship_id in fleet.api_ship when ship_id isnt -1
          for slotitem_id in ships[ship_id].api_slot when slotitem_id isnt -1
            slotitem_slotitemid = slotitems[slotitem_id].api_slotitem_id
            if slotitem_slotitemid is 75
              _drum_count += 1
        if _drum_count >= drum_count
          status[idx] &= true
        else
          status[idx] &= false
    checkRequiredShiptype: (status, required_shiptype, decks, ships, Ships) ->
      for fleet, idx in decks[1..3]
        _required_shiptype_count = 0
        for ship_id in fleet.api_ship when ship_id isnt -1
          ship_shipid = ships[ship_id].api_ship_id
          ship_shiptype = Ships[ship_shipid].api_stype
          if ship_shiptype in required_shiptype.shiptype
            _required_shiptype_count += 1
        if _required_shiptype_count >= required_shiptype.count
          status[idx] &= true
        else
          status[idx] &= false
    checkSupply: (status, decks, ships) ->
      for fleet, idx in decks[1..3]
        _supply_ok = true
        for ship_id in fleet.api_ship when ship_id isnt -1
          ship_fuel = ships[ship_id].api_fuel
          ship_fuel_max = ships[ship_id].api_fuel_max
          ship_bull = ships[ship_id].api_bull
          ship_bull_max = ships[ship_id].api_bull_max
          if ship_fuel < ship_fuel_max or ship_bull < ship_bull_max
            _supply_ok = false
            break
        status[idx] &= _supply_ok
    checkCondition: (status, decks, ships) ->
      for fleet, idx in decks[1..3]
        _condition_ok = true
        for ship_id in fleet.api_ship when ship_id isnt -1
          ship_cond = ships[ship_id].api_cond
          if ship_cond < 30
            _condition_ok = false
            break
        status[idx] &= _condition_ok
    checkFlagshipHp: (status, decks, ships) ->
      for fleet, idx in decks[1..3]
        flagship_id = fleet.api_ship[0]
        if flagship_id isnt -1
          flagship_hp = ships[flagship_id].api_nowhp
          flagship_maxhp = ships[flagship_id].api_maxhp
          if flagship_hp / flagship_maxhp > 0.25
            status[idx] &= true
          else
            status[idx] &= false
        else
          status[idx] &= false
    handleExpeditionSelect: (id) ->
      if id is 0 then return
      {$ships, $shipTypes, $missions, _decks, _ships, _slotitems} = window
      mission = $missions[id]
      expedition = @state.expeditions[id]
      information = []
      if mission?
        hours = mission.api_time // 60;

            for reward_item, i in expedition.reward_items
              information.push <li key="reward_items_#{i}">{itemNames[reward_item.itemtype]} 0~{reward_item.max_number} 个</li>
      constraints = []
      if expedition?
        if expedition.flagship_lv isnt 0
          constraints.push <li key='flagship_lv'>旗舰等级 Lv. {expedition.flagship_lv}</li>
        if expedition.fleet_lv isnt 0
          constraints.push <li key='fleet_lv'>舰队等级合计 Lv. {expedition.fleet_lv}</li>
        if expedition.flagship_shiptype isnt 0
          constraints.push <li key='flagship_shiptype'>旗舰舰种 {$shipTypes[expedition.flagship_shiptype].api_name}</li>
        if expedition.ship_count isnt 0
          constraints.push <li key='ship_count'>总舰数 {expedition.ship_count} 只</li>
        if expedition.drum_ship_count isnt 0
          constraints.push <li key='drum_ship_count'>装备缶的舰数 {expedition.drum_ship_count} 只</li>
        if expedition.drum_count isnt 0
          constraints.push <li key='drum_count'>装备的缶个数 {expedition.drum_count} 个</li>
        if expedition.required_shiptypes.length isnt 0
          for required_shiptype, i in expedition.required_shiptypes
            stype_name = $shipTypes[required_shiptype.shiptype[0]].api_name
