heladito

Members
  • Content Count

    38
  • Joined

  • Last visited

  • Feedback

    0%

Community Reputation

0 Neutral

About heladito

  • Rank
    Vassal

Profile Information

  • Gender
    Male
  • Country
    Argentina

Recent Profile Visitors

593 profile views
  1. hi! i added this code to my datapack but its giving me a problem with Duplicate Character in DB Have idea why? and critical error. The author its @EdenEternal Code Index: com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (revision 946) +++ com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -3041,6 +3042,15 @@ { karma = 0; } + + if(karma ==0 && Config.TRANSFORM_PK) + { + getPoly().setPolyInfo(null, "1"); + decayMe(); + spawnMe(getX(),getY(),getZ()); + sendMessage("You have been untransformed."); + broadcastUserInfo(); + } if(_karma == 0 && karma > 0) { @@ -8359,10 +8369,21 @@ updateTitle(); } + if(Config.TRANSFORM_PK) + { + String transform_id = Config.TRANSFORM_NPC_ID; + getPoly().setPolyInfo("npc", transform_id); + teleToLocation(getX(), getY(), getZ(), false); + sendMessage("You have killed a player!"); + sendMessage("You have been transformed to "+Config.TRANSFORM_NPC_NAME+"."); + broadcastUserInfo(); + } + //Update the character's title color if they reached any of the 5 PK levels. updatePkColor(getPkKills()); broadcastUserInfo(); + // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter sendPacket(new UserInfo(this)); } =================================================================== --- com/l2jfrozen/Config.java (revision 946) +++ com/l2jfrozen/Config.java (working copy) @@ -2167,10 +2167,21 @@ public static boolean DONATOR_SKILLS; + public static boolean TRANSFORM_PK; + public static String TRANSFORM_NPC_ID; + public static String TRANSFORM_NPC_NAME; @@ -2309,10 +2311,21 @@ //============================================================ public static void loadByLekiConfig() GM_MAX_ENCHANT = Integer.parseInt(ByLekiSettings.getProperty("GMMaxEnchant", "65355")); + TRANSFORM_PK = Boolean.parseBoolean(ByLekiSettings.getProperty("EnableTransformPK", "False")); + TRANSFORM_NPC_ID = ByLekiSettings.getProperty("TransformNPCID", "14040"); + TRANSFORM_NPC_NAME = ByLekiSettings.getProperty("TransformNPCName", "Zombie"); if (L2JMOD_CHAMPION_ENABLE_mxc != 0 && L2JMOD_CHAMPION_ENABLE_mxc != 1 && L2JMOD_CHAMPION_ENABLE_mxc != 2) L2JMOD_CHAMPION_ENABLE_mxc = 0; } catch(Exception e) Index: config/ByLeki/ByLeki.ini =================================================================== --- config/ByLeki/ByLeki.ini (revision 946) +++ config/ByLeki/ByLeki.ini (working copy) @@ -21,7 +24,5 @@ # words to use, between 10 and 16 keys. ######################################## #PK Cleaner NPC ######################################## #Item ID for Cleaning PK PKCleanItemID = 4037 #PK Cleaning price PKCleanPrice = 1 +######################################## +# Tranform PKs +######################################## +#Tranform PK Players? +EnableTransformPK = False +#Tranformation Monster ID +TransformNPCID = 14040 +#Tranform Monster Name +TransformNPCName = Zombie
  2. hi! anyone can help me with an error? problem with Duplicate Character in DB Have idea why?
  3. hi guys! im trying to write a script for clean the pk of character. Only have a part of them. Anyone can help me to finish it? please def onEvent(self,event,st): htmltext = event count=st.getQuestItemsCount(57) if count < 5 : htmltext = "ErrorAdena.htm" elif st.getPlayer().getPkKills() < 5 : htmltext = "ErrorPkKills.htm" else: st.getPlayer().setTarget(st.getPlayer()) if event == "RemovePk": st.takeItems(57,5) st.getPlayer().setPkKills(st.getPlayer().getPkKills() - 5) st.playSound("ItemSound.quest_finish") st.setState(COMPLETED) return "End.htm" if htmltext != event: st.setState(COMPLETED) st.exitQuest(1) return htmltext
  4. @Tryskell hi man! so, you say make a sincronized backup with mysql when the server restart?
  5. Hi @Rootware ! thanks for answer. can, maybe if u have some time, tell me how can i do it that?
  6. hi guys! anyone can help me to adapt this code for jfrozen rev 1132? Index: net.sf.l2j;Config.JAVA =================================================================== --- net.sf.l2j;Config.JAVA (revision) +++ net.sf.l2j;Config.JAVA (working copy) + /** Auto Save Data Base */ + public static boolean ENABLE_BACKUP_BOOLEAN; + public static String NAME_DATA_BASE; + ENABLE_BACKUP_BOOLEAN = Boolean.parseBoolean(aCis.getProperty("AutoSaveDB", "True")); + NAME_DATA_BASE = aCis.getProperty("URL_DB", "aCis"); Index: Dev.AutoBackup;BackupDBSave.JAVA =================================================================== --- Dev.AutoBackup;BackupDBSave.JAVA (revision) +++ Dev.AutoBackup;BackupDBSave.JAVA (working copy) + package Dev.AutoBackup; + + import java.io.BufferedReader; + import java.io.File; + import java.io.FileInputStream; + import java.io.FileOutputStream; + import java.io.IOException; + import java.io.InputStreamReader; + import java.net.URL; + import java.sql.Connection; + import java.sql.PreparedStatement; + import java.sql.ResultSet; + import java.text.DateFormat; + import java.text.SimpleDateFormat; + import java.util.Date; + import java.util.zip.ZipEntry; + import java.util.zip.ZipOutputStream; + + import net.sf.l2j.commons.concurrent.ThreadPool; + + import net.sf.l2j.Config; + import net.sf.l2j.L2DatabaseFactory; + import net.sf.l2j.util.Mysql; + + + /** + * @author COMBATE + * + * note to RESTORE + * Unzip the file + * Then go to database via navicat and run Execute SQL File + * Then declick the option "Run multiple queries in each execution" to avoid conflict with locks of tables + */ + public class BackupDBSave + { + private String database_name = Config.NAME_DATA_BASE; + private boolean DEBUG_SYSTEM = false; + private long initializeAfterTime = 1000 * 60 * 60 * 1; // Start in 2 hour + private long checkEveryTime = 1000 * 60 * 60 * 1; // Every 6 hours + + protected BackupDBSave() + { + ThreadPool.scheduleAtFixedRate(() -> BackupDBToSql(), initializeAfterTime, checkEveryTime); + + System.out.println("Database Backup Manager: Loaded"); + } + + public void BackupDBToSql() + { + String pathOfMysql = "\""; + + Connection con = null; + PreparedStatement statement = null; + ResultSet rs = null; + + try + { + con = L2DatabaseFactory.getInstance().getConnection(); + statement = con.prepareStatement("SELECT @@basedir"); + rs = statement.executeQuery(); + + while (rs.next()) + { + pathOfMysql += rs.getString(1); + } + } + catch (Exception e) + { + e.printStackTrace(); + } + finally + { + Mysql.closeQuietly(con, statement, rs); + } + + if (pathOfMysql.isEmpty()) + { + System.out.println("Error on backup database. Empty path of mysql."); + return; + } + + // Give the specific path (pathOfMysql out = C:\Program Files\MySQL\MySQL Server 5.7\) + pathOfMysql += "bin\\mysqldump" + "\""; + + if(DEBUG_SYSTEM) System.out.println("Path of mysql: " + pathOfMysql); + + // Initialize code for backup + try + { + // Section for path of system + URL applicationRootPathURL = getClass().getProtectionDomain().getCodeSource().getLocation(); + File applicationRootPath = new File(applicationRootPathURL.getPath()); + File myFile = new File(applicationRootPath.getParent()); + File lastMyFile = new File(myFile.getParent()); + + String dbUser = Config.DATABASE_LOGIN; + String dbPass = Config.DATABASE_PASSWORD; + + String commandOfMysqlDump = " " + database_name + " --single-transaction -u" + dbUser + " -p" + dbPass + " --skip-create-options --skip-comments --disable-keys > "; + + /* NOTE: Creating Path Constraints for folder saving */ + /* NOTE: Here the backup folder is created for saving inside it */ + String folderPath = "backup"; + + /* NOTE: Creating Folder if it does not exist */ + File f1 = new File(folderPath); + f1.mkdir(); + + /* NOTE: Creating Path Constraints for backup saving */ + /* NOTE: Here the backup is saved in a folder called backup with the name backup.sql */ + String pathUntilDirectory = (lastMyFile.getAbsolutePath() + "\\backup\\").replaceAll("%20", " "); + String savePath = ("\""+pathUntilDirectory + "backup.sql\"").replaceAll("%20", " "); + + /* NOTE: Used to create a cmd command */ + String commandToExecute = "cmd /c "+ pathOfMysql + commandOfMysqlDump + savePath; + + if (DEBUG_SYSTEM) + { + System.out.println("Save path of sql file: " + savePath); + System.out.println("Command To Execute: " + commandToExecute); + } + + /* NOTE: Executing the command here */ + Process runtimeProcess = Runtime.getRuntime().exec(new String[] {"cmd", "/c", commandToExecute }); + + if (DEBUG_SYSTEM) + { + BufferedReader stdInput = new BufferedReader(new InputStreamReader(runtimeProcess.getInputStream())); + BufferedReader stdError = new BufferedReader(new InputStreamReader(runtimeProcess.getErrorStream())); + + // read the output from the command + System.out.println("Here is the standard output of the command:\n"); + String s = null; + while ((s = stdInput.readLine()) != null) { + System.out.println(s); + } + + // read any errors from the attempted command + System.out.println("Here is the standard error of the command (if any):\n"); + while ((s = stdError.readLine()) != null) { + System.out.println(s); + } + } + + int processComplete = runtimeProcess.waitFor(); + + /* NOTE: processComplete=0 if correctly executed, will contain other values if not */ + if (processComplete == 0) + { + System.out.println("Backup to SQL Complete"); + + // Zip the sql file + zipAFile(pathUntilDirectory); + + // Delete the backup.sql file + deleteAFile(savePath.replaceAll("\"", "")); + } + else + { + System.out.println("Backup to SQL Failure"); + } + } + catch (IOException | InterruptedException ex) + { + System.out.println("Error at Backuprestore" + ex.getMessage()); + } + } + + @SuppressWarnings("resource") + private static void zipAFile(String pathToSave) + { + byte[] buffer = new byte[1024]; + + try + { + DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH-mm-ss"); + Date date = new Date(); + + FileOutputStream fos = new FileOutputStream(pathToSave + "Backup_"+dateFormat.format(date)+".zip"); + ZipOutputStream zos = new ZipOutputStream(fos); + ZipEntry ze = new ZipEntry("backup.sql"); + zos.putNextEntry(ze); + FileInputStream in = new FileInputStream(pathToSave + "\\backup.sql"); + + int len; + while ((len = in.read(buffer)) > 0) + { + zos.write(buffer, 0, len); + } + + in.close(); + zos.closeEntry(); + + // remember close it + zos.close(); + + System.out.println("Done the zip of backup."); + + } + catch (IOException ex) + { + ex.printStackTrace(); + } + + } + + private static void deleteAFile(String path) { + try{ + File file = new File(path); + System.out.println(file.delete() ? (file.getName() + " is deleted!") : ("Delete operation is failed.")); + + }catch(Exception e){ + + e.printStackTrace(); + + } + } + + public static BackupDBSave getInstance() + { + return SingletonHolder._instance; + } + + private static class SingletonHolder + { + protected static final BackupDBSave _instance = new BackupDBSave(); + } + } + Index: Dev.AutoBackup;Mysql.JAVA =================================================================== --- Dev.AutoBackup;Mysql.JAVA (revision) +++ Dev.AutoBackup;Mysql.JAVA (working copy) + package Dev.AutoBackup; + + + import java.sql.Connection; + import java.sql.PreparedStatement; + import java.sql.ResultSet; + import java.sql.SQLException; + import java.sql.Statement; + import java.util.logging.Logger; + + import net.sf.l2j.L2DatabaseFactory; + + /** + * @author COMBATE + * + */ + public abstract class Mysql + { + private static final Logger _log = Logger.getLogger(Mysql.class.getName()); + + /** + * Performs a simple sql queries where unnecessary control parameters <BR> + * NOTE: In this method, the parameters passed are not valid for SQL-injection! + * @param db + * @param query + * @param vars + * @return + */ + public static boolean setEx(L2DatabaseFactory db, String query, Object... vars) + { + Connection con = null; + Statement statement = null; + PreparedStatement pstatement = null; + boolean successed = true; + + try + { + if(db == null) + db = L2DatabaseFactory.getInstance(); + + con = db.getConnection(); + if(vars.length == 0) + { + statement = con.createStatement(); + statement.executeUpdate(query); + statement.close(); + } + else + { + pstatement = con.prepareStatement(query); + setVars(pstatement, vars); + pstatement.executeUpdate(); + pstatement.close(); + } + con.close(); + } + catch(Exception e) + { + _log.warning("Could not execute update '" + query + "': " + e); + e.printStackTrace(); + successed = false; + } + finally + { + closeQuietly(con, pstatement); + closeQuietly(statement); + } + return successed; + } + + public static void setVars(PreparedStatement statement, Object... vars) throws SQLException + { + Number n; + long long_val; + double double_val; + for(int i = 0; i < vars.length; i++) + if(vars[i] instanceof Number) + { + n = (Number) vars[i]; + long_val = n.longValue(); + double_val = n.doubleValue(); + if(long_val == double_val) + statement.setLong(i + 1, long_val); + else + statement.setDouble(i + 1, double_val); + } + else if(vars[i] instanceof String) + statement.setString(i + 1, (String) vars[i]); + } + + public static boolean set(String query, Object... vars) + { + return setEx(null, query, vars); + } + + public static boolean set(String query) + { + return setEx(null, query); + } + + public static void closeQuietly(Connection conn) + { + try { + close(conn); + } catch (SQLException e) { // NOPMD + // quiet + } + } + + public static void closeQuietly(Connection conn, Statement stmt, ResultSet rs) { + + try { + closeQuietly(rs); + } finally { + try { + closeQuietly(stmt); + } finally { + closeQuietly(conn); + } + } + } + + public static void closeQuietly(Connection conn, Statement stmt) + { + try { + closeQuietly(stmt); + } finally { + closeQuietly(conn); + } + } + + public static void closeQuietly(ResultSet rs) { + try { + close(rs); + } catch (SQLException e) { // NOPMD + // quiet + } + } + + public static void closeQuietly(Statement stmt) { + try { + close(stmt); + } catch (SQLException e) { // NOPMD + // quiet + } + } + + public static void close(Connection conn) throws SQLException { + if (conn != null) { + conn.close(); + } + } + + public static void close(ResultSet rs) throws SQLException { + if (rs != null) { + rs.close(); + } + } + + public static void close(Statement stmt) throws SQLException { + if (stmt != null) { + stmt.close(); + } + } + } + Index: net.sf.l2j.gameserver;GameServer.JAVA =================================================================== --- net.sf.l2j.gameserver;GameServer.JAVA (revision) +++ net.sf.l2j.gameserver;GameServer.JAVA (working copy) + import Dev.AutoBackup.BackupDBSave; + StringUtil.printSection("DataBase Auto Save"); + if (Config.ENABLE_BACKUP_BOOLEAN) { + BackupDBSave.getInstance(); + LOGGER.info("[DataBase Auto Save]: Enabled"); + }else + { + LOGGER.info("[DataBase Auto Save]: Desatived"); + } Index: gameserver.config.aCis.aCis.properties =================================================================== --- gameserver.config.aCis.aCis.properties (revision) +++ gameserver.config.aCis.aCis.properties (working copy) # Enable Auto Save DataBase AutoSaveDB = True #Name DataBase #Ex: l2jdb URL_DB = aCis
  7. Hello guys. I would like to know if anyone could help me to create an item that with double click, generate spawn protection for 15 seconds. Its for frozen 1132
  8. hi bro! like this skin system mode https://maxcheaters.com/topic/236274-code-adaption-from-l2jlisvus-to-l2jfrozen
  9. anyone have it with the skin system mode + 2 click item?
  10. Hello friends! how are you? Today I bring this code to adapt to everyone, because in the "requests" part I did not receive an answer. I hope we can do this together as the great community that we are. Let's start! I try to adapt the skin + 2 click item system for Jfrozen rev 1132. At first, I made a mistake when the character logged in, because he reappeared inside the flood. I think i fix it from charinfo.java and userinfo.java Now, the problem is that I go in and when I click on the coin to give me the skin, it does not take any action. There are no errors in the gameserver or in java. We can adapt the rest among everyone and make a post line so that each one contributes their part! Sorry for my english :) Original Code Lisvus: Pastebin Adapted to Frozen rev 1132: Pastebin
  11. @HowardStern hi bro! thanks for answer. i dont think so, i trying to adapt from lisvus to frozen but i cant do it. can send me your share or post adapted to frozen? please. or say me how can i fix it i just saw your share. its .dressme but this i try to adapt its dressme + skin with 2 click item
  12. hi guys! i thy to adapt this skin system mode from lisvus to frozen. And dont give me any error in eclipse or gameserver, but when i log with the character, happens you can see in the pics. this is the code from lisvus pastebin
  13. hi bro! thanks for answer. that code its .dressme , i want, if possible, the code i shared because its a dressme skin system with 2 click item
  14. hi guys! i hope anyone can help me with this. can adapt this dressme + 2 click skin for Jfrozen rev 1132? please Pastebin code