Advertisement
tensador125

Change Mode System PVE-PVP-NORMAL

Jun 21st, 2023 (edited)
1,099
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 48.29 KB | Gaming | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P Orionwins
  3. diff --git files/game/config/L2jServer/ExtraSettings.properties files/game/config/L2jServer/ExtraSettings.properties
  4. index 2af9e38..eea7e5b 100644
  5. --- files/game/config/L2jServer/ExtraSettings.properties
  6. +++ files/game/config/L2jServer/ExtraSettings.properties
  7. @@ -273,5 +273,20 @@
  8.  RandromCraftConsumeCreate = 300000
  9.  
  10.  
  11. +#==========================================================================
  12. +#   GAME MODE SYSTEM - PVE - PVP - NORMAL - WITH BONUS
  13. +#==========================================================================
  14.  
  15. +GameModeSystemEnable = True
  16. +
  17. +PVPModeXpSpRate = 50
  18. +NormalModeXpSpRate = 20
  19. +PVPModeSpoilRate = 50
  20. +NormalModeSpoilRate = 20
  21. +PVPModeDropRate = 50
  22. +NormalModeDropRate = 20
  23. +PVPModeAdenaRate = 25
  24. +NormalModeAdenaRate = 20
  25. +PVPModeDropSealStonesRate = 5
  26. +NormalDropSealStonesRate = 2
  27.  
  28. diff --git files/game/data/html/mods/ChangeModeSystem/ModeSystem.htm files/game/data/html/mods/ChangeModeSystem/ModeSystem.htm
  29. new file mode 100644
  30. index 0000000..6e94618
  31. --- /dev/null
  32. +++ files/game/data/html/mods/ChangeModeSystem/ModeSystem.htm
  33. @@ -0,0 +1,57 @@
  34. +<html>
  35. +<head>
  36. +    <title>L2Wins - Modos De Juego</title>
  37. +</head>
  38. +<body>
  39. +
  40. +    <center><font color="00FF00">Bienvenido a L2Wins.</font></center>
  41. +    <br>
  42. +    <center><font color="00FF00">Elige tu Modo de Juego.</font></center>
  43. +<center>
  44. +<br1>
  45. +<font color="00FF00">Por Defecto Entras En Normal Mode.</font>
  46. +<br1>
  47. +<font color="00FF00">Puedes Cambiarlo Escribiendo - .pve - .pvp - .normal</font>
  48. +<br1>
  49. +<font color="00FF00">Los Modos De Juego PvP - Normal Mode.</font>
  50. +<br1>
  51. +<font color="00FF00">Tienen Un Bonus General de EXP-SP-DROP-ADENA.</font>
  52. +<br1>
  53. +<font color="00FF00">En el Modo PvE No Podran Matarte.</font>
  54. +<br1>
  55. +<font color="00FF00">Tampoco Podras Atacar A Otro Jugador.</font>
  56. +<br1>
  57. +<font color="00FF00">Solo Podras Estar En Party Con Gente.</font>
  58. +<br1>
  59. +<font color="00FF00">Que Tenga Tu Mismo Modo De Juego.</font>
  60. +
  61. +</center>
  62. +
  63. +    <br>
  64. +
  65. +    <table>
  66. +        <tr>
  67. +            <td width="160" align="center"><font color="FFFF00">PvE Mode</font></td>
  68. +            <td width="160" align="center"><font color="800080">PvP Mode</font></td>
  69. +            <td width="160" align="center"><font color="CCFFCC"><font color="FF6600">Normal Mode</font></font></td>
  70. +        </tr>
  71. +</table>
  72. +     <table>
  73. +        <tr>
  74. +            <td width="160" align="center"><font color="FFFF00">Bonus 0%</font></td>
  75. +            <td width="160" align="center"><font color="800080">Bonus 50%</font></td>
  76. +            <td width="160" align="center"><font color="CCFFCC"><font color="FF6600">Bonus 20%</font></font></td>
  77. +        </tr>
  78. +</table>
  79. +
  80. +
  81. +<br>
  82. +<table>
  83. +        <tr>
  84. +            <td width="160" align="center"><button value="Use" action="bypass -h PvEMode" width="75" height="21" back="L2UI.DefaultButton_click" fore="L2UI.DefaultButton"></td>
  85. +            <td width="160" align="center"><button value="Use" action="bypass -h PvPMode" width="75" height="21" back="L2UI.DefaultButton_click" fore="L2UI.DefaultButton"></td>
  86. +            <td width="160" align="center"><button value="Use" action="bypass -h NormalMode" width="75" height="21" back="L2UI.DefaultButton_click" fore="L2UI.DefaultButton"></td>
  87. +        </tr>
  88. +    </table>
  89. +</body>
  90. +</html>
  91. diff --git src/Base/ModeSystem/ChangeModeManager.java src/Base/ModeSystem/ChangeModeManager.java
  92. new file mode 100644
  93. index 0000000..282394f
  94. --- /dev/null
  95. +++ src/Base/ModeSystem/ChangeModeManager.java
  96. @@ -0,0 +1,204 @@
  97. +package Base.ModeSystem;
  98. +
  99. +import l2jwins.Config;
  100. +import l2jwins.game.model.actor.instance.L2PcInstance;
  101. +import l2jwins.game.model.zone.ZoneId;
  102. +
  103. +public class ChangeModeManager
  104. +{
  105. +   public static boolean verifyChangeMode(L2PcInstance activeChar)
  106. +   {
  107. +       if (activeChar == null)
  108. +       {
  109. +           return false;
  110. +       }
  111. +      
  112. +       if (!Config.GAME_MODE_ENABLE)
  113. +       {
  114. +           activeChar.sendMessage("El Change Mode System Esta Desactivado.");
  115. +           return false;
  116. +       }
  117. +      
  118. +       if (activeChar.isMoving())
  119. +       {
  120. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Te Estas Moviendo");
  121. +           return false;
  122. +       }
  123. +      
  124. +       if (activeChar.isInParty())
  125. +       {
  126. +           activeChar.sendMessage("Sal De La Party Para Cambiar de Modo De Juego");
  127. +           return false;
  128. +       }
  129. +      
  130. +       if (activeChar.isInDuel())
  131. +       {
  132. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  133. +           return false;
  134. +       }
  135. +      
  136. +       if (activeChar.isInArena())
  137. +       {
  138. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  139. +           return false;
  140. +       }
  141. +      
  142. +       if (activeChar.isInArenaEvent())
  143. +       {
  144. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  145. +           return false;
  146. +       }
  147. +      
  148. +       if (activeChar.isInJail())
  149. +       {
  150. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  151. +           return false;
  152. +       }
  153. +      
  154. +       if (activeChar.isInPartyMatchRoom())
  155. +       {
  156. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  157. +           return false;
  158. +       }
  159. +      
  160. +       if (activeChar.isInCraftMode())
  161. +       {
  162. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  163. +           return false;
  164. +       }
  165. +      
  166. +       if (activeChar.isInHideoutSiege())
  167. +       {
  168. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  169. +           return false;
  170. +       }
  171. +      
  172. +       if (activeChar.isInsideZone(ZoneId.ZONE_BOSS))
  173. +       {
  174. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  175. +           return false;
  176. +       }
  177. +      
  178. +       if (activeChar.isInsideZone(ZoneId.ZONE_CASTLE))
  179. +       {
  180. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  181. +           return false;
  182. +       }
  183. +      
  184. +       if (activeChar.isInsideZone(ZoneId.ZONE_DANGERAREA))
  185. +       {
  186. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  187. +           return false;
  188. +       }
  189. +      
  190. +       if (activeChar.isInsideZone(ZoneId.ZONE_FLAG))
  191. +       {
  192. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  193. +           return false;
  194. +       }
  195. +      
  196. +       if (activeChar.isInsideZone(ZoneId.ZONE_NOSUMMONFRIEND))
  197. +       {
  198. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  199. +           return false;
  200. +       }
  201. +      
  202. +       if (activeChar.isInsideZone(ZoneId.ZONE_JAIL))
  203. +       {
  204. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  205. +           return false;
  206. +       }
  207. +      
  208. +       if (activeChar.isInsideZone(ZoneId.ZONE_MONSTERTRACK))
  209. +       {
  210. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  211. +           return false;
  212. +       }
  213. +      
  214. +       if (activeChar.isInsideZone(ZoneId.ZONE_OLY))
  215. +       {
  216. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  217. +           return false;
  218. +       }
  219. +      
  220. +       if (activeChar.isInsideZone(ZoneId.ZONE_PVP))
  221. +       {
  222. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  223. +           return false;
  224. +       }
  225. +      
  226. +       if (activeChar.isInsideZone(ZoneId.ZONE_RAID_LIMIT))
  227. +       {
  228. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  229. +           return false;
  230. +       }
  231. +      
  232. +       if (activeChar.isInsideZone(ZoneId.ZONE_RANDOM))
  233. +       {
  234. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  235. +           return false;
  236. +       }
  237. +      
  238. +       if (activeChar.isInsideZone(ZoneId.ZONE_SIEGE))
  239. +       {
  240. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  241. +           return false;
  242. +       }
  243. +      
  244. +       if (activeChar.isInsideZone(ZoneId.ZONE_NORESTART))
  245. +       {
  246. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  247. +           return false;
  248. +       }
  249. +      
  250. +       if (activeChar.isIn7sDungeon())
  251. +       {
  252. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  253. +           return false;
  254. +       }
  255. +      
  256. +       if (activeChar.isDungeon())
  257. +       {
  258. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas En Una Dungeon");
  259. +           return false;
  260. +       }
  261. +      
  262. +       if (activeChar.isInOlympiadMode())
  263. +       {
  264. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas En Olympiadas");
  265. +           return false;
  266. +       }
  267. +      
  268. +       if (activeChar.isRegisteredInCTFEvent() || activeChar.isRegisteredInDMEvent() || activeChar.isRegisteredInFunEvent() || activeChar.isRegisteredInTVTEvent() || activeChar.isRegisteredInVIPEvent())
  269. +       {
  270. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas Registrado En Un Evento");
  271. +           return false;
  272. +       }
  273. +      
  274. +       if (activeChar.inObserverMode())
  275. +       {
  276. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas en ObserverMode");
  277. +           return false;
  278. +       }
  279. +      
  280. +       if (activeChar.isCastingNow())
  281. +       {
  282. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas Casteando un Skill");
  283. +           return false;
  284. +       }
  285. +      
  286. +       if (activeChar.isInCombat())
  287. +       {
  288. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Si Estas en Combate");
  289. +           return false;
  290. +       }
  291. +      
  292. +       if (activeChar.isAttackingNow())
  293. +       {
  294. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas Atacando");
  295. +           return false;
  296. +       }
  297. +      
  298. +       return true;
  299. +   }
  300. +}
  301. diff --git src/l2jwins/Config.java src/l2jwins/Config.java
  302. index 90bd833..9201857 100644
  303. --- src/l2jwins/Config.java
  304. +++ src/l2jwins/Config.java
  305. @@ -287,6 +287,23 @@
  306.     public static int RANDOM_CRAFT_ITEM_CONSUME_REFRESH;
  307.     public static int RANDOM_CRAFT_ITEM_CONSUME_CREATE;
  308.    
  309. +   public static boolean GAME_MODE_ENABLE;
  310. +  
  311. +   public static float PVP_MODE_XPSP_RATE;
  312. +   public static float NORMAL_MODE_XPSP_RATE;
  313. +  
  314. +   public static float PVP_MODE_SPOIL_RATE;
  315. +   public static float NORMAL_MODE_SPOIL_RATE;
  316. +  
  317. +   public static float PVP_MODE_DROP_RATE;
  318. +   public static float NORMAL_MODE_DROP_RATE;
  319. +  
  320. +   public static float PVP_MODE_ADENA_RATE;
  321. +   public static float NORMAL_MODE_ADENA_RATE;
  322. +  
  323. +   public static float PVP_MODE_SS_RATE;
  324. +   public static float NORMAL_MODE_SS_RATE;
  325. +  
  326.     // ===================================================================================================================================//
  327.    
  328.     public static void loadExtraSettingsConfig()
  329. @@ -306,6 +323,23 @@
  330.            
  331.             // ===================================================================================================================================//
  332.            
  333. +           GAME_MODE_ENABLE = Boolean.parseBoolean(ExtraSettings.getProperty("GameModeSystemEnable", "True"));
  334. +          
  335. +           PVP_MODE_XPSP_RATE = Float.parseFloat(ExtraSettings.getProperty("PVPModeXpSpRate", "1.5"));
  336. +           NORMAL_MODE_XPSP_RATE = Float.parseFloat(ExtraSettings.getProperty("NormalModeXpSpRate", "1.5"));
  337. +          
  338. +           PVP_MODE_SPOIL_RATE = Float.parseFloat(ExtraSettings.getProperty("PVPModeSpoilRate", "1.5"));
  339. +           NORMAL_MODE_SPOIL_RATE = Float.parseFloat(ExtraSettings.getProperty("NormalSpoilRate", "1.5"));
  340. +          
  341. +           PVP_MODE_DROP_RATE = Float.parseFloat(ExtraSettings.getProperty("PVPModeDropRate", "1.5"));
  342. +           NORMAL_MODE_DROP_RATE = Float.parseFloat(ExtraSettings.getProperty("NormalDropRate", "1.5"));
  343. +          
  344. +           PVP_MODE_ADENA_RATE = Float.parseFloat(ExtraSettings.getProperty("PVPModeAdenaRate", "1.5"));
  345. +           NORMAL_MODE_ADENA_RATE = Float.parseFloat(ExtraSettings.getProperty("NormalAdenaRate", "1.5"));
  346. +          
  347. +           PVP_MODE_SS_RATE = Float.parseFloat(ExtraSettings.getProperty("PVPModeDropSealStonesRate", "1.5"));
  348. +           NORMAL_MODE_SS_RATE = Float.parseFloat(ExtraSettings.getProperty("NormalDropSealStonesRate", "1.5"));
  349. +          
  350.             SERVER_NAME = ExtraSettings.getProperty("ServerName", "L2-Pain");
  351.            
  352.             AFK_TIMER = Integer.parseInt(ExtraSettings.getProperty("TimerAFK", "10"));
  353. diff --git src/l2jwins/game/handler/VoicedCommandHandler.java src/l2jwins/game/handler/VoicedCommandHandler.java
  354. index 901615a..5c191e9 100644
  355. --- src/l2jwins/game/handler/VoicedCommandHandler.java
  356. +++ src/l2jwins/game/handler/VoicedCommandHandler.java
  357. @@ -13,6 +13,7 @@
  358.  import l2jwins.game.handler.voice.Event_DM;
  359.  import l2jwins.game.handler.voice.Event_TVT;
  360.  import l2jwins.game.handler.voice.ExpireItems;
  361. +import l2jwins.game.handler.voice.GameMode;
  362.  import l2jwins.game.handler.voice.OfflineShop;
  363.  import l2jwins.game.handler.voice.Online;
  364.  import l2jwins.game.handler.voice.PartyTeleport;
  365. @@ -97,6 +98,7 @@
  366.         registerVoicedCommandHandler(new BossEventCMD());
  367.         registerVoicedCommandHandler(new BufferAuto());
  368.         registerVoicedCommandHandler(new elixir());
  369. +       registerVoicedCommandHandler(new GameMode());
  370.         CustomBypassHandler.getInstance().registerCustomBypassHandler(new ExpireItems());
  371.        
  372.         LOG.info("VoicedCommandHandler: Loaded " + _datatable.size() + " handlers");
  373. diff --git src/l2jwins/game/handler/voice/GameMode.java src/l2jwins/game/handler/voice/GameMode.java
  374. new file mode 100644
  375. index 0000000..b944522
  376. --- /dev/null
  377. +++ src/l2jwins/game/handler/voice/GameMode.java
  378. @@ -0,0 +1,375 @@
  379. +package l2jwins.game.handler.voice;
  380. +
  381. +import java.sql.Connection;
  382. +import java.sql.PreparedStatement;
  383. +import java.sql.SQLException;
  384. +
  385. +import l2jwins.Config;
  386. +import l2jwins.game.handler.IVoicedCommandHandler;
  387. +import l2jwins.game.model.L2World;
  388. +import l2jwins.game.model.actor.instance.L2PcInstance;
  389. +import l2jwins.game.model.zone.ZoneId;
  390. +import l2jwins.game.network.serverpackets.NpcHtmlMessage;
  391. +import l2jwins.util.database.L2DatabaseFactory;
  392. +
  393. +public class GameMode implements IVoicedCommandHandler
  394. +{
  395. +   private static final String[] VOICED_COMMANDS =
  396. +   {
  397. +       "pve",
  398. +       "pvp",
  399. +       "normal",
  400. +       "mode"
  401. +   };
  402. +  
  403. +   @Override
  404. +   public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
  405. +   {
  406. +       if (activeChar == null)
  407. +       {
  408. +           return false;
  409. +       }
  410. +      
  411. +       if (!Config.GAME_MODE_ENABLE)
  412. +       {
  413. +           activeChar.sendMessage("El Change Mode System Esta Desactivado.");
  414. +           return false;
  415. +       }
  416. +      
  417. +       if (activeChar.isMoving())
  418. +       {
  419. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Te Estas Moviendo");
  420. +           return false;
  421. +       }
  422. +      
  423. +       if (activeChar.isInParty())
  424. +       {
  425. +          
  426. +           activeChar.sendMessage("Sal De La Party Para Cambiar de Modo De Juego");
  427. +           return false;
  428. +       }
  429. +      
  430. +       if (activeChar.isInDuel())
  431. +       {
  432. +          
  433. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  434. +           return false;
  435. +       }
  436. +      
  437. +       if (activeChar.isInArena())
  438. +       {
  439. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  440. +           return false;
  441. +       }
  442. +      
  443. +       if (activeChar.isInArenaEvent())
  444. +       {
  445. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  446. +           return false;
  447. +       }
  448. +      
  449. +       if (activeChar.isInJail())
  450. +       {
  451. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  452. +           return false;
  453. +       }
  454. +      
  455. +       if (activeChar.isInPartyMatchRoom())
  456. +       {
  457. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  458. +           return false;
  459. +       }
  460. +      
  461. +       if (activeChar.isInCraftMode())
  462. +       {
  463. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  464. +           return false;
  465. +       }
  466. +      
  467. +       if (activeChar.isInHideoutSiege())
  468. +       {
  469. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  470. +           return false;
  471. +       }
  472. +      
  473. +       if (activeChar.isInHideoutSiege())
  474. +       {
  475. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  476. +           return false;
  477. +       }
  478. +      
  479. +       if (activeChar.isInsideZone(ZoneId.ZONE_BOSS))
  480. +       {
  481. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  482. +           return false;
  483. +       }
  484. +      
  485. +       if (activeChar.isInsideZone(ZoneId.ZONE_CASTLE))
  486. +       {
  487. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  488. +           return false;
  489. +       }
  490. +      
  491. +       if (activeChar.isInsideZone(ZoneId.ZONE_DANGERAREA))
  492. +       {
  493. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  494. +           return false;
  495. +       }
  496. +      
  497. +       if (activeChar.isInsideZone(ZoneId.ZONE_FLAG))
  498. +       {
  499. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  500. +           return false;
  501. +       }
  502. +      
  503. +       if (activeChar.isInsideZone(ZoneId.ZONE_NOSUMMONFRIEND))
  504. +       {
  505. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  506. +           return false;
  507. +       }
  508. +      
  509. +       if (activeChar.isInsideZone(ZoneId.ZONE_JAIL))
  510. +       {
  511. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  512. +           return false;
  513. +       }
  514. +      
  515. +       if (activeChar.isInsideZone(ZoneId.ZONE_MONSTERTRACK))
  516. +       {
  517. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  518. +           return false;
  519. +       }
  520. +      
  521. +       if (activeChar.isInsideZone(ZoneId.ZONE_OLY))
  522. +       {
  523. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  524. +           return false;
  525. +       }
  526. +      
  527. +       if (activeChar.isInsideZone(ZoneId.ZONE_PVP))
  528. +       {
  529. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  530. +           return false;
  531. +       }
  532. +      
  533. +       if (activeChar.isInsideZone(ZoneId.ZONE_RAID_LIMIT))
  534. +       {
  535. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  536. +           return false;
  537. +       }
  538. +      
  539. +       if (activeChar.isInsideZone(ZoneId.ZONE_RANDOM))
  540. +       {
  541. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  542. +           return false;
  543. +       }
  544. +      
  545. +       if (activeChar.isInsideZone(ZoneId.ZONE_SIEGE))
  546. +       {
  547. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  548. +           return false;
  549. +       }
  550. +      
  551. +       if (activeChar.isInsideZone(ZoneId.ZONE_NORESTART))
  552. +       {
  553. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  554. +           return false;
  555. +       }
  556. +      
  557. +       if (activeChar.isIn7sDungeon())
  558. +       {
  559. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora");
  560. +           return false;
  561. +       }
  562. +      
  563. +       if (activeChar.isDungeon())
  564. +       {
  565. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas En Una Dungeon");
  566. +           return false;
  567. +       }
  568. +      
  569. +       if (activeChar.isInOlympiadMode())
  570. +       {
  571. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas En Olympiadas");
  572. +           return false;
  573. +       }
  574. +       if (activeChar.isRegisteredInCTFEvent() || activeChar.isRegisteredInDMEvent() || activeChar.isRegisteredInFunEvent() || activeChar.isRegisteredInTVTEvent() || activeChar.isRegisteredInVIPEvent())
  575. +       {
  576. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas Registrado En Un Evento");
  577. +           return false;
  578. +       }
  579. +      
  580. +       if (activeChar.inObserverMode())
  581. +       {
  582. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas ObserverMode");
  583. +           return false;
  584. +       }
  585. +      
  586. +       if (activeChar.isCastingNow())
  587. +       {
  588. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas Cast Un Skill");
  589. +           return false;
  590. +       }
  591. +      
  592. +       if ((activeChar.isInCombat()))
  593. +       {
  594. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Si Estas En Combate");
  595. +           return false;
  596. +       }
  597. +      
  598. +       if (activeChar.isAttackingNow())
  599. +       {
  600. +           activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas Atacando");
  601. +           return false;
  602. +       }
  603. +      
  604. +       if (command.equalsIgnoreCase(VOICED_COMMANDS[0]))
  605. +       { // PVE Mode
  606. +          
  607. +           if (activeChar.isPVEMode())
  608. +           {
  609. +               activeChar.sendMessage("Ya estas en el modo PVE.");
  610. +               return false;
  611. +           }
  612. +          
  613. +           if (activeChar.getPvpFlag() == 0 && activeChar.getKarma() == 0)
  614. +           {
  615. +               activeChar.setPVEMode(true);
  616. +               activeChar.setPVPMode(false);
  617. +               activeChar.setNormalMode(false);
  618. +               setActiveCharGameMode(activeChar, "PVE MODE");
  619. +               activeChar.sendMessage("Has cambiado al modo PVE. - No Podran Matarte Otros Jugadores");
  620. +               activeChar.sendMessage("Tampoco Podras Atacar a Otros Jugadores - No Obtendras El Bonus");
  621. +               activeChar.decayMe();
  622. +               L2World.getInstance().addPlayerToWorld(activeChar);
  623. +               activeChar.broadcastUserInfo();
  624. +               activeChar.spawnMe();
  625. +               return true;
  626. +           }
  627. +           activeChar.sendMessage(" Estas con Flag o Tienes Karma No puedes Activar el modo PvE Con Karma o Flag");
  628. +           return false;
  629. +          
  630. +       }
  631. +       else if (command.equalsIgnoreCase(VOICED_COMMANDS[1]))
  632. +       { // PVP Mode
  633. +          
  634. +           if (activeChar.isPVPMode())
  635. +           {
  636. +               activeChar.sendMessage("Ya estas en el modo PVP.");
  637. +               return false;
  638. +           }
  639. +          
  640. +           if (activeChar.getLevel() < 76)
  641. +           {
  642. +               activeChar.sendMessage("Necesitas Minimo Ser LvL 76 Para Activar El Modo PvP");
  643. +               return false;
  644. +           }
  645. +          
  646. +           if (!activeChar.isInsideZone(ZoneId.ZONE_PEACE))
  647. +           {
  648. +               activeChar.sendMessage("Solo Puedes Cambiar El Modo En Una Zone Peace.");
  649. +               return false;
  650. +           }
  651. +          
  652. +           activeChar.stopPvPFlag();
  653. +           activeChar.setPvpFlag(1);
  654. +           activeChar.setPVEMode(false);
  655. +           activeChar.setPVPMode(true);
  656. +           activeChar.setNormalMode(false);
  657. +           setActiveCharGameMode(activeChar, "PVP MODE");
  658. +           activeChar.sendMessage("Has cambiado al modo PVP. - Obtendras un Bonus de 50%");
  659. +           activeChar.decayMe();
  660. +           L2World.getInstance().addPlayerToWorld(activeChar);
  661. +           activeChar.broadcastUserInfo();
  662. +           activeChar.spawnMe();
  663. +           return true;
  664. +       }
  665. +       else if (command.equalsIgnoreCase(VOICED_COMMANDS[2]))
  666. +       {
  667. +          
  668. +           if (activeChar.isNormalMode())
  669. +           {
  670. +               activeChar.sendMessage("Ya estas en el modo Normal.");
  671. +               return false;
  672. +           }
  673. +          
  674. +           if (!activeChar.isInsideZone(ZoneId.ZONE_PEACE))
  675. +           {
  676. +               activeChar.sendMessage("Solo Puedes Cambiar El Modo En Una Zone Peace.");
  677. +               return false;
  678. +           }
  679. +          
  680. +           if (activeChar.getPvpFlag() > 0)
  681. +           {
  682. +               activeChar.stopPvPFlag();
  683. +               activeChar.updatePvPStatus();
  684. +               activeChar.setPVEMode(false);
  685. +               activeChar.setPVPMode(false);
  686. +               activeChar.setNormalMode(true);
  687. +               activeChar.sendMessage("Has cambiado al modo Normal. - Obtendras un Bonus de 20%");
  688. +              
  689. +               setActiveCharGameMode(activeChar, "NORMAL MODE");
  690. +               activeChar.decayMe();
  691. +               L2World.getInstance().addPlayerToWorld(activeChar);
  692. +               activeChar.broadcastUserInfo();
  693. +               activeChar.spawnMe();
  694. +              
  695. +           }
  696. +           else
  697. +           {
  698. +               activeChar.setPvpFlag(0);
  699. +               activeChar.setPVEMode(false);
  700. +               activeChar.setPVPMode(false);
  701. +               activeChar.setNormalMode(true);
  702. +               setActiveCharGameMode(activeChar, "NORMAL MODE");
  703. +               activeChar.sendMessage("Has cambiado al modo Normal. - Obtendras un Bonus de 20%");
  704. +               activeChar.decayMe();
  705. +               L2World.getInstance().addPlayerToWorld(activeChar);
  706. +               activeChar.broadcastUserInfo();
  707. +               activeChar.spawnMe();
  708. +               return true;
  709. +           }
  710. +          
  711. +       }
  712. +      
  713. +       else if (command.equalsIgnoreCase(VOICED_COMMANDS[3]))
  714. +       { // PVP Mode
  715. +           showModeSystemHTML(activeChar);
  716. +           return true;
  717. +       }
  718. +      
  719. +       return false;
  720. +   }
  721. +  
  722. +   private void setActiveCharGameMode(L2PcInstance activeChar, String gameMode)
  723. +   {
  724. +       try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  725. +       {
  726. +           String sql = "REPLACE INTO Character_Game_Mode (object_id, char_name, game_mode) VALUES (?, ?, ?)";
  727. +           try (PreparedStatement ps = con.prepareStatement(sql))
  728. +           {
  729. +               ps.setInt(1, activeChar.getObjectId());
  730. +               ps.setString(2, activeChar.getName());
  731. +               ps.setString(3, gameMode);
  732. +               ps.execute();
  733. +           }
  734. +       }
  735. +       catch (SQLException e)
  736. +       {
  737. +           // Manejo de excepciones
  738. +       }
  739. +   }
  740. +  
  741. +   private void showModeSystemHTML(L2PcInstance player)
  742. +   {
  743. +       NpcHtmlMessage html = new NpcHtmlMessage(0);
  744. +       html.setFile("data/html/mods/ChangeModeSystem/ModeSystem.htm");
  745. +       player.sendPacket(html);
  746. +   }
  747. +  
  748. +   @Override
  749. +   public String[] getVoicedCommandList()
  750. +   {
  751. +       return VOICED_COMMANDS;
  752. +   }
  753. +}
  754. diff --git src/l2jwins/game/model/L2Attackable.java src/l2jwins/game/model/L2Attackable.java
  755. index 0615b26..c25553d 100644
  756. --- src/l2jwins/game/model/L2Attackable.java
  757. +++ src/l2jwins/game/model/L2Attackable.java
  758. @@ -651,6 +651,19 @@
  759.                                     exp = (long) (exp * Config.PREMIUM_XPSP_RATE);
  760.                                     sp = (int) (sp * Config.PREMIUM_XPSP_RATE);
  761.                                 }
  762. +                              
  763. +                               if (((L2PcInstance) attacker).isPVPMode())
  764. +                               {
  765. +                                   exp = (long) (exp * Config.PVP_MODE_XPSP_RATE);
  766. +                                   sp = (int) (sp * Config.PVP_MODE_XPSP_RATE);
  767. +                               }
  768. +                              
  769. +                               if (((L2PcInstance) attacker).isNormalMode())
  770. +                               {
  771. +                                   exp = (long) (exp * Config.NORMAL_MODE_XPSP_RATE);
  772. +                                   sp = (int) (sp * Config.NORMAL_MODE_XPSP_RATE);
  773. +                               }
  774. +                              
  775.                             }
  776.                            
  777.                             // Distribute the Exp and SP between the L2PcInstance and its L2Summon
  778. @@ -1158,6 +1171,16 @@
  779.                     dropChance *= Config.PREMIUM_SPOIL_RATE;
  780.                 }
  781.                
  782. +               if (lastAttacker.isPVPMode())
  783. +               {
  784. +                   dropChance *= Config.PVP_MODE_SPOIL_RATE;
  785. +               }
  786. +              
  787. +               if (lastAttacker.isNormalMode())
  788. +               {
  789. +                   dropChance *= Config.NORMAL_MODE_SPOIL_RATE;
  790. +               }
  791. +              
  792.             }
  793.             dropChance = (int) ((dropChance * lastAttacker.calcStat(Stats.SPOIL_RATE, 100, null, null)) / 100);
  794.         }
  795. @@ -1183,6 +1206,15 @@
  796.                 {
  797.                     dropChance *= Config.PREMIUM_DROP_RATE;
  798.                 }
  799. +              
  800. +               if (lastAttacker.isPVPMode())
  801. +               {
  802. +                   dropChance *= Config.PVP_MODE_DROP_RATE;
  803. +               }
  804. +               if (lastAttacker.isNormalMode())
  805. +               {
  806. +                   dropChance *= Config.NORMAL_MODE_DROP_RATE;
  807. +               }
  808.             }
  809.         }
  810.        
  811. @@ -1271,6 +1303,15 @@
  812.                 {
  813.                     itemCount *= Config.PREMIUM_ADENA_RATE;
  814.                 }
  815. +              
  816. +               if (lastAttacker.isPVPMode())
  817. +               {
  818. +                   itemCount *= Config.PVP_MODE_ADENA_RATE;
  819. +               }
  820. +               if (lastAttacker.isNormalMode())
  821. +               {
  822. +                   itemCount *= Config.NORMAL_MODE_ADENA_RATE;
  823. +               }
  824.             }
  825.         }
  826.        
  827. @@ -1327,6 +1368,16 @@
  828.             {
  829.                 categoryDropChance *= Config.PREMIUM_SS_RATE;
  830.             }
  831. +          
  832. +           if (lastAttacker.isPVPMode())
  833. +           {
  834. +               categoryDropChance *= Config.PVP_MODE_SS_RATE;
  835. +           }
  836. +          
  837. +           if (lastAttacker.isNormalMode())
  838. +           {
  839. +               categoryDropChance *= Config.NORMAL_MODE_SS_RATE;
  840. +           }
  841.         }
  842.         else
  843.         {
  844. @@ -1394,6 +1445,15 @@
  845.                     {
  846.                         dropChance *= Config.PREMIUM_DROP_RATE;
  847.                     }
  848. +                  
  849. +                   if (lastAttacker.isPVPMode())
  850. +                   {
  851. +                       dropChance *= Config.PVP_MODE_DROP_RATE;
  852. +                   }
  853. +                   if (lastAttacker.isNormalMode())
  854. +                   {
  855. +                       dropChance *= Config.NORMAL_MODE_DROP_RATE;
  856. +                   }
  857.                 }
  858.             }
  859.            
  860. @@ -1453,6 +1513,16 @@
  861.                 {
  862.                     itemCount *= Config.PREMIUM_SS_RATE;
  863.                 }
  864. +               if (lastAttacker.isPVPMode())
  865. +               {
  866. +                   itemCount *= Config.PVP_MODE_SS_RATE;
  867. +               }
  868. +              
  869. +               if (lastAttacker.isNormalMode())
  870. +               {
  871. +                   itemCount *= Config.NORMAL_MODE_SS_RATE;
  872. +               }
  873. +              
  874.             }
  875.            
  876.             if (drop.getItemId() == 57)
  877. @@ -1477,6 +1547,14 @@
  878.                     {
  879.                         itemCount *= Config.PREMIUM_ADENA_RATE;
  880.                     }
  881. +                   if (lastAttacker.isPVPMode())
  882. +                   {
  883. +                       itemCount *= Config.PVP_MODE_ADENA_RATE;
  884. +                   }
  885. +                   if (lastAttacker.isNormalMode())
  886. +                   {
  887. +                       itemCount *= Config.NORMAL_MODE_ADENA_RATE;
  888. +                   }
  889.                 }
  890.             }
  891.            
  892. diff --git src/l2jwins/game/model/actor/instance/L2PcInstance.java src/l2jwins/game/model/actor/instance/L2PcInstance.java
  893. index 5a34ade..93095fd 100644
  894. --- src/l2jwins/game/model/actor/instance/L2PcInstance.java
  895. +++ src/l2jwins/game/model/actor/instance/L2PcInstance.java
  896. @@ -327,7 +327,12 @@
  897.     private String _autofarm_mode = "None";
  898.     private Location _autofarm_distance;
  899.    
  900. +   private boolean isPVEMode = false;
  901. +   private boolean isPVPMode = false;
  902. +   private boolean isNormalMode = false;
  903. +  
  904.     private boolean isTryingSkin = false;
  905. +  
  906.     private boolean isTryingSkinPremium = false;
  907.     private List<Integer> _armorSkins = new CopyOnWriteArrayList<>();
  908.     private List<Integer> _weaponSkins = new CopyOnWriteArrayList<>();
  909.  
  910. @@ -11745,6 +11755,22 @@
  911.             return;
  912.         }
  913.        
  914. +       // Check if target is in PVE mode
  915. +       if (target instanceof L2PcInstance && ((L2PcInstance) target).isPVEMode())
  916. +       {
  917. +           sendPacket(ActionFailed.STATIC_PACKET);
  918. +           this.sendMessage("No Puedes Atacar a " + target.getName() + " Por Que Esta en PVE MODE");
  919. +           return;
  920. +       }
  921. +      
  922. +       // Check if attacker is in PVE mode and target is a player
  923. +       if (this.isPVEMode() && target instanceof L2PcInstance)
  924. +       {
  925. +           sendPacket(ActionFailed.STATIC_PACKET);
  926. +           this.sendMessage("Desactiva El Modo PVE");
  927. +           return;
  928. +       }
  929. +      
  930.         // Check if the spell consume an item
  931.         if (skill.getItemConsume() > 0)
  932.         {
  933. @@ -11857,6 +11883,7 @@
  934.                 sendPacket(sm);
  935.                 return;
  936.             }
  937. +          
  938.         }
  939.        
  940.         // Like L2OFF if you are mounted on wyvern you can't use own skills
  941. @@ -19769,6 +19796,36 @@
  942.         return isTryingSkin;
  943.     }
  944.    
  945. +   public boolean isPVEMode()
  946. +   {
  947. +       return isPVEMode;
  948. +   }
  949. +  
  950. +   public void setPVEMode(boolean b)
  951. +   {
  952. +       isPVEMode = b;
  953. +   }
  954. +  
  955. +   public boolean isPVPMode()
  956. +   {
  957. +       return isPVPMode;
  958. +   }
  959. +  
  960. +   public void setPVPMode(boolean b)
  961. +   {
  962. +       isPVPMode = b;
  963. +   }
  964. +  
  965. +   public boolean isNormalMode()
  966. +   {
  967. +       return isNormalMode;
  968. +   }
  969. +  
  970. +   public void setNormalMode(boolean b)
  971. +   {
  972. +       isNormalMode = b;
  973. +   }
  974. +  
  975.     public void setIsTryingSkin(boolean b)
  976.     {
  977.         isTryingSkin = b;
  978. @@ -20801,6 +20858,31 @@
  979.         }
  980.     }
  981.    
  982. +   public String getGameMode()
  983. +   {
  984. +       try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  985. +       {
  986. +           String sql = "SELECT game_mode FROM Character_Game_Mode WHERE object_id = ?";
  987. +           try (PreparedStatement ps = con.prepareStatement(sql))
  988. +           {
  989. +               ps.setInt(1, getObjectId());
  990. +               try (ResultSet rs = ps.executeQuery())
  991. +               {
  992. +                   if (rs.next())
  993. +                   {
  994. +                       return rs.getString("game_mode");
  995. +                   }
  996. +               }
  997. +           }
  998. +       }
  999. +       catch (SQLException e)
  1000. +       {
  1001. +           // Manejo de excepciones
  1002. +       }
  1003. +      
  1004. +       return "Desconocido";
  1005. +   }
  1006. +  
  1007.     public void updateLastAction()
  1008.     {
  1009.         _lastAction = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(Config.AFK_TIMER);
  1010. diff --git src/l2jwins/game/network/clientpackets/AttackRequest.java src/l2jwins/game/network/clientpackets/AttackRequest.java
  1011. index 291a214..5ecca8e 100644
  1012. --- src/l2jwins/game/network/clientpackets/AttackRequest.java
  1013. +++ src/l2jwins/game/network/clientpackets/AttackRequest.java
  1014. @@ -71,6 +71,22 @@
  1015.             return;
  1016.         }
  1017.        
  1018. +       // Check if target is in PVE mode
  1019. +       if (target instanceof L2PcInstance && ((L2PcInstance) target).isPVEMode() && !activeChar.isGM())
  1020. +       {
  1021. +           activeChar.sendMessage("El Usuario: " + target.getName() + " esta en modo PvE");
  1022. +           activeChar.sendPacket(ActionFailed.STATIC_PACKET);
  1023. +           return;
  1024. +       }
  1025. +      
  1026. +       // Check if attacker is in PVE mode
  1027. +       if (activeChar.isPVEMode() && !activeChar.isGM())
  1028. +       {
  1029. +           activeChar.sendMessage("Debes desactivar el modo PvE para atacar a otros jugadores");
  1030. +           activeChar.sendPacket(ActionFailed.STATIC_PACKET);
  1031. +           return;
  1032. +       }
  1033. +      
  1034.         // Players can't attack objects in the other instances except from multiverse
  1035.         if (target.getInstanceId() != activeChar.getInstanceId() && activeChar.getInstanceId() != -1)
  1036.         {
  1037. diff --git src/l2jwins/game/network/clientpackets/EnterWorld.java src/l2jwins/game/network/clientpackets/EnterWorld.java
  1038. index aeae263..89370b4 100644
  1039. --- src/l2jwins/game/network/clientpackets/EnterWorld.java
  1040. +++ src/l2jwins/game/network/clientpackets/EnterWorld.java
  1041. @@ -24,7 +24,6 @@
  1042.  import java.util.regex.PatternSyntaxException;
  1043.  
  1044.  import Base.Rank.RankManager;
  1045. -import Base.custom.DailyRewardManager;
  1046.  import Base.data.Dolls;
  1047.  import l2jwins.Config;
  1048.  import l2jwins.game.GameServer;
  1049. @@ -203,6 +202,62 @@
  1050.             activeChar.restoreEffects();
  1051.         }
  1052.        
  1053. +       if (Config.GAME_MODE_ENABLE)
  1054. +       {
  1055. +          
  1056. +           String gameMode = activeChar.getGameMode();
  1057. +           if (gameMode.equalsIgnoreCase("PVE MODE"))
  1058. +           {
  1059. +               activeChar.setPVEMode(true);
  1060. +               activeChar.setPVPMode(false);
  1061. +               activeChar.setNormalMode(false);
  1062. +               activeChar.decayMe();
  1063. +               L2World.getInstance().addPlayerToWorld(activeChar);
  1064. +               activeChar.sendMessage("Estas En PvE Mode - Los jugadores no podran atacarte");
  1065. +               activeChar.sendMessage("Puedes Cambiarlo Con: - .pve - .pvp - .normal");
  1066. +               activeChar.broadcastUserInfo();
  1067. +               activeChar.spawnMe();
  1068. +           }
  1069. +           else if (gameMode.equalsIgnoreCase("PVP MODE"))
  1070. +           {
  1071. +               activeChar.stopPvPFlag();
  1072. +               activeChar.updatePvPFlag(1);
  1073. +               activeChar.setPVEMode(false);
  1074. +               activeChar.setPVPMode(true);
  1075. +               activeChar.setNormalMode(false);
  1076. +               activeChar.sendMessage("Estas En PVP Mode - Recibes un bonus de 50% de Exp - Sp - Drop - Adena");
  1077. +               activeChar.sendMessage("Puedes Cambiarlo Con: - .pve - .pvp - .normal");
  1078. +               activeChar.decayMe();
  1079. +               L2World.getInstance().addPlayerToWorld(activeChar);
  1080. +               activeChar.broadcastUserInfo();
  1081. +               activeChar.spawnMe();
  1082. +           }
  1083. +           else if (gameMode.equalsIgnoreCase("NORMAL MODE"))
  1084. +           {
  1085. +               activeChar.setPvpFlag(0);
  1086. +               activeChar.setPVEMode(false);
  1087. +               activeChar.setPVPMode(false);
  1088. +               activeChar.setNormalMode(true);
  1089. +               activeChar.sendMessage("Estas En Normal Mode - Recibes un bonus de 20% de Exp - Sp - Drop - Adena");
  1090. +               activeChar.sendMessage("Puedes Cambiarlo Con: - .pve - .pvp - .normal");
  1091. +               activeChar.decayMe();
  1092. +               L2World.getInstance().addPlayerToWorld(activeChar);
  1093. +               activeChar.broadcastUserInfo();
  1094. +               activeChar.spawnMe();
  1095. +           }
  1096. +          
  1097. +           if (activeChar.getFirstLog())
  1098. +           {
  1099. +               activeChar.setNormalMode(true);
  1100. +               activeChar.sendMessage("Estas En Normal Mode - Recibes un bonus de 20% de Exp - Sp - Drop - Adena");
  1101. +               activeChar.sendMessage("Puedes Cambiarlo Con: - .pve - .pvp - .normal");
  1102. +              
  1103. +               showModeSystemHTML(activeChar);
  1104. +              
  1105. +           }
  1106. +          
  1107. +       }
  1108. +      
  1109.         // Apply augmentation bonus for equipped items
  1110.         for (L2ItemInstance temp : activeChar.getInventory().getAugmentedItems())
  1111.         {
  1112. @@ -1209,6 +1262,13 @@
  1113.        
  1114.     }
  1115.    
  1116. +   private void showModeSystemHTML(L2PcInstance player)
  1117. +   {
  1118. +       NpcHtmlMessage html = new NpcHtmlMessage(0);
  1119. +       html.setFile("data/html/mods/ChangeModeSystem/ModeSystem.htm");
  1120. +       player.sendPacket(html);
  1121. +   }
  1122. +  
  1123.     private void notifyCastleOwner(L2PcInstance activeChar)
  1124.     {
  1125.         L2Clan clan = activeChar.getClan();
  1126. diff --git src/l2jwins/game/network/clientpackets/RequestBypassToServer.java src/l2jwins/game/network/clientpackets/RequestBypassToServer.java
  1127. index d179afd..95a5544 100644
  1128. --- src/l2jwins/game/network/clientpackets/RequestBypassToServer.java
  1129. +++ src/l2jwins/game/network/clientpackets/RequestBypassToServer.java
  1130. @@ -30,6 +30,7 @@
  1131.  import java.util.stream.Stream;
  1132.  
  1133.  import Base.ItemRecover.ItemRecoveryManager;
  1134. +import Base.ModeSystem.ChangeModeManager;
  1135.  import Base.WinsStats.WinsStatSystem;
  1136.  import Base.custom.Board.BoardManager;
  1137.  import javolution.text.TextBuilder;
  1138. @@ -76,6 +77,7 @@
  1139.  import l2jwins.game.model.entity.event.TvT;
  1140.  import l2jwins.game.model.entity.event.VIP;
  1141.  import l2jwins.game.model.olympiad.OlympiadManager;
  1142. +import l2jwins.game.model.zone.ZoneId;
  1143.  import l2jwins.game.network.PacketClient;
  1144.  import l2jwins.game.network.SystemMessageId;
  1145.  import l2jwins.game.network.serverpackets.ActionFailed;
  1146. @@ -342,6 +344,119 @@
  1147.                 activeChar.broadcastUserInfo();
  1148.                 activeChar.broadcastTitleInfo();
  1149.             }
  1150. +          
  1151. +           else if (bp.bypass.startsWith("PvEMode"))
  1152. +           {
  1153. +              
  1154. +               if (ChangeModeManager.verifyChangeMode(activeChar))
  1155. +               {
  1156. +                  
  1157. +                   if (activeChar.isPVEMode())
  1158. +                   {
  1159. +                       activeChar.sendMessage("Ya estas en el modo PVE.");
  1160. +                       return;
  1161. +                   }
  1162. +                  
  1163. +                   if (activeChar.getPvpFlag() == 0 && activeChar.getKarma() == 0)
  1164. +                   {
  1165. +                       activeChar.setPVEMode(true);
  1166. +                       activeChar.setPVPMode(false);
  1167. +                       activeChar.setNormalMode(false);
  1168. +                       activeChar.decayMe();
  1169. +                       L2World.getInstance().addPlayerToWorld(activeChar);
  1170. +                       activeChar.sendMessage("Estas En PvE Mode - Los jugadores no podran atacarte");
  1171. +                       activeChar.sendMessage("Puedes Cambiarlo Con: - .pve - .pvp - .normal");
  1172. +                       activeChar.broadcastUserInfo();
  1173. +                       activeChar.spawnMe();
  1174. +                   }
  1175. +                   else
  1176. +                   {
  1177. +                       activeChar.sendMessage(" Estas con Flag o Tienes Karma No puedes Activar el modo PvE Con Karma o Flag");
  1178. +                   }
  1179. +               }
  1180. +              
  1181. +           }
  1182. +          
  1183. +           else if (bp.bypass.startsWith("PvPMode"))
  1184. +           {
  1185. +              
  1186. +               if (ChangeModeManager.verifyChangeMode(activeChar))
  1187. +               {
  1188. +                   if (activeChar.isPVPMode())
  1189. +                   {
  1190. +                       activeChar.sendMessage("Ya estas en el modo PVP.");
  1191. +                       return;
  1192. +                   }
  1193. +                  
  1194. +                   if (!activeChar.isInsideZone(ZoneId.ZONE_PEACE))
  1195. +                   {
  1196. +                       activeChar.sendMessage("Solo Puedes Cambiar El Modo En Una Zone Peace.");
  1197. +                       return;
  1198. +                   }
  1199. +                  
  1200. +                   if (activeChar.getLevel() < 76)
  1201. +                   {
  1202. +                       activeChar.sendMessage("Necesitas Minimo Ser LvL 76 Para Activar El Modo PvP.");
  1203. +                       return;
  1204. +                   }
  1205. +                  
  1206. +                   activeChar.stopPvPFlag();
  1207. +                   activeChar.setPvpFlag(1);
  1208. +                   activeChar.setPVEMode(false);
  1209. +                   activeChar.setPVPMode(true);
  1210. +                   activeChar.setNormalMode(false);
  1211. +                   activeChar.sendMessage("Has cambiado al modo PVP. - Obtendras un Bonus de 50%");
  1212. +                   activeChar.decayMe();
  1213. +                   L2World.getInstance().addPlayerToWorld(activeChar);
  1214. +                   activeChar.broadcastUserInfo();
  1215. +                   activeChar.spawnMe();
  1216. +               }
  1217. +              
  1218. +           }
  1219. +          
  1220. +           else if (bp.bypass.startsWith("NormalMode"))
  1221. +           {
  1222. +               if (ChangeModeManager.verifyChangeMode(activeChar))
  1223. +               {
  1224. +                  
  1225. +                   if (activeChar.isNormalMode())
  1226. +                   {
  1227. +                       activeChar.sendMessage("Ya estas en el modo Normal.");
  1228. +                       return;
  1229. +                   }
  1230. +                  
  1231. +                   if (!activeChar.isInsideZone(ZoneId.ZONE_PEACE))
  1232. +                   {
  1233. +                       activeChar.sendMessage("Solo Puedes Cambiar El Modo En Una Zone Peace.");
  1234. +                       return;
  1235. +                   }
  1236. +                  
  1237. +                   if (activeChar.getPvpFlag() > 0)
  1238. +                   {
  1239. +                       activeChar.stopPvPFlag();
  1240. +                       activeChar.updatePvPStatus();
  1241. +                       activeChar.setPVEMode(false);
  1242. +                       activeChar.setPVPMode(false);
  1243. +                       activeChar.setNormalMode(true);
  1244. +                       activeChar.sendMessage("Has cambiado al modo Normal. - Obtendras un Bonus de 20%");
  1245. +                       activeChar.decayMe();
  1246. +                       L2World.getInstance().addPlayerToWorld(activeChar);
  1247. +                       activeChar.broadcastUserInfo();
  1248. +                       activeChar.spawnMe();
  1249. +                   }
  1250. +                   activeChar.setPvpFlag(0);
  1251. +                   activeChar.setPVEMode(false);
  1252. +                   activeChar.setPVPMode(false);
  1253. +                   activeChar.setNormalMode(true);
  1254. +                   activeChar.sendMessage("Has cambiado al modo Normal. - Obtendras un Bonus de 20%");
  1255. +                   activeChar.decayMe();
  1256. +                   L2World.getInstance().addPlayerToWorld(activeChar);
  1257. +                   activeChar.broadcastUserInfo();
  1258. +                   activeChar.spawnMe();
  1259. +               }
  1260. +              
  1261. +           }
  1262. +          
  1263.             else if (bp.bypass.startsWith("player_help "))
  1264.             {
  1265.                 playerHelp(activeChar, bp.bypass.substring(12));
  1266. diff --git src/l2jwins/game/network/clientpackets/RequestDuelAnswerStart.java src/l2jwins/game/network/clientpackets/RequestDuelAnswerStart.java
  1267. index 8b957eb..416ba62 100644
  1268. --- src/l2jwins/game/network/clientpackets/RequestDuelAnswerStart.java
  1269. +++ src/l2jwins/game/network/clientpackets/RequestDuelAnswerStart.java
  1270. @@ -19,6 +19,7 @@
  1271.   */
  1272.  package l2jwins.game.network.clientpackets;
  1273.  
  1274. +import l2jwins.Config;
  1275.  import l2jwins.game.managers.DuelManager;
  1276.  import l2jwins.game.model.actor.instance.L2PcInstance;
  1277.  import l2jwins.game.network.PacketClient;
  1278. @@ -56,6 +57,15 @@
  1279.             return;
  1280.         }
  1281.        
  1282. +       if (Config.GAME_MODE_ENABLE)
  1283. +       {
  1284. +           if (requestor.isPVEMode())
  1285. +           {
  1286. +               player.sendMessage("Estas en PVE MODE o el jugador que intentas retar a un duelo lo esta");
  1287. +               return;
  1288. +           }
  1289. +       }
  1290. +      
  1291.         if (_response == 1)
  1292.         {
  1293.             SystemMessage msg1 = null, msg2 = null;
  1294. diff --git src/l2jwins/game/network/clientpackets/RequestDuelStart.java src/l2jwins/game/network/clientpackets/RequestDuelStart.java
  1295. index d808b43..7855025 100644
  1296. --- src/l2jwins/game/network/clientpackets/RequestDuelStart.java
  1297. +++ src/l2jwins/game/network/clientpackets/RequestDuelStart.java
  1298. @@ -65,6 +65,21 @@
  1299.             return;
  1300.         }
  1301.        
  1302. +       if (Config.GAME_MODE_ENABLE)
  1303. +       {
  1304. +           if (activeChar.isPVEMode())
  1305. +           {
  1306. +               activeChar.sendMessage("Desactiva El PVE MODE");
  1307. +               return;
  1308. +           }
  1309. +          
  1310. +           if (targetChar.isPVEMode())
  1311. +           {
  1312. +               activeChar.sendMessage("El Jugador: " + targetChar.getName() + " Esta en PvE Mode");
  1313. +               return;
  1314. +           }
  1315. +       }
  1316. +      
  1317.         // Check if duel is possible
  1318.         if (!activeChar.canDuel())
  1319.         {
  1320. diff --git src/l2jwins/game/network/clientpackets/RequestJoinParty.java src/l2jwins/game/network/clientpackets/RequestJoinParty.java
  1321. index 76a96d3..ff31b1a 100644
  1322. --- src/l2jwins/game/network/clientpackets/RequestJoinParty.java
  1323. +++ src/l2jwins/game/network/clientpackets/RequestJoinParty.java
  1324. @@ -71,6 +71,16 @@
  1325.             return;
  1326.         }
  1327.        
  1328. +       if (Config.GAME_MODE_ENABLE)
  1329. +       {
  1330. +          
  1331. +           if (requestor.getGameMode().equals(target.getGameMode()))
  1332. +           {
  1333. +               requestor.sendMessage("No puedes invitar a la party a un jugador con un modo de juego diferente.");
  1334. +               return;
  1335. +           }
  1336. +       }
  1337. +      
  1338.         if ((requestor._inEventDM && (DM.is_teleport() || DM.is_started())) || (target._inEventDM && (DM.is_teleport() || DM.is_started())))
  1339.         {
  1340.             requestor.sendMessage("You can't invite that player in party!");
  1341. diff --git src/l2jwins/game/network/clientpackets/RequestJoinSiege.java src/l2jwins/game/network/clientpackets/RequestJoinSiege.java
  1342. index 644f078..a785d0e 100644
  1343. --- src/l2jwins/game/network/clientpackets/RequestJoinSiege.java
  1344. +++ src/l2jwins/game/network/clientpackets/RequestJoinSiege.java
  1345. @@ -20,6 +20,7 @@
  1346.  
  1347.  package l2jwins.game.network.clientpackets;
  1348.  
  1349. +import l2jwins.Config;
  1350.  import l2jwins.game.managers.CHSiegeManager;
  1351.  import l2jwins.game.managers.CastleManager;
  1352.  import l2jwins.game.managers.FortManager;
  1353. @@ -62,6 +63,15 @@
  1354.             return;
  1355.         }
  1356.        
  1357. +       if (Config.GAME_MODE_ENABLE)
  1358. +       {
  1359. +           if (player.isPVEMode())
  1360. +           {
  1361. +               player.sendMessage("Desactiva El PVE MODE");
  1362. +               return;
  1363. +           }
  1364. +       }
  1365. +      
  1366.         L2Clan clan = player.getClan();
  1367.         if (clan == null)
  1368.         {
  1369. diff --git src/l2jwins/game/network/clientpackets/RequestOlympiadMatchList.java src/l2jwins/game/network/clientpackets/RequestOlympiadMatchList.java
  1370. index 3f271ba..43803ee 100644
  1371. --- src/l2jwins/game/network/clientpackets/RequestOlympiadMatchList.java
  1372. +++ src/l2jwins/game/network/clientpackets/RequestOlympiadMatchList.java
  1373. @@ -20,6 +20,7 @@
  1374.   */
  1375.  package l2jwins.game.network.clientpackets;
  1376.  
  1377. +import l2jwins.Config;
  1378.  import l2jwins.game.model.actor.instance.L2PcInstance;
  1379.  import l2jwins.game.model.olympiad.Olympiad;
  1380.  import l2jwins.game.model.olympiad.OlympiadGameManager;
  1381. @@ -46,6 +47,15 @@
  1382.             return;
  1383.         }
  1384.        
  1385. +       if (Config.GAME_MODE_ENABLE)
  1386. +       {
  1387. +           if (activeChar.isPVEMode())
  1388. +           {
  1389. +               activeChar.sendMessage("Desactiva El PVE MODE");
  1390. +               return;
  1391. +           }
  1392. +       }
  1393. +      
  1394.         int i = 0;
  1395.        
  1396.         final StringBuilder sb = new StringBuilder(1500);
  1397. diff --git src/l2jwins/game/network/clientpackets/RequestOlympiadObserverEnd.java src/l2jwins/game/network/clientpackets/RequestOlympiadObserverEnd.java
  1398. index 14201b7..f94a4be 100644
  1399. --- src/l2jwins/game/network/clientpackets/RequestOlympiadObserverEnd.java
  1400. +++ src/l2jwins/game/network/clientpackets/RequestOlympiadObserverEnd.java
  1401. @@ -20,6 +20,7 @@
  1402.   */
  1403.  package l2jwins.game.network.clientpackets;
  1404.  
  1405. +import l2jwins.Config;
  1406.  import l2jwins.game.model.actor.instance.L2PcInstance;
  1407.  import l2jwins.game.network.PacketClient;
  1408.  
  1409. @@ -39,6 +40,15 @@
  1410.             return;
  1411.         }
  1412.        
  1413. +       if (Config.GAME_MODE_ENABLE)
  1414. +       {
  1415. +           if (activeChar.isPVEMode())
  1416. +           {
  1417. +               activeChar.sendMessage("Desactiva El PVE MODE");
  1418. +               return;
  1419. +           }
  1420. +       }
  1421. +      
  1422.         if (activeChar.inObserverMode())
  1423.         {
  1424.             activeChar.leaveOlympiadObserverMode();
  1425. diff --git src/l2jwins/game/network/clientpackets/RequestStartPledgeWar.java src/l2jwins/game/network/clientpackets/RequestStartPledgeWar.java
  1426. index 68b6a38..2c9642f 100644
  1427. --- src/l2jwins/game/network/clientpackets/RequestStartPledgeWar.java
  1428. +++ src/l2jwins/game/network/clientpackets/RequestStartPledgeWar.java
  1429. @@ -70,6 +70,15 @@
  1430.             return;
  1431.         }
  1432.        
  1433. +       if (Config.GAME_MODE_ENABLE)
  1434. +       {
  1435. +           if (player.isPVEMode())
  1436. +           {
  1437. +               player.sendMessage("Desactiva El PVE MODE");
  1438. +               return;
  1439. +           }
  1440. +       }
  1441. +      
  1442.         final L2Clan clan = ClanTable.getInstance().getClanByName(_pledgeName);
  1443.         if (clan == null)
  1444.         {
  1445. diff --git src/l2jwins/game/network/clientpackets/RequestStopPledgeWar.java src/l2jwins/game/network/clientpackets/RequestStopPledgeWar.java
  1446. index 3cda6f7..2827035 100644
  1447. --- src/l2jwins/game/network/clientpackets/RequestStopPledgeWar.java
  1448. +++ src/l2jwins/game/network/clientpackets/RequestStopPledgeWar.java
  1449. @@ -19,6 +19,7 @@
  1450.   */
  1451.  package l2jwins.game.network.clientpackets;
  1452.  
  1453. +import l2jwins.Config;
  1454.  import l2jwins.game.datatables.sql.ClanTable;
  1455.  import l2jwins.game.model.L2Clan;
  1456.  import l2jwins.game.model.L2World;
  1457. @@ -61,6 +62,15 @@
  1458.             return;
  1459.         }
  1460.        
  1461. +       if (Config.GAME_MODE_ENABLE)
  1462. +       {
  1463. +           if (player.isPVEMode())
  1464. +           {
  1465. +               player.sendMessage("Desactiva El PVE MODE");
  1466. +               return;
  1467. +           }
  1468. +       }
  1469. +      
  1470.         if (!playerClan.isAtWarWith(clan.getClanId()))
  1471.         {
  1472.             player.sendMessage("You aren't at war with this clan.");
  1473. diff --git src/l2jwins/game/network/clientpackets/RequestSurrenderPledgeWar.java src/l2jwins/game/network/clientpackets/RequestSurrenderPledgeWar.java
  1474. index 70bb1c9..320e4b8 100644
  1475. --- src/l2jwins/game/network/clientpackets/RequestSurrenderPledgeWar.java
  1476. +++ src/l2jwins/game/network/clientpackets/RequestSurrenderPledgeWar.java
  1477. @@ -19,6 +19,7 @@
  1478.   */
  1479.  package l2jwins.game.network.clientpackets;
  1480.  
  1481. +import l2jwins.Config;
  1482.  import l2jwins.game.datatables.sql.ClanTable;
  1483.  import l2jwins.game.model.L2Clan;
  1484.  import l2jwins.game.model.actor.instance.L2PcInstance;
  1485. @@ -48,11 +49,24 @@
  1486.     {
  1487.         _activeChar = getClient().getActiveChar();
  1488.         if (_activeChar == null)
  1489. +       {
  1490.             return;
  1491. +       }
  1492. +      
  1493. +       if (Config.GAME_MODE_ENABLE)
  1494. +       {
  1495. +           if (_activeChar.isPVEMode())
  1496. +           {
  1497. +               _activeChar.sendMessage("Desactiva El PVE MODE");
  1498. +               return;
  1499. +           }
  1500. +       }
  1501.        
  1502.         _clan = _activeChar.getClan();
  1503.         if (_clan == null)
  1504. +       {
  1505.             return;
  1506. +       }
  1507.        
  1508.         final L2Clan clan = ClanTable.getInstance().getClanByName(_pledgeName);
  1509.         if (clan == null)
  1510. diff --git src/l2jwins/game/network/serverpackets/CharInfo.java src/l2jwins/game/network/serverpackets/CharInfo.java
  1511. index 1b85818..dadf1f4 100644
  1512. --- src/l2jwins/game/network/serverpackets/CharInfo.java
  1513. +++ src/l2jwins/game/network/serverpackets/CharInfo.java
  1514. @@ -74,10 +74,8 @@
  1515.         _swimWalkSpd = _flWalkSpd = _flyWalkSpd = _walkSpd;
  1516.         _maxCp = player.getMaxCp();
  1517.        
  1518. -       if (!hideInfo())
  1519. +       if (!GameModeInfo())
  1520.         {
  1521. -           _name = player.getName();
  1522. -          
  1523.             if (player.getAppearance().getInvisible())
  1524.             {
  1525.                 _title = "Invisible";
  1526. @@ -87,9 +85,19 @@
  1527.                
  1528.                 _title = _activeChar.getTitle();
  1529.             }
  1530. +           _titleColor = player.getAppearance().getTitleColor();
  1531. +       }
  1532. +       else
  1533. +       {
  1534. +           _title = "PVE MODE";
  1535. +           _titleColor = 0x00FFFF;
  1536. +       }
  1537. +      
  1538. +       if (!hideInfo())
  1539. +       {
  1540. +           _name = player.getName();
  1541.            
  1542.             _nameColor = player.getAppearance().getNameColor();
  1543. -           _titleColor = player.getAppearance().getTitleColor();
  1544.             _clanId = player.getClanId();
  1545.             _clanCrestId = player.getClanCrestId();
  1546.             _allyId = player.getAllyId();
  1547. @@ -98,9 +106,8 @@
  1548.         else
  1549.         {
  1550.             _name = Config.PLAYER_FAKE_NAME;
  1551. -           _title = "";
  1552. +          
  1553.             _nameColor = 0xFFFFFF;
  1554. -           _titleColor = 0xFFFF77;
  1555.             _clanId = 0;
  1556.             _clanCrestId = 0;
  1557.             _allyId = 0;
  1558. @@ -511,6 +518,18 @@
  1559.         return false;
  1560.     }
  1561.    
  1562. +   public boolean GameModeInfo()
  1563. +   {
  1564. +       if (Config.GAME_MODE_ENABLE)
  1565. +       {
  1566. +           if (_activeChar.isPVEMode())
  1567. +           {
  1568. +               return true;
  1569. +           }
  1570. +       }
  1571. +       return false;
  1572. +   }
  1573. +  
  1574.     @Override
  1575.     public String getType()
  1576.     {
  1577. diff --git src/l2jwins/game/network/serverpackets/UserInfo.java src/l2jwins/game/network/serverpackets/UserInfo.java
  1578. index e0a682f..ca47b8b 100644
  1579. --- src/l2jwins/game/network/serverpackets/UserInfo.java
  1580. +++ src/l2jwins/game/network/serverpackets/UserInfo.java
  1581. @@ -29,6 +29,9 @@
  1582.     private int _flyWalkSpd;
  1583.     private int _relation;
  1584.     private float _moveMultiplier;
  1585. +   private String _title;
  1586. +  
  1587. +   private int _titleColor;
  1588.    
  1589.     // Your own character info
  1590.     public UserInfo(L2PcInstance character)
  1591. @@ -52,6 +55,26 @@
  1592.         _walkSpd = (int) (_activeChar.getWalkSpeed() / _moveMultiplier);
  1593.         _swimRunSpd = _flRunSpd = _flyRunSpd = _runSpd;
  1594.         _swimWalkSpd = _flWalkSpd = _flyWalkSpd = _walkSpd;
  1595. +      
  1596. +       if (!GameModeInfo())
  1597. +       {
  1598. +           if (character.getAppearance().getInvisible())
  1599. +           {
  1600. +               _title = "Invisible";
  1601. +           }
  1602. +           else
  1603. +           {
  1604. +              
  1605. +               _title = _activeChar.getTitle();
  1606. +           }
  1607. +           _titleColor = character.getAppearance().getTitleColor();
  1608. +       }
  1609. +       else
  1610. +       {
  1611. +           _title = "PVE MODE";
  1612. +           _titleColor = 0x00FFFF;
  1613. +       }
  1614. +      
  1615.     }
  1616.    
  1617.     @Override
  1618. @@ -379,20 +402,15 @@
  1619.         writeD(_activeChar.getAppearance().getFace());
  1620.         writeD(_activeChar.isGM() ? 1 : 0); // builder level
  1621.        
  1622. -       String title = _activeChar.getTitle();
  1623. -       if (_activeChar.getAppearance().getInvisible() && _activeChar.isGM())
  1624. -       {
  1625. -           title = "Invisible";
  1626. -       }
  1627.         if (_activeChar.getPoly().isMorphed())
  1628.         {
  1629.             final L2NpcTemplate polyObj = NpcTable.getInstance().getTemplate(_activeChar.getPoly().getPolyId());
  1630.             if (polyObj != null)
  1631.             {
  1632. -               title += " - " + polyObj.name;
  1633. +               _title += " - " + polyObj.name;
  1634.             }
  1635.         }
  1636. -       writeS(title);
  1637. +       writeS(_title);
  1638.        
  1639.         writeD(_activeChar.getClanId());
  1640.         writeD(_activeChar.getClanCrestId());
  1641. @@ -461,7 +479,7 @@
  1642.         writeD(_activeChar.getPledgeClass()); // changes the text above CP on Status Window
  1643.         writeD(_activeChar.getPledgeType());
  1644.        
  1645. -       writeD(_activeChar.getAppearance().getTitleColor());
  1646. +       writeD(_titleColor);
  1647.        
  1648.         if (_activeChar.isCursedWeaponEquiped())
  1649.         {
  1650. @@ -515,6 +533,18 @@
  1651.         return false;
  1652.     }
  1653.    
  1654. +   public boolean GameModeInfo()
  1655. +   {
  1656. +       if (Config.GAME_MODE_ENABLE)
  1657. +       {
  1658. +           if (_activeChar.isPVEMode())
  1659. +           {
  1660. +               return true;
  1661. +           }
  1662. +       }
  1663. +       return false;
  1664. +   }
  1665. +  
  1666.     @Override
  1667.     public String getType()
  1668.     {
  1669.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement