Nginx配置 定义键盘快捷键 Zookeeper HTML框架 进程 Java Out Of Memory 压制组装机 unity HTTP请求 shell xamarin jboss ionic framework vue注册组件 android经典项目开发实战 jquery触发点击事件 jq触发点击事件 jquery事件绑定方法 jquery获取元素 软件测试实战项目 js字符串排序 mac上传文件到linux ubuntu显示隐藏文件夹 pythonassert函数 python加法 python代码示例 python打开文件 python语言编程 python的re模块 python教程推荐 java接口类 java中的基本数据类型 java基本语法 java平台 java取当前时间 java生成文件 java异常 java环境下载 linux安装教程 linuxshell编程
当前位置: 首页 > 学习教程  > 编程学习

和Sun一起开源(武林外传游戏外挂Java源代码) - 论坛版

2021/1/22 23:11:50 文章标签: 旋风辅助

以下是我在大三时,武林外传游戏还在公测时写的一个外挂,辅助玩游戏。以前在大学时用着很好用,和大家共享出来。希望有朋友能够进行重构,发布一些更好用的JAVA实现的外挂程序。 由于这是本人的处女做,所以代码结构有些乱…

      以下是我在大三时,武林外传游戏还在公测时写的一个外挂,辅助玩游戏。以前在大学时用着很好用,和大家共享出来。希望有朋友能够进行重构,发布一些更好用的JAVA实现的外挂程序。

 

      由于这是本人的处女做,所以代码结构有些乱,但由于程序本身并不是很复杂,有心人是一定会看懂的,此外还有一些简单的注释。

 

      由于当时不会使用IDE,仅用记事本写的,所以写得比较辛苦,也花费了较长时间。希望对大家能够有所帮助。

 

package game;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.lang.*;
import java.io.*; 

//主类
public class Action
{
 static int TimeNumber=0;
 public static void main(String[] args)
 {
  ViewFlow vf=new ViewFlow();
  vf.addActionlistener();
  }
 }

 

  

package game;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.lang.*;
import java.io.*;


class MyActionListener2 implements ActionListener//核心类(实现主要功能)
 {
  static int ip=0;
  public void actionPerformed(ActionEvent e2)
  {
    try
    {
      Robot robot=new Robot();
     int x=73,y=23,
         x2=ViewFlow.slider1.getValue(),
             y2=23,
         x3=228,y3=26,
         x4=0,y4=0;
/*
int i=ViewFlow.slider1.getValue(),j=23,k=0;
    {
      try
      {
       Robot rb=new Robot();
       while(k<1)
         { 
          rb.mouseMove(i,j);
         rb.getPixelColor(i,j);
         System.out.print((k++)+": "+rb.getPixelColor(i,j)+": ");
         System.out.println("(i="+(i++)+",j="+j+");");
           }
          }
          catch(AWTException e3){}
    }
*/
   if(robot.getPixelColor(x,y).equals(new Color(255,75,53))&&MyActionListener2.ip==1)//自动打怪
         {
       robot.keyPress(KeyEvent.VK_5);//捡东西
          if(  robot.getPixelColor(x3,y3).equals(new Color(255,107,87))
                                                   ||robot.getPixelColor(x3,y3).equals(new Color(255,107,86)))
          {
           robot.keyPress(KeyEvent.VK_1);//技能1
           //robot.keyPress(KeyEvent.VK_2);//技能2
           //robot.keyPress(KeyEvent.VK_3);//技能3
           //robot.keyPress(KeyEvent.VK_4);//打怪1
           }
          else
          {
           robot.keyPress(KeyEvent.VK_TAB);
           robot.keyRelease(KeyEvent.VK_TAB);
           }
          }
          
          
              //System.out.println(MyActionListener.myTimer.getDelay());//改变加血速度测试
   if(!robot.getPixelColor(x,y).equals(new Color(255,75,53)))
   {
    ViewFlow.setText1("提示:请启动游戏");
    //System.out.println(ViewFlow.slider1.getValue());//测试1
    //System.out.println(ViewFlow.slider2.getValue());//测试2
    }                                        
   else if(  robot.getPixelColor(x2,y2).equals(new Color(255,75,53))       //加血位置与血的颜色相等
             ||robot.getPixelColor(x,y).equals(robot.getPixelColor(x2,y2))   //加血位置与指定的理想的血的位置的颜色相等
           /*
           ||robot.getPixelColor(x2,y2).equals(new Color(255,159,147))     //加血位置与指血的颜色1比较 
              ||robot.getPixelColor(x2,y2).equals(new Color(247,193,186))     //加血位置与指血的颜色2比较 
              ||robot.getPixelColor(x2,y2).equals(new Color(228,103,88))      //加血位置与指血的颜色3比较 
              ||robot.getPixelColor(x2,y2).equals(new Color(245,72,51))       //加血位置与指血的颜色4比较 
              ||robot.getPixelColor(x2,y2).equals(new Color(255,183,174))     //加血位置与指血的颜色5比较 
              ||robot.getPixelColor(x2,y2).equals(new Color(228,91,75))       //加血位置与指血的颜色6比较 
              ||robot.getPixelColor(x2,y2).equals(new Color(248,73,52))       //加血位置与指血的颜色7比较 
              ||robot.getPixelColor(x2,y2).equals(new Color(225,195,188))     //加血位置与指血的颜色8比较 
              ||robot.getPixelColor(x2,y2).equals(new Color(235,141,130))     //加血位置与指血的颜色9比较 
              ||robot.getPixelColor(x2,y2).equals(new Color(235,69,49))       //加血位置与指血的颜色10比较
              ||robot.getPixelColor(x2,y2).equals(new Color(239,154,144))     //加血位置与指血的颜色11比较
              */
           )
   {
    ViewFlow.setText1("不需加血");
    }
    
   else if(  robot.getPixelColor(x,y).equals(new Color(255,75,53))//加血
             &&!robot.getPixelColor(x,y).equals(robot.getPixelColor(x2,y2))
           )
    {
       robot.keyPress(KeyEvent.VK_F8);//加血的键位
       //ViewFlow.setText1("自动加血开始");   
       }
   
   }
    catch(AWTException eException1){}
   
   }
  
  }

 

 

   

