lleconomy.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /**
  2. * @file lleconomy.h
  3. *
  4. * $LicenseInfo:firstyear=2002&license=viewergpl$
  5. *
  6. * Copyright (c) 2002-2009, Linden Research, Inc.
  7. *
  8. * Second Life Viewer Source Code
  9. * The source code in this file ("Source Code") is provided by Linden Lab
  10. * to you under the terms of the GNU General Public License, version 2.0
  11. * ("GPL"), unless you have obtained a separate licensing agreement
  12. * ("Other License"), formally executed by you and Linden Lab. Terms of
  13. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  14. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  15. *
  16. * There are special exceptions to the terms and conditions of the GPL as
  17. * it is applied to this Source Code. View the full text of the exception
  18. * in the file doc/FLOSS-exception.txt in this software distribution, or
  19. * online at
  20. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  21. *
  22. * By copying, modifying or distributing this software, you acknowledge
  23. * that you have read and understood your obligations described above,
  24. * and agree to abide by those obligations.
  25. *
  26. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  27. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  28. * COMPLETENESS OR PERFORMANCE.
  29. * $/LicenseInfo$
  30. */
  31. #ifndef LL_LLECONOMY_H
  32. #define LL_LLECONOMY_H
  33. #include "llsingleton.h"
  34. class LLSD;
  35. class LLMessageSystem;
  36. class LLVector3;
  37. // These are the defaults for SL
  38. constexpr S32 DEFAULT_UPLOAD_COST = 10;
  39. constexpr S32 DEFAULT_GROUP_COST = 100;
  40. constexpr S32 DEFAULT_MAX_PICKS = 10;
  41. class LLEconomy final : public LLSingleton<LLEconomy>
  42. {
  43. friend class LLSingleton<LLEconomy>;
  44. protected:
  45. LOG_CLASS(LLEconomy);
  46. public:
  47. LLEconomy();
  48. void setDefaultCosts(bool in_sl);
  49. void processEconomyData(LLMessageSystem* msg);
  50. void setBenefits(const LLSD& data, const std::string& account_type);
  51. LL_INLINE S32 getPriceUpload() const { return mPriceUpload; }
  52. LL_INLINE S32 getAnimationUploadCost() const { return mAnimationUploadCost; }
  53. LL_INLINE S32 getSoundUploadCost() const { return mSoundUploadCost; }
  54. LL_INLINE S32 getCreateGroupCost() const { return mCreateGroupCost; }
  55. LL_INLINE S32 getAttachmentLimit() const { return mAttachmentLimit; }
  56. LL_INLINE S32 getAnimatedObjectLimit() const { return mAnimatedObjectLimit; }
  57. LL_INLINE S32 getGroupMembershipLimit() const { return mGroupMembershipLimit; }
  58. // A texture upload cost depends on its size, now...
  59. LL_INLINE S32 getTextureUploadCost() const { return mTextureUploadCost; }
  60. LL_INLINE S32 get2KTextureUploadCost() const { return m2KTextureUploadCost; }
  61. S32 getTextureUploadCost(S32 tex_area) const;
  62. S32 getTextureUploadCost(S32 x_size, S32 y_size) const;
  63. LL_INLINE S32 getPicksLimit() const
  64. {
  65. return mPicksLimit > -1 ? mPicksLimit : DEFAULT_MAX_PICKS;
  66. }
  67. const LLSD& getBenefit(const std::string& key) const;
  68. private:
  69. std::string mAccountType;
  70. LLSD mBenefits;
  71. // Note: mPriceUpload is now llmax(mAnimationUploadCost, mSoundUploadCost,
  72. // mTextureUploadCost) when benefits are implemented in the grid (when not
  73. // all four costs are equal).
  74. S32 mPriceUpload;
  75. S32 mAnimationUploadCost;
  76. S32 mSoundUploadCost;
  77. S32 mTextureUploadCost;
  78. S32 m2KTextureUploadCost;
  79. S32 mCreateGroupCost;
  80. S32 mAttachmentLimit;
  81. S32 mAnimatedObjectLimit;
  82. S32 mGroupMembershipLimit;
  83. S32 mPicksLimit;
  84. bool mGotBenefits;
  85. };
  86. #endif