SHOW:
|
|
- or go back to the newest paste.
1 | ### Eclipse Workspace Patch 1.0 | |
2 | #P aCis_Gameserver | |
3 | Index: java/net/sf/l2j/Config.java | |
4 | =================================================================== | |
5 | --- java/net/sf/l2j/Config.java (nonexistent) | |
6 | +++ java/net/sf/l2j/Config.java (working copy) | |
7 | ||
8 | ||
9 | public static final String SIEGE_FILE = "./config/siege.properties"; | |
10 | + public static final String DUNGEON_REWARD_FILE = "./events/Dungeon_Html_Reward.properties"; | |
11 | + | |
12 | + | |
13 | + public static int DUNGEON_COIN_ID; | |
14 | + public static int CONT_DUNGEON_ITEM; | |
15 | + public static int DUNGEON_SPAWN_X; | |
16 | + public static int DUNGEON_SPAWN_Y; | |
17 | + public static int DUNGEON_SPAWN_Z; | |
18 | + public static int DUNGEON_SPAWN_RND; | |
19 | + | |
20 | + public static int DUNGEON_ITEM_RENEWAL0; | |
21 | + public static int DUNGEON_ITEM_RENEWAL1; | |
22 | + public static int DUNGEON_ITEM_RENEWAL2; | |
23 | + public static int DUNGEON_ITEM_RENEWAL3; | |
24 | + public static int DUNGEON_ITEM_RENEWAL4; | |
25 | + public static int DUNGEON_ITEM_RENEWAL5; | |
26 | + public static int DUNGEON_ITEM_RENEWAL6; | |
27 | + public static int DUNGEON_ITEM_RENEWAL7; | |
28 | + public static int DUNGEON_ITEM_RENEWAL8; | |
29 | + public static int DUNGEON_ITEM_RENEWAL9; | |
30 | + public static int DUNGEON_ITEM_RENEWAL10; | |
31 | + | |
32 | + public static int DUNGEON_PARTY_ITEM_RENEWAL0; | |
33 | + public static int DUNGEON_PARTY_ITEM_RENEWAL1; | |
34 | + public static int DUNGEON_PARTY_ITEM_RENEWAL2; | |
35 | + public static int DUNGEON_PARTY_ITEM_RENEWAL3; | |
36 | + public static int DUNGEON_PARTY_ITEM_RENEWAL4; | |
37 | + | |
38 | + | |
39 | + | |
40 | + /** | |
41 | + * Loads Dungeon settings. | |
42 | + */ | |
43 | + private static final void loadDungeon() | |
44 | + { | |
45 | + // Dungeon | |
46 | + ExProperties SafeDungeon = initProperties(DUNGEON_REWARD_FILE); | |
47 | + | |
48 | + DUNGEON_COIN_ID = SafeDungeon.getProperty("DungeonCoinId", 57); | |
49 | + CONT_DUNGEON_ITEM = SafeDungeon.getProperty("DungeonContItem", 1); | |
50 | + DUNGEON_SPAWN_X = SafeDungeon.getProperty("DungeonSpawnX", 82635); | |
51 | + DUNGEON_SPAWN_Y = SafeDungeon.getProperty("DungeonSpawnY", 148798); | |
52 | + DUNGEON_SPAWN_Z = SafeDungeon.getProperty("DungeonSpawnZ", -3464); | |
53 | + DUNGEON_SPAWN_RND = SafeDungeon.getProperty("DungeonSpawnRnd", 25); | |
54 | + | |
55 | + DUNGEON_ITEM_RENEWAL0 = SafeDungeon.getProperty("DungeonRenewalHtml0", 15); | |
56 | + DUNGEON_ITEM_RENEWAL1 = SafeDungeon.getProperty("DungeonRenewalHtml1", 15); | |
57 | + DUNGEON_ITEM_RENEWAL2 = SafeDungeon.getProperty("DungeonRenewalHtml2", 15); | |
58 | + DUNGEON_ITEM_RENEWAL3 = SafeDungeon.getProperty("DungeonRenewalHtml3", 15); | |
59 | + DUNGEON_ITEM_RENEWAL4 = SafeDungeon.getProperty("DungeonRenewalHtml4", 15); | |
60 | + DUNGEON_ITEM_RENEWAL5 = SafeDungeon.getProperty("DungeonRenewalHtml5", 15); | |
61 | + DUNGEON_ITEM_RENEWAL6 = SafeDungeon.getProperty("DungeonRenewalHtml6", 15); | |
62 | + DUNGEON_ITEM_RENEWAL7 = SafeDungeon.getProperty("DungeonRenewalHtml7", 15); | |
63 | + DUNGEON_ITEM_RENEWAL8 = SafeDungeon.getProperty("DungeonRenewalHtml8", 15); | |
64 | + DUNGEON_ITEM_RENEWAL9 = SafeDungeon.getProperty("DungeonRenewalHtml9", 15); | |
65 | + DUNGEON_ITEM_RENEWAL10 = SafeDungeon.getProperty("DungeonRenewalHtml10", 15); | |
66 | + DUNGEON_PARTY_ITEM_RENEWAL0 = SafeDungeon.getProperty("DungeonPartyRenewalHtml0", 15); | |
67 | + DUNGEON_PARTY_ITEM_RENEWAL1 = SafeDungeon.getProperty("DungeonPartyRenewalHtml1", 15); | |
68 | + DUNGEON_PARTY_ITEM_RENEWAL2 = SafeDungeon.getProperty("DungeonPartyRenewalHtml2", 15); | |
69 | + DUNGEON_PARTY_ITEM_RENEWAL3 = SafeDungeon.getProperty("DungeonPartyRenewalHtml3", 15); | |
70 | + DUNGEON_PARTY_ITEM_RENEWAL4 = SafeDungeon.getProperty("DungeonPartyRenewalHtml4", 15); | |
71 | + } | |
72 | ||
73 | ||
74 | ||
75 | public static final void loadGameServer() | |
76 | { | |
77 | LOGGER.info("Loading gameserver configuration files."); | |
78 | ||
79 | ||
80 | + // Dungeon settings | |
81 | + loadDungeon(); | |
82 | ||
83 | // clans settings | |
84 | loadClans(); | |
85 | ||
86 | ||
87 | ||
88 | ||
89 | ### Eclipse Workspace Patch 1.0 | |
90 | #P aCis-Gameserver | |
91 | Index: java/Base/Manager/NewCharTaskManager.java | |
92 | =================================================================== | |
93 | --- java/Base/Manager/NewCharTaskManager.java (nonexistent) | |
94 | +++ java/Base/Manager/NewCharTaskManager.java (working copy) | |
95 | +package Base.Manager; | |
96 | + | |
97 | +import java.util.Map; | |
98 | +import java.util.concurrent.ConcurrentHashMap; | |
99 | + | |
100 | +import net.sf.l2j.commons.pool.ThreadPool; | |
101 | + | |
102 | +import net.sf.l2j.gameserver.model.actor.Creature; | |
103 | +import net.sf.l2j.gameserver.model.actor.Player; | |
104 | + | |
105 | +/** | |
106 | + * @author Baggos | |
107 | + */ | |
108 | +public final class NewCharTaskManager implements Runnable | |
109 | +{ | |
110 | + private final Map<Player, Long> _players = new ConcurrentHashMap<>(); | |
111 | + | |
112 | + protected NewCharTaskManager() | |
113 | + { | |
114 | + // Run task each 10 second. | |
115 | + ThreadPool.scheduleAtFixedRate(this, 1000, 1000); | |
116 | + } | |
117 | + | |
118 | + public final void add(Player player) | |
119 | + { | |
120 | + _players.put(player, System.currentTimeMillis()); | |
121 | + } | |
122 | + | |
123 | + public final void remove(Creature player) | |
124 | + { | |
125 | + _players.remove(player); | |
126 | + } | |
127 | + | |
128 | + @Override | |
129 | + public final void run() | |
130 | + { | |
131 | + if (_players.isEmpty()) | |
132 | + return; | |
133 | + | |
134 | + for (Map.Entry<Player, Long> entry : _players.entrySet()) | |
135 | + { | |
136 | + final Player player = entry.getKey(); | |
137 | + | |
138 | + if (player.getMemos().getLong("newEndTime") < System.currentTimeMillis()) | |
139 | + { | |
140 | + Player.removeNewChar(player); | |
141 | + remove(player); | |
142 | + } | |
143 | + } | |
144 | + } | |
145 | + | |
146 | + public static final NewCharTaskManager getInstance() | |
147 | + { | |
148 | + return SingletonHolder._instance; | |
149 | + } | |
150 | + | |
151 | + private static class SingletonHolder | |
152 | + { | |
153 | + protected static final NewCharTaskManager _instance = new NewCharTaskManager(); | |
154 | + } | |
155 | +} | |
156 | ||
157 | ### Eclipse Workspace Patch 1.0 | |
158 | #P aCis-Gameserver | |
159 | Index: java/Base/Util/Mysql.java | |
160 | =================================================================== | |
161 | --- java/Base/Util/Mysql.java (nonexistent) | |
162 | +++ java/Base/Util/Mysql.java (working copy) | |
163 | +package Base.Util; | |
164 | + | |
165 | +import java.sql.Connection; | |
166 | +import java.sql.PreparedStatement; | |
167 | +import java.sql.ResultSet; | |
168 | +import java.sql.SQLException; | |
169 | +import java.sql.Statement; | |
170 | +import java.util.logging.Logger; | |
171 | + | |
172 | +import net.sf.l2j.commons.pool.ConnectionPool; | |
173 | + | |
174 | + | |
175 | + | |
176 | +public abstract class Mysql | |
177 | +{ | |
178 | + public static final Logger _log = Logger.getLogger(Mysql.class.getName()); | |
179 | + | |
180 | + /** | |
181 | + * Performs a simple sql queries where unnecessary control parameters <BR> | |
182 | + * NOTE: In this method, the parameters passed are not valid for SQL-injection! | |
183 | + * @param db | |
184 | + * @param query | |
185 | + * @param vars | |
186 | + * @return | |
187 | + */ | |
188 | + public static boolean setEx(ConnectionPool db, String query, Object... vars) | |
189 | + { | |
190 | + Connection con = null; | |
191 | + Statement statement = null; | |
192 | + PreparedStatement pstatement = null; | |
193 | + boolean successed = true; | |
194 | + | |
195 | + try | |
196 | + { | |
197 | + if(db == null) | |
198 | + db = ConnectionPool.getInstance(); | |
199 | + | |
200 | + con = ConnectionPool.getConnection(); | |
201 | + if(vars.length == 0) | |
202 | + { | |
203 | + statement = con.createStatement(); | |
204 | + statement.executeUpdate(query); | |
205 | + statement.close(); | |
206 | + } | |
207 | + else | |
208 | + { | |
209 | + pstatement = con.prepareStatement(query); | |
210 | + setVars(pstatement, vars); | |
211 | + pstatement.executeUpdate(); | |
212 | + pstatement.close(); | |
213 | + } | |
214 | + con.close(); | |
215 | + } | |
216 | + catch(Exception e) | |
217 | + { | |
218 | + _log.warning("Could not execute update '" + query + "': " + e); | |
219 | + e.printStackTrace(); | |
220 | + successed = false; | |
221 | + } | |
222 | + finally | |
223 | + { | |
224 | + closeQuietly(con, pstatement); | |
225 | + closeQuietly(statement); | |
226 | + } | |
227 | + return successed; | |
228 | + } | |
229 | + | |
230 | + public static void setVars(PreparedStatement statement, Object... vars) throws SQLException | |
231 | + { | |
232 | + Number n; | |
233 | + long long_val; | |
234 | + double double_val; | |
235 | + for(int i = 0; i < vars.length; i++) | |
236 | + if(vars[i] instanceof Number) | |
237 | + { | |
238 | + n = (Number) vars[i]; | |
239 | + long_val = n.longValue(); | |
240 | + double_val = n.doubleValue(); | |
241 | + if(long_val == double_val) | |
242 | + statement.setLong(i + 1, long_val); | |
243 | + else | |
244 | + statement.setDouble(i + 1, double_val); | |
245 | + } | |
246 | + else if(vars[i] instanceof String) | |
247 | + statement.setString(i + 1, (String) vars[i]); | |
248 | + } | |
249 | + | |
250 | + public static boolean set(String query, Object... vars) | |
251 | + { | |
252 | + return setEx(null, query, vars); | |
253 | + } | |
254 | + | |
255 | + public static boolean set(String query) | |
256 | + { | |
257 | + return setEx(null, query); | |
258 | + } | |
259 | + | |
260 | + public static void closeQuietly(Connection conn) | |
261 | + { | |
262 | + try { | |
263 | + close(conn); | |
264 | + } catch (SQLException e) { // NOPMD | |
265 | + // quiet | |
266 | + } | |
267 | + } | |
268 | + | |
269 | + public static void closeQuietly(Connection conn, Statement stmt, ResultSet rs) { | |
270 | + | |
271 | + try { | |
272 | + closeQuietly(rs); | |
273 | + } finally { | |
274 | + try { | |
275 | + closeQuietly(stmt); | |
276 | + } finally { | |
277 | + closeQuietly(conn); | |
278 | + } | |
279 | + } | |
280 | + } | |
281 | + | |
282 | + public static void closeQuietly(Connection conn, Statement stmt) | |
283 | + { | |
284 | + try { | |
285 | + closeQuietly(stmt); | |
286 | + } finally { | |
287 | + closeQuietly(conn); | |
288 | + } | |
289 | + } | |
290 | + | |
291 | + public static void closeQuietly(ResultSet rs) { | |
292 | + try { | |
293 | + close(rs); | |
294 | + } catch (SQLException e) { // NOPMD | |
295 | + // quiet | |
296 | + } | |
297 | + } | |
298 | + | |
299 | + public static void closeQuietly(Statement stmt) { | |
300 | + try { | |
301 | + close(stmt); | |
302 | + } catch (SQLException e) { // NOPMD | |
303 | + // quiet | |
304 | + } | |
305 | + } | |
306 | + | |
307 | + public static void close(Connection conn) throws SQLException { | |
308 | + if (conn != null) { | |
309 | + conn.close(); | |
310 | + } | |
311 | + } | |
312 | + | |
313 | + public static void close(ResultSet rs) throws SQLException { | |
314 | + if (rs != null) { | |
315 | + rs.close(); | |
316 | + } | |
317 | + } | |
318 | + | |
319 | + public static void close(Statement stmt) throws SQLException { | |
320 | + if (stmt != null) { | |
321 | + stmt.close(); | |
322 | + } | |
323 | + } | |
324 | + | |
325 | +} | |
326 | ||
327 | ### Eclipse Workspace Patch 1.0 | |
328 | #P aCis-Gameserver | |
329 | Index: java/Base/XML/XMLDocumentFactory.java | |
330 | =================================================================== | |
331 | --- java/Base/XML/XMLDocumentFactory.java (nonexistent) | |
332 | +++ java/Base/XML/XMLDocumentFactory.java (working copy) | |
333 | +package Base.XML; | |
334 | + | |
335 | +import java.io.File; | |
336 | + | |
337 | +import javax.xml.parsers.DocumentBuilder; | |
338 | +import javax.xml.parsers.DocumentBuilderFactory; | |
339 | + | |
340 | +import org.w3c.dom.Document; | |
341 | + | |
342 | +/** | |
343 | + * @author Forsaiken | |
344 | + */ | |
345 | +public final class XMLDocumentFactory | |
346 | +{ | |
347 | + public static final XMLDocumentFactory getInstance() | |
348 | + { | |
349 | + return SingletonHolder._instance; | |
350 | + } | |
351 | + | |
352 | + private final DocumentBuilder _builder; | |
353 | + | |
354 | + protected XMLDocumentFactory() throws Exception | |
355 | + { | |
356 | + try | |
357 | + { | |
358 | + final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); | |
359 | + factory.setValidating(false); | |
360 | + factory.setIgnoringComments(true); | |
361 | + | |
362 | + _builder = factory.newDocumentBuilder(); | |
363 | + } | |
364 | + catch (Exception e) | |
365 | + { | |
366 | + throw new Exception("Failed initializing", e); | |
367 | + } | |
368 | + } | |
369 | + | |
370 | + public final Document loadDocument(final String filePath) throws Exception | |
371 | + { | |
372 | + return loadDocument(new File(filePath)); | |
373 | + } | |
374 | + | |
375 | + public final Document loadDocument(final File file) throws Exception | |
376 | + { | |
377 | + if (!file.exists() || !file.isFile()) | |
378 | + throw new Exception("File: " + file.getAbsolutePath() + " doesn't exist and/or is not a file."); | |
379 | + | |
380 | + return _builder.parse(file); | |
381 | + } | |
382 | + | |
383 | + public final Document newDocument() | |
384 | + { | |
385 | + return _builder.newDocument(); | |
386 | + } | |
387 | + | |
388 | + private static class SingletonHolder | |
389 | + { | |
390 | + protected static final XMLDocumentFactory _instance; | |
391 | + | |
392 | + static | |
393 | + { | |
394 | + try | |
395 | + { | |
396 | + _instance = new XMLDocumentFactory(); | |
397 | + } | |
398 | + catch (Exception e) | |
399 | + { | |
400 | + throw new ExceptionInInitializerError(e); | |
401 | + } | |
402 | + } | |
403 | + } | |
404 | +} | |
405 | ||
406 | ||
407 | ||
408 | ||
409 | ||
410 | ### Eclipse Workspace Patch 1.0 | |
411 | #P aCis-Gameserver | |
412 | Index: java/net/sf/l2j/gameserver/model/actor/Player.java | |
413 | =================================================================== | |
414 | --- java/net/sf/l2j/gameserver/model/actor/Player.java (nonexistent) | |
415 | +++ java/net/sf/l2j/gameserver/model/actor/Player.java (working copy) | |
416 | import net.sf.l2j.gameserver.taskmanager.ShadowItemTaskManager; | |
417 | import net.sf.l2j.gameserver.taskmanager.WaterTaskManager; | |
418 | +import Base.Dungeon.Dungeon; | |
419 | +import Base.Dungeon.Instance; | |
420 | +import Base.Manager.NewCharTaskManager; | |
421 | +import Base.Util.Mysql; | |
422 | ||
423 | ||
424 | ||
425 | ||
426 | ||
427 | ||
428 | ||
429 | ||
430 | ||
431 | ||
432 | ||
433 | ||
434 | @Override | |
435 | public void onInteract(Player player) | |
436 | { | |
437 | switch (getOperateType()) | |
438 | { | |
439 | case SELL: | |
440 | case PACKAGE_SELL: | |
441 | player.sendPacket(new PrivateStoreListSell(player, this)); | |
442 | break; | |
443 | ||
444 | case BUY: | |
445 | player.sendPacket(new PrivateStoreListBuy(player, this)); | |
446 | break; | |
447 | ||
448 | case MANUFACTURE: | |
449 | player.sendPacket(new RecipeShopSellList(player, this)); | |
450 | break; | |
451 | } | |
452 | } | |
453 | ||
454 | ||
455 | + public String getIP() | |
456 | + { | |
457 | + if (getClient().getConnection() == null) | |
458 | + return "N/A IP"; | |
459 | + | |
460 | + return getClient().getConnection().getInetAddress().getHostAddress(); | |
461 | + } | |
462 | + | |
463 | + | |
464 | + public static void doNewChar(Player player, int time) | |
465 | + { | |
466 | + player.setNewChar(true); | |
467 | + NewCharTaskManager.getInstance().add(player); | |
468 | + long remainingTime = player.getMemos().getLong("newEndTime", 0); | |
469 | + if (remainingTime > 0) | |
470 | + { | |
471 | + player.getMemos().set("newEndTime", remainingTime + TimeUnit.MINUTES.toMillis(time)); | |
472 | + } | |
473 | + else | |
474 | + { | |
475 | + player.getMemos().set("newEndTime", System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(time)); | |
476 | + player.broadcastUserInfo(); | |
477 | + } | |
478 | + } | |
479 | + | |
480 | + public static void removeNewChar(Player player) | |
481 | + { | |
482 | + NewCharTaskManager.getInstance().remove(player); | |
483 | + player.getMemos().set("newEndTime", 0); | |
484 | + player.setNewChar(false); | |
485 | + player.broadcastUserInfo(); | |
486 | + | |
487 | + } | |
488 | + private boolean _isnewChar; | |
489 | + public boolean isNewChar() | |
490 | + { | |
491 | + return _isnewChar; | |
492 | + } | |
493 | + | |
494 | + public void setNewChar(boolean b) | |
495 | + { | |
496 | + _isnewChar = b; | |
497 | + } | |
498 | + private Dungeon dungeon = null; | |
499 | + public void setDungeon(Dungeon val) | |
500 | + { | |
501 | + dungeon = val; | |
502 | + } | |
503 | + | |
504 | + public Dungeon getDungeon() | |
505 | + { | |
506 | + return dungeon; | |
507 | + } | |
508 | + | |
509 | + private boolean _isInDungeonZone; | |
510 | + public boolean isInDungeonZone() | |
511 | + { | |
512 | + return _isInDungeonZone; | |
513 | + } | |
514 | + | |
515 | + | |
516 | + public void deleteTempItem(int itemObjectID) | |
517 | + { | |
518 | + boolean destroyed = false; | |
519 | + if (getInventory().getItemByObjectId(itemObjectID) != null) | |
520 | + { | |
521 | + sendMessage("Your "+ItemData.getInstance().getTemplate(getInventory().getItemByObjectId(itemObjectID).getItemId()).getName()+" has expired."); | |
522 | + destroyItem("tempItemDestroy", itemObjectID, 1, this, true); | |
523 | + getInventory().updateDatabase(); | |
524 | + sendPacket(new ItemList(this, true)); | |
525 | + | |
526 | + destroyed = true; | |
527 | + } | |
528 | + | |
529 | + if (!destroyed) | |
530 | + { | |
531 | + Connection con = null; | |
532 | + PreparedStatement statement = null; | |
533 | + ResultSet rset = null; | |
534 | + try | |
535 | + { | |
536 | + con = ConnectionPool.getConnection(); | |
537 | + statement = con.prepareStatement("DELETE FROM items WHERE object_id=?"); | |
538 | + statement.setInt(1, itemObjectID); | |
539 | + statement.execute(); | |
540 | + } | |
541 | + catch (Exception e) | |
542 | + { | |
543 | + e.printStackTrace(); | |
544 | + } | |
545 | + finally | |
546 | + { | |
547 | + Mysql.closeQuietly(con, statement, rset); | |
548 | + } | |
549 | + } | |
550 | + } | |
551 | + private boolean _isInClanDungeonZone; | |
552 | + public boolean isInClanDungeonZone() | |
553 | + { | |
554 | + return _isInClanDungeonZone; | |
555 | + } | |
556 | + | |
557 | + public void setClanDungeonZone(boolean isInClanDungeonZone) | |
558 | + { | |
559 | + _isInClanDungeonZone = isInClanDungeonZone; | |
560 | + } | |
561 | + /** | |
562 | + * @param instance | |
563 | + * @param b | |
564 | + */ | |
565 | + public static void setInstance(Instance instance, boolean b) | |
566 | + { | |
567 | + return; | |
568 | + | |
569 | + } | |
570 | ||
571 | ### Eclipse Workspace Patch 1.0 | |
572 | #P aCis-Gameserver | |
573 | Index: java/net/sf/l2j/gameserver/model/actor/Npc.java | |
574 | =================================================================== | |
575 | --- java/net/sf/l2j/gameserver/model/actor/Npc.java (nonexistent) | |
576 | +++ java/net/sf/l2j/gameserver/model/actor/Npc.java (working copy) | |
577 | import net.sf.l2j.gameserver.taskmanager.DecayTaskManager; | |
578 | import net.sf.l2j.gameserver.taskmanager.RandomAnimationTaskManager; | |
579 | +import Base.Dungeon.Instance; | |
580 | ||
581 | ||
582 | ||
583 | ||
584 | ||
585 | ||
586 | ||
587 | ||
588 | @Override | |
589 | public void onActiveRegion() | |
590 | { | |
591 | startRandomAnimationTimer(); | |
592 | } | |
593 | ||
594 | + /** | |
595 | + * @param instance | |
596 | + * @param b | |
597 | + */ | |
598 | + public void setInstance(Instance instance, boolean b) | |
599 | + { | |
600 | + return; | |
601 | + } | |
602 | ||
603 | ||
604 | ### Eclipse Workspace Patch 1.0 | |
605 | #P aCis-Gameserver | |
606 | Index: java/net/sf/l2j/gameserver/model/memo/AbstractMemo.java | |
607 | =================================================================== | |
608 | --- java/net/sf/l2j/gameserver/model/memo/AbstractMemo.java (nonexistent) | |
609 | +++ java/net/sf/l2j/gameserver/model/memo/AbstractMemo.java (working copy) | |
610 | +package net.sf.l2j.gameserver.model.memo; | |
611 | + | |
612 | +import java.util.concurrent.atomic.AtomicBoolean; | |
613 | + | |
614 | +import net.sf.l2j.commons.data.StatSet; | |
615 | + | |
616 | + | |
617 | + | |
618 | +/** | |
619 | + * A {@link StatSet} which overrides methods to prevent doing useless database operations if there is no changes since last edit (it +uses an AtomicBoolean to keep edition tracking).<br> | |
620 | + * <br> | |
621 | + * It also has 2 abstract methods, named restoreMe() and storeMe(). | |
622 | + */ | |
623 | +public abstract class AbstractMemo extends StatSet | |
624 | +{ | |
625 | + /** | |
626 | + * | |
627 | + */ | |
628 | + private static final long serialVersionUID = 1L; | |
629 | + private final AtomicBoolean _hasChanges = new AtomicBoolean(false); | |
630 | + | |
631 | + @Override | |
632 | + public final void set(String name, boolean value) | |
633 | + { | |
634 | + _hasChanges.compareAndSet(false, true); | |
635 | + super.set(name, value); | |
636 | + } | |
637 | + | |
638 | + @Override | |
639 | + public final void set(String name, double value) | |
640 | + { | |
641 | + _hasChanges.compareAndSet(false, true); | |
642 | + super.set(name, value); | |
643 | + } | |
644 | + | |
645 | + @Override | |
646 | + public final void set(String name, Enum<?> value) | |
647 | + { | |
648 | + _hasChanges.compareAndSet(false, true); | |
649 | + super.set(name, value); | |
650 | + } | |
651 | + | |
652 | + @Override | |
653 | + public final void set(String name, int value) | |
654 | + { | |
655 | + _hasChanges.compareAndSet(false, true); | |
656 | + super.set(name, value); | |
657 | + } | |
658 | + | |
659 | + @Override | |
660 | + public final void set(String name, long value) | |
661 | + { | |
662 | + _hasChanges.compareAndSet(false, true); | |
663 | + super.set(name, value); | |
664 | + } | |
665 | + | |
666 | + @Override | |
667 | + public final void set(String name, String value) | |
668 | + { | |
669 | + _hasChanges.compareAndSet(false, true); | |
670 | + super.set(name, value); | |
671 | + } | |
672 | + | |
673 | + /** | |
674 | + * @return {@code true} if changes are made since last load/save. | |
675 | + */ | |
676 | + public final boolean hasChanges() | |
677 | + { | |
678 | + return _hasChanges.get(); | |
679 | + } | |
680 | + | |
681 | + /** | |
682 | + * Atomically sets the value to the given updated value if the current value {@code ==} the expected value. | |
683 | + * @param expect | |
684 | + * @param update | |
685 | + * @return {@code true} if successful. {@code false} return indicates that the actual value was not equal to the expected value. | |
686 | + */ | |
687 | + public final boolean compareAndSetChanges(boolean expect, boolean update) | |
688 | + { | |
689 | + return _hasChanges.compareAndSet(expect, update); | |
690 | + } | |
691 | + | |
692 | + /** | |
693 | + * Removes variable | |
694 | + * @param name | |
695 | + */ | |
696 | + public final void remove(String name) | |
697 | + { | |
698 | + _hasChanges.compareAndSet(false, true); | |
699 | + unset(name); | |
700 | + } | |
701 | + | |
702 | + protected abstract boolean restoreMe(); | |
703 | + | |
704 | + protected abstract boolean storeMe(); | |
705 | +} | |
706 | ||
707 | ||
708 | ### Eclipse Workspace Patch 1.0 | |
709 | #P aCis-Gameserver | |
710 | Index: java/net/sf/l2j/gameserver/model/memo/PlayerVar.java | |
711 | =================================================================== | |
712 | --- java/net/sf/l2j/gameserver/model/memo/PlayerVar.java (nonexistent) | |
713 | +++ java/net/sf/l2j/gameserver/model/memo/PlayerVar.java (working copy) | |
714 | +package net.sf.l2j.gameserver.model.memo; | |
715 | + | |
716 | +import java.util.concurrent.ScheduledFuture; | |
717 | + | |
718 | +import net.sf.l2j.commons.pool.ThreadPool; | |
719 | + | |
720 | +import net.sf.l2j.gameserver.model.actor.Player; | |
721 | + | |
722 | +public class PlayerVar | |
723 | +{ | |
724 | + private Player owner; | |
725 | + private String name; | |
726 | + private String value; | |
727 | + private long expire_time; | |
728 | + | |
729 | + @SuppressWarnings("rawtypes") | |
730 | + private ScheduledFuture task; | |
731 | + | |
732 | + public PlayerVar(Player owner, String name, String value, long expire_time) | |
733 | + { | |
734 | + this.owner = owner; | |
735 | + this.name = name; | |
736 | + this.value = value; | |
737 | + this.expire_time = expire_time; | |
738 | + | |
739 | + if (expire_time > 0) // if expires schedule expiration | |
740 | + { | |
741 | + task = ThreadPool.schedule(new PlayerVarExpireTask(this), expire_time - System.currentTimeMillis()); | |
742 | + } | |
743 | + } | |
744 | + | |
745 | + public String getName() | |
746 | + { | |
747 | + return name; | |
748 | + } | |
749 | + | |
750 | + public Player getOwner() | |
751 | + { | |
752 | + return owner; | |
753 | + } | |
754 | + | |
755 | + public boolean hasExpired() | |
756 | + { | |
757 | + return task == null || task.isDone(); | |
758 | + } | |
759 | + | |
760 | + public long getTimeToExpire() | |
761 | + { | |
762 | + return expire_time - System.currentTimeMillis(); | |
763 | + } | |
764 | + | |
765 | + public String getValue() | |
766 | + { | |
767 | + return value; | |
768 | + } | |
769 | + | |
770 | + public boolean getValueBoolean() | |
771 | + { | |
772 | + if (isNumeric(value)) | |
773 | + return Integer.parseInt(value) > 0; | |
774 | + | |
775 | + return value.equalsIgnoreCase("true"); | |
776 | + } | |
777 | + | |
778 | + public void setValue(String val) | |
779 | + { | |
780 | + value = val; | |
781 | + } | |
782 | + | |
783 | + public void stopExpireTask() | |
784 | + { | |
785 | + if (task != null && !task.isDone()) | |
786 | + { | |
787 | + task.cancel(true); | |
788 | + } | |
789 | + } | |
790 | + | |
791 | + private static class PlayerVarExpireTask implements Runnable | |
792 | + { | |
793 | + private PlayerVar _pv; | |
794 | + | |
795 | + public PlayerVarExpireTask(PlayerVar pv) | |
796 | + { | |
797 | + _pv = pv; | |
798 | + } | |
799 | + | |
800 | + @Override | |
801 | + public void run() | |
802 | + { | |
803 | + Player pc = _pv.getOwner(); | |
804 | + if (pc == null) | |
805 | + { | |
806 | + return; | |
807 | + } | |
808 | + | |
809 | + PlayerMemo.unsetVar(pc, _pv.getName()); | |
810 | + } | |
811 | + } | |
812 | + | |
813 | + public boolean isNumeric(String str) | |
814 | + { | |
815 | + try | |
816 | + { | |
817 | + @SuppressWarnings("unused") | |
818 | + double d = Double.parseDouble(str); | |
819 | + } | |
820 | + catch (NumberFormatException nfe) | |
821 | + { | |
822 | + return false; | |
823 | + } | |
824 | + return true; | |
825 | + } | |
826 | +} | |
827 | ||
828 | ||
829 | ||
830 | ||
831 | ||
832 | ||
833 | ||
834 | ### Eclipse Workspace Patch 1.0 | |
835 | #P aCis-Gameserver | |
836 | Index: java/net/sf/l2j/gameserver/model/memo/PlayerMemo.java | |
837 | =================================================================== | |
838 | --- java/net/sf/l2j/gameserver/model/memo/PlayerMemo.java (nonexistent) | |
839 | +++ java/net/sf/l2j/gameserver/model/memo/PlayerMemo.java (working copy) | |
840 | +package net.sf.l2j.gameserver.model.memo; | |
841 | + | |
842 | +import java.sql.Connection; | |
843 | +import java.sql.PreparedStatement; | |
844 | +import java.sql.ResultSet; | |
845 | +import java.sql.SQLException; | |
846 | +import java.util.logging.Level; | |
847 | +import java.util.logging.Logger; | |
848 | + | |
849 | +import net.sf.l2j.commons.pool.ConnectionPool; | |
850 | + | |
851 | +import net.sf.l2j.gameserver.model.actor.Player; | |
852 | + | |
853 | +import Base.Util.Mysql; | |
854 | + | |
855 | +/** | |
856 | + * An implementation of {@link AbstractMemo} used for Player. There is a restore/save system. | |
857 | + */ | |
858 | +public class PlayerMemo extends AbstractMemo | |
859 | +{ | |
860 | + /** | |
861 | + * | |
862 | + */ | |
863 | + private static final long serialVersionUID = 1L; | |
864 | + | |
865 | + private static final Logger LOG = Logger.getLogger(PlayerMemo.class.getName()); | |
866 | + | |
867 | + private static final String SELECT_QUERY = "SELECT * FROM character_memo WHERE charId = ?"; | |
868 | + private static final String DELETE_QUERY = "DELETE FROM character_memo WHERE charId = ?"; | |
869 | + private static final String INSERT_QUERY = "INSERT INTO character_memo (charId, var, val) VALUES (?, ?, ?)"; | |
870 | + | |
871 | + private final int _objectId; | |
872 | + | |
873 | + public PlayerMemo(int objectId) | |
874 | + { | |
875 | + _objectId = objectId; | |
876 | + restoreMe(); | |
877 | + } | |
878 | + | |
879 | + | |
880 | + // When var exist | |
881 | + public static void changeValue(Player player, String name, String value) | |
882 | + { | |
883 | + if (!player.getMemos().containsKey(name)) | |
884 | + { | |
885 | + player.sendMessage("Variable is not exist..."); | |
886 | + return; | |
887 | + } | |
888 | + | |
889 | + getVarObject(player, name).setValue(value); | |
890 | + Mysql.set("UPDATE character_memo_dungeon SET value=? WHERE obj_id=? AND name=?", value, player.getObjectId(), name); | |
891 | + } | |
892 | + | |
893 | + public static void setVar(Player player, String name, String value, long expirationTime) | |
894 | + { | |
895 | + if (player.getMemos().containsKey(name)) | |
896 | + getVarObject(player, name).stopExpireTask(); | |
897 | + | |
898 | + player.getMemos().put(name, new PlayerVar(player, name, value, expirationTime)); | |
899 | + Mysql.set("REPLACE INTO character_memo_dungeon (obj_id, name, value, expire_time) VALUES (?,?,?,?)", player.getObjectId(), name, value, expirationTime); | |
900 | + } | |
901 | + | |
902 | + public static void setVar(Player player, String name, int value, long expirationTime) | |
903 | + { | |
904 | + setVar(player, name, String.valueOf(value), expirationTime); | |
905 | + } | |
906 | + | |
907 | + public void setVar(Player player, String name, long value, long expirationTime) | |
908 | + { | |
909 | + setVar(player, name, String.valueOf(value), expirationTime); | |
910 | + } | |
911 | + | |
912 | + | |
913 | + public static PlayerVar getVarObject(Player player, String name) | |
914 | + { | |
915 | + if(player.getMemos() == null) | |
916 | + return null; | |
917 | + | |
918 | + return (PlayerVar) player.getMemos().get(name); | |
919 | + } | |
920 | + | |
921 | + public static long getVarTimeToExpire(Player player, String name) | |
922 | + { | |
923 | + try | |
924 | + { | |
925 | + return getVarObject(player, name).getTimeToExpire(); | |
926 | + } | |
927 | + catch (NullPointerException npe) | |
928 | + { | |
929 | + } | |
930 | + | |
931 | + return 0; | |
932 | + } | |
933 | + | |
934 | + public static void unsetVar(Player player, String name) | |
935 | + { | |
936 | + if (name == null) | |
937 | + return; | |
938 | + | |
939 | + // Avoid possible unsetVar that have elements for login | |
940 | + if(player == null) | |
941 | + return; | |
942 | + | |
943 | + PlayerVar pv = (PlayerVar) player.getMemos().get(name); | |
944 | + | |
945 | + if (pv != null) | |
946 | + { | |
947 | + if(name.contains("delete_temp_item")) | |
948 | + pv.getOwner().deleteTempItem(Integer.parseInt(pv.getValue())); | |
949 | + else if(name.contains("solo_hero")) { | |
950 | + pv.getOwner().broadcastCharInfo(); | |
951 | + pv.getOwner().broadcastUserInfo(); | |
952 | + } | |
953 | + | |
954 | + | |
955 | + Mysql.set("DELETE FROM character_memo_dungeon WHERE obj_id=? AND name=? LIMIT 1", pv.getOwner().getObjectId(), name); | |
956 | + | |
957 | + pv.stopExpireTask(); | |
958 | + } | |
959 | + } | |
960 | + | |
961 | + public static void deleteExpiredVar(Player player, String name, String value) | |
962 | + { | |
963 | + if (name == null) | |
964 | + return; | |
965 | + | |
966 | + if(name.contains("delete_temp_item")) | |
967 | + player.deleteTempItem(Integer.parseInt(value)); | |
968 | + /*else if(name.contains("solo_hero")) // Useless | |
969 | + player.broadcastCharInfo();*/ | |
970 | + | |
971 | + Mysql.set("DELETE FROM character_memo_dungeon WHERE obj_id=? AND name=? LIMIT 1", player.getObjectId(), name); | |
972 | + } | |
973 | + | |
974 | + public static String getVar(Player player, String name) | |
975 | + { | |
976 | + PlayerVar pv = getVarObject(player, name); | |
977 | + | |
978 | + if (pv == null) | |
979 | + return null; | |
980 | + | |
981 | + return pv.getValue(); | |
982 | + } | |
983 | + | |
984 | + @SuppressWarnings("resource") | |
985 | + public static long getVarTimeToExpireSQL(Player player, String name) | |
986 | + { | |
987 | + long expireTime = 0; | |
988 | + | |
989 | + try (Connection con = ConnectionPool.getConnection()) | |
990 | + { | |
991 | + PreparedStatement statement = con.prepareStatement("SELECT expire_time FROM character_memo_dungeon WHERE obj_id = ? AND name = ?"); | |
992 | + statement.setLong(1, player.getObjectId()); | |
993 | + statement.setString(2, name); | |
994 | + for (ResultSet rset = statement.executeQuery(); rset.next();) | |
995 | + expireTime = rset.getLong("expire_time"); | |
996 | + | |
997 | + con.close(); | |
998 | + statement.close(); | |
999 | + } | |
1000 | + catch (Exception e) | |
1001 | + { | |
1002 | + e.printStackTrace(); | |
1003 | + } | |
1004 | + | |
1005 | + return expireTime; | |
1006 | + } | |
1007 | + | |
1008 | + public static boolean getVarB(Player player, String name, boolean defaultVal) | |
1009 | + { | |
1010 | + PlayerVar pv = getVarObject(player, name); | |
1011 | + | |
1012 | + if (pv == null) | |
1013 | + return defaultVal; | |
1014 | + | |
1015 | + return pv.getValueBoolean(); | |
1016 | + } | |
1017 | + | |
1018 | + public static boolean getVarB(Player player, String name) | |
1019 | + { | |
1020 | + return getVarB(player, name, false); | |
1021 | + } | |
1022 | + | |
1023 | + public long getVarLong(Player player, String name) | |
1024 | + { | |
1025 | + return getVarLong(player, name, 0L); | |
1026 | + } | |
1027 | + | |
1028 | + public long getVarLong(Player player, String name, long defaultVal) | |
1029 | + { | |
1030 | + long result = defaultVal; | |
1031 | + String var = getVar(player, name); | |
1032 | + if (var != null) | |
1033 | + result = Long.parseLong(var); | |
1034 | + | |
1035 | + return result; | |
1036 | + } | |
1037 | + | |
1038 | + public static int getVarInt(Player player, String name) | |
1039 | + { | |
1040 | + return getVarInt(player, name, 0); | |
1041 | + } | |
1042 | + | |
1043 | + public static int getVarInt(Player player, String name, int defaultVal) | |
1044 | + { | |
1045 | + int result = defaultVal; | |
1046 | + String var = getVar(player, name); | |
1047 | + if (var != null) | |
1048 | + { | |
1049 | + if(var.equalsIgnoreCase("true")) | |
1050 | + result = 1; | |
1051 | + else if(var.equalsIgnoreCase("false")) | |
1052 | + result = 0; | |
1053 | + else | |
1054 | + result = Integer.parseInt(var); | |
1055 | + } | |
1056 | + return result; | |
1057 | + } | |
1058 | + | |
1059 | + public static void loadVariables(Player player) | |
1060 | + { | |
1061 | + Connection con = null; | |
1062 | + PreparedStatement offline = null; | |
1063 | + ResultSet rs = null; | |
1064 | + try | |
1065 | + { | |
1066 | + | |
1067 | + con = ConnectionPool.getConnection(); | |
1068 | + offline = con.prepareStatement("SELECT * FROM character_memo_dungeon WHERE obj_id = ?"); | |
1069 | + offline.setInt(1, player.getObjectId()); | |
1070 | + rs = offline.executeQuery(); | |
1071 | + | |
1072 | + while (rs.next()) | |
1073 | + { | |
1074 | + String name = rs.getString("name"); | |
1075 | + String value = rs.getString("value"); | |
1076 | + long expire_time = rs.getLong("expire_time"); | |
1077 | + long curtime = System.currentTimeMillis(); | |
1078 | + | |
1079 | + if ((expire_time <= curtime) && (expire_time > 0)) | |
1080 | + { | |
1081 | + deleteExpiredVar(player, name, rs.getString("value")); //TODO: Remove the Var | |
1082 | + continue; | |
1083 | + } | |
1084 | + | |
1085 | + player.getMemos().put(name, new PlayerVar(player, name, value, expire_time)); | |
1086 | + } | |
1087 | + | |
1088 | + con.close(); | |
1089 | + } | |
1090 | + catch (Exception e) | |
1091 | + { | |
1092 | + e.printStackTrace(); | |
1093 | + } | |
1094 | + finally | |
1095 | + { | |
1096 | + Mysql.closeQuietly(con, offline, rs); | |
1097 | + } | |
1098 | + } | |
1099 | + | |
1100 | + public static String getVarValue(Player player, String var, String defaultString) | |
1101 | + { | |
1102 | + String value = null; | |
1103 | + Connection con = null; | |
1104 | + PreparedStatement offline = null; | |
1105 | + ResultSet rs = null; | |
1106 | + try | |
1107 | + { | |
1108 | + | |
1109 | + con = ConnectionPool.getConnection(); | |
1110 | + offline = con.prepareStatement("SELECT value FROM character_memo_dungeon WHERE obj_id = ? AND name = ?"); | |
1111 | + offline.setInt(1, player.getObjectId()); | |
1112 | + offline.setString(2, var); | |
1113 | + rs = offline.executeQuery(); | |
1114 | + if (rs.next()) | |
1115 | + value = rs.getString("value"); | |
1116 | + | |
1117 | + con.close(); | |
1118 | + } | |
1119 | + catch (Exception e) | |
1120 | + { | |
1121 | + e.printStackTrace(); | |
1122 | + } | |
1123 | + finally | |
1124 | + { | |
1125 | + Mysql.closeQuietly(con, offline, rs); | |
1126 | + } | |
1127 | + return value == null ? defaultString : value; | |
1128 | + } | |
1129 | + | |
1130 | + public static String getVarValue(int objectId, String var, String defaultString) | |
1131 | + { | |
1132 | + String value = null; | |
1133 | + Connection con = null; | |
1134 | + PreparedStatement offline = null; | |
1135 | + ResultSet rs = null; | |
1136 | + try | |
1137 | + { | |
1138 | + | |
1139 | + con = ConnectionPool.getConnection(); | |
1140 | + offline = con.prepareStatement("SELECT value FROM character_memo_dungeon WHERE obj_id = ? AND name = ?"); | |
1141 | + offline.setInt(1, objectId); | |
1142 | + offline.setString(2, var); | |
1143 | + rs = offline.executeQuery(); | |
1144 | + if (rs.next()) | |
1145 | + value = rs.getString("value"); | |
1146 | + | |
1147 | + con.close(); | |
1148 | + } | |
1149 | + catch (Exception e) | |
1150 | + { | |
1151 | + e.printStackTrace(); | |
1152 | + } | |
1153 | + finally | |
1154 | + { | |
1155 | + Mysql.closeQuietly(con, offline, rs); | |
1156 | + } | |
1157 | + return value == null ? defaultString : value; | |
1158 | + } | |
1159 | + | |
1160 | + @Override | |
1161 | + public boolean restoreMe() | |
1162 | + { | |
1163 | + | |
1164 | + // Restore previous variables. | |
1165 | + try (Connection con = ConnectionPool.getConnection()) | |
1166 | + { | |
1167 | + PreparedStatement st = con.prepareStatement(SELECT_QUERY); | |
1168 | + st.setInt(1, _objectId); | |
1169 | + | |
1170 | + ResultSet rset = st.executeQuery(); | |
1171 | + while (rset.next()) | |
1172 | + set(rset.getString("var"), rset.getString("val")); | |
1173 | + | |
1174 | + rset.close(); | |
1175 | + st.close(); | |
1176 | + } | |
1177 | + catch (SQLException e) | |
1178 | + { | |
1179 | + LOG.log(Level.SEVERE, "Couldn't restore variables for player id: " + _objectId, e); | |
1180 | + return false; | |
1181 | + } | |
1182 | + finally | |
1183 | + { | |
1184 | + compareAndSetChanges(true, false); | |
1185 | + } | |
1186 | + return true; | |
1187 | + } | |
1188 | + | |
1189 | + @Override | |
1190 | + public boolean storeMe() | |
1191 | + { | |
1192 | + // No changes, nothing to store. | |
1193 | + if (!hasChanges()) | |
1194 | + return false; | |
1195 | + | |
1196 | + | |
1197 | + try (Connection con = ConnectionPool.getConnection()) | |
1198 | + { | |
1199 | + // Clear previous entries. | |
1200 | + PreparedStatement st = con.prepareStatement(DELETE_QUERY); | |
1201 | + st.setInt(1, _objectId); | |
1202 | + st.execute(); | |
1203 | + st.close(); | |
1204 | + | |
1205 | + // Insert all variables. | |
1206 | + st = con.prepareStatement(INSERT_QUERY); | |
1207 | + st.setInt(1, _objectId); | |
1208 | + for (Entry<String, Object> entry : entrySet()) | |
1209 | + { | |
1210 | + st.setString(2, entry.getKey()); | |
1211 | + st.setString(3, String.valueOf(entry.getValue())); | |
1212 | + st.addBatch(); | |
1213 | + } | |
1214 | + st.executeBatch(); | |
1215 | + st.close(); | |
1216 | + } | |
1217 | + catch (SQLException e) | |
1218 | + { | |
1219 | + LOG.log(Level.SEVERE, "Couldn't update variables for player id: " + _objectId, e); | |
1220 | + return false; | |
1221 | + } | |
1222 | + finally | |
1223 | + { | |
1224 | + compareAndSetChanges(true, false); | |
1225 | + } | |
1226 | + return true; | |
1227 | + } | |
1228 | +} | |
1229 | ||
1230 | ||
1231 | ### Eclipse Workspace Patch 1.0 | |
1232 | #P aCis-Gameserver | |
1233 | Index: java/net/sf/l2j/gameserver/model/actor/instance/DungeonManagerNpc.java | |
1234 | =================================================================== | |
1235 | --- java/net/sf/l2j/gameserver/model/actor/instance/DungeonManagerNpc.java (nonexistent) | |
1236 | +++ java/net/sf/l2j/gameserver/model/actor/instance/DungeonManagerNpc.java (working copy) | |
1237 | +/* | |
1238 | + * This program is free software: you can redistribute it and/or modify it under | |
1239 | + * the terms of the GNU General Public License as published by the Free Software | |
1240 | + * Foundation, either version 3 of the License, or (at your option) any later | |
1241 | + * version. | |
1242 | + * | |
1243 | + * This program is distributed in the hope that it will be useful, but WITHOUT | |
1244 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
1245 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
1246 | + * details. | |
1247 | + * | |
1248 | + * You should have received a copy of the GNU General Public License along with | |
1249 | + * this program. If not, see <http://www.gnu.org/licenses/>. | |
1250 | + */ | |
1251 | +package net.sf.l2j.gameserver.model.actor.instance; | |
1252 | + | |
1253 | + | |
1254 | + | |
1255 | +import java.util.StringTokenizer; | |
1256 | + | |
1257 | +import net.sf.l2j.Config; | |
1258 | +import net.sf.l2j.gameserver.model.actor.Player; | |
1259 | +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate; | |
1260 | +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; | |
1261 | + | |
1262 | +import Base.Dungeon.DungeonManager; | |
1263 | + | |
1264 | + | |
1265 | + | |
1266 | +/** | |
1267 | + * @author Anarchy | |
1268 | + */ | |
1269 | +public class DungeonManagerNpc extends Folk | |
1270 | +{ | |
1271 | + public DungeonManagerNpc(int objectId, NpcTemplate template) | |
1272 | + { | |
1273 | + super(objectId, template); | |
1274 | + } | |
1275 | + | |
1276 | + @Override | |
1277 | + public void onBypassFeedback(Player player, String command) | |
1278 | + { | |
1279 | + if (command.startsWith("dungeon")) | |
1280 | + { | |
1281 | + if (DungeonManager.getInstance().isInDungeon(player) || player.isInOlympiadMode()) | |
1282 | + { | |
1283 | + player.sendMessage("You are currently unable to enter a Dungeon. Please try again later."); | |
1284 | + return; | |
1285 | + } | |
1286 | + | |
1287 | + if (player.getInventory().getItemByItemId(Config.DUNGEON_COIN_ID) == null) | |
1288 | + { | |
1289 | + DungeonManagerNpc.mainHtml(player, 0); | |
1290 | + return; | |
1291 | + } | |
1292 | + | |
1293 | + player.destroyItemByItemId("Quest",Config.DUNGEON_COIN_ID, Config.CONT_DUNGEON_ITEM, player, true); | |
1294 | + int dungeonId = Integer.parseInt(command.substring(8)); | |
1295 | + | |
1296 | + | |
1297 | + if(dungeonId == 1 || dungeonId == 2) | |
1298 | + { | |
1299 | + | |
1300 | + | |
1301 | + DungeonManager.getInstance().enterDungeon(dungeonId, player); | |
1302 | + | |
1303 | + } | |
1304 | + } | |
1305 | + else | |
1306 | + super.onBypassFeedback(player, command); | |
1307 | + } | |
1308 | + public static void mainHtml(Player activeChar, int time) | |
1309 | + { | |
1310 | + if (activeChar.isOnline()) | |
1311 | + { | |
1312 | + NpcHtmlMessage nhm = new NpcHtmlMessage(5); | |
1313 | + StringBuilder html1 = new StringBuilder(""); | |
1314 | + html1.append("<html><head><title>Dungeon</title></head><body><center>"); | |
1315 | + html1.append("<br>"); | |
1316 | + html1.append("Your character Cont Item."); | |
1317 | + html1.append("</center>"); | |
1318 | + html1.append("</body></html>"); | |
1319 | + nhm.setHtml(html1.toString()); | |
1320 | + activeChar.sendPacket(nhm); | |
1321 | + } | |
1322 | + | |
1323 | + } | |
1324 | + | |
1325 | + public static String getPlayerStatus(Player player, int dungeonId) | |
1326 | + { | |
1327 | + String s = "You can enter"; | |
1328 | + | |
1329 | + String ip = player.getIP(); // Is ip or hwid? | |
1330 | + if (DungeonManager.getInstance().getPlayerData().containsKey(ip) && DungeonManager.getInstance().getPlayerData().get(ip)[dungeonId] > 0) | |
1331 | + { | |
1332 | + long total = (DungeonManager.getInstance().getPlayerData().get(ip)[dungeonId] + (1000*60*60*12)) - System.currentTimeMillis(); | |
1333 | + | |
1334 | + if (total > 0) | |
1335 | + { | |
1336 | + int hours = (int) (total/1000/60/60); | |
1337 | + int minutes = (int) ((total/1000/60) - hours*60); | |
1338 | + int seconds = (int) ((total/1000) - (hours*60*60 + minutes*60)); | |
1339 | + | |
1340 | + s = String.format("%02d:%02d:%02d", hours, minutes, seconds); | |
1341 | + } | |
1342 | + } | |
1343 | + | |
1344 | + return s; | |
1345 | + } | |
1346 | + | |
1347 | + @Override | |
1348 | + public void showChatWindow(Player player, int val) | |
1349 | + { | |
1350 | + NpcHtmlMessage htm = new NpcHtmlMessage(getObjectId()); | |
1351 | + htm.setFile("data/html/mods/dungeon/"+getNpcId()+(val == 0 ? "" : "-"+val)+".htm"); | |
1352 | + | |
1353 | + String[] s = htm.getHtml().split("%"); | |
1354 | + for (int i = 0; i < s.length; i++) | |
1355 | + { | |
1356 | + if (i % 2 > 0 && s[i].contains("dung ")) | |
1357 | + { | |
1358 | + StringTokenizer st = new StringTokenizer(s[i]); | |
1359 | + st.nextToken(); | |
1360 | + htm.replace("%"+s[i]+"%", getPlayerStatus(player, Integer.parseInt(st.nextToken()))); | |
1361 | + } | |
1362 | + } | |
1363 | + | |
1364 | + htm.replace("%objectId%", getObjectId()+""); | |
1365 | + | |
1366 | + player.sendPacket(htm); | |
1367 | + } | |
1368 | + | |
1369 | + @Override | |
1370 | + public String getHtmlPath(int npcId, int val) | |
1371 | + { | |
1372 | + String filename = ""; | |
1373 | + if (val == 0) | |
1374 | + filename = "" + npcId; | |
1375 | + else | |
1376 | + filename = npcId + "-" + val; | |
1377 | + | |
1378 | + return "data/html/mods/dungeon/" + filename + ".htm"; | |
1379 | + } | |
1380 | +} | |
1381 | ||
1382 | ### Eclipse Workspace Patch 1.0 | |
1383 | #P aCis-Gameserver | |
1384 | Index: java/net/sf/l2j/gameserver/network/serverpackets/NpcHtmlMessage.java | |
1385 | =================================================================== | |
1386 | --- java/net/sf/l2j/gameserver/network/serverpackets/NpcHtmlMessage.java (nonexistent) | |
1387 | +++ java/net/sf/l2j/gameserver/network/serverpackets/NpcHtmlMessage.java (working copy) | |
1388 | ||
1389 | public void replace(String pattern, double value) | |
1390 | { | |
1391 | _html = _html.replaceAll(pattern, Double.toString(value)); | |
1392 | } | |
1393 | ||
1394 | + public String getHtml() | |
1395 | + { | |
1396 | + return _html; | |
1397 | + } | |
1398 | ||
1399 | ||
1400 | ||
1401 | ||
1402 | ||
1403 | ### Eclipse Workspace Patch 1.0 | |
1404 | #P aCis-Gameserver | |
1405 | Index: java/net/sf/l2j/gameserver/model/actor/instance/DungeonMob.java | |
1406 | =================================================================== | |
1407 | --- java/net/sf/l2j/gameserver/model/actor/instance/DungeonMob.java (nonexistent) | |
1408 | +++ java/net/sf/l2j/gameserver/model/actor/instance/DungeonMob.java (working copy) | |
1409 | +/* | |
1410 | + * This program is free software: you can redistribute it and/or modify it under | |
1411 | + * the terms of the GNU General Public License as published by the Free Software | |
1412 | + * Foundation, either version 3 of the License, or (at your option) any later | |
1413 | + * version. | |
1414 | + * | |
1415 | + * This program is distributed in the hope that it will be useful, but WITHOUT | |
1416 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
1417 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
1418 | + * details. | |
1419 | + * | |
1420 | + * You should have received a copy of the GNU General Public License along with | |
1421 | + * this program. If not, see <http://www.gnu.org/licenses/>. | |
1422 | + */ | |
1423 | +package net.sf.l2j.gameserver.model.actor.instance; | |
1424 | + | |
1425 | + | |
1426 | + | |
1427 | + | |
1428 | +import net.sf.l2j.commons.pool.ThreadPool; | |
1429 | + | |
1430 | +import net.sf.l2j.gameserver.model.actor.Creature; | |
1431 | +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate; | |
1432 | + | |
1433 | +import Base.Dungeon.Dungeon; | |
1434 | + | |
1435 | + | |
1436 | + | |
1437 | +/** | |
1438 | + * @author Anarchy | |
1439 | + */ | |
1440 | +public class DungeonMob extends Monster | |
1441 | +{ | |
1442 | + private Dungeon dungeon; | |
1443 | + | |
1444 | + public DungeonMob(int objectId, NpcTemplate template) | |
1445 | + { | |
1446 | + super(objectId, template); | |
1447 | + } | |
1448 | + | |
1449 | + @Override | |
1450 | + public boolean doDie(Creature killer) | |
1451 | + { | |
1452 | + if (!super.doDie(killer)) | |
1453 | + return false; | |
1454 | + | |
1455 | + if(dungeon != null) // It will be dungeon == null when mob is spawned from admin and not from dungeon | |
1456 | + ThreadPool.schedule(() -> dungeon.onMobKill(this), 1000*2); | |
1457 | + | |
1458 | + return true; | |
1459 | + } | |
1460 | + | |
1461 | + public void setDungeon(Dungeon dungeon) | |
1462 | + { | |
1463 | + this.dungeon = dungeon; | |
1464 | + } | |
1465 | +} | |
1466 | ||
1467 | ||
1468 | ||
1469 | ||
1470 | ||
1471 | ||
1472 | ### Eclipse Workspace Patch 1.0 | |
1473 | #P aCis-Gameserver | |
1474 | Index: java/Base/Dungeon/Dungeon.java | |
1475 | =================================================================== | |
1476 | --- java/Base/Dungeon/Dungeon.java (nonexistent) | |
1477 | +++ java/Base/Dungeon/Dungeon.java (working copy) | |
1478 | +/* | |
1479 | + * This program is free software: you can redistribute it and/or modify it under | |
1480 | + * the terms of the GNU General Public License as published by the Free Software | |
1481 | + * Foundation, either version 3 of the License, or (at your option) any later | |
1482 | + * version. | |
1483 | + * | |
1484 | + * This program is distributed in the hope that it will be useful, but WITHOUT | |
1485 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
1486 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
1487 | + * details. | |
1488 | + * | |
1489 | + * You should have received a copy of the GNU General Public License along with | |
1490 | + * this program. If not, see <http://www.gnu.org/licenses/>. | |
1491 | + */ | |
1492 | +package Base.Dungeon; | |
1493 | + | |
1494 | +import java.util.List; | |
1495 | +import java.util.Map.Entry; | |
1496 | +import java.util.concurrent.CopyOnWriteArrayList; | |
1497 | +import java.util.concurrent.ScheduledFuture; | |
1498 | ||
1499 | +import net.sf.l2j.commons.pool.ThreadPool; | |
1500 | + | |
1501 | +import net.sf.l2j.gameserver.data.sql.SpawnTable; | |
1502 | +import net.sf.l2j.gameserver.data.xml.NpcData; | |
1503 | +import net.sf.l2j.gameserver.model.actor.Player; | |
1504 | +import net.sf.l2j.gameserver.model.actor.instance.DungeonMob; | |
1505 | +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate; | |
1506 | +import net.sf.l2j.gameserver.model.location.Location; | |
1507 | +import net.sf.l2j.gameserver.model.memo.PlayerMemo; | |
1508 | +import net.sf.l2j.gameserver.model.spawn.Spawn; | |
1509 | +import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage; | |
1510 | +import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage.SMPOS; | |
1511 | +import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse; | |
1512 | +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; | |
1513 | ||
1514 | +/** | |
1515 | + * @author Anarchy | |
1516 | + */ | |
1517 | +public class Dungeon | |
1518 | +{ | |
1519 | + private DungeonTemplate template; | |
1520 | + private List<Player> players; | |
1521 | + private ScheduledFuture<?> dungeonCancelTask = null; | |
1522 | + private ScheduledFuture<?> nextTask = null; | |
1523 | + private ScheduledFuture<?> timerTask = null; | |
1524 | + private DungeonStage currentStage = null; | |
1525 | + private long stageBeginTime = 0; | |
1526 | + private List<DungeonMob> mobs = new CopyOnWriteArrayList<>(); | |
1527 | + private Instance instance; | |
1528 | + | |
1529 | + public Dungeon(DungeonTemplate template, List<Player> players) | |
1530 | + { | |
1531 | + this.template = template; | |
1532 | + this.players = players; | |
1533 | + instance = InstanceManager.getInstance().createInstance(); | |
1534 | + | |
1535 | + for (Player player : players) | |
1536 | + player.setDungeon(this); | |
1537 | + | |
1538 | + beginTeleport(); | |
1539 | + } | |
1540 | + | |
1541 | + public void onPlayerDeath(Player player) | |
1542 | + { | |
1543 | + if (!players.contains(player)) | |
1544 | + return; | |
1545 | + | |
1546 | + if (players.size() == 1) | |
1547 | + ThreadPool.schedule(() -> cancelDungeon(), 5 * 1000); | |
1548 | + else | |
1549 | + player.sendMessage("You will be ressurected if your team completes this stage."); | |
1550 | + } | |
1551 | + | |
1552 | + public synchronized void onMobKill(DungeonMob mob) | |
1553 | + { | |
1554 | + if (!mobs.contains(mob)) | |
1555 | + return; | |
1556 | + | |
1557 | + deleteMob(mob); | |
1558 | + | |
1559 | + if (mobs.isEmpty()) | |
1560 | + { | |
1561 | + if (dungeonCancelTask != null) | |
1562 | + dungeonCancelTask.cancel(false); | |
1563 | + if (timerTask != null) | |
1564 | + timerTask.cancel(true); | |
1565 | + if (nextTask != null) | |
1566 | + nextTask.cancel(true); | |
1567 | + | |
1568 | + for (Player player : players) | |
1569 | + if (player.isDead()) | |
1570 | + player.doRevive(); | |
1571 | + | |
1572 | + getNextStage(); | |
1573 | + if (currentStage == null) // No more stages | |
1574 | + { | |
1575 | + rewardPlayers(); | |
1576 | + if (template.getRewardHtm().equals("NULL")) | |
1577 | + { | |
1578 | + broadcastScreenMessage("You have completed the dungeon!", 5); | |
1579 | + teleToTown(); | |
1580 | + } | |
1581 | + else | |
1582 | + { | |
1583 | + broadcastScreenMessage("You have completed the dungeon! Select your reward", 5); | |
1584 | + // teleToTown(); | |
1585 | + } | |
1586 | + InstanceManager.getInstance().deleteInstance(instance.getId()); | |
1587 | + DungeonManager.getInstance().removeDungeon(this); | |
1588 | + } | |
1589 | + else | |
1590 | + { | |
1591 | + broadcastScreenMessage("You have completed stage " + (currentStage.getOrder() - 1) + "! Next stage begins in 10 seconds.", 5); | |
1592 | + ThreadPool.schedule(() -> teleToStage(), 5 * 1000); | |
1593 | + nextTask = ThreadPool.schedule(() -> beginStage(), 10 * 1000); | |
1594 | + } | |
1595 | + } | |
1596 | + } | |
1597 | + | |
1598 | + private void rewardPlayers() | |
1599 | + { | |
1600 | + // First Add Fixed Reward | |
1601 | + for (Player player : players) | |
1602 | + { | |
1603 | + | |
1604 | + PlayerMemo.setVar(player, "dungeon_atleast1time", "true", -1); | |
1605 | + for (Entry<Integer, Integer> itemId : template.getRewards().entrySet()) | |
1606 | + { | |
1607 | + player.addItem("dungeon reward", itemId.getKey(), itemId.getValue(), null, true); | |
1608 | + } | |
1609 | + } | |
1610 | + | |
1611 | + if (!template.getRewardHtm().equals("NULL")) | |
1612 | + { | |
1613 | + NpcHtmlMessage htm = new NpcHtmlMessage(0); | |
1614 | + htm.setFile(template.getRewardHtm()); | |
1615 | + for (Player player : players) | |
1616 | + player.sendPacket(htm); | |
1617 | + } | |
1618 | + else | |
1619 | + { | |
1620 | + for (Player player : players) | |
1621 | + { | |
1622 | + Player.setInstance(InstanceManager.getInstance().getInstance(0), true); | |
1623 | + player.teleportTo(82635, 148798, -3464, 25); | |
1624 | + } | |
1625 | + } | |
1626 | + } | |
1627 | + | |
1628 | + private void teleToStage() | |
1629 | + { | |
1630 | + if (!currentStage.teleport()) | |
1631 | + return; | |
1632 | + | |
1633 | + for (Player player : players) | |
1634 | + player.teleportTo(currentStage.getLocation(), 25); | |
1635 | + } | |
1636 | + | |
1637 | + private void teleToTown() | |
1638 | + { | |
1639 | + for (Player player : players) | |
1640 | + { | |
1641 | + if (!player.isOnline() || player.getClient().isDetached()) | |
1642 | + continue; | |
1643 | + | |
1644 | + DungeonManager.getInstance().getDungeonParticipants().remove(player.getObjectId()); | |
1645 | + player.setDungeon(null); | |
1646 | + Player.setInstance(InstanceManager.getInstance().getInstance(0), true); | |
1647 | + player.teleportTo(82635, 148798, -3464, 25); | |
1648 | + } | |
1649 | + } | |
1650 | + | |
1651 | + private void cancelDungeon() | |
1652 | + { | |
1653 | + for (Player player : players) | |
1654 | + { | |
1655 | + if (player.isDead()) | |
1656 | + player.doRevive(); | |
1657 | + | |
1658 | + | |
1659 | + } | |
1660 | + | |
1661 | + | |
1662 | + for (DungeonMob mob : mobs) | |
1663 | + deleteMob(mob); | |
1664 | + | |
1665 | + broadcastScreenMessage("You have failed to complete the dungeon. You will be teleported back in 10 seconds.", 5); | |
1666 | + teleToTown(); | |
1667 | + | |
1668 | + InstanceManager.getInstance().deleteInstance(instance.getId()); | |
1669 | + DungeonManager.getInstance().removeDungeon(this); | |
1670 | + | |
1671 | + if (nextTask != null) | |
1672 | + nextTask.cancel(true); | |
1673 | + if (timerTask != null) | |
1674 | + timerTask.cancel(true); | |
1675 | + if (dungeonCancelTask != null) | |
1676 | + dungeonCancelTask.cancel(true); | |
1677 | + } | |
1678 | + | |
1679 | + private void deleteMob(DungeonMob mob) | |
1680 | + { | |
1681 | + if (!mobs.contains(mob)) | |
1682 | + return; | |
1683 | + | |
1684 | + mobs.remove(mob); | |
1685 | + if (mob.getSpawn() != null) | |
1686 | + SpawnTable.getInstance().deleteSpawn(mob.getSpawn(), false); | |
1687 | + mob.deleteMe(); | |
1688 | + } | |
1689 | + | |
1690 | + private void beginStage() | |
1691 | + { | |
1692 | + for (int mobId : currentStage.getMobs().keySet()) | |
1693 | + spawnMob(mobId, currentStage.getMobs().get(mobId)); | |
1694 | + | |
1695 | + stageBeginTime = System.currentTimeMillis(); | |
1696 | + timerTask = ThreadPool.scheduleAtFixedRate(() -> broadcastTimer(), 5 * 1000, 1000); | |
1697 | + nextTask = null; | |
1698 | + dungeonCancelTask = ThreadPool.schedule(() -> cancelDungeon(), 1000 * 60 * currentStage.getMinutes()); | |
1699 | + broadcastScreenMessage("You have " + currentStage.getMinutes() + " minutes to finish stage " + currentStage.getOrder() + "!", 5); | |
1700 | + } | |
1701 | + | |
1702 | + private void spawnMob(int mobId, List<Location> locations) | |
1703 | + { | |
1704 | + NpcTemplate template = NpcData.getInstance().getTemplate(mobId); | |
1705 | + try | |
1706 | + { | |
1707 | + for (Location loc : locations) | |
1708 | + { | |
1709 | + Spawn spawn = new Spawn(template); | |
1710 | + spawn.setLoc(loc.getX(), loc.getY(), loc.getZ(), 0); | |
1711 | + spawn.setRespawnDelay(1); | |
1712 | + spawn.setRespawnState(false); | |
1713 | + spawn.doSpawn(false); | |
1714 | + | |
1715 | + ((DungeonMob) spawn.getNpc()).setDungeon(this); | |
1716 | + spawn.getNpc().setInstance(instance, false); // Set instance first | |
1717 | + // SpawnTable.getInstance().addNewSpawn(spawn, false); // TODO: Useless | |
1718 | + | |
1719 | + | |
1720 | + // Add it to memory | |
1721 | + mobs.add((DungeonMob) spawn.getNpc()); | |
1722 | + } | |
1723 | + } | |
1724 | + catch (Exception e) | |
1725 | + { | |
1726 | + e.printStackTrace(); | |
1727 | + } | |
1728 | + } | |
1729 | + | |
1730 | + private void teleportPlayers() | |
1731 | + { | |
1732 | + for (Player player : players) | |
1733 | + Player.setInstance(instance, true); | |
1734 | + | |
1735 | + teleToStage(); | |
1736 | + | |
1737 | + broadcastScreenMessage("Stage " + currentStage.getOrder() + " begins in 10 seconds!", 5); | |
1738 | + | |
1739 | + nextTask = ThreadPool.schedule(() -> beginStage(), 10 * 1000); | |
1740 | + } | |
1741 | + | |
1742 | + private void beginTeleport() | |
1743 | + { | |
1744 | + getNextStage(); | |
1745 | + for (Player player : players) | |
1746 | + { | |
1747 | + player.broadcastPacket(new MagicSkillUse(player, 1050, 1, 10000, 10000)); | |
1748 | + broadcastScreenMessage("You will be teleported in 10 seconds!", 3); | |
1749 | + } | |
1750 | + | |
1751 | + nextTask = ThreadPool.schedule(() -> teleportPlayers(), 10 * 1000); | |
1752 | + } | |
1753 | + | |
1754 | + private void getNextStage() | |
1755 | + { | |
1756 | + currentStage = currentStage == null ? template.getStages().get(1) : template.getStages().get(currentStage.getOrder() + 1); | |
1757 | + } | |
1758 | + | |
1759 | + private void broadcastTimer() | |
1760 | + { | |
1761 | + int secondsLeft = (int) (((stageBeginTime + (1000 * 60 * currentStage.getMinutes())) - System.currentTimeMillis()) / 1000); | |
1762 | + int minutes = secondsLeft / 60; | |
1763 | + int seconds = secondsLeft % 60; | |
1764 | + ExShowScreenMessage packet = new ExShowScreenMessage(String.format("%02d:%02d", minutes, seconds), 1010, SMPOS.BOTTOM_RIGHT, false); | |
1765 | + for (Player player : players) | |
1766 | + player.sendPacket(packet); | |
1767 | + } | |
1768 | + | |
1769 | + private void broadcastScreenMessage(String msg, int seconds) | |
1770 | + { | |
1771 | + ExShowScreenMessage packet = new ExShowScreenMessage(msg, seconds * 1000, SMPOS.TOP_CENTER, false); | |
1772 | + for (Player player : players) | |
1773 | + player.sendPacket(packet); | |
1774 | + } | |
1775 | + | |
1776 | + public List<Player> getPlayers() | |
1777 | + { | |
1778 | + return players; | |
1779 | + } | |
1780 | +} | |
1781 | ### Eclipse Workspace Patch 1.0 | |
1782 | #P aCis-Gameserver | |
1783 | Index: java/Base/Dungeon/DungeonManager.java | |
1784 | =================================================================== | |
1785 | --- java/Base/Dungeon/DungeonManager.java (nonexistent) | |
1786 | +++ java/Base/Dungeon/DungeonManager.java (working copy) | |
1787 | +/* | |
1788 | + * This program is free software: you can redistribute it and/or modify it under | |
1789 | + * the terms of the GNU General Public License as published by the Free Software | |
1790 | + * Foundation, either version 3 of the License, or (at your option) any later | |
1791 | + * version. | |
1792 | + * | |
1793 | + * This program is distributed in the hope that it will be useful, but WITHOUT | |
1794 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
1795 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
1796 | + * details. | |
1797 | + * | |
1798 | + * You should have received a copy of the GNU General Public License along with | |
1799 | + * this program. If not, see <http://www.gnu.org/licenses/>. | |
1800 | + */ | |
1801 | +package Base.Dungeon; | |
1802 | + | |
1803 | +import java.io.File; | |
1804 | +import java.sql.Connection; | |
1805 | +import java.sql.PreparedStatement; | |
1806 | +import java.sql.ResultSet; | |
1807 | +import java.util.ArrayList; | |
1808 | +import java.util.HashMap; | |
1809 | +import java.util.List; | |
1810 | +import java.util.Map; | |
1811 | +import java.util.concurrent.ConcurrentHashMap; | |
1812 | +import java.util.concurrent.CopyOnWriteArrayList; | |
1813 | +import java.util.logging.Level; | |
1814 | +import java.util.logging.Logger; | |
1815 | + | |
1816 | +import net.sf.l2j.commons.pool.ConnectionPool; | |
1817 | +import net.sf.l2j.commons.pool.ThreadPool; | |
1818 | + | |
1819 | +import net.sf.l2j.gameserver.model.actor.Player; | |
1820 | +import net.sf.l2j.gameserver.model.location.Location; | |
1821 | + | |
1822 | +import org.w3c.dom.Document; | |
1823 | +import org.w3c.dom.NamedNodeMap; | |
1824 | +import org.w3c.dom.Node; | |
1825 | + | |
1826 | +import Base.XML.XMLDocumentFactory; | |
1827 | + | |
1828 | +/** | |
1829 | + * @author Anarchy | |
1830 | + */ | |
1831 | +public class DungeonManager | |
1832 | +{ | |
1833 | + private static Logger log = Logger.getLogger(DungeonManager.class.getName()); | |
1834 | + | |
1835 | + private Map<Integer, DungeonTemplate> templates; | |
1836 | + private List<Dungeon> running; | |
1837 | + private List<Integer> dungeonParticipants; | |
1838 | + private boolean reloading = false; | |
1839 | + private Map<String, Long[]> dungeonPlayerData; | |
1840 | + | |
1841 | + protected DungeonManager() | |
1842 | + { | |
1843 | + templates = new ConcurrentHashMap<>(); | |
1844 | + running = new CopyOnWriteArrayList<>(); | |
1845 | + dungeonParticipants = new CopyOnWriteArrayList<>(); | |
1846 | + dungeonPlayerData = new ConcurrentHashMap<>(); | |
1847 | + | |
1848 | + load(); | |
1849 | + ThreadPool.scheduleAtFixedRate(() -> updateDatabase(), 1000*60*30, 1000*60*60); | |
1850 | + } | |
1851 | + | |
1852 | + @SuppressWarnings("resource") | |
1853 | + private void updateDatabase() | |
1854 | + { | |
1855 | + try (Connection con = ConnectionPool.getConnection()) | |
1856 | + { | |
1857 | + PreparedStatement stm = con.prepareStatement("DELETE FROM dungeon"); | |
1858 | + stm.execute(); | |
1859 | + | |
1860 | + for (String ip : dungeonPlayerData.keySet()) | |
1861 | + { | |
1862 | + for (int i = 1; i < dungeonPlayerData.get(ip).length; i++) | |
1863 | + { | |
1864 | + PreparedStatement stm2 = con.prepareStatement("INSERT INTO dungeon VALUES (?,?,?)"); | |
1865 | + stm2.setInt(1, i); | |
1866 | + stm2.setString(2, ip); | |
1867 | + stm2.setLong(3, dungeonPlayerData.get(ip)[i]); | |
1868 | + stm2.execute(); | |
1869 | + stm2.close(); | |
1870 | + } | |
1871 | + } | |
1872 | + | |
1873 | + stm.close(); | |
1874 | + } | |
1875 | + catch (Exception e) | |
1876 | + { | |
1877 | + e.printStackTrace(); | |
1878 | + } | |
1879 | + } | |
1880 | + | |
1881 | + public boolean reload() | |
1882 | + { | |
1883 | + if (!running.isEmpty()) | |
1884 | + { | |
1885 | + reloading = true; | |
1886 | + return false; | |
1887 | + } | |
1888 | + | |
1889 | + templates.clear(); | |
1890 | + load(); | |
1891 | + return true; | |
1892 | + } | |
1893 | + | |
1894 | + @SuppressWarnings("resource") | |
1895 | + private void load() | |
1896 | + { | |
1897 | + try | |
1898 | + { | |
1899 | + File f = new File("./events/Dungeon.xml"); | |
1900 | + Document doc = XMLDocumentFactory.getInstance().loadDocument(f); | |
1901 | + | |
1902 | + Node n = doc.getFirstChild(); | |
1903 | + for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) | |
1904 | + { | |
1905 | + if (d.getNodeName().equals("dungeon")) | |
1906 | + { | |
1907 | + int id = Integer.parseInt(d.getAttributes().getNamedItem("id").getNodeValue()); | |
1908 | + String name = d.getAttributes().getNamedItem("name").getNodeValue(); | |
1909 | + int players = Integer.parseInt(d.getAttributes().getNamedItem("players").getNodeValue()); | |
1910 | + Map<Integer, Integer> rewards = new HashMap<>(); | |
1911 | + String rewardHtm = d.getAttributes().getNamedItem("rewardHtm").getNodeValue(); | |
1912 | + Map<Integer, DungeonStage> stages = new HashMap<>(); | |
1913 | + | |
1914 | + String rewards_data = d.getAttributes().getNamedItem("rewards").getNodeValue(); | |
1915 | + if(!rewards_data.isEmpty()) // If config is empty do not feed the rewards | |
1916 | + { | |
1917 | + String[] rewards_data_split = rewards_data.split(";"); | |
1918 | + for (String reward : rewards_data_split) | |
1919 | + { | |
1920 | + String[] reward_split = reward.split(","); | |
1921 | + rewards.put(Integer.parseInt(reward_split[0]), Integer.parseInt(reward_split[1])); | |
1922 | + } | |
1923 | + } | |
1924 | + | |
1925 | + for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling()) | |
1926 | + { | |
1927 | + NamedNodeMap attrs = cd.getAttributes(); | |
1928 | + | |
1929 | + if (cd.getNodeName().equals("stage")) | |
1930 | + { | |
1931 | + int order = Integer.parseInt(attrs.getNamedItem("order").getNodeValue()); | |
1932 | + String loc_data = attrs.getNamedItem("loc").getNodeValue(); | |
1933 | + String[] loc_data_split = loc_data.split(","); | |
1934 | + Location loc = new Location(Integer.parseInt(loc_data_split[0]), Integer.parseInt(loc_data_split[1]), Integer.parseInt(loc_data_split[2])); | |
1935 | + boolean teleport = Boolean.parseBoolean(attrs.getNamedItem("teleport").getNodeValue()); | |
1936 | + int minutes = Integer.parseInt(attrs.getNamedItem("minutes").getNodeValue()); | |
1937 | + Map<Integer, List<Location>> mobs = new HashMap<>(); | |
1938 | + | |
1939 | + for (Node ccd = cd.getFirstChild(); ccd != null; ccd = ccd.getNextSibling()) | |
1940 | + { | |
1941 | + NamedNodeMap attrs2 = ccd.getAttributes(); | |
1942 | + | |
1943 | + if (ccd.getNodeName().equals("mob")) | |
1944 | + { | |
1945 | + int npcId = Integer.parseInt(attrs2.getNamedItem("npcId").getNodeValue()); | |
1946 | + List<Location> locs = new ArrayList<>(); | |
1947 | + | |
1948 | + String locs_data = attrs2.getNamedItem("locs").getNodeValue(); | |
1949 | + String[] locs_data_split = locs_data.split(";"); | |
1950 | + for (String locc : locs_data_split) | |
1951 | + { | |
1952 | + String[] locc_data = locc.split(","); | |
1953 | + locs.add(new Location(Integer.parseInt(locc_data[0]), Integer.parseInt(locc_data[1]), Integer.parseInt(locc_data[2]))); | |
1954 | + } | |
1955 | + | |
1956 | + mobs.put(npcId, locs); | |
1957 | + } | |
1958 | + } | |
1959 | + | |
1960 | + stages.put(order, new DungeonStage(order, loc, teleport, minutes, mobs)); | |
1961 | + } | |
1962 | + } | |
1963 | + | |
1964 | + templates.put(id, new DungeonTemplate(id, name, players, rewards, rewardHtm, stages)); | |
1965 | + } | |
1966 | + } | |
1967 | + } | |
1968 | + catch (Exception e) | |
1969 | + { | |
1970 | + log.log(Level.WARNING, "DungeonManager: Error loading dungeons.xml", e); | |
1971 | + e.printStackTrace(); | |
1972 | + } | |
1973 | + | |
1974 | + try (Connection con = ConnectionPool.getConnection()) | |
1975 | + { | |
1976 | + PreparedStatement stm = con.prepareStatement("SELECT * FROM dungeon"); | |
1977 | + ResultSet rset = stm.executeQuery(); | |
1978 | + | |
1979 | + while (rset.next()) | |
1980 | + { | |
1981 | + int dungid = rset.getInt("dungid"); | |
1982 | + String ipaddr = rset.getString("ipaddr"); | |
1983 | + long lastjoin = rset.getLong("lastjoin"); | |
1984 | + | |
1985 | + if (!dungeonPlayerData.containsKey(ipaddr)) | |
1986 | + { | |
1987 | + Long[] times = new Long[templates.size()+1]; | |
1988 | + for (int i = 0; i < times.length; i++) | |
1989 | + times[i] = 0L; | |
1990 | + times[dungid] = lastjoin; | |
1991 | + | |
1992 | + dungeonPlayerData.put(ipaddr, times); | |
1993 | + } | |
1994 | + else | |
1995 | + dungeonPlayerData.get(ipaddr)[dungid] = lastjoin; | |
1996 | + } | |
1997 | + | |
1998 | + rset.close(); | |
1999 | + stm.close(); | |
2000 | + } | |
2001 | + catch (Exception e) | |
2002 | + { | |
2003 | + e.printStackTrace(); | |
2004 | + } | |
2005 | + | |
2006 | + log.info("DungeonManager: Loaded "+templates.size()+" dungeon templates"); | |
2007 | + } | |
2008 | + | |
2009 | + public synchronized void removeDungeon(Dungeon dungeon) | |
2010 | + { | |
2011 | + running.remove(dungeon); | |
2012 | + | |
2013 | + if (reloading && running.isEmpty()) | |
2014 | + { | |
2015 | + reloading = false; | |
2016 | + reload(); | |
2017 | + } | |
2018 | + } | |
2019 | + | |
2020 | + public synchronized void enterDungeon(int id, Player player) | |
2021 | + { | |
2022 | + if (reloading) | |
2023 | + { | |
2024 | + player.sendMessage("The Dungeon system is reloading, please try again in a few minutes."); | |
2025 | + return; | |
2026 | + } | |
2027 | + | |
2028 | + | |
2029 | + DungeonTemplate template = templates.get(id); | |
2030 | + if (template.getPlayers() > 1 && (!player.isInParty() || player.getParty().getMembersCount() != template.getPlayers())) | |
2031 | + { | |
2032 | + player.sendMessage("You need a party of "+template.getPlayers()+" players to enter this Dungeon."); | |
2033 | + return; | |
2034 | + } | |
2035 | + else if (template.getPlayers() == 1 && player.isInParty()) | |
2036 | + { | |
2037 | + player.sendMessage("You can only enter this Dungeon alone."); | |
2038 | + return; | |
2039 | + } | |
2040 | + | |
2041 | + List<Player> players = new ArrayList<>(); | |
2042 | + if (player.isInParty()) | |
2043 | + { | |
2044 | + for (Player pm : player.getParty().getMembers()) | |
2045 | + { | |
2046 | + String pmip = pm.getIP(); | |
2047 | + if (dungeonPlayerData.containsKey(pmip) && (System.currentTimeMillis() - dungeonPlayerData.get(pmip)[template.getId()] < 1000*60*60*12)) | |
2048 | + { | |
2049 | + player.sendMessage("One of your party members cannot join this Dungeon because 12 hours have not passed since they last joined."); | |
2050 | + return; | |
2051 | + } | |
2052 | + } | |
2053 | + | |
2054 | + for (Player pm : player.getParty().getMembers()) | |
2055 | + { | |
2056 | + String pmip = pm.getIP(); | |
2057 | + | |
2058 | + dungeonParticipants.add(pm.getObjectId()); | |
2059 | + players.add(pm); | |
2060 | + if (dungeonPlayerData.containsKey(pmip)) | |
2061 | + dungeonPlayerData.get(pmip)[template.getId()] = System.currentTimeMillis(); | |
2062 | + else | |
2063 | + { | |
2064 | + Long[] times = new Long[templates.size()+1]; | |
2065 | + for (int i = 0; i < times.length; i++) | |
2066 | + times[i] = 0L; | |
2067 | + times[template.getId()] = System.currentTimeMillis(); | |
2068 | + dungeonPlayerData.put(pmip, times); | |
2069 | + } | |
2070 | + } | |
2071 | + } | |
2072 | + else | |
2073 | + { | |
2074 | + String pmip = player.getIP(); | |
2075 | + if (dungeonPlayerData.containsKey(pmip) && (System.currentTimeMillis() - dungeonPlayerData.get(pmip)[template.getId()] < 1000*60*60*12)) | |
2076 | + { | |
2077 | + player.sendMessage("12 hours have not passed since you last entered this Dungeon."); | |
2078 | + return; | |
2079 | + } | |
2080 | + | |
2081 | + dungeonParticipants.add(player.getObjectId()); | |
2082 | + players.add(player); | |
2083 | + if (dungeonPlayerData.containsKey(pmip)) | |
2084 | + dungeonPlayerData.get(pmip)[template.getId()] = System.currentTimeMillis(); | |
2085 | + else | |
2086 | + { | |
2087 | + Long[] times = new Long[templates.size()+1]; | |
2088 | + for (int i = 0; i < times.length; i++) | |
2089 | + times[i] = 0L; | |
2090 | + times[template.getId()] = System.currentTimeMillis(); | |
2091 | + dungeonPlayerData.put(pmip, times); | |
2092 | + } | |
2093 | + } | |
2094 | + | |
2095 | + running.add(new Dungeon(template, players)); | |
2096 | + } | |
2097 | + | |
2098 | + public boolean isReloading() | |
2099 | + { | |
2100 | + return reloading; | |
2101 | + } | |
2102 | + | |
2103 | + public boolean isInDungeon(Player player) | |
2104 | + { | |
2105 | + for (Dungeon dungeon : running) | |
2106 | + for (Player p : dungeon.getPlayers()) | |
2107 | + if (p == player) | |
2108 | + return true; | |
2109 | + | |
2110 | + return false; | |
2111 | + } | |
2112 | + | |
2113 | + public Map<String, Long[]> getPlayerData() | |
2114 | + { | |
2115 | + return dungeonPlayerData; | |
2116 | + } | |
2117 | + | |
2118 | + public List<Integer> getDungeonParticipants() | |
2119 | + { | |
2120 | + return dungeonParticipants; | |
2121 | + } | |
2122 | + | |
2123 | + public static DungeonManager getInstance() | |
2124 | + { | |
2125 | + return SingletonHolder.instance; | |
2126 | + } | |
2127 | + | |
2128 | + private static class SingletonHolder | |
2129 | + { | |
2130 | + protected static final DungeonManager instance = new DungeonManager(); | |
2131 | + } | |
2132 | +} | |
2133 | ||
2134 | ||
2135 | ### Eclipse Workspace Patch 1.0 | |
2136 | #P aCis-Gameserver | |
2137 | Index: java/Base/Dungeon/DungeonStage.java | |
2138 | =================================================================== | |
2139 | --- java/Base/Dungeon/DungeonStage.java (nonexistent) | |
2140 | +++ java/Base/Dungeon/DungeonStage.java (working copy) | |
2141 | +/* | |
2142 | + * This program is free software: you can redistribute it and/or modify it under | |
2143 | + * the terms of the GNU General Public License as published by the Free Software | |
2144 | + * Foundation, either version 3 of the License, or (at your option) any later | |
2145 | + * version. | |
2146 | + * | |
2147 | + * This program is distributed in the hope that it will be useful, but WITHOUT | |
2148 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
2149 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
2150 | + * details. | |
2151 | + * | |
2152 | + * You should have received a copy of the GNU General Public License along with | |
2153 | + * this program. If not, see <http://www.gnu.org/licenses/>. | |
2154 | + */ | |
2155 | +package Base.Dungeon; | |
2156 | + | |
2157 | +import java.util.List; | |
2158 | +import java.util.Map; | |
2159 | + | |
2160 | +import net.sf.l2j.gameserver.model.location.Location; | |
2161 | + | |
2162 | + | |
2163 | + | |
2164 | +/** | |
2165 | + * @author Anarchy | |
2166 | + * | |
2167 | + */ | |
2168 | +public class DungeonStage | |
2169 | +{ | |
2170 | + private int order; | |
2171 | + private Location location; | |
2172 | + private boolean teleport; | |
2173 | + private int minutes; | |
2174 | + private Map<Integer, List<Location>> mobs; | |
2175 | + | |
2176 | + public DungeonStage(int order, Location location, boolean teleport, int minutes, Map<Integer, List<Location>> mobs) | |
2177 | + { | |
2178 | + this.order = order; | |
2179 | + this.location = location; | |
2180 | + this.teleport = teleport; | |
2181 | + this.minutes = minutes; | |
2182 | + this.mobs = mobs; | |
2183 | + } | |
2184 | + | |
2185 | + public int getOrder() | |
2186 | + { | |
2187 | + return order; | |
2188 | + } | |
2189 | + | |
2190 | + public Location getLocation() | |
2191 | + { | |
2192 | + return location; | |
2193 | + } | |
2194 | + | |
2195 | + public boolean teleport() | |
2196 | + { | |
2197 | + return teleport; | |
2198 | + } | |
2199 | + | |
2200 | + public int getMinutes() | |
2201 | + { | |
2202 | + return minutes; | |
2203 | + } | |
2204 | + | |
2205 | + public Map<Integer, List<Location>> getMobs() | |
2206 | + { | |
2207 | + return mobs; | |
2208 | + } | |
2209 | +} | |
2210 | ||
2211 | ### Eclipse Workspace Patch 1.0 | |
2212 | #P aCis-Gameserver | |
2213 | Index: java/Base/Dungeon/DungeonTemplate.java | |
2214 | =================================================================== | |
2215 | --- java/Base/Dungeon/DungeonTemplate.java (nonexistent) | |
2216 | +++ java/Base/Dungeon/DungeonTemplate.java (working copy) | |
2217 | +/* | |
2218 | + * This program is free software: you can redistribute it and/or modify it under | |
2219 | + * the terms of the GNU General Public License as published by the Free Software | |
2220 | + * Foundation, either version 3 of the License, or (at your option) any later | |
2221 | + * version. | |
2222 | + * | |
2223 | + * This program is distributed in the hope that it will be useful, but WITHOUT | |
2224 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
2225 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
2226 | + * details. | |
2227 | + * | |
2228 | + * You should have received a copy of the GNU General Public License along with | |
2229 | + * this program. If not, see <http://www.gnu.org/licenses/>. | |
2230 | + */ | |
2231 | +package Base.Dungeon; | |
2232 | + | |
2233 | +import java.util.Map; | |
2234 | + | |
2235 | +/** | |
2236 | + * @author Anarchy | |
2237 | + * | |
2238 | + */ | |
2239 | +public class DungeonTemplate | |
2240 | +{ | |
2241 | + private int id; | |
2242 | + private String name; | |
2243 | + private int players; | |
2244 | + private Map<Integer, Integer> rewards; | |
2245 | + private String rewardHtm; | |
2246 | + private Map<Integer, DungeonStage> stages; | |
2247 | + | |
2248 | + public DungeonTemplate(int id, String name, int players, Map<Integer, Integer> rewards, String rewardHtm, Map<Integer, DungeonStage> stages) | |
2249 | + { | |
2250 | + this.id = id; | |
2251 | + this.name = name; | |
2252 | + this.players = players; | |
2253 | + this.rewards = rewards; | |
2254 | + this.rewardHtm = rewardHtm; | |
2255 | + this.stages = stages; | |
2256 | + } | |
2257 | + | |
2258 | + public int getId() | |
2259 | + { | |
2260 | + return id; | |
2261 | + } | |
2262 | + | |
2263 | + public String getName() | |
2264 | + { | |
2265 | + return name; | |
2266 | + } | |
2267 | + | |
2268 | + public int getPlayers() | |
2269 | + { | |
2270 | + return players; | |
2271 | + } | |
2272 | + | |
2273 | + public Map<Integer, Integer> getRewards() | |
2274 | + { | |
2275 | + return rewards; | |
2276 | + } | |
2277 | + | |
2278 | + public String getRewardHtm() | |
2279 | + { | |
2280 | + return rewardHtm; | |
2281 | + } | |
2282 | + | |
2283 | + public Map<Integer, DungeonStage> getStages() | |
2284 | + { | |
2285 | + return stages; | |
2286 | + } | |
2287 | +} | |
2288 | ||
2289 | ### Eclipse Workspace Patch 1.0 | |
2290 | #P aCis-Gameserver | |
2291 | Index: java/Base/Dungeon/Instance.java | |
2292 | =================================================================== | |
2293 | --- java/Base/Dungeon/Instance.java (nonexistent) | |
2294 | +++ java/Base/Dungeon/Instance.java (working copy) | |
2295 | +/* | |
2296 | + * This program is free software: you can redistribute it and/or modify it under | |
2297 | + * the terms of the GNU General Public License as published by the Free Software | |
2298 | + * Foundation, either version 3 of the License, or (at your option) any later | |
2299 | + * version. | |
2300 | + * | |
2301 | + * This program is distributed in the hope that it will be useful, but WITHOUT | |
2302 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
2303 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
2304 | + * details. | |
2305 | + * | |
2306 | + * You should have received a copy of the GNU General Public License along with | |
2307 | + * this program. If not, see <http://www.gnu.org/licenses/>. | |
2308 | + */ | |
2309 | +package Base.Dungeon; | |
2310 | + | |
2311 | +import java.util.ArrayList; | |
2312 | +import java.util.List; | |
2313 | + | |
2314 | +import net.sf.l2j.gameserver.model.actor.instance.Door; | |
2315 | + | |
2316 | +/** | |
2317 | + * @author Anarchy | |
2318 | + * | |
2319 | + */ | |
2320 | +public class Instance | |
2321 | +{ | |
2322 | + private int id; | |
2323 | + private List<Door> doors; | |
2324 | + | |
2325 | + public Instance(int id) | |
2326 | + { | |
2327 | + this.id = id; | |
2328 | + doors = new ArrayList<>(); | |
2329 | + } | |
2330 | + | |
2331 | + public void openDoors() | |
2332 | + { | |
2333 | + for (Door door : doors) | |
2334 | + door.openMe(); | |
2335 | + } | |
2336 | + | |
2337 | + public void closeDoors() | |
2338 | + { | |
2339 | + for (Door door : doors) | |
2340 | + door.closeMe(); | |
2341 | + } | |
2342 | + | |
2343 | + public void addDoor(Door door) | |
2344 | + { | |
2345 | + doors.add(door); | |
2346 | + } | |
2347 | + | |
2348 | + public List<Door> getDoors() | |
2349 | + { | |
2350 | + return doors; | |
2351 | + } | |
2352 | + | |
2353 | + public int getId() | |
2354 | + { | |
2355 | + return id; | |
2356 | + } | |
2357 | +} | |
2358 | ||
2359 | ### Eclipse Workspace Patch 1.0 | |
2360 | #P aCis-Gameserver | |
2361 | Index: java/Base/Dungeon/InstanceIdFactory.java | |
2362 | =================================================================== | |
2363 | --- java/Base/Dungeon/InstanceIdFactory.java (nonexistent) | |
2364 | +++ java/Base/Dungeon/InstanceIdFactory.java (working copy) | |
2365 | +/* | |
2366 | + * This program is free software: you can redistribute it and/or modify it under | |
2367 | + * the terms of the GNU General Public License as published by the Free Software | |
2368 | + * Foundation, either version 3 of the License, or (at your option) any later | |
2369 | + * version. | |
2370 | + * | |
2371 | + * This program is distributed in the hope that it will be useful, but WITHOUT | |
2372 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
2373 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
2374 | + * details. | |
2375 | + * | |
2376 | + * You should have received a copy of the GNU General Public License along with | |
2377 | + * this program. If not, see <http://www.gnu.org/licenses/>. | |
2378 | + */ | |
2379 | +package Base.Dungeon; | |
2380 | + | |
2381 | +import java.util.concurrent.atomic.AtomicInteger; | |
2382 | + | |
2383 | +/** | |
2384 | + * @author Anarchy | |
2385 | + * | |
2386 | + */ | |
2387 | +public final class InstanceIdFactory | |
2388 | +{ | |
2389 | + private static AtomicInteger nextAvailable = new AtomicInteger(1); | |
2390 | + | |
2391 | + public synchronized static int getNextAvailable() | |
2392 | + { | |
2393 | + return nextAvailable.getAndIncrement(); | |
2394 | + } | |
2395 | +} | |
2396 | ||
2397 | ### Eclipse Workspace Patch 1.0 | |
2398 | #P aCis-Gameserver | |
2399 | Index: java/Base/Dungeon/InstanceManager.java | |
2400 | =================================================================== | |
2401 | --- java/Base/Dungeon/InstanceManager.java (nonexistent) | |
2402 | +++ java/Base/Dungeon/InstanceManager.java (working copy) | |
2403 | +/* | |
2404 | + * This program is free software: you can redistribute it and/or modify it under | |
2405 | + * the terms of the GNU General Public License as published by the Free Software | |
2406 | + * Foundation, either version 3 of the License, or (at your option) any later | |
2407 | + * version. | |
2408 | + * | |
2409 | + * This program is distributed in the hope that it will be useful, but WITHOUT | |
2410 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
2411 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
2412 | + * details. | |
2413 | + * | |
2414 | + * You should have received a copy of the GNU General Public License along with | |
2415 | + * this program. If not, see <http://www.gnu.org/licenses/>. | |
2416 | + */ | |
2417 | +package Base.Dungeon; | |
2418 | + | |
2419 | +import java.util.Map; | |
2420 | +import java.util.concurrent.ConcurrentHashMap; | |
2421 | + | |
2422 | +import net.sf.l2j.gameserver.model.actor.instance.Door; | |
2423 | + | |
2424 | +/** | |
2425 | + * @author Anarchy | |
2426 | + * | |
2427 | + */ | |
2428 | +public class InstanceManager | |
2429 | +{ | |
2430 | + private Map<Integer, Instance> instances; | |
2431 | + | |
2432 | + protected InstanceManager() | |
2433 | + { | |
2434 | + instances = new ConcurrentHashMap<>(); | |
2435 | + instances.put(0, new Instance(0)); | |
2436 | + } | |
2437 | + | |
2438 | + public void addDoor(int id, Door door) | |
2439 | + { | |
2440 | + if (!instances.containsKey(id) || id == 0) | |
2441 | + return; | |
2442 | + | |
2443 | + instances.get(id).addDoor(door); | |
2444 | + } | |
2445 | + | |
2446 | + public void deleteInstance(int id) | |
2447 | + { | |
2448 | + if (id == 0) | |
2449 | + { | |
2450 | + System.out.println("Attempt to delete instance with id 0."); | |
2451 | + return; | |
2452 | + } | |
2453 | + | |
2454 | + // delete doors | |
2455 | + } | |
2456 | + | |
2457 | + public synchronized Instance createInstance() | |
2458 | + { | |
2459 | + Instance instance = new Instance(InstanceIdFactory.getNextAvailable()); | |
2460 | + instances.put(instance.getId(), instance); | |
2461 | + return instance; | |
2462 | + } | |
2463 | + | |
2464 | + public Instance getInstance(int id) | |
2465 | + { | |
2466 | + return instances.get(id); | |
2467 | + } | |
2468 | + | |
2469 | + public static InstanceManager getInstance() | |
2470 | + { | |
2471 | + return SingletonHolder.instance; | |
2472 | + } | |
2473 | + | |
2474 | + private static final class SingletonHolder | |
2475 | + { | |
2476 | + protected static final InstanceManager instance = new InstanceManager(); | |
2477 | + } | |
2478 | +} | |
2479 | ||
2480 | ||
2481 | ||
2482 | ### Eclipse Workspace Patch 1.0 | |
2483 | #P aCis-Gameserver | |
2484 | Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java | |
2485 | =================================================================== | |
2486 | --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (nonexistent) | |
2487 | +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy) | |
2488 | ||
2489 | @Override | |
2490 | protected void runImpl() | |
2491 | { | |
2492 | final Player player = getClient().getPlayer(); | |
2493 | if (player == null) | |
2494 | { | |
2495 | getClient().closeNow(); | |
2496 | return; | |
2497 | } | |
2498 | + // Set NewChar | |
2499 | + switch (player.getClassId().getId()) | |
2500 | + { | |
2501 | + case 0: | |
2502 | + case 10: | |
2503 | + case 18: | |
2504 | + case 25: | |
2505 | + case 31: | |
2506 | + case 38: | |
2507 | + case 44: | |
2508 | + case 49: | |
2509 | + case 53: | |
2510 | + Player.doNewChar(player, 1); | |
2511 | + break; | |
2512 | + } | |
2513 | ||
2514 | ||
2515 | ||
2516 | getClient().setState(GameClientState.IN_GAME); | |
2517 | ||
2518 | ||
2519 | ||
2520 | ||
2521 | ||
2522 | ||
2523 | if (Config.PLAYER_SPAWN_PROTECTION > 0) | |
2524 | player.setSpawnProtection(true); | |
2525 | ||
2526 | player.spawnMe(); | |
2527 | ||
2528 | + if (player.getMemos().getLong("newEndTime", 0) > 0) | |
2529 | + onEnterNewChar(player); | |
2530 | ||
2531 | ||
2532 | ||
2533 | // Tutorial | |
2534 | final QuestState qs = player.getQuestList().getQuestState("Tutorial"); | |
2535 | if (qs != null) | |
2536 | qs.getQuest().notifyEvent("UC", null, player); | |
2537 | ||
2538 | player.sendPacket(ActionFailed.STATIC_PACKET); | |
2539 | } | |
2540 | ||
2541 | + private static void onEnterNewChar(Player activeChar) | |
2542 | + { | |
2543 | + long now = Calendar.getInstance().getTimeInMillis(); | |
2544 | + long endDay = activeChar.getMemos().getLong("newEndTime"); | |
2545 | + | |
2546 | + if (now > endDay) | |
2547 | + Player.removeNewChar(activeChar); | |
2548 | + else | |
2549 | + { | |
2550 | + activeChar.setNewChar(true); | |
2551 | + activeChar.broadcastUserInfo(); | |
2552 | + } | |
2553 | + } | |
2554 | ||
2555 | @Override | |
2556 | protected boolean triggersOnActionRequest() | |
2557 | { | |
2558 | return false; | |
2559 | } | |
2560 | ||
2561 | ||
2562 | ||
2563 | ### Eclipse Workspace Patch 1.0 | |
2564 | #P aCis-Gameserver | |
2565 | Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java | |
2566 | =================================================================== | |
2567 | --- java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (nonexistent) | |
2568 | +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (working copy) | |
2569 | import net.sf.l2j.gameserver.model.actor.Player; | |
2570 | import net.sf.l2j.gameserver.model.actor.instance.OlympiadManagerNpc; | |
2571 | +import net.sf.l2j.gameserver.model.item.instance.ItemInstance; | |
2572 | ||
2573 | ||
2574 | ||
2575 | ||
2576 | import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; | |
2577 | import net.sf.l2j.gameserver.scripting.QuestState; | |
2578 | ||
2579 | +import Base.Dungeon.InstanceManager; | |
2580 | ||
2581 | ||
2582 | ||
2583 | ||
2584 | ||
2585 | ||
2586 | else if (_command.startsWith("player_help ")) | |
2587 | { | |
2588 | final String path = _command.substring(12); | |
2589 | if (path.indexOf("..") != -1) | |
2590 | return; | |
2591 | ||
2592 | final StringTokenizer st = new StringTokenizer(path); | |
2593 | final String[] cmd = st.nextToken().split("#"); | |
2594 | ||
2595 | final NpcHtmlMessage html = new NpcHtmlMessage(0); | |
2596 | html.setFile("data/html/help/" + cmd[0]); | |
2597 | if (cmd.length > 1) | |
2598 | { | |
2599 | final int itemId = Integer.parseInt(cmd[1]); | |
2600 | html.setItemId(itemId); | |
2601 | ||
2602 | if (itemId == 7064 && cmd[0].equalsIgnoreCase("lidias_diary/7064-16.htm")) | |
2603 | { | |
2604 | final QuestState qs = player.getQuestList().getQuestState("Q023_LidiasHeart"); | |
2605 | if (qs != null && qs.getCond() == 5 && qs.getInteger("diary") == 0) | |
2606 | qs.set("diary", "1"); | |
2607 | } | |
2608 | } | |
2609 | html.disableValidation(); | |
2610 | player.sendPacket(html); | |
2611 | } | |
2612 | ||
2613 | + if (_command.startsWith("bp_reward")) | |
2614 | + { | |
2615 | + int type = Integer.parseInt(_command.substring(10)); | |
2616 | + int itemId = 0; | |
2617 | + int count = 1; | |
2618 | + | |
2619 | + switch (type) | |
2620 | + { | |
2621 | + case 0: | |
2622 | + { | |
2623 | + itemId = Config.DUNGEON_ITEM_RENEWAL0; | |
2624 | + | |
2625 | + break; | |
2626 | + } | |
2627 | + case 1: | |
2628 | + { | |
2629 | + itemId = Config.DUNGEON_ITEM_RENEWAL1; | |
2630 | + | |
2631 | + break; | |
2632 | + } | |
2633 | + case 2: | |
2634 | + { | |
2635 | + itemId = Config.DUNGEON_ITEM_RENEWAL2; | |
2636 | + | |
2637 | + break; | |
2638 | + } | |
2639 | + case 3: | |
2640 | + { | |
2641 | + itemId = Config.DUNGEON_ITEM_RENEWAL3; | |
2642 | + | |
2643 | + break; | |
2644 | + } | |
2645 | + case 4: | |
2646 | + { | |
2647 | + itemId = Config.DUNGEON_ITEM_RENEWAL4; | |
2648 | + | |
2649 | + break; | |
2650 | + } | |
2651 | + case 5: | |
2652 | + { | |
2653 | + itemId = Config.DUNGEON_ITEM_RENEWAL5; | |
2654 | + | |
2655 | + break; | |
2656 | + } | |
2657 | + case 6: | |
2658 | + { | |
2659 | + itemId = Config.DUNGEON_ITEM_RENEWAL6; | |
2660 | + | |
2661 | + break; | |
2662 | + } | |
2663 | + case 7: | |
2664 | + { | |
2665 | + itemId = Config.DUNGEON_ITEM_RENEWAL7; | |
2666 | + | |
2667 | + break; | |
2668 | + } | |
2669 | + case 8: | |
2670 | + { | |
2671 | + itemId = Config.DUNGEON_ITEM_RENEWAL8; | |
2672 | + | |
2673 | + break; | |
2674 | + } | |
2675 | + case 9: | |
2676 | + { | |
2677 | + itemId = Config.DUNGEON_ITEM_RENEWAL9; | |
2678 | + | |
2679 | + break; | |
2680 | + } | |
2681 | + case 10: | |
2682 | + { | |
2683 | + itemId = Config.DUNGEON_ITEM_RENEWAL10; | |
2684 | + | |
2685 | + break; | |
2686 | + } | |
2687 | + case 11: | |
2688 | + { | |
2689 | + itemId = Config.DUNGEON_PARTY_ITEM_RENEWAL0; | |
2690 | + | |
2691 | + break; | |
2692 | + } | |
2693 | + case 12: | |
2694 | + { | |
2695 | + itemId = Config.DUNGEON_PARTY_ITEM_RENEWAL1; | |
2696 | + | |
2697 | + break; | |
2698 | + } | |
2699 | + case 13: | |
2700 | + { | |
2701 | + itemId = Config.DUNGEON_PARTY_ITEM_RENEWAL2; | |
2702 | + | |
2703 | + break; | |
2704 | + } | |
2705 | + case 14: | |
2706 | + { | |
2707 | + itemId = Config.DUNGEON_PARTY_ITEM_RENEWAL3; | |
2708 | + | |
2709 | + break; | |
2710 | + } | |
2711 | + case 15: | |
2712 | + { | |
2713 | + itemId = Config.DUNGEON_PARTY_ITEM_RENEWAL4; | |
2714 | + | |
2715 | + break; | |
2716 | + } | |
2717 | + } | |
2718 | + | |
2719 | + if (itemId == 0) | |
2720 | + { | |
2721 | + System.out.println(player.getName() + " tried to send custom id on dungeon solo rewards."); | |
2722 | + return; | |
2723 | + } | |
2724 | + | |
2725 | + if(player.getDungeon() != null) | |
2726 | + { | |
2727 | + ItemInstance item = player.addItem("dungeon reward", itemId, count, null, true); | |
2728 | + item.setEnchantLevel(25); | |
2729 | + player.getInventory().equipItemAndRecord(item); | |
2730 | + PlayerMemo.setVar(player, "delete_temp_item_" + item.getObjectId(), item.getObjectId(), System.currentTimeMillis() + (1000 *60 *60 *5)); | |
2731 | + InstanceManager.getInstance().getInstance(0); | |
2732 | + player.setDungeon(null); | |
2733 | + player.teleportTo(Config.DUNGEON_SPAWN_X, Config.DUNGEON_SPAWN_Y, Config.DUNGEON_SPAWN_Z, Config.DUNGEON_SPAWN_RND); | |
2734 | + } | |
2735 | + else | |
2736 | + { | |
2737 | + player.sendMessage("No puedes recibir el premio"); | |
2738 | + } | |
2739 | + | |
2740 | + } | |
2741 | ||
2742 | else if (_command.startsWith("npc_")) | |
2743 | ||
2744 | ||
2745 | ||
2746 | ||
2747 | Gameserver/data/xml/npc | |
2748 | ||
2749 | DungeonManagerNpc.xml | |
2750 | +<?xml version="1.0" encoding="utf-8"?> | |
2751 | +<list> | |
2752 | + <npc id="65514" idTemplate="31228" name="Dungeon Manager" title="Renewal Dungeon"> | |
2753 | + <set name="usingServerSideName" val="true"/> | |
2754 | + <set name="usingServerSideTitle" val="true"/> | |
2755 | + <set name="level" val="78"/> | |
2756 | + <set name="radius" val="9"/> | |
2757 | + <set name="height" val="16"/> | |
2758 | + <set name="rHand" val="0"/> | |
2759 | + <set name="lHand" val="0"/> | |
2760 | + <set name="type" val="DungeonManagerNpc"/> | |
2761 | + <set name="exp" val="18299"/> | |
2762 | + <set name="sp" val="2212"/> | |
2763 | + <set name="hp" val="3010.8929976"/> | |
2764 | + <set name="mp" val="1777.86"/> | |
2765 | + <set name="hpRegen" val="8.772"/> | |
2766 | + <set name="mpRegen" val="3.1008"/> | |
2767 | + <set name="pAtk" val="961.93701102"/> | |
2768 | + <set name="pDef" val="361.0859925"/> | |
2769 | + <set name="mAtk" val="677.644106544"/> | |
2770 | + <set name="mDef" val="246.330714"/> | |
2771 | + <set name="crit" val="4"/> | |
2772 | + <set name="atkSpd" val="253"/> | |
2773 | + <set name="str" val="40"/> | |
2774 | + <set name="int" val="21"/> | |
2775 | + <set name="dex" val="30"/> | |
2776 | + <set name="wit" val="20"/> | |
2777 | + <set name="con" val="43"/> | |
2778 | + <set name="men" val="20"/> | |
2779 | + <set name="corpseTime" val="7"/> | |
2780 | + <set name="walkSpd" val="45"/> | |
2781 | + <set name="runSpd" val="175"/> | |
2782 | + <set name="dropHerbGroup" val="1"/> | |
2783 | + <set name="attackRange" val="40"/> | |
2784 | + <ai type="DEFAULT" ssCount="100" ssRate="10" spsCount="100" spsRate="5" aggro="500" canMove="true" seedable="true"/> | |
2785 | + | |
2786 | + </npc> | |
2787 | + | |
2788 | +</list> | |
2789 | ||
2790 | ||
2791 | ||
2792 | DungeonMob.xml | |
2793 | +<?xml version="1.0" encoding="utf-8"?> | |
2794 | +<list> | |
2795 | + <npc id="65515" idTemplate="20620" name="Dungeon Monster" title="Event"> | |
2796 | + <set name="usingServerSideName" val="true"/> | |
2797 | + <set name="usingServerSideTitle" val="true"/> | |
2798 | + <set name="level" val="78"/> | |
2799 | + <set name="radius" val="21"/> | |
2800 | + <set name="height" val="35"/> | |
2801 | + <set name="rHand" val="0"/> | |
2802 | + <set name="lHand" val="0"/> | |
2803 | + <set name="type" val="DungeonMob"/> | |
2804 | + <set name="exp" val="18299"/> | |
2805 | + <set name="sp" val="2212"/> | |
2806 | + <set name="hp" val="3010.8929976"/> | |
2807 | + <set name="mp" val="1777.86"/> | |
2808 | + <set name="hpRegen" val="8.772"/> | |
2809 | + <set name="mpRegen" val="3.1008"/> | |
2810 | + <set name="pAtk" val="961.93701102"/> | |
2811 | + <set name="pDef" val="361.0859925"/> | |
2812 | + <set name="mAtk" val="677.644106544"/> | |
2813 | + <set name="mDef" val="246.330714"/> | |
2814 | + <set name="crit" val="4"/> | |
2815 | + <set name="atkSpd" val="253"/> | |
2816 | + <set name="str" val="40"/> | |
2817 | + <set name="int" val="21"/> | |
2818 | + <set name="dex" val="30"/> | |
2819 | + <set name="wit" val="20"/> | |
2820 | + <set name="con" val="43"/> | |
2821 | + <set name="men" val="20"/> | |
2822 | + <set name="corpseTime" val="7"/> | |
2823 | + <set name="walkSpd" val="45"/> | |
2824 | + <set name="runSpd" val="175"/> | |
2825 | + <set name="dropHerbGroup" val="1"/> | |
2826 | + <set name="attackRange" val="40"/> | |
2827 | + <ai type="DEFAULT" ssCount="100" ssRate="10" spsCount="100" spsRate="5" aggro="500" canMove="true" seedable="true"/> | |
2828 | + <skills> | |
2829 | + <skill id="4028" level="3"/> | |
2830 | + <skill id="4408" level="11"/> | |
2831 | + <skill id="4410" level="12"/> | |
2832 | + <skill id="4411" level="12"/> | |
2833 | + <skill id="4412" level="10"/> | |
2834 | + <skill id="4413" level="10"/> | |
2835 | + <skill id="4416" level="11"/> | |
2836 | + </skills> | |
2837 | + | |
2838 | + <drops> | |
2839 | + <category id="0"> | |
2840 | + <drop itemid="57" min="10000" max="15000" chance="1000000"/> | |
2841 | + </category> | |
2842 | + </drops> | |
2843 | + | |
2844 | + </npc> | |
2845 | +</list> | |
2846 | ||
2847 | ||
2848 | ||
2849 | gameserver/events/Dungeon.xml | |
2850 | +<?xml version="1.0" encoding="UTF-8"?> | |
2851 | +<list> | |
2852 | + <dungeon id="1" name="Solo Story Mode" players="1" rewards="9500,20000,9501,50" rewardHtm="data/html/mods/dungeon/solo_rewards.htm"> | |
2853 | + <stage order="1" loc="174122,-76173,-5106" teleport="true" minutes="5"> | |
2854 | + <mob npcId="65515" locs="174527,-75636,-5106;174654,-75987,-5106;174647,-76483,-5106;174160,-76758,-5106"/> | |
2855 | + </stage> | |
2856 | + <stage order="2" loc="174082,-78151,-5106" teleport="false" minutes="5"> | |
2857 | + <mob npcId="65515" locs="174527,-75636,-5106;174654,-75987,-5106;174647,-76483,-5106;174160,-76758,-5106"/> | |
2858 | + </stage> | |
2859 | + <stage order="3" loc="174038,-80727,-5106" teleport="true" minutes="5"> | |
2860 | + <mob npcId="65515" locs="173739,-81254,-5122;173736,-81613,-5122;173729,-82232,-5122;174041,-82539,-5122;174377,-82379,-5122;174451,-81893,-5122;174433,-81342,-5122;174152,-81560,-5122"/> | |
2861 | + </stage> | |
2862 | + <stage order="4" loc="174230,-87512,-5116" teleport="true" minutes="15"> | |
2863 | + <mob npcId="65515" locs="174229,-86659,-5106"/> | |
2864 | + </stage> | |
2865 | + </dungeon> | |
2866 | + <dungeon id="2" name="Quatro Hard Mode" players="4" rewards="8191,1" rewardHtm="NULL"> | |
2867 | + <stage order="1" loc="174122,-76173,-5106" teleport="true" minutes="5"> | |
2868 | + <mob npcId="62100" locs="174527,-75636,-5106;174654,-75987,-5106;174647,-76483,-5106;174160,-76758,-5106"/> | |
2869 | + </stage> | |
2870 | + <stage order="2" loc="174082,-78151,-5106" teleport="false" minutes="5"> | |
2871 | + <mob npcId="62100" locs="174527,-75636,-5106;174654,-75987,-5106;174647,-76483,-5106;174160,-76758,-5106"/> | |
2872 | + </stage> | |
2873 | + <stage order="3" loc="174038,-80727,-5106" teleport="true" minutes="5"> | |
2874 | + <mob npcId="62101" locs="173739,-81254,-5122;173736,-81613,-5122;173729,-82232,-5122;174041,-82539,-5122;174377,-82379,-5122;174451,-81893,-5122;174433,-81342,-5122;174152,-81560,-5122"/> | |
2875 | + </stage> | |
2876 | + <stage order="4" loc="174056,-83856,-5106" teleport="true" minutes="5"> | |
2877 | + <mob npcId="62101" locs="174742,-84194,-5106;174745,-84526,-5106;174726,-85127,-5106;174231,-85361,-5106"/> | |
2878 | + </stage> | |
2879 | + <stage order="5" loc="174229,-86659,-5106" teleport="true" minutes="5"> | |
2880 | + <mob npcId="62102" locs="174742,-84194,-5106;174745,-84526,-5106;174726,-85127,-5106;174231,-85361,-5106"/> | |
2881 | + </stage> | |
2882 | + <stage order="6" loc="174229,-86659,-5106" teleport="false" minutes="5"> | |
2883 | + <mob npcId="62103" locs="174229,-86659,-5106"/> | |
2884 | + </stage> | |
2885 | + <stage order="7" loc="174229,-86659,-5106" teleport="false" minutes="10"> | |
2886 | + <mob npcId="62104" locs="174229,-86659,-5106"/> | |
2887 | + </stage> | |
2888 | + </dungeon> | |
2889 | +</list> | |
2890 | ||
2891 | ||
2892 | ||
2893 | gameserver/events/Dungeon_Html_Reward.properties | |
2894 | +#Item Id Prince L2DungeonManager | |
2895 | +DungeonCoinId = 57 | |
2896 | +# ID of the item that will be Buy to Dungeon | |
2897 | +DungeonContItem = 1 | |
2898 | + | |
2899 | +#Cordenadas para la vuelta del jugador al terminar el evento | |
2900 | +DungeonSpawnX = 82732 | |
2901 | +DungeonSpawnY = 149316 | |
2902 | +DungeonSpawnZ = -3495 | |
2903 | +DungeonSpawnRnd = 25 | |
2904 | + | |
2905 | + | |
2906 | +#Renewal Dungeon Open Html Finishi! | |
2907 | +DungeonRenewalHtml0 = 6657 | |
2908 | +DungeonRenewalHtml1 = 6656 | |
2909 | +DungeonRenewalHtml2 = 6658 | |
2910 | +DungeonRenewalHtml3 = 6659 | |
2911 | +DungeonRenewalHtml4 = 6660 | |
2912 | +DungeonRenewalHtml5 = 8191 | |
2913 | +DungeonRenewalHtml6 = 49997 | |
2914 | +DungeonRenewalHtml7 = 49998 | |
2915 | +DungeonRenewalHtml8 = 50000 | |
2916 | +DungeonRenewalHtml9 = 59989 | |
2917 | +DungeonRenewalHtml10 = 52366 | |
2918 | + | |
2919 | + | |
2920 | +DungeonPartyRenewalHtml0 = 58012 | |
2921 | +DungeonPartyRenewalHtml1 = 50051 | |
2922 | +DungeonPartyRenewalHtml2 = 59999 | |
2923 | +DungeonPartyRenewalHtml3 = 52030 | |
2924 | +DungeonPartyRenewalHtml4 = 52031 | |
2925 | +DungeonPartyRenewalHtml5 = 52032 | |
2926 | ||
2927 | ||
2928 | ||
2929 | ||
2930 | Archivos sql y html bajar importante: https://www.mediafire.com/file/ntbn69340fjbops/Dungeon.rar/file | |
2931 | ||
2932 | ||
2933 | ||
2934 | ||
2935 | ||
2936 | ||
2937 | ||
2938 |