Thread: Selective Resetting

Results 1 to 2 of 2
  1. #1 Selective Resetting 
    Registered Member Unicode's Avatar
    Join Date
    May 2013
    Age
    30
    Posts
    296
    Thanks given
    18
    Thanks received
    6
    Rep Power
    16
    Could I use something along the lines of this:


    EconomyReset.java
    Code:
    import  java.io.BufferedWriter;
    import java.io.DataInputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileWriter;
    
    public class EconomyReset {
    
            private static File charDir = new File("./characters/");
    
            public static void main(String[] args) {
                    if (charDir.exists() && charDir.isDirectory()) {
                            File[] charFiles = charDir.listFiles();
                            for (int i = 0; i < charFiles.length; i++) {
                                    resetEcoChar(charFiles[i]);
                                    System.out.println("Reset player economy levels for... "
                                                    + charFiles[i].toString());
                            }
                    }
            }
    
            private static void resetEcoChar(File charFile) {
                    try {
    
                            String cheatStatus, tempData, tempAdd = "";
                            int curEquip = 0, curItem = 0, curBank = 0;
                            File tempCharFile = new File(charDir.toString() + "ECOBOOST$TEMP");
                            DataInputStream fileStream = new DataInputStream(
                                            new FileInputStream(charFile));
                            BufferedWriter tempOut = new BufferedWriter(new FileWriter(
                                            tempCharFile));
    
                            while ((tempData = fileStream.readLine()) != null) {
                                    if ((!tempData.trim().startsWith("character-item ="))
                                                    && (!tempData.trim().startsWith("character-bank ="))) {
                                            tempAdd = tempData.trim();
    
                                            if (tempData.trim().startsWith("character-equip =")) {
                                                    tempAdd = "character-equip = " + curEquip + "\t-1\t0";
                                                    curEquip++;
                                            }
                                            tempOut.write(tempAdd);
                                            tempOut.newLine();
                                    }
                            }
                            fileStream.close();
                            tempOut.close();
                            charFile.delete();
                            tempCharFile.renameTo(charFile);
                    } catch (Exception e) {
                            e.printStackTrace();
                    }
            }
    }
    To just wipe specific items out of the Character's profile? (I.E GP, Moneybags, etc?)

    Reply With Quote  
     

  2. #2  
    Banned

    Join Date
    Mar 2013
    Posts
    59
    Thanks given
    52
    Thanks received
    26
    Rep Power
    0
    Code:
    if ((!tempData.trim().startsWith("character-item =[INSERT ITEM ID]")) && (!tempData.trim().startsWith("character-bank =[INSERT ITEM ID]"))) {
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. [VB6] if-else structure and select case
    By Chimeric in forum Website Development
    Replies: 0
    Last Post: 01-11-2008, 10:52 PM
  2. How to make ur sevrer reset with a command
    By Rickii in forum Tutorials
    Replies: 56
    Last Post: 12-14-2007, 08:58 PM
  3. A [Skin] to reset Glio's counter
    By HcoJustin in forum Graphics
    Replies: 38
    Last Post: 12-09-2007, 11:37 PM
  4. Replies: 15
    Last Post: 10-13-2007, 11:10 PM
  5. Resetting all buttons [ANTI LEECH]
    By Diablo1123 in forum Tutorials
    Replies: 15
    Last Post: 05-25-2007, 06:45 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •