SHOW:
|
|
- or go back to the newest paste.
1 | ### Eclipse Workspace Patch 1.0 | |
2 | #P aCis_gameserver405 | |
3 | diff --git config/GameModeSystem.properties config/GameModeSystem.properties | |
4 | new file mode 100644 | |
5 | index 0000000..f9226ad | |
6 | --- /dev/null | |
7 | +++ config/GameModeSystem.properties | |
8 | @@ -0,0 +1,17 @@ | |
9 | +#========================================================================== | |
10 | +# GAME MODE SYSTEM - PVE - PVP - NORMAL - WITH BONUS | |
11 | +#========================================================================== | |
12 | + | |
13 | +GameModeSystemEnable = True | |
14 | +PvPModeRateXp = 50 | |
15 | +PvPModeRateSp = 50 | |
16 | +PvPModeRateDropCurency = 50 | |
17 | +PvPModeRateDropSpoil = 50 | |
18 | +PvPModeRateDropItems = 50 | |
19 | +PvPModeRateRaidDropItems = 50 | |
20 | +NormalModeRateXp = 20 | |
21 | +NormalModeRateSp = 20 | |
22 | +NormalModeRateDropCurency = 20 | |
23 | +NormalModeRateDropSpoil = 20 | |
24 | +NormalModeRateDropItems = 20 | |
25 | +NormalModeRateRaidDropItems = 20 | |
26 | diff --git java/Base/GameModeSystem/ChangeModeManager.java java/Base/GameModeSystem/ChangeModeManager.java | |
27 | new file mode 100644 | |
28 | index 0000000..3f9e220 | |
29 | --- /dev/null | |
30 | +++ java/Base/GameModeSystem/ChangeModeManager.java | |
31 | @@ -0,0 +1,156 @@ | |
32 | +package Base.GameModeSystem; | |
33 | + | |
34 | +import net.sf.l2j.Config; | |
35 | +import net.sf.l2j.gameserver.enums.ZoneId; | |
36 | +import net.sf.l2j.gameserver.model.actor.Player; | |
37 | + | |
38 | +public class ChangeModeManager | |
39 | +{ | |
40 | + public static boolean verifyChangeMode(Player activeChar) | |
41 | + { | |
42 | + if (activeChar == null) | |
43 | + { | |
44 | + return false; | |
45 | + } | |
46 | + | |
47 | + if (!Config.GAME_MODE_ENABLE) | |
48 | + { | |
49 | + activeChar.sendMessage("El Change Mode System Esta Desactivado."); | |
50 | + return false; | |
51 | + } | |
52 | + | |
53 | + if (activeChar.isMoving()) | |
54 | + { | |
55 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Te Estas Moviendo"); | |
56 | + return false; | |
57 | + } | |
58 | + | |
59 | + if (activeChar.isInParty()) | |
60 | + { | |
61 | + activeChar.sendMessage("Sal De La Party Para Cambiar de Modo De Juego"); | |
62 | + return false; | |
63 | + } | |
64 | + | |
65 | + if (activeChar.isInDuel()) | |
66 | + { | |
67 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
68 | + return false; | |
69 | + } | |
70 | + | |
71 | + if (activeChar.isInArena()) | |
72 | + { | |
73 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
74 | + return false; | |
75 | + } | |
76 | + | |
77 | + | |
78 | + | |
79 | + if (activeChar.isInJail()) | |
80 | + { | |
81 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
82 | + return false; | |
83 | + } | |
84 | + | |
85 | + if (activeChar.isInPartyMatchRoom()) | |
86 | + { | |
87 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
88 | + return false; | |
89 | + } | |
90 | + | |
91 | + | |
92 | + | |
93 | + if (activeChar.isInsideZone(ZoneId.BOSS)) | |
94 | + { | |
95 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
96 | + return false; | |
97 | + } | |
98 | + | |
99 | + if (activeChar.isInsideZone(ZoneId.CASTLE)) | |
100 | + { | |
101 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
102 | + return false; | |
103 | + } | |
104 | + | |
105 | + if (activeChar.isInsideZone(ZoneId.DANGER_AREA)) | |
106 | + { | |
107 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
108 | + return false; | |
109 | + } | |
110 | + | |
111 | + | |
112 | + | |
113 | + if (activeChar.isInsideZone(ZoneId.NO_SUMMON_FRIEND)) | |
114 | + { | |
115 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
116 | + return false; | |
117 | + } | |
118 | + | |
119 | + if (activeChar.isInsideZone(ZoneId.JAIL)) | |
120 | + { | |
121 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
122 | + return false; | |
123 | + } | |
124 | + | |
125 | + if (activeChar.isInsideZone(ZoneId.MONSTER_TRACK)) | |
126 | + { | |
127 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
128 | + return false; | |
129 | + } | |
130 | + | |
131 | + | |
132 | + | |
133 | + if (activeChar.isInsideZone(ZoneId.PVP)) | |
134 | + { | |
135 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
136 | + return false; | |
137 | + } | |
138 | + | |
139 | + | |
140 | + | |
141 | + if (activeChar.isInsideZone(ZoneId.SIEGE)) | |
142 | + { | |
143 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
144 | + return false; | |
145 | + } | |
146 | + | |
147 | + if (activeChar.isInsideZone(ZoneId.NO_RESTART)) | |
148 | + { | |
149 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
150 | + return false; | |
151 | + } | |
152 | + | |
153 | + if (activeChar.isIn7sDungeon()) | |
154 | + { | |
155 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
156 | + return false; | |
157 | + } | |
158 | + | |
159 | + | |
160 | + | |
161 | + if (activeChar.isInOlympiadMode()) | |
162 | + { | |
163 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas En Olympiadas"); | |
164 | + return false; | |
165 | + } | |
166 | + | |
167 | + | |
168 | + | |
169 | + if (activeChar.isInObserverMode()) | |
170 | + { | |
171 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas en ObserverMode"); | |
172 | + return false; | |
173 | + } | |
174 | + | |
175 | + | |
176 | + | |
177 | + if (activeChar.isInCombat()) | |
178 | + { | |
179 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Si Estas en Combate"); | |
180 | + return false; | |
181 | + } | |
182 | + | |
183 | + | |
184 | + | |
185 | + return true; | |
186 | + } | |
187 | +} | |
188 | diff --git java/net/sf/l2j/Config.java java/net/sf/l2j/Config.java | |
189 | index 30397a1..7065ef2 100644 | |
190 | --- java/net/sf/l2j/Config.java | |
191 | +++ java/net/sf/l2j/Config.java | |
192 | @@ -33,32 +33,42 @@ | |
193 | public static final String LOGINSERVER_FILE = "./config/loginserver.properties"; | |
194 | public static final String NPCS_FILE = "./config/npcs.properties"; | |
195 | public static final String PLAYERS_FILE = "./config/players.properties"; | |
196 | + public static final String GAME_MODE_FILE = "./config/GameModeSystem.properties"; | |
197 | public static final String SERVER_FILE = "./config/server.properties"; | |
198 | public static final String SIEGE_FILE = "./config/siege.properties"; | |
199 | ||
200 | ||
201 | + // -------------------------------------------------- | |
202 | + // Game Mode System - PVE - PVP - NORMAL | |
203 | + // -------------------------------------------------- | |
204 | + public static boolean GAME_MODE_ENABLE; | |
205 | ||
206 | + public static double PVP_MODE_RATE_XP; | |
207 | + public static double PVP_MODE_RATE_SP; | |
208 | + public static double PVP_MODE_RATE_DROP_CURRENCY; | |
209 | + public static double PVP_MODE_RATE_DROP_SPOIL; | |
210 | + public static double PVP_MODE_RATE_DROP_ITEMS; | |
211 | + public static double PVP_MODE_RATE_DROP_ITEMS_BY_RAID; | |
212 | ||
213 | + public static double NORMAL_MODE_RATE_XP; | |
214 | + public static double NORMAL_MODE_RATE_SP; | |
215 | + public static double NORMAL_MODE_RATE_DROP_CURRENCY; | |
216 | + public static double NORMAL_MODE_RATE_DROP_SPOIL; | |
217 | + public static double NORMAL_MODE_RATE_DROP_ITEMS; | |
218 | + public static double NORMAL_MODE_RATE_DROP_ITEMS_BY_RAID; | |
219 | ||
220 | // -------------------------------------------------- | |
221 | // Clans settings | |
222 | // -------------------------------------------------- | |
223 | ||
224 | /** Clans */ | |
225 | public static int CLAN_JOIN_DAYS; | |
226 | public static int CLAN_CREATE_DAYS; | |
227 | @@ -835,6 +845,29 @@ | |
228 | } | |
229 | ||
230 | /** | |
231 | + * Loads GameModeSystem settings. | |
232 | + */ | |
233 | + private static final void loadGameMode() | |
234 | + { | |
235 | + final ExProperties gamemode = initProperties(GAME_MODE_FILE); | |
236 | + | |
237 | + GAME_MODE_ENABLE = gamemode.getProperty("GameModeSystemEnable", true); | |
238 | + PVP_MODE_RATE_XP = gamemode.getProperty("PvPModeRateXp", 2.); | |
239 | + PVP_MODE_RATE_SP = gamemode.getProperty("PvPModeRateSp", 2.); | |
240 | + PVP_MODE_RATE_DROP_CURRENCY = gamemode.getProperty("PvPModeRateDropCurency", 2.); | |
241 | + PVP_MODE_RATE_DROP_SPOIL = gamemode.getProperty("PvPModeRateDropSpoil", 2.); | |
242 | + PVP_MODE_RATE_DROP_ITEMS = gamemode.getProperty("PvPModeRateDropItems", 2.); | |
243 | + PVP_MODE_RATE_DROP_ITEMS_BY_RAID = gamemode.getProperty("PvPModeRateRaidDropItems", 2.); | |
244 | + NORMAL_MODE_RATE_XP = gamemode.getProperty("NormalModeRateXp", 2.); | |
245 | + NORMAL_MODE_RATE_SP = gamemode.getProperty("NormalModeRateSp", 2.); | |
246 | + NORMAL_MODE_RATE_DROP_CURRENCY = gamemode.getProperty("NormalModeRateDropCurency", 2.); | |
247 | + NORMAL_MODE_RATE_DROP_SPOIL = gamemode.getProperty("NormalModeRateDropSpoil", 2.); | |
248 | + NORMAL_MODE_RATE_DROP_ITEMS = gamemode.getProperty("NormalModeRateDropItems", 2.); | |
249 | + NORMAL_MODE_RATE_DROP_ITEMS_BY_RAID = gamemode.getProperty("NormalModeRateRaidDropItems", 2.); | |
250 | + | |
251 | + } | |
252 | + | |
253 | + /** | |
254 | * Loads hex ID settings. | |
255 | */ | |
256 | private static final void loadHexID() | |
257 | @@ -1292,6 +1323,9 @@ | |
258 | // geoengine settings | |
259 | loadGeoengine(); | |
260 | ||
261 | + // gamemode settings | |
262 | + loadGameMode(); | |
263 | + | |
264 | // hexID | |
265 | loadHexID(); | |
266 | ||
267 | diff --git java/net/sf/l2j/gameserver/enums/DropType.java java/net/sf/l2j/gameserver/enums/DropType.java | |
268 | index 57dbb7b..bcc057c 100644 | |
269 | --- java/net/sf/l2j/gameserver/enums/DropType.java | |
270 | +++ java/net/sf/l2j/gameserver/enums/DropType.java | |
271 | @@ -1,6 +1,8 @@ | |
272 | package net.sf.l2j.gameserver.enums; | |
273 | ||
274 | import net.sf.l2j.Config; | |
275 | +import net.sf.l2j.gameserver.model.actor.Npc; | |
276 | +import net.sf.l2j.gameserver.model.actor.Player; | |
277 | ||
278 | public enum DropType | |
279 | { | |
280 | @@ -9,17 +11,51 @@ | |
281 | DROP, | |
282 | HERB; | |
283 | ||
284 | - public double getDropRate(boolean isRaid) | |
285 | + public double getDropRate(Player player, Npc npc, boolean isRaid) | |
286 | { | |
287 | switch (this) | |
288 | { | |
289 | case SPOIL: | |
290 | + if (player.isPVPMode()) | |
291 | + { | |
292 | + return Config.PVP_MODE_RATE_DROP_SPOIL; | |
293 | + } | |
294 | + | |
295 | + if (player.isNormalMode()) | |
296 | + { | |
297 | + return Config.NORMAL_MODE_RATE_DROP_SPOIL; | |
298 | + } | |
299 | + | |
300 | return Config.RATE_DROP_SPOIL; | |
301 | ||
302 | case CURRENCY: | |
303 | + | |
304 | + if (player.isPVPMode()) | |
305 | + { | |
306 | + return Config.PVP_MODE_RATE_DROP_CURRENCY; | |
307 | + } | |
308 | + | |
309 | + if (player.isNormalMode()) | |
310 | + { | |
311 | + return Config.NORMAL_MODE_RATE_DROP_CURRENCY; | |
312 | + } | |
313 | + | |
314 | return Config.RATE_DROP_CURRENCY; | |
315 | ||
316 | case DROP: | |
317 | + | |
318 | + if (player.isPVPMode()) | |
319 | + { | |
320 | + if (isRaid) | |
321 | + return Config.PVP_MODE_RATE_DROP_ITEMS_BY_RAID; | |
322 | + } | |
323 | + | |
324 | + if (player.isNormalMode()) | |
325 | + { | |
326 | + if (isRaid) | |
327 | + return Config.NORMAL_MODE_RATE_DROP_ITEMS_BY_RAID; | |
328 | + } | |
329 | + | |
330 | return isRaid ? Config.RATE_DROP_ITEMS_BY_RAID : Config.RATE_DROP_ITEMS; | |
331 | ||
332 | case HERB: | |
333 | diff --git java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java | |
334 | index 35df73c..4dacb70 100644 | |
335 | --- java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java | |
336 | +++ java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java | |
337 | @@ -4,6 +4,7 @@ | |
338 | import java.util.Map; | |
339 | ||
340 | import net.sf.l2j.gameserver.handler.usercommandhandlers.DressMe; | |
341 | +import net.sf.l2j.gameserver.handler.voicedcommandhandlers.GameMode; | |
342 | ||
343 | public class VoicedCommandHandler | |
344 | { | |
345 | @@ -18,6 +19,7 @@ | |
346 | { | |
347 | //Codigos para colocar aqui dentro | |
348 | registerHandler(new DressMe()); | |
349 | + registerHandler(new GameMode()); | |
350 | ||
351 | } | |
352 | ||
353 | diff --git java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminInfo.java java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminInfo.java | |
354 | index 0dba20a..1924f58 100644 | |
355 | --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminInfo.java | |
356 | +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminInfo.java | |
357 | @@ -111,11 +111,11 @@ | |
358 | { | |
359 | final int page = (st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : 1; | |
360 | ||
361 | - sendDropInfos(targetNpc, html, page, subCommand.equalsIgnoreCase("drop")); | |
362 | + sendDropInfos(player, targetNpc, html, page, subCommand.equalsIgnoreCase("drop")); | |
363 | } | |
364 | catch (Exception e) | |
365 | { | |
366 | - sendDropInfos(targetNpc, html, 1, true); | |
367 | + sendDropInfos(player, targetNpc, html, 1, true); | |
368 | } | |
369 | break; | |
370 | ||
371 | @@ -289,12 +289,13 @@ | |
372 | ||
373 | /** | |
374 | * Feed a {@link NpcHtmlMessage} with <b>DROPS</b> or <b>SPOILS</b> informations regarding a {@link Npc}. | |
375 | + * @param player | |
376 | * @param npc : The {@link Npc} used as reference. | |
377 | * @param html : The {@link NpcHtmlMessage} used as reference. | |
378 | * @param page : The current page we are checking. | |
379 | * @param isDrop : If true, we check drops only. If false, we check spoils. | |
380 | */ | |
381 | - private static void sendDropInfos(Npc npc, NpcHtmlMessage html, int page, boolean isDrop) | |
382 | + private static void sendDropInfos(Player player, Npc npc, NpcHtmlMessage html, int page, boolean isDrop) | |
383 | { | |
384 | // Load static htm. | |
385 | html.setFile("data/html/admin/npcinfo/default.htm"); | |
386 | @@ -305,7 +306,7 @@ | |
387 | final Pagination<DropCategory> list = new Pagination<>(npc.getTemplate().getDropData().stream(), page, PAGE_LIMIT_1, dc -> (isDrop) ? dc.getDropType() != DropType.SPOIL : dc.getDropType() == DropType.SPOIL); | |
388 | for (DropCategory category : list) | |
389 | { | |
390 | - double catChance = category.getChance() * category.getDropType().getDropRate(npc.isRaidBoss()); | |
391 | + double catChance = category.getChance() * category.getDropType().getDropRate(player, npc, npc.isRaidBoss()); | |
392 | double chanceMultiplier = 1; | |
393 | double countMultiplier = 1; | |
394 | ||
395 | diff --git java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/GameMode.java java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/GameMode.java | |
396 | new file mode 100644 | |
397 | index 0000000..3d5d529 | |
398 | --- /dev/null | |
399 | +++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/GameMode.java | |
400 | @@ -0,0 +1,311 @@ | |
401 | +package net.sf.l2j.gameserver.handler.voicedcommandhandlers; | |
402 | + | |
403 | +import java.sql.Connection; | |
404 | +import java.sql.PreparedStatement; | |
405 | +import java.sql.SQLException; | |
406 | + | |
407 | +import net.sf.l2j.commons.pool.ConnectionPool; | |
408 | + | |
409 | +import net.sf.l2j.Config; | |
410 | +import net.sf.l2j.gameserver.enums.ZoneId; | |
411 | +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler; | |
412 | +import net.sf.l2j.gameserver.model.World; | |
413 | +import net.sf.l2j.gameserver.model.actor.Player; | |
414 | +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; | |
415 | +import net.sf.l2j.gameserver.taskmanager.PvpFlagTaskManager; | |
416 | + | |
417 | +public class GameMode implements IVoicedCommandHandler | |
418 | +{ | |
419 | + private static final String[] VOICED_COMMANDS = | |
420 | + { | |
421 | + "pve", | |
422 | + "pvp", | |
423 | + "normal", | |
424 | + "mode" | |
425 | + }; | |
426 | + | |
427 | + @Override | |
428 | + public boolean useVoicedCommand(String command, Player activeChar, String params) | |
429 | + { | |
430 | + if (activeChar == null) | |
431 | + { | |
432 | + return false; | |
433 | + } | |
434 | + | |
435 | + if (!Config.GAME_MODE_ENABLE) | |
436 | + { | |
437 | + activeChar.sendMessage("El Change Mode System Esta Desactivado."); | |
438 | + return false; | |
439 | + } | |
440 | + | |
441 | + if (activeChar.isMoving()) | |
442 | + { | |
443 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Te Estas Moviendo"); | |
444 | + return false; | |
445 | + } | |
446 | + | |
447 | + if (activeChar.isInParty()) | |
448 | + { | |
449 | + | |
450 | + activeChar.sendMessage("Sal De La Party Para Cambiar de Modo De Juego"); | |
451 | + return false; | |
452 | + } | |
453 | + | |
454 | + if (activeChar.isInDuel()) | |
455 | + { | |
456 | + | |
457 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
458 | + return false; | |
459 | + } | |
460 | + | |
461 | + if (activeChar.isInArena()) | |
462 | + { | |
463 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
464 | + return false; | |
465 | + } | |
466 | + | |
467 | + if (activeChar.isInJail()) | |
468 | + { | |
469 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
470 | + return false; | |
471 | + } | |
472 | + | |
473 | + if (activeChar.isInPartyMatchRoom()) | |
474 | + { | |
475 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
476 | + return false; | |
477 | + } | |
478 | + | |
479 | + if (activeChar.isInsideZone(ZoneId.BOSS)) | |
480 | + { | |
481 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
482 | + return false; | |
483 | + } | |
484 | + | |
485 | + if (activeChar.isInsideZone(ZoneId.CASTLE)) | |
486 | + { | |
487 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
488 | + return false; | |
489 | + } | |
490 | + | |
491 | + if (activeChar.isInsideZone(ZoneId.DANGER_AREA)) | |
492 | + { | |
493 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
494 | + return false; | |
495 | + } | |
496 | + | |
497 | + if (activeChar.isInsideZone(ZoneId.NO_SUMMON_FRIEND)) | |
498 | + { | |
499 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
500 | + return false; | |
501 | + } | |
502 | + | |
503 | + if (activeChar.isInsideZone(ZoneId.JAIL)) | |
504 | + { | |
505 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
506 | + return false; | |
507 | + } | |
508 | + | |
509 | + if (activeChar.isInsideZone(ZoneId.MONSTER_TRACK)) | |
510 | + { | |
511 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
512 | + return false; | |
513 | + } | |
514 | + | |
515 | + if (activeChar.isInsideZone(ZoneId.PVP)) | |
516 | + { | |
517 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
518 | + return false; | |
519 | + } | |
520 | + | |
521 | + if (activeChar.isInsideZone(ZoneId.SIEGE)) | |
522 | + { | |
523 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
524 | + return false; | |
525 | + } | |
526 | + | |
527 | + if (activeChar.isInsideZone(ZoneId.NO_RESTART)) | |
528 | + { | |
529 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
530 | + return false; | |
531 | + } | |
532 | + | |
533 | + if (activeChar.isIn7sDungeon()) | |
534 | + { | |
535 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Ahora"); | |
536 | + return false; | |
537 | + } | |
538 | + | |
539 | + if (activeChar.isInOlympiadMode()) | |
540 | + { | |
541 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas En Olympiadas"); | |
542 | + return false; | |
543 | + } | |
544 | + | |
545 | + if (activeChar.isInObserverMode()) | |
546 | + { | |
547 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego SI Estas ObserverMode"); | |
548 | + return false; | |
549 | + } | |
550 | + | |
551 | + if ((activeChar.isInCombat())) | |
552 | + { | |
553 | + activeChar.sendMessage("No Puedes Cambiar El Modo De Juego Si Estas En Combate"); | |
554 | + return false; | |
555 | + } | |
556 | + | |
557 | + if (command.equalsIgnoreCase(VOICED_COMMANDS[0])) | |
558 | + { // PVE Mode | |
559 | + | |
560 | + if (activeChar.isPVEMode()) | |
561 | + { | |
562 | + activeChar.sendMessage("Ya estas en el modo PVE."); | |
563 | + return false; | |
564 | + } | |
565 | + | |
566 | + if (activeChar.getPvpFlag() == 0 && activeChar.getKarma() == 0) | |
567 | + { | |
568 | + activeChar.setPVEMode(true); | |
569 | + activeChar.setGameModeService(0); | |
570 | + activeChar.setPVPMode(false); | |
571 | + activeChar.setNormalMode(false); | |
572 | + setActiveCharGameMode(activeChar, "PVE MODE"); | |
573 | + activeChar.sendMessage("Has cambiado al modo PVE. - No Podran Matarte Otros Jugadores"); | |
574 | + activeChar.sendMessage("Tampoco Podras Atacar a Otros Jugadores - No Obtendras El Bonus"); | |
575 | + activeChar.decayMe(); | |
576 | + World.getInstance().addPlayer(activeChar); | |
577 | + activeChar.broadcastUserInfo(); | |
578 | + activeChar.spawnMe(); | |
579 | + return true; | |
580 | + } | |
581 | + activeChar.sendMessage(" Estas con Flag o Tienes Karma No puedes Activar el modo PvE Con Karma o Flag"); | |
582 | + return false; | |
583 | + | |
584 | + } | |
585 | + else if (command.equalsIgnoreCase(VOICED_COMMANDS[1])) | |
586 | + { // PVP Mode | |
587 | + | |
588 | + if (activeChar.isPVPMode()) | |
589 | + { | |
590 | + activeChar.sendMessage("Ya estas en el modo PVP."); | |
591 | + return false; | |
592 | + } | |
593 | + | |
594 | + if (activeChar.getStatus().getLevel() < 76 && !activeChar.isGM()) | |
595 | + { | |
596 | + activeChar.sendMessage("Necesitas Minimo Ser LvL 76 Para Activar El Modo PvP"); | |
597 | + return false; | |
598 | + } | |
599 | + | |
600 | + if (!activeChar.isInsideZone(ZoneId.TOWN) && !activeChar.isGM()) | |
601 | + { | |
602 | + activeChar.sendMessage("Solo Puedes Cambiar El Modo En Una Ciudad."); | |
603 | + return false; | |
604 | + } | |
605 | + | |
606 | + activeChar.updatePvPFlag(1); | |
607 | + activeChar.setPVEMode(false); | |
608 | + activeChar.setPVPMode(true); | |
609 | + activeChar.setGameModeService(1); | |
610 | + activeChar.setNormalMode(false); | |
611 | + setActiveCharGameMode(activeChar, "PVP MODE"); | |
612 | + activeChar.sendMessage("Has cambiado al modo PVP. - Obtendras un Bonus de 50%"); | |
613 | + activeChar.decayMe(); | |
614 | + World.getInstance().addPlayer(activeChar); | |
615 | + activeChar.broadcastUserInfo(); | |
616 | + activeChar.spawnMe(); | |
617 | + return true; | |
618 | + } | |
619 | + else if (command.equalsIgnoreCase(VOICED_COMMANDS[2])) | |
620 | + { | |
621 | + | |
622 | + if (activeChar.isNormalMode()) | |
623 | + { | |
624 | + activeChar.sendMessage("Ya estas en el modo Normal."); | |
625 | + return false; | |
626 | + } | |
627 | + | |
628 | + if (!activeChar.isInsideZone(ZoneId.TOWN) && !activeChar.isGM()) | |
629 | + { | |
630 | + activeChar.sendMessage("Solo Puedes Cambiar El Modo En Una Ciudad."); | |
631 | + return false; | |
632 | + } | |
633 | + | |
634 | + if (activeChar.getPvpFlag() > 0) | |
635 | + { | |
636 | + | |
637 | + PvpFlagTaskManager.getInstance().add(activeChar, Config.PVP_NORMAL_TIME); | |
638 | + | |
639 | + activeChar.updatePvPFlag(1); | |
640 | + activeChar.setPVEMode(false); | |
641 | + activeChar.setPVPMode(false); | |
642 | + activeChar.setNormalMode(true); | |
643 | + activeChar.setGameModeService(2); | |
644 | + activeChar.sendMessage("Has cambiado al modo Normal. - Obtendras un Bonus de 20%"); | |
645 | + | |
646 | + setActiveCharGameMode(activeChar, "NORMAL MODE"); | |
647 | + activeChar.decayMe(); | |
648 | + World.getInstance().addPlayer(activeChar); | |
649 | + activeChar.broadcastUserInfo(); | |
650 | + activeChar.spawnMe(); | |
651 | + | |
652 | + } | |
653 | + else | |
654 | + { | |
655 | + | |
656 | + activeChar.setPVEMode(false); | |
657 | + activeChar.setPVPMode(false); | |
658 | + activeChar.setNormalMode(true); | |
659 | + activeChar.setGameModeService(2); | |
660 | + setActiveCharGameMode(activeChar, "NORMAL MODE"); | |
661 | + activeChar.sendMessage("Has cambiado al modo Normal. - Obtendras un Bonus de 20%"); | |
662 | + activeChar.decayMe(); | |
663 | + World.getInstance().addPlayer(activeChar); | |
664 | + activeChar.broadcastUserInfo(); | |
665 | + activeChar.spawnMe(); | |
666 | + return true; | |
667 | + } | |
668 | + | |
669 | + } | |
670 | + | |
671 | + else if (command.equalsIgnoreCase(VOICED_COMMANDS[3])) | |
672 | + { // PVP Mode | |
673 | + showModeSystemHTML(activeChar); | |
674 | + return true; | |
675 | + } | |
676 | + | |
677 | + return false; | |
678 | + } | |
679 | + | |
680 | + private static void setActiveCharGameMode(Player activeChar, String gameMode) | |
681 | + { | |
682 | + try (Connection con = ConnectionPool.getConnection()) | |
683 | + { | |
684 | + String sql = "REPLACE INTO Character_Game_Mode (object_id, char_name, game_mode) VALUES (?, ?, ?)"; | |
685 | + try (PreparedStatement ps = con.prepareStatement(sql)) | |
686 | + { | |
687 | + ps.setInt(1, activeChar.getObjectId()); | |
688 | + ps.setString(2, activeChar.getName()); | |
689 | + ps.setString(3, gameMode); | |
690 | + ps.execute(); | |
691 | + } | |
692 | + } | |
693 | + catch (SQLException e) | |
694 | + { | |
695 | + // Manejo de excepciones | |
696 | + } | |
697 | + } | |
698 | + | |
699 | + private static void showModeSystemHTML(Player player) | |
700 | + { | |
701 | + NpcHtmlMessage html = new NpcHtmlMessage(0); | |
702 | + html.setFile("data/html/mods/ChangeModeSystem/ModeSystem.htm"); | |
703 | + player.sendPacket(html); | |
704 | + } | |
705 | + | |
706 | + @Override | |
707 | + public String[] getVoicedCommandList() | |
708 | + { | |
709 | + return VOICED_COMMANDS; | |
710 | + } | |
711 | +} | |
712 | diff --git java/net/sf/l2j/gameserver/model/actor/Creature.java java/net/sf/l2j/gameserver/model/actor/Creature.java | |
713 | index 44a34c5..0928279 100644 | |
714 | --- java/net/sf/l2j/gameserver/model/actor/Creature.java | |
715 | +++ java/net/sf/l2j/gameserver/model/actor/Creature.java | |
716 | @@ -117,6 +117,7 @@ | |
717 | ||
718 | private final Map<Integer, Long> _disabledSkills = new ConcurrentHashMap<>(); | |
719 | private boolean _allSkillsDisabled; | |
720 | + private int _GameModeService; | |
721 | ||
722 | public Creature(int objectId, CreatureTemplate template) | |
723 | { | |
724 | @@ -1791,6 +1792,16 @@ | |
725 | setTarget(null); | |
726 | } | |
727 | ||
728 | + public void setGameModeService(int premiumService) | |
729 | + { | |
730 | + _GameModeService = premiumService; | |
731 | + } | |
732 | + | |
733 | + public int getGameModeService() | |
734 | + { | |
735 | + return _GameModeService; | |
736 | + } | |
737 | + | |
738 | /** | |
739 | * @return The {@link List} of GMs {@link Player}s in surrounding regions. | |
740 | */ | |
741 | diff --git java/net/sf/l2j/gameserver/model/actor/Npc.java java/net/sf/l2j/gameserver/model/actor/Npc.java | |
742 | index 16013ae..4c736eb 100644 | |
743 | --- java/net/sf/l2j/gameserver/model/actor/Npc.java | |
744 | +++ java/net/sf/l2j/gameserver/model/actor/Npc.java | |
745 | @@ -874,18 +874,40 @@ | |
746 | } | |
747 | ||
748 | /** | |
749 | + * @param GameMode | |
750 | * @return The Exp reward of this {@link Npc} based on its {@link NpcTemplate} and modified by {@link Config#RATE_XP}. | |
751 | */ | |
752 | - public int getExpReward() | |
753 | + public int getExpReward(int GameMode) | |
754 | { | |
755 | + if (GameMode == 1) | |
756 | + { | |
757 | + return (int) (getTemplate().getRewardExp() * Config.PVP_MODE_RATE_XP); | |
758 | + } | |
759 | + | |
760 | + if (GameMode == 2) | |
761 | + { | |
762 | + return (int) (getTemplate().getRewardExp() * Config.NORMAL_MODE_RATE_XP); | |
763 | + } | |
764 | + | |
765 | return (int) (getTemplate().getRewardExp() * Config.RATE_XP); | |
766 | } | |
767 | ||
768 | /** | |
769 | + * @param GameMode | |
770 | * @return The SP reward of this {@link Npc} based on its {@link NpcTemplate} and modified by {@link Config#RATE_SP}. | |
771 | */ | |
772 | - public int getSpReward() | |
773 | + public int getSpReward(int GameMode) | |
774 | { | |
775 | + if (GameMode == 1) | |
776 | + { | |
777 | + return (int) (getTemplate().getRewardExp() * Config.PVP_MODE_RATE_SP); | |
778 | + } | |
779 | + | |
780 | + if (GameMode == 2) | |
781 | + { | |
782 | + return (int) (getTemplate().getRewardExp() * Config.NORMAL_MODE_RATE_SP); | |
783 | + } | |
784 | + | |
785 | return (int) (getTemplate().getRewardSp() * Config.RATE_SP); | |
786 | } | |
787 | ||
788 | diff --git java/net/sf/l2j/gameserver/model/actor/Playable.java java/net/sf/l2j/gameserver/model/actor/Playable.java | |
789 | index 525de4a..bf420f5 100644 | |
790 | --- java/net/sf/l2j/gameserver/model/actor/Playable.java | |
791 | +++ java/net/sf/l2j/gameserver/model/actor/Playable.java | |
792 | @@ -354,6 +354,13 @@ | |
793 | if (isInSameActiveOlympiadMatch(targetPlayer)) | |
794 | return true; | |
795 | ||
796 | + // Check if either the caster or the target is in PvE mode. | |
797 | + if (getActingPlayer().isPVEMode() || targetPlayer.isPVEMode()) | |
798 | + { | |
799 | + | |
800 | + return false; | |
801 | + } | |
802 | + | |
803 | // No checks for players in Duel. | |
804 | if (isInSameActiveDuel(targetPlayer)) | |
805 | return true; | |
806 | diff --git java/net/sf/l2j/gameserver/model/actor/Player.java java/net/sf/l2j/gameserver/model/actor/Player.java | |
807 | index 35bca86..de81940 100644 | |
808 | --- java/net/sf/l2j/gameserver/model/actor/Player.java | |
809 | +++ java/net/sf/l2j/gameserver/model/actor/Player.java | |
810 | @@ -3,6 +3,7 @@ | |
811 | import java.sql.Connection; | |
812 | import java.sql.PreparedStatement; | |
813 | import java.sql.ResultSet; | |
814 | +import java.sql.SQLException; | |
815 | import java.util.ArrayList; | |
816 | import java.util.Arrays; | |
817 | import java.util.Collection; | |
818 | @@ -490,6 +475,10 @@ | |
819 | ||
820 | private int _mailPosition; | |
821 | ||
822 | + private boolean isPVEMode = false; | |
823 | + private boolean isPVPMode = false; | |
824 | + private boolean isNormalMode = false; | |
825 | + | |
826 | private static final int FALLING_VALIDATION_DELAY = 10000; | |
827 | private volatile long _fallingTimestamp; | |
828 | ||
829 | ||
830 | @@ -7469,6 +7445,61 @@ | |
831 | return formal != null && formal.getItem().getBodyPart() == Item.SLOT_ALLDRESS; | |
832 | } | |
833 | ||
834 | + public boolean isPVEMode() | |
835 | + { | |
836 | + return isPVEMode; | |
837 | + } | |
838 | + | |
839 | + public void setPVEMode(boolean b) | |
840 | + { | |
841 | + isPVEMode = b; | |
842 | + } | |
843 | + | |
844 | + public boolean isPVPMode() | |
845 | + { | |
846 | + return isPVPMode; | |
847 | + } | |
848 | + | |
849 | + public void setPVPMode(boolean b) | |
850 | + { | |
851 | + isPVPMode = b; | |
852 | + } | |
853 | + | |
854 | + public boolean isNormalMode() | |
855 | + { | |
856 | + return isNormalMode; | |
857 | + } | |
858 | + | |
859 | + public void setNormalMode(boolean b) | |
860 | + { | |
861 | + isNormalMode = b; | |
862 | + } | |
863 | + | |
864 | + public String getGameMode() | |
865 | + { | |
866 | + try (Connection con = ConnectionPool.getConnection()) | |
867 | + { | |
868 | + String sql = "SELECT game_mode FROM Character_Game_Mode WHERE object_id = ?"; | |
869 | + try (PreparedStatement ps = con.prepareStatement(sql)) | |
870 | + { | |
871 | + ps.setInt(1, getObjectId()); | |
872 | + try (ResultSet rs = ps.executeQuery()) | |
873 | + { | |
874 | + if (rs.next()) | |
875 | + { | |
876 | + return rs.getString("game_mode"); | |
877 | + } | |
878 | + } | |
879 | + } | |
880 | + } | |
881 | + catch (SQLException e) | |
882 | + { | |
883 | + // Manejo de excepciones | |
884 | + } | |
885 | + | |
886 | + return "Desconocido"; | |
887 | + } | |
888 | + | |
889 | public final void startFakeDeath() | |
890 | { | |
891 | _isFakeDeath = true; | |
892 | ||
893 | \ No newline at end of file | |
894 | diff --git java/net/sf/l2j/gameserver/model/actor/attack/PlayableAttack.java java/net/sf/l2j/gameserver/model/actor/attack/PlayableAttack.java | |
895 | index d264edd..28f35e3 100644 | |
896 | --- java/net/sf/l2j/gameserver/model/actor/attack/PlayableAttack.java | |
897 | +++ java/net/sf/l2j/gameserver/model/actor/attack/PlayableAttack.java | |
898 | @@ -31,6 +31,14 @@ | |
899 | return false; | |
900 | } | |
901 | ||
902 | + if (_actor.getActingPlayer().isPVEMode()) | |
903 | + { | |
904 | + | |
905 | + _actor.sendMessage("Desactiva El Modo PvE Para Atacar A Otros Jugadores"); | |
906 | + return false; | |
907 | + | |
908 | + } | |
909 | + | |
910 | if (target.isInsideZone(ZoneId.PEACE)) | |
911 | { | |
912 | _actor.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.TARGET_IN_PEACEZONE)); | |
913 | diff --git java/net/sf/l2j/gameserver/model/actor/instance/Monster.java java/net/sf/l2j/gameserver/model/actor/instance/Monster.java | |
914 | index c2e7083..4641f6e 100644 | |
915 | --- java/net/sf/l2j/gameserver/model/actor/instance/Monster.java | |
916 | +++ java/net/sf/l2j/gameserver/model/actor/instance/Monster.java | |
917 | @@ -150,7 +150,7 @@ | |
918 | { | |
919 | final int levelDiff = attacker.getStatus().getLevel() - getStatus().getLevel(); | |
920 | final float penalty = (attacker.hasServitor()) ? ((Servitor) attacker.getSummon()).getExpPenalty() : 0; | |
921 | - final int[] expSp = calculateExpAndSp(levelDiff, damage, totalDamage); | |
922 | + final int[] expSp = calculateExpAndSp(attacker, levelDiff, damage, totalDamage, attacker.getGameModeService()); | |
923 | ||
924 | long exp = expSp[0]; | |
925 | int sp = expSp[1]; | |
926 | @@ -222,10 +222,24 @@ | |
927 | final int levelDiff = partyLvl - getStatus().getLevel(); | |
928 | ||
929 | // Calculate Exp and SP rewards. | |
930 | - final int[] expSp = calculateExpAndSp(levelDiff, partyDmg, totalDamage); | |
931 | + final int[] expSpPvPMode = calculateExpAndSp(attacker, levelDiff, partyDmg, totalDamage, 1); | |
932 | + long exp_pvp_mode = expSpPvPMode[0]; | |
933 | + int sp_pvp_mode = expSpPvPMode[1]; | |
934 | + | |
935 | + // Calculate Exp and SP rewards. | |
936 | + final int[] expSpNormalMode = calculateExpAndSp(attacker, levelDiff, partyDmg, totalDamage, 2); | |
937 | + long exp_normal_mode = expSpNormalMode[0]; | |
938 | + int sp_normal_mode = expSpNormalMode[1]; | |
939 | + | |
940 | + // Calculate Exp and SP rewards. | |
941 | + final int[] expSp = calculateExpAndSp(attacker, levelDiff, partyDmg, totalDamage, 0); | |
942 | long exp = expSp[0]; | |
943 | int sp = expSp[1]; | |
944 | ||
945 | + exp_pvp_mode *= partyMul; | |
946 | + sp_pvp_mode *= partyMul; | |
947 | + exp_normal_mode *= partyMul; | |
948 | + sp_normal_mode *= partyMul; | |
949 | exp *= partyMul; | |
950 | sp *= partyMul; | |
951 | ||
952 | @@ -234,11 +248,13 @@ | |
953 | { | |
954 | attacker.sendPacket(SystemMessageId.OVER_HIT); | |
955 | exp += _overhitState.calculateOverhitExp(exp); | |
956 | + exp_pvp_mode += _overhitState.calculateOverhitExp(exp_pvp_mode); | |
957 | + exp_normal_mode += _overhitState.calculateOverhitExp(exp_normal_mode); | |
958 | } | |
959 | ||
960 | // Distribute Experience and SP rewards to Player Party members in the known area of the last attacker. | |
961 | if (partyDmg > 0) | |
962 | - attackerParty.distributeXpAndSp(exp, sp, rewardedMembers, partyLvl, playersWithPets); | |
963 | + attackerParty.distributeXpAndSp(exp_pvp_mode, sp_pvp_mode, exp_normal_mode, sp_normal_mode, exp, sp, rewardedMembers, partyLvl, playersWithPets); | |
964 | } | |
965 | } | |
966 | } | |
967 | @@ -391,16 +407,18 @@ | |
968 | ||
969 | /** | |
970 | * Calculate the XP and SP to distribute to the attacker of the {@link Monster}. | |
971 | + * @param player | |
972 | * @param diff : The difference of level between the attacker and the {@link Monster}. | |
973 | * @param damage : The damages done by the attacker. | |
974 | * @param totalDamage : The total damage done. | |
975 | + * @param GameMode | |
976 | * @return an array consisting of xp and sp values. | |
977 | */ | |
978 | - private int[] calculateExpAndSp(int diff, int damage, long totalDamage) | |
979 | + private int[] calculateExpAndSp(Player player, int diff, int damage, long totalDamage, int GameMode) | |
980 | { | |
981 | // Calculate damage ratio. | |
982 | - double xp = (double) getExpReward() * damage / totalDamage; | |
983 | - double sp = (double) getSpReward() * damage / totalDamage; | |
984 | + double xp = (double) getExpReward(GameMode) * damage / totalDamage; | |
985 | + double sp = (double) getSpReward(GameMode) * damage / totalDamage; | |
986 | ||
987 | // Calculate level ratio. | |
988 | if (diff > 5) | |
989 | @@ -410,6 +428,18 @@ | |
990 | sp = sp * pow; | |
991 | } | |
992 | ||
993 | + if (player.getGameModeService() == 1) | |
994 | + { | |
995 | + xp *= Config.PVP_MODE_RATE_XP; | |
996 | + sp *= Config.PVP_MODE_RATE_SP; | |
997 | + } | |
998 | + | |
999 | + if (player.getGameModeService() == 2) | |
1000 | + { | |
1001 | + xp *= Config.NORMAL_MODE_RATE_XP; | |
1002 | + sp *= Config.NORMAL_MODE_RATE_SP; | |
1003 | + } | |
1004 | + | |
1005 | // If the XP is inferior or equals 0, don't reward any SP. Both XP and SP can't be inferior to 0. | |
1006 | if (xp <= 0) | |
1007 | { | |
1008 | @@ -483,7 +513,7 @@ | |
1009 | continue; | |
1010 | ||
1011 | // Calculate drops of this category. | |
1012 | - for (IntIntHolder drop : category.calculateDrop(levelMultiplier, isRaid)) | |
1013 | + for (IntIntHolder drop : category.calculateDrop(player, this, levelMultiplier, isRaid)) | |
1014 | { | |
1015 | if (type == DropType.SPOIL) | |
1016 | getSpoilState().add(drop); | |
1017 | diff --git java/net/sf/l2j/gameserver/model/group/Party.java java/net/sf/l2j/gameserver/model/group/Party.java | |
1018 | index f697b7d..bacb259 100644 | |
1019 | --- java/net/sf/l2j/gameserver/model/group/Party.java | |
1020 | +++ java/net/sf/l2j/gameserver/model/group/Party.java | |
1021 | @@ -628,13 +628,17 @@ | |
1022 | * <FONT COLOR=#FF0000><B> <U>Caution</U> : This method DOESN'T GIVE rewards to Pet</B></FONT><BR> | |
1023 | * <BR> | |
1024 | * Exception are Pets that leech from the owner's XP; they get the exp indirectly, via the owner's exp gain.<BR> | |
1025 | + * @param xpReward_pvp_mode | |
1026 | + * @param spReward_pvp_mode | |
1027 | + * @param xpReward_normal_mode | |
1028 | + * @param spReward_normal_mode | |
1029 | * @param xpReward : The Experience reward to distribute. | |
1030 | * @param spReward : The SP reward to distribute. | |
1031 | * @param rewardedMembers : The {@link Player}s' {@link List} to reward. | |
1032 | * @param topLvl : The maximum level. | |
1033 | * @param rewards : The {@link Map} of {@link Creature}s and {@link RewardInfo}. | |
1034 | */ | |
1035 | - public void distributeXpAndSp(long xpReward, int spReward, List<Player> rewardedMembers, int topLvl, Map<Creature, RewardInfo> rewards) | |
1036 | + 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) | |
1037 | { | |
1038 | final List<Player> validMembers = new ArrayList<>(); | |
1039 | ||
1040 | @@ -681,7 +685,13 @@ | |
1041 | ||
1042 | xpReward *= partyRate * Config.RATE_PARTY_XP; | |
1043 | spReward *= partyRate * Config.RATE_PARTY_SP; | |
1044 | + xpReward_pvp_mode *= partyRate * Config.RATE_PARTY_XP; | |
1045 | + spReward_pvp_mode *= partyRate * Config.RATE_PARTY_SP; | |
1046 | + xpReward_normal_mode *= partyRate * Config.RATE_PARTY_XP; | |
1047 | + spReward_normal_mode *= partyRate * Config.RATE_PARTY_SP; | |
1048 | ||
1049 | + long xpRew = 0; | |
1050 | + int spRew = 0; | |
1051 | int sqLevelSum = 0; | |
1052 | for (Player member : validMembers) | |
1053 | sqLevelSum += member.getStatus().getLevel() * member.getStatus().getLevel(); | |
1054 | @@ -692,6 +702,24 @@ | |
1055 | if (member.isDead()) | |
1056 | continue; | |
1057 | ||
1058 | + if (member.getGameModeService() == 0) | |
1059 | + { | |
1060 | + xpRew = xpReward; | |
1061 | + spRew = spReward; | |
1062 | + } | |
1063 | + | |
1064 | + if (member.getGameModeService() == 1) | |
1065 | + { | |
1066 | + xpRew = xpReward_pvp_mode; | |
1067 | + spRew = spReward_pvp_mode; | |
1068 | + } | |
1069 | + | |
1070 | + if (member.getGameModeService() == 2) | |
1071 | + { | |
1072 | + xpRew = xpReward_normal_mode; | |
1073 | + spRew = spReward_normal_mode; | |
1074 | + } | |
1075 | + | |
1076 | // Calculate and add the EXP and SP reward to the member. | |
1077 | if (validMembers.contains(member)) | |
1078 | { | |
1079 | @@ -701,8 +729,8 @@ | |
1080 | final double sqLevel = member.getStatus().getLevel() * member.getStatus().getLevel(); | |
1081 | final double preCalculation = (sqLevel / sqLevelSum) * (1 - penalty); | |
1082 | ||
1083 | - final long xp = Math.round(xpReward * preCalculation); | |
1084 | - final int sp = (int) (spReward * preCalculation); | |
1085 | + final long xp = Math.round(xpRew * preCalculation); | |
1086 | + final int sp = (int) (spRew * preCalculation); | |
1087 | ||
1088 | // Set new karma. | |
1089 | member.updateKarmaLoss(xp); | |
1090 | diff --git java/net/sf/l2j/gameserver/model/item/DropCategory.java java/net/sf/l2j/gameserver/model/item/DropCategory.java | |
1091 | index 0d43736..d059fb6 100644 | |
1092 | --- java/net/sf/l2j/gameserver/model/item/DropCategory.java | |
1093 | +++ java/net/sf/l2j/gameserver/model/item/DropCategory.java | |
1094 | @@ -7,6 +7,8 @@ | |
1095 | import net.sf.l2j.commons.random.Rnd; | |
1096 | ||
1097 | import net.sf.l2j.gameserver.enums.DropType; | |
1098 | +import net.sf.l2j.gameserver.model.actor.Player; | |
1099 | +import net.sf.l2j.gameserver.model.actor.instance.Monster; | |
1100 | import net.sf.l2j.gameserver.model.holder.IntIntHolder; | |
1101 | ||
1102 | public class DropCategory | |
1103 | @@ -68,14 +70,16 @@ | |
1104 | ||
1105 | /** | |
1106 | * Calculates drops of this {@link DropCategory}. | |
1107 | + * @param player | |
1108 | + * @param monster | |
1109 | * @param levelMultiplier : The input level modifier of the last attacker. | |
1110 | * @param raid : The NPC is raid boss. | |
1111 | * @return The list of {@link IntIntHolder} holding item ID and item count. | |
1112 | */ | |
1113 | - public List<IntIntHolder> calculateDrop(double levelMultiplier, boolean raid) | |
1114 | + public List<IntIntHolder> calculateDrop(Player player, Monster monster, double levelMultiplier, boolean raid) | |
1115 | { | |
1116 | // Get base category chance and apply level multiplier and drop rate config based on type. | |
1117 | - double chance = getChance() * levelMultiplier * getDropType().getDropRate(raid) * DropData.MAX_CHANCE / 100; | |
1118 | + double chance = getChance() * levelMultiplier * getDropType().getDropRate(player, monster, raid) * DropData.MAX_CHANCE / 100; | |
1119 | ||
1120 | // Check chance exceeding 100% limit and calculate drop chance multiplier. | |
1121 | double multiplier; | |
1122 | diff --git java/net/sf/l2j/gameserver/network/clientpackets/AttackRequest.java java/net/sf/l2j/gameserver/network/clientpackets/AttackRequest.java | |
1123 | index 288946d..23be218 100644 | |
1124 | --- java/net/sf/l2j/gameserver/network/clientpackets/AttackRequest.java | |
1125 | +++ java/net/sf/l2j/gameserver/network/clientpackets/AttackRequest.java | |
1126 | @@ -54,6 +54,22 @@ | |
1127 | return; | |
1128 | } | |
1129 | ||
1130 | + // Check if target is in PVE mode | |
1131 | + if (target instanceof Player && ((Player) target).isPVEMode() && !player.isGM()) | |
1132 | + { | |
1133 | + player.sendMessage("El Usuario: " + target.getName() + " esta en modo PvE"); | |
1134 | + player.sendPacket(ActionFailed.STATIC_PACKET); | |
1135 | + return; | |
1136 | + } | |
1137 | + | |
1138 | + // Check if attacker is in PVE mode | |
1139 | + if (player.isPVEMode() && !player.isGM()) | |
1140 | + { | |
1141 | + player.sendMessage("Debes desactivar el modo PvE para atacar a otros jugadores"); | |
1142 | + player.sendPacket(ActionFailed.STATIC_PACKET); | |
1143 | + return; | |
1144 | + } | |
1145 | + | |
1146 | // (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. | |
1147 | target.onAction(player, (player.getTarget() == target), _isShiftAction); | |
1148 | } | |
1149 | diff --git java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java | |
1150 | index 3efda23..0a00998 100644 | |
1151 | --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java | |
1152 | +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java | |
1153 | @@ -102,6 +102,70 @@ | |
1154 | player.updateEffectIcons(); | |
1155 | player.sendPacket(new EtcStatusUpdate(player)); | |
1156 | ||
1157 | + if (Config.GAME_MODE_ENABLE) | |
1158 | + { | |
1159 | + | |
1160 | + String gameMode = player.getGameMode(); | |
1161 | + if (gameMode.equalsIgnoreCase("PVE MODE")) | |
1162 | + { | |
1163 | + player.setPVEMode(true); | |
1164 | + player.setGameModeService(0); | |
1165 | + player.setPVPMode(false); | |
1166 | + player.setNormalMode(false); | |
1167 | + player.decayMe(); | |
1168 | + World.getInstance().addPlayer(player); | |
1169 | + player.sendMessage("Estas En PvE Mode - Los jugadores no podran atacarte"); | |
1170 | + player.sendMessage("Puedes Cambiarlo Con: - .pve - .pvp - .normal"); | |
1171 | + player.broadcastUserInfo(); | |
1172 | + player.spawnMe(); | |
1173 | + } | |
1174 | + else if (gameMode.equalsIgnoreCase("PVP MODE")) | |
1175 | + { | |
1176 | + | |
1177 | + player.updatePvPFlag(1); | |
1178 | + player.setPVEMode(false); | |
1179 | + player.setPVPMode(true); | |
1180 | + player.setGameModeService(1); | |
1181 | + player.setNormalMode(false); | |
1182 | + player.sendMessage("Estas En PVP Mode - Recibes un bonus de 50% de Exp - Sp - Drop - Adena"); | |
1183 | + player.sendMessage("Puedes Cambiarlo Con: - .pve - .pvp - .normal"); | |
1184 | + player.decayMe(); | |
1185 | + World.getInstance().addPlayer(player); | |
1186 | + player.broadcastUserInfo(); | |
1187 | + player.spawnMe(); | |
1188 | + } | |
1189 | + else if (gameMode.equalsIgnoreCase("NORMAL MODE")) | |
1190 | + { | |
1191 | + | |
1192 | + player.setPVEMode(false); | |
1193 | + player.setPVPMode(false); | |
1194 | + player.setNormalMode(true); | |
1195 | + player.setGameModeService(2); | |
1196 | + player.sendMessage("Estas En Normal Mode - Recibes un bonus de 20% de Exp - Sp - Drop - Adena"); | |
1197 | + player.sendMessage("Puedes Cambiarlo Con: - .pve - .pvp - .normal"); | |
1198 | + player.decayMe(); | |
1199 | + World.getInstance().addPlayer(player); | |
1200 | + player.broadcastUserInfo(); | |
1201 | + player.spawnMe(); | |
1202 | + } | |
1203 | + | |
1204 | + if (!player.isPVPMode() && !player.isPVEMode()) | |
1205 | + { | |
1206 | + player.setPVEMode(false); | |
1207 | + player.setPVPMode(false); | |
1208 | + player.setNormalMode(true); | |
1209 | + player.setGameModeService(2); | |
1210 | + player.sendMessage("Estas En Normal Mode - Recibes un bonus de 20% de Exp - Sp - Drop - Adena"); | |
1211 | + player.sendMessage("Puedes Cambiarlo Con: - .pve - .pvp - .normal"); | |
1212 | + player.decayMe(); | |
1213 | + World.getInstance().addPlayer(player); | |
1214 | + showModeSystemHTML(player); | |
1215 | + player.broadcastUserInfo(); | |
1216 | + player.spawnMe(); | |
1217 | + } | |
1218 | + | |
1219 | + } | |
1220 | + | |
1221 | // Clan checks. | |
1222 | final Clan clan = player.getClan(); | |
1223 | if (clan != null) | |
1224 | @@ -286,6 +350,14 @@ | |
1225 | player.sendPacket(ActionFailed.STATIC_PACKET); | |
1226 | } | |
1227 | ||
1228 | + @SuppressWarnings("static-method") | |
1229 | + private void showModeSystemHTML(Player player) | |
1230 | + { | |
1231 | + NpcHtmlMessage html = new NpcHtmlMessage(0); | |
1232 | + html.setFile("data/html/mods/ChangeModeSystem/ModeSystem.htm"); | |
1233 | + player.sendPacket(html); | |
1234 | + } | |
1235 | + | |
1236 | @Override | |
1237 | protected boolean triggersOnActionRequest() | |
1238 | { | |
1239 | diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java | |
1240 | index d74f2a3..c4ab884 100644 | |
1241 | --- java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java | |
1242 | +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java | |
1243 | @@ -38,7 +38,9 @@ | |
1244 | import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; | |
1245 | import net.sf.l2j.gameserver.network.serverpackets.PlaySound; | |
1246 | import net.sf.l2j.gameserver.scripting.QuestState; | |
1247 | +import net.sf.l2j.gameserver.taskmanager.PvpFlagTaskManager; | |
1248 | ||
1249 | +import Base.GameModeSystem.ChangeModeManager; | |
1250 | import Base.Skin.DressMeData; | |
1251 | import Base.Skin.SkinPackage; | |
1252 | ||
1253 | @@ -109,6 +111,122 @@ | |
1254 | ach.useVoicedCommand(_command.substring(7), player, null); | |
1255 | } | |
1256 | ||
1257 | + else if (_command.startsWith("PvEMode")) | |
1258 | + { | |
1259 | + | |
1260 | + if (ChangeModeManager.verifyChangeMode(player)) | |
1261 | + { | |
1262 | + | |
1263 | + if (player.isPVEMode()) | |
1264 | + { | |
1265 | + player.sendMessage("Ya estas en el modo PVE."); | |
1266 | + return; | |
1267 | + } | |
1268 | + | |
1269 | + if (player.getPvpFlag() == 0 && player.getKarma() == 0) | |
1270 | + { | |
1271 | + player.setPVEMode(true); | |
1272 | + player.setGameModeService(0); | |
1273 | + player.setPVPMode(false); | |
1274 | + player.setNormalMode(false); | |
1275 | + player.decayMe(); | |
1276 | + World.getInstance().addPlayer(player); | |
1277 | + player.sendMessage("Estas En PvE Mode - Los jugadores no podran atacarte"); | |
1278 | + player.sendMessage("Puedes Cambiarlo Con: - .pve - .pvp - .normal"); | |
1279 | + player.broadcastUserInfo(); | |
1280 | + player.spawnMe(); | |
1281 | + } | |
1282 | + else | |
1283 | + { | |
1284 | + player.sendMessage(" Estas con Flag o Tienes Karma No puedes Activar el modo PvE Con Karma o Flag"); | |
1285 | + } | |
1286 | + } | |
1287 | + | |
1288 | + } | |
1289 | + | |
1290 | + else if (_command.startsWith("PvPMode")) | |
1291 | + { | |
1292 | + | |
1293 | + if (ChangeModeManager.verifyChangeMode(player)) | |
1294 | + { | |
1295 | + if (player.isPVPMode()) | |
1296 | + { | |
1297 | + player.sendMessage("Ya estas en el modo PVP."); | |
1298 | + return; | |
1299 | + } | |
1300 | + | |
1301 | + if (!player.isInsideZone(ZoneId.TOWN) && !player.isGM()) | |
1302 | + { | |
1303 | + player.sendMessage("Solo Puedes Cambiar El Modo En Una Ciudad."); | |
1304 | + return; | |
1305 | + } | |
1306 | + | |
1307 | + if (player.getStatus().getLevel() < 76 && !player.isGM()) | |
1308 | + { | |
1309 | + player.sendMessage("Necesitas Minimo Ser LvL 76 Para Activar El Modo PvP."); | |
1310 | + return; | |
1311 | + } | |
1312 | + | |
1313 | + player.updatePvPFlag(1); | |
1314 | + player.setPVEMode(false); | |
1315 | + player.setPVPMode(true); | |
1316 | + player.setGameModeService(1); | |
1317 | + player.setNormalMode(false); | |
1318 | + player.sendMessage("Has cambiado al modo PVP. - Obtendras un Bonus de 50%"); | |
1319 | + player.decayMe(); | |
1320 | + World.getInstance().addPlayer(player); | |
1321 | + player.broadcastUserInfo(); | |
1322 | + player.spawnMe(); | |
1323 | + } | |
1324 | + | |
1325 | + } | |
1326 | + | |
1327 | + else if (_command.startsWith("NormalMode")) | |
1328 | + { | |
1329 | + if (ChangeModeManager.verifyChangeMode(player)) | |
1330 | + { | |
1331 | + | |
1332 | + if (player.isNormalMode()) | |
1333 | + { | |
1334 | + player.sendMessage("Ya estas en el modo Normal."); | |
1335 | + return; | |
1336 | + } | |
1337 | + | |
1338 | + if (!player.isInsideZone(ZoneId.TOWN) && !player.isGM()) | |
1339 | + { | |
1340 | + player.sendMessage("Solo Puedes Cambiar El Modo En Una Ciudad."); | |
1341 | + return; | |
1342 | + } | |
1343 | + | |
1344 | + if (player.getPvpFlag() > 0) | |
1345 | + { | |
1346 | + PvpFlagTaskManager.getInstance().add(player, Config.PVP_NORMAL_TIME); | |
1347 | + | |
1348 | + player.updatePvPFlag(1); | |
1349 | + player.setPVEMode(false); | |
1350 | + player.setPVPMode(false); | |
1351 | + player.setNormalMode(true); | |
1352 | + player.setGameModeService(2); | |
1353 | + player.sendMessage("Has cambiado al modo Normal. - Obtendras un Bonus de 20%"); | |
1354 | + player.decayMe(); | |
1355 | + World.getInstance().addPlayer(player); | |
1356 | + player.broadcastUserInfo(); | |
1357 | + player.spawnMe(); | |
1358 | + } | |
1359 | + player.setPvpFlag(0); | |
1360 | + player.setPVEMode(false); | |
1361 | + player.setPVPMode(false); | |
1362 | + player.setNormalMode(true); | |
1363 | + player.setGameModeService(2); | |
1364 | + player.sendMessage("Has cambiado al modo Normal. - Obtendras un Bonus de 20%"); | |
1365 | + player.decayMe(); | |
1366 | + World.getInstance().addPlayer(player); | |
1367 | + player.broadcastUserInfo(); | |
1368 | + player.spawnMe(); | |
1369 | + } | |
1370 | + | |
1371 | + } | |
1372 | + | |
1373 | else if (_command.startsWith("custom_")) | |
1374 | { | |
1375 | Player player2 = getClient().getPlayer(); | |
1376 | diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelAnswerStart.java java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelAnswerStart.java | |
1377 | index 82913b7..c02d826 100644 | |
1378 | --- java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelAnswerStart.java | |
1379 | +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelAnswerStart.java | |
1380 | @@ -1,5 +1,6 @@ | |
1381 | package net.sf.l2j.gameserver.network.clientpackets; | |
1382 | ||
1383 | +import net.sf.l2j.Config; | |
1384 | import net.sf.l2j.gameserver.data.manager.DuelManager; | |
1385 | import net.sf.l2j.gameserver.model.actor.Player; | |
1386 | import net.sf.l2j.gameserver.model.group.CommandChannel; | |
1387 | @@ -34,6 +35,18 @@ | |
1388 | player.setActiveRequester(null); | |
1389 | requestor.onTransactionResponse(); | |
1390 | ||
1391 | + | |
1392 | + | |
1393 | + if (Config.GAME_MODE_ENABLE) | |
1394 | + { | |
1395 | + if (requestor.isPVEMode()) | |
1396 | + { | |
1397 | + player.sendMessage("Estas en PVE MODE o el jugador que intentas retar a un duelo lo esta"); | |
1398 | + return; | |
1399 | + } | |
1400 | + } | |
1401 | + | |
1402 | + | |
1403 | if (_duelAccepted) | |
1404 | { | |
1405 | // Check if duel is possible. | |
1406 | diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.java java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.java | |
1407 | index 7ce0499..134f42e 100644 | |
1408 | --- java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.java | |
1409 | +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.java | |
1410 | @@ -1,5 +1,6 @@ | |
1411 | package net.sf.l2j.gameserver.network.clientpackets; | |
1412 | ||
1413 | +import net.sf.l2j.Config; | |
1414 | import net.sf.l2j.gameserver.model.World; | |
1415 | import net.sf.l2j.gameserver.model.actor.Player; | |
1416 | import net.sf.l2j.gameserver.model.group.CommandChannel; | |
1417 | @@ -34,6 +35,26 @@ | |
1418 | return; | |
1419 | } | |
1420 | ||
1421 | + | |
1422 | + | |
1423 | + if (Config.GAME_MODE_ENABLE) | |
1424 | + { | |
1425 | + if (player.isPVEMode()) | |
1426 | + { | |
1427 | + player.sendMessage("Desactiva El PVE MODE"); | |
1428 | + return; | |
1429 | + } | |
1430 | + | |
1431 | + if (target.isPVEMode()) | |
1432 | + { | |
1433 | + player.sendMessage("El Jugador: " + target.getName() + " Esta en PvE Mode"); | |
1434 | + return; | |
1435 | + } | |
1436 | + } | |
1437 | + | |
1438 | + | |
1439 | + | |
1440 | + | |
1441 | // Check if duel is possible. | |
1442 | if (!player.canDuel()) | |
1443 | { | |
1444 | diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java | |
1445 | index 4d4552d..4db7299 100644 | |
1446 | --- java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java | |
1447 | +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java | |
1448 | @@ -1,5 +1,6 @@ | |
1449 | package net.sf.l2j.gameserver.network.clientpackets; | |
1450 | ||
1451 | +import net.sf.l2j.Config; | |
1452 | import net.sf.l2j.gameserver.enums.LootRule; | |
1453 | import net.sf.l2j.gameserver.model.World; | |
1454 | import net.sf.l2j.gameserver.model.actor.Player; | |
1455 | @@ -34,6 +35,9 @@ | |
1456 | return; | |
1457 | } | |
1458 | ||
1459 | + | |
1460 | + | |
1461 | + | |
1462 | if (target.getBlockList().isBlockingAll()) | |
1463 | { | |
1464 | requestor.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_BLOCKED_EVERYTHING).addCharName(target)); | |
1465 | @@ -52,6 +56,18 @@ | |
1466 | return; | |
1467 | } | |
1468 | ||
1469 | + | |
1470 | + if (Config.GAME_MODE_ENABLE) | |
1471 | + { | |
1472 | + | |
1473 | + if (!requestor.getGameMode().equals(target.getGameMode())) | |
1474 | + { | |
1475 | + requestor.sendMessage("No puedes invitar a la party a un jugador con un modo de juego diferente."); | |
1476 | + return; | |
1477 | + } | |
1478 | + } | |
1479 | + | |
1480 | + | |
1481 | if (target.isInParty()) | |
1482 | { | |
1483 | requestor.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_IS_ALREADY_IN_PARTY).addCharName(target)); | |
1484 | diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinPartyRoom.java java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinPartyRoom.java | |
1485 | index 7e692a5..54cfa0e 100644 | |
1486 | --- java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinPartyRoom.java | |
1487 | +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinPartyRoom.java | |
1488 | @@ -1,5 +1,6 @@ | |
1489 | package net.sf.l2j.gameserver.network.clientpackets; | |
1490 | ||
1491 | +import net.sf.l2j.Config; | |
1492 | import net.sf.l2j.gameserver.data.manager.PartyMatchRoomManager; | |
1493 | import net.sf.l2j.gameserver.model.actor.Player; | |
1494 | import net.sf.l2j.gameserver.model.group.PartyMatchRoom; | |
1495 | @@ -39,6 +40,15 @@ | |
1496 | return; | |
1497 | } | |
1498 | ||
1499 | + if (Config.GAME_MODE_ENABLE) | |
1500 | + { | |
1501 | + if (player.isPVEMode()) | |
1502 | + { | |
1503 | + player.sendMessage("Desactiva El PVE MODE"); | |
1504 | + return; | |
1505 | + } | |
1506 | + } | |
1507 | + | |
1508 | // Remove from waiting list | |
1509 | PartyMatchRoomManager.getInstance().removeWaitingPlayer(player); | |
1510 | ||
1511 | diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinSiege.java java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinSiege.java | |
1512 | index d9bea2c..742316f 100644 | |
1513 | --- java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinSiege.java | |
1514 | +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinSiege.java | |
1515 | @@ -1,5 +1,6 @@ | |
1516 | package net.sf.l2j.gameserver.network.clientpackets; | |
1517 | ||
1518 | +import net.sf.l2j.Config; | |
1519 | import net.sf.l2j.gameserver.data.manager.CastleManager; | |
1520 | import net.sf.l2j.gameserver.data.manager.ClanHallManager; | |
1521 | import net.sf.l2j.gameserver.model.actor.Player; | |
1522 | @@ -40,6 +41,18 @@ | |
1523 | if (clan == null) | |
1524 | return; | |
1525 | ||
1526 | + | |
1527 | + if (Config.GAME_MODE_ENABLE) | |
1528 | + { | |
1529 | + if (player.isPVEMode()) | |
1530 | + { | |
1531 | + player.sendMessage("Desactiva El PVE MODE"); | |
1532 | + return; | |
1533 | + } | |
1534 | + } | |
1535 | + | |
1536 | + | |
1537 | + | |
1538 | // Check Castle entity associated to the id. | |
1539 | final Castle castle = CastleManager.getInstance().getCastleById(_id); | |
1540 | if (castle != null) | |
1541 | diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestOlympiadMatchList.java java/net/sf/l2j/gameserver/network/clientpackets/RequestOlympiadMatchList.java | |
1542 | index ca9934d..ed8061c 100644 | |
1543 | --- java/net/sf/l2j/gameserver/network/clientpackets/RequestOlympiadMatchList.java | |
1544 | +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestOlympiadMatchList.java | |
1545 | @@ -2,6 +2,7 @@ | |
1546 | ||
1547 | import net.sf.l2j.commons.lang.StringUtil; | |
1548 | ||
1549 | +import net.sf.l2j.Config; | |
1550 | import net.sf.l2j.gameserver.model.actor.Player; | |
1551 | import net.sf.l2j.gameserver.model.olympiad.Olympiad; | |
1552 | import net.sf.l2j.gameserver.model.olympiad.OlympiadGameManager; | |
1553 | @@ -22,6 +23,21 @@ | |
1554 | if (player == null || !player.isInObserverMode()) | |
1555 | return; | |
1556 | ||
1557 | + | |
1558 | + | |
1559 | + if (Config.GAME_MODE_ENABLE) | |
1560 | + { | |
1561 | + if (player.isPVEMode()) | |
1562 | + { | |
1563 | + player.sendMessage("Desactiva El PVE MODE"); | |
1564 | + return; | |
1565 | + } | |
1566 | + } | |
1567 | + | |
1568 | + | |
1569 | + | |
1570 | + | |
1571 | + | |
1572 | int i = 0; | |
1573 | ||
1574 | final StringBuilder sb = new StringBuilder(1500); | |
1575 | diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestOlympiadObserverEnd.java java/net/sf/l2j/gameserver/network/clientpackets/RequestOlympiadObserverEnd.java | |
1576 | index 7b1d873..4c18905 100644 | |
1577 | --- java/net/sf/l2j/gameserver/network/clientpackets/RequestOlympiadObserverEnd.java | |
1578 | +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestOlympiadObserverEnd.java | |
1579 | @@ -1,5 +1,6 @@ | |
1580 | package net.sf.l2j.gameserver.network.clientpackets; | |
1581 | ||
1582 | +import net.sf.l2j.Config; | |
1583 | import net.sf.l2j.gameserver.model.actor.Player; | |
1584 | ||
1585 | public final class RequestOlympiadObserverEnd extends L2GameClientPacket | |
1586 | @@ -16,6 +17,16 @@ | |
1587 | if (player == null) | |
1588 | return; | |
1589 | ||
1590 | + | |
1591 | + if (Config.GAME_MODE_ENABLE) | |
1592 | + { | |
1593 | + if (player.isPVEMode()) | |
1594 | + { | |
1595 | + player.sendMessage("Desactiva El PVE MODE"); | |
1596 | + return; | |
1597 | + } | |
1598 | + } | |
1599 | + | |
1600 | if (!player.isInObserverMode()) | |
1601 | return; | |
1602 | ||
1603 | diff --git java/net/sf/l2j/gameserver/taskmanager/PvpFlagTaskManager.java java/net/sf/l2j/gameserver/taskmanager/PvpFlagTaskManager.java | |
1604 | index 1fdf282..cdcecaf 100644 | |
1605 | --- java/net/sf/l2j/gameserver/taskmanager/PvpFlagTaskManager.java | |
1606 | +++ java/net/sf/l2j/gameserver/taskmanager/PvpFlagTaskManager.java | |
1607 | @@ -37,15 +37,24 @@ | |
1608 | final Player player = entry.getKey(); | |
1609 | final long timeLeft = entry.getValue(); | |
1610 | ||
1611 | - // Time is running out, clear PvP flag and remove from list. | |
1612 | - if (currentTime > timeLeft) | |
1613 | - remove(player, true); | |
1614 | - // Time almost runned out, update to blinking PvP flag. | |
1615 | - else if (currentTime > (timeLeft - 5000)) | |
1616 | - player.updatePvPFlag(2); | |
1617 | - // Time didn't run out, keep PvP flag. | |
1618 | + if (!player.isPVPMode()) | |
1619 | + { | |
1620 | + // Time is running out, clear PvP flag and remove from list. | |
1621 | + if (currentTime > timeLeft) | |
1622 | + remove(player, true); | |
1623 | + // Time almost run out, update to blinking PvP flag. | |
1624 | + else if (currentTime > (timeLeft - 5000)) | |
1625 | + player.updatePvPFlag(2); | |
1626 | + // Time didn't run out, keep PvP flag. | |
1627 | + else | |
1628 | + player.updatePvPFlag(1); | |
1629 | + } | |
1630 | else | |
1631 | + { | |
1632 | + // Player is in PvP mode, set PvP flag to 1. | |
1633 | player.updatePvPFlag(1); | |
1634 | + } | |
1635 | + | |
1636 | } | |
1637 | } | |
1638 | ||
1639 | diff --git java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java | |
1640 | index b963bd0..e0268f7 100644 | |
1641 | --- java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java | |
1642 | +++ java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java | |
1643 | @@ -12,10 +12,30 @@ | |
1644 | public class CharInfo extends L2GameServerPacket | |
1645 | { | |
1646 | private final Player _player; | |
1647 | + private String _title; | |
1648 | + private int _titleColor; | |
1649 | ||
1650 | public CharInfo(Player player) | |
1651 | { | |
1652 | _player = player; | |
1653 | + if (!GameModeInfo()) | |
1654 | + { | |
1655 | + if (!player.getAppearance().isVisible()) | |
1656 | + { | |
1657 | + _title = "Invisible"; | |
1658 | + } | |
1659 | + else | |
1660 | + { | |
1661 | + | |
1662 | + _title = _player.getTitle(); | |
1663 | + } | |
1664 | + _titleColor = player.getAppearance().getTitleColor(); | |
1665 | + } | |
1666 | + else | |
1667 | + { | |
1668 | + _title = "PVE MODE"; | |
1669 | + _titleColor = 0x00FFFF; | |
1670 | + } | |
1671 | } | |
1672 | ||
1673 | @Override | |
1674 | @@ -116,7 +136,7 @@ | |
1675 | writeD(_player.getAppearance().getHairColor()); | |
1676 | writeD(_player.getAppearance().getFace()); | |
1677 | ||
1678 | - writeS((canSeeInvis) ? "Invisible" : _player.getTitle()); | |
1679 | + writeS(_title); | |
1680 | ||
1681 | writeD(_player.getClanId()); | |
1682 | writeD(_player.getClanCrestId()); | |
1683 | @@ -156,7 +176,19 @@ | |
1684 | writeD(_player.getHeading()); | |
1685 | writeD(_player.getPledgeClass()); | |
1686 | writeD(_player.getPledgeType()); | |
1687 | - writeD(_player.getAppearance().getTitleColor()); | |
1688 | + writeD(_titleColor); | |
1689 | writeD(CursedWeaponManager.getInstance().getCurrentStage(_player.getCursedWeaponEquippedId())); | |
1690 | } | |
1691 | + | |
1692 | + public boolean GameModeInfo() | |
1693 | + { | |
1694 | + if (Config.GAME_MODE_ENABLE) | |
1695 | + { | |
1696 | + if (_player.isPVEMode()) | |
1697 | + { | |
1698 | + return true; | |
1699 | + } | |
1700 | + } | |
1701 | + return false; | |
1702 | + } | |
1703 | } | |
1704 | \ No newline at end of file | |
1705 | diff --git java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java | |
1706 | index b1679c0..14a37db 100644 | |
1707 | --- java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java | |
1708 | +++ java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java | |
1709 | @@ -14,6 +14,9 @@ | |
1710 | private final Player _player; | |
1711 | private int _relation; | |
1712 | ||
1713 | + private String _title; | |
1714 | + private int _titleColor; | |
1715 | + | |
1716 | public UserInfo(Player player) | |
1717 | { | |
1718 | _player = player; | |
1719 | @@ -24,6 +27,26 @@ | |
1720 | _relation |= 0x180; | |
1721 | if (_player.getSiegeState() == 2) | |
1722 | _relation |= 0x80; | |
1723 | + | |
1724 | + if (!GameModeInfo()) | |
1725 | + { | |
1726 | + if (!player.getAppearance().isVisible()) | |
1727 | + { | |
1728 | + _title = "Invisible"; | |
1729 | + } | |
1730 | + else | |
1731 | + { | |
1732 | + | |
1733 | + _title = _player.getTitle(); | |
1734 | + } | |
1735 | + _titleColor = player.getAppearance().getTitleColor(); | |
1736 | + } | |
1737 | + else | |
1738 | + { | |
1739 | + _title = "PVE MODE"; | |
1740 | + _titleColor = 0x00FFFF; | |
1741 | + } | |
1742 | + | |
1743 | } | |
1744 | ||
1745 | @Override | |
1746 | @@ -171,7 +194,7 @@ | |
1747 | writeD(_player.getAppearance().getFace()); | |
1748 | writeD((_player.isGM()) ? 1 : 0); | |
1749 | ||
1750 | - writeS((_player.getPolymorphTemplate() != null) ? "Morphed" : _player.getTitle()); | |
1751 | + writeS((_player.getPolymorphTemplate() != null) ? "Morphed" : _title); | |
1752 | ||
1753 | writeD(_player.getClanId()); | |
1754 | writeD(_player.getClanCrestId()); | |
1755 | @@ -211,7 +234,19 @@ | |
1756 | writeC((_player.isRunning()) ? 0x01 : 0x00); | |
1757 | writeD(_player.getPledgeClass()); | |
1758 | writeD(_player.getPledgeType()); | |
1759 | - writeD(_player.getAppearance().getTitleColor()); | |
1760 | + writeD(_titleColor); | |
1761 | writeD(CursedWeaponManager.getInstance().getCurrentStage(_player.getCursedWeaponEquippedId())); | |
1762 | } | |
1763 | + | |
1764 | + public boolean GameModeInfo() | |
1765 | + { | |
1766 | + if (Config.GAME_MODE_ENABLE) | |
1767 | + { | |
1768 | + if (_player.isPVEMode()) | |
1769 | + { | |
1770 | + return true; | |
1771 | + } | |
1772 | + } | |
1773 | + return false; | |
1774 | + } | |
1775 | } | |
1776 | \ No newline at end of file | |
1777 | ||
1778 | diff --git server/gameserver/data/html/mods/ChangeModeSystem/ModeSystem.htm server/gameserver/data/html/mods/ChangeModeSystem/ModeSystem.htm | |
1779 | new file mode 100644 | |
1780 | index 0000000..6e94618 | |
1781 | --- /dev/null | |
1782 | +++ server/gameserver/data/html/mods/ChangeModeSystem/ModeSystem.htm | |
1783 | @@ -0,0 +1,57 @@ | |
1784 | +<html> | |
1785 | +<head> | |
1786 | + <title>L2Wins - Modos De Juego</title> | |
1787 | +</head> | |
1788 | +<body> | |
1789 | + | |
1790 | + <center><font color="00FF00">Bienvenido a L2Wins.</font></center> | |
1791 | + <br> | |
1792 | + <center><font color="00FF00">Elige tu Modo de Juego.</font></center> | |
1793 | +<center> | |
1794 | +<br1> | |
1795 | +<font color="00FF00">Por Defecto Entras En Normal Mode.</font> | |
1796 | +<br1> | |
1797 | +<font color="00FF00">Puedes Cambiarlo Escribiendo - .pve - .pvp - .normal</font> | |
1798 | +<br1> | |
1799 | +<font color="00FF00">Los Modos De Juego PvP - Normal Mode.</font> | |
1800 | +<br1> | |
1801 | +<font color="00FF00">Tienen Un Bonus General de EXP-SP-DROP-ADENA.</font> | |
1802 | +<br1> | |
1803 | +<font color="00FF00">En el Modo PvE No Podran Matarte.</font> | |
1804 | +<br1> | |
1805 | +<font color="00FF00">Tampoco Podras Atacar A Otro Jugador.</font> | |
1806 | +<br1> | |
1807 | +<font color="00FF00">Solo Podras Estar En Party Con Gente.</font> | |
1808 | +<br1> | |
1809 | +<font color="00FF00">Que Tenga Tu Mismo Modo De Juego.</font> | |
1810 | + | |
1811 | +</center> | |
1812 | + | |
1813 | + <br> | |
1814 | + | |
1815 | + <table> | |
1816 | + <tr> | |
1817 | + <td width="160" align="center"><font color="FFFF00">PvE Mode</font></td> | |
1818 | + <td width="160" align="center"><font color="800080">PvP Mode</font></td> | |
1819 | + <td width="160" align="center"><font color="CCFFCC"><font color="FF6600">Normal Mode</font></font></td> | |
1820 | + </tr> | |
1821 | +</table> | |
1822 | + <table> | |
1823 | + <tr> | |
1824 | + <td width="160" align="center"><font color="FFFF00">Bonus 0%</font></td> | |
1825 | + <td width="160" align="center"><font color="800080">Bonus 50%</font></td> | |
1826 | + <td width="160" align="center"><font color="CCFFCC"><font color="FF6600">Bonus 20%</font></font></td> | |
1827 | + </tr> | |
1828 | +</table> | |
1829 | + | |
1830 | + | |
1831 | +<br> | |
1832 | +<table> | |
1833 | + <tr> | |
1834 | + <td width="160" align="center"><button value="Use" action="bypass -h PvEMode" width="75" height="21" back="L2UI.DefaultButton_click" fore="L2UI.DefaultButton"></td> | |
1835 | + <td width="160" align="center"><button value="Use" action="bypass -h PvPMode" width="75" height="21" back="L2UI.DefaultButton_click" fore="L2UI.DefaultButton"></td> | |
1836 | + <td width="160" align="center"><button value="Use" action="bypass -h NormalMode" width="75" height="21" back="L2UI.DefaultButton_click" fore="L2UI.DefaultButton"></td> | |
1837 | + </tr> | |
1838 | + </table> | |
1839 | +</body> | |
1840 | +</html> | |
1841 |