Jump to content

claudeny

Membro
  • Content Count

    21
  • Joined

  • Last visited

Community Reputation

1 Normal

About claudeny

  • Rank
    ForeverAlone

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. ### Eclipse Workspace Patch 1.0 #P L2JBrasil Index: L2JBrasil_CORE/java/com/it/br/Config.java =================================================================== --- L2JBrasil_CORE/java/com/it/br/Config.java (revision 339) +++ L2JBrasil_CORE/java/com/it/br/Config.java (working copy) @@ -332,6 +334,9 @@ // - L2JBRASIL PROPIETERS - // // --------------------------------------------- // // ============================================================ + public static boolean WYVERN_PROTECTION; + public static String ID_RESTRICT; + public static List<Integer> LISTID_RESTRICT; public static byte LEVEL_ON_ENTER; public static int SP_ON_ENTER; public static int STARTING_ADENA; @@ -440,7 +446,14 @@ L2JBrasil.load(is); is.close(); - LEVEL_ON_ENTER = Byte.parseByte(L2JBrasil.getProperty("LevelOnEnter", "0")); + WYVERN_PROTECTION = Boolean.parseBoolean(L2JBrasil.getProperty("WyvernProtectionEnabled", "False")); + ID_RESTRICT = L2JBrasil.getProperty("WyvernItemID", ""); + LISTID_RESTRICT = new FastList<Integer>(); + for(String classId : ID_RESTRICT.split(",")) + { + LISTID_RESTRICT.add(Integer.parseInt(classId)); + } + LEVEL_ON_ENTER = Byte.parseByte(L2JBrasil.getProperty("LevelOnEnter", "0")); SP_ON_ENTER = Integer.parseInt(L2JBrasil.getProperty("SPOnEnter", "0")); STARTING_ADENA = Integer.parseInt(L2JBrasil.getProperty("StartingAdena", "100")); CUSTOM_STARTER_ITEMS_ENABLED = Boolean.parseBoolean(L2JBrasil.getProperty("CustomStarterItemsEnabled", "False")); Index: L2JBrasil_CORE/java/com/it/br/gameserver/network/clientpackets/UseItem.java =================================================================== --- L2JBrasil_CORE/java/com/it/br/gameserver/network/clientpackets/UseItem.java (revision 339) +++ L2JBrasil_CORE/java/com/it/br/gameserver/network/clientpackets/UseItem.java (working copy) @@ -27,6 +27,7 @@ import com.it.br.gameserver.instancemanager.CastleManager; import com.it.br.gameserver.instancemanager.ClanHallManager; import com.it.br.gameserver.model.Inventory; +import com.it.br.gameserver.model.L2Character; import com.it.br.gameserver.model.L2Clan; import com.it.br.gameserver.model.L2Effect; import com.it.br.gameserver.model.L2ItemInstance; @@ -76,7 +77,15 @@ activeChar.sendPacket(new ActionFailed()); return; } - + if(Config.WYVERN_PROTECTION && activeChar.isInsideZone(L2Character.ZONE_PEACE)) + { + if(Config.LISTID_RESTRICT.contains(item.getItemId())) + { + activeChar.sendMessage("You can not use this item here within the city."); + activeChar.sendPacket(new ActionFailed()); + return; + } + } if (!activeChar.isHero() && !activeChar.isGM() && !activeChar.isFakeHero() && (item.getItemId() == 6842 || (item.getItemId() >= 6611 && item.getItemId() <= 6621))) { activeChar.sendMessage("His weapon was destroyed successfully you do not have requirements to use it"); Index: L2JBrasil_CORE/java/com/it/br/gameserver/model/zone/type/L2TownZone.java =================================================================== --- L2JBrasil_CORE/java/com/it/br/gameserver/model/zone/type/L2TownZone.java (revision 339) +++ L2JBrasil_CORE/java/com/it/br/gameserver/model/zone/type/L2TownZone.java (working copy) @@ -22,9 +22,11 @@ import org.w3c.dom.Node; import com.it.br.Config; import com.it.br.gameserver.model.L2Character; import com.it.br.gameserver.model.actor.instance.L2PcInstance; import com.it.br.gameserver.model.zone.L2ZoneType; +import com.it.br.gameserver.network.serverpackets.NpcHtmlMessage; import com.it.br.gameserver.util.Rnd; public class L2TownZone extends L2ZoneType @@ -88,12 +90,18 @@ { if (character instanceof L2PcInstance) { + if((((L2PcInstance) character).isFlying() || ((L2PcInstance) character).isMounted()) && Config.WYVERN_PROTECTION) + { + ((L2PcInstance) character).dismount(); + showHtmlWyvern((L2PcInstance) character); + } // PVP possible during siege, now for siege participants only // Could also check if this town is in siege, or if any siege is going on if (((L2PcInstance)character).getSiegeState() != 0 && Config.ZONE_TOWN == 1) return; //((L2PcInstance)character).sendMessage("You entered "+_townName); + ((L2PcInstance)character).setLastTownName(_townName); } if (!_noPeace && Config.ZONE_TOWN != 2) character.setInsideZone(L2Character.ZONE_PEACE, true); @@ -102,7 +110,8 @@ @Override protected void onExit(L2Character character) { - if (!_noPeace) character.setInsideZone(L2Character.ZONE_PEACE, false); + if (!_noPeace) + character.setInsideZone(L2Character.ZONE_PEACE, false); // if (character instanceof L2PcInstance) //((L2PcInstance)character).sendMessage("You left "+_townName); @@ -114,7 +123,16 @@ @Override protected void onReviveInside(L2Character character) {} + + public void showHtmlWyvern(L2PcInstance player) + { + String filename = "data/html/mods/protect/wyvern-protection.htm"; + + NpcHtmlMessage html = new NpcHtmlMessage(player.getObjectId()); + html.setFile(filename); + html.replace("%objectId%", String.valueOf(player.getObjectId())); + player.sendPacket(html); + } /** * Returns this town zones name * @return Index: L2JBrasil_CORE/config/custom/l2jbrasil.properties =================================================================== --- L2JBrasil_CORE/config/custom/l2jbrasil.properties (revision 339) +++ L2JBrasil_CORE/config/custom/l2jbrasil.properties (working copy) @@ -82,6 +82,17 @@ DisableGradePenalty = False # -------------------------------- # +# - Wyvern Protection's - # +# -------------------------------- # +# data/html/mods/wyvern-protection.htm +# Enable / Disable Protection +# By Leonardo Alves. +WyvernProtectionEnabled = True +# Wyvern Item ID. +# format: id,id,id +WyvernItemID = 8663 + +# -------------------------------- # # - Equipment Restriction - # # -------------------------------- # # Light Equipment Restriction Index: L2JBrasil_DP/data/html/mods/protect/wyvern-protection.htm =================================================================== --- L2JBrasil_DP/data/html/mods/protect/wyvern-protection.htm (revision 0) +++ L2JBrasil_DP/data/html/mods/protect/wyvern-protection.htm (revision 0) @@ -0,0 +1,10 @@ +<html> +<title>Wyvern Item Protection</title> +<br> +<center> +<font color="green">Wyvern Protect:</font> You can not use this item within the city.<br> +<br> +<font color="green">By:</font> Leonardo Alves.<br> +<br> +</center> +</html>
  2. ### Eclipse Workspace Patch 1.0 #P L2JBrasil Index: L2JBrasil_CORE/java/com/it/br/Config.java =================================================================== --- L2JBrasil_CORE/java/com/it/br/Config.java (revision 339) +++ L2JBrasil_CORE/java/com/it/br/Config.java (working copy) @@ -332,6 +334,9 @@ // - L2JBRASIL PROPIETERS - // // --------------------------------------------- // // ============================================================ + public static boolean WYVERN_PROTECTION; + public static String ID_RESTRICT; + public static List<Integer> LISTID_RESTRICT; public static byte LEVEL_ON_ENTER; public static int SP_ON_ENTER; public static int STARTING_ADENA; @@ -440,7 +446,14 @@ L2JBrasil.load(is); is.close(); - LEVEL_ON_ENTER = Byte.parseByte(L2JBrasil.getProperty("LevelOnEnter", "0")); + WYVERN_PROTECTION = Boolean.parseBoolean(L2JBrasil.getProperty("WyvernProtectionEnabled", "False")); + ID_RESTRICT = L2JBrasil.getProperty("WyvernItemID", ""); + LISTID_RESTRICT = new FastList<Integer>(); + for(String classId : ID_RESTRICT.split(",")) + { + LISTID_RESTRICT.add(Integer.parseInt(classId)); + } + LEVEL_ON_ENTER = Byte.parseByte(L2JBrasil.getProperty("LevelOnEnter", "0")); SP_ON_ENTER = Integer.parseInt(L2JBrasil.getProperty("SPOnEnter", "0")); STARTING_ADENA = Integer.parseInt(L2JBrasil.getProperty("StartingAdena", "100")); CUSTOM_STARTER_ITEMS_ENABLED = Boolean.parseBoolean(L2JBrasil.getProperty("CustomStarterItemsEnabled", "False")); Index: L2JBrasil_CORE/java/com/it/br/gameserver/network/clientpackets/UseItem.java =================================================================== --- L2JBrasil_CORE/java/com/it/br/gameserver/network/clientpackets/UseItem.java (revision 339) +++ L2JBrasil_CORE/java/com/it/br/gameserver/network/clientpackets/UseItem.java (working copy) @@ -27,6 +27,7 @@ import com.it.br.gameserver.instancemanager.CastleManager; import com.it.br.gameserver.instancemanager.ClanHallManager; import com.it.br.gameserver.model.Inventory; +import com.it.br.gameserver.model.L2Character; import com.it.br.gameserver.model.L2Clan; import com.it.br.gameserver.model.L2Effect; import com.it.br.gameserver.model.L2ItemInstance; @@ -76,7 +77,15 @@ activeChar.sendPacket(new ActionFailed()); return; } - + if(Config.WYVERN_PROTECTION && activeChar.isInsideZone(L2Character.ZONE_PEACE)) + { + if(Config.LISTID_RESTRICT.contains(item.getItemId())) + { + activeChar.sendMessage("You can not use this item here within the city."); + activeChar.sendPacket(new ActionFailed()); + return; + } + } if (!activeChar.isHero() && !activeChar.isGM() && !activeChar.isFakeHero() && (item.getItemId() == 6842 || (item.getItemId() >= 6611 && item.getItemId() <= 6621))) { activeChar.sendMessage("His weapon was destroyed successfully you do not have requirements to use it"); Index: L2JBrasil_CORE/java/com/it/br/gameserver/model/zone/type/L2TownZone.java =================================================================== --- L2JBrasil_CORE/java/com/it/br/gameserver/model/zone/type/L2TownZone.java (revision 339) +++ L2JBrasil_CORE/java/com/it/br/gameserver/model/zone/type/L2TownZone.java (working copy) @@ -22,9 +22,11 @@ import org.w3c.dom.Node; import com.it.br.Config; import com.it.br.gameserver.model.L2Character; import com.it.br.gameserver.model.actor.instance.L2PcInstance; import com.it.br.gameserver.model.zone.L2ZoneType; +import com.it.br.gameserver.network.serverpackets.NpcHtmlMessage; import com.it.br.gameserver.util.Rnd; public class L2TownZone extends L2ZoneType @@ -88,12 +90,18 @@ { if (character instanceof L2PcInstance) { + if((((L2PcInstance) character).isFlying() || ((L2PcInstance) character).isMounted()) && Config.WYVERN_PROTECTION) + { + ((L2PcInstance) character).dismount(); + showHtmlWyvern((L2PcInstance) character); + } // PVP possible during siege, now for siege participants only // Could also check if this town is in siege, or if any siege is going on if (((L2PcInstance)character).getSiegeState() != 0 && Config.ZONE_TOWN == 1) return; //((L2PcInstance)character).sendMessage("You entered "+_townName); + ((L2PcInstance)character).setLastTownName(_townName); } if (!_noPeace && Config.ZONE_TOWN != 2) character.setInsideZone(L2Character.ZONE_PEACE, true); @@ -102,7 +110,8 @@ @Override protected void onExit(L2Character character) { - if (!_noPeace) character.setInsideZone(L2Character.ZONE_PEACE, false); + if (!_noPeace) + character.setInsideZone(L2Character.ZONE_PEACE, false); // if (character instanceof L2PcInstance) //((L2PcInstance)character).sendMessage("You left "+_townName); @@ -114,7 +123,16 @@ @Override protected void onReviveInside(L2Character character) {} + + public void showHtmlWyvern(L2PcInstance player) + { + String filename = "data/html/mods/protect/wyvern-protection.htm"; + + NpcHtmlMessage html = new NpcHtmlMessage(player.getObjectId()); + html.setFile(filename); + html.replace("%objectId%", String.valueOf(player.getObjectId())); + player.sendPacket(html); + } /** * Returns this town zones name * @return Index: L2JBrasil_CORE/config/custom/l2jbrasil.properties =================================================================== --- L2JBrasil_CORE/config/custom/l2jbrasil.properties (revision 339) +++ L2JBrasil_CORE/config/custom/l2jbrasil.properties (working copy) @@ -82,6 +82,17 @@ DisableGradePenalty = False # -------------------------------- # +# - Wyvern Protection's - # +# -------------------------------- # +# data/html/mods/wyvern-protection.htm +# Enable / Disable Protection +# By Leonardo Alves. +WyvernProtectionEnabled = True +# Wyvern Item ID. +# format: id,id,id +WyvernItemID = 8663 + +# -------------------------------- # # - Equipment Restriction - # # -------------------------------- # # Light Equipment Restriction Index: L2JBrasil_DP/data/html/mods/protect/wyvern-protection.htm =================================================================== --- L2JBrasil_DP/data/html/mods/protect/wyvern-protection.htm (revision 0) +++ L2JBrasil_DP/data/html/mods/protect/wyvern-protection.htm (revision 0) @@ -0,0 +1,10 @@ +<html> +<title>Wyvern Item Protection</title> +<br> +<center> +<font color="green">Wyvern Protect:</font> You can not use this item within the city.<br> +<br> +<font color="green">By:</font> Leonardo Alves.<br> +<br> +</center> +</html>
  3. E isso MSM tava quero usa ele MSM mais não conseguir dava erro Talvez o caminha do MySQL não e como da l2jfrozen Tayran cara eu e um amigo meu uzumaky da que do fórum nois estamos criando com servidor gracia final com base l2jserver mais nois estamos com esse problema ai
  4. Gostaria de sabe se alguém sabe estala um database_installer em uma versão Gracia final L2jserver
  5. Cara e por que vou cria um servidor gracia final e quero cria ele do zero quero fase com java mod
  6. Gostaria de sabe se alguém podia mim ajuda com uma Svn Gracia final ativa como l2jserver ou l2jfree
  7. ### Eclipse Workspace Patch 1.0 #P L2JFrozen Index: gameserver/head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java =================================================================== --- gameserver/head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (revision 936) +++ gameserver/head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (working copy) @@ -26,6 +26,7 @@ import com.l2jfrozen.Config; import com.l2jfrozen.crypt.nProtect; import com.l2jfrozen.crypt.nProtect.RestrictionType; +import com.l2jfrozen.gameserver.Restart; import com.l2jfrozen.gameserver.communitybbs.Manager.RegionBBSManager; import com.l2jfrozen.gameserver.controllers.GameTimeController; import com.l2jfrozen.gameserver.datatables.CharSchemesTable; @@ -466,6 +467,11 @@ } } + if(Config.RESTART_BY_TIME_OF_DAY) + { + ShowNextRestart(activeChar); + } + // NPCBuffer if (PowerPakConfig.BUFFER_ENABLED) CharSchemesTable.getInstance().onPlayerLogin(activeChar.getObjectId()); @@ -801,6 +807,17 @@ } } + /** + * Envia mensagem para o player do proximo restart + * NOTE: RESTART_BY_TIME_OF_DAY = TRUE + * + * @param activeChar + */ + private void ShowNextRestart(L2PcInstance activeChar) + { + activeChar.sendMessage("Next Restart: " + Restart.getInstance().getRestartNextTime()); + } + @Override public String getType() { ### Eclipse Workspace Patch 1.0 #P L2JFrozen Index: gameserver/head-src/com/l2jfrozen/gameserver/Shutdown.java =================================================================== --- gameserver/head-src/com/l2jfrozen/gameserver/Shuwtdon.java (revision 936) +++ gameserver/head-src/com/l2jfrozen/gameserver/Shutdown.java (working copy) @@ -171,6 +171,18 @@ } } + public void autoRestart(int time) + { + _secondsShut = time; + + countdown(); + + _shutdownMode = GM_RESTART; + + _instance.setMode(GM_RESTART); + System.exit(2); + } + /** * Default constucter is only used internal to create the shutdown-hook instance */ ### Eclipse Workspace Patch 1.0 #P L2JFrozen Index: gameserver/head-src/com/l2jfrozen/gameserver/Restart.java =================================================================== --- gameserver/head-src/com/l2jfrozen/gameserver/Restart.java (revision 0) +++ gameserver/head-src/com/l2jfrozen/gameserver/Restart.java (revision 0) @@ -0,0 +1,122 @@ +/* + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + package com.l2jfrozen.gameserver; + + import java.text.SimpleDateFormat; + import java.util.Calendar; + import java.util.logging.Logger; + + import com.l2jfrozen.Config; + import com.l2jfrozen.gameserver.thread.ThreadPoolManager; + + /** + * This Config for Auto Restart GameServer + * Initialize class getInstance() + * Set Time in Config File + * Thank You L2JServer | L2JRussia + * + * @author L2JRussia + * + */ + public class Restart + { + //Variaveis globais + private static Restart _instance = null; + protected static final Logger _log = Logger.getLogger(Restart.class.getName()); + private Calendar NextRestart; + private SimpleDateFormat format = new SimpleDateFormat("HH:mm"); + + //Singleton + public static Restart getInstance() + { + if(_instance == null) + _instance = new Restart(); + return _instance; + } + + public String getRestartNextTime() + { + if(NextRestart.getTime() != null) + return format.format(NextRestart.getTime()); + else + return "Erro"; + } + + //Connstrutor + private Restart() + { + //:D + } + + public void StartCalculationOfNextRestartTime() + { + _log.info("#####################################"); + _log.info("#[Restart System]: System actived...#"); + _log.info("#####################################"); + try + { + Calendar currentTime = Calendar.getInstance(); + Calendar testStartTime = null; + long flush2 = 0,timeL = 0; + int count = 0; + + for (String timeOfDay : Config.RESTART_INTERVAL_BY_TIME_OF_DAY) + { + testStartTime = Calendar.getInstance(); + testStartTime.setLenient(true); + String[] splitTimeOfDay = timeOfDay.split(":"); + testStartTime.set(Calendar.HOUR_OF_DAY, Integer.parseInt(splitTimeOfDay[0])); + testStartTime.set(Calendar.MINUTE, Integer.parseInt(splitTimeOfDay[1])); + testStartTime.set(Calendar.SECOND, 00); + //Verifica a validade to tempo + if (testStartTime.getTimeInMillis() < currentTime.getTimeInMillis()) + { + testStartTime.add(Calendar.DAY_OF_MONTH, 1); + } + + //TimeL Recebe o quanto falta de milisegundos para o restart + timeL = testStartTime.getTimeInMillis() - currentTime.getTimeInMillis(); + + //Verifica qual horario sera o proximo restart + if(count == 0){ + flush2 = timeL; + NextRestart = testStartTime; + } + + if(timeL < flush2){ + flush2 = timeL; + NextRestart = testStartTime; + } + + count ++; + } + _log.info("[AutoRestart]: Next Restart Time: " + NextRestart.getTime().toString()); + ThreadPoolManager.getInstance().scheduleGeneral(new StartRestartTask(), flush2); + } + catch (Exception e) + { + System.out.println("[AutoRestart]: The restart automated server presented error in load restarts period config !"); + } + } + + class StartRestartTask implements Runnable + { + public void run() + { + _log.info("Start automated restart GameServer."); + Shutdown.getInstance().autoRestart(Config.RESTART_SECONDS); + } + } + } \ No newline at end of file ### Eclipse Workspace Patch 1.0 #P L2JFrozen Index: gameserver/head-src/com/l2jfrozen/gameserver/GameServer.java =================================================================== --- gameserver/head-src/com/l2jfrozen/gameserver/GameServer.java (revision 936) +++ gameserver/head-src/com/l2jfrozen/gameserver/GameServer.java (working copy) @@ -549,6 +549,14 @@ if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS) OfflineTradeTable.restoreOfflineTraders(); + Util.printSection("Restart Manager"); + if(Config.RESTART_BY_TIME_OF_DAY) + Restart.getInstance().StartCalculationOfNextRestartTime(); + else + _log.info("# Auto Restart System is Disabled #"); + + System.gc(); + Util.printSection("Info"); _log.info("Operating System: " + Util.getOSName() + " " + Util.getOSVersion() + " " + Util.getOSArch()); _log.info("Available CPUs: " + Util.getAvailableProcessors()); ### Eclipse Workspace Patch 1.0 #P L2JFrozen Index: gameserver/config/custom/la2slipper.properties =================================================================== --- gameserver/config/custom/la2slipper.properties (revision 936) +++ gameserver/config/custom/la2slipper.properties (working copy) @@ -2,6 +2,42 @@ # Server Config # #============================================================# +########################################### +# Automated restart config # +# Mod exclusive LA2JSlipper # +# ######################################### +# Enable / Disable Restart Auto +EnableRestartSystem = False + +# If EnableRestartSystem = True Describe hours of the day +# Example: 22:00,23:00 (hh:mm,hh:mm...) +# NOTE: Separate ":" mm:hh and "," others restart time +RestartByTimeOfDay = 00:00,12:00 + +# Seconds to restart the server ( 360 = 5 Minutos ) +# default = 360 +RestartSeconds = 360 + # Server Name Enabled: Displays a message on char login # with the server name you have set below. ServerNameEnabled = False ### Eclipse Workspace Patch 1.0 #P L2JFrozen Index: gameserver/head-src/com/l2jfrozen/Config.java =================================================================== --- gameserver/head-src/com/l2jfrozen/Config.java (revision 936) +++ gameserver/head-src/com/l2jfrozen/Config.java (working copy) @@ -2281,6 +2287,13 @@ public static boolean ANNOUNCE_TO_ALL_SPAWN_RB; public static boolean ANNOUNCE_TRY_BANNED_ACCOUNT; public static String ALT_Server_Name; + public static boolean ENABLE_CLAN_SYSTEM; + public static Map CLAN_SKILLS; + public static byte CLAN_LEVEL; + public static int REPUTATION_QUANTITY; + public static boolean RESTART_BY_TIME_OF_DAY; + public static int RESTART_SECONDS; + public static String[] RESTART_INTERVAL_BY_TIME_OF_DAY; + RESTART_BY_TIME_OF_DAY = Boolean.parseBoolean(la2slipperSettings.getProperty("EnableRestartSystem", "false")); + RESTART_SECONDS = Integer.parseInt(la2slipperSettings.getProperty("RestartSeconds", "360")); + RESTART_INTERVAL_BY_TIME_OF_DAY = la2slipperSettings.getProperty("RestartByTimeOfDay", "20:00").split(",");
  8. ### Eclipse Workspace Patch 1.0 #P aCis_gameserver Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java =================================================================== --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 2) +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy) @@ -17,6 +17,7 @@ import net.sf.l2j.Config; import net.sf.l2j.gameserver.Announcements; import net.sf.l2j.gameserver.GameTimeController; +import net.sf.l2j.gameserver.Restart; import net.sf.l2j.gameserver.communitybbs.Manager.MailBBSManager; import net.sf.l2j.gameserver.datatables.AdminCommandAccessRights; import net.sf.l2j.gameserver.datatables.GmListTable; @@ -186,6 +187,11 @@ } } + if(Config.RESTART_BY_TIME_OF_DAY) + { + ShowNextRestart(activeChar); + } + activeChar.getMacroses().sendUpdate(); activeChar.sendPacket(new UserInfo(activeChar)); activeChar.sendPacket(new HennaInfo(activeChar)); @@ -323,4 +329,10 @@ { return false; } + + private static void ShowNextRestart(L2PcInstance activeChar) + { + activeChar.sendMessage("Next Restart: " + Restart.getInstance().getRestartNextTime()); + } + } \ No newline at end of file Index: java/net/sf/l2j/gameserver/Restart.java =================================================================== --- java/net/sf/l2j/gameserver/Restart.java (revision 0) +++ java/net/sf/l2j/gameserver/Restart.java (working copy) @@ -0,0 +1,114 @@ +/* +* This program is free software: you can redistribute it and/or modify it under +* the terms of the GNU General Public License as published by the Free Software +* Foundation, either version 3 of the License, or (at your option) any later +* version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +* details. +* +* You should have received a copy of the GNU General Public License along with +* this program. If not, see <http://www.gnu.org/licenses/>. +*/ +package net.sf.l2j.gameserver; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.logging.Logger; + +import net.sf.l2j.Config; +import net.sf.l2j.gameserver.ThreadPoolManager; + +/** +* @author Toxico +*/ + +public class Restart + { + //Variaveis globais + private static Restart _instance = null; + protected static final Logger _log = Logger.getLogger(Restart.class.getName()); + private Calendar NextRestart; + private SimpleDateFormat format = new SimpleDateFormat("HH:mm"); + + //Singleton + public static Restart getInstance() + { + if(_instance == null) + _instance = new Restart(); + return _instance; + } + + public String getRestartNextTime() + { + if(NextRestart.getTime() != null) + return format.format(NextRestart.getTime()); + return "Erro"; + } + + //Connstrutor + private Restart() + { + //:D + } + + public void StartCalculationOfNextRestartTime() + { + try + { + Calendar currentTime = Calendar.getInstance(); + Calendar testStartTime = null; + long flush2 = 0,timeL = 0; + int count = 0; + + for (String timeOfDay : Config.RESTART_INTERVAL_BY_TIME_OF_DAY) + { + testStartTime = Calendar.getInstance(); + testStartTime.setLenient(true); + String[] splitTimeOfDay = timeOfDay.split(":"); + testStartTime.set(Calendar.HOUR_OF_DAY, Integer.parseInt(splitTimeOfDay[0])); + testStartTime.set(Calendar.MINUTE, Integer.parseInt(splitTimeOfDay[1])); + testStartTime.set(Calendar.SECOND, 00); + //Verifica a validade to tempo + if (testStartTime.getTimeInMillis() < currentTime.getTimeInMillis()) + { + testStartTime.add(Calendar.DAY_OF_MONTH, 1); + } + + //TimeL Recebe o quanto falta de milisegundos para o restart + timeL = testStartTime.getTimeInMillis() - currentTime.getTimeInMillis(); + + //Verifica qual horario sera o proximo restart + if(count == 0){ + flush2 = timeL; + NextRestart = testStartTime; + } + + if(timeL < flush2){ + flush2 = timeL; + NextRestart = testStartTime; + } + + count ++; + } + _log.info("Auto Restart: Next Restart Time: " + NextRestart.getTime().toString()); + ThreadPoolManager.getInstance().scheduleGeneral(new StartRestartTask(), flush2); + } + catch (Exception e) + { + System.out.println("[AutoRestart]: The restart automated server presented error in load restarts period config !"); + } + } + + class StartRestartTask implements Runnable + { + @Override + public void run() + { + _log.info("Start automated restart GameServer."); + Shutdown.getInstance().autoRestart(Config.RESTART_SECONDS); + } + } +} \ No newline at end of file Index: java/net/sf/l2j/gameserver/GameServer.java =================================================================== --- java/net/sf/l2j/gameserver/GameServer.java (revision 2) +++ java/net/sf/l2j/gameserver/GameServer.java (working copy) @@ -178,6 +178,13 @@ GmListTable.getInstance(); RaidBossPointsManager.getInstance(); + Util.printSection("Restart Manager"); + if(Config.RESTART_BY_TIME_OF_DAY) + Restart.getInstance().StartCalculationOfNextRestartTime(); + else + _log.info("# Auto Restart System is Disabled #"); + System.gc(); + Util.printSection("Community server"); if (Config.ENABLE_COMMUNITY_BOARD) // Forums has to be loaded before clan data ForumsBBSManager.getInstance().initRoot(); Index: java/net/sf/l2j/gameserver/Shutdown.java =================================================================== --- java/net/sf/l2j/gameserver/Shutdown.java (revision 2) +++ java/net/sf/l2j/gameserver/Shutdown.java (working copy) @@ -71,6 +71,18 @@ Broadcast.toAllOnlinePlayers(sysm); } + public void autoRestart(int time) + { + _secondsShut = time; + + countdown(); + + _shutdownMode = GM_RESTART; + + SingletonHolder._instance.setMode(GM_RESTART); + System.exit(2); + } + /** * Default constucter is only used internal to create the shutdown-hook instance */ Index: java/net/sf/l2j/Config.java =================================================================== --- java/net/sf/l2j/Config.java (revision 2) +++ java/net/sf/l2j/Config.java (working copy) @@ -652,6 +652,11 @@ public static int ZONE_TOWN; public static boolean DISABLE_TUTORIAL; + /** Auto Restart */ + public static boolean RESTART_BY_TIME_OF_DAY; + public static int RESTART_SECONDS; + public static String[] RESTART_INTERVAL_BY_TIME_OF_DAY; + // -------------------------------------------------- // Those "hidden" settings haven't configs to avoid admins to fuck their server // You still can experiment changing values here. But don't say I didn't warn you. @@ -1261,6 +1266,10 @@ ZONE_TOWN = server.getProperty("ZoneTown", 0); SERVER_NEWS = server.getProperty("ShowServerNews", false); DISABLE_TUTORIAL = server.getProperty("DisableTutorial", false); + + RESTART_BY_TIME_OF_DAY = Boolean.parseBoolean(server.getProperty("EnableRestartSystem", "false")); + RESTART_SECONDS = Integer.parseInt(server.getProperty("RestartSeconds", "360")); + RESTART_INTERVAL_BY_TIME_OF_DAY = server.getProperty("RestartByTimeOfDay", "20:00").split(","); } else if (Server.serverMode == Server.MODE_LOGINSERVER) { Index: config/server.properties =================================================================== --- config/server.properties (revision 2) +++ config/server.properties (working copy) @@ -370,4 +370,20 @@ ShowServerNews = False # Disable tutorial on new player game entrance. Default: False. -DisableTutorial = False \ No newline at end of file +DisableTutorial = False + +# ================================================================= +# Auto Restart +# ================================================================= + +# Enable / Disable Restart Auto +EnableRestartSystem = True + +# If EnableRestartSystem = True Describe hours of the day +# Example: 22:00,23:00 (hh:mm,hh:mm...) +# NOTE: Separate ":" mm:hh and "," others restart time +RestartByTimeOfDay = 00:00,12:00 + +# Seconds to restart the server ( 360 = 5 Minutos ) +# default = 360 +RestartSeconds = 360
  9. ### Eclipse Workspace Patch 1.0 #P L2JFrozen Index: gameserver/head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java =================================================================== --- gameserver/head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (revision 936) +++ gameserver/head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (working copy) @@ -26,6 +26,7 @@ import com.l2jfrozen.Config; import com.l2jfrozen.crypt.nProtect; import com.l2jfrozen.crypt.nProtect.RestrictionType; +import com.l2jfrozen.gameserver.Restart; import com.l2jfrozen.gameserver.communitybbs.Manager.RegionBBSManager; import com.l2jfrozen.gameserver.controllers.GameTimeController; import com.l2jfrozen.gameserver.datatables.CharSchemesTable; @@ -466,6 +467,11 @@ } } + if(Config.RESTART_BY_TIME_OF_DAY) + { + ShowNextRestart(activeChar); + } + // NPCBuffer if (PowerPakConfig.BUFFER_ENABLED) CharSchemesTable.getInstance().onPlayerLogin(activeChar.getObjectId()); @@ -801,6 +807,17 @@ } } + /** + * Envia mensagem para o player do proximo restart + * NOTE: RESTART_BY_TIME_OF_DAY = TRUE + * + * @param activeChar + */ + private void ShowNextRestart(L2PcInstance activeChar) + { + activeChar.sendMessage("Next Restart: " + Restart.getInstance().getRestartNextTime()); + } + @Override public String getType() { ### Eclipse Workspace Patch 1.0 #P L2JFrozen Index: gameserver/head-src/com/l2jfrozen/gameserver/Shutdown.java =================================================================== --- gameserver/head-src/com/l2jfrozen/gameserver/Shutdown.java (revision 936) +++ gameserver/head-src/com/l2jfrozen/gameserver/Shutdown.java (working copy) @@ -171,6 +171,18 @@ } } + public void autoRestart(int time) + { + _secondsShut = time; + + countdown(); + + _shutdownMode = GM_RESTART; + + _instance.setMode(GM_RESTART); + System.exit(2); + } + /** * Default constucter is only used internal to create the shutdown-hook instance */ ### Eclipse Workspace Patch 1.0 #P L2JFrozen Index: gameserver/head-src/com/l2jfrozen/gameserver/Restart.java =================================================================== --- gameserver/head-src/com/l2jfrozen/gameserver/Restart.java (revision 0) +++ gameserver/head-src/com/l2jfrozen/gameserver/Restart.java (revision 0) @@ -0,0 +1,122 @@ +/* + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + package com.l2jfrozen.gameserver; + + import java.text.SimpleDateFormat; + import java.util.Calendar; + import java.util.logging.Logger; + + import com.l2jfrozen.Config; + import com.l2jfrozen.gameserver.thread.ThreadPoolManager; + + /** + * This Config for Auto Restart GameServer + * Initialize class getInstance() + * Set Time in Config File + * Thank You L2JServer | L2JRussia + * + * @author L2JRussia + * + */ + public class Restart + { + //Variaveis globais + private static Restart _instance = null; + protected static final Logger _log = Logger.getLogger(Restart.class.getName()); + private Calendar NextRestart; + private SimpleDateFormat format = new SimpleDateFormat("HH:mm"); + + //Singleton + public static Restart getInstance() + { + if(_instance == null) + _instance = new Restart(); + return _instance; + } + + public String getRestartNextTime() + { + if(NextRestart.getTime() != null) + return format.format(NextRestart.getTime()); + else + return "Erro"; + } + + //Connstrutor + private Restart() + { + //:D + } + + public void StartCalculationOfNextRestartTime() + { + _log.info("#####################################"); + _log.info("#[Restart System]: System actived...#"); + _log.info("#####################################"); + try + { + Calendar currentTime = Calendar.getInstance(); + Calendar testStartTime = null; + long flush2 = 0,timeL = 0; + int count = 0; + + for (String timeOfDay : Config.RESTART_INTERVAL_BY_TIME_OF_DAY) + { + testStartTime = Calendar.getInstance(); + testStartTime.setLenient(true); + String[] splitTimeOfDay = timeOfDay.split(":"); + testStartTime.set(Calendar.HOUR_OF_DAY, Integer.parseInt(splitTimeOfDay[0])); + testStartTime.set(Calendar.MINUTE, Integer.parseInt(splitTimeOfDay[1])); + testStartTime.set(Calendar.SECOND, 00); + //Verifica a validade to tempo + if (testStartTime.getTimeInMillis() < currentTime.getTimeInMillis()) + { + testStartTime.add(Calendar.DAY_OF_MONTH, 1); + } + + //TimeL Recebe o quanto falta de milisegundos para o restart + timeL = testStartTime.getTimeInMillis() - currentTime.getTimeInMillis(); + + //Verifica qual horario sera o proximo restart + if(count == 0){ + flush2 = timeL; + NextRestart = testStartTime; + } + + if(timeL < flush2){ + flush2 = timeL; + NextRestart = testStartTime; + } + + count ++; + } + _log.info("[AutoRestart]: Next Restart Time: " + NextRestart.getTime().toString()); + ThreadPoolManager.getInstance().scheduleGeneral(new StartRestartTask(), flush2); + } + catch (Exception e) + { + System.out.println("[AutoRestart]: The restart automated server presented error in load restarts period config !"); + } + } + + class StartRestartTask implements Runnable + { + public void run() + { + _log.info("Start automated restart GameServer."); + Shutdown.getInstance().autoRestart(Config.RESTART_SECONDS); + } + } + } \ No newline at end of file ### Eclipse Workspace Patch 1.0 #P L2JFrozen Index: gameserver/head-src/com/l2jfrozen/gameserver/GameServer.java =================================================================== --- gameserver/head-src/com/l2jfrozen/gameserver/GameServer.java (revision 936) +++ gameserver/head-src/com/l2jfrozen/gameserver/GameServer.java (working copy) @@ -549,6 +549,14 @@ if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS) OfflineTradeTable.restoreOfflineTraders(); + Util.printSection("Restart Manager"); + if(Config.RESTART_BY_TIME_OF_DAY) + Restart.getInstance().StartCalculationOfNextRestartTime(); + else + _log.info("# Auto Restart System is Disabled #"); + + System.gc(); + Util.printSection("Info"); _log.info("Operating System: " + Util.getOSName() + " " + Util.getOSVersion() + " " + Util.getOSArch()); _log.info("Available CPUs: " + Util.getAvailableProcessors()); ### Eclipse Workspace Patch 1.0 #P L2JFrozen Index: gameserver/config/custom/la2slipper.properties =================================================================== --- gameserver/config/custom/la2slipper.properties (revision 936) +++ gameserver/config/custom/la2slipper.properties (working copy) @@ -2,6 +2,42 @@ # Server Config # #============================================================# +########################################### +# Automated restart config # +# Mod exclusive LA2JSlipper # +# ######################################### +# Enable / Disable Restart Auto +EnableRestartSystem = False + +# If EnableRestartSystem = True Describe hours of the day +# Example: 22:00,23:00 (hh:mm,hh:mm...) +# NOTE: Separate ":" mm:hh and "," others restart time +RestartByTimeOfDay = 00:00,12:00 + +# Seconds to restart the server ( 360 = 5 Minutos ) +# default = 360 +RestartSeconds = 360 + # Server Name Enabled: Displays a message on char login # with the server name you have set below. ServerNameEnabled = False ### Eclipse Workspace Patch 1.0 #P L2JFrozen Index: gameserver/head-src/com/l2jfrozen/Config.java =================================================================== --- gameserver/head-src/com/l2jfrozen/Config.java (revision 936) +++ gameserver/head-src/com/l2jfrozen/Config.java (working copy) @@ -2281,6 +2287,13 @@ public static boolean ANNOUNCE_TO_ALL_SPAWN_RB; public static boolean ANNOUNCE_TRY_BANNED_ACCOUNT; public static String ALT_Server_Name; + public static boolean ENABLE_CLAN_SYSTEM; + public static Map CLAN_SKILLS; + public static byte CLAN_LEVEL; + public static int REPUTATION_QUANTITY; + public static boolean RESTART_BY_TIME_OF_DAY; + public static int RESTART_SECONDS; + public static String[] RESTART_INTERVAL_BY_TIME_OF_DAY; + RESTART_BY_TIME_OF_DAY = Boolean.parseBoolean(la2slipperSettings.getProperty("EnableRestartSystem", "false")); + RESTART_SECONDS = Integer.parseInt(la2slipperSettings.getProperty("RestartSeconds", "360")); + RESTART_INTERVAL_BY_TIME_OF_DAY = la2slipperSettings.getProperty("RestartByTimeOfDay", "20:00").split(",");
  10. ### Eclipse Workspace Patch 1.0 #P trunk Index: unstable/java/com/l2jfanatic/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- unstable/java/com/l2jfanatic/gameserver/model/actor/instance/L2PcInstance.java (revision 8) +++ unstable/java/com/l2jfanatic/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -36,6 +36,7 @@ import com.l2jfanatic.Config; import com.l2jfanatic.L2DatabaseFactory; +import com.l2jfanatic.gameserver.Announcements; import com.l2jfanatic.gameserver.GameTimeController; import com.l2jfanatic.gameserver.GeoData; import com.l2jfanatic.gameserver.ItemsAutoDestroy; @@ -407,6 +408,9 @@ private boolean _isInWater; private boolean _isIn7sDungeon = false; + // by leonardo alves. + private int heroaddkills = 0, deadkillsremovehero = 0; + private PunishLevel _punishLevel = PunishLevel.NONE; private long _punishTimer = 0; private ScheduledFuture<?> _punishTask; @@ -502,7 +506,7 @@ private TradeList _buyList; private boolean _noble = false; - private boolean _hero = false; + private boolean _hero = false, _fakehero = false; /** The L2Npc corresponding to the current folk the player is talking with. */ private L2Npc _currentFolkNpc = null; @@ -1942,6 +1946,12 @@ */ public void setPvpKills(int pvpKills) { + ++heroaddkills; + if(Config.FH_ENABLED && !isFakeHero() && !isHero() && heroaddkills == Config.FH_NEED_KILLS){ + setFakeHero(true); + setHero(true); + Announcements.getInstance().announceToAll(getName()+": Set hero for "+heroaddkills+" kills."); + } _pvpKills = pvpKills; } @@ -4187,6 +4197,16 @@ @Override public boolean doDie(L2Character killer) { + ++deadkillsremovehero; + if(Config.FH_ENABLED && isFakeHero() && deadkillsremovehero == Config.FH_NEED_DEADS) + { + setFakeHero(false); + setHero(false); + Announcements.getInstance().announceToAll(getName()+": dead hero status lost.. total kills: "+heroaddkills+"."); + Announcements.getInstance().announceToAll(getName()+": Dead: "+deadkillsremovehero+"."); + deadkillsremovehero = 0; + heroaddkills = 0; + } // Kill the L2PcInstance if (!super.doDie(killer)) return false; @@ -8252,10 +8272,13 @@ { return _blockList; } - + public void setFakeHero(boolean fakehero) + { + _fakehero = fakehero; + } public void setHero(boolean hero) { - if (hero && _baseClass == _activeClass) + if (!_fakehero && hero && _baseClass == _activeClass) { for (L2Skill s : SkillTable.getHeroSkills()) addSkill(s, false); // Dont Save Hero skills to database @@ -8284,7 +8307,10 @@ { return _OlympiadStart; } - + public boolean isFakeHero() + { + return _fakehero; + } public boolean isHero() { return _hero; Index: unstable/java/com/l2jfanatic/Config.java =================================================================== --- unstable/java/com/l2jfanatic/Config.java (revision 8) +++ unstable/java/com/l2jfanatic/Config.java (working copy) @@ -372,6 +372,15 @@ public static boolean WYVERN_PROTECTION; public static String ID_RESTRICT; public static List<Integer> LISTID_RESTRICT; public static List<String> ITEM_PROTECTION_EXCLUDE_ON = new ArrayList<String>(); + // By Leonardo Alves + public static boolean FH_ENABLED; + public static int FH_NEED_KILLS; + public static int FH_NEED_DEADS; + // L2JBrasil - L2JFanatic Team. public static int STARTING_ADENA; public static boolean EFFECT_CANCELING; public static double HP_REGEN_MULTIPLIER; @@ -996,6 +1005,21 @@ { ITEM_PROTECTION_EXCLUDE_ON.add(items.nextToken()); } + FH_ENABLED = Boolean.parseBoolean(players.getProperty("FHEnabled","True")); + FH_NEED_KILLS = Integer.parseInt(players.getProperty("FHNeedKills", "5")); + FH_NEED_DEADS = Integer.parseInt(players.getProperty("FHNeedDeads", "100")); STARTING_ADENA = players.getProperty("StartingAdena", 100); EFFECT_CANCELING = players.getProperty("CancelLesserEffect", true); HP_REGEN_MULTIPLIER = players.getProperty("HpRegenMultiplier", 1.); Index: unstable/dist/config/players.properties =================================================================== --- unstable/dist/config/players.properties (revision 8) +++ unstable/dist/config/players.properties (working copy) @@ -2,6 +2,16 @@ ProtectionItemID = 0,0,0,0,0 ItemsProtectionExcludeOn = PVP PEACE SIEGE OLYMPIAD SEVEN RB + +# By Leonardo Alves +FHEnabled = True +FHNeedKills = 5 +FHNeedDeads = 2 + #Amount of adenas that a new character is given, default is 100 StartingAdena = 100
  11. queria sabe como coloca site online sem erro voa no-ip dereto da meu pc
  12. claudeny

    server gracia final

    BOM GALERA QUEM TEVE UM PRE GRACIA FINAL QUE ESTEJA EM BOM USO POR QUE TESTEI VARIOS PRE CONFIGURADO DO FORUM EM ATE AGORA NEN UM ESTA BOM TODOS COM ERRO DE HTML SCRIP ERRO DE GS SKILL E PORISO QUEM TEVE UM REV L2JFREE OU L2JSERVER AGRADESO...
×
×
  • Create New...