Jump to content

Recommended Posts

Posted (edited)

Hello here is a pvp auto enchant code for acis when you kill some you have a chance to get a random item from yours by +1 

 

http://prntscr.com/i451wk

 

go to

net/sf/l2j/gameserver/model/actor/instance/player.java

 

find this 

protected int _classIndex;

and put this     

/** Pvp enchant System **/
    private int rewardConsecutiveKillCount = 0;

 

like that

	protected int _classIndex;
	
	/** Pvp enchant System **/
	private int rewardConsecutiveKillCount = 0;

next find this 

	// Add PvP point to attacker.
				setPvpKills(getPvpKills() + 1);

and paste this

rewardConsecutiveKillCount++;

like that  

	// Add PvP point to attacker.
  setPvpKills(getPvpKills() + 1);
  rewardConsecutiveKillCount++;

and under this

 rewardConsecutiveKillCount++;

paste all this 

final ItemInstance pvpwep = getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
				final ItemInstance pvphead = getInventory().getPaperdollItem(Inventory.PAPERDOLL_HEAD);
				final ItemInstance pvpgloves = getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES);
				final ItemInstance pvpchest = getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST);
				final ItemInstance pvplegs = getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS);
				final ItemInstance pvpfeet = getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET);
				final ItemInstance pvpneck = getInventory().getPaperdollItem(Inventory.PAPERDOLL_NECK);
				final ItemInstance pvplf = getInventory().getPaperdollItem(Inventory.PAPERDOLL_LFINGER);
				final ItemInstance pvprf = getInventory().getPaperdollItem(Inventory.PAPERDOLL_RFINGER);
				
				if (rewardConsecutiveKillCount >= Config.PVP_COUNT_TILL_ENCHANTMENT && Config.ENABLE_PVP_ENCHANTMENT)
				{
					switch (Rnd.get(9))
					{
						case 0:
						{
							pvpwep.setEnchantLevel(pvpwep.getEnchantLevel() + 1);
							sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) + "has been enchanted by +1 due to your pvp kills");
							rewardConsecutiveKillCount = 0;
							break;
						}
						case 1:
						{
							pvphead.setEnchantLevel(pvphead.getEnchantLevel() + 1);
							sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_HEAD) + "has been enchanted by +1 due to your pvp kills");
							rewardConsecutiveKillCount = 0;
							break;
						}
						case 2:
						{
							pvpgloves.setEnchantLevel(pvpgloves.getEnchantLevel() + 1);
							sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES) + "has been enchanted by +1 due to your pvp kills");
							rewardConsecutiveKillCount = 0;
							break;
						}
						case 3:
						{
							pvpchest.setEnchantLevel(pvpchest.getEnchantLevel() + 1);
							sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST) + "has been enchanted by +1 due to your pvp kills");
							rewardConsecutiveKillCount = 0;
							break;
						}
						case 4:
						{
							pvplegs.setEnchantLevel(pvplegs.getEnchantLevel() + 1);
							sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS) + "has been enchanted by +1 due to your pvp kills");
							rewardConsecutiveKillCount = 0;
							break;
						}
						case 5:
						{
							pvpfeet.setEnchantLevel(pvpfeet.getEnchantLevel() + 1);
							sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET) + "has been enchanted by +1 due to your pvp kills");
							rewardConsecutiveKillCount = 0;
							break;
						}
						case 6:
						{
							pvpneck.setEnchantLevel(pvpneck.getEnchantLevel() + 1);
							sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_NECK) + "has been enchanted by +1 due to your pvp kills");
							rewardConsecutiveKillCount = 0;
							break;
						}
						case 7:
						{
							pvplf.setEnchantLevel(pvplf.getEnchantLevel() + 1);
							sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_LFINGER) + "has been enchanted by +1 due to your pvp kills");
							rewardConsecutiveKillCount = 0;
							break;
						}
						case 8:
						{
							pvprf.setEnchantLevel(pvprf.getEnchantLevel() + 1);
							sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_RFINGER) + "has been enchanted by +1 due to your pvp kills");
							rewardConsecutiveKillCount = 0;
							break;
						}
					}
				}

go to net/sf/l2j

 

find this    

public static boolean ALT_GAME_SUBCLASS_WITHOUT_QUESTS;

and paste this like that 

public static boolean ALT_GAME_SUBCLASS_WITHOUT_QUESTS;

    /** PvP auto enchant system */
    public static boolean ENABLE_PVP_ENCHANTMENT;
    public static int PVP_COUNT_TILL_ENCHANTMENT;

find this 

ALT_GAME_SUBCLASS_WITHOUT_QUESTS = players.getProperty("AltSubClassWithoutQuests", false);

and put this like that 

ALT_GAME_SUBCLASS_WITHOUT_QUESTS = players.getProperty("AltSubClassWithoutQuests", false);

ENABLE_PVP_ENCHANTMENT = players.getProperty("EnablePvpEnchantSystem", false);
        PVP_COUNT_TILL_ENCHANTMENT = players.getProperty("PvpCountTillEnchanment", 20);

go to config/players.properties

#=================================#
#==  by thelwhelprepaidia ==#
#==  Pvp Enchant System ==#
#=================================#
#By enabling this then every X pvp
#in a row the player will get randomly
#a part of his armor,weapon or jewel that
#is currently equiped automatically enchanted
#To enable the system set True below
EnablePvpEnchantSystem = True
#Every how many kills you want the chars to be
#awared with +1?
PvpCountTillEnchanment = 20

And you are done.

 

credits Elfocrash

Edited by ThelwHelpRePaidia
  • Like 1
Posted (edited)

good share but missing the "chance" of what you describe.

the description is first xx kills enchant 100% a random item that player wears.

also i am sure its already shared here before i think it needs credits

Edited by Nightw0lf
Posted (edited)

we all had to start from somewhere no shame on that

just enclose all the big code inside of this and it will be activated with 50% chance

if (Rnd.get(100) > 50){
  //paste the code here
}
Edited by Nightw0lf
Posted (edited)

A nice-different feature :) Good to bring back some old shares.

About the code use elfo,nightwolf update will be better ;)

also you can add 1 null check in elfos code for the item . something like that

 

L2ItemInstance itemToEnchant = activeChar.getInventory().getPaperdollItem(randomInventorySlot);
+if (itemToEnchant == null)
+  return;
itemToEnchant.setEnchantLevel(itemToEnchant.getEnchantLevel() + 1);

and update the line

sendMessage("Your " + ItemTable.getInstance().getTemplate(itemToEnchant.getItemId()).getName() + " has been enchanted by +1 due to your pvp kills");

to 

sendMessage("Your " + itemToEnchant.getItem().getName() + " has been enchanted by +1 due to your pvp kills");

 

Edited by melron
Posted

thanks for share nice code :) 

On 1/24/2018 at 3:22 PM, .Elfocrash said:

I was already shared mate. I think it could be found in the old l2jfrozen forum.

den uparxi old forum l2jfrozen exasan ta files lene. xD etsi diavasa toulaxiston

Posted
18 minutes ago, .Elfocrash said:

[GR] Exeis valei to readability kai vasika coding practices sta tessera kai ta ksekoliazeis, alla profanws einai private source opote klain.

 

Ontopic, ye pretty much simple as that.

 

mono egw exw to source

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

    • For the first time in thousands of posts I've read on this forum, I’ve actually found a message that is enriching on both a personal and professional level. I’ll take your advice to heart: I’m going to start creating more and stop overthinking things that get me nowhere. I totally agree about the toxic community; it's a shame. Time to keep working. Thanks a lot for your input.   Exactly, that’s why the Scryde method and their merge system work so well. People don't lose their progress and can still keep rushing new servers. Obviously, gameplay has mutated into something much faster-paced, but obviously, this happens in real life too, everyone is more accelerated and on edge. Thanks to social media and mental conditioning. But, well, it’s something we have to accept. Don't even get me started on gambling and online casinos; that’s a whole other topic regarding all the P2W servers.   Really, amen bro.
    • Hello, the server lifespan isn't something that only affects Argentina; just look at the South American and European communities. Those distant days you mentioned, when we were younger, which I completely agree with, are long gone. Today, the community plays RUSH for 30 or 60 days and seeks the adrenaline rush of starting over. As for free or paid packs, there are many options, but in all of them, you'll have to create your own unique style.  
    • Introducing: NimeraCP V2! What's New: Realtime Tickets (Receive + Send messages without refreshing page, instant delivery to player) Powered by WebSockets Realtime Rankings/Stats (Receive instant updates without refreshing page) Powered by WebSockets - PvP/Boss Rankings/Clan Rankings etc... oAuth Login + Register (VK, Discord, Google) Two Factor Authentication (Authenticator App) Passkey coming soon! Theme Editor New Arcade Game: Rock Paper Scissors Let players gamble wagering their topped up wallet balance! Discord Webhooks: Receive messages to discord via Bot or Webhook for certain events New Player registration New Payment received New Ticket Opened and more Complete UI Overhaul NimeracCP V2 is now fully multilangual supporting the following languages: English Ελληνικά Português / Brasileiro Español Русский Українська 한국어 Onboarding: Easy installation wizard via /onboarding on first use of the panel for easy installation. Feature Flags: You have full control over the UI. Disable/Enable pages + features via Admin CP CloudFlare R2 Bucket integration: The panel comes with Bucket storage integration for all kinds of assets uploaded to the panel.   A new website shop at https://nimeracp.com/ is also coming soon, including full installation docs.  You can join the discord for further updates/questions: https://discord.nimeracp.com/
    • thanks for choosing me ! 
  • 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