U3Games

Games | Desarrollo & Soporte => L2 | Sección de Servidores => Lineage => L2 | Implementaciones => Mensaje iniciado por: Swarlog en Ago 03, 2025, 12:44 AM

Título: Add Alternative Time Buffs in config
Publicado por: Swarlog en Ago 03, 2025, 12:44 AM
CitarProperties:

@@ -311,4 +311,17 @@
 MaxBuffsAmount = 20
 
 # Store buffs/debuffs on user logout?
-StoreSkillCooltime = True
\ No newline at end of file
+StoreSkillCooltime = True
+
+# --------------------------------------
+#  Alternative Time Buffs aCis
+# --------------------------------------
+# When the reads, buff, and their duration.
+# Format: id_skill time; id_skill2, time2 ;....
+# Example:
+# SkillDurationList = 264,3600; 265,3600; 266,3600; 267,3600; 268,3600; \
+# 269.3600, 270.3600, 304.3600, 305.1200, 306.3600, 308.3600, 349.3600; \
+# 363.3600, 364.3600
+# Default: False
+EnableModifySkillDuration = False
+SkillDurationList =
\ No newline at end of file

CitarConfig.java:

@@ -30,6 +30,8 @@
 import java.util.StringTokenizer;
 import java.util.logging.Logger;
 
+import javolution.util.FastMap;
+
 import net.sf.l2j.gameserver.util.FloodProtectorConfig;
 import net.sf.l2j.util.StringUtil;
 
@@ -485,6 +487,8 @@
  /** Buffs */
  public static boolean STORE_SKILL_COOLTIME;
  public static byte BUFFS_MAX_AMOUNT;
+ public static boolean ENABLE_MODIFY_SKILL_DURATION;
+ public static FastMap<Integer, Integer> SKILL_DURATION_LIST;
 
  // --------------------------------------------------
  // Server
@@ -1247,6 +1251,39 @@
 
  BUFFS_MAX_AMOUNT = Byte.parseByte(players.getProperty("MaxBuffsAmount", "20"));
  STORE_SKILL_COOLTIME = Boolean.parseBoolean(players.getProperty("StoreSkillCooltime", "true"));
+ ENABLE_MODIFY_SKILL_DURATION = Boolean.parseBoolean(players.getProperty("EnableModifySkillDuration", "false"));
+ if(ENABLE_MODIFY_SKILL_DURATION)
+ {
+ SKILL_DURATION_LIST = new FastMap<Integer, Integer>();
+
+ String[] propertySplit;
+ propertySplit = players.getProperty("SkillDurationList", "").split(";");
+
+ for(String skill : propertySplit)
+ {
+ String[] skillSplit = skill.split(",");
+ if(skillSplit.length != 2)
+ {
+ System.out.println("[SkillDurationList]: invalid config property -> SkillDurationList \"" + skill + "\"");
+ }
+ else
+ {
+ try
+ {
+ SKILL_DURATION_LIST.put(Integer.parseInt(skillSplit[0]), Integer.parseInt(skillSplit[1]));
+ }
+ catch(NumberFormatException nfe)
+ {
+ nfe.printStackTrace();
+
+ if(!skill.equals(""))
+ {
+ System.out.println("[SkillDurationList]: invalid config property -> SkillList \"" + skillSplit[0] + "\"" + skillSplit[1]);
+ }
+ }
+ }
+ }
+ }
  }
  catch (Exception e)
  {

CitarDocumentBase.java:

@@ -26,6 +26,7 @@
 import javolution.util.FastList;
 import javolution.util.FastMap;
 
+import net.sf.l2j.Config;
 import net.sf.l2j.gameserver.datatables.ItemTable;
 import net.sf.l2j.gameserver.model.ChanceCondition;
 import net.sf.l2j.gameserver.model.L2Skill;
@@ -239,7 +240,28 @@
  count = Integer.decode(getValue(attrs.getNamedItem("count").getNodeValue(), template));
 
  if (attrs.getNamedItem("time") != null)
+ {
  time = Integer.decode(getValue(attrs.getNamedItem("time").getNodeValue(), template));
+ if(Config.ENABLE_MODIFY_SKILL_DURATION)
+ {
+ if(Config.SKILL_DURATION_LIST.containsKey(((L2Skill) template).getId()))
+ {
+ if(((L2Skill) template).getLevel() < 100)
+ {
+ time = Config.SKILL_DURATION_LIST.get(((L2Skill) template).getId());
+ }
+ else if(((L2Skill) template).getLevel() >= 100 && ((L2Skill) template).getLevel() < 140)
+ {
+ time += Config.SKILL_DURATION_LIST.get(((L2Skill) template).getId());
+ }
+ else if(((L2Skill) template).getLevel() > 140)
+ {
+ time = Config.SKILL_DURATION_LIST.get(((L2Skill) template).getId());
+ }
+ }
+ }
+
+ }
  else if (((L2Skill) template).getBuffDuration() > 0)
  time = ((L2Skill) template).getBuffDuration() / 1000 / count;