Advertisement
Guest User

toms iz bad

a guest
Sep 23rd, 2014
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 13.72 KB | None | 0 0
  1. import java.awt.*;
  2. import java.applet.*;
  3. import java.util.*;
  4. import javax.swing.*;
  5. import java.applet.Applet;
  6. import java.awt.event.*;
  7. import java.io.*;
  8.  
  9. public class Torchlight extends /*Applet*/JApplet implements ActionListener {
  10.  
  11.     Label ConidText;
  12.     TextField SkillpasText, SkillactText, GndrText, WepnText, PetText, ClasText;        // All the Textfields next to the Checkboxes
  13.     Checkbox skillsPassive, skillsActive, gender, weaponry, pet, clas, everything;  // Checkboxes
  14.     //Image torchlightLogo;
  15.     ImageIcon RndmImg, ClearImg, HelpImg, torchlightLogo, CloseImg;                     // The logo
  16.     //Button Rndmize, Restart, Help, DisposeB; 
  17.     JButton Rndmize, Restart, Help, DisposeB, TestBtn;
  18.     Frame HelpF;                                                                                        //the frame when you click "Click here for help"
  19.     int RndmNumWep, RndmNumPet, RndmNumGndr, RndmNumAct, RndmNumPas, RndmNumClas, RndmNumAll, RndmNumOut, RndmNumEng, RndmNumEmb, RndmNumBer,RndmNumOutA, RndmNumEngA, RndmNumEmbA, RndmNumBerA; // integers, the random numbers
  20.     String Weaponry[] = {"Cannon","Pistol","Crossbow","Bow","Shotgonne","Axes","Fist Weapons","Maces","Polearm","Sword","Wand","Staff"};  //All the Weapons to randomize   
  21.     String Pet[] = {"Wolf","Cat","Bulldog","Panther","Papillion","Ferret","Chakawary","Hawk","Owl","Badger","Panda","Headcrab","Alpaca"}; //all the pets to randomize
  22.     String Gender[] = {"ok","Female","Male"};                                                                                                    //Gender(s) to randmize
  23.     String Class[] = {"Outlander","Embermage","Berserker","Engineer"};                                                               //classes to ranomize
  24.     String SkillPasO[] = {"Long Range Mastery","Shotgonne Mastery","Akimbo","Dodge Mastery","Poison Burst","Share the Wealth","Master of the Elements","Shadowling Ammo","Death Ritual"}; //Passive Skills for Outlander
  25.     String SkillPasB[] = {"Blood Hunger","Executioner","Rampage","Cold Steel Mastery","Shatter Storm","Rage Retaliation","Frenzy Mastery","Shred Amour","Red Wolf"};                      //Passive Skills for Berserker
  26.     String SkillPasEm[] = {"Charge Mastery","Elemental Attunement","Fire Brand","Staff Mastery","Frozen Fate","Ice Brand","Prismatic Rift","Wand Chaos","Lightning Brand"};               //Passive Skills for Embermage
  27.     String SkillPasE[] = {"Heavy Lifting","Supercharge","Coup-de-Grace","Bulwark","Fire and Spark","Charge Domination","Sword and Board","Aegis of Fate","Charge Reconstitution"};        // Passive skills for Engineer
  28.     String SkillActO[] = {"Rapid Fire","Rune Vault","Chaos Burst","Cursed Daggers","Vortex Hex","Shattering Glaive","Venomous Hail","Glaive Throw","Tangling Shot","Glaive Sweep","Sandstorm","Bramble Wall","Burning Leap","Flaming Glaive","Blade Pact","Shadowshot","Band Breath","Replusion Hex","Stone Pact","Shadowmantle","Shadowling Brute"}; //Active Skills for Outlander  
  29.     String SkillActB[] = {"Eviscerate","Howl","Razer","Wolfstrike","Battle Rage","Rupture","Ravage","Frost Breath","Stormclaw","Storm Hatchet","Northern Rage","Ice Shield","Permafrost","Glacial Shatter","Shadow Burst","Wolf Shade","Shadowbind","Savage Rush","Chain Snare","Battle Standard","Wolfpack"}; //Active Skills for Berserker
  30.     String SkillActEm[] = {"Magma Spear","Magma Mace","Firebombs","Blazing Pillar","Infernal Collapse","Immolation Aura","Firestorm","Icy Blast","Hailstorm","Frost Phase","Elemental Boon","Frost Wave","Ice Prison","Astral Ally","Prismatic Bolt","Shocking Burst","Thunder Locus","Arc Beam","Death's Bounty","Shockbolts","Shocking Orb"}; //Active Skills for Embermage
  31.     String SkillActE[] = {"Flame Hammer","Seismic Slam","Ember Hammer","Onslaught","Ember Reach","Storm Burst","Emberquake","Healing Bot","Blast Cannon","Spider Mines","Gun Bot","Shock Grenade","Fusilade","Sledgebot","Shield Bash","Forcefield","Overload","Dynamo Field","Tremor","Fire Bash","Immobillization Copter"}; //Active Skills for Eningeer
  32.    
  33.     public void init() {   
  34.        
  35.         Container content = getContentPane();                                       // gooey strt [GUI]
  36.         content.setLayout(new FlowLayout());
  37.         RndmImg = new ImageIcon("RndmImg.png");
  38.         Rndmize = new JButton ("RANDOMIZE");                                                       
  39.         Rndmize = new JButton (RndmImg);
  40.         Rndmize.setBounds(150, 400, 150, 50);
  41.         content.add(Rndmize);
  42.         ClearImg = new ImageIcon("vague.png");
  43.         Restart = new JButton ("Clear All");
  44.         Restart = new JButton (ClearImg);
  45.         Restart.setBounds(340, 275, 150, 50);
  46.         content.add(Restart);
  47.         HelpImg = new ImageIcon ("coolmeme.png");
  48.         Help = new JButton ("Click Here for Help!");
  49.         Help = new JButton (HelpImg);
  50.         Help.setBounds(340, 200, 150, 50);
  51.         content.add(Help);
  52.         SkillpasText = new TextField(10);
  53.         SkillpasText.setBounds(130, 200, 200, 20);
  54.         SkillactText = new TextField(10);
  55.         SkillactText.setBounds(130, 225, 200, 20);
  56.         GndrText = new TextField(10);
  57.         GndrText.setBounds(130, 250, 200, 20);
  58.         WepnText = new TextField(10);
  59.         WepnText.setBounds(130, 275, 200, 20);
  60.         PetText = new TextField(10);
  61.         PetText.setBounds(130, 300, 200, 20);
  62.         ClasText = new TextField(10);
  63.         ClasText.setBounds(130, 325, 200, 20);
  64.         add (Rndmize);
  65.         add (Restart);
  66.         add (SkillpasText);
  67.         add (SkillactText);
  68.         add (GndrText);
  69.         add (WepnText);
  70.         add (PetText);
  71.         add (ClasText);
  72.         add (Help);
  73.         torchlightLogo = new ImageIcon("Torchlight-2-1.png");
  74.         //torchlightLogo = getImage(getDocumentBase(),"torchlight_2_logo.png");
  75.         setLayout(null);
  76.         skillsPassive = new Checkbox("Skills (Passive) **", null, false);
  77.         skillsPassive.setBounds(15, 200, 150, 25);
  78.         add (skillsPassive);
  79.         skillsActive = new Checkbox("Skills (Active) **", null, false);
  80.         skillsActive.setBounds(15, 225, 150, 25);
  81.         add (skillsActive);
  82.         gender = new Checkbox("Gender", null, false);
  83.         gender.setBounds(15, 250, 150, 25);
  84.         add (gender);
  85.         weaponry = new Checkbox("Weaponry", null, false);
  86.         weaponry.setBounds(15, 275, 150, 25);
  87.         add (weaponry);
  88.         pet = new Checkbox("Pet", null, false);
  89.         pet.setBounds(15, 300, 150, 25);
  90.         add (pet);
  91.         clas = new Checkbox("Class", null, false);
  92.         clas.setBounds(15, 325, 150, 25);
  93.         add (clas);
  94.         everything = new Checkbox("Randomize Everything", null, false);
  95.         add(everything);
  96.         everything.setBounds(15, 350, 150,25);                                                         
  97.         Rndmize.addActionListener(this);
  98.         Restart.addActionListener(this);
  99.         Help.addActionListener(this);
  100.        
  101.         repaint();                                                                          // gooey ed [GUI]
  102.  
  103.     }
  104.            
  105.     public void paint(Graphics g){
  106.        
  107.         super.paint(g);
  108.        
  109.         torchlightLogo.paintIcon(this, g, 0, 0);                                                    //Adds the logo at the top
  110.        
  111.         //setBackground(Color.white);                                                                    
  112.        
  113.         //int width = torchlightLogo.getWidth(this);                                               
  114.         //int height = torchlightLogo.getHeight(this);
  115.        
  116.         //g.drawImage(torchlightLogo, 32, 5, width/3, height/3, this); 
  117.        
  118.     }
  119.    
  120.     public void actionPerformed(ActionEvent e)                                                 
  121.     {
  122.         RndmNumWep = ((int)(Math.random()*10)+1);                   //rolls a random number between 1 - 10 and assigns it to RndmNum(x)
  123.         RndmNumPet = ((int)(Math.random()*12)+1);                   //"                                 " 1 - 12
  124.         RndmNumGndr = ((int)(Math.random()*2)+1);                   //"                                 " 1 - 2
  125.         RndmNumClas = ((int)(Math.random()*4));                 //"                                 " 0 - 3
  126.         RndmNumOut = ((int)(Math.random()*9));
  127.         RndmNumEmb = ((int)(Math.random()*9));
  128.         RndmNumEng = ((int)(Math.random()*9));
  129.         RndmNumBer = ((int)(Math.random()*9));
  130.         RndmNumOutA = ((int)(Math.random()*21));
  131.         RndmNumEmbA = ((int)(Math.random()*21));
  132.         RndmNumEngA = ((int)(Math.random()*21));
  133.         RndmNumBerA = ((int)(Math.random()*21));
  134.        
  135.        
  136.         if (e.getSource() == Rndmize)
  137.        
  138.         if (weaponry.getState())
  139.         {
  140.           WepnText.setText(""+Weaponry[RndmNumWep]);                                            // Makes it so when Weaponry is ticked it'll roll a random number and find it in the array and display it.
  141.         }
  142.        
  143.         if (pet.getState())
  144.         {
  145.           PetText.setText(""+Pet[RndmNumPet]);                                                  // Makes it so when Pet is ticked it'll roll a random number and find it in the array and display it.
  146.         }
  147.        
  148.         if (gender.getState())
  149.         {
  150.           GndrText.setText(""+Gender[RndmNumGndr]);                                                 // Makes it so when Gender is ticked it'll roll a random number and find it in the array and display it.
  151.          }
  152.        
  153.         if (clas.getState())
  154.         {
  155.           ClasText.setText(""+Class[RndmNumClas]);                                              // Makes it so when Class is ticked it'll roll a random number, find it in the array and display it.
  156.          }
  157.        
  158.          if (everything.getState())                                                                 // Randomize everything code                   
  159.         {
  160.             gender.setState(true);
  161.             clas.setState(true);
  162.             pet.setState(true);
  163.             weaponry.setState(true);
  164.             skillsPassive.setState(true);
  165.             skillsActive.setState(true);
  166.  
  167.           ClasText.setText(""+Class[RndmNumClas]);
  168.          
  169.           GndrText.setText(""+Gender[RndmNumGndr]);
  170.          
  171.           PetText.setText(""+Pet[RndmNumPet]);
  172.          
  173.           WepnText.setText(""+Weaponry[RndmNumWep]);                                                                                                         
  174.          
  175.           if (RndmNumClas == 0){
  176.             SkillpasText.setText(""+SkillPasO[RndmNumOut]);
  177.                  }
  178.            if (RndmNumClas == 1){
  179.                 SkillpasText.setText(""+SkillPasEm[RndmNumEmb]);
  180.              }
  181.            if (RndmNumClas == 2){
  182.               SkillpasText.setText(""+SkillPasB[RndmNumBer]);
  183.              }
  184.            if (RndmNumClas == 3){
  185.               SkillpasText.setText(""+SkillPasE[RndmNumEng]);        
  186.                  }
  187.             if (RndmNumClas == 0){
  188.              SkillactText.setText(""+SkillActO[RndmNumOutA]);  
  189.               }
  190.            if (RndmNumClas == 1){
  191.              SkillactText.setText(""+SkillActEm[RndmNumEmbA]);
  192.               }
  193.            if (RndmNumClas == 2){
  194.              SkillactText.setText(""+SkillActB[RndmNumBerA]);
  195.               }
  196.            if (RndmNumClas == 3){
  197.              SkillactText.setText(""+SkillActE[RndmNumEngA]);  
  198.               }
  199.          }
  200.           if (clas.getState() && skillsPassive.getState())                                  // Skills passive randomization
  201.          {
  202.            if (RndmNumClas == 0){
  203.             SkillpasText.setText(""+SkillPasO[RndmNumOut]);
  204.                  }
  205.            if (RndmNumClas == 1){
  206.                 SkillpasText.setText(""+SkillPasEm[RndmNumEmb]);
  207.              }
  208.            if (RndmNumClas == 2){
  209.               SkillpasText.setText(""+SkillPasB[RndmNumBer]);
  210.              }
  211.            if (RndmNumClas == 3){
  212.               SkillpasText.setText(""+SkillPasE[RndmNumEng]);        
  213.                  }
  214.         }
  215.        
  216.           if (clas.getState() && skillsActive.getState())                                           // Skills active radmonzation
  217.         {
  218.           if (RndmNumClas == 0){
  219.              SkillactText.setText(""+SkillActO[RndmNumOutA]);  
  220.               }
  221.           if (RndmNumClas == 1){
  222.              SkillactText.setText(""+SkillActEm[RndmNumEmbA]);
  223.               }
  224.           if (RndmNumClas == 2){
  225.              SkillactText.setText(""+SkillActB[RndmNumBerA]);
  226.               }
  227.           if (RndmNumClas == 3){
  228.              SkillactText.setText(""+SkillActE[RndmNumEngA]);  
  229.               }
  230.         }
  231.        
  232.         if (e.getSource() == Restart)                                                       //Makes everything ticked clear whatever is in the textfield
  233.         {
  234.          
  235.             gender.setState(false);
  236.             clas.setState(false);
  237.             pet.setState(false);
  238.             weaponry.setState(false);
  239.             skillsPassive.setState(false);
  240.             skillsActive.setState(false);
  241.             everything.setState(false);
  242.        
  243.             WepnText.setText("");  
  244.             SkillpasText.setText("");
  245.             SkillactText.setText("");
  246.             GndrText.setText("");  
  247.             PetText.setText("");
  248.              ClasText.setText("");  
  249.         }                                                                                               //end of if
  250.        
  251.        if (e.getSource() == Help)
  252.         {
  253.        
  254.         Container content = getContentPane();
  255.         content.setLayout(new FlowLayout());
  256.        
  257.         CloseImg = new ImageIcon("closer.png");
  258.         //DisposeB = new JButton ("CLOSE");                                                      // Start of next frame
  259.        DisposeB = new JButton (CloseImg);
  260.        DisposeB.setBounds(10, 175, 100, 50);
  261.         //DisposeB.setBounds(150, 400, 150, 50);
  262.         content.add(DisposeB);
  263.        
  264.        HelpF = new Frame();
  265.         HelpF.setSize(750, 275);
  266.         HelpF.setVisible(true);
  267.    
  268.       Label Desc = new Label ("Description:");
  269.         Desc.setBounds(25, 50, 75, 25);
  270.         Desc.setFont(new Font("SansSerif",Font.BOLD, 12));
  271.      
  272.        Label LineOne = new Label("This program will choose the class in Torchlight II; it will also give you the option to randomize the pet, traits, skills");
  273.             LineOne.setBounds(100, 50, 1000, 25);
  274.      
  275.        Label LineTwo = new Label ("and the weaponry you will be given to slay with. You might think why you might need this however");
  276.             LineTwo.setBounds(100, 75, 1000, 25);
  277.      
  278.        Label LineThree = new Label ("playing your obviously favourite game with the completely up-to-fate ideal behind it");
  279.             LineThree.setBounds(100, 100, 1000, 25);
  280.        
  281.        Label LineFour = new Label ("may make you feel  more intertwined with your character and thus making the game more fun.");
  282.             LineFour.setBounds(100, 125, 1000, 25);
  283.        
  284.        Label HowTo = new Label ("How to use:");
  285.             HowTo.setBounds(115, 175, 1000, 20);                                         // x, y, width height
  286.                 HowTo.setFont(new Font("SansSerif",Font.BOLD, 12));
  287.        
  288.         Label LineFive = new Label ("* Tick which catergory you would like randomize");
  289.             LineFive.setBounds(115, 195, 500, 20);   
  290.      
  291.        Label LineSix = new Label ("* Click RANDOMIZE");
  292.         LineSix.setBounds(115, 215, 500, 20);
  293.        
  294.         ConidText = new Label ("* If there is a ** next to the name you have to have 'Class' ticked");
  295.             ConidText.setBounds(115, 235, 500, 20);
  296.      
  297.        HelpF.setLayout(null);
  298.            
  299.             HelpF.add(LineOne);
  300.             HelpF.add(LineTwo);
  301.             HelpF.add(LineThree);
  302.             HelpF.add(LineFour);
  303.             HelpF.add(DisposeB);
  304.             HelpF.add(Desc);
  305.             HelpF.add(HowTo);
  306.             HelpF.add(LineFive);
  307.             HelpF.add(LineSix);
  308.             HelpF.add(ConidText);
  309.            
  310.             DisposeB.addActionListener(this);                               // end of new frame
  311.         }
  312.          if (e.getSource() == DisposeB)
  313.         {
  314.             HelpF.setVisible(false);                                        // disposes of the new frame when CLOSE is clicked.
  315.             HelpF.dispose();   
  316.         }
  317.     }                                                                                                   //end AP
  318. }                                                                                                       //end applet
  319.  
  320. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////|
  321. //////////////////////////////////////////22/09/14///////////By//Joshua//Commane////////////22/09/14////////////////////////////////////////////|
  322. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////|
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement