*

"[L2JFrozen][Manual-Patch]No Breack Item Fail Enchant"

Iniciado Por malocam, El día Mayo 07, 2018, 04:31:14 am



Seleccionar idioma
English Spanish Es

Autor Tema: [L2JFrozen][Manual-Patch]No Breack Item Fail Enchant  (Leído 235 veces)

0 Usuarios y 2 Visitantes están viendo este tema.

Conectado malocam en: Mayo 07, 2018, 04:31:14 am

  • 3D Maker
  • *
  • *
  • Rank: Nivel: Leyenda
  • *
  • Gracias Recibidas: 298
  • Mensajes: 218
  • Loco Por el 3D
Buenas Gente aqui Les dejo un Codigo en el que estoy Trabajando

Este codigo Hace que al Fallar en un Encantamiento , el item no se Rompa , Ni que se Cristalise, y Vuelva a +0

Se Lo Implementa Manual Mente y Esta en Fase Beta,

Codigo:

Código: [Seleccionar]
Index: L2jFrozen_GameServer/head-src/com/l2jfrozen/Gameserver/network/clientpackets/RequestEnchantItem.java
===================================================================
--- L2jFrozen_GameServer/head-src/com/l2jfrozen/Gameserver/network/clientpackets/RequestEnchantItem.java   (revision 1004)
+++ L2jFrozen_GameServer/head-src/com/l2jfrozen/Gameserver/network/clientpackets/RequestEnchantItem.java   (working copy)
===================================================================
@@ -691,21 +736,53 @@

-               if (item.isEquipped())
-               {
-                  if (item.isAugmented())
-                  {
-                     item.getAugmentation().removeBoni(activeChar);
-                  }
-                  
-                  L2ItemInstance[] unequiped = activeChar.getInventory().unEquipItemInSlotAndRecord(item.getEquipSlot());
-                  
-                  InventoryUpdate iu = new InventoryUpdate();
-                  for (L2ItemInstance element : unequiped)
-                  {
-                     iu.addModifiedItem(element);
-                  }
-                  activeChar.sendPacket(iu);
-                  
-                  activeChar.broadcastUserInfo();
-               }
               
               int count = item.getCrystalCount() - (item.getItem().getCrystalCount() + 1) / 2;
               if (count < 1)
               {
                  count = 1;
               }
               
               if (item.fireEvent("enchantFail", new Object[] {}) != null)
                  return;
-               L2ItemInstance destroyItem = activeChar.getInventory().destroyItem("Enchant", item, activeChar, null);
-               if (destroyItem == null)
-                  return;
-               
-               L2ItemInstance crystals = activeChar.getInventory().addItem("Enchant", crystalId, count, activeChar, destroyItem);
-               
-               sm = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);
-               sm.addItemName(crystals.getItemId());
-               sm.addNumber(count);
-               activeChar.sendPacket(sm);
-               
-               if (!Config.FORCE_INVENTORY_UPDATE)
-               {
-                  InventoryUpdate iu = new InventoryUpdate();
-                  if (destroyItem.getCount() == 0)
-                  {
-                     iu.addRemovedItem(destroyItem);
-                  }
-                  else
-                  {
-                     iu.addModifiedItem(destroyItem);
-                  }
-                  iu.addItem(crystals);
-                  
-                  activeChar.sendPacket(iu);
-               }
-               else
-               {
-                  activeChar.sendPacket(new ItemList(activeChar, true));
-               }
-               
-               StatusUpdate su = new StatusUpdate(activeChar.getObjectId());
-               su.addAttribute(StatusUpdate.CUR_LOAD, activeChar.getCurrentLoad());
-               activeChar.sendPacket(su);
-               
-               activeChar.broadcastUserInfo();
-               
-               L2World world = L2World.getInstance();
-               world.removeObject(destroyItem);


