Beispiel #1
0
        private void result(int fleet_id)
        {
            string parameter    = KanColle.Request.Mission.Mission.Result(fleet_id);
            string postResponse = this.kcp.proxy(KanColle.Request.Mission.Mission.RESULT, parameter);

            try {
                KanColleAPI <MissionResult> result = JsonConvert.DeserializeObject <KanColleAPI <MissionResult> >(postResponse);

                // If mission fails, abort loop completely.
                if (result.GetData().GetResult().Equals(ExpeditionResult.FAIL))
                {
                    Console.WriteLine("Mission has FAILED! Current mission loop will be aborted.\nPlease check your fleet lineup and start again.");
                    Console.WriteLine("Press any key to exit this program.");                     // Not really supposde to exit...
                    Console.Read();
                    Environment.Exit(2);
                }

                this.accumulated[fleet_id][0] += result.GetData().api_get_material[0];
                this.accumulated[fleet_id][1] += result.GetData().api_get_material[1];
                this.accumulated[fleet_id][2] += result.GetData().api_get_material[2];
                this.accumulated[fleet_id][3] += result.GetData().api_get_material[3];
            } catch (Exception e) {
                Console.WriteLine(parameter);
                Console.WriteLine(postResponse);
                Console.WriteLine(e.Message);
                return;
            }
        }
Beispiel #2
0
        private void result()
        {
            Console.WriteLine();
            Console.WriteLine("!!***** MISSION RESULTS *****!!");
            string parameter    = Mission.Result(this.fleet_id);
            string postResponse = this.kcp.proxy(Mission.RESULT, parameter);

            // Debug
            // Console.WriteLine(postResponse);
            try {
                KanColleAPI <MissionResult> result = JsonConvert.DeserializeObject <KanColleAPI <MissionResult> >(postResponse);
                int[] getMaterials = result.GetData().PrintConsole();

                this.accumulated[0] += getMaterials[0];
                this.accumulated[1] += getMaterials[1];
                this.accumulated[2] += getMaterials[2];
                this.accumulated[3] += getMaterials[3];
                //this.accumulated.Zip(getMaterials, (x, y) => x + y); // Didn't work for some reason.
                Console.WriteLine("Cumulative resource acquired: {0} fuel, {1} ammo, {2} steel, {3} bauxite.", this.accumulated[0], this.accumulated[1], this.accumulated[2], this.accumulated[3]);

                // If mission fails, abort loop completely.
                if (result.GetData().GetResult().Equals(ExpeditionResult.FAIL))
                {
                    Console.WriteLine("Mission has FAILED! Current mission loop will be aborted.\nPlease check your fleet lineup and start again.");
                    Console.WriteLine("Press any key to exit this program.");
                    Console.Read();
                    Environment.Exit(2);
                }
            } catch (Exception e) {
                Console.WriteLine(parameter);
                Console.WriteLine(postResponse);
                Console.WriteLine(e.Message);
                return;
            }
        }
Beispiel #3
0
        private string getShipList(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 {
                return(api_data.GetData().GetFleetList(fleetNum));
            } catch (Exception e) {
                Console.WriteLine(result.Substring(0, 200));
                Console.WriteLine(e.Message);
                throw new Exception(e.Message, e);
            }
        }
        private void result(int fleet_id)
        {
            string parameter     = Mission.Result(fleet_id);
            string post_response = this.Proxy.proxy(Mission.RESULT, parameter);

            KanColleAPI <MissionResult> result = JsonConvert.DeserializeObject <KanColleAPI <MissionResult> >(post_response);

            // If mission fails, abort completely.
            if (result.GetData().GetResult().Equals(ExpeditionResult.FAIL))
            {
                this.IsRunning = false;
                // Write status to Main Window.
                this.mw.ConsoleOutput.Text += string.Format("Expedition for {0} has FAILED! Please check your fleet!\n", this.FleetMission.api_name);
            }
            else
            {
                this.mw.fuel  += result.api_data.api_get_material[0];
                this.mw.ammo  += result.api_data.api_get_material[1];
                this.mw.steel += result.api_data.api_get_material[2];
                this.mw.baux  += result.api_data.api_get_material[3];

                this.mw.ConsoleOutput.Text += string.Format("Expedition {0} has successfully returned!\n", this.FleetMission.api_name);
                this.mw.UpdateCollectedResourcesUI();
            }
        }
Beispiel #5
0
        private void start()
        {
            Console.WriteLine();
            Console.WriteLine("!!***** NEW MISSION *****!!");
            System.Diagnostics.Process proc = System.Diagnostics.Process.Start("KanColleConsole.exe");
            Thread.Sleep(400);
            proc.Kill();
            string mission_hash = File.ReadAllText("__abcde__.txt");

            string parameter    = Mission.Start(this.fleet_id, this.mission_id, int.Parse(mission_hash));
            string postResponse = this.kcp.proxy(Mission.START, parameter);

            // Debug
            // Console.WriteLine(postResponse);

            try {
                KanColleAPI <MissionStart> start = JsonConvert.DeserializeObject <KanColleAPI <MissionStart> >(postResponse);
                start.GetData().PrintConsole();
            } catch (Exception e) {
                Console.WriteLine(parameter);
                Console.WriteLine(postResponse);
                Console.WriteLine(e.Message);
                return;
            }
        }
Beispiel #6
0
        private string getMemberId()
        {
            String result = this.kcp.proxy(Basic.GET);
            KanColleAPI <Basic> api_data = JsonConvert.DeserializeObject <KanColleAPI <Basic> >(result);

            try {
                return(api_data.GetData().api_member_id);
            } catch (Exception e) {
                Console.WriteLine(result.Substring(0, 200));
                Console.WriteLine(e.Message);
                throw new Exception(e.Message, e);
            }
        }
Beispiel #7
0
        private void start(int fleet_id, int mission_id)
        {
            string param    = KanColle.Request.Mission.Mission.Start(fleet_id, mission_id, GetMission_Flash());
            string response = this.kcp.proxy(KanColle.Request.Mission.Mission.START, param);

            try {
                KanColleAPI <MissionStart> start = JsonConvert.DeserializeObject <KanColleAPI <MissionStart> >(response);
                start.GetData().PrintConsole();
            } catch (Exception e) {
                Console.WriteLine(param);
                Console.WriteLine(response);
                Console.WriteLine(e.Message);
                return;
            }
        }