Thread: Working mining base

Page 1 of 5 123 ... LastLast
Results 1 to 10 of 46
  1. #1 Working mining base 
    Legend Rene
    Guest
    Create a new folder called Skills.

    Create a new class called Mining.java in it.

    Put this in the class.

    Code:
    package RS2E.Skills;
    
    import RS2E.Packets.*;
    import RS2E.Players.*; 
    import java.util.Random;
    
    public class Mining
    {
    	Player p;
    	int anim;
    	int speed;
    	int time;
    	int amount;
    	int objid;
    	int rockid;
    	int oreTimer = -1;
    	int secondtimer = 2;
    	int ores = 0;
    	int maxores = 0;
    	boolean hacking = false;
    	public Mining(Player p2)
    	{
    		p = p2;
    	}
    	public void startCutting(int objectid)
    	{
    		if (getPlayerPickaxe() == -1)
    		{
    			p.frame.sendMessage(p,"You don't have a pickaxe wich you have the Mining level to use.");
    			return;
    		}
    		if ((getLevelForPickAxe(getPlayerPickaxe()) < getMiningLevel())== false)
    		{
    			p.frame.sendMessage(p, "You don't have a pickaxe wich you have the Mining level to use.");
    			return;
    		}
    
    		objid = objectid;
    		rockid = getRockIDForObject(objid);
    		if (getLevelForOre(rockid) > getMiningLevel())
    		{
    			p.frame.sendMessage(p, "You need level " + getLevelForOre(rockid)+" to take this ore");
    			return;
    		}
    		p.frame.sendMessage(p, "You swing your pickaxe at the rock.");
    		maxores = getMaxAmountOfOre(rockid);
    		if (maxores == 0) maxores = 1;
    		//p.frame.sendMessage(p, "You will get " + maxores + " ores from this ore");
    		setAnimAndSpeed(rockid, getPlayerPickaxe(), getMiningLevel());
    		oreTimer = time;
    		p.requestAnim(anim,0);
    		hacking = true;
    	}
    	public void process()
    	{
    		if (hacking)
    		{
    			secondtimer--;
    			if (secondtimer == 0)
    			{
    				secondtimer = 2;
    				oreTimer--;
    				p.requestAnim(anim, 0);
    			}
    			if (oreTimer == 0)
    			{
    				oreTimer = time;
    				ores++;
    				doOre();
    			}
    		}
    	}
    	public void resetMining()
    	{
    		oreTimer = -1;
    		hacking = false;
    	}
    	public void doOre()
    	{
    		p.frame.sendMessage(p, "You get some ore.");
    		giveItem(getOreForRock(rockid));
    		giveMiningXP(getXpForOre(rockid));
    		p.requestAnim(anim,0);
    	}
    	public int getMiningLevel()
    	{
    		return p.skillLvl[14];
    	}
    	public void giveMiningXP(int xp)
    	{
    		p.skillXP[14] = p.skillXP[14] + xp;
            p.frame.sendSkillLvl(p, 14);
    	}
    	public boolean hasItem(int id)
    	{
    		PlayerItems pi = new PlayerItems();
    		return pi.invItemCount(p, id) > 0;
    	}
    	public void giveItem(int id)
    	{
    		PlayerItems pi = new PlayerItems();
    		pi.addItem(p, id,1);
    	}
    	public int getPlayerPickaxe()
    	{
    		if (hasItem(1265)) return 1265;
    		if (hasItem(1267)) return 1267;
    		if (hasItem(1269)) return 1269;
    		if (hasItem(1271)) return 1271;
    		if (hasItem(1273)) return 1273;
    		if (hasItem(1275)) return 1275;
    		if (p.equipment[3] == 1265) return 1265;
    		if (p.equipment[3] == 1267) return 1267;
    		if (p.equipment[3] == 1269) return 1269;
    		if (p.equipment[3] == 1271) return 1271;
    		if (p.equipment[3] == 1273) return 1273;
    		if (p.equipment[3] == 1275) return 1275;
    		return -1;		
    	}
    	public int getRockIDForObject(int ore)
    	{
    		switch (ore)
    		{
    				case 2110:
    				case 2090:
    				case 2091://Copper
    					return 1;
    				case 2094:
    				case 2095://Tin
    					return 2;
    				case 2092:
    				case 2093:// Iron
    					return 3;
    				case 2100:
    				case 2101://Silver
    					return 4;
    				case 2098:
    				case 2099://Gold
    					return 5;
    				case 2096:
    				case 2097://Coal
    					return 6;
    				case 2102:
    				case 2103://Mithril
    					return 7;
    				case 2104:
    				case 2105://Adamantite
    					return 8;
    				case 2106:
    				case 2107://Rune
    					return 9;
    				case 4028:
    				case 4029: 
    				case 4030://Limestone
    					return 10;
    				case 6669:
    				case 6670: 
    				case 6671://Elemental 
    					return 11;
    				
    		}
    		return -1;
    	}
    	public int getOreForRock(int Ore)
    	{
    		switch (Ore)
    		{
    			case 1://Copper
    				return 436;
    				
    			case 2://Tin
    				return 438;
    				
    			case 3://Iron
    				return 440;
    				
    			case 4://Silver
    				return 442;
    				
    			case 5://Coal
    				return 453;
    				
    			case 6://Gold
    				return 444;
    				
    			case 7://Mithril
    				return 447;
    				
    			case 8://Adamantite
    				return 449;
    				
    			case 9://Runite
    				return 451;
    			
    			case 10://Limestone
    				return 3211;
    			
    			case 11://Elemental
    				return 2892;
    				
    		}
    		return -1;
    	}
    	public int getMaxAmountOfOre(int Ore)
    	{
    		switch (Ore)
    		{
    			case 1://Copper
    				return 1;
    				
    			case 2://Tin
    				return 1;
    				
    			case 3://Iron
    				return 1;
    				
    			case 4://Silver
    				return 1;
    				
    			case 5://Coal
    				return 1;
    				
    			case 6://Gold
    				return 1;
    				
    			case 7://Mithril
    				return 1;
    				
    			case 8://Adamantite
    				return 1;
    				
    			case 9://Runite
    				return 1;
    			
    			case 10://Limestone
    				return 1;
    			
    			case 11://Elemental
    				return 1;
    				
    		}
    		return -1;
    	}
    	public int getXpForOre(int Ore)
    	{
    		switch (Ore)
    		{
    			case 1://Copper
    				return 10;
    				
    			case 2://Tin
    				return 10;
    				
    			case 3://Iron
    				return 35;
    				
    			case 4://Silver
    				return 42;
    				
    			case 5://Coal
    				return 50;
    				
    			case 6://Gold
    				return 60;
    				
    			case 7://Mithril
    				return 90;
    				
    			case 8://Adamantite
    				return 120;
    				
    			case 9://Runite
    				return 200;
    				
    			case 10://Limestone
    				return 5;
    			
    			case 11://Elemental
    				return 20;
    				
    		}
    		return -1;
    	}
    	public int getLevelForOre(int Ore)
    	{
    		switch (Ore)
    		{
    			case 1://Copper
    				return 0;
    				
    			case 2://Tin
    				return 0;
    				
    			case 3://Iron
    				return 15;
    				
    			case 4://Silver
    				return 20;
    				
    			case 5://Coal
    				return 30;
    				
    			case 6://Gold
    				return 40;
    				
    			case 7://Mithril
    				return 55;
    				
    			case 8://Adamantite
    				return 70;
    				
    			case 9://Runite
    				return 80;
    			
    			case 10://Limestone
    				return 1;
    			
    			case 11://Elemental
    				return 10;
    				
    		}
    		return -1;
    	}
    	public int getLevelForPickAxe(int axe)
    	{
    		switch (axe)
    		{
    			case 1265://Bronze Pickaxe
    				return 0;
    				
    			case 1267://Iron Pickaxe
    				return 0;
    				
    			case 1269://Steel Pickaxe
    				return 5;
    				
    			case 1271://Mithril Pickaxe
    				return 21;
    				
    			case 1273://Adamant Pickaxe
    				return 31;
    				
    			case 1275://Rune Pickaxe
    				return 41;
    				
    		}
    		return -1;
    	}
    	public void setAnimAndSpeed(int ore,int axe,int level)
    	{
    		switch(axe)
    		{
    			case 1265://Bronze Pickaxe
    				anim = 625;
    				speed = 1;
    				break;
    			case 1267://Iron Pickaxe
    				anim = 626;
    				speed = 2;
    				break;
    			case 1269://Steel Pickaxe
    				anim = 627;
    				speed = 5;
    				break;
    			case 1271://Mithril Pickaxe
    				anim = 629;
    				speed = 13;
    				break;
    			case 1273://Adamant Pickaxe
    				anim = 628;
    				speed = 20;
    				break;
    			case 1275://Rune Pickaxe
    				anim = 624;
    				speed = 30;
    				break;
    			}
    		speed = (speed - (speed * 2)) / 10;
    		time = ( ( level / getLevelForOre(ore) )) - speed;
    		if (time < 0) time = 1;
    		if (time == 1) anim++;
    	}
    }
    Save it, now go to your firstObject class. (if you don't have one forget about this whole thread.)

    Add this in it.

    Code:
    				case 2110:
    				case 2090:
    				case 2091:/* Copper */
    				case 2094:
    				case 2095:/* Tin */
    				case 2092:
    				case 2093:/* Iron */
    				case 2100:
    				case 2101:/* Silver */
    				case 2098:
    				case 2099:/* Gold */
    				case 2096:
    				case 2097:/* Coal */
    				case 2102:
    				case 2103:/* Mithril */
    				case 2104:
    				case 2105:/* Adamantite */
    				case 2106:
    				case 2107:/* Rune */
    				case 4028:
    				case 4029: 
    				case 4030:/* Limestone( */
    				case 6669:
    				case 6670: 
    				case 6671:/* Elemental */
    					p.mi = new Mining(p);
    					p.mi.startCutting(objectId);
    				break;
    Now go to your Player class.

    And add this :
    Code:
    public Mining mi;
    and this elsewhere in that class
    Code:
    mi.process();
    Now you're done I guess, don't post your errors here, don't ask questions, and most of all, don't cry.

    Credit goes to that guy who made that woodcutting stuff, I just converted to Mining.
    Reply With Quote  
     

  2. #2  
    Registered Member jigar's Avatar
    Join Date
    Aug 2008
    Posts
    723
    Thanks given
    0
    Thanks received
    6
    Rep Power
    15
    hey how comes when i make a new .java file the .class file of it doesnt show?
    Reply With Quote  
     

  3. #3  
    Registered Member badboy ownz's Avatar
    Join Date
    Mar 2008
    Posts
    327
    Thanks given
    3
    Thanks received
    0
    Rep Power
    4
    hey can u please realse ur firstobject or anyone tell me how to add firstobject.java please

    EDIT: ALREADY GOT IT LOL ITS JUST A DIFFERENT NAME
    Retired rune-server member.
    Reply With Quote  
     

  4. #4  
    Legend Rene
    Guest
    That goes in my siggy.

    And a class file is the result of the compiler compiling a java file.

    Badboy, if you don't have it, forget 'bout this.
    Reply With Quote  
     

  5. #5  
    Registered Member jigar's Avatar
    Join Date
    Aug 2008
    Posts
    723
    Thanks given
    0
    Thanks received
    6
    Rep Power
    15
    oh and is this for rs2e v2?
    Reply With Quote  
     

  6. #6  
    Registered Member badboy ownz's Avatar
    Join Date
    Mar 2008
    Posts
    327
    Thanks given
    3
    Thanks received
    0
    Rep Power
    4
    where do i add thease

    Code:
    public Mining mi;
    mi.process();
    HELP WITH THIS
    Code:
    ------------ Compiling players ------------
    .\RS2E\Players\Player.java:429: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Players.Player
    public Mining mi;
           ^
    .\RS2E\Packets\ObjectClick1.java:67: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Packets.ObjectClick1
                                            p.mi = new Mining(p);
                                                       ^
    .\RS2E\Packets\ObjectClick1.java:68: cannot find symbol
    symbol  : variable objectId
    location: class RS2E.Packets.ObjectClick1
                                            p.mi.startCutting(objectId);
                                                              ^
    3 errors
    ------------ Compiling packets ------------
    .\RS2E\Players\Player.java:429: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Players.Player
    public Mining mi;
           ^
    .\RS2E\Packets\ObjectClick1.java:67: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Packets.ObjectClick1
                                            p.mi = new Mining(p);
                                                       ^
    .\RS2E\Packets\ObjectClick1.java:68: cannot find symbol
    symbol  : variable objectId
    location: class RS2E.Packets.ObjectClick1
                                            p.mi.startCutting(objectId);
                                                              ^
    3 errors
    ------------ Compiling util ------------
    ------------ Compiling world ------------
    .\RS2E\Players\Player.java:429: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Players.Player
    public Mining mi;
           ^
    .\RS2E\Packets\ObjectClick1.java:67: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Packets.ObjectClick1
                                            p.mi = new Mining(p);
                                                       ^
    .\RS2E\Packets\ObjectClick1.java:68: cannot find symbol
    symbol  : variable objectId
    location: class RS2E.Packets.ObjectClick1
                                            p.mi.startCutting(objectId);
                                                              ^
    3 errors
    ------------ Compiling EquipReq Package ------------
    .\RS2E\Players\Player.java:429: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Players.Player
    public Mining mi;
           ^
    .\RS2E\Packets\ObjectClick1.java:67: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Packets.ObjectClick1
                                            p.mi = new Mining(p);
                                                       ^
    .\RS2E\Packets\ObjectClick1.java:68: cannot find symbol
    symbol  : variable objectId
    location: class RS2E.Packets.ObjectClick1
                                            p.mi.startCutting(objectId);
                                                              ^
    3 errors
    ------------ Compiling main ------------
    .\RS2E\Players\Player.java:429: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Players.Player
    public Mining mi;
           ^
    .\RS2E\Packets\ObjectClick1.java:67: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Packets.ObjectClick1
                                            p.mi = new Mining(p);
                                                       ^
    .\RS2E\Packets\ObjectClick1.java:68: cannot find symbol
    symbol  : variable objectId
    location: class RS2E.Packets.ObjectClick1
                                            p.mi.startCutting(objectId);
                                                              ^
    3 errors
    ------------ Compile complete ------------
    Press any key to continue . . .
    Retired rune-server member.
    Reply With Quote  
     

  7. #7  
    Legend Rene
    Guest
    Now you're done I guess, don't post your errors here, don't ask questions, and most of all, don't cry.
    K understood?
    Reply With Quote  
     

  8. #8  
    Registered Member jigar's Avatar
    Join Date
    Aug 2008
    Posts
    723
    Thanks given
    0
    Thanks received
    6
    Rep Power
    15
    Well.....we wouldnt have to ask questions if u put it 100% easy step by step towards where bouts things go.

    Quote Originally Posted by badboy ownz View Post
    where do i add thease

    Code:
    public Mining mi;
    mi.process();
    HELP WITH THIS
    Code:
    ------------ Compiling players ------------
    .\RS2E\Players\Player.java:429: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Players.Player
    public Mining mi;
           ^
    .\RS2E\Packets\ObjectClick1.java:67: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Packets.ObjectClick1
                                            p.mi = new Mining(p);
                                                       ^
    .\RS2E\Packets\ObjectClick1.java:68: cannot find symbol
    symbol  : variable objectId
    location: class RS2E.Packets.ObjectClick1
                                            p.mi.startCutting(objectId);
                                                              ^
    3 errors
    ------------ Compiling packets ------------
    .\RS2E\Players\Player.java:429: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Players.Player
    public Mining mi;
           ^
    .\RS2E\Packets\ObjectClick1.java:67: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Packets.ObjectClick1
                                            p.mi = new Mining(p);
                                                       ^
    .\RS2E\Packets\ObjectClick1.java:68: cannot find symbol
    symbol  : variable objectId
    location: class RS2E.Packets.ObjectClick1
                                            p.mi.startCutting(objectId);
                                                              ^
    3 errors
    ------------ Compiling util ------------
    ------------ Compiling world ------------
    .\RS2E\Players\Player.java:429: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Players.Player
    public Mining mi;
           ^
    .\RS2E\Packets\ObjectClick1.java:67: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Packets.ObjectClick1
                                            p.mi = new Mining(p);
                                                       ^
    .\RS2E\Packets\ObjectClick1.java:68: cannot find symbol
    symbol  : variable objectId
    location: class RS2E.Packets.ObjectClick1
                                            p.mi.startCutting(objectId);
                                                              ^
    3 errors
    ------------ Compiling EquipReq Package ------------
    .\RS2E\Players\Player.java:429: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Players.Player
    public Mining mi;
           ^
    .\RS2E\Packets\ObjectClick1.java:67: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Packets.ObjectClick1
                                            p.mi = new Mining(p);
                                                       ^
    .\RS2E\Packets\ObjectClick1.java:68: cannot find symbol
    symbol  : variable objectId
    location: class RS2E.Packets.ObjectClick1
                                            p.mi.startCutting(objectId);
                                                              ^
    3 errors
    ------------ Compiling main ------------
    .\RS2E\Players\Player.java:429: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Players.Player
    public Mining mi;
           ^
    .\RS2E\Packets\ObjectClick1.java:67: cannot find symbol
    symbol  : class Mining
    location: class RS2E.Packets.ObjectClick1
                                            p.mi = new Mining(p);
                                                       ^
    .\RS2E\Packets\ObjectClick1.java:68: cannot find symbol
    symbol  : variable objectId
    location: class RS2E.Packets.ObjectClick1
                                            p.mi.startCutting(objectId);
                                                              ^
    3 errors
    ------------ Compile complete ------------
    Press any key to continue . . .
    " got the same error....
    Last edited by jigar; 08-12-2008 at 02:56 PM. Reason: Double posting is not allowed!
    Reply With Quote  
     

  9. #9  
    Registered Member badboy ownz's Avatar
    Join Date
    Mar 2008
    Posts
    327
    Thanks given
    3
    Thanks received
    0
    Rep Power
    4
    oh dont worry ill convert it for us yh it will take me 3 mins
    Retired rune-server member.
    Reply With Quote  
     

  10. #10  
    Registered Member jigar's Avatar
    Join Date
    Aug 2008
    Posts
    723
    Thanks given
    0
    Thanks received
    6
    Rep Power
    15
    TY TY TY VM.
    If you can cna u convert the wcing one pwease as well?
    Reply With Quote  
     

Page 1 of 5 123 ... LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •