Thread: [PI] drop logs

Results 1 to 3 of 3
  1. #1 [PI] drop logs 
    Extreme Donator

    Join Date
    Oct 2011
    Posts
    234
    Thanks given
    3
    Thanks received
    14
    Rep Power
    37
    Does anyone have a good drop log system?
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Feb 2012
    Posts
    368
    Thanks given
    24
    Thanks received
    26
    Rep Power
    14
    ~Remove, misread post~
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Oct 2010
    Posts
    20
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    PlayerAssistant.java
    Code:
      public void writeDropLog(String data, int ID, int itemX, int itemY) {
                    checkDateAndTime();
                    String filePath = "./Data/logs/drop/" + c.playerName + ".txt";
                    BufferedWriter bw = null;
                    try {
                            bw = new BufferedWriter(new FileWriter(filePath, true));
                            bw.write("[" + c.date + "]" + "-" + "[" + c.currentTime + " "
                                            + checkTimeOfDay() + "]: " + "[" + c.connectedFrom + "]: "
                                            + "" + data + " " + " " + Item.getItemName(ID) + " ("
                                            + itemX + "/" + itemY + ").");
                            bw.newLine();
                            bw.flush();
                    } catch (IOException ioe) {
                            ioe.printStackTrace();
                    } finally {
                            if (bw != null) {
                                    try {
                                            bw.close();
                                    } catch (IOException ioe2) {
                                    }
                            }
                    }
            }
    Usage: ItemHandler.java
    src/server/world/ItemHandler.java
    under the 'addItem(item);' in the dropItem(int Item, int amount) method add this:

    Code:
    c.getPA().writeDropLog(itemAmount + "x", itemId, itemX, itemY);
    Example of ItemHandler.java:
    Code:
         if (!server.model.items.Item.itemStackable[itemId]
                                            && itemAmount > 0) {
                                    for (int j = 0; j < itemAmount; j++) {
                                            c.getItems().createGroundItem(itemId, itemX, itemY, 1);
                                            GroundItem item = new GroundItem(itemId, itemX, itemY, 1,
                                                            c.playerId, (c.inWild() ? 2 : HIDE_TICKS),
                                                            Server.playerHandler.players[playerId].playerName);
                                            addItem(item); // ADD BELOW HERE
                                    c.getPA().writeDropLog(itemAmount + "x", itemId, itemX, itemY);
                                    }
                            } else {
                                    c.getItems().createGroundItem(itemId, itemX, itemY, itemAmount);
                                    GroundItem item = new GroundItem(itemId, itemX, itemY,
                                                    itemAmount, c.playerId, (c.inWild() ? 2 : HIDE_TICKS),
                                                    Server.playerHandler.players[playerId].playerName);
                                    addItem(item); // ADD BELOW HERE
                                    c.getPA().writeDropLog(itemAmount + "x", itemId, itemX, itemY);
                            }
    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. Replies: 3
    Last Post: 05-25-2012, 12:13 PM
  2. [Delta] Pm Logs & Chat Logs
    By im slickk in forum Snippets
    Replies: 13
    Last Post: 01-31-2011, 12:30 AM
  3. Replies: 2
    Last Post: 11-30-2010, 01:15 PM
  4. umm logs in and logs back out?
    By xSelseor in forum Help
    Replies: 2
    Last Post: 08-18-2009, 12:27 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
  •