Widget.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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 __EQ2_WIDGET__
  17. #define __EQ2_WIDGET__
  18. #include "Spawn.h"
  19. #include "client.h"
  20. #include <string.h>
  21. using namespace std;
  22. #define WIDGET_TYPE_GENERIC 0
  23. #define WIDGET_TYPE_DOOR 1
  24. #define WIDGET_TYPE_LIFT 2
  25. class Widget : public Spawn{
  26. public:
  27. Widget();
  28. virtual ~Widget();
  29. bool IsWidget(){ return true; }
  30. int32 GetWidgetID();
  31. void SetWidgetID(int32 val);
  32. void SetWidgetX(float val);
  33. float GetWidgetX();
  34. void SetWidgetY(float val);
  35. float GetWidgetY();
  36. void SetWidgetZ(float val);
  37. float GetWidgetZ();
  38. void SetIncludeLocation(bool val);
  39. bool GetIncludeLocation();
  40. void SetIncludeHeading(bool val);
  41. bool GetIncludeHeading();
  42. void SetWidgetIcon(int8 val);
  43. Widget* Copy();
  44. EQ2Packet* serialize(Player* player, int16 version);
  45. void HandleTimerUpdate();
  46. void OpenDoor();
  47. void CloseDoor();
  48. void HandleUse(Client* client, string command, int8 overrideWidgetType=0xFF);
  49. float GetOpenHeading();
  50. void SetOpenHeading(float val);
  51. float GetClosedHeading();
  52. void SetClosedHeading(float val);
  53. float GetOpenY();
  54. void SetOpenY(float val);
  55. float GetCloseY();
  56. void SetCloseY(float val);
  57. float GetOpenX(){return open_x;}
  58. float GetOpenZ(){return open_z;}
  59. float GetCloseX(){return close_x;}
  60. float GetCloseZ(){return close_z;}
  61. void SetOpenX(float x){open_x = x;}
  62. void SetOpenZ(float z){open_z = z;}
  63. void SetCloseX(float x){close_x = x;}
  64. void SetCloseZ(float z){close_z = z;}
  65. int8 GetWidgetType();
  66. void SetWidgetType(int8 val);
  67. bool IsOpen();
  68. int32 GetActionSpawnID();
  69. void SetActionSpawnID(int32 id);
  70. int32 GetLinkedSpawnID();
  71. void SetLinkedSpawnID(int32 id);
  72. const char* GetOpenSound();
  73. void SetOpenSound(const char* name);
  74. const char* GetCloseSound();
  75. void SetCloseSound(const char* name);
  76. void SetOpenDuration(int16 val);
  77. int16 GetOpenDuration();
  78. void ProcessUse();
  79. void SetHouseID(int32 val) { m_houseID = val; }
  80. int32 GetHouseID() { return m_houseID; }
  81. void SetMultiFloorLift(bool val) { multi_floor_lift = val; }
  82. bool GetMultiFloorLift() { return multi_floor_lift; }
  83. static string GetWidgetTypeNameByTypeID(int8 type)
  84. {
  85. switch (type)
  86. {
  87. case WIDGET_TYPE_DOOR:
  88. return string("Door");
  89. break;
  90. case WIDGET_TYPE_LIFT:
  91. return string("Lift");
  92. break;
  93. }
  94. return string("Generic");
  95. }
  96. private:
  97. int8 widget_type;
  98. bool include_location;
  99. bool include_heading;
  100. float widget_x;
  101. float widget_y;
  102. float widget_z;
  103. int32 widget_id;
  104. float open_heading;
  105. float closed_heading;
  106. float open_y;
  107. float close_y;
  108. Widget* action_spawn;
  109. int32 action_spawn_id;
  110. Widget* linked_spawn;
  111. int32 linked_spawn_id;
  112. bool is_open;
  113. string open_sound;
  114. string close_sound;
  115. int16 open_duration;
  116. int32 m_houseID;
  117. float open_x;
  118. float open_z;
  119. float close_x;
  120. float close_z;
  121. bool multi_floor_lift;
  122. };
  123. #endif