Jump to content

[Share]PvP Weapon augmentable, etc.


`Rοmeο

Recommended Posts

  • 4 weeks later...

Please help me i dont no. I find files RequestExEnchantItemAttribute.java

and i dont lines i based on l2jserver High Five

 

- if (item.getItem().getItemType() == L2WeaponType.FISHINGROD || item.isShadowItem() || item.isCommonItem() || item.isPvp() || item.isHeroItem() || item.isTimeLimitedItem() ||

+ if (item.getItem().getItemType() == L2WeaponType.FISHINGROD || item.isShadowItem() || item.isCommonItem() || item.isHeroItem() || item.isTimeLimitedItem() ||

 

Mi files:

 

public class RequestExEnchantItemAttribute extends L2GameClientPacket
{
private static final String _C__D0_35_REQUESTEXENCHANTITEMATTRIBUTE = "[C] D0:35 RequestExEnchantItemAttribute";

private int _objectId;

@Override
protected void readImpl()
{
	_objectId = readD();
}

@Override
protected void runImpl()
{
	L2PcInstance player = getClient().getActiveChar();
	if (player == null)
		return;

	if (_objectId == 0xFFFFFFFF)
	{
		// Player canceled enchant
		player.setActiveEnchantAttrItem(null);
		player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ELEMENTAL_ENHANCE_CANCELED));
		return;
	}

	if (!player.isOnline())
	{
		player.setActiveEnchantAttrItem(null);
		return;
	}

	if (player.getPrivateStoreType() != 0)
	{
		player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANNOT_ADD_ELEMENTAL_POWER_WHILE_OPERATING_PRIVATE_STORE_OR_WORKSHOP));
		player.setActiveEnchantAttrItem(null);
		return;
	}

	// Restrict enchant during a trade (bug if enchant fails)
	if (player.getActiveRequester() != null)
	{
		// Cancel trade
		player.cancelActiveTrade();
		player.setActiveEnchantAttrItem(null);
		player.sendMessage("Enchanting items is not allowed during a trade.");
		return;
	}

	L2ItemInstance item = player.getInventory().getItemByObjectId(_objectId);
	L2ItemInstance stone = player.getActiveEnchantAttrItem();
	if (item == null || stone == null)
	{
		player.setActiveEnchantAttrItem(null);
		return;
	}

	if (!item.isElementable())
	{
		player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ELEMENTAL_ENHANCE_REQUIREMENT_NOT_SUFFICIENT));
		player.setActiveEnchantAttrItem(null);
		return;
	}

	switch (item.getLocation())
	{
		case INVENTORY:
		case PAPERDOLL:
		{
			if (item.getOwnerId() != player.getObjectId())
			{
				player.setActiveEnchantAttrItem(null);
				return;
			}
			break;
		}
		default:
		{
			player.setActiveEnchantAttrItem(null);
			Util.handleIllegalPlayerAction(player, "Player "+player.getName()+" tried to use enchant Exploit!", Config.DEFAULT_PUNISH);
			return;
		}
	}

	int stoneId = stone.getItemId();
	byte elementToAdd = Elementals.getItemElement(stoneId);
	// Armors have the opposite element
	if (item.isArmor())
		elementToAdd = Elementals.getOppositeElement(elementToAdd);
	byte opositeElement = Elementals.getOppositeElement(elementToAdd);

	Elementals oldElement = item.getElemental(elementToAdd);
	int elementValue = oldElement == null ? 0 : oldElement.getValue();
	int limit = getLimit(item, stoneId);
	int powerToAdd = getPowerToAdd(stoneId, elementValue, item);

	if ((item.isWeapon() && oldElement != null && oldElement.getElement() != elementToAdd && oldElement.getElement() != -2)
			|| (item.isArmor() && item.getElemental(elementToAdd) == null && item.getElementals() != null && item.getElementals().length >= 3))
	{
		player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ANOTHER_ELEMENTAL_POWER_ALREADY_ADDED));
		player.setActiveEnchantAttrItem(null);
		return;
	}

	if (item.isArmor() && item.getElementals() != null)
	{
		//cant add opposite element
		for (Elementals elm : item.getElementals())
		{
			if (elm.getElement() == opositeElement)
			{
				player.setActiveEnchantAttrItem(null);
				Util.handleIllegalPlayerAction(player, "Player "+player.getName()+" tried to add oposite attribute to item!", Config.DEFAULT_PUNISH);
				return;
			}
		}
	}

	int newPower = elementValue + powerToAdd;
	if (newPower > limit)
	{
		newPower = limit;
		powerToAdd = limit - elementValue;
	}

	if (powerToAdd <= 0)
	{
		player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ELEMENTAL_ENHANCE_CANCELED));
		player.setActiveEnchantAttrItem(null);
		return;
	}

	if(!player.destroyItem("AttrEnchant", stone, 1, player, true))
	{
		player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NOT_ENOUGH_ITEMS));
		Util.handleIllegalPlayerAction(player, "Player "+player.getName()+" tried to attribute enchant with a stone he doesn't have", Config.DEFAULT_PUNISH);
		player.setActiveEnchantAttrItem(null);
		return;
	}
	boolean success = false;
	switch(Elementals.getItemElemental(stoneId)._type)
	{
		case Stone:
		case Roughore:
			success = Rnd.get(100) < Config.ENCHANT_CHANCE_ELEMENT_STONE;
			break;
		case Crystal:
			success = Rnd.get(100) < Config.ENCHANT_CHANCE_ELEMENT_CRYSTAL;
			break;
		case Jewel:
			success = Rnd.get(100) < Config.ENCHANT_CHANCE_ELEMENT_JEWEL;
			break;
		case Energy:
			success = Rnd.get(100) < Config.ENCHANT_CHANCE_ELEMENT_ENERGY;
			break;
	}
	if (success)
	{
		byte realElement = item.isArmor() ? opositeElement : elementToAdd;

		SystemMessage sm;
		if (item.getEnchantLevel() == 0)
		{
			if (item.isArmor())
				sm = SystemMessage.getSystemMessage(SystemMessageId.THE_S2_ATTRIBUTE_WAS_SUCCESSFULLY_BESTOWED_ON_S1_RES_TO_S3_INCREASED);
			else
				sm = SystemMessage.getSystemMessage(SystemMessageId.ELEMENTAL_POWER_S2_SUCCESSFULLY_ADDED_TO_S1);
			sm.addItemName(item);
			sm.addElemental(realElement);
			if (item.isArmor())
				sm.addElemental(Elementals.getOppositeElement(realElement));
		}
		else
		{
			if (item.isArmor())
				sm = SystemMessage.getSystemMessage(SystemMessageId.THE_S3_ATTRIBUTE_BESTOWED_ON_S1_S2_RESISTANCE_TO_S4_INCREASED);
			else
				sm = SystemMessage.getSystemMessage(SystemMessageId.ELEMENTAL_POWER_S3_SUCCESSFULLY_ADDED_TO_S1_S2);
			sm.addNumber(item.getEnchantLevel());
			sm.addItemName(item);
			sm.addElemental(realElement);
			if (item.isArmor())
				sm.addElemental(Elementals.getOppositeElement(realElement));
		}
		player.sendPacket(sm);
		item.setElementAttr(elementToAdd, newPower);
		if (item.isEquipped())
			item.updateElementAttrBonus(player);

		// send packets
		InventoryUpdate iu = new InventoryUpdate();
		iu.addModifiedItem(item);
		player.sendPacket(iu);
	}
	else
		player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FAILED_ADDING_ELEMENTAL_POWER));

	player.sendPacket(new ExAttributeEnchantResult(powerToAdd));
	player.sendPacket(new UserInfo(player));
	player.sendPacket(new ExBrExtraUserInfo(player));
	player.setActiveEnchantAttrItem(null);
}

public int getLimit(L2ItemInstance item, int sotneId)
{
	Elementals.ElementalItems elementItem = Elementals.getItemElemental(sotneId);
	if (elementItem == null)
		return 0;

	if (item.isWeapon())
		return Elementals.WEAPON_VALUES[elementItem._type._maxLevel];
	return Elementals.ARMOR_VALUES[elementItem._type._maxLevel];
}

public int getPowerToAdd(int stoneId, int oldValue, L2ItemInstance item)
{
	if (Elementals.getItemElement(stoneId) != Elementals.NONE)
	{
		if (item.isWeapon())
		{
			if (oldValue == 0)
				return Elementals.FIRST_WEAPON_BONUS;
			return Elementals.NEXT_WEAPON_BONUS;
		}
		else if (item.isArmor())
			return Elementals.ARMOR_BONUS;
	}
	return 0;
}

@Override
public String getType()
{
	return _C__D0_35_REQUESTEXENCHANTITEMATTRIBUTE;
}
}

Link to comment
Share on other sites

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
Reply to this topic...

×   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

    • 💸 New discount coupon 5% 😎 boosti 😎
    • 💸 New discount coupon 5% 😎 boosti 😎
    • to my store : https://topestore.mysellix.io/fr/ 2015-2022 Aged Discord Account 2015 Discord Account : 50.99 $ 2016 Discord Account : 10$ 2017 Discord Account :3.99 $ 2018 Discord Account : 3.50$ 2019 Discord Account : 2.70 $ 2020 Discord Account :1.50$ 2021 Discord Account :0.99$ 2022 Discord Account :0.70$ Warranty :Lifetime Payment Methods : Crypto/ PayPal Contact Me On Discord Or Telegram Discord : @ultrasstore11 Telegram : https://t.me/ultrastore11 Whatsapp ; +212614849119
    • This is my first and last topic created on a Lineage Forum, because if there's one thing that causes headaches for a lot of people, it's the critical error, that's why I decided to share it...   I'm creating a server again and before starting configurations I started collecting dozens of customs, without realizing my system folder had 950MB of files, so I started to enter the game, every 1 to 2 hours my client was reaching the maximum limit of virtual memory of the game due to the absurd amount of customs inside the system folder, reaching the maximum limit of 2047MB virtual ram, automatically we get critical, regardless of the error that appears on your screen, "THE WORDS ARE IRRELEVANT, unless it is a critical error before the ram memory limit reaches its limit", if you are seeing "2047 MB", it means that the game's virtual memory has reached its limit, and this memory is not configurable due to the game being created on 32-bit architecture, so I significantly reduced the amount of customs within the system from 950MB to 625MB, so my client started to reach the maximum memory limit every 10 to 12h, a huge progress, but my goal was at least 24h before reaching the virtual memory limit (playing frantically), so I reduced the system's custom files from 625MB to 267MB, the result was a first virtual memory limit critical error appearing after 41h.   My client is H5, the only types of customs I added to the game were focused only on equipment, one of the main causes were these skins and cloaks, they consume a huge amount of MB's within the "system", the problem is not adding customs to the client, the problem is adapting a custom and adding it inside the system folder, the system folder was not created with the intention of storing a huge amount of files.   Adding customs to the system folder means significantly reducing the time your client can remain open before reaching the virtual ram limit and make no mistake, there are hundreds of different critical errors with a small summary of the cause of the error, but if the critical table shows 2047MB of RAM, the problem is only 1. Example: I can see 3, 5, 9 critical error with different messages, but if this table is showing 2047MB ram, the reason was the virtual memory limit, an important detail is that this 2047MB ram is not a "fixed message or information from your computer", this 2047MB only appear when the cause is the virtual ram limit, it means that when you get a critical error with random numbers of ram memory appearing, such as 358MB ram, 715MB ram, it means that the cause of this error has no connection with ram virtual memory.
    • DISCORD : utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products  https://discord.gg/hoodservices https://campsite.bio/utchihaamkt
  • Topics

×
×
  • Create New...