Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.applet.*;
- import java.util.*;
- import javax.swing.*;
- import java.applet.Applet;
- import java.awt.event.*;
- import java.io.*;
- public class Torchlight extends /*Applet*/JApplet implements ActionListener {
- Label ConidText;
- TextField SkillpasText, SkillactText, GndrText, WepnText, PetText, ClasText; // All the Textfields next to the Checkboxes
- Checkbox skillsPassive, skillsActive, gender, weaponry, pet, clas, everything; // Checkboxes
- //Image torchlightLogo;
- ImageIcon RndmImg, ClearImg, HelpImg, torchlightLogo, CloseImg; // The logo
- //Button Rndmize, Restart, Help, DisposeB;
- JButton Rndmize, Restart, Help, DisposeB, TestBtn;
- Frame HelpF; //the frame when you click "Click here for help"
- int RndmNumWep, RndmNumPet, RndmNumGndr, RndmNumAct, RndmNumPas, RndmNumClas, RndmNumAll, RndmNumOut, RndmNumEng, RndmNumEmb, RndmNumBer,RndmNumOutA, RndmNumEngA, RndmNumEmbA, RndmNumBerA; // integers, the random numbers
- String Weaponry[] = {"Cannon","Pistol","Crossbow","Bow","Shotgonne","Axes","Fist Weapons","Maces","Polearm","Sword","Wand","Staff"}; //All the Weapons to randomize
- String Pet[] = {"Wolf","Cat","Bulldog","Panther","Papillion","Ferret","Chakawary","Hawk","Owl","Badger","Panda","Headcrab","Alpaca"}; //all the pets to randomize
- String Gender[] = {"ok","Female","Male"}; //Gender(s) to randmize
- String Class[] = {"Outlander","Embermage","Berserker","Engineer"}; //classes to ranomize
- 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
- String SkillPasB[] = {"Blood Hunger","Executioner","Rampage","Cold Steel Mastery","Shatter Storm","Rage Retaliation","Frenzy Mastery","Shred Amour","Red Wolf"}; //Passive Skills for Berserker
- String SkillPasEm[] = {"Charge Mastery","Elemental Attunement","Fire Brand","Staff Mastery","Frozen Fate","Ice Brand","Prismatic Rift","Wand Chaos","Lightning Brand"}; //Passive Skills for Embermage
- 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
- 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
- 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
- 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
- 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
- public void init() {
- Container content = getContentPane(); // gooey strt [GUI]
- content.setLayout(new FlowLayout());
- RndmImg = new ImageIcon("RndmImg.png");
- Rndmize = new JButton ("RANDOMIZE");
- Rndmize = new JButton (RndmImg);
- Rndmize.setBounds(150, 400, 150, 50);
- content.add(Rndmize);
- ClearImg = new ImageIcon("vague.png");
- Restart = new JButton ("Clear All");
- Restart = new JButton (ClearImg);
- Restart.setBounds(340, 275, 150, 50);
- content.add(Restart);
- HelpImg = new ImageIcon ("coolmeme.png");
- Help = new JButton ("Click Here for Help!");
- Help = new JButton (HelpImg);
- Help.setBounds(340, 200, 150, 50);
- content.add(Help);
- SkillpasText = new TextField(10);
- SkillpasText.setBounds(130, 200, 200, 20);
- SkillactText = new TextField(10);
- SkillactText.setBounds(130, 225, 200, 20);
- GndrText = new TextField(10);
- GndrText.setBounds(130, 250, 200, 20);
- WepnText = new TextField(10);
- WepnText.setBounds(130, 275, 200, 20);
- PetText = new TextField(10);
- PetText.setBounds(130, 300, 200, 20);
- ClasText = new TextField(10);
- ClasText.setBounds(130, 325, 200, 20);
- add (Rndmize);
- add (Restart);
- add (SkillpasText);
- add (SkillactText);
- add (GndrText);
- add (WepnText);
- add (PetText);
- add (ClasText);
- add (Help);
- torchlightLogo = new ImageIcon("Torchlight-2-1.png");
- //torchlightLogo = getImage(getDocumentBase(),"torchlight_2_logo.png");
- setLayout(null);
- skillsPassive = new Checkbox("Skills (Passive) **", null, false);
- skillsPassive.setBounds(15, 200, 150, 25);
- add (skillsPassive);
- skillsActive = new Checkbox("Skills (Active) **", null, false);
- skillsActive.setBounds(15, 225, 150, 25);
- add (skillsActive);
- gender = new Checkbox("Gender", null, false);
- gender.setBounds(15, 250, 150, 25);
- add (gender);
- weaponry = new Checkbox("Weaponry", null, false);
- weaponry.setBounds(15, 275, 150, 25);
- add (weaponry);
- pet = new Checkbox("Pet", null, false);
- pet.setBounds(15, 300, 150, 25);
- add (pet);
- clas = new Checkbox("Class", null, false);
- clas.setBounds(15, 325, 150, 25);
- add (clas);
- everything = new Checkbox("Randomize Everything", null, false);
- add(everything);
- everything.setBounds(15, 350, 150,25);
- Rndmize.addActionListener(this);
- Restart.addActionListener(this);
- Help.addActionListener(this);
- repaint(); // gooey ed [GUI]
- }
- public void paint(Graphics g){
- super.paint(g);
- torchlightLogo.paintIcon(this, g, 0, 0); //Adds the logo at the top
- //setBackground(Color.white);
- //int width = torchlightLogo.getWidth(this);
- //int height = torchlightLogo.getHeight(this);
- //g.drawImage(torchlightLogo, 32, 5, width/3, height/3, this);
- }
- public void actionPerformed(ActionEvent e)
- {
- RndmNumWep = ((int)(Math.random()*10)+1); //rolls a random number between 1 - 10 and assigns it to RndmNum(x)
- RndmNumPet = ((int)(Math.random()*12)+1); //" " 1 - 12
- RndmNumGndr = ((int)(Math.random()*2)+1); //" " 1 - 2
- RndmNumClas = ((int)(Math.random()*4)); //" " 0 - 3
- RndmNumOut = ((int)(Math.random()*9));
- RndmNumEmb = ((int)(Math.random()*9));
- RndmNumEng = ((int)(Math.random()*9));
- RndmNumBer = ((int)(Math.random()*9));
- RndmNumOutA = ((int)(Math.random()*21));
- RndmNumEmbA = ((int)(Math.random()*21));
- RndmNumEngA = ((int)(Math.random()*21));
- RndmNumBerA = ((int)(Math.random()*21));
- if (e.getSource() == Rndmize)
- if (weaponry.getState())
- {
- 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.
- }
- if (pet.getState())
- {
- 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.
- }
- if (gender.getState())
- {
- 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.
- }
- if (clas.getState())
- {
- 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.
- }
- if (everything.getState()) // Randomize everything code
- {
- gender.setState(true);
- clas.setState(true);
- pet.setState(true);
- weaponry.setState(true);
- skillsPassive.setState(true);
- skillsActive.setState(true);
- ClasText.setText(""+Class[RndmNumClas]);
- GndrText.setText(""+Gender[RndmNumGndr]);
- PetText.setText(""+Pet[RndmNumPet]);
- WepnText.setText(""+Weaponry[RndmNumWep]);
- if (RndmNumClas == 0){
- SkillpasText.setText(""+SkillPasO[RndmNumOut]);
- }
- if (RndmNumClas == 1){
- SkillpasText.setText(""+SkillPasEm[RndmNumEmb]);
- }
- if (RndmNumClas == 2){
- SkillpasText.setText(""+SkillPasB[RndmNumBer]);
- }
- if (RndmNumClas == 3){
- SkillpasText.setText(""+SkillPasE[RndmNumEng]);
- }
- if (RndmNumClas == 0){
- SkillactText.setText(""+SkillActO[RndmNumOutA]);
- }
- if (RndmNumClas == 1){
- SkillactText.setText(""+SkillActEm[RndmNumEmbA]);
- }
- if (RndmNumClas == 2){
- SkillactText.setText(""+SkillActB[RndmNumBerA]);
- }
- if (RndmNumClas == 3){
- SkillactText.setText(""+SkillActE[RndmNumEngA]);
- }
- }
- if (clas.getState() && skillsPassive.getState()) // Skills passive randomization
- {
- if (RndmNumClas == 0){
- SkillpasText.setText(""+SkillPasO[RndmNumOut]);
- }
- if (RndmNumClas == 1){
- SkillpasText.setText(""+SkillPasEm[RndmNumEmb]);
- }
- if (RndmNumClas == 2){
- SkillpasText.setText(""+SkillPasB[RndmNumBer]);
- }
- if (RndmNumClas == 3){
- SkillpasText.setText(""+SkillPasE[RndmNumEng]);
- }
- }
- if (clas.getState() && skillsActive.getState()) // Skills active radmonzation
- {
- if (RndmNumClas == 0){
- SkillactText.setText(""+SkillActO[RndmNumOutA]);
- }
- if (RndmNumClas == 1){
- SkillactText.setText(""+SkillActEm[RndmNumEmbA]);
- }
- if (RndmNumClas == 2){
- SkillactText.setText(""+SkillActB[RndmNumBerA]);
- }
- if (RndmNumClas == 3){
- SkillactText.setText(""+SkillActE[RndmNumEngA]);
- }
- }
- if (e.getSource() == Restart) //Makes everything ticked clear whatever is in the textfield
- {
- gender.setState(false);
- clas.setState(false);
- pet.setState(false);
- weaponry.setState(false);
- skillsPassive.setState(false);
- skillsActive.setState(false);
- everything.setState(false);
- WepnText.setText("");
- SkillpasText.setText("");
- SkillactText.setText("");
- GndrText.setText("");
- PetText.setText("");
- ClasText.setText("");
- } //end of if
- if (e.getSource() == Help)
- {
- Container content = getContentPane();
- content.setLayout(new FlowLayout());
- CloseImg = new ImageIcon("closer.png");
- //DisposeB = new JButton ("CLOSE"); // Start of next frame
- DisposeB = new JButton (CloseImg);
- DisposeB.setBounds(10, 175, 100, 50);
- //DisposeB.setBounds(150, 400, 150, 50);
- content.add(DisposeB);
- HelpF = new Frame();
- HelpF.setSize(750, 275);
- HelpF.setVisible(true);
- Label Desc = new Label ("Description:");
- Desc.setBounds(25, 50, 75, 25);
- Desc.setFont(new Font("SansSerif",Font.BOLD, 12));
- 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");
- LineOne.setBounds(100, 50, 1000, 25);
- Label LineTwo = new Label ("and the weaponry you will be given to slay with. You might think why you might need this however");
- LineTwo.setBounds(100, 75, 1000, 25);
- Label LineThree = new Label ("playing your obviously favourite game with the completely up-to-fate ideal behind it");
- LineThree.setBounds(100, 100, 1000, 25);
- Label LineFour = new Label ("may make you feel more intertwined with your character and thus making the game more fun.");
- LineFour.setBounds(100, 125, 1000, 25);
- Label HowTo = new Label ("How to use:");
- HowTo.setBounds(115, 175, 1000, 20); // x, y, width height
- HowTo.setFont(new Font("SansSerif",Font.BOLD, 12));
- Label LineFive = new Label ("* Tick which catergory you would like randomize");
- LineFive.setBounds(115, 195, 500, 20);
- Label LineSix = new Label ("* Click RANDOMIZE");
- LineSix.setBounds(115, 215, 500, 20);
- ConidText = new Label ("* If there is a ** next to the name you have to have 'Class' ticked");
- ConidText.setBounds(115, 235, 500, 20);
- HelpF.setLayout(null);
- HelpF.add(LineOne);
- HelpF.add(LineTwo);
- HelpF.add(LineThree);
- HelpF.add(LineFour);
- HelpF.add(DisposeB);
- HelpF.add(Desc);
- HelpF.add(HowTo);
- HelpF.add(LineFive);
- HelpF.add(LineSix);
- HelpF.add(ConidText);
- DisposeB.addActionListener(this); // end of new frame
- }
- if (e.getSource() == DisposeB)
- {
- HelpF.setVisible(false); // disposes of the new frame when CLOSE is clicked.
- HelpF.dispose();
- }
- } //end AP
- } //end applet
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////|
- //////////////////////////////////////////22/09/14///////////By//Joshua//Commane////////////22/09/14////////////////////////////////////////////|
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////|
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement