Jump to content

Search the Community

Showing results for tags 'saving'.



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 26 results

  1. Hi all, I am having some trouble figuring out how to set up the game to write to a MySQL Database with the character information. Ideally I would like all the information that is saved in the character file under "data\characters" to be saved in a table that can then be called through php on my website. - This can be used as a modCP or just in a My Account section. I have set up highscores before through MySQL and understand it is the same kind of process but I just cannot figure it out. Would love if someone could help me, all advice is welcome Also, I have only mainly worked on a 317 server in the past, this is my first 718 server. - My source was Validus. If it is the same method as a 317 then I will follow a tutorial already online and make changes as I'm going through it. - It just seems to be a lot different in the way it is set up. Thanks! [attachment=34:charsig-1.png]
  2. This is somewhat a tutorial, but I'll consider it as a snippet as its simple. It can be converted easily for higher revisions. Create the class [B]Saving [/B]in a new package named [B]timers[/B] and add this in it: [CODE] package server.timers; /** * * @author thaBoom * */ public class Saving { static Client c; /** * Runs the timer. */ public static void startTimer() { int timer = Config.SAVE_TIMER; if (timer == 1) { PlayerSave.saveGame(c); c.sendMessage("Your player has been saved."); timer = 250; } if (timer > 0) { timer--; } } private transient Player player; public Saving(Player player) { this.player = player; } } [/CODE] Add this constant anywhere in your [B]Config [/B]class. [CODE] public static final int SAVE_TIMER = 120; [/CODE] In the void [B]initialize()[/B] of the class [B]Client [/B]add: [CODE] Saving.startTimer(); [/CODE] Add the [U][COLOR="#FFA500"]necessary imports in the classes above to prevent errors.[/COLOR][/U] and then this should save all your players every couple minutes.
  3. Going to try to save up for a 2010-2014 camaro. They're amazing cars can do 0-60 in 4.8ish seconds and have a top speed of 155 miles an hour. This is somewhat what I'd like it to look like. [IMG]http://files.conceptcarz.com/img/Chevrolet/Chevy-Camaro-Black-DV-09-NAIAS_0014.jpg[/IMG] Going to need a decent stream of money to get this within a year although I'm very dedicated and want to make this happen.
  4. Diff: 1 Copy + Paste. First make a new class called YellTag anywere. enter this in it. [code] package server.model.players; public class YellTag { public static String getYellTitle(Client player) { return player.currentTitle; } public static String setYellTitle(Client player, String set) { return player.currentTitle = set; } public static boolean attemptTitle(Client player, String title) { if (!getLimitations(player, title)) return false; setYellTitle(player, title); player.sendMessage("Successfully set title to "+title); return true; } private static boolean getLimitations(Client player, String title) { if (title.length() > 12) { player.sendMessage("Your title can only have a maximum of 12 characters!"); return false; } String[] badWords = {"nigger", "fuck"}; for (int i = 0; i < badWords.length; i++) { if (title.contains(badWords[i])) { player.sendMessage("Your title contains illegal text. Please try again."); return false; } } return true; } } [/code] next in player.java add this. [code] public String currentTitle = ""; [/code] next in PlayerSave.java add these two things. [code] characterfile.write("currentTitle = ", 0, 15); characterfile.write(p.currentTitle, 0, p.currentTitle.length()); characterfile.newLine(); also add this. } else if (token.equals("currentTitle")) { p.currentTitle = token2; [/code]
  5. [B]Hello guys i am having a problem, i have Grand exchange into my server and when you buy an item you have to wait for someone to sell it for it to work. Here is what my selling says. [IMG]http://i.imgur.com/y4wQswg.png[/IMG] I have tried a lot of items in game and i just ran out of idea. I really need help thanks. I have another problem to, when you logout or restart the server the item you bought is gone in Grand Exchange and it takes the cash. Anyone have an answer for that? Thank you guys sooo much! Thanks, cya :D[/B]
  6. Character customisation is working. but.. [IMG]https://dl.dropboxusercontent.com/u/94482740/rspspics/charactercustomisation.png[/IMG] [IMG]https://dl.dropboxusercontent.com/u/94482740/rspspics/charactercustomisation2.png[/IMG] When I rejoin the server. [IMG]https://dl.dropboxusercontent.com/u/94482740/rspspics/charactercustomisation3.png[/IMG] Help pls
  7. [FONT=Arial Black][SIZE=3]Once I enter in all the information for the start.bat and I try to Save & Compile, it says " 'javac' is not recognized as an internal or external command, operable program or batch file."[/SIZE][/FONT] [SIZE=4]Help?[/SIZE]
  8. Hi guys, I realize that so many people have asked this question but I have been sitting here trying so hard to find a guide or website or even a post that can help me out. Before you say "use the search button", I have. I have tried Google, multiple rsps-server sites, searching, going through posts, I even asked the nerds on my skype friends' list :(.. everything that I am capable of doing.. and I am not having any luck. I'm not asking you to spoonfeed me anything, I'm just looking for a tip or tutorial or ANYTHING that can help me with this issue. My server right now has everything down from being able to access the character creation command to being able to pick anything that's in there. However, when you choose something and click accept, it'll save and everything. Well, since I'm really a co-owner, I asked the owner himself to tell me if he see's any changes whatsoever, and having my luck, the answer is no. The other issue is that after changing, you can equip anything and it reverts back to default. Do any of you have any idea as to why nobody else can see the changes being made/why it won't "technically" save? If any of you have any answers, just please post.
  9. go to com.rs2.util; and find playersave and on top u sould see [CODE] public static final String directory = "./data/characters/";[/CODE] right below that put [CODE] public static final String backup = "./data/charbackup/";[/CODE] now find [CODE]public static void save(final Player player) {[/CODE] and right before that add [CODE] public static void savebackup(final Player player) { try { @SuppressWarnings("unused") Misc.Stopwatch stopwatch = new Misc.Stopwatch(); File file = new File(backup + player.getUsername() + ".dat"); if (!file.exists()) { file.createNewFile(); } FileOutputStream outFile = new FileOutputStream(file); DataOutputStream write = new DataOutputStream(outFile); write.writeUTF(player.getUsername()); write.writeUTF(player.getPassword()); write.writeInt(player.getStaffRights()); write.writeInt(player.getPosition().getX()); write.writeInt(player.getPosition().getY()); write.writeInt(player.getPosition().getZ()); write.writeInt(player.getGender()); write.writeBoolean(player.shouldAutoRetaliate()); write.writeInt(player.getFightMode()); write.writeInt(player.getScreenBrightness()); write.writeInt(player.getMouseButtons()); write.writeInt(player.getChatEffects()); write.writeInt(player.getSplitPrivateChat()); write.writeInt(player.getAcceptAid()); write.writeInt(player.getMusicVolume()); write.writeInt(player.getEffectVolume()); write.writeInt(player.getQuestPoints()); write.writeDouble(player.getSpecialAmount()); write.writeBoolean(player.getBankPin().isChangingBankPin()); write.writeBoolean(player.getBankPin().isDeletingBankPin()); write.writeInt(player.getBankPin().getPinAppendYear()); write.writeInt(player.getBankPin().getPinAppendDay()); write.writeInt(player.getBindingNeckCharge()); write.writeInt(player.getRingOfForgingLife()); write.writeInt(player.getRingOfRecoilLife()); write.writeInt(player.getSkullTimer()); write.writeInt(player.getNewComersSide().getTutorialIslandStage()); write.writeInt(player.getNewComersSide().getProgressValue()); write.writeDouble(player.getEnergy()); write.writeBoolean(player.getMovementHandler().isRunToggled()); for (int i = 0; i < player.getBankPin().getBankPin().length; i++) { write.writeInt(player.getBankPin().getBankPin()[i]); } for (int i = 0; i < player.getBankPin().getPendingBankPin().length; i++) { write.writeInt(player.getBankPin().getPendingBankPin()[i]); } for (Object[] element : player.questData) { write.writeInt((Integer) element[1]); } for (int i = 0; i < 4; i++) { write.writeInt(player.getPouchData(i)); } for (int i = 0; i < player.getAppearance().length; i++) { write.writeInt(player.getAppearance()[i]); } for (int i = 0; i < player.getColors().length; i++) { write.writeInt(player.getColors()[i]); } for (int i = 0; i < player.getSkill().getLevel().length; i++) { write.writeInt(player.getSkill().getLevel()[i]); } for (int i = 0; i < player.getSkill().getExp().length; i++) { write.writeInt((int) player.getSkill().getExp()[i]); } for (int i = 0; i < 28; i++) { Item item = player.getInventory().getItemContainer().get(i); if (item == null) { write.writeInt(65535); } else { write.writeInt(item.getId()); write.writeInt(item.getCount()); write.writeInt(item.getTimer()); } } for (int i = 0; i < 14; i++) { Item item = player.getEquipment().getItemContainer().get(i); if (item == null) { write.writeInt(65535); } else { write.writeInt(item.getId()); write.writeInt(item.getCount()); } } for (int i = 0; i < BankManager.SIZE; i++) { Item item = player.getBank().get(i); if (item == null) { write.writeInt(65535); } else { write.writeInt(item.getId()); write.writeInt(item.getCount()); write.writeInt(item.getTimer()); } } for (int i = 0; i < player.getFriends().length; i++) { write.writeLong(player.getFriends()[i]); } for (int i = 0; i < player.getIgnores().length; i++) { write.writeLong(player.getIgnores()[i]); } for (int i = 0; i < player.getPendingItems().length; i++) { write.writeInt(player.getPendingItems()[i]); write.writeInt(player.getPendingItemsAmount()[i]); } write.writeInt(player.getRunecraftNpc()); write.writeLong(player.getMuteExpire()); write.writeLong(player.getBanExpire()); write.writeBoolean(player.hasKilledTreeSpirit()); write.writeBoolean(player.hasReset()); write.writeBoolean(player.hasKilledJungleDemon()); for (int i = 0; i < 6; i++) { write.writeBoolean(player.getBarrowsNpcDead(i)); } write.writeInt(player.getKillCount()); write.writeInt(player.getRandomGrave()); write.writeInt(player.getPoisonImmunity().ticksRemaining()); write.writeInt(player.getFireImmunity().ticksRemaining()); write.writeInt(player.getTeleblockTimer().ticksRemaining()); write.writeDouble(player.getPoisonDamage()); for (int i = 0; i < player.getAllotment().getFarmingStages().length; i++) { write.writeInt(player.getAllotment().getFarmingStages()[i]); } for (int i = 0; i < player.getAllotment().getFarmingSeeds().length; i++) { write.writeInt(player.getAllotment().getFarmingSeeds()[i]); } for (int i = 0; i < player.getAllotment().getFarmingHarvest().length; i++) { write.writeInt(player.getAllotment().getFarmingHarvest()[i]); } for (int i = 0; i < player.getAllotment().getFarmingState().length; i++) { write.writeInt(player.getAllotment().getFarmingState()[i]); } for (int i = 0; i < player.getAllotment().getFarmingTimer().length; i++) { write.writeLong(player.getAllotment().getFarmingTimer()[i]); } for (int i = 0; i < player.getAllotment().getDiseaseChance().length; i++) { write.writeDouble(player.getAllotment().getDiseaseChance()[i]); } for (int i = 0; i < player.getAllotment().getFarmingWatched().length; i++) { write.writeBoolean(player.getAllotment().getFarmingWatched()[i]); } for (int i = 0; i < player.getBushes().getFarmingStages().length; i++) { write.writeInt(player.getBushes().getFarmingStages()[i]); } for (int i = 0; i < player.getBushes().getFarmingSeeds().length; i++) { write.writeInt(player.getBushes().getFarmingSeeds()[i]); } for (int i = 0; i < player.getBushes().getFarmingState().length; i++) { write.writeInt(player.getBushes().getFarmingState()[i]); } for (int i = 0; i < player.getBushes().getFarmingTimer().length; i++) { write.writeLong(player.getBushes().getFarmingTimer()[i]); } for (int i = 0; i < player.getBushes().getFarmingChance().length; i++) { write.writeDouble(player.getBushes().getFarmingChance()[i]); } for (int i = 0; i < player.getBushes().getFarmingWatched().length; i++) { write.writeBoolean(player.getBushes().getFarmingWatched()[i]); } for (int i = 0; i < player.getFlowers().getFarmingStages().length; i++) { write.writeInt(player.getFlowers().getFarmingStages()[i]); } for (int i = 0; i < player.getFlowers().getFarmingSeeds().length; i++) { write.writeInt(player.getFlowers().getFarmingSeeds()[i]); } for (int i = 0; i < player.getFlowers().getFarmingState().length; i++) { write.writeInt(player.getFlowers().getFarmingState()[i]); } for (int i = 0; i < player.getFlowers().getFarmingTimer().length; i++) { write.writeLong(player.getFlowers().getFarmingTimer()[i]); } for (int i = 0; i < player.getFlowers().getDiseaseChance().length; i++) { write.writeDouble(player.getFlowers().getDiseaseChance()[i]); } for (int i = 0; i < player.getFruitTrees().getFarmingStages().length; i++) { write.writeInt(player.getFruitTrees().getFarmingStages()[i]); } for (int i = 0; i < player.getFruitTrees().getFarmingSeeds().length; i++) { write.writeInt(player.getFruitTrees().getFarmingSeeds()[i]); } for (int i = 0; i < player.getFruitTrees().getFarmingState().length; i++) { write.writeInt(player.getFruitTrees().getFarmingState()[i]); } for (int i = 0; i < player.getFruitTrees().getFarmingTimer().length; i++) { write.writeLong(player.getFruitTrees().getFarmingTimer()[i]); } for (int i = 0; i < player.getFruitTrees().getDiseaseChance().length; i++) { write.writeDouble(player.getFruitTrees().getDiseaseChance()[i]); } for (int i = 0; i < player.getFruitTrees().getFarmingWatched().length; i++) { write.writeBoolean(player.getFruitTrees().getFarmingWatched()[i]); } for (int i = 0; i < player.getHerbs().getFarmingStages().length; i++) { write.writeInt(player.getHerbs().getFarmingStages()[i]); } for (int i = 0; i < player.getHerbs().getFarmingSeeds().length; i++) { write.writeInt(player.getHerbs().getFarmingSeeds()[i]); } for (int i = 0; i < player.getHerbs().getFarmingHarvest().length; i++) { write.writeInt(player.getHerbs().getFarmingHarvest()[i]); } for (int i = 0; i < player.getHerbs().getFarmingState().length; i++) { write.writeInt(player.getHerbs().getFarmingState()[i]); } for (int i = 0; i < player.getHerbs().getFarmingTimer().length; i++) { write.writeLong(player.getHerbs().getFarmingTimer()[i]); } for (int i = 0; i < player.getHerbs().getDiseaseChance().length; i++) { write.writeDouble(player.getHerbs().getDiseaseChance()[i]); } for (int i = 0; i < player.getHops().getFarmingStages().length; i++) { write.writeInt(player.getHops().getFarmingStages()[i]); } for (int i = 0; i < player.getHops().getFarmingSeeds().length; i++) { write.writeInt(player.getHops().getFarmingSeeds()[i]); } for (int i = 0; i < player.getHops().getFarmingHarvest().length; i++) { write.writeInt(player.getHops().getFarmingHarvest()[i]); } for (int i = 0; i < player.getHops().getFarmingState().length; i++) { write.writeInt(player.getHops().getFarmingState()[i]); } for (int i = 0; i < player.getHops().getFarmingTimer().length; i++) { write.writeLong(player.getHops().getFarmingTimer()[i]); } for (int i = 0; i < player.getHops().getDiseaseChance().length; i++) { write.writeDouble(player.getHops().getDiseaseChance()[i]); } for (int i = 0; i < player.getHops().getFarmingWatched().length; i++) { write.writeBoolean(player.getHops().getFarmingWatched()[i]); } for (int i = 0; i < player.getSpecialPlantOne().getFarmingStages().length; i++) { write.writeInt(player.getSpecialPlantOne().getFarmingStages()[i]); } for (int i = 0; i < player.getSpecialPlantOne().getFarmingSeeds().length; i++) { write.writeInt(player.getSpecialPlantOne().getFarmingSeeds()[i]); } for (int i = 0; i < player.getSpecialPlantOne().getFarmingState().length; i++) { write.writeInt(player.getSpecialPlantOne().getFarmingState()[i]); } for (int i = 0; i < player.getSpecialPlantOne().getFarmingTimer().length; i++) { write.writeLong(player.getSpecialPlantOne().getFarmingTimer()[i]); } for (int i = 0; i < player.getSpecialPlantOne().getDiseaseChance().length; i++) { write.writeDouble(player.getSpecialPlantOne().getDiseaseChance()[i]); } for (int i = 0; i < player.getSpecialPlantTwo().getFarmingStages().length; i++) { write.writeInt(player.getSpecialPlantTwo().getFarmingStages()[i]); } for (int i = 0; i < player.getSpecialPlantTwo().getFarmingSeeds().length; i++) { write.writeInt(player.getSpecialPlantTwo().getFarmingSeeds()[i]); } for (int i = 0; i < player.getSpecialPlantTwo().getFarmingState().length; i++) { write.writeInt(player.getSpecialPlantTwo().getFarmingState()[i]); } for (int i = 0; i < player.getSpecialPlantTwo().getFarmingTimer().length; i++) { write.writeLong(player.getSpecialPlantTwo().getFarmingTimer()[i]); } for (int i = 0; i < player.getSpecialPlantTwo().getDiseaseChance().length; i++) { write.writeDouble(player.getSpecialPlantTwo().getDiseaseChance()[i]); } for (int i = 0; i < player.getTrees().getFarmingStages().length; i++) { write.writeInt(player.getTrees().getFarmingStages()[i]); } for (int i = 0; i < player.getTrees().getFarmingSeeds().length; i++) { write.writeInt(player.getTrees().getFarmingSeeds()[i]); } for (int i = 0; i < player.getTrees().getFarmingHarvest().length; i++) { write.writeInt(player.getTrees().getFarmingHarvest()[i]); } for (int i = 0; i < player.getTrees().getFarmingState().length; i++) { write.writeInt(player.getTrees().getFarmingState()[i]); } for (int i = 0; i < player.getTrees().getFarmingTimer().length; i++) { write.writeLong(player.getTrees().getFarmingTimer()[i]); } for (int i = 0; i < player.getTrees().getDiseaseChance().length; i++) { write.writeDouble(player.getTrees().getDiseaseChance()[i]); } for (int i = 0; i < player.getTrees().getFarmingWatched().length; i++) { write.writeBoolean(player.getTrees().getFarmingWatched()[i]); } for (int i = 0; i < player.getCompost().getCompostBins().length; i++) { write.writeInt(player.getCompost().getCompostBins()[i]); } for (int i = 0; i < player.getCompost().getCompostBinsTimer().length; i++) { write.writeLong(player.getCompost().getCompostBinsTimer()[i]); } for (int i = 0; i < player.getCompost().getOrganicItemAdded().length; i++) { write.writeInt(player.getCompost().getOrganicItemAdded()[i]); } for (int i = 0; i < player.getFarmingTools().getTools().length; i++) { write.writeInt(player.getFarmingTools().getTools()[i]); } write.writeInt(player.getSlayer().slayerMaster); write.writeUTF(player.getSlayer().slayerTask); write.writeInt(player.getSlayer().taskAmount); write.writeBoolean(player.getMagicBookType() == SpellBook.ANCIENT); write.writeBoolean(player.isBrimhavenDungeonOpen()); write.writeBoolean(player.hasKilledClueAttacker()); write.flush(); write.close(); } catch (Exception ex) { ex.printStackTrace(); } }[/CODE] now go to [CODE]com.rs2.model.players;[/CODE] and find [CODE] b = Benchmarks.getBenchmark("savePlayer");[/CODE] find [CODE]PlayerSave.save(this);[/CODE] and right below that add [CODE]PlayerSave.savebackup(this);[/CODE] That sould make backup chars when someone logs out i did this because i got a glitch when i was coding autosaving
  10. my comp restarts on me and when it does it dasnt save the char files in my server and people are getting really mad i need to know how to make it auto save every 1 min or so can someone plz help me :)
  11. [SIZE=5]Can anyone tell me how Appearences are saved so I can fix character creation?[/SIZE]
  12. Jonn

    Player Saving

    Hello, I am having trouble with Player Saving, When you log in you can do what ever you want collect items, etc. But as soon as you log out it deletes your saved data, When you log back in you are at the home with a new starter, or a brand new character. I am using the NRS3Server V4 Base, Here is my Playersave.Java. [B]Playersave.java:[/B] [CODE]package server.model.players; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import server.Server; import server.util.Misc; public class PlayerSave { /** *Loading **/ public static int loadGame(Client p, String playerName, String playerPass) { String line = ""; String token = ""; String token2 = ""; String[] token3 = new String[3]; boolean EndOfFile = false; int ReadMode = 0; BufferedReader characterfile = null; boolean File1 = false; try { characterfile = new BufferedReader(new FileReader("./Data/characters/"+playerName+".txt")); File1 = true; } catch(FileNotFoundException fileex1) { } if (File1) { //new File ("./characters/"+playerName+".txt"); } else { Misc.println(playerName+": character file not found."); p.newPlayer = false; return 0; } try { line = characterfile.readLine(); } catch(IOException ioexception) { Misc.println(playerName+": error loading file."); return 3; } while(EndOfFile == false && line != null) { line = line.trim(); int spot = line.indexOf("="); if (spot > -1) { token = line.substring(0, spot); token = token.trim(); token2 = line.substring(spot + 1); token2 = token2.trim(); token3 = token2.split("\t"); switch (ReadMode) { case 1: if (token.equals("character-password")) { if (playerPass.equalsIgnoreCase(token2) || Misc.basicEncrypt(playerPass).equals(token2)) { playerPass = token2; } else { return 3; } } break; case 2: if (token.equals("character-height")) { p.heightLevel = Integer.parseInt(token2); } else if (token.equals("character-posx")) { p.teleportToX = (Integer.parseInt(token2) <= 0 ? 3210 : Integer.parseInt(token2)); } else if (token.equals("character-posy")) { p.teleportToY = (Integer.parseInt(token2) <= 0 ? 3424 : Integer.parseInt(token2)); } else if (token.equals("character-rights")) { p.playerRights = Integer.parseInt(token2); } else if (token.equals("dungPoints")) { p.dungPoints = Integer.parseInt(token2); } else if (token.equals("Used-Puremaster")) { p.pure = Integer.parseInt(token2); } else if (token.equals("tutorial-progress")) { p.tutorial = Integer.parseInt(token2); } else if (token.equals("skull-timer")) { p.skullTimer = Integer.parseInt(token2); } else if (token.equals("EP")) { p.earningPotential = Integer.parseInt(token2); } else if (token.equals("character-longsword")) { p.vlsLeft = Integer.parseInt(token2); } else if (token.equals("character-warhammer")) { p.statLeft = Integer.parseInt(token2); } else if (token.equals("character-spear")) { p.vSpearLeft = Integer.parseInt(token2); } else if (token.equals("character-chainbody")) { p.vTopLeft = Integer.parseInt(token2); } else if (token.equals("shopcollect")) { p.playerCollect = Integer.parseInt(token2); } else if (token.equals("character-chainskirt")) { p.vLegsLeft = Integer.parseInt(token2); } else if (token.equals("character-full helm")) { p.sHelmLeft = Integer.parseInt(token2); } else if (token.equals("character-platebody")) { p.sTopLeft = Integer.parseInt(token2); } else if (token.equals("character-platelegs")) { p.sLegsLeft = Integer.parseInt(token2); } else if (token.equals("character-hood")) { p.zHoodLeft = Integer.parseInt(token2); } else if (token.equals("character-staff")) { p.zStaffLeft = Integer.parseInt(token2); } else if (token.equals("character-robe top")) { p.zTopLeft = Integer.parseInt(token2); } else if (token.equals("character-robe bottom")) { p.zBottomLeft = Integer.parseInt(token2); } else if (token.equals("character-leather body")) { p.mBodyLeft = Integer.parseInt(token2); } else if (token.equals("character-chaps")) { p.mChapsLeft = Integer.parseInt(token2); } else if (token.equals("magic-book")) { p.playerMagicBook = Integer.parseInt(token2); } else if (token.equals("xpLock")) { p.xpLock = Boolean.parseBoolean(token2); } else if (token.equals("Jailed")) { p.Jail = Boolean.parseBoolean(token2); } else if (token.equals("Agrith")) { p.Agrith = Boolean.parseBoolean(token2); } else if (token.equals("degrade")) { p.degradeTime = Integer.parseInt(token2); } else if (token.equals("Flambeed")) { p.Flambeed = Boolean.parseBoolean(token2); } else if (token.equals("Karamel")) { p.Karamel = Boolean.parseBoolean(token2); } else if (token.equals("Dessourt")) { p.Dessourt = Boolean.parseBoolean(token2); } else if (token.equals("culin")) { p.Culin = Boolean.parseBoolean(token2); } else if (token.equals("brother-info")) { p.barrowsNpcs[Integer.parseInt(token3[0])][1] = Integer.parseInt(token3[1]); } else if (token.equals("special-amount")) { p.specAmount = Double.parseDouble(token2); } else if (token.equals("selected-coffin")) { p.randomCoffin = Integer.parseInt(token2); } else if (token.equals("barrows-killcount")) { p.pkPoints = Integer.parseInt(token2); } else if (token.equals("teleblock-length")) { p.teleBlockDelay = System.currentTimeMillis(); p.teleBlockLength = Integer.parseInt(token2); } else if (token.equals("pc-points")) { p.pcPoints = Integer.parseInt(token2); } else if (token.equals("npc-kills")) { p.npcKills = Integer.parseInt(token2); } else if (token.equals("gwdelay")) { p.gwdelay = Integer.parseInt(token2); } else if (token.equals("summonSpec")) { p.summonSpec = Integer.parseInt(token2); } else if (token.equals("dungRest")) { p.dungRest = Integer.parseInt(token2); } else if (token.equals("Altar")) { p.altarPrayed = Integer.parseInt(token2); } else if (token.equals("Arma-KC")) { p.Arma = Integer.parseInt(token2); } else if (token.equals("Band-KC")) { p.Band = Integer.parseInt(token2); } else if (token.equals("Zammy-KC")) { p.Zammy = Integer.parseInt(token2); } else if (token.equals("Sara-KC")) { p.Sara = Integer.parseInt(token2); } else if (token.equals("pk-points")) { p.pkPoints = Integer.parseInt(token2); } else if (token.equals("isDonator")) { p.isDonator = Integer.parseInt(token2); } else if (token.equals("donatorChest")) { p.donatorChest = Integer.parseInt(token2); } else if (token.equals("slayerTask")) { p.slayerTask = Integer.parseInt(token2); } else if (token.equals("taskAmount")) { p.taskAmount = Integer.parseInt(token2); } else if (token.equals("magePoints")) { p.magePoints = Integer.parseInt(token2); } else if (line.startsWith("KC")) { p.KC = Integer.parseInt(token2); } else if (line.startsWith("DC")) { p.DC = Integer.parseInt(token2); } else if (line.startsWith("totalstored")) { p.totalstored = Integer.parseInt(token2); } else if (token.equals("autoRet")) { p.autoRet = Integer.parseInt(token2); } else if (token.equals("trade11")) { p.trade11 = Integer.parseInt(token2); } else if (token.equals("SpeDelay")) { p.SpecialDelay = Integer.parseInt(token2); } else if (token.equals("barrowskillcount")) { p.barrowsKillCount = Integer.parseInt(token2); } else if (token.equals("flagged")) { p.accountFlagged = Boolean.parseBoolean(token2); } else if (token.equals("Rules")) { p.readRules = Boolean.parseBoolean(token2); } else if (token.equals("isShopping")) { p.isShopping = Boolean.parseBoolean(token2); } else if (token.equals("SPoints")) { p.SPoints = Integer.parseInt(token2); } else if (token.equals("wave")) { p.waveId = Integer.parseInt(token2); } else if (token.equals("dfs-charges")) { p.dfsCount = Integer.parseInt(token2); } else if (token.equals("lastsummon")) { p.lastsummon = Integer.parseInt(token2); } else if (token.equals("summoningnpcid")) { p.summoningnpcid = Integer.parseInt(token2); } else if (token.equals("void")) { for (int j = 0; j < token3.length; j++) { p.voidStatus[j] = Integer.parseInt(token3[j]); } } else if (token.equals("fightMode")) { p.fightMode = Integer.parseInt(token2); } else if (token.equals("Black-marks")) { p.BlackMarks = Integer.parseInt(token2); } break; case 3: if (token.equals("character-equip")) { p.playerEquipment[Integer.parseInt(token3[0])] = Integer.parseInt(token3[1]); p.playerEquipmentN[Integer.parseInt(token3[0])] = Integer.parseInt(token3[2]); } break; case 4: if (token.equals("character-look")) { p.playerAppearance[Integer.parseInt(token3[0])] = Integer.parseInt(token3[1]); } break; case 5: if (token.equals("character-skill")) { p.playerLevel[Integer.parseInt(token3[0])] = Integer.parseInt(token3[1]); p.playerXP[Integer.parseInt(token3[0])] = Integer.parseInt(token3[2]); } break; case 6: if (token.equals("character-item")) { p.playerItems[Integer.parseInt(token3[0])] = Integer.parseInt(token3[1]); p.playerItemsN[Integer.parseInt(token3[0])] = Integer.parseInt(token3[2]); } break; case 7: if (token.equals("character-bank")) { p.bankItems[Integer.parseInt(token3[0])] = Integer.parseInt(token3[1]); p.bankItemsN[Integer.parseInt(token3[0])] = Integer.parseInt(token3[2]); } break; case 8: if (token.equals("character-friend")) { p.friends[Integer.parseInt(token3[0])] = Long.parseLong(token3[1]); } break; case 9: /* if (token.equals("character-ignore")) { ignores[Integer.parseInt(token3[0])] = Long.parseLong(token3[1]); } */ break; case 20: if (token.equals("stored")) { p.storeditems[Integer.parseInt(token3[0])] = Integer.parseInt(token3[1]); } break; case 21: if (token.equals("occupy")) { p.occupied[Integer.parseInt(token3[0])] = Boolean.parseBoolean(token3[1]); } break; case 10: if (token.equals("character-shop")) { p.playerShop[Integer.parseInt(token3[0])] = Integer.parseInt(token3[1]); p.playerShopP[Integer.parseInt(token3[0])] = Integer.parseInt(token3[2]); p.playerShopN[Integer.parseInt(token3[0])] = Integer.parseInt(token3[3]); } break; } } else { if (line.equals("[ACCOUNT]")) { ReadMode = 1; } else if (line.equals("[CHARACTER]")) { ReadMode = 2; } else if (line.equals("[EQUIPMENT]")) { ReadMode = 3; } else if (line.equals("[LOOK]")) { ReadMode = 4; } else if (line.equals("[SKILLS]")) { ReadMode = 5; } else if (line.equals("[ITEMS]")) { ReadMode = 6; } else if (line.equals("[BANK]")) { ReadMode = 7; } else if (line.equals("[FRIENDS]")) { ReadMode = 8; } else if (line.equals("[IGNORES]")) { ReadMode = 9; } else if (line.equals("[STORED]")) { ReadMode = 20; } else if (line.equals("[OCCUPY]")) { ReadMode = 21; } else if (line.equals("[SHOP]")) { ReadMode = 10; } else if (line.equals("[EOF]")) { try { characterfile.close(); } catch(IOException ioexception) { } return 1; } } try { line = characterfile.readLine(); } catch(IOException ioexception1) { EndOfFile = true; } } try { characterfile.close(); } catch(IOException ioexception) { } return 13; } /** *Saving **/ public static boolean saveGame(Client p) { if(!p.saveFile || p.newPlayer || !p.saveCharacter) { //System.out.println("first"); return false; } if(p.playerName == null || Server.playerHandler.players[p.playerId] == null) { //System.out.println("second"); return false; } p.playerName = p.playerName2; int tbTime = (int)(p.teleBlockDelay - System.currentTimeMillis() + p.teleBlockLength); if(tbTime > 300000 || tbTime < 0){ tbTime = 0; } BufferedWriter characterfile = null; try { characterfile = new BufferedWriter(new FileWriter("./Data/characters/"+p.playerName+".txt")); /*ACCOUNT*/ characterfile.write("[ACCOUNT]", 0, 9); characterfile.newLine(); characterfile.write("character-username = ", 0, 21); characterfile.write(p.playerName, 0, p.playerName.length()); characterfile.newLine(); characterfile.write("character-password = ", 0, 21); characterfile.write(p.playerPass, 0, p.playerPass.length()); characterfile.newLine(); characterfile.newLine(); characterfile.write("KC = ", 0, 4); characterfile.write(Integer.toString(p.KC), 0, Integer.toString(p.KC).length()); characterfile.newLine(); characterfile.write("DC = ", 0, 4); characterfile.write(Integer.toString(p.DC), 0, Integer.toString(p.DC).length()); characterfile.newLine(); /*CHARACTER*/ characterfile.write("[CHARACTER]", 0, 11); characterfile.newLine(); characterfile.write("character-height = ", 0, 19); characterfile.write(Integer.toString(p.heightLevel), 0, Integer.toString(p.heightLevel).length()); characterfile.newLine(); characterfile.write("character-posx = ", 0, 17); characterfile.write(Integer.toString(p.absX), 0, Integer.toString(p.absX).length()); characterfile.newLine(); characterfile.write("character-posy = ", 0, 17); characterfile.write(Integer.toString(p.absY), 0, Integer.toString(p.absY).length()); characterfile.newLine(); characterfile.write("character-rights = ", 0, 19); characterfile.write(Integer.toString(p.playerRights), 0, Integer.toString(p.playerRights).length()); characterfile.newLine(); characterfile.write("shopcollect = ", 0, 14); characterfile.write(Integer.toString(p.playerCollect), 0, Integer.toString(p.playerCollect).length()); characterfile.newLine(); characterfile.write("dungPoints = ", 0, 12); characterfile.write(Integer.toString(p.dungPoints), 0, Integer.toString(p.dungPoints).length()); characterfile.newLine(); characterfile.write("crystal-bow-shots = ", 0, 20); characterfile.write(Integer.toString(p.crystalBowArrowCount), 0, Integer.toString(p.crystalBowArrowCount).length()); characterfile.newLine(); characterfile.write("VLS-hits = ", 0, 11); characterfile.write(Integer.toString(p.degradeTime), 0, Integer.toString(p.degradeTime).length()); /*characterfile.newLine(); characterfile.write("dungPoints = ", 0, 20); characterfile.write(Integer.toString(p.dungPoints), 0, Integer.toString(p.dungPoints).length());*/ characterfile.newLine(); characterfile.write("skull-timer = ", 0, 14); characterfile.write(Integer.toString(p.skullTimer), 0, Integer.toString(p.skullTimer).length()); characterfile.newLine(); characterfile.write("EP = ", 0, 5); characterfile.write(Integer.toString(p.earningPotential), 0, Integer.toString(p.earningPotential).length()); characterfile.newLine(); characterfile.write("character-longsword = ", 0, 22); characterfile.write(Integer.toString(p.vlsLeft), 0, Integer.toString(p.vlsLeft).length()); characterfile.newLine(); characterfile.write("character-warhammer = ", 0, 22); characterfile.write(Integer.toString(p.statLeft), 0, Integer.toString(p.statLeft).length()); characterfile.newLine(); characterfile.write("character-spear = ", 0, 18); characterfile.write(Integer.toString(p.vSpearLeft), 0, Integer.toString(p.vSpearLeft).length()); characterfile.newLine(); characterfile.write("character-chainbody = ", 0, 22); characterfile.write(Integer.toString(p.vTopLeft), 0, Integer.toString(p.vTopLeft).length()); characterfile.newLine(); characterfile.write("character-chainskirt = ", 0, 23); characterfile.write(Integer.toString(p.vLegsLeft), 0, Integer.toString(p.vLegsLeft).length()); characterfile.newLine(); characterfile.write("character-full helm = ", 0, 22); characterfile.write(Integer.toString(p.sHelmLeft), 0, Integer.toString(p.sHelmLeft).length()); characterfile.newLine(); characterfile.write("character-platebody = ", 0, 22); characterfile.write(Integer.toString(p.sTopLeft), 0, Integer.toString(p.sTopLeft).length()); characterfile.newLine(); characterfile.write("character-platelegs = ", 0, 22); characterfile.write(Integer.toString(p.sLegsLeft), 0, Integer.toString(p.sLegsLeft).length()); characterfile.newLine(); characterfile.write("character-hood = ", 0, 17); characterfile.write(Integer.toString(p.zHoodLeft), 0, Integer.toString(p.zHoodLeft).length()); characterfile.newLine(); characterfile.write("character-staff = ", 0, 18); characterfile.write(Integer.toString(p.zStaffLeft), 0, Integer.toString(p.zStaffLeft).length()); characterfile.newLine(); characterfile.write("character-robe top = ", 0, 21); characterfile.write(Integer.toString(p.zTopLeft), 0, Integer.toString(p.zTopLeft).length()); characterfile.newLine(); characterfile.write("character-robe bottom = ", 0, 24); characterfile.write(Integer.toString(p.zBottomLeft), 0, Integer.toString(p.zBottomLeft).length()); characterfile.newLine(); characterfile.write("character-leather body = ", 0, 25); characterfile.write(Integer.toString(p.mBodyLeft), 0, Integer.toString(p.mBodyLeft).length()); characterfile.newLine(); characterfile.write("character-chaps = ", 0, 18); characterfile.write(Integer.toString(p.mChapsLeft), 0, Integer.toString(p.mChapsLeft).length()); characterfile.newLine(); characterfile.write("magic-book = ", 0, 13); characterfile.write(Integer.toString(p.playerMagicBook), 0, Integer.toString(p.playerMagicBook).length()); characterfile.newLine(); for (int b = 0; b < p.barrowsNpcs.length; b++) { characterfile.write("brother-info = ", 0, 15); characterfile.write(Integer.toString(b), 0, Integer.toString(b).length()); characterfile.write(" ", 0, 1); characterfile.write(p.barrowsNpcs[b][1] <= 1 ? Integer.toString(0) : Integer.toString(p.barrowsNpcs[b][1]), 0, Integer.toString(p.barrowsNpcs[b][1]).length()); characterfile.newLine(); } characterfile.write("special-amount = ", 0, 17); characterfile.write(Double.toString(p.specAmount), 0, Double.toString(p.specAmount).length()); characterfile.newLine(); characterfile.write("selected-coffin = ", 0, 18); characterfile.write(Integer.toString(p.randomCoffin), 0, Integer.toString(p.randomCoffin).length()); characterfile.newLine(); characterfile.write("barrows-killcount = ", 0, 20); characterfile.write(Integer.toString(p.barrowsKillCount), 0, Integer.toString(p.barrowsKillCount).length()); characterfile.newLine(); characterfile.write("teleblock-length = ", 0, 19); characterfile.write(Integer.toString(tbTime), 0, Integer.toString(tbTime).length()); characterfile.newLine(); characterfile.write("pc-points = ", 0, 12); characterfile.write(Integer.toString(p.pcPoints), 0, Integer.toString(p.pcPoints).length()); characterfile.newLine(); characterfile.write("npc-kills = ", 0, 12); characterfile.write(Integer.toString(p.npcKills), 0, Integer.toString(p.npcKills).length()); characterfile.newLine(); characterfile.write("gwdelay = ", 0, 10); characterfile.write(Integer.toString(p.gwdelay), 0, Integer.toString(p.gwdelay).length()); characterfile.newLine(); characterfile.write("summonSpec = ", 0, 10); characterfile.write(Integer.toString(p.summonSpec), 0, Integer.toString(p.summonSpec).length()); characterfile.newLine(); characterfile.write("dungRest = ", 0, 10); characterfile.write(Integer.toString(p.dungRest), 0, Integer.toString(p.dungRest).length()); characterfile.newLine(); characterfile.write("Altar = ", 0, 8); characterfile.write(Integer.toString(p.altarPrayed), 0, Integer.toString(p.altarPrayed).length()); characterfile.newLine(); characterfile.write("Arma-KC = ", 0, 10); characterfile.write(Integer.toString(p.Arma), 0, Integer.toString(p.Arma).length()); characterfile.newLine(); characterfile.write("Band-KC = ", 0, 10); characterfile.write(Integer.toString(p.Band), 0, Integer.toString(p.Band).length()); characterfile.newLine(); characterfile.write("Zammy-KC = ", 0, 11); characterfile.write(Integer.toString(p.Zammy), 0, Integer.toString(p.Zammy).length()); characterfile.newLine(); characterfile.write("Sara-KC = ", 0, 10); characterfile.write(Integer.toString(p.Sara), 0, Integer.toString(p.Sara).length()); characterfile.newLine(); characterfile.newLine(); characterfile.write("pk-points = ", 0, 12); characterfile.write(Integer.toString(p.pkPoints), 0, Integer.toString(p.pkPoints).length()); characterfile.newLine(); characterfile.newLine(); characterfile.write("isDonator = ", 0, 12); characterfile.write(Integer.toString(p.isDonator), 0, Integer.toString(p.isDonator).length()); characterfile.newLine(); characterfile.write("donatorChest = ", 0, 15); characterfile.write(Integer.toString(p.donatorChest), 0, Integer.toString(p.donatorChest).length()); characterfile.newLine(); characterfile.write("slayerTask = ", 0, 13); characterfile.write(Integer.toString(p.slayerTask), 0, Integer.toString(p.slayerTask).length()); characterfile.newLine(); characterfile.write("xpLock = ", 0, 9); characterfile.write(Boolean.toString(p.xpLock), 0, Boolean.toString(p.xpLock).length()); characterfile.newLine(); characterfile.write("Agrith = ", 0, 9); characterfile.write(Boolean.toString(p.Agrith), 0, Boolean.toString(p.Agrith).length()); characterfile.newLine(); characterfile.write("Flambeed = ", 0, 11); characterfile.write(Boolean.toString(p.Flambeed), 0, Boolean.toString(p.Flambeed).length()); characterfile.newLine(); characterfile.write("Karamel = ", 0, 10); characterfile.write(Boolean.toString(p.Karamel), 0, Boolean.toString(p.Karamel).length()); characterfile.newLine(); characterfile.write("Dessourt = ", 0, 11); characterfile.write(Boolean.toString(p.Dessourt), 0, Boolean.toString(p.Dessourt).length()); characterfile.newLine(); characterfile.write("culin = ", 0, 8); characterfile.write(Boolean.toString(p.Culin), 0, Boolean.toString(p.Culin).length()); characterfile.newLine(); characterfile.write("taskAmount = ", 0, 13); characterfile.write(Integer.toString(p.taskAmount), 0, Integer.toString(p.taskAmount).length()); characterfile.newLine(); characterfile.write("magePoints = ", 0, 13); characterfile.write(Integer.toString(p.magePoints), 0, Integer.toString(p.magePoints).length()); characterfile.newLine(); characterfile.write("KC = ", 0, 4); characterfile.write(Integer.toString(p.KC), 0, Integer.toString(p.KC).length()); characterfile.newLine(); characterfile.write("DC = ", 0, 4); characterfile.write(Integer.toString(p.DC), 0, Integer.toString(p.DC).length()); characterfile.newLine(); characterfile.write("totalstored = ", 0, 14); characterfile.write(Integer.toString(p.totalstored), 0, Integer.toString(p.totalstored).length()); characterfile.newLine(); characterfile.write("autoRet = ", 0, 10); characterfile.write(Integer.toString(p.autoRet), 0, Integer.toString(p.autoRet).length()); characterfile.newLine(); characterfile.write("trade11 = ", 0, 10); characterfile.write(Integer.toString(p.trade11), 0, Integer.toString(p.trade11).length()); characterfile.newLine(); characterfile.write("SpeDelay = ", 0, 11); characterfile.write(Long.toString(p.SpecialDelay), 0, Long.toString(p.SpecialDelay).length()); characterfile.newLine(); characterfile.write("barrowskillcount = ", 0, 19); characterfile.write(Integer.toString(p.barrowsKillCount), 0, Integer.toString(p.barrowsKillCount).length()); characterfile.newLine(); characterfile.write("flagged = ", 0, 10); characterfile.write(Boolean.toString(p.accountFlagged), 0, Boolean.toString(p.accountFlagged).length()); characterfile.newLine(); characterfile.write("Rules = ", 0, 8); characterfile.write(Boolean.toString(p.readRules), 0, Boolean.toString(p.readRules).length()); characterfile.newLine(); characterfile.write("shopping = ", 0, 11); characterfile.write(Boolean.toString(p.isShopping), 0, Boolean.toString(p.isShopping).length()); characterfile.newLine(); characterfile.write("Jailed = ", 0, 9); characterfile.write(Boolean.toString(p.Jail), 0, Boolean.toString(p.Jail).length()); characterfile.newLine(); characterfile.write("wave = ", 0, 7); characterfile.write(Integer.toString(p.waveId), 0, Integer.toString(p.waveId).length()); characterfile.newLine(); characterfile.write("dfs-charges = ", 0, 14); characterfile.write(Integer.toString(p.dfsCount), 0, Integer.toString(p.dfsCount).length()); characterfile.newLine(); characterfile.write("lastsummon = ", 0, 13); characterfile.write(Integer.toString(p.lastsummon), 0, Integer.toString(p.lastsummon).length()); characterfile.newLine(); characterfile.write("summoningnpcid = ", 0, 17); characterfile.write(Integer.toString(p.summoningnpcid), 0, Integer.toString(p.summoningnpcid).length()); characterfile.newLine(); characterfile.write("fightMode = ", 0, 12); characterfile.write(Integer.toString(p.fightMode), 0, Integer.toString(p.fightMode).length()); characterfile.newLine(); characterfile.write("SPoints = ", 0, 10); characterfile.write(Integer.toString(p.SPoints), 0, Integer.toString(p.SPoints).length()); characterfile.newLine(); characterfile.write("dungPoints = ", 0, 12); characterfile.write(Integer.toString(p.dungPoints), 0, Integer.toString(p.dungPoints).length()); characterfile.newLine(); characterfile.write("Black-marks = ", 0, 12); characterfile.write(Integer.toString(p.BlackMarks), 0, Integer.toString(p.BlackMarks).length()); characterfile.newLine(); characterfile.write("void = ", 0, 7); String toWrite = p.voidStatus[0] + "\t" + p.voidStatus[1] + "\t" + p.voidStatus[2] + "\t" + p.voidStatus[3] + "\t" + p.voidStatus[4]; characterfile.write(toWrite); characterfile.newLine(); characterfile.newLine(); /*EQUIPMENT*/ characterfile.write("[EQUIPMENT]", 0, 11); characterfile.newLine(); for (int i = 0; i < p.playerEquipment.length; i++) { characterfile.write("character-equip = ", 0, 18); characterfile.write(Integer.toString(i), 0, Integer.toString(i).length()); characterfile.write(" ", 0, 1); characterfile.write(Integer.toString(p.playerEquipment[i]), 0, Integer.toString(p.playerEquipment[i]).length()); characterfile.write(" ", 0, 1); characterfile.write(Integer.toString(p.playerEquipmentN[i]), 0, Integer.toString(p.playerEquipmentN[i]).length()); characterfile.write(" ", 0, 1); characterfile.newLine(); } characterfile.newLine(); /*LOOK*/ characterfile.write("[LOOK]", 0, 6); characterfile.newLine(); for (int i = 0; i < p.playerAppearance.length; i++) { characterfile.write("character-look = ", 0, 17); characterfile.write(Integer.toString(i), 0, Integer.toString(i).length()); characterfile.write(" ", 0, 1); characterfile.write(Integer.toString(p.playerAppearance[i]), 0, Integer.toString(p.playerAppearance[i]).length()); characterfile.newLine(); } characterfile.newLine(); /*SKILLS*/ characterfile.write("[SKILLS]", 0, 8); characterfile.newLine(); for (int i = 0; i < p.playerLevel.length; i++) { characterfile.write("character-skill = ", 0, 18); characterfile.write(Integer.toString(i), 0, Integer.toString(i).length()); characterfile.write(" ", 0, 1); characterfile.write(Integer.toString(p.playerLevel[i]), 0, Integer.toString(p.playerLevel[i]).length()); characterfile.write(" ", 0, 1); characterfile.write(Integer.toString(p.playerXP[i]), 0, Integer.toString(p.playerXP[i]).length()); characterfile.newLine(); } characterfile.newLine(); /*ITEMS*/ characterfile.write("[ITEMS]", 0, 7); characterfile.newLine(); for (int i = 0; i < p.playerItems.length; i++) { if (p.playerItems[i] > 0) { characterfile.write("character-item = ", 0, 17); characterfile.write(Integer.toString(i), 0, Integer.toString(i).length()); characterfile.write(" ", 0, 1); characterfile.write(Integer.toString(p.playerItems[i]), 0, Integer.toString(p.playerItems[i]).length()); characterfile.write(" ", 0, 1); characterfile.write(Integer.toString(p.playerItemsN[i]), 0, Integer.toString(p.playerItemsN[i]).length()); characterfile.newLine(); } } characterfile.newLine(); /*BANK*/ characterfile.write("[BANK]", 0, 6); characterfile.newLine(); for (int i = 0; i < p.bankItems.length; i++) { if (p.bankItems[i] > 0) { characterfile.write("character-bank = ", 0, 17); characterfile.write(Integer.toString(i), 0, Integer.toString(i).length()); characterfile.write(" ", 0, 1); characterfile.write(Integer.toString(p.bankItems[i]), 0, Integer.toString(p.bankItems[i]).length()); characterfile.write(" ", 0, 1); characterfile.write(Integer.toString(p.bankItemsN[i]), 0, Integer.toString(p.bankItemsN[i]).length()); characterfile.newLine(); } } characterfile.newLine(); /*FRIENDS*/ characterfile.write("[FRIENDS]", 0, 9); characterfile.newLine(); for (int i = 0; i < p.friends.length; i++) { if (p.friends[i] > 0) { characterfile.write("character-friend = ", 0, 19); characterfile.write(Integer.toString(i), 0, Integer.toString(i).length()); characterfile.write(" ", 0, 1); characterfile.write("" + p.friends[i]); characterfile.newLine(); } } characterfile.newLine(); /*Storeditems*/ characterfile.write("[STORED]", 0, 8); characterfile.newLine(); for (int i = 0; i < p.storeditems.length; i++) { characterfile.write("stored = ", 0, 9); characterfile.write(Integer.toString(i), 0, Integer.toString(i).length()); characterfile.write(" ", 0, 1); characterfile.write(Integer.toString(p.storeditems[i]), 0, Integer.toString(p.storeditems[i]).length()); characterfile.newLine(); } characterfile.newLine(); /*Storeditems*/ characterfile.write("[OCCUPY]", 0, 8); characterfile.newLine(); for (int i = 0; i < p.occupied.length; i++) { characterfile.write("occupy = ", 0, 9); characterfile.write(Integer.toString(i), 0, Integer.toString(i).length()); characterfile.write(" ", 0, 1); characterfile.write(Boolean.toString(p.occupied[i]), 0, Boolean.toString(p.occupied[i]).length()); characterfile.newLine(); } characterfile.newLine(); /*SHOP*/ characterfile.write("[SHOP]", 0, 6); characterfile.newLine(); for (int i = 0; i < p.playerShop.length; i++) { if (p.playerShop[i] > 0) { characterfile.write("character-shop = ", 0, 17); characterfile.write(Integer.toString(i), 0, Integer.toString(i).length()); characterfile.write(" ", 0, 1); characterfile.write(Integer.toString(p.playerShop[i]), 0, Integer.toString(p.playerShop[i]).length()); characterfile.write(" ", 0, 1); characterfile.write(Integer.toString(p.playerShopP[i]), 0, Integer.toString(p.playerShopP[i]).length()); characterfile.write(" ", 0, 1); characterfile.write(Integer.toString(p.playerShopN[i]), 0, Integer.toString(p.playerShopN[i]).length()); characterfile.newLine(); } } characterfile.newLine(); /*IGNORES*/ /*characterfile.write("[IGNORES]", 0, 9); characterfile.newLine(); for (int i = 0; i < ignores.length; i++) { if (ignores[i] > 0) { characterfile.write("character-ignore = ", 0, 19); characterfile.write(Integer.toString(i), 0, Integer.toString(i).length()); characterfile.write(" ", 0, 1); characterfile.write(Long.toString(ignores[i]), 0, Long.toString(ignores[i]).length()); characterfile.newLine(); } } characterfile.newLine();*/ /*EOF*/ characterfile.write("[EOF]", 0, 5); characterfile.newLine(); characterfile.newLine(); characterfile.close(); } catch(IOException ioexception) { Misc.println(p.playerName+": error writing file."); return false; } return true; } }[/CODE] If anyone could help me out with this it would mean a lot! Thanks, Jonn
  13. [b]Adding fully working ingame hiscores with saving for PI.[/b] In src/server/model/players, make a new class called HighScores.java and add this in: [code]package server.model.players; import java.io.*; import server.Config; import server.Server; import server.model.players.Client; import server.util.Misc; /** * Handles the ingame highscores. * * @author Bradley Carels */ public class HighScores { public static Object[][] PLAYERS = new Object[10][3]; public static void load() { try { BufferedReader in = new BufferedReader(new FileReader("./Data/highscores.txt")); for (int i = 0; i < 10; i++) { String[] data = in.readLine().split(" "); for (int j = 0; j < data.length; j++) PLAYERS[i][j] = (j == 0 ? data[j] : Integer.parseInt(data[j])); } System.out.println("Loaded HighScores."); } catch (IOException e) { System.out.println("Error loading HighScores."); } } public static void save() { for (int i = 0; i < 10; i++) { if (PLAYERS[i][0] == null) return; } try { BufferedWriter out = new BufferedWriter(new FileWriter("./Data/highscores.txt")); for (int i = 0; i < 10; i++) { String line = PLAYERS[i][0] + " " + PLAYERS[i][1] + " " + PLAYERS[i][2]; out.write(line, 0, line.length()); out.newLine(); } out.close(); } catch (IOException e) { System.out.println("Error saving HighScores."); } } public static void open(Client c) { c.getPA().showInterface(6308); c.getPA().sendFrame126(Config.SERVER_NAME + " HighScores", 6400); c.getPA().sendFrame126("Top PKers:", 6399); for (int i = 0; i < 40; i++) c.getPA().sendFrame126("", 8578 + i); for (int i = 0; i < 10; i++) c.getPA().sendFrame126(PLAYERS[i][1] + ". " + PLAYERS[i][0] + " - " + PLAYERS[i][2] + " Kills", 6402 + i); } public static void update(Client c) { for (int i = 0; i < 10; i++) { if (c.kills > (Integer) PLAYERS[i][2] && (c.kills < (Integer) PLAYERS[i - (i == 0 ? 0 : 1)][2] || i == 0)) { PLAYERS[i][0] = c.playerName; PLAYERS[i][2] = c.kills; } } } }[/code] [b]Edit the variables to suit your needs.[/b] Next in ActionHandler.java search for: [code]switch(objectType) {[/code] Under that switch statement add: [code] case 3192: HighScores.open(c); break;[/code] Now open Client.java and search for: [code]process() {[/code] Under that add: [code] HighScores.update(this);[/code] Now go in ShutDownHook.java and search for: [code]public void run() {[/code] Under that line add: [code] HighScores.save();[/code] Next open Server.java and search for: [code]public static void main[/code] And under that line add: [code] HighScores.load();[/code] Next open ObjectManager.java and search for: [code]public void loadCustomSpawns(Client c) {[/code] Under that add: [code] c.getPA().checkObjectSpawn(3192, 3222, 3218, 0, 10); // scoreboard[/code] Change these coordinates to wherever you want, this currently spawns the scoreboard in Lumbridge. [color=red]Last step![/color] Lastly, go into your Data folder and make a new text document called highscores.txt [b]If you followed the tutorial correctly, you now have fully working ingame highscores![/b] As always, all credits go to me. Enjoy. ;) Picture: [IMG]http://i1224.photobucket.com/albums/ee365/ZBradleyX/highscores2.png[/IMG]
  14. jaideep00

    auto saving

    hi guys i need help with auto saving players in my server said please have auto saving if someone cane do auto savin for me will be so thankfuls or if u have a tutorial for that will be greatt to thanks! skype id is :helprsps thanks for helping
  15. Not hard, but convenient. [CODE]/** * Location saving */ private WorldTile savedLocation;[/CODE] [CODE]/** * Saves a location. * [MENTION=75098]Para[/MENTION]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 * * [MENTION=75098]Para[/MENTION]m delayTime * - Time in which the player must be teleported * [MENTION=75098]Para[/MENTION]m event * - what you want to player to preform before the delay time * runs out * [MENTION=75098]Para[/MENTION]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; [MENTION=15855]Over[/MENTION]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.
  16. Can anyone give me a bit of a tut as to how I would go about saving the char files to a database? I know I could expand for the rest of the char files, but I want to make sure it's done correctly. Any help is greatly appreciated. Thanks :)
  17. In server.java under [code] public static void main(java.lang.String args[]) throws NullPointerException, IOException { [/code] add this [code] java.awt.Frame frame = new java.awt.Frame(); frame.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent e) { System.out.println("Saving all players."); synchronized (this) { for(Player p : PlayerHandler.players) { if(p == null) continue; PlayerSave.saveGame((Client)p); lastMassSave = System.currentTimeMillis(); } System.exit(0); } } }); frame.setVisible(true); [/code]
  18. Alright i have my game done its called SurvivalX it is supposed to be a rpg but i can not figure out how to make the game data save for that computer like it saves a game file somewhere. MSN: [email][email protected][/email] Skype: Joshy426
  19. Hi, what is wrong with this commands, as it does not save the players appearance, when i relog, im back to normal. What do I have to add to get this working? Thanks [QUOTE] if (command[0].equals("char")) { ActionSender.sendWindowsPane(player, 1028, 0); ActionSender.sendAMask(player, 2, 1028, 45, 0, 204); ActionSender.sendAMask(player, 2, 1028, 111, 0, 204); ActionSender.sendAMask(player, 2, 1028, 107, 0, 204); player.getMask().setApperanceUpdate(true); }[/QUOTE]
  20. This fixes the lottery. When the server crashes/you shut it off, the arrays of players entered no longer exist. Therefor, all members entered will lose there entry cash. [code] /** * Put shutdown loop; returns cash if restarting * * @author thedopekid * @param client */ public void refundLottery(Client c) { for (String entries : lotteryPlayersNames) { if (c.playerName.equalsIgnoreCase(entries)) { c.getItems().addItem(995, entryPrice * 1000000); c.sendMessage("Your lottery entry has been refunded due to a restart."); } } } [/code] Then in your shutdown hook add: [code] for (int j = 0; j < Server.playerHandler.players.length; j++) { if (Server.playerHandler.players[j] != null) { Client all = (Client) Server.playerHandler.players[j]; for (String lotteryEntries : Server.lottery.lotteryPlayersNames) { if (all.playerName .equalsIgnoreCase(lotteryEntries)) { Server.lottery.refundLottery(all); } } } } [/code]
  21. Title says it all, Thanks in advanced... The character files are saving as a [SIZE=6]* .ser *[/SIZE] file and not a .txt file so I can't read them and change rights.
  22. Do you think you should save yourself to marriage, or at least until you love someone? Or should you just have sex when you feel like it? I may have an argument up soon, but I'll just leave the question here.
  23. Since Misty had shut down Runesky, i have purshased it from her for $400.00. Yes, it is the EXACT source used by her, except all of her accountsaves are gone. The Server is up and running, but will not be released yet , as their is one problem The Server will NOT save accounts. if you have any idea why, or how to fix it, feel free to add my msn, or skype, or respond here. Depending on if you really know what your doing, i may pay you. Please DON'T Waste My Time. skype: c.begley33 msn: decatur33 at live dot com
  24. well guys i need help with the command char after you change what your character looks like it dosent save so i need help anyone that helps will get a thing called well done mate thanks for helping :)
  25. Okay, this will only work if you have done modifications to the player update method that allows you to load custom outfits that overwrite what you are currently wearing (thanks to Emily for getting me in the mood of looking into this (with that color customization max cape shit)). The command will take what you are wearing and save a correct conventions command to a text file that can just be copy pasted into the admincommands.java. Usage of the command is ';;saveoutfit (nameofcommand)' I don't know how helpful this is, but it saved me a shit ton of time on having to manually go into the player text file and find the equipment, then copy and paste the equipment item ids into a command blah blah I am getting bored just talking about it lol. [code] if (cmd[0].equals(";;saveoutfit")) { try { String commandy = ";;"+cmd[1]; FileWriter fstream = new FileWriter("outfitcodes.txt", true); BufferedWriter out = new BufferedWriter(fstream); out.write(" //"+cmd[1]); out.newLine(); out.write(" if (cmd[0].equals("+commandy+")) {"); out.newLine(); out.write(" player.specialHat = new Item("+player.getEquipment().get(0).getDefinition().getId()+", 1);"); out.newLine(); out.write(" player.specialCape = new Item("+player.getEquipment().get(1).getDefinition().getId()+", 1);"); out.newLine(); out.write(" player.specialAmulet = new Item("+player.getEquipment().get(2).getDefinition().getId()+", 1);"); out.newLine(); out.write(" player.specialWeapon = new Item("+player.getEquipment().get(3).getDefinition().getId()+", 1);"); out.newLine(); out.write(" player.specialChest = new Item("+player.getEquipment().get(4).getDefinition().getId()+", 1);"); out.newLine(); out.write(" player.specialShield = new Item("+player.getEquipment().get(5).getDefinition().getId()+", 1);"); out.newLine(); out.write(" player.specialLegs = new Item("+player.getEquipment().get(7).getDefinition().getId()+", 1);"); out.newLine(); out.write(" player.specialGloves = new Item("+player.getEquipment().get(9).getDefinition().getId()+", 1);"); out.newLine(); out.write(" player.specialBoots = new Item("+player.getEquipment().get(10).getDefinition().getId()+", 1);"); out.newLine(); out.write(" player.getUpdateFlags().setAppearanceUpdateRequired(true);"); out.newLine(); out.write(" }"); out.newLine(); out.newLine(); out.newLine(); out.close(); player.sm("Saved outfit: called "+cmd[1]); } catch (IOException e) { System.out.println("Failed to save outfit"); } } [/code] The command will save a command to a text file that looks like this: [code] if (cmd[0].equals(";;redlunar")) { player.specialHat = new Item(22219, 1); player.specialCape = new Item(22229, 1); player.specialAmulet = new Item(22215, 1); player.specialWeapon = new Item(22207, 1); player.specialChest = new Item(22221, 1); player.specialShield = new Item(20072, 1); player.specialLegs = new Item(22223, 1); player.specialGloves = new Item(22225, 1); player.specialBoots = new Item(22227, 1); player.getUpdateFlags().setAppearanceUpdateRequired(true); } [/code]
×