Secret Experience

Secret Experience (https://secretexperience.net/)
-   [Lineage] Java Mods (https://secretexperience.net/lineage-java-mods/)
-   -   [L2JServer] Restricao de Item Em Olympiad (https://secretexperience.net/lineage-java-mods/25322-restricao-de-item-em-olympiad.html)

Mazokista 14-09-2010 05:34 PM

Restricao de Item Em Olympiad
 
1 Anexo(s)
Creditos : GUMA

Esse Mod Faz com qui Voce Possa impedir qual quer item qui voce nao Deseja nas Olympiads ;) Basta Colokar o ID do Item

Código:

Index: /Trunk/L2JStep_CORE/config/altsettings.properties
===================================================================
--- /Trunk/L2JStep_CORE/config/altsettings.properties (revision 99)
+++ /Trunk/L2JStep_CORE/config/altsettings.properties (revision 100)

@@ -133,2 +133,19 @@

+
+# This is the item restriction for olympiad. if an item is restricted , then a player cannot
+# Use it in olympiad mode. this is a fastlist. so it has to be like  (OlyRestrictedItems = 1,2,3) 
+OlyRestrictedItems = 0
+


Index: /TrunK/L2JStep_CORE/java/com/l2jstep/Config.java
===================================================================
--- /TrunK/L2JStep_CORE/java/com/l2jstep/Config.java (revision 99)
+++ /TrunK/L2JStep_CORE/java/com/l2jstep/Config.java (revision 100)

@@ -834,4 +834,9 @@
 
+    public static FastList<Integer> ALT_OLY_RESTRICTED_ITEMS = new FastList<Integer>();

@@ -1984,4 +1989,8 @@
+                ALT_OLY_RESTRICTED_ITEMS = new FastList<Integer>(); 
+                    for (String id : AltSettings.getProperty("OlyRestrictedItems","0").split(",")) 
+                    { 
+                                ALT_OLY_RESTRICTED_ITEMS.add(Integer.parseInt(id)); 
+                    }


Index: /Trunk/L2JStep_CORE/java/com/l2jstep/gameserver/model/L2ItemInstance.java
===================================================================
--- /Trunk/L2JStep_CORE/java/com/l2jstep/gameserver/model/L2ItemInstance.java (revision 99)
+++ /Trunk/L2JStep_CORE/java/com/l2jstep/gameserver/model/L2ItemInstance.java (revision 100)

@@ -107,4 +107,10 @@
 
    public long getDropTime()
    {
        return _dropTime;
    }
+    public boolean isOlyRestrictedItem()
+    {
+        return (Config.ALT_OLY_RESTRICTED_ITEMS.contains(_itemId));
+    }

   
Index: /Trunk/L2JStep_CORE/java/com/l2jstep/gameserver/Olympiad.java
===================================================================
--- /Trunk/L2JStep_CORE/java/com/l2jstep/gameserver/Olympiad.java (revision 99)
+++ /Trunk/L2JStep_CORE/java/com/l2jstep/gameserver/Olympiad.java (revision 100)

@@ -107,4 +107,10 @@
            //Remove Hero Weapons
            //Possible fix for Exploits With Conversion SA Weapons
            // check to prevent the using of weapon/shield on strider/wyvern
-            L2ItemInstance wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
-            if (wpn == null) wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND);
-            if (wpn != null &&
-                    (
-                            (wpn.getItemId() >= 6611 && wpn.getItemId() <= 6621) ||
-                            wpn.getItemId() == 6842 ||
-                            wpn.getItemId() == 5597 ||
-                            wpn.getItemId() == 5605 ||
-                            wpn.getItemId() == 6314 ||
-                            wpn.getItemId() == 7715 ||
-                            wpn.getItemId() == 8119 ||
-                            wpn.getItemId() == 8138 ||
-                            wpn.getItemId() == 8146 ||
-                            wpn.getItemId() == 8815
-                    )
-                )

+            L2ItemInstance wpn;
+            if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) != null)

            {
-                L2ItemInstance[] unequiped = player.getInventory().unEquipItemInBodySlotAndRecord(wpn.getItem().getBodyPart());
-                InventoryUpdate iu = new InventoryUpdate();
-                for (int i = 0; i < unequiped.length; i++)
-                    iu.addModifiedItem(unequiped[i]);
-                player.sendPacket(iu);
-                player.abortAttack();
-                player.broadcastUserInfo();
-
-                // this can be 0 if the user pressed the right mousebutton twice very fast
-                if (unequiped.length > 0)
-                {
-                    if (unequiped[0].isWear())
-                        return;
-                    SystemMessage sm = null;
-                    if (unequiped[0].getEnchantLevel() > 0)
-                    {
-                        sm = new SystemMessage(SystemMessageId.EQUIPMENT_S1_S2_REMOVED);
-                        sm.addNumber(unequiped[0].getEnchantLevel());
-                        sm.addItemName(unequiped[0].getItemId());
-                    }
-                    else
-                    {
-                        sm = new SystemMessage(SystemMessageId.S1_DISARMED);
-                        sm.addItemName(unequiped[0].getItemId());
-                    }
-                    player.sendPacket(sm);
-                }

+                wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
+                checkWeaponArmor(player, wpn);

            }
+            if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND) != null)
+            {
+                wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND);
+                checkWeaponArmor(player, wpn);
+            }
+            if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND) != null)
+            {
+                wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND);
+                checkWeaponArmor(player, wpn);
+            }
+            if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_UNDER) != null)
+            {
+                wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_UNDER);
+                checkWeaponArmor(player, wpn);
+            }
+            if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEAR) != null)
+            {
+                wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEAR);
+                checkWeaponArmor(player, wpn);
+            }
+            if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_REAR) != null)
+            {
+                wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_REAR);
+                checkWeaponArmor(player, wpn);
+            }
+            if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_NECK) != null)
+            {
+                wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_NECK);
+                checkWeaponArmor(player, wpn);
+            }
+            if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LFINGER) != null)
+            {
+                wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LFINGER);
+                checkWeaponArmor(player, wpn);
+            }
+            if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RFINGER) != null)
+            {
+                wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RFINGER);
+                checkWeaponArmor(player, wpn);
+            }
+            if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_HEAD) != null)
+            {
+                wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_HEAD);
+                checkWeaponArmor(player, wpn);
+            }
+            if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES) != null)
+            {
+                wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES);
+                checkWeaponArmor(player, wpn);
+            }
+            if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST) != null)
+            {
+                wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST);
+                checkWeaponArmor(player, wpn);
+            }
+            if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS) != null)
+            {
+                wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS);
+                checkWeaponArmor(player, wpn);
+            }
+            if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET) != null)
+            {
+                wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET);
+                checkWeaponArmor(player, wpn);
+            }
+            if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_BACK) != null)
+            {
+                wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_BACK);
+                checkWeaponArmor(player, wpn);
+            }
+            if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FACE) != null)
+            {
+                wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FACE);
+                checkWeaponArmor(player, wpn);
+            }
+            if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_HAIR) != null)
+            {
+                wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_HAIR);
+                checkWeaponArmor(player, wpn);
+            }
+            if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_DHAIR) != null)
+            {
+                wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_DHAIR);
+                checkWeaponArmor(player, wpn);
+            }

 
            //Remove ss/sps/bsps automation
            Map<Integer, Integer> activeSoulShots = player.getAutoSoulShot();
@@ -702,4 +748,35 @@
                }
        }
    }
-}
\ No newline at end of file
+    private void checkWeaponArmor(L2PcInstance player, L2ItemInstance wpn)
+    {
+        if (wpn != null && (wpn.isOlyRestrictedItem()))
+        {
+            L2ItemInstance[] unequiped = player.getInventory().unEquipItemInBodySlotAndRecord(wpn.getItem().getBodyPart());
+            InventoryUpdate iu = new InventoryUpdate();
+            for (L2ItemInstance element : unequiped)
+                iu.addModifiedItem(element);
+            player.sendPacket(iu);
+            player.abortAttack();
+            player.broadcastUserInfo();
+            if (unequiped.length > 0)
+            {
+                if (unequiped[0].isWear())
+                    return;
+                SystemMessage sm = null;
+                if (unequiped[0].getEnchantLevel() > 0)
+                {
+                    sm = new SystemMessage(SystemMessageId.EQUIPMENT_S1_S2_REMOVED);
+                    sm.addNumber(unequiped[0].getEnchantLevel());
+                    sm.addItemName(unequiped[0].getItemId());
+                }
+                else
+                {
+                    sm = new SystemMessage(SystemMessageId.S1_DISARMED);
+                    sm.addItemName(unequiped[0].getItemId());
+                }
+                player.sendPacket(sm);
+            }
+        }
+    }
+}


Index: TrunK/*********_CORE/java/com/it/br/gameserver/clientpackets/UseItem.java
===================================================================
--- TrunK/*********_CORE/java/com/it/br/gameserver/clientpackets/UseItem.java (revision 1332)
+++ TrunK/*********_CORE/java/com/it/br/gameserver/clientpackets/UseItem.java (revision 1430)

@@ -337,6 +337,10 @@
                                            return;
                                    }   
                            }
+                if (activeChar.isInOlympiadMode() && (item.isOlyRestrictedItem()))
+                {
+                    return;
+                }

                // Don't allow weapon/shield hero equipment during Olympiads
                if (activeChar.isInOlympiadMode() && (bodyPart == L2Item.SLOT_LR_HAND || bodyPart == L2Item.SLOT_L_HAND || bodyPart == L2Item.SLOT_R_HAND) && ((item.getItemId() >= 6611 && item.getItemId() <= 6621) || item.getItemId() == 6842))
                {return;}



Horários baseados na GMT -3. Agora são 07:40 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0