Thread: Christmas World Drop Party (Via command)

Results 1 to 5 of 5
  1. #1 Christmas World Drop Party (Via command) 
    Registered Member Dds legend's Avatar
    Join Date
    Nov 2011
    Posts
    101
    Thanks given
    6
    Thanks received
    8
    Rep Power
    11
    This is a command that drops random Rares around the world, Not too many either. The amount is set to 15, but you can change easily. You can also change the ID's of the items in ChristmasDrop.java. Lets begin.

    Pictures:








    In Item.java add this anywhere: (Server folder, Src -- org -- rscdaemon -- server -- model)

    Code:
    public long droppedBy = 0;
    
    	 public Item(int id, int x, int y, int amount, Player owner, long spawnTime) {
    		 setID(id);
    		 setAmount(amount);
    		 this.owner = owner;
    		 if(owner != null) {
    			 droppedBy = owner.getUsernameHash();
    		 }
    		 spawnedTime = spawnTime;
    		 setLocation(Point.location(x, y));
    	 }
    In Point.java find: (Server folder, Src -- org -- rscdaemon -- server -- model)

    Code:
    private Point(int x, int y) {
    Replace that with

    Code:
    public Point(int x, int y) {
    Now go into your minigames folder, src -- org -- rscdaemon -- server -- minigames. if you do not have it create it there. Then inside that create a new folder called Christmas and then inside that create a new file called ChristmasDrop.java:

    Code:
    package org.rscdaemon.server.minigames.christmas;
    
    /**
     * Imports
     */
    import org.rscdaemon.server.util.DataConversions;
    import org.rscdaemon.server.event.MiniEvent;
    import org.rscdaemon.server.model.Player;
    import org.rscdaemon.server.model.World;
    import org.rscdaemon.server.model.Point;
    import org.rscdaemon.server.model.Item;
    
    public class ChristmasDrop {
    	 /**
    	 * Christmas World Drop
    	 * @author Yong Min
    	 */
    	 private static final World world = World.getWorld();
    	
    	 private static final int[] randomDropItem = { 575, 576, 577, 578, 579, 580, 581, 593, 594, 597, 1276, 1277, 81, 93, 112, 400, 401, 402, 404, 406, 407,
    		 677, 828, 831, 832, 1156, 971 };
    	
    	 private static Point[] dropLocations = {
    		 new Point(291, 568),
    		 new Point(219, 642),
    		 new Point(136, 507),
    		 new Point(220, 432)
    	 };
    	
    	 private static int randomItem = 0;
    	 
    	public static void startCountDown() {
    		 world.getDelayedEventHandler().add(new MiniEvent(null, 1000) {
    			 public void action() {
    				 for(final Player p : world.getPlayers()) {
    					 p.getActionSender().sendMessage("@red@[Christmas Drop] @ora@The Christmas World Drop will begin in 3 seconds!");
    					 world.getDelayedEventHandler().add(new MiniEvent(null, 1000) {
    						 public void action() {
    							 p.getActionSender().sendMessage("@red@[Christmas Drop] @ora@The Christmas World Drop will begin in 2 seconds!");
    							 world.getDelayedEventHandler().add(new MiniEvent(null, 1000) {
    								 public void action() {
    									 p.getActionSender().sendMessage("@red@[Christmas Drop] @ora@The Christmas World Drop will begin in 1 seconds!");
    									 world.getDelayedEventHandler().add(new MiniEvent(null, 1000) {
    										 public void action() {
    											 startWorldDrop();
    										 }
    									 });
    								 }
    							 });
    						 }
    					 });
    				 }
    			 }
    		 });
    	 }
    	
    	 public static void startWorldDrop() {
    		 world.getDelayedEventHandler().add(new MiniEvent(null, 3000) {
    			 public void action() {
    				 for(int itemAmount = 0; itemAmount < 15; itemAmount++) {
    					 Point dropCoordinates = dropLocations[DataConversions.random(0, dropLocations.length - 1)];
    					 int x = dropCoordinates.getX() + (DataConversions.random(0, 1) == 1 ? - 20 : 0) + DataConversions.random(0, 20);
    					 int y = dropCoordinates.getY() + (DataConversions.random(0, 1) == 1 ? - 20 : 0) + DataConversions.random(0, 20);
    					 while(world.getTile(x, y).hasGameObject()) {
    						 x = dropCoordinates.getX() + (DataConversions.random(0, 1) == 1 ? - 20 : 0) + DataConversions.random(0, 20);
    						 y = dropCoordinates.getY() + (DataConversions.random(0, 1) == 1 ? - 20 : 0) + DataConversions.random(0, 20);
    					 }
    					 setRandomItem();
    					 world.registerItem(new Item(randomItem, x, y, 1, null, System.currentTimeMillis() - DataConversions.random(45000, 60000)));
    				 }
    				 for(Player p : world.getPlayers()) {
    					 p.getActionSender().sendAlert("@ran@Merry Christmas!" + "@whi@ The World Drop has now dropped items around the following locations: Draynor, Falador, Edgeville & Varrock! Happy Hunting!", false);
    				 }
    			 }
    		 });
    	 }
    	
    	 public static void setRandomItem() {
    		 randomItem = (randomDropItem[(int)(Math.random() * randomDropItem.length)]);
    	 }
    }
    In CommandHandler.java Import: (src -- org -- rscdaemon -- server -- packethandler -- client -- org -- client)

    Code:
    import org.rscdaemon.server.minigames.christmas.ChristmasDrop;
    Then add this Code:

    Code:
    if (cmd.equals("xmasdrop")) && (player.isAdmin())) {
    ChristmasDrop.startCountDown();
    }
    If you get an error with the command change the code to this:

    Code:
    if((cmd.equals("xmasdrop")) && (player.isAdmin())) {
    ChristmasDrop.startCountDown();
    }
    I Hope you Like it! Enjoy!
    Reply With Quote  
     

  2. Thankful user:

    Community VeteranSub

  3. #2  
    Registered Member
    Addiction's Avatar
    Join Date
    Mar 2011
    Posts
    954
    Thanks given
    1,875
    Thanks received
    136
    Rep Power
    311
    Nice work.
    Reply With Quote  
     

  4. #3  
    Donator

    ProFiles's Avatar
    Join Date
    May 2011
    Posts
    1,673
    Thanks given
    4
    Thanks received
    240
    Rep Power
    118
    Nice work will use.
    Reply With Quote  
     

  5. #4  
    Fuckin PRO Derek's Avatar
    Join Date
    May 2008
    Posts
    1,257
    Thanks given
    38
    Thanks received
    86
    Rep Power
    67
    Will be adding this in December. Thanks man. Bookmarked.
    Reply With Quote  
     

  6. #5  
    Registered Member
    Join Date
    Jun 2014
    Posts
    27
    Thanks given
    2
    Thanks received
    0
    Rep Power
    10
    Amazing Job, i plan on using it soon enough!
    Reply With Quote  
     


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. [PI] Drop Party Command
    By mr giggles in forum Snippets
    Replies: 43
    Last Post: 06-13-2014, 01:35 AM
  2. Replies: 6
    Last Post: 10-28-2011, 09:15 PM
  3. Drop party command help:) please
    By FlawlessName in forum Help
    Replies: 3
    Last Post: 01-11-2011, 09:06 AM
  4. Replies: 3
    Last Post: 12-30-2009, 11:55 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •