Jump to content

Recommended Posts

  • 4 weeks later...
Posted

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;
}
}

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

    • No, the real purpose is cheating and custom  development for games.  I'm building a custom AI moderator specially for checking illegal activity and flag current topica.
    • Hello trying to edit Armorgrp_Classic.dat using L2ClientDat Editor - l2jmobius edition I can normally open a file but can't save, even can't save "clean" version of file (just open and then click save) Other files i can normally open, edit and save. but there is problem with Armorgrp_Classic.dat Anyone find solution, or other Editor for protocol 166 ?   [25/12 15:10:11] --------------------------------------- [25/12 15:10:11] Open file: Armorgrp_Classic.dat [25/12 15:10:11] File Armorgrp_Classic.dat encrypted. Lineage2Ver413 decrypt ... [25/12 15:10:11] Decrypt Armorgrp_Classic.dat file successfully by v413_encdec decrypter. [25/12 15:10:11] Read the file structure ... [25/12 15:10:11] Unpacking [L2GameDataName.dat] [25/12 15:10:11] GameDataName: Load 97534 count. [25/12 15:10:11] Completed. [25/12 15:11:32] Wrong param count for wrapper: fertheia_mesh_add, paramIndex: 1, params: {{{[LineageAccessory3.fertheia_pvp_Hrm_ad11];[None];[LineageAccessory3.fertheia_pvp_Hrm_ad11];[None];[LineageAccessory3.fertheia_pvp_Hrm_ad11;[none]};{{109;114};{0;-1};{109;114};{0;-1};{109;114}}};{[Mantleguild.kingdom.E_elmd_1_t00];[None];[Mantleguild.kingdom.E_elmd_1_t00];[None];[Mantleguild.kingdom.E_elmd_1_t00];[None]};[None]} -node: fertheia_mesh_add[WRAPPER][null][null] param: {{{[LineageAccessory3.fertheia_pvp_Hrm_ad11];[None];[LineageAccessory3.fertheia_pvp_Hrm_ad11];[None];[LineageAccessory3.fertheia_pvp_Hrm_ad11;[none]};{{109;114};{0;-1};{109;114};{0;-1};{109;114}}};{[Mantleguild.kingdom.E_elmd_1_t00];[None];[Mantleguild.kingdom.E_elmd_1_t00];[None];[Mantleguild.kingdom.E_elmd_1_t00];[None]};[None]} org.l2jmobius.xml.exceptions.PackDataException: Wrong param count for wrapper: fertheia_mesh_add, paramIndex: 1, params: {{{[LineageAccessory3.fertheia_pvp_Hrm_ad11];[None];[LineageAccessory3.fertheia_pvp_Hrm_ad11];[None];[LineageAccessory3.fertheia_pvp_Hrm_ad11;[none]};{{109;114};{0;-1};{109;114};{0;-1};{109;114}}};{[Mantleguild.kingdom.E_elmd_1_t00];[None];[Mantleguild.kingdom.E_elmd_1_t00];[None];[Mantleguild.kingdom.E_elmd_1_t00];[None]};[None]} -node: fertheia_mesh_add[WRAPPER][null][null] param: {{{[LineageAccessory3.fertheia_pvp_Hrm_ad11];[None];[LineageAccessory3.fertheia_pvp_Hrm_ad11];[None];[LineageAccessory3.fertheia_pvp_Hrm_ad11;[none]};{{109;114};{0;-1};{109;114};{0;-1};{109;114}}};{[Mantleguild.kingdom.E_elmd_1_t00];[None];[Mantleguild.kingdom.E_elmd_1_t00];[None];[Mantleguild.kingdom.E_elmd_1_t00];[None]};[None]} at org.l2jmobius.xml.DescriptorWriter.packData(DescriptorWriter.java:275) at org.l2jmobius.xml.DescriptorWriter.packData(DescriptorWriter.java:184) at org.l2jmobius.xml.DescriptorWriter.parseData(DescriptorWriter.java:100) at org.l2jmobius.actions.SaveDat.action(SaveDat.java:70) at org.l2jmobius.actions.ActionTask.doInBackground(ActionTask.java:48) at org.l2jmobius.actions.ActionTask.doInBackground(ActionTask.java:27) at java.desktop/javax.swing.SwingWorker$1.call(SwingWorker.java:303) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:328) at java.desktop/javax.swing.SwingWorker.run(SwingWorker.java:340) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1095) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:619) at java.base/java.lang.Thread.run(Thread.java:1447) [25/12 15:11:32] buff == null.  
    • Leave your contact information or write to me on Telegram @dieorditsa
    • Hello everyone, I’m looking for a graphic designer to design a custom logo that will be used in NPC HTML interfaces for Lineage. Please send me a private message if you are interested.
    • ok sounds good sign me up
  • 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