Worker.java
上传用户:hainatieta
上传日期:2019-07-13
资源大小:1076k
文件大小:5k
- package cn.seejava.lei2;
- import java.awt.AWTException;
- import java.awt.event.InputEvent;
- import java.awt.event.KeyEvent;
- import java.util.Date;
- import javax.swing.JOptionPane;
- public class Worker {
- boolean threeOutStart = false;
- boolean cgTeamStart = false;
- int i = 0;
- int j = 0 ;
-
- public void doClick(SRobot robot){
- sleep(10);
- robot.mousePress(InputEvent.BUTTON1_MASK);
- robot.delay(70);
- robot.mouseRelease(InputEvent.BUTTON1_MASK);
- sleep(20);
- }
- public void doKeyType(SRobot robot,int keyCode){
- robot.keyPress(keyCode);
- robot.delay(50);
- robot.keyRelease(keyCode);
- sleep(50);
- }
- public void doFastJoin(SRobot robot3){
- robot3.mouseMove(624, 439);
- doClick(robot3);
- robot3.mouseMove(455, 424);
- }
- public void doFQueDing(SRobot robot3){
- sleep(50);
- robot3.mouseMove(455, 404);
- doClick(robot3);
- robot3.mouseMove(455,424);
- }
- public void doJoinGame(SRobot robot3,Check check){
- int i = check.getPep(robot3);
- if(i>ReadyOwner.penum){
- robot3.mouseMove(749, 439);
- doClick(robot3);
- robot3.mouseMove(740, 460);
- }else if(i>2){
- doPressBack(robot3);
- }
- }
- public void doCheckJoinGame(SRobot robot3,Check check){
- robot3.mouseMove(420, 133);
- doClick(robot3);
- sleep(300);
- doTypeEnter(robot3);
- doJoinGame(robot3,check);
- }
- public void doTypeEnter(SRobot robot3){
- robot3.keyPress(KeyEvent.VK_ENTER);
- robot3.delay(50);
- robot3.keyRelease(KeyEvent.VK_ENTER);
- sleep(50);
- }
- public void doLevelUp(SRobot robot3){
- robot3.mouseMove(406, 463);
- doClick(robot3);
- robot3.mouseMove(406, 483);
- }
- public void doStartGame(SRobot robot3){
- robot3.mouseMove(766, 439);
- doClick(robot3);
- robot3.mouseMove(766, 459);
- }
- public void doPressBack(SRobot robot3){
- doKeyType(robot3, KeyEvent.VK_ESCAPE);
- }
- public void doBack(SRobot robot,Check check){
- //先是判断是不是能 后退
- if(check.isCancelReady(robot)){
- //先移动鼠标点击
- doCancelReady(robot);
- sleep(50);
- }
- doPressBack(robot);
- sleep(200);
- }
- public void doResult(SRobot robot3){
- robot3.mouseMove(744, 564);
- doClick(robot3);
-
- }
- public void doReady(SRobot robot3){
- doCancelReady(robot3);
- robot3.mouseMove(740, 460);
- }
- public void doCancelReady(SRobot robot3){
- robot3.mouseMove(740,440);
- doClick(robot3);
- robot3.mouseMove(740, 460);
- }
- public void doClickTT(SRobot robot3){
- robot3.mouseMove(420, 133);
- doClick(robot3);
- }
- public void doInvite(SRobot robot3){
- robot3.mouseMove(443, 483);
- doClick(robot3);
- }
- public void doOutFight(SRobot robot){
- doKeyType(robot, KeyEvent.VK_ESCAPE);
- sleep(1000);
- doTypeEnter(robot);
- sleep(1000);
- doTypeEnter(robot);
-
- }
- public void doThreeOut(Check check){
- if(threeOutStart){
- return;
- }else{
- threeOutStart = true;
- //上来就睡觉三分钟
- sleep(1000*50*3);
- SRobot robot5;
- try {
- robot5 = new SRobot();
- if(check.isCancelReady(robot5)){
- //后退
- doBack(robot5, check);
- }
- } catch (AWTException e) {
- JOptionPane.showMessageDialog(null, "程序出现错误,错误代码0002,请主动联系开发人员");
- }
- threeOutStart = false;
- }
-
- }
- public void cgTeam(Check check){
- if(cgTeamStart){
- return;
- }else{
- cgTeamStart = true;
- int i = 0;
- SRobot robot6;
- while(true){
- try {
- if(i<2){
- robot6 = new SRobot();
- if(check.isInRoom(robot6)){
- if(check.checkEmptySpace(robot6)){
- if(check.isCancelReady(robot6)){
- doCancelReady(robot6);
- }
- doClickTT(robot6);
- sleep(3000);
- i++;
- }else{
- sleep(50);
- }
- }else{
- break;
- }
- }else{
- break;
- }
- } catch (AWTException e) {
- e.printStackTrace();
- }
- }
- cgTeamStart = false;
- }
- }
- public void sleep(int time){
- try {
- Thread.sleep(time);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- public void doSayF5(SRobot robot){
- i++;
- if(i%20==0){
- doKeyType(robot, KeyEvent.VK_F5);
- doKeyType(robot, KeyEvent.VK_F6);
- }
- if(i==65534){
- i = 0;
- }
- }
- public void doChekOut(SRobot robot,Check check){
- j++;
- if(j%50==0){
- int z = check.getPepNum(robot);
- if(2<z&&z<ReadyOwner.penum){
- //执行退出房间
- doOutFight(robot);
- }
- }
- if(j==65534){
- j = 0;
- }
-
- }
- public void doThrowBomb(SRobot robot){
- robot.mouseMove(400, 3000);
- sleep(300);
- doClick(robot);
- sleep(1000);
- }
- }