Guest User

Untitled

a guest
May 12th, 2018
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.96 KB | None | 0 0
  1. /*
  2.  * Copyright (C) 2004-2016 L2J DataPack
  3.  *
  4.  * This file is part of L2J DataPack.
  5.  *
  6.  * L2J DataPack is free software: you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License as published by
  8.  * the Free Software Foundation, either version 3 of the License, or
  9.  * (at your option) any later version.
  10.  *
  11.  * L2J DataPack is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14.  * General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18.  */
  19. package ai.npc.NpcBuffers;
  20.  
  21. import com.l2jserver.gameserver.ThreadPoolManager;
  22. import com.l2jserver.gameserver.model.actor.L2Npc;
  23. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  24.  
  25. import ai.npc.AbstractNpcAI;
  26.  
  27. /**
  28.  * @author UnAfraid
  29.  */
  30. public final class NpcBuffers extends AbstractNpcAI
  31. {
  32.     private final NpcBuffersData _npcBuffers = new NpcBuffersData();
  33.    
  34.     private NpcBuffers()
  35.     {
  36.         super(NpcBuffers.class.getSimpleName(), "ai/npc");
  37.        
  38.         for (int npcId : _npcBuffers.getNpcBufferIds())
  39.         {
  40.             // TODO: Cleanup once npc rework is finished and default html is configurable.
  41.             addFirstTalkId(npcId);
  42.             addSpawnId(npcId);
  43.         }
  44.     }
  45.    
  46.     // TODO: Cleanup once npc rework is finished and default html is configurable.
  47.     @Override
  48.     public String onFirstTalk(L2Npc npc, L2PcInstance player)
  49.     {
  50.         return null;
  51.     }
  52.    
  53.     @Override
  54.     public String onSpawn(L2Npc npc)
  55.     {
  56.         final NpcBufferData data = _npcBuffers.getNpcBuffer(npc.getId());
  57.         for (NpcBufferSkillData skill : data.getSkills())
  58.         {
  59.             ThreadPoolManager.getInstance().scheduleAi(new NpcBufferAI(npc, skill), skill.getInitialDelay());
  60.         }
  61.         return super.onSpawn(npc);
  62.     }
  63.    
  64.     public static void main(String[] args)
  65.     {
  66.         new NpcBuffers();
  67.     }
  68. }
Add Comment
Please, Sign In to add comment