L2NpcTemplate.java 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package com.l2jserver.gameserver.templates.chars;
  16. import java.util.List;
  17. import java.util.Map;
  18. import java.util.logging.Logger;
  19. import com.l2jserver.gameserver.model.L2DropCategory;
  20. import com.l2jserver.gameserver.model.L2DropData;
  21. import com.l2jserver.gameserver.model.L2MinionData;
  22. import com.l2jserver.gameserver.model.L2Skill;
  23. import com.l2jserver.gameserver.model.actor.instance.L2XmassTreeInstance;
  24. import com.l2jserver.gameserver.model.base.ClassId;
  25. import com.l2jserver.gameserver.model.quest.Quest;
  26. import com.l2jserver.gameserver.model.L2NpcAIData;
  27. import com.l2jserver.gameserver.skills.Stats;
  28. import com.l2jserver.gameserver.templates.StatsSet;
  29. import javolution.util.FastList;
  30. import javolution.util.FastMap;
  31. /**
  32. * This cl contains all generic data of a L2Spawn object.<BR><BR>
  33. *
  34. * <B><U> Data</U> :</B><BR><BR>
  35. * <li>npcId, type, name, sex</li>
  36. * <li>rewardExp, rewardSp</li>
  37. * <li>aggroRange, factionId, factionRange</li>
  38. * <li>rhand, lhand, armor</li>
  39. * <li>isUndead</li>
  40. * <li>_drops</li>
  41. * <li>_minions</li>
  42. * <li>_teachInfo</li>
  43. * <li>_skills</li>
  44. * <li>_questsStart</li><BR><BR>
  45. *
  46. * @version $Revision: 1.1.2.4 $ $Date: 2005/04/02 15:57:51 $
  47. */
  48. public final class L2NpcTemplate extends L2CharTemplate
  49. {
  50. protected static final Logger _log = Logger.getLogger(Quest.class.getName());
  51. public final int npcId;
  52. public final int idTemplate;
  53. public final String type;
  54. public final String name;
  55. public final boolean serverSideName;
  56. public final String title;
  57. public final boolean serverSideTitle;
  58. public final String sex;
  59. public final byte level;
  60. public final int rewardExp;
  61. public final int rewardSp;
  62. public final int aggroRange;
  63. public final int rhand;
  64. public final int lhand;
  65. public final int armor;
  66. public final int enchantEffect;
  67. public final int absorbLevel;
  68. public final AbsorbCrystalType absorbType;
  69. public Race race;
  70. public final String jClass;
  71. public final boolean dropherb;
  72. public boolean isQuestMonster; // doesn't include all mobs that are involved in
  73. // quests, just plain quest monsters for preventing champion spawn
  74. public final float baseVitalityDivider;
  75. //Skill AI
  76. public FastList<L2Skill> _buffskills;
  77. public FastList<L2Skill> _negativeskills;
  78. public FastList<L2Skill> _debuffskills;
  79. public FastList<L2Skill> _atkskills;
  80. public FastList<L2Skill> _rootskills;
  81. public FastList<L2Skill> _stunskills;
  82. public FastList<L2Skill> _sleepskills;
  83. public FastList<L2Skill> _paralyzeskills;
  84. public FastList<L2Skill> _fossilskills;
  85. public FastList<L2Skill> _floatskills;
  86. public FastList<L2Skill> _immobiliseskills;
  87. public FastList<L2Skill> _healskills;
  88. public FastList<L2Skill> _resskills;
  89. public FastList<L2Skill> _dotskills;
  90. public FastList<L2Skill> _cotskills;
  91. public FastList<L2Skill> _universalskills;
  92. public FastList<L2Skill> _manaskills;
  93. public FastList<L2Skill> _Lrangeskills;
  94. public FastList<L2Skill> _Srangeskills;
  95. public FastList<L2Skill> _generalskills;
  96. private boolean _hasbuffskills;
  97. private boolean _hasnegativeskills;
  98. private boolean _hasdebuffskills;
  99. private boolean _hasatkskills;
  100. private boolean _hasrootskills;
  101. private boolean _hasstunskills;
  102. private boolean _hassleepskills;
  103. private boolean _hasparalyzeskills;
  104. private boolean _hasfossilskills;
  105. private boolean _hasfloatskills;
  106. private boolean _hasimmobiliseskills;
  107. private boolean _hashealskills;
  108. private boolean _hasresskills;
  109. private boolean _hasdotskills;
  110. private boolean _hascotskills;
  111. private boolean _hasuniversalskills;
  112. private boolean _hasmanaskills;
  113. private boolean _hasLrangeskills;
  114. private boolean _hasSrangeskills;
  115. private boolean _hasgeneralskills;
  116. private L2NpcAIData _AIdataStatic = new L2NpcAIData();
  117. public static enum AbsorbCrystalType
  118. {
  119. LAST_HIT,
  120. FULL_PARTY,
  121. PARTY_ONE_RANDOM
  122. }
  123. public static enum AIType
  124. {
  125. FIGHTER,
  126. ARCHER,
  127. BALANCED,
  128. MAGE,
  129. HEALER,
  130. CORPSE
  131. }
  132. public static enum Race
  133. {
  134. UNDEAD,
  135. MAGICCREATURE,
  136. BEAST,
  137. ANIMAL,
  138. PLANT,
  139. HUMANOID,
  140. SPIRIT,
  141. ANGEL,
  142. DEMON,
  143. DRAGON,
  144. GIANT,
  145. BUG,
  146. FAIRIE,
  147. HUMAN,
  148. ELVE,
  149. DARKELVE,
  150. ORC,
  151. DWARVE,
  152. OTHER,
  153. NONLIVING,
  154. SIEGEWEAPON,
  155. DEFENDINGARMY,
  156. MERCENARIE,
  157. UNKNOWN,
  158. KAMAEL,
  159. NONE
  160. }
  161. //private final StatsSet _npcStatsSet;
  162. /** The table containing all Item that can be dropped by L2NpcInstance using this L2NpcTemplate*/
  163. private FastList<L2DropCategory> _categories = null;
  164. /** The table containing all Minions that must be spawn with the L2NpcInstance using this L2NpcTemplate*/
  165. private List<L2MinionData> _minions = null;
  166. private List<ClassId> _teachInfo;
  167. private Map<Integer, L2Skill> _skills;
  168. private Map<Stats, Double> _vulnerabilities;
  169. // contains a list of quests for each event type (questStart, questAttack, questKill, etc)
  170. private Map<Quest.QuestEventType, Quest[]> _questEvents;
  171. /**
  172. * Constructor of L2Character.<BR><BR>
  173. *
  174. * @param set The StatsSet object to transfer data to the method
  175. *
  176. */
  177. public L2NpcTemplate(StatsSet set)
  178. {
  179. super(set);
  180. npcId = set.getInteger("npcId");
  181. idTemplate = set.getInteger("idTemplate");
  182. type = set.getString("type");
  183. name = set.getString("name");
  184. serverSideName = set.getBool("serverSideName");
  185. title = set.getString("title");
  186. if (title.equalsIgnoreCase("Quest Monster"))
  187. isQuestMonster = true;
  188. else
  189. isQuestMonster = false;
  190. serverSideTitle = set.getBool("serverSideTitle");
  191. sex = set.getString("sex");
  192. level = set.getByte("level");
  193. rewardExp = set.getInteger("rewardExp");
  194. rewardSp = set.getInteger("rewardSp");
  195. aggroRange = set.getInteger("aggroRange");
  196. rhand = set.getInteger("rhand");
  197. lhand = set.getInteger("lhand");
  198. armor = set.getInteger("armor");
  199. enchantEffect = set.getInteger("enchant");
  200. absorbLevel = set.getInteger("absorb_level", 0);
  201. absorbType = AbsorbCrystalType.valueOf(set.getString("absorb_type"));
  202. race = null;
  203. dropherb = set.getBool("drop_herbs", false);
  204. //_npcStatsSet = set;
  205. _teachInfo = null;
  206. jClass = set.getString("jClass");
  207. // all NPCs has 20 resistance to all attributes
  208. baseFireRes += 20;
  209. baseWindRes += 20;
  210. baseWaterRes += 20;
  211. baseEarthRes += 20;
  212. baseHolyRes += 20;
  213. baseDarkRes += 20;
  214. // can be loaded from db
  215. baseVitalityDivider = level > 0 && rewardExp > 0 ? baseHpMax * 9 * level * level /(100 * rewardExp) : 0;
  216. }
  217. public void addTeachInfo(ClassId classId)
  218. {
  219. if (_teachInfo == null)
  220. _teachInfo = new FastList<ClassId>();
  221. _teachInfo.add(classId);
  222. }
  223. public ClassId[] getTeachInfo()
  224. {
  225. if (_teachInfo == null)
  226. return null;
  227. return _teachInfo.toArray(new ClassId[_teachInfo.size()]);
  228. }
  229. public boolean canTeach(ClassId classId)
  230. {
  231. if (_teachInfo == null)
  232. return false;
  233. // If the player is on a third class, fetch the class teacher
  234. // information for its parent class.
  235. if (classId.level() == 3)
  236. return _teachInfo.contains(classId.getParent());
  237. return _teachInfo.contains(classId);
  238. }
  239. // add a drop to a given category. If the category does not exist, create it.
  240. public void addDropData(L2DropData drop, int categoryType)
  241. {
  242. if (drop.isQuestDrop())
  243. {
  244. // if (_questDrops == null)
  245. // _questDrops = new FastList<L2DropData>(0);
  246. // _questDrops.add(drop);
  247. }
  248. else
  249. {
  250. if (_categories == null)
  251. _categories = new FastList<L2DropCategory>();
  252. // if the category doesn't already exist, create it first
  253. synchronized (_categories)
  254. {
  255. boolean catExists = false;
  256. for (L2DropCategory cat : _categories)
  257. // if the category exists, add the drop to this category.
  258. if (cat.getCategoryType() == categoryType)
  259. {
  260. cat.addDropData(drop, type.equalsIgnoreCase("L2RaidBoss") || type.equalsIgnoreCase("L2GrandBoss"));
  261. catExists = true;
  262. break;
  263. }
  264. // if the category doesn't exit, create it and add the drop
  265. if (!catExists)
  266. {
  267. L2DropCategory cat = new L2DropCategory(categoryType);
  268. cat.addDropData(drop, type.equalsIgnoreCase("L2RaidBoss") || type.equalsIgnoreCase("L2GrandBoss"));
  269. _categories.add(cat);
  270. }
  271. }
  272. }
  273. }
  274. public void addRaidData(L2MinionData minion)
  275. {
  276. if (_minions == null)
  277. _minions = new FastList<L2MinionData>();
  278. _minions.add(minion);
  279. }
  280. public void addVulnerability(Stats id, double vuln)
  281. {
  282. if (_vulnerabilities == null)
  283. _vulnerabilities = new FastMap<Stats, Double>();
  284. _vulnerabilities.put(id, new Double(vuln));
  285. }
  286. public double getVulnerability(Stats id)
  287. {
  288. if (_vulnerabilities == null || _vulnerabilities.get(id) == null)
  289. return 1;
  290. return _vulnerabilities.get(id);
  291. }
  292. public void addSkill(L2Skill skill)
  293. {
  294. if (_skills == null)
  295. _skills = new FastMap<Integer, L2Skill>();
  296. if(!skill.isPassive())
  297. {
  298. addGeneralSkill(skill);
  299. switch(skill.getSkillType())
  300. {
  301. case BUFF:
  302. case REFLECT:
  303. addBuffSkill(skill);
  304. break;
  305. case HEAL:
  306. case HOT:
  307. case HEAL_PERCENT:
  308. case HEAL_STATIC:
  309. case BALANCE_LIFE:
  310. addHealSkill(skill);
  311. break;
  312. case RESURRECT:
  313. addResSkill(skill);
  314. break;
  315. case DEBUFF:
  316. case WEAKNESS:
  317. addDebuffSkill(skill);
  318. addCOTSkill(skill);
  319. addRangeSkill(skill);
  320. break;
  321. case ROOT:
  322. addRootSkill(skill);
  323. addImmobiliseSkill(skill);
  324. addRangeSkill(skill);
  325. break;
  326. case SLEEP:
  327. addSleepSkill(skill);
  328. addImmobiliseSkill(skill);
  329. break;
  330. case STUN:
  331. addRootSkill(skill);
  332. addImmobiliseSkill(skill);
  333. addRangeSkill(skill);
  334. break;
  335. case PARALYZE:
  336. addParalyzeSkill(skill);
  337. addImmobiliseSkill(skill);
  338. addRangeSkill(skill);
  339. break;
  340. case PDAM:
  341. case MDAM:
  342. case BLOW:
  343. case DRAIN:
  344. case CHARGEDAM:
  345. case DEATHLINK:
  346. case CPDAM:
  347. case MANADAM:
  348. addAtkSkill(skill);
  349. addUniversalSkill(skill);
  350. addRangeSkill(skill);
  351. break;
  352. case POISON:
  353. case DOT:
  354. case MDOT:
  355. case BLEED:
  356. addDOTSkill(skill);
  357. addRangeSkill(skill);
  358. break;
  359. case MUTE:
  360. case FEAR:
  361. addCOTSkill(skill);
  362. addRangeSkill(skill);
  363. break;
  364. case CANCEL:
  365. case NEGATE:
  366. addNegativeSkill(skill);
  367. addRangeSkill(skill);
  368. break;
  369. default :
  370. addUniversalSkill(skill);
  371. break;
  372. }
  373. }
  374. _skills.put(skill.getId(), skill);
  375. }
  376. public double removeVulnerability(Stats id)
  377. {
  378. return _vulnerabilities.remove(id);
  379. }
  380. /**
  381. * Return the list of all possible UNCATEGORIZED drops of this L2NpcTemplate.<BR><BR>
  382. */
  383. public FastList<L2DropCategory> getDropData()
  384. {
  385. return _categories;
  386. }
  387. /**
  388. * Return the list of all possible item drops of this L2NpcTemplate.<BR>
  389. * (ie full drops and part drops, mats, miscellaneous & UNCATEGORIZED)<BR><BR>
  390. */
  391. public List<L2DropData> getAllDropData()
  392. {
  393. if (_categories == null)
  394. return null;
  395. List<L2DropData> lst = new FastList<L2DropData>();
  396. for (L2DropCategory tmp : _categories)
  397. {
  398. lst.addAll(tmp.getAllDrops());
  399. }
  400. return lst;
  401. }
  402. /**
  403. * Empty all possible drops of this L2NpcTemplate.<BR><BR>
  404. */
  405. public synchronized void clearAllDropData()
  406. {
  407. if (_categories == null)
  408. return;
  409. while (!_categories.isEmpty())
  410. {
  411. _categories.getFirst().clearAllDrops();
  412. _categories.removeFirst();
  413. }
  414. _categories.clear();
  415. }
  416. /**
  417. * Return the list of all Minions that must be spawn with the L2NpcInstance using this L2NpcTemplate.<BR><BR>
  418. */
  419. public List<L2MinionData> getMinionData()
  420. {
  421. return _minions;
  422. }
  423. public Map<Integer, L2Skill> getSkills()
  424. {
  425. return _skills;
  426. }
  427. public void addQuestEvent(Quest.QuestEventType EventType, Quest q)
  428. {
  429. if (_questEvents == null)
  430. _questEvents = new FastMap<Quest.QuestEventType, Quest[]>();
  431. if (_questEvents.get(EventType) == null)
  432. {
  433. _questEvents.put(EventType, new Quest[]
  434. {
  435. q
  436. });
  437. }
  438. else
  439. {
  440. Quest[] _quests = _questEvents.get(EventType);
  441. int len = _quests.length;
  442. // if only one registration per npc is allowed for this event type
  443. // then only register this NPC if not already registered for the specified event.
  444. // if a quest allows multiple registrations, then register regardless of count
  445. // In all cases, check if this new registration is replacing an older copy of the SAME quest
  446. // Finally, check quest class hierarchy: a parent class should never replace a child class.
  447. // a child class should always replace a parent class.
  448. if (!EventType.isMultipleRegistrationAllowed())
  449. {
  450. // if it is the same quest (i.e. reload) or the existing is a superclass of the new one, replace the existing.
  451. if (_quests[0].getName().equals(q.getName()) || L2NpcTemplate.isAssignableTo(q, _quests[0].getClass()))
  452. {
  453. _quests[0] = q;
  454. }
  455. else
  456. {
  457. _log.warning("Quest event not allowed in multiple quests. Skipped addition of Event Type \"" + EventType + "\" for NPC \"" + name + "\" and quest \"" + q.getName() + "\".");
  458. }
  459. }
  460. else
  461. {
  462. // be ready to add a new quest to a new copy of the list, with larger size than previously.
  463. Quest[] tmp = new Quest[len + 1];
  464. // loop through the existing quests and copy them to the new list. While doing so, also
  465. // check if this new quest happens to be just a replacement for a previously loaded quest.
  466. // Replace existing if the new quest is the same (reload) or a child of the existing quest.
  467. // Do nothing if the new quest is a superclass of an existing quest.
  468. // Add the new quest in the end of the list otherwise.
  469. for (int i = 0; i < len; i++)
  470. {
  471. if (_quests[i].getName().equals(q.getName()) || L2NpcTemplate.isAssignableTo(q, _quests[i].getClass()))
  472. {
  473. _quests[i] = q;
  474. return;
  475. }
  476. else if (L2NpcTemplate.isAssignableTo(_quests[i], q.getClass()))
  477. {
  478. return;
  479. }
  480. tmp[i] = _quests[i];
  481. }
  482. tmp[len] = q;
  483. _questEvents.put(EventType, tmp);
  484. }
  485. }
  486. }
  487. /**
  488. * Checks if obj can be assigned to the Class represented by clazz.<br>
  489. * This is true if, and only if, obj is the same class represented by clazz,
  490. * or a subclass of it or obj implements the interface represented by clazz.
  491. *
  492. *
  493. * @param obj
  494. * @param clazz
  495. * @return
  496. */
  497. public static boolean isAssignableTo(Object obj, Class<?> clazz)
  498. {
  499. return L2NpcTemplate.isAssignableTo(obj.getClass(), clazz);
  500. }
  501. public static boolean isAssignableTo(Class<?> sub, Class<?> clazz)
  502. {
  503. // if clazz represents an interface
  504. if (clazz.isInterface())
  505. {
  506. // check if obj implements the clazz interface
  507. Class<?>[] interfaces = sub.getInterfaces();
  508. for (int i = 0; i < interfaces.length; i++)
  509. {
  510. if (clazz.getName().equals(interfaces[i].getName()))
  511. {
  512. return true;
  513. }
  514. }
  515. }
  516. else
  517. {
  518. do
  519. {
  520. if (sub.getName().equals(clazz.getName()))
  521. {
  522. return true;
  523. }
  524. sub = sub.getSuperclass();
  525. }
  526. while (sub != null);
  527. }
  528. return false;
  529. }
  530. public Quest[] getEventQuests(Quest.QuestEventType EventType)
  531. {
  532. if (_questEvents == null)
  533. {
  534. return null;
  535. }
  536. return _questEvents.get(EventType);
  537. }
  538. public void setRace(int raceId)
  539. {
  540. switch (raceId)
  541. {
  542. case 1:
  543. race = L2NpcTemplate.Race.UNDEAD;
  544. break;
  545. case 2:
  546. race = L2NpcTemplate.Race.MAGICCREATURE;
  547. break;
  548. case 3:
  549. race = L2NpcTemplate.Race.BEAST;
  550. break;
  551. case 4:
  552. race = L2NpcTemplate.Race.ANIMAL;
  553. break;
  554. case 5:
  555. race = L2NpcTemplate.Race.PLANT;
  556. break;
  557. case 6:
  558. race = L2NpcTemplate.Race.HUMANOID;
  559. break;
  560. case 7:
  561. race = L2NpcTemplate.Race.SPIRIT;
  562. break;
  563. case 8:
  564. race = L2NpcTemplate.Race.ANGEL;
  565. break;
  566. case 9:
  567. race = L2NpcTemplate.Race.DEMON;
  568. break;
  569. case 10:
  570. race = L2NpcTemplate.Race.DRAGON;
  571. break;
  572. case 11:
  573. race = L2NpcTemplate.Race.GIANT;
  574. break;
  575. case 12:
  576. race = L2NpcTemplate.Race.BUG;
  577. break;
  578. case 13:
  579. race = L2NpcTemplate.Race.FAIRIE;
  580. break;
  581. case 14:
  582. race = L2NpcTemplate.Race.HUMAN;
  583. break;
  584. case 15:
  585. race = L2NpcTemplate.Race.ELVE;
  586. break;
  587. case 16:
  588. race = L2NpcTemplate.Race.DARKELVE;
  589. break;
  590. case 17:
  591. race = L2NpcTemplate.Race.ORC;
  592. break;
  593. case 18:
  594. race = L2NpcTemplate.Race.DWARVE;
  595. break;
  596. case 19:
  597. race = L2NpcTemplate.Race.OTHER;
  598. break;
  599. case 20:
  600. race = L2NpcTemplate.Race.NONLIVING;
  601. break;
  602. case 21:
  603. race = L2NpcTemplate.Race.SIEGEWEAPON;
  604. break;
  605. case 22:
  606. race = L2NpcTemplate.Race.DEFENDINGARMY;
  607. break;
  608. case 23:
  609. race = L2NpcTemplate.Race.MERCENARIE;
  610. break;
  611. case 24:
  612. race = L2NpcTemplate.Race.UNKNOWN;
  613. break;
  614. case 25:
  615. race = L2NpcTemplate.Race.KAMAEL;
  616. break;
  617. default:
  618. race = L2NpcTemplate.Race.NONE;
  619. break;
  620. }
  621. }
  622. //-----------------------------------------------------------------------
  623. // Npc AI Data
  624. // By ShanSoft
  625. public void setAIData(L2NpcAIData aidata)
  626. {
  627. //_AIdataStatic = new L2NpcAIData(); // not needed to init object and in next line override with other reference. maybe other intention?
  628. _AIdataStatic = aidata;
  629. }
  630. //-----------------------------------------------------------------------
  631. public L2NpcAIData getAIDataStatic()
  632. {
  633. return _AIdataStatic;
  634. }
  635. public void addBuffSkill(L2Skill skill)
  636. {
  637. if (_buffskills == null)
  638. _buffskills = new FastList<L2Skill>();
  639. _buffskills.add(skill);
  640. _hasbuffskills=true;
  641. }
  642. public void addHealSkill(L2Skill skill)
  643. {
  644. if (_healskills == null)
  645. _healskills = new FastList<L2Skill>();
  646. _healskills.add(skill);
  647. _hashealskills=true;
  648. }
  649. public void addResSkill(L2Skill skill)
  650. {
  651. if (_resskills == null)
  652. _resskills = new FastList<L2Skill>();
  653. _resskills.add(skill);
  654. _hasresskills=true;
  655. }
  656. public void addAtkSkill(L2Skill skill)
  657. {
  658. if (_atkskills == null)
  659. _atkskills = new FastList<L2Skill>();
  660. _atkskills.add(skill);
  661. _hasatkskills=true;
  662. }
  663. public void addDebuffSkill(L2Skill skill)
  664. {
  665. if (_debuffskills == null)
  666. _debuffskills = new FastList<L2Skill>();
  667. _debuffskills.add(skill);
  668. _hasdebuffskills=true;
  669. }
  670. public void addRootSkill(L2Skill skill)
  671. {
  672. if (_rootskills == null)
  673. _rootskills = new FastList<L2Skill>();
  674. _rootskills.add(skill);
  675. _hasrootskills=true;
  676. }
  677. public void addSleepSkill(L2Skill skill)
  678. {
  679. if (_sleepskills == null)
  680. _sleepskills = new FastList<L2Skill>();
  681. _sleepskills.add(skill);
  682. _hassleepskills=true;
  683. }
  684. public void addStunSkill(L2Skill skill)
  685. {
  686. if (_stunskills == null)
  687. _stunskills = new FastList<L2Skill>();
  688. _stunskills.add(skill);
  689. _hasstunskills=true;
  690. }
  691. public void addParalyzeSkill(L2Skill skill)
  692. {
  693. if (_paralyzeskills == null)
  694. _paralyzeskills = new FastList<L2Skill>();
  695. _paralyzeskills.add(skill);
  696. _hasparalyzeskills=true;
  697. }
  698. public void addFloatSkill(L2Skill skill)
  699. {
  700. if (_floatskills == null)
  701. _floatskills = new FastList<L2Skill>();
  702. _floatskills.add(skill);
  703. _hasfloatskills=true;
  704. }
  705. public void addFossilSkill(L2Skill skill)
  706. {
  707. if (_fossilskills == null)
  708. _fossilskills = new FastList<L2Skill>();
  709. _fossilskills.add(skill);
  710. _hasfossilskills=true;
  711. }
  712. public void addNegativeSkill(L2Skill skill)
  713. {
  714. if (_negativeskills == null)
  715. _negativeskills = new FastList<L2Skill>();
  716. _negativeskills.add(skill);
  717. _hasnegativeskills=true;
  718. }
  719. public void addImmobiliseSkill(L2Skill skill)
  720. {
  721. if (_immobiliseskills == null)
  722. _immobiliseskills = new FastList<L2Skill>();
  723. _immobiliseskills.add(skill);
  724. _hasimmobiliseskills=true;
  725. }
  726. public void addDOTSkill(L2Skill skill)
  727. {
  728. if (_dotskills == null)
  729. _dotskills = new FastList<L2Skill>();
  730. _dotskills.add(skill);
  731. _hasdotskills=true;
  732. }
  733. public void addUniversalSkill(L2Skill skill)
  734. {
  735. if (_universalskills == null)
  736. _universalskills = new FastList<L2Skill>();
  737. _universalskills.add(skill);
  738. _hasuniversalskills=true;
  739. }
  740. public void addCOTSkill(L2Skill skill)
  741. {
  742. if (_cotskills == null)
  743. _cotskills = new FastList<L2Skill>();
  744. _cotskills.add(skill);
  745. _hascotskills=true;
  746. }
  747. public void addManaHealSkill(L2Skill skill)
  748. {
  749. if (_manaskills == null)
  750. _manaskills = new FastList<L2Skill>();
  751. _manaskills.add(skill);
  752. _hasmanaskills=true;
  753. }
  754. public void addGeneralSkill(L2Skill skill)
  755. {
  756. if (_generalskills == null)
  757. _generalskills = new FastList<L2Skill>();
  758. _generalskills.add(skill);
  759. _hasgeneralskills=true;
  760. }
  761. public void addRangeSkill(L2Skill skill)
  762. {
  763. if (skill.getCastRange() <= 150 && skill.getCastRange() > 0)
  764. {
  765. if (_Srangeskills == null)
  766. _Srangeskills = new FastList<L2Skill>();
  767. _Srangeskills.add(skill);
  768. _hasSrangeskills=true;
  769. }
  770. else if (skill.getCastRange() > 150)
  771. {
  772. if (_Lrangeskills == null)
  773. _Lrangeskills = new FastList<L2Skill>();
  774. _Lrangeskills.add(skill);
  775. _hasLrangeskills=true;
  776. }
  777. }
  778. //--------------------------------------------------------------------
  779. public boolean hasBuffSkill()
  780. {
  781. return _hasbuffskills;
  782. }
  783. public boolean hasHealSkill()
  784. {
  785. return _hashealskills;
  786. }
  787. public boolean hasResSkill()
  788. {
  789. return _hasresskills;
  790. }
  791. public boolean hasAtkSkill()
  792. {
  793. return _hasatkskills;
  794. }
  795. public boolean hasDebuffSkill()
  796. {
  797. return _hasdebuffskills;
  798. }
  799. public boolean hasRootSkill()
  800. {
  801. return _hasrootskills;
  802. }
  803. public boolean hasSleepSkill()
  804. {
  805. return _hassleepskills;
  806. }
  807. public boolean hasStunSkill()
  808. {
  809. return _hasstunskills;
  810. }
  811. public boolean hasParalyzeSkill()
  812. {
  813. return _hasparalyzeskills;
  814. }
  815. public boolean hasFloatSkill()
  816. {
  817. return _hasfloatskills;
  818. }
  819. public boolean hasFossilSkill()
  820. {
  821. return _hasfossilskills;
  822. }
  823. public boolean hasNegativeSkill()
  824. {
  825. return _hasnegativeskills;
  826. }
  827. public boolean hasImmobiliseSkill()
  828. {
  829. return _hasimmobiliseskills;
  830. }
  831. public boolean hasDOTSkill()
  832. {
  833. return _hasdotskills;
  834. }
  835. public boolean hasUniversalSkill()
  836. {
  837. return _hasuniversalskills;
  838. }
  839. public boolean hasCOTSkill()
  840. {
  841. return _hascotskills;
  842. }
  843. public boolean hasManaHealSkill()
  844. {
  845. return _hasmanaskills;
  846. }
  847. public boolean hasAutoLrangeSkill()
  848. {
  849. return _hasLrangeskills;
  850. }
  851. public boolean hasAutoSrangeSkill()
  852. {
  853. return _hasSrangeskills;
  854. }
  855. public boolean hasSkill()
  856. {
  857. return _hasgeneralskills;
  858. }
  859. public L2NpcTemplate.Race getRace()
  860. {
  861. if (race == null)
  862. race = L2NpcTemplate.Race.NONE;
  863. return race;
  864. }
  865. public boolean isCustom()
  866. {
  867. return npcId != idTemplate;
  868. }
  869. /**
  870. * @return name
  871. */
  872. public String getName()
  873. {
  874. return name;
  875. }
  876. public boolean isSpecialTree()
  877. {
  878. return npcId == L2XmassTreeInstance.SPECIAL_TREE_ID;
  879. }
  880. }