Thread: Trollheim Expansion

Results 1 to 1 of 1
  1. #1 Trollheim Expansion 
    Registered Member PhaseGFX's Avatar
    Join Date
    Oct 2012
    Age
    24
    Posts
    155
    Thanks given
    19
    Thanks received
    40
    Rep Power
    51
    R-S Mod Response  Trollheim Expansion

    Since i'm not developing anymore and doing some clean-ups, thought i'd release some. I know it's far from perfect, but does the job.

    Supports pretty much all trollheim's agility shortcuts + correct anims and delay, also includes some objects interactions and cave entrances.





    Trollheim.java

    Code:
    package com.rs.game.player.content.agility;
    
    import com.rs.cores.CoresManager;
    import com.rs.game.*;
    import com.rs.game.Hit.HitLook;
    import com.rs.game.player.Player;
    import com.rs.game.player.Skills;
    import com.rs.game.player.content.FadingScreen;
    import com.rs.game.tasks.WorldTask;
    import com.rs.game.tasks.WorldTasksManager;
    import com.rs.net.decoders.handlers.ObjectHandler;
    import com.rs.utils.Logger;
    import com.rs.utils.Utils;
    
    public class Trollheim {
    	
    	 /** Trollheim @author PhaseGFX
         **/
    	static int CLIMB = 3378;
    	static int CLIMB_DOWN = 3382;
    	static int FALL = 1106;
    	
    	public void fade (final Player player) {
    		final long time = FadingScreen.fade(player);
    		CoresManager.slowExecutor.execute(new Runnable() {
    			@Override
    			public void run() {
    				try {
    					FadingScreen.unfade(player, time/2, new Runnable() {
    						@Override
    						public void run() {
    				}
    					});
    			} catch (Throwable e) {
    				Logger.handle(e);
    			}
    			}
    		
    	});
    	}
    
    
        public static void ClimbLadderOutsideDown(final Player player,
                WorldObject object) {
        player.lock(2);
        player.setNextAnimation(new Animation(827));
        player.setNextWorldTile(new WorldTile(2569, 9525, player.getPlane()));
        WorldTasksManager.schedule(new WorldTask() {
            @Override
            public void run() {
                player.getPackets().sendGameMessage(
                        "You climb down to the Dungeon...");
                stop();
            }
        }, 1);
    }
        
    
        
        public static void Cliffsides(final Player player, WorldObject object) {
        	  if (player.getSkills().getLevel(Skills.AGILITY) < 47) {
             	  player.getDialogueManager().startDialogue("SimpleMessage", "You need a Agility level of 47 to use this Shortcut.");
      		     	return;
        	  }
          player.faceObject(object);
          player.lock(5);
            int x = player.getX() == 2897 ? 2893 : 2897;
                 final WorldTile toTile = new WorldTile(x, 3673, 0);
                    int x2 = player.getX() == 2879 ? 2875 : 2879;
                       final WorldTile toTile2 = new WorldTile(x2, 3673, 0); 
                          int y3 = player.getY() == 3663 ? 3659 : 3663;
                             final WorldTile toTile3 = new WorldTile(2875, y3, 0);
                               int x4 = player.getX() == 2908 ? 2912 : 2908;
                                  final WorldTile toTile4 = new WorldTile(x4, 3686, 0);
                                    int x5 = player.getX() == 2858 ? 2854 : 2858;
                                       final WorldTile toTile5 = new WorldTile(x5, 3664, 0);
                                         int x6 = player.getX() == 2934 ? 2930 : 2934;
                                            final WorldTile toTile6 = new WorldTile(x6, 3681, 0);
                                              int x7 = player.getX() == 2950 ? 2954 : 2950;
                                                final WorldTile toTile7 = new WorldTile(x7, 3682, 0);
                                                   int y8 = player.getY() == 3622 ? 3618 : 3622;
                                                    final WorldTile toTile8 = new WorldTile(2878, y8, 0);
                                                      int y9 = player.getY() == 3594 ? 3598 : 3594;
                                                        final WorldTile toTile9 = new WorldTile(2876, y9, 0);
                                            
      		           if (player.getX() == 2893 || (player.getX() == 2879 && player.getY() == 3673) || (player.getY() == 3663)
      		        		 || (player.getX() == 2908) || (player.getX() == 2858) 
      		        		 || (player.getX() == 2934) || (player.getX() == 2950) || (player.getY() == 3622) || (player.getY() == 3598)) {
      		        	
                          player.setNextAnimation(new Animation(CLIMB_DOWN));
                          WorldTasksManager.schedule(new WorldTask() {
                              @Override
                              public void run() {
                            	  if (player.getX() == 2893) 
                          		    player.setNextWorldTile(toTile);
                          		     if (player.getX() == 2879) {
                          			   player.setNextWorldTile(toTile2);
                          		          } if (player.getY() == 3663) {
                          			    	 player.setNextWorldTile(toTile3);
                          		               } if (player.getX() == 2908) {
                         			    	      player.setNextWorldTile(toTile4);
                          		                    } if (player.getX() == 2858) {
                        			    	           player.setNextWorldTile(toTile5);
                          		                        } if (player.getX() == 2934) {
                       			    	                  player.setNextWorldTile(toTile6);
                          		                          } if (player.getX() == 2950) {
                       			    	                    player.setNextWorldTile(toTile7);  
                       			    	                     } if (player.getY() == 3622) {
                           			    	                    player.setNextWorldTile(toTile8);  
                           			    	                    }  if (player.getY() == 3598) {
                               			    	                    player.setNextWorldTile(toTile9);  
                               			    	                    }
                          	                     stop();
                          				       player.setNextAnimation(new Animation(-1));
                          				       player.setForceNextMapLoadRefresh(true);
                                              }
                                       }, 5);
                          return;
                          
      		             }  else if (Utils.random(5) < 1) {
                         player.setNextAnimation(new Animation(FALL));
                         WorldTasksManager.schedule(new WorldTask() {
                             @Override
                             public void run() {
                                 player.sm("You attempted to climb the cliff, but took a loose rock and fell down!");
                                 if (player.getHitpoints() < 50) {
                                	 return;
                                 } else
                                 player.applyHit(new Hit(player, Utils.random(25),
                                         HitLook.REGULAR_DAMAGE));
                         	   stop();
                             }
                         }, 1,5);
                         return;
              	   } 
                          player.faceObject(object);
                          player.lock(5);
                          player.setNextAnimation(new Animation(CLIMB));
                          WorldTasksManager.schedule(new WorldTask() {
                              @Override
                              public void run() {
                             	if (player.getX() == 2897) 
                          		 player.setNextWorldTile(toTile);
                                   if (object.getX() == 2876) {
                                	   player.setNextWorldTile(toTile2);
                                          } if (player.getY() == 3659) {
                                	    	  player.setNextWorldTile(toTile3);
                                                } if (player.getX() == 2912) {
                                	    	       player.setNextWorldTile(toTile4);
                                                     } if (player.getX() == 2854) {
                                 	    	           player.setNextWorldTile(toTile5);	     
                                                         } if (player.getX() == 2930) {
                                   	    	              player.setNextWorldTile(toTile6);	
                                                           } if (player.getX() == 2954) {
                          			    	                  player.setNextWorldTile(toTile7);
                                                              } if (object.getY() == 3619) {
                           			    	                    player.setNextWorldTile(toTile8);
                                                                } if (player.getY() == 3594) {
                              			    	                  player.setNextWorldTile(toTile9);
                                                }
                  				         stop();
                  				       player.setNextAnimation(new Animation(-1));
                  				       player.setForceNextMapLoadRefresh(true);
                                       }
                              }, 5);
                    }
       
    
           
        
        public static void SecretCaveExit(final Player player, WorldObject object) {
        	player.setNextAnimation(new Animation(7376));
        final WorldTile toTile = new WorldTile(2830, 3637, 0);
            WorldTasksManager.schedule(new WorldTask() {
            public void run() {
                player.setNextAnimation(new Animation(7376));
                player.setNextWorldTile(toTile);
                player.getPackets().sendGameMessage("You made your way safely out of the tunnel.");
                    stop();
            }
    
        }, 0, 1);             
        }
        
        public static void SecretCaveEntrance(final Player player, WorldObject object) {
        	player.setNextAnimation(new Animation(7376));
        final WorldTile toTile = new WorldTile(2824, 10050, 0);
            WorldTasksManager.schedule(new WorldTask() {
            public void run() {
                player.setNextAnimation(new Animation(7376));
                player.setNextWorldTile(toTile);
                player.getPackets().sendGameMessage("You enter through a secret tunnel.");
                    stop();
            }
    
        }, 0, 2);             
        }
        
        public static void Rocks6(final Player player, WorldObject object) {
        	player.faceObject(object);
        	player.lock(2);
            player.setNextAnimation(new Animation(5038));
           	int x = player.getX() == 2818 ? 2816 : 2818;
        	  final WorldTile toTile = new WorldTile(x, 3632, 0);
        	  if (player.getX() == 2816) {
        	        player.setNextForceMovement(new ForceMovement(player, 1, toTile, 3,
        	                ForceMovement.EAST));
        	  } else
            player.setNextForceMovement(new ForceMovement(
                    new WorldTile(x, 3632, 0), 3,
                    player.getY() == 2 ? 1 : 3));
            player.useStairs(-1, new WorldTile(x, 3632, 0), 3, 4);
        }
     
        public static void Rocks5(final Player player, WorldObject object) {
        	player.faceObject(object);
        	player.lock(2);
            player.setNextAnimation(new Animation(5038));
            int y = player.getY() == 3621 ? 3619 : 3621;
        	  final WorldTile toTile = new WorldTile(2848, y, 0);
        	  if (player.getX() == 2848) {
        	        player.setNextForceMovement(new ForceMovement(player, 1, toTile, 3,
        	                ForceMovement.NORTH));
        	  } else
            player.setNextForceMovement(new ForceMovement(
                    new WorldTile(2848, y, 0), 3,
                    player.getY() == 2 ? 1 : 3) );
            player.useStairs(-1, new WorldTile(2848, y, 0), 3, 4);
        }
        
        
        public static void GWDBoulder(final Player player, WorldObject object) {
        	if (player.getSkills().getLevel(Skills.AGILITY) < 60) {
           	  player.getDialogueManager().startDialogue("SimpleMessage", "You need a Agility level of 60 to squeeze through the boulder.");
    			return;
        	 }
        	 int y = player.getY() == 3708 ? 3712 : 3708;
    			player.sendMessage("You tighten yourself and squeeze through the big boulder...");
    			player.lock(5);
    			player.setNextAnimation(new Animation(752));
    			player.getAppearence().setRenderEmote(156);
    			player.setRun(true);
    			
    			 WorldTasksManager.schedule(new WorldTask() {
    		        	@Override
    		    			public void run() {
    		        		player.setNextAnimation(new Animation(752));
    		    				stop();
    		    		      }
    
    		            }, 0, 1);
    			WorldTasksManager.schedule(new WorldTask() {
    				@Override
    				public void run() {
    					player.getAppearence().setRenderEmote(-1);
    					 player.setNextForceMovement(new ForceMovement(
    				                new WorldTile(2910, y, 0), 3,
    				                player.getY() == 3676 ? 1 : 3));
    				        player.useStairs(-1, new WorldTile(2910, y, 0), 3, 4);
    						player.setNextAnimation(new Animation(7377));
    					player.sendMessage("You made it to the other side.");
    				}
    			}, 1);
    		}
        
        public static void Rocks(final Player player, WorldObject object) {
        	player.faceObject(object);
        	player.lock(2);
            player.setNextAnimation(new Animation(5038));
        	  int y = player.getY() == 3676 ? 3674 : 3676;
        	  final WorldTile toTile = new WorldTile(2920, y, 0);
        	  if (player.getY() == 3674) {
        	        player.setNextForceMovement(new ForceMovement(player, 1, toTile, 3,
        	                ForceMovement.NORTH));
        	  } else
            player.setNextForceMovement(new ForceMovement(
                    new WorldTile(2920, y, 0), 3,
                    player.getY() == 3676 ? 1 : 3));
            player.useStairs(-1, new WorldTile(2920, y, 0), 3, 4);
        }
    
     
        public static void Rocks2(final Player player, WorldObject object) {
        	player.faceObject(object);
        	player.lock(2);
        	int x = player.getX() == 2901 ? 2899 : 2901;
           	player.setNextAnimation(new Animation(839));
        	 final WorldTile toTile = new WorldTile(x, 3610, 0);
        	 if (player.getX() == 2899) {
     	        player.setNextForceMovement(new ForceMovement(player, 1, toTile, 3,
     	                ForceMovement.EAST));
     	  } else
            player.setNextForceMovement(new ForceMovement(
                    new WorldTile(x, 3610, 0), 3,
                    player.getX() == x ? 1 : 3));
            player.useStairs(-1, new WorldTile(x, 3610, 0), 3, 4);                
        }
        
        public static void Rocks4(final Player player, WorldObject object) {
        	player.faceObject(object);
        	player.lock(2);
        	int x = player.getX() == 2835 ? 2833 : 2835;
           	player.setNextAnimation(new Animation(839));
        	 final WorldTile toTile = new WorldTile(x, 3628, 0);
        	 if (player.getX() == 2833) {
     	        player.setNextForceMovement(new ForceMovement(player, 1, toTile, 3,
     	                ForceMovement.EAST));
     	  } else
     		    player.setNextForceMovement(new ForceMovement(
     	                new WorldTile(x, 3628, 0), 2,
     	               player.getX() == 2 ? 1 : 2) );
     	        player.useStairs(-1, new WorldTile(x, 3628, 0), 3, 2);
                 
        }
        
    
        
    
    public static void EadgarCave(Player player,
    		final WorldObject object) {
        final WorldTile toTile = new WorldTile(2893, 10074, 0);
        final WorldTile toTile2 = new WorldTile(2890, 3674, 0);
    	if (object.getX() == 2885) {
    	      player.setNextAnimation(new Animation(11042));
                      WorldTasksManager.schedule(new WorldTask() {
          				@Override
          				public void run() {
          				  player.setNextWorldTile(toTile);
          			     player.setNextAnimation(new Animation(11043));
                         player.setForceNextMapLoadRefresh(true);
          				 }
                      }, 2);
    	} else {
    		player.setNextAnimation(new Animation(11042));
    		WorldTasksManager.schedule(new WorldTask() {
    			@Override
    			public void run() {
    				  player.setNextWorldTile(toTile2);
       			     player.setNextAnimation(new Animation(11043));
                      player.setForceNextMapLoadRefresh(true);
    			}
    		}, 1);
    	}
    }
    
    public static boolean isObject(final WorldObject object) {
    	switch (object.getId()) {
    	case 34395:
    	case 3803:
    	case 9303:
    	case 9305:
    	case 9304:
    	case 9306:
    	case 34889:
    	case 32738:
    	case 34878:
    	case 34836:
    	case 34839:
    	case 34877:
    	case 35391:
    	case 3748:
    	return true;
    	default:
    	return false;
    	}
    }
    
    
    public static void HandleObject(Player player, final WorldObject object) {
    	final int id = object.getId();
    	if (id == 34395 || id == 32738) { 
    		Trollheim.EadgarCave(player, object);
    		return;
    	}
    	if (id == 35391) {
    		if (object.getX() == 2900)
    		Trollheim.Rocks2(player, object);
    		   if (object.getX() == 2834) {
    			  Trollheim.Rocks4(player, object);
    		}
    	}
    	if (id == 3748) { 
    		if (object.getX() == 2918)
    		Trollheim.Rocks(player, object);
    		   if (object.getX() == 2817) {
    	     	Trollheim.Rocks6(player, object);
    	        	} if (object.getX() == 2846) {
    		        	Trollheim.Rocks5(player, object);
    		}
    	}
    	if (id == 34878) { 
    		if (player.getAttackedByDelay() > Utils.currentTimeMillis()) {
    			player.sm("You are currently in combat and can't do this interaction.");
    			return;
    		} else
    		Trollheim.Cliffsides(player, object);
    	}
    	if (id == 34839 || id == 34836) {
    		ObjectHandler.handleGate(player, object);
    	}
    		if (id == 3803 || id == 9305 || id == 9304 || id == 9306 
    				|| id == 9303 || id == 34889 || id == 34878 || id == 34877 && player.withinDistance(object, 1)) { 
    				Trollheim.Cliffsides(player, object);
    			
    		}
    	}
     
    }


    TrollheimObj.java

    Code:
    package com.rs.game.player.actions.objects;
    
    import com.rs.cache.loaders.ObjectDefinitions;
    import com.rs.game.Animation;
    import com.rs.game.World;
    import com.rs.game.WorldObject;
    import com.rs.game.WorldTile;
    import com.rs.game.player.Player;
    import com.rs.game.player.content.FadingScreen;
    import com.rs.game.player.controlers.Barrows;
    import com.rs.game.tasks.WorldTask;
    import com.rs.game.tasks.WorldTasksManager;
    import com.rs.utils.Utils;
    
    /*
     * @Author PhaseGFX
     * Trollheim objects expansion
     */
    
    public class TrollheimObj {
    	
    
    	public static void CloseCell(Player player,
    			final WorldObject object) {
    			if (object.getId() == 3764) {
    				player.faceObject(object);
    			player.setNextAnimation(new Animation(8804));
    			player.lock(3);
    			 WorldTasksManager.schedule(new WorldTask() {
    			        @Override
    			        public void run() {
    			        	WorldObject closedCell = new WorldObject(3765,
    								object.getType(), object.getRotation()+1, object.getX(),
    								object.getY(), object.getPlane());	
    						player.faceObject(closedCell);
    						World.spawnTemporaryObject(closedCell, 30000, true);
    			        }
    			    }, 2); }}
    	
    	public static void PrisonDoor(Player player,
    			final WorldObject object) {
    			if (object.getX() == 2848) {
    				player.faceObject(object);
    			player.setNextAnimation(new Animation(4797));
    			player.sm("You attempt to pick-lock the door...");		
    			player.lock(3);
    			 WorldTasksManager.schedule(new WorldTask() {
    			        @Override
    			        public void run() {
    			        	WorldObject openedDoor = new WorldObject(3780,
    								object.getType(), object.getRotation()+1, object.getX(),
    								object.getY(), object.getPlane());	
    						player.faceObject(openedDoor);
    						World.spawnTemporaryObject(openedDoor, 5000, true);
    						player.sm("The key cilinder cracks and the door opens.");		
    			        }
    			    }, 6); 
    			 WorldTasksManager.schedule(new WorldTask() {
    			        @Override
    			        public void run() {
    			        	player.addWalkSteps(player.getX() == 2848 ? 2846 : 2848, 
    			        			player.getY() == 10107 ? 10107 : 10107, 1,
    								false);
    						player.setRun(false);
    			        
    			        }
    			    }, 7); 
    			}}
    			
    		
    	public static void DangerSign(Player player,
    			final WorldObject object) {
    		if (player.withinDistance(object, 1)) {
    			player.sm("I can't reach that.");
    		player.getInterfaceManager().sendInterface(327);
    		player.getPackets().sendIComponentText(327, 14, 
    				"Warning! This is a dangerous area, aggressive thrower trolls attack any adventurers passing this passage.");
    		}
    	}
    	
    	public static void Rack(Player player,
    			final WorldObject object) {
    		player.setNextAnimation(new Animation(6840));
    		player.sm("You start investigating the rack...");		
    		WorldTasksManager.schedule(new WorldTask() {
                @Override
                public void run() {
                	player.sm("but find nothing interesting.");
                }
            }, 2);
    	}
    	
    	public static void StairsUp(Player player,
    			final WorldObject object) {
    		if (object.getY() == 10052) {
    			player.setNextAnimation(new Animation(2118));	
    			FadingScreen.fade(player, new Runnable() {
    			    @Override
    			    public void run() {
    			        player.setNextWorldTile(new WorldTile(2845, 10051, 2));
    			        player.setForceNextMapLoadRefresh(true);
    				player.lock(3);
    				return;
    			    }
    			});
    		} else if (object.getX() == 2842) {
    			player.setNextAnimation(new Animation(2118));	
    			FadingScreen.fade(player, new Runnable() {
    			    @Override
    			    public void run() {
    			        player.setNextWorldTile(new WorldTile(2845, 10108, 2));
    			        player.setForceNextMapLoadRefresh(true);
    				player.lock(3);
    				return;
    			    }
    			});
    		} else if (object.getX() == 2852) {
    		player.setNextAnimation(new Animation(2118));	
    		FadingScreen.fade(player, new Runnable() {
    		    @Override
    		    public void run() {
    		        player.setNextWorldTile(new WorldTile(2853, 10109, 1));
    		        player.setForceNextMapLoadRefresh(true);
    			player.lock(3);
    		    }
    		});
    	}}
    	
    	public static void StairsDown(Player player,
    			final WorldObject object) {
    			player.setNextAnimation(new Animation(15732));	
    			FadingScreen.fade(player, new Runnable() {
    			    @Override
    			    public void run() {
    			        player.setNextWorldTile(new WorldTile(2841, 10052, 1));
    			        player.setForceNextMapLoadRefresh(true);
    				player.lock(3);
    			   }
    			 });
    			
    	}
    			public static void StairsDown3(Player player,
    					final WorldObject object) {
    		player.setNextAnimation(new Animation(15732));	
    		FadingScreen.fade(player, new Runnable() {
    		    @Override
    		    public void run() {
    		        player.setNextWorldTile(new WorldTile(2852, 10105, 0));
    		        player.setForceNextMapLoadRefresh(true);
    			player.lock(3);
    		    }
    		});
    	}
    			public static void StairsDown2(Player player,
    					final WorldObject object) {
    		player.setNextAnimation(new Animation(15732));	
    		FadingScreen.fade(player, new Runnable() {
    		    @Override
    		    public void run() {
    		        player.setNextWorldTile(new WorldTile(2841, 10108, 1));
    		        player.setForceNextMapLoadRefresh(true);
    			player.lock(3);
    		    }
    		});
    	}
    	
    	public static void SlideDown(Player player,
    			final WorldObject object) {
    		player.lock(3);
    		player.faceObject(object);
    		player.setNextAnimation(new Animation(5040));	
    		WorldTasksManager.schedule(new WorldTask() {
    		    @Override
    		    public void run() {
    		        player.setNextWorldTile(new WorldTile(2831, 10076, 2));
    		        player.setForceNextMapLoadRefresh(true);
    		    	player.setNextAnimation(new Animation(15459));	
    		    }
            }, 2);
    	}
    	
    	public static void ClimbUp(Player player,
    			final WorldObject object) {
    		player.lock(3);
    		player.faceObject(object);
    		player.setNextAnimation(new Animation(15456));	
    		FadingScreen.fade(player, new Runnable() {
    		    @Override
    		    public void run() {
    		        player.setNextWorldTile(new WorldTile(2812, 3669, 0));
    		        player.setForceNextMapLoadRefresh(true);
    		    	player.setNextAnimation(new Animation(-1));	
    		    }
    		});
    	}
    	
    	public static void ClimbUp2(Player player,
    			final WorldObject object) {
    		player.lock(3);
    		player.faceObject(object);
    		player.setNextAnimation(new Animation(2118));	
    		FadingScreen.fade(player, new Runnable() {
    		    @Override
    		    public void run() {
    		        player.setNextWorldTile(new WorldTile(2845, 10052, 2));
    		        player.setForceNextMapLoadRefresh(true);
    		    	player.setNextAnimation(new Animation(-1));	
    		    }
    		});
    	}
    	
    	public static void CaveEntrance(Player player,
    			final WorldObject object) {
    	    final WorldTile toTile = new WorldTile(2852, 10105, 0);
    		if (object.getX() == 2847) {
    		player.setNextAnimation(new Animation(11042));	
    		WorldTasksManager.schedule(new WorldTask() {
                @Override
                public void run() {
            	player.setNextAnimation(new Animation(11043));	
            	  player.setNextWorldTile(toTile);
            	  player.setForceNextMapLoadRefresh(true);
                }
            }, 1);
    	}}
    	
    	public static void KitchenDrawers(Player player,
    			final WorldObject object) {
    		player.lock(6);
    		player.faceObject(object);
    		player.setNextAnimation(new Animation(9429));	
    		player.sm("You reach for the drawer.");
    		WorldTasksManager.schedule(new WorldTask() {
                @Override
                public void run() {
    
                	WorldObject opened = new WorldObject(3817,
    						object.getType(), object.getRotation(), object.getX(),
    						object.getY(), object.getPlane());	
    				player.faceObject(opened);
    				World.spawnTemporaryObject(opened, 30000, true);
                }
            }, 2);
    
    		WorldTasksManager.schedule(new WorldTask() {
                @Override
                public void run() {
                	player.sm("You start to inspect...");
            	player.setNextAnimation(new Animation(2094));	
            	  player.setForceNextMapLoadRefresh(true);
                }
            }, 3);
    		
    		WorldTasksManager.schedule(new WorldTask() {
                @Override
                public void run() {
                	Long item = (Long) player.getTemporaryAttributtes().get("FOUND");
        			if (item != null && item + 300000 > Utils.currentTimeMillis()) { //5min
                    	player.sm("Seems it's empty (*some onion scent leaves the drawer)");
                    	stop();
                    	return;
        			} else				
        			player.getDialogueManager().startDialogue("Onion");
        			player.getInventory().addItem(1957, 1);
        	    	player.sm("Not sure why they would keep a onion in there...");
        			player.getTemporaryAttributtes().put("FOUND", Utils.currentTimeMillis());
        		    stop();
        	     	player.setNextAnimation(new Animation(-1));	
        			
                }
            }, 5);	
    	}
    	
    	public static void CaveEntrance2(Player player,
    			final WorldObject object) {
    	    final WorldTile toTile = new WorldTile(2824, 10050, 0);
    	    final WorldTile toTile2 = new WorldTile(2831, 3638, 0);
    		if (object.getX() == 2829) {
    		      player.setNextAnimation(new Animation(11042));
    	                  WorldTasksManager.schedule(new WorldTask() {
    	      				@Override
    	      				public void run() {
    	      				  player.setNextWorldTile(toTile);
    	      			     player.setNextAnimation(new Animation(11043));
    	                     player.setForceNextMapLoadRefresh(true);
    	      				 }
    	                  }, 2);
    		   } else if (object.getX() == 2823) {
    			      player.setNextAnimation(new Animation(11042));
                      WorldTasksManager.schedule(new WorldTask() {
          				@Override
          				public void run() {
          				  player.setNextWorldTile(toTile2);
          			     player.setNextAnimation(new Animation(11043));
                         player.setForceNextMapLoadRefresh(true);
          				 }
                      }, 2);
    		   }
    		}
    	
    	public static void JailDoor(Player player,
    			final WorldObject object) {
    		player.setNextAnimation(new Animation(5037));
    		player.sm("You attempt to break-open the jail door...");		
    		WorldTasksManager.schedule(new WorldTask() {
                @Override
                public void run() {
                	player.sm("But it seems it's firmly locked.");
                }
            }, 5);
    	}
    	
    	
    
    	public static boolean isObject(final WorldObject object) {
    		switch (object.getId()) {
    		case 3821:
    		case 3765:
    		case 3742:
    		case 3764:
    		case 3767:
    		case 3761:
    		case 3762:
    		case 3788:
    		case 3780:
    		case 3816:
    		case 3789:
    		case 34395:
    		case 18833:
    		case 18834:
    		return true;
    		default:
    		return false;
    		}
    	}
    	
    	public static void HandleObject(Player player, final WorldObject object) {
    		final int id = object.getId();
    		if (id == 3821) {
    			if (object.getX() == 2828) { 
    				TrollheimObj.Rack(player, object); 
    				return;
    		}
    	}
    		if (id == 3765 || id == 3767) { 
    			if (object.getX() == 2832) {
    				TrollheimObj.JailDoor(player, object); 
    				return;
    			}
    		}
    		if (id == 3761 || id == 3762) { 
    				TrollheimObj.CaveEntrance2(player, object); 
    				return;
    		}
    		if (id == 18833) { 
    			TrollheimObj.SlideDown(player, object); 
    			return;
    	} else if (id == 18834) { 
    		TrollheimObj.ClimbUp(player, object); 
    		return;
    	}
    		if (id == 3816) {
    			TrollheimObj.KitchenDrawers(player, object);
    		}
    		if (id == 3788) {
    			if (object.getX() == 2842 && object.getY() == 10051) {
    				TrollheimObj.ClimbUp2(player, object); 
    			} else
    			TrollheimObj.StairsUp(player, object); 
    			
    	}
    		if (id == 3742) {
    			TrollheimObj.DangerSign(player, object); 
    			return;
    	}
    		if (id == 3780) {
    			if (object.getX() == 2848) { 
    			TrollheimObj.PrisonDoor(player, object); 
    			return;
    		}
    	}
    		if (id == 3789) {
    			if (object.getX() == 2842 && object.getY() == 10051) {
    				TrollheimObj.StairsDown(player, object); 
    		} else	if (object.getX() == 2842 && object.getY() == 10108) {
    			TrollheimObj.StairsDown2(player, object); 
    		} else	{
    			TrollheimObj.StairsDown3(player, object); 
    		}
    	}
    		
    		if (id == 34395) {
    			if (object.getX() == 2847) {
    				TrollheimObj.CaveEntrance(player, object); 
    				return;
    			}
    		}
    		if (id == 3764) {
    			if (object.getX() == 2831) { 
    				TrollheimObj.CloseCell(player, object);	
    				return;
    		}
    		}
    	}
    
    }

    In ObjectHandler class:

    Code:
    if (Trollheim.isObject(object))
                    	Trollheim.HandleObject(player, object);
                    if (TrollheimObj.isObject(object))
                    	TrollheimObj.HandleObject(player, object);


    OnionDialogue:

    Code:
    package com.rs.game.player.dialogues.trollheim;
    
    import com.rs.cache.loaders.NPCDefinitions;
    import com.rs.game.player.dialogues.Dialogue;
    import com.rs.utils.ShopsHandler;
    
    public class Onion extends Dialogue {
    
    
    	@Override
    	public void start() {
    		sendItemDialogue(1957, "You found a onion...");
    		stage = 1;
    	}
    
    	@Override
    	public void run(int interfaceId, int componentId) {
    		switch (stage) {
    		case 1:
    			stage = -2;
    			sendPlayerDialogue(THINKING, "Why would they leave a onion in a drawer?");
    			end();
    			break;
    	
    		}
    	}
    
    	@Override
    	public void finish() {
    		
    	}
    
    }
    DialogueHandler:

    Code:
    handledDialogues.put("Onion", (Class<Dialogue>) Class.forName(Onion.class.getCanonicalName()));

    R-S Mod Response  //todos

    -Add aggressive thrower trolls on cliff sides.
    -complete more object interactions within trollheim
    -add climbing shoes before climbing certain rocks.
    -make DAD aggressive upon 1st enter.
    -edgars and general troll's dialogues.



    Enjoy.
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  2. Thankful users:



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. The Trollheim Teleport Icon Location?
    By Bondie8 in forum Help
    Replies: 2
    Last Post: 11-19-2010, 12:15 AM
  2. {COORD}Trollheim{/COORD}
    By Austin_ in forum Help
    Replies: 2
    Last Post: 08-13-2010, 11:26 AM
  3. Replies: 0
    Last Post: 02-02-2010, 01:48 PM
  4. Expansion on requirements for ranking positions.
    By thiefmn6092 in forum Suggestions
    Replies: 6
    Last Post: 10-29-2009, 05:36 AM
  5. Replies: 3
    Last Post: 10-25-2008, 12:24 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
  •