View difference between Paste ID: Te6tjnVp and fXKQgkg6
SHOW: | | - or go back to the newest paste.
1
=================================================
2
Index: gameserver.taskmanager.PvpFlagTaskManager.JAVA
3
=================================================
4
5
+package l2j.dev.gameserver.taskmanager;
6
+
7
+import java.util.Map;
8
+import java.util.concurrent.ConcurrentHashMap;
9
+
10
+import l2j.dev.commons.concurrent.ThreadPool;
11
+import l2j.dev.gameserver.model.actor.instance.PlayerInstance;
12
+import l2j.dev.gameserver.model.zone.ZoneId;
13
+
14
+/**
15
+ * @author Juvenil Walker
16
+ */
17
+public class PvpFlagTaskManager implements Runnable
18
+{
19
+	private final Map<PlayerInstance, Long> _players = new ConcurrentHashMap<>();
20
+	
21
+	protected PvpFlagTaskManager()
22
+	{
23
+		// Run task each second.
24
+		ThreadPool.scheduleAtFixedRate(this, 1000, 1000);
25
+	}
26
+	
27
+	public final void add(PlayerInstance player, long time)
28
+	{
29
+		_players.put(player, System.currentTimeMillis() + time);
30
+	}
31
+	
32
+	public final void remove(PlayerInstance player)
33
+	{
34
+		_players.remove(player);
35
+	}
36
+	
37
+	@Override
38
+	public final void run()
39
+	{
40
+		// List is empty, skip.
41
+		if (_players.isEmpty())
42
+		{
43
+			return;
44
+		}
45
+		
46
+		// Get current time.
47
+		final long currentTime = System.currentTimeMillis();
48
+		
49
+		// Loop all players.
50
+		for (Map.Entry<PlayerInstance, Long> entry : _players.entrySet())
51
+		{
52
+			// Get time left and check.
53
+			final PlayerInstance player = entry.getKey();
54
+			
55
+			if (player.isInsideZone(ZoneId.CHAOT))
56
+			{
57
+				_players.remove(player);
58
+				continue;
59
+			}
60
+			
61
+			final long timeLeft = entry.getValue();
62
+			
63
+			// Time is running out, clear PvP flag and remove from list.
64
+			if (currentTime > timeLeft)
65
+			{
66
+				player.updatePvPFlag(0);
67
+				_players.remove(player);
68
+			}
69
+			// Time almost runned out, update to blinking PvP flag.
70
+			else if (currentTime > (timeLeft - 5000))
71
+			{
72
+				player.updatePvPFlag(2);
73
+				// Time didn't run out, keep PvP flag.
74
+			}
75
+			else
76
+			{
77
+				player.updatePvPFlag(1);
78
+			}
79
+		}
80
+	}
81
+	
82
+	public static final PvpFlagTaskManager getInstance()
83
+	{
84
+		return SingletonHolder._instance;
85
+	}
86
+	
87
+	private static class SingletonHolder
88
+	{
89
+		protected static final PvpFlagTaskManager _instance = new PvpFlagTaskManager();
90
+	}
91
+}
92
==============================================================
93
Index: l2j.dev.gameserver.model.zone.ZoneId.JAVA
94
==============================================================
95
	SCRIPT,
96
	SIEGE,
97
	TOWN,
98
	SWAMP,
99
	WATER,
