Guild.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  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 GUILD_H_
  17. #define GUILD_H_
  18. #include <vector>
  19. #include <deque>
  20. #include <map>
  21. #include "../../common/Mutex.h"
  22. #include "../MutexMap.h"
  23. using namespace std;
  24. class ZoneServer;
  25. class Client;
  26. class Player;
  27. #define GUILD_RANK_LEADER 0
  28. #define GUILD_RANK_SENIOR_OFFICER 1
  29. #define GUILD_RANK_OFFICER 2
  30. #define GUILD_RANK_SENIOR_MEMBER 3
  31. #define GUILD_RANK_MEMBER 4
  32. #define GUILD_RANK_JUNIOR_MEMBER 5
  33. #define GUILD_RANK_INITIATE 6
  34. #define GUILD_RANK_RECRUIT 7
  35. #define GUILD_PERMISSIONS_INVITE 0
  36. #define GUILD_PERMISSIONS_RMEOVE_MEMBER 1
  37. #define GUILD_PERMISSIONS_PROMOTE_MEMBER 2
  38. #define GUILD_PERMISSIONS_DEMOTE_MEMBER 3
  39. #define GUILD_PERMISSIONS_CHANGE_MOTD 6
  40. #define GUILD_PERMISSIONS_CHANGE_PERMISSIONS 7
  41. #define GUILD_PERMISSIONS_CHANGE_RANK_NAMES 8
  42. #define GUILD_PERMISSIONS_SEE_OFFICER_NOTES 9
  43. #define GUILD_PERMISSIONS_EDIT_OFFICER_NOTES 10
  44. #define GUILD_PERMISSIONS_SEE_OFFICER_CHAT 11
  45. #define GUILD_PERMISSIONS_SPEAK_IN_OFFICER_CHAT 12
  46. #define GUILD_PERMISSIONS_SEE_GUILD_CHAT 13
  47. #define GUILD_PERMISSIONS_SPEAK_IN_GUILD_CHAT 14
  48. #define GUILD_PERMISSIONS_EDIT_PERSONAL_NOTES 15
  49. #define GUILD_PERMISSIONS_EDIT_PERSONAL_NOTES_OTHERS 16
  50. #define GUILD_PERMISSIONS_EDIT_EVENT_FILTERS 17
  51. #define GUILD_PERMISSIONS_EDIT_EVENTS 18
  52. #define GUILD_PERMISSIONS_PURCHASE_STATUS_ITEMS 19
  53. #define GUILD_PERMISSIONS_DISPLAY_GUILD_NAME 20
  54. #define GUILD_PERMISSIONS_SEND_EMAIL_TO_GUILD 21
  55. #define GUILD_PERMISSIONS_BANK1_SEE_CONTENTS 22
  56. #define GUILD_PERMISSIONS_BANK2_SEE_CONTENTS 23
  57. #define GUILD_PERMISSIONS_BANK3_SEE_CONTENTS 24
  58. #define GUILD_PERMISSIONS_BANK4_SEE_CONTENTS 25
  59. #define GUILD_PERMISSIONS_BANK1_DEPOSIT 26
  60. #define GUILD_PERMISSIONS_BANK2_DEPOSIT 27
  61. #define GUILD_PERMISSIONS_BANK3_DEPOSIT 28
  62. #define GUILD_PERMISSIONS_BANK4_DEPOSIT 29
  63. #define GUILD_PERMISSIONS_BANK1_WITHDRAWL 30
  64. #define GUILD_PERMISSIONS_BANK2_WITHDRAWL 31
  65. #define GUILD_PERMISSIONS_BANK3_WITHDRAWL 32
  66. #define GUILD_PERMISSIONS_BANK4_WITHDRAWL 33
  67. #define GUILD_PERMISSIONS_EDIT_RECRUITING_SETTINGS 35
  68. #define GUILD_PERMISSIONS_MAKE_OTHERS_RECRUITERS 36
  69. #define GUILD_PERMISSIONS_SEE_RECRUITING_SETTINGS 37
  70. #define GUILD_PERMISSIONS_ASSIGN_POINTS 43
  71. #define GUILD_PERMISSIONS_RECEIVE_POINTS 44
  72. #define GUILD_EVENT_FILTER_CATEGORY_RETAIN_HISTORY 0
  73. #define GUILD_EVENT_FILTER_CATEGORY_BROADCAST 1
  74. #define GUILD_EVENT_GUILD_LEVEL_UP 0
  75. #define GUILD_EVENT_GUILD_LEVEL_DOWN 1
  76. #define GUILD_EVENT_DISCOVERS_ITEM 2
  77. #define GUILD_EVENT_GAINS_ADV_LEVEL_1_10 3
  78. #define GUILD_EVENT_GAINS_ADV_LEVEL_11_20 4
  79. #define GUILD_EVENT_GAINS_ADV_LEVEL_21_30 5
  80. #define GUILD_EVENT_GAINS_ADV_LEVEL_31_40 6
  81. #define GUILD_EVENT_GAINS_ADV_LEVEL_41_50 7
  82. #define GUILD_EVENT_GAINS_TS_LEVEL_1_10 8
  83. #define GUILD_EVENT_GAINS_TS_LEVEL_11_20 9
  84. #define GUILD_EVENT_GAINS_TS_LEVEL_21_30 10
  85. #define GUILD_EVENT_GAINS_TS_LEVEL_31_40 11
  86. #define GUILD_EVENT_GAINS_TS_LEVEL_41_50 12
  87. #define GUILD_EVENT_MEMBER_JOINS 13
  88. #define GUILD_EVENT_MEMBER_LEAVES 14
  89. #define GUILD_EVENT_MEMBER_PROMOTED 15
  90. #define GUILD_EVENT_MEMBER_DEMOTED 16
  91. #define GUILD_EVENT_COMPLETES_HERITAGE_QUEST 19
  92. #define GUILD_EVENT_KILLS_EPIC_MONSTER 20
  93. #define GUILD_EVENT_LOOTS_ARTIFACT 21
  94. #define GUILD_EVENT_LOOTS_FABELED_ITEM 22
  95. #define GUILD_EVENT_LOOTS_LEGENDARY_ITEM 23
  96. #define GUILD_EVENT_COMPLETES_WRIT 24
  97. #define GUILD_EVENT_LOOTS_MYTHICAL_ITEM 25
  98. #define GUILD_EVENT_GAINS_ADV_LEVEL_10 26
  99. #define GUILD_EVENT_GAINS_ADV_LEVEL_20 27
  100. #define GUILD_EVENT_GAINS_ADV_LEVEL_30 28
  101. #define GUILD_EVENT_GAINS_ADV_LEVEL_40 29
  102. #define GUILD_EVENT_GAINS_ADV_LEVEL_50 30
  103. #define GUILD_EVENT_GAINS_TS_LEVEL_10 31
  104. #define GUILD_EVENT_GAINS_TS_LEVEL_20 32
  105. #define GUILD_EVENT_GAINS_TS_LEVEL_30 33
  106. #define GUILD_EVENT_GAINS_TS_LEVEL_40 34
  107. #define GUILD_EVENT_GAINS_TS_LEVEL_50 35
  108. #define GUILD_EVENT_GAINS_ADV_LEVEL_51_60 37
  109. #define GUILD_EVENT_GAINS_TS_LEVEL_51_60 38
  110. #define GUILD_EVENT_GAINS_ADV_LEVEL_60 39
  111. #define GUILD_EVENT_GAINS_TS_LEVEL_60 40
  112. #define GUILD_EVENT_GAINS_ADV_LEVEL_61_70 41
  113. #define GUILD_EVENT_GAINS_TS_LEVEL_61_70 42
  114. #define GUILD_EVENT_GAINS_ADV_LEVEL_70 43
  115. #define GUILD_EVENT_GAINS_TS_LEVEL_70 44
  116. #define GUILD_EVENT_GAINS_AA_10 45
  117. #define GUILD_EVENT_GAINS_AA_20 46
  118. #define GUILD_EVENT_GAINS_AA_30 47
  119. #define GUILD_EVENT_GAINS_AA_40 48
  120. #define GUILD_EVENT_GAINS_AA_50 49
  121. #define GUILD_EVENT_GAINS_AA_1_10 50
  122. #define GUILD_EVENT_GAINS_AA_11_20 51
  123. #define GUILD_EVENT_GAINS_AA_21_30 52
  124. #define GUILD_EVENT_GAINS_AA_31_40 53
  125. #define GUILD_EVENT_GAINS_AA_41_50 54
  126. #define GUILD_EVENT_BECOMES_RECRUITER 55
  127. #define GUILD_EVENT_NO_LONGER_RECRUITER 56
  128. #define GUILD_EVENT_HERALDY_CHANGE 57
  129. #define GUILD_EVENT_GAINS_AA_60 58
  130. #define GUILD_EVENT_GAINS_AA_70 59
  131. #define GUILD_EVENT_GAINS_AA_80 60
  132. #define GUILD_EVENT_GAINS_AA_90 61
  133. #define GUILD_EVENT_GAINS_AA_100 62
  134. #define GUILD_EVENT_GAINS_AA_51_60 63
  135. #define GUILD_EVENT_GAINS_AA_61_70 64
  136. #define GUILD_EVENT_GAINS_AA_71_80 65
  137. #define GUILD_EVENT_GAINS_AA_81_90 66
  138. #define GUILD_EVENT_GAINS_AA_91_100 67
  139. #define GUILD_EVENT_GAINS_ADV_LEVEL_80 68
  140. #define GUILD_EVENT_GAINS_TS_LEVEL_80 69
  141. #define GUILD_EVENT_GAINS_ADV_LEVEL_71_80 70
  142. #define GUILD_EVENT_GAINS_TS_LEVEL_71_80 71
  143. #define GUILD_EVENT_GAINS_AA_110 72
  144. #define GUILD_EVENT_GAINS_AA_120 73
  145. #define GUILD_EVENT_GAINS_AA_130 74
  146. #define GUILD_EVENT_GAINS_AA_140 75
  147. #define GUILD_EVENT_GAINS_AA_101_110 76
  148. #define GUILD_EVENT_GAINS_AA_111_120 77
  149. #define GUILD_EVENT_GAINS_AA_121_130 78
  150. #define GUILD_EVENT_GAINS_AA_131_140 79
  151. #define GUILD_EVENT_GAINS_AA_150 80
  152. #define GUILD_EVENT_GAINS_AA_141_150 81
  153. #define GUILD_EVENT_GAINS_AA_160 82
  154. #define GUILD_EVENT_GAINS_AA_170 83
  155. #define GUILD_EVENT_GAINS_AA_180 84
  156. #define GUILD_EVENT_GAINS_AA_190 85
  157. #define GUILD_EVENT_GAINS_AA_200 86
  158. #define GUILD_EVENT_GAINS_AA_151_160 87
  159. #define GUILD_EVENT_GAINS_AA_161_170 88
  160. #define GUILD_EVENT_GAINS_AA_171_180 89
  161. #define GUILD_EVENT_GAINS_AA_181_190 90
  162. #define GUILD_EVENT_GAINS_AA_191_200 91
  163. #define GUILD_EVENT_EARNS_ACHIEVEMENT 92
  164. #define GUILD_RECRUITING_FLAG_TRAINING 0
  165. #define GUILD_RECRUITING_FLAG_FIGHTERS 1
  166. #define GUILD_RECRUITING_FLAG_PRIESTS 2
  167. #define GUILD_RECRUITING_FLAG_SCOUTS 3
  168. #define GUILD_RECRUITING_FLAG_MAGES 4
  169. #define GUILD_RECRUITING_FLAG_TRADESKILLERS 5
  170. #define GUILD_RECRUITING_PLAYSTYLE_NONE 0
  171. #define GUILD_RECRUITING_PLAYSTYLE_CASUAL 1
  172. #define GUILD_RECRUITING_PLAYSTYLE_HARDCORE 2
  173. #define GUILD_RECRUITING_DESC_TAG_NONE 0
  174. #define GUILD_RECRUITING_DESC_TAG_GOOD 1
  175. #define GUILD_RECRUITING_DESC_TAG_EVIL 2
  176. #define GUILD_RECRUITING_DESC_TAG_CHATTY 3
  177. #define GUILD_RECRUITING_DESC_TAG_ORGANIZED 4
  178. #define GUILD_RECRUITING_DESC_TAG_ROLEPLAY 5
  179. #define GUILD_RECRUITING_DESC_TAG_ENJOY_QUESTS 6
  180. #define GUILD_RECRUITING_DESC_TAG_ENJOY_RAIDS 7
  181. #define GUILD_RECRUITING_DESC_TAG_ODD_HOURS 8
  182. #define GUILD_RECRUITING_DESC_TAG_CRAFTER_ORIENTED 9
  183. #define GUILD_RECRUITING_DESC_TAG_FAMILY_FRIENDLY 10
  184. #define GUILD_RECRUITING_DESC_TAG_MATURE_HUMOR 11
  185. #define GUILD_RECRUITING_DESC_TAG_INMATES_RUN 12
  186. #define GUILD_RECRUITING_DESC_TAG_VERY_FUNNY 13
  187. #define GUILD_RECRUITING_DESC_TAG_HUMOR_CAUES_PAIN 14
  188. #define GUILD_RECRUITING_DESC_TAG_SERIOUS 15
  189. #define GUILD_MEMBER_FLAGS_RECRUITING_FOR_GUILD 1
  190. #define GUILD_MEMBER_FLAGS_NOTIFY_LOGINS 2
  191. #define GUILD_MEMBER_FLAGS_DONT_GENERATE_EVENTS 4
  192. #define GUILD_EVENT_ACTION_LOCK 0
  193. #define GUILD_EVENT_ACTION_UNLOCK 1
  194. #define GUILD_EVENT_ACTION_DELETE 2
  195. #define GUILD_MAX_LEVEL 80
  196. #define GUILD_MAX_POINT_HISTORY 50
  197. #define GUILD_MAX_EVENTS 500
  198. #define GUILD_MAX_LOCKED_EVENTS 200
  199. struct PointHistory {
  200. int32 date;
  201. string modified_by;
  202. string comment;
  203. float points;
  204. bool saved_needed;
  205. };
  206. struct GuildMember {
  207. int32 character_id;
  208. int32 account_id;
  209. int32 recruiter_id; //00 00 00 00 if not a guild recruiter
  210. char name[64];
  211. int32 guild_status;
  212. float points;
  213. int8 adventure_class;
  214. int8 adventure_level;
  215. int8 tradeskill_class;
  216. int8 tradeskill_level;
  217. int8 rank;
  218. int8 member_flags;
  219. string zone;
  220. int32 join_date;
  221. int32 last_login_date;
  222. string note;
  223. string officer_note;
  224. string recruiter_description;
  225. unsigned char* recruiter_picture_data;
  226. int16 recruiter_picture_data_size;
  227. int8 recruiting_show_adventure_class;
  228. deque<PointHistory*> point_history;
  229. };
  230. struct GuildEvent {
  231. int64 event_id;
  232. int32 date;
  233. int32 type;
  234. string description;
  235. int8 locked;
  236. bool save_needed;
  237. };
  238. struct GuildBankEvent {
  239. int64 event_id;
  240. int32 date;
  241. int32 type;
  242. string description;
  243. };
  244. struct Bank {
  245. string name;
  246. deque<GuildBankEvent*> events;
  247. };
  248. class Guild {
  249. public:
  250. Guild();
  251. virtual ~Guild();
  252. void SetID(int32 id_in) {id = id_in;}
  253. void SetName(const char* name, bool send_packet = true);
  254. void SetLevel(int8 level, bool send_packet = true);
  255. void SetFormedDate(int32 formed_date_in) {formed_date = formed_date_in;}
  256. void SetMOTD(const char *motd, bool send_packet = true);
  257. int32 GetID() const {return id;}
  258. const char* GetName() const {return name;}
  259. int8 GetLevel() const {return level;}
  260. int32 GetFormedDate() const {return formed_date;}
  261. const char * GetMOTD() const {return motd;}
  262. void SetEXPCurrent(int64 exp, bool send_packet = true);
  263. void AddEXPCurrent(sint64 exp, bool send_packet = true);
  264. int64 GetEXPCurrent() const {return exp_current;}
  265. void SetEXPToNextLevel(int64 exp, bool send_packet = true);
  266. int64 GetEXPToNextLevel() const {return exp_to_next_level;}
  267. void SetRecruitingShortDesc(const char* new_desc, bool send_packet = true);
  268. string GetRecruitingShortDesc() const {return recruiting_short_desc;}
  269. void SetRecruitingFullDesc(const char* new_desc, bool send_packet = true);
  270. string GetRecruitingFullDesc() const {return recruiting_full_desc;}
  271. void SetRecruitingMinLevel(int8 new_level, bool send_packet = true);
  272. int8 GetRecruitingMinLevel() const {return recruiting_min_level;}
  273. void SetRecruitingPlayStyle(int8 new_play_style, bool send_packet = true);
  274. int8 GetRecruitingPlayStyle() const {return recruiting_play_style;}
  275. bool SetRecruitingDescTag(int8 index, int8 tag, bool send_packet = true);
  276. int8 GetRecruitingDescTag(int8 index);
  277. bool SetPermission(int8 rank, int8 permission, int8 value, bool send_packet = true);
  278. int8 GetPermission(int8 rank, int8 permission);
  279. bool SetEventFilter(int8 event_id, int8 category, int8 value, bool send_packet = true);
  280. int8 GetEventFilter(int8 event_id, int8 category);
  281. int32 GetNumUniqueAccounts();
  282. int32 GetNumRecruiters();
  283. int32 GetNextRecruiterID();
  284. int64 GetNextEventID();
  285. GuildMember* GetGuildMemberOnline(Client* client);
  286. GuildMember* GetGuildMember(Player* player);
  287. GuildMember* GetGuildMember(int32 character_id);
  288. GuildMember* GetGuildMember(const char* player_name);
  289. vector<GuildMember*>* GetGuildRecruiters();
  290. GuildEvent* GetGuildEvent(int64 event_id);
  291. bool SetRankName(int8 rank, const char* name, bool send_packet = true);
  292. const char* GetRankName(int8 rank);
  293. bool SetRecruitingFlag(int8 flag, int8 value, bool send_packet = true);
  294. int8 GetRecruitingFlag(int8 flag);
  295. bool SetGuildRecruiter(Client* client, const char* name, bool value, bool send_packet = true);
  296. bool SetGuildRecruiterDescription(Client* client, const char* description, bool send_packet = true);
  297. bool ToggleGuildRecruiterAdventureClass(Client* client, bool send_packet = true);
  298. bool SetGuildMemberNote(const char* name, const char* note, bool send_packet = true);
  299. bool SetGuildOfficerNote(const char* name, const char* note, bool send_packet = true);
  300. bool AddNewGuildMember(Client* client, const char* invited_by = 0, int8 rank = GUILD_RANK_RECRUIT);
  301. bool AddGuildMember(GuildMember* guild_member);
  302. void RemoveGuildMember(int32 character_id, bool send_packet = true);
  303. void RemoveAllGuildMembers();
  304. bool DemoteGuildMember(Client* client, const char* name, bool send_packet = true);
  305. bool PromoteGuildMember(Client* client, const char* name, bool send_packet = true);
  306. bool KickGuildMember(Client* client, const char* name, bool send_packet = true);
  307. bool InvitePlayer(Client* client, const char* name, bool send_packet = true);
  308. bool AddPointsToAll(Client* client, float points, const char* comment = 0, bool send_packet = true);
  309. bool AddPointsToAllOnline(Client* client, float points, const char* comment = 0, bool send_packet = true);
  310. bool AddPointsToGroup(Client* client, float points, const char* comment = 0, bool send_packet = true);
  311. bool AddPointsToRaid(Client* client, float points, const char* comment = 0, bool send_packet = true);
  312. bool AddPointsToGuildMember(Client* client, float points, const char* name, const char* comment = 0, bool send_packet = true);
  313. bool AddPointHistory(GuildMember* guild_member, int32 date, const char* modified_by, float points, const char* comment = 0, bool new_point_history = true);
  314. void ViewGuildMemberPoints(Client* client, const char* name);
  315. bool ChangeMemberFlag(Client* client, int8 member_flag, int8 value, bool send_packet = true);
  316. bool UpdateGuildMemberInfo(Player* player);
  317. bool UpdateGuildStatus(Player *player, int32 Status);
  318. void AddGuildEvent(int64 event_id, int32 type, const char* description, int32 date, int8 locked);
  319. void AddNewGuildEvent(int32 type, const char* description, int32 date, bool send_packet = true, ...);
  320. bool LockGuildEvent(int64 event_id, bool lock, bool send_packet = true);
  321. bool DeleteGuildEvent(int64 event_id, bool send_packet = true);
  322. void SendGuildMOTD(Client* client);
  323. void SendGuildEventList();
  324. void SendGuildEventList(Client* client);
  325. void SendGuildEventDetails();
  326. void SendGuildEventDetails(Client* client);
  327. void SendAllGuildEvents();
  328. void SendAllGuildEvents(Client* client);
  329. void SendOldGuildEvent(Client* client, GuildEvent* guild_event);
  330. void SendNewGuildEvent(GuildEvent* guild_event);
  331. void SendNewGuildEvent(Client* client, GuildEvent* guild_event);
  332. void SendGuildEventAction(int8 action, GuildEvent* guild_event);
  333. void SendGuildEventAction(Client* client, int8 action, GuildEvent* guild_event);
  334. void SendGuildBankEventList();
  335. void SendGuildBankEventList(Client* client);
  336. void SendGuildUpdate();
  337. void SendGuildUpdate(Client* client);
  338. void SendGuildMemberList();
  339. void SendGuildMemberList(Client* client);
  340. void SendGuildMember(Player* player, bool include_zone = true);
  341. void SendGuildMember(GuildMember* gm, bool include_zone = true);
  342. void SendGuildMember(Client* client, GuildMember* gm, bool include_zone = true);
  343. void SendGuildModification(float points, vector<int32>* character_ids);
  344. void SendGuildModification(Client* client, float points, vector<int32>* character_ids);
  345. void GuildMemberLogin(Client *client, bool first_login = false);
  346. void GuildMemberLogoff(Player *player);
  347. void SendGuildMemberLeave(int32 character_id);
  348. void SendGuildMemberLeave(Client* client, int32 character_id);
  349. void SendGuildRecruitingDetails(Client* client);
  350. void SendGuildRecruitingImages(Client* client);
  351. void SendGuildRecruiterInfo(Client* client, Player* player);
  352. void HandleGuildSay(Client* sender, const char* message);
  353. void HandleOfficerSay(Client* sender, const char* message);
  354. void SendMessageToGuild(int8 event_type, const char* message, ...);
  355. void SetSaveNeeded(bool val) {save_needed = val;}
  356. bool GetSaveNeeded() {return save_needed;}
  357. void SetMemberSaveNeeded(bool val) {member_save_needed = val;}
  358. bool GetMemberSaveNeeded() {return member_save_needed;}
  359. void SetEventsSaveNeeded(bool val) {events_save_needed = val;}
  360. bool GetEventsSaveNeeded() {return events_save_needed;}
  361. void SetRanksSaveNeeded(bool val) {ranks_save_needed = val;}
  362. bool GetRanksSaveNeeded() {return ranks_save_needed;}
  363. void SetEventFiltersSaveNeeded(bool val) {event_filters_save_needed = val;}
  364. bool GetEventFiltersSaveNeeded() {return event_filters_save_needed;}
  365. void SetPointsHistorySaveNeeded(bool val) {points_history_save_needed = val;}
  366. bool GetPointsHistorySaveNeeded() {return points_history_save_needed;}
  367. void SetRecruitingSaveNeeded(bool val) {recruiting_save_needed = val;}
  368. bool GetRecruitingSaveNeeded() {return recruiting_save_needed;}
  369. map<int32, GuildMember*>* GetGuildMembers() {return &members;}
  370. Mutex * GetGuildMembersMutex() {return &mMembers;}
  371. deque<GuildEvent*>* GetGuildEvents() {return &guild_events;}
  372. MutexMap<int8, MutexMap<int8, int8>*>* GetPermissions() {return &permissions;}
  373. MutexMap<int8, string>* GetGuildRanks() {return &ranks;}
  374. MutexMap<int8, int8>* GetRecruitingFlags() {return &recruiting_flags;}
  375. MutexMap<int8, int8>* GetRecruitingDescTags() {return &recruiting_desc_tags;}
  376. int8 GetRecruitingLookingForPacketValue();
  377. static string GetEpicMobDeathMessage(const char* player_name, const char* mob_name);
  378. private:
  379. int32 id;
  380. char name[64];
  381. int8 level;
  382. int32 formed_date;
  383. char motd[256];
  384. int64 exp_current;
  385. int64 exp_to_next_level;
  386. string recruiting_short_desc;
  387. string recruiting_full_desc;
  388. int8 recruiting_min_level;
  389. int8 recruiting_play_style;
  390. MutexMap<int8, string> ranks;
  391. map<int32, GuildMember*> members;
  392. Mutex mMembers;
  393. deque<GuildEvent*> guild_events;
  394. MutexMap<int8, MutexMap<int8, int8>*> permissions;
  395. MutexMap<int8, MutexMap<int8, int8>*> event_filters;
  396. MutexMap<int8, int8> recruiting_flags;
  397. MutexMap<int8, int8> recruiting_desc_tags;
  398. Bank banks[4];
  399. int32 GetPermissionsPacketValue(int8 rank, int32 start, int32 end);
  400. int32 GetEventFilterPacketValue(int8 category, int32 start, int32 end);
  401. bool save_needed;
  402. bool member_save_needed;
  403. bool events_save_needed;
  404. bool event_filters_save_needed;
  405. bool ranks_save_needed;
  406. bool points_history_save_needed;
  407. bool recruiting_save_needed;
  408. };
  409. class GuildList {
  410. public:
  411. GuildList();
  412. virtual ~GuildList();
  413. bool AddGuild(Guild* guild);
  414. Guild* GetGuild(int32 guild_id);
  415. Guild* GetGuild(const char* guild_name);
  416. bool RemoveGuild(Guild* guild, bool delete_data = false);
  417. bool RemoveGuild(int32 guild_id, bool delete_data = false);
  418. int32 GetNumGuilds() {return guild_list.size();}
  419. MutexMap<int32, Guild*>* GetGuilds() {return &guild_list;}
  420. private:
  421. MutexMap<int32, Guild*> guild_list;
  422. };
  423. #endif