Clone of UAS2 @ https://github.com/drudgedance/uas2

Fellowship.h 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * This file is part of UAS2.
  3. *
  4. * UAS2 is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * UAS2 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 UASv1; if not, write to the Free Software
  15. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. */
  17. /**
  18. * @file Fellowship.h
  19. */
  20. #ifndef __FELLOWSHIPS_H
  21. #define __FELLOWSHIPS_H
  22. #pragma warning(disable:4786) //warning: identifier was truncated to '255' characters in the browser information
  23. #include <map>
  24. #include "Avatar.h"
  25. #include "Shared.h"
  26. struct FellowMem
  27. {
  28. DWORD m_dwGUID;
  29. WORD m_wUnk1;
  30. DWORD m_dwLevel; // Level
  31. DWORD m_dwHealthTot; // maximum Health
  32. DWORD m_dwStaminaTot; // maximum Stamina
  33. DWORD m_dwManaTot; // maximum Mana
  34. DWORD m_dwHealthCur; // current Health
  35. DWORD m_dwStaminaCur; // current Stamina
  36. DWORD m_dwManaCur; // current Mana
  37. bool m_bShareLoot; // share loot - 0x00 = no, 0x10 = yes
  38. std::string m_szName;
  39. float m_fShareOfXP;
  40. ULONG m_timeJoin;
  41. };
  42. class cFellowship
  43. {
  44. friend class cAvatar;
  45. friend class cMasterServer;
  46. public:
  47. cFellowship();
  48. ~cFellowship();
  49. static DWORD NewFellowship ( DWORD dwLeaderGUID, std::string name, char felName[50], bool shareXP, bool shareLoot );
  50. DWORD CreateFellowship ( DWORD dwLeaderGUID, std::string name, char felName[50], bool shareXP, bool shareLoot );
  51. void Disband ( );
  52. void ClearMembers ( );
  53. static cFellowship* GetFellowshipByID ( DWORD dwFellowshipID );
  54. DWORD GetID() { return m_ID; }
  55. DWORD GetLeader() { return m_LeaderGUID; }
  56. DWORD GetSize() { return m_Size; }
  57. std::string GetName() { return m_Name.c_str(); }
  58. ULONG GetCreationTime() { return m_CreationTime; }
  59. bool GetIsOpen() { return m_IsOpen; }
  60. typedef std::map<DWORD, FellowMem> MemberList;
  61. FellowMem* FindMember ( DWORD dwMemberGUID ) { return &this->members.find(dwMemberGUID)->second; }
  62. bool SetLeader ( DWORD dwNewLeaderGUID );
  63. bool SetOpenClose ( DWORD dwIsOpen );
  64. bool AddMember ( DWORD dwAvatarGUID );
  65. bool RemMember ( DWORD dwMemberGUID );
  66. bool DismissMember ( DWORD dwMemberGUID );
  67. bool MemberDeath ( DWORD dwMemberGUID );
  68. bool InsertMember ( DWORD dwMemberGUID );
  69. bool DeleteMember ( DWORD dwMemberGUID, bool wasDismissed=false );
  70. bool UpdateMember ( DWORD dwMemberGUID );
  71. void RelayMemberUpdate ( DWORD dwMemberGUID );
  72. void RelayMemberDelete ( DWORD dwMemberGUID );
  73. void RelayMemberDismiss ( DWORD dwMemberGUID );
  74. cMessage JoinMessage ( DWORD dwClGUID, DWORD dwClF7B0Sequence );
  75. cMessage DisbandMessage ( DWORD dwClGUID, DWORD dwClF7B0Sequence );
  76. cMessage UpdMemberMessage ( DWORD dwClGUID, DWORD dwClF7B0Sequence, DWORD dwMemberGUID );
  77. cMessage RemMemberMessage ( DWORD dwClGUID, DWORD dwClF7B0Sequence, DWORD dwMemberGUID );
  78. cMessage DisMemberMessage ( DWORD dwClGUID, DWORD dwClF7B0Sequence, DWORD dwMemberGUID );
  79. void DistributeXP ( DWORD dwMemberGUID, cLocation memberLoc, DWORD dwExperience );
  80. void CalcShareXP ( );
  81. void CalcProportionXP ( int numFellows, int levelDiff, int minLevel );
  82. void CalcNonProportionXP ( int numFellows );
  83. float CalcFellowFactor ( int numFellows );
  84. float CalcDistanceFactor ( cLocation earnMemLoc, cLocation recvMemLoc );
  85. MemberList members;
  86. protected:
  87. DWORD m_ID;
  88. std::string m_Name;
  89. DWORD m_LeaderGUID;
  90. int m_Size;
  91. ULONG m_CreationTime;
  92. bool m_IsOpen; // opened/closed fellowship (allows all members to recruit) (0 = no; 1 = yes)
  93. bool m_ShareLoot; // share loot among fellows (0 = no; 1 = yes)
  94. bool m_ShareXP; // share experience among fellows (0 = no; 1 = yes)
  95. bool m_ProportionXP; // proportion shared experience (according to level) (0 = no; 1 = yes)
  96. };
  97. #endif // #ifndef __FELLOWSHIPS_H