2
0

SummonEffectsTable.java 2.8 KB

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