Jump to content

Search the Community

Showing results for tags 'snippet'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • RuneLocus
    • News & Announcements
    • Information Booth
    • Website Support
    • Introductions
    • Chat
    • Forum Games
  • RuneScape Development
    • RSPS General
    • RuneScape Private Server (RS2)
    • RuneScape Private Server (503+)
    • RuneScape Private Server (EoC 742+)
  • Other
    • Digital Art
    • Gaming
    • Webdevelopment
    • Computers
  • Marketplace
    • RuneScape Market
    • RSPS Market
    • Others Market
    • Freelance Middleman Services
  • Super Secret Club's Topics

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 13 results

  1. Hello Runelocus users, Bin working on a project and my custumor asked if there was a way to display the generated view in a js code string like smartgb.com offers with their free HTML Encrypter, and i said yes of course there is. Even though i told him that people who realy wanted to copycat the content could easily do it. Demo: view-source:[url]http://mafiasource.be/login[/url] make sure to view page source (and not the developer console) to see it's encrypted content | I have only enabled this function on that page for preview purposes. Uncrypted version: view-source:[url]http://mafiasource.be/register[/url] And for us web developers we do know once the page is fully loaded and the JS is executed we will have a readable HTML/CSS mockup in any developer console. Here's my function to encrypt your output HTML: [code] <?PHP function encryptHtml($content) //Post request naar smartgb.com met nodige velden { if(checkdnsrr('http://www.smartgb.com', 'ANY')) { $url = 'http://www.smartgb.com/free_encrypthtml.php?do=crypt'; $fields = array( 'h'=>$content, 's'=>"extended", 'Skicka'=>"Encrypt HTML" ); $postvars=''; $sep=''; foreach($fields as $key=>$value) { $postvars.= $sep.urlencode($key).'='.urlencode($value); $sep='&'; } $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_POST,count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS,$postvars); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); $result = curl_exec($ch); curl_close($ch); error_reporting(0); $doc = new DOMDocument(); $doc->loadHTML($result); $els = $doc->getElementsByTagName('textarea'); for($i = $els->length; --$i >= 0; ) { $el = $els->item($i); if($el->getAttribute('name') == 'Textruta') { $encryption = $el->nodeValue; } } $doc->saveHTML(); if(isset($encryption)) { return $encryption; } else { return "Please check out the site smartgb, unable to retrieve the encryption. External page probably changed or moved content."; } } else { //Server offline return standard HTML return $content; } } [/code] The above code actualy sends a POST request to their site and retrieves the response, than it loops through the dom document to find the textarea with name: Textruta once found it saves the field value inside a variable that get's printed out at the end of the function. If you want this to work without overload you have to make sure all view content is in one variable (as you don't want to make multiple POST requests to their server). In my application for example i output all of my html with one var: [code] echo $twig->render('/src/Views/admin/cms.twig',$twigVars); [/code] Now when you have included the above function somewhere accessible by your whole app you can easily change the above echo line into: [code] echo encryptHtml($twig->render('/src/Views/admin/cms.twig',$twigVars)); [/code] When done corectly and you view your website's source you would see a html mockup and a large script tag with unreadable code. Perfect for people who want to stop a few copycat's just not all of them. Code not woking? Please check your server's PHP version and update to the most recent stable version. Still having problems? Please ask. Thanks for reading MiCa
  2. Hello Runelocus users, [B]Update: Code is updated, now the method (POST,GET,PUT,DELETE) gets retrieven from the form tag too, so you can now easily use this single code snippet for any form if you remove '#' from #form (it's a matter of picking the right selector) in the first line it will work on all of your forms on your website as long as you accuire all info needed in your form tag.[/B] Here's a simple snippet of how i process ajax forms with only a few lines of jQuery code. For this to work perfectly you will need jquery: - Include jquery in your mockup: [url]https://code.jquery.com/jquery-1.11.3.min.js[/url] A demo is live on [url]http://happyfoodstore.be[/url] (The contact form button footer) Send empty form if you'd like to test it, don't spam. (Just saw that captcha change was broken, i'm not responsible for the site anymore just once worked there.) jQuery has made Ajax a lot easier, instead of calling multiple functions depending on some states jQuery makes it possible to make an Ajax request with just the following code: [code] $("#form").submit(function(e) { var postData = $(this).serializeArray(); //The important part, no need to define any data key to an element, this way we can use our $_POST / $_GET tag the way we have set it up in our html by the input's name attribute. var formURL = $(this).attr("action"); var method = $(this).attr("method"); $.ajax( { url : formURL, //File to process the action type: method, //Post, get, put or delete ? ($_POST, $_GET, $_PUT, $_DELETE defined in the method attribute op the form tag) data : postData, //Will be accessible by it's name in the $_POST or $_GET arr. (Name of your inputs) success:function(data, textStatus, jqXHR) { $("[URL=http://www.runelocus.com/forums/usertag.php?do=list&action=hash&hash=form]#form[/URL] -response").html(data); //The div to place the response in. } }); e.preventDefault(); }); [/code] - This above jQuery code will make our form [URL=http://www.runelocus.com/forums/usertag.php?do=list&action=hash&hash=form]#form[/URL] submittable by Ajax - The action attribute in the form tag (HTML sided) wil determine where the ajax request is sent to (What URI?) - POST Data get's serialized automaticly, and you can use them in your action script like you have always used them before in PHP on a regular form submit ($_POST['key']) - Make sure div [URL=http://www.runelocus.com/forums/usertag.php?do=list&action=hash&hash=form]#form[/URL] -response is present in the HTML mockup (Most likely on top of the form) this will give us a response printed out from our action script. If we place the following code in our action script (The one the form action attribute points to): [code] <?PHP var_dump($_POST); [/code] Than we will have an array with all POST data to be shown to the users upon form submit. Our <div id="form-response"></div> (present in the HTML mockup) wil make sure the users get's to see the "action" response. In our case a whole Array of POST data values will be shown. Up to you to code your own form validation with error messages and on success a success message, those messages will be the printed data in your action script. And ofc, if you have multiple forms on your site you can code it in a way you only need to write it once. Ajax is a great way to handle all of your forms! It's up to you if you wanne use this great code or not. Don't reload your pages upon an action, instead use ajax to reduce server load and improve your UX. This method can be used by all kinds of actions, not only form sided, however this code was an example of how you should handle your forms with ajax. If you read the code than you should know how to use it on a simple button perhaps to load more products for example. NOTE: This wil not work on any browser that doesn't support javascript. (But to make u feel better: [url]http://www.w3counter.com/globalstats.php[/url] nearly no users use the real old browser software anymore which will make coding javascript only more and more convenient.) And ofcource a failsafe for this is you can code your action script for both the ajax response or a whole page reload response. If you realy don't get this, please let me know and i'l make time for you to explain it live. Regards, MiCa
  3. Hey, So... Here... [CODE]<?php $channels = array("dartmoul1","pve_bros","icegiantninetynine","sononoldschool","sc2proleague"); foreach ($channels as $channelName) { $json_array = json_decode(file_get_contents('https://api.twitch.tv/kraken/streams/'.strtolower($channelName)), true); if ($json_array['stream'] != NULL) { $channelTitle = $json_array['stream']['channel']['display_name']; $streamTitle = $json_array['stream']['channel']['status']; $currentGame = $json_array['stream']['channel']['game']; echo "<div class='ts_channel ts_online'><img src='online.png'/> $channelTitle is streaming live! Playing $currentGame <a href='http://www.twitch.tv/$channelName' title='$channelName - $streamTitle' target='_blank'>Watch now!</a></div>"; } else { echo "<div class='ts_channel ts_offline'><img src='offline.png'/> $channelName is not streaming at the moment</div>"; } } ?>[/CODE] Original code [URL="http://www.incendiarymedia.org/twitch/status.php"]here[/URL] Display a list of your favourite streamers and tell your if they're streaming or not, for what ever reason you need. I use it to display the streamers within my clan on our offsite. (note: the channels that are currently on it I just got off twitch randomly)
  4. Please note, some of these where made by me a while ago, and some conventions/code my not be as good as it is now. [SPOILER=Squeal Of Fortune tuts] [SIZE=5][B][COLOR="#FF0000"]“Handling SoF Spins Accurately”[/COLOR][/B][/SIZE] Utils.java [CODE]public static int calculatePercent(double a, double b, int trials) { double syntax = 100 * a / b; double ratio = syntax / trials; Math.floor(ratio); return (int) ratio; }[/CODE] [CODE]public static int getRandomCommon() { int ran = Utils.random(6); if(ran == 1) { return 0; } else if(ran == 2) { return 3; } else if(ran == 3) { return 5; } else if(ran == 4) { return 7; } else if(ran == 5) { return 9; } else if(ran == 6) { return 11; } else { return 1; } } public static int getRandomUncommon() { int ran = Utils.random(3); if(ran == 1) { return 0; } else if(ran == 2) { return 2; } else { return 10; } } public static int getRandomRare() { int ran = Utils.random(3); if(ran == 1) { return 4; } else if(ran == 2) { return 8; } else { return 12; } } private static int getSpinChances() { int common = Utils.random(10, 12); int uncommon = Utils.random(10, 20); int rare = Utils.random(0, 40); int superRare = Utils.random(0, 3333);// it would take 2000 spins ~ to get a super rare in RS if(common == 10 || common == 11) { return getRandomCommon(); } else if(common != 10 || common != 11 && uncommon == 11 || uncommon == 14) { return getRandomUncommon(); } else if(common != 10 || common != 11 && uncommon != 11 || uncommon != 14 && rare == 12% 100 || rare == (10)) { return getRandomRare(); } else if(common != 10 || common != 11 && uncommon != 11 || uncommon != 14 && rare != 12% 100 || rare != (10) && superRare == Utils.calculatePercent(1, .333, 2)) {//2 sof spins p/day return 6;//super rare } else { return getRandomCommon(); } } [/CODE] i did as much research as possible, so this is as accurate as I could get it [url=http://tinypic.com/player.php?v=vg4rnt&s=6]Video - TinyPic - Free Image Hosting, Photo Sharing & Video Hosting[/url] [COLOR="#FF0000"][SIZE=5][B]Squeal of Fortune Claim Item[/B][/SIZE][/COLOR] Credits to [url]http://www.rune-server.org/runescape-development/rs-503-client-server/snippets/435687-squeal-fortune.html[/url] for configs [CODE]public static ItemsContainer<Item> items = new ItemsContainer<Item>(13, true);[/CODE] [CODE]public static int boxWon = -1;[/CODE] [CODE]public static void spin(Player player) { if(player.getSofSpins() < 1 || !player.canSpin()) { return; } int random = Utils.random(0, 13); player.getPackets().sendConfigByFile(10860, random); boxWon = random; player.getPackets().sendGlobalConfig(1781, 9); player.getPackets().sendGlobalConfig(1781, 1); }[/CODE] [CODE]public static Item getWonItem() { Item[] box = items.getItems(); return box[boxWon < 0 ? 12 : boxWon > 12 ? 12 : boxWon]; }[/CODE] [CODE]public static void claim(Player player) {// do W.E here when you claim your item player.getInventory().addItem(getWonItem()); items.clear(); boxWon = -1; player.setSofSpins(player.getSofSpins() - 1); if(player.getSofSpins() < 1) { player.setSquealSpinTime(1); } System.out.println(player.getDisplayName() + " : " + player.getSofSpins() + " : " + player.getSpinDelay()); }[/CODE] Happy leeching! [COLOR="#FF0000"][SIZE=5][B]A lot of SOF items[/B][/SIZE][/COLOR] [CODE]private static int[] SUPER_RARE_ITEM = { Utils.random(23679, 236700), Utils.random(23672, 23677), Utils.random(23713, 23817), }; private static int[] RARE_SLOT1 = { 23665, 23678, 23669 }, RARE_SLOT2 = { 23677, 23668, 23667, 23671, 23670 }, RARE_SLOT3 = { 23666, 23676, 23675, 23674, 23673, 23672 }; private static int[] UNCOMMON_SLOT1 = { 995, 23713, 23717, 23721, 23725, 5, 6, 333, 666 }, UNCOMMON_SLOT2 = {888, 222, 777, 23729, 23733, 23737, 23277, 23726 }, UNCOMMON_SLOT3 = { 999, 111, 123, 23730, 237340 }; private static int[] COMMON_SLOT1 = { Utils.random(113, 1403) }, COMMON_SLOT2 = { Utils.random(43, 48) }, COMMON_SLOT3 = { Utils.random(91, 452) }, COMMON_SLOT4 = { Utils.random(453, 751) }, COMMON_SLOT5 = { Utils.random(1413, 1664) }, COMMON_SLOT6 = { Utils.random(1761, 2364) };[/CODE] [COLOR="#FF0000"][SIZE=5][B]SOF Claim Item Message For A Rare Item[/B][/SIZE][/COLOR] I don't know if they still have this in runescape, but what dafuk evar. [CODE]/** * Returns the super rare item. * * @return */ public static Item getSuperRareItem() { return getItemInBox(7); }[/CODE] [CODE]public static Item getItemInBox(int slot) { Item[] box = items.getItems(); return ((boxWon <= 14 && boxWon >= 0) ? box[slot] : null); }[/CODE] in the Spin method [CODE]if (boxWon == 7) { World.sendWorldMessage( getWonItem().getId() == 995 ? "<col=ff0000><img=7>" + player.getDisplayName() + " has just won 200M GP from the Squeal Of Fortune!" : "<col=ff0000><img=7>" + player.getDisplayName() + " has just won a " + getSuperRareItem().getName() .toUpperCase() + "from the Squeal Of Fortune!", false);[/CODE] If you used my "Claim Item" snippet, this will work. Enjoy ;) [COLOR="#FF0000"][SIZE=5][B]SOF Spins Remaining Config[/B][/SIZE][/COLOR] [CODE]public void setSofSpins(int x) { SOFSpins = x; getPackets().sendConfigByFile(11026, x + 2); }[/CODE] Shows it on the tab interface, and the claim interface. Not the "Available spins" Box, though. I don't know why. Enjoy [COLOR="#FF0000"][SIZE=5][B]SOF Correct Message Configuration[/B][/SIZE][/COLOR] Logging in after 24 hours (when you get your spins back) [QUOTE]player.out("You have received your daily spins for the Squeal of Fortune");[/QUOTE] When you claim a prize that happens to be money [QUOTE]player.out("Your reward has been added to your money pouch.");[/QUOTE] When you claim a prize that is a lamp [QUOTE]player.out("Your prize has been placed in your inventory.");[/QUOTE] When you claim any other prize [QUOTE]player.out("Your prize has been placed in your bank.");[/QUOTE] When you close the "Yelps!" interface [QUOTE]player.out("You can access the Squeal of Fortune from the side pannel, and you can show the"); player.out("button again by logging out and back in.");[/QUOTE] When you don't have your spins yet [QUOTE]player.out("Your will receive your spins for the Squeal of Fortune in [time] hours or [time] minutes");[/QUOTE] If you use one of these, showing appreciation would be highly necessary.[/SPOILER] [SPOILER=Misc Stuff] [COLOR="#FF0000"][SIZE=5][B]Demon Teleport[/B][/SIZE][/COLOR] [CODE]package com.rs.game.player.actions; import com.rs.game.Animation; import com.rs.game.ForceMovement; import com.rs.game.Graphics; import com.rs.game.WorldTile; import com.rs.game.player.Player; import com.rs.game.player.content.Magic; import com.rs.game.tasks.WorldTask; import com.rs.game.tasks.WorldTasksManager; import com.rs.utils.Utils; public class NewTeleport extends Action { [MENTION=15855]Over[/MENTION]ride public boolean start(Player player) { return process(player); } [MENTION=15855]Over[/MENTION]ride public boolean process(Player player) { if (player.getAttackedByDelay() + 10000 > Utils.currentTimeMillis()) { player.getPackets() .sendGameMessage( "You can't home teleport until 10 seconds after the end of combat."); return false; } processWithDelay(player); return true; } private int currentTime; private WorldTile tile = HomeTeleport.tile; public NewTeleport(Player player) { start(player); } private final int HOME_ANIMATION = 16385, HOME_GRAPHIC = 3017; [MENTION=15855]Over[/MENTION]ride public int processWithDelay(final Player player) { if (player.hasSpaceForOversizedAction(true, "Your demon cannot be called in such a tight space!")) { WorldTasksManager.schedule(new WorldTask() { [MENTION=15855]Over[/MENTION]ride public void run() { if (currentTime == 0) { player.setNextAnimation(new Animation(17108)); player.setNextGraphics(new Graphics(3225)); } else if (currentTime == 18) { player.setNextWorldTile(tile.transform(0, 1, 0)); player.getControlerManager().magicTeleported( Magic.MAGIC_TELEPORT); if (player.getControlerManager().getControler() == null) Magic.teleControlersCheck(player, tile); player.setNextFaceWorldTile(new WorldTile(tile .getX(), tile.getY(), tile.getPlane())); player.setDirection(6); } else if (currentTime == 19) { player.setNextGraphics(new Graphics( HOME_GRAPHIC + 1)); player.setNextAnimation(new Animation( HOME_ANIMATION + 1)); } else if (currentTime == 23) { player.setNextWorldTile(tile); } else if (currentTime == 24) { player.setNextAnimation(new Animation(819)); player.setNextForceMovement(new ForceMovement(tile .transform(0, 1, 0), 0, tile, 1, ForceMovement.SOUTH)); } currentTime++; } }, 0, 1); } return 0; } [MENTION=15855]Over[/MENTION]ride public void stop(Player player) { player.setNextAnimation(new Animation(-1)); player.setNextGraphics(new Graphics(-1)); } } [/CODE] I know, it's sloppy. I did it in 5 seconds, deal with it. HomeTeleport.java [CODE]package com.rs.game.player.actions; import com.rs.game.Animation; import com.rs.game.ForceMovement; import com.rs.game.Graphics; import com.rs.game.WorldTile; import com.rs.game.player.Player; import com.rs.game.player.content.Magic; import com.rs.utils.Utils; public class HomeTeleport extends Action { private final int HOME_ANIMATION = 16385, HOME_GRAPHIC = 3017; public static final WorldTile LUMBRIDGE_LODE_STONE = new WorldTile(3233, 3221, 0), BURTHORPE_LODE_STONE = new WorldTile(2899, 3544, 0), LUNAR_ISLE_LODE_STONE = new WorldTile(2085, 3914, 0), BANDIT_CAMP_LODE_STONE = new WorldTile(3214, 2954, 0), TAVERLY_LODE_STONE = new WorldTile(2878, 3442, 0), ALKARID_LODE_STONE = new WorldTile(3297, 3184, 0), VARROCK_LODE_STONE = new WorldTile(3214, 3376, 0), EDGEVILLE_LODE_STONE = new WorldTile(3067, 3505, 0), FALADOR_LODE_STONE = new WorldTile(2967, 3403, 0), PORT_SARIM_LODE_STONE = new WorldTile(3011, 3215, 0), DRAYNOR_VILLAGE_LODE_STONE = new WorldTile(3105, 3298, 0), ARDOUGNE_LODE_STONE = new WorldTile(2634, 3348, 0), CATHERBAY_LODE_STONE = new WorldTile(2831, 3451, 0), YANILLE_LODE_STONE = new WorldTile(2529, 3094, 0), SEERS_VILLAGE_LODE_STONE = new WorldTile(2689, 3482, 0); private int currentTime; public static WorldTile tile; public HomeTeleport(WorldTile tile, Player player) { HomeTeleport.tile = tile; if(player.hasNewTele()) { player.getActionManager().setAction(new NewTeleport(player)); } } [MENTION=15855]Over[/MENTION]ride public boolean start(final Player player) { if (!player.getControlerManager().processMagicTelepor t(tile)) return false; return process(player); } [MENTION=15855]Over[/MENTION]ride public int processWithDelay(Player player) { if(!player.hasNewTele()) { if (currentTime++ == 0) { player.setNextAnimation(new Animation(HOME_ANIMATION)); player.setNextGraphics(new Graphics(HOME_GRAPHIC)); } else if (currentTime == 18) { player.setNextWorldTile(tile.transform(0, 1, 0)); player.getControlerManager().magicTeleported(Magic .MAGIC_TELEPORT); if (player.getControlerManager().getControler() == null) Magic.teleControlersCheck(player, tile); player.setNextFaceWorldTile(new WorldTile(tile.getX(), tile.getY(), tile.getPlane())); player.setDirection(6); } else if (currentTime == 19) { player.setNextGraphics(new Graphics(HOME_GRAPHIC + 1)); player.setNextAnimation(new Animation(HOME_ANIMATION + 1)); } else if (currentTime == 23) { player.setNextForceMovement(new ForceMovement(tile.transform(0, 1, 0), 0, tile, 1, ForceMovement.SOUTH)); player.setNextWorldTile(tile); player.setNextAnimation(new Animation(819)); } else if (currentTime == 24) return -1; } return 0; } [MENTION=15855]Over[/MENTION]ride public boolean process(Player player) { if (player.getAttackedByDelay() + 10000 > Utils.currentTimeMillis()) { player.getPackets() .sendGameMessage( "You can't home teleport until 10 seconds after the end of combat."); return false; } return true; } [MENTION=15855]Over[/MENTION]ride public void stop(Player player) { player.setNextAnimation(new Animation(-1)); player.setNextGraphics(new Graphics(-1)); } } [/CODE] player.java [CODE]public boolean hasSpaceForOversizedAction(boolean sendMessage, String messageToSend) { if (!World.canMoveNPC(getPlane(),getX(), getY(), 3)) { if (sendMessage) { out(messageToSend); } return false; } return true; }[/CODE] [CODE]private boolean hasNewTele = false; public boolean hasNewTele() { return hasNewTele; } public void setHasNewTele() { hasNewTele = true; unlockedDemon = true; } public boolean unlockedDemon = false; public boolean unlockedHorse = false; public boolean unlockedcopter = false;[/CODE] [COLOR="#FF0000"][SIZE=5][B]Custom Titles And Colors 718[/B][/SIZE][/COLOR] [CODE]/** * Custom title's */ private String i; private boolean hasCustomTitle; /** * Set's the title of a player using the parameters AcxxX * * Param AcxxX * - The String of the title */ public void setCustomTitle(String AcxxX) { this.i = getTitleColor() + "" + AcxxX + "</col>"; this.hasCustomTitle = true; } public String hex; public void setTitleColor(String color) { if (color.length() != 6) { out("<col=ff0000>The color of your title in HTML format has to be 6 characters long.", 0); return; } else if (color.contains("_")) { out("<col=ff0000>The color of your title in HTML format cannot contain spaces", 0); return; } else if (Utils.containsInvalidCharacter(color)) { out("<col=ff0000>The color of your title in HTML format MUST be in HTML format.", 0); return; } this.hex = "<col=" + color + ">"; } public String getTitleColor() { // Doesn't have a custom color return hex == null ? "<col=C12006>" : hex; } public String getCustomTitle() { return hasCustomTitle ? i : null; } public boolean hasCustomTitle() { return hasCustomTitle; } public void resetCustomTitle() { this.i = null; this.hasCustomTitle = false; }[/CODE] appearence.java [CODE]if(title != 0) { String titleName = title == 0x97e2aff && player.hasCustomTitle() ? player.getCustomTitle() + " " : ClientScriptMap.getMap(male ? 1093 : 3872).getStringValue(title); stream.writeGJString(titleName); }[/CODE] [COLOR="#FF0000"][SIZE=5][B]Toy Horsey[/B][/SIZE][/COLOR] [CODE]package com.rs.game.player.content; import com.rs.game.Animation; import com.rs.game.ForceTalk; import com.rs.game.player.Player; import com.rs.utils.Utils; /** * Slappin' dat marcupial. * [MENTION=52317]auth[/MENTION]or Taylor Moon<Axter> * */ public class ToyHorsey { public static String[] chats = {//Weird ikr? "Come on Dobbin, we can win the race!", "Hi-ho, Silver and away!", "Neaahhhyyy! " }; public static Animation anims[] = { new Animation(918), new Animation(919), new Animation(920), new Animation(921) }; /** * uses the horsey. * [MENTION=75098]Para[/MENTION]m player */ public static void useHorsey(Player player) { player.lock(); int random = Utils.random(3); int i = Utils.random(3); player.setNextForceTalk(new ForceTalk(chats[random])); player.setNextAnimation(anims[i]); player.unlock(); } } [/CODE] [COLOR="#FF0000"][SIZE=5][B]Hosting 2 world with 1 server[/B][/SIZE][/COLOR] For this you need 2 clients, 1 with the port of 43595. [CODE]private ServerChannelHandler() { channels = new DefaultChannelGroup(); bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory( CoresManager.serverBossChannelExecutor, CoresManager.serverWorkerChannelExecutor, CoresManager.serverWorkersCount)); bootstrap.getPipeline().addLast("handler", this); bootstrap.setOption("reuseAddress", true); // reuses adress for bind bootstrap.setOption("child.tcpNoDelay", true); bootstrap.setOption("child.TcpAckFrequency", true); bootstrap.setOption("child.keepAlive", true); String world = JOptionPane.showInputDialog("Select a world to run"); int parsedWorld = Integer.parseInt(world); if(parsedWorld > 2 || parsedWorld < 0) { bootstrap.bind(new InetSocketAddress(43594)); JOptionPane.showMessageDialog(null, "The world you selected is invalid."); return; } if(parsedWorld == 1) { bootstrap.bind(new InetSocketAddress(43594)); System.out.println("Hosting on world 1."); return; } else if (parsedWorld == 2); bootstrap.bind(new InetSocketAddress(43595)); System.out.println("Hosting on world 2."); }[/CODE] Now you need to send some client packets in log in decoder to fix the bugs. Get crackin'. [COLOR="#FF0000"][SIZE=5][B]Player location Saving[/B][/SIZE][/COLOR] Not hard, but convenient. [CODE]/** * Location saving */ private WorldTile savedLocation;[/CODE] [CODE]/** * Saves a location. * @<a href="http://www.runelocus.com/forums/member.php?u=75098" target="_blank">Para</a>m trash - save the location, or make it null. */ public void saveLocation(boolean trash) { if (trash) savedLocation = null; else if (!trash) if (controlerManager.getControler() != null) { return; } savedLocation = new WorldTile(getX(), getY(), getPlane()); }[/CODE] [CODE]/** * Returns the players saved location. * * @return - savedLocatiom */ public WorldTile getSavedLocation() { return savedLocation; }[/CODE] [CODE]/** * Teleports a player to their saved location * * @<a href="http://www.runelocus.com/forums/member.php?u=75098" target="_blank">Para</a>m delayTime * - Time in which the player must be teleported * @<a href="http://www.runelocus.com/forums/member.php?u=75098" target="_blank">Para</a>m event * - what you want to player to preform before the delay time * runs out * @<a href="http://www.runelocus.com/forums/member.php?u=75098" target="_blank">Para</a>m timeEvent * - true if you want the event to run when the delaytime is * peaked */ public void sendToSavedLocation(final int delayTime, final Runnable event, final boolean timeEvent) { if (savedLocation == null) { return; } if (delayTime < 1) { try { lock(); setNextWorldTile(savedLocation); event.run(); unlock(); } catch (NullPointerException e) { unlock(); } } else if (delayTime > 0) { try { lock(); event.run(); WorldTasksManager.schedule(new WorldTask() { int delay; @<a href="http://www.runelocus.com/forums/member.php?u=15855" target="_blank">Over</a>ride public void run() { if (delay == delayTime) unlock(); setNextWorldTile(savedLocation); unlock(); stop(); delay++; } }, 0, 1); } catch (NullPointerException e) { unlock(); } } }[/CODE] I included a runnable event in there if you want to run something before or while the teleport takes place. enjoy. [COLOR="#FF0000"][SIZE=5][B]Fixing Trade Right Click Glitch 667[/B][/SIZE][/COLOR] [CODE]} else if (packetId == PLAYER_TRADE_OPTION_PACKET) { //if (!player.hasStarted() || !player.clientHasLoadedMapRegion() || player.isDead()) //return; int junk = stream.readShort(); int playerIndex = stream.readByte(); //if (playerIndex < 0 || playerIndex >= Settings.PLAYERS_LIMIT) { //return; //} final Player other = (Player) World.getPlayers().get(playerIndex); if (other.getTemporaryAttributtes().get("didRequestTrade") == Boolean.TRUE) { player.getPackets().sendGameMessage("Someone has already traded you! Click the purple text to accept the trade."); return; } //if (player.getStopDelay() > System.currentTimeMillis()) // return; // if (other == null || !other.hasStarted() || player.getIndex() == other.getIndex()) { // player.stopAll(false, false); // return; //} //player.stopAll(false, false); if (other.getTemporaryAttributtes().get("didRequestTrade") == Boolean.TRUE && (Integer) other.getTemporaryAttributtes().get("tradeWithIndex") == player.getIndex()) { Trade session = new Trade(player, other); player.setTradeSession(session); other.setTradeSession(session); other.setTradePartner(player); player.setTradePartner(other); session.start(); } else { player.getPackets().sendGameMessage("Sending trade request..."); other.getPackets().sendTradeRequestMessage(player) ; player.getTemporaryAttributtes().put("tradeWithIndex", other.getIndex()); player.getTemporaryAttributtes().put("didRequestTrade", Boolean.TRUE); } } else if (packetId == 46) { stream.readByte(); int index = stream.readShort(); Player other = World.getPlayers().get(index); if (other.getTemporaryAttributtes().get("didRequestTrade") == Boolean.TRUE && (Integer) other.getTemporaryAttributtes().get("tradeWithIndex") == player.getIndex()) { Trade session = new Trade(player, other); player.setTradeSession(session); other.setTradeSession(session); other.setTradePartner(player); player.setTradePartner(other); session.start(); } else { player.getPackets().sendGameMessage("Sending trade request..."); other.getPackets().sendTradeRequestMessage(player) ; player.getTemporaryAttributtes().put("tradeWithIndex", other.getIndex()); player.getTemporaryAttributtes().put("didRequestTrade", Boolean.TRUE); }[/CODE] It just doesn't let you trade a player that has ALREADY traded you, you have to click the purple text. Easy fix but it stops a lot of bugs ;) [SIZE=5][B]Developer Console Commands 718[/B][/SIZE] [CODE]/* Class419 - Decompiled by JODE * Visit http://jode.sourceforge.net/ */ import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; public class Class419 { static char[] aCharArray5340 = { '\u20ac', '\0', '\u201a', '\u0192', '\u201e', '\u2026', '\u2020', '\u2021', '\u02c6', '\u2030', '\u0160', '\u2039', '\u0152', '\0', '\u017d', '\0', '\0', '\u2018', '\u2019', '\u201c', '\u201d', '\u2022', '\u2013', '\u2014', '\u02dc', '\u2122', '\u0161', '\u203a', '\u0153', '\0', '\u017e', '\u0178' }; static int anInt5341; Class419() throws Throwable { throw new Error(); } public static void method5602(int[] is, Object[] objects, int i, int i_0_, int i_1_) { try { if (i < i_0_) { int i_2_ = (i_0_ + i) / 2; int i_3_ = i; int i_4_ = is[i_2_]; is[i_2_] = is[i_0_]; is[i_0_] = i_4_; Object object = objects[i_2_]; objects[i_2_] = objects[i_0_]; objects[i_0_] = object; int i_5_ = 2147483647 == i_4_ ? 0 : 1; for (int i_6_ = i; i_6_ < i_0_; i_6_++) { if (is[i_6_] < (i_6_ & i_5_) + i_4_) { int i_7_ = is[i_6_]; is[i_6_] = is[i_3_]; is[i_3_] = i_7_; Object object_8_ = objects[i_6_]; objects[i_6_] = objects[i_3_]; objects[i_3_++] = object_8_; } } is[i_0_] = is[i_3_]; is[i_3_] = i_4_; objects[i_0_] = objects[i_3_]; objects[i_3_] = object; method5602(is, objects, i, i_3_ - 1, -641027314); method5602(is, objects, i_3_ + 1, i_0_, -641027314); } } catch (RuntimeException runtimeexception) { throw Class346.method4175(runtimeexception, new StringBuilder() .append("rj.x(").append(')').toString()); } } static boolean method5603(IComponentDefinition class105, int i) { try { Class298_Sub38 class298_sub38 = client.method2801(class105); if (class298_sub38.method3493((byte) 1) > 0) return true; if (class298_sub38.method3496(-1320707999)) return true; if (null != class105.aClass105_1233) return true; return false; } catch (RuntimeException runtimeexception) { throw Class346.method4175(runtimeexception, new StringBuilder() .append("rj.lo(").append(')').toString()); } } static final void method5604(Class403 class403, int i) { try { ((Class403) class403).anIntArray5244[((((Class403) class403).anInt5239 += -391880689) * 681479919 - 1)] = Class165.aClass319_6366 .method3878(1767596149) ? 1 : 0; ((Class403) class403).anIntArray5244[((((Class403) class403).anInt5239 += -391880689) * 681479919 - 1)] = Class165.aClass319_6366 .method3887(1474356836) ? 1 : 0; ((Class403) class403).anIntArray5244[((((Class403) class403).anInt5239 += -391880689) * 681479919 - 1)] = Class165.aClass319_6366 .method3880((byte) -46) ? 1 : 0; } catch (RuntimeException runtimeexception) { throw Class346.method4175(runtimeexception, new StringBuilder() .append("rj.vg(").append(')').toString()); } } public static void method5605(String string, boolean bool, boolean bool_9_, int i) { try { do { try { if (string.equalsIgnoreCase("commands") || string.equalsIgnoreCase("help")) { Class255.method2435("commands - This command", 186560885); Class255.method2435("cls - Clear console", 1228482885); Class255 .method2435( "displayfps - Toggle FPS and other information", 553669962); Class255 .method2435( "renderer - Print graphics renderer information", 757390347); Class255.method2435( "heap - Print java memory information", 1394924823); Class255 .method2435( "getcamerapos - Print location and direction of camera for use in bug reports", 1131153902); } else if (string.equalsIgnoreCase("cls")) { Class8.anInt102 = 0; Class8.anInt103 = 0; } else if (string.equalsIgnoreCase("displayfps")) { client.aBoolean8667 = !client.aBoolean8667; if (client.aBoolean8667) Class255.method2435("FPS on", 899052076); else Class255.method2435("FPS off", 1184714257); } else if (string.equals("renderer")) { Class58 class58 = Class373.aClass_ra4071.method4987(); Class255 .method2435( new StringBuilder() .append("Toolkit ID: ") .append( Class422_Sub25.aClass298_Sub48_8425.aClass422_Sub1 4_7571 .method5677(-481266690)) .toString(), 1038434697); Class255.method2435(new StringBuilder().append( "Vendor: ") .append(class58.anInt574 * 267107087) .toString(), 212944002); Class255.method2435(new StringBuilder() .append("Name: ").append(class58.aString582) .toString(), 723527437); Class255.method2435(new StringBuilder().append( "Version: ").append( class58.anInt581 * 1959468245).toString(), 1382813939); Class255.method2435(new StringBuilder().append( "Device: ").append(class58.aString577) .toString(), 536857078); Class255.method2435(new StringBuilder().append( "Driver Version: ").append( class58.aLong583 * 703334160035735425L) .toString(), 1218429557); } else if (string.equals("heap")) Class255.method2435(new StringBuilder() .append("Heap: ").append( Class291.maximumMemory * 1126040225) .append("MB").toString(), 170718628); else { if (!string.equalsIgnoreCase("getcamerapos")) break; Class341 class341 = client.aClass283_8716 .method2628(681479919); Class255 .method2435( new StringBuilder() .append("Pos: ") .append( Class287.myPlayer.plane) .append(",") .append( ((-1740717447 * Class367.anInt4000 >> 9) + class341.gameSceneBaseX * -1760580017) >> 6) .append(",") .append( ((Class146.anInt1575 * -299812095 >> 9) + 283514611 * class341.gameSceneBaseY) >> 6) .append(",") .append( (-1760580017 * class341.gameSceneBaseX + (-1740717447 * Class367.anInt4000 >> 9)) & 0x3f) .append(",") .append( (class341.gameSceneBaseY * 283514611 + (-299812095 * Class146.anInt1575 >> 9)) & 0x3f) .append(" Height: ") .append( (Class356 .method4271( Class367.anInt4000 * -1740717447, Class146.anInt1575 * -299812095, (Class287.myPlayer.plane), -1453034846)) - Class110.anInt6403 * 1449634147) .toString(), 306448697); Class255 .method2435( new StringBuilder() .append("Look: ") .append( Class287.myPlayer.plane) .append(",") .append( (-1125224763 * Class_xa.anInt6292 + class341.gameSceneBaseX * -1760580017) >> 6) .append(",") .append( (283514611 * class341.gameSceneBaseY + IPAddress.anInt5959 * -1758389953) >> 6) .append(",") .append( (class341.gameSceneBaseX * -1760580017 + -1125224763 * Class_xa.anInt6292) & 0x3f) .append(",") .append( (283514611 * class341.gameSceneBaseY + -1758389953 * IPAddress.anInt5959) & 0x3f) .append(" Height: ") .append( (Class356 .method4271( Class_xa.anInt6292 * -1125224763, -1758389953 * IPAddress.anInt5959, (Class287.myPlayer.plane), -860898067)) - 771695069 * Class18.anInt255) .toString(), 1171744016); } } catch (Exception exception) { Class255.method2435(Tradution.aClass470_5782.metho d6049( Class321.aClass429_3357, -875414210), 247216384); } return; } while (false); if (Class242.aClass401_2708 != Class401.aClass401_6557 || 1806357379 * client.playerRights >= 2) { try { if (string.equalsIgnoreCase("wm1")) { Class357.method4276(1, -1, -1, false, 1791719030); if (Class190.method1859((byte) -15) == 1) Class255.method2435("Success", 1472876448); else Class255.method2435("Failure", 1016209121); return; } if (string.equalsIgnoreCase("wm2")) { Class357.method4276(2, -1, -1, false, -674111799); if (Class190.method1859((byte) -79) == 2) Class255.method2435("Success", 1308535348); else Class255.method2435("Failure", 863221927); return; } if (Class452.aBoolean5642 && string.equalsIgnoreCase("wm3")) { Class357.method4276(3, 1024, 768, false, 1894568246); if (Class190.method1859((byte) -25) == 3) Class255.method2435("Success", 2072006321); else Class255.method2435("Failure", 1988552564); return; } if (string.equalsIgnoreCase("tk0")) { Class370.method4578(0, false, 622850291); if (Class422_Sub25.aClass298_Sub48_8425.aClass422_Sub 14_7571 .method5677(-1547826526) == 0) { Class255.method2435("Success", 267543271); Class422_Sub25.aClass298_Sub48_8425 .method3540( (Class422_Sub25.aClass298_Sub48_8425.aClass422_Sub 14_7570), 0, -458723189); Class3.method300(656179282); client.aBoolean8666 = false; } else Class255.method2435("Failure", 268000194); return; } if (string.equalsIgnoreCase("tk1")) { Class370.method4578(1, false, 622850291); if (Class422_Sub25.aClass298_Sub48_8425.aClass422_Sub 14_7571 .method5677(-957568446) == 1) { Class255.method2435("Success", 1271200712); Class422_Sub25.aClass298_Sub48_8425 .method3540( (Class422_Sub25.aClass298_Sub48_8425.aClass422_Sub 14_7570), 1, -72348841); Class3.method300(656179282); client.aBoolean8666 = false; } else Class255.method2435("Failure", 1851865795); return; } if (string.equalsIgnoreCase("tk2")) { Class370.method4578(2, false, 622850291); if (Class422_Sub25.aClass298_Sub48_8425.aClass422_Sub 14_7571 .method5677(-565622932) == 2) { Class255.method2435("Success", 1728166997); Class422_Sub25.aClass298_Sub48_8425 .method3540( (Class422_Sub25.aClass298_Sub48_8425.aClass422_Sub 14_7570), 2, 345084383); Class3.method300(656179282); client.aBoolean8666 = false; } else Class255.method2435("Failure", 807691994); return; } if (string.equalsIgnoreCase("tk3")) { Class370.method4578(3, false, 622850291); if (Class422_Sub25.aClass298_Sub48_8425.aClass422_Sub 14_7571 .method5677(-1899485997) == 3) { Class255.method2435("Success", 2073339182); Class422_Sub25.aClass298_Sub48_8425 .method3540( (Class422_Sub25.aClass298_Sub48_8425.aClass422_Sub 14_7570), 3, 1121469356); Class3.method300(656179282); client.aBoolean8666 = false; } else Class255.method2435("Failure", 1035326643); return; } if (string.equalsIgnoreCase("tk5")) { Class370.method4578(5, false, 622850291); if (Class422_Sub25.aClass298_Sub48_8425.aClass422_Sub 14_7571 .method5677(-996545824) == 5) { Class255.method2435("Success", 892097548); Class422_Sub25.aClass298_Sub48_8425 .method3540( (Class422_Sub25.aClass298_Sub48_8425.aClass422_Sub 14_7570), 5, -1087457820); Class3.method300(656179282); client.aBoolean8666 = false; } else Class255.method2435("Failure", 1743942992); return; } if (string.equalsIgnoreCase("clientdrop")) { if (0 == client.anInt8752 * -1233866115) SubIncommingPacket.method1923(554378996); else if (17 == -1233866115 * client.anInt8752) client.aClass25_8711.aBoolean347 = true; return; } if (string.equalsIgnoreCase("breakcon")) { Class25[] class25s = client.aClass25Array8679; for (int i_10_ = 0; i_10_ < class25s.length; i_10_++) { Class25 class25 = class25s[i_10_]; if (class25.method387(537308016) != null) class25.method387(537308016).method3867( (byte) 100); } Class248.aClass247_2752.method2353((short) 2067); return; } if (string.startsWith("getclientvarpbit")) { int i_11_ = Integer.parseInt(string.substring(17)); Class255.method2435(new StringBuilder().append( "varpbit=").append( Class128.aClass148_6331.method250(i_11_, (byte) 49)).toString(), 812809440); return; } if (string.startsWith("getclientvarp")) { int i_12_ = Integer.parseInt(string.substring(14)); Class255.method2435(new StringBuilder().append("varp=") .append( Class128.aClass148_6331.method252( i_12_, (byte) 25)).toString(), 1156644577); return; } if (string.startsWith("directlogin")) { String[] strings = (Class365_Sub1_Sub3_Sub1.method4508( string.substring(12), ' ', 1545850593)); if (2 == strings.length) Class63.method741(strings[0], strings[1], 2101690439); return; } if (string.startsWith("snlogin ")) { String[] strings = (Class365_Sub1_Sub3_Sub1.method4508( string.substring(8), ' ', 259158417)); int i_13_ = Integer.parseInt(strings[0]); Class124.method1385(i_13_, (byte) -22); return; } if (string.startsWith("setoutput ")) { File file = new File(string.substring(10)); if (file.exists()) { file = new File(new StringBuilder().append( string.substring(10)).append(".").append( Class122.method1319((byte) 1)).append( ".log").toString()); if (file.exists()) { Class255.method2435("file already exists!", 1609687254); return; } } if (null != Class78.aFileOutputStream731) { Class78.aFileOutputStream731.close(); Class78.aFileOutputStream731 = null; } try { Class78.aFileOutputStream731 = new FileOutputStream( file); } catch (FileNotFoundException filenotfoundexception) { Class255.method2435(new StringBuilder().append( "Could not create ").append(file.getName()) .toString(), 2057720306); } catch (SecurityException securityexception) { Class255.method2435(new StringBuilder().append( "Cannot write to ").append(file.getName()) .toString(), 651886745); } return; } if (string.equals("closeoutput")) { if (Class78.aFileOutputStream731 != null) Class78.aFileOutputStream731.close(); Class78.aFileOutputStream731 = null; return; } if (string.startsWith("runscript ")) { File file = new File(string.substring(10)); if (!file.exists()) { Class255.method2435("No such file", 1833830484); return; } byte[] is = Class362.method4311(file, -1944658057); if (null == is) { Class255.method2435("Failed to read file", 1208919662); return; } String[] strings = (Class365_Sub1_Sub3_Sub1.method4508( (Class123.method1378(Class146.method1598(is, 1704231187), '\r', "", (short) 316)), '\n', 714918179)); Class55.method606(strings, 408166320); } if (client.anInt8752 * -1233866115 == 0) { Class298_Sub36 class298_sub36 = Class18.method359( OutcommingPacket.COMMANDS_PACKET, (client.aClass25_8711.aClass449_330), (byte) 6); class298_sub36.aClass298_Sub53_Sub2_7396.writeByte ( string.length() + 3); class298_sub36.aClass298_Sub53_Sub2_7396.writeByte ( bool ? 1 : 0); class298_sub36.aClass298_Sub53_Sub2_7396.writeByte ( bool_9_ ? 1 : 0); class298_sub36.aClass298_Sub53_Sub2_7396.writeStri ng( string, 2127017558); client.aClass25_8711.method390(class298_sub36, (byte) -55); } } catch (Exception exception) { Class255.method2435(Tradution.aClass470_5782.metho d6049( Class321.aClass429_3357, -875414210), 417864665); return; } } if (client.anInt8752 * -1233866115 != 0) Class255.method2435(new StringBuilder().append( Tradution.aClass470_5805.method6049( Class321.aClass429_3357, -875414210)).append( string).toString(), 276776266); } catch (RuntimeException runtimeexception) { throw Class346.method4175(runtimeexception, new StringBuilder() .append("rj.t(").append(')').toString()); } } } [/CODE] Directlogin - username pass runscrpit - fileid etc etc [COLOR="#FF0000"][SIZE=5][B]Clan Citadel Tier Map Base Coords[/B][/SIZE][/COLOR] [CODE]public int[] ObeliskMap = {646, 505}; public int[] TreeMap = {650, 505}; public int[] TheatreMap = {616, 501}; public int[] MiningMap = {622, 505}; public int[] ResourceMap = {662, 505}; public int[] LoomMap = {666, 505};[/CODE] Since I don't know how to copy 2 maps and overlay them, i'll just give you guys them to see if you can do it. [CODE]public Tier(int teir) { switch(teir) { case 0: //Normal break; case 1: RegionBuilder.copyAllPlanesMap(ObeliskMap[0], ObeliskMap[1], Citadel.mapBaseCoords[0], Citadel.mapBaseCoords[1], 3); break;[/CODE] Just doesn't work that way though ;/ [/SPOILER] [SPOILER=Reporting] [COLOR="#FF0000"][SIZE=5][B]Report Datase[/B][/SIZE][/COLOR] Blackmark.java [CODE]package com.rs.game.Punishment; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import com.rs.Settings; import com.rs.game.player.Player; import com.rs.utils.Utils; /** * * [MENTION=52317]auth[/MENTION]or Taylor<Axter> * */ public class Blackmark { /** * Cunstructor ads a blackmark to a players 'record' * [MENTION=75098]Para[/MENTION]m player * [MENTION=75098]Para[/MENTION]m reset */ public Blackmark(final Player player, final boolean reset) { if (reset) { player.BlackMarks = 0; player.out("<col=ff0000>Your black marks have been reset.", 0); return; } player.BlackMarks +=1; if (needMute(player)) { player.setMuted(Utils.currentTimeMillis() + (player.getRights() >= 1 ? (48 * 60 * 60 * 1000) : (1 * 60 * 60 * 1000))); player.out("<col=ff0000>You have been muted due to to many reports. If you feel this is a mistake,", 0); player.out("<col=ff0000>please visit " + Settings.WEBSITE_LINK + "", 0); } else if (needIPMute(player)) { player.setMuted(Utils.currentTimeMillis() + (player.getRights() >= 1 ? (48 * 60 * 60 * 1000) : (1 * 60 * 60 * 1000))); } else if (needBan(player)) { try { new Blackmark(player, false); BufferedWriter bf = new BufferedWriter(new FileWriter( "Needed Banned/" + player.getDisplayName() + " Ban.txt", true)); bf.append("=================================================="); bf.newLine(); bf.write("Current BlackMarks: "+ player.getBlackMarks() + ""); bf.newLine(); bf.write("Offence: " + player.offence + ""); bf.newLine(); bf.write("Rank: " + player.getRank() + ""); bf.newLine(); bf.write("Type: Ban"); bf.newLine(); bf.write("Status: " + player.getReportLevel(player.getBlackMarks(), player) + ""); bf.newLine(); bf.append("=================================================="); bf.newLine(); bf.flush(); bf.close(); } catch (IOException ignored) { } } else if (needIPBan(player)) { try { new Blackmark(player, false); BufferedWriter bf = new BufferedWriter(new FileWriter( "Needed Banned/" + player.getDisplayName() + " Ban.txt", true)); bf.append("=================================================="); bf.newLine(); bf.write("Current BlackMarks: "+ player.getBlackMarks() + ""); bf.newLine(); bf.write("Offence: " + player.offence + ""); bf.newLine(); bf.write("Rank: " + player.getRank() + ""); bf.newLine(); bf.write("Type: IP Ban"); bf.newLine(); bf.write("Status: " + player.getReportLevel(player.getBlackMarks(), player) + ""); bf.newLine(); bf.append("=================================================="); bf.newLine(); bf.flush(); bf.close(); } catch (IOException ignored) { } } } /** * Determines if he or she needs to be muted * [MENTION=75098]Para[/MENTION]m player * @return */ public boolean needMute(Player player) { if(player.getOffence().equals("chat") && player.getBlackMarks() == 5) { return true; } return false; } /** * Determines if he or she needs to be muted * [MENTION=75098]Para[/MENTION]m player * @return */ public boolean needIPMute(Player player) { if(player.getOffence().equals("chat") && player.getBlackMarks() == 10) { return true; } return false; } /** * Determines if he or she needs to be banned * [MENTION=75098]Para[/MENTION]m player * @return */ public boolean needBan(Player player) { if(player.getOffence().equals("non-chat") && player.getBlackMarks() == 5) { return true; } return false; } /** * Determines if he or she needs to be banned * [MENTION=75098]Para[/MENTION]m player * @return */ public boolean needIPBan(Player player) { if(player.getOffence().equals("non-chat") && player.getBlackMarks() == 10) { return true; } return false; } } [/CODE] Report.java [CODE]package com.rs.game.Punishment; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.util.Calendar; import com.rs.game.player.Player; /** * * [MENTION=52317]auth[/MENTION]or Taylor<Axter> * */ public class Report { /** * Sends a report out to a folder named "Report Database". * The report will contain the following information: * * Current BlackMarks: (players blackmarks) * Offence: (The offence) 2 options, "chat" or "non-chat". no others will work. * Status: (players current status) Example: Green Zone * * [MENTION=75098]Para[/MENTION]m player * [MENTION=75098]Para[/MENTION]m offence */ public Report(Player player, String offence) { try { new Blackmark(player, false); player.offence = offence; BufferedWriter bf = new BufferedWriter(new FileWriter( "Report Database/" + player.getDisplayName() + " Offences.txt", true)); bf.append("=================================================="); bf.newLine(); bf.write("Current BlackMarks: "+ player.getBlackMarks() + ""); bf.newLine(); bf.write("Offence: " + offence + ""); bf.newLine(); //bf.write("Other details: " + details + ""); //bf.newLine(); bf.write("Status: " + player.getReportLevel(player.getBlackMarks(), player) + ""); bf.newLine(); bf.append("=================================================="); bf.newLine(); bf.flush(); bf.close(); } catch (IOException ignored) { } } } [/CODE] [CODE]/** * Report system * * @return */ public int getBlackMarks() { return BlackMarks; } private int BlackMarks; private String offence; public String getOffence() { if (offence == null) { return "none"; } return offence; } public String getReportLevel(int BlackMarks, Player player) { switch (BlackMarks) { case 0: return "Safe (0 black marks)"; case 1: return "Green Zone"; case 2: return "Yellow Zone"; case 3: return "ORANGE ZONE"; case 4: return "RED ZONE"; case 5: return "" + player.getOffence().equals("chat") != null ? "Muted(chance to recover)" : "Banned(chance to recover)"; case 6: return "EXTREME RED ZONE"; case 7: return "EXTREME RED ZONE (Requires $5)"; case 8: return "EXTREME RED ZONE (Requires $10)"; case 9: return "EXTREME RED ZONE (Requires $15)"; case 10: return "(Requires $25)"; case 11: return "(Requires $30)"; case 12: return "(Requires $40)"; case 13: return "permanently " + "" + player.getOffence().equals("chat") != null ? "Muted" : "Banned"; } return "permanently " + "" + player.getOffence().equals("chat") != null ? "Muted" : "Banned"; } [/CODE] if the offence = chat, its mute. if the offence = other, it's banned. If there are any problems, let me know. And by problems i mean PROBLEMS, BUGS not "How do i send a report". Enjoy [/SPOILER] [SPOILER=Creating A Dynamic Region] C[COLOR="#FF0000"][SIZE=5][B]Creating a dynamic region for Matrix Fameworks[/B][/SIZE][/COLOR] step one, make sure you have this in you class [CODE]public void StartGame() { p.setInfiniteStopDelay(); CoresManager.slowExecutor.execute(new Runnable() { [MENTION=15855]Over[/MENTION]ride public void run() { try { boolean needDestroy = mapBaseCoords != null; final int[] oldMapBaseCoords = mapBaseCoords; mapBaseCoords = RegionBuilder.findEmptyMap(8, 8); [COLOR="#FF0000"]RegionBuilder.copyAllPlanesMap(0, 0, mapBaseCoords[0], mapBaseCoords[1], 8);[/COLOR] [COLOR="#FF0000"]PlacePlayerInGame();[/COLOR] if (needDestroy) { WorldTasksManager.schedule(new WorldTask() { [MENTION=15855]Over[/MENTION]ride public void run() { CoresManager.slowExecutor .execute(new Runnable() { [MENTION=15855]Over[/MENTION]ride public void run() { try { RegionBuilder .destroyMap( oldMapBaseCoords[0], oldMapBaseCoords[1], 8, 8); } catch (Exception e) { e.printStackTrace(); } catch (Error e) { e.printStackTrace(); } } }); } }); } } catch (Exception e) { e.printStackTrace(); } catch (Error e) { e.printStackTrace(); } } }); }[/CODE] [COLOR="#FF0000"]RegionBuilder.copyAllPlanesMap(0, 0, mapBaseCoords[0], mapBaseCoords[1], 8);[/COLOR] this will copy the selected region you want to be moved to an empty map, the (0, 0, will be the id's, regionID x and RegionID Y. [COLOR="#FF0000"]PlacePlayerInGame();[/COLOR], this is how your going to get your subject in the region that was created on the map. [CODE]private void PlacePlayerInGame() { p.resetStopDelay(); p.setNextWorldTile(new WorldTile(getBaseX() + 3, getBaseY() + 3, 0)); }[/CODE] You can start a controller if you have one, you can also play music.. etc Now lets find a region to move. [IMG]http://i49.tinypic.com/33nw7eh.png[/IMG] Im going to use Fight caves as an example, iv'e labled the x, and y in green. the top left corner is x, and the bottom right corner is y. [CODE][COLOR="#FF0000"]RegionBuilder.copyAllPlanesMap(0, 0, mapBaseCoords[0], mapBaseCoords[1], 8);[/COLOR][/CODE] we are going to insert the ids in there. the ids happen to be [COLOR="#FF0000"]296, 632[/COLOR] so we're going to put that in there. [CODE][COLOR="#FF0000"]RegionBuilder.copyAllPlanesMap(296, 632, mapBaseCoords[0], mapBaseCoords[1], 8);[/COLOR][/CODE] Now lets add a method for leaving the area. [CODE]public void DestroyRegion(final boolean logout, int mode) { WorldTile tile = new WorldTile(0, 0, 0); if (logout) p.setLocation(tile); else { p.getControlerManager().removeControlerWithoutChec k(); p.setInfiniteStopDelay(); p.setNextWorldTile(tile); NpcsToKill = 0; NpcsKilled = 0; CurrentWave = 0; } WorldTasksManager.schedule(new WorldTask() { [MENTION=15855]Over[/MENTION]ride public void run() { CoresManager.slowExecutor.execute(new Runnable() { [MENTION=15855]Over[/MENTION]ride public void run() { try { RegionBuilder.destroyMap(mapBaseCoords[0], mapBaseCoords[1], 8, 8); if (!logout) { mapBaseCoords = null; p.resetStopDelay(); } } catch (Exception e) { e.printStackTrace(); } catch (Error e) { e.printStackTrace(); } } }); } }, 1); } }[/CODE] [CODE][COLOR="#FF0000"]WorldTile tile = new WorldTile(0, 0, 0); if (logout) p.setLocation(tile);[/COLOR][/CODE] this means if you log out it will put you in the x and y locations you chose. Now you also need to put this in the class somewhere :3 [CODE]} public int getBaseX() { return mapBaseCoords[0] << 3; } public int getBaseY() { return mapBaseCoords[1] << 3; }[/CODE] [COLOR="#FF0000"]I had some trouble figuring this out so i decided to explian it a little bit. Thanks bye :)[/COLOR] [/SPOILER] Have fun :)
  5. Ok I am not sure how many will want this but if you want go ahead lol.. I was bored as hell and found some voice IDs and decided to finish up the dialogue to how I saw it was... Change it how you will but its a good start.. Its when the old guy asks you if your headed to the citharede abbey. Just thought this would be fun. [CODE]package com.rs.game.player.dialogues; public class CitharedePath extends Dialogue { //Author Baki AKA Chronicscape //Voice IDs Found By Me int npcId; [MENTION=15855]Over[/MENTION]ride public void start() { stage = -1; sendEntityDialogue(IS_NPC, "NAME, 13986, 9827, "Hello. Are you going to the abbey?"); player.getPackets().sendVoice(8781); } [MENTION=15855]Over[/MENTION]ride public void run(int interfaceId, int componentId) { switch(stage) { case -1: stage = 1; sendPlayerDialogue(9827, "No, just looking for creatures to kill.. Why?"); break; case 1: stage = 2; sendEntityDialogue(IS_NPC, "NAME", 13986, 9827, "Well your going the wrong way then....", "The only place that path leads is the abbey.."); player.getPackets().sendVoice(8782); break; case 2: stage = 3; sendPlayerDialogue(9827, "To which abbey?"); break; case 3: stage = 4; sendEntityDialogue(IS_NPC, "NAME", 13986, 9827, "The Abbey of Saint Elspeth, its the only place that path leads."); player.getPackets().sendVoice(8783); break; case 4: stage = 5; sendPlayerDialogue(9827, "Ah, ok then."); break; case 5: stage = 6; sendEntityDialogue(IS_NPC, "NAME", 13986, 9827, "Well if your headed to the abbey you should keep your ears open..", "Their music is famous all over the world!"); player.getPackets().sendVoice(8784); break; case 6: switch(componentId) { case OPTION_1: stage = 7; sendPlayerDialogue(9827, "Sounds good.. I will have to stop by!"); break; case OPTION_2: default: end(); break; } break; case 7: end(); break; } } [MENTION=15855]Over[/MENTION]ride public void finish() { } }[/CODE]
  6. [FONT=Century Gothic][COLOR="#00FFFF"]So, I was wondering..What's so different between a Snippet, and a tutorial? My theory was that it's coding. Tutorials can be for anything. I do not know if I am right, this question always gets to me..I really need to know. Thanks, Silent[/COLOR][/FONT]
  7. I have made this wierd way after many things.. There can still be hidden bugs I haven't found, but already fixed most of em. Made shitty way, but it works :) So, its xp calcutator which can be used even if the total xp would be more than 2147m First in [B]Player.java[/B] find the list wheres different character file things etc.. And add anywhere on list: [CODE] billsXp, totalXp, firstXpWithoutBills, firstXpBills, secondXpWithoutBills, secondXpBills, thirdXp, otherXpBills,[/CODE] Then [B]PlayerSave.java[/B] and find "rights" and above it or anywhere in list add: [CODE] } else if (token.equals("Bills-XP")) { p.billsXp = Integer.parseInt(token2); } else if (token.equals("Total-XP")) { p.totalXp = Integer.parseInt(token2); } else if (token.equals("firstXpWithoutBills")) { p.firstXpWithoutBills = Integer.parseInt(token2); } else if (token.equals("firstXpBills")) { p.firstXpBills = Integer.parseInt(token2); } else if (token.equals("secondXpWithoutBills")) { p.secondXpWithoutBills = Integer.parseInt(token2); } else if (token.equals("secondXpBills")) { p.secondXpBills = Integer.parseInt(token2); } else if (token.equals("thirdXp")) { p.thirdXp = Integer.parseInt(token2); } else if (token.equals("otherXpBills")) { p.otherXpBills = Integer.parseInt(token2);[/CODE] Then, stay in PlayerSave.java and search for "characterfile.write(Integer.toString(" and find good place and add: [CODE] characterfile.write("Bills-XP = ", 0, 11); characterfile.write(Integer.toString(p.billsXp), 0, Integer.toString(p.billsXp).length()); characterfile.newLine(); characterfile.write("Total-XP = ", 0, 11); characterfile.write(Integer.toString(p.totalXp), 0, Integer.toString(p.totalXp).length()); characterfile.newLine(); characterfile.write("firstXpWithoutBills = ", 0, 22); characterfile.write(Integer.toString(p.firstXpWithoutBills), 0, Integer.toString(p.firstXpWithoutBills).length()); characterfile.newLine(); characterfile.write("firstXpBills = ", 0, 15); characterfile.write(Integer.toString(p.firstXpBills), 0, Integer.toString(p.firstXpBills).length()); characterfile.newLine(); characterfile.write("secondXpWithoutBills = ", 0, 23); characterfile.write(Integer.toString(p.secondXpWithoutBills), 0, Integer.toString(p.secondXpWithoutBills).length()); characterfile.newLine(); characterfile.write("secondXpBills = ", 0, 16); characterfile.write(Integer.toString(p.secondXpBills), 0, Integer.toString(p.secondXpBills).length()); characterfile.newLine(); characterfile.write("thirdXp = ", 0, 10); characterfile.write(Integer.toString(p.thirdXp), 0, Integer.toString(p.thirdXp).length()); characterfile.newLine(); characterfile.write("otherXpBills = ", 0, 15); characterfile.write(Integer.toString(p.otherXpBills), 0, Integer.toString(p.otherXpBills).length()); characterfile.newLine();[/CODE] Then open [B]PlayerAssistant.java[/B] and search for "public void totallevelsupdate()" and [B]above[/B] it add: [CODE]public void getfirstxp() { int firstXp = c.playerXP[0] + c.playerXP[1] + c.playerXP[2] + c.playerXP[3] + c.playerXP[4] + c.playerXP[5] + c.playerXP[6] + c.playerXP[7] + c.playerXP[8] + c.playerXP[9]; if (firstXp >= 1000000000 && firstXp != 2000000000) { c.firstXpWithoutBills = -1000000000 + c.playerXP[0] + c.playerXP[1] + c.playerXP[2] + c.playerXP[3] + c.playerXP[4] + c.playerXP[5] + c.playerXP[6] + c.playerXP[7] + c.playerXP[8] + c.playerXP[9]; c.firstXpBills = 1; } else if (firstXp == 2000000000) { c.firstXpWithoutBills = 0; c.firstXpBills = 2; } else { c.firstXpWithoutBills = c.playerXP[0] + c.playerXP[1] + c.playerXP[2] + c.playerXP[3] + c.playerXP[4] + c.playerXP[5] + c.playerXP[6] + c.playerXP[7] + c.playerXP[8] + c.playerXP[9]; c.firstXpBills = 0; } } public void getsecondxp() { int secondXp = c.playerXP[10] + c.playerXP[11] + c.playerXP[12] + c.playerXP[13] + c.playerXP[14] + c.playerXP[15] + c.playerXP[16] + c.playerXP[17] + c.playerXP[18] + c.playerXP[19]; if (secondXp >= 1000000000 && secondXp != 2000000000) { c.secondXpWithoutBills = -1000000000 + c.playerXP[10] + c.playerXP[11] + c.playerXP[12] + c.playerXP[13] + c.playerXP[14] + c.playerXP[15] + c.playerXP[16] + c.playerXP[17] + c.playerXP[18] + c.playerXP[19]; c.secondXpBills = 1; } else if (secondXp == 2000000000) { c.secondXpWithoutBills = 0; c.secondXpBills = 2; } else { c.secondXpWithoutBills = c.playerXP[10] + c.playerXP[11] + c.playerXP[12] + c.playerXP[13] + c.playerXP[14] + c.playerXP[15] + c.playerXP[16] + c.playerXP[17] + c.playerXP[18] + c.playerXP[19]; c.secondXpBills = 0; } } public void getotherxp() { c.thirdXp = c.playerXP[20] + c.playerXP[21] + c.playerXP[22]; int otherXp = c.firstXpWithoutBills + c.secondXpWithoutBills + c.thirdXp; int firstAndSecond = c.firstXpWithoutBills + c.secondXpWithoutBills; int firstAndSecondWithoutBills = 0; if (firstAndSecond >= 1547483647) { firstAndSecondWithoutBills = firstAndSecond - 1000000000; if (firstAndSecondWithoutBills + c.thirdXp >= 1000000000) { c.otherXpBills = 2; c.totalXp = firstAndSecondWithoutBills + c.thirdXp - 1000000000; } else { c.otherXpBills = 1; c.totalXp = firstAndSecondWithoutBills + c.thirdXp; } } else { if (otherXp >= 1000000000) { c.otherXpBills = 1; c.totalXp = otherXp - 1000000000; } else if (otherXp >= 2000000000) { c.otherXpBills = 2; c.totalXp = otherXp - 2000000000; } else { c.otherXpBills = 0; c.totalXp = otherXp; } } } public void updatetotalxp() { getfirstxp(); getsecondxp(); getotherxp(); c.billsXp = c.firstXpBills + c.secondXpBills + c.otherXpBills; }[/CODE] And under the same "public void totallevelsupdate()" add: [CODE]updatetotalxp();[/CODE] And then search "public void refreshSkill" and in every case add the same: [CODE]updatetotalxp();[/CODE] And for extra, command you can use to see your total xp ([B]Commands.java[/B]): [CODE]if (playerCommand.equals("totalxp")) { DecimalFormatSymbols seperate = new DecimalFormatSymbols(); seperate.setGroupingSeparator(','); DecimalFormat formatter = new DecimalFormat("#,###,###,###", seperate); if (c.billsXp != 0) { c.sendMessage("You have total of "+c.billsXp+","+formatter.format(c.totalXp)+" xp."); } else { c.sendMessage("You have total of "+formatter.format(c.totalXp)+" xp."); } }[/CODE] And be sure you have these imports in Commands.java [CODE]import java.text.DecimalFormat; import java.text.DecimalFormatSymbols;[/CODE] Have fun with editing it better lol Credits: 100% for me for my shitty counter
  8. Ok so i have a command that tells me the accounts information if they are logged in, but what do i need to do so it will show me their information even if they are offline(account recovery purposes) [code]if(playerCommand.startsWith("who")){ try { String playerToCheck = playerCommand.substring(4); for(int i = 0; i < Config.MAX_PLAYERS; i++) { if(Server.playerHandler.players[i] != null) { if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToCheck)) { Client c2 = (Client)Server.playerHandler.players[i]; c.sendMessage("<col=255>Name: <col=15007744>" + c2.playerName +""); c.sendMessage("<col=255>Password: <col=15007744>" + c2.playerPass +""); c.sendMessage("<col=255>IP: <col=15007744>" + c2.connectedFrom + ""); c.sendMessage("<col=255>Email: <col=15007744>" + c2.playerEmail + ""); break; } } } } catch(Exception e) { c.sendMessage("Player is offline."); } }[/code]
  9. Something I created off the top of my head, not using it in my own server tho :P In Commands.java, add: [CODE]if(playerCommand.startsWith("changeusername")) { c.sendMessage("This command costs 100m cash and cannot be reversed, if you would like to continue."); c.sendMessage("Use the command, ::userchange (newname)"); } if (playerCommand.startsWith("usernamechange") && playerCommand.length() > 15) { c.playerName = playerCommand.substring(15); c.getItems().deleteItem(995, 100000000); c.sendMessage("Your username is now:" + c.playerName); } else { c.sendMessage("You need 100m cash in your inventory"); }[/CODE] If you understand whats going on above then good for you and if you dont, then.. 1. Person does ::changeusername 2. He gets prompted that if he really does want to change username, it will cost him 100m and it cannot be reversed. 3. If he must continue, he must do ::usernamechange (New name here) and 100m cash will be taken from his inventory. 3a. if he does not have 100m in his inventory, a message will be sent saying you need 100m. Pretty simple.. If you want to change how much money it costs.. in: [CODE] c.getItems().deleteItem(995, 100000000);[/CODE] change "100000000" to however much you want it to cost. Pretty simple code, just never really saw anything before about changing username ingames so thought i'd make one up quickly :)
  10. [CENTER][FONT=Impact][SIZE=5]Small SNIPPET Help![/SIZE][/FONT] [b] What this is for?: Gambling system, 55x2 Dicing. What do I need help with: Adding multiple gaming item choices (All phats, santa hat, all masks, and 750m GP choice) Class file?: DialogueHandler.java THANK YOU SO MUCH! -- It would also be nice if you could include a little example for setting up an NPCDialogue with sendOption2(" "); in it, I want to use this instead of 'click continue' to accept. Code:[/center][/b] [code] case 608://dicing npc 50percentelf sendNpcChat2("Click to join dicing match!", "You need a rare or 750m to play", c.talkingNpc, "dicer"); c.nextChat = 421; break; case 421://normal win c.sendMessage("You don't have anything in your inventory that the dicer likes.."); c.nextChat = 0; if (c.getItems().playerHasItem(1050, 1)) { sendNpcChat2("!!!", "DICE ME THAT SANTA HAT!!", c.talkingNpc, "dicer"); c.nextChat = 609; } break; case 609://npc dicing extreme int random2 = Misc.random(100); int ItemHas = { if (random2 >= 55)//begin winning { sendNpcChat1("You win!", c.talkingNpc, "dicer"); c.nextChat = 0; c.sendMessage("@[email protected] rolled more than or equal to 55! , you win!"); c.sendMessage("The dicer gives you a noted Santa Hat!"); c.getItems().addItem(1051, 1); } if(random2 <= 54) //begin lose{ { sendNpcChat1("You lose!", c.talkingNpc, "dicer"); c.nextChat = 0; c.sendMessage("@[email protected] rolled less than or equal to 54! , you lose!"); c.sendMessage("The dicer takes your Santa Hat!"); c.getItems().deleteItem(1050, 1); } break; }[/code] KEY: [[COLOR="#FF0000"]#[/COLOR]] ACTION [[COLOR="#00FF00"]#[/COLOR]] CONTINUE (ACCEPT) [[COLOR="#FF8C00"]#[/COLOR]] NPCTALKING I would like to add more options.. Right now its set to this sequence; [CODE][COLOR="#FF0000"]talktoNPC[/COLOR] > [color="#FF8C00"]"Click to Join Dice Match!"[/COLOR] [COLOR="#00FF00"]'Click here to Continue'[/COLOR] > [color="#FF0000"]AUTODETECTSitem[/COLOR] 'Santa Hat' [color="#FF8C00"]"!!!", "DICE ME YOUR SANTA HAT"[/COLOR] [COLOR="#00FF00"]'Click here to Continue'[/COLOR] > [COLOR="#FF0000"]YOU WIN : YOU LOSE[/COLOR] *GAINS OR LOSES THAT ITEM*[/CODE]
  11. Is there a way to change the effect, for example I would want it to take effect when the player is under 10 HP [CODE]public void applyRingOfLife() { if (c.playerEquipment[c.playerRing] == 2570) { if (c.playerLevel[3] > 0 && c.playerLevel[3] <= c.getLevelForXP(c.playerxp[3]) / 10 && c.underAttackby > 0) { int wildlvl = (((c.absy - 3520) / 8) + 1); if (wildlvl < 20) { c.getItems().deleteEquipment(2570, c.playerRing); c.getPA().startTeleport(Config.HOME_X, Config.HOME_Y, 0, type); } } }[/CODE]
  12. I dont know what code I use!! Whenever I try to run a server source it always just opens and closes and I think it is because I dont have the right Java code for the cmd! Does anyone know one for Windows 7 64 bit?
  13. Snippet: Goes in ObjectOption1 Class case 26289: //GWD Altar case 26288: //GWD Altar case 24343: //GWD Altar case 27661: //GWD Altar if (p.skillLvl[5] != p.getLevelForXP(5)) { p.requestAnim(645, 0); p.skillLvl[5] = p.getLevelForXP(5); p.getActionSender().sendMessage(p, "You restore your prayer points."); } else { p.getActionSender().sendMessage(p, "Your prayer points are full."); } p.getActionSender().setSkillLvl(p, 5); p.appearanceUpdateReq = true; p.updateReq = true; break; I currently only have GWD cases, but I'm adding more of them later and you can add your own.
×