xlogel

Champion mob for aCis 401

Sep 6th, 2024
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.83 KB | None | 0 0
  1. diff --git a/aCis_gameserver/config/ChampionMobs.properties b/aCis_gameserver/config/ChampionMobs.properties
  2. new file mode 100644
  3. index 0000000..416848e
  4. --- /dev/null
  5. +++ b/aCis_gameserver/config/ChampionMobs.properties
  6. @@ -0,0 +1,52 @@
  7. +# ---------------------------------------------------------------------------
  8. +# Custom - non-retail-like systems that have been integrated into the project.
  9. +# Be warned that there may be no support for these mods ban the original author's assistance.
  10. +# ---------------------------------------------------------------------------
  11. +# Champion mobs - Turn random mobs into Champions
  12. +# ---------------------------------------------------------------------------
  13. +
  14. +# Enable/Disable Champion Mob System.
  15. +ChampionEnable = True
  16. +
  17. +# Force Champion mobs to be passive?
  18. +# To leave champion mobs to default/Aggressive, set to False.
  19. +# To set all champion mobs to Passive, set True.
  20. +ChampionPassive = False
  21. +
  22. +# % chance for a mob to became champion (0 to disable).
  23. +ChampionFrequency = 25
  24. +
  25. +# Title of all Champion Mobs.
  26. +ChampionTitle = *Champion*
  27. +
  28. +# Min and max levels allowed for a mob to be a Champion mob.
  29. +ChampionMinLevel = 75
  30. +ChampionMaxLevel = 80
  31. +
  32. +# Stats Multiplier for Champion mobs.
  33. +ChampionHp = 20
  34. +ChampionPatk = 3
  35. +ChampionPdef = 20
  36. +ChampionMatk = 5
  37. +ChampionMdef = 20
  38. +
  39. +# XP / SP Multiplier
  40. +ChampionRewards = 20
  41. +
  42. +# Adena rewards multiplier for Champion mobs.
  43. +ChampionAdenasRewards = 10
  44. +
  45. +# Specified reward item ID
  46. +ChampionRewardItemID = 6673
  47. +
  48. +# The amount of the specified reward a player will receive if they are awarded the item.
  49. +ChampionRewardItemQty = 5
  50. +
  51. +# % Chance to obtain a specified reward item from a higher level Champion mob.
  52. +# Default: 0
  53. +# not working
  54. +ChampionRewardLowerLvlItemChance = 100
  55. +
  56. +# % Chance to obtain a specified reward item from a lower level Champion mob.
  57. +# Default: 0
  58. +ChampionRewardHigherLvlItemChance = 100
  59. \ No newline at end of file
  60.  
  61. diff --git a/aCis_gameserver/java/net/sf/l2j/Config.java b/aCis_gameserver/java/net/sf/l2j/Config.java
  62. index 1c2cdcb..56e3b0d 100644
  63. --- a/aCis_gameserver/java/net/sf/l2j/Config.java
  64. +++ b/aCis_gameserver/java/net/sf/l2j/Config.java
  65. @@ -714,9 +714,52 @@ public final class Config
  66. public static int CLIENT_PACKET_QUEUE_MAX_OVERFLOWS_PER_MIN = 1; // default 1
  67. public static int CLIENT_PACKET_QUEUE_MAX_UNDERFLOWS_PER_MIN = 1; // default 1
  68. public static int CLIENT_PACKET_QUEUE_MAX_UNKNOWN_PER_MIN = 5; // default 5
  69. -
  70. +
  71. + /** Champion mobs */
  72. + public static final String CHAMPION_FILE = "./config/ChampionMobs.properties";
  73. + public static boolean L2JDEV_CHAMPION_ENABLE;
  74. + public static boolean L2JDEV_CHAMPION_PASSIVE;
  75. + public static int L2JDEV_CHAMPION_FREQUENCY;
  76. + public static String L2JDEV_CHAMP_TITLE;
  77. + public static int L2JDEV_CHAMP_MIN_LVL;
  78. + public static int L2JDEV_CHAMP_MAX_LVL;
  79. + public static int L2JDEV_CHAMPION_HP;
  80. + public static int L2JDEV_CHAMPION_REWARDS;
  81. + public static float L2JDEV_CHAMPION_ADENAS_REWARDS;
  82. + public static float L2JDEV_CHAMPION_ChampionPatk;
  83. + public static float L2JDEV_CHAMPION_ChampionPdef;
  84. + public static float L2JDEV_CHAMPION_ChampionMatk;
  85. + public static float L2JDEV_CHAMPION_ChampionMdef;
  86. + public static int L2JDEV_CHAMPION_REWARD_LOWER_LVL_ITEM_CHANCE;
  87. + public static int L2JDEV_CHAMPION_REWARD_HIGHER_LVL_ITEM_CHANCE;
  88. + public static int L2JDEV_CHAMPION_REWARD_ID;
  89. + public static int L2JDEV_CHAMPION_REWARD_QTY;
  90. +
  91. + public static final void loadChampion() {
  92. + final ExProperties CHAMPION = initProperties(CHAMPION_FILE);
  93. +
  94. + L2JDEV_CHAMPION_ENABLE = CHAMPION.getProperty("ChampionEnable", false);
  95. + L2JDEV_CHAMPION_PASSIVE = CHAMPION.getProperty("ChampionPassive", false);
  96. + L2JDEV_CHAMPION_FREQUENCY = CHAMPION.getProperty("ChampionFrequency", 0);
  97. + L2JDEV_CHAMP_TITLE = CHAMPION.getProperty("ChampionTitle", "Champion");
  98. + L2JDEV_CHAMP_MIN_LVL = CHAMPION.getProperty("ChampionMinLevel", 20);
  99. + L2JDEV_CHAMP_MAX_LVL = CHAMPION.getProperty("ChampionMaxLevel", 60);
  100. + L2JDEV_CHAMPION_HP = CHAMPION.getProperty("ChampionHp", 7);
  101. + L2JDEV_CHAMPION_ChampionPatk = CHAMPION.getProperty("ChampionPatk", 1);
  102. + L2JDEV_CHAMPION_ChampionPdef = CHAMPION.getProperty("ChampionPdef", 1);
  103. + L2JDEV_CHAMPION_ChampionMatk = CHAMPION.getProperty("ChampionMatk", 1);
  104. + L2JDEV_CHAMPION_ChampionMdef = CHAMPION.getProperty("ChampionMdef", 1);
  105. + L2JDEV_CHAMPION_REWARDS = CHAMPION.getProperty("ChampionRewards", 8);
  106. + L2JDEV_CHAMPION_ADENAS_REWARDS = CHAMPION.getProperty("ChampionAdenasRewards", 1);
  107. +
  108. + L2JDEV_CHAMPION_REWARD_LOWER_LVL_ITEM_CHANCE = CHAMPION.getProperty("ChampionRewardLowerLvlItemChance", 0);
  109. + L2JDEV_CHAMPION_REWARD_HIGHER_LVL_ITEM_CHANCE = CHAMPION.getProperty("ChampionRewardHigherLvlItemChance", 0);
  110. + L2JDEV_CHAMPION_REWARD_ID = CHAMPION.getProperty("ChampionRewardItemID", 6393);
  111. + L2JDEV_CHAMPION_REWARD_QTY = CHAMPION.getProperty("ChampionRewardItemQty", 1);
  112. +
  113. + }
  114. // --------------------------------------------------
  115. -
  116. +
  117. /**
  118. * Initialize {@link ExProperties} from specified configuration file.
  119. * @param filename : File name to be loaded.
  120. @@ -1526,6 +1569,9 @@ public final class Config
  121.  
  122. // vote settings
  123. loadVoteSystem();
  124. +
  125. + // load champion inside loadGameServer()
  126. + loadChampion();
  127.  
  128. }
  129.  
  130. diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Attackable.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Attackable.java
  131. index cb3aad3..a1d31a0 100644
  132. --- a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Attackable.java
  133. +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Attackable.java
  134. @@ -116,6 +116,19 @@ public class Attackable extends Npc
  135. ThreadPool.schedule(() -> quest.notifyKill(this, killer), 3000);
  136.  
  137. _attackedBy.clear();
  138. +
  139. + setChampion(false);
  140. + if (Config.L2JDEV_CHAMPION_ENABLE) {
  141. + // Set champion on next spawn
  142. + if (!(killer instanceof Monster) && (Config.L2JDEV_CHAMPION_FREQUENCY > 0)
  143. + && (getStatus().getLevel() >= Config.L2JDEV_CHAMP_MIN_LVL)
  144. + && (getStatus().getLevel() <= Config.L2JDEV_CHAMP_MAX_LVL)) {
  145. +
  146. + if (Rnd.get(100) <= Config.L2JDEV_CHAMPION_FREQUENCY) {
  147. + setChampion(true);
  148. + }
  149. + }
  150. + }
  151.  
  152. return true;
  153. }
  154. diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Creature.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Creature.java
  155. index 2c23a36..5bec8a5 100644
  156. --- a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Creature.java
  157. +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Creature.java
  158. @@ -169,6 +169,17 @@ public abstract class Creature extends WorldObject {
  159. return "[Creature objId=" + getObjectId() + "]";
  160. }
  161.  
  162. + private boolean _champion = false;
  163. +
  164. + public boolean isChampion() {
  165. + return _champion;
  166. + }
  167. +
  168. + public void setChampion(boolean chanpion) {
  169. + _champion = true;
  170. + _champion = chanpion;
  171. + }
  172. +
  173. /**
  174. * Set all related {@link Func}s of this {@link Creature}.
  175. */
  176. @@ -1593,6 +1604,11 @@ public abstract class Creature extends WorldObject {
  177.  
  178. public void reduceCurrentHp(double i, Creature attacker, boolean awake, boolean isDOT, L2Skill skill) {
  179. getStatus().reduceHp(i, attacker, awake, isDOT, false);
  180. +
  181. + if (Config.L2JDEV_CHAMPION_ENABLE && isChampion() && (Config.L2JDEV_CHAMPION_HP != 0)) {
  182. + getStatus().reduceHp(i / Config.L2JDEV_CHAMPION_HP, attacker, awake, isDOT, false);
  183. + } else
  184. + getStatus().reduceHp(i, attacker, awake, isDOT, false);
  185. }
  186.  
  187. /**
  188.  
  189. diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
  190. index b119ef2..1044a49 100644
  191. --- a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
  192. +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
  193. @@ -160,6 +160,11 @@ public class Monster extends Attackable {
  194.  
  195. exp *= 1 - penalty;
  196.  
  197. + if (Config.L2JDEV_CHAMPION_ENABLE && isChampion()) {
  198. + exp *= Config.L2JDEV_CHAMPION_REWARDS;
  199. + sp *= Config.L2JDEV_CHAMPION_REWARDS;
  200. + }
  201. +
  202. // Test over-hit.
  203. if (_overhitState.isValidOverhit(attacker)) {
  204. attacker.sendPacket(SystemMessageId.OVER_HIT);
  205. @@ -232,6 +237,11 @@ public class Monster extends Attackable {
  206. exp *= partyMul;
  207. sp *= partyMul;
  208.  
  209. + if (Config.L2JDEV_CHAMPION_ENABLE && isChampion()) {
  210. + exp *= Config.L2JDEV_CHAMPION_REWARDS;
  211. + sp *= Config.L2JDEV_CHAMPION_REWARDS;
  212. + }
  213. +
  214. // Test over-hit.
  215. if (_overhitState.isValidOverhit(attacker)) {
  216. attacker.sendPacket(SystemMessageId.OVER_HIT);
  217. @@ -840,6 +850,9 @@ public class Monster extends Attackable {
  218. continue;
  219.  
  220. dropOrAutoLootItem(player, holder, true);
  221. +
  222. + if (holder.getId() == 57)
  223. + championMobDropAdena(player,holder );
  224. }
  225. }
  226.  
  227. @@ -853,6 +866,8 @@ public class Monster extends Attackable {
  228. dropOrAutoLootItem(player, holder, false);
  229. }
  230. }
  231. +
  232. + championMobDropSpecialItem(player);
  233. }
  234.  
  235. /**
  236. @@ -923,6 +938,7 @@ public class Monster extends Attackable {
  237. // Create the ItemInstance and add it in the world as a visible object.
  238. final ItemInstance item = ItemInstance.create(holder.getId(), holder.getValue(), player, this);
  239. item.setDropProtection(player.getObjectId(), isRaidBoss());
  240. + item.setDropProtection(player.getObjectId(), isChampion());
  241. item.dropMe(this, 70);
  242.  
  243. // If stackable, end loop as entire count is included in 1 instance of item.
  244. @@ -997,4 +1013,34 @@ public class Monster extends Attackable {
  245. }
  246. }
  247.  
  248. + private void championMobDropSpecialItem(Player player){
  249. + // Champion mod
  250. + // Apply Special Item drop with random(rnd) quantity(qty) for champions.
  251. + if (Config.L2JDEV_CHAMPION_ENABLE && isChampion()
  252. + && (Config.L2JDEV_CHAMPION_REWARD_HIGHER_LVL_ITEM_CHANCE > 0)) {
  253. +
  254. + int champqty = Rnd.get(Config.L2JDEV_CHAMPION_REWARD_QTY);
  255. + IntIntHolder item = new IntIntHolder(Config.L2JDEV_CHAMPION_REWARD_ID, champqty);
  256. +
  257. + if (Rnd.get(100) <= Config.L2JDEV_CHAMPION_REWARD_HIGHER_LVL_ITEM_CHANCE) {
  258. + if (Config.AUTO_LOOT) {
  259. + player.addItem("ChampionLoot", item.getId(), item.getValue(), this, true);
  260. + } else {
  261. + if ((Rnd.get(1, 10) == 1))
  262. + dropItem(player, item);
  263. + else
  264. + player.addItem("ChampionLoot", item.getId(), item.getValue(), this, true);
  265. + }
  266. + }
  267. + }
  268. + }
  269. +
  270. + private void championMobDropAdena(Player player, IntIntHolder holder) {
  271. + if (Config.L2JDEV_CHAMPION_ENABLE && isChampion()
  272. + && (Config.L2JDEV_CHAMPION_ADENAS_REWARDS > 1)) {
  273. + player.addAdena("ChampionLoot", (int) (holder.getValue() * (Config.L2JDEV_CHAMPION_ADENAS_REWARDS)), this,
  274. + true);
  275. + }
  276. + }
  277. +
  278. }
  279.  
  280.  
  281. diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/status/CreatureStatus.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/status/CreatureStatus.java
  282. index e4afd17..fca3a0b 100644
  283. --- a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/status/CreatureStatus.java
  284. +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/status/CreatureStatus.java
  285. @@ -627,7 +627,7 @@ public class CreatureStatus<T extends Creature>
  286. */
  287. public int getMAtk(Creature target, L2Skill skill)
  288. {
  289. - return (int) calcStat(Stats.MAGIC_ATTACK, _actor.getTemplate().getBaseMAtk(), target, skill);
  290. + return (int) calcStat(Stats.MAGIC_ATTACK, _actor.getTemplate().getBaseMAtk() * ((_actor.isChampion()) ? Config.L2JDEV_CHAMPION_ChampionMatk : 1), target, skill);
  291. }
  292.  
  293. /**
  294. @@ -646,7 +646,7 @@ public class CreatureStatus<T extends Creature>
  295. public int getMDef(Creature target, L2Skill skill)
  296. {
  297. // Calculate modifiers Magic Attack
  298. - return (int) calcStat(Stats.MAGIC_DEFENCE, _actor.getTemplate().getBaseMDef() * ((_actor.isRaidRelated()) ? Config.RAID_DEFENCE_MULTIPLIER : 1), target, skill);
  299. + return (int) calcStat(Stats.MAGIC_DEFENCE, _actor.getTemplate().getBaseMDef() * ((_actor.isRaidRelated()) ? Config.RAID_DEFENCE_MULTIPLIER : 1) * ((_actor.isChampion()) ? Config.L2JDEV_CHAMPION_ChampionMdef : 1), target, skill);
  300. }
  301.  
  302. /**
  303. @@ -655,7 +655,7 @@ public class CreatureStatus<T extends Creature>
  304. */
  305. public int getPAtk(Creature target)
  306. {
  307. - return (int) calcStat(Stats.POWER_ATTACK, _actor.getTemplate().getBasePAtk(), target, null);
  308. + return (int) calcStat(Stats.POWER_ATTACK, _actor.getTemplate().getBasePAtk() * ((_actor.isChampion()) ? Config.L2JDEV_CHAMPION_ChampionPatk : 1), target, null);
  309. }
  310.  
  311. /**
  312. @@ -672,7 +672,7 @@ public class CreatureStatus<T extends Creature>
  313. */
  314. public int getPDef(Creature target)
  315. {
  316. - return (int) calcStat(Stats.POWER_DEFENCE, _actor.getTemplate().getBasePDef() * ((_actor.isRaidRelated()) ? Config.RAID_DEFENCE_MULTIPLIER : 1), target, null);
  317. + return (int) calcStat(Stats.POWER_DEFENCE, _actor.getTemplate().getBasePDef() * ((_actor.isRaidRelated()) ? Config.RAID_DEFENCE_MULTIPLIER : 1) * ((_actor.isChampion()) ? Config.L2JDEV_CHAMPION_ChampionPdef : 1), target, null);
  318. }
  319.  
  320. /**
  321.  
  322.  
  323. diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/network/serverpackets/AbstractNpcInfo.java b/aCis_gameserver/java/net/sf/l2j/gameserver/network/serverpackets/AbstractNpcInfo.java
  324. index 1b3ee71..c9fe0d6 100644
  325. --- a/aCis_gameserver/java/net/sf/l2j/gameserver/network/serverpackets/AbstractNpcInfo.java
  326. +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/network/serverpackets/AbstractNpcInfo.java
  327. @@ -10,104 +10,100 @@ import net.sf.l2j.gameserver.model.actor.instance.Monster;
  328.  
  329. if (Config.SHOW_NPC_LVL && _npc instanceof Monster)
  330. - _title = "Lv " + _npc.getStatus().getLevel() + (_npc.getTemplate().getAggroRange() > 0 ? "* " : " ") + _title;
  331. -
  332. + _title = "Lv " + _npc.getStatus().getLevel() + (_npc.getTemplate().getAggroRange() > 0 ? "* " : " ")
  333. + + _title;
  334. +
  335. + if (Config.L2JDEV_CHAMPION_ENABLE && _npc.isChampion())
  336. + _title = "" + Config.L2JDEV_CHAMP_TITLE;
  337. +
  338.  
Advertisement
Add Comment
Please, Sign In to add comment