package game;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.lang.*;
import java.io.*;

class MyActionListener3 implements ActionListener
   {
    public void actionPerformed(ActionEvent e3)
    {
       MyActionListener.myTimer.stop();
       ViewFlow.setText1("       外挂程序已停止");
     }
    }

 

 

 

   

package game;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.lang.*;
import java.io.*;

class MyActionListener4 implements ActionListener
    {
     public void actionPerformed(ActionEvent e7)
     {
       if(e7.getSource()==ViewFlow.helpMenuItem1)//打开使用帮助网页
       {
         try
        {
          Runtime.getRuntime().exec("\"C:\\Program  Files\\Internet  Explorer\\iexplore.exe\"http://blog.csdn.net/sunnyjavamoon/archive/2006/10/27/1352772.aspx");  
         }
         catch(IOException eIO){}
        }
       
       else if(e7.getSource()==ViewFlow.helpMenuItem2)//打开在线更新网页
       {
         try
        {
          Runtime.getRuntime().exec("\"C:\\Program  Files\\Internet  Explorer\\iexplore.exe\"http://blog.csdn.net/sunnyjavamoon/archive/2006/11/04/1366552.aspx");  
         }
         catch(IOException eIO){}
        }
        
       else if(e7.getSource()==ViewFlow.helpMenuItem3)//打开作者主页网页
       {
         try
        {
          Runtime.getRuntime().exec("\"C:\\Program  Files\\Internet  Explorer\\iexplore.exe\"http://blog.csdn.net/SunnyJavaMoon/");  
         }
         catch(IOException eIO){}
        }
       
       else if(e7.getSource()==ViewFlow.helpMenuItem4)//打开关于网页
       {
         try
        {
          Runtime.getRuntime().exec("\"C:\\Program  Files\\Internet  Explorer\\iexplore.exe\"http://blog.csdn.net/sunnyjavamoon/archive/2006/10/27/1352772.aspx");  
         }
         catch(IOException eIO){}
        }
        
       else if(e7.getSource()==ViewFlow.exchangeItem1)//论坛交流
       {
         try
        {
          Runtime.getRuntime().exec("\"C:\\Program  Files\\Internet  Explorer\\iexplore.exe\"http://vip3.getbbs.com/Board/TList.aspx?BID=5177");  
         }
         catch(IOException eIO){}
        }
       
       else if(e7.getSource()==ViewFlow.exchangeItem2)//论坛主页
       {
         try
        {
          Runtime.getRuntime().exec("\"C:\\Program  Files\\Internet  Explorer\\iexplore.exe\"http://ljf365.getbbs.com");  
         }
         catch(IOException eIO){}
        }
       else if(e7.getSource()==ViewFlow.jbt3)//论坛主页
       {
         try
        {
          Runtime.getRuntime().exec("\"C:\\Program  Files\\Internet  Explorer\\iexplore.exe\"http://blog.csdn.net/sunnyjavamoon/archive/2006/11/04/1366552.aspx");  
         }
         catch(IOException eIO){}
        }
       }
      }

 

 

 

   

package game;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.lang.*;
import java.io.*;

