L2JLisvus

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

    FairyTrees -> Java [Commited]

    Karakan
    Karakan


    Posts : 756
    Join date : 2013-10-04

    FairyTrees -> Java  [Commited] Empty FairyTrees -> Java [Commited]

    Post  Karakan 13th July 2019, 15:47

    Not sure about skill Venomous Poison. (4243)
    It is supported in C4 client but missing xml values.

    Needs to be checked.

    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 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 ai.group_template;

    import net.sf.l2j.gameserver.ai.CtrlIntention;
    import net.sf.l2j.gameserver.datatables.SkillTable;
    import net.sf.l2j.gameserver.model.L2Skill;
    import net.sf.l2j.gameserver.model.L2Attackable;
    import net.sf.l2j.gameserver.model.L2Character;
    import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    import net.sf.l2j.gameserver.model.quest.Quest;
    import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
    import net.sf.l2j.util.Rnd;

    public class FairyTrees extends Quest
    {
       public FairyTrees (int questId, String name, String descr)
       {
          super(questId, name, descr);
            int[] mobs =
           {
              5185, // Fairy Tree Of Wind
              5186,  // Fairy Tree Of Star
              5187, // Fairy Tree Of Twilight
              5188 // Fairy Tree Of Abyss
           };
           registerMobs(mobs);
       }
       
       private static final String[] NPC_STRING =
       {
          "We must protect the fairy tree!",
          "Get out of the sacred tree you scoundrel!",
          "Death to the thieves of the pure water of the world!"
       };

       @Override
       public String onKill(L2NpcInstance npc, L2PcInstance killer, boolean isPet)
       {
             for (int i = 0; i < 20; i++)
             {
                L2Attackable newNpc = (L2Attackable) addSpawn(5189, npc.getX(), npc.getY(), npc.getZ(), 0, false, 30000); // Soul of Tree Guardian
                
                newNpc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), (NPC_STRING[Rnd.get(3)])));

                if (killer.getTarget() == npc)
                {
                   newNpc.onAction(killer);
                }

                newNpc.setRunning();
                
                L2Character originalKiller = isPet ? killer.getPet() : killer;
                if (originalKiller != null)
                {
                   newNpc.addDamageHate(originalKiller, 0, 100);
                   newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, originalKiller);
                }
                
                if (Rnd.get(1, 2) == 1)
                {
                   L2Skill skill = SkillTable.getInstance().getInfo(4243, 1);
                   if (skill != null && originalKiller != null)
                      skill.getEffects(newNpc, originalKiller);
                }
             }

          return super.onKill(npc, killer, isPet);
       }

       public static void main(String[] args)
       {
          new FairyTrees(-1, "fairytrees", "ai/group_template");
       }
    }
    Karakan
    Karakan


    Posts : 756
    Join date : 2013-10-04

    FairyTrees -> Java  [Commited] Empty Re: FairyTrees -> Java [Commited]

    Post  Karakan 23rd July 2019, 13:50

    Updated code : Added missing NpcString's

    Cool

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