SHOW:
|
|
- or go back to the newest paste.
1 | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java b/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java | |
2 | index e682cc6..ab68e75 100644 | |
3 | --- a/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java | |
4 | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java | |
5 | @@ -56,6 +56,7 @@ | |
6 | import net.sf.l2j.gameserver.data.xml.FishData; | |
7 | import net.sf.l2j.gameserver.data.xml.HennaData; | |
8 | import net.sf.l2j.gameserver.data.xml.HerbDropData; | |
9 | +import net.sf.l2j.gameserver.data.xml.IconData; | |
10 | import net.sf.l2j.gameserver.data.xml.InstantTeleportData; | |
11 | import net.sf.l2j.gameserver.data.xml.ItemData; | |
12 | import net.sf.l2j.gameserver.data.xml.MapRegionData; | |
13 | @@ -273,6 +274,9 @@ | |
14 | LOGGER.info("Loaded {} target handlers.", TargetHandler.getInstance().size()); | |
15 | LOGGER.info("Loaded {} user command handlers.", UserCommandHandler.getInstance().size()); | |
16 | ||
17 | + StringUtil.printSection("IconData"); | |
18 | + IconData.getInstance(); | |
19 | + | |
20 | StringUtil.printSection("System"); | |
21 | Runtime.getRuntime().addShutdownHook(Shutdown.getInstance()); | |
22 | ||
23 | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/data/manager/GrandBossManager.java b/aCis_gameserver/java/net/sf/l2j/gameserver/data/manager/GrandBossManager.java | |
24 | index 8055a66..6d9fc97 100644 | |
25 | --- a/aCis_gameserver/java/net/sf/l2j/gameserver/data/manager/GrandBossManager.java | |
26 | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/data/manager/GrandBossManager.java | |
27 | @@ -27,6 +27,7 @@ | |
28 | private final Map<Integer, GrandBoss> _bosses = new HashMap<>(); | |
29 | private final Map<Integer, StatSet> _sets = new HashMap<>(); | |
30 | private final Map<Integer, Integer> _bossStatus = new HashMap<>(); | |
31 | + private final Map<Integer, Long> _trigger = new HashMap<>(); | |
32 | ||
33 | protected GrandBossManager() | |
34 | { | |
35 | @@ -98,6 +99,22 @@ | |
36 | return _bosses.get(bossId); | |
37 | } | |
38 | ||
39 | + public long getBossTrigger(int bossId) | |
40 | + { | |
41 | + if (_trigger.containsKey(bossId)) | |
42 | + return _trigger.get(bossId); | |
43 | + return -1; | |
44 | + } | |
45 | + | |
46 | + /** | |
47 | + * @param bossId : Set the Grandboss ID | |
48 | + * @param time : Insert a value time of triggering. | |
49 | + */ | |
50 | + public void setBossTrigger(int bossId, long time) | |
51 | + { | |
52 | + _trigger.put(bossId, time); | |
53 | + } | |
54 | + | |
55 | public StatSet getStatSet(int bossId) | |
56 | { | |
57 | return _sets.get(bossId); | |
58 | @@ -201,6 +218,7 @@ | |
59 | _bosses.clear(); | |
60 | _sets.clear(); | |
61 | _bossStatus.clear(); | |
62 | + _trigger.clear(); | |
63 | } | |
64 | ||
65 | public static GrandBossManager getInstance() | |
66 | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/data/manager/RaidBossManager.java b/aCis_gameserver/java/net/sf/l2j/gameserver/data/manager/RaidBossManager.java | |
67 | index 421a8bf..3ca176c 100644 | |
68 | --- a/aCis_gameserver/java/net/sf/l2j/gameserver/data/manager/RaidBossManager.java | |
69 | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/data/manager/RaidBossManager.java | |
70 | @@ -32,6 +32,7 @@ | |
71 | private static final String SAVE_RAIDBOSS = "UPDATE raidboss_spawnlist SET currentHP = ?, currentMP = ? WHERE boss_id = ?"; | |
72 | ||
73 | protected final Map<Integer, BossSpawn> _spawns = new HashMap<>(); | |
74 | + public final static Map<Integer, Long> _rTime = new HashMap<>(); | |
75 | ||
76 | public RaidBossManager() | |
77 | { | |
78 | @@ -79,6 +80,28 @@ | |
79 | } | |
80 | ||
81 | /** | |
82 | + * @param id : Insert BossId to get infos about respawnTime. | |
83 | + * @return returns -1 if BossID and/or respawnTime isn't mapping. | |
84 | + */ | |
85 | + public long getRespawntime(int id) | |
86 | + { | |
87 | + if (_rTime.containsKey(id)) | |
88 | + return _rTime.get(id); | |
89 | + | |
90 | + return -1; | |
91 | + } | |
92 | + | |
93 | + /** | |
94 | + * @param id : Set the ID of Boss. | |
95 | + * @param time : Insert a value of long time. | |
96 | + * @return If success inserting, the value of time inserts to map. | |
97 | + */ | |
98 | + public long setTime(int id, long time) | |
99 | + { | |
100 | + return _rTime.put(id, time); | |
101 | + } | |
102 | + | |
103 | + /** | |
104 | * @return a {@link Collection} holding all existing {@link BossSpawn}s. | |
105 | */ | |
106 | public Collection<BossSpawn> getBossSpawns() | |
107 | @@ -159,6 +182,7 @@ | |
108 | bs.setCurrentHp(currentHP); | |
109 | bs.setCurrentMp(currentMP); | |
110 | bs.setRespawnTime(0); | |
111 | + _rTime.put(id, 0L); | |
112 | ||
113 | // Time passed by, or we force the database save ; save data on database. | |
114 | if (time > respawnTime || forceSave) | |
115 | @@ -192,6 +216,7 @@ | |
116 | bs.setCurrentHp(0); | |
117 | bs.setCurrentMp(0); | |
118 | bs.setRespawnTime(respawnTime); | |
119 | + _rTime.put(id, respawnTime); | |
120 | } | |
121 | ||
122 | // Add the BossSpawn. | |
123 | @@ -214,6 +239,9 @@ | |
124 | if (bs == null) | |
125 | return; | |
126 | ||
127 | + if (_rTime.containsKey(id)) | |
128 | + _rTime.remove(id); | |
129 | + | |
130 | // Make actions related to despawn. | |
131 | bs.onDespawn(); | |
132 | ||
133 | @@ -260,6 +288,7 @@ | |
134 | ||
135 | // Delete spawns entries. | |
136 | _spawns.clear(); | |
137 | + _rTime.clear(); | |
138 | } | |
139 | ||
140 | public static RaidBossManager getInstance() | |
141 | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/data/xml/IconData.java b/aCis_gameserver/java/net/sf/l2j/gameserver/data/xml/IconData.java | |
142 | new file mode 100644 | |
143 | index 0000000..f709bd8 | |
144 | --- /dev/null | |
145 | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/data/xml/IconData.java | |
146 | @@ -0,0 +1,68 @@ | |
147 | +package net.sf.l2j.gameserver.data.xml; | |
148 | + | |
149 | +import java.nio.file.Path; | |
150 | +import java.util.HashMap; | |
151 | +import java.util.Map; | |
152 | + | |
153 | +import net.sf.l2j.commons.data.xml.IXmlReader; | |
154 | + | |
155 | +import org.w3c.dom.Document; | |
156 | + | |
157 | +/** | |
158 | + * @author BaggosPC | |
159 | + * | |
160 | + */ | |
161 | +public class IconData implements IXmlReader | |
162 | +{ | |
163 | + public static final Map<Integer, String> _iconItem = new HashMap<>(); | |
164 | + | |
165 | + protected IconData() | |
166 | + { | |
167 | + load(); | |
168 | + } | |
169 | + | |
170 | + @Override | |
171 | + public void load() | |
172 | + { | |
173 | + parseFile("./data/xml/iconItems.xml"); | |
174 | + LOGGER.info("Loaded {} Icons on items.", _iconItem.size()); | |
175 | + } | |
176 | + | |
177 | + @Override | |
178 | + public void parseDocument(Document doc, Path path) | |
179 | + { | |
180 | + try | |
181 | + { | |
182 | + forEach(doc, "list", listNode -> forEach(listNode, "icon", iconNode -> | |
183 | + { | |
184 | + var set = parseAttributes(iconNode); | |
185 | + _iconItem.put(set.getInteger("ItemID"), set.getString("Icon")); | |
186 | + })); | |
187 | + } | |
188 | + catch (Exception e) | |
189 | + { | |
190 | + LOGGER.info("Error while loading. Make sure your iconItems.xml its correct. The error may be after the "+ _iconItem.size() + " loaded icon(s)."); | |
191 | + } | |
192 | + } | |
193 | + | |
194 | + public void reload() | |
195 | + { | |
196 | + _iconItem.clear(); | |
197 | + load(); | |
198 | + } | |
199 | + | |
200 | + public static String getIcon(int id) | |
201 | + { | |
202 | + return _iconItem.get(id); | |
203 | + } | |
204 | + | |
205 | + public static IconData getInstance() | |
206 | + { | |
207 | + return SingletonHolder.INSTANCE; | |
208 | + } | |
209 | + | |
210 | + private static class SingletonHolder | |
211 | + { | |
212 | + protected static final IconData INSTANCE = new IconData(); | |
213 | + } | |
214 | +} | |
215 | \ No newline at end of file | |
216 | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/spawn/BossSpawn.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/spawn/BossSpawn.java | |
217 | index f30299a..712e6fd 100644 | |
218 | --- a/aCis_gameserver/java/net/sf/l2j/gameserver/model/spawn/BossSpawn.java | |
219 | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/spawn/BossSpawn.java | |
220 | @@ -10,6 +10,7 @@ | |
221 | import net.sf.l2j.commons.pool.ThreadPool; | |
222 | import net.sf.l2j.commons.random.Rnd; | |
223 | ||
224 | +import net.sf.l2j.gameserver.data.manager.RaidBossManager; | |
225 | import net.sf.l2j.gameserver.enums.BossStatus; | |
226 | import net.sf.l2j.gameserver.model.actor.Npc; | |
227 | ||
228 | @@ -32,6 +33,7 @@ | |
229 | private double _currentMp; | |
230 | ||
231 | private long _respawnTime; | |
232 | + private long _bossTime; | |
233 | ||
234 | @Override | |
235 | public String toString() | |
236 | @@ -49,6 +51,16 @@ | |
237 | _spawn = spawn; | |
238 | } | |
239 | ||
240 | + public long getBossTime() | |
241 | + { | |
242 | + return _bossTime; | |
243 | + } | |
244 | + | |
245 | + public void setBossTime(long bossTime) | |
246 | + { | |
247 | + _bossTime = bossTime; | |
248 | + } | |
249 | + | |
250 | public BossStatus getStatus() | |
251 | { | |
252 | return _status; | |
253 | @@ -136,6 +148,7 @@ | |
254 | _currentHp = 0; | |
255 | _currentMp = 0; | |
256 | _respawnTime = respawnTime; | |
257 | + _bossTime = RaidBossManager.getInstance().setTime(_spawn.getNpcId(), respawnTime); | |
258 | ||
259 | // Cancel task, if running. | |
260 | cancelTask(); | |
261 | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/zone/type/BossZone.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/zone/type/BossZone.java | |
262 | index 5e5b7c0..dd6808b 100644 | |
263 | --- a/aCis_gameserver/java/net/sf/l2j/gameserver/model/zone/type/BossZone.java | |
264 | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/zone/type/BossZone.java | |
265 | @@ -86,7 +86,7 @@ | |
266 | player.setInsideZone(ZoneId.NO_SUMMON_FRIEND, true); | |
267 | ||
268 | // Skip other checks for GM or if no invade time is set. | |
269 | - if (player.isGM() || _invadeTime == 0) | |
270 | + if (player.isGM() || _invadeTime == 0 || player.isInObserverMode()) | |
271 | return; | |
272 | ||
273 | // Get player object id. | |
274 | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java b/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java | |
275 | index d8adb02..deec387 100644 | |
276 | --- a/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java | |
277 | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java | |
278 | @@ -20,6 +20,7 @@ | |
279 | import net.sf.l2j.gameserver.network.serverpackets.ActionFailed; | |
280 | import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; | |
281 | import net.sf.l2j.gameserver.scripting.QuestState; | |
282 | +import net.sf.l2j.gameserver.scripting.script.feature.RaidbossInfo; | |
283 | ||
284 | public final class RequestBypassToServer extends L2GameClientPacket | |
285 | { | |
286 | @@ -98,6 +99,16 @@ | |
287 | html.disableValidation(); | |
288 | player.sendPacket(html); | |
289 | } | |
290 | + else if (_command.startsWith("droplist")) | |
291 | + { | |
292 | + StringTokenizer st = new StringTokenizer(_command, " "); | |
293 | + st.nextToken(); | |
294 | + | |
295 | + int npcId = Integer.parseInt(st.nextToken()); | |
296 | + int page = st.hasMoreTokens() ? Integer.parseInt(st.nextToken()) : 1; | |
297 | + | |
298 | + RaidbossInfo.sendDropInfos(player, npcId, page); | |
299 | + } | |
300 | else if (_command.startsWith("npc_")) | |
301 | { | |
302 | if (!player.validateBypass(_command)) | |
303 | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/ai/boss/Antharas.java b/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/ai/boss/Antharas.java | |
304 | index ad33fc8..2d0a6e8 100644 | |
305 | --- a/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/ai/boss/Antharas.java | |
306 | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/ai/boss/Antharas.java | |
307 | @@ -12,6 +12,7 @@ | |
308 | import net.sf.l2j.gameserver.data.manager.GrandBossManager; | |
309 | import net.sf.l2j.gameserver.data.manager.ZoneManager; | |
310 | import net.sf.l2j.gameserver.enums.ScriptEventType; | |
311 | +import net.sf.l2j.gameserver.model.World; | |
312 | import net.sf.l2j.gameserver.model.actor.Creature; | |
313 | import net.sf.l2j.gameserver.model.actor.Npc; | |
314 | import net.sf.l2j.gameserver.model.actor.Playable; | |
315 | @@ -143,6 +144,9 @@ | |
316 | // Drop tasks. | |
317 | dropTimers(npc); | |
318 | ||
319 | + // Stop triggering map | |
320 | + GrandBossManager.getInstance().setBossTrigger(ANTHARAS, 0L); | |
321 | + | |
322 | // Delete current instance of Antharas. | |
323 | npc.deleteMe(); | |
324 | return null; | |
325 | @@ -171,6 +175,9 @@ | |
326 | // stores current time for inactivity task. | |
327 | _timeTracker = System.currentTimeMillis(); | |
328 | ||
329 | + // Stop triggering map | |
330 | + GrandBossManager.getInstance().setBossTrigger(ANTHARAS, 0L); | |
331 | + World.announceToOnlinePlayers("Grand Monster Antharas is engaged in battle!", true); | |
332 | GrandBossManager.getInstance().setBossStatus(ANTHARAS, FIGHTING); | |
333 | npc.setInvul(false); | |
334 | npc.forceRunStance(); | |
335 | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/ai/boss/Baium.java b/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/ai/boss/Baium.java | |
336 | index 0654270..bc54511 100644 | |
337 | --- a/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/ai/boss/Baium.java | |
338 | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/ai/boss/Baium.java | |
339 | @@ -14,6 +14,7 @@ | |
340 | import net.sf.l2j.gameserver.data.manager.ZoneManager; | |
341 | import net.sf.l2j.gameserver.enums.ScriptEventType; | |
342 | import net.sf.l2j.gameserver.geoengine.GeoEngine; | |
343 | +import net.sf.l2j.gameserver.model.World; | |
344 | import net.sf.l2j.gameserver.model.actor.Attackable; | |
345 | import net.sf.l2j.gameserver.model.actor.Creature; | |
346 | import net.sf.l2j.gameserver.model.actor.Npc; | |
347 | @@ -112,6 +113,7 @@ | |
348 | _minions.add(angel); | |
349 | } | |
350 | ||
351 | + World.announceToOnlinePlayers("Grand Monster Baium is awake and fighting.", true); | |
352 | startQuestTimerAtFixedRate("baium_despawn", baium, null, 60000); | |
353 | startQuestTimerAtFixedRate("skill_range", baium, null, 2000); | |
354 | startQuestTimerAtFixedRate("angels_aggro_reconsider", null, null, 5000); | |
355 | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/ai/boss/Valakas.java b/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/ai/boss/Valakas.java | |
356 | index 03cd98e..7d65abe 100644 | |
357 | --- a/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/ai/boss/Valakas.java | |
358 | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/ai/boss/Valakas.java | |
359 | @@ -8,6 +8,7 @@ | |
360 | import net.sf.l2j.gameserver.data.manager.GrandBossManager; | |
361 | import net.sf.l2j.gameserver.data.manager.ZoneManager; | |
362 | import net.sf.l2j.gameserver.enums.ScriptEventType; | |
363 | +import net.sf.l2j.gameserver.model.World; | |
364 | import net.sf.l2j.gameserver.model.actor.Creature; | |
365 | import net.sf.l2j.gameserver.model.actor.Npc; | |
366 | import net.sf.l2j.gameserver.model.actor.Playable; | |
367 | @@ -173,6 +174,9 @@ | |
368 | cancelQuestTimers("regen_task", npc); | |
369 | cancelQuestTimers("skill_task", npc); | |
370 | ||
371 | + // Stop triggering map | |
372 | + GrandBossManager.getInstance().setBossTrigger(VALAKAS, 0L); | |
373 | + | |
374 | // Delete current instance of Valakas. | |
375 | npc.deleteMe(); | |
376 | ||
377 | @@ -222,9 +226,12 @@ | |
378 | VALAKAS_LAIR.broadcastPacket(new SpecialCamera(npc.getObjectId(), 750, 170, -10, 3400, 4000, 10, -15, 1, 0)); | |
379 | else if (name.equalsIgnoreCase("spawn_10")) | |
380 | { | |
381 | + // Stop triggering map | |
382 | + GrandBossManager.getInstance().setBossTrigger(VALAKAS, 0L); | |
383 | + | |
384 | GrandBossManager.getInstance().setBossStatus(VALAKAS, FIGHTING); | |
385 | npc.setInvul(false); | |
386 | - | |
387 | + World.announceToOnlinePlayers("Grand Monster Valakas is engaged in battle!", true); | |
388 | startQuestTimerAtFixedRate("regen_task", npc, null, 60000); | |
389 | startQuestTimerAtFixedRate("skill_task", npc, null, 2000); | |
390 | } | |
391 | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/feature/GrandbossInfo.java b/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/feature/GrandbossInfo.java | |
392 | new file mode 100644 | |
393 | index 0000000..63ee4aa | |
394 | --- /dev/null | |
395 | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/feature/GrandbossInfo.java | |
396 | @@ -0,0 +1,195 @@ | |
397 | +package net.sf.l2j.gameserver.scripting.script.feature; | |
398 | + | |
399 | +import java.text.SimpleDateFormat; | |
400 | +import java.util.StringTokenizer; | |
401 | + | |
402 | +import net.sf.l2j.commons.lang.StringUtil; | |
403 | +import net.sf.l2j.commons.logging.CLogger; | |
404 | + | |
405 | +import net.sf.l2j.gameserver.data.manager.GrandBossManager; | |
406 | +import net.sf.l2j.gameserver.data.xml.NpcData; | |
407 | +import net.sf.l2j.gameserver.model.actor.Npc; | |
408 | +import net.sf.l2j.gameserver.model.actor.Player; | |
409 | +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; | |
410 | +import net.sf.l2j.gameserver.scripting.Quest; | |
411 | + | |
412 | +/** | |
413 | + * @author BaggosPC | |
414 | + * | |
415 | + */ | |
416 | +public class GrandbossInfo extends Quest | |
417 | +{ | |
418 | + protected static final CLogger LOGGER = new CLogger(GrandbossInfo.class.getName()); | |
419 | + | |
420 | + private static final int[] NPCs = | |
421 | + { | |
422 | + 31729, | |
423 | + 31730, | |
424 | + 31731, | |
425 | + 31732, | |
426 | + 31733, | |
427 | + 31734, | |
428 | + 31735, | |
429 | + 31736, | |
430 | + 31737, | |
431 | + 31738, | |
432 | + 31775, | |
433 | + 31776, | |
434 | + 31777, | |
435 | + 31778, | |
436 | + 31779, | |
437 | + 31780, | |
438 | + 31781, | |
439 | + 31782, | |
440 | + 31783, | |
441 | + 31784, | |
442 | + 31785, | |
443 | + 31786, | |
444 | + 31787, | |
445 | + 31788, | |
446 | + 31789, | |
447 | + 31790, | |
448 | + 31791, | |
449 | + 31792, | |
450 | + 31793, | |
451 | + 31794, | |
452 | + 31795, | |
453 | + 31796, | |
454 | + 31797, | |
455 | + 31798, | |
456 | + 31799, | |
457 | + 31800, | |
458 | + 31801, | |
459 | + 31802, | |
460 | + 31803, | |
461 | + 31804, | |
462 | + 31805, | |
463 | + 31806, | |
464 | + 31807, | |
465 | + 31808, | |
466 | + 31809, | |
467 | + 31810, | |
468 | + 31811, | |
469 | + 31812, | |
470 | + 31813, | |
471 | + 31814, | |
472 | + 31815, | |
473 | + 31816, | |
474 | + 31817, | |
475 | + 31818, | |
476 | + 31819, | |
477 | + 31820, | |
478 | + 31821, | |
479 | + 31822, | |
480 | + 31823, | |
481 | + 31824, | |
482 | + 31825, | |
483 | + 31826, | |
484 | + 31827, | |
485 | + 31828, | |
486 | + 31829, | |
487 | + 31830, | |
488 | + 31831, | |
489 | + 31832, | |
490 | + 31833, | |
491 | + 31834, | |
492 | + 31835, | |
493 | + 31836, | |
494 | + 31837, | |
495 | + 31838, | |
496 | + 31839, | |
497 | + 31840, | |
498 | + 31841, | |
499 | + }; | |
500 | + | |
501 | + public GrandbossInfo() | |
502 | + { | |
503 | + super(-1, "feature"); | |
504 | + | |
505 | + addTalkId(NPCs); | |
506 | + } | |
507 | + | |
508 | + @Override | |
509 | + public String onAdvEvent(String event, Npc npc, Player cha) | |
510 | + { | |
511 | + // Location of Grandboss to Observe the battle. | |
512 | + if (event.equalsIgnoreCase("antharas")) | |
513 | + cha.enterObserverMode(178040, 115048, -7704); | |
514 | + else if (event.equalsIgnoreCase("valakas")) | |
515 | + cha.enterObserverMode(212808, -114152, -1632); | |
516 | + | |
517 | + if (!StringUtil.isDigit(event)) | |
518 | + return event; | |
519 | + | |
520 | + var filename = "data/html/script/feature/GrandbossInfo/" + npc.getNpcId() + ".htm"; | |
521 | + var grandId = Integer.parseInt(event); | |
522 | + var BossStatus = GrandBossManager.getInstance().getBossStatus(grandId); | |
523 | + var npcData = NpcData.getInstance().getTemplate(grandId); | |
524 | + var trigger = GrandBossManager.getInstance().getBossTrigger(grandId); | |
525 | + | |
526 | + switch (BossStatus) | |
527 | + { | |
528 | + case 0: | |
529 | + var str = new StringTokenizer(event, " "); | |
530 | + str.nextToken(); | |
531 | + var page = str.hasMoreTokens() ? Integer.parseInt(str.nextToken()) : 1; | |
532 | + | |
533 | + RaidbossInfo.sendDropInfos(cha, grandId, page); | |
534 | + } | |
535 | + switch (npcData.getNpcId()) | |
536 | + { | |
537 | + case 29006: | |
538 | + case 29014: | |
539 | + case 29001: | |
540 | + case 29022: // Case of Queen/Core/Orfen/Zaken | |
541 | + if (BossStatus == 1) | |
542 | + sendHTM(cha, npc, grandId); | |
543 | + break; | |
544 | + case 29020: // Case of Baium | |
545 | + if (BossStatus == 2) | |
546 | + sendHTM(cha, npc, grandId); | |
547 | + break; | |
548 | + case 29019: | |
549 | + case 29028: // Case of Antharas/Valakas | |
550 | + var htm = new NpcHtmlMessage(0); | |
551 | + switch (BossStatus) | |
552 | + { | |
553 | + case 1: | |
554 | + filename = "data/html/script/feature/GrandbossInfo/trigger.htm"; | |
555 | + htm.setFile(filename); | |
556 | + htm.replace("%trigger%", "<font color=\"FF9900\">" + new SimpleDateFormat("HH:mm").format(trigger) + ".</font>"); | |
557 | + cha.sendPacket(htm); | |
558 | + break; | |
559 | + case 2: | |
560 | + filename = "data/html/script/feature/GrandbossInfo/watch.htm"; | |
561 | + htm.setFile(filename); | |
562 | + cha.sendPacket(htm); | |
563 | + break; | |
564 | + case 3: | |
565 | + sendHTM(cha, npc, grandId); | |
566 | + break; | |
567 | + } | |
568 | + break; | |
569 | + } | |
570 | + return null; | |
571 | + } | |
572 | + | |
573 | + private static void sendHTM(Player cha, Npc npc, int id) | |
574 | + { | |
575 | + var npcData = NpcData.getInstance().getTemplate(id); | |
576 | + var info = GrandBossManager.getInstance().getStatSet(id); | |
577 | + var temp = info.getLong("respawn_time"); | |
578 | + var htm = new NpcHtmlMessage(0); | |
579 | + | |
580 | + htm.setFile("data/html/script/feature/GrandbossInfo/dead.htm"); | |
581 | + htm.replace("%name%", npcData.getName()); | |
582 | + htm.replace("%refresh%", "<font color=\"FF9900\">" + new SimpleDateFormat("dd-MM-yyyy HH:mm").format(temp) + ".</font>"); | |
583 | + cha.sendPacket(htm); | |
584 | + } | |
585 | + | |
586 | + @Override | |
587 | + public String onTalk(Npc npc, Player player) | |
588 | + { | |
589 | + return "info.htm"; | |
590 | + } | |
591 | +} | |
592 | \ No newline at end of file | |
593 | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/feature/RaidbossInfo.java b/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/feature/RaidbossInfo.java | |
594 | index d960e08..b562fdf 100644 | |
595 | --- a/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/feature/RaidbossInfo.java | |
596 | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/feature/RaidbossInfo.java | |
597 | @@ -1,15 +1,27 @@ | |
598 | package net.sf.l2j.gameserver.scripting.script.feature; | |
599 | ||
600 | +import java.text.DecimalFormat; | |
601 | +import java.text.SimpleDateFormat; | |
602 | import java.util.HashMap; | |
603 | +import java.util.List; | |
604 | import java.util.Map; | |
605 | +import java.util.StringTokenizer; | |
606 | ||
607 | import net.sf.l2j.commons.lang.StringUtil; | |
608 | +import net.sf.l2j.commons.math.MathUtil; | |
609 | ||
610 | +import net.sf.l2j.Config; | |
611 | +import net.sf.l2j.gameserver.data.manager.RaidBossManager; | |
612 | import net.sf.l2j.gameserver.data.sql.SpawnTable; | |
613 | +import net.sf.l2j.gameserver.data.xml.IconData; | |
614 | +import net.sf.l2j.gameserver.data.xml.ItemData; | |
615 | +import net.sf.l2j.gameserver.data.xml.NpcData; | |
616 | import net.sf.l2j.gameserver.model.actor.Npc; | |
617 | import net.sf.l2j.gameserver.model.actor.Player; | |
618 | +import net.sf.l2j.gameserver.model.item.DropData; | |
619 | import net.sf.l2j.gameserver.model.location.Location; | |
620 | import net.sf.l2j.gameserver.model.spawn.Spawn; | |
621 | +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; | |
622 | import net.sf.l2j.gameserver.scripting.Quest; | |
623 | ||
624 | public class RaidbossInfo extends Quest | |
625 | @@ -119,13 +131,113 @@ | |
626 | if (!StringUtil.isDigit(event)) | |
627 | return event; | |
628 | ||
629 | - final Location loc = RADARS.get(Integer.parseInt(event)); | |
630 | - if (loc != null) | |
631 | - player.getRadarList().addMarker(loc); | |
632 | + var rbid = Integer.parseInt(event); | |
633 | + var filename = "data/html/script/feature/RaidbossInfo/" + npc.getNpcId() + ".htm"; | |
634 | + var npcData = NpcData.getInstance().getTemplate(rbid); | |
635 | + var boss = RaidBossManager.getInstance().getBossSpawn(rbid); | |
636 | + var time = RaidBossManager.getInstance().getRespawntime(rbid); | |
637 | + var htm = new NpcHtmlMessage(0); | |
638 | ||
639 | + // filename = ((boss.getStatus() == BossStatus.ALIVE) ? "data/html/scripts/custom/RaidbossInfo/alive.htm" : "data/html/scripts/custom/RaidbossInfo/dead.htm"); | |
640 | + switch (boss.getStatus()) | |
641 | + { | |
642 | + case ALIVE: | |
643 | + var loc = RADARS.get(Integer.parseInt(event)); | |
644 | + if (loc != null) | |
645 | + player.getRadarList().addMarker(loc); | |
646 | + | |
647 | + | |
648 | + var str = new StringTokenizer(event, " "); | |
649 | + str.nextToken(); | |
650 | + var page = str.hasMoreTokens() ? Integer.parseInt(str.nextToken()) : 1; | |
651 | + | |
652 | + sendDropInfos(player, rbid, page); | |
653 | + break; | |
654 | + case DEAD: | |
655 | + filename = "data/html/script/feature/RaidbossInfo/dead.htm"; | |
656 | + htm.setFile(filename); | |
657 | + htm.replace("%name%", npcData.getName()); | |
658 | + htm.replace("%refresh%", "<font color=\"FF9900\">" + new SimpleDateFormat("dd-MM-yyyy HH:mm").format(time) + ".</font>"); | |
659 | + player.sendPacket(htm); | |
660 | + break; | |
661 | + } | |
662 | return null; | |
663 | } | |
664 | ||
665 | + public static void sendDropInfos(Player player, int npcId, int page) | |
666 | + { | |
667 | + var npcData = NpcData.getInstance().getTemplate(npcId); | |
668 | + List<DropData> list = npcData.getAllDropData(); | |
669 | + var PAGE_LIMIT = 7; | |
670 | + | |
671 | + if (list.isEmpty()) | |
672 | + { | |
673 | + player.sendMessage("Boss " + npcData.getName() + " has no drop."); | |
674 | + return; | |
675 | + } | |
676 | + | |
677 | + var max = MathUtil.countPagesNumber(list.size(), PAGE_LIMIT); | |
678 | + if (page > max) | |
679 | + page = max; | |
680 | + | |
681 | + list = list.subList((page - 1) * PAGE_LIMIT, Math.min(page * PAGE_LIMIT, list.size())); | |
682 | + | |
683 | + var sb = new StringBuilder(2000); | |
684 | + StringUtil.append(sb, "<html><title>Boss ", npcData.getName(), "</title><body><center><font color=\"LEVEL\">Boss Monster ", npcData.getName(), " is alive!</font></center><br>"); | |
685 | + | |
686 | + var row = 0; | |
687 | + for (DropData drop : list) | |
688 | + { | |
689 | + sb.append(((row % 2) == 0 ? "<table width=\"280\" bgcolor=\"000000\"><tr>" : "<table width=\"280\"><tr>")); | |
690 | + | |
691 | + var chance = Math.min(100, (((drop.getItemId() == 57) ? drop.getChance() * Config.RATE_DROP_ADENA : drop.getChance() * Config.RATE_DROP_ITEMS_BY_RAID) / 10000)); | |
692 | + var item = ItemData.getInstance().getTemplate(drop.getItemId()); | |
693 | + | |
694 | + String format; | |
695 | + if (chance <= 0.001 || chance <= 0.01) | |
696 | + { | |
697 | + var df = new DecimalFormat(chance <= 0.001 ? "#.####" : "#.###"); | |
698 | + format = df.format(chance); | |
699 | + } | |
700 | + else | |
701 | + { | |
702 | + var df = new DecimalFormat("##.##"); | |
703 | + format = df.format(chance); | |
704 | + } | |
705 | + | |
706 | + String name = item.getName(); | |
707 | + if (name.length() >= 45) | |
708 | + name = name.substring(0, 42) + "..."; | |
709 | + | |
710 | + StringUtil.append(sb, "<td width=44 height=41 align=center><table bgcolor=" + ("3BB9FF") + " cellpadding=6 cellspacing=\"-5\"><tr><td><button width=32 height=32 back=" + IconData.getIcon(drop.getItemId()) + " fore=" + IconData.getIcon(drop.getItemId()) + "></td></tr></table></td>"); | |
711 | + StringUtil.append(sb, "<td width=246 height=34>", name, "<br1><font color=B09878>", "Drop", ": ", format, "% Min: ", drop.getMinDrop(), " Max: ", drop.getMaxDrop(), "</font></td>"); | |
712 | + | |
713 | + sb.append("</tr></table><img src=\"L2UI.SquareGray\" width=277 height=1>"); | |
714 | + row++; | |
715 | + } | |
716 | + | |
717 | + // Build page footer. | |
718 | + sb.append("<br><img src=\"L2UI.SquareGray\" width=277 height=1><table width=\"100%\" bgcolor=000000><tr>"); | |
719 | + | |
720 | + if (page > 1) | |
721 | + StringUtil.append(sb, "<td align=left width=70><a action=\"bypass droplist ", npcId, " ", page - 1, "\">Previous</a></td>"); | |
722 | + else | |
723 | + StringUtil.append(sb, "<td align=left width=70>Previous</td>"); | |
724 | + | |
725 | + StringUtil.append(sb, "<td align=center width=100>Page ", page, "</td>"); | |
726 | + | |
727 | + if (page < max) | |
728 | + StringUtil.append(sb, "<td align=right width=70><a action=\"bypass droplist ", npcId, " ", page + 1, "\">Next</a></td>"); | |
729 | + else | |
730 | + StringUtil.append(sb, "<td align=right width=70>Next</td>"); | |
731 | + | |
732 | + sb.append("</tr></table><img src=\"L2UI.SquareGray\" width=277 height=1>"); | |
733 | + sb.append("</body></html>"); | |
734 | + var html = new NpcHtmlMessage(0); | |
735 | + html.setHtml(sb.toString()); | |
736 | + player.sendPacket(html); | |
737 | + } | |
738 | + | |
739 | @Override | |
740 | public String onTalk(Npc npc, Player player) | |
741 | { | |
742 | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/teleport/GrandBossTeleporter.java b/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/teleport/GrandBossTeleporter.java | |
743 | index cee8e32..60f7da2 100644 | |
744 | --- a/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/teleport/GrandBossTeleporter.java | |
745 | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/script/teleport/GrandBossTeleporter.java | |
746 | @@ -161,6 +161,10 @@ | |
747 | ||
748 | if (status == Antharas.DORMANT) | |
749 | { | |
750 | + var trigger = Config.WAIT_TIME_ANTHARAS; | |
751 | + var Time = System.currentTimeMillis() + (trigger); | |
752 | + | |
753 | + GrandBossManager.getInstance().setBossTrigger(Antharas.ANTHARAS, Time); | |
754 | GrandBossManager.getInstance().setBossStatus(Antharas.ANTHARAS, Antharas.WAITING); | |
755 | ScriptData.getInstance().getQuest("Antharas").startQuestTimer("beginning", null, null, Config.WAIT_TIME_ANTHARAS); | |
756 | } | |
757 | @@ -191,6 +195,10 @@ | |
758 | ||
759 | if (status == Valakas.DORMANT) | |
760 | { | |
761 | + var trigger = Config.WAIT_TIME_ANTHARAS; | |
762 | + var Time = System.currentTimeMillis() + (trigger); | |
763 | + | |
764 | + GrandBossManager.getInstance().setBossTrigger(Valakas.VALAKAS, Time); | |
765 | GrandBossManager.getInstance().setBossStatus(Valakas.VALAKAS, Valakas.WAITING); | |
766 | ScriptData.getInstance().getQuest("Valakas").startQuestTimer("beginning", null, null, Config.WAIT_TIME_VALAKAS); | |
767 | } | |
768 | diff --git a/aCis_datapack/data/html/adventurer_guildsman/31805.htm b/aCis_datapack/data/html/adventurer_guildsman/31805.htm | |
769 | index b3f851f..d997037 100644 | |
770 | --- a/aCis_datapack/data/html/adventurer_guildsman/31805.htm | |
771 | +++ b/aCis_datapack/data/html/adventurer_guildsman/31805.htm | |
772 | @@ -1,8 +1,11 @@ | |
773 | -<html><body>Adventure Guildsman:<br> | |
774 | +<html> | |
775 | +<title>Adventure Guildsman</title> | |
776 | +<body>Adventure Guildsman:<br> | |
777 | The world is a dark and scary place, my friend! If everyone would only follow the teachings of Eve and Einhasad, this chaos would finally end!<br> | |
778 | What's needed is brave warrior like you stand up for the down-trodden, to restore peace and justice to the world! are you up to the task?<br> | |
779 | <a action="bypass -h npc_%objectId%_questlist">Quest Information</a><br> | |
780 | -<a action="bypass -h npc_%objectId%_Quest RaidbossInfo">Raid Monster Information</a><br> | |
781 | +<a action="bypass -h npc_%objectId%_Quest RaidbossInfo">Boss Monster Information</a><br> | |
782 | +<a action="bypass -h npc_%objectId%_Quest GrandbossInfo">Grand Monster Information</a><br> | |
783 | <a action="bypass -h npc_%objectId%_Chat 1">Use Life Crystals</a><br> | |
784 | <a action="bypass -h npc_%objectId%_Quest">Quest</a> | |
785 | </body></html> | |
786 | diff --git a/aCis_datapack/data/html/script/feature/GrandbossInfo/dead.htm b/aCis_datapack/data/html/script/feature/GrandbossInfo/dead.htm | |
787 | new file mode 100644 | |
788 | index 0000000..66306e2 | |
789 | --- /dev/null | |
790 | +++ b/aCis_datapack/data/html/script/feature/GrandbossInfo/dead.htm | |
791 | @@ -0,0 +1,6 @@ | |
792 | +<html> | |
793 | +<title>Boss Manager</title> | |
794 | +<body> | |
795 | +Hello Traveler,<br> | |
796 | +Raidboss %name% is dead! Next respawn at: %refresh%<br> | |
797 | +</body></html> | |
798 | \ No newline at end of file | |
799 | diff --git a/aCis_datapack/data/html/script/feature/GrandbossInfo/info.htm b/aCis_datapack/data/html/script/feature/GrandbossInfo/info.htm | |
800 | new file mode 100644 | |
801 | index 0000000..2837e67 | |
802 | --- /dev/null | |
803 | +++ b/aCis_datapack/data/html/script/feature/GrandbossInfo/info.htm | |
804 | @@ -0,0 +1,12 @@ | |
805 | +<html> | |
806 | +<title>Boss Manager</title> | |
807 | +<body>Grandbosses Information:<br> | |
808 | +<a action="bypass -h Quest GrandbossInfo 29001">Queent Ant (lv40)</a><br> | |
809 | +<a action="bypass -h Quest GrandbossInfo 29006">Core (lv50)</a><br> | |
810 | +<a action="bypass -h Quest GrandbossInfo 29014">Orfen (lv50)</a><br> | |
811 | +<a action="bypass -h Quest GrandbossInfo 29022">Zaken (lv60)</a><br> | |
812 | +<a action="bypass -h Quest GrandbossInfo 29020">Baium (lv78)</a><br> | |
813 | +<a action="bypass -h Quest GrandbossInfo 29019">Antharas (lv79)</a><br> | |
814 | +<a action="bypass -h Quest GrandbossInfo 29047">Scarlet van Halisha (lv80)</a><br> | |
815 | +<a action="bypass -h Quest GrandbossInfo 29028">Valakas (lv85)</a><br> | |
816 | +</body></html> | |
817 | diff --git a/aCis_datapack/data/html/script/feature/GrandbossInfo/trigger.htm b/aCis_datapack/data/html/script/feature/GrandbossInfo/trigger.htm | |
818 | new file mode 100644 | |
819 | index 0000000..5fdcb84 | |
820 | --- /dev/null | |
821 | +++ b/aCis_datapack/data/html/script/feature/GrandbossInfo/trigger.htm | |
822 | @@ -0,0 +1,8 @@ | |
823 | +<html> | |
824 | +<title>Boss Manager</title> | |
825 | +<body> | |
826 | +Hello Traveler, you came at the right time!<br> | |
827 | +Someone has entered, Grandboss its about to spawn soon!<br> | |
828 | +Entry closes at %trigger% | |
829 | +<br>When the battle begin, you will be able to watch the players killing the Grandboss. | |
830 | +</body></html> | |
831 | \ No newline at end of file | |
832 | diff --git a/aCis_datapack/data/html/script/feature/GrandbossInfo/watch.htm b/aCis_datapack/data/html/script/feature/GrandbossInfo/watch.htm | |
833 | new file mode 100644 | |
834 | index 0000000..71c0af2 | |
835 | --- /dev/null | |
836 | +++ b/aCis_datapack/data/html/script/feature/GrandbossInfo/watch.htm | |
837 | @@ -0,0 +1,7 @@ | |
838 | +<html> | |
839 | +<title>Boss Manager</title> | |
840 | +<body> | |
841 | +Hello Traveler,<br> | |
842 | +The Grandboss is engaged in battle! You can now watch other players killing it.<br> | |
843 | +<a action="bypass -h Quest GrandbossInfo antharas">Watch the battle.</a><br> | |
844 | +</body></html> | |
845 | \ No newline at end of file | |
846 | diff --git a/aCis_datapack/data/html/script/feature/RaidbossInfo/dead.htm b/aCis_datapack/data/html/script/feature/RaidbossInfo/dead.htm | |
847 | new file mode 100644 | |
848 | index 0000000..66306e2 | |
849 | --- /dev/null | |
850 | +++ b/aCis_datapack/data/html/script/feature/RaidbossInfo/dead.htm | |
851 | @@ -0,0 +1,6 @@ | |
852 | +<html> | |
853 | +<title>Boss Manager</title> | |
854 | +<body> | |
855 | +Hello Traveler,<br> | |
856 | +Raidboss %name% is dead! Next respawn at: %refresh%<br> | |
857 | +</body></html> | |
858 | \ No newline at end of file | |
859 | diff --git a/aCis_datapack/data/html/script/feature/RaidbossInfo/info.htm b/aCis_datapack/data/html/script/feature/RaidbossInfo/info.htm | |
860 | index d923869..f785131 100644 | |
861 | --- a/aCis_datapack/data/html/script/feature/RaidbossInfo/info.htm | |
862 | +++ b/aCis_datapack/data/html/script/feature/RaidbossInfo/info.htm | |
863 | @@ -1,9 +1,11 @@ | |
864 | -<html><body>Raid Monster Information:<br> | |
865 | +<html> | |
866 | +<title>Boss Manager</title> | |
867 | +<body>Raid Monster Information:<br> | |
868 | <a action="bypass -h Quest RaidbossInfo level20.htm">Level 20 Raid Monsters</a><br> | |
869 | <a action="bypass -h Quest RaidbossInfo level30.htm">Level 30 Raid Monsters</a><br> | |
870 | <a action="bypass -h Quest RaidbossInfo level40.htm">Level 40 Raid Monsters</a><br> | |
871 | <a action="bypass -h Quest RaidbossInfo level50.htm">Level 50 Raid Monsters</a><br> | |
872 | <a action="bypass -h Quest RaidbossInfo level60.htm">Level 60 Raid Monsters</a><br> | |
873 | <a action="bypass -h Quest RaidbossInfo level70.htm">Level 70 Raid Monsters</a><br> | |
874 | -<a action="bypass -h Quest RaidbossInfo level80.htm">Level 80 Raid Monsters</a> | |
875 | +<a action="bypass -h Quest RaidbossInfo level80.htm">Level 80 Raid Monsters</a><br> | |
876 | </body></html> | |
877 | \ No newline at end of file | |
878 | diff --git a/aCis_datapack/data/xml/scripts.xml b/aCis_datapack/data/xml/scripts.xml | |
879 | index 3e38b21..a24ef1a 100644 | |
880 | --- a/aCis_datapack/data/xml/scripts.xml | |
881 | +++ b/aCis_datapack/data/xml/scripts.xml | |
882 | @@ -402,6 +402,7 @@ | |
883 | <script path="script.feature.Clan"/> | |
884 | <script path="script.feature.EchoCrystal"/> | |
885 | <script path="script.feature.FirstClassChange"/> | |
886 | + <script path="script.feature.GrandbossInfo"/> | |
887 | <script path="script.feature.HeroCirclet"/> | |
888 | <script path="script.feature.HeroWeapon"/> | |
889 | <script path="script.feature.KetraOrcSupport"/> | |
890 |