View difference between Paste ID: krrVkzdA and guWdv29H
SHOW: | | - or go back to the newest paste.
1
### Eclipse Workspace Patch 1.0
2
#P aCis_gameserver
3
Index: java/net/sf/l2j/gameserver/instancemanager/GrandBossManager.java
4
===================================================================
5
--- java/net/sf/l2j/gameserver/instancemanager/GrandBossManager.java	(revision 4)
6
+++ java/net/sf/l2j/gameserver/instancemanager/GrandBossManager.java	(working copy)
7
@@ -9,12 +9,10 @@
8
 import java.util.logging.Level;
9
 import java.util.logging.Logger;
10
 
11
+import net.sf.l2j.Config;
12
 import net.sf.l2j.L2DatabaseFactory;
13
 import net.sf.l2j.gameserver.data.NpcTable;
14
 import net.sf.l2j.gameserver.model.actor.instance.GrandBoss;
15
 import net.sf.l2j.gameserver.templates.StatsSet;
16
+import net.sf.l2j.gameserver.util.Broadcast;
17
 
18
 /**
19
  * This class handles the status of all Grand Bosses, and manages L2BossZone zones.
20
@@ -82,38 +80,6 @@
21
 		_bossStatus.put(bossId, status);
22
 		_log.info("GrandBossManager: Updated " + NpcTable.getInstance().getTemplate(bossId).getName() + " (id: " + bossId + ") status to " + status);
23
 		updateDb(bossId, true);
24
+		if (Config.GRAND_BOSS_ANNOUNCE)
25
+		{
26
+			switch (bossId)
27
+			{
28
+				case 29001:
29
+				case 29006:
30
+				case 29014:
31
+					if (status == 0)
32
+						Broadcast.announceToOnlinePlayers("Grandboss " + NpcTable.getInstance().getTemplate(bossId).getName() + " is spawned in the world!", true);
33
+					else if (status == 1)
34
+						Broadcast.announceToOnlinePlayers("Grandboss " + NpcTable.getInstance().getTemplate(bossId).getName() + " has been killed. Type .epic for details!", true);
35
+					break;
36
+				case 29020:
37
+					if (status == 0)
38
+						Broadcast.announceToOnlinePlayers("Grandboss " + NpcTable.getInstance().getTemplate(bossId).getName() + " is spawned in the world!", true);
39
+					else if (status == 1)
40
+						Broadcast.announceToOnlinePlayers("Grandboss " + NpcTable.getInstance().getTemplate(bossId).getName() + " is awake and fighting.", true);
41
+					else if (status == 2)
42
+						Broadcast.announceToOnlinePlayers("Grandboss " + NpcTable.getInstance().getTemplate(bossId).getName() + " has been killed. Type .epic for details!", true);
43
+					break;
44
+				case 29028:
45
+				case 29019:
46
+				case 29047:
47
+					if (status == 0)
48
+						Broadcast.announceToOnlinePlayers("Grandboss " + NpcTable.getInstance().getTemplate(bossId).getName() + " is spawned in the world!", true);
49
+					if (status == 2)
50
+						Broadcast.announceToOnlinePlayers("Grandboss " + NpcTable.getInstance().getTemplate(bossId).getName() + " is engaged in battle!", true);
51
+					else if (status == 3)
52
+						Broadcast.announceToOnlinePlayers("Grandboss " + NpcTable.getInstance().getTemplate(bossId).getName() + " has been killed. Type .epic for details!", true);
53
+					break;
54
+			}
55
+		}
56
 	}
57
 	
58
 	/**
59
Index: config/npcs.properties
60
===================================================================
61
--- config/npcs.properties	(revision 4)
62
+++ config/npcs.properties	(working copy)
63
@@ -245,6 +245,16 @@
64
 # Random interval. Value is hour.
65
 ZakenRandomSpawn = 20
66
 
67
+# Announce Grandboss status.
68
+# Ex: If status for Antharas/Valakas/Frintezza change to 2 player get announce:
69
+# Grandbossname is engaged in battle.
70
+# If status changed to 3: Grandbossname has been killed. Type .epic for details!
71
+# For Baium if status change to 1 - Baium is awake and fighting.
72
+# All Grandboses respawned - Grandbossname is spawned in the world!
73
+AnnounceGrandBossStatus = True
74
+# Enlabe .epic command
75
+EpicInfoCmd = True
76
+
77
 #=============================================================
78
 #                            IA
79
 #=============================================================
80
Index: java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
81
===================================================================
82
--- java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java	(revision 4)
83
+++ java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java	(working copy)
84
@@ -20,6 +20,7 @@
85
 import net.sf.l2j.gameserver.handler.voicedcommandhandlers.AioMenu;
86
 import net.sf.l2j.gameserver.handler.voicedcommandhandlers.BankingCommand;
87
 import net.sf.l2j.gameserver.handler.voicedcommandhandlers.EventJoin;
88
+import net.sf.l2j.gameserver.handler.voicedcommandhandlers.GrandBossInfo;
89
 import net.sf.l2j.gameserver.handler.voicedcommandhandlers.GrandBossStatus;
90
 import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Menu;
91
 import net.sf.l2j.gameserver.handler.voicedcommandhandlers.OfflineShop;
92
@@ -52,6 +53,7 @@
93
 		registerHandler(new Repair());
94
 		registerHandler(new AioMenu());
95
 		registerHandler(new OfflineShop());
96
+		registerHandler(new GrandBossInfo());
97
 	}
98
 	
99
 	public void registerHandler(IVoicedCommandHandler handler)
100
Index: java/net/sf/l2j/Config.java
101
===================================================================
102
--- java/net/sf/l2j/Config.java	(revision 4)
103
+++ java/net/sf/l2j/Config.java	(working copy)
104
@@ -665,6 +665,9 @@
105
 	public static int SPAWN_INTERVAL_ZAKEN;
106
 	public static int RANDOM_SPAWN_TIME_ZAKEN;
107
 	
108
+	public static boolean GRANDBOSSES_ANNOUNCE;
109
+	public static boolean INFO_EPIC;
110
+	
111
 	/** AI */
112
 	public static boolean GUARD_ATTACK_AGGRO_MOB;
113
 	public static int MAX_DRIFT_RANGE;
114
@@ -1988,6 +2011,9 @@
115
 		SPAWN_INTERVAL_ZAKEN = npcs.getProperty("ZakenSpawnInterval", 60);
116
 		RANDOM_SPAWN_TIME_ZAKEN = npcs.getProperty("ZakenRandomSpawn", 20);
117
 		
118
+		GRAND_BOSS_ANNOUNCE = npcs.getProperty("AnnounceGrandBossStatus", true);
119
+		INFO_EPIC = npcs.getProperty("EpicInfoCmd", true);
120
+		
121
 		GUARD_ATTACK_AGGRO_MOB = npcs.getProperty("GuardAttackAggroMob", false);
122
 		MAX_DRIFT_RANGE = npcs.getProperty("MaxDriftRange", 300);
123
 		MIN_NPC_ANIMATION = npcs.getProperty("MinNPCAnimation", 20);
124
 		
125
Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/GrandBossInfo.java
126
===================================================================
127
--- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/GrandBossInfo.java	(nonexistent)
128
+++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/GrandBossInfo.java	(working copy)
129
@@ -0,0 +1,168 @@
130
+/*
131
+ * This program is free software: you can redistribute it and/or modify it under
132
+ * the terms of the GNU General Public License as published by the Free Software
133
+ * Foundation, either version 3 of the License, or (at your option) any later
134
+ * version.
135
+ * 
136
+ * This program is distributed in the hope that it will be useful, but WITHOUT
137
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
138
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
139
+ * details.
140
+ * 
141
+ * You should have received a copy of the GNU General Public License along with
142
+ * this program. If not, see <http://www.gnu.org/licenses/>.
143
+ */
144
+package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
145
+
146
+import java.text.SimpleDateFormat;
147
+
148
+import net.sf.l2j.Config;
149
+import net.sf.l2j.gameserver.data.NpcTable;
150
+import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
151
+import net.sf.l2j.gameserver.instancemanager.GrandBossManager;
152
+import net.sf.l2j.gameserver.instancemanager.RaidBossSpawnManager;
153
+import net.sf.l2j.gameserver.model.actor.instance.Player;
154
+import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
155
+import net.sf.l2j.gameserver.templates.StatsSet;
156
+
157
+/**
158
+ * @author Baggos
159
+ */
160
+public class GrandBossInfo implements IVoicedCommandHandler
161
+{
162
+	
163
+	private static final String[] _voicedCommands =
164
+	{
165
+		"epic"
166
+	};
167
+	
168
+    private static final int[] raidbosses = new int[]
169
+    {
170-
+		51006 // Zaken
170+
+		29022 // Zaken
171
+    };
172
+	
173
+    private static final int[] GRAND = new int[]
174
+	{
175
+		29001, // Queen Ant
176
+		29006, // Core
177
+		29014 // Orfen
178
+	};
179
+	
180
+    private static final int[] GRAND2 = new int[]
181
+	{
182
+		29019, // Antharas
183
+		29028, // Valakas
184
+		29047 // Halisha
185
+	};
186
+	
187
+	private static final int BAIUM = 29020;
188
+	
189
+	@Override
190
+	public boolean useVoicedCommand(String command, Player activeChar, String params)
191
+	{
192
+		if (command.equals("epic") && Config.EPIC_INFO)
193
+		{
194
+			final StringBuilder sb = new StringBuilder();
195
+			NpcHtmlMessage html = new NpcHtmlMessage(0);
196
+			for (int raidboss : raidbosses)
197
+			{
198
+				String name = NpcTable.getInstance().getTemplate(raidboss).getName();
199
+				long delay = RaidBossSpawnManager.getInstance().getRespawntime(raidboss);
200
+				sb.append("<html><head><title>Epic Boss Manager</title></head><body>");
201
+				sb.append("<center>");
202
+				sb.append("<img src=\"L2UI.SquareGray\" width=300 height=1><br>");
203
+				
204
+				if (delay <= System.currentTimeMillis())
205
+				{
206
+					sb.append("" + name + ":&nbsp;<font color=\"4d94ff\">Is Alive!</font><br1>");
207
+				}
208
+				else
209
+				{
210
+					sb.append("" + name + ":&nbsp;<br1>");
211
+					sb.append("&nbsp;<font color=\"FFFFFF\">" + " " + "Respawn at:</font>" + "" + "<font color=\"FF9900\"> " + new SimpleDateFormat("dd-MM-yyyy HH:mm").format(delay) + "</font><br>");
212
+				}
213
+			}
214
+			
215
+			// Case of Queen/Core/Orfen
216
+			for (int grandboss : GRAND)
217
+			{
218
+				StatsSet info = GrandBossManager.getInstance().getStatsSet(grandboss);
219
+				long temp = info.getLong("respawn_time");
220
+				String Grand = NpcTable.getInstance().getTemplate(grandboss).getName();
221
+				
222
+				sb.append("<center>");
223
+				sb.append("<img src=\"L2UI.SquareGray\" width=300 height=1><br>");
224
+				if (temp <= System.currentTimeMillis())
225
+				{
226
+					sb.append("" + Grand + ":&nbsp;<font color=\"4d94ff\">Is Alive!</font><br1>");
227
+				}
228
+				else
229
+				{
230
+					sb.append("" + Grand + ":&nbsp;<br1>");
231
+					sb.append("&nbsp;<font color=\"FFFFFF\">" + " " + "Respawn at:</font>" + "" + "<font color=\"FF9900\"> " + new SimpleDateFormat("dd-MM-yyyy HH:mm").format(temp) + "</font><br>");
232
+				}
233
+			}
234
+			
235
+			// Case of Baium
236
+			StatsSet infobaium = GrandBossManager.getInstance().getStatsSet(BAIUM);
237
+			long tempbaium = infobaium.getLong("respawn_time");
238
+			String Baium = NpcTable.getInstance().getTemplate(BAIUM).getName();
239
+			int BaiumStatus = GrandBossManager.getInstance().getBossStatus(BAIUM);
240
+			
241
+			sb.append("<center>");
242
+			sb.append("<img src=\"L2UI.SquareGray\" width=300 height=1><br>");
243
+			if (tempbaium <= System.currentTimeMillis() && BaiumStatus == 0)
244
+			{
245
+				sb.append("" + Baium + ":&nbsp;<font color=\"ff4d4d\">Is Asleep!</font><br1>");
246
+			}
247
+			else if (BaiumStatus == 1)
248
+			{
249
+				sb.append("" + Baium + ":&nbsp;<font color=\"ff4d4d\">Is Awake and fighting. Entry is locked.</font><br1>");
250
+			}
251
+			else
252
+			{
253
+				sb.append("" + Baium + ":&nbsp;<br1>");
254
+				sb.append("&nbsp;<font color=\"FFFFFF\">" + " " + "Respawn at:</font>" + "" + "<font color=\"FF9900\"> " + new SimpleDateFormat("dd-MM-yyyy HH:mm").format(tempbaium) + "</font><br>");
255
+			}
256
+			
257
+			// Case of Antharas/Valakas/Halisha
258
+			for (int grandboss : GRAND2)
259
+			{
260
+				StatsSet infogrand = GrandBossManager.getInstance().getStatsSet(grandboss);
261
+				long tempgrand = infogrand.getLong("respawn_time");
262
+				String Grand = NpcTable.getInstance().getTemplate(grandboss).getName();
263
+				int BossStatus = GrandBossManager.getInstance().getBossStatus(grandboss);
264
+				
265
+				sb.append("<center>");
266
+				sb.append("<img src=\"L2UI.SquareGray\" width=300 height=1><br>");
267
+				if (tempgrand <= System.currentTimeMillis() && BossStatus == 0)
268
+				{
269
+					sb.append("" + Grand + ":&nbsp;<font color=\"4d94ff\">Is spawned. Entry is unlocked.</font><br1>");
270
+				}
271
+				else if (BossStatus == 1)
272
+				{
273
+					sb.append("" + Grand + ":&nbsp;<font color=\"ff4d4d\">Someone has entered. Hurry!</font><br1>");
274
+				}
275
+				else if (BossStatus == 2)
276
+				{
277
+					sb.append("" + Grand + ":&nbsp;<font color=\"ff4d4d\">Is engaged in battle. Entry is locked.</font><br1>");
278
+				}
279
+				else
280
+				{
281
+					sb.append("" + Grand + ":&nbsp;<br1>");
282
+					sb.append("&nbsp;<font color=\"FFFFFF\">" + " " + "Respawn at:</font>" + "" + "<font color=\"FF9900\"> " + new SimpleDateFormat("dd-MM-yyyy HH:mm").format(tempgrand) + "</font><br>");
283
+				}
284
+			}
285
+			html.setHtml(sb.toString());
286
+			html.replace("%bosslist%", sb.toString());
287
+			activeChar.sendPacket(html);
288
+		}
289
+		return true;
290
+	}
291
+	
292
+	@Override
293
+	public String[] getVoicedCommandList()
294
+	{
295
+		return _voicedCommands;
296
+	}
297
+}