Jump to content

akis84

Members
  • Posts

    3
  • Credits

  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by akis84

  1. I found the solution and share it

    I added this new Class into  net.sf.l2j.gameserver.scripting.scripts.ai.group

    /*
     * 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 net.sf.l2j.gameserver.scripting.scripts.ai.group;
    
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    
    import net.sf.l2j.Config;
    import net.sf.l2j.commons.random.Rnd;
    import net.sf.l2j.gameserver.model.L2Skill;
    import net.sf.l2j.gameserver.model.actor.L2Attackable;
    import net.sf.l2j.gameserver.model.actor.L2Npc;
    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    import net.sf.l2j.gameserver.scripting.EventType;
    import net.sf.l2j.gameserver.scripting.QuestState;
    import net.sf.l2j.gameserver.scripting.scripts.ai.L2AttackableAIScript;
    
    /**
     * Forge of the Gods spawns... When one mob dies, there is a chance to spawn 5 other mobs of the same type.
     */
    public class ForgeOfTheGods extends L2AttackableAIScript
    {
    	private static final Map<Integer, Integer> FOG_SPAWNS = new HashMap<>();
    	
    	static
    	{
    		FOG_SPAWNS.put(21376, 21376);
    		FOG_SPAWNS.put(21377, 21377);
    		FOG_SPAWNS.put(21378, 21378);
    		FOG_SPAWNS.put(21379, 21379);
    		FOG_SPAWNS.put(21380, 21380);
    		FOG_SPAWNS.put(21381, 21381);
    		FOG_SPAWNS.put(21382, 21382);
    		FOG_SPAWNS.put(21383, 21383);
    		FOG_SPAWNS.put(21384, 21384);
    		FOG_SPAWNS.put(21385, 21385);
    		FOG_SPAWNS.put(21386, 21386);
    		FOG_SPAWNS.put(21387, 21387);
    //		FOG_SPAWNS.put(21388, 21388); // Archer type
    		FOG_SPAWNS.put(21389, 21389);
    		FOG_SPAWNS.put(21390, 21390);
    		FOG_SPAWNS.put(21391, 21391);
    		FOG_SPAWNS.put(21392, 21392);
    		FOG_SPAWNS.put(21393, 21393);
    //		FOG_SPAWNS.put(21394, 21394); // Lavasaurus
    //		FOG_SPAWNS.put(21395, 21395); // Elder Lavasaurus
    		FOG_SPAWNS.put(21652, 21652);
    		FOG_SPAWNS.put(21653, 21653);
    		FOG_SPAWNS.put(21654, 21654);
    		FOG_SPAWNS.put(21655, 21655);
    		FOG_SPAWNS.put(21656, 21656);
    		FOG_SPAWNS.put(21657, 21657);
    	}
    	
    	public ForgeOfTheGods()
    	{
    		super("ai/group");
    	}
    	
    	@Override
    	protected void registerNpcs()
    	{
    		addEventIds(FOG_SPAWNS.keySet(), EventType.ON_SPELL_FINISHED);
    	}
    	
    	@Override
    	public String onSpellFinished(L2Npc npc, L2PcInstance player, L2Skill skill)
    	{		
    		if (skill.getId() == 4614)
    		{	
    			for (int i = 0; i < 5; i++)
    			{
    				final L2Attackable newNpc = (L2Attackable) addSpawn(FOG_SPAWNS.get(npc.getNpcId()), npc, false, 0, false);
    				attack(newNpc, player);
    			}
    			
    			if (player != null) {
    				// Output list.
    				final List<L2PcInstance> candidates = new ArrayList<>();
    				int torch = 7264;
    				String qn = "Q617_GatherTheFlames";
    				QuestState st = null;
    				if (player.isInParty())
    				{
    					// Filter candidates from player's party.
    					for (L2PcInstance partyMember : player.getParty().getPartyMembers())
    					{
    						st = partyMember.getQuestState(qn);
    						// Check party members' quest state and range from npc.
    						if (st.isStarted() && partyMember.isInsideRadius(npc, Config.ALT_PARTY_RANGE, true, false))
    							candidates.add(partyMember);
    					}
    					if (!candidates.isEmpty())
    						Rnd.get(candidates).getQuestState(qn).dropItemsAlways(torch, 1, 0);
    				}
    				else
    				{
    					st = player.getQuestState(qn);
    					if (st.isStarted())
    						st.dropItemsAlways(torch, 1, 0);
    				}
    			}
    		}
    		
    		return null;
    	}
    }

    and the following line into gameserver/data/xml/scipts.xml

    	<script path="scripts.ai.group.ForgeOfTheGods"/>

     

×
×
  • Create New...