Jump to content

Recommended Posts

Posted

Lineage II Gracia Part II

 

Once the "Invincible" skill effect is applied, it cannot be re-applied for a certain amount of time. Related skills include: Celestial Shield, Flames of Invincibility, Sonic Barrier, Force Barrier, Servitor Barrier, Sublime Self-Sacrifice.

 

Reworked

I decided to implement this small feature because it prevents players from using the one barrier after the other.

The default penalty time is 10 minutes.

I hope its gonna be useful for you people.

 

First of all,create a record in Characters table using navicat.

The record must be like this.

 

Characters

Name                 Type           Length             Decimals           Allow Null
isInvulLimited       tinyint            3                      0                 (untick this)

 

L2PcInstance.java

   // Character Character SQL String Definitions:
   private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,obj_Id,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,pvpkills,pkkills,clanid,race,classid,
-deletetime,cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,newbie,nobless,power_grade,last_recom_date) --values -------(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+deletetime,cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,newbie,nobless,power_grade,isInvulLimited,last_recom_date) +values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprenti
-ce=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=? WHERE obj_Id=?";
+ce=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,isInvulLimited=?,death_penalty_level=? WHERE obj_Id=?";
   private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, 
-varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level FROM characters WHERE obj_Id=?";
+varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,isInvulLimited,death_penalty_level FROM characters WHERE obj_Id=?";

                       statement.setInt(28, isIn7sDungeon() ? 1 : 0);
		statement.setInt(29, getClanPrivileges());
		statement.setInt(30, getWantsPeace());
		statement.setInt(31, getBaseClass());
		statement.setInt(32, getNewbie());
		statement.setInt(33, isNoble() ? 1 :0);
		statement.setLong(34, 0);
-                       statement.setLong(35,System.currentTimeMillis());
+                       statement.setInt(35, isInvulLimited() ? 1 : 0);
+			statement.setLong(36,System.currentTimeMillis());

               if (player.isInJail())
               	player.setJailTimer(rset.getLong("jail_timer"));
               else
               	player.setJailTimer(0);

               CursedWeaponsManager.getInstance().checkPlayer(player);

               player.setAllianceWithVarkaKetra(rset.getInt("varka_ketra_ally"));

+               player.startInvulPenalty(rset.getInt("isInvulLimited") == 1);

               player.setDeathPenaltyBuffLevel(rset.getInt("death_penalty_level"));

                       statement.setLong(45,getSponsor());
                       statement.setInt(46, getAllianceWithVarkaKetra());
		statement.setLong(47, getClanJoinExpiryTime());
		statement.setLong(48, getClanCreateExpiryTime());
		statement.setString(49, getName());
-                       statement.setLong(50, getDeathPenaltyBuffLevel());
-                       statement.setInt(51, getObjectId());
+                       statement.setInt(50, isInvulLimited() ? 1 : 0);
+			statement.setLong(51, getDeathPenaltyBuffLevel());
+                       statement.setInt(52, getObjectId());

 

L2Character.java

 private boolean _isConfused                             = false; // Attack anyone randomly

 private boolean _isFakeDeath                            = false; // Fake death
 private boolean _isFlying                               = false; //Is flying Wyvern?

+ private boolean _isInvulLimited                         = false;
 private boolean _isMuted                                = false; // Cannot use magic
 private boolean _isMagicImmune                          = false;

   public final void stopPhysicalAttackMuted(L2Effect effect)
   {
      if (effect == null)
          stopEffects(L2Effect.EffectType.PHYSICAL_ATTACK_MUTE);
      else
           removeEffect(effect);

      setIsPhysicalAttackMuted(false);
   }
+
+   public boolean isInvulLimited()
+   {
+      return _isInvulLimited;	
+   }
+
+   public final void startInvulPenalty(boolean value)
+   {
+      _isInvulLimited = value;
+      if (isInvulLimited())
+      {
+             long limit = 600000;
+             ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
+             {
+                     @Override
+	              public void run()
+                     {
+                             _isInvulLimited = false;
+                             sendMessage("The Invincible skill effect penalty has been removed.");
+                     }
+             }, limit);
+      }
+   }
}

 

L2Skill.java

   public final L2Effect[] getEffects(L2Character effector, L2Character effected)
   {
       if (isPassive()) return _emptyEffectSet;

       if (_effectTemplates == null)
       	return _emptyEffectSet;

+       if (effected.isInvulLimited() && (getId() == 1505 || getId() == 1496 || getId() == 1427 || getId() == 1418 || getId() == 837 || getId() == 443 || getId() == 442))
+               return _emptyEffectSet;

 

EffectInvincible.java

package net.sf.l2j.gameserver.skills.effects;

import net.sf.l2j.gameserver.model.L2Effect;
+import net.sf.l2j.gameserver.serverpackets.SystemMessage;
import net.sf.l2j.gameserver.skills.Env;

public class EffectInvincible extends L2Effect
{
public EffectInvincible(Env env, EffectTemplate template)
{
	super(env, template);
}

@Override
public EffectType getEffectType()
{
	return L2Effect.EffectType.INVINCIBLE;
}

@Override
public void onStart()
       {
	getEffected().setIsInvul(true);
+               getEffected().startInvulPenalty(true);
+               getEffected().sendMessage("Once the Invincible skill effect is applied, it cannot be re-applied for a certain amount of time.");

       }

 

*Note: For Interlude,you gotta remove skill ids 1496,1505 and 837.

 

Thank you for using it if you ever use it :)

Posted

Make a patch better , good work.

 

I currently face some errors with patch creation in my eclipse,

but as soon as i create the patch,i will post it here :)

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...