Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • thewraith500: check out autoscape.org custom osrs server! inferno hydra konar
      January 22, 2021, 04:02:52 PM
    • jennipher11: better play dodian.net
      January 21, 2021, 02:53:53 PM
    • Project_Czar: Yes @Zymus..
      January 21, 2021, 04:49:17 AM
    • Zymus: Are you the programmer?
      January 20, 2021, 05:04:26 PM
    • Project_Czar: FizzerX - Allstar server is now ONLINE!
      January 20, 2021, 06:46:51 AM
    • Mazeingmaze: sick
      January 12, 2021, 08:56:35 PM
    • jennipher11: dodian.net
      January 11, 2021, 02:12:23 PM
    • jennipher11: yes it's back online
      January 11, 2021, 02:12:04 PM
    • arham 4: nice
      January 10, 2021, 04:43:09 PM
    • Togasa: Dodian is back online!? Dodian.net
      January 08, 2021, 10:04:21 PM
    • Pwnd: Y'all don't even know there's a community inside talk section
      January 06, 2021, 07:49:05 PM
    • drubrkletern: damn
      January 06, 2021, 01:04:50 AM
    • Zymus: Nobody cares
      January 04, 2021, 06:39:43 AM
    • wildskiller: or does no one give a shit about moparscape anymore?
      January 03, 2021, 09:24:08 PM
    • wildskiller: So, anyone gonna ban the guy in Server and Client development showoff?
      January 03, 2021, 09:24:00 PM
    • zachrida: wheres all my work?
      December 08, 2020, 09:50:22 AM
    • zachrida: what happend?
      December 08, 2020, 09:49:53 AM
    • zachrida: yo
      December 08, 2020, 09:49:36 AM
    • Shady Aftermath: try out skyfire317.com it has 5 custom skills, max level 168 and combat level 255
      December 07, 2020, 12:55:12 PM
    • skyhigh21: twisted-royalty.com is pretty cool i like it so far
      December 05, 2020, 01:35:34 PM

    Show Posts

    This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


    Topics - arham 4

    Pages: [1] 2
    1

    Since I am a content developer, I figured I would start revamping some current systems to make my content spew out faster. Thus, this came. Made in approximately 2 hours.

    [COLOR="#FF0000"]Some things I'm unsure about or have questions on are stated in the code comments.[/COLOR]



    Requirements: Project Lombok[/URL]

    Implementing the System

    To start off, make a new enum called State. In it, add this:
    Code: Java
    1. packagecom.rs.game.player.dialogues.test;
    2.  
    3. /**
    4.  * Created by Arham 4 on 2/15/2016.
    5.  *
    6.  * I'm not sure about using this, but can't find a better way to do this. I need this for Option dialogue.
    7.  */
    8. publicenum State {
    9.     TALKING, NOT_TALKING
    10. }
    11.  
    12.  

    This represents the current state of a dialogue.

    Next, make a new enum in the same area and name it Expression. In it, add this:
    Code: Java
    1. packagecom.rs.game.player.dialogues.test;
    2.  
    3. importlombok.Getter;
    4.  
    5. /**
    6.  * Created by Arham 4 on 2/15/2016.
    7.  *
    8.  * Think some of these names could be improved lol.
    9.  */
    10. publicenum Expression {
    11.  
    12.     TERRIFIED(9750),
    13.     TERRIFIED_NO_YELL(9753),
    14.     THANK_YOU(9757),
    15.     SAD(9760),
    16.     SADDER(9761),
    17.     SADDER_LOOKS_RIGHT(9762),
    18.     SADDEST_DISGRACED(9765),
    19.     SADDEST(9768),
    20.     NEAR_TO_SAD(9769),
    21.     SCARED_GET_AWAY_FROM_ME(9773),
    22.     SCARED_PINCHED_EYES(9777),
    23.     SCARED(9780),
    24.     GET_OFF_MY_LAWN(9781),
    25.     GET_OFF_MY_LAWN_ANGRIER(9782),
    26.     GET_OFF_MY_LAWN_ANGRIEST(9783),
    27.     ANGRY(9789),
    28.     ANGRY_MOVING_FACE_ONLY(9792),
    29.     MOVE_HEAD_FRONT_AND_BACK(9793),
    30.     SLEEPY(9802),
    31.     NEUTRAL(9803),
    32.     BLINKING(9804),
    33.     PARANOID(9806),
    34.     PARANOID_AT_PLAYER(9808),
    35.     INVESTIGATIVE(9811),
    36.     TALK_TO_RIGHT(9814),
    37.     QUESTION(9827),
    38.     PLAIN_LOOK(9830),
    39.     INVESTIGATIVE_TALKING(9831),
    40.     WEE_DRUNK(9835),
    41.     WISE(9836),
    42.     VERY_JOLLY(9840),
    43.     FUN_LAUGHING(9841),
    44.     EVIL_MUHAHAHA(9842),
    45.     GET_OFF_MY_LAWN_HAPPY(9843),
    46.     HAPPY_EYEBROWS(9847),
    47.     HAPPY(9850),
    48.     VERY_FUN_LAUGHING(9851),
    49.     BEGGING(9877),
    50.     STICK_TONGUE_OUT(9878);
    51.  
    52.     @Getter
    53.     privatefinalint id;
    54.  
    55.     Expression(int id){
    56.         this.id= id;
    57.     }
    58. }
    59.  
    This represents the player and NPC expressions in the 718 cache.

    Next, we need to make the class that represents a Dialogue, so make a new class and name it Dialogue. Add this in it:
    Code: Java
    1. packagecom.rs.game.player.dialogues.test;
    2.  
    3. importcom.rs.game.player.Player;
    4. importcom.rs.game.player.dialogues.test.message.Message;
    5. importcom.rs.game.player.dialogues.test.message.OptionMessage;
    6.  
    7. importjava.util.HashMap;
    8.  
    9. /**
    10.  * Created by Arham 4 on 2/15/2016.
    11.  * <p>
    12.  * Represents a Dialogue (which contains Messages)
    13.  */
    14.  
    15. /**
    16.  * Thinking about using a builder for this for short dialogues? I don't know.
    17.  */
    18. publicabstractclass Dialogue {
    19.  
    20.     protectedfinal HashMap<Integer, Message> dialogue;
    21.     /**
    22.      * I can't think of any other way to handle option dialogue closing rather than States.
    23.      */
    24.     protected State state;
    25.     private Player player;
    26.  
    27.     privateint key =1;
    28.  
    29.     /**
    30.      * @param dialogue So I can assure a new dialogue is being made per class rather than reusing the same one per class.
    31.      */
    32.     protected Dialogue(Player player, HashMap<Integer, Message> dialogue){
    33.         this.player= player;
    34.         this.dialogue= dialogue;
    35.         state = State.TALKING;
    36.     }
    37.  
    38.     /**
    39.      * Where we make the magic with the dialogue HashMap happen.
    40.      */
    41.     publicabstractvoid buildDialogue();
    42.  
    43.     publicvoid communicate(){
    44.         dialogue.get(key).display(player);
    45.         dialogue.get(key).executeAction();
    46.     }
    47.  
    48.     /**
    49.      * Better name?
    50.      */
    51.     publicvoid communicateNext(){
    52.         key++;
    53.         if(isFinished()){
    54.             player.getTestDialogueManager().finish();
    55.             return;
    56.         }
    57.         communicate();
    58.     }
    59.  
    60.     /**
    61.      * Better name? Possibly a better way to do this?
    62.      */
    63.     publicvoid communicateNext(OptionMessage.Option option){
    64.         OptionMessage message =(OptionMessage) dialogue.get(key);
    65.         message.onClick(option);
    66.         communicate();
    67.     }
    68.  
    69.     /**
    70.      * I don't want to obligate the State enum, but its needed for option dialogues. However, if you don't use the
    71.      * option dialogue, then the key will handle the job for you.
    72.      */
    73.     privateboolean isFinished(){
    74.         return state == State.NOT_TALKING|| key > dialogue.size();
    75.     }
    76.  
    77.     /**
    78.      * Used for option dialogue.
    79.      */
    80.     protectedvoid setKey(int key){
    81.         this.key= key;
    82.         communicate();
    83.     }
    84.  
    85.     /**
    86.      * I didn't feel like using @Getter because I wanted this to be protected for security use.
    87.      */
    88.     protected Player getPlayer(){
    89.         return player;
    90.     }
    91. }
    92.  
    93.  

    This Dialogue system sort of gets complicated here - especially when seeing isFinished(). The isFinished() message is complicated due to option dialogue, because the option dialogue then redirects the dialogue to a different key, which sort of disrupts the patterns of +1 key per dialogue. Perhaps this can be simplified if somebody suggests how.

    Next, lets manage these Dialogues by making a new class called DialogueManager and add the following in it:
    Code: Java
    1. packagecom.rs.game.player.dialogues.test;
    2.  
    3. importcom.rs.game.player.Player;
    4. importcom.rs.game.player.dialogues.test.message.OptionMessage;
    5. importlombok.Setter;
    6.  
    7. /**
    8.  * Created by Arham 4 on 2/15/2016.
    9.  */
    10. publicclass DialogueManager {
    11.  
    12.     privatefinal Player player;
    13.     @Setter
    14.     private Dialogue lastDialogue;
    15.  
    16.     public DialogueManager(Player player){
    17.         this.player= player;
    18.     }
    19.  
    20.     publicvoid next(){
    21.         if(lastDialogue ==null){
    22.             return;
    23.         }
    24.         lastDialogue.communicateNext();
    25.     }
    26.  
    27.     publicvoid start(Dialogue dialogue){
    28.         if(lastDialogue !=null){
    29.             finish();
    30.         }
    31.         setLastDialogue(dialogue);
    32.         dialogue.buildDialogue();
    33.         dialogue.communicate();
    34.     }
    35.  
    36.     publicvoid finish(){
    37.         if(lastDialogue ==null){
    38.             return;
    39.         }
    40.         lastDialogue =null;
    41.         if(player.getInterfaceManager().containsChatBoxInter()){
    42.             player.getInterfaceManager().closeChatBoxInterface();
    43.         }
    44.     }
    45.  
    46.     /**
    47.      * Better way to do this?
    48.      */
    49.     publicvoid onClick(OptionMessage.Option option){
    50.         if(lastDialogue ==null){
    51.             return;
    52.         }
    53.         lastDialogue.communicateNext(option);
    54.     }
    55. }
    56.  
    onClick is sort of that one random method in this, but ignoring that, this class allows the dialogue system to belong to the player (as noticed by the constructor). I'm still debating whether to make a setPlayer in Dialogue and not make it an obligatory call every time the Dialogue method is called, or just keep it as is.

    Next, the messengers are going to be added. Through this, the dialogue will be a) formulated and b) displayed. Prepare for a barrage of classes to add (6 classes). Before doing this, make a new package called "message." Add the following in the package:
    Message
    Code: Java
    1. packagecom.rs.game.player.dialogues.test.message;
    2.  
    3. importcom.rs.game.player.Player;
    4.  
    5. /**
    6.  * Created by Arham 4 on 2/15/2016.
    7.  */
    8. publicinterface Message {
    9.  
    10.     void executeAction();
    11.  
    12.     void display(Player player);
    13. }
    14.  
    PlainMessage
    Code: Java
    1. packagecom.rs.game.player.dialogues.test.message;
    2.  
    3. importcom.rs.game.player.Player;
    4.  
    5. /**
    6.  * Created by admin on 2/15/2016.
    7.  * <p>
    8.  * Represents a plain message, with no entities in the dialogue.
    9.  */
    10. publicclass PlainMessage implements Message {
    11.  
    12.     privatefinalString[] message;
    13.  
    14.     public PlainMessage(String... message){
    15.         this.message= message;
    16.     }
    17.  
    18.     @Override
    19.     publicvoid executeAction(){
    20.     }
    21.  
    22.     /**
    23.      * DO NOT OVERRIDE
    24.      */
    25.     @Override
    26.     publicvoid display(Player player){
    27.         StringBuilder builder =new StringBuilder();
    28.         for(int line =0; line < message.length; line++)
    29.             builder.append(line ==0?"<p=1>":"<br>").append(message[line]);
    30.         String text = builder.toString();
    31.         player.getInterfaceManager().sendChatBoxInterface(1186);
    32.         player.getPackets().sendIComponentText(1186, 1, text);
    33.     }
    34. }
    35.  
    PlayerMessage
    Code: Java
    1. packagecom.rs.game.player.dialogues.test.message;
    2.  
    3. importcom.rs.game.player.Player;
    4. importcom.rs.game.player.dialogues.test.Expression;
    5.  
    6. /**
    7.  * Created by Arham 4 on 2/15/2016.
    8.  * <p>
    9.  * Represents a singular message with a Player talking.
    10.  */
    11. publicclass PlayerMessage implements Message {
    12.  
    13.     privatefinal Expression expression;
    14.     privatefinalString[] message;
    15.  
    16.     public PlayerMessage(Expression expression, String... message){
    17.         this.expression= expression;
    18.         this.message= message;
    19.     }
    20.  
    21.     @Override
    22.     publicvoid executeAction(){
    23.     }
    24.  
    25.     /**
    26.      * DO NOT OVERRIDE
    27.      */
    28.     @Override
    29.     publicvoid display(Player player){
    30.         StringBuilder builder =new StringBuilder();
    31.         for(String line : message){
    32.             builder.append(" ").append(line);
    33.         }
    34.         String text = builder.toString();
    35.         player.getInterfaceManager().sendChatBoxInterface(1191);
    36.         player.getPackets().sendIComponentText(1191, 8, player.getDisplayName());
    37.         player.getPackets().sendIComponentText(1191, 17, text);
    38.         player.getPackets().sendPlayerOnIComponent(1191, 15);
    39.         player.getPackets().sendIComponentAnimation(expression.getId(), 1191, 15);
    40.     }
    41.  
    42.     /**
    43.      * Should I just do this with a boolean?
    44.      */
    45.     publicclass NonContinuable extends PlayerMessage {
    46.  
    47.         public NonContinuable(Expression expression, String... message){
    48.             super(expression, message);
    49.         }
    50.  
    51.         /**
    52.          * DO NOT OVERRIDE
    53.          */
    54.         @Override
    55.         publicvoid display(Player player){
    56.             StringBuilder builder =new StringBuilder();
    57.             for(String line : message){
    58.                 builder.append(" ").append(line);
    59.             }
    60.             String text = builder.toString();
    61.             player.getInterfaceManager().replaceRealChatBoxInterface(1192);
    62.             player.getPackets().sendIComponentText(1192, 16, player.getDisplayName());
    63.             player.getPackets().sendIComponentText(1192, 12, text);
    64.             player.getPackets().sendPlayerOnIComponent(1192, 11);
    65.             player.getPackets().sendIComponentAnimation(expression.getId(), 1192, 11);
    66.         }
    67.     }
    68. }
    69.  
    NPCMessage
    Code: Java
    1. packagecom.rs.game.player.dialogues.test.message;
    2.  
    3. importcom.rs.cache.loaders.NPCDefinitions;
    4. importcom.rs.game.player.Player;
    5. importcom.rs.game.player.dialogues.test.Expression;
    6.  
    7. /**
    8.  * Created by Arham 4 on 2/15/2016.
    9.  * <p>
    10.  * Represents a singular message with an NPC talking.
    11.  */
    12. publicclass NPCMessage implements Message {
    13.  
    14.     privatefinal Expression expression;
    15.     privatefinalint npcId;
    16.     privatefinalString[] message;
    17.  
    18.     public NPCMessage(int npcId, Expression expression, String... message){
    19.         this.npcId= npcId;
    20.         this.expression= expression;
    21.         this.message= message;
    22.     }
    23.  
    24.     @Override
    25.     publicvoid executeAction(){
    26.     }
    27.  
    28.     /**
    29.      * DO NOT OVERRIDE
    30.      */
    31.     @Override
    32.     publicvoid display(Player player){
    33.         StringBuilder builder =new StringBuilder();
    34.         for(String line : message){
    35.             builder.append(" ").append(line);
    36.         }
    37.         String text = builder.toString();
    38.         player.getInterfaceManager().sendChatBoxInterface(1184);
    39.         player.getPackets().sendIComponentText(1184, 17, NPCDefinitions.getNPCDefinitions(npcId).getName());
    40.         player.getPackets().sendIComponentText(1184, 13, text);
    41.         player.getPackets().sendNPCOnIComponent(1184, 11, npcId);
    42.         player.getPackets().sendIComponentAnimation(expression.getId(), 1184, 11);
    43.     }
    44.  
    45.     /**
    46.      * Should I just do this with a boolean?
    47.      */
    48.     publicclass NonContinuable extends NPCMessage {
    49.  
    50.         public NonContinuable(int npcId, Expression expression, String... message){
    51.             super(npcId, expression, message);
    52.         }
    53.  
    54.         /**
    55.          * DO NOT OVERRIDE
    56.          */
    57.         @Override
    58.         publicvoid display(Player player){
    59.             StringBuilder builder =new StringBuilder();
    60.             for(String line : message){
    61.                 builder.append(" ").append(line);
    62.             }
    63.             String text = builder.toString();
    64.             player.getInterfaceManager().replaceRealChatBoxInterface(1192);
    65.             player.getPackets().sendIComponentText(1192, 16, NPCDefinitions.getNPCDefinitions(npcId).getName());
    66.             player.getPackets().sendIComponentText(1192, 12, text);
    67.             player.getPackets().sendEntityOnIComponent(false, npcId, 1192, 11);
    68.             player.getPackets().sendIComponentAnimation(expression.getId(), 1192, 11);
    69.         }
    70.     }
    71. }
    72.  
    ItemMessage
    Code: Java
    1. packagecom.rs.game.player.dialogues.test.message;
    2.  
    3. importcom.rs.game.item.Item;
    4. importcom.rs.game.player.Player;
    5.  
    6. /**
    7.  * Created by Arham 4 on 2/15/2016.
    8.  * <p>
    9.  * Represents a singular message with an Item in it.
    10.  */
    11. publicclass ItemMessage implements Message {
    12.  
    13.     privatefinal Item item;
    14.     privatefinalString[] message;
    15.  
    16.     public ItemMessage(Item item, String... message){
    17.         this.item= item;
    18.         this.message= message;
    19.     }
    20.  
    21.     @Override
    22.     publicvoid executeAction(){
    23.     }
    24.  
    25.     /**
    26.      * DO NOT OVERRIDE
    27.      */
    28.     @Override
    29.     publicvoid display(Player player){
    30.         StringBuilder builder =new StringBuilder();
    31.         for(String line : message){
    32.             builder.append(" ").append(line);
    33.         }
    34.         String text = builder.toString();
    35.         player.getInterfaceManager().sendChatBoxInterface(1189);
    36.         player.getPackets().sendItemOnIComponent(1189, 1, item.getId(), item.getAmount());
    37.         player.getPackets().sendIComponentText(1189, 4, text);
    38.     }
    39.  
    40.     /**
    41.      * Should I just do this with a boolean?
    42.      */
    43.     publicclass NonContinuable extends ItemMessage {
    44.  
    45.         public NonContinuable(Item item, String... message){
    46.             super(item, message);
    47.         }
    48.  
    49.         /**
    50.          * DO NOT OVERRIDE
    51.          */
    52.         @Override
    53.         publicvoid display(Player player){
    54.             StringBuilder builder =new StringBuilder();
    55.             for(String line : message){
    56.                 builder.append(" ").append(line);
    57.             }
    58.             String text = builder.toString();
    59.             player.getInterfaceManager().replaceRealChatBoxInterface(1190);
    60.             player.getPackets().sendItemOnIComponent(1190, 1, item.getId(), item.getAmount());
    61.             player.getPackets().sendIComponentText(1190, 4, text);
    62.         }
    63.     }
    64. }
    65.  
    OptionDialogue
    Code: Java
    1. packagecom.rs.game.player.dialogues.test.message;
    2.  
    3. importcom.rs.game.player.Player;
    4. importlombok.Getter;
    5.  
    6. importjava.util.Arrays;
    7. importjava.util.Collections;
    8. importjava.util.List;
    9.  
    10. /**
    11.  * Created by Arham 4 on 2/15/2016.
    12.  * <p>
    13.  * Represents a singular option dialogue with onClick handling each option.
    14.  */
    15.  
    16. /**
    17.  * I was thinking about maybe even making a SubDialogue class for the option dialogue. Though, I think that's
    18.  * complicating things.
    19.  */
    20. publicabstractclass OptionMessage implements Message {
    21.  
    22.     publicstaticfinalint OPTION_INTERFACE =1188;
    23.     publicstaticfinalString DEFAULT_TITLE ="Select an Option";
    24.  
    25.     privatefinalString title;
    26.     privatefinalString[] options;
    27.  
    28.     public OptionMessage(String title, String... options){
    29.         this.title= title;
    30.         this.options= options;
    31.     }
    32.  
    33.     publicabstractvoid onClick(Option option);
    34.  
    35.     @Override
    36.     publicvoid executeAction(){
    37.     }
    38.  
    39.     /**
    40.      * DO NOT OVERRIDE
    41.      */
    42.     @Override
    43.     publicvoid display(Player player){
    44.         player.getInterfaceManager().sendChatBoxInterface(1188);
    45.         player.getPackets().sendIComponentText(1188, 20, title);
    46.         for(int line =0; line <5; line++){
    47.             if(line < options.length){
    48.                 if(line ==0)
    49.                     player.getPackets().sendIComponentText(1188, 3, options[line]);
    50.                 elseif(line ==1)
    51.                     player.getPackets().sendIComponentText(1188, 24, options[line]);
    52.                 elseif(line ==2)
    53.                     player.getPackets().sendIComponentText(1188, 29, options[line]);
    54.                 elseif(line ==3)
    55.                     player.getPackets().sendIComponentText(1188, 34, options[line]);
    56.                 elseif(line ==4)
    57.                     player.getPackets().sendIComponentText(1188, 39, options[line]);
    58.             }else{
    59.                 if(line ==2){
    60.                     player.getPackets().sendHideIComponent(1188, 14, true);
    61.                 }elseif(line ==3){
    62.                     player.getPackets().sendHideIComponent(1188, 15, true);
    63.                 }elseif(line ==4){
    64.                     player.getPackets().sendHideIComponent(1188, 16, true);
    65.                 }
    66.             }
    67.         }
    68.     }
    69.  
    70.     publicenumOption{
    71.         ONE(11), TWO(13), THREE(14), FOUR(15), FIVE(16);
    72.  
    73.         privatestaticfinal List<Option> VALUES =Collections.unmodifiableList(Arrays.asList(values()));
    74.         @Getter
    75.         privatefinalint componentId;
    76.  
    77.         Option(int componentId){
    78.             this.componentId= componentId;
    79.         }
    80.  
    81.         publicstaticOption getOption(int componentId){
    82.             for(Option option : VALUES){
    83.                 if(option.getComponentId()== componentId){
    84.                     return option;
    85.                 }
    86.             }
    87.             returnnull;
    88.         }
    89.     }
    90. }
    91.  

    Next, make an "impl" package. Here is where all your dialogue will be.

    Integrating the System

    What we're going to be doing next is just a bunch of adding our dialogue system in place of the old one, to allow our system to finish properly and continue the dialogue properly.

    Add the following to Player.java:
    Code: Java
    1. privatetransient DialogueManager testDialogueManager;
    2.  
    We're going to name it testDialogueManager because of the amount of times our current system is called. Be sure to import the right one! Also, my Player class is a @Data class, if its not for you, make the @Getter for this!

    Find the following:
    Code: Java
    1. dialogueManager =new
    2.  
    Below this line, add the following:
    Code: Java
    1. testDialogueManager =new DialogueManager(this);
    2.  
    Errors? Consider doing "com.rs.game.player.dialogue.test.DialogueManager instead of just plain DialogueManager. Do this for the errors later if you see them too.

    Next, go to WorldPacketsDecoder and find the following:
    Code: Java
    1. if(player.getEquipment().wearingArmour()){
    2.  
    Either delete the finishDialogue() method call there or just add the following beneath it:
    Code: Java
    1. player.getTestDialogueManager().finish();
    2.  

    Next, find:
    Code: Java
    1. player.getSkills().setXp(skillId, Skills.getXPForLevel(value));
    Again, either delete finishDialogue() or add below it:
    Code: Java
    1. player.getTestDialogueManager().finish();
    2.  

    Next, find:
    Code: Java
    1. player.getDialogueManager().continueDialogue(interfaceId
    2.  
    And replace it with:
    Code: Java
    1.             if(interfaceId == OptionMessage.OPTION_INTERFACE){
    2.                 player.getTestDialogueManager().onClick(OptionMessage.Option.getOption(componentId));
    3.             }else{
    4.                 player.getTestDialogueManager().next();
    5.             }
    6.  

    The option dialogue is the reason for any bit of complication in this, and you can see its root cause here. Where does the option dialogue continue to? All determined here. Is this a normal dialogue or an option dialogue? *dun dun dun*

    Alright, successfully integrated!

    Example
    Lets use our drunk buddy Hans to show us how this dialogue system works.
    Code: Java
    1. packagecom.rs.game.player.dialogues.test.impl;
    2.  
    3. importcom.rs.game.item.Item;
    4. importcom.rs.game.player.Player;
    5. importcom.rs.game.player.dialogues.test.Dialogue;
    6. importcom.rs.game.player.dialogues.test.Expression;
    7. importcom.rs.game.player.dialogues.test.State;
    8. importcom.rs.game.player.dialogues.test.message.ItemMessage;
    9. importcom.rs.game.player.dialogues.test.message.NPCMessage;
    10. importcom.rs.game.player.dialogues.test.message.OptionMessage;
    11. importcom.rs.game.player.dialogues.test.message.PlayerMessage;
    12. importlombok.NonNull;
    13.  
    14. importjava.util.HashMap;
    15.  
    16. /**
    17.  * Created by Arham 4 on 2/15/2016.
    18.  * <p>
    19.  * Sample dialogue for the new dialogue system.
    20.  */
    21. publicclass Hans extends Dialogue {
    22.  
    23.     privatefinalint npcId;
    24.  
    25.     public Hans(Player player, int npcId){
    26.         super(player, new HashMap<>());
    27.         this.npcId= npcId;
    28.     }
    29.  
    30.     @Override
    31.     publicvoid buildDialogue(){
    32.         dialogue.put(1, new PlayerMessage(Expression.HAPPY, "Hi!"));
    33.         dialogue.put(2, new NPCMessage(npcId, Expression.WEE_DRUNK, "Wassup ma nigga"));
    34.         dialogue.put(3, new PlayerMessage(Expression.QUESTION, "Umm, nothing much?"));
    35.         dialogue.put(4, new NPCMessage(npcId, Expression.WEE_DRUNK, "Wanna be my.. friend..?"));
    36.         dialogue.put(5, new OptionMessage(OptionMessage.DEFAULT_TITLE, "Wtf man?", "Yess!!, I need friends!!"){
    37.             /**
    38.              * After seeing this, I feel that onClick could be simplified into something, just what?
    39.              */
    40.             @Override
    41.             publicvoid onClick(@NonNull Option option){
    42.                 switch(option){
    43.                     case ONE:
    44.                         setKey(6);
    45.                         break;
    46.                     case TWO:
    47.                         setKey(12);
    48.                         break;
    49.                 }
    50.             }
    51.         });
    52.         dialogue.put(6, new PlayerMessage(Expression.ANGRY, "Wtf man?"));
    53.         dialogue.put(7, new NPCMessage(npcId, Expression.WEE_DRUNK, "Idk man, I'm drunk.."));
    54.         dialogue.put(8, new PlayerMessage(Expression.GET_OFF_MY_LAWN, "Just, stop."));
    55.         dialogue.put(9, new NPCMessage(npcId, Expression.WEE_DRUNK, "Take some money?"));
    56.         /*
    57.          * I wanted to use the val type that Lombok provides, but there's a glitch with it which makes the enum spit out
    58.          * "cannot call super method in enumeration" even though the val variable is all the way here and the enum is
    59.          * in the OptionMessage? So stupid... Oh well.
    60.          */
    61.         final Item money =new Item(995, 20000);
    62.         dialogue.put(10, new ItemMessage(money, "The man gives you some money."){
    63.             @Override
    64.             publicvoid executeAction(){
    65.                 getPlayer().getInventory().addItem(money);
    66.             }
    67.         });
    68.         dialogue.put(11, new PlayerMessage(Expression.HAPPY_EYEBROWS, "Omg thank u!!!"){
    69.             @Override
    70.             publicvoid executeAction(){
    71.                 state = State.NOT_TALKING;
    72.             }
    73.         });
    74.         dialogue.put(12, new PlayerMessage(Expression.HAPPY_EYEBROWS, "Yess!!, I need friends!!"));
    75.         dialogue.put(13, new NPCMessage(npcId, Expression.HAPPY_EYEBROWS, "YAYYYYY!"));
    76.     }
    77. }
    78.  
    And in NPCHandler's handleOption1():
    Code: Java
    1.                 if(npc.getId()==0){
    2.                     player.getTestDialogueManager().start(new Hans(player, npc.getId()));
    3.                 }
    4.  

    As you can see, you can summarize a lot of functions pretty concisely.



    - Arham

    2
    Server Tutorials / Border/Boundary System + Weather Implementation
    « on: December 22, 2015, 12:08:01 AM »

    What a bored Arham does when he has no computer but is in the programming mood. <click image for full size>

    So recently I've been wanting to add a Boundary system that would allow us to mark some regions and make only members be able to walk on it (rather than the typical "donator island"). Then I figured I'd extend the system to be able to support Weather when I began to re-read the interesting thread we had here a year back. Thus, came this.


    My request from you...

    Provide some feedback to the code. I know alot of the places where the code is quite bad or uses too much memory, but I simply don't know how to make it better, so offer your suggestions!

    *Keep note, the base used is Hyperion, so other bases will need a little bit of modifications for this to work.*

    First, lets make the JSON file. Put this in the directory you see fit.
    Code: Text
    1. [
    2.   {
    3.     "identification": "Lumbridge",
    4.     "topRightLocation": {
    5.       "x": 3244,
    6.       "y": 3308,
    7.       "z": 0
    8.     },
    9.     "bottomLeftLocation": {
    10.       "x": 3150,
    11.       "y": 3197,
    12.       "z": 0
    13.     },
    14.     "premiumOnly": false,
    15.     "staticWeather": false
    16.   }
    17. ]
    18.  
    Name this file borders.json

    This is our data. The data is quite straightforward; you identify the region both as an ease of use to you and also to extend if you'd like to later on. The top right and bottom left locations are the primary "borders" of the area. The premiumOnly boolean is if this is only for donators. And the staticWeather is for our weather system, which basically if set to true will never change the weather of a boundary.

    Make a new package called border in wherever the entities are. There, make BorderManager.java and add this.
    Code: Java
    1. packageorg.hyperion.rs2.model.border;
    2.  
    3. importcom.google.gson.*;
    4. importorg.hyperion.rs2.model.Location;
    5. importorg.hyperion.rs2.model.Player;
    6.  
    7. importjava.io.File;
    8. importjava.io.FileNotFoundException;
    9. importjava.io.FileReader;
    10. importjava.util.ArrayList;
    11. importjava.util.List;
    12. importjava.util.Random;
    13. importjava.util.logging.Logger;
    14.  
    15. /**
    16.  * Created by Arham on 12/21/2015.
    17.  */
    18. publicclass BorderManager {
    19.  
    20.     /**
    21.      * The logger for this class.
    22.      */
    23.     privatestaticfinal Logger logger = Logger.getLogger(BorderManager.class.getName());
    24.  
    25.     /**
    26.      * All the borders.
    27.      */
    28.     privatestatic List<Border> borderList =new ArrayList<>();
    29.  
    30.     /**
    31.      * Loads borders from the borders.json file.
    32.      */
    33.     publicstaticvoid loadBorders(){
    34.         JsonParser parser =new JsonParser();
    35.         try{
    36.             JsonArray array =(JsonArray) parser.parse(newFileReader(newFile("./data/player/borders.json")));
    37.             final Gson builder =new GsonBuilder().create();
    38.  
    39.             for(int i =0; i < array.size(); i++){
    40.                 JsonObject reader =(JsonObject) array.get(i);
    41.  
    42.                 String identification = reader.get("identification").getAsString();
    43.                 Location topRightLocation = builder.fromJson(reader.get("topRightLocation").getAsJsonObject(), Location.class);
    44.                 Location bottomLeftLocation = builder.fromJson(reader.get("bottomLeftLocation").getAsJsonObject(), Location.class);
    45.                 boolean premiumOnly = reader.get("premiumOnly").getAsBoolean();
    46.                 boolean staticWeather = reader.get("staticWeather").getAsBoolean();
    47.  
    48.                 Border border =newBorder(identification, topRightLocation, bottomLeftLocation, premiumOnly, staticWeather);
    49.                 borderList.add(border);
    50.             }
    51.  
    52.             logger.info("Successfully loaded "+ array.size()+" borders.");
    53.         }catch(JsonIOException | JsonSyntaxException |FileNotFoundException e){
    54.             e.printStackTrace();
    55.         }
    56.     }
    57.  
    58.     /**
    59.      * Handles the actions to be done when walking.
    60.      *
    61.      * @param player      The Player who walked.
    62.      * @param endLocation Where the player is walking to.
    63.      * @return If the player is allowed to walk.
    64.      */
    65.     publicstaticboolean onWalk(Player player, Location endLocation){
    66.         for(Border border : borderList)
    67.             if(border.isInBorder(player.getLocation()))
    68.                 return border.onWalk(player, endLocation);
    69.         returntrue;
    70.     }
    71.  
    72.     /**
    73.      * Gets all the borders in the List.
    74.      *
    75.      * @return the borders
    76.      */
    77.     publicstatic List<Border> getBorderList(){
    78.         return borderList;
    79.     }
    80.  
    81.     /**
    82.      * Generates a random weather pattern to assign to a border.
    83.      *
    84.      * @return A random weather pattern.
    85.      */
    86.     publicstatic Weather getRandomWeather(){
    87.         return Weather.values()[newRandom().nextInt(Weather.values().length-1)];
    88.     }
    89.  
    90.     /**
    91.      * Checks if the location is in the border.
    92.      *
    93.      * @param location The location to check.
    94.      * @return if the location is in the border.
    95.      */
    96.     publicstaticboolean isInBorder(Location location){
    97.         boolean inBorder =false;
    98.         for(Border border : borderList)
    99.             if(border.isInBorder(location))
    100.                 inBorder =true;
    101.         return inBorder;
    102.     }
    103.  
    104.     /**
    105.      * Handles the measures to take when somebody does soemthing like walk in the border.
    106.      *
    107.      * @param player The "somebody"
    108.      * @param x      What X coordinate are they at, or going to?
    109.      * @param y      What Y coordinate are they at, or going to?
    110.      * @return Sent for the walking, to say if the player can walk in the border.
    111.      */
    112.     publicstaticboolean handleWorldAction(Player player, int x, int y){
    113.         if(!BorderManager.isInBorder(player.getLocation())){
    114.             player.getActionSender().sendWalkableInterface(-1);
    115.         }else{
    116.             if(!BorderManager.onWalk(player, Location.create(x, y, player.getLocation().getZ()))){
    117.                 returnfalse;
    118.             }
    119.         }
    120.         returntrue;
    121.     }
    122. }
    123.  

    This right here not only loads our data, but also holds the new borders made from the data and also handles all the reaction within the border. To keep this anonymous, rather than forcing the user to extend every border, a lot of repetition is done.

    Next, in the same package, make Border.java and add this in it.
    Code: Java
    1. packageorg.hyperion.rs2.model.border;
    2.  
    3. importorg.hyperion.rs2.model.Location;
    4. importorg.hyperion.rs2.model.Player;
    5. importorg.hyperion.util.Debugger;
    6.  
    7. importjava.util.ArrayList;
    8. importjava.util.List;
    9.  
    10. /**
    11.  * Created by Arham on 12/21/2015.
    12.  */
    13. publicclassBorder{
    14.  
    15.     /**
    16.      * What identifies the, otherwise, anonymous Border.
    17.      */
    18.     privateString identification;
    19.  
    20.     /**
    21.      * The two primary border locations.
    22.      */
    23.     private Location topRightLocation, bottomLeftLocation;
    24.  
    25.     /**
    26.      * The configurations for the Border.
    27.      */
    28.     privateboolean premiumOnly, staticWeather;
    29.  
    30.     /**
    31.      * The weather within the Border.
    32.      */
    33.     private Weather weather = Weather.SUNNY;
    34.  
    35.     /**
    36.      * The players within the Border.
    37.      */
    38.     private List<Player> playersInBorder =new ArrayList<>();
    39.  
    40.     /**
    41.      * Represents a single Border.
    42.      */
    43.     publicBorder(String identification, Location topRightLocation, Location bottomLeftLocation, boolean premiumOnly, boolean staticWeather){
    44.         this.identification= identification;
    45.         this.topRightLocation= topRightLocation;
    46.         this.bottomLeftLocation= bottomLeftLocation;
    47.         this.premiumOnly= premiumOnly;
    48.         this.staticWeather= staticWeather;
    49.     }
    50.  
    51.     /**
    52.      * What the Border does when somebody walks. This is the actual functionality of the BorderManager.onWalk() boolean.
    53.      *
    54.      * @param player      The Player walking.
    55.      * @param endLocation Where the Player is walking to.
    56.      * @return If the Player can walk.
    57.      */
    58.     publicboolean onWalk(Player player, Location endLocation){
    59.         boolean inBorderList =false;
    60.         for(Player playerInBorder : playersInBorder)
    61.             if(playerInBorder.getClientIndex()== player.getClientIndex())
    62.                 inBorderList =true;
    63.         if(!inBorderList){
    64.             playersInBorder.add(player);
    65.             Debugger.println("Added new player, "+ player.getName()+", to "+ identification +".");
    66.         }
    67.         if(!staticWeather){
    68.             switch(weather){
    69.                 case SNOWY:
    70.                     player.getActionSender().sendWalkableInterface(11877);
    71.                     Debugger.println("Snowy walkable interface initiated.");
    72.                     break;
    73.                 case RAINY:
    74.                     //TODO
    75.                     player.getActionSender().sendWalkableInterface(-1);
    76.                     Debugger.println("Rainy walkable interface initiated.");
    77.                     break;
    78.                 case SUNNY:
    79.                     player.getActionSender().sendWalkableInterface(-1);
    80.                     Debugger.println("Sunny walkable interface initiated.");
    81.                     break;
    82.             }
    83.         }
    84.         if(!isInBorder(endLocation)){
    85.             playersInBorder.remove(player);
    86.             Debugger.println("Removed player, "+ player.getName()+", from "+ identification +".");
    87.         }
    88.         return!premiumOnly;
    89.     }
    90.  
    91.     /**
    92.      * Checks if the Location is in the Border. This is the actual functionality of the BorderManager.isInBorder() boolean.
    93.      *
    94.      * @param compare The location to check.
    95.      * @return if the Location is in the Border.
    96.      */
    97.     publicboolean isInBorder(Location compare){
    98.         return compare.getX()>= getBottomLeftLocation().getX()&& compare.getX()<= getTopRightLocation().getX()&& compare.getY()>= getBottomLeftLocation().getY()&& compare.getY()<= getTopRightLocation().getY();
    99.     }
    100.  
    101.     /**
    102.      * Sets the Weather of the Border via WeatherTask.
    103.      *
    104.      * @param weather The Weather the Border is being set to.
    105.      */
    106.     publicvoid setWeather(Weather weather){
    107.         this.weather= weather;
    108.     }
    109.  
    110.     public Location getTopRightLocation(){
    111.         return topRightLocation;
    112.     }
    113.  
    114.     public Location getBottomLeftLocation(){
    115.         return bottomLeftLocation;
    116.     }
    117.  
    118.     public List<Player> getPlayersInBorder(){
    119.         return playersInBorder;
    120.     }
    121. }
    122.  

    This is one of your data in borders.json that is constructed to be a fully functional boundary in the game that is configurable. The onWalk boolean is what is the main "action" part of this, as it, based on the randomly assigned weather, sends the appropriate visual affect of the border, as well as marking the player as "in the border" and "out the border."


    Next, the weather system that extends this.

    In the same package, make Weather.java and add this in it:
    Code: Java
    1. packageorg.hyperion.rs2.model.border;
    2.  
    3. /**
    4.  * Created by Arham on 12/21/2015.
    5.  * <p>
    6.  * The weather patterns.
    7.  */
    8. publicenum Weather {
    9.     SNOWY, RAINY, SUNNY
    10. }
    11.  
    This is the weather patterns in the server. Remember onWalk in Boundary? Yeah, the switch statement uses the values in this enum.

    Now, go to your event manager and make a new event. Name it WeatherEvent.java and add this in it:
    Code: Java
    1. packageorg.hyperion.rs2.event.impl;
    2.  
    3. importorg.hyperion.rs2.Constants;
    4. importorg.hyperion.rs2.event.Event;
    5. importorg.hyperion.rs2.model.World;
    6. importorg.hyperion.rs2.task.impl.AutoSaveTask;
    7. importorg.hyperion.rs2.task.impl.WeatherTask;
    8.  
    9. /**
    10.  * Automatically assigns all the borders a new weather.
    11.  * @author Arham 4
    12.  */
    13. publicclass WeatherEvent extendsEvent{
    14.  
    15.     /**
    16.      * The delay in milliseconds between save. Currently set at 5 minutes. 1
    17.      * second = 1,000 milliseconds.
    18.      */
    19.     publicstaticfinalint WEATHER_CYCLE_TIME = Constants.DEBUG?30000:1800000;
    20.  
    21.     /**
    22.      * Creates the auto save event to run every 5 minutes.
    23.      */
    24.     public WeatherEvent(){
    25.         super(WEATHER_CYCLE_TIME);
    26.     }
    27.  
    28.     @Override
    29.     publicvoid execute(){
    30.         World.getWorld().submit(new WeatherTask());
    31.     }
    32. }
    33.  

    This event initializes the task to reassign the world's weather.

    In your task system, make a new file called WeatherTask.java and add this in it:
    Code: Java
    1. packageorg.hyperion.rs2.task.impl;
    2.  
    3. importorg.hyperion.rs2.GameEngine;
    4. importorg.hyperion.rs2.model.Player;
    5. importorg.hyperion.rs2.model.World;
    6. importorg.hyperion.rs2.model.border.Border;
    7. importorg.hyperion.rs2.model.border.BorderManager;
    8. importorg.hyperion.rs2.model.border.Weather;
    9. importorg.hyperion.rs2.task.Task;
    10. importorg.hyperion.util.Debugger;
    11.  
    12. /**
    13.  * Changes all the borders' weather.
    14.  *
    15.  * @author Arham 4
    16.  */
    17. publicclass WeatherTask implements Task {
    18.  
    19.     @Override
    20.     publicvoid execute(GameEngine context){
    21.         context.submitWork(()->{
    22.             for(Border border : BorderManager.getBorderList()){
    23.                 Weather weather = BorderManager.getRandomWeather();
    24.                 border.setWeather(weather);
    25.                 for(Player playerInBorder : border.getPlayersInBorder()){
    26.                     BorderManager.handleWorldAction(playerInBorder, playerInBorder.getLocation().getX(), playerInBorder.getLocation().getY());
    27.                 }
    28.                 Debugger.println(weather.toString());
    29.             }
    30.         });
    31.     }
    32.  
    33. }
    34.  
    This loops through all the borders in the game and reassigns the weather, then fetches the players in the border and initializes the infamous handleWorldAction() method.


    Adding functionality to the system.

    Get used to the handleWorldAction() method, you'll be seeing it a lot. Its function is just as the method comment says:
    Code: Java
    1.     /**
    2.      * Handles the measures to take when somebody does soemthing like walk in the border.
    3.      *
    4.      * @param player The "somebody"
    5.      * @param x      What X coordinate are they at, or going to?
    6.      * @param y      What Y coordinate are they at, or going to?
    7.      * @return Sent for the walking, to say if the player can walk in the border.
    8.      */
    9.  

    Wherever you handle logging in and assigning the variables (like sending the map region), add this:
    Code: Java
    1.                         BorderManager.handleWorldAction(player, player.getLocation().getX(), player.getLocation().getY());
    2.  
    Wherever walking is handled, add this when the data is read, but before it is being used:
    Code: Java
    1.                 if(!BorderManager.handleWorldAction(player, firstX, firstY))
    2.                         return;
    3.  

    Yay for functionality!!





    TODO:
    • Make this "extensible."
    • Make an onLogin() method which transfers the user back to default spawn location if they are in a region that is premium-only.
    • Make the premium rank actually corrispond in the onWalk boolean.
    • Is there a raining interface at all?
    • Make a custom packet send to change the floor terrain of the border.
    • Day and Night?
    • Make the actions as stated in the original idea for the weather system functional (i.e. more fish on rainy days, less wood on snowy days).
    • Decouple the walking from the border system.
    • Make each "extenction" of the system independent (as in, not need to assign staticWeather on each entry for borders.json)
    That's all I can think of right now.



    - Arham

    3
    Off-Topic (Spam) / Shut up
    « on: November 29, 2015, 05:59:14 PM »
    Welcome to Moparscape, allow me to introduce you around. Those whom have commented regarding the 'ugliness' of your progress are all you will see around here. People do not bother congratulating on your abilities to achieve task. This is the reason this community is dying by the day. I come here for a day to see if something has changed and all have remained the same. You deserve some positive feedback. It may not look exactly right, as it's a bit off, but the fact you've put effort into adding it is noteworthy. Keep it up!
    shutup

    Oh and here comes the douchebag with the ability to act above everyone else.
    shutup
    My turn  :|
    Shut up


    Shut up.

    shut up

    Shut up

    Shut up.

    shut up

    shut up

    Shut up.

    Shut up

    4
    [/URL]

    ^ Click above for source code (Git) ^

    Admit it; the RSPS scene has become a bit dry now-a-days.* We are becoming more of an emulation if anything. So the purpose of this? I shall keep this thread simple and to the point, two simple points:

    • An introduction to new ideas for RSPS.
    • An idea for implementation of these new ideas.
    Sui Generis plans to fully utilize Git and the features BitBucket offers[/url] through Wiki documentation for ideas held within the source code[/url], issue tracking to know what bugs are present, as well as propose new ideas to the server[/url], and the basic commits which shall allow a user to find the specifications for adding a certain content by clicking the commit ID[/url].

    Sui Generis is not a server that is going to be hosted.

    Features Ready for Implementation
    • Sui Generis Wiki / Global Dueling[/url]
    Have an idea? Click to drop it down in the  section![/url]

    (click to show/hide)

    Swiffy - Using Ruse so I don't have to worry about adding generic content, rather I can just focus on the unique I want to add.
    Brandyn - Stole his thread layout because banned.
    w/e companies logo I stole - because fudge making my own.

    Hope I can get some motivation for this project.

    Actually.. go! Comment right now with that quick reply box some motivation! This is being done for you, so do it!

    5


    You got this Sini (and others)!

    6
    Off-Topic (Spam) / /thread
    « on: July 29, 2015, 12:51:28 PM »
    Who's gonna end the thread?

    /thread

    7
    Decided to ask here because mopar generally tends to have smarter people lol.



    How does this work? I have heard that RuneScape supports only MIDI files, but this song has lyrics and has real instruments, so how is this working?

    This song is in 718+.
    ID: 1034
    Location: 3443, 3162, 0

    Hope I get informative responses!



    EDIT:

    This also has the same.

    ID: 1108

    8
    Server and Client Development Showoff / Zamorakian Falador
    « on: July 19, 2015, 08:27:14 PM »
    Repost of a thread in Rune-Server.

    Quote


    (click to show/hide)

    This was a project I've been developing for a lot of time. Kept on staying up really late nights to get this done for Turmoil[/URL] as their project is being released to join very soon.

    Considering Saradomin is known to be looked over Falador, what if Zamorak took it over?
    This is what it I based the newer Falador on, isolating the elements of Zamorak, without making it look like a Tzhaar area.

    Note:
    • Some objects such as banners, standards, wall objects haven't been replaced by me. They will be done so by Turmoil and Zeref at a later stage.
    • The unique aspects of this area such as the floor changes and such are only subject to the area of Falador, nowhere else. It works on a per region basis and uses custom overlays/underlays.
    • No client or server sided coding was used.
    • No terrain map editing tools were used (none are available for this revision)
    • The project consisted of re-making over 120 Object Models across types 1-22 (mainly wall type, there's so many!)
    • The area has a dark red ambiance. So like how draynor and a night clan citadel have a dark blue ambiance and a nighttime look/feel, Zamorakian Falador has a dark red ambiance. This causes all assets to have a slightly red tinge to it, including the terrain. It is probably more visible in-game.


    (click to show/hide)


    (click to show/hide)


    (click to show/hide)



    (click to show/hide)


    9

    Special thanks to iRize for this. Syber had made the "Turmoil" text and the background light, however this image is designed based off of ZafireHD[/url]'s WowMystery logo.

    Information
    Name: Turmoil
    Revision: 718
    Sort: Economy
    EXP rate: 50x

    Website: Turmoil | RSPS[/url]
    Play Now: Turmoil | RSPS

    Current Stage:
    Developmental Stage
    Closed Beta (June 6th)
    Official Release (July 11th)

    =1

    Development Team
    Turmoil - Owner, Founder, Programmer
    Arham 4 - Owner, Founder, Programmer

    Development Log
    Latest update: Turmoil now features Ironman mode!
    Code: [Select]
    On August 13th, 2015, Ironman mode and its hardcore counterpart was added to Turmoil.
    On August 10th, 2015, Skeletal Wyverns were made accessible.
    On August 6th, 2015, new TokHaar capes were implemented in-game. Now there were 2 counter-parts added: Xil and Mej.
    On August 6th, 2015, new master cape designs were implemented in-game.
    On August 6th, 2015, auras were removed from being dropped on death.
    On August 5th, 2015, the twisted bird necklace and split dragontooth necklaces' effects worked.
    On August 4th, 2015, new premium capes were added in-game.
    On August 4th, 2015, Obsidian arsenal and Berserker Necklace bonuses were added
    On August 4th, 2015, godwars was revamped to have killcounts working.
    On August 3rd, 2015, completionist cape requirements were revamped.
    On August 1st, 2015, more info was added in to task tab.
    On August 1st, 2015, the superheat, alchemy, and enchanting spells were added.
    On August 1st, 2015, the ring of slaying was added.
    On August 1st, 2015, the notorious bug related to dragonfire was fixed.
    On August 1st, 2015, brawling gloves and pendents gave a 5% boost in skilling.
    On August 1st, 2015, Blinks drops were stabilized.
    On August 1st, 2015, women/men were added to dance along with you in skillcape emotes.
    On August 1st, 2015, Fight Kiln was fixed.
    On August 1st, 2015, Master capes could do skillcape emotes.
    On July 31st, 2015, a store system was added to Turmoil.
    On July 31st, 2015, a vote system was added to Turmoil.
    On July 25th, 2015, Construction was temporarily disabled.
    On July 25th, 2015, the option to pick up pets were added.
    On July 25th, 2015, the Hunger Games were temporarily disabled.
    On July 25th, 2015, boss pets were added to the game.
    On July 24th, 2015, 50% of construction was added.
    On July 23rd, 2015, the slayer shop was added.
    On July 23rd, 2015, the notorious "money pouch" glitch was fixed. Now people could buy item via money pouch again.
    On July 21st, 2015, the zookeeper was added with Penguin rewards.
    On July 21st, 2015, staffs became 1 handed.
    On July 21st, 2015, Puro Puro was added to Turmoil.
    On July 21st, 2015, a new Hunter system was added to Turmoil!
    On July 21st, 2015, a new Slayer system was added to Turmoil!
    On July 18th, 2015, the Ecto-Tokens shop was added to Turmoil.
    On July 16th, 2015, clan chat was functional.
    On July 16th, 2015, bonus points were now given to players when the cap of 5 players was breached in the trivia.
    On July 16th, 2015, an AFK timer was added.
    On July 14th, 2015, the npcname, npcid, dropname, and dropid commands were added, allowing players to look up drops.
    On July 14th, 2015, the drops of Vorago were fixed.
    On July 14th, 2015, the floors of Falador became bloodier.
    On July 13th, 2015, the trivia token shop was added.
    On July 13th, 2015, the requirements of the max cape changed from 200m to 104m.
    On July 12th, 2015, the "Community" chat was founded for all the community to communicate with each other. The friends chat system would now automatically add you to the friends chat you were previously on.
    On July 12th, 2015, multi-logging was removed. The max player limit is now 1 account per IP.
    On July 11th, 2015, the Intro the server was re-enabled, with the ability to watch it if you have not done so
    On July 11th, 2015, the Intro to the server was disabled.
    On July 11th, 2015, a player cap was added for 2x exp. Once 20 players were reached, double exp would be active until the player count went below the cap.
    On July 9th, 2015, quick chat support was added.
    On July 9th, 2015, the Shooting Stars D&D was added to Turmoil!
    On July 9th, 2015, the Sinkholes global event was added to Turmoil!
    On July 9th, 2015, the Penguin Hide and Seek D&D was added to Turmoil!
    On July 9th, 2015, the ability to lose items upon death even through NPC combat was regained.
    On July 9th, 2015, a referral system was added. The referee shall get a golden katana, whilst the referrer shall get 2 crystal keys!
    On July 1st, 2015, a Notes system was added.
    On June 23rd, the Evil Tree was added
    On June 22nd, 2015, the notorious double text at home bug was fixed.
    On June 22nd, 2015, a new Intro for Turmoil was made.
    On June 7th, 2015, bank pins were added to Turmoil.
    On June 4th, 2015, various Dungeoneering rewards' effects were added.
    On June 4th, 2015, the Hunger Games minigame was released.
    On June 4th, 2015, Dungeoneering's Horde mode was released.
    On June 3rd, 2015, the notorious "you can't reach that" bug was fixed.
    On June 2nd, 2015, Soul Wars was added to Turmoil!
    On June 2nd, 2015, the Squeal of Fortune was added to Turmoil!
    On June 2nd, 2015, you could bank items by simply selecting it and clicking the bank (item on object)
    On June 1st, 2015, Turmoil featured a custom launcher!
    On May 26th, 2015, XP/level tracking and goal setting was added
    On May 26th, 2015, the Warriors Guild was added.
    On May 19th, 2015, the Mudskipper was added as an add-on to Fishing.
    On May 19th, 2015, Slagilith was added as an add-on to Mining.
    On May 17th, 2015, the mod finder system was added.
    On May 17th, 2015, the On-Spot dueling system was added. Players could duel anywhere, anytime!
    On April 16th, 2015, the Rise of Six minigame was added!
    On March 2nd, 2015, custom titles, colors, and yell titles were added for members.
    On March 2nd, 2015, Turmoil featured a vote reminder interface.
    On February 28th, 2015, Turmoil features sheathed weapons and kite shields.
    On February 28th, 2015, Turmoil featured off-hand weapons!
    On February 22nd, 2015, Turmoil featured crystal chest rewards.
    On February 13th, 2015, Turmoil features the Fist of Guthix minigame!
    On February 2nd, 2015, Turmoil features loot beams.
    On January 21st, 2015, Turmoil featured zooming the client screen by the mouse wheel.
    On January 15th, 2015, Turmoil featured the Dwarf multi-cannon.
    On January 6th, 2015, Turmoil added Solomon's teleports for members.
    On January 5th, 2015, Turmoil featured effigies.
    On January 5th, 2015, Turmoil featured experience lamps.
    On January 5th, 2015, Turmoil featured skill-fu animations for members.
    On January 5th, 2015, Turmoil featured the full farming skill!
    On December 29th, 2014, Turmoil featured a bar system where the pub in Falador would have pub fights and refills for customers!
    We have done 88 updates!

    Media
    A summary:





    (click to show/hide)

    Support
    Looking to support us? Do so by copy and pasting this to your signature!
    (click to show/hide)

    10
    Off-Topic (Spam) / What is love
    « on: December 08, 2014, 07:30:40 AM »
    What is it

    11
    Off-Topic (Spam) / No Subject
    « on: September 14, 2014, 11:20:50 AM »
    tomistan
    moparisthebestistan
    pakistan

    omg, it all makes sense now

    12
    Snippets / Referral System
    « on: August 16, 2014, 12:52:11 PM »
    Quote
    Refer your friends to get 2 mystery boxes for yourself and your friend gets one! Here's how it works:

    1. You get a new 10 digit referral code.

    Interested in how its generated? Here ya go!
    Code: [Select]
        private void generateReferralCode() {
            String[] string = "abcdefghijklmnopqrstuvwxyz0123456789".split("");
            String code = "";
            for (int i = 0; i < 10; i++) {
                code = code + string[Utils.random(0, string.length - 1)];
            }
            if (!checkReferralCode(code)) {
                generateReferralCode();
                return;
            }
            FileLogger.logData("referralCodes", code + " - " + username);
            referralCode = code;
        }

    2. Tell your friend your code. Wait for them to log in. When they do log in, they'll see something like this (after designing their character):

    3. Tell your friend to put the code in this dialogue box.

    4. Enjoy your gifts!


    Please don't take this as advertising.

    You need this FileLogger system before continuing:
    Code: Java
    1. packagecom.rs.game;
    2.  
    3. importjava.io.File;
    4. importjava.io.FileWriter;
    5. importjava.io.IOException;
    6. importjava.text.SimpleDateFormat;
    7. importjava.util.Date;
    8.  
    9. /**
    10.  * Provides a lightweight external data logger
    11.  *
    12.  * @author Octave
    13.  * @date 2/1/13
    14.  */
    15.  
    16. publicclass FileLogger {
    17.  
    18.     /**
    19.      * Log file path
    20.      */
    21.     privatestaticfinalString FILE_PATH ="./data/logs/";
    22.  
    23.     /**
    24.      * Formats data before appending to log
    25.      *
    26.      * @param file - File to write data to
    27.      * @param data - Data to written
    28.      * @throws IOException
    29.      */
    30.     publicstaticvoid logData(String file, String[] data){
    31.         try{
    32.             writeData(file, formatStringArray(data));
    33.         }catch(Exception e){
    34.             System.out.println("Fatal error while logging Data!");
    35.         }
    36.     }
    37.  
    38.     publicstaticvoid logData(String file, String data){
    39.         try{
    40.             writeData(file, data);
    41.         }catch(Exception e){
    42.             System.out.println("Fatal error while logging Data!");
    43.         }
    44.     }
    45.  
    46.     /**
    47.      * Format string array to proper log syntax
    48.      *
    49.      * @param origin - string to format
    50.      * @return Array to string, formatted
    51.      */
    52.     privatestaticString formatStringArray(String[] origin){
    53.         StringBuffer result =newStringBuffer();
    54.         for(int i =0; i < origin.length; i++){
    55.             result.append(origin[i]+"\t");
    56.         }
    57.         String mynewstring = result.toString();
    58.         return mynewstring;
    59.     }
    60.  
    61.     /**
    62.      * Fetches system time and formats it appropriately
    63.      *
    64.      * @return Formatted time
    65.      */
    66.     privatestaticString getTime(){
    67.         Date getDate =newDate();
    68.         String timeFormat ="M/d/yy hh:mma";
    69.         SimpleDateFormat sdf =newSimpleDateFormat(timeFormat);
    70.         return"["+ sdf.format(getDate)+"]\t";
    71.     }
    72.  
    73.     /**
    74.      * Writes formatted string to text file
    75.      *
    76.      * @param file - File to write data to
    77.      * @param data - Data to written
    78.      * @throws IOException
    79.      */
    80.     privatestaticvoid writeData(String file, String writable)
    81.             throwsIOException{
    82.         FileWriter fw =newFileWriter(FILE_PATH + file +".txt", true);
    83.         try{
    84.             fw.write(getTime()+ writable);
    85.             fw.write("\n");
    86.             fw.close();
    87.         }catch(Exception e){
    88.             fw.write("Error processing data: "+ e);
    89.         }
    90.     }
    91.  
    92.     publicstaticvoid eraseFile(String name){
    93.         try{
    94.             File file =newFile(FILE_PATH + name +".txt");
    95.             file.delete();
    96.             System.out.println(name +" logs automatically cleaned.");
    97.             writeData(name,
    98.                     "\t <----------------- File automatically cleaned ----------------->");
    99.         }catch(Exception e){
    100.             System.out.println("Failed to clean logs.");
    101.         }
    102.     }
    103.  
    104. }

    Also, in the data folder, make a new folder called logs.

    Anyways, in Player.java, add this anywhere:
    Code: Java
    1.     privateString referralCode;
    2.     privateboolean pendingItems;
    3.  
    4.     privatevoid generateReferralCode(){
    5.         String[] string ="abcdefghijklmnopqrstuvwxyz0123456789".split("");
    6.         String code ="";
    7.         for(int i =0; i <10; i++){
    8.             code = code + string[Utils.random(0, string.length-1)];
    9.         }
    10.         if(!checkReferralCode(code)){
    11.             generateReferralCode();
    12.             return;
    13.         }
    14.         FileLogger.logData("referralCodes", code +" - "+ username);
    15.         referralCode = code;
    16.     }
    17.  
    18.     publicboolean checkReferralCode(String code){
    19.         try{
    20.             BufferedReader reader =newBufferedReader(newFileReader("./data/logs/referralCodes.txt"));
    21.             String line =null;
    22.             while((line = reader.readLine())!=null){
    23.                 if(line.contains(code))
    24.                     returnfalse;
    25.             }
    26.         }catch(IOException e){
    27.             e.printStackTrace();
    28.         }
    29.         returntrue;
    30.     }
    31.  
    32.     publicvoid setReferralCode(String referralCode){
    33.         this.referralCode= referralCode;
    34.     }
    35.  
    36.     publicvoid setPendingItems(boolean pendingItems){
    37.         this.pendingItems= pendingItems;
    38.     }

    Now go to the run method and add the following:
    Code: Java
    1.         if(referralCode ==null)
    2.             generateReferralCode();
    3.         if(referralCode !=null)
    4.             getPackets().sendGameMessage("Your referral code is "+ referralCode +".");
    5.         if(pendingItems){
    6.             getPackets().sendGameMessage("You have items waiting for you in the bank.");
    7.             pendingItems =false;
    8.         }

    Now in WHATEVER HANDLES GIVING THE STARTER, add this:
    Code: Java
    1.             getTemporaryAttributtes().put("referralCode", Boolean.TRUE);
    2.             getPackets().sendRunScript(109, newObject[]{"Please enter your referal code (leave blank if not referred)"});

    Great, not in WorldPacketsDecoder, find:
    Code: Java
    1.             }elseif(player.getTemporaryAttributtes().get("titlecolor")==true){
    Above that, add:
    Code: Java
    1.             }elseif(player.getTemporaryAttributtes().get("referralCode")==true){
    2.                 if(value.length()>14){
    3.                     player.getDialogueManager().startDialogue("SimpleMessage", "That is too long for a referral link!");
    4.                 }elseif(!player.checkReferralCode(value)){
    5.                     try{
    6.                         BufferedReader reader =newBufferedReader(newFileReader("./data/logs/referralCodes.txt"));
    7.                         String line =null;
    8.                         while((line = reader.readLine())!=null){
    9.                             if(line.contains(value)){
    10.                                 String args[]= line.split(" - ");
    11.                                 String username = args[1];
    12.                                 Player referrer = World.getPlayer(username);
    13.                                 if(referrer !=null){
    14.                                     if(referrer.getSession().getIP()== player.getSession().getIP()){
    15.                                         player.getDialogueManager().startDialogue("SimpleMessage", "You can't refer yourself!");
    16.                                         return;
    17.                                     }
    18.                                     referrer.getPackets().sendGameMessage("A player has referred under your name! You have been rewarded two mystery boxes!");
    19.                                     if(referrer.getInventory().getFreeSlots()>2){
    20.                                         referrer.getInventory().addItem(new Item(6199, 2));
    21.                                     }else{
    22.                                         referrer.getBank().addItem(6199, 2, true);
    23.                                         referrer.getPackets().sendGameMessage("Unable to find space in your inventory. The mystery boxes have been banked.");
    24.                                     }
    25.                                 }else{
    26.                                     username = Utils.formatPlayerNameForProtocol(username);
    27.                                     if(SerializableFilesManager.containsPlayer(username)){
    28.                                         referrer = SerializableFilesManager.loadPlayer(username);
    29.                                         if(referrer.getLastIP().equals(player.getSession().getIP())){
    30.                                             player.getDialogueManager().startDialogue("SimpleMessage", "You can't refer yourself!");
    31.                                             return;
    32.                                         }
    33.                                         referrer.setUsername(username);
    34.                                         referrer.getInventory().setPlayer(referrer);
    35.                                         if(referrer.getInventory().getFreeSlots()>2){
    36.                                             referrer.getInventory().addItem(new Item(6199, 2), false);
    37.                                         }else{
    38.                                             referrer.getBank().addItem(6199, 2, true);
    39.                                             referrer.setPendingItems(true);
    40.                                         }
    41.                                         SerializableFilesManager.savePlayer(referrer);
    42.                                     }
    43.                                 }
    44.                                 break;
    45.                             }
    46.                         }
    47.                     }catch(IOException e){
    48.                         e.printStackTrace();
    49.                     }
    50.                     player.getInventory().addItem(new Item(6199));
    51.                     player.getDialogueManager().startDialogue("Your referral link is valid! You have received a free mystery box and your friend has received 2!");
    52.                 }else{
    53.                     player.getDialogueManager().startDialogue("SimpleMessage", "That referral code does not exist!");
    54.                 }

    Alright, now in Inventory.java, find:
    Code: Java
    1.     publicboolean addItem(Item item){
    Replace that whole method with this:
    Code: Java
    1.     publicboolean addItem(Item item, boolean refresh){
    2.         if(item.getId()<0
    3.                 || item.getAmount()<0
    4.                 ||!Utils.itemExists(item.getId()))
    5.             returnfalse;
    6.         if(!player.getControlerManager().canAddInventoryItem(
    7.                 item.getId(), item.getAmount()))
    8.             returnfalse;
    9.         Item[] itemsBefore = items.getItemsCopy();
    10.         if(!items.add(item)){
    11.             items.add(new Item(item.getId(), items.getFreeSlots()));
    12.             player.getPackets().sendGameMessage(
    13.                     "Not enough space in your inventory.");
    14.             if(!refresh)
    15.                 refreshItems(itemsBefore, false);
    16.             else
    17.                 refreshItems(itemsBefore);
    18.             returnfalse;
    19.         }
    20.         if(!refresh)
    21.             refreshItems(itemsBefore, false);
    22.         else
    23.             refreshItems(itemsBefore);
    24.         returntrue;
    25.     }
    Then above that method, add:
    Code: Java
    1.     publicboolean addItem(Item item){
    2.         return addItem(item, true);
    3.     }
    Now, find:
    Code: Java
    1.     publicvoid refreshItems(Item[] itemsBefore){
    Replace that whole method with:
    Code: Java
    1.     publicvoid refreshItems(Item[] itemsBefore, boolean refresh){
    2.         int[] changedSlots =newint[itemsBefore.length];
    3.         int count =0;
    4.         for(int index =0; index < itemsBefore.length; index++){
    5.             if(itemsBefore[index]!= items.getItems()[index])
    6.                 changedSlots[count++]= index;
    7.         }
    8.         int[] finalChangedSlots =newint[count];
    9.         System.arraycopy(changedSlots, 0, finalChangedSlots, 0, count);
    10.         if(refresh)
    11.             refresh(finalChangedSlots);
    12.     }
    Now above that method, add:
    Code: Java
    1.     publicvoid refreshItems(Item[] itemsBefore){
    2.         refreshItems(itemsBefore, true);
    3.     }

    And done! Tell me if I needa add anything else. :)

    13
    Snippets / [CONFIG] [718] Point to Sidebar icon/orb config
    « on: August 16, 2014, 12:50:38 PM »
    Was trying to find some new configs. Found this cool hell of a config.





    Code: [Select]
    sendConfig(1021, SIDE_BAR_ICON);

    Since I'm a nice guy, here's all the values you can set this to:
    Code: [Select]
    1 - Combat icon
    2 - Task icon
    3 - Stats icon
    4 - Quests icon
    5 - Inventory icon
    6 - Equipment icon
    7 - Prayer icon
    8 - Spells icon
    9 - Summoning icon
    10 - Friends icon
    11 - Friends chat icon
    12 - Clan chat icon
    13 - Settings icon
    14 - Emotes icon
    15 - Music icon
    16 - Notes icon
    17 - Run orb
    18 - Clears all of them
    19 - World map
    20 - Compass

    Note: Value 0 - 16 can be used with values 17 - 20. here's an example of such:

    Code: [Select]
    sendConfig(1021, 4);
    sendConfig(1021, 17);

    - Arham

    14
    Snippets / [718] A good progress on Big Chompy Bird Hunting
    « on: August 16, 2014, 12:49:50 PM »
    Rantz.java
    Code: Java
    1. packagecom.feather.game.player.dialogues.ogre.city;
    2.  
    3. importcom.feather.game.player.dialogues.Dialogue;
    4. importcom.feather.game.player.dialogues.quests.BigChompyBirdHunting;
    5.  
    6. /**
    7.  * Created by Arham 4 on 8/9/14.
    8.  */
    9. publicclass Rantz extends Dialogue {
    10.     privateint npcId;
    11.     @Override
    12.     publicvoid start(){
    13.         npcId =(int) parameters[0];
    14.         if(!player.startedBigChompyBirdHunting){
    15.             sendNPCDialogue(npcId, 9830, "Hey you creature! Make me some stabbers! I wanna hunt da chompy?");
    16.         }elseif(player.inProgressBigChompyBirdHunting){
    17.             sendNPCDialogue(npcId, 9827, "Hey you creature... Have you made me da stabbers? I wanna stick da chompy?");
    18.             stage =15;
    19.         }
    20.     }
    21.  
    22.     @Override
    23.     publicvoid run(int interfaceId, int componentId){
    24.         switch(stage){
    25.             case-1:
    26.                 sendOptionsDialogue(SEND_DEFAULT_OPTIONS_TITLE, "What are 'stabbers'?", "What's a 'chompy'?", "Ok, I'll make you some 'stabbers'.", "Er, make your own 'stabbers'!");
    27.                 stage =0;
    28.                 break;
    29.             case0:
    30.                 switch(componentId){
    31.                     case OPTION_1:
    32.                         sendPlayerDialogue(9827, "What are stabbers?");
    33.                         stage =1;
    34.                         break;
    35.                     case OPTION_2:
    36.                         sendPlayerDialogue(9827, "What's a 'chompy'?");
    37.                         stage =5;
    38.                         break;
    39.                     case OPTION_3:
    40.                         BigChompyBirdHunting.handleProgressQuest(player);
    41.                         sendPlayerDialogue(9830, "Ok, I'll make you some 'stabbers'.");
    42.                         stage =14;
    43.                         break;
    44.                     case OPTION_4:
    45.                         sendPlayerDialogue(9830, "Er, make your own 'stabbers'!");
    46.                         stage =13;
    47.                         break;
    48.                 }
    49.                 break;
    50.             case1:
    51.                 sendNPCDialogue(npcId, 9830, "For da stabbie chucker, I's wanna hunt da chompy! Creature knows what Rantz wants... ...flyin' to stabbie da chompy!");
    52.                 stage =2;
    53.                 break;
    54.             case2:
    55.                 sendEntityDialogue(IS_ITEM, "", 2883, 1, "The ogre shows you a huge but crude bow and then starts to nod", "energetically in an effort to help you understand.");
    56.                 stage =3;
    57.                 break;
    58.             case3:
    59.                 sendPlayerDialogue(9827, "I think I understand. You want me to make some arrows for you?");
    60.                 stage =4;
    61.                 break;
    62.             case4:
    63.                 sendNPCDialogue(npcId, 9830, "Yeah, is what Rantz sayed, make da stabbers for da stabby chucker!");
    64.                 stage =8;
    65.                 break;
    66.             case5:
    67.                 sendNPCDialogue(npcId, 9830, "Da chompy is der bestest yummies for Rantz, Fycie and Bugs! We's looking for da yummies all da time. Da chompy is a big flapper, Rantz want's stabbers to sneaky, sneaky, stick da chompy.");
    68.                 stage =6;
    69.                 break;
    70.             case6:
    71.                 sendPlayerDialogue(9827, "Ah, so 'da chompy' is some king of bird?");
    72.                 stage =7;
    73.                 break;
    74.             case7:
    75.                 sendNPCDialogue(npcId, 9830, "Yes, is what Rantz sayed, Da chompy is da big flapper and is bestest yummies. But Rantz needs stabbers to stick da chompy... Will creatures make dem stabbers for us?");
    76.                 stage =-1;
    77.                 break;
    78.             case8:
    79.                 sendOptionsDialogue(SEND_DEFAULT_OPTIONS_TITLE, "How do I make the 'stabbers'?", "What's a 'chompy'?", "Ok, I'll make you some 'stabbers.'", "Er, make your own 'stabbers'!");
    80.                 stage =9;
    81.                 break;
    82.             case9:
    83.                 switch(componentId){
    84.                     case OPTION_1:
    85.                         sendPlayerDialogue(9827, "How do I make the 'stabbers'?");
    86.                         stage =10;
    87.                         break;
    88.                     case OPTION_2:
    89.                         sendPlayerDialogue(9827, "What's a 'chompy'?");
    90.                         stage =5;
    91.                         break;
    92.                     case OPTION_3:
    93.                         BigChompyBirdHunting.handleProgressQuest(player);
    94.                         sendPlayerDialogue(9830, "Ok, I'll make you some 'stabbers'.");
    95.                         stage =14;
    96.                         break;
    97.                     case OPTION_4:
    98.                         sendPlayerDialogue(9830, "Er, make your own 'stabbers'!");
    99.                         stage =13;
    100.                         break;
    101.                 }
    102.                 break;
    103.             case10:
    104.                 sendNPCDialogue(npcId, 9830, "Ahh, da creature wants to know Rantz secret for stabbers? Rantz not say till day creature says will make da stabbers for us else you Creature steals da chompy from us!");
    105.                 stage =11;
    106.                 break;
    107.             case11:
    108.                 sendOptionsDialogue(SEND_DEFAULT_OPTIONS_TITLE, "What's a 'chompy'?", "Ok, I'll make you some 'stabbers.'", "Er, make your own 'stabbers'!");
    109.                 stage =12;
    110.                 break;
    111.             case12:
    112.                 switch(componentId){
    113.                     case OPTION_1:
    114.                         sendPlayerDialogue(9827, "What's a 'chompy'?");
    115.                         stage =5;
    116.                         break;
    117.                     case OPTION_2:
    118.                         BigChompyBirdHunting.handleProgressQuest(player);
    119.                         sendPlayerDialogue(9830, "Ok, I'll make you some 'stabbers'.");
    120.                         stage =14;
    121.                         break;
    122.                     case OPTION_3:
    123.                         sendPlayerDialogue(9830, "Er, make your own 'stabbers'!");
    124.                         stage =13;
    125.                         break;
    126.                 }
    127.                 break;
    128.             case13:
    129.                 sendNPCDialogue(npcId, 9789, "What I make 'stabbers', I pretend you chompy and practice on you!");
    130.                 stage =-2;
    131.                 break;
    132.             case14:
    133.                 sendNPCDialogue(npcId, 9830, "Good you creature, you need sticksies from achey tree and stabbies from dog bones.");
    134.                 stage =-2;
    135.                 break;
    136.             case15:
    137.                 if(player.getInventory().containsItem(2866, 6)&& player.madeOgreArrows){
    138.  
    139.                 }elseif(player.getInventory().containsItem(2866, 6)&&!player.madeOgreArrows){
    140.  
    141.                 }else{
    142.                     sendPlayerDialogue(9830, "Er not exactly?");
    143.                     stage =16;
    144.                 }
    145.                 break;
    146.             case16:
    147.                 sendNPCDialogue(npcId, 9789, "You do stabbers quick!..quick!. Or Rantz make stabbers for Rantz and then practice for chompy sticking on creature!");
    148.                 stage =17;
    149.                 break;
    150.             case17:
    151.                 sendOptionsDialogue(SEND_DEFAULT_OPTIONS_TITLE, "How do I make the 'stabbers' again?", "Ok, I'll make the 'stabbers' for you.");
    152.                 stage =18;
    153.                 break;
    154.             case18:
    155.                 switch(componentId){
    156.                     case OPTION_1:
    157.                         sendPlayerDialogue(9827, "How do I make the 'stabbers' again?");
    158.                         stage =19;
    159.                         break;
    160.                     case OPTION_2:
    161.                         sendPlayerDialogue(9830, "Ok, I'll make the 'stabbers' for you.");
    162.                         stage =22;
    163.                         break;
    164.                 }
    165.                 break;
    166.             case19:
    167.                 sendNPCDialogue(npcId, 9830, "Grr creature...you's no good stabber maker! You's make da stabbie bit from da dog bones, and get da sticksies from da Achey tree...simple see! Oh and da flufsies from da flappers as well!");
    168.                 stage =20;
    169.                 break;
    170.             case20:
    171.                 sendPlayerDialogue(9827, "Oh, so I need logs from the achey tree, bones from a canine...and feathers?");
    172.                 stage =21;
    173.                 break;
    174.             case21:
    175.                 sendNPCDialogue(npcId, 9830, "Is just what Rantz sayed! <col=1B18F1>~ The hulking ogre nods excitedly.</col>");
    176.                 stage =-2;
    177.                 break;
    178.             case22:
    179.                 sendNPCDialogue(npcId, 9830, "Good creature, quickly, hurry bring da stabbers!");
    180.                 stage =-2;
    181.                 break;
    182.             default:
    183.                 end();
    184.                 break;
    185.         }
    186.     }
    187.  
    188.     @Override
    189.     publicvoid finish(){
    190.  
    191.     }
    192. }
    Player.java
    Code: Java
    1.     //Big Chompy Bird Hunting
    2.     publicboolean startedBigChompyBirdHunting =false;
    3.     publicboolean inProgressBigChompyBirdHunting =false;
    4.     publicboolean madeOgreArrows =false;
    5.     publicboolean completedBigChompyBirdHunting =false;
    Yes, this is horrible. No getters and setters. I said cba to make them because I was having fun writing the dialogue. xD

    BigChompyBirdHunting.java
    Code: Java
    1. packagecom.feather.game.player.dialogues.quests;
    2.  
    3. importcom.feather.game.player.Player;
    4. importcom.feather.game.player.Skills;
    5.  
    6. /**
    7.  * Created by Arham 4 on 8/9/14.
    8.  */
    9. publicclass BigChompyBirdHunting {
    10.  
    11.     /**
    12.      * Sends the configuration to the quest tab and sets Doric's Quest into progress.
    13.      *
    14.      * @param player
    15.      */
    16.     publicstaticvoid handleProgressQuest(final Player player){
    17.         player.startedBigChompyBirdHunting=true;
    18.         player.inProgressBigChompyBirdHunting=true;
    19.         player.getPackets().sendConfig(293, 1);
    20.         player.getInterfaceManager().sendInterfaces();
    21.         player.getPackets().sendUnlockIComponentOptionSlots(190, 15, 0, 201, 0, 1, 2, 3);
    22.     }
    23.  
    24.     /**
    25.      * The interface before the player has started the quest.
    26.      *
    27.      * @param player
    28.      */
    29.     publicstaticvoid handleQuestStartInterface(final Player player){
    30.         player.getInterfaceManager().sendInterface(275);
    31.         player.getPackets().sendRunScript(1207, 3);
    32.         player.getPackets().sendIComponentText(275, 1, "Big Chompy Bird Hunting");
    33.         player.getPackets().sendIComponentText(275, 10, "");
    34.         player.getPackets().sendIComponentText(275, 11, "<col=330099>I can start this quest by speaking to the ogre</col> <col=660000Rantz</col> <col=330099>who</col>");
    35.         player.getPackets().sendIComponentText(275, 12, "<col=330099>lives <col=660000>East</col> <col=330099>of the</col> <col=660000>Ogre City</col><col=330099>,</col> <col=660000>North</col> <col=330099>of the</col> <col=660000>Swamp Pool.</col>");
    36.         player.getPackets().sendIComponentText(275, 13, "<col=330099>To complete this quest I need:</col>");
    37.         player.getPackets().sendIComponentText(275, 14, (player.getSkills().getLevel(Skills.FLETCHING)>5?"<str>":"<col=330099>")+"Level 5 Fletching");
    38.         player.getPackets().sendIComponentText(275, 15, (player.getSkills().getLevel(Skills.COOKING)>30?"<str>":"<col=330099>")+"Level 30 Cooking");
    39.         player.getPackets().sendIComponentText(275, 16, (player.getSkills().getLevel(Skills.RANGE)>30?"<str>":"<col=330099>")+"Level 30 Ranging");
    40.         if(player.getSkills().getLevel(Skills.FLETCHING)>5&& player.getSkills().getLevel(Skills.COOKING)>30&& player.getSkills().getLevel(Skills.RANGE)>30){
    41.             player.getPackets().sendIComponentText(275, 17, "<col=330099>I have all the</col> <col=660000>stats</col> <col=330099>needed to complete this quest.</col>");
    42.         }else{
    43.             player.getPackets().sendIComponentText(275, 17, "");
    44.         }
    45.         for(int i =18; i <300; i++){
    46.             player.getPackets().sendIComponentText(275, i, "");
    47.         }
    48.     }
    49.  
    50.     /**
    51.      * The interface during the quest when the player gathers the items.
    52.      *
    53.      * @param player
    54.      */
    55.     publicstaticvoid handleProgressQuestInterface(final Player player){
    56.         player.getInterfaceManager().sendInterface(275);
    57.         player.getPackets().sendRunScript(1207, 3);
    58.         player.getPackets().sendIComponentText(275, 1, "Big Chompy Bird Hunting");
    59.         player.getPackets().sendIComponentText(275, 10, "");
    60.         player.getPackets().sendIComponentText(275, 11, "<str><col=330099>I can start this quest by speaking to the ogre</col> <col=660000Rantz</col> <col=330099>who</col>");
    61.         player.getPackets().sendIComponentText(275, 12, "<str><col=330099>lives <col=660000>East</col> <col=330099>of the</col> <col=660000>Ogre City</col><col=330099>,</col> <col=660000>North</col> <col=330099>of the</col> <col=660000>Swamp Pool.</col>");
    62.         player.getPackets().sendIComponentText(275, 13, "<col=330099>I agreed to get</col> <col=660000>Rantz</col> <col=330099>some</col> <col=660000>'stabbers'</col>");
    63.         for(int i =14; i <300; i++){
    64.             player.getPackets().sendIComponentText(275, i, "");
    65.         }
    66.     }
    67. }
    ButtonHandler.java
    Below:
    Code: Java
    1.         }elseif(interfaceId ==190){
    Add:
    Code: Java
    1.             if(componentId ==15&& slotId ==20){
    2.                 if(!player.startedBigChompyBirdHunting){
    3.                     BigChompyBirdHunting.handleQuestStartInterface(player);
    4.                 }
    5.                 if(player.inProgressBigChompyBirdHunting){
    6.                     BigChompyBirdHunting.handleProgressQuestInterface(player);
    7.                 }
    8.             }

    Reason for incompletion: While I was fetching dialogue, my account got kicked and banned from RS. R.I.P my 9 year old main, Arham 4 AKA District CLI.

    15
    Snippets / [718] Doric's Quest
    « on: August 16, 2014, 12:46:51 PM »
    Another useless quest to add to your useless server. :)

    (nah JK)

    Doric.java
    Code: Java
    1. packagecom.feather.game.player.dialogues.taverley;
    2.  
    3. importcom.feather.game.item.Item;
    4. importcom.feather.game.player.dialogues.Dialogue;
    5. importcom.feather.game.player.dialogues.quests.DoricsQuest;
    6.  
    7. /**
    8.  * Created by Arham 4 on 8/9/14.
    9.  */
    10. publicclass Doric extends Dialogue {
    11.  
    12.     privateint npcId;
    13.  
    14.     @Override
    15.     publicvoid start(){
    16.         npcId =(int) parameters[0];
    17.         if(!player.startedDoricsQuest){
    18.             sendNPCDialogue(npcId, 9827, "Oy der, mate! Care to help a little fella who needs some clay and a couple o' ores? There's a good reward, there is. So, how 'bout it, mate?");
    19.         }elseif(player.inProgressDoricsQuest){
    20.             sendNPCDialogue(npcId, 9827, "So, you got my items, mate?");
    21.             stage =4;
    22.         }elseif(player.completedDoricsQuest){
    23.             sendNPCDialogue(npcId, 9850, "Y'know, you could always use my anvils.");
    24.             stage =-2;
    25.         }
    26.     }
    27.  
    28.     @Override
    29.     publicvoid run(int interfaceId, int componentId){
    30.         switch(stage){
    31.             case-1:
    32.                 sendOptionsDialogue(SEND_DEFAULT_OPTIONS_TITLE, "Sure.", "Uh, I'll have to pass for now.");
    33.                 stage =0;
    34.                 break;
    35.             case0:
    36.                 switch(componentId){
    37.                     case OPTION_1:
    38.                         sendPlayerDialogue(9830, "Sure.");
    39.                         DoricsQuest.handleProgressQuest(player);
    40.                         stage =1;
    41.                         break;
    42.                     case OPTION_2:
    43.                         sendPlayerDialogue(9830, "Uh, I'll have to pass for now.");
    44.                         stage =3;
    45.                         break;
    46.                 }
    47.                 break;
    48.             case1:
    49.                 sendNPCDialogue(npcId, 9850, "Oh, that's great, right 'der, that's great. Now, I will be needing some clay, some copper, and a couple o' iron ores.");
    50.                 stage =2;
    51.                 break;
    52.             case2:
    53.                 sendPlayerDialogue(9830, "Alright, I'm on my way.");
    54.                 stage =-2;
    55.                 break;
    56.             case3:
    57.                 sendNPCDialogue(npcId, 9789, "You'll have to pass? Oh I see, it's 'cause I'm short, ain't it? You pesky humans need to learn some respect for us dwarfs. Get out of my house!");
    58.                 stage =-2;
    59.                 break;
    60.             case4:
    61.                 if(player.getInventory().containsItems(newint[]{437, 441, 435}, newint[]{4, 2, 6})){
    62.                     sendPlayerDialogue(9850, "Here's all the items!");
    63.                     stage =5;
    64.                 }else{
    65.                     sendPlayerDialogue(9830, "I don't have all the items yet.");
    66.                     stage =7;
    67.                 }
    68.                 break;
    69.             case5:
    70.                 player.getInventory().removeItems(new Item(437, 4), new Item(441, 2), new Item(435, 6));
    71.                 sendNPCDialogue(npcId, 9850, "Thanks mate! I owe it to ya!");
    72.                 stage =6;
    73.                 break;
    74.             case6:
    75.                 end();
    76.                 DoricsQuest.handleQuestComplete(player);
    77.                 DoricsQuest.handleQuestCompleteInterface(player);
    78.                 break;
    79.             case7:
    80.                 sendNPCDialogue(npcId, 9830, "Well then go get them, you baffoon!");
    81.                 stage =-2;
    82.                 break;
    83.             default:
    84.                 end();
    85.                 break;
    86.         }
    87.     }
    88.  
    89.     @Override
    90.     publicvoid finish(){
    91.  
    92.     }
    93. }
    Player.java
    Code: Java
    1.     //Doric's Quest
    2.     publicboolean startedDoricsQuest =false;
    3.     publicboolean inProgressDoricsQuest =false;
    4.     publicboolean completedDoricsQuest =false;
    Yes, this is horrible. No getters and setters. I said cba to make them. xD

    DoricsQuest.java
    Code: Java
    1. packagecom.feather.game.player.dialogues.quests;
    2.  
    3. importcom.feather.game.player.Player;
    4. importcom.feather.game.player.Skills;
    5.  
    6. /**
    7.  * Handles all the methods needed for Doric's Quest.
    8.  *
    9.  * @author Arham 4
    10.  */
    11. publicclass DoricsQuest  {
    12.  
    13.     /**
    14.      * Sends the configuration to the quest tab and sets Doric's Quest into progress.
    15.      *
    16.      * @param player
    17.      */
    18.     publicstaticvoid handleProgressQuest(final Player player){
    19.         player.startedDoricsQuest=true;
    20.         player.inProgressDoricsQuest=true;
    21.         player.getPackets().sendConfig(31, 1);
    22.         player.getInterfaceManager().sendInterfaces();
    23.         player.getPackets().sendUnlockIComponentOptionSlots(190, 15, 0, 201, 0, 1, 2, 3);
    24.     }
    25.  
    26.     /**
    27.      * The interface before the player has started the quest.
    28.      *
    29.      * @param player
    30.      */
    31.     publicstaticvoid handleQuestStartInterface(final Player player){
    32.         player.getInterfaceManager().sendInterface(275);
    33.         player.getPackets().sendRunScript(1207, 3);
    34.         player.getPackets().sendIComponentText(275, 1, "Doric's Quest");
    35.         player.getPackets().sendIComponentText(275, 10, "");
    36.         player.getPackets().sendIComponentText(275, 11, "<col=330099>I can start this quest by speaking to</col> <col=660000>Doric</col>, <col=330099>the dwarf, near");
    37.         player.getPackets().sendIComponentText(275, 12, "<col=660000>Goblin Village</col> <col=330099>near the crossing of</col> <col=660000>Falador</col> <col=330099>to</col> <col=660000>Varrock</col><col=330099>.</col>");
    38.         player.getPackets().sendIComponentText(275, 13, "");
    39.         player.getPackets().sendIComponentText(275, 14, "<col=330099>There aren't any requirements but</col> <col=660000>15 mining</col> <col=330099>will help</col>");
    40.         for(int i =15; i <300; i++){
    41.             player.getPackets().sendIComponentText(275, i, "");
    42.         }
    43.     }
    44.  
    45.     /**
    46.      * The interface during the quest when the player gathers the items.
    47.      *
    48.      * @param player
    49.      */
    50.     publicstaticvoid handleProgressQuestInterface(final Player player){
    51.         player.getInterfaceManager().sendInterface(275);
    52.         player.getPackets().sendRunScript(1207, 10);
    53.         player.getPackets().sendConfig(31, 1);
    54.         player.getPackets().sendIComponentText(275, 1, "Doric's Quest");
    55.         player.getPackets().sendIComponentText(275, 10, "");
    56.         player.getPackets().sendIComponentText(275, 11, "<str><col=330099>I can start this quest by speaking to</col> <col=660000>Doric</col>, <col=330099>the dwarf, near");
    57.         player.getPackets().sendIComponentText(275, 12, "<str><col=660000>Goblin Village</col> <col=330099>near the crossing of</col> <col=660000>Falador</col> <col=330099>to</col> <col=660000>Varrock</col><col=330099>.</col>");
    58.         player.getPackets().sendIComponentText(275, 13, "");
    59.         player.getPackets().sendIComponentText(275, 14, "<col=330099>I've spoken to with Doric and accepted his request. He wants me to");
    60.         player.getPackets().sendIComponentText(275, 15, "<col=3300099>gather the following materials:");
    61.         player.getPackets().sendIComponentText(275, 16, "<col=330099>I "+(!player.getInventory().containsItem(435, 6)?"need</col>":"have</col>")+" <col=660000>6 clay (noted)</col> <col=330099>to give to Doric.</col>");
    62.         player.getPackets().sendIComponentText(275, 17, "<col=330099>I "+(!player.getInventory().containsItem(437, 4)?"need</col>":"have</col>")+" <col=660000>4 copper ores (noted)</col> <col=330099>to give to Doric.</col>");
    63.         player.getPackets().sendIComponentText(275, 18, "<col=330099>I "+(!player.getInventory().containsItem(441, 2)?"need</col>":"have</col>")+" <col=660000>2 iron ores (noted)</col> <col=330099>to give to Doric.</col>");
    64.         for(int i =19; i <300; i++){
    65.             player.getPackets().sendIComponentText(275, i, "");
    66.         }
    67.     }
    68.  
    69.     /**
    70.      * Handles the reward the player gets when completing the quest.
    71.      *
    72.      * @param player
    73.      */
    74.     publicstaticvoid handleQuestComplete(final Player player){
    75.         player.inProgressDoricsQuest=false;
    76.         player.completedDoricsQuest=true;
    77.         player.questPoints+=1;
    78.         player.getSkills().addXp(Skills.MINING, 1300);
    79.         player.getPouch().addMoney(1300);
    80.         player.getPouch().refreshPouch(false);
    81.         player.getPackets().sendConfig(31, 100);
    82.         player.getPackets().sendConfig(101, player.questPoints);// Quest Points
    83.         player.getInterfaceManager().sendInterfaces();
    84.         player.getPackets().sendUnlockIComponentOptionSlots(190, 15, 0, 201, 0, 1, 2, 3);
    85.     }
    86.  
    87.     /**
    88.      * The interface shown after the player has completed the quest.
    89.      *
    90.      * @param player
    91.      */
    92.     publicstaticvoid handleQuestCompletionTabInterface(final Player player){
    93.         player.getInterfaceManager().sendInterface(275);
    94.         player.getPackets().sendRunScript(1207, 12);
    95.         player.getPackets().sendIComponentText(275, 1, "Doric's Quest");
    96.         player.getPackets().sendIComponentText(275, 10, "");
    97.         player.getPackets().sendIComponentText(275, 11, "<str><col=330099>I can start this quest by speaking to</col> <col=660000>Doric</col>, <col=330099>the dwarf, near");
    98.         player.getPackets().sendIComponentText(275, 12, "<str><col=660000>Goblin Village</col> <col=330099>near the crossing of</col> <col=660000>Falador</col> <col=330099>to</col> <col=660000>Varrock</col><col=330099>.</col>");
    99.         player.getPackets().sendIComponentText(275, 13, "");
    100.         player.getPackets().sendIComponentText(275, 14, "<str><col=330099>I've spoken to with Doric and accepted his request. He wants me to");
    101.         player.getPackets().sendIComponentText(275, 15, "<str><col=3300099>gather the following materials:");
    102.         player.getPackets().sendIComponentText(275, 16, "<str><col=330099>I have</col> <col=660000>6 clay (noted)</col> <col=330099>to give to Doric.</col>");
    103.         player.getPackets().sendIComponentText(275, 17, "<str><col=330099>I have</col> <col=660000>4 copper ores (noted)</col> <col=330099>to give to Doric.</col>");
    104.         player.getPackets().sendIComponentText(275, 18, "<str><col=330099>I have</col> <col=660000>2 iron ores (noted)</col> <col=330099>to give to Doric.</col>");
    105.         player.getPackets().sendIComponentText(275, 19, "");
    106.         player.getPackets().sendIComponentText(275, 20, "<col=660000>QUEST COMPLETE</col>");
    107.         for(int i =21; i <300; i++){
    108.             player.getPackets().sendIComponentText(275, i, "");
    109.         }
    110.     }
    111.  
    112.     /**
    113.      * The interface as the player gets the reward for completion of the quest.
    114.      *
    115.      * @param player
    116.      */
    117.     publicstaticvoid handleQuestCompleteInterface(final Player player){
    118.         player.getInterfaceManager().sendInterface(277);
    119.         player.getPackets().sendIComponentText(277, 4, "You have completed Doric's Quest.");
    120.         player.getPackets().sendIComponentText(277, 7, ""+ player.questPoints);
    121.         player.getPackets().sendIComponentText(277, 9, "You are awarded:");
    122.         player.getPackets().sendIComponentText(277, 10, "1 Quest Point");
    123.         player.getPackets().sendIComponentText(277, 11, "1300 Mining XP");
    124.         player.getPackets().sendIComponentText(277, 12, "180 Coins");
    125.         player.getPackets().sendIComponentText(277, 13, "Use of Doric's Anvils");
    126.         player.getPackets().sendIComponentText(277, 14, "");
    127.         player.getPackets().sendIComponentText(277, 15, "");
    128.         player.getPackets().sendIComponentText(277, 16, "");
    129.         player.getPackets().sendIComponentText(277, 17, "");
    130.         player.getPackets().sendItemOnIComponent(277, 5, 1269, 1);
    131.         player.getPackets().sendGameMessage("Congratulations! You have completed Doric's Quest!");
    132.     }
    133.  
    134. }
    ButtonHandler.java
    Below:
    Code: Java
    1.         }elseif(interfaceId ==190){
    Add:
    Code: Java
    1.             if(componentId ==15&& slotId ==3){
    2.                 if(!player.startedDoricsQuest){
    3.                     DoricsQuest.handleQuestStartInterface(player);
    4.                 }
    5.                 if(player.inProgressDoricsQuest){
    6.                     DoricsQuest.handleProgressQuestInterface(player);
    7.                 }
    8.                 if(player.completedDoricsQuest){
    9.                     DoricsQuest.handleQuestCompletionTabInterface(player);
    10.                 }
    11.             }

    Done!

    16
    Snippets / Shortcuts Abstract Class
    « on: August 16, 2014, 12:46:11 PM »
    I made this a long, long time ago. I don't even remember how I intended to make this system function.

    Shortcut.java
    Code: Java
    1. packagecom.rs.game.player.content.agility;
    2.  
    3. importcom.rs.game.Animation;
    4. importcom.rs.game.WorldTile;
    5. importcom.rs.game.item.Item;
    6. importcom.rs.game.player.Player;
    7. importcom.rs.game.player.Skills;
    8. importcom.rs.game.player.quests.Quest;
    9. importcom.rs.game.tasks.WorldTask;
    10. importcom.rs.game.tasks.WorldTasksManager;
    11.  
    12. /**
    13.  * Handles a shortcut.
    14.  *
    15.  * @author Arham Siddiqui
    16.  */
    17. publicabstractclass Shortcut {
    18.  
    19.     /**
    20.      * The type of shortcut.
    21.      */
    22.     publicenum ShortcutType {
    23.         ;
    24.  
    25.         private Animation animation;
    26.  
    27.         ShortcutType(Animation animation){
    28.             this.animation= animation;
    29.         }
    30.  
    31.         public Animation getAnimation(){
    32.             return animation;
    33.         }
    34.     }
    35.  
    36.     /**
    37.      * Does the shortcut addressed to do.
    38.      *
    39.      * @param shortcut The shortcut addressed to do.
    40.      * @param player   The player who is doing the shortcut.
    41.      */
    42.     publicvoid doShortcut(final Shortcut shortcut, final Player player){
    43.         if(player.getSkills().getLevel(Skills.AGILITY)< shortcut.getLevelRequired()){
    44.             player.getPackets().sendGameMessage("You need an Agility level of at least "+ shortcut.getLevelRequired()+" to use this obstacle.");
    45.             return;
    46.         }
    47.         WorldTasksManager.schedule(new WorldTask(){
    48.             @Override
    49.             publicvoid run(){
    50.                 player.setNextAnimation(shortcut.getShortcutType().getAnimation());
    51.                 this.stop();
    52.             }
    53.         }, 1);
    54.     }
    55.  
    56.     publicabstract ShortcutType getShortcutType();
    57.  
    58.     /**
    59.      * Gets the destination.
    60.      *
    61.      * @return The destination.
    62.      */
    63.     publicabstract WorldTile getDestination();
    64.  
    65.     /**
    66.      * Gets the level required.
    67.      *
    68.      * @return The level required.
    69.      */
    70.     publicabstractint getLevelRequired();
    71.  
    72.     /**
    73.      * Gets the Items required to do the shortcut.
    74.      *
    75.      * @return The required items.
    76.      */
    77.     public Item[] getItemRequirements(){
    78.         returnnull;
    79.     }
    80.  
    81.     /**
    82.      * Gets the Skill requirements to do the shortcut.
    83.      *
    84.      * @return The skill requirements.
    85.      */
    86.     publicint[] getSkillRequirements(){
    87.         returnnull;
    88.     }
    89.  
    90.     /**
    91.      * Gets the Quests required to do the shortcut.
    92.      *
    93.      * @return The required quests.
    94.      */
    95.     public Quest[] getQuestRequirements(){
    96.         returnnull;
    97.     }
    98. }

    - Arham

    Now that I think about it, making a new class for every shortcut seems a bit overkill.

    17
    Snippets / [Matrix] Alcohol Intake
    « on: August 16, 2014, 12:45:33 PM »
    Since you RSPS people like getting drunk all the time.

    ---

    How this works: Grab some beer, vodka, wine, ale, or a mind bomb, and drink up! When you drink 10 alcoholic beverages, your character will become drunk for 10 minutes.

    ---

    Also, if you guys like getting drunk on your servers, here's another snippet:

    Alcohol.java
    Code: Java
    1. packagecom.rs.game.player.content;
    2.  
    3. importcom.rs.game.item.Item;
    4. importcom.rs.game.player.Player;
    5. importcom.rs.game.tasks.WorldTask;
    6. importcom.rs.game.tasks.WorldTasksManager;
    7.  
    8. /**
    9.  * Gets a Player drunk.
    10.  * Created by Arham 4 on 7/7/14.
    11.  */
    12. publicclass Alcohol {
    13.  
    14.     /**
    15.      * Can the Player drink?
    16.      *
    17.      * @param item The item being drunk.
    18.      * @return If the Player can drink.
    19.      */
    20.     publicstaticboolean canDrink(Item item){
    21.         String itemName = item.getName().toLowerCase();
    22.         return itemName.contains("beer")|| itemName.contains("vodka")|| itemName.contains("wine")|| itemName.contains("ale")|| itemName.contains("mind bomb");
    23.     }
    24.  
    25.     /**
    26.      * Intakes the alcohol.
    27.      *
    28.      * @param player The Player drinking.
    29.      * @param
    30.      */
    31.     publicstaticvoid intake(final Player player, Item item){
    32.         player.setAlcoholIntake(player.getAlcoholIntake()+1);
    33.         if(player.getAlcoholIntake()>10){
    34.             player.getAppearence().setRenderEmote(290);
    35.             player.getPackets().sendSound(4580, 0, 1);
    36.             WorldTasksManager.schedule(new WorldTask(){
    37.                 @Override
    38.                 publicvoid run(){
    39.                     player.setAlcoholIntake(0);
    40.                     player.getAppearence().setRenderEmote(-1);
    41.                     this.stop();
    42.                 }
    43.             }, 1000);
    44.         }
    45.     }
    46. }
    Player.java
    Code: Java
    1.     privateint alcoholIntake =0;
    2.  
    3.     publicint getAlcoholIntake(){
    4.         return alcoholIntake;
    5.     }
    6.  
    7.     publicvoid setAlcoholIntake(int beerIntake){
    8.         this.alcoholIntake= beerIntake;
    9.     }
    Foods.java
    Below:
    Code: Java
    1. player.getPackets().sendGameMessage("It heals some health.");
    Add:
    Code: Java
    1.         if(Alcohol.canDrink(item))
    2.             Alcohol.intake(player, item);

    Go get drunk bois,
    Arham

    P.S: For those of you who know my age (shows it right below my name anyways...), I should make an age limit in the canDrink boolean.

    18


    Find:
    Code: Java
    1. publicboolean sendEntityDialogue(int type, String title, int entityId, int animationId, String... texts){
    Replace the method with:
    Code: Java
    1.     /*
    2.      * new dialogues
    3.      */
    4.     publicboolean sendEntityDialogue(int type, String title, int entityId, int animationId, String... texts){
    5.         StringBuilder builder =new StringBuilder();
    6.         for(int line =0; line < texts.length; line++)
    7.             builder.append(" "+ texts[line]);
    8.         String text = builder.toString();
    9.         if(type == IS_NPC){
    10.             player.getInterfaceManager().sendChatBoxInterface(1184);
    11.             player.getPackets().sendIComponentText(1184, 17, title);
    12.             player.getPackets().sendIComponentText(1184, 13, text);
    13.             player.getPackets().sendNPCOnIComponent(1184, 11, entityId);
    14.             if(animationId !=-1)
    15.                 player.getPackets().sendIComponentAnimation(animationId, 1184, 11);
    16.         }elseif(type == IS_PLAYER){
    17.             player.getInterfaceManager().sendChatBoxInterface(1191);
    18.             player.getPackets().sendIComponentText(1191, 8, title);
    19.             player.getPackets().sendIComponentText(1191, 17, text);
    20.             player.getPackets().sendPlayerOnIComponent(1191, 15);
    21.             if(animationId !=-1)
    22.                 player.getPackets().sendIComponentAnimation(animationId, 1191, 15);
    23.         }elseif(type == IS_ITEM){
    24.             player.getInterfaceManager().sendChatBoxInterface(1189);
    25.             player.getPackets().sendItemOnIComponent(1189, 1, entityId, animationId);
    26.             player.getPackets().sendIComponentText(1189, 4, text);
    27.         }
    28.         returntrue;
    29.     }
    Next, find:
    Code: Java
    1. publicstaticboolean sendEntityDialogueNoContinue(Player player, int type, String title, int entityId, int animationId, String... texts){
    Replace the method with this:
    Code: Java
    1.     publicstaticboolean sendEntityDialogueNoContinue(Player player, int type, String title, int entityId, int animationId, String... texts){
    2.         StringBuilder builder =new StringBuilder();
    3.         for(int line =0; line < texts.length; line++)
    4.             builder.append(" "+ texts[line]);
    5.         String text = builder.toString();
    6.         if(type == IS_ITEM){
    7.             player.getInterfaceManager().replaceRealChatBoxInterface(1190);
    8.             player.getPackets().sendItemOnIComponent(1190, 1, entityId, animationId);
    9.             player.getPackets().sendIComponentText(1190, 4, text);
    10.         }else{
    11.             player.getInterfaceManager().replaceRealChatBoxInterface(1192);
    12.             player.getPackets().sendIComponentText(1192, 16, title);
    13.             player.getPackets().sendIComponentText(1192, 12, text);
    14.             player.getPackets().sendEntityOnIComponent(type == IS_PLAYER, entityId, 1192, 11);
    15.             if(animationId !=-1)
    16.                 player.getPackets().sendIComponentAnimation(animationId, 1192, 11);
    17.         }
    18.         returntrue;
    19.     }

    Now add these two methods:
    Code: Java
    1.     public