Jump to content

[Share] H5 Npc Enchant Manager V2 /*java*/


HappyLDE

Recommended Posts

BTW i just checked for the 3rd time the fix is not there you have to fix it  manually  anjd if you readr the posters edit date 
Edited by HappyLDE, 28 December 2013 - 04:50 AM.

you weill see that the guy who needs help posted ....

 

madines, on 08 Jan 2014 - 2:13 PM, said:snapback.png

is that can help u ? 

 So how is the post up there fixed if the guy who needs help posted 11 days after hmmm careful not to fall for it right.....

i already fixed the buggs in this so if you need it pm me im not gonna spam the topic but i will respond to someone
insulting me or trying to help a fellow out in private ....
15x0etz.jpg

Link to comment
Share on other sites

thisis nice share i have enchant manager but this is good pliz fix sql custom_npc to put in hive becoze see error in this share for l2j hive five dont have java code siple is good npc only java is this to put in costom no eclipse pliz fix if you want sql to put navikat becoze eror arrow line 1 is mperdema opos kai naxi gia osous to douleboun brabo! maybi my revision dont make sql eξξes

Edited by l22expert
Link to comment
Share on other sites

BTW i just checked for the 3rd time the fix is not there you have to fix it  manually  anjd if you readr the posters edit date 

Edited by HappyLDE, 28 December 2013 - 04:50 AM.

 

you weill see that the guy who needs help posted ....

 

madines, on 08 Jan 2014 - 2:13 PM, said:snapback.png

 So how is the post up there fixed if the guy who needs help posted 11 days after hmmm careful not to fall for it right.....

 

i already fixed the buggs in this so if you need it pm me im not gonna spam the topic but i will respond to someone

insulting me or trying to help a fellow out in private ....

15x0etz.jpg

 

 

I meant that at the top of page 3 I said I had that same problem about L2ItemInstance, I even posted a picture of the exact same error madines has on page 2 and it was fixed by updating to latest version of L2J. I didnt mean that HappyLDE fixed it.

 

If you fixed it another way then thats awesome, and if I were you I would share it on the thread because you will let other people learn and contribute to the share, but its your choice.

Link to comment
Share on other sites

thisis nice share i have enchant manager but this is good pliz fix sql custom_npc to put in hive becoze see error in this share for l2j hive five dont have java code siple is good npc only java is this to put in costom no eclipse pliz fix if you want sql to put navikat becoze eror arrow line 1 is mperdema opos kai naxi gia osous to douleboun brabo! maybi my revision dont make sql eξξes

/*
Navicat MySQL Data Transfer
 
Source Server         : l2jdb
Source Server Version : 50132
Source Host           : localhost:3306
Source Database       : l2jdb
 
Target Server Type    : MYSQL
Target Server Version : 50132
File Encoding         : 65001
 
Date: 2014-01-09 09:05:34
*/
 
SET FOREIGN_KEY_CHECKS=0;
 
-- ----------------------------
-- Table structure for `custom_npc`
-- ----------------------------
DROP TABLE IF EXISTS `custom_npc`;
CREATE TABLE `custom_npc` (
  `id` mediumint(7) unsigned NOT NULL,
  `idTemplate` smallint(5) unsigned NOT NULL,
  `name` varchar(200) NOT NULL DEFAULT '',
  `serverSideName` tinyint(1) NOT NULL DEFAULT '1',
  `title` varchar(45) NOT NULL DEFAULT '',
  `serverSideTitle` tinyint(1) NOT NULL DEFAULT '1',
  `class` varchar(200) DEFAULT NULL,
  `collision_radius` decimal(6,2) DEFAULT NULL,
  `collision_height` decimal(6,2) DEFAULT NULL,
  `level` tinyint(2) DEFAULT NULL,
  `sex` enum('etc','female','male') NOT NULL DEFAULT 'etc',
  `type` varchar(22) DEFAULT NULL,
  `attackrange` smallint(4) DEFAULT NULL,
  `hp` decimal(30,15) DEFAULT NULL,
  `mp` decimal(30,15) DEFAULT NULL,
  `hpreg` decimal(30,15) DEFAULT NULL,
  `mpreg` decimal(30,15) DEFAULT NULL,
  `str` tinyint(2) NOT NULL DEFAULT '40',
  `con` tinyint(2) NOT NULL DEFAULT '43',
  `dex` tinyint(2) NOT NULL DEFAULT '30',
  `int` tinyint(2) NOT NULL DEFAULT '21',
  `wit` tinyint(2) NOT NULL DEFAULT '20',
  `men` tinyint(2) NOT NULL DEFAULT '20',
  `exp` int(9) NOT NULL DEFAULT '0',
  `sp` int(9) NOT NULL DEFAULT '0',
  `patk` decimal(12,5) DEFAULT NULL,
  `pdef` decimal(12,5) DEFAULT NULL,
  `matk` decimal(12,5) DEFAULT NULL,
  `mdef` decimal(12,5) DEFAULT NULL,
  `atkspd` smallint(4) NOT NULL DEFAULT '230',
  `critical` tinyint(1) NOT NULL DEFAULT '1',
  `matkspd` smallint(4) NOT NULL DEFAULT '333',
  `rhand` smallint(5) unsigned NOT NULL DEFAULT '0',
  `lhand` smallint(5) unsigned NOT NULL DEFAULT '0',
  `enchant` tinyint(1) NOT NULL DEFAULT '0',
  `walkspd` decimal(10,5) NOT NULL DEFAULT '60.00000',
  `runspd` decimal(10,5) NOT NULL DEFAULT '120.00000',
  `dropHerbGroup` tinyint(1) NOT NULL DEFAULT '0',
  `basestats` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
-- ----------------------------
-- Records of custom_npc
-- ----------------------------
INSERT INTO `custom_npc` VALUES ('9994', '32548', 'Enchanter Manager', '1', 'Enchanter Attributor', '1', 'LineageNPC2.xers', '12.50', '25.00', '70', 'male', 'L2Npc', '40', '2000.000000000000000', '1000.000000000000000', '1.000000000000000', '1.000000000000000', '40', '43', '30', '21', '20', '20', '0', '0', '100.00000', '100.00000', '100.00000', '100.00000', '230', '1', '333', '0', '0', '0', '60.00000', '120.00000', '0', '0');

#

#

#

#

/*
Navicat MySQL Data Transfer
 
Source Server         : l2jdb
Source Server Version : 50132
Source Host           : localhost:3306
Source Database       : l2jdb
 
Target Server Type    : MYSQL
Target Server Version : 50132
File Encoding         : 65001
 
Date: 2014-01-12 05:14:43
*/
 
SET FOREIGN_KEY_CHECKS=0;
 
-- ----------------------------
-- Table structure for `custom_npcaidata`
-- ----------------------------
DROP TABLE IF EXISTS `custom_npcaidata`;
CREATE TABLE `custom_npcaidata` (
  `npcId` mediumint(7) unsigned NOT NULL,
  `minSkillChance` tinyint(3) unsigned NOT NULL DEFAULT '7',
  `maxSkillChance` tinyint(3) unsigned NOT NULL DEFAULT '15',
  `primarySkillId` smallint(5) unsigned DEFAULT '0',
  `agroRange` smallint(4) unsigned NOT NULL DEFAULT '0',
  `canMove` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `targetable` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `showName` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `minRangeSkill` smallint(5) unsigned DEFAULT '0',
  `minRangeChance` tinyint(3) unsigned DEFAULT '0',
  `maxRangeSkill` smallint(5) unsigned DEFAULT '0',
  `maxRangeChance` tinyint(3) unsigned DEFAULT '0',
  `soulShot` smallint(4) unsigned DEFAULT '0',
  `spiritShot` smallint(4) unsigned DEFAULT '0',
  `spsChance` tinyint(3) unsigned DEFAULT '0',
  `ssChance` tinyint(3) unsigned DEFAULT '0',
  `aggro` smallint(4) unsigned NOT NULL DEFAULT '0',
  `isChaos` smallint(4) unsigned DEFAULT '0',
  `clan` varchar(40) DEFAULT NULL,
  `clanRange` smallint(4) unsigned DEFAULT '0',
  `enemyClan` varchar(40) DEFAULT NULL,
  `enemyRange` smallint(4) unsigned DEFAULT '0',
  `dodge` tinyint(3) unsigned DEFAULT '0',
  `aiType` varchar(8) NOT NULL DEFAULT 'fighter',
  PRIMARY KEY (`npcId`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
-- ----------------------------
-- Records of custom_npcaidata
-- ----------------------------
INSERT INTO `custom_npcaidata` VALUES ('9994', '7', '15', '0', '0', '1', '1', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', null, '0', null, '0', '0', 'fighter');

#

#

#

#

change the "9994" to your npc id of the enchanter it is not hard to dump sql in navi table 

 

copy past both save as sql  one custom_npc || custom_npcaidata

Link to comment
Share on other sites

2dridn5.jpgMade aDdditiosn to your npc 
i added 8 more NPCS each you can add 1 +450  LvL9 Attribute to a individual piece of armor to many people bitching in my server for attributes i had to make 8 npc because if you add all the code in 1 scrip it goes hay wire with everyone clikcing the script so much don't no why this works perfect tho 

#WEAPONS ATTRIBUTE ALL ITEMS ENCHANT 
#Head ATTRIBUTE
#Chest ATTRIBUTE
#Leggings ATTRIBUTE
#Boots ATTRIBUTE
#Gloves ATTRIBUTE
#Cloak ATTRIBUTE
#tattoo ATTRIBUTE
#belt ATTRIBUTE

https://www.mediafire.com/?ws6j5kjfpyl5dqa
https://www.mediafire.com/?ws6j5kjfpyl5dqa
https://www.mediafire.com/?ws6j5kjfpyl5dqa
https://www.mediafire.com/?ws6j5kjfpyl5dqa
https://www.mediafire.com/?ws6j5kjfpyl5dqa
https://www.mediafire.com/?ws6j5kjfpyl5dqa
https://www.mediafire.com/?ws6j5kjfpyl5dqa
https://www.mediafire.com/?ws6j5kjfpyl5dqa



http://l2phoenixrealm.webs.com/

You can try it on my server befor you download it if you want its live 24/7 
 

Edited by toxicreaper989898
Link to comment
Share on other sites

I need to put 3 attributes, I configure and put all in one

package custom.mondial.enchantmanager;

import java.util.StringTokenizer;
import java.util.logging.Logger;

import com.l2jserver.gameserver.model.Elementals;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.gameserver.model.olympiad.OlympiadManager;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.network.serverpackets.CharInfo;
import com.l2jserver.gameserver.network.serverpackets.ExBrExtraUserInfo;
import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate;
import com.l2jserver.gameserver.network.serverpackets.UserInfo;

public class EnchantManager extends Quest
{
	public static final Logger _log = Logger.getLogger(EnchantManager.class.getName());
	
	private final static int npcId = 9994;
	
	// Item required to enchant armor +1
	private final static int itemRequiredArmor = 9143; // Id for GA
	private final static int itemRequiredArmorCount = 50;
	
	// Item required to enchant jewels +1
	private final static int itemRequiredJewels = 9143;
	private final static int itemRequiredJewelsCount = 50;
	
	// Item required to enchant weapon +1
	private final static int itemRequiredWeapon = 9143;
	private final static int itemRequiredWeaponCount = 50;
	
	// Item required to enchant belt/shirt +1
	private final static int itemRequiredBeltShirt = 9143;
	private final static int itemRequiredBeltShirtCount = 100;
	
	// Item required to add Lv 7 attribute to weapon
	private final static int itemRequiredAttr = 9143;
	private final static int itemRequiredAttrCount = 500;
	
	public EnchantManager(int questId, String name, String descr)
	{
		super(questId, name, descr);
		
		addStartNpc(npcId);
		addFirstTalkId(npcId);
		addTalkId(npcId);
	}
	
	public static void main(String[] args)
	{
		new EnchantManager(-1, "enchantmanager", "custom/mondial");
	}
	
	@Override
	public String onFirstTalk(L2Npc npc, L2PcInstance player)
	{
		String enchantType = "html/Index.htm";
		
		if (player.getQuestState(getName()) == null)
		{
			newQuestState(player);
		}
		else if (player.isInCombat())
		{
			return drawHtml("You are in combat", "Don't fight if you want to talk with me!", enchantType);
		}
		else if (player.getPvpFlag() == 1)
		{
			return drawHtml("You are flagged", "Don't fight if you want to talk with me!", enchantType);
		}
		else if (player.getKarma() != 0)
		{
			return drawHtml("You are in chaotic state", "Don't fight if you want to talk with me!", enchantType);
		}
		else if (OlympiadManager.getInstance().isRegistered(player))
		{
			return drawHtml("You are registered for Olympiad", "You can't use my services<br1>while playing the Olympiad.", enchantType);
		}
		else if (player.isInDuel())
		{
			return drawHtml("Estas En duelo", "No puedes usar mis servicios.<br1>.", enchantType);
		}
		else if (player.isFestivalParticipant())
		{
			return drawHtml("Estas Participando en Festival", "No puedes usar mis servicios.<br1>.", enchantType);
		}
		else if (player.isOnEvent())
		{
			return drawHtml("Estas En Un Evento", "No puedes usar mis servicios.<br1>.", enchantType);
		}
		
		return enchantType;
	}
	
	@Override
	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
	{
		String htmlText = event;
		
		String enchantType = "Index.htm";
		
		int armorType = -1;
		
		// If it contains space, then it's an attribute enchant. After space it's the element name. Eg: Fire
		if (event.contains(" "))
		{
			final StringTokenizer st = new StringTokenizer(event);
			
			if (st.nextToken().equalsIgnoreCase("attributeWeapons"))
			{
				armorType = Inventory.PAPERDOLL_RHAND;
				enchantType = "Attributes.htm";
				
				final String element = st.nextToken();
				
				htmlText = enchant(element, enchantType, player, armorType, itemRequiredAttr, itemRequiredAttrCount);
			}
		}
		// Attribute Casco //
		if (event.contains(" "))
		{
			final StringTokenizer st = new StringTokenizer(event);
			
			if (st.nextToken().equalsIgnoreCase("attributeCasco"))
			{
				armorType = Inventory.PAPERDOLL_HEAD;
				enchantType = "Attributes.htm";
				
				final String element = st.nextToken();
				
				htmlText = enchant(element, enchantType, player, armorType, itemRequiredAttr, itemRequiredAttrCount);
			}
		}
		
		// Termina aqui lo del casco//
		
		// Attribute Pechera //
		
		if (event.contains(" "))
		{
			final StringTokenizer st = new StringTokenizer(event);
			
			if (st.nextToken().equalsIgnoreCase("attributePechera"))
			{
				armorType = Inventory.PAPERDOLL_CHEST;
				enchantType = "Attributes.htm";
				
				final String element = st.nextToken();
				
				htmlText = enchant(element, enchantType, player, armorType, itemRequiredAttr, itemRequiredAttrCount);
			}
		}
		
		// Termina aqui lo de la pechera//
		
		// Attribute Guantes//
		if (event.contains(" "))
		{
			final StringTokenizer st = new StringTokenizer(event);
			
			if (st.nextToken().equalsIgnoreCase("attributeGuantes"))
			{
				armorType = Inventory.PAPERDOLL_GLOVES;
				enchantType = "Attributes.htm";
				
				final String element = st.nextToken();
				
				htmlText = enchant(element, enchantType, player, armorType, itemRequiredAttr, itemRequiredAttrCount);
			}
		}
		
		// Attribute Pantalones//
		
		if (event.contains(" "))
		{
			final StringTokenizer st = new StringTokenizer(event);
			
			if (st.nextToken().equalsIgnoreCase("attributePantalones"))
			{
				armorType = Inventory.PAPERDOLL_LEGS;
				enchantType = "Attributes.htm";
				
				final String element = st.nextToken();
				
				htmlText = enchant(element, enchantType, player, armorType, itemRequiredAttr, itemRequiredAttrCount);
			}
		}
		
		// Termina Aqui lo de los pantalones//
		
		// Attribute Botas//
		
		if (event.contains(" "))
		{
			final StringTokenizer st = new StringTokenizer(event);
			
			if (st.nextToken().equalsIgnoreCase("attributeBotas"))
			{
				armorType = Inventory.PAPERDOLL_FEET;
				enchantType = "Attributes.htm";
				
				final String element = st.nextToken();
				
				htmlText = enchant(element, enchantType, player, armorType, itemRequiredAttr, itemRequiredAttrCount);
			}
		}
		
		// termina las botas//
		// Armor parts
		else if (event.equals("enchantHelmet"))
		{
			armorType = Inventory.PAPERDOLL_HEAD;
			enchantType = "EnchantArmor.htm";
			
			htmlText = enchant("enchant", enchantType, player, armorType, itemRequiredArmor, itemRequiredArmorCount);
		}
		else if (event.equals("enchantChest"))
		{
			armorType = Inventory.PAPERDOLL_CHEST;
			enchantType = "EnchantArmor.htm";
			
			htmlText = enchant("enchant", enchantType, player, armorType, itemRequiredArmor, itemRequiredArmorCount);
		}
		else if (event.equals("enchantLeggings"))
		{
			armorType = Inventory.PAPERDOLL_LEGS;
			enchantType = "EnchantArmor.htm";
			
			htmlText = enchant("enchant", enchantType, player, armorType, itemRequiredArmor, itemRequiredArmorCount);
		}
		else if (event.equals("enchantGloves"))
		{
			armorType = Inventory.PAPERDOLL_GLOVES;
			enchantType = "EnchantArmor.htm";
			
			htmlText = enchant("enchant", enchantType, player, armorType, itemRequiredArmor, itemRequiredArmorCount);
		}
		else if (event.equals("enchantBoots"))
		{
			armorType = Inventory.PAPERDOLL_FEET;
			enchantType = "EnchantArmor.htm";
			
			htmlText = enchant("enchant", enchantType, player, armorType, itemRequiredArmor, itemRequiredArmorCount);
		}
		else if (event.equals("enchantShieldOrSigil"))
		{
			armorType = Inventory.PAPERDOLL_LHAND;
			enchantType = "EnchantArmor.htm";
			
			htmlText = enchant("enchant", enchantType, player, armorType, itemRequiredArmor, itemRequiredArmorCount);
		}
		// Jewels
		else if (event.equals("enchantUpperEarring"))
		{
			armorType = Inventory.PAPERDOLL_LEAR;
			enchantType = "EnchantJewels.htm";
			
			htmlText = enchant("enchant", enchantType, player, armorType, itemRequiredJewels, itemRequiredJewelsCount);
		}
		else if (event.equals("enchantLowerEarring"))
		{
			armorType = Inventory.PAPERDOLL_REAR;
			enchantType = "EnchantJewels.htm";
			
			htmlText = enchant("enchant", enchantType, player, armorType, itemRequiredJewels, itemRequiredJewelsCount);
		}
		else if (event.equals("enchantNecklace"))
		{
			armorType = Inventory.PAPERDOLL_NECK;
			enchantType = "EnchantJewels.htm";
			
			htmlText = enchant("enchant", enchantType, player, armorType, itemRequiredJewels, itemRequiredJewelsCount);
		}
		else if (event.equals("enchantUpperRing"))
		{
			armorType = Inventory.PAPERDOLL_LFINGER;
			enchantType = "EnchantJewels.htm";
			
			htmlText = enchant("enchant", enchantType, player, armorType, itemRequiredJewels, itemRequiredJewelsCount);
		}
		else if (event.equals("enchantLowerRing"))
		{
			armorType = Inventory.PAPERDOLL_RFINGER;
			enchantType = "EnchantJewels.htm";
			
			htmlText = enchant("enchant", enchantType, player, armorType, itemRequiredJewels, itemRequiredJewelsCount);
		}
		// Belt/Shirt
		else if (event.equals("enchantBelt"))
		{
			armorType = Inventory.PAPERDOLL_BELT;
			enchantType = "EnchantBeltShirt.htm";
			
			htmlText = enchant("enchant", enchantType, player, armorType, itemRequiredBeltShirt, itemRequiredBeltShirtCount);
		}
		else if (event.equals("enchantShirt"))
		{
			armorType = Inventory.PAPERDOLL_UNDER;
			enchantType = "EnchantBeltShirt.htm";
			
			htmlText = enchant("enchant", enchantType, player, armorType, itemRequiredBeltShirt, itemRequiredBeltShirtCount);
		}
		// Weapon
		else if (event.equals("enchantWeapon"))
		{
			armorType = Inventory.PAPERDOLL_RHAND;
			enchantType = "EnchantWeapon.htm";
			
			htmlText = enchant("enchant", enchantType, player, armorType, itemRequiredWeapon, itemRequiredWeaponCount);
		}
		else
		{
			htmlText = "html/" + htmlText;
		}
		
		return htmlText;
	}
	
	private String enchant(String type, String enchantType, L2PcInstance player, int armorType, int itemRequired, int itemRequiredCount)
	{
		QuestState qs = player.getQuestState(getName());
		
		// See if player has the required item and the correct amount of it
		if (qs.getQuestItemsCount(itemRequired) >= itemRequiredCount)
		{
			// Try to enchant
			try
			{
				// Get the item to enchant
				L2ItemInstance item = getItemToEnchant(player, armorType);
				
				// If valid item
				if (item != null)
				{
					// Check if item is valid
					if (item.isItem() && item.isEquipable() && !item.isConsumable() && !item.isCommonItem() && !item.isOlyRestrictedItem() && !item.isShadowItem() && !item.isQuestItem())
					{
						// If we want to enchant
						if (type == "enchant")
						{
							final int currentEnchant = item.getEnchantLevel();
							
							if (currentEnchant < 10)
							{
								int newEnchantLevel = setEnchant(player, item, currentEnchant + 1, armorType);
								
								if (newEnchantLevel > 0)
								{
									qs.takeItems(itemRequired, itemRequiredCount);
									player.sendMessage("You successfully enchanted your " + item.getItem().getName() + " from +" + currentEnchant + " to +" + newEnchantLevel + "!");
									
									String htmlContent = "<center>You successfully enchanted your:<br>" + "<font color=\"FF7200\">" + item.getItem().getName() + "</font><br>" + "From: <font color=\"AEFF00\">+" + currentEnchant + "</font> to <font color=\"AEFF00\">+" + newEnchantLevel + "</font>" + "</center>";
									
									return drawHtml("Congratulations!", htmlContent, enchantType);
								}
							}
							else
							{
								player.sendMessage("Your " + item.getItem().getName() + " is already +10!");
								return drawHtml("It's already +10", "<center>Your <font color=\"FF7200\">" + item.getItem().getName() + "</font> is already +20!</center>", enchantType);
							}
						}
						// If we want to add attribute
						else
						{
							qs.takeItems(itemRequired, itemRequiredCount);
							
							setElement(player, item, type, armorType);
							
							player.sendMessage("You successfully added " + type + " element Lv 4 to your " + item.getItem().getName() + "!");
							
							String htmlContent = "<center>You added <font color=\"AEFF00\">" + type + "</font> element Lv 4 to your:<br>" + "<font color=\"FF7200\">" + item.getItem().getName() + "</font>" + "</center>";
							
							return drawHtml("Congratulations!", htmlContent, enchantType);
						}
					}
					// If item can not be enchanted
					else
					{
						player.sendMessage("Your " + item.getItem().getName() + " is not enchantable!");
						return drawHtml("Not enchantable item!", "<center>Your <font color=\"FF7200\">" + item.getItem().getName() + "</font> is not enchantable!</center>", enchantType);
					}
				}
			}
			catch (StringIndexOutOfBoundsException e)
			{
				player.sendMessage("Something went wrong. Are equiped with the item?");
				return drawHtml("Error Enchant", "<center>Something went wrong.<br>Are equiped with the item?</center>", enchantType);
			}
			catch (NumberFormatException e)
			{
				player.sendMessage("Something went wrong. Are equiped with the item?");
				return drawHtml("Error Enchant", "<center>Something went wrong.<br>Are equiped with the item?</center>", enchantType);
			}
			
			player.sendMessage("Something went wrong. Are equiped with the item?");
			return drawHtml("Error Enchant", "<center>Something went wrong.<br>Are equiped with the item?</center>", enchantType);
		}
		// If player doesn't have correct amount of required item, tell him what he needs
		String content = "<center>" + "Not enough <font color=\"FF7200\">Golden Apiga..</font>!<br>";
		
		if (qs.getQuestItemsCount(itemRequired) > 0)
		{
			content += "You have " + qs.getQuestItemsCount(itemRequired) + " Golden Apiga,<br1>" + "Need " + (itemRequiredCount - qs.getQuestItemsCount(itemRequired)) + " more.";
		}
		else
		{
			content += "You need <font color=\"FF7200\">" + itemRequiredCount + " olden Apiga</font>!";
		}
		
		content += "</center>";
		
		return drawHtml("Not Enough Items", content, enchantType);
	}
	
	private L2ItemInstance getItemToEnchant(L2PcInstance player, int armorType)
	{
		L2ItemInstance itemInstance = null;
		L2ItemInstance parmorInstance = player.getInventory().getPaperdollItem(armorType);
		
		if ((parmorInstance != null) && (parmorInstance.getLocationSlot() == armorType))
		{
			itemInstance = parmorInstance;
			
			if (itemInstance != null)
			{
				return itemInstance;
			}
		}
		
		return null;
	}
	
	private int setEnchant(L2PcInstance player, L2ItemInstance item, int newEnchantLevel, int armorType)
	{
		if (item != null)
		{
			// set enchant value
			player.getInventory().unEquipItemInSlot(armorType);
			item.setEnchantLevel(newEnchantLevel);
			player.getInventory().equipItem(item);
			
			// send packets
			InventoryUpdate iu = new InventoryUpdate();
			iu.addModifiedItem(item);
			player.sendPacket(iu);
			player.broadcastPacket(new CharInfo(player));
			player.sendPacket(new UserInfo(player));
			player.broadcastPacket(new ExBrExtraUserInfo(player));
			
			return newEnchantLevel;
		}
		
		return -1;
	}
	
	private void setElement(L2PcInstance player, L2ItemInstance item, String type, int armorType)
	{
		if (item != null)
		{
			// set enchant value
			player.getInventory().unEquipItemInSlot(armorType);
			
			// New attr
			byte attr = Elementals.getElementId(type);
			byte attr1 = Elementals.getElementId(type);
			byte attr2 = Elementals.getElementId(type);
			
			byte clearAttr = -1;
			item.clearElementAttr(clearAttr);
			
			item.setElementAttr(attr, 60);
			item.setElementAttr(attr1, 60);
			item.setElementAttr(attr2, 60);
			
			player.getInventory().equipItem(item);
			
			// send packets
			InventoryUpdate iu = new InventoryUpdate();
			iu.addModifiedItem(item);
			player.sendPacket(iu);
		}
	}
	
	public String drawHtml(String title, String content, String enchantType)
	{
		String html = "<html>" + "<title>L2Xos~Ros</title>" + "<body>" + "<center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>" + "<font color=\"FF9900\">" + title + "</font></center><br>" + content + "<br><br>" + "<center><a action=\"bypass -h Quest enchantmanager " + enchantType + "\">Go Back</a></center>" + "</body>" + "</html>";
		
		return html;
	}
}
Link to comment
Share on other sites

  • 1 month later...

Excelente share, I was looking for a java enchanter because L2j doesn't support jython anymore and I found this one, it worked like a charm on the newest revision with minor fixes. Thank you very much.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.



×
×
  • Create New...