100
+	CHAOT;
101
102
103
104
==============================================================
105
Index: gameserver.model.zone.type.ChaoticZone.JAVA
106
==============================================================
107
108
+package l2j.dev.gameserver.model.zone.type;
109
+
110
+import l2j.dev.Config;
111
+import l2j.dev.gameserver.datatables.SkillTable;
112
+import l2j.dev.gameserver.enums.TeleportWhereType;
113
+import l2j.dev.gameserver.model.Skill;
114
+import l2j.dev.gameserver.model.actor.Creature;
115
+import l2j.dev.gameserver.model.actor.instance.PlayerInstance;
116
+import l2j.dev.gameserver.model.zone.ZoneId;
117
+import l2j.dev.gameserver.model.zone.ZoneRespawn;
118
+import l2j.dev.gameserver.network.SystemMessageId;
119
+import l2j.dev.gameserver.network.serverpackets.ExShowScreenMessage;
120
+import l2j.dev.gameserver.taskmanager.PvpFlagTaskManager;
121
+
122
+/**
123
+ * @author Juvenil Walker
124
+ */
125
+public class ChaoticZone extends ZoneRespawn
126
+{
127
+	private String _ChaoticName;
128
+	private boolean _ChaoticNameBollean;
129
+	private boolean _ChaoticFlag;
130
+	private boolean _ChaoticNobles;
131
+	private boolean _Chaotic_HEAL_FUll_HP_CP_MP;
132
+	private int _TimeDelay;
133
+	
134
+	public ChaoticZone(int id)
135
+	{
136
+		super(id);
137
+	}
138
+	
139
+	@Override
140
+	public void setParameter(String name, String value)
141
+	{
142
+		if (name.equals("name"))
143
+		{
144
+			_ChaoticName = value;
145
+		}
146
+		else if (name.equals("ChaoticFlag"))
147
+		{
148
+			_ChaoticFlag = Boolean.parseBoolean(value);
149
+		}
150
+		else if (name.equals("ChaoticNobles"))
151
+		{
152
+			_ChaoticNobles = Boolean.parseBoolean(value);
153
+		}
154
+		else if (name.equals("Chaotic_HEAL_FUll_HP_CP_MP"))
155
+		{
156
+			_Chaotic_HEAL_FUll_HP_CP_MP = Boolean.parseBoolean(value);
157
+		}
158
+		else if (name.equals("Chaotic_HEAL_FUll_HP_CP_MP"))
159
+		{
160
+			_Chaotic_HEAL_FUll_HP_CP_MP = Boolean.parseBoolean(value);
161
+		}
162
+		else if (name.equals("ChaoticMensagem"))
163
+		{
164
+			_ChaoticNameBollean = Boolean.parseBoolean(value);
165
+		}
166
+		else if (name.equals("MensagenDelay"))
167
+		{
168
+			_TimeDelay = Integer.parseInt(value);
169
+		}
170
+		else
171
+		{
172
+			super.setParameter(name, value);
173
+		}
174
+	}
175
+	
176
+	@Override
177
+	protected void onEnter(Creature creature)
178
+	{
179
+		creature.setInsideZone(ZoneId.CHAOT, true);
180
+		creature.setInsideZone(ZoneId.NO_SUMMON_FRIEND, true);
181
+		
182
+		if (creature instanceof PlayerInstance)
183
+		{
184
+			if (_ChaoticFlag)
185
+			{
186
+				((PlayerInstance) creature).sendPacket(SystemMessageId.YOU_HAVE_ENTERED_A_COMBAT_ZONE);
187
+				
188
+				creature.updatePvPFlag(1);
189
+			}
190
+			if (_ChaoticNobles)
191
+			{
192
+				Skill noblesse = SkillTable.getInstance().getInfo(1323, 1);
193
+				noblesse.getEffects(creature, creature);
194
+			}
195
+			
196
+			if (!_Chaotic_HEAL_FUll_HP_CP_MP)
197
+			{
198
+				creature.setCurrentCp(creature.getMaxCp());
199
+				creature.setCurrentHp(creature.getMaxHp());
200
+				creature.setCurrentMp(creature.getMaxMp());
201
+			}
202
+			if (_ChaoticNameBollean)
203
+			{
204
+				creature.sendPacket(new ExShowScreenMessage(" " + getChaoticName() + "", _TimeDelay));
205
+			}
206
+			
207
+		}
208
+		
209
+	}
210
+	
211
+	@Override
212
+	protected void onExit(Creature creature)
213
+	{
214
+		creature.setInsideZone(ZoneId.CHAOT, false);
215
+		creature.setInsideZone(ZoneId.NO_SUMMON_FRIEND, false);
216
+		
217
+		if (creature instanceof PlayerInstance)
218
+		{
219
+			if (_ChaoticFlag)
220
+			{
221
+				final PlayerInstance player = (PlayerInstance) creature;
222
+				PvpFlagTaskManager.getInstance().add(player, Config.PVP_NORMAL_TIME);
223
+				creature.setPvpFlagLasts(System.currentTimeMillis() + Config.PVP_NORMAL_TIME);
224
+				((PlayerInstance) creature).sendPacket(SystemMessageId.YOU_HAVE_LEFT_A_COMBAT_ZONE);
225
+			}
226
+			if (_ChaoticNameBollean)
227
+			{
228
+				creature.sendPacket(new ExShowScreenMessage(" Left " + getChaoticName() + "", _TimeDelay));
229
+			}
230
+		}
231
+	}
232
+	
233
+	@Override
234
+	protected void onDieInside(Creature creature)
235
+	{
236
+	}
237
+	
238
+	@Override
239
+	protected void onReviveInside(Creature creature)
240
+	{
241
+		if (_Chaotic_HEAL_FUll_HP_CP_MP)
242
+		{
243
+			creature.setCurrentCp(creature.getMaxCp());
244
+			creature.setCurrentHp(creature.getMaxHp());
245
+			creature.setCurrentMp(creature.getMaxMp());
246
+		}
247
+		if (_ChaoticNobles)
248
+		{
249
+			Skill noblesse = SkillTable.getInstance().getInfo(1323, 1);
250
+			noblesse.getEffects(creature, creature);
251
+		}
252
+	}
253
+	
254
+	public void oustAllPlayers()
255
+	{
256
+		for (Creature creature : getCharactersInside())
257
+		{
258
+			if (creature == null)
259
+			{
260
+				continue;
261
+			}
262
+			
263
+			if (creature instanceof PlayerInstance)
264
+			{
265
+				final PlayerInstance player = (PlayerInstance) creature;
266
+				if (player.isOnline())
267
+				{
268
+					player.teleToLocation(TeleportWhereType.TOWN);
269
+				}
270
+			}
271
+		}
272
+	}
273
+	
274
+	public String getChaoticName()
275
+	{
276
+		return _ChaoticName;
277
+	}
278
+}
279
280
========================================================
281
Index: gameserver.datatables.xml.ZoneData.JAVA
282
========================================================
283
284
+import l2j.dev.gameserver.model.zone.type.ChaoticZone;
285
286
	case "ArenaZone":
