A Project for Chronicle 4 based on L2JServer.


    [Share] AIO Buffer

    Share
    avatar
    mystogan64

    Posts : 51
    Join date : 2013-10-04

    [Share] AIO Buffer

    Post  mystogan64 on 11th October 2013, 02:05

    Another share for those who might want to use AIO-Buffer system for their server Smile
    Lets begin.........................................

    net.sf.l2j.gameserver.Olympiad.java
    Code:

    noble.sendPacket(new SystemMessage(SystemMessage.THE_OLYMPIAD_GAME_IS_NOT_CURRENTLY_IN_PROGRESS));
     return false;
     }
    +if (noble.isAio())
    + {
    + noble.sendMessage("AIO players can't register in Olympiad");
    + return false;
    + }
    Create new .java in net.sf.l2j.gameserver.model with name AioBufferHandler.java and paste this inside.
    Code:

    package net.sf.l2j.gameserver.model;

    import java.util.logging.Logger;

    import net.sf.l2j.gameserver.clientpackets.Say2;
    import net.sf.l2j.gameserver.datatables.SkillTable;
    import net.sf.l2j.gameserver.datatables.SkillTreeTable;
    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    import net.sf.l2j.gameserver.serverpackets.CreatureSay;

    public class AioBuffHandler
    {
     private static final Logger _log = Logger.getLogger((AioBuffHandler.class.getName()));
     
    private final static int SKILL_IDS_LEVELS[][] =
     {
     {
     1204,
     2
     },
     {
     1242,
     3
     },
     {
     1243,
     6
     },
     {
     1240,
     3
     },
     {
     1032,
     3
     },
     {
     1035,
     4
     },
     {
     1036,
     2
     },
     {
     1040,
     3
     },
     {
     1043,
     1
     },
     {
     1044,
     3
     },
     {
     1045,
     6
     },
     {
     1047,
     4
     },
     {
     1048,
     6
     },
     {
     1059,
     3
     },
     {
     1062,
     2
     },
     {
     1068,
     3
     },
     {
     1073,
     2
     },
     {
     1077,
     3
     },
     {
     1078,
     6
     },
     {
     1085,
     3
     },
     {
     1086,
     2
     },
     {
     1087,
     3
     },
     {
     1182,
     3
     },
     {
     1189,
     3
     },
     {
     1191,
     3
     },
     {
     1250,
     3
     },
     {
     1251,
     2
     },
     {
     1252,
     3
     },
     {
     1253,
     3
     },
     {
     1257,
     3
     },
     {
     1259,
     4
     },
     {
     1303,
     2
     },
     {
     1304,
     3
     },
     {
     1308,
     3
     },
     {
     1307,
     3
     },
     {
     1309,
     3
     },
     {
     1310,
     4
     },
     {
     1323,
     1
     },
     {
     1353,
     1
     },
     {
     1354,
     1
     },
     {
     1355,
     1
     },
     {
     1356,
     1
     },
     {
     1357,
     1
     },
     {
     1363,
     1
     },
     {
     1268,
     4
     },
     {
     264,
     1
     },
     {
     265,
     1
     },
     {
     266,
     1
     },
     {
     267,
     1
     },
     {
     268,
     1
     },
     {
     269,
     1
     },
     {
     270,
     1
     },
     {
     271,
     1
     },
     {
     272,
     1
     },
     {
     273,
     1
     },
     {
     274,
     1
     },
     {
     275,
     1
     },
     {
     276,
     1
     },
     {
     277,
     1
     },
     {
     304,
     1
     },
     {
     305,
     1
     },
     {
     306,
     1
     },
     {
     307,
     1
     },
     {
     308,
     1
     },
     {
     309,
     1
     },
     {
     310,
     1
     },
     {
     311,
     1
     },
     {
     365,
     1
     },
     {
     364,
     1
     },
     {
     363,
     1
     },
     {
     349,
     1
     },
     {
     1390,
     3
     },
     {
     1391,
     3
     },
     {
     4699,
     8
     },
     {
     4700,
     8
     },
     {
     4702,
     8
     },
     {
     4703,
     8
     },
     {
     1218,
     33
     },
     {
     1219,
     33
     },
     {
     1013,
     32
     },
     {
     1306,
     6
     },
     {
     600, // Aio Boost
     1
     }
     };
     
    public static void setAio(L2PcInstance player, L2PcInstance target)
     {
     if ((player == null) || (target == null))
     {
     return;
     }
     
    if (target.isAio())
     {
     player.sendMessage("Player " + target.getName() + " is already an AIO");
     return;
     }
     
    else if (target.isSubClassActive())
     {
     player.sendMessage("Player must be at main class in order to become an AIO");
     return;
     }
     
    else if (target.isTeleporting() || target.isInOlympiadMode() || target.isDead() || target.isAlikeDead())
     {
     player.sendMessage("Action failed , nothing happened");
     return;
     }
     
    target.setAio(true);
     player.sendMessage("Player " + target.getName() + " is now an AIO!");
     target.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Aio System", "Dear player, you have AIO status now with special abilities , congratulations."));
     
    }
     
    public static void changeName(String beforeName, L2PcInstance target)
     {
     if ((beforeName == null) || (beforeName == "") || (target == null))
     {
     return;
     }
     
    String currentName = target.getName();
     String newName = beforeName + currentName;
     
    target.setName(newName);
     target.setRecomHave(255);
     target.broadcastUserInfo();
     }
     
    public static void removeCurrentSkills(L2PcInstance player, L2PcInstance target)
     {
     if ((player == null) || (target == null))
     {
     return;
     }
     
    L2Skill[] playerCurrentSkills = target.getAllSkills();
     
    // loop into skills to remove one by one
     for (L2Skill skill : playerCurrentSkills)
     {
     if (skill == null)
     {
     player.sendMessage("Warning:Error occured in skill " + skill.getName() + ".");
     continue;
     }
     target.removeSkill(skill);
     
    }
     target.getSkillList();
     }
     
    public static void giveAioSkills(L2PcInstance player, L2PcInstance target)
     {
     for (int[] skillIdLevel : SKILL_IDS_LEVELS)
     {
     int id = skillIdLevel[0];
     int level = skillIdLevel[1];
     
    if ((id == 0) || (level == 0))
     {
     continue;
     }
     
    L2Skill skillToAdd = SkillTable.getInstance().getInfo(id, level);
     
    if (skillToAdd == null)
     {
     player.sendMessage("An error occured to give skills to " + target.getName() + ",check your skill infos please and try again.");
     return;
     }
     
    target.addSkill(skillToAdd, true);
     }
     target.getSkillList();
     }
     
    public static void removeAio(L2PcInstance player, L2PcInstance target)
     {
     if ((target == null) || (player == null))
     {
     return;
     }
     
    if (!target.isAio())
     {
     player.sendMessage("This character is not AIO at the moment!");
     return;
     }
     
    if (target.isTeleporting())
     {
     player.sendMessage("An error occured, nothing happened");
     return;
     }
     
    target.setAio(false);
     
    L2Skill[] aioBuffs = target.getAllSkills();
     
    for (L2Skill skill : aioBuffs)
     {
     if (skill == null)
     {
     continue;
     }
     
    target.removeSkill(skill);
     }
     
    boolean countUnlearnable = true;
     int unLearnable = 0;
     int skillCounter = 0;
     L2SkillLearn[] skills = SkillTreeTable.getInstance().getAvailableSkills(target, target.getClassId());
     while (skills.length > unLearnable)
     {
     for (L2SkillLearn s : skills)
     {
     L2Skill sk = SkillTable.getInstance().getInfo(s.getId(), s.getLevel());
     if ((sk == null) || !sk.getCanLearn(target.getClassId()))
     {
     if (countUnlearnable)
     {
     unLearnable++;
     }
     continue;
     }
     if (target.getSkillLevel(sk.getId()) == -1)
     {
     skillCounter++;
     }
     target.addSkill(sk, true);
     }
     countUnlearnable = false;
     skills = SkillTreeTable.getInstance().getAvailableSkills(target, target.getClassId());
     }
     
    String aioName = target.getName();
     String name = null;
     
    if (aioName.startsWith("[AIO]"))
     {
     name = aioName.substring(5);
     }
     
    if (name != null)
     {
     target.setName(name);
     }
     
    target.broadcastUserInfo();
     target.getSkillList();
     target.setRecomHave(0);
     target.sendPacket(new CreatureSay(0, Say2.PARTY_ROOM, "Aio System", "You are no longer an AIO , you rewarded with your normal skills."));
     player.sendMessage("Player " + target.getName() + " successfully removed from AIO");
     
    }
     
    }
    Create new .java file in net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAio.java and paste the below code inside.
    Code:

    package net.sf.l2j.gameserver.handler.admincommandhandlers;

    import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
    import net.sf.l2j.gameserver.model.AioBuffHandler;
    import net.sf.l2j.gameserver.model.L2Object;
    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;

    public class AdminAio implements IAdminCommandHandler
    {
     
    private final String[] AIO_COMMANDS =
     {
     "admin_setaio",
     "admin_removeaio"
     };
     
    @Override
     public boolean useAdminCommand(String command, L2PcInstance activeChar)
     {
     L2Object target = activeChar.getTarget();
     L2PcInstance targ = null;
     if (target == null)
     {
     activeChar.sendMessage("Using this command in the air?");
     return false;
     }
     if (!(target instanceof L2PcInstance))
     {
     activeChar.sendMessage("This command can be used only in players.");
     return false;
     }
     targ = (L2PcInstance) target;
     
    if (command.equalsIgnoreCase("admin_setaio"))
     {
     AioBuffHandler.setAio(activeChar, targ);
     AioBuffHandler.removeCurrentSkills(activeChar, targ);
     AioBuffHandler.giveAioSkills(activeChar, targ);
     }
     else if (command.equalsIgnoreCase("admin_removeaio"))
     {
     AioBuffHandler.removeAio(activeChar, targ);
     }
     
    return true;
     }
     
    @Override
     public String[] getAdminCommandList()
     {
     return AIO_COMMANDS;
     }
     
    }
    net.sf.l2j.gameserver.GameServer.java
    Code:

    import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAdmin;
    +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAio;

    _adminCommandHandler.registerAdminCommandHandler(new AdminAdmin());
    +_adminCommandHandler.registerAdminCommandHandler(new AdminAio());
    net.sf.l2j.gameserver.model.actor.instance.L2PcInstance.java
    Code:

    -private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,clan_privs=?,wantspeace=?,clan_join_expiry_time=?,clan_create_expiry_time=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,last_recom_date=?,varka_ketra_ally=?,char_name=? WHERE obj_Id=?";
    +private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,clan_privs=?,wantspeace=?,clan_join_expiry_time=?,clan_create_expiry_time=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,last_recom_date=?,varka_ketra_ally=?,char_name=?,aio=? WHERE obj_Id=?";

    public void doCast(L2Skill skill)
     
    {
    + if (isAio() && !isInsideZone(ZONE_PEACE))
    + {
    + sendMessage("An AIO buffer can use his abilities only in PEACE ZONE");
    + return;
    + }


    private boolean _noble = false;
    +private boolean _aio = false;

    player.setNoble(rset.getInt("nobless") == 1);
    +player.setAio(rset.getInt("aio") == 1);


    -statement.setInt(50, getObjectId());
    +statement.setInt(50, isAio() ? 1 : 0);
    +statement.setInt(51, getObjectId());


    finally
     {
     try
     {
     con.close();
     }
     catch (Exception e)
     {
     }
     }

    +public void setAio(boolean becomeAio)
    +{
    + _aio = becomeAio;
    +}
    +
    +public boolean isAio()
    +{
    + return _aio;
    +}

    // Force a revalidation
    revalidateZone(true);
    +if (isAio() && !isInsideZone(ZONE_PEACE))
    +{
    + teleToLocation(MapRegionTable.TeleportWhereType.Town);
    +}
    net.sf.l2j.gameserver.clientpackets.EnterWorld.java
    Code:

    loadTutorial(activeChar);
    +// AIO SYSTEM
    + if (activeChar.isAio())
    + {
    + activeChar.setIsImmobilized(false);
    + activeChar.setIsParalyzed(false);
    + activeChar.setIsOverloaded(false);
    + activeChar.setIsTeleporting(false);
    + activeChar.setInsideZone(L2Character.ZONE_PEACE, true);
    + activeChar.teleToLocation(activeChar.getX(), activeChar.getY(), activeChar.getZ());
    +
    + if (!activeChar.isInsideZone(L2Character.ZONE_PEACE))
    + {
    + activeChar.teleToLocation(MapRegionTable.TeleportWhereType.Town);
    + }
    + }
    net.sf.l2j.gameserver.model.actor.instance.L2VillageMasterInstance.java
    Code:

    player.sendPacket(new SystemMessage(SystemMessage.YOU_HAVE_ALREADY_BEEN_REGISTERED_IN_A_WAITING_LIST_OF_AN_EVENT));
     return;
     }
     
    + // Subclasses may not be changed if player is AIO
    + if (player.isAio())
    + {
    + player.sendMessage("An AIO has not the ability to change or add subclasses");
    + return;
    + }
    net.sf.l2j.gameserver.model.zone.type.L2TownZone.java
    Code:

    import net.sf.l2j.Config;
    +import net.sf.l2j.gameserver.datatables.MapRegionTable.TeleportWhereType;

    if (character instanceof L2PcInstance)
     {
    + if (((L2PcInstance) character).isAio())
    + {
    + ((L2PcInstance) character).sendMessage("Aio characters can't leave towns!");
    + ((L2PcInstance) character).teleToLocation(TeleportWhereType.Town); // teleport the aio to the closest town
    + }
    characters.sql
    Code:

    varka_ketra_ally int(1) NOT NULL DEFAULT 0,
    +`aio` TINYINT UNSIGNED NOT NULL DEFAULT 0,

    marcos2

    Posts : 2
    Join date : 2016-07-11

    Hello

    Post  marcos2 on 13th August 2016, 04:42

    Man This Mods it works perfectly because i have problem when i am install Neutral

      Current date/time is 20th September 2017, 16:01