Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P aCis_gameserver405
- diff --git config/GameModeSystem.properties config/GameModeSystem.properties
- new file mode 100644
- index 0000000..f9226ad
- --- /dev/null
- +++ config/GameModeSystem.properties
- @@ -0,0 +1,17 @@
- +#==========================================================================
- +# GAME MODE SYSTEM - PVE - PVP - NORMAL - WITH BONUS
- +#==========================================================================
- +
- +GameModeSystemEnable = True
- +PvPModeRateXp = 50
- +PvPModeRateSp = 50
- +PvPModeRateDropCurency = 50
- +PvPModeRateDropSpoil = 50
- +PvPModeRateDropItems = 50
- +PvPModeRateRaidDropItems = 50
- +NormalModeRateXp = 20
- +NormalModeRateSp = 20
- +NormalModeRateDropCurency = 20
- +NormalModeRateDropSpoil = 20
- +NormalModeRateDropItems = 20
- +NormalModeRateRaidDropItems = 20
- diff --git java/Base/GameModeSystem/ChangeModeManager.java java/Base/GameModeSystem/ChangeModeManager.java
- new file mode 100644
- index 0000000..3f9e220
- --- /dev/null
- +++ java/Base/GameModeSystem/ChangeModeManager.java
- @@ -0,0 +1,156 @@
- +package Base.GameModeSystem;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.enums.ZoneId;
- +import net.sf.l2j.gameserver.model.actor.Player;
- +
- +public class ChangeModeManager
- +{
- + public static boolean verifyChangeMode(Player activeChar)
- + {
- + if (activeChar == null)
- + {
- + return false;
- + }
- +
- + if (!Config.GAME_MODE_ENABLE)
- + {
- + activeChar.sendMessage("El Change Mode System Esta Desactivado.");
- + return false;
- + }
- +
- + if (activeChar.isMoving())
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Te Estas Moviendo");
- + return false;
- + }
- +
- + if (activeChar.isInParty())
- + {
- + activeChar.sendMessage("Sal De La Party Para Cambiar de Modo De Juego");
- + return false;
- + }
- +
- + if (activeChar.isInDuel())
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInArena())
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- +
- +
- + if (activeChar.isInJail())
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInPartyMatchRoom())
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- +
- +
- + if (activeChar.isInsideZone(ZoneId.BOSS))
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInsideZone(ZoneId.CASTLE))
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInsideZone(ZoneId.DANGER_AREA))
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- +
- +
- + if (activeChar.isInsideZone(ZoneId.NO_SUMMON_FRIEND))
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInsideZone(ZoneId.JAIL))
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInsideZone(ZoneId.MONSTER_TRACK))
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- +
- +
- + if (activeChar.isInsideZone(ZoneId.PVP))
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- +
- +
- + if (activeChar.isInsideZone(ZoneId.SIEGE))
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInsideZone(ZoneId.NO_RESTART))
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isIn7sDungeon())
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- +
- +
- + if (activeChar.isInOlympiadMode())
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas En Olympiadas");
- + return false;
- + }
- +
- +
- +
- + if (activeChar.isInObserverMode())
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas en ObserverMode");
- + return false;
- + }
- +
- +
- +
- + if (activeChar.isInCombat())
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Si Estas en Combate");
- + return false;
- + }
- +
- +
- +
- + return true;
- + }
- +}
- diff --git java/net/sf/l2j/Config.java java/net/sf/l2j/Config.java
- index 30397a1..7065ef2 100644
- --- java/net/sf/l2j/Config.java
- +++ java/net/sf/l2j/Config.java
- @@ -33,32 +33,42 @@
- public static final String LOGINSERVER_FILE = "./config/loginserver.properties";
- public static final String NPCS_FILE = "./config/npcs.properties";
- public static final String PLAYERS_FILE = "./config/players.properties";
- + public static final String GAME_MODE_FILE = "./config/GameModeSystem.properties";
- public static final String SERVER_FILE = "./config/server.properties";
- public static final String SIEGE_FILE = "./config/siege.properties";
- + // --------------------------------------------------
- + // Game Mode System - PVE - PVP - NORMAL
- + // --------------------------------------------------
- + public static boolean GAME_MODE_ENABLE;
- + public static double PVP_MODE_RATE_XP;
- + public static double PVP_MODE_RATE_SP;
- + public static double PVP_MODE_RATE_DROP_CURRENCY;
- + public static double PVP_MODE_RATE_DROP_SPOIL;
- + public static double PVP_MODE_RATE_DROP_ITEMS;
- + public static double PVP_MODE_RATE_DROP_ITEMS_BY_RAID;
- + public static double NORMAL_MODE_RATE_XP;
- + public static double NORMAL_MODE_RATE_SP;
- + public static double NORMAL_MODE_RATE_DROP_CURRENCY;
- + public static double NORMAL_MODE_RATE_DROP_SPOIL;
- + public static double NORMAL_MODE_RATE_DROP_ITEMS;
- + public static double NORMAL_MODE_RATE_DROP_ITEMS_BY_RAID;
- // --------------------------------------------------
- // Clans settings
- // --------------------------------------------------
- /** Clans */
- public static int CLAN_JOIN_DAYS;
- public static int CLAN_CREATE_DAYS;
- @@ -835,6 +845,29 @@
- }
- /**
- + * Loads GameModeSystem settings.
- + */
- + private static final void loadGameMode()
- + {
- + final ExProperties gamemode = initProperties(GAME_MODE_FILE);
- +
- + GAME_MODE_ENABLE = gamemode.getProperty("GameModeSystemEnable", true);
- + PVP_MODE_RATE_XP = gamemode.getProperty("PvPModeRateXp", 2.);
- + PVP_MODE_RATE_SP = gamemode.getProperty("PvPModeRateSp", 2.);
- + PVP_MODE_RATE_DROP_CURRENCY = gamemode.getProperty("PvPModeRateDropCurency", 2.);
- + PVP_MODE_RATE_DROP_SPOIL = gamemode.getProperty("PvPModeRateDropSpoil", 2.);
- + PVP_MODE_RATE_DROP_ITEMS = gamemode.getProperty("PvPModeRateDropItems", 2.);
- + PVP_MODE_RATE_DROP_ITEMS_BY_RAID = gamemode.getProperty("PvPModeRateRaidDropItems", 2.);
- + NORMAL_MODE_RATE_XP = gamemode.getProperty("NormalModeRateXp", 2.);
- + NORMAL_MODE_RATE_SP = gamemode.getProperty("NormalModeRateSp", 2.);
- + NORMAL_MODE_RATE_DROP_CURRENCY = gamemode.getProperty("NormalModeRateDropCurency", 2.);
- + NORMAL_MODE_RATE_DROP_SPOIL = gamemode.getProperty("NormalModeRateDropSpoil", 2.);
- + NORMAL_MODE_RATE_DROP_ITEMS = gamemode.getProperty("NormalModeRateDropItems", 2.);
- + NORMAL_MODE_RATE_DROP_ITEMS_BY_RAID = gamemode.getProperty("NormalModeRateRaidDropItems", 2.);
- +
- + }
- +
- + /**
- * Loads hex ID settings.
- */
- private static final void loadHexID()
- @@ -1292,6 +1323,9 @@
- // geoengine settings
- loadGeoengine();
- + // gamemode settings
- + loadGameMode();
- +
- // hexID
- loadHexID();
- diff --git java/net/sf/l2j/gameserver/enums/DropType.java java/net/sf/l2j/gameserver/enums/DropType.java
- index 57dbb7b..bcc057c 100644
- --- java/net/sf/l2j/gameserver/enums/DropType.java
- +++ java/net/sf/l2j/gameserver/enums/DropType.java
- @@ -1,6 +1,8 @@
- package net.sf.l2j.gameserver.enums;
- import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.model.actor.Npc;
- +import net.sf.l2j.gameserver.model.actor.Player;
- public enum DropType
- {
- @@ -9,17 +11,51 @@
- DROP,
- HERB;
- - public double getDropRate(boolean isRaid)
- + public double getDropRate(Player player, Npc npc, boolean isRaid)
- {
- switch (this)
- {
- case SPOIL:
- + if (player.isPVPMode())
- + {
- + return Config.PVP_MODE_RATE_DROP_SPOIL;
- + }
- +
- + if (player.isNormalMode())
- + {
- + return Config.NORMAL_MODE_RATE_DROP_SPOIL;
- + }
- +
- return Config.RATE_DROP_SPOIL;
- case CURRENCY:
- +
- + if (player.isPVPMode())
- + {
- + return Config.PVP_MODE_RATE_DROP_CURRENCY;
- + }
- +
- + if (player.isNormalMode())
- + {
- + return Config.NORMAL_MODE_RATE_DROP_CURRENCY;
- + }
- +
- return Config.RATE_DROP_CURRENCY;
- case DROP:
- +
- + if (player.isPVPMode())
- + {
- + if (isRaid)
- + return Config.PVP_MODE_RATE_DROP_ITEMS_BY_RAID;
- + }
- +
- + if (player.isNormalMode())
- + {
- + if (isRaid)
- + return Config.NORMAL_MODE_RATE_DROP_ITEMS_BY_RAID;
- + }
- +
- return isRaid ? Config.RATE_DROP_ITEMS_BY_RAID : Config.RATE_DROP_ITEMS;
- case HERB:
- diff --git java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
- index 35df73c..4dacb70 100644
- --- java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
- +++ java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
- @@ -4,6 +4,7 @@
- import java.util.Map;
- import net.sf.l2j.gameserver.handler.usercommandhandlers.DressMe;
- +import net.sf.l2j.gameserver.handler.voicedcommandhandlers.GameMode;
- public class VoicedCommandHandler
- {
- @@ -18,6 +19,7 @@
- {
- //Codigos para colocar aqui dentro
- registerHandler(new DressMe());
- + registerHandler(new GameMode());
- }
- diff --git java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminInfo.java java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminInfo.java
- index 0dba20a..1924f58 100644
- --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminInfo.java
- +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminInfo.java
- @@ -111,11 +111,11 @@
- {
- final int page = (st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : 1;
- - sendDropInfos(targetNpc, html, page, subCommand.equalsIgnoreCase("drop"));
- + sendDropInfos(player, targetNpc, html, page, subCommand.equalsIgnoreCase("drop"));
- }
- catch (Exception e)
- {
- - sendDropInfos(targetNpc, html, 1, true);
- + sendDropInfos(player, targetNpc, html, 1, true);
- }
- break;
- @@ -289,12 +289,13 @@
- /**
- * Feed a {@link NpcHtmlMessage} with <b>DROPS</b> or <b>SPOILS</b> informations regarding a {@link Npc}.
- + * @param player
- * @param npc : The {@link Npc} used as reference.
- * @param html : The {@link NpcHtmlMessage} used as reference.
- * @param page : The current page we are checking.
- * @param isDrop : If true, we check drops only. If false, we check spoils.
- */
- - private static void sendDropInfos(Npc npc, NpcHtmlMessage html, int page, boolean isDrop)
- + private static void sendDropInfos(Player player, Npc npc, NpcHtmlMessage html, int page, boolean isDrop)
- {
- // Load static htm.
- html.setFile("data/html/admin/npcinfo/default.htm");
- @@ -305,7 +306,7 @@
- final Pagination<DropCategory> list = new Pagination<>(npc.getTemplate().getDropData().stream(), page, PAGE_LIMIT_1, dc -> (isDrop) ? dc.getDropType() != DropType.SPOIL : dc.getDropType() == DropType.SPOIL);
- for (DropCategory category : list)
- {
- - double catChance = category.getChance() * category.getDropType().getDropRate(npc.isRaidBoss());
- + double catChance = category.getChance() * category.getDropType().getDropRate(player, npc, npc.isRaidBoss());
- double chanceMultiplier = 1;
- double countMultiplier = 1;
- diff --git java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/GameMode.java java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/GameMode.java
- new file mode 100644
- index 0000000..3d5d529
- --- /dev/null
- +++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/GameMode.java
- @@ -0,0 +1,311 @@
- +package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
- +
- +import java.sql.Connection;
- +import java.sql.PreparedStatement;
- +import java.sql.SQLException;
- +
- +import net.sf.l2j.commons.pool.ConnectionPool;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.enums.ZoneId;
- +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
- +import net.sf.l2j.gameserver.model.World;
- +import net.sf.l2j.gameserver.model.actor.Player;
- +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- +import net.sf.l2j.gameserver.taskmanager.PvpFlagTaskManager;
- +
- +public class GameMode implements IVoicedCommandHandler
- +{
- + private static final String[] VOICED_COMMANDS =
- + {
- + "pve",
- + "pvp",
- + "normal",
- + "mode"
- + };
- +
- + @Override
- + public boolean useVoicedCommand(String command, Player activeChar, String params)
- + {
- + if (activeChar == null)
- + {
- + return false;
- + }
- +
- + if (!Config.GAME_MODE_ENABLE)
- + {
- + activeChar.sendMessage("El Change Mode System Esta Desactivado.");
- + return false;
- + }
- +
- + if (activeChar.isMoving())
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Te Estas Moviendo");
- + return false;
- + }
- +
- + if (activeChar.isInParty())
- + {
- +
- + activeChar.sendMessage("Sal De La Party Para Cambiar de Modo De Juego");
- + return false;
- + }
- +
- + if (activeChar.isInDuel())
- + {
- +
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInArena())
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInJail())
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInPartyMatchRoom())
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInsideZone(ZoneId.BOSS))
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInsideZone(ZoneId.CASTLE))
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInsideZone(ZoneId.DANGER_AREA))
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInsideZone(ZoneId.NO_SUMMON_FRIEND))
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInsideZone(ZoneId.JAIL))
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInsideZone(ZoneId.MONSTER_TRACK))
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInsideZone(ZoneId.PVP))
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInsideZone(ZoneId.SIEGE))
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInsideZone(ZoneId.NO_RESTART))
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isIn7sDungeon())
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
- + return false;
- + }
- +
- + if (activeChar.isInOlympiadMode())
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas En Olympiadas");
- + return false;
- + }
- +
- + if (activeChar.isInObserverMode())
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas ObserverMode");
- + return false;
- + }
- +
- + if ((activeChar.isInCombat()))
- + {
- + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Si Estas En Combate");
- + return false;
- + }
- +
- + if (command.equalsIgnoreCase(VOICED_COMMANDS[0]))
- + { // PVE Mode
- +
- + if (activeChar.isPVEMode())
- + {
- + activeChar.sendMessage("Ya estas en el modo PVE.");
- + return false;
- + }
- +
- + if (activeChar.getPvpFlag() == 0 && activeChar.getKarma() == 0)
- + {
- + activeChar.setPVEMode(true);
- + activeChar.setGameModeService(0);
- + activeChar.setPVPMode(false);
- + activeChar.setNormalMode(false);
- + setActiveCharGameMode(activeChar, "PVE MODE");
- + activeChar.sendMessage("Has cambiado al modo PVE. - No Podran Matarte Otros Jugadores");
- + activeChar.sendMessage("Tampoco Podras Atacar a Otros Jugadores - No Obtendras El Bonus");
- + activeChar.decayMe();
- + World.getInstance().addPlayer(activeChar);
- + activeChar.broadcastUserInfo();
- + activeChar.spawnMe();
- + return true;
- + }
- + activeChar.sendMessage(" Estas con Flag o Tienes Karma No puedes Activar el modo PvE Con Karma o Flag");
- + return false;
- +
- + }
- + else if (command.equalsIgnoreCase(VOICED_COMMANDS[1]))
- + { // PVP Mode
- +
- + if (activeChar.isPVPMode())
- + {
- + activeChar.sendMessage("Ya estas en el modo PVP.");
- + return false;
- + }
- +
- + if (activeChar.getStatus().getLevel() < 76 && !activeChar.isGM())
- + {
- + activeChar.sendMessage("Necesitas Minimo Ser LvL 76 Para Activar El Modo PvP");
- + return false;
- + }
- +
- + if (!activeChar.isInsideZone(ZoneId.TOWN) && !activeChar.isGM())
- + {
- + activeChar.sendMessage("Solo Puedes Cambiar El Modo En Una Ciudad.");
- + return false;
- + }
- +
- + activeChar.updatePvPFlag(1);
- + activeChar.setPVEMode(false);
- + activeChar.setPVPMode(true);
- + activeChar.setGameModeService(1);
- + activeChar.setNormalMode(false);
- + setActiveCharGameMode(activeChar, "PVP MODE");
- + activeChar.sendMessage("Has cambiado al modo PVP. - Obtendras un Bonus de 50%");
- + activeChar.decayMe();
- + World.getInstance().addPlayer(activeChar);
- + activeChar.broadcastUserInfo();
- + activeChar.spawnMe();
- + return true;
- + }
- + else if (command.equalsIgnoreCase(VOICED_COMMANDS[2]))
- + {
- +
- + if (activeChar.isNormalMode())
- + {
- + activeChar.sendMessage("Ya estas en el modo Normal.");
- + return false;
- + }
- +
- + if (!activeChar.isInsideZone(ZoneId.TOWN) && !activeChar.isGM())
- + {
- + activeChar.sendMessage("Solo Puedes Cambiar El Modo En Una Ciudad.");
- + return false;
- + }
- +
- + if (activeChar.getPvpFlag() > 0)
- + {
- +
- + PvpFlagTaskManager.getInstance().add(activeChar, Config.PVP_NORMAL_TIME);
- +
- + activeChar.updatePvPFlag(1);
- + activeChar.setPVEMode(false);
- + activeChar.setPVPMode(false);
- + activeChar.setNormalMode(true);
- + activeChar.setGameModeService(2);
- + activeChar.sendMessage("Has cambiado al modo Normal. - Obtendras un Bonus de 20%");
- +
- + setActiveCharGameMode(activeChar, "NORMAL MODE");
- + activeChar.decayMe();
- + World.getInstance().addPlayer(activeChar);
- + activeChar.broadcastUserInfo();
- + activeChar.spawnMe();
- +
- + }
- + else
- + {
- +
- + activeChar.setPVEMode(false);
- + activeChar.setPVPMode(false);
- + activeChar.setNormalMode(true);
- + activeChar.setGameModeService(2);
- + setActiveCharGameMode(activeChar, "NORMAL MODE");
- + activeChar.sendMessage("Has cambiado al modo Normal. - Obtendras un Bonus de 20%");
- + activeChar.decayMe();
- + World.getInstance().addPlayer(activeChar);
- + activeChar.broadcastUserInfo();
- + activeChar.spawnMe();
- + return true;
- + }
- +
- + }
- +
- + else if (command.equalsIgnoreCase(VOICED_COMMANDS[3]))
- + { // PVP Mode
- + showModeSystemHTML(activeChar);
- + return true;
- + }
- +
- + return false;
- + }
- +
- + private static void setActiveCharGameMode(Player activeChar, String gameMode)
- + {
- + try (Connection con = ConnectionPool.getConnection())
- + {
- + String sql = "REPLACE INTO Character_Game_Mode (object_id, char_name, game_mode) VALUES (?, ?, ?)";
- + try (PreparedStatement ps = con.prepareStatement(sql))
- + {
- + ps.setInt(1, activeChar.getObjectId());
- + ps.setString(2, activeChar.getName());
- + ps.setString(3, gameMode);
- + ps.execute();
- + }
- + }
- + catch (SQLException e)
- + {
- + // Manejo de excepciones
- + }
- + }
- +
- + private static void showModeSystemHTML(Player player)
- + {
- + NpcHtmlMessage html = new NpcHtmlMessage(0);
- + html.setFile("data/html/mods/ChangeModeSystem/ModeSystem.htm");
- + player.sendPacket(html);
- + }
- +
- + @Override
- + public String[] getVoicedCommandList()
- + {
- + return VOICED_COMMANDS;
- + }
- +}
- diff --git java/net/sf/l2j/gameserver/model/actor/Creature.java java/net/sf/l2j/gameserver/model/actor/Creature.java
- index 44a34c5..0928279 100644
- --- java/net/sf/l2j/gameserver/model/actor/Creature.java
- +++ java/net/sf/l2j/gameserver/model/actor/Creature.java
- @@ -117,6 +117,7 @@
- private final Map<Integer, Long> _disabledSkills = new ConcurrentHashMap<>();
- private boolean _allSkillsDisabled;
- + private int _GameModeService;
- public Creature(int objectId, CreatureTemplate template)
- {
- @@ -1791,6 +1792,16 @@
- setTarget(null);
- }
- + public void setGameModeService(int premiumService)
- + {
- + _GameModeService = premiumService;
- + }
- +
- + public int getGameModeService()
- + {
- + return _GameModeService;
- + }
- +
- /**
- * @return The {@link List} of GMs {@link Player}s in surrounding regions.
- */
- diff --git java/net/sf/l2j/gameserver/model/actor/Npc.java java/net/sf/l2j/gameserver/model/actor/Npc.java
- index 16013ae..4c736eb 100644
- --- java/net/sf/l2j/gameserver/model/actor/Npc.java
- +++ java/net/sf/l2j/gameserver/model/actor/Npc.java
- @@ -874,18 +874,40 @@
- }
- /**
- + * @param GameMode
- * @return The Exp reward of this {@link Npc} based on its {@link NpcTemplate} and modified by {@link Config#RATE_XP}.
- */
- - public int getExpReward()
- + public int getExpReward(int GameMode)
- {
- + if (GameMode == 1)
- + {
- + return (int) (getTemplate().getRewardExp() * Config.PVP_MODE_RATE_XP);
- + }
- +
- + if (GameMode == 2)
- + {
- + return (int) (getTemplate().getRewardExp() * Config.NORMAL_MODE_RATE_XP);
- + }
- +
- return (int) (getTemplate().getRewardExp() * Config.RATE_XP);
- }
- /**
- + * @param GameMode
- * @return The SP reward of this {@link Npc} based on its {@link NpcTemplate} and modified by {@link Config#RATE_SP}.
- */
- - public int getSpReward()
- + public int getSpReward(int GameMode)
- {
- + if (GameMode == 1)
- + {
- + return (int) (getTemplate().getRewardExp() * Config.PVP_MODE_RATE_SP);
- + }
- +
- + if (GameMode == 2)
- + {
- + return (int) (getTemplate().getRewardExp() * Config.NORMAL_MODE_RATE_SP);
- + }
- +
- return (int) (getTemplate().getRewardSp() * Config.RATE_SP);
- }
- diff --git java/net/sf/l2j/gameserver/model/actor/Playable.java java/net/sf/l2j/gameserver/model/actor/Playable.java
- index 525de4a..bf420f5 100644
- --- java/net/sf/l2j/gameserver/model/actor/Playable.java
- +++ java/net/sf/l2j/gameserver/model/actor/Playable.java
- @@ -354,6 +354,13 @@
- if (isInSameActiveOlympiadMatch(targetPlayer))
- return true;
- + // Check if either the caster or the target is in PvE mode.
- + if (getActingPlayer().isPVEMode() || targetPlayer.isPVEMode())
- + {
- +
- + return false;
- + }
- +
- // No checks for players in Duel.
- if (isInSameActiveDuel(targetPlayer))
- return true;
- diff --git java/net/sf/l2j/gameserver/model/actor/Player.java java/net/sf/l2j/gameserver/model/actor/Player.java
- index 35bca86..de81940 100644
- --- java/net/sf/l2j/gameserver/model/actor/Player.java
- +++ java/net/sf/l2j/gameserver/model/actor/Player.java
- @@ -3,6 +3,7 @@
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- +import java.sql.SQLException;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.Collection;
- @@ -490,6 +475,10 @@
- private int _mailPosition;
- + private boolean isPVEMode = false;
- + private boolean isPVPMode = false;
- + private boolean isNormalMode = false;
- +
- private static final int FALLING_VALIDATION_DELAY = 10000;
- private volatile long _fallingTimestamp;
- @@ -7469,6 +7445,61 @@
- return formal != null && formal.getItem().getBodyPart() == Item.SLOT_ALLDRESS;
- }
- + public boolean isPVEMode()
- + {
- + return isPVEMode;
- + }
- +
- + public void setPVEMode(boolean b)
- + {
- + isPVEMode = b;
- + }
- +
- + public boolean isPVPMode()
- + {
- + return isPVPMode;
- + }
- +
- + public void setPVPMode(boolean b)
- + {
- + isPVPMode = b;
- + }
- +
- + public boolean isNormalMode()
- + {
- + return isNormalMode;
- + }
- +
- + public void setNormalMode(boolean b)
- + {
- + isNormalMode = b;
- + }
- +
- + public String getGameMode()
- + {
- + try (Connection con = ConnectionPool.getConnection())
- + {
- + String sql = "SELECT game_mode FROM Character_Game_Mode WHERE object_id = ?";
- + try (PreparedStatement ps = con.prepareStatement(sql))
- + {
- + ps.setInt(1, getObjectId());
- + try (ResultSet rs = ps.executeQuery())
- + {
- + if (rs.next())
- + {
- + return rs.getString("game_mode");
- + }
- + }
- + }
- + }
- + catch (SQLException e)
- + {
- + // Manejo de excepciones
- + }
- +
- + return "Desconocido";
- + }
- +
- public final void startFakeDeath()
- {
- _isFakeDeath = true;
- \ No newline at end of file
- diff --git java/net/sf/l2j/gameserver/model/actor/attack/PlayableAttack.java java/net/sf/l2j/gameserver/model/actor/attack/PlayableAttack.java
- index d264edd..28f35e3 100644
- --- java/net/sf/l2j/gameserver/model/actor/attack/PlayableAttack.java
- +++ java/net/sf/l2j/gameserver/model/actor/attack/PlayableAttack.java
- @@ -31,6 +31,14 @@
- return false;
- }
- + if (_actor.getActingPlayer().isPVEMode())
- + {
- +
- + _actor.sendMessage("Desactiva El Modo PvE Para Atacar A Otros Jugadores");
- + return false;
- +
- + }
- +
- if (target.isInsideZone(ZoneId.PEACE))
- {
- _actor.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
- diff --git java/net/sf/l2j/gameserver/model/actor/instance/Monster.java java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
- index c2e7083..4641f6e 100644
- --- java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
- +++ java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
- @@ -150,7 +150,7 @@
- {
- final int levelDiff = attacker.getStatus().getLevel() - getStatus().getLevel();
- final float penalty = (attacker.hasServitor()) ? ((Servitor) attacker.getSummon()).getExpPenalty() : 0;
- - final int[] expSp = calculateExpAndSp(levelDiff, damage, totalDamage);
- + final int[] expSp = calculateExpAndSp(attacker, levelDiff, damage, totalDamage, attacker.getGameModeService());
- long exp = expSp[0];
- int sp = expSp[1];
- @@ -222,10 +222,24 @@
- final int levelDiff = partyLvl - getStatus().getLevel();
- // Calculate Exp and SP rewards.
- - final int[] expSp = calculateExpAndSp(levelDiff, partyDmg, totalDamage);
- + final int[] expSpPvPMode = calculateExpAndSp(attacker, levelDiff, partyDmg, totalDamage, 1);
- + long exp_pvp_mode = expSpPvPMode[0];
- + int sp_pvp_mode = expSpPvPMode[1];
- +
- + // Calculate Exp and SP rewards.
- + final int[] expSpNormalMode = calculateExpAndSp(attacker, levelDiff, partyDmg, totalDamage, 2);
- + long exp_normal_mode = expSpNormalMode[0];
- + int sp_normal_mode = expSpNormalMode[1];
- +
- + // Calculate Exp and SP rewards.
- + final int[] expSp = calculateExpAndSp(attacker, levelDiff, partyDmg, totalDamage, 0);
- long exp = expSp[0];
- int sp = expSp[1];
- + exp_pvp_mode *= partyMul;
- + sp_pvp_mode *= partyMul;
- + exp_normal_mode *= partyMul;
- + sp_normal_mode *= partyMul;
- exp *= partyMul;
- sp *= partyMul;
- @@ -234,11 +248,13 @@
- {
- attacker.sendPacket(SystemMessageId.OVER_HIT);
- exp += _overhitState.calculateOverhitExp(exp);
- + exp_pvp_mode += _overhitState.calculateOverhitExp(exp_pvp_mode);
- + exp_normal_mode += _overhitState.calculateOverhitExp(exp_normal_mode);
- }
- // Distribute Experience and SP rewards to Player Party members in the known area of the last attacker.
- if (partyDmg > 0)
- - attackerParty.distributeXpAndSp(exp, sp, rewardedMembers, partyLvl, playersWithPets);
- + attackerParty.distributeXpAndSp(exp_pvp_mode, sp_pvp_mode, exp_normal_mode, sp_normal_mode, exp, sp, rewardedMembers, partyLvl, playersWithPets);
- }
- }
- }
- @@ -391,16 +407,18 @@
- /**
- * Calculate the XP and SP to distribute to the attacker of the {@link Monster}.
- + * @param player
- * @param diff : The difference of level between the attacker and the {@link Monster}.
- * @param damage : The damages done by the attacker.
- * @param totalDamage : The total damage done.
- + * @param GameMode
- * @return an array consisting of xp and sp values.
- */
- - private int[] calculateExpAndSp(int diff, int damage, long totalDamage)
- + private int[] calculateExpAndSp(Player player, int diff, int damage, long totalDamage, int GameMode)
- {
- // Calculate damage ratio.
- - double xp = (double) getExpReward() * damage / totalDamage;
- - double sp = (double) getSpReward() * damage / totalDamage;
- + double xp = (double) getExpReward(GameMode) * damage / totalDamage;
- + double sp = (double) getSpReward(GameMode) * damage / totalDamage;
- // Calculate level ratio.
- if (diff > 5)
- @@ -410,6 +428,18 @@
- sp = sp * pow;
- }
- + if (player.getGameModeService() == 1)
- + {
- + xp *= Config.PVP_MODE_RATE_XP;
- + sp *= Config.PVP_MODE_RATE_SP;
- + }
- +
- + if (player.getGameModeService() == 2)
- + {
- + xp *= Config.NORMAL_MODE_RATE_XP;
- + sp *= Config.NORMAL_MODE_RATE_SP;
- + }
- +
- // If the XP is inferior or equals 0, don't reward any SP. Both XP and SP can't be inferior to 0.
- if (xp <= 0)
- {
- @@ -483,7 +513,7 @@
- continue;
- // Calculate drops of this category.
- - for (IntIntHolder drop : category.calculateDrop(levelMultiplier, isRaid))
- + for (IntIntHolder drop : category.calculateDrop(player, this, levelMultiplier, isRaid))
- {
- if (type == DropType.SPOIL)
- getSpoilState().add(drop);
- diff --git java/net/sf/l2j/gameserver/model/group/Party.java java/net/sf/l2j/gameserver/model/group/Party.java
- index f697b7d..bacb259 100644
- --- java/net/sf/l2j/gameserver/model/group/Party.java
- +++ java/net/sf/l2j/gameserver/model/group/Party.java
- @@ -628,13 +628,17 @@
- * <FONT COLOR=#FF0000><B> <U>Caution</U> : This method DOESN'T GIVE rewards to Pet</B></FONT><BR>
- * <BR>
- * Exception are Pets that leech from the owner's XP; they get the exp indirectly, via the owner's exp gain.<BR>
- + * @param xpReward_pvp_mode
- + * @param spReward_pvp_mode
- + * @param xpReward_normal_mode
- + * @param spReward_normal_mode
- * @param xpReward : The Experience reward to distribute.
- * @param spReward : The SP reward to distribute.
- * @param rewardedMembers : The {@link Player}s' {@link List} to reward.
- * @param topLvl : The maximum level.
- * @param rewards : The {@link Map} of {@link Creature}s and {@link RewardInfo}.
- */
- - public void distributeXpAndSp(long xpReward, int spReward, List<Player> rewardedMembers, int topLvl, Map<Creature, RewardInfo> rewards)
- + public void distributeXpAndSp(long xpReward_pvp_mode, int spReward_pvp_mode, long xpReward_normal_mode, int spReward_normal_mode, long xpReward, int spReward, List<Player> rewardedMembers, int topLvl, Map<Creature, RewardInfo> rewards)
- {
- final List<Player> validMembers = new ArrayList<>();
- @@ -681,7 +685,13 @@
- xpReward *= partyRate * Config.RATE_PARTY_XP;
- spReward *= partyRate * Config.RATE_PARTY_SP;
- + xpReward_pvp_mode *= partyRate * Config.RATE_PARTY_XP;
- + spReward_pvp_mode *= partyRate * Config.RATE_PARTY_SP;
- + xpReward_normal_mode *= partyRate * Config.RATE_PARTY_XP;
- + spReward_normal_mode *= partyRate * Config.RATE_PARTY_SP;
- + long xpRew = 0;
- + int spRew = 0;
- int sqLevelSum = 0;
- for (Player member : validMembers)
- sqLevelSum += member.getStatus().getLevel() * member.getStatus().getLevel();
- @@ -692,6 +702,24 @@
- if (member.isDead())
- continue;
- + if (member.getGameModeService() == 0)
- + {
- + xpRew = xpReward;
- + spRew = spReward;
- + }
- +
- + if (member.getGameModeService() == 1)
- + {
- + xpRew = xpReward_pvp_mode;
- + spRew = spReward_pvp_mode;
- + }
- +
- + if (member.getGameModeService() == 2)
- + {
- + xpRew = xpReward_normal_mode;
- + spRew = spReward_normal_mode;
- + }
- +
- // Calculate and add the EXP and SP reward to the member.
- if (validMembers.contains(member))
- {
- @@ -701,8 +729,8 @@
- final double sqLevel = member.getStatus().getLevel() * member.getStatus().getLevel();
- final double preCalculation = (sqLevel / sqLevelSum) * (1 - penalty);
- - final long xp = Math.round(xpReward * preCalculation);
- - final int sp = (int) (spReward * preCalculation);
- + final long xp = Math.round(xpRew * preCalculation);
- + final int sp = (int) (spRew * preCalculation);
- // Set new karma.
- member.updateKarmaLoss(xp);
- diff --git java/net/sf/l2j/gameserver/model/item/DropCategory.java java/net/sf/l2j/gameserver/model/item/DropCategory.java
- index 0d43736..d059fb6 100644
- --- java/net/sf/l2j/gameserver/model/item/DropCategory.java
- +++ java/net/sf/l2j/gameserver/model/item/DropCategory.java
- @@ -7,6 +7,8 @@
- import net.sf.l2j.commons.random.Rnd;
- import net.sf.l2j.gameserver.enums.DropType;
- +import net.sf.l2j.gameserver.model.actor.Player;
- +import net.sf.l2j.gameserver.model.actor.instance.Monster;
- import net.sf.l2j.gameserver.model.holder.IntIntHolder;
- public class DropCategory
- @@ -68,14 +70,16 @@
- /**
- * Calculates drops of this {@link DropCategory}.
- + * @param player
- + * @param monster
- * @param levelMultiplier : The input level modifier of the last attacker.
- * @param raid : The NPC is raid boss.
- * @return The list of {@link IntIntHolder} holding item ID and item count.
- */
- - public List<IntIntHolder> calculateDrop(double levelMultiplier, boolean raid)
- + public List<IntIntHolder> calculateDrop(Player player, Monster monster, double levelMultiplier, boolean raid)
- {
- // Get base category chance and apply level multiplier and drop rate config based on type.
- - double chance = getChance() * levelMultiplier * getDropType().getDropRate(raid) * DropData.MAX_CHANCE / 100;
- + double chance = getChance() * levelMultiplier * getDropType().getDropRate(player, monster, raid) * DropData.MAX_CHANCE / 100;
- // Check chance exceeding 100% limit and calculate drop chance multiplier.
- double multiplier;
- diff --git java/net/sf/l2j/gameserver/network/clientpackets/AttackRequest.java java/net/sf/l2j/gameserver/network/clientpackets/AttackRequest.java
- index 288946d..23be218 100644
- --- java/net/sf/l2j/gameserver/network/clientpackets/AttackRequest.java
- +++ java/net/sf/l2j/gameserver/network/clientpackets/AttackRequest.java
- @@ -54,6 +54,22 @@
- return;
- }
- + // Check if target is in PVE mode
- + if (target instanceof Player && ((Player) target).isPVEMode() && !player.isGM())
- + {
- + player.sendMessage("El Usuario: " + target.getName() + " esta en modo PvE");
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- +
- + // Check if attacker is in PVE mode
- + if (player.isPVEMode() && !player.isGM())
- + {
- + player.sendMessage("Debes desactivar el modo PvE para atacar a otros jugadores");
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- +
- // (player.getTarget() == target) -> This happens when you control + click a target without having had it selected beforehand. Behaves as the Action packet and will NOT trigger an attack.
- target.onAction(player, (player.getTarget() == target), _isShiftAction);
- }
- diff --git java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- index 3efda23..0a00998 100644
- --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- @@ -102,6 +102,70 @@
- player.updateEffectIcons();
- player.sendPacket(new EtcStatusUpdate(player));
- + if (Config.GAME_MODE_ENABLE)
- + {
- +
- + String gameMode = player.getGameMode();
- + if (gameMode.equalsIgnoreCase("PVE MODE"))
- + {
- + player.setPVEMode(true);
- + player.setGameModeService(0);
- + player.setPVPMode(false);
- + player.setNormalMode(false);
- + player.decayMe();
- + World.getInstance().addPlayer(player);
- + player.sendMessage("Estas En PvE Mode - Los jugadores no podran atacarte");
- + player.sendMessage("Puedes Cambiarlo Con: - .pve - .pvp - .normal");
- + player.broadcastUserInfo();
- + player.spawnMe();
- + }
- + else if (gameMode.equalsIgnoreCase("PVP MODE"))
- + {
- +
- + player.updatePvPFlag(1);
- + player.setPVEMode(false);
- + player.setPVPMode(true);
- + player.setGameModeService(1);
- + player.setNormalMode(false);
- + player.sendMessage("Estas En PVP Mode - Recibes un bonus de 50% de Exp - Sp - Drop - Adena");
- + player.sendMessage("Puedes Cambiarlo Con: - .pve - .pvp - .normal");
- + player.decayMe();
- + World.getInstance().addPlayer(player);
- + player.broadcastUserInfo();
- + player.spawnMe();
- + }
- + else if (gameMode.equalsIgnoreCase("NORMAL MODE"))
- + {
- +
- + player.setPVEMode(false);
- + player.setPVPMode(false);
- + player.setNormalMode(true);
- + player.setGameModeService(2);
- + player.sendMessage("Estas En Normal Mode - Recibes un bonus de 20% de Exp - Sp - Drop - Adena");
- + player.sendMessage("Puedes Cambiarlo Con: - .pve - .pvp - .normal");
- + player.decayMe();
- + World.getInstance().addPlayer(player);
- + player.broadcastUserInfo();
- + player.spawnMe();
- + }
- +
- + if (!player.isPVPMode() && !player.isPVEMode())
- + {
- + player.setPVEMode(false);
- + player.setPVPMode(false);
- + player.setNormalMode(true);
- + player.setGameModeService(2);
- + player.sendMessage("Estas En Normal Mode - Recibes un bonus de 20% de Exp - Sp - Drop - Adena");
- + player.sendMessage("Puedes Cambiarlo Con: - .pve - .pvp - .normal");
- + player.decayMe();
- + World.getInstance().addPlayer(player);
- + showModeSystemHTML(player);
- + player.broadcastUserInfo();
- + player.spawnMe();
- + }
- +
- + }
- +
- // Clan checks.
- final Clan clan = player.getClan();
- if (clan != null)
- @@ -286,6 +350,14 @@
- player.sendPacket(ActionFailed.STATIC_PACKET);
- }
- + @SuppressWarnings("static-method")
- + private void showModeSystemHTML(Player player)
- + {
- + NpcHtmlMessage html = new NpcHtmlMessage(0);
- + html.setFile("data/html/mods/ChangeModeSystem/ModeSystem.htm");
- + player.sendPacket(html);
- + }
- +
- @Override
- protected boolean triggersOnActionRequest()
- {
- diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
- index d74f2a3..c4ab884 100644
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
- @@ -38,7 +38,9 @@
- import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- import net.sf.l2j.gameserver.network.serverpackets.PlaySound;
- import net.sf.l2j.gameserver.scripting.QuestState;
- +import net.sf.l2j.gameserver.taskmanager.PvpFlagTaskManager;
- +import Base.GameModeSystem.ChangeModeManager;
- import Base.Skin.DressMeData;
- import Base.Skin.SkinPackage;
- @@ -109,6 +111,122 @@
- ach.useVoicedCommand(_command.substring(7), player, null);
- }
- + else if (_command.startsWith("PvEMode"))
- + {
- +
- + if (ChangeModeManager.verifyChangeMode(player))
- + {
- +
- + if (player.isPVEMode())
- + {
- + player.sendMessage("Ya estas en el modo PVE.");
- + return;
- + }
- +
- + if (player.getPvpFlag() == 0 && player.getKarma() == 0)
- + {
- + player.setPVEMode(true);
- + player.setGameModeService(0);
- + player.setPVPMode(false);
- + player.setNormalMode(false);
- + player.decayMe();
- + World.getInstance().addPlayer(player);
- + player.sendMessage("Estas En PvE Mode - Los jugadores no podran atacarte");
- + player.sendMessage("Puedes Cambiarlo Con: - .pve - .pvp - .normal");
- + player.broadcastUserInfo();
- + player.spawnMe();
- + }
- + else
- + {
- + player.sendMessage(" Estas con Flag o Tienes Karma No puedes Activar el modo PvE Con Karma o Flag");
- + }
- + }
- +
- + }
- +
- + else if (_command.startsWith("PvPMode"))
- + {
- +
- + if (ChangeModeManager.verifyChangeMode(player))
- + {
- + if (player.isPVPMode())
- + {
- + player.sendMessage("Ya estas en el modo PVP.");
- + return;
- + }
- +
- + if (!player.isInsideZone(ZoneId.TOWN) && !player.isGM())
- + {
- + player.sendMessage("Solo Puedes Cambiar El Modo En Una Ciudad.");
- + return;
- + }
- +
- + if (player.getStatus().getLevel() < 76 && !player.isGM())
- + {
- + player.sendMessage("Necesitas Minimo Ser LvL 76 Para Activar El Modo PvP.");
- + return;
- + }
- +
- + player.updatePvPFlag(1);
- + player.setPVEMode(false);
- + player.setPVPMode(true);
- + player.setGameModeService(1);
- + player.setNormalMode(false);
- + player.sendMessage("Has cambiado al modo PVP. - Obtendras un Bonus de 50%");
- + player.decayMe();
- + World.getInstance().addPlayer(player);
- + player.broadcastUserInfo();
- + player.spawnMe();
- + }
- +
- + }
- +
- + else if (_command.startsWith("NormalMode"))
- + {
- + if (ChangeModeManager.verifyChangeMode(player))
- + {
- +
- + if (player.isNormalMode())
- + {
- + player.sendMessage("Ya estas en el modo Normal.");
- + return;
- + }
- +
- + if (!player.isInsideZone(ZoneId.TOWN) && !player.isGM())
- + {
- + player.sendMessage("Solo Puedes Cambiar El Modo En Una Ciudad.");
- + return;
- + }
- +
- + if (player.getPvpFlag() > 0)
- + {
- + PvpFlagTaskManager.getInstance().add(player, Config.PVP_NORMAL_TIME);
- +
- + player.updatePvPFlag(1);
- + player.setPVEMode(false);
- + player.setPVPMode(false);
- + player.setNormalMode(true);
- + player.setGameModeService(2);
- + player.sendMessage("Has cambiado al modo Normal. - Obtendras un Bonus de 20%");
- + player.decayMe();
- + World.getInstance().addPlayer(player);
- + player.broadcastUserInfo();
- + player.spawnMe();
- + }
- + player.setPvpFlag(0);
- + player.setPVEMode(false);
- + player.setPVPMode(false);
- + player.setNormalMode(true);
- + player.setGameModeService(2);
- + player.sendMessage("Has cambiado al modo Normal. - Obtendras un Bonus de 20%");
- + player.decayMe();
- + World.getInstance().addPlayer(player);
- + player.broadcastUserInfo();
- + player.spawnMe();
- + }
- +
- + }
- +
- else if (_command.startsWith("custom_"))
- {
- Player player2 = getClient().getPlayer();
- diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelAnswerStart.java java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelAnswerStart.java
- index 82913b7..c02d826 100644
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelAnswerStart.java
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelAnswerStart.java
- @@ -1,5 +1,6 @@
- package net.sf.l2j.gameserver.network.clientpackets;
- +import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.data.manager.DuelManager;
- import net.sf.l2j.gameserver.model.actor.Player;
- import net.sf.l2j.gameserver.model.group.CommandChannel;
- @@ -34,6 +35,18 @@
- player.setActiveRequester(null);
- requestor.onTransactionResponse();
- +
- +
- + if (Config.GAME_MODE_ENABLE)
- + {
- + if (requestor.isPVEMode())
- + {
- + player.sendMessage("Estas en PVE MODE o el jugador que intentas retar a un duelo lo esta");
- + return;
- + }
- + }
- +
- +
- if (_duelAccepted)
- {
- // Check if duel is possible.
- diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.java java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.java
- index 7ce0499..134f42e 100644
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.java
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.java
- @@ -1,5 +1,6 @@
- package net.sf.l2j.gameserver.network.clientpackets;
- +import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.model.World;
- import net.sf.l2j.gameserver.model.actor.Player;
- import net.sf.l2j.gameserver.model.group.CommandChannel;
- @@ -34,6 +35,26 @@
- return;
- }
- +
- +
- + if (Config.GAME_MODE_ENABLE)
- + {
- + if (player.isPVEMode())
- + {
- + player.sendMessage("Desactiva El PVE MODE");
- + return;
- + }
- +
- + if (target.isPVEMode())
- + {
- + player.sendMessage("El Jugador: " + target.getName() + " Esta en PvE Mode");
- + return;
- + }
- + }
- +
- +
- +
- +
- // Check if duel is possible.
- if (!player.canDuel())
- {
- diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java
- index 4d4552d..4db7299 100644
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java
- @@ -1,5 +1,6 @@
- package net.sf.l2j.gameserver.network.clientpackets;
- +import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.enums.LootRule;
- import net.sf.l2j.gameserver.model.World;
- import net.sf.l2j.gameserver.model.actor.Player;
- @@ -34,6 +35,9 @@
- return;
- }
- +
- +
- +
- if (target.getBlockList().isBlockingAll())
- {
- requestor.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_BLOCKED_EVERYTHING).addCharName(target));
- @@ -52,6 +56,18 @@
- return;
- }
- +
- + if (Config.GAME_MODE_ENABLE)
- + {
- +
- + if (!requestor.getGameMode().equals(target.getGameMode()))
- + {
- + requestor.sendMessage("No puedes invitar a la party a un jugador con un modo de juego diferente.");
- + return;
- + }
- + }
- +
- +
- if (target.isInParty())
- {
- requestor.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_IS_ALREADY_IN_PARTY).addCharName(target));
- diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinPartyRoom.java java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinPartyRoom.java
- index 7e692a5..54cfa0e 100644
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinPartyRoom.java
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinPartyRoom.java
- @@ -1,5 +1,6 @@
- package net.sf.l2j.gameserver.network.clientpackets;
- +import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.data.manager.PartyMatchRoomManager;
- import net.sf.l2j.gameserver.model.actor.Player;
- import net.sf.l2j.gameserver.model.group.PartyMatchRoom;
- @@ -39,6 +40,15 @@
- return;
- }
- + if (Config.GAME_MODE_ENABLE)
- + {
- + if (player.isPVEMode())
- + {
- + player.sendMessage("Desactiva El PVE MODE");
- + return;
- + }
- + }
- +
- // Remove from waiting list
- PartyMatchRoomManager.getInstance().removeWaitingPlayer(player);
- diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinSiege.java java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinSiege.java
- index d9bea2c..742316f 100644
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinSiege.java
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinSiege.java
- @@ -1,5 +1,6 @@
- package net.sf.l2j.gameserver.network.clientpackets;
- +import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.data.manager.CastleManager;
- import net.sf.l2j.gameserver.data.manager.ClanHallManager;
- import net.sf.l2j.gameserver.model.actor.Player;
- @@ -40,6 +41,18 @@
- if (clan == null)
- return;
- +
- + if (Config.GAME_MODE_ENABLE)
- + {
- + if (player.isPVEMode())
- + {
- + player.sendMessage("Desactiva El PVE MODE");
- + return;
- + }
- + }
- +
- +
- +
- // Check Castle entity associated to the id.
- final Castle castle = CastleManager.getInstance().getCastleById(_id);
- if (castle != null)
- diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestOlympiadMatchList.java java/net/sf/l2j/gameserver/network/clientpackets/RequestOlympiadMatchList.java
- index ca9934d..ed8061c 100644
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestOlympiadMatchList.java
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestOlympiadMatchList.java
- @@ -2,6 +2,7 @@
- import net.sf.l2j.commons.lang.StringUtil;
- +import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.model.actor.Player;
- import net.sf.l2j.gameserver.model.olympiad.Olympiad;
- import net.sf.l2j.gameserver.model.olympiad.OlympiadGameManager;
- @@ -22,6 +23,21 @@
- if (player == null || !player.isInObserverMode())
- return;
- +
- +
- + if (Config.GAME_MODE_ENABLE)
- + {
- + if (player.isPVEMode())
- + {
- + player.sendMessage("Desactiva El PVE MODE");
- + return;
- + }
- + }
- +
- +
- +
- +
- +
- int i = 0;
- final StringBuilder sb = new StringBuilder(1500);
- diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestOlympiadObserverEnd.java java/net/sf/l2j/gameserver/network/clientpackets/RequestOlympiadObserverEnd.java
- index 7b1d873..4c18905 100644
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestOlympiadObserverEnd.java
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestOlympiadObserverEnd.java
- @@ -1,5 +1,6 @@
- package net.sf.l2j.gameserver.network.clientpackets;
- +import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.model.actor.Player;
- public final class RequestOlympiadObserverEnd extends L2GameClientPacket
- @@ -16,6 +17,16 @@
- if (player == null)
- return;
- +
- + if (Config.GAME_MODE_ENABLE)
- + {
- + if (player.isPVEMode())
- + {
- + player.sendMessage("Desactiva El PVE MODE");
- + return;
- + }
- + }
- +
- if (!player.isInObserverMode())
- return;
- diff --git java/net/sf/l2j/gameserver/taskmanager/PvpFlagTaskManager.java java/net/sf/l2j/gameserver/taskmanager/PvpFlagTaskManager.java
- index 1fdf282..cdcecaf 100644
- --- java/net/sf/l2j/gameserver/taskmanager/PvpFlagTaskManager.java
- +++ java/net/sf/l2j/gameserver/taskmanager/PvpFlagTaskManager.java
- @@ -37,15 +37,24 @@
- final Player player = entry.getKey();
- final long timeLeft = entry.getValue();
- - // Time is running out, clear PvP flag and remove from list.
- - if (currentTime > timeLeft)
- - remove(player, true);
- - // Time almost runned out, update to blinking PvP flag.
- - else if (currentTime > (timeLeft - 5000))
- - player.updatePvPFlag(2);
- - // Time didn't run out, keep PvP flag.
- + if (!player.isPVPMode())
- + {
- + // Time is running out, clear PvP flag and remove from list.
- + if (currentTime > timeLeft)
- + remove(player, true);
- + // Time almost run out, update to blinking PvP flag.
- + else if (currentTime > (timeLeft - 5000))
- + player.updatePvPFlag(2);
- + // Time didn't run out, keep PvP flag.
- + else
- + player.updatePvPFlag(1);
- + }
- else
- + {
- + // Player is in PvP mode, set PvP flag to 1.
- player.updatePvPFlag(1);
- + }
- +
- }
- }
- diff --git java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java
- index b963bd0..e0268f7 100644
- --- java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java
- +++ java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java
- @@ -12,10 +12,30 @@
- public class CharInfo extends L2GameServerPacket
- {
- private final Player _player;
- + private String _title;
- + private int _titleColor;
- public CharInfo(Player player)
- {
- _player = player;
- + if (!GameModeInfo())
- + {
- + if (!player.getAppearance().isVisible())
- + {
- + _title = "Invisible";
- + }
- + else
- + {
- +
- + _title = _player.getTitle();
- + }
- + _titleColor = player.getAppearance().getTitleColor();
- + }
- + else
- + {
- + _title = "PVE MODE";
- + _titleColor = 0x00FFFF;
- + }
- }
- @Override
- @@ -116,7 +136,7 @@
- writeD(_player.getAppearance().getHairColor());
- writeD(_player.getAppearance().getFace());
- - writeS((canSeeInvis) ? "Invisible" : _player.getTitle());
- + writeS(_title);
- writeD(_player.getClanId());
- writeD(_player.getClanCrestId());
- @@ -156,7 +176,19 @@
- writeD(_player.getHeading());
- writeD(_player.getPledgeClass());
- writeD(_player.getPledgeType());
- - writeD(_player.getAppearance().getTitleColor());
- + writeD(_titleColor);
- writeD(CursedWeaponManager.getInstance().getCurrentStage(_player.getCursedWeaponEquippedId()));
- }
- +
- + public boolean GameModeInfo()
- + {
- + if (Config.GAME_MODE_ENABLE)
- + {
- + if (_player.isPVEMode())
- + {
- + return true;
- + }
- + }
- + return false;
- + }
- }
- \ No newline at end of file
- diff --git java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java
- index b1679c0..14a37db 100644
- --- java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java
- +++ java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java
- @@ -14,6 +14,9 @@
- private final Player _player;
- private int _relation;
- + private String _title;
- + private int _titleColor;
- +
- public UserInfo(Player player)
- {
- _player = player;
- @@ -24,6 +27,26 @@
- _relation |= 0x180;
- if (_player.getSiegeState() == 2)
- _relation |= 0x80;
- +
- + if (!GameModeInfo())
- + {
- + if (!player.getAppearance().isVisible())
- + {
- + _title = "Invisible";
- + }
- + else
- + {
- +
- + _title = _player.getTitle();
- + }
- + _titleColor = player.getAppearance().getTitleColor();
- + }
- + else
- + {
- + _title = "PVE MODE";
- + _titleColor = 0x00FFFF;
- + }
- +
- }
- @Override
- @@ -171,7 +194,7 @@
- writeD(_player.getAppearance().getFace());
- writeD((_player.isGM()) ? 1 : 0);
- - writeS((_player.getPolymorphTemplate() != null) ? "Morphed" : _player.getTitle());
- + writeS((_player.getPolymorphTemplate() != null) ? "Morphed" : _title);
- writeD(_player.getClanId());
- writeD(_player.getClanCrestId());
- @@ -211,7 +234,19 @@
- writeC((_player.isRunning()) ? 0x01 : 0x00);
- writeD(_player.getPledgeClass());
- writeD(_player.getPledgeType());
- - writeD(_player.getAppearance().getTitleColor());
- + writeD(_titleColor);
- writeD(CursedWeaponManager.getInstance().getCurrentStage(_player.getCursedWeaponEquippedId()));
- }
- +
- + public boolean GameModeInfo()
- + {
- + if (Config.GAME_MODE_ENABLE)
- + {
- + if (_player.isPVEMode())
- + {
- + return true;
- + }
- + }
- + return false;
- + }
- }
- \ No newline at end of file
- diff --git server/gameserver/data/html/mods/ChangeModeSystem/ModeSystem.htm server/gameserver/data/html/mods/ChangeModeSystem/ModeSystem.htm
- new file mode 100644
- index 0000000..6e94618
- --- /dev/null
- +++ server/gameserver/data/html/mods/ChangeModeSystem/ModeSystem.htm
- @@ -0,0 +1,57 @@
- +<html>
- +<head>
- + <title>L2Wins - Modos De Juego</title>
- +</head>
- +<body>
- +
- + <center><font color="00FF00">Bienvenido a L2Wins.</font></center>
- + <br>
- + <center><font color="00FF00">Elige tu Modo de Juego.</font></center>
- +<center>
- +<br1>
- +<font color="00FF00">Por Defecto Entras En Normal Mode.</font>
- +<br1>
- +<font color="00FF00">Puedes Cambiarlo Escribiendo - .pve - .pvp - .normal</font>
- +<br1>
- +<font color="00FF00">Los Modos De Juego PvP - Normal Mode.</font>
- +<br1>
- +<font color="00FF00">Tienen Un Bonus General de EXP-SP-DROP-ADENA.</font>
- +<br1>
- +<font color="00FF00">En el Modo PvE No Podran Matarte.</font>
- +<br1>
- +<font color="00FF00">Tampoco Podras Atacar A Otro Jugador.</font>
- +<br1>
- +<font color="00FF00">Solo Podras Estar En Party Con Gente.</font>
- +<br1>
- +<font color="00FF00">Que Tenga Tu Mismo Modo De Juego.</font>
- +
- +</center>
- +
- + <br>
- +
- + <table>
- + <tr>
- + <td width="160" align="center"><font color="FFFF00">PvE Mode</font></td>
- + <td width="160" align="center"><font color="800080">PvP Mode</font></td>
- + <td width="160" align="center"><font color="CCFFCC"><font color="FF6600">Normal Mode</font></font></td>
- + </tr>
- +</table>
- + <table>
- + <tr>
- + <td width="160" align="center"><font color="FFFF00">Bonus 0%</font></td>
- + <td width="160" align="center"><font color="800080">Bonus 50%</font></td>
- + <td width="160" align="center"><font color="CCFFCC"><font color="FF6600">Bonus 20%</font></font></td>
- + </tr>
- +</table>
- +
- +
- +<br>
- +<table>
- + <tr>
- + <td width="160" align="center"><button value="Use" action="bypass -h PvEMode" width="75" height="21" back="L2UI.DefaultButton_click" fore="L2UI.DefaultButton"></td>
- + <td width="160" align="center"><button value="Use" action="bypass -h PvPMode" width="75" height="21" back="L2UI.DefaultButton_click" fore="L2UI.DefaultButton"></td>
- + <td width="160" align="center"><button value="Use" action="bypass -h NormalMode" width="75" height="21" back="L2UI.DefaultButton_click" fore="L2UI.DefaultButton"></td>
- + </tr>
- + </table>
- +</body>
- +</html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement