L2JLisvus

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

3 posters

    My modifications to asimilate more to l2off

    avatar
    confejulian


    Posts : 254
    Join date : 2016-08-27

    My modifications to asimilate more to l2off Empty My modifications to asimilate more to l2off

    Post  confejulian 13th December 2018, 22:23

    Hi everybody, today i want to share with you my 3 modifications to asimilate more the l2j to l2off.

    First: When you attack someone with active tranfer paint on l2off c4, you obtain an message like  You have given 500 damage to your target and 500 damage to the servitor. On this l2j you obtain You have given 100 damage to your target.

    I had modified this message to obtain like l2off.

    For modify this, you need to add this on PC INSTANCE, on funcion public final void sendDamageMessage.
    Code:

    if ((target.getPet() != null) && (target.getPet() instanceof L2SummonInstance) && target.isInsideRadius(target.getPet().getX(), target.getPet().getY(), PcStatus.TRANSFER_PAIN_RANGE, true)) // You have given $s1 damage to your target and $s2 damage to the servitor
     {
     for (L2Effect efecto : target.getAllEffects())
     {
     if (efecto.getSkill().getId() == 1262)
     {
     int damage_pet = (damage * (int) target.getStat().calcStat(Stats.TRANSFER_DAMAGE_PERCENT, 0, null, null)) / 100;
     int damage_target = damage - damage_pet;
     SystemMessage sm = new SystemMessage(SystemMessage.YOU_HAVE_GIVEN_S1_DAMAGE_TO_YOUR_TARGET_AND_S2_TO_THE_SERVITOR);
     sm.addNumber(damage_target);
     sm.addNumber(damage_pet);
     sendPacket(sm);
     return;
     }
     }
     }



    Second: On this l2j the range of active is very shortest than l2off c4. Really on l2c4off is infinite, but i modify like range be since when dissapear your pet life bar.
    For modify this on PC STATUS you need to modify that line:


    Code:
    if ((summon != null) && (summon instanceof L2SummonInstance) && Util.checkIfInRange(TRANSFER_PAIN_RANGE, getActiveChar(), summon, true))
    Add on clas pcstatus
    Code:
    public static final int TRANSFER_PAIN_RANGE = 4500;

    if you want more or less, you need to modify TRANSFER_PAIN_RANGE number.

    Third: The last modification, on this l2j, you can't summon with others players death summon and when you play l2off you can summon with death summons of others players, at exeption of wyverns, cogaburas, etc. I had apply this code change to asimilate more to l2off

    on L2SKILL  you need to add this case after the first if.
    Code:
    // Permitir summonear usando cuerpo de otros summons
     if ((target instanceof L2SummonInstance) && target.isDead()) // Si el objetivo es un Summon y esta muerto
     {
     return new L2Character[]
     {
     target
     };
     }

    And modify L2SKILLSUMMON for this.

    Code:
    /*
     * 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 2, 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, write to the Free Software
     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
     * 02111-1307, USA.
     *
     * http://www.gnu.org/copyleft/gpl.html
     */
    package net.sf.l2j.gameserver.skills.l2skills;

    import javolution.util.FastList;
    import net.sf.l2j.gameserver.datatables.NpcTable;
    import net.sf.l2j.gameserver.idfactory.IdFactory;
    import net.sf.l2j.gameserver.instancemanager.SiegeManager;
    import net.sf.l2j.gameserver.model.L2Character;
    import net.sf.l2j.gameserver.model.L2Object;
    import net.sf.l2j.gameserver.model.L2Skill;
    import net.sf.l2j.gameserver.model.L2Summon;
    import net.sf.l2j.gameserver.model.L2World;
    import net.sf.l2j.gameserver.model.actor.instance.L2CubicInstance;
    import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    import net.sf.l2j.gameserver.model.actor.instance.L2PetInstance;
    import net.sf.l2j.gameserver.model.actor.instance.L2SiegeSummonInstance;
    import net.sf.l2j.gameserver.model.actor.instance.L2SummonInstance;
    import net.sf.l2j.gameserver.model.base.Experience;
    import net.sf.l2j.gameserver.serverpackets.SystemMessage;
    import net.sf.l2j.gameserver.templates.L2NpcTemplate;
    import net.sf.l2j.gameserver.templates.StatsSet;

    public class L2SkillSummon extends L2Skill
    {
     private final int npcId;
     private final float expPenalty;
     private final boolean isCubic;

     public L2SkillSummon(StatsSet set)
     {
     super(set);

     npcId = set.getInteger("npcId", 0); // default for undescribed skills
     expPenalty = set.getFloat("expPenalty", 0.f);
     isCubic = set.getBool("isCubic", false);
     }

     @Override
     public boolean checkCondition(L2Character activeChar, boolean itemOrWeapon)
     {
     if (activeChar instanceof L2PcInstance)
     {
     L2PcInstance player = (L2PcInstance) activeChar;

     if (player.inObserverMode())
     {
     return false;
     }

     if (!isCubic)
     {
     if ((player.getPet() != null) || player.isMounted())
     {
     player.sendMessage("You already have a pet.");
     return false;
     }

     if (player.isAttackingNow() || player.isRooted())
     {
     player.sendPacket(new SystemMessage(SystemMessage.YOU_CANNOT_SUMMON_IN_COMBAT));
     return false;
     }

     FastList<Integer> lista_summons_id = new FastList<>();
     // Los siguientes ID se refieren aquellos ID de summon por ITEM, por ejemplo el Strider.
     lista_summons_id.add(12077); // Wolf
     lista_summons_id.add(12311); // Hatchling of the Wind
     lista_summons_id.add(12312); // Hatchling of the Stars
     lista_summons_id.add(12313); // Hatchling of the Twilight
     lista_summons_id.add(12526); // Wind Strider
     lista_summons_id.add(12527); // Star Strider
     lista_summons_id.add(12528); // Twilight Strider
     lista_summons_id.add(12564); // Sin Eater (Gremlin PET)
     lista_summons_id.add(12780); // Baby Buffalo
     lista_summons_id.add(12781); // Baby Kookaburra
     lista_summons_id.add(12782); // Baby Cougar
     
     // Dejaremos estas 3 condiciones por si acaso
     L2Object target = player.getTarget();
     if (target instanceof L2SummonInstance)
     {
     // Descomentar lineas para DEBUG
     // System.out.println("L2SummonInstace ID: " + ((L2SummonInstance) target).getNpcId());
     // System.out.println("L2SummonInstance usado");
     }
     else if (target instanceof L2Summon) /** Summon por ITEM */
     {
     // System.out.println("L2Summon ID: " + ((L2Summon) target).getNpcId());
     // System.out.println("L2Summon usado");
     int id_summon = ((L2Summon) target).getNpcId();
     if (lista_summons_id.contains(id_summon))
     {
     player.sendMessage("Incorrect target");
     return false;
     }
     }
     else if (target instanceof L2PetInstance)
     {
     // System.out.println("L2PetInstance ID: " + ((L2PetInstance) target).getNpcId());
     // System.out.println("L2PetInstance usado");
     }
     if ((player.getPet() != null) || player.isMounted())
     {
     player.sendMessage("You already have a pet.");
     return false;
     }
     
     }

     // If summon siege golem (13), Summon Wild Hog Cannon (299), check if its ok to summon
     if (((getId() == 13) || (getId() == 299)) && !SiegeManager.getInstance().checkIfOkToSummon(player, false))
     {
     return false;
     }

     }
     return super.checkCondition(activeChar, itemOrWeapon);
     }

     @Override
     public void useSkill(L2Character caster, L2Object[] targets)
     {
     if (caster.isAlikeDead() || !(caster instanceof L2PcInstance))
     {
     return;
     }

     L2PcInstance activeChar = (L2PcInstance) caster;

     if (npcId == 0)
     {
     return;
     }

     if (isCubic)
     {
     for (int index = 0; index < targets.length; index++)
     {

     if (!(targets[index] instanceof L2PcInstance))
     {
     continue;
     }

     L2PcInstance target = (L2PcInstance) targets[index];

     int mastery = target.getSkillLevel(L2Skill.SKILL_CUBIC_MASTERY);
     if (mastery < 0)
     {
     mastery = 0;
     }

     if ((mastery == 0) && (target.getCubics().size() > 0) && !target.getCubics().containsKey(npcId))
     {
     // Player can have only 1 cubic - we should replace old cubic with new one
     for (L2CubicInstance c : target.getCubics().values())
     {
     c.stopAction();
     c.cancelDisappear();
     }
     target.getCubics().clear();
     }

     if ((target.getCubics().size() > mastery) || target.getCubics().containsKey(npcId))
     {
     continue;
     }

     if (target == activeChar)
     {
     target.addCubic(npcId, getLevel(), false);
     }
     else
     {
     target.addCubic(npcId, getLevel(), true);
     }
     target.broadcastUserInfo();

     }

     return;
     }

     L2NpcTemplate summonTemplate = NpcTable.getInstance().getTemplate(npcId);

     L2SummonInstance summon;
     if (summonTemplate.type.equalsIgnoreCase("L2SiegeSummon"))
     {
     summon = new L2SiegeSummonInstance(IdFactory.getInstance().getNextId(), summonTemplate, activeChar, this);
     }
     else
     {
     summon = new L2SummonInstance(IdFactory.getInstance().getNextId(), summonTemplate, activeChar, this);
     }

     summon.setName(summonTemplate.name);
     summon.setTitle(activeChar.getName());
     summon.setExpPenalty(expPenalty);
     if (summon.getLevel() >= Experience.LEVEL.length)
     {
     summon.getStat().setExp(Experience.LEVEL[Experience.LEVEL.length - 1]);
     _log.warning("Summon (" + summon.getName() + ") NpcID: " + summon.getNpcId() + " has a level above 78. Please rectify.");
     }
     else
     {
     summon.getStat().setExp(Experience.LEVEL[(summon.getLevel() % Experience.LEVEL.length)]);
     }

     summon.setCurrentHp(summon.getMaxHp());
     summon.setCurrentMp(summon.getMaxMp());
     summon.setHeading(activeChar.getHeading());
     summon.setRunning();
     activeChar.setPet(summon);

     L2World.getInstance().storeObject(summon);
     summon.spawnMe(activeChar.getX() + 50, activeChar.getY() + 100, activeChar.getZ());
     
     L2Character target = (L2Character) caster.getTarget();
     if (target != null)
     {
     if (target.isDead() && (getTargetType() == SkillTargetType.TARGET_CORPSE_MOB) && (target instanceof L2NpcInstance))
     {
     /** Si se usa el cuerpo de un MOB **/
     ((L2NpcInstance) target).endDecayTask();
     // System.out.println("Sumoneaste, se debio borrar MOB");
     }
     if (target.isDead() && (getTargetType() == SkillTargetType.TARGET_CORPSE_MOB) && (target instanceof L2SummonInstance))
     {
     /** Si se usa el cuerpo de un SUMMON **/
     ((L2SummonInstance) target).decayMe();
     // System.out.println("Sumoneaste, se debio borrar SUMMON");
     }
     }
     }
    }


    I'm very happy with this pack, but i share with you all this modification with the hope of DnR this be useful to become better on the future revisions.
    avatar
    ASDron


    Posts : 18
    Join date : 2016-04-15
    Age : 34

    My modifications to asimilate more to l2off Empty Re: My modifications to asimilate more to l2off

    Post  ASDron 17th January 2019, 10:03

    SystemMessage sm = new SystemMessage(SystemMessage.YOU_HAVE_GIVEN_S1_DAMAGE_TO_YOUR_TARGET_AND_S2_TO_THE_SERVITOR);


    pls give systemmessage code
    avatar
    confejulian


    Posts : 254
    Join date : 2016-08-27

    My modifications to asimilate more to l2off Empty Re: My modifications to asimilate more to l2off

    Post  confejulian 17th January 2019, 20:42

    ASDron wrote:SystemMessage sm = new SystemMessage(SystemMessage.YOU_HAVE_GIVEN_S1_DAMAGE_TO_YOUR_TARGET_AND_S2_TO_THE_SERVITOR);


    pls give systemmessage code

    Code:
    1130   1    You have given $s1 damage to your target and $s2 damage to the servitor.    0   79   9B   B0   -1   
    DnR
    DnR
    Admin
    Admin


    Posts : 1475
    Join date : 2012-12-03
    Age : 34

    My modifications to asimilate more to l2off Empty Re: My modifications to asimilate more to l2off

    Post  DnR 7th February 2019, 18:41

    I think there is a misunderstanding here.
    First and third were already fixed in revision 592, so you shouldn't touch a thing there.
    Code works as it is, but i'm not sure what gave you the wrong impression.

    Details from revision 592.
    Code:

    - From now on, enemy servitor corpses can be used as material for corpse skills. Thanks confejulian.
    - Added appropriate "give damage" message in case of Transfer Pain. Thanks confejulian.

    About second, NCSoft itself declared this as a bug during C5 update.
    I changed the range to 4000, which is the player distance to forget characters.

    Still, thank you a lot for contributing and i hope you find new changes satisfactory.

    Best regards,
    DnR

    Sponsored content


    My modifications to asimilate more to l2off Empty Re: My modifications to asimilate more to l2off

    Post  Sponsored content


      Current date/time is 19th May 2024, 07:00