Jump to content
  • 0

Special Time Buff for VIP


crazyshock

Question

Hi , I'm trying to set up a special time for players who are vip.

I've made the field in characters for VIP, and added in L2pcinstance.

Ok..

 

My problem is anytime you need to do the comparison and check if the player is or is not vip.

By the time I did this setting in Config.java, but I'm not getting through to see if the player.isVip == True, shows no error, but when you start the server would not start.

        ENABLE_VIP_DURATION = Boolean.parseBoolean(COSettings.getProperty("VipTempoCustom", "True"));
                                   
                                   
                                    L2PcInstance player = null;
         
                                    if (ENABLE_VIP_DURATION && player.isVip())
                                   {
                                       String[] propertySplit = COSettings.getProperty("SkillVipDuration", "").split(";");
                                        SKILL_DURACAO = new TIntIntHashMap(propertySplit.length);
                                        for (String skill : propertySplit)
                                       {
                                           String[] skillSplit = skill.split(",");
                                           if (skillSplit.length != 2)
                                             _log.warning(StringUtil.concat("[skillVipDuration]: invalid config property -> SkillDurationList \"", skill, "\""));
                                            else
                                            {
                                                try
                                                {
                                                    SKILL_DURACAO.put(Integer.parseInt(skillSplit[0]), Integer.parseInt(skillSplit[1]));
                                                }
                                                catch (NumberFormatException nfe)
                                                {
                                                    if (!skill.isEmpty())
                                                    {
                                                        _log.warning(StringUtil.concat("[skillVipDuration]: invalid config property -> SkillList \"", skillSplit[0], "\"", skillSplit[1]));
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    

Link to comment
Share on other sites

Recommended Posts

  • 0

you may change the buff effect time from com.l2jserver.gameserver.model.L2Effect.

To get the player instance using the buff, use getEffected() inside that class

Link to comment
Share on other sites

  • 0
Index: java/com/l2jserver/gameserver/model/L2Effect.java
===================================================================
--- java/com/l2jserver/gameserver/model/L2Effect.java	(revision 4536)
+++ java/com/l2jserver/gameserver/model/L2Effect.java	(working copy)
@@ -357,7 +357,13 @@
		if (_period > 0)
		{
			stopEffectTask();
-			final int initialDelay = Math.max((_period - _periodFirstTime) * 1000, 5);
+			int initialDelay = 0;
+			L2PcInstance plr = getEffected().getActingPlayer();
+			if(plr != null && plr.isVip() && getSkill().getSkillType() == L2SkillType.BUFF)
+				initialDelay = YOUR_VIP_BUFF_TIME_GOES_HERE;
+			else
+				initialDelay = Math.max((_period - _periodFirstTime) * 1000, 5);
+			
			if (_count > 1)
				_currentFuture = ThreadPoolManager.getInstance().scheduleEffectAtFixedRate(new EffectTask(), initialDelay, _period * 1000);
			else

Link to comment
Share on other sites

  • 0
Index: java/com/l2jserver/gameserver/model/L2Effect.java
===================================================================
--- java/com/l2jserver/gameserver/model/L2Effect.java	(revision 4536)
+++ java/com/l2jserver/gameserver/model/L2Effect.java	(working copy)
@@ -357,7 +357,13 @@
		if (_period > 0)
		{
			stopEffectTask();
-			final int initialDelay = Math.max((_period - _periodFirstTime) * 1000, 5);
+			int initialDelay = 0;
+			L2PcInstance plr = getEffected().getActingPlayer();
+			if(plr != null && plr.isVip() && getSkill().getSkillType() == L2SkillType.BUFF)
+				initialDelay = YOUR_VIP_BUFF_TIME_GOES_HERE;
+			else
+				initialDelay = Math.max((_period - _periodFirstTime) * 1000, 5);
+			
			if (_count > 1)
				_currentFuture = ThreadPoolManager.getInstance().scheduleEffectAtFixedRate(new EffectTask(), initialDelay, _period * 1000);
			else

Link to comment
Share on other sites

  • 0

 

thank you, one question in this case all the skills that are defined as a "buffer" will have more time right?

 

in this case, there is a way I can define the skills that have changed over time?

 

 

THankkk BIG!

Link to comment
Share on other sites

  • 0

 

thank you, one question in this case all the skills that are defined as a "buffer" will have more time right?

 

in this case, there is a way I can define the skills that have changed over time?

 

 

THankkk BIG!

Link to comment
Share on other sites

  • 0

1) I corrected the code i posted, since before, it would change the time of all effects, with the new code just buffs time are changed

2) Didnt understand your question

Link to comment
Share on other sites

  • 0

1) I corrected the code i posted, since before, it would change the time of all effects, with the new code just buffs time are changed

2) Didnt understand your question

Link to comment
Share on other sites

  • 0

Index: java/com/l2jserver/gameserver/model/L2Effect.java
===================================================================
--- java/com/l2jserver/gameserver/model/L2Effect.java	(revision 4536)
+++ java/com/l2jserver/gameserver/model/L2Effect.java	(working copy)
@@ -357,7 +357,13 @@
		if (_period > 0)
		{
			stopEffectTask();
-			final int initialDelay = Math.max((_period - _periodFirstTime) * 1000, 5);
+			final int initialDelay = 0;
+			final L2PcInstance plr = getEffected().getActingPlayer();
+			if(plr != null && plr.isVip() && getSkill().canModifyTime())
+				initialDelay = YOUR_VIP_BUFF_TIME_IN_MILLIS_GOES_HERE;
+			else
+				initialDelay = Math.max((_period - _periodFirstTime) * 1000, 5);
+			
			if (_count > 1)
				_currentFuture = ThreadPoolManager.getInstance().scheduleEffectAtFixedRate(new EffectTask(), initialDelay, _period * 1000);
			else
Index: java/com/l2jserver/gameserver/model/L2Skill.java
===================================================================
--- java/com/l2jserver/gameserver/model/L2Skill.java	(revision 4536)
+++ java/com/l2jserver/gameserver/model/L2Skill.java	(working copy)
@@ -291,8 +291,10 @@
	private final boolean _excludedFromCheck;
	private final boolean _simultaneousCast;

-	private L2ExtractableSkill _extractableItems = null;;
+	private L2ExtractableSkill _extractableItems = null;

+	private boolean _canModifyTime = false;
+	
	protected L2Skill(StatsSet set)
	{
		_id = set.getInteger("skill_id");
@@ -532,6 +534,8 @@

			_extractableItems = parseExtractableSkill(_id, _level, capsuled_items);
		}
+		
+		_canModifyTime = set.getBool("canModifyTime", false);
	}

	public abstract void useSkill(L2Character caster, L2Object[] targets);
@@ -541,6 +545,11 @@
		return _isPotion;
	}

+	public final boolean canModifyTime()
+	{
+		return _canModifyTime;
+	}
+	
	public final int getArmorsAllowed()
	{
		return _armorsAllowed;

 

In those skill where you would like to modify the time based if the player is vip or not, you would have to add

 

<set name="canModifyTime" val="true" />

Link to comment
Share on other sites

  • 0

Index: java/com/l2jserver/gameserver/model/L2Effect.java
===================================================================
--- java/com/l2jserver/gameserver/model/L2Effect.java	(revision 4536)
+++ java/com/l2jserver/gameserver/model/L2Effect.java	(working copy)
@@ -357,7 +357,13 @@
		if (_period > 0)
		{
			stopEffectTask();
-			final int initialDelay = Math.max((_period - _periodFirstTime) * 1000, 5);
+			final int initialDelay = 0;
+			final L2PcInstance plr = getEffected().getActingPlayer();
+			if(plr != null && plr.isVip() && getSkill().canModifyTime())
+				initialDelay = YOUR_VIP_BUFF_TIME_IN_MILLIS_GOES_HERE;
+			else
+				initialDelay = Math.max((_period - _periodFirstTime) * 1000, 5);
+			
			if (_count > 1)
				_currentFuture = ThreadPoolManager.getInstance().scheduleEffectAtFixedRate(new EffectTask(), initialDelay, _period * 1000);
			else
Index: java/com/l2jserver/gameserver/model/L2Skill.java
===================================================================
--- java/com/l2jserver/gameserver/model/L2Skill.java	(revision 4536)
+++ java/com/l2jserver/gameserver/model/L2Skill.java	(working copy)
@@ -291,8 +291,10 @@
	private final boolean _excludedFromCheck;
	private final boolean _simultaneousCast;

-	private L2ExtractableSkill _extractableItems = null;;
+	private L2ExtractableSkill _extractableItems = null;

+	private boolean _canModifyTime = false;
+	
	protected L2Skill(StatsSet set)
	{
		_id = set.getInteger("skill_id");
@@ -532,6 +534,8 @@

			_extractableItems = parseExtractableSkill(_id, _level, capsuled_items);
		}
+		
+		_canModifyTime = set.getBool("canModifyTime", false);
	}

	public abstract void useSkill(L2Character caster, L2Object[] targets);
@@ -541,6 +545,11 @@
		return _isPotion;
	}

+	public final boolean canModifyTime()
+	{
+		return _canModifyTime;
+	}
+	
	public final int getArmorsAllowed()
	{
		return _armorsAllowed;

 

In those skill where you would like to modify the time based if the player is vip or not, you would have to add

 

<set name="canModifyTime" val="true" />

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock