Jump to content

Recommended Posts

Posted

Hello to all MxC users.

 

this forum really helped me so much about l2j and learn to code in java :)

 

thanks  everyone for share and is why I want to give

a CHRISTMAS gift  ;D :

 

a small patch but is useful for many new and old l2j developers

 

I took from l2joneo interlude version and I create a patch to L2J last Interlude Revision

 

so? leech me:

Index: java/config/l2jmods.properties
===================================================================
--- java/config/l2jmods.properties	(revision 4430)
+++ java/config/l2jmods.properties	(working copy)
@@ -132,3 +132,16 @@
# ex.: 1;2;3;4;5;6
# no ";" at the start or end
TvTEventDoorsCloseOpenOnStartEnd =
+
+#---------------------------------------------------------------
+# Skill Customizations                                         -
+#---------------------------------------------------------------
+# Enable to modify skill duration data
+EnableModifySkillDuration = false
+# Skill duration list 
+# Format : skillid,newtime;skillid,newtime....
+# Example : this enable 1h(3600) duration for songs
+# 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
+SkillDurationList = 
\ No newline at end of file
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java	(revision 4430)
+++ java/net/sf/l2j/Config.java	(working copy)
@@ -25,10 +25,12 @@
import java.io.OutputStream;
import java.math.BigInteger;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import java.util.logging.Logger;

import javolution.util.FastList;
+import javolution.util.FastMap;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;

/**
@@ -882,7 +884,12 @@
    public static boolean L2JMOD_WEDDING_FORMALWEAR;
    public static int L2JMOD_WEDDING_DIVORCE_COSTS;

-    // Packet information
+    /** Enable skill duration mod */
+	public static boolean ENABLE_MODIFY_SKILL_DURATION;
+	public static Map<Integer, Integer> SKILL_DURATION_LIST;
+	public static int MODIFIED_SKILL_COUNT;
+	
+	// Packet information
    /** Count the amount of packets per minute ? */
    public static boolean  COUNT_PACKETS           = false;
    /** Dump packet count ? */
@@ -1858,7 +1865,37 @@
                L2JMOD_WEDDING_SAMESEX                  = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingAllowSameSex", "False"));
                L2JMOD_WEDDING_FORMALWEAR               = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingFormalWear", "True"));
                L2JMOD_WEDDING_DIVORCE_COSTS            = Integer.parseInt(L2JModSettings.getProperty("WeddingDivorceCosts", "20"));
-
+                ENABLE_MODIFY_SKILL_DURATION = Boolean.valueOf(L2JModSettings.getProperty("EnableModifySkillDuration", "false"));
+				
+                if (ENABLE_MODIFY_SKILL_DURATION)
+				{
+					SKILL_DURATION_LIST = new FastMap<Integer, Integer>();
+					String[] propertySplit;
+					propertySplit = L2JModSettings.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.valueOf(skillSplit[0]), Integer.valueOf(skillSplit[1]));
+							}
+							catch (NumberFormatException nfe)
+							{
+								if (!skill.equals(""))
+								{
+									System.out.println("[skillDurationList]: invalid config property -> SkillList \"" + skillSplit[0] + "\"" + skillSplit[1]);
+								}
+							}
+						}
+					}
+				}
+				
                if (TVT_EVENT_PARTICIPATION_NPC_ID == 0)
                {
                    TVT_EVENT_ENABLED = false;
Index: java/net/sf/l2j/gameserver/skills/DocumentBase.java
===================================================================
--- java/net/sf/l2j/gameserver/skills/DocumentBase.java	(revision 4430)
+++ java/net/sf/l2j/gameserver/skills/DocumentBase.java	(working copy)
@@ -30,6 +30,7 @@
import javolution.text.TextBuilder;
import javolution.util.FastList;
import javolution.util.FastMap;
+import net.sf.l2j.Config;
import net.sf.l2j.gameserver.datatables.SkillTable;
import net.sf.l2j.gameserver.model.L2Character;
import net.sf.l2j.gameserver.model.L2Skill;
@@ -206,6 +207,29 @@
        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());
+					}
+					if (Config.DEBUG)
+					{
+						_log.info("*** Skill " + ((L2Skill) template).getName() + " (" + ((L2Skill) template).getLevel() + ") changed duration to " + time + " seconds.");
+					}
+					Config.MODIFIED_SKILL_COUNT += 1;
+				}
+			}
        }
        else time = ((L2Skill) template).getBuffDuration() / 1000 / count;
        boolean self = false;

 

Credits: L2JOneo and Me (DarknightMarE) for stolen or borrow and test the code  8)

 

Is working 100% I tested myself.

 

MERRY CHRISTMAS and HAPPY NEW YEAR

 

Posted

So your Christmas gift to the community is a leeched code that exists in every L2JPack?

sorry coyote, I only want help the new interlude developers with that share.

maybe to other clean l2joff interlude pack need it ;)

 

merry christmas brother!

Posted

Credits: L2JOneo and Me (DarknightMarE) for stolen or borrow and test the code  8)

Lol, credits for you  ? :D Are you kidding me ? :D You can't steal java code, because of GNU license :D
Posted

Lol, credits for you  ? :D Are you kidding me ? :D You can't steal java code, because of GNU license :D

sorry I mean leech that java code ;) I know is GNU lol!

 

merry christmas :)

Posted

stop saying merry xmas, we've read it. ok.

 

man, this is not a gift, made by you. you just c/p a java code from 1 project to 1 other. if you want to make a real christmas gift, it's gotta be something yours, not leaching from projects. or just create sth, like cobra did, make a patch with lot of shares or fixes in it... i hope you get me ;)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...