Exemplo n.º 1
0
 private int[] getShipListArray(int fleetNum)
 {
     String result = this.kcp.proxy(ApiPort.PORT, ApiPort.port(this.member_id));
     KanColleAPI<Port> api_data = JsonConvert.DeserializeObject<KanColleAPI<Port>>(result);
     this.portData = api_data.GetData();
     try {
         string shipList = api_data.GetData().GetFleetList(fleetNum);
         this.ship_list_string = shipList;
         return ToIntArray(shipList, ',');
     } catch (Exception e) {
         Console.WriteLine(result.Substring(0, 200));
         Console.WriteLine(e.Message);
         throw new Exception(e.Message, e);
     }
 }
Exemplo n.º 2
0
        public void runForOneShip(int ship_id, int run_times)
        {
            int morale = getMorale(this.portData, ship_id);
            Console.WriteLine("KANMUSU'S ID: " + ship_id);
            Console.WriteLine("INITIAL MORALE: " + morale);

            if (morale >= 81) {
                Console.WriteLine("Morale is " + morale + ". Skipping...");
                return;
            }

            int run_count = 0;
            while (run_times != run_count) {
                if (morale >= 81) {
                    Console.WriteLine("Morale is " + morale + ". Skipping the rest of iterations...");
                    break;
                }

                this.kcp.proxy(MapInfo.MAPINFO);
                Console.WriteLine("MapInfo done.");
                this.kcp.proxy(MapCell.MAPCELL, MapCell.Get(1, 1));
                Console.WriteLine("MapCell done.");

                this.kcp.proxy(Map.START, Map.Start(1, this.fleet_id, 1, 1));
                Console.WriteLine("STARTED.");

                Thread.Sleep(ONE_SECOND);
                this.kcp.proxy(Sortie.BATTLE, Sortie.Battle(1, 0));
                Console.WriteLine("First battle done.");
                Thread.Sleep(TEN_SECONDS);
                this.kcp.proxy(Sortie.BATTLERESULT);
                Console.WriteLine("First battle results get.");
                Thread.Sleep(FIVE_SECONDS);

                this.kcp.proxy(Ship3.SHIP2, Ship3.Ship2());
                Console.WriteLine("Ship2 get.");
                this.kcp.proxy(Map.NEXT, Map.Next());
                Console.WriteLine("NEXT.");
                Thread.Sleep(ONE_SECOND);

                this.kcp.proxy(Sortie.BATTLE, Sortie.Battle(1, 0));
                Console.WriteLine("Second battle done.");
                Thread.Sleep(TEN_SECONDS);
                this.kcp.proxy(Sortie.BATTLERESULT);
                Console.WriteLine("Second battle results get.");
                Thread.Sleep(FIVE_SECONDS);

                string port_data = this.kcp.proxy(ApiPort.PORT, ApiPort.port(this.member_id));
                this.portData = JsonConvert.DeserializeObject<KanColleAPI<Port>>(port_data).GetData();
                Console.WriteLine("Returned to port.");

                this.kcp.proxy(Hokyu.CHARGE, Hokyu.Charge(this.ship_list_string, ChargeKind.BOTH));
                Console.WriteLine("Refueled.");
                Thread.Sleep(ONE_SECOND);

                Console.WriteLine("ROUND {0} COMPLETE.", ++run_count);
                morale = getMorale(this.portData, ship_id);
                Console.WriteLine("CURRENT MORALE: " + morale + "\n");
            }
        }
Exemplo n.º 3
0
 private int getMorale(Port port, int ship_id)
 {
     int cond = 0;
     foreach (Ship kanmusu in port.api_ship) {
         if (kanmusu.api_id == ship_id) {
             return kanmusu.api_cond;
         }
     }
     return cond;
 }