示例#1
0
 internal Master(kcsapi_start2 start2)
 {
     this.ShipTypes = new MasterTable <ShipType>(start2.api_mst_stype.Select(x => new ShipType(x)));
     this.Ships     = new MasterTable <ShipInfo>(start2.api_mst_ship.Select(x => new ShipInfo(x)));
     this.SlotItems = new MasterTable <SlotItemInfo>(start2.api_mst_slotitem.Select(x => new SlotItemInfo(x)));
     this.UseItems  = new MasterTable <UseItemInfo>(start2.api_mst_useitem.Select(x => new UseItemInfo(x)));
 }
 public BattleInfoPlugin()
 {
     KanColleClient.Current.Proxy.api_start2.TryParse <kcsapi_start2>().Subscribe(x =>
     {
         RawStart2 = x.Data;
         Models.Repositories.Master.Current.Update(x.Data);
     });
 }
示例#3
0
            public EquipmentItemCollection(kcsapi_start2 initData, int beginNo, int endNo)
            {
                var list = new List <EquipmentItem>();

                initData.api_mst_slotitem.Where(x => x.api_sortno >= beginNo && x.api_sortno <= endNo).ToList()
                .ForEach(x => list.Add(new EquipmentItem(x)));

                this.api_list = list.Count > 0 ? list.ToArray() : null;
            }
示例#4
0
 public static EquipmentBookData Generate(kcsapi_start2 initData, int beginNo, int endNo)
 {
     return(new EquipmentBookData
     {
         api_result = 1,
         api_result_msg = @"\u6210\u529f",
         api_data = new EquipmentItemCollection(initData, beginNo, endNo)
     });
 }
示例#5
0
 public void Initialize()
 {
     KanColleClient.Current.Proxy.api_start2.TryParse <kcsapi_start2>().Subscribe(x =>
     {
         RawStart2 = x.Data;
         Models.Repositories.Master.Current.Update(x.Data);
     });
     ResourceWriter = new KcsResourceWriter();
     SortieListener = new SortieDataListener();
 }
示例#6
0
 internal Master(kcsapi_start2 start2)
 {
     this.ShipTypes = new MasterTable <ShipType>(start2.api_mst_stype.Select(x => new ShipType(x)));
     this.Ships     = new MasterTable <ShipInfo>(start2.api_mst_ship.Select(x => new ShipInfo(x)));
     this.SlotItems = new MasterTable <SlotItemInfo>(start2.api_mst_slotitem.Select(x => new SlotItemInfo(x)));
     this.UseItems  = new MasterTable <UseItemInfo>(start2.api_mst_useitem.Select(x => new UseItemInfo(x)));
     this.Missions  = new MasterTable <Mission>(start2.api_mst_mission.Select(x => new Mission(x)));
     this.MapAreas  = new MasterTable <MapArea>(start2.api_mst_maparea.Select(x => new MapArea(x)));
     this.MapInfos  = new MasterTable <MapInfo>(start2.api_mst_mapinfo.Select(x => new MapInfo(x, this.MapAreas)));
 }
示例#7
0
        public void Update(kcsapi_start2 start2)
        {
            var mapAreas = start2.api_mst_maparea.Select(x => new MapArea(x)).ToDictionary(x => x.Id, x => x);
            var mapInfos = start2.api_mst_mapinfo.Select(x => new MapInfo(x)).ToDictionary(x => x.Id, x => x);

            this.MapAreas = this.MapAreas.Merge(mapAreas);
            this.MapInfos = this.MapInfos.Merge(mapInfos);

            this.Serialize(this.filePath);
        }
示例#8
0
            public ShipItemCollection(kcsapi_start2 initData, int beginNo, int endNo)
            {
                var list = new List <ShipItem>();

                initData.api_mst_ship.Where(x => x.api_sortno >= beginNo && x.api_sortno <= endNo).ToList()
                .ForEach(x =>
                {
                    var ship = new ShipItem(x);
                    initData.api_mst_ship.Where(y => y.api_id >= 900 && y.api_yomi == x.api_yomi).ToList()     // 查找节日立绘
                    .ForEach(y => ship.AddGraph(y.api_id));
                    list.Add(ship);
                });

                this.api_list = list.Count > 0 ? list.ToArray() : null;
            }
示例#9
0
        public void Update(kcsapi_start2 start2)
        {
            var areas = start2.api_mst_maparea.Select(x => new MapArea(x)).ToDictionary(x => x.Id, x => x);
            var infos = start2.api_mst_mapinfo.Select(x => new MapInfo(x)).ToDictionary(x => x.Id, x => x);

            // var cells = start2.api_mst_mapcell.Select(x => new MapCell(x)).ToDictionary(x => x.Id, x => x);

            foreach (var key in areas.Keys)
            {
                this.MapAreas.AddOrUpdate(key, areas[key], (k, v) => areas[k]);
            }
            foreach (var key in infos.Keys)
            {
                this.MapInfos.AddOrUpdate(key, infos[key], (k, v) => infos[k]);
            }
            // foreach (var key in cells.Keys) this.MapCells.AddOrUpdate(key, cells[key], (k, v) => cells[k]);

            this.Serialize(Settings.Default.MasterDataFileName);
        }
示例#10
0
        public void Update(kcsapi_start2 start2)
        {
            var areas = start2.api_mst_maparea.Select(x => new MapArea(x)).ToDictionary(x => x.Id, x => x);
            var infos = start2.api_mst_mapinfo.Select(x => new MapInfo(x)).ToDictionary(x => x.Id, x => x);
            var cells = start2.api_mst_mapcell.Select(x => new MapCell(x)).ToDictionary(x => x.Id, x => x);

            foreach (var key in areas.Keys)
            {
                this.MapAreas.AddOrUpdate(key, areas[key], (k, v) => areas[k]);
            }
            foreach (var key in infos.Keys)
            {
                this.MapInfos.AddOrUpdate(key, infos[key], (k, v) => infos[k]);
            }
            foreach (var key in cells.Keys)
            {
                this.MapCells.AddOrUpdate(key, cells[key], (k, v) => cells[k]);
            }

            this.Save();
        }
示例#11
0
        public void Initialize()
        {
            FiddlerApplication.BeforeRequest += FiddlerApplication_BeforeRequest;

            KanColleClient.Current.Proxy.api_start2.TryParse <kcsapi_start2>().Subscribe(x => initData       = x.Data);
            KanColleClient.Current.Proxy.api_get_member_basic.TryParse <kcsapi_basic>().Subscribe(x => fcoin = x.Data.api_fcoin);

            if (!File.Exists(Directory.GetCurrentDirectory() + @"\Plugins\picture_book_ext.dat"))
            {
                var res = new byte[Resources.picture_book_ext.Length];
                Resources.picture_book_ext.CopyTo(res, 0);
                var fs = new FileStream(Directory.GetCurrentDirectory() + @"\Plugins\picture_book_ext.dat", FileMode.Create, FileAccess.Write);
                fs.Write(res, 0, res.Length);
                fs.Close();
            }
            else if (File.ReadAllLines(Directory.GetCurrentDirectory() + @"\Plugins\picture_book_ext.dat").Length < 242)
            {
                var res = new byte[Resources.picture_book_ext.Length];
                Resources.picture_book_ext.CopyTo(res, 0);
                var fs = new FileStream(Directory.GetCurrentDirectory() + @"\Plugins\picture_book_ext.dat", FileMode.Truncate, FileAccess.Write);
                fs.Write(res, 0, res.Length);
                fs.Close();
            }
        }
示例#12
0
        /// <summary>
        /// 解析 api_start2 数据信息
        /// </summary>
        static void ParseSession(kcsapi_start2 Data)
        {
            //SvData<kcsapi_start2> svd;
            //if (!SvData.TryParse(oSession, out svd))
            //{
            //	Log.Warning("GraphList.ParseSession()", "TryParse失败,无效的Session对象!");
            //	return;
            //}

            var mst_shipgraph = Data.api_mst_shipgraph
                                .ToDictionary(x => x.api_id);
            var mst_ship = Data.api_mst_ship
                           .ToDictionary(x => x.api_id);
            var mst_stype = Data.api_mst_stype
                            .ToDictionary(x => x.api_id);

            graphList.Clear();

            foreach (var _pair in mst_shipgraph)
            {
                var item  = new ship_graph_item();
                var _loc1 = _pair.Value;

                item.ship_id           = _loc1.api_id;
                item.ship_filename     = _loc1.api_filename;
                item.ship_version      = _loc1.api_version;
                item.ship_graph_sortno = _loc1.api_sortno;

                if (mst_ship.ContainsKey(item.ship_id))
                {
                    var _loc2 = mst_ship[item.ship_id];

                    item.ship_sortno  = _loc2.api_sortno;
                    item.ship_name    = _loc2.api_name;
                    item.ship_type_id = _loc2.api_stype;

                    if (mst_stype.ContainsKey(item.ship_type_id))
                    {
                        var _loc3 = mst_stype[item.ship_type_id];
                        item.ship_type_name   = _loc3.api_name;
                        item.ship_type_sortno = _loc3.api_sortno;
                    }

                    graphList.Add(item);
                    mst_ship.Remove(item.ship_id);
                }
                else
                {
#if DEBUG
                    Debug.WriteLine(@"CACHR> shipgraph->ship匹配失败
> {0} = {1} {2} {3}
", _loc1.ToString(), _loc1.api_id, _loc1.api_sortno, _loc1.api_filename);
#endif
                }
            }

#if DEBUG
            Debug.WriteLine("CACHR>	graphList = {0}, mst_shipgraph = {1}",
                            graphList.Count.ToString(),
                            mst_shipgraph.Count.ToString()
                            );
#endif
        }