Jump to content

[Share]Invincible Effect limit[Reworked]


DnR

Recommended Posts

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 :)

Link to comment
Share on other sites

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.



  • Posts

    • amigo como eu coloco pra mostra os icone enchant no inventory  vc pode da essa ajuda @ShooterLineage2 ?
    • 📢 𝐖𝐞 𝐚𝐫𝐞 𝐢𝐧 𝐛𝐞𝐭𝐚 𝐭𝐞𝐬𝐭, 𝐰𝐞 𝐰𝐢𝐥𝐥 𝐬𝐭𝐚𝐫𝐭 𝐨𝐧 𝐉𝐮𝐧𝐞 𝟐𝟎 𝐚𝐭 𝟏𝟖:𝟎𝟎 𝐦𝐨𝐫𝐞 𝐢𝐧𝐟𝐨𝐬 𝐢𝐧 https://l2bless.online/infos.html ⚔️ 𝗥𝗮𝘁𝗲𝘀: 𝗫𝗣 𝟐𝟎𝐗, 𝗔𝗱𝗲𝗻𝗮 𝟐𝟎𝐗, 𝗦𝗽𝗼𝗶𝗹 𝟐𝟎𝐗, 𝗗𝗿𝗼𝗽 𝟐𝟎𝐗, 💬 𝗠𝗮𝘅 𝗲𝗻𝗰𝗵𝗮𝗻𝘁 +𝟭𝟲 𝘄𝗶𝘁𝗵 𝟲𝟱% 𝗻𝗼𝗿𝗺𝗮𝗹 𝗮𝗻𝗱 𝟳𝟬% 𝗯𝗹𝗲𝘀𝘀𝗲𝗱, 👉 𝟳𝟬+ 𝗔𝘂𝘁𝗼 𝗲𝘃𝗲𝗻𝘁𝘀, 𝗖𝘂𝘀𝘁𝗼𝗺 𝗥𝗮𝗶𝗱𝘀, 𝟱𝟱 𝗻𝗲𝘄𝘀 𝗖𝗹𝗼𝗮𝗸𝘀, 🌍 𝗪𝗲𝗯𝗦𝗶𝘁𝗲: https://l2bless.online/
    • What unique features ? 
    • Welcome to SmurfsZone   Buy League of Legends accounts across all servers and jump straight into Ranked Games with amazing quality and support.   Why Choose SmurfsZone? 24/7 Instant Delivery: Get your full access LoL smurf account immediately. 100% Hand-Leveled: High-quality accounts leveled by hand. Versatile MMR Options: High MMR, Standard MMR, Fresh MMR (ARAMs), and Ranked accounts available. Valorant Accounts: Expand your gaming experience. Our Commitment to You: Unopened Loot: Customize your champion pool. Lifetime Warranty: Valid if you change the email, username, and password upon purchase. Password Changeable: Ensure your account's security. Full Recovery Information: Complete access to account recovery details. Unverified and Changeable Email: Easy to personalize and secure your account. Completely Unranked: Fresh start with no ranked history in any season. Responsive Customer Support: Our dedicated team is available to assist you 24/7.   Experience the best place to buy League of Legends accounts with exceptional quality and dedicated support. We're here for YOU!
    • Thanks! I'll take a second look and let you know if my implementation of the clearCircle() helps with the stuttering once I find time for some extensive testing.
  • Topics

×
×
  • Create New...