Skip to content

[SHARE]Log petition

Featured Replies

Save peticions into the log/peticion.csv

 

UNTESTED i code it 2min ago give me feedback about it.

 

credits to me.

 

Index: /Trunk/L2_GameServer/java/config/Maxcheaters.properties
===================================================================
--- /Trunk/L2_GameServer/java/config/Maxcheaters.properties (revision 144)
+++ /Trunk/L2_GameServer/java/config/Maxcheaters.properties (revision 147)
@@ -313,2 +313,9 @@
EvilBaseY = -112524
EvilBaseZ = -235
+
+#---------------------------------------------------------------
+# Peticion settings                                            -
+#---------------------------------------------------------------
+# Log peticions to log/peticions.csv
+# Only for testing yet!
+EnablePeticionLogging = False
Index: /Trunk/L2_GameServer/java/net/sf/l2j/Config.java
===================================================================
--- /Trunk/L2_GameServer/java/net/sf/l2j/Config.java (revision 144)
+++ /Trunk/L2_GameServer/java/net/sf/l2j/Config.java (revision 147)
@@ -760,4 +760,5 @@
	public static int ADD_EXP;
    public static int ADD_SP;
+    public static boolean PETICION_LOGGING;

	//--------------------------------------------------
@@ -1507,4 +1508,5 @@
					ADD_EXP = Integer.parseInt(maxcheatersSettings.getProperty("AddExpAtPvp", "0"));
					ADD_SP = Integer.parseInt(maxcheatersSettings.getProperty("AddSpAtPvp", "0"));
+					PETICION_LOGGING = Boolean.parseBoolean(maxcheatersSettings.getProperty("EnablePeticionLogging", "False"));
				}
				catch (Exception e)
Index: /Trunk/L2_GameServer/java/net/sf/l2j/gameserver/instancemanager/PetitionManager.java
===================================================================
--- /Trunk/L2_GameServer/java/net/sf/l2j/gameserver/instancemanager/PetitionManager.java (revision 124)
+++ /Trunk/L2_GameServer/java/net/sf/l2j/gameserver/instancemanager/PetitionManager.java (revision 147)
@@ -15,8 +15,12 @@
package net.sf.l2j.gameserver.instancemanager;

+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
+import java.util.logging.Level;
import java.util.logging.Logger;

@@ -606,3 +610,46 @@
		activeChar.sendPacket(htmlMsg);
	}
+	
+	public static synchronized void logResult(String petitioner, String responder, long submitTime, long endTime, String content)
+			{
+				if (!Config.PETICION_LOGGING) return;
+				
+				SimpleDateFormat formatter;
+				formatter = new SimpleDateFormat("dd/MM/yyyy H:mm:ss");
+				String date = formatter.format(new Date());
+				FileWriter save = null;
+				try
+				{
+					File file = new File("log/peticion.csv");
+					
+					boolean writeHead = false;
+					if (!file.exists())
+						writeHead = true;
+					
+					save = new FileWriter(file, true);
+			
+					if (writeHead)
+					{
+						String header = "Date,petitioner,responder,submitTime,endTime,content\r\n";
+						save.write(header);
+					}
+					
+					String out = date + "," + petitioner + "," + responder + "," + submitTime + "," + endTime + "," + content + "\r\n";
+					save.write(out);
+				}
+				catch (IOException e)
+				{
+					_log.log(Level.WARNING, "Peticion System: Peticion log could not be saved: ", e);
+				}
+				finally
+				{
+					try
+					{
+						save.close();
+					}
+					catch (Exception e)
+					{
+					}
+				}
+			}
}

Great share ;D

With this share you can check the GM's support upon the players

GJ Intrepid :)

Log Peticion

 

:) Fix Title :D

Nice Share.. But .. Mate.. It's Petition. -.- xD

 

Thx For This Share

nice share.

I Agree With Stef Petition Will be Better :P

  • 2 months later...

Usefull! Good to check your GM actions, thanks for sharing!

  • 10 months later...

So many good guides here, I don't know which one to read first ..

Anyway, Thank you very much for sharing ! =)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.