1 // Copyright (C) 2013 Kazuhiro Fujieda <fujieda@users.sourceforge.jp>
\r
3 // This program is part of KancolleSniffer.
\r
5 // KancolleSniffer is free software: you can redistribute it and/or modify
\r
6 // it under the terms of the GNU General Public License as published by
\r
7 // the Free Software Foundation, either version 3 of the License, or
\r
8 // (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, see <http://www.gnu.org/licenses/>.
\r
18 namespace KancolleSniffer
\r
20 public class ItemInfo
\r
22 private int _nowShips;
\r
26 get { return _nowShips; }
\r
31 var limit = MaxShips - MarginShips;
\r
32 NeedRing = _nowShips < limit && value >= limit;
\r
38 public int MaxShips { get; set; }
\r
39 public int MarginShips { get; set; }
\r
40 public bool NeedRing { get; set; }
\r
41 public int NowItems { get; set; }
\r
42 public int MaxItems { get; set; }
\r
43 public int NumBuckets { get; set; }
\r
45 public bool TooManyShips
\r
47 get { return MaxShips != 0 && NowShips >= MaxShips - MarginShips; }
\r
55 public void InspectBasic(dynamic json)
\r
57 MaxShips = (int)json.api_max_chara;
\r
58 MaxItems = (int)json.api_max_slotitem;
\r
60 public void InspectRecord(dynamic json)
\r
62 NowShips = (int)json.api_ship[0];
\r
63 MaxShips = (int)json.api_ship[1];
\r
64 NowItems = (int)json.api_slotitem[0];
\r
65 MaxItems = (int)json.api_slotitem[1];
\r
68 public void InspectMaterial(dynamic json)
\r
70 foreach (var entry in json)
\r
72 if ((int)entry.api_id != 6)
\r
74 NumBuckets = (int)entry.api_value;
\r
78 public void InspectSlotItem(dynamic json)
\r
80 NowItems = ((object[])json).Length;
\r