Jump to content
  • 0

[Help] About a pvp reward


Question

Posted

Hello guys i saw that topic

 

http://maxcheaters.com/forum/index.php?topic=48159.0

 

 

and i have some question about that i hope someone to help me :P...

 

Can i add as a feature reward an enchant by chance? For example 1 kill = 5% chance to make a random enchant on weapon/armor/jew? (to not give scroll but enchant.)

 

And if yes is it easy something like that?

 

 

EDIT: Sry for my bad english :P

2 answers to this question

Recommended Posts

  • 0
Posted

i just coded it, but did not test

 

### Eclipse Workspace Patch 1.0
#P L2J_Server
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java	(revision 4838)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -5675,9 +5675,73 @@
			// Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
			sendPacket(new UserInfo(this));
			sendPacket(new ExBrExtraUserInfo(this));
+			
+			chanceEnchantReward();
		}
	}

+	private final void chanceEnchantReward()
+	{
+		final int chance = 5; // 5% of chance to get an item enchanted
+		
+		final int producedChance = Rnd.get(100) + 1;
+		if(producedChance <= chance)
+		{	
+			FastList<L2ItemInstance> enchantableItems = new FastList<L2ItemInstance>();
+			PcInventory inv = getInventory();
+			for(L2ItemInstance itm : inv.getItems())
+				if(itm.isArmor() || itm.isWeapon())
+					enchantableItems.add(itm);
+		
+			L2ItemInstance enchantedItem = null;
+			boolean enchanted = false;
+			do
+			{
+				enchantedItem = enchantableItems.remove(Rnd.get(enchantableItems.size()));
+				if(enchantedItem.isWeapon())
+				{
+					if(((L2Weapon)enchantedItem.getItem()).isCrystallizable()
+							&& enchantedItem.getEnchantLevel() < Config.ENCHANT_MAX_WEAPON)
+					{
+						synchronized(inv)
+						{
+							enchantedItem.setEnchantLevel(enchantedItem.getEnchantLevel() + 1);
+							enchanted = true;
+						}
+					}
+				}
+				else if(enchantedItem.isArmor())
+				{
+					L2Armor armorItem = (L2Armor)enchantedItem.getItem();
+					if(armorItem.isCrystallizable())
+					{
+						if((armorItem.getType1() == L2Item.TYPE1_WEAPON_RING_EARRING_NECKLACE
+								&& enchantedItem.getEnchantLevel() < Config.ENCHANT_MAX_JEWELRY)
+								|| (armorItem.getType1() == L2Item.TYPE1_SHIELD_ARMOR
+								&& enchantedItem.getEnchantLevel() < Config.ENCHANT_MAX_ARMOR))
+						{
+							synchronized(inv)
+							{
+								enchantedItem.setEnchantLevel(enchantedItem.getEnchantLevel() + 1);
+								enchanted = true;
+							}
+						}
+					}	
+				}
+				
+				if(enchanted)
+				{
+					broadcastUserInfo();
+					sendPacket(new ItemList(this, false));
+					SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED);
+					sm.addItemName(enchantedItem);
+					sendPacket(sm);
+				}
+			}
+			while(!enchanted);
+		}
+	}
+	
	/**
	 * Increase pk count, karma and send the info to the player
	 *

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
Answer this question...

×   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

    • Good Luck!
    • My repository  https://github.com/gawric/Unity-Client-for-L2J
    • Project based on lucera2 Chronicle: Interlude Starting level: 80 Max level: 95 EXP/SP: x160 DROP:X1 RAID:X1 SAFE+7 MAX+25 Farm Aresa Cave of Trials Hellbound Night Instance - Elven Fortress from 10pm to 11pm PvP Areas Gludin Village - max item level 1 Garden of Eva - max items 3 lvl Hellbound Town - No restrictions *PvP Rewards enchant scrolls PVP SKILLS: - 1 lvl > 1000 pvps > Evo Magic Barrier - 2 lvl > 2000 pvps > Evo Shield - 3 lvl > 5000 pvps > Evo Might/Empower - 4 lvl > 10000 pvps > Evo Health - 5 lvl > 15000 pvps > Evo Bererker - 6 lvl > 20000 pvps > Evo Valor - Note: You need to restart to earn the skill! - Announcing your rank level on entering. - PvP Skills available only on the main class! - The buffs can be stucked from all levels! Custom Items Armors 5 lvls 1 lvl epic armor 2 lvl dynasty armor 3 lvl Vesper armor 4 lvl Titanium Armor 5 lvl Bloody Armor Weapons 6 lvls 1 lvl monster weapons 2 lvl dynasty weapons 3 lvl vesper weapons 4 lvl divine weapons (good for farm) 5 lvl weapons titanium weapons 6 lvl Raid & God weapons *Raid weapons can be earned only from RAIDS! * Raids and god weapons have the same stats. Jews Normal and Relic Accessories 1 & 2 lvl. Tattoos 1 & 2 lvl *2 lvl tattos can be enchanted. On each enchant adding atak speed, cast, hp, p.atk, m.atk, health depends on the tattoo. Enchant bonuses on weapon armors on weapon vary from +16 to +25 on armors +16 evo aura/ +18 bonus stas ENCHANT RATES BLESSED SCROLLS: -5% after every enchant EVO SCROLLS: +5% more chance than BLESSED EVO EPIC SCROLLS: +5% more chance and on fail the enchant stays the same DIVINE SCROLL: Only for divine weapons. 100% success rate. GOD SCROLL: 100% success rate. Only for God/raid weps/bloody armor. Farm and Economy Full custom farm mobs Armor/Weapon +++ as possible drop Custom Coins Custom chests (appear after the mob is killed with %). You can earn additional rare rewards. 2 levels of custom chests for better rewards. L2 Evo Quest - Daily challange. You need to collect 20 Evo Quest coins. After finishing the quest you will get your dialy reward. - 7 Days reward (progressive) - 4 cycles reward (When you finish 4 weeks quests, you will be awarded with a rare coin. You can exchange this Rare Coin for: 3 lvl weapon +0, Heroic Coin (3 days), 2 level jews. - Added quest tracking day 1: Silver Coins - 1000, 1 Blessed Scroll Weapon day 2: Blue Eva - 500, 2 Blessed Scroll Armor day 3: Silver Coins - 1400, 5 Event Medals day 4: Festival Adena- 50, 3 Blessed Scroll Weapon day 5: Silver Coins 2000, 4 Blessed Scroll Armor day 6: Blue Eva - 2000, Event Medal: 8 day 7: Heroic Contract 1, Event Medal 15 * With heroic contract you can get 3 days hero from the Donate Services NPC. All raids removed. All party mobs drop raid and epic raid coins. All clans have the chance to get unlimited raids. We have 3 custom pvp raids in the pvp zones. Respawn 12h. EVENTS TVT CTF SQUASH EVENT NIGHT EVENT Custom NPCS Gatekeeper Custom Shop - all important items Buffer - all needed buffs GM Shop - all basic items Donate shop - all items that can be donated Night Instance - Special Event (every day 10pm to 11pm) +2GMT *type .time in game to see the server time. Quest Manager Skill enchant manager Letters collector (earn additional rewards for collecting words) About classes: All classes boosted PVE skill dmg All summoners classes boosted (pet instant 92lvl) + boosted skills on pet. Critical Damage restriction formula. Website: https://l2evo.net GRAND OPENING: 24.04.2025 8PM +2 GMT. DISCORD: https://discord.gg/3DcBVKhNnX  
    • Get A Free Trial NOW! Get A Free Trial NOW! Get A Free Trial NOW!
  • Topics

×
×
  • Create New...