2
0

SummonEffectsTable.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Copyright (C) 2004-2013 L2J Server
  3. *
  4. * This file is part of L2J Server.
  5. *
  6. * L2J Server 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 Server 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 com.l2jserver.gameserver.datatables;
  20. import java.util.List;
  21. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  22. import com.l2jserver.gameserver.model.skills.L2Skill;
  23. import gnu.trove.map.hash.TIntObjectHashMap;
  24. /**
  25. * @author Nyaran
  26. */
  27. public class SummonEffectsTable
  28. {
  29. /** Servitors **/
  30. // Map tree
  31. // -> key: charObjectId, value: classIndex Map
  32. // --> key: classIndex, value: servitors Map
  33. // ---> key: servitorSkillId, value: Effects list
  34. private final TIntObjectHashMap<TIntObjectHashMap<TIntObjectHashMap<List<SummonEffect>>>> _servitorEffects = new TIntObjectHashMap<>();
  35. public TIntObjectHashMap<TIntObjectHashMap<TIntObjectHashMap<List<SummonEffect>>>> getServitorEffectsOwner()
  36. {
  37. return _servitorEffects;
  38. }
  39. public TIntObjectHashMap<List<SummonEffect>> getServitorEffects(L2PcInstance owner)
  40. {
  41. final TIntObjectHashMap<TIntObjectHashMap<List<SummonEffect>>> servitorMap = _servitorEffects.get(owner.getObjectId());
  42. if (servitorMap == null)
  43. {
  44. return null;
  45. }
  46. return servitorMap.get(owner.getClassIndex());
  47. }
  48. /** Pets **/
  49. private final TIntObjectHashMap<List<SummonEffect>> _petEffects = new TIntObjectHashMap<>(); // key: petItemObjectId, value: Effects list
  50. public TIntObjectHashMap<List<SummonEffect>> getPetEffects()
  51. {
  52. return _petEffects;
  53. }
  54. public class SummonEffect
  55. {
  56. L2Skill _skill;
  57. int _effectCount;
  58. int _effectCurTime;
  59. public SummonEffect(L2Skill skill, int effectCount, int effectCurTime)
  60. {
  61. _skill = skill;
  62. _effectCount = effectCount;
  63. _effectCurTime = effectCurTime;
  64. }
  65. public L2Skill getSkill()
  66. {
  67. return _skill;
  68. }
  69. public int getEffectCount()
  70. {
  71. return _effectCount;
  72. }
  73. public int getEffectCurTime()
  74. {
  75. return _effectCurTime;
  76. }
  77. }
  78. /**
  79. * @return
  80. */
  81. public static SummonEffectsTable getInstance()
  82. {
  83. return SingletonHolder._instance;
  84. }
  85. private static class SingletonHolder
  86. {
  87. protected static final SummonEffectsTable _instance = new SummonEffectsTable();
  88. }
  89. }