View difference between Paste ID: 7zvv3rkP and S4PmWEvG
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/model/actor/template/NpcTemplate.java
4
===================================================================
5
--- java/net/sf/l2j/gameserver/model/actor/template/NpcTemplate.java	(revision 20)
6
+++ java/net/sf/l2j/gameserver/model/actor/template/NpcTemplate.java	(working copy)
7
@@ -34,6 +34,7 @@
8
 	private boolean _usingServerSideName;
9
 	private final String _title;
10
 	private boolean _usingServerSideTitle;
11
+	private final boolean _cantBeChampionMonster;
12
 	private final byte _level;
13
 	private final int _exp;
14
 	private final int _sp;
15
@@ -81,6 +82,7 @@
16
 		_usingServerSideName = set.getBool("usingServerSideName", false);
17
 		_title = set.getString("title", "");
18
 		_usingServerSideTitle = set.getBool("usingServerSideTitle", false);
19
+		_cantBeChampionMonster = _title.equalsIgnoreCase("Quest Monster") || isType("Chest");
20
 		_level = set.getByte("level", (byte) 1);
21
 		_exp = set.getInteger("exp", 0);
22
 		_sp = set.getInteger("sp", 0);
23
@@ -195,6 +197,11 @@
24
 		return _usingServerSideTitle;
25
 	}
26
 	
27
+	public boolean cantBeChampion()
28
+	{
29
+		return _cantBeChampionMonster;
30
+	}
31
+	
32
 	public byte getLevel()
33
 	{
34
 		return _level;
35
Index: java/net/sf/l2j/gameserver/network/serverpackets/AbstractNpcInfo.java
36
===================================================================
37
--- java/net/sf/l2j/gameserver/network/serverpackets/AbstractNpcInfo.java	(revision 20)
38
+++ java/net/sf/l2j/gameserver/network/serverpackets/AbstractNpcInfo.java	(working copy)
39
@@ -99,7 +99,9 @@
40
 			if (_npc.getTemplate().isUsingServerSideName())
41
 				_name = _npc.getName();
42
 			
43
-			if (_npc.getTemplate().isUsingServerSideTitle())
44
+			if (_npc.isChampion())
45
+				_title = "Champion";
46
+			else if (_npc.getTemplate().isUsingServerSideTitle())
47
 				_title = _npc.getTitle();
48
 			
49
 			if (Config.SHOW_NPC_LVL && _npc instanceof Monster)
50
Index: config/npcs.properties
51
===================================================================
52
--- config/npcs.properties	(revision 20)
53
+++ config/npcs.properties	(working copy)
54
@@ -1,4 +1,42 @@
55
 #=============================================================
56
+#                        Champion mobs
57
+#=============================================================
58
+
59
+# Chance for a mob to became champion (in percent) - 0 to disable
60
+ChampionFrequency = 0
61
+
62
+# Min and max lvl allowed for a mob to be champion.
63
+ChampionMinLevel = 20
64
+ChampionMaxLevel = 70
65
+
66
+# Hp multiplier
67
+ChampionHp = 8
68
+
69
+# Hp Regen Multiplier
70
+ChampionHpRegen = 1.
71
+
72
+# Rewards multiplier
73
+ChampionRewards = 8
74
+
75
+# Adenas & seal stones rewards multiplier
76
+ChampionAdenasRewards = 1
77
+
78
+# Atk bonus for champion (changes apply on patk & matk)
79
+ChampionAtk = 1.
80
+
81
+# Spd Atk bonus for champion (changes apply on patkspd & matkspd)
82
+ChampionSpdAtk = 1.
83
+
84
+# Chance to obtain a specified reward item from a higher lvl champion (in percents)   default is off using glittering medal as reward
85
+ChampionRewardItem = 0
86
+
87
+# Specified reward item ID
88
+ChampionRewardItemID = 6393
89
+
90
+# Specified reward item rnd qty
91
+ChampionRewardItemQty = 1
92
+
93
+#=============================================================
94
 #                          Баффер
95
 #=============================================================
96
 # Максимальное количество доступных схем на игрока.
97
Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminManage.java
98
===================================================================
99
--- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminManage.java	(revision 20)
100
+++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminManage.java	(working copy)
101
@@ -4,6 +4,7 @@
102
 
103
 import net.sf.l2j.commons.lang.StringUtil;
104
 
105
+import net.sf.l2j.Config;
106
 import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
107
 import net.sf.l2j.gameserver.model.World;
108
 import net.sf.l2j.gameserver.model.actor.Creature;
109
@@ -149,7 +150,7 @@
110
 			return false;
111
 		
112
 		creature.stopAllEffects();
113
-		creature.reduceCurrentHp(creature.getStatus().getMaxHp() + creature.getStatus().getMaxCp() + 1, player, null);
114
+		creature.reduceCurrentHp(creature.isChampion() ? creature.getStatus().getMaxHp() * Config.CHAMPION_HP + 1 : creature.getStatus().getMaxHp() + creature.getStatus().getMaxCp() + 1, player, null);
115
 		return true;
116
 	}
117
 	
118
Index: config/en/npcs.properties
119
===================================================================
120
--- config/en/npcs.properties	(revision 20)
121
+++ config/en/npcs.properties	(working copy)
122
@@ -1,4 +1,42 @@
123
 #=============================================================
124
+#                        Champion mobs
125
+#=============================================================
126
+
127
+# Chance for a mob to became champion (in percent) - 0 to disable
128
+ChampionFrequency = 0
129
+
130
+# Min and max lvl allowed for a mob to be champion.
131
+ChampionMinLevel = 20
132
+ChampionMaxLevel = 70
133
+
134
+# Hp multiplier
135
+ChampionHp = 8
136
+
137
+# Hp Regen Multiplier
138
+ChampionHpRegen = 1.
139
+
140
+# Rewards multiplier
141
+ChampionRewards = 8
142
+
143
+# Adenas & seal stones rewards multiplier
144
+ChampionAdenasRewards = 1
145
+
146
+# Atk bonus for champion (changes apply on patk & matk)
147
+ChampionAtk = 1.
148
+
149
+# Spd Atk bonus for champion (changes apply on patkspd & matkspd)
150
+ChampionSpdAtk = 1.
151
+
152
+# Chance to obtain a specified reward item from a higher lvl champion (in percents)   default is off using glittering medal as reward
153
+ChampionRewardItem = 0
154
+
155
+# Specified reward item ID
156
+ChampionRewardItemID = 6393
157
+
158
+# Specified reward item rnd qty
159
+ChampionRewardItemQty = 1
160
+
161
+#=============================================================
162
 #                          Buffer
163
 #=============================================================
164
 
165
Index: java/net/sf/l2j/Config.java
166
===================================================================
167
--- java/net/sf/l2j/Config.java	(revision 20)
168
+++ java/net/sf/l2j/Config.java	(working copy)
169
@@ -298,6 +298,20 @@
170
 	// NPCs / Monsters
171
 	// --------------------------------------------------
172
 	
173
+	/** Champion Mod */
174
+	public static int CHAMPION_FREQUENCY;
175
+	public static int CHAMP_MIN_LVL;
176
+	public static int CHAMP_MAX_LVL;
177
+	public static int CHAMPION_HP;
178
+	public static int CHAMPION_REWARDS;
179
+	public static int CHAMPION_ADENAS_REWARDS;
180
+	public static double CHAMPION_HP_REGEN;
181
+	public static double CHAMPION_ATK;
182
+	public static double CHAMPION_SPD_ATK;
183
+	public static int CHAMPION_REWARD;
184
+	public static int CHAMPION_REWARD_ID;
185
+	public static int CHAMPION_REWARD_QTY;
186
+	
187
 	/** Buffer */
188
 	public static int BUFFER_MAX_SCHEMES;
189
 	public static int BUFFER_STATIC_BUFF_COST;
190
@@ -1122,6 +1136,19 @@
191
 	{
192
 		final ExProperties npcs = initProperties(NPCS_FILE);
193
 		
194
+		CHAMPION_FREQUENCY = npcs.getProperty("ChampionFrequency", 0);
195
+		CHAMP_MIN_LVL = npcs.getProperty("ChampionMinLevel", 20);
196
+		CHAMP_MAX_LVL = npcs.getProperty("ChampionMaxLevel", 70);
197
+		CHAMPION_HP = npcs.getProperty("ChampionHp", 8);
198
+		CHAMPION_HP_REGEN = npcs.getProperty("ChampionHpRegen", 1.);
199
+		CHAMPION_REWARDS = npcs.getProperty("ChampionRewards", 8);
200
+		CHAMPION_ADENAS_REWARDS = npcs.getProperty("ChampionAdenasRewards", 1);
201
+		CHAMPION_ATK = npcs.getProperty("ChampionAtk", 1.);
202
+		CHAMPION_SPD_ATK = npcs.getProperty("ChampionSpdAtk", 1.);
203
+		CHAMPION_REWARD = npcs.getProperty("ChampionRewardItem", 0);
204
+		CHAMPION_REWARD_ID = npcs.getProperty("ChampionRewardItemID", 6393);
205
+		CHAMPION_REWARD_QTY = npcs.getProperty("ChampionRewardItemQty", 1);
206
+		
207
 		BUFFER_MAX_SCHEMES = npcs.getProperty("BufferMaxSchemesPerChar", 4);
208
 		BUFFER_STATIC_BUFF_COST = npcs.getProperty("BufferStaticCostPerBuff", -1);
209
 		
210
Index: java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
211
===================================================================
212
--- java/net/sf/l2j/gameserver/model/actor/instance/Monster.java	(revision 20)
213
+++ java/net/sf/l2j/gameserver/model/actor/instance/Monster.java	(working copy)
214
@@ -65,6 +65,8 @@
215
 	private boolean _isRaid;
216
 	private boolean _isMinion;
217
 	
218
+	private boolean _isChampion;
219
+	
220
 	public Monster(int objectId, NpcTemplate template)
221
 	{
222
 		super(objectId, template);
223
@@ -468,6 +470,13 @@
224
 			sp = sp * pow;
225
 		}
226
 		
227
+		// Add champion ratio, if any.
228
+		if (isChampion())
229
+		{
230
+			xp *= Config.CHAMPION_REWARDS;
231
+			sp *= Config.CHAMPION_REWARDS;
232
+		}
233
+		
234
 		// If the XP is inferior or equals 0, don't reward any SP. Both XP and SP can't be inferior to 0.
235
 		if (xp <= 0)
236
 		{
237
@@ -502,6 +511,17 @@
238
 		return _minionList;
239
 	}
240
 	
241
+	@Override
242
+	public final boolean isChampion()
243
+	{
244
+		return _isChampion;
245
+	}
246
+	
247
+	public final void setChampion(boolean value)
248
+	{
249
+		_isChampion = value;
250
+	}
251
+	
252
 	/**
253
 	 * Teleport this {@link Monster} to its master.
254
 	 */
255
@@ -565,6 +585,9 @@
256
 		else
257
 			dropChance *= Config.RATE_DROP_ITEMS;
258
 		
259
+		if (isChampion())
260
+			dropChance *= Config.CHAMPION_REWARDS;
261
+		
262
 		// Set our limits for chance of drop
263
 		if (dropChance < 1)
264
 			dropChance = 1;
265
@@ -592,6 +615,10 @@
266
 			dropChance -= DropData.MAX_CHANCE;
267
 		}
268
 		
269
+		if (isChampion())
270
+			if (drop.getItemId() == 57 || (drop.getItemId() >= 6360 && drop.getItemId() <= 6362))
271
+				itemCount *= Config.CHAMPION_ADENAS_REWARDS;
272
+		
273
 		if (itemCount > 0)
274
 			return new IntIntHolder(drop.getItemId(), itemCount);
275
 		
276
@@ -634,6 +661,9 @@
277
 		else
278
 			categoryDropChance *= Config.RATE_DROP_ITEMS;
279
 		
280
+		if (isChampion())
281
+			categoryDropChance *= Config.CHAMPION_REWARDS;
282
+		
283
 		// Set our limits for chance of drop
284
 		if (categoryDropChance < 1)
285
 			categoryDropChance = 1;
286
@@ -665,6 +695,9 @@
287
 			else
288
 				dropChance *= Config.RATE_DROP_ITEMS;
289
 			
290
+			if (isChampion())
291
+				dropChance *= Config.CHAMPION_REWARDS;
292
+			
293
 			if (dropChance < DropData.MAX_CHANCE)
294
 				dropChance = DropData.MAX_CHANCE;
295
 			
296
@@ -691,6 +724,10 @@
297
 				dropChance -= DropData.MAX_CHANCE;
298
 			}
299
 			
300
+			if (isChampion())
301
+				if (drop.getItemId() == 57 || (drop.getItemId() >= 6360 && drop.getItemId() <= 6362))
302
+					itemCount *= Config.CHAMPION_ADENAS_REWARDS;
303
+			
304
 			if (itemCount > 0)
305
 				return new IntIntHolder(drop.getItemId(), itemCount);
306
 		}
307
@@ -887,6 +924,30 @@
308
 			}
309
 		}
310
 		
311
+		// Apply special item drop for champions.
312
+		if (isChampion() && Config.CHAMPION_REWARD > 0)
313
+		{
314
+			int dropChance = Config.CHAMPION_REWARD;
315
+			
316
+			// Apply level modifier, if any/wanted.
317
+			if (Config.DEEPBLUE_DROP_RULES)
318
+			{
319
+				int deepBlueDrop = (levelModifier > 0) ? 3 : 1;
320
+				
321
+				// Check if we should apply our maths so deep blue mobs will not drop that easy.
322
+				dropChance = ((Config.CHAMPION_REWARD - ((Config.CHAMPION_REWARD * levelModifier) / 100)) / deepBlueDrop);
323
+			}
324
+			
325
+			if (Rnd.get(100) < dropChance)
326
+			{
327
+				final IntIntHolder item = new IntIntHolder(Config.CHAMPION_REWARD_ID, Math.max(1, Rnd.get(1, Config.CHAMPION_REWARD_QTY)));
328
+				if (Config.AUTO_LOOT)
329
+					player.addItem("ChampionLoot", item.getId(), item.getValue(), this, true);
330
+				else
331
+					dropItem(player, item);
332
+			}
333
+		}
334
+		
335
 		// Herbs.
336
 		if (getTemplate().getDropHerbGroup() > 0)
337
 		{
338
Index: java/net/sf/l2j/gameserver/model/actor/Creature.java
339
===================================================================
340
--- java/net/sf/l2j/gameserver/model/actor/Creature.java	(revision 20)
341
+++ java/net/sf/l2j/gameserver/model/actor/Creature.java	(working copy)
342
@@ -1683,8 +1683,16 @@
343
 	}
344
 	
345
 	public void reduceCurrentHp(double i, Creature attacker, boolean awake, boolean isDOT, L2Skill skill)
346
+	{		
347
+		if (isChampion() && Config.CHAMPION_HP != 0)
348
+			getStatus().reduceHp(i / Config.CHAMPION_HP, attacker, awake, isDOT, false);
349
+		else
350
+			getStatus().reduceHp(i, attacker, awake, isDOT, false);
351
+	}
352
+	
353
+	public boolean isChampion()
354
 	{
355
-		getStatus().reduceHp(i, attacker, awake, isDOT, false);
356
+		return false;
357
 	}
358
 	
359
 	/**
360
Index: java/net/sf/l2j/gameserver/model/actor/status/CreatureStatus.java
361
===================================================================
362
--- java/net/sf/l2j/gameserver/model/actor/status/CreatureStatus.java	(revision 20)
363
+++ java/net/sf/l2j/gameserver/model/actor/status/CreatureStatus.java	(working copy)
364
@@ -622,7 +622,7 @@
365
 	 */
366
 	public double getRegenHp()
367
 	{
368
-		return calcStat(Stats.REGENERATE_HP_RATE, _actor.getTemplate().getBaseHpRegen(getLevel()) * (_actor.isRaidRelated() ? Config.RAID_HP_REGEN_MULTIPLIER : Config.HP_REGEN_MULTIPLIER), null, null);
369
+		return calcStat(Stats.REGENERATE_HP_RATE, _actor.getTemplate().getBaseHpRegen(getLevel()) * (_actor.isRaidRelated() ? Config.RAID_HP_REGEN_MULTIPLIER : Config.HP_REGEN_MULTIPLIER) * ((_actor.isChampion()) ? Config.CHAMPION_HP_REGEN : 1), null, null);
370
 	}
371
 	
372
 	/**
373
@@ -640,7 +640,7 @@
374
 	 */
375
 	public int getMAtk(Creature target, L2Skill skill)
376
 	{
377
-		return (int) calcStat(Stats.MAGIC_ATTACK, _actor.getTemplate().getBaseMAtk(), target, skill);
378
+		return (int) calcStat(Stats.MAGIC_ATTACK, _actor.getTemplate().getBaseMAtk() * ((_actor.isChampion()) ? Config.CHAMPION_ATK : 1), target, skill);
379
 	}
380
 	
381
 	/**
382
@@ -648,7 +648,7 @@
383
 	 */
384
 	public int getMAtkSpd()
385
 	{
386
-		return (int) calcStat(Stats.MAGIC_ATTACK_SPEED, 333.0, null, null);
387
+		return (int) calcStat(Stats.MAGIC_ATTACK_SPEED, 333.0 * ((_actor.isChampion()) ? Config.CHAMPION_SPD_ATK : 1), null, null);
388
 	}
389
 	
390
 	/**
391
@@ -668,7 +668,7 @@
392
 	 */
393
 	public int getPAtk(Creature target)
394
 	{
395
-		return (int) calcStat(Stats.POWER_ATTACK, _actor.getTemplate().getBasePAtk(), target, null);
396
+		return (int) calcStat(Stats.POWER_ATTACK, _actor.getTemplate().getBasePAtk() * ((_actor.isChampion()) ? Config.CHAMPION_ATK : 1), target, null);
397
 	}
398
 	
399
 	/**
400
@@ -676,7 +676,7 @@
401
 	 */
402
 	public int getPAtkSpd()
403
 	{
404
-		return (int) calcStat(Stats.POWER_ATTACK_SPEED, _actor.getTemplate().getBasePAtkSpd(), null, null);
405
+		return (int) calcStat(Stats.POWER_ATTACK_SPEED, _actor.getTemplate().getBasePAtkSpd() * ((_actor.isChampion()) ? Config.CHAMPION_SPD_ATK : 1), null, null);
406
 	}
407
 	
408
 	/**
409
Index: java/net/sf/l2j/gameserver/model/spawn/Spawn.java
410
===================================================================
411
--- java/net/sf/l2j/gameserver/model/spawn/Spawn.java	(revision 20)
412
+++ java/net/sf/l2j/gameserver/model/spawn/Spawn.java	(working copy)
413
@@ -6,6 +6,7 @@
414
 import net.sf.l2j.commons.pool.ThreadPool;
415
 import net.sf.l2j.commons.random.Rnd;
416
 
417
+import net.sf.l2j.Config;
418
 import net.sf.l2j.gameserver.data.xml.NpcData;
419
 import net.sf.l2j.gameserver.geoengine.GeoEngine;
420
 import net.sf.l2j.gameserver.idfactory.IdFactory;
421
@@ -12,6 +13,7 @@
422
 import net.sf.l2j.gameserver.model.World;
423
 import net.sf.l2j.gameserver.model.actor.Creature;
424
 import net.sf.l2j.gameserver.model.actor.Npc;
425
+import net.sf.l2j.gameserver.model.actor.instance.Monster;
426
 import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
427
 import net.sf.l2j.gameserver.model.location.SpawnLocation;
428
 
429
@@ -390,6 +392,14 @@
430
 		// Set the HP and MP of the Npc to the max
431
 		_npc.getStatus().setMaxHpMp();
432
 		
433
+		// when champion mod is enabled, try to make NPC a champion
434
+		if (Config.CHAMPION_FREQUENCY > 0)
435
+		{
436
+			// It can't be a Raid, a Raid minion nor a minion. Quest mobs and chests are disabled too.
437
+			if (_npc instanceof Monster && !getTemplate().cantBeChampion() && _npc.getStatus().getLevel() >= Config.CHAMP_MIN_LVL && _npc.getStatus().getLevel() <= Config.CHAMP_MAX_LVL && !_npc.isRaidRelated() && !_npc.isMinion())
438
+				((Monster) _npc).setChampion(Rnd.get(100) < Config.CHAMPION_FREQUENCY);
439
+		}
440
+		
441
 		// spawn NPC on new coordinates
442
 		_npc.spawnMe(locX, locY, locZ, (_loc.getHeading() < 0) ? Rnd.get(65536) : _loc.getHeading());
443
 	}
444