+                /**
+                * @author  Deilan Sasame
+                */
+                  if (!Config.NOBREACK_ITEMENCHANT){
+                  L2ItemInstance destroyItem = activeChar.getInventory().destroyItem("Enchant", item, activeChar, null);
+                  if (destroyItem != null)
+                     return;
+                  L2ItemInstance crystals = activeChar.getInventory().addItem("Enchant", crystalId, count, activeChar, destroyItem);
+                  
+                  sm = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);
+                  sm.addItemName(crystals.getItemId());
+                  sm.addNumber(count);
+                  activeChar.sendPacket(sm);
+                  
+                  if (item.isEquipped()){
+                     if (item.isAugmented()){
+                        item.getAugmentation().removeBoni(activeChar);
+                     }
+                     L2ItemInstance[] unequiped = activeChar.getInventory().unEquipItemInSlotAndRecord(item.getEquipSlot());
+                     
+                     InventoryUpdate iu = new InventoryUpdate();
+                     for (L2ItemInstance element : unequiped){
+                        iu.addModifiedItem(element);
+                     }
+                     activeChar.sendPacket(iu);
+                     activeChar.broadcastUserInfo();
+                  }
+                  if (!Config.FORCE_INVENTORY_UPDATE){
+                     InventoryUpdate iu = new InventoryUpdate() ;
+                     if (destroyItem.getCount() == 0){
+                        iu.addRemovedItem(destroyItem);
+                     }else{
+                        iu.addModifiedItem(destroyItem);
+                     }
+                     iu.addItem(crystals);
+                     activeChar.sendPacket(iu);
+                  }
+               }else{
+                  item.setEnchantLevel(0);
+                  item.updateDatabase();                  
+               }

Index: L2jFrozen_GameServer/head-src/com/l2jfrozen/Config.java
===================================================================
--- L2jFrozen_GameServer/head-src/com/l2jfrozen/Config.java   (revision 1004)
+++ L2jFrozen_GameServer/head-src/com/l2jfrozen/Config.java   (working copy)
===================================================================
@@ -2408,5 +2409,5 @@

-   public static String PVP2_CUSTOM_MESSAGE;

+   public static String PVP2_CUSTOM_MESSAGE;
+   public static boolean NOBREACK_ITEMENCHANT;

@@ -2553,13 +2554,13 @@
-         PVP2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP2CustomMeesage", "You have been teleported to PvP Zone 2!");

+         PVP2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP2CustomMeesage", "You have been teleported to PvP Zone 2!");
+         NOBREACK_ITEMENCHANT = Boolean.parseBoolean(L2JFrozenSettings.getProperty("NoBreackItemEnchant", "False"));

Index: L2jFrozen_GameServer/Config/functions/l2jfrozen.properties
===================================================================
--- L2jFrozen_GameServer/Config/functions/l2jfrozen.properties   (revision 1004)
+++ L2jFrozen_GameServer/Config/functions/l2jfrozen.properties   (working copy)
===================================================================
@@ -283,1 +284,1 @@
# Npc Protector Message
ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules!

+# No Destroy Item In Fail Enchant
+NoBreackItemEnchant = True


Cliente: Interlude
DataPack: L2jFrozen, L2jDrifter


Cualquier Bug , Duda, Problema, o Aporte Es Bienvenido
Espero que os Sea de ayuda
« Última modificación: Junio 17, 2018, 12:54:35 pm por melo920 »
Solo para Ayudar y Aprender
Twitter Youtube Facebook

El Respeto Es Para Quien Se lo Merece

Gracias:


Desconectado pske #1 en: Octubre 11, 2018, 05:23:57 pm

  • *
  • *
  • Rank: Nuevo Usuario
  • Gracias Recibidas: 0
  • Mensajes: 2
  • GamesBit.net
Si tenes tiempo podes hacer algo parecido pero en lugar de volver a 0 te reste un enchant te voy a adorar  cheesy

 

 
Cerrar
Bienvenido a GamesBit, por favor registrate para disfrutar del foro