Jump to content

Recommended Posts

Posted (edited)

Some time ago i helped someone with disabling shot spells. So, the next code it's more elegant solution than my previous guide. Example of course will for aCis but adapt for any other pack not a problem, i guess.

 

For broadcasting all shot spells except soulshot uses broadcastPacketInRadius method into Creature.java. So, then we changing him.

 

	public void broadcastPacketInRadius(GameServerPacket packet, int radius)
	{
		if (radius < 0)
			radius = 600;
		
		// Check if packet is MagicSkillUse.
		final boolean isMagicSkillUse = (packet instanceof MagicSkillUse);
		for (final Player player : getKnownTypeInRadius(Player.class, radius))
		{
			// Check if magicSkillUse contains Shot's skill and check if player disabled shot spells.
			if (isMagicSkillUse && SkillTable.isShotSkill(((MagicSkillUse) packet).getSkillId()) && player.getGameSettings().isBlockedShotEffect())
				continue;
			
			player.sendPacket(packet);
		}
	}

 

Next one step we add fix for soulshot spells broadcasting via broadcastPacket() method.

 

	public void broadcastPacket(GameServerPacket packet, boolean selfToo)
	{
		final boolean isAttackWithShots = (packet instanceof Attack) && ((Attack) packet).soulshot;
		
		Attack attackPacket = null;
		if (isAttackWithShots)
		{
			attackPacket = new Attack(((Attack) packet).getAttacker(), false, 0);
			final HitHolder[] holder = ((Attack) packet).getHits();
			final HitHolder[] newHolder = new HitHolder[holder.length];
			
			// This magic need for cleanup FLAG bit mask from SS usage.
			for (int i = 0; i < newHolder.length; i++)
				newHolder[i] = new HitHolder(holder[i]._target, holder[i]._damage, holder[i]._crit, holder[i]._miss, holder[i]._shld);
			
			// Generating FLAG bit mast anew.
			attackPacket.processHits(newHolder);
		}
		
		for (final Player player : getKnownType(Player.class))
		{
			if (isAttackWithShots && player.getGameSettings().isBlockedShotEffect() && attackPacket != null)
			{
				player.sendPacket(attackPacket);
				continue;
			}
			
			player.sendPacket(packet);
		}
	}

 

Next one step we add return methods for some fields in Attack packet. Don't forget change field INT to Creature for storing attaker as object, and not object ID. And add changes into constuct method also.

 

	public Creature getAttacker()
	{
		return _attacker;
	}
	
	public HitHolder[] getHits()
	{
		return _hits;
	}

 

Next one step add method inside MagicSkillUse packet for getting skill id of sendable skill.

 

	public int getSkillId()
	{
		return _skillId;
	}

 

Next one step add into SkillTable array with shot's skill IDs and method for checking them.

 

	private static final int[] _shotSkillsId =
	{
		2008,
		2009,
		2033,
		2039,
		2047,
		2061,
		2150,
		2151,
		2152,
		2153,
		2154,
		2155,
		2156,
		2157,
		2158,
		2159,
		2160,
		2161,
		2162,
		2163,
		2164,
		2181,
		2182,
		2183,
		2184,
		2185,
		2186
	};
	
	public static boolean isShotSkill(int skillId)
	{
		for (int id : _shotSkillsId)
			if (id == skillId)
				return true;
			
		return false;
	}

 

Next one step is addition trigger option for store player configuration as i'm uses (player.getGameSettings().isBlockedShotEffect()). I uses separated GameSetting instance for all player's settings. You can make directly the new field inside Player.java and use like player.isBlockedShotEffect().

 

That's all what you need. This code disable all spells (SoulShot, SpritShot, Blessed SpiritShot, Beats Shot, Fishing Shot) from other objects except your spells. If you need add own servitor spell seeing then just add new return method in MagicSkillUse for get caster object IOD and thek him with your servitor object ID.

 

 

Edited by Rootware
Added SoulShot usage fix.
Posted
2 hours ago, Rootware said:

Some time ago i helped someone with disabling shot spells. So, the next code it's more elegant solution than my previous guide. Example of course will for aCis but adapt for any other pack not a problem, i guess.

 

AFor broadcasting shot spelss uses broadcastPacketInRadius method into Creature.java. So, then we changing him.

 


	public void broadcastPacketInRadius(GameServerPacket packet, int radius)
	{
		if (radius < 0)
			radius = 600;
		
		// Check if packet is MagicSkillUse.
		final boolean isMagicSkillUse = (packet instanceof MagicSkillUse);
		for (final Player player : getKnownTypeInRadius(Player.class, radius))
		{
			// Check if magicSkillUse contains Shot's skill and check if player disabled shot spells.
			if (isMagicSkillUse && SkillTable.isShotSkill(((MagicSkillUse) packet).getSkillId()) && player.getGameSettings().isBlockedShotEffect())
				continue;
			
			player.sendPacket(packet);
		}
	}

 

Next one step add method inside MagicSkillUse packet for getting skill id of sendable skill.

 


	public int getSkillId()
	{
		return _skillId;
	}

 

Next one step add into SkillTable array with shot's skill IDs and method for checking them.

 


	private static final int[] _shotSkillsId =
	{
		2008,
		2009,
		2033,
		2039,
		2047,
		2061,
		2150,
		2151,
		2152,
		2153,
		2154,
		2155,
		2156,
		2157,
		2158,
		2159,
		2160,
		2161,
		2162,
		2163,
		2164,
		2181,
		2182,
		2183,
		2184,
		2185,
		2186
	};
	
	public static boolean isShotSkill(int skillId)
	{
		for (int id : _shotSkillsId)
			if (id == skillId)
				return true;
			
		return false;
	}

 

Next one step is addition trigger option for store player configuration as i'm uses (player.getGameSettings().isBlockedShotEffect()). I uses separated GameSetting instance for all player's settings. You can make directly the new field inside Player.java and use like player.isBlockedShotEffect().

 

That's all what you need. This code disable all spells (SoulShot, SpritShot, Blessed SpiritShot, Beats Shot, Fishing Shot) from other objects except your spells. If you need add own servitor spell seeing then just add new return method in MagicSkillUse for get caster object IOD and thek him with your servitor object ID.

 

 

 

I created this diff to facilitate instead of creating a new variable to block I added it to the Block List, disregard if it doesn't help.

 

Block Effect - Pastebin.com

Posted
6 minutes ago, Williams said:

 

I created this diff to facilitate instead of creating a new variable to block I added it to the Block List, disregard if it doesn't help.

 

Block Effect - Pastebin.com

Your diff is outdated. Was added soulshot fix in Attack packet.

Posted (edited)
5 minutes ago, Rootware said:

Seu diferencial está desatualizado. Foi adicionado soulshot fix no pacote de ataque.

sorry I didn't see all the code I will redo the diff

Edited by Williams
Posted
2 minutes ago, Williams said:

sorry I didn't see all the code I will redo the diff

I think that pointles to make diff because not all parts of code completed. I meant the trigger for skipping spells.

Posted (edited)

when delete soulshot.int in system folder off it too :) or cant edit it... but GJ :)

Edited by KabLe21

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • L2Virus the one who buyed those files from me.
    • Hi ️ Are you a supplier or do you have your own modem and are looking for a place to sell numbers?  SMS.PRO - The best option for selling your numbers  You choose the selling price yourself  Sale option: public (to everyone) or private (you choose who you want to sell to)  Everything works automatically  The simplest possible connection  Visit the website SMS.PRO and start selling your numbers.  Support @alismsorg_bot
    • Good luck to anyone playing on this server . Kamael items are bugged ( stats are insane ) Commands not working properly ( .getreward for example  ... gives u free reward without voting ). When i had those files , i fixed most of the stuff .   Every 2-3 years , he closes the server because players report bugs to him about items , he dont know how to fix then he repeating the process again https://ibb.co/Fkv7y9hJ https://ibb.co/fdYP2bVQ https://ibb.co/sp1f8C61 https://ibb.co/CKZnCgL7 https://ibb.co/Z6GktJgP  
    • Hello and welcome Server started 2026-01-05 Web site: https://l2dragonlands.eu Discrod: https://discord.gg/ngQUY8FB8G Rates >Xp x500 >Sp x500 >Drop x25 >Spoil x25 Enchant rates: Safe/max enchant +500  Blessed and simple scrolls max enchant (+200)  Enchant maneger to make +500.  In server items are progresed in tiers. Weapons: Starter > Vesper > Vorpal > Elegia > Ferrum. Armors: Starter > Moirai > Vesper > Vesper Noble > Vorpal > Elegia > Scarlet. Jewels: Starter > Vesper > Vorpal > Elegia > Ferrum. Cloaks: Pearl White > Pitch Black > Frintezza > Class Cloka > Hero > Scarlet. Acessories: Goblin Circlet 1/2lvl > Half Mask Mage 1/2lvl > Half Mask Fighter 1/2lvl > Flame of valakas > Gem Mask > Ferrum Helmet. Belt: Mithril Belt > Vitality Belt. Badges: For fighter and mage from 1lvl to 6lvl upgraded in order. Bracelets: Mithril > Shiny Fighter/Mage > 1/2lvl custom talismans in bracelest. Agathion: 7 tiers upgrade in order eatch one. Clan item shop/ New weapon Spadona upgradeble from 1lvl till 85lvl. Farm zones in order: >Giran Harbor > WasteLand > Gateway > Valley of Saints > Chromatic > Ruins of Despair > Soul Harbor > Dragon Valley. >LvL up zone >PvP zone Custom instance zone. Custom buff maneger it will grand big boost in stats. Lotery maneger to gamble. Extra features ALT+B: >Events  >Rankings  >Clan  >RB Status  >Updates and other Auto Event system: >Team VS Team event - Auto event  >Capture The Flag - Auto event Olympiad: >Retail olympiad game  >Competition period [2] week  >Olympiad start time [18:00] end [00:00]  >Maximum enchant in the Olympiad is +10, not custom items in olympiada only normal ones from shop.
    • L2 VOID - ADVERTISING BANNER   L2 FURY - ANIMATED BANNER   L2 HEROIC - ANIMATED BANNER   L2 WEED - ANIMATED BANNER   L2 REFORGE - ANIMATED LOGO   L2 WARZONE - ANIMATED LOGO   L2 ACME - SPLASH SCREEN   L2 DRUGS - ANIMATED BANNER   L2 GOLD - ADVERTISING BANNER   L2 AARON - ADVERTISING BANNER  
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..

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