Jump to content

L2jacis pvp auto enchant


Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

@Elfocrash sorry for sharing you work without asking it..if you want i can take it down

Edited by ThelwHelpRePaidia
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...