Hello, everyone. I’m currently restoring the old enchantment system of aCis, but I have a question: some items in my inventory are not updating when I use enchantment as an administrator. This issue occurs only with earrings and rings; after enchanting, the values don’t update automatically only when I open and close the inventory. Does anyone know how I can fix this?
I use aCis 409 free version
package net.sf.l2j.gameserver.handler.admincommandhandlers;import net.sf.l2j.gameserver.data.SkillTable;import net.sf.l2j.gameserver.data.xml.ArmorSetData;import net.sf.l2j.gameserver.enums.Paperdoll;import net.sf.l2j.gameserver.handler.IAdminCommandHandler;import net.sf.l2j.gameserver.model.WorldObject;import net.sf.l2j.gameserver.model.actor.Player;import net.sf.l2j.gameserver.model.item.ArmorSet;import net.sf.l2j.gameserver.model.item.instance.ItemInstance;import net.sf.l2j.gameserver.model.item.kind.Armor;import net.sf.l2j.gameserver.model.item.kind.Item;import net.sf.l2j.gameserver.model.item.kind.Weapon;import net.sf.l2j.gameserver.network.serverpackets.SkillList;import net.sf.l2j.gameserver.skills.L2Skill;publicclassAdminEnchant implements IAdminCommandHandler{privatestatic final String[] ADMIN_COMMANDS ={"admin_seteh",// 6"admin_setec",// 10"admin_seteg",// 9"admin_setel",// 11"admin_seteb",// 12"admin_setew",// 7"admin_setes",// 8"admin_setle",// 1"admin_setre",// 2"admin_setlf",// 4"admin_setrf",// 5"admin_seten",// 3"admin_setun",// 0"admin_setba",// 13"admin_enchant"};@Overridepublicvoid useAdminCommand(String command,Player player){if(command.equals("admin_enchant"))
showMainPage(player);else{int armorType =-1;if(command.startsWith("admin_seteh"))
armorType =Item.SLOT_HEAD;elseif(command.startsWith("admin_setec"))
armorType =Item.SLOT_CHEST;elseif(command.startsWith("admin_seteg"))
armorType =Item.SLOT_GLOVES;elseif(command.startsWith("admin_seteb"))
armorType =Item.SLOT_FEET;elseif(command.startsWith("admin_setel"))
armorType =Item.SLOT_LEGS;elseif(command.startsWith("admin_setew"))
armorType =Item.SLOT_R_HAND;elseif(command.startsWith("admin_setes"))
armorType =Item.SLOT_L_HAND;elseif(command.startsWith("admin_setle"))
armorType =Item.SLOT_L_EAR;elseif(command.startsWith("admin_setre"))
armorType =Item.SLOT_R_EAR;elseif(command.startsWith("admin_setlf"))
armorType =Item.SLOT_L_FINGER;elseif(command.startsWith("admin_setrf"))
armorType =Item.SLOT_R_FINGER;elseif(command.startsWith("admin_seten"))
armorType =Item.SLOT_NECK;elseif(command.startsWith("admin_setun"))
armorType =Item.SLOT_UNDERWEAR;elseif(command.startsWith("admin_setba"))
armorType =Item.SLOT_BACK;if(armorType !=-1){try{int ench =Integer.parseInt(command.substring(12));// check valueif(ench <0|| ench >65535)
player.sendMessage("You must set the enchant level to be between 0-65535.");else
setEnchant(player, ench, armorType);}catch(Exception e){
player.sendMessage("Please specify a new enchant value.");}}// show the enchant menu after an action
showMainPage(player);}return;}/**
* @param activeChar
* @param enchant
* @param armorType
*/privatestaticvoid setEnchant(Player activeChar,int enchant,int armorType){WorldObject target = activeChar.getTarget();if(!(target instanceof Player))
target = activeChar;
final Player player =(Player) target;
final ItemInstance item = player.getInventory().getItemFrom(armorType);if(item == null){
player.sendMessage(player.getName()+" doesn't wear any item in "+ armorType +" slot.");return;}
final Item it = item.getItem();
final int oldEnchant = item.getEnchantLevel();// Do nothing if both values are the same.if(oldEnchant == enchant){
player.sendMessage(player.getName()+"'s "+ it.getName()+" enchant is already set to "+ enchant +".");return;}
item.setEnchantLevel(enchant, player);// If item is equipped, verify the skill obtention/drop (+4 duals, +6 armorset).if(item.isEquipped()){
final int currentEnchant = item.getEnchantLevel();// Skill bestowed by +4 duals.if(it instanceof Weapon){// Old enchant was >= 4 and new is lower : we drop the skill.if(oldEnchant >=4&& currentEnchant <4){
final L2Skill enchant4Skill =((Weapon) it).getEnchant4Skill();if(enchant4Skill != null){
player.removeSkill(enchant4Skill.getId(),false);
player.sendPacket(newSkillList(player));}}// Old enchant was < 4 and new is 4 or more : we add the skill.elseif(oldEnchant <4&& currentEnchant >=4){
final L2Skill enchant4Skill =((Weapon) it).getEnchant4Skill();if(enchant4Skill != null){
player.addSkill(enchant4Skill,false);
player.sendPacket(newSkillList(player));}}}// Add skill bestowed by +6 armorset.elseif(it instanceof Armor){// Old enchant was >= 6 and new is lower : we drop the skill.if(oldEnchant >=6&& currentEnchant <6){// Check if player is wearing a chest item.
final int itemId = player.getInventory().getItemIdFrom(Paperdoll.CHEST);if(itemId >0){
final ArmorSet armorSet =ArmorSetData.getInstance().getSet(itemId);if(armorSet != null){
final int skillId = armorSet.getEnchant6skillId();if(skillId >0){
player.removeSkill(skillId,false);
player.sendPacket(newSkillList(player));}}}}// Old enchant was < 6 and new is 6 or more : we add the skill.elseif(oldEnchant <6&& currentEnchant >=6){// Check if player is wearing a chest item.
final int itemId = player.getInventory().getItemIdFrom(Paperdoll.CHEST);if(itemId >0){
final ArmorSet armorSet =ArmorSetData.getInstance().getSet(itemId);if(armorSet != null && armorSet.isEnchanted6(player))// has all parts of set enchanted to 6 or more{
final int skillId = armorSet.getEnchant6skillId();if(skillId >0){
final L2Skill skill =SkillTable.getInstance().getInfo(skillId,1);if(skill != null){
player.addSkill(skill,false);
player.sendPacket(newSkillList(player));}}}}}}}
player.broadcastUserInfo();
player.sendMessage(player.getName()+"'s "+ it.getName()+" enchant was modified from "+ oldEnchant +" to "+ enchant +".");}privatevoid showMainPage(Player activeChar){
sendFile(activeChar,"enchant.htm");}@OverridepublicString[] getAdminCommandList(){return ADMIN_COMMANDS;}}
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.
I apologize for my incompetence. The ability to trade is limited only for builder 1. Ordinary characters can trade with each other, and this has nothing to do with auto loot.)
Question
Orochy
Hello, everyone. I’m currently restoring the old enchantment system of aCis, but I have a question: some items in my inventory are not updating when I use enchantment as an administrator. This issue occurs only with earrings and rings; after enchanting, the values don’t update automatically only when I open and close the inventory. Does anyone know how I can fix this?
I use aCis 409 free version
0 answers to this question
Recommended Posts
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.