Thread: [PI] Freaky Forester Event (Nothing Special)

Results 1 to 6 of 6
  1. #1 [PI] Freaky Forester Event (Nothing Special) 
    Erethium Developer
    Code Kiwi's Avatar
    Join Date
    Jan 2015
    Posts
    434
    Thanks given
    179
    Thanks received
    23
    Rep Power
    72
    Nothing special could be cleaned up and minimized without a doubt, may come in handy for someone.


    Code:
    package server.model.minigames;
    
    import server.Server;
    import server.model.players.Client;
    import server.util.Misc;
    import server.model.players.*;
    
    public class ForresterEvent {
    
    public static void startEvent(Client c) {
    c.stopMovement();
    c.lastX = c.absX;
    c.lastY = c.absY;
    if (System.currentTimeMillis() - c.lastButton < 1000) {
    				 c.lastButton = System.currentTimeMillis();
    				 return;
    			} else
    c.lastButton = System.currentTimeMillis();
    c.getPA().removeAllWindows(); 
    ForresterEvent.teleportPlayer(c);
    return;
    }
    
    public static void teleportPlayer(Client c) {
    c.stopMovement();
    c.getPA().startTeleport(2597, 4779, 0, "modern");
    c.inForrestEvent = true;
    ForresterEvent.sendDialogue(c, 1);
    return;
    }
    
    public static void hasMeat(Client c) {
    c.getItems().deleteItem(6178, 1);
    ForresterEvent.sendDialogue(c, 3);
    c.givenMeat = true;
    return;
    }
    
    public static void givenMeat(Client c) {
    ForresterEvent.sendDialogue(c, 3);
    return;
    }
    
    public static void noMeat(Client c) {
    ForresterEvent.sendDialogue(c, 2);
    return;
    }
    
    public static void leaveEvent(Client c) {
    if(c.givenMeat == true) {
    ForresterEvent.giveReward(c);
    c.getPA().startTeleport(c.lastX, c.lastY, 0, "modern");
    }else if(c.givenMeat == false) {
    ForresterEvent.sendDialogue(c, 4);
    return;
    }
    }
    
    public static void giveReward(Client c) {
    c.givenMeat = false;
    c.inForrestEvent = false;
    ForresterEvent.sendDialogue(c, 4);
    if (c.getItems().freeSlots() < 1) {
    c.sendMessage("You don't have enough inventory space to collect the reward.");
    return;
    }
    c.getItems().addItem(6183, 1);
    return;
    }
    
    public static void logOut(Client c) {
    c.getPA().movePlayer(2864, 5354, 2);
    return;
    }
    
    public static void sendDialogue(Client c, int dialogueId) {
    		switch (dialogueId) {
    case 1:
    c.getDH().sendNpcChat4("Welcome to 8thgen's anti Macro event.",
    			"To exit the event, you must complete my task.", 
    			"I need one raw Pheasant meat. Kill one and come and talk to",
    			"Me to leave this event.", 
    			 2458, 
    			"Freaky Forester");
    break;
    
    case 2:
    c.getDH().sendNpcChat1("Please get me one raw Pheasant meat.", 
    			 2458, 
    			"Freaky Forester");
    break;
    
    case 3:
    c.getDH().sendNpcChat2("Thanks for that, " + c.playerName +".",
    			"You may now leave the event in the portal over there.",
    			 2458, 
    			"Freaky Forester");
    break;
    
    case 4:
    c.getDH().sendNpcChat1("Hey, talk to me before leaving.", 
    			 2458, 
    			"Freaky Forester");
    break;
    
    case 5:
    c.getDH().sendNpcChat1("Take this reward for finishing the event.", 
    			 2458, 
    			"Freaky Forester");
    break;
    
    }
    }
    }
    Reply With Quote  
     

  2. #2  
    Registered Member Stevenhax's Avatar
    Join Date
    Jul 2014
    Posts
    389
    Thanks given
    53
    Thanks received
    64
    Rep Power
    42
    Thanks for the contribution.
    Reply With Quote  
     

  3. #3  
    Registered Member KushKings's Avatar
    Join Date
    Jul 2018
    Posts
    441
    Thanks given
    49
    Thanks received
    24
    Discord
    View profile
    Rep Power
    37
    Quote Originally Posted by Code Kiwi View Post
    Nothing special could be cleaned up and minimized without a doubt, may come in handy for someone.


    Code:
    package server.model.minigames;
    
    import server.Server;
    import server.model.players.Client;
    import server.util.Misc;
    import server.model.players.*;
    
    public class ForresterEvent {
    
    public static void startEvent(Client c) {
    c.stopMovement();
    c.lastX = c.absX;
    c.lastY = c.absY;
    if (System.currentTimeMillis() - c.lastButton < 1000) {
    				 c.lastButton = System.currentTimeMillis();
    				 return;
    			} else
    c.lastButton = System.currentTimeMillis();
    c.getPA().removeAllWindows(); 
    ForresterEvent.teleportPlayer(c);
    return;
    }
    
    public static void teleportPlayer(Client c) {
    c.stopMovement();
    c.getPA().startTeleport(2597, 4779, 0, "modern");
    c.inForrestEvent = true;
    ForresterEvent.sendDialogue(c, 1);
    return;
    }
    
    public static void hasMeat(Client c) {
    c.getItems().deleteItem(6178, 1);
    ForresterEvent.sendDialogue(c, 3);
    c.givenMeat = true;
    return;
    }
    
    public static void givenMeat(Client c) {
    ForresterEvent.sendDialogue(c, 3);
    return;
    }
    
    public static void noMeat(Client c) {
    ForresterEvent.sendDialogue(c, 2);
    return;
    }
    
    public static void leaveEvent(Client c) {
    if(c.givenMeat == true) {
    ForresterEvent.giveReward(c);
    c.getPA().startTeleport(c.lastX, c.lastY, 0, "modern");
    }else if(c.givenMeat == false) {
    ForresterEvent.sendDialogue(c, 4);
    return;
    }
    }
    
    public static void giveReward(Client c) {
    c.givenMeat = false;
    c.inForrestEvent = false;
    ForresterEvent.sendDialogue(c, 4);
    if (c.getItems().freeSlots() < 1) {
    c.sendMessage("You don't have enough inventory space to collect the reward.");
    return;
    }
    c.getItems().addItem(6183, 1);
    return;
    }
    
    public static void logOut(Client c) {
    c.getPA().movePlayer(2864, 5354, 2);
    return;
    }
    
    public static void sendDialogue(Client c, int dialogueId) {
    		switch (dialogueId) {
    case 1:
    c.getDH().sendNpcChat4("Welcome to 8thgen's anti Macro event.",
    			"To exit the event, you must complete my task.", 
    			"I need one raw Pheasant meat. Kill one and come and talk to",
    			"Me to leave this event.", 
    			 2458, 
    			"Freaky Forester");
    break;
    
    case 2:
    c.getDH().sendNpcChat1("Please get me one raw Pheasant meat.", 
    			 2458, 
    			"Freaky Forester");
    break;
    
    case 3:
    c.getDH().sendNpcChat2("Thanks for that, " + c.playerName +".",
    			"You may now leave the event in the portal over there.",
    			 2458, 
    			"Freaky Forester");
    break;
    
    case 4:
    c.getDH().sendNpcChat1("Hey, talk to me before leaving.", 
    			 2458, 
    			"Freaky Forester");
    break;
    
    case 5:
    c.getDH().sendNpcChat1("Take this reward for finishing the event.", 
    			 2458, 
    			"Freaky Forester");
    break;
    
    }
    }
    }
    is this all I have to add or is there more please let me know and thanks
    Reply With Quote  
     

  4. #4  
    Banned
    Join Date
    Sep 2017
    Posts
    340
    Thanks given
    24
    Thanks received
    30
    Rep Power
    0
    Thanks for this will make it a less code because currently it is so poor
    Reply With Quote  
     

  5. #5  
    touched like seafood
    Women's Avatar
    Join Date
    Mar 2010
    Posts
    1,830
    Thanks given
    651
    Thanks received
    1,002
    Discord
    View profile
    Rep Power
    3071
    do u know what a boolean is?


    When you ape the cops it ain't anarchy
    Reply With Quote  
     

  6. #6  
    Erethium Developer
    Code Kiwi's Avatar
    Join Date
    Jan 2015
    Posts
    434
    Thanks given
    179
    Thanks received
    23
    Rep Power
    72
    Quote Originally Posted by Women View Post
    do u know what a boolean is?
    Nah bro
    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. Lethium317; Nothing Special PI Client
    By Garrett in forum Downloads
    Replies: 11
    Last Post: 01-09-2013, 03:53 AM
  2. [PI] server with nothing special :D
    By EricFtw in forum Advertise
    Replies: 3
    Last Post: 09-27-2011, 04:58 PM
  3. Freaky Forester random event
    By tj007razor in forum Tutorials
    Replies: 8
    Last Post: 12-31-2009, 11:42 AM
  4. Freaky Forester Event [100%]
    By Xuzk in forum Tutorials
    Replies: 27
    Last Post: 11-12-2009, 11:49 PM
  5. New walls...nothing special..
    By Jammy780 in forum Show-off
    Replies: 10
    Last Post: 03-29-2009, 10:37 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
  •