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

    • Wtb full account or items on l2 warland 
    • https://discord.gg/k53SZ4DM5z   Interlude Client L2Old Pride is a L2 Pride Interlude Based All functional skills (Not archer/mage server)   L2Old Pride Helper (Works like Woundrous Cubic) https://imgur.com/iYqmHQY Farm Zones: Cave of Trials and Elven Ruins (Chaotic) Olympiads: Every 15 days Various Cosmetic Items https://imgur.com/uoeU6Jw https://imgur.com/oCS2Zed PvP Zone: Gludin Village (No-Parties, Disguised) More than 100 new Skills https://imgur.com/6RaPsQV Max Level: 90 https://imgur.com/z4QVJKZ Gaining Xp by PVP https://imgur.com/LRqI31T Purchasable S-grade items +10 or +20 with random chance to enchant +5 Purchasable Custom Items Depends on Tier Mysterious Merchants https://imgur.com/2ZwWyPH Auto Enchant Via PvPing (with low chance) Custom Raid Bosses Siege Every Weekend (Aden, Rune, Giran) Autofarm / Drop Tracker https://imgur.com/Vz3rha6   RATES: • Start Level 80 • Max level 90  • EXP: 5000x • SP: 5000x • ADENA 6000x   ENCHANT: • Maximum enchant S Grade Items: +35. • Maximum enchant Unique/Epic Items: +25. • Maximum enchant Legendary Items: +18. • Maximum enchant Relic Items: +14. •Descriptions for rate at scrolls!   EVENTS: • TEAMS vs TEAMS • CAPTURE THE FLAG • DOMINATION • DEATH MATCH • DICE OF DEATH • CHAOTIC ZONE   OTHERS: Assistance system in pvps. Where support classes are enabled to receive pvp with a low chance, for supporting a party member during pvp. •  /sit to regen HP/MP/CP • Custom Shots Glows https://imgur.com/FLK0DmR • Achievements System • Daily Tasks System • Monthly Tasks System   CUSTOM ARMORS SETS Dread Armor/Titanium Armor Pride Armor Rykros Armor https://imgur.com/SPxoQp1   CUSTOM WEAPONS SETS Unique Weapons Pride Weapons Legendary Weapons Relic Weapons https://imgur.com/kOHNXhS   CUSTOM ACCESSORIES Standard Superior Legendary https://imgur.com/zPqNiiX   CUSTOM JEWELS/TATTOO Legendary Nightmarish https://imgur.com/gcqS28P There are many more features that you will only understand by playing and following. Beta testing server is currently open. Follow us on our discord and join our server to test it.
    • You shouldn't use rev 382, not sure why everyone keep using that.   I don't make changesets for fun, I don't make new revisions for nothing.   Follow the revisions.
    • Your issue isn't related to geoengine at all (as always), rev 410 got improved water movement management.
  • Topics

×
×
  • 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