287
	{
288
	temp = new ArenaZone(zoneId);
289
	break;
290
	}
291
	
292
+	case "ChaoticZone":
293
+	{
294
+		temp = new ChaoticZone(zoneId);
295
+		break;
296
+	}
297
298
========================================================
299
Index: l2j.dev.gameserver.datatables.xml.MapRegionData.JAVA
300
========================================================
301
302
303
	// Check if player is in arena.
304
	final ArenaZone arena = ZoneData.getInstance().getZone(player, ArenaZone.class);
305
	if (arena != null)
306
	{
307
	return arena.getSpawnLoc();
308
	}
309
		
310
+	// Check if player is in arena.
311
+		final ChaoticZone Flag = ZoneData.getInstance().getZone(player, ChaoticZone.class);
312
+		if (Flag != null)
313
+		{
314
+			return Flag.getSpawnLoc();
315
+		}
316
317
318
========================================================
319
Index: GAME/DATA/ZONES/ChaoticZone.XML
320
========================================================
321
322
+<?xml version="1.0" encoding="utf-8"?>
323
+<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/zones.xsd">
324
+
325
+	<!-- Primeval Isle -->
326
+    <zone type="ChaoticZone" shape="NPoly" minZ="-4290" maxZ="-1290">
327
+	<!-- Name Chaotic ExShowScreenMessage  -->
328
+	<stat name="name" val="Primavel Isle" />
329
+	<!-- Chaotic Enable Update Flag  -->
330
+	<stat name="ChaoticFlag" val="True" />
331
+	<!-- Chaotic Enable Skill Nobles  -->
332
+	<stat name="ChaoticNobles" val="True" />
333
+	<!-- Chaotic Heal Full HP/CP/MP  -->
334
+	<stat name="Chaotic_HEAL_FUll_HP_CP_MP" val="True" />
335
+	<!-- Chaotic Enable Mensagem onEnter onExit  -->
336
+	<stat name="ChaoticMensagem" val="True" />
337
+	<!-- Chaotic Delay Mensagen Time  -->
338
+	<stat name="MensagenDelay" val="4000" />
339
+	<node X="10408" Y="-27395" />
340
+	<node X="12065" Y="-25334" />
341
+	<node X="15834" Y="-19850" />
342
+	<node X="8791" Y="-10223" />
343
+	<node X="3487" Y="-12137" />
344
+	<node X="4110" Y="-34245" />
345
+	<spawn X="10280" Y="-23832" Z="-3664" />
346
+	<spawn X="9496" Y="-21928" Z="-3680" />
347
+    </zone>
348
+	
349
+	<!-- Pagan Temple Pvp -->
350
+	<zone type="ChaoticZone" shape="Cylinder" minZ="-11000" maxZ="-8000" rad="19000">
351
+	<!-- Name Chaotic ExShowScreenMessage  -->
352
+	<stat name="name" val="Pagan Temple" />
353
+	<!-- Chaotic Enable Update Flag  -->
354
+	<stat name="ChaoticFlag" val="True" />
355
+	<!-- Chaotic Enable Skill Nobles  -->
356
+	<stat name="ChaoticNobles" val="True" />
357
+	<!-- Chaotic Heal Full HP/CP/MP  -->
358
+	<stat name="Chaotic_HEAL_FUll_HP_CP_MP" val="True" />
359
+	<!-- Chaotic Enable Mensagem onEnter onExit  -->
360
+	<stat name="ChaoticMensagem" val="True" />
361
+	<!-- Chaotic Delay Mensagen Time  -->
362
+	<stat name="MensagenDelay" val="4000" />
363
+	<node X="-16370" Y="-40782" />
364
+	<spawn X="-17592" Y="-50776" Z="-11008" />
365
+	<spawn X="-15048" Y="-50712" Z="-11008" />
366
+	<spawn X="-17592" Y="-50776" Z="-11008" />
367
+	<spawn X="-15048" Y="-50712" Z="-11008" />
368
+	</zone>
369
+	
370
+	<!-- MONASTERY SPWAN FLAG -->
371
+	<zone type="ChaoticZone" shape="Cuboid" minZ="-3296" maxZ="-3392">
372
+	<!-- Name Chaotic ExShowScreenMessage  -->
373
+	<stat name="name" val="Monastery" />
374
+	<!-- Chaotic Enable Update Flag  -->
375
+	<stat name="ChaoticFlag" val="True" />
376
+	<!-- Chaotic Enable Skill Nobles  -->
377
+	<stat name="ChaoticNobles" val="True" />
378
+	<!-- Chaotic Heal Full HP/CP/MP  -->
379
+	<stat name="Chaotic_HEAL_FUll_HP_CP_MP" val="True" />
380
+	<!-- Chaotic Enable Mensagem onEnter onExit  -->
381
+	<stat name="ChaoticMensagem" val="True" />	
382
+	<!-- Chaotic Delay Mensagen Time  -->
383
+	<stat name="MensagenDelay" val="4000" />
384
+	
385
+	<node X="119665" Y="-77324" />
386
+	<node X="-118416" Y="-75408" />
387
+	<spawn X="148560" Y="-55904" Z="-2779" />
388
+    </zone>
389
+	
390
+	<!-- Ketra -->
391
+	<zone type="ChaoticZone" shape="Cuboid" minZ="-10000" maxZ="10000">
392
+	<!-- Name Chaotic ExShowScreenMessage  -->
393
+	<stat name="name" val="Ketra Orc" />
394
+	<!-- Chaotic Enable Update Flag  -->
395
+	<stat name="ChaoticFlag" val="True" />
396
+	<!-- Chaotic Enable Skill Nobles  -->
397
+	<stat name="ChaoticNobles" val="True" />
398
+	<!-- Chaotic Heal Full HP/CP/MP  -->
399
+	<stat name="Chaotic_HEAL_FUll_HP_CP_MP" val="True" />
400
+	<!-- Chaotic Enable Mensagem onEnter onExit  -->
401
+	<stat name="ChaoticMensagem" val="True" />
402
+	<!-- Chaotic Delay Mensagen Time  -->
403
+	<stat name="MensagenDelay" val="4000" />
404
+	
405
+	<node X="137513" Y="-59681" />
406
+	<node X="100011" Y="-90708" />
407
+	<spawn X="131144" Y="-72360" Z="-3518" />
408
+	<spawn X="130968" Y="-71992" Z="-3489" />
409
+	<spawn X="130552" Y="-71768" Z="-3464" />
410
+	<spawn X="130088" Y="-71896" Z="-3477" />
411
+	<spawn X="129592" Y="-72056" Z="-3464" />
412
+	<spawn X="129128" Y="-72344" Z="-3487" />
413
+	<spawn X="129064" Y="-72856" Z="-3464" />
414
+	<spawn X="129560" Y="-72856" Z="-3452" />
415
+	<spawn X="129912" Y="-72664" Z="-3471" />
416
+	<spawn X="130392" Y="-72408" Z="-3508" />
417
+	<spawn X="130728" Y="-72584" Z="-3497" />
418
+	<spawn X="130712" Y="-72184" Z="-3510" />
419
+	<spawn X="130312" Y="-72120" Z="-3502" />
420
+	<spawn X="129872" Y="-72292" Z="-3503" />
421
+	<spawn X="129402" Y="-72557" Z="-3497" />
422
+	<spawn X="128824" Y="-73272" Z="-3438" />
423
+	<spawn X="128392" Y="-73016" Z="-3464" />
424
+	<spawn X="128248" Y="-73384" Z="-3405" />
425
+	<spawn X="127912" Y="-73016" Z="-3453" />
426
+	<spawn X="127688" Y="-73416" Z="-3418" />
427
+	<spawn X="127400" Y="-73176" Z="-3384" />
428
+	<spawn X="127016" Y="-73608" Z="-3384" />
429
+	<spawn X="126904" Y="-72984" Z="-3272" />
430
+	<spawn X="126488" Y="-72552" Z="-3208" />
431
+	<spawn X="126088" Y="-72264" Z="-3161" />
432
+	<spawn X="126024" Y="-71880" Z="-3105" />
433
+	<spawn X="127080" Y="-74184" Z="-3265" />
434
+	<spawn X="127048" Y="-74728" Z="-3109" />
435
+	<spawn X="126632" Y="-75080" Z="-2997" />
436
+	<spawn X="126584" Y="-75384" Z="-2887" />
437
+	<spawn X="126296" Y="-75544" Z="-2857" />
438
+	<spawn X="126120" Y="-75688" Z="-2852" />
439
+	<spawn X="127144" Y="-73304" Z="-3368" />
440
+	<spawn X="128696" Y="-73048" Z="-3446" />
441
+	<spawn X="128088" Y="-71944" Z="-2824" />
442
+	<spawn X="126920" Y="-71736" Z="-2816" />
443
+	<spawn X="128168" Y="-71880" Z="-2848" />
444
+	<spawn X="129016" Y="-71080" Z="-2824" />
445
+	<spawn X="130440" Y="-73432" Z="-2904" />
446
+	<spawn X="127928" Y="-74488" Z="-2608" />
447
+	</zone>		
448
+	
449
+	<!-- Imperial Tomb -->
450
+	<zone type="ChaoticZone" shape="Cuboid" minZ="-10000" maxZ="10000">
451
+	<!-- Name Chaotic ExShowScreenMessage  -->
452
+	<stat name="name" val="Imperial Tomb" />
453
+	<!-- Chaotic Enable Update Flag  -->
454
+	<stat name="ChaoticFlag" val="True" />
455
+	<!-- Chaotic Enable Skill Nobles  -->
456
+	<stat name="ChaoticNobles" val="True" />
457
+	<!-- Chaotic Heal Full HP/CP/MP  -->
458
+	<stat name="Chaotic_HEAL_FUll_HP_CP_MP" val="True" />
459
+	<!-- Chaotic Enable Mensagem onEnter onExit  -->
460
+	<stat name="ChaoticMensagem" val="True" />
461
+	<!-- Chaotic Delay Mensagen Time  -->
462
+	<stat name="MensagenDelay" val="4000" />
463
+	
464
+	<node X="197805" Y="-67585" />
465
+	<node X="173512" Y="-91135" />
466
+	<spawn X="180408" Y="-78696" Z="-2728" />
467
+	<spawn X="182440" Y="-78696" Z="-2728" />
468
+	<spawn X="181384" Y="-79688" Z="-2728" />
469
+	<spawn X="181416" Y="-77576" Z="-2728" />
470
+	<spawn X="181288" Y="-78584" Z="-2728" />
471
+	<spawn X="181336" Y="-78776" Z="-2728" />
472
+	<spawn X="181512" Y="-78696" Z="-2728" />
473
+	<spawn X="181480" Y="-78520" Z="-2727" />
474
+	<spawn X="181992" Y="-78680" Z="-2728" />
475
+	<spawn X="181368" Y="-79256" Z="-2728" />
476
+	<spawn X="180904" Y="-78696" Z="-2728" />
477
+	<spawn X="180200" Y="-78168" Z="-2731" />
478
+	<spawn X="180248" Y="-79240" Z="-2729" />
479
+	<spawn X="180872" Y="-79944" Z="-2731" />
480
+	<spawn X="181944" Y="-79960" Z="-2731" />
481
+	<spawn X="182664" Y="-79208" Z="-2728" />
482
+	<spawn X="182648" Y="-78104" Z="-2728" />
483
+	<spawn X="182088" Y="-77448" Z="-2731" />
484
+	<spawn X="180856" Y="-77448" Z="-2731" />
485
+	<spawn X="181384" Y="-77960" Z="-2728" />		
486
+	</zone>	
487
+</list>