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

    • DISCORD : utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/hood-services https://campsite.bio/utchihaamkt  
    • Server Rates: » Xp 500x. » Sp 500x. » Aden 500x. » Drop 1x. » PartyXp 2x. » PartySp 2x. » Starting character level -61. Enchant rates: » Safe enchant +4. » Blessed and simple scrolls max enchant (+16). » Crystal scrolls max enchant (+20). » Simple enchant scrolls chance – 65%. » Blessed enchant scrolls chance – 100%. » Crystal enchant scrolls chance – 50% Augmentations: » Mid life stone skill chance – 5%. » High life stone skill chance – 10%. » Top life stone skill chance – 20%. » Augments 1+1 Unique features: » Main town – Giran » Automatic-Manual Potions. » Working 2 castle sieges. (Giran-Aden) » SPS cancel lasts 10 seconds and than buffs come back. » Stackable scrolls, lifestones, book of giants. » Unique pvp zone » More then 11 active raid bosses. » Wedding system. » Unique farming areas. » Npc skill enchanter. » Full npc buffer with auto buff. » Max count of buffs – 55. » Max subclasses – 4. » Free and no quest class change. » Free and no quest sub class. » Raid boss drop nobless item. » No weight limit. » Unique protection anti-hwy armor for archers/daggers etc. » Ingame password change. » Top pvp/pk/online ranks NPC. » Unique monsters & NPC. » Interlude retail skills. » Server up-time [24/7] [99]%. » Perfect class balance (all class can kill all class depending on players skill and setup knowledge,gear,augmentations). » Announcements on double kills triple kills etc. » Announcements on Grand Boss death , with the name of the killer as well as clan name of the player. » Information Npc in game with all servers infromations. Custom server gear : 1). Titanium Armor Lv.1 2). Epic Armor Lv.2 3). Epic Weapons-Kamikaze-Black S grade (Same Stats) 4). Demonic-Angelic Wings-Baium Hair-Custom Accessories (SameStats) 5). Custom Fighter/Mage tattoo Lv1-Lv2-Lv3 6). Shirt (STR,CON,INT +1) 7). Custom Shields Server Commands: .tvtjoin .tvtleave – Join or leave tvt event. .ctfjoin .ctfleave – Join or leave ctf event. .dmjoin .dmleave – Join of leave dm event. .online – current online players count. .repair – repairs stuck character in world. .menu – opens online menu panel. .exit – PVP zone exit in case you are bullied. .changepassword - Opens online menu then u can change ur password in game. .farm - Enable/disable autofarm Event system: » TVT event » CTF event » DM event » Tournament Event » Party Zone » Unique event shop. Olympiad game: » Retail olympiad game. » Competition period [1] week. » Olympiad start time [18:00] end [00:00] GMT+2. » New Heroes every Sunday.
    • Tomorrow grand opening lests go 🙂 
  • Topics

×
×
  • Create New...