L2JLisvus

Would you like to react to this message? Create an account in a few clicks or log in to continue.

    Wyvern Protection's

    yusuketh
    yusuketh


    Posts : 58
    Join date : 2013-07-12

    Wyvern Protection's Empty Wyvern Protection's

    Post  yusuketh 24th July 2014, 11:11

    This mod deserves to be added in customs



    Code:
    ### Eclipse Workspace Patch 1.0
    #P L2JBrasil
    Index: L2JBrasil_CORE/java/com/it/br/Config.java
    ===================================================================
    --- L2JBrasil_CORE/java/com/it/br/Config.java (revision 339)
    +++ L2JBrasil_CORE/java/com/it/br/Config.java (working copy)
    @@ -332,6 +334,9 @@
         // -            L2JBRASIL PROPIETERS           - //
         // --------------------------------------------- //
         // ============================================================
    +    public static boolean WYVERN_PROTECTION;
    +    public static String ID_RESTRICT;
    +    public static List<Integer> LISTID_RESTRICT;
      public static byte LEVEL_ON_ENTER;
         public static int SP_ON_ENTER;
         public static int STARTING_ADENA;
    @@ -440,7 +446,14 @@
           L2JBrasil.load(is);
           is.close();
     
    -      LEVEL_ON_ENTER = Byte.parseByte(L2JBrasil.getProperty("LevelOnEnter", "0"));
    +      WYVERN_PROTECTION = Boolean.parseBoolean(L2JBrasil.getProperty("WyvernProtectionEnabled", "False"));
    +            ID_RESTRICT = L2JBrasil.getProperty("WyvernItemID", "");
    +            LISTID_RESTRICT = new FastList<Integer>();
    +            for(String classId : ID_RESTRICT.split(","))
    +            {
    +                LISTID_RESTRICT.add(Integer.parseInt(classId));
    +            }
    +            LEVEL_ON_ENTER = Byte.parseByte(L2JBrasil.getProperty("LevelOnEnter", "0"));
           SP_ON_ENTER = Integer.parseInt(L2JBrasil.getProperty("SPOnEnter", "0"));
           STARTING_ADENA = Integer.parseInt(L2JBrasil.getProperty("StartingAdena", "100"));
           CUSTOM_STARTER_ITEMS_ENABLED = Boolean.parseBoolean(L2JBrasil.getProperty("CustomStarterItemsEnabled", "False"));
    Index: L2JBrasil_CORE/java/com/it/br/gameserver/network/clientpackets/UseItem.java
    ===================================================================
    --- L2JBrasil_CORE/java/com/it/br/gameserver/network/clientpackets/UseItem.java (revision 339)
    +++ L2JBrasil_CORE/java/com/it/br/gameserver/network/clientpackets/UseItem.java (working copy)
    @@ -27,6 +27,7 @@
     import com.it.br.gameserver.instancemanager.CastleManager;
     import com.it.br.gameserver.instancemanager.ClanHallManager;
     import com.it.br.gameserver.model.Inventory;
    +import com.it.br.gameserver.model.L2Character;
     import com.it.br.gameserver.model.L2Clan;
     import com.it.br.gameserver.model.L2Effect;
     import com.it.br.gameserver.model.L2ItemInstance;
    @@ -76,7 +77,15 @@
      activeChar.sendPacket(new ActionFailed());
      return;
      }
    -
    + if(Config.WYVERN_PROTECTION && activeChar.isInsideZone(L2Character.ZONE_PEACE))
    + {
    + if(Config.LISTID_RESTRICT.contains(item.getItemId()))
    + {
    +        activeChar.sendMessage("You can not use this item here within the city.");
    +        activeChar.sendPacket(new ActionFailed());
    +        return;
    + }
    + }
      if (!activeChar.isHero() && !activeChar.isGM() && !activeChar.isFakeHero() && (item.getItemId() == 6842 || (item.getItemId() >= 6611 && item.getItemId() <= 6621)))
      {
      activeChar.sendMessage("His weapon was destroyed  successfully you do not have requirements to use it");
    Index: L2JBrasil_CORE/java/com/it/br/gameserver/model/zone/type/L2TownZone.java
    ===================================================================
    --- L2JBrasil_CORE/java/com/it/br/gameserver/model/zone/type/L2TownZone.java (revision 339)
    +++ L2JBrasil_CORE/java/com/it/br/gameserver/model/zone/type/L2TownZone.java (working copy)
    @@ -22,9 +22,11 @@
     import org.w3c.dom.Node;
     
     import com.it.br.Config;
     import com.it.br.gameserver.model.L2Character;
     import com.it.br.gameserver.model.actor.instance.L2PcInstance;
     import com.it.br.gameserver.model.zone.L2ZoneType;
    +import com.it.br.gameserver.network.serverpackets.NpcHtmlMessage;
     import com.it.br.gameserver.util.Rnd;
     
     public class L2TownZone extends L2ZoneType
    @@ -88,12 +90,18 @@
      {
      if (character instanceof L2PcInstance)
      {
    + if((((L2PcInstance) character).isFlying() || ((L2PcInstance) character).isMounted()) && Config.WYVERN_PROTECTION)
    + {
    + ((L2PcInstance) character).dismount();
    + showHtmlWyvern((L2PcInstance) character);
    + }
      // PVP possible during siege, now for siege participants only
      // Could also check if this town is in siege, or if any siege is going on
      if (((L2PcInstance)character).getSiegeState() != 0 && Config.ZONE_TOWN == 1)
      return;
     
      //((L2PcInstance)character).sendMessage("You entered "+_townName);
    + ((L2PcInstance)character).setLastTownName(_townName);
      }
     
      if (!_noPeace && Config.ZONE_TOWN != 2) character.setInsideZone(L2Character.ZONE_PEACE, true);
    @@ -102,7 +110,8 @@
      @Override
      protected void onExit(L2Character character)
      {
    - if (!_noPeace) character.setInsideZone(L2Character.ZONE_PEACE, false);
    + if (!_noPeace)
    + character.setInsideZone(L2Character.ZONE_PEACE, false);
     
      // if (character instanceof L2PcInstance)
      //((L2PcInstance)character).sendMessage("You left "+_townName);
    @@ -114,7 +123,16 @@
     
      @Override
      protected void onReviveInside(L2Character character) {}
    +
    + public void showHtmlWyvern(L2PcInstance player)
    + {
    + String filename = "data/html/mods/protect/wyvern-protection.htm";
    +
    + NpcHtmlMessage html = new NpcHtmlMessage(player.getObjectId());
    + html.setFile(filename);
    + html.replace("%objectId%", String.valueOf(player.getObjectId()));
    + player.sendPacket(html);
    + }
      /**
       * Returns this town zones name
       * @return
    Index: L2JBrasil_CORE/config/custom/l2jbrasil.properties
    ===================================================================
    --- L2JBrasil_CORE/config/custom/l2jbrasil.properties (revision 339)
    +++ L2JBrasil_CORE/config/custom/l2jbrasil.properties (working copy)
    @@ -82,6 +82,17 @@
     DisableGradePenalty = False
     
     # -------------------------------- #
    +# -    Wyvern Protection's       - #
    +# -------------------------------- #
    +# data/html/mods/wyvern-protection.htm
    +# Enable / Disable Protection
    +# By Leonardo Alves.
    +WyvernProtectionEnabled = True
    +# Wyvern Item ID.
    +# format: id,id,id
    +WyvernItemID = 8663
    +
    +# -------------------------------- #
     # -   Equipment Restriction      - #
     # -------------------------------- #
     # Light Equipment Restriction
    Index: L2JBrasil_DP/data/html/mods/protect/wyvern-protection.htm
    ===================================================================
    --- L2JBrasil_DP/data/html/mods/protect/wyvern-protection.htm (revision 0)
    +++ L2JBrasil_DP/data/html/mods/protect/wyvern-protection.htm (revision 0)
    @@ -0,0 +1,10 @@
    +<html>
    +<title>Wyvern Item Protection</title>
    +<br>
    +<center>
    +<font color="green">Wyvern Protect:</font> You can not use this item within the city.<br>
    +<br>
    +<font color="green">By:</font> Leonardo Alves.<br>
    +<br>
    +</center>
    +</html>

    Credits: Leonardo Alves (sapoo).

      Current date/time is 19th May 2024, 15:10