- May 12, 2018
- 19
- 4
- 0
Spoiler for Read before you rate/hate/discriminate below:
**This can probably be used for different revisions but I only tested it on my 718.**
**This is my first Rune-server snippet post. If I didn't format it correctly that's why. Correct me in PM or comments.**
**This can probably be coded way better, but not by me **
**I searched all of rune-server for this and only got bits/pieces and made my own type of zoom. I couldn't find this released anywhere.**
What you will be adding:
- Holding shift and using mouse wheel to zoom in and/or out
- Holding shift and clicking mouse wheel in to reset zoom
- Command "resetzoom" to reset zoom amount. Useful if players are on laptops and can scroll with touchpad but do not have a button to reset back zoom.
Client sided:
Class319_Sub1.java
- Find code
Code:
public synchronized void mouseClicked(MouseEvent mouseevent) {
try {
- Add code below try {
Code:
if (mouseevent.isShiftDown()) {
String resetzoom = "resetzoom";
System.out.println(resetzoom);
Class419.method5605(resetzoom, true, false, 1405738364);
}
- Find code
Code:
public synchronized void mouseWheelMoved(MouseWheelEvent mousewheelevent) {
try {
- Add code below try {
Code:
if (mousewheelevent.isShiftDown()) {
int z = mousewheelevent.getWheelRotation();
if (mousewheelevent.getWheelRotation() == +1) {
try {
String string = new StringBuilder().append("zoomout ").append(16).toString();
System.out.println(string);
Class419.method5605(string, true, false, 1405738364);
} catch (RuntimeException runtimeexception) {
throw Class346.method4175(runtimeexception, new StringBuilder().append("zm.gd(").append(')').toString());
}
}
if (mousewheelevent.getWheelRotation() == -1){
try {
String string = new StringBuilder().append("zoomin ").append(16).toString();
System.out.println(string);
Class419.method5605(string, true, false, 1405738364);
} catch (RuntimeException runtimeexception) {
throw Class346.method4175(runtimeexception, new StringBuilder().append("zm.gd(").append(')').toString());
}
}
}
Server sided:
Player.java
- Find a "Public int" and add code below line:
Code:
public int zoom = 226;
Open your regular player commands .java (Regular.java)?
- Find code
Code:
if (clientCommand) {
Spoiler for If code was not found open this, if not, continue below:
- Find code
Code:
public static boolean processCommand
Code:
public static boolean processCommand(final Player player, String[] cmd, boolean console, boolean clientCommand) {
Code:
if (clientCommand) {
return true;
}
Add code below:
Code:
if (cmd[0].equals("zoomout")) {
cmd = cmd[1].split(" ");
player.zoom = player.zoom-Integer.valueOf(cmd[0]);
int setZoom = player.zoom;
if (player.zoom <= 49) {
player.zoom = 50;
player.getPackets().sendGlobalConfig(184, 50);
player.getPackets().sendGameMessage("You can not zoom out that much!");
}
player.getPackets().sendGlobalConfig(184, setZoom);
//player.getPackets().sendGameMessage("Player zoom: (out) "+player.zoom+"");
return true;
}
if (cmd[0].equals("zoomin")) {
cmd = cmd[1].split(" ");
player.zoom = player.zoom+Integer.valueOf(cmd[0]);
int setZoom = player.zoom;
if (player.zoom >= 2500) {
player.zoom = 2500;
player.getPackets().sendGlobalConfig(184, 2500);
player.getPackets().sendGameMessage("You can not zoom in that much!");
}
player.getPackets().sendGlobalConfig(184, setZoom);
//player.getPackets().sendGameMessage("Player zoom: (in) "+player.zoom+"");
return true;
}
if (cmd[0].equals("resetzoom")) {
player.zoom = 226;
player.getPackets().sendGlobalConfig(184, 0);
return true;
}
Find your home command and add above:
Code:
if (cmd[0].equals("resetzoom")) {
player.zoom = 226;
player.getPackets().sendGlobalConfig(184, 0);
return true;
}
You're done! See below for notes about what you added.
Spoiler for A few useful notes:
Increments are set at +16 or -16 from the client Class319_Sub1.java class add-in at code:
Code:
append([COLOR="#00FFFF"][SIZE=4]16[/SIZE][/COLOR]).toString();
Player zoom is defaulted to 226 from the Player.java add in zoom = 226;. (Same as the resetzoom command)
You can adjust as wanted.
When logging back in the player zoom will reset until they re-adjust zoom with shift + mouse wheel.
- To fix this you can add "getPackets().sendGlobalConfig(184, zoom);" to the login code.
Zoom amounts are limited to 50 through 2500. You can adjust as wanted in your commands code.
Rate/hate/discriminate below! Let me know if you enjoyed it, if it was not useful, if I made a mistake, if you have an error, or how I can improve my code.