Advertisement
Axelut

Modify skill duration time

May 11th, 2023
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.30 KB | None | 0 0
  1. Index: java/config/l2jmods.properties
  2. ===================================================================
  3. --- java/config/l2jmods.properties (revision 4430)
  4. +++ java/config/l2jmods.properties (working copy)
  5. @@ -132,3 +132,16 @@
  6. # ex.: 1;2;3;4;5;6
  7. # no ";" at the start or end
  8. TvTEventDoorsCloseOpenOnStartEnd =
  9. +
  10. +#---------------------------------------------------------------
  11. +# Skill Customizations -
  12. +#---------------------------------------------------------------
  13. +# Enable to modify skill duration data
  14. +EnableModifySkillDuration = false
  15. +# Skill duration list
  16. +# Format : skillid,newtime;skillid,newtime....
  17. +# Example : this enable 1h(3600) duration for songs
  18. +# SkillDurationList = 264,3600;265,3600;266,3600;267,3600;268,3600;\
  19. +# 269,3600;270,3600;304,3600;305,1200;306,3600;308,3600;349,3600;\
  20. +# 363,3600;364,3600
  21. +SkillDurationList =
  22. \ No newline at end of file
  23. Index: java/net/sf/l2j/Config.java
  24. ===================================================================
  25. --- java/net/sf/l2j/Config.java (revision 4430)
  26. +++ java/net/sf/l2j/Config.java (working copy)
  27. @@ -25,10 +25,12 @@
  28. import java.io.OutputStream;
  29. import java.math.BigInteger;
  30. import java.util.List;
  31. +import java.util.Map;
  32. import java.util.Properties;
  33. import java.util.logging.Logger;
  34.  
  35. import javolution.util.FastList;
  36. +import javolution.util.FastMap;
  37. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  38.  
  39. /**
  40. @@ -882,7 +884,12 @@
  41. public static boolean L2JMOD_WEDDING_FORMALWEAR;
  42. public static int L2JMOD_WEDDING_DIVORCE_COSTS;
  43.  
  44. - // Packet information
  45. + /** Enable skill duration mod */
  46. + public static boolean ENABLE_MODIFY_SKILL_DURATION;
  47. + public static Map<Integer, Integer> SKILL_DURATION_LIST;
  48. + public static int MODIFIED_SKILL_COUNT;
  49. +
  50. + // Packet information
  51. /** Count the amount of packets per minute ? */
  52. public static boolean COUNT_PACKETS = false;
  53. /** Dump packet count ? */
  54. @@ -1858,7 +1865,37 @@
  55. L2JMOD_WEDDING_SAMESEX = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingAllowSameSex", "False"));
  56. L2JMOD_WEDDING_FORMALWEAR = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingFormalWear", "True"));
  57. L2JMOD_WEDDING_DIVORCE_COSTS = Integer.parseInt(L2JModSettings.getProperty("WeddingDivorceCosts", "20"));
  58. -
  59. + ENABLE_MODIFY_SKILL_DURATION = Boolean.valueOf(L2JModSettings.getProperty("EnableModifySkillDuration", "false"));
  60. +
  61. + if (ENABLE_MODIFY_SKILL_DURATION)
  62. + {
  63. + SKILL_DURATION_LIST = new FastMap<Integer, Integer>();
  64. + String[] propertySplit;
  65. + propertySplit = L2JModSettings.getProperty("SkillDurationList", "").split(";");
  66. + for (String skill : propertySplit)
  67. + {
  68. + String[] skillSplit = skill.split(",");
  69. + if (skillSplit.length != 2)
  70. + {
  71. + System.out.println("[skillDurationList]: invalid config property -> SkillDurationList \"" + skill + "\"");
  72. + }
  73. + else
  74. + {
  75. + try
  76. + {
  77. + SKILL_DURATION_LIST.put(Integer.valueOf(skillSplit[0]), Integer.valueOf(skillSplit[1]));
  78. + }
  79. + catch (NumberFormatException nfe)
  80. + {
  81. + if (!skill.equals(""))
  82. + {
  83. + System.out.println("[skillDurationList]: invalid config property -> SkillList \"" + skillSplit[0] + "\"" + skillSplit[1]);
  84. + }
  85. + }
  86. + }
  87. + }
  88. + }
  89. +
  90. if (TVT_EVENT_PARTICIPATION_NPC_ID == 0)
  91. {
  92. TVT_EVENT_ENABLED = false;
  93. Index: java/net/sf/l2j/gameserver/skills/DocumentBase.java
  94. ===================================================================
  95. --- java/net/sf/l2j/gameserver/skills/DocumentBase.java (revision 4430)
  96. +++ java/net/sf/l2j/gameserver/skills/DocumentBase.java (working copy)
  97. @@ -30,6 +30,7 @@
  98. import javolution.text.TextBuilder;
  99. import javolution.util.FastList;
  100. import javolution.util.FastMap;
  101. +import net.sf.l2j.Config;
  102. import net.sf.l2j.gameserver.datatables.SkillTable;
  103. import net.sf.l2j.gameserver.model.L2Character;
  104. import net.sf.l2j.gameserver.model.L2Skill;
  105. @@ -206,6 +207,29 @@
  106. if (attrs.getNamedItem("time") != null)
  107. {
  108. time = Integer.decode(getValue(attrs.getNamedItem("time").getNodeValue(),template));
  109. + if (Config.ENABLE_MODIFY_SKILL_DURATION)
  110. + {
  111. + if (Config.SKILL_DURATION_LIST.containsKey(((L2Skill) template).getId()))
  112. + {
  113. + if (((L2Skill) template).getLevel() < 100)
  114. + {
  115. + time = Config.SKILL_DURATION_LIST.get(((L2Skill) template).getId());
  116. + }
  117. + else if ((((L2Skill) template).getLevel() >= 100) && (((L2Skill) template).getLevel() < 140))
  118. + {
  119. + time += Config.SKILL_DURATION_LIST.get(((L2Skill) template).getId());
  120. + }
  121. + else if (((L2Skill) template).getLevel() > 140)
  122. + {
  123. + time = Config.SKILL_DURATION_LIST.get(((L2Skill) template).getId());
  124. + }
  125. + if (Config.DEBUG)
  126. + {
  127. + _log.info("*** Skill " + ((L2Skill) template).getName() + " (" + ((L2Skill) template).getLevel() + ") changed duration to " + time + " seconds.");
  128. + }
  129. + Config.MODIFIED_SKILL_COUNT += 1;
  130. + }
  131. + }
  132. }
  133. else time = ((L2Skill) template).getBuffDuration() / 1000 / count;
  134. boolean self = false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement