9
3

HeroicOp.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. EQ2Emulator: Everquest II Server Emulator
  3. Copyright (C) 2007 EQ2EMulator Development Team (http://www.eq2emulator.net)
  4. This file is part of EQ2Emulator.
  5. EQ2Emulator is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. EQ2Emulator is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with EQ2Emulator. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef __HEROICOP_H__
  17. #define __HEROICOP_H__
  18. #include <map>
  19. #include <vector>
  20. #include "../../common/types.h"
  21. using namespace std;
  22. struct HeroicOPStarter {
  23. int32 id;
  24. int8 start_class;
  25. int16 starter_icon;
  26. int16 abilities[6];
  27. };
  28. struct HeroicOPWheel {
  29. int8 order;
  30. int16 shift_icon;
  31. float chance;
  32. int16 abilities[6];
  33. int32 spell_id;
  34. };
  35. class HeroicOP {
  36. public:
  37. HeroicOP();
  38. ~HeroicOP();
  39. /// <summary>Sets the complete flag for this Heroic OP</summary>
  40. /// <param name='val'>The value to set the complete flag to, 1 = failed 2 = finished</param>
  41. void SetComplete(int8 val) { m_complete = val; }
  42. /// <summary>Sets the current stage of the starter chain or the wheel chain is at</summary>
  43. /// <param name='val'>The stage to set this Heroic OP to</param>
  44. void SetStage(int8 val) { m_currentStage = val; }
  45. /// <summary>Sets the wheel for this Heroic OP</summary>
  46. /// <param name='val'>The wheel we are setting the Heroic OP to</param>
  47. void SetWheel(HeroicOPWheel* val);
  48. /// <summary>Sets the start time for the wheel</summary>
  49. /// <param name='val'>Value to set the start time to</param>
  50. void SetStartTime(int32 val) { m_startTime = val; }
  51. /// <summary>Sets the total time to complete the wheel</summary>
  52. /// <param name='val'>Value to set the total time to</param>
  53. void SetTotalTime(float val) { m_totalTime = val; }
  54. /// <summary>Sets the target of this HO</summary>
  55. /// <param name='val'>The ID of the spawn</param>
  56. void SetTarget(int32 val);
  57. /// <summary>Gets the complete flag for this Heroic OP</summary>
  58. /// <returns>0 = not complete, 1 = complete, 2+= failed</returns>
  59. int8 GetComplete() { return m_complete; }
  60. /// <summary>Gets the wheel for this heroic op</summary>
  61. HeroicOPWheel* GetWheel() { return m_wheel; }
  62. /// <summary>Gets a pointer to the list of starter chains</summary>
  63. vector<HeroicOPStarter*>* GetStarterChains() { return &starters; }
  64. /// <summary>Gets the current stage the HO is on</summary>
  65. int8 GetStage() { return m_currentStage; }
  66. /// <summary>Gets the start time for the wheel</summary>
  67. int32 GetStartTime() { return m_startTime; }
  68. /// <summary>Gets the total time players have to complete the wheel</summary>
  69. float GetTotalTime() { return m_totalTime; }
  70. /// <summary>Gets the ID of this HO's target</summary>
  71. int32 GetTarget() { return m_target; }
  72. /// <summary></summary>
  73. bool HasShifted() { return m_shifted; }
  74. /// <summary>Checks to see if the given icon will advance the Heroic OP</summary>
  75. /// <param name='icon'>The icon that is trying to advance the Heroic OP</param>
  76. /// <returns>True if the icon advanced the HO</returns>
  77. bool UpdateHeroicOP(int16 icon);
  78. /// <summary>Reset the stage to 0</summary>
  79. void ResetStage() { m_currentStage = 0; }
  80. /// <summary>Adds a starter chain to the Heroic OP</summary>
  81. /// <param name='starter'>The starter chain to add</param>
  82. void AddStarterChain(HeroicOPStarter* starter);
  83. /// <summary>Attempts to shift the wheel</summary>
  84. bool ShiftWheel();
  85. int8 countered[6];
  86. private:
  87. int8 m_complete;
  88. int8 m_currentStage;
  89. int32 m_startTime;
  90. float m_totalTime;
  91. int32 m_target;
  92. bool m_shifted;
  93. HeroicOPWheel* m_wheel;
  94. vector<HeroicOPStarter*> starters;
  95. };
  96. class MasterHeroicOPList {
  97. public:
  98. MasterHeroicOPList();
  99. ~MasterHeroicOPList();
  100. /// <summary>Adds the starter chain to the list</summary>
  101. /// <param name='start_class'>Class id for the starter chain</param>
  102. /// <param name='starter'>Starter chain to add</param>
  103. void AddStarter(int8 start_class, HeroicOPStarter* starter);
  104. /// <summary>Add the wheel chain to the list</summary>
  105. /// <param name='starter_id'>Id of the starter this wheel belongs to</param>
  106. /// <param name='wheel'>Wheel to add</param>
  107. void AddWheel(int32 starter_id, HeroicOPWheel* wheel);
  108. /// <summary>Creates a new HO</summary>
  109. /// <param name='class_id'>Class ID starting the HO</param>
  110. HeroicOP* GetHeroicOP(int8 class_id);
  111. /// <summary>Gets a random wheel from the given starter</summary>
  112. /// <param name='starter'>The starter to determine what wheels to choose from</param>
  113. HeroicOPWheel* GetWheel(HeroicOPStarter* starter);
  114. private:
  115. // map<class, map<starter, vector<wheel> > >
  116. map<int8, map<HeroicOPStarter*, vector<HeroicOPWheel*> > > m_hoList;
  117. };
  118. #endif