Welcome, Guest. Please login or register.

Author Topic: hello I hope it goes well can you help me to adapt a code  (Read 46 times)

0 Members and 1 Guest are viewing this topic.

Offline progressive

  • L2jHellas User
  • *
  • Posts: 9
  • Country: ar
  • Karma: 0
hello I hope it goes well can you help me to adapt a code
« on: November 14, 2022, 12:43:42 am »
Code: [Select]
### Eclipse Workspace Patch 1.0
#P L2jFrozen_GameServer
Index: head-src/com/l2jfrozen/Config.java
===================================================================
--- head-src/com/l2jfrozen/Config.java    (revision 1004)
+++ head-src/com/l2jfrozen/Config.java    (working copy)
@@ -2398,6 +2398,7 @@
    public static String FARM2_CUSTOM_MESSAGE;
    public static String PVP1_CUSTOM_MESSAGE;
    public static String PVP2_CUSTOM_MESSAGE;
+    public static boolean SHOW_NPC_ENCHANT;

    //============================================================
    public static void loadL2JFrozenConfig()
@@ -2517,6 +2518,7 @@
            FARM2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("Farm2CustomMeesage", "You have been teleported to Farm Zone 2!");
            PVP1_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP1CustomMeesage", "You have been teleported to PvP Zone 1!");
            PVP2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP2CustomMeesage", "You have been teleported to PvP Zone 2!");
+            SHOW_NPC_ENCHANT = Boolean.parseBoolean(L2JFrozenSettings.getProperty("ShowNpcEnchantWeapon", "False"));
        }
        catch(Exception e)
        {
Index: config/functions/l2jfrozen.properties
===================================================================
--- config/functions/l2jfrozen.properties    (revision 1004)
+++ config/functions/l2jfrozen.properties    (working copy)
@@ -280,4 +280,9 @@
ProtectorSkillLevel = 13
ProtectorSkillTime = 600
# Npc Protector Message
-ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules!
\ No newline at end of file
+ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules!
+
+# Show random enchant weapon effect for NPC's.
+# Enchantment is only visual, range is 4-21.
+# Default: False
+ShowNpcEnchantWeapon = False
Index: head-src/com/l2jfrozen/gameserver/datatables/sql/NpcTable.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/datatables/sql/NpcTable.java    (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/datatables/sql/NpcTable.java    (working copy)
@@ -122,6 +122,7 @@
                        "matkspd",
                        "rhand",
                        "lhand",
+                        "enchant",
                        "armor",
                        "walkspd",
                        "runspd",
@@ -184,6 +185,7 @@
                            "matkspd",
                            "rhand",
                            "lhand",
+                            "enchant",
                            "armor",
                            "walkspd",
                            "runspd",
@@ -671,6 +673,7 @@
            npcDat.set("aggroRange", NpcData.getInt("aggro"));
            npcDat.set("rhand", NpcData.getInt("rhand"));
            npcDat.set("lhand", NpcData.getInt("lhand"));
+            npcDat.set("enchant", NpcData.getInt("enchant"));
            npcDat.set("armor", NpcData.getInt("armor"));
            npcDat.set("baseWalkSpd", NpcData.getInt("walkspd"));
            npcDat.set("baseRunSpd", NpcData.getInt("runspd"));
@@ -781,6 +784,7 @@
                    "matkspd",
                    "rhand",
                    "lhand",
+                    "enchant",
                    "armor",
                    "walkspd",
                    "runspd",
Index: head-src/com/l2jfrozen/gameserver/templates/L2NpcTemplate.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/templates/L2NpcTemplate.java    (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/templates/L2NpcTemplate.java    (working copy)
@@ -64,6 +64,7 @@
    public final int aggroRange;
    public final int rhand;
    public final int lhand;
+    public final int enchantEffect;
    public final int armor;
    public final String factionId;
    public final int factionRange;
@@ -147,6 +148,7 @@
        aggroRange = set.getInteger("aggroRange");
        rhand = set.getInteger("rhand");
        lhand = set.getInteger("lhand");
+        enchantEffect = set.getInteger("enchant");
        armor = set.getInteger("armor");
        String f = set.getString("factionId", null);
        if(f == null)
Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2NpcInstance.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2NpcInstance.java    (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2NpcInstance.java    (working copy)
@@ -160,6 +160,8 @@
    /** The _current r hand id. */
    private int _currentRHandId; // normally this shouldn't change from the template, but there exist exceptions

+    private int _currentEnchant;
+
    /** The _current collision height. */
    private int _currentCollisionHeight; // used for npc grow effect skills

@@ -355,6 +357,7 @@
        // initialize the "current" equipment
        _currentLHandId = getTemplate().lhand;
        _currentRHandId = getTemplate().rhand;
+        _currentEnchant = Config.SHOW_NPC_ENCHANT ? Rnd.get(4,21) : getTemplate().enchantEffect;
        // initialize the "current" collisions
        _currentCollisionHeight = getTemplate().collisionHeight;
        _currentCollisionRadius = getTemplate().collisionRadius;
@@ -609,6 +612,11 @@
        return _currentRHandId;
    }

+    public int getEnchantEffect()
+    {
+        return _currentEnchant;
+    }
+
    /**
     * Return True if this L2NpcInstance has drops that can be sweeped.<BR>
     * <BR>
@@ -3247,6 +3255,13 @@
        _currentRHandId = newWeaponId;
    }

+    public void setLRHandId(int newLWeaponId, int newRWeaponId)
+    {
+        _currentRHandId = newRWeaponId;
+        _currentLHandId = newLWeaponId;
+        updateAbnormalEffect();
+    }
+
    /**
     * Sets the collision height.
     * @param height the new collision height
Index: head-src/com/l2jfrozen/gameserver/network/serverpackets/NpcInfo.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/serverpackets/NpcInfo.java    (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/serverpackets/NpcInfo.java    (working copy)
@@ -58,7 +58,7 @@
    private int _runSpd, _walkSpd, _swimRunSpd, _swimWalkSpd, _flRunSpd, _flWalkSpd, _flyRunSpd, _flyWalkSpd;

    /** The _lhand. */
-    private int _rhand, _lhand;
+    private int _rhand, _lhand, _enchantEffect;

    /** The _collision radius. */
    private int _collisionHeight, _collisionRadius;
@@ -95,6 +95,7 @@
        _isAttackable = cha.isAutoAttackable(attacker);
        _rhand = cha.getRightHandItem();
        _lhand = cha.getLeftHandItem();
+        _enchantEffect = cha.getEnchantEffect();
        _isSummoned = false;
        _collisionHeight = cha.getCollisionHeight();
        _collisionRadius = cha.getCollisionRadius();
@@ -240,7 +241,7 @@
        writeC(0x00); // C3  team circle 1-blue, 2-red
        writeF(_collisionRadius);
        writeF(_collisionHeight);
-        writeD(0x00); // C4
+        writeD(_enchantEffect);
        writeD(0x00); // C6
    }