00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00023 #ifndef __FELLOWSHIPS_H
00024 #define __FELLOWSHIPS_H
00025
00026 #pragma warning(disable:4786) //warning: identifier was truncated to '255' characters in the browser information
00027 #include <map>
00028
00029 #include "Avatar.h"
00030 #include "Shared.h"
00031
00032 struct FellowMem
00033 {
00034 DWORD m_dwGUID;
00035 WORD m_wUnk1;
00036 DWORD m_dwLevel;
00037 DWORD m_dwHealthTot;
00038 DWORD m_dwStaminaTot;
00039 DWORD m_dwManaTot;
00040 DWORD m_dwHealthCur;
00041 DWORD m_dwStaminaCur;
00042 DWORD m_dwManaCur;
00043 bool m_bShareLoot;
00044 std::string m_szName;
00045
00046 float m_fShareOfXP;
00047 ULONG m_timeJoin;
00048 };
00049
00050 class cFellowship
00051 {
00052 friend class cAvatar;
00053 friend class cMasterServer;
00054
00055 public:
00056 cFellowship();
00057 ~cFellowship();
00058
00059 static DWORD NewFellowship ( DWORD dwLeaderGUID, std::string name, char felName[50], bool shareXP, bool shareLoot );
00060
00061 DWORD CreateFellowship ( DWORD dwLeaderGUID, std::string name, char felName[50], bool shareXP, bool shareLoot );
00062 void Disband ( );
00063 void ClearMembers ( );
00064
00065 static cFellowship* GetFellowshipByID ( DWORD dwFellowshipID );
00066 DWORD GetID() { return m_ID; }
00067 DWORD GetLeader() { return m_LeaderGUID; }
00068 DWORD GetSize() { return m_Size; }
00069 std::string GetName() { return m_Name.c_str(); }
00070 ULONG GetCreationTime() { return m_CreationTime; }
00071 bool GetIsOpen() { return m_IsOpen; }
00072
00073 typedef std::map<DWORD, FellowMem> MemberList;
00074
00075 FellowMem* FindMember ( DWORD dwMemberGUID ) { return &this->members.find(dwMemberGUID)->second; }
00076
00077 bool SetLeader ( DWORD dwNewLeaderGUID );
00078 bool SetOpenClose ( DWORD dwIsOpen );
00079 bool AddMember ( DWORD dwAvatarGUID );
00080 bool RemMember ( DWORD dwMemberGUID );
00081 bool DismissMember ( DWORD dwMemberGUID );
00082 bool MemberDeath ( DWORD dwMemberGUID );
00083
00084 bool InsertMember ( DWORD dwMemberGUID );
00085 bool DeleteMember ( DWORD dwMemberGUID, bool wasDismissed=false );
00086 bool UpdateMember ( DWORD dwMemberGUID );
00087
00088 void RelayMemberUpdate ( DWORD dwMemberGUID );
00089 void RelayMemberDelete ( DWORD dwMemberGUID );
00090 void RelayMemberDismiss ( DWORD dwMemberGUID );
00091
00092 cMessage JoinMessage ( DWORD dwClGUID, DWORD dwClF7B0Sequence );
00093 cMessage DisbandMessage ( DWORD dwClGUID, DWORD dwClF7B0Sequence );
00094 cMessage UpdMemberMessage ( DWORD dwClGUID, DWORD dwClF7B0Sequence, DWORD dwMemberGUID );
00095 cMessage RemMemberMessage ( DWORD dwClGUID, DWORD dwClF7B0Sequence, DWORD dwMemberGUID );
00096 cMessage DisMemberMessage ( DWORD dwClGUID, DWORD dwClF7B0Sequence, DWORD dwMemberGUID );
00097
00098 void DistributeXP ( DWORD dwMemberGUID, cLocation memberLoc, DWORD dwExperience );
00099 void CalcShareXP ( );
00100 void CalcProportionXP ( int numFellows, int levelDiff, int minLevel );
00101 void CalcNonProportionXP ( int numFellows );
00102 float CalcFellowFactor ( int numFellows );
00103 float CalcDistanceFactor ( cLocation earnMemLoc, cLocation recvMemLoc );
00104
00105 MemberList members;
00106
00107 protected:
00108 DWORD m_ID;
00109 std::string m_Name;
00110 DWORD m_LeaderGUID;
00111 int m_Size;
00112 ULONG m_CreationTime;
00113 bool m_IsOpen;
00114 bool m_ShareLoot;
00115 bool m_ShareXP;
00116 bool m_ProportionXP;
00117 };
00118
00119 #endif // #ifndef __FELLOWSHIPS_H