class MyActionListener implements ActionListener
 {
  static Timer myTimer=new Timer(1500,new MyActionListener2());//速度控制    
  public void actionPerformed(ActionEvent e)
  {
   ViewFlow.setText1("        外挂程序启动中......");                               
   MyActionListener.myTimer.start();                      
   }
  }

 

 

 

   

package game;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.lang.*;
import java.io.*;

class MyChangeListener1 implements ChangeListener
   {
    public void stateChanged(ChangeEvent e4)
    {
     ViewFlow.setText2("加血位置:"+ViewFlow.slider1.getValue()+"/170");
     }
    }

 

 

 

   

package game;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.lang.*;
import java.io.*;

class MyChangeListener2 implements ChangeListener
   {
    public void stateChanged(ChangeEvent e5)
    {
     ViewFlow.setText3("加血速度:"+ViewFlow.slider2.getValue()+" 毫秒/次");
     MyActionListener.myTimer.setDelay(ViewFlow.slider2.getValue());
     }
    }

 

 

   

package game;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.lang.*;
import java.io.*;

//界面类
class ViewFlow
{
 Container jfContainer=null;
 JButton jbt1=null;
 JButton jbt2=null;
 static JButton jbt3=null;
 JPanel jp1=null;
 JPanel jp2=null;
 JPanel jp3=null;
 JPanel jp4=null;
 static JSlider slider1=null;
 static JSlider slider2=null;
 static JTextField jf1=new JTextField("请启动游戏",15);
 static JTextField jf2=new JTextField("加血位置:100"+"/170",15);
 static JTextField jf3=new JTextField("加血速度:1500"+" 毫秒/次",15);
 static JRadioButton jrb1=null;
 static JRadioButton jrb2=null;
 
 JMenuBar jmb=null;
 JMenu helpMenu=null;
 static JMenuItem helpMenuItem1=null;
 static JMenuItem helpMenuItem2=null;
  static JMenuItem helpMenuItem3=null;
  static JMenuItem helpMenuItem4=null;
  JMenu hightSet=null;
  static JMenuItem hightSetItem1=null;
  static JMenuItem hightSetItem2=null;
  static JMenuItem hightSetItem3=null;
  JMenu exchangeMenu=null;
  static JMenuItem exchangeItem1=null;
  static JMenuItem exchangeItem2=null;

 ButtonGroup bg=null;
 ViewFlow()
 {
  JFrame jf=new JFrame("武林外挂1.0");
  jf.setSize(218,490);
  jf.setLocation(550,70);
  
  jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  jfContainer=jf.getContentPane();
  jfContainer.setLayout(new GridLayout(4,1,10,15));
  //面版
  jp1=new JPanel();
  jp2=new JPanel();
  jp3=new JPanel();
  jp4=new JPanel();
  
  //jp1.setSize(20,5);
  //jp2.setSize(30,30);

  jp1.setLayout(new FlowLayout(FlowLayout.CENTER,20,5));
  jp2.setLayout(new FlowLayout(FlowLayout.CENTER,20,5));
  jp3.setLayout(new FlowLayout(FlowLayout.CENTER,20,5));
  
  jp1.setBorder(BorderFactory.createTitledBorder("主控制区"));
  jp2.setBorder(BorderFactory.createTitledBorder("加血位置调整"));
  jp3.setBorder(BorderFactory.createTitledBorder("加血速度调整"));
  jp4.setBorder(BorderFactory.createTitledBorder("打怪模式设定"));
  
  jbt1=new JButton("开启");
  jbt2=new JButton("停止");
  jbt3=new JButton("在线升级");
  jbt3.setSize(10,20);
  
   jfContainer.add(jp1);//框架加入面版1
   jfContainer.add(jp2);//框架加入面版2
   jfContainer.add(jp3);//框架加入面版3 
   jfContainer.add(jp4);//框架加入面版4
   //滑杆1
   
   slider1=new JSlider(75,170,100);
  slider1.setPaintTicks(true);
  slider1.setMajorTickSpacing(20);
  slider1.setMinorTickSpacing(2);
  slider1.setSnapToTicks(true);
  //slider1.setPaintLabels(true);//显示刻度数字
  slider1.setPaintTrack(true);
  
  //滑杆2
  slider2=new JSlider(300,3000,1500);
  slider2.setPaintTicks(true);
  slider2.setMajorTickSpacing(300);
  slider2.setMinorTickSpacing(50);
  slider2.setSnapToTicks(true);
  //slider2.setPaintLabels(true);//显示刻度数字
  slider2.setPaintTrack(true);
  //单选按键
  jrb1=new JRadioButton("手动打怪");
  jrb2=new JRadioButton("自动打怪");
  bg=new ButtonGroup();
  //菜单
  jmb=new JMenuBar();
  jmb.setOpaque(true);
  jf.setJMenuBar(jmb);
  
  hightSet=buildHeightFileNenu();//生成高级选项菜单
  jmb.add(buildHeightFileNenu());//加载菜单
  
  exchangeMenu=builExchangeFileNenu();//生成问题交流菜单
  jmb.add(exchangeMenu);//加载菜单
  
  helpMenu=buildHelpFileMenu();//生成帮助菜单
  jmb.add(helpMenu);//加载菜单
 
  //面版
  jp1.add(jbt1);//面版1加入按键
   jp1.add(jbt2);//面版1加入按键
   jp1.add(jf1);
   bg.add(jrb1);
    bg.add(jrb2);
    jp2.add(slider1);
   jp2.add(jf2);
   jp3.add(slider2);   
   jp3.add(jf3);
   jp4.add(jrb1);
   jp4.add(jrb2);
   jp4.add(jbt3);
   jf.setVisible(true);
  }
  //  
  public JMenu buildHeightFileNenu()
  {
   JMenu file2=new JMenu("高级设置");//菜单1
   hightSetItem1=new JMenuItem("加血速度");//菜单2_菜单项1   
   hightSetItem2=new JMenuItem("加血位置");//菜单2_菜单项2
   hightSetItem3=new JMenuItem("打怪模式");//菜单3_菜单项3
   file2.add(hightSetItem1);
   file2.addSeparator();
   file2.add(hightSetItem2);
   file2.addSeparator();
   file2.add(hightSetItem3);
   return file2;
   } 
  public JMenu builExchangeFileNenu()
  {
   JMenu file2=new JMenu("问题交流");//菜单2
   exchangeItem1=new JMenuItem("论坛交流");//菜单2_菜单项1   
   exchangeItem2=new JMenuItem("龙旋风论坛");//菜单2_菜单项2
   file2.add(exchangeItem1);
   file2.addSeparator();
   file2.add(exchangeItem2);
   return file2;
   } 
  public JMenu buildHelpFileMenu()//菜单内容生成
  {
   JMenu file1=new JMenu("帮助");//菜单3
   helpMenuItem1=new JMenuItem("使用帮助");//菜单1_菜单项1   
   helpMenuItem2=new JMenuItem("在线更新");//菜单1_菜单项2
   helpMenuItem3=new JMenuItem("作者主页");//菜单1_菜单项2
   helpMenuItem4=new JMenuItem("关于");//菜单1_菜单项3
   file1.add(helpMenuItem1);
   file1.addSeparator();
   file1.add(helpMenuItem2);
   file1.addSeparator();
   file1.add(helpMenuItem3);
   file1.addSeparator();
   file1.add(helpMenuItem4);
   return file1;
   }
 public void addActionlistener()
 {
  jbt1.addActionListener(new MyActionListener());      
  jbt2.addActionListener(new MyActionListener3());
  jbt3.addActionListener(new MyActionListener4());
  
  slider1.addChangeListener(new MyChangeListener1());
  slider2.addChangeListener(new MyChangeListener2());
  
  jrb1.addItemListener(new MyItemListener1());
  jrb2.addItemListener(new MyItemListener1());
  
  MyActionListener4 MenuItemListener=new MyActionListener4();//菜单监视器
  //帮助菜单
  helpMenuItem1.addActionListener(MenuItemListener);
  helpMenuItem2.addActionListener(MenuItemListener);
  helpMenuItem3.addActionListener(MenuItemListener);
  helpMenuItem4.addActionListener(MenuItemListener);
  //高级设置
   hightSetItem1.addActionListener(MenuItemListener);
   hightSetItem2.addActionListener(MenuItemListener);
   hightSetItem3.addActionListener(MenuItemListener);
   //问题交流
   exchangeItem1.addActionListener(MenuItemListener);   
  exchangeItem2.addActionListener(MenuItemListener);
  }
  
 public static void setText1(String str)
 {
  jf1.setText(str);
  }
  
 public static void setText2(String str)
 {
  jf2.setText(str);
  }
  
 public static void setText3(String str)
 {
  jf3.setText(str);
  }
  
  }

 

   

package game;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.lang.*;
import java.io.*;
class MyItemListener1 implements ItemListener
    {
     public void itemStateChanged(ItemEvent e6)
     {
      if(e6.getSource()==ViewFlow.jrb1)
      {
       MyActionListener2.ip=0;//手动
       //System.out.println(ViewFlow.ip);//测试单选键1
       }
      else if(e6.getSource()==ViewFlow.jrb2)
      {
       MyActionListener2.ip=1;//自动
       //System.out.println(ViewFlow.ip);//测试单选键2
       }
      }
     }

 

 


本文链接: http://www.dtmao.cc/news_show_1248638.shtml

附件下载

相关教程

    暂无相关的数据...

共有条评论 网友评论

验证码: 看不清楚?