Thread: PI - Mining issue (right click on rock to mine it again)

Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1 PI - Mining issue (right click on rock to mine it again) 
    Registered Member
    Rock_Gyo's Avatar
    Join Date
    Oct 2009
    Posts
    505
    Thanks given
    27
    Thanks received
    35
    Rep Power
    104
    Alright so I attempt to mine a rock, and also while my character is swinging the pickaxe around trying to mine it, I right click on the rock. Once my character successfully mined the ore, I just finish my right click by attempting to mine the rock again 9while it's empty). My character will then start mining the rock EVEN THOUGH it's empty, and not refilled. Does anyone know a fix for that please?
    Reply With Quote  
     

  2. #2  
    Java Developer

    Celty's Avatar
    Join Date
    Aug 2013
    Age
    27
    Posts
    355
    Thanks given
    94
    Thanks received
    91
    Rep Power
    173
    Are you using an event, if so you need to stop it upon depleting the rock of resource.

    If no post your class so we can see code.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Rock_Gyo's Avatar
    Join Date
    Oct 2009
    Posts
    505
    Thanks given
    27
    Thanks received
    35
    Rep Power
    104
    Is this what you mean?

    Code:
    CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    			@Override
    			public void execute(CycleEventContainer container) {
    
    				c.getItems().addItem(1436, 1);
    				c.sendMessage("You manage to mine some "+ c.getItems().getItemName(1436).toLowerCase()+".");
    				c.getPA().addSkillXP(5 * MINING_XP, c.playerMining);
    				c.startAnimation(getAnimation(c));
    
    				if(!hasPickaxe(c)) {
    					c.sendMessage("You need a Mining pickaxe which you need a Mining level to use.");
    					resetMining(c);
    					container.stop();
    				}
    				if(!c.stopPlayerSkill) {
    					resetMining(c);
    					container.stop();
    				}
    				if(!noInventorySpace(c, "mining")) {
     					resetMining(c);
    					container.stop();
    				}
    
    			}
    			@Override
    			public void stop() {
    
    			}
    		}, 2);
    	}
    Reply With Quote  
     

  4. #4  
    Java Developer

    Celty's Avatar
    Join Date
    Aug 2013
    Age
    27
    Posts
    355
    Thanks given
    94
    Thanks received
    91
    Rep Power
    173
    Code:
    CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    			@Override
    			public void execute(CycleEventContainer container) {
    
    				c.getItems().addItem(1436, 1);
    				c.sendMessage("You manage to mine some "+ c.getItems().getItemName(1436).toLowerCase()+".");
    				c.getPA().addSkillXP(5 * MINING_XP, c.playerMining);
    				c.startAnimation(getAnimation(c));
                                    <--- Stop the event here and see what happens.
    				if(!hasPickaxe(c)) {
    					c.sendMessage("You need a Mining pickaxe which you need a Mining level to use.");
    					resetMining(c);
    					container.stop();
    				}
    				if(!c.stopPlayerSkill) {
    					resetMining(c);
    					container.stop();
    				}
    				if(!noInventorySpace(c, "mining")) {
     					resetMining(c);
    					container.stop();
    				}
    
    			}
    			@Override
    			public void stop() {
    
    			}
    		}, 2);
    	}
    Reply With Quote  
     

  5. #5  
    Registered Member
    Rock_Gyo's Avatar
    Join Date
    Oct 2009
    Posts
    505
    Thanks given
    27
    Thanks received
    35
    Rep Power
    104
    Still occuring =\
    Reply With Quote  
     

  6. #6  
    Java Developer

    Celty's Avatar
    Join Date
    Aug 2013
    Age
    27
    Posts
    355
    Thanks given
    94
    Thanks received
    91
    Rep Power
    173
    Post your full mining class becuase what you posted was for rune ess and that should be a continuous event till you walk away because it has unlimited resources.
    Reply With Quote  
     

  7. #7  
    Registered Member
    Rock_Gyo's Avatar
    Join Date
    Oct 2009
    Posts
    505
    Thanks given
    27
    Thanks received
    35
    Rep Power
    104
    My bad about the rune ess, here's the good one

    Code:
    public static void attemptData(final Client c, final int object, final int obX, final int obY) {
    		if(!noInventorySpace(c, "mining")) {
    			resetMining(c);
    			return;
    		}
    		if(!hasRequiredLevel(c, 14, getLevelReq(c, object), "mining", "mine here")) {
    			return;
    		}
    		if(!hasPickaxe(c)) {
    			c.sendMessage("You need a Mining pickaxe which you need a Mining level to use.");
    			return;
    		}
    		c.sendMessage("You swing your pick at the rock.");
    
    		if(c.playerSkilling[14]) {
    			return;
    		}
    
    		c.playerSkilling[14] = true;
    		c.stopPlayerSkill = true;
    
    		c.startAnimation(getAnimation(c));
    
    		for(int i = 0; i < data.length; i++) {
    			if(object == data[i][0]) {
    
    				c.playerSkillProp[14][0] = data[i][1];
    				c.playerSkillProp[14][1] = data[i][3];
    
    				c.startAnimation(getAnimation(c));
    
    				CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    					@Override
    					public void execute(CycleEventContainer container) {
    
    						if(c.playerSkillProp[14][0] > 0) {
    							c.getItems().addItem(c.playerSkillProp[14][0], 1);
    							c.sendMessage("You manage to mine some "+ c.getItems().getItemName(c.playerSkillProp[14][0]).toLowerCase()+".");
    						}
    						if(c.playerSkillProp[14][1] > 0) {
    							c.getPA().addSkillXP(c.playerSkillProp[14][1] * MINING_XP, c.playerMining);
    							Server.objectHandler.createAnObject(c, 451, obX, obY);
    						}
    						if(!hasPickaxe(c)) {
    							c.sendMessage("You need a Mining pickaxe which you need a Mining level to use.");
    							resetMining(c);
    							container.stop();
    						}
    						if(!c.stopPlayerSkill) {
    							resetMining(c);
    							container.stop();
    						}
    						if(!noInventorySpace(c, "mining")) {
     							resetMining(c);
    							container.stop();
    						}
    						
    						resetMining(c);
    
    						container.stop();
    					}
    					@Override
    					public void stop() {
    
    					}
    				}, getTimer(c, object));
    				CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    					@Override
    					public void execute(CycleEventContainer container) {
    						Server.objectHandler.createAnObject(c, object, obX, obY);
    						container.stop();
    					}
    					@Override
    					public void stop() {
    
    					}
    				}, getTimer(c, object) + getRespawnTime(c, object));
    
    				CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    					@Override
    					public void execute(CycleEventContainer container) {
    						if(c.playerSkilling[14]) {
    							c.startAnimation(getAnimation(c));
    						}
    						if(!c.stopPlayerSkill || !c.playerSkilling[14]) {
    							resetMining(c);
    							container.stop();
    						}
    					}
    					@Override
    					public void stop() {
    
    					}
    				}, 15);
    			}
    		}
    	}
    If it's still not good I will paste the whole mining class
    Reply With Quote  
     

  8. #8  
    Java Developer

    Celty's Avatar
    Join Date
    Aug 2013
    Age
    27
    Posts
    355
    Thanks given
    94
    Thanks received
    91
    Rep Power
    173
    Wow that just a big mess.


    Why are you running 2 events?
    Reply With Quote  
     

  9. #9  
    Registered Member
    Rock_Gyo's Avatar
    Join Date
    Oct 2009
    Posts
    505
    Thanks given
    27
    Thanks received
    35
    Rep Power
    104
    Yeah I know it is, it was like that lol, been trying to fix this right click problem but without luck =\
    Reply With Quote  
     

  10. #10  
    Registered Member
    Rock_Gyo's Avatar
    Join Date
    Oct 2009
    Posts
    505
    Thanks given
    27
    Thanks received
    35
    Rep Power
    104
    bump
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. Replies: 0
    Last Post: 11-04-2011, 10:22 PM
  2. Right clicking on minimap
    By Purple in forum Help
    Replies: 1
    Last Post: 06-15-2011, 08:06 PM
  3. rigth click on object to see the id (317)
    By mr code in forum Requests
    Replies: 3
    Last Post: 02-27-2011, 10:15 PM
  4. [pi] adding new rocks to mine
    By inFamous in forum Help
    Replies: 7
    Last Post: 12-28-2010, 08:56 PM
  5. Click on skill to teleport somewhere?
    By Vault in forum Help
    Replies: 24
    Last Post: 12-17-2009, 12:34 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •