Advertisement
Guest User

party.h

a guest
Jun 10th, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.03 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////////////////
  2. // OpenTibia - an opensource roleplaying game
  3. ////////////////////////////////////////////////////////////////////////
  4. // This program 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 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program 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. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16. ////////////////////////////////////////////////////////////////////////
  17.  
  18. #ifndef __PARTY__
  19. #define __PARTY__
  20. #include "player.h"
  21.  
  22. typedef std::vector<Player*> PlayerVector;
  23.  
  24. class Player;
  25. class Party;
  26.  
  27. class Party
  28. {
  29.     public:
  30.         Party(Player* _leader);
  31.         virtual ~Party() {}
  32.  
  33.         Player* getLeader() const {return leader;}
  34.         void setLeader(Player* _leader) {leader = _leader;}
  35.         PlayerVector getMembers() {return memberList;}
  36.  
  37.         bool passLeadership(Player* player);
  38.         void disband();
  39.         bool canDisband() {return memberList.empty() && inviteList.empty();}
  40.  
  41.         bool invitePlayer(Player* player);
  42.         void revokeInvitation(Player* player);
  43.         bool removeInvite(Player* player);
  44.         bool join(Player* player);
  45.         bool leave(Player* player);
  46.  
  47.         void updateAllIcons();
  48.         void updateIcons(Player* player);
  49.         void broadcastMessage(MessageClasses messageClass, const std::string& text, bool sendToInvitations = false);
  50.  
  51.         void shareExperience(double experience, bool fromMonster, bool multiplied);
  52.         bool setSharedExperience(Player* player, bool _sharedExpActive);
  53.         bool isSharedExperienceActive() const {return sharedExpActive;}
  54.         bool isSharedExperienceEnabled() const {return sharedExpEnabled;}
  55.         bool canUseSharedExperience(const Player* player, uint32_t highestLevel = 0) const;
  56.         void updateSharedExperience();
  57.  
  58.         void addPlayerHealedMember(Player* player, uint32_t points);
  59.         void addPlayerDamageMonster(Player* player, uint32_t points);
  60.         void clearPlayerPoints(Player* player);
  61.  
  62.         bool isPlayerMember(const Player* player, bool result = false) const;
  63.         bool isPlayerInvited(const Player* player, bool result = false) const;
  64.         bool canOpenCorpse(uint32_t ownerId);
  65.  
  66.     protected:
  67.         bool canEnableSharedExperience();
  68.  
  69.         PlayerVector memberList;
  70.         PlayerVector inviteList;
  71.  
  72.         Player* leader;
  73.         bool sharedExpActive, sharedExpEnabled;
  74.  
  75.         struct CountBlock_t
  76.         {
  77.             int32_t totalHeal, totalDamage;
  78.             int64_t ticks;
  79.  
  80.             CountBlock_t(int32_t heal, int32_t damage)
  81.             {
  82.                 ticks = OTSYS_TIME();
  83.                 totalDamage = damage;
  84.                 totalHeal = heal;
  85.             }
  86.  
  87.             CountBlock_t() {ticks = totalHeal = totalDamage = 0;}
  88.         };
  89.         typedef std::map<uint32_t, CountBlock_t> CountMap;
  90.         CountMap pointMap;
  91. };
  92. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement