Thread: [718+] Right Click Mod Options (Dialogue)

Page 1 of 12 12311 ... LastLast
Results 1 to 10 of 112
  1. #1 [718+] Right Click Mod Options (Dialogue) 
    KNOWLEDGE IS POWER

    OG KingFox's Avatar
    Join Date
    Dec 2006
    Age
    33
    Posts
    1,683
    Thanks given
    628
    Thanks received
    1,062
    Rep Power
    750
    Tutorial was developed from this post: http://www.rune-server.org/runescape...tion-mods.html

    Preview: Screenshot by Lightshot

    Credits: jo0 3a7 lo7z for posting the original tutorial above.

    This has an exploit, to fix it click this link and follow the tutorial: http://www.rune-server.org/runescape...-dialogue.html

    First, if you dont have it already, add this into WorldPacketsDecoder.java with the other ones like it:

    Code:
    private final static int PLAYER_OPTION_5_PACKET = 77;
    Next, find this:

    Code:
    || packetId == PLAYER_OPTION_1_PACKET
    Under that, add this:

    Code:
    || packetId == PLAYER_OPTION_5_PACKET
    Next, find this:

    Code:
    public static void decodeLogicPacket(final Player player, LogicPacket packet) {
        int packetId = packet.getId();
        InputStream stream = new InputStream(packet.getData());
    Under it, add this:

    Code:
            if (packetId == PLAYER_OPTION_5_PACKET) {
                boolean unknown = stream.readByte() == 1;
                int playerIndex = stream.readUnsignedShortLE128();
                Player other = World.getPlayers().get(playerIndex);
                if (other == null || other.isDead() || other.hasFinished() || !player.getMapRegionsIds().contains(other.getRegionId()))
                    return;
                if (player.getLockDelay() > Utils.currentTimeMillis())
                    return;
                if (!other.withinDistance(player, 14)) {
                    player.getPackets().sendGameMessage("Unable to find target "+other.getDisplayName());
                    return;
                }
                player.getDialogueManager().startDialogue("ModPanel", playerIndex);
            }
    next, add this dialogue:

    Code:
    package com.rs.game.player.dialogues;
    
    import com.rs.Settings;
    import com.rs.game.World;
    import com.rs.game.player.Player;
    import com.rs.game.player.dialogues.Dialogue;
    import com.rs.utils.SerializableFilesManager;
    import com.rs.utils.Utils;
    
    public class ModPanel extends Dialogue {
    
        private int playerIndex;
        
        @Override
        public void start() {
            playerIndex = (Integer) parameters[0];
            Player target = World.getPlayers().get(playerIndex);
            stage = 1;
            if (stage == 1) {
                sendOptionsDialogue("Player Options: "+target.getDisplayName()+"",
                        "<col=ff0000>Ban Permanently</col>", 
                        "<col=ff0000>Mute 24 Hours</col>",
                        "<col=ff0000>Force Logout</col>", 
                        "<col=ff0000>Jail 24 Hours</col>",
                        "<col=ff0000>Cancel</col>");
                stage = 2;
            }
        }
    
        @Override
        public void run(int interfaceId, int componentId) {
            if (stage == 2) {
                if (componentId == OPTION_1) {
                    ban();
                    end();
                }
                if (componentId == OPTION_2) {
                    mute();
                    end();
                }
                if (componentId == OPTION_3) {
                    kick();
                    end();
                }
                if (componentId == OPTION_4) {
                    jail();
                    end();
                }
                if (componentId == OPTION_5) {
                    end();
                }
            }
        }
    
        public void ban() {
            Player target = World.getPlayers().get(playerIndex);
            if (target.getRights() == 2) {
                player.sendMessage("You can't ban an administrator.");
                target.sendMessage(""+player.getDisplayName()+" has attempted to ban you.");
                return;
            }
            
            SerializableFilesManager.savePlayer(target);
            target.setPermBanned(true);
            target.forceLogout();
            player.getPackets().sendGameMessage("You have banned " + target.getDisplayName()+".");
            World.sendWorldMessage("<col=ff0000><img=7>News: " + target.getDisplayName() + " has been banned by "+player.getDisplayName()+"", true);
        }
        
        public void mute() {
            Player target = World.getPlayers().get(playerIndex);
            if (target.getRights() == 2) {
                player.sendMessage("You can't mute an administrator.");
                target.sendMessage(""+player.getDisplayName()+" has attempted to mute you.");
                return;
            }
            player.getPackets().sendGameMessage("You have muted " + target.getDisplayName()+" for 24 hours.");
            target.setMuted(Utils.currentTimeMillis() + 1440000);
            target.getPackets().sendGameMessage("You have been muted for 24 hours by "+player.getDisplayName()+".");
            World.sendWorldMessage("<col=ff0000><img=5>News: " + target.getDisplayName() + " has been muted for 24 hours by "+player.getDisplayName()+"", true);
        }
        
        public void kick() {
            Player target = World.getPlayers().get(playerIndex);
            target.forceLogout();
            player.getPackets().sendGameMessage("You have kicked: " + target.getDisplayName() + ".");
        }
        
        public void jail() {
            Player target = World.getPlayers().get(playerIndex);
            if (target.getRights() == 2) {
                player.sendMessage("You can't jail an administrator.");
                target.sendMessage(""+player.getDisplayName()+" has attempted to jail you.");
                return;
            }
            target.setJailed(Utils.currentTimeMillis() + 1440000);
            target.getControlerManager().startControler("JailControler");
            target.getPackets().sendGameMessage("You've been Jailed for 24 hours by " + Utils.formatPlayerNameForDisplay(player.getUsername()) + ".");
            player.getPackets().sendGameMessage("You have Jailed 24 hours: " + target.getDisplayName() + ".");
            SerializableFilesManager.savePlayer(target);
        }
        
        @Override
        public void finish() {
            // TODO Auto-generated method stub
            
        }
    
    }

    Open DialogueHandler, add this into init():

    Code:
    handledDialogues.put("ModPanel", (Class<Dialogue>) Class.forName(ModPanel.class.getCanonicalName()));
    Next, open Player.java, and find

    Code:
    public void sendDefaultPlayersOptions() {
    inside that method, add this:

    Code:
    if (getRights() ==1 || getRights() == 2) {
        getPackets().sendPlayerOption("<col=FF0000>Mod Panel</col>", 5, false);
    }
    Should be everything ^_^ Simple as that

    Attached image
    Reply With Quote  
     


  2. #2  
    Success is the worst teacher

    Santa Hat's Avatar
    Join Date
    Oct 2012
    Age
    27
    Posts
    3,334
    Thanks given
    807
    Thanks received
    1,185
    Rep Power
    190
    That's a nice touch, good job


    Reply With Quote  
     

  3. #3  
    KNOWLEDGE IS POWER

    OG KingFox's Avatar
    Join Date
    Dec 2006
    Age
    33
    Posts
    1,683
    Thanks given
    628
    Thanks received
    1,062
    Rep Power
    750
    Figured it'd be something nice to have ^_^

    Attached image
    Reply With Quote  
     

  4. #4  
    Myre


    Join Date
    Apr 2012
    Age
    26
    Posts
    1,519
    Thanks given
    407
    Thanks received
    367
    Rep Power
    475
    that's actually quite useful, good job
    Would be easier to right click then find option, for some people
    Reply With Quote  
     

  5. #5  
    Mysteria Developer

    DatguyJay's Avatar
    Join Date
    Mar 2011
    Age
    28
    Posts
    2,139
    Thanks given
    302
    Thanks received
    161
    Rep Power
    212
    Quote Originally Posted by King Fox View Post
    Tutorial was developed from this post: http://www.rune-server.org/runescape...tion-mods.html

    Preview: Screenshot by Lightshot

    Credits: jo0 3a7 lo7z for posting the original tutorial above.


    First, if you dont have it already, add this into WorldPacketsDecoder.java with the other ones like it:

    Code:
    private final static int PLAYER_OPTION_5_PACKET = 77;
    Next, find this:

    Code:
    || packetId == PLAYER_OPTION_1_PACKET
    Under that, add this:

    Code:
    || packetId == PLAYER_OPTION_5_PACKET
    Next, find this:

    Code:
    public static void decodeLogicPacket(final Player player, LogicPacket packet) {
        int packetId = packet.getId();
        InputStream stream = new InputStream(packet.getData());
    Under it, add this:

    Code:
            if (packetId == PLAYER_OPTION_5_PACKET) {
                boolean unknown = stream.readByte() == 1;
                int playerIndex = stream.readUnsignedShortLE128();
                Player other = World.getPlayers().get(playerIndex);
                if (other == null || other.isDead() || other.hasFinished() || !player.getMapRegionsIds().contains(other.getRegionId()))
                    return;
                if (player.getLockDelay() > Utils.currentTimeMillis())
                    return;
                if (!other.withinDistance(player, 14)) {
                    player.getPackets().sendGameMessage("Unable to find target "+other.getDisplayName());
                    return;
                }
                player.getDialogueManager().startDialogue("ModPanel", playerIndex);
            }
    next, add this dialogue:

    Code:
    package com.rs.game.player.dialogues;
    
    import com.rs.Settings;
    import com.rs.game.World;
    import com.rs.game.player.Player;
    import com.rs.game.player.dialogues.Dialogue;
    import com.rs.utils.SerializableFilesManager;
    import com.rs.utils.Utils;
    
    public class ModPanel extends Dialogue {
    
        private int playerIndex;
        
        @Override
        public void start() {
            playerIndex = (Integer) parameters[0];
            Player target = World.getPlayers().get(playerIndex);
            stage = 1;
            if (stage == 1) {
                sendOptionsDialogue("Player Options: "+target.getDisplayName()+"",
                        "<col=ff0000>Ban Permanently</col>", 
                        "<col=ff0000>Mute 24 Hours</col>",
                        "<col=ff0000>Force Logout</col>", 
                        "<col=ff0000>Jail 24 Hours</col>",
                        "<col=ff0000>Cancel</col>");
                stage = 2;
            }
        }
    
        @Override
        public void run(int interfaceId, int componentId) {
            if (stage == 2) {
                if (componentId == OPTION_1) {
                    ban();
                    end();
                }
                if (componentId == OPTION_2) {
                    mute();
                    end();
                }
                if (componentId == OPTION_3) {
                    kick();
                    end();
                }
                if (componentId == OPTION_4) {
                    jail();
                    end();
                }
                if (componentId == OPTION_5) {
                    end();
                }
            }
        }
    
        public void ban() {
            Player target = World.getPlayers().get(playerIndex);
            if (target == null || target.isDead() || target.hasFinished() || !player.getMapRegionsIds().contains(target.getRegionId()))
               return;
            if (player.getLockDelay() > Utils.currentTimeMillis())
                return;
            if (!target.withinDistance(player, 14)) {
                player.getPackets().sendGameMessage(""+target.getDisplayName()+" is not in range.");
                return;
            }
            if (target.getRights() == 2) {
                player.sendMessage("You can't ban an administrator.");
                target.sendMessage(""+player.getDisplayName()+" has attempted to ban you.");
                return;
            }
            
            SerializableFilesManager.savePlayer(target);
            target.setPermBanned(true);
            target.forceLogout();
            player.getPackets().sendGameMessage("You have banned " + target.getDisplayName()+".");
            World.sendWorldMessage("<col=ff0000><img=5>News: " + target.getDisplayName() + " has been banned by "+player.getDisplayName()+"", true);
        }
        
        public void mute() {
            Player target = World.getPlayers().get(playerIndex);
            if (target == null || target.isDead() || target.hasFinished() || !player.getMapRegionsIds().contains(target.getRegionId()))
               return;
            
            if (player.getLockDelay() > Utils.currentTimeMillis())
                return;
            
            if (!target.withinDistance(player, 14)) {
                player.getPackets().sendGameMessage(""+target.getDisplayName()+" is not in range.");
                return;
            }
            if (target.getRights() == 2) {
                player.sendMessage("You can't mute an administrator.");
                target.sendMessage(""+player.getDisplayName()+" has attempted to mute you.");
                return;
            }
            player.getPackets().sendGameMessage("You have muted " + target.getDisplayName()+" for 24 hours.");
            target.setMuted(Utils.currentTimeMillis() + 1440000);
            target.getPackets().sendGameMessage("You have been muted for 24 hours by "+player.getDisplayName()+".");
            World.sendWorldMessage("<col=ff0000><img=5>News: " + target.getDisplayName() + " has been muted for 24 hours by "+player.getDisplayName()+"", true);
        }
        
        public void kick() {
            Player target = World.getPlayers().get(playerIndex);
            if (target == null || target.isDead() || target.hasFinished() || !player.getMapRegionsIds().contains(target.getRegionId()))
               return;
            
            if (player.getLockDelay() > Utils.currentTimeMillis())
                return;
            
            if (!target.withinDistance(player, 14)) {
                player.getPackets().sendGameMessage(""+target.getDisplayName()+" is not in range.");
                return;
            }
            
            target.forceLogout();
            player.getPackets().sendGameMessage("You have kicked: " + target.getDisplayName() + ".");
        }
        
        public void jail() {
            Player target = World.getPlayers().get(playerIndex);
            if (target == null || target.isDead() || target.hasFinished() || !player.getMapRegionsIds().contains(target.getRegionId()))
               return;
            
            if (player.getLockDelay() > Utils.currentTimeMillis())
                return;
            
            if (!target.withinDistance(player, 14)) {
                player.getPackets().sendGameMessage(""+target.getDisplayName()+" is not in range.");
                return;
            }
            if (target.getRights() == 2) {
                player.sendMessage("You can't jail an administrator.");
                target.sendMessage(""+player.getDisplayName()+" has attempted to jail you.");
                return;
            }
            target.setJailed(Utils.currentTimeMillis() + 1440000);
            target.getControlerManager().startControler("JailControler");
            target.getPackets().sendGameMessage("You've been Jailed for 24 hours by " + Utils.formatPlayerNameForDisplay(player.getUsername()) + ".");
            player.getPackets().sendGameMessage("You have Jailed 24 hours: " + target.getDisplayName() + ".");
            SerializableFilesManager.savePlayer(target);
        }
        
        @Override
        public void finish() {
            // TODO Auto-generated method stub
            
        }
    
    }

    Open DialogueHandler, add this into init():

    Code:
    handledDialogues.put("ModPanel", (Class<Dialogue>) Class.forName(ModPanel.class.getCanonicalName()));
    Next, open Player.java, and find

    Code:
    public void sendDefaultPlayersOptions() {
    inside that method, add this:

    Code:
    if (getRights() ==1 || getRights() == 2) {
    	getPackets().sendPlayerOption("<col=FF0000>Mod Panel</col>", 5, false);
    }
    Should be everything ^_^ Simple as that
    nice job on this!
    Reply With Quote  
     

  6. #6  
    KNOWLEDGE IS POWER

    OG KingFox's Avatar
    Join Date
    Dec 2006
    Age
    33
    Posts
    1,683
    Thanks given
    628
    Thanks received
    1,062
    Rep Power
    750
    Was no reason to quote my thread, i never delete my stuff o_o
    Thanks tho ^_^

    Attached image
    Reply With Quote  
     

  7. #7  
    Registered Member x3ndless's Avatar
    Join Date
    Jan 2010
    Posts
    96
    Thanks given
    6
    Thanks received
    3
    Rep Power
    7
    Definitively gonna use thank you! ^-^
    Reply With Quote  
     

  8. #8  
    Registered Member Anox's Avatar
    Join Date
    Oct 2011
    Posts
    129
    Thanks given
    23
    Thanks received
    25
    Rep Power
    11
    I'd like to see a right click chat mute option
    Reply With Quote  
     

  9. #9  
    Registered Member Grown's Avatar
    Join Date
    Oct 2012
    Posts
    838
    Thanks given
    650
    Thanks received
    86
    Rep Power
    54
    Quote Originally Posted by Exure View Post
    I'd like to see a right click chat mute option
    Did you not read the thread, and what it's based off of?

    [718] Right click mute option for mods+
    "Programs aren’t just built in one go, like a bridge. They are talked about,
    sketched out, prototyped, played with, refactored, tuned, tested, tweaked,
    deleted, rewritten....
    A program is not built; it is grown.
    Because a program is always growing and always changing, it must be written
    with change in mind."
    Reply With Quote  
     

  10. #10  
    KNOWLEDGE IS POWER

    OG KingFox's Avatar
    Join Date
    Dec 2006
    Age
    33
    Posts
    1,683
    Thanks given
    628
    Thanks received
    1,062
    Rep Power
    750
    H means like clicking a line of text in the chatbox, and having a mute option through that as well.

    Attached image
    Reply With Quote  
     

Page 1 of 12 12311 ... LastLast

Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. [718] Right click mute option for mods+
    By jo0 3a7 lo7z in forum Tutorials
    Replies: 66
    Last Post: 08-27-2014, 11:25 AM
  2. 718 - Right click when attack?
    By Ynneh in forum Help
    Replies: 0
    Last Post: 04-06-2013, 02:01 AM
  3. [667]Right Click "Attack" Option
    By TaterMater in forum Help
    Replies: 6
    Last Post: 01-18-2013, 11:42 PM
  4. Right-Click Ip-mute option for Mod+
    By Hidden Gamer in forum Requests
    Replies: 0
    Last Post: 10-30-2011, 02:14 AM
  5. Make new right click player option
    By w::v::d in forum Tutorials
    Replies: 2
    Last Post: 06-23-2008, 03:34 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •