-
Posts
606 -
Joined
-
Last visited
-
Days Won
23
Content Type
Profiles
Forums
Blogs
Top List
Everything posted by Sanity
-
For those who use Vencillio, there is a nasty bug with Ruby Bolts (e). What this bug does is after a NPC's health goes below 0, and it hits a spec, it counts the kill as two. Allowing for multiple drops, mini-games to skip waves (ex. fight caves), and etc. This is my first snippet so bear with me. The fix I added works and I'm not sure if this is the 100% proper way to do this, but It has fixed it. In BoltSpecials.java find Case 9242. Below that add if (attacking.isDead()) { return; } I'm horrible at explaining things, but what this does is it checks if the NPC you're attacking is dead. If it is then it will catch that, and stop the spec from happening. I apologize if this is shit... first tutorial ever.
-
Ticket system where a player requests a ticket, a message would then be sent to the staff online and could then be accepted. package com.elvarg.game.content.ticket; import com.elvarg.game.World; import com.elvarg.game.entity.impl.player.Player; import com.elvarg.util.Misc; import java.util.*; import java.util.stream.Collectors; public class TicketManager { private final Queue<TicketEntry> entries = new ArrayDeque<>(); public static final TicketManager INSTANCE = new TicketManager(); public void acceptRequest(Player staff) { if (entries.peek() == null) { staff.getPacketSender().sendMessage("No tickets have been requested."); return; } TicketEntry entry = entries.peek(); entries.poll(); Player player = entry.getRequester(); player.getPacketSender().sendMessage(staff.getUsername() + " has accepted your ticket"); staff.getPacketSender().sendMessage("Teleporting to " + player.getUsername()); staff.moveTo(player.getPosition().copy()); staff.forceChat("How may I help you " + Misc.capitalize(player.getUsername()) + "?"); } package com.elvarg.game.content.ticket; import com.elvarg.game.entity.impl.player.Player; public final class TicketEntry { private final Player requester; public TicketEntry(Player requester) { this.requester = requester; } public Player getRequester() { return requester; } } Add this OwnerCommands if (parts[0].startsWith("acceptticket")) { TicketManager.INSTANCE.acceptRequest(player); } Add this under PlayerCommands if (parts[0].startsWith("request")) { TicketManager.INSTANCE.requestTicket(player); }
-
This will add a 2 minute auto save to prevent rollback. This is literally if your vps goes down, you accidentally close eclipse or your server.bat, or if the server crashes. Step One: Open your Vencillio source, and navigate to Src/Com/Vencillio/core/task/impl You'll know you're in the right place if you see a file called "WalktoTask.java" Create a new Java Document and call it PlayerBackupTask Paste this code inside of it package com.vencillio.core.task.impl; import java.util.Arrays; import java.util.Optional; import com.vencillio.core.task.Task; import com.vencillio.rs2.content.io.PlayerSave; import com.vencillio.rs2.entity.World; import com.vencillio.rs2.entity.player.Player; public class PlayerBackupTask extends Task { //every 2 min public PlayerBackupTask() { super(650, true, StackType.NEVER_STACK, BreakType.NEVER, TaskIdentifier.CHARACTER_BACKUP); } @Override public void execute() { Thread t = new Thread(new Runnable() { @Override public void run() { backup(); System.out.println("Starting up Anti-Rollback Task..."); } }); t.start(); try { t.join(); } catch (InterruptedException e) { e.printStackTrace(); } } @Override public void onStop() { } public static void backup() { Arrays.stream(World.getPlayers()).forEach(player -> { Optional<Player> node = Optional.ofNullable(player); node.ifPresent(p -> PlayerSave.save(p)); }); } } Save and Close the File. Step Two: Now navigate to Src/Com/Vencillio/Core And open up "GameThread.java" Ctrl-F and search for GameDataLoader.load(); You should see this logger.info("Loading game data.."); GameDataLoader.load(); Directly under the GameDataLoader.load(); paste this logger.info("Turning on Player Backup System..."); TaskQueue.queue(new PlayerBackupTask()); Don't close the file yet. If you're not using an IDE it wont suggest the import. If you are using an IDE when it will suggest the Import. Lets go ahead and manually add the import, unless you feel like IDE should do it. At the top where you see all the imports add this import. import com.vencillio.core.task.impl.PlayerBackupTask; Save and Close the File. Step Three: Let me state this clearly because last snippet I got shit for this. If you're using an IDE it will compile your source automatically. If you're not using an IDE, Compile your server. Congratulations you're done.
-
Hello Lads, I ran into an issue with the Vencillio base where gem's and some other items could be cut or crafted without the necessary tool, today I have a small snippet of code which could be considered kinda "hacky" but takes care of this issue. First Open your Crafting.java rs2.content.skill.craftingnew.Crafting.java search for public boolean itemOnItem(Player player, Item use, Item with) { next search for this final Craftable craftable = getCraftable(use.getId(), with.getId()); if (craftable == null) { return false; } and underneath that we can add this snippet of code I have written. if(craftable.getUse().getId() != use.getId() && craftable.getUse().getId() != with.getId()) { player.send(new SendMessage("You need a " + craftable.getUse().getDefinition().getName() + " to craft this")); return false; } Let's explain a bit what this code does so you guys can understand how we are solving this issue craftable.getUse.getId() returns the ID of the required Chisel(or required tool) we are comparing this against both of our used items to make sure a chisel is in fact being used. If the correct tool is not being used we are using craftable.getUse().getDefinition.getName() to return the name of the proper tool to the user. Hopefully this helped someone out.
-
Hi people. I wanted to give you guys this, it took around 2 minuites (not including the time it took to find the string values) but i thought someone might like it, this can be converted to any server for PI just replace getPacketSender() with getPA() and sendString to sendFrame126 and you should be fine. Add this to Player.java right after the interface removal has happened. Then paste this code in getPacketSender().sendInterface(15244) .sendString(15257, "Welcome to SuperScape") .sendString(15258, "You're logged in from " + getHostAddress()) .sendString(15259, "Remember to keep your password safe.\\n And to set a bank pin.") .sendString(15260, "You have 0 messages in your message center") .sendString(15261, "") .sendString(15270, "Remember to donate to keep \\n the server alive!") .sendString(15262, "When you donate you have access \\n to a donator only skilling area!");
-
Hello guys, its been a while since i posted my last snippet. So i decided to make one. This one is an improved dialogue system. I was looking at the dialogue system (after not having used it for a while) and decided it needed a change. It is not smaller, more compact and easier to use. It still needs work but its like 95%.Difficultly: 2 / 10 - C+P. extending classes.First of all if you do not have the class Node. Make a class called nodes in the models package. You can just leave it blank for now or add a method to check which type of node it is.With this class that you have now made go into the following classes and extend Node.Item.javaEntity.javaIt would have looked like this Code: public class Item { and now look like this Code: public class Item extends Node { Do that to Entity.java and your done with Node.javaBtw Node class isn't used for anything atm but just do something in the npc option class and if dialogue.nodes()[0] == npc.getId() or something like that to make it functional. Now make Dialogue.java Code: package com.elvarg.world.content.dialogue; import com.elvarg.world.entity.impl.player.Player; import com.elvarg.world.model.Node; /** * A peice of dialogue. this is the abstract dialogue so this is the class which * will be extended into other dialogue classes. * @author jamix77 * */ public abstract class Dialogue { /** * This is the player who is in the dialogue with (whoever). */ protected final Player player; /** * Our dialogue stage. Used for the handling of the dialogue. Not always used but best way to do this. */ protected int stage; /** * Our node in which we are talking to. */ private Node node; /** * The interpreter for the dialogue at this moment. */ protected DialogueInterpreter interpreter; /** * Constructor to set our player. * @param player The player. */ public Dialogue(final Player player) { this.player = player; interpreter = new DialogueInterpreter(this.player,this); } /** * Handle our dialogue. * @return {@code True} If we should quit. * @return {@code False} If we should continue. */ protected abstract boolean handle(int option); /** * Defaultly handle our dialogue here. Then call the abstract dialogue. This one contains no option so it does the * other method also called defaultHandle but it supplys that one with the argument of -1. Indicating that there * is no button id chosen. */ public void defaultHandle() { defaultHandle(-1); } /** * Defaultly handle our dialogue here. Then call the abstract dialogue. */ public void defaultHandle(int option) { if (handle(option)) { end(); } stage++; } /** * Initilize the dialogue. */ public void init() { player.setNewDialogue(this); defaultHandle(); } /** * End our dialogue session and resume back to whatever we were doing previously. */ private void end() { player.setNewDialogue(null); } /** * The nodes that can initilize a dialogue. * @return */ public abstract Node[] nodes(); public Node getNode() { return node; } public void setNode(Node node) { this.node = node; } } This is a piece of dialogue which can be extended into a class. EG: public class LumbridgeGuideDialogue extends Dialogue { Now make DialogueInterpreter.java Code: package com.elvarg.world.content.dialogue; import com.elvarg.cache.impl.definitions.NpcDefinition; import com.elvarg.world.entity.impl.npc.NPC; import com.elvarg.world.entity.impl.player.Player; import com.elvarg.world.model.Item; /** * The interpreter for dialogue system. * @author jamix77 * */ public class DialogueInterpreter { /** * Player who owns the interpreter at this current moment. */ protected final Player player; /** * The dialogue that we are interpreting and sending to the player */ protected final Dialogue dialogue; /** * Constructor with player inside to indicate which player is owning the interpreter at this current moment. * @param player The player. */ public DialogueInterpreter(final Player player,final Dialogue dialogue) { this.player = player; this.dialogue = dialogue; } /** * Send an npc dialogue. * @param lines the lines of dialogue * @return the interpreter instance. */ public DialogueInterpreter npc(String...lines) { if (!(dialogue.getNode() instanceof NPC)) { return this;//cant continue because the node is not an npc. } return npc((NPC)dialogue.getNode(),Expression.DEFAULT,lines); } /** * Sends an npc dialogue. This is with more detail. * @param npc the npc. * @param e the expression on the npcs face. * @param lines the lines of dialogue. * @return the interpreter instance. */ public DialogueInterpreter npc(NPC npc,Expression e,String...lines) { int startDialogueChildId = NODE_DIALOGUE_ID[lines.length - 1]; int headChildId = startDialogueChildId - 2; player.getPacketSender().sendNpcHeadOnInterface(npc.getId(), headChildId); player.getPacketSender().sendInterfaceAnimation(headChildId, e.getAnimation()); player.getPacketSender().sendString(startDialogueChildId - 1, NpcDefinition.forId(npc.getId()) != null ? NpcDefinition.forId(npc.getId()).getName().replaceAll("_", " ") : ""); for (int i = 0; i < lines.length; i++) { player.getPacketSender().sendString(startDialogueChildId + i, lines[i]); } player.getPacketSender().sendChatboxInterface(startDialogueChildId - 3); return this; } /** * Sends a player dialogue. * @param lines the lines of dialogue * @return the interpreter instance. */ public DialogueInterpreter player(String...lines) { return player(Expression.DEFAULT,lines); } /** * Sends a player dialogue. With more detail on what to do. * @param e the expression of the dialogue speaker. * @param lines the lines of the dialogue. * @return the interpreter instance. */ public DialogueInterpreter player(Expression e, String...lines) { int startDialogueChildId = PLAYER_DIALOGUE_ID[lines.length - 1]; int headChildId = startDialogueChildId - 2; player.getPacketSender().sendPlayerHeadOnInterface(headChildId); player.getPacketSender().sendInterfaceAnimation(headChildId, e.getAnimation()); player.getPacketSender().sendString(startDialogueChildId - 1, player.getUsername()); for (int i = 0; i < lines.length; i++) { player.getPacketSender().sendString(startDialogueChildId + i, lines[i]); } player.getPacketSender().sendChatboxInterface(startDialogueChildId - 3); return this; } /** * Sends an item dialogue. * @param lines the lines of dialogue. * @return the interpreter instance. */ public DialogueInterpreter item(String...lines) { if (!(dialogue.getNode() instanceof Item)) { return this;//cannot continue with the dialogue because not isnt an instance of item. to send an item send the other method that asks you to specify an item. } return item((Item)dialogue.getNode(),lines); } /** * Sends an item dialogue. With more detail. * @param item the item to send. * @param lines the lines of dialogue. * @return the interpreter instance. */ public DialogueInterpreter item(Item item, String...lines) { int startDialogueChildId = NODE_DIALOGUE_ID[lines.length - 1]; int headChildId = startDialogueChildId - 2; player.getPacketSender().sendInterfaceModel(headChildId, item.getId(), 150); player.getPacketSender().sendString(startDialogueChildId - 1, item.getDefinition() == null ? "?" : item.getDefinition().getName() == null ? "?" : item.getDefinition().getName()); for (int i = 0; i < lines.length; i++) { player.getPacketSender().sendString(startDialogueChildId + i, lines[i]); } player.getPacketSender().sendChatboxInterface(startDialogueChildId - 3); return this; } /** * Sends a set of options. * @param lines * @return */ public DialogueInterpreter options(String...lines) { int firstChildId = OPTION_DIALOGUE_ID[lines.length - 1]; player.getPacketSender().sendString(firstChildId - 1, "Choose an option"); for (int i = 0; i < lines.length; i++) { player.getPacketSender().sendString(firstChildId + i, lines[i]); } player.getPacketSender().sendChatboxInterface(firstChildId - 2); return this; } /** * This array contains the child id where the dialogue * statement starts for npc and item dialogues. */ private static final int[] NODE_DIALOGUE_ID = { 4885, 4890, 4896, 4903 }; /** * This array contains the child id where the dialogue * statement starts for player dialogues. */ private static final int[] PLAYER_DIALOGUE_ID = { 971, 976, 982, 989 }; /** * This array contains the child id where the dialogue * statement starts for option dialogues. */ private static final int[] OPTION_DIALOGUE_ID = { 13760, 2461, 2471, 2482, 2494, }; } This is the class which dialogues will be sent. Heres an example usage when inside your class which is extending Dialogue. interpreter.npc(new NPC(825,null),"Well hello there young adventurer.");Expression.java Code: package com.elvarg.world.content.dialogue; import com.elvarg.world.model.Animation; /** * The dialogue facial expressions * @author jamix77 * */ public enum Expression { /** * Value for a good mood. */ HAPPY(588), /** * Value for a calm mood. */ CALM(589), /** * Value for a calm mood. */ CALM_2(590), /** * Value for the default conversation mood. */ DEFAULT(591), /** * Value for an evil mood. */ EVIL(592), /** * Value for an evil mood. */ EVIL_2(593), /** * Value for an evil, yet delighted mood. */ EVIL_DELIGHTED(594), /** * Value for an annoyed mood. */ ANNOYED(595), /** * Value for a distressed mood. */ DISTRESSED(596), /** * Value for a distressed mood. */ DISTRESSED_2(597), /** * Value for an almost-crying mood. */ CRYING_ALMOST(598), /** * Value for a sad mood, with the head bowing down. */ SAD_HEAD_BOW(599), /** * Value for a sleepy/drunken mood. */ SLEEPY(600), /** * Value for a sleepy/drunken mood. */ SLEEPY_2(601), /** * Value for a sleepy/drunken mood. */ SLEEPY_3(602), /** * Value for a sleepy/drunken mood. */ SLEEPY_4(603), /** * Value for an evil mood. */ EVIL_3(604), /** * Value for a laughing mood. */ LAUGHING(605), /** * Value for a laughing mood. */ LAUGHING_2(606), /** * Value for a laughing mood. */ LAUGHING_3(607), /** * Value for a laughing mood. */ LAUGHING_4(608), /** * Value for an evil mood. */ EVIL_4(609), /** * Value for a sad mood. */ SAD(610), /** * Value for a sad mood. */ SAD_2(611), /** * Value for a sad mood. */ SAD_3(612), /** * Value for an almost-crying mood. */ CRYING_ALMOST_2(613), /** * Value for an angry mood. */ ANGRY(614), /** * Value for an angry mood. */ ANGRY_2(615), /** * Value for an angry mood. */ ANGRY_3(616), /** * Value for an angry mood. */ ANGRY_4(617); /** * The DialogueExpression constructor. * @param animationId The id of the animation for said expression. */ private Expression(int animationId) { animation = new Animation(animationId); } /** * The animation the dialogue head model will perform. */ private final Animation animation; /** * Gets the animation for dialogue head model to perform. * @return animation. */ public Animation getAnimation() { return animation; } } These are the facial expressions of the chatheads.Replace your DialoguePacketListener.java to this Code: package com.elvarg.net.packet.impl; import com.elvarg.net.packet.Packet; import com.elvarg.net.packet.PacketConstants; import com.elvarg.net.packet.PacketListener; import com.elvarg.world.entity.impl.player.Player; import com.elvarg.world.model.dialogue.DialogueManager; /** * This packet listener handles player's mouse click on the * "Click here to continue" option, etc. * * @author relex lawl * @author jamix77 */ public class DialoguePacketListener implements PacketListener { @Override public void handleMessage(Player player, Packet packet) { switch (packet.getOpcode()) { case PacketConstants.DIALOGUE_OPCODE: player.getPacketSender().sendInterfaceRemoval(); if (player.getNewDialogue() != null) { player.getNewDialogue().defaultHandle(); } break; } } } In ButtonClickPacketListener Code: case FIRST_DIALOGUE_OPTION_OF_FIVE: case FIRST_DIALOGUE_OPTION_OF_FOUR: case FIRST_DIALOGUE_OPTION_OF_THREE: case FIRST_DIALOGUE_OPTION_OF_TWO: if(player.getDialogueOptions() != null) { player.getDialogueOptions().handleOption(player, 1); } if (player.getNewDialogue() != null) { player.getNewDialogue().defaultHandle(1); } break; case SECOND_DIALOGUE_OPTION_OF_FIVE: case SECOND_DIALOGUE_OPTION_OF_FOUR: case SECOND_DIALOGUE_OPTION_OF_THREE: case SECOND_DIALOGUE_OPTION_OF_TWO: if(player.getDialogueOptions() != null) { player.getDialogueOptions().handleOption(player, 2); } if (player.getNewDialogue() != null) { player.getNewDialogue().defaultHandle(2); } break; case THIRD_DIALOGUE_OPTION_OF_FIVE: case THIRD_DIALOGUE_OPTION_OF_FOUR: case THIRD_DIALOGUE_OPTION_OF_THREE: if(player.getDialogueOptions() != null) { player.getDialogueOptions().handleOption(player, 3); } if (player.getNewDialogue() != null) { player.getNewDialogue().defaultHandle(3); } break; case FOURTH_DIALOGUE_OPTION_OF_FIVE: case FOURTH_DIALOGUE_OPTION_OF_FOUR: if(player.getDialogueOptions() != null) { player.getDialogueOptions().handleOption(player, 4); } if (player.getNewDialogue() != null) { player.getNewDialogue().defaultHandle(4); } break; case FIFTH_DIALOGUE_OPTION_OF_FIVE: if(player.getDialogueOptions() != null) { player.getDialogueOptions().handleOption(player, 5); } if (player.getNewDialogue() != null) { player.getNewDialogue().defaultHandle(1); } break; Last thing in Player.java Code: private com.elvarg.world.content.dialogue.Dialogue newDialogue; and make its getters and setters.And your done!Here is an example class if you want. Code: package com.elvarg.world.content.dialogue.impl; import com.elvarg.world.content.dialogue.Dialogue; import com.elvarg.world.entity.impl.npc.NPC; import com.elvarg.world.entity.impl.player.Player; import com.elvarg.world.model.Node; /** * A dialogue that belongs to the npc of Man. * First dialogue made with new system. Testing it out. * @author jamix77 * */ public class ManDialogue extends Dialogue { /** * Our default constructor with player inside :P * @param player the player. */ public ManDialogue(Player player) { super(player); } /** * Handle our dialogue */ @Override protected boolean handle(int option) { switch (stage) { case 0: interpreter.npc("Hello dude!"); break; case 1: interpreter.player("Hi"); break; case 2: interpreter.options("Op1","op2"); break; case 3: switch (option) { case -1: stage = 1; return false; } player.getPacketSender().sendInterfaceRemoval() .sendMessage(option == 1 ? "Spaghetti meatballs":"Steak"); break; case 4: return true; } return false; } /** * Nodes that initlize the {@code ManDialogue} dialogue. */ @Override public Node[] nodes() { return new Node[] {new NPC(385,null)}; } } The way you initialise a dialogue is this Code: ManDialogue md = new ManDialogue(player); md.setNode(new NPC(NPCID,null)); md.init(); Switch out what you need there to suit your new dialogue.Edit: in the handle method inside your npc's separate dialogue class when you return false it will continue when you return true the dialogue will be exited.Thanks everybody.Constructive criticism is welcome.
-
Great Olm Object + NPC Ids and Coords
Sanity replied to OG KingFox's topic in #317 - #494 RSPS Configuration
Nice thanks for this. -
Xbox one but PC.
-
Hey bro, Welcome to the community!
-
You weren't find most of these as they have never been released or try being sold for.
-
This has all 154 data just need to pack it. [Hidden Content]
-
Don't think it's a rank anymore.
-
Nice one mate, I did have this but i delete it and couldn't find it, Nice one lad.
-
Thanks mate.
-
Done
-
Come on Ace, could of added media
- 122 replies
-
- moparscape
- 30/3/2017
-
(and 2 more)
Tagged with:
-
Added
-
GoodLuck with this.
-
Welcome mate
-
Got Bored Administrator Ace Community Manager None Forum Moderator Madara Nox Forum Support None Graphics Designer Vacation Designs Programmer Dexter Morgan Hassan Pax Professor Oak Xenon Web Developer Thrallix
-
Hello there, Welcome to the runeleak community!
-
I really want this forum to be active.