- Main Page
- Classes
- Files

- File List
- File Members

# E:/uas2/Server/Fellowship.h

Go to the documentation of this file.

    00001 /*
    00002 * This file is part of UAS2.
    00003 *
    00004 * UAS2 is free software; you can redistribute it and/or modify
    00005 * it under the terms of the GNU General Public License as published by
    00006 * the Free Software Foundation; either version 2 of the License, or
    00007 * (at your option) any later version.
    00008 *
    00009 * UAS2 is distributed in the hope that it will be useful,
    00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012 * GNU General Public License for more details.
    00013
    00014 * You should have received a copy of the GNU General Public License
    00015 * along with UASv1; if not, write to the Free Software
    00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    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;              // Level
    00037         DWORD           m_dwHealthTot;  // maximum Health
    00038         DWORD           m_dwStaminaTot; // maximum Stamina
    00039         DWORD           m_dwManaTot;    // maximum Mana
    00040         DWORD           m_dwHealthCur;  // current Health
    00041         DWORD           m_dwStaminaCur; // current Stamina
    00042         DWORD           m_dwManaCur;    // current Mana
    00043         bool            m_bShareLoot;   // share loot - 0x00 = no, 0x10 = yes
    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;                       // opened/closed fellowship (allows all members to recruit) (0 = no; 1 = yes)
    00114                 bool            m_ShareLoot;            // share loot among fellows (0 = no; 1 = yes)
    00115                 bool            m_ShareXP;                      // share experience among fellows (0 = no; 1 = yes)
    00116                 bool            m_ProportionXP;         // proportion shared experience (according to level) (0 = no; 1 = yes)
    00117 };
    00118
    00119 #endif  // #ifndef __FELLOWSHIPS_H