U3Games

Games | Desarrollo & Soporte => L2 | Sección de Servidores => Lineage => L2 | Implementaciones => Mensaje iniciado por: Swarlog en Ago 03, 2025, 01:36 AM

Título: AIO System
Publicado por: Swarlog en Ago 03, 2025, 01:36 AM
Es funcional tanto en H5 como Freya, para interlude necesitaran realizar algunas adaptaciones pero nada del otro mundo. By Fissban.

CitarL2AioInstance.java

    /*
     * Copyright (C) 2013 AdminsProL2
     *
     * This program is free software: you can redistribute it and/or modify it under
     * the terms of the GNU General Public License as published by the Free Software
     * Foundation, either version 3 of the License, or (at your option) any later
     * version.
     *
     * This program is distributed in the hope that it will be useful, but WITHOUT
     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
     * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
     * details.
     *
     * You should have received a copy of the GNU General Public License along with
     * this program. If not, see <http://www.gnu.org/licenses/>.
     */

    package com.l2jserver.gameserver.model.actor.instance;

    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.logging.Logger;

    import com.l2jserver.Config;
    import com.l2jserver.L2DatabaseFactory;
    import com.l2jserver.gameserver.datatables.ExperienceTable;
    import com.l2jserver.gameserver.datatables.SkillTable;
    import com.l2jserver.gameserver.model.skills.L2Skill;

    /**
     * @autor Fissban
     */

    public class L2AioInstance
    {
       private static final Logger _log = Logger.getLogger(L2AioInstance.class.getName());
       
       private L2AioInstance()
       {
       }
       
       public boolean leerAio(L2PcInstance player)
       {
          boolean isAio = false;
         
          try (Connection con = L2DatabaseFactory.getInstance().getConnection();
             PreparedStatement statement = con.prepareStatement("SELECT charId FROM aios WHERE charId=?"))
          {
             statement.setInt(1, player.getObjectId());
             ResultSet rset = statement.executeQuery();
             
             isAio = rset.next();
          }
          catch (SQLException sqle)
          {
             _log.severe("Couldnt get aio data from " + player.getName());
             _log.severe(sqle.getMessage());
             return false;
             
          }
          if (isAio)
          {
             return true;
          }
          return false;
       }
       
       public void addAio(L2PcInstance player)
       {
          // insertar datos en la DB
          updatedb(player, true);
         
          // set lvl
          long pXp = player.getExp();
          long tXp = ExperienceTable.getInstance().getExpForLevel(85);
          player.addExpAndSp(tXp - pXp, 0);
         
       }
       
       public void removeAio(L2PcInstance player)
       {
          updatedb(player, false);
       }
       
       private void updatedb(L2PcInstance player, boolean add)
       {
          String sql = "";
          if (add)
          {
             sql = "INSERT INTO aios (charId) VALUES (?)";
          }
          else
          {
             sql = "DELETE FROM aios WHERE charId = ?";
          }
         
          try (Connection con = L2DatabaseFactory.getInstance().getConnection();
             PreparedStatement statement = con.prepareStatement(sql);)
          {
             statement.setInt(1, player.getObjectId());
             statement.execute();
          }
          catch (SQLException sqle)
          {
             _log.severe("Couldnt get aio data from " + player.getName());
             _log.severe(sqle.getMessage());
          }
       }
       
       public void onEnter(L2PcInstance player)
       {
          if (player.isAio())
          {
             if (Config.AIO_CUSTOM_TITLE_AD)
             {
                player.setTitle(Config.AIO_CUSTOM_TITLE);
             }
             if (Config.AIO_COLOR_NAME_TITLE)
             {
                Integer colorName = Integer.decode("0x" + Config.AIOS_NAMECOLOR);
                Integer colorTitle = Integer.decode("0x" + Config.AIOS_TITLECOLOR);
                player.getAppearance().setNameColor(colorName);
                player.getAppearance().setTitleColor(colorTitle);
             }
             for (int skill : Config.AIO_SKILLS.keySet())
             {
                L2Skill sk = SkillTable.getInstance().getInfo(skill, Config.AIO_SKILLS.get(skill));
                player.addSkill(sk, false);
             }
          }
       }
       
       public static L2AioInstance getInstance()
       {
          return SingleTonHolder._instance;
       }
       
       static class SingleTonHolder
       {
          @SuppressWarnings("synthetic-access")
          static L2AioInstance _instance = new L2AioInstance();
       }
    }

CitarConfig.java

       public static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
       public static final String SECURITY_CONFIG_FILE = "./config/Security.properties";
       public static final String EMAIL_CONFIG_FILE = "./config/Email.properties";
       public static final String CH_SIEGE_FILE = "./config/ConquerableHallSiege.properties";
    +   // --------------------------------------------------
    +   // L2jAdmins Property File Definitions
    +   // --------------------------------------------------
    +   public static final String AIO_CONFIG_FILE = "./config/AIO.properties";

         FLOOD_PROTECTOR_MULTISELL = new FloodProtectorConfig("MultiSellFloodProtector");
         FLOOD_PROTECTOR_TRANSACTION = new FloodProtectorConfig("TransactionFloodProtector");
         FLOOD_PROTECTOR_MANUFACTURE = new FloodProtectorConfig("ManufactureFloodProtector");
         FLOOD_PROTECTOR_MANOR = new FloodProtectorConfig("ManorFloodProtector");
         FLOOD_PROTECTOR_SENDMAIL = new FloodProtectorConfig("SendMailFloodProtector");
         FLOOD_PROTECTOR_CHARACTER_SELECT = new FloodProtectorConfig("CharacterSelectFloodProtector");
         FLOOD_PROTECTOR_ITEM_AUCTION = new FloodProtectorConfig("ItemAuctionFloodProtector");
+         
+         L2Properties AIOandVIPSettings = new L2Properties();
+         final File AIO = new File(AIO_CONFIG_FILE);
+         try (InputStream is = new FileInputStream(AIO))

CitarEnterWorld.java

if (Config.GM_GIVE_SPECIAL_AURA_SKILLS)
         {
            SkillTreesData.getInstance().addSkills(activeChar, true);
         }
      }
+     
+      // System Aio
+      L2AioInstance.getInstance().onEnter(activeChar);

CitarAIO.properties

    ###########################################
    #                Sistema Aio              #
    ###########################################
    # author: Fissban

    # Enable/Disable Color in Name and Title for Aio users.
    AioColorNameTitle = True

    # Custom Color in name for Aio users.
    AioNameColor = CC00FF

    # Custom Color in title for Aio users.
    AioTitleColor = CC00FF

    # Enable/Disable Custom Title for aio users.
    CustomTitle = True

    # Custom Title for aio users
    SetCustomTitle = AIO

    # Skills gived to Aio players. They are not stored on databse.
    # Player will recive them at Enterworld
    # Format: skillid,skilllevel;skillid,skilllevel;
    AioSkills = 1085,3;1304,3;1087,3;1354,1;1062,2;1005,3;1243,6;1045,6;1048,6;\
    1311,6;168,3;213,8;1007,3;1309,3;1552,3;1006,3;1229,15;1308,3;1253,3;1284,3;\
    1009,3;1310,4;1363,1;1362,1;1397,3;1292,6;1078,6;307,1;276,1;309,1;274,1;275,1;\
    272,1;277,1;273,1;311,1;366,1;365,1;310,1;271,1;1242,3;1257,3;1353,3;1391,3;\
    1352,1;229,7;228,3;1077,3;1218,33;1059,3;1219,33;1217,33;1388,3;1389,3;1240,3;\
    1086,2;1032,3;1073,2;1036,2;1035,4;1068,3;1003,3;1282,2;1356,1;1355,1;1357,33;\
    1044,3;1182,3;1191,3;1033,3;1189,3;1259,4;1306,6;234,23;1040,3;364,1;264,1;306,1;\
    269,1;270,1;265,1;363,1;349,1;308,1;305,1;304,1;267,1;266,1;268,1;1390,3;1303,2;\
    1204,2;1268,4;1413,1;4699,8;4700,8;4703,8

CitarSQL

    CREATE TABLE IF NOT EXISTS `aios` (
      `charId` int(10) NOT NULL,
      PRIMARY KEY (`charId`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

CitarAdminAio.java

    /*
     * Copyright (C) 2013 AdminsProL2
     *
     * This program is free software: you can redistribute it and/or modify it under
     * the terms of the GNU General Public License as published by the Free Software
     * Foundation, either version 3 of the License, or (at your option) any later
     * version.
     *
     * This program is distributed in the hope that it will be useful, but WITHOUT
     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
     * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
     * details.
     *
     * You should have received a copy of the GNU General Public License along with
     * this program. If not, see <http://www.gnu.org/licenses/>.
     */

    package handlers.admincommandhandlers;

    import com.l2jserver.gameserver.handler.IAdminCommandHandler;
    import com.l2jserver.gameserver.model.L2Object;
    import com.l2jserver.gameserver.model.actor.instance.L2AioInstance;
    import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;

    /**
     * @author fissban
     */

    public class AdminAio implements IAdminCommandHandler
    {
       
       private static final String[] ADMIN_COMMANDS =
       {
          "admin_setaio",
          "admin_removeaio",
          "admin_aio"
       };
       
       @Override
       public String[] getAdminCommandList()
       {
          return ADMIN_COMMANDS;
       }
       
       @Override
       public boolean useAdminCommand(String command, L2PcInstance activeChar)
       {
          // ???
          L2Object target = activeChar.getTarget();
          // ???
          L2PcInstance player = (L2PcInstance) target;
         
          if ((target == null) || !(target instanceof L2PcInstance))
          {
             activeChar.sendMessage("No tienes ningun target!");
             return false;
          }
         
          if (command.equals("admin_setaio") || command.startsWith("admin_setaio"))
          {
             
             if (player.isAio())
             {
                activeChar.sendMessage("El usuario " + player.getName() + " ya es Aio");
             }
             else
             {
                activeChar.sendMessage("El usuario " + player.getName() + " es ahora Aio");
                player.sendMessage("Feclicitaciones, ya eres un Char AIO");
                player.sendMessage("No olvides relogear!");
                L2AioInstance.getInstance().addAio(player);
               
             }
          }
         
          if (command.equals("admin_removeaio") || command.startsWith("admin_removeaio"))
          {
             // if (L2AioInstance.getInstance().Aio())
             if (player.isAio())
             {
                activeChar.sendMessage("El usuario " + player.getName() + " ya no es Aio");
                player.sendMessage("Has perdido el status de AIO!");
                player.sendMessage("No olvides relogear!");
                L2AioInstance.getInstance().removeAio(player);
             }
             else
             {
                activeChar.sendMessage("El usuario " + player.getName() + " no es Aio");
             }
          }
         
          if (command.equals("admin_aio") || command.startsWith("admin_aio"))
          {
             activeChar.sendMessage("Necesita tener targeteado al usuario a hacer o quitar el Aio");
             activeChar.sendMessage("use el comando //setaio para hacer un usuario Aio");
             activeChar.sendMessage("use el comando //removeaio para quitarle el Aio a un usuario");
          }
          return false;
       }
    }

CitaradminCommands.xml

       <admin command="admin_zone_visual_clear" accessLevel="7" />

       <!-- VOICE COMMANDS -->
       <admin command="banchat" accessLevel="7" />
       <admin command="debug" accessLevel="7" />
       <admin command="unbanchat" accessLevel="7" />
       
       <!-- ADMINSPROL2 -->
    +   <admin command="admin_setaio" accessLevel="7" />
    +   <admin command="admin_removeaio" accessLevel="7" />
    +   <admin command="admin_aio" accessLevel="7" />

CitaradminCommands.xsd

                               <xs:enumeration value="debug" />
                               <xs:enumeration value="recall" />
                               <xs:enumeration value="teleportto" />
                               <xs:enumeration value="unbanchat" />
    +                           <xs:enumeration value="admin_setaio" />
    +                           <xs:enumeration value="admin_removeaio" />
    +                           <xs:enumeration value="admin_aio" />

CitarL2PcInstance.java

          @Override
          public void doCast(L2Skill skill)
          {
             super.doCast(skill);
             
             // cancel the recent fake-death protection instantly if the player attacks or casts spells
             getPlayer().setRecentFakeDeath(false);
          }
       }
       
    +   // System AIO
    +   private boolean _aio;

       public boolean getExchangeRefusal()
       {
          return _exchangeRefusal;
       }
       
       public BlockList getBlockList()
       {
          return _blockList;
       }
       
    +   // System AIO
    +   public void setAio(boolean value)
    +   {
    +      _aio = value;
    +   }
    +   
    +   // System AIO
    +   @Override
    +   public boolean isAio()
    +   {
    +      return _aio;
    +   }