diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index 8fa21bd7e..786e1bbd2 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -244,7 +244,6 @@ const U8 SIM_ACCESS_DOWN = 254; const U8 SIM_ACCESS_MAX = SIM_ACCESS_ADULT; // attachment constants -const U32 MAX_AGENT_ATTACHMENTS = 38; const U8 ATTACHMENT_ADD = 0x80; // god levels diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt index e9586d500..71909dc09 100644 --- a/indra/llinventory/CMakeLists.txt +++ b/indra/llinventory/CMakeLists.txt @@ -17,7 +17,6 @@ include_directories( set(llinventory_SOURCE_FILES llcategory.cpp - lleconomy.cpp llfoldertype.cpp llinventory.cpp llinventorydefines.cpp @@ -40,7 +39,6 @@ set(llinventory_HEADER_FILES CMakeLists.txt llcategory.h - lleconomy.h llfoldertype.h llinventory.h llinventorydefines.h diff --git a/indra/llinventory/lleconomy.cpp b/indra/llinventory/lleconomy.cpp deleted file mode 100644 index e10402196..000000000 --- a/indra/llinventory/lleconomy.cpp +++ /dev/null @@ -1,288 +0,0 @@ -/** - * @file lleconomy.cpp - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "lleconomy.h" -#include "llerror.h" -#include "message.h" -#include "v3math.h" - - -LLGlobalEconomy::LLGlobalEconomy() -: mObjectCount( -1 ), - mObjectCapacity( -1 ), - mPriceObjectClaim( -1 ), - mPricePublicObjectDecay( -1 ), - mPricePublicObjectDelete( -1 ), - mPriceEnergyUnit( -1 ), - mPriceUpload( -1 ), - mPriceRentLight( -1 ), - mTeleportMinPrice( -1 ), - mTeleportPriceExponent( -1 ), - mPriceGroupCreate( -1 ) -{ } - -LLGlobalEconomy::~LLGlobalEconomy() -{ } - -void LLGlobalEconomy::addObserver(LLEconomyObserver* observer) -{ - mObservers.push_back(observer); -} - -void LLGlobalEconomy::removeObserver(LLEconomyObserver* observer) -{ - std::list::iterator it = - std::find(mObservers.begin(), mObservers.end(), observer); - if (it != mObservers.end()) - { - mObservers.erase(it); - } -} - -void LLGlobalEconomy::notifyObservers() -{ - for (std::list::iterator it = mObservers.begin(); - it != mObservers.end(); - ++it) - { - (*it)->onEconomyDataChange(); - } -} - -// static -void LLGlobalEconomy::processEconomyData(LLMessageSystem *msg, LLGlobalEconomy* econ_data) -{ - S32 i; - F32 f; - - msg->getS32Fast(_PREHASH_Info, _PREHASH_ObjectCapacity, i); - econ_data->setObjectCapacity(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_ObjectCount, i); - econ_data->setObjectCount(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceEnergyUnit, i); - econ_data->setPriceEnergyUnit(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceObjectClaim, i); - econ_data->setPriceObjectClaim(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PricePublicObjectDecay, i); - econ_data->setPricePublicObjectDecay(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PricePublicObjectDelete, i); - econ_data->setPricePublicObjectDelete(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceUpload, i); - econ_data->setPriceUpload(i); -#if LL_LINUX - // We can optionally fake the received upload price for testing. - // Note that the server is within its rights to not obey our fake - // price. :) - const char* fakeprice_str = getenv("LL_FAKE_UPLOAD_PRICE"); - if (fakeprice_str) - { - S32 fakeprice = (S32)atoi(fakeprice_str); - LL_WARNS() << "LL_FAKE_UPLOAD_PRICE: Faking upload price as L$" << fakeprice << LL_ENDL; - econ_data->setPriceUpload(fakeprice); - } -#endif - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceRentLight, i); - econ_data->setPriceRentLight(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_TeleportMinPrice, i); - econ_data->setTeleportMinPrice(i); - msg->getF32Fast(_PREHASH_Info, _PREHASH_TeleportPriceExponent, f); - econ_data->setTeleportPriceExponent(f); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceGroupCreate, i); - econ_data->setPriceGroupCreate(i); - - econ_data->notifyObservers(); -} - -S32 LLGlobalEconomy::calculateTeleportCost(F32 distance) const -{ - S32 min_cost = getTeleportMinPrice(); - F32 exponent = getTeleportPriceExponent(); - F32 divisor = 100.f * pow(3.f, exponent); - S32 cost = (U32)(distance * pow(log10(distance), exponent) / divisor); - if (cost < 0) - { - cost = 0; - } - else if (cost < min_cost) - { - cost = min_cost; - } - - return cost; -} - -S32 LLGlobalEconomy::calculateLightRent(const LLVector3& object_size) const -{ - F32 intensity_mod = llmax(object_size.magVec(), 1.f); - return (S32)(intensity_mod * getPriceRentLight()); -} - -void LLGlobalEconomy::print() -{ - LL_INFOS() << "Global Economy Settings: " << LL_ENDL; - LL_INFOS() << "Object Capacity: " << mObjectCapacity << LL_ENDL; - LL_INFOS() << "Object Count: " << mObjectCount << LL_ENDL; - LL_INFOS() << "Claim Price Per Object: " << mPriceObjectClaim << LL_ENDL; - LL_INFOS() << "Claim Price Per Public Object: " << mPricePublicObjectDecay << LL_ENDL; - LL_INFOS() << "Delete Price Per Public Object: " << mPricePublicObjectDelete << LL_ENDL; - LL_INFOS() << "Release Price Per Public Object: " << getPricePublicObjectRelease() << LL_ENDL; - LL_INFOS() << "Price Per Energy Unit: " << mPriceEnergyUnit << LL_ENDL; - LL_INFOS() << "Price Per Upload: " << mPriceUpload << LL_ENDL; - LL_INFOS() << "Light Base Price: " << mPriceRentLight << LL_ENDL; - LL_INFOS() << "Teleport Min Price: " << mTeleportMinPrice << LL_ENDL; - LL_INFOS() << "Teleport Price Exponent: " << mTeleportPriceExponent << LL_ENDL; - LL_INFOS() << "Price for group creation: " << mPriceGroupCreate << LL_ENDL; -} - -LLRegionEconomy::LLRegionEconomy() -: LLGlobalEconomy(), - mPriceObjectRent( -1.f ), - mPriceObjectScaleFactor( -1.f ), - mEnergyEfficiency( -1.f ), - mBasePriceParcelClaimDefault(-1), - mBasePriceParcelClaimActual(-1), - mPriceParcelClaimFactor(-1.f), - mBasePriceParcelRent(-1), - mAreaOwned(-1.f), - mAreaTotal(-1.f) -{ } - -LLRegionEconomy::~LLRegionEconomy() -{ } - -BOOL LLRegionEconomy::hasData() const -{ - return (mBasePriceParcelRent != -1); -} - -// static -void LLRegionEconomy::processEconomyData(LLMessageSystem *msg, void** user_data) -{ - S32 i; - F32 f; - - LLRegionEconomy *this_ptr = (LLRegionEconomy*)user_data; - - LLGlobalEconomy::processEconomyData(msg, this_ptr); - - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceParcelClaim, i); - this_ptr->setBasePriceParcelClaimDefault(i); - msg->getF32(_PREHASH_Info, _PREHASH_PriceParcelClaimFactor, f); - this_ptr->setPriceParcelClaimFactor(f); - msg->getF32Fast(_PREHASH_Info, _PREHASH_EnergyEfficiency, f); - this_ptr->setEnergyEfficiency(f); - msg->getF32Fast(_PREHASH_Info, _PREHASH_PriceObjectRent, f); - this_ptr->setPriceObjectRent(f); - msg->getF32Fast(_PREHASH_Info, _PREHASH_PriceObjectScaleFactor, f); - this_ptr->setPriceObjectScaleFactor(f); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceParcelRent, i); - this_ptr->setBasePriceParcelRent(i); -} - -// static -void LLRegionEconomy::processEconomyDataRequest(LLMessageSystem *msg, void **user_data) -{ - LLRegionEconomy *this_ptr = (LLRegionEconomy*)user_data; - if (!this_ptr->hasData()) - { - LL_WARNS() << "Dropping EconomyDataRequest, because EconomyData message " - << "has not been processed" << LL_ENDL; - } - - msg->newMessageFast(_PREHASH_EconomyData); - msg->nextBlockFast(_PREHASH_Info); - msg->addS32Fast(_PREHASH_ObjectCapacity, this_ptr->getObjectCapacity()); - msg->addS32Fast(_PREHASH_ObjectCount, this_ptr->getObjectCount()); - msg->addS32Fast(_PREHASH_PriceEnergyUnit, this_ptr->getPriceEnergyUnit()); - msg->addS32Fast(_PREHASH_PriceObjectClaim, this_ptr->getPriceObjectClaim()); - msg->addS32Fast(_PREHASH_PricePublicObjectDecay, this_ptr->getPricePublicObjectDecay()); - msg->addS32Fast(_PREHASH_PricePublicObjectDelete, this_ptr->getPricePublicObjectDelete()); - msg->addS32Fast(_PREHASH_PriceParcelClaim, this_ptr->mBasePriceParcelClaimActual); - msg->addF32Fast(_PREHASH_PriceParcelClaimFactor, this_ptr->mPriceParcelClaimFactor); - msg->addS32Fast(_PREHASH_PriceUpload, this_ptr->getPriceUpload()); - msg->addS32Fast(_PREHASH_PriceRentLight, this_ptr->getPriceRentLight()); - msg->addS32Fast(_PREHASH_TeleportMinPrice, this_ptr->getTeleportMinPrice()); - msg->addF32Fast(_PREHASH_TeleportPriceExponent, this_ptr->getTeleportPriceExponent()); - - msg->addF32Fast(_PREHASH_EnergyEfficiency, this_ptr->getEnergyEfficiency()); - msg->addF32Fast(_PREHASH_PriceObjectRent, this_ptr->getPriceObjectRent()); - msg->addF32Fast(_PREHASH_PriceObjectScaleFactor, this_ptr->getPriceObjectScaleFactor()); - msg->addS32Fast(_PREHASH_PriceParcelRent, this_ptr->getPriceParcelRent()); - msg->addS32Fast(_PREHASH_PriceGroupCreate, this_ptr->getPriceGroupCreate()); - - msg->sendReliable(msg->getSender()); -} - - -S32 LLRegionEconomy::getPriceParcelClaim() const -{ - //return (S32)((F32)mBasePriceParcelClaim * (mAreaTotal / (mAreaTotal - mAreaOwned))); - return (S32)((F32)mBasePriceParcelClaimActual * mPriceParcelClaimFactor); -} - -S32 LLRegionEconomy::getPriceParcelRent() const -{ - return mBasePriceParcelRent; -} - - -void LLRegionEconomy::print() -{ - this->LLGlobalEconomy::print(); - - LL_INFOS() << "Region Economy Settings: " << LL_ENDL; - LL_INFOS() << "Land (square meters): " << mAreaTotal << LL_ENDL; - LL_INFOS() << "Owned Land (square meters): " << mAreaOwned << LL_ENDL; - LL_INFOS() << "Daily Object Rent: " << mPriceObjectRent << LL_ENDL; - LL_INFOS() << "Daily Land Rent (per meter): " << getPriceParcelRent() << LL_ENDL; - LL_INFOS() << "Energey Efficiency: " << mEnergyEfficiency << LL_ENDL; -} - - -void LLRegionEconomy::setBasePriceParcelClaimDefault(S32 val) -{ - mBasePriceParcelClaimDefault = val; - if(mBasePriceParcelClaimActual == -1) - { - mBasePriceParcelClaimActual = val; - } -} - -void LLRegionEconomy::setBasePriceParcelClaimActual(S32 val) -{ - mBasePriceParcelClaimActual = val; -} - -void LLRegionEconomy::setPriceParcelClaimFactor(F32 val) -{ - mPriceParcelClaimFactor = val; -} - -void LLRegionEconomy::setBasePriceParcelRent(S32 val) -{ - mBasePriceParcelRent = val; -} diff --git a/indra/llinventory/lleconomy.h b/indra/llinventory/lleconomy.h deleted file mode 100644 index eb2ecf71b..000000000 --- a/indra/llinventory/lleconomy.h +++ /dev/null @@ -1,159 +0,0 @@ -/** - * @file lleconomy.h - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLECONOMY_H -#define LL_LLECONOMY_H - -#include "llsingleton.h" - -class LLMessageSystem; -class LLVector3; - -/** - * Register an observer to be notified of economy data updates coming from server. - */ -class LLEconomyObserver -{ -public: - virtual ~LLEconomyObserver() {} - virtual void onEconomyDataChange() = 0; -}; - -class LLGlobalEconomy -{ -public: - LLGlobalEconomy(); - virtual ~LLGlobalEconomy(); - - // This class defines its singleton internally as a typedef instead of inheriting from - // LLSingleton like most others because the LLRegionEconomy sub-class might also - // become a singleton and this pattern will more easily disambiguate them. - typedef LLSingleton Singleton; - - void initSingleton() { } - - virtual void print(); - - void addObserver(LLEconomyObserver* observer); - void removeObserver(LLEconomyObserver* observer); - void notifyObservers(); - - static void processEconomyData(LLMessageSystem *msg, LLGlobalEconomy* econ_data); - - S32 calculateTeleportCost(F32 distance) const; - S32 calculateLightRent(const LLVector3& object_size) const; - - S32 getObjectCount() const { return mObjectCount; } - S32 getObjectCapacity() const { return mObjectCapacity; } - S32 getPriceObjectClaim() const { return mPriceObjectClaim; } - S32 getPricePublicObjectDecay() const { return mPricePublicObjectDecay; } - S32 getPricePublicObjectDelete() const { return mPricePublicObjectDelete; } - S32 getPricePublicObjectRelease() const { return mPriceObjectClaim - mPricePublicObjectDelete; } - S32 getPriceEnergyUnit() const { return mPriceEnergyUnit; } - S32 getPriceUpload() const { return mPriceUpload; } - S32 getPriceRentLight() const { return mPriceRentLight; } - S32 getTeleportMinPrice() const { return mTeleportMinPrice; } - F32 getTeleportPriceExponent() const { return mTeleportPriceExponent; } - S32 getPriceGroupCreate() const { return mPriceGroupCreate; } - - - void setObjectCount(S32 val) { mObjectCount = val; } - void setObjectCapacity(S32 val) { mObjectCapacity = val; } - void setPriceObjectClaim(S32 val) { mPriceObjectClaim = val; } - void setPricePublicObjectDecay(S32 val) { mPricePublicObjectDecay = val; } - void setPricePublicObjectDelete(S32 val) { mPricePublicObjectDelete = val; } - void setPriceEnergyUnit(S32 val) { mPriceEnergyUnit = val; } - void setPriceUpload(S32 val) { mPriceUpload = val; } - void setPriceRentLight(S32 val) { mPriceRentLight = val; } - void setTeleportMinPrice(S32 val) { mTeleportMinPrice = val; } - void setTeleportPriceExponent(F32 val) { mTeleportPriceExponent = val; } - void setPriceGroupCreate(S32 val) { mPriceGroupCreate = val; } - -private: - S32 mObjectCount; - S32 mObjectCapacity; - S32 mPriceObjectClaim; // per primitive - S32 mPricePublicObjectDecay; // per primitive - S32 mPricePublicObjectDelete; // per primitive - S32 mPriceEnergyUnit; - S32 mPriceUpload; - S32 mPriceRentLight; - S32 mTeleportMinPrice; - F32 mTeleportPriceExponent; - S32 mPriceGroupCreate; - - std::list mObservers; -}; - - -class LLRegionEconomy : public LLGlobalEconomy -{ -public: - LLRegionEconomy(); - ~LLRegionEconomy(); - - static void processEconomyData(LLMessageSystem *msg, void **user_data); - static void processEconomyDataRequest(LLMessageSystem *msg, void **user_data); - - void print(); - - BOOL hasData() const; - F32 getPriceObjectRent() const { return mPriceObjectRent; } - F32 getPriceObjectScaleFactor() const {return mPriceObjectScaleFactor;} - F32 getEnergyEfficiency() const { return mEnergyEfficiency; } - S32 getPriceParcelClaim() const; - S32 getPriceParcelRent() const; - F32 getAreaOwned() const { return mAreaOwned; } - F32 getAreaTotal() const { return mAreaTotal; } - S32 getBasePriceParcelClaimActual() const { return mBasePriceParcelClaimActual; } - - void setPriceObjectRent(F32 val) { mPriceObjectRent = val; } - void setPriceObjectScaleFactor(F32 val) { mPriceObjectScaleFactor = val; } - void setEnergyEfficiency(F32 val) { mEnergyEfficiency = val; } - - void setBasePriceParcelClaimDefault(S32 val); - void setBasePriceParcelClaimActual(S32 val); - void setPriceParcelClaimFactor(F32 val); - void setBasePriceParcelRent(S32 val); - - void setAreaOwned(F32 val) { mAreaOwned = val; } - void setAreaTotal(F32 val) { mAreaTotal = val; } - -private: - F32 mPriceObjectRent; - F32 mPriceObjectScaleFactor; - F32 mEnergyEfficiency; - - S32 mBasePriceParcelClaimDefault; - S32 mBasePriceParcelClaimActual; - F32 mPriceParcelClaimFactor; - S32 mBasePriceParcelRent; - - F32 mAreaOwned; - F32 mAreaTotal; - -}; - -#endif diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index d0ed1d211..0d25be520 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -120,6 +120,7 @@ set(viewer_SOURCE_FILES llaisapi.cpp llagent.cpp llagentaccess.cpp + llagentbenefits.cpp llagentcamera.cpp llagentdata.cpp llagentlanguage.cpp @@ -666,6 +667,7 @@ set(viewer_HEADER_FILES llaisapi.h llagent.h llagentaccess.h + llagentbenefits.h llagentcamera.h llagentdata.h llagentlanguage.h diff --git a/indra/newview/hippogridmanager.cpp b/indra/newview/hippogridmanager.cpp index bf82c7fde..f6cff71b9 100644 --- a/indra/newview/hippogridmanager.cpp +++ b/indra/newview/hippogridmanager.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include #include @@ -59,7 +58,6 @@ HippoGridInfo::HippoGridInfo(const std::string& gridName) : mRenderCompat(true), mAutoUpdate(false), mLocked(false), - mMaxAgentGroups(-1), mCurrencySymbol("OS$"), mCurrencyText("OS Dollars"), mRealCurrencySymbol("US$"), @@ -414,37 +412,22 @@ void HippoGridInfo::getGridInfo() XML_ParserFree(parser); } -std::string HippoGridInfo::getUploadFee() const -{ - std::string fee; - formatFee(fee, LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(), true); - return fee; -} - -std::string HippoGridInfo::getGroupCreationFee() const -{ - std::string fee; - formatFee(fee, LLGlobalEconomy::Singleton::getInstance()->getPriceGroupCreate(), false); - return fee; -} - std::string HippoGridInfo::getDirectoryFee() const { - std::string fee; - formatFee(fee, mDirectoryFee, true); + std::string fee = formatFee(mDirectoryFee, true); if (mDirectoryFee != 0) fee += "/" + LLTrans::getString("hippo_label_week"); return fee; } -void HippoGridInfo::formatFee(std::string &fee, int cost, bool showFree) const +std::string HippoGridInfo::formatFee(int cost, bool showFree) const { - if (showFree && (cost == 0)) + if (showFree && (cost < 0)) { - fee = LLTrans::getString("hippo_label_free"); + return LLTrans::getString("hippo_label_free"); } else { - fee = llformat("%s%d", getCurrencySymbol().c_str(), cost); + return llformat("%s%d", getCurrencySymbol().c_str(), cost); } } diff --git a/indra/newview/hippogridmanager.h b/indra/newview/hippogridmanager.h index 8d2ae9650..f7bbdfe87 100644 --- a/indra/newview/hippogridmanager.h +++ b/indra/newview/hippogridmanager.h @@ -56,15 +56,13 @@ public: const std::string& getVoiceConnector() const { return mVoiceConnector; } bool isRenderCompat() const { return mRenderCompat; } std::string getGridNick() const; - int getMaxAgentGroups() const { return mMaxAgentGroups; } const std::string& getCurrencySymbol() const { return mCurrencySymbol; } const std::string& getCurrencyText() const { return mCurrencyText; } const std::string& getRealCurrencySymbol() const { return mRealCurrencySymbol; } - std::string getUploadFee() const; - std::string getGroupCreationFee() const; const int& getClassifiedFee() const { return mClassifiedFee; } std::string getDirectoryFee() const; + std::string formatFee(S32 cost, bool showFree = true) const; void setPlatform (const std::string& platform); void setPlatform (Platform platform); @@ -82,7 +80,6 @@ public: void setSearchUrl(const std::string& url); void setGridMessage(const std::string& message); void setRenderCompat(bool compat); - void setMaxAgentGroups(int max) { mMaxAgentGroups = max; } void setVoiceConnector(const std::string& vc) { mVoiceConnector = vc; } void setUPCSupported(bool on); bool getUPCSupported(); @@ -123,7 +120,6 @@ private: bool mAutoUpdate; bool mLocked; bool mUPCSupported; - int mMaxAgentGroups; std::string mCurrencySymbol; std::string mCurrencyText; @@ -143,7 +139,6 @@ private: static std::string sanitizeUri(std::string const& uri_in); void useHttps(void); - void formatFee(std::string &fee, int cost, bool showFree) const; static void onXmlElementStart(void* userData, const XML_Char* name, const XML_Char** atts); static void onXmlElementEnd(void* userData, const XML_Char* name); diff --git a/indra/newview/hippolimits.cpp b/indra/newview/hippolimits.cpp index 439af0157..346e72267 100644 --- a/indra/newview/hippolimits.cpp +++ b/indra/newview/hippolimits.cpp @@ -28,29 +28,8 @@ void HippoLimits::setLimits() } } -namespace -{ -// gMaxAgentGroups is now sent by login.cgi, which -// looks it up from globals.xml. -// -// For now we need an old default value however, -// so the viewer can be deployed ahead of login.cgi. -// -constexpr S32 DEFAULT_MAX_AGENT_GROUPS = 60; -} - -void HippoLimits::setMaxAgentGroups() -{ - //KC: new server defined max groups - if (auto grid = gHippoGridManager->getConnectedGrid()) - mMaxAgentGroups = grid->getMaxAgentGroups(); - if (mMaxAgentGroups <= 0) - mMaxAgentGroups = DEFAULT_MAX_AGENT_GROUPS; -} - void HippoLimits::setOpenSimLimits() { - setMaxAgentGroups(); mMaxPrimScale = 8192.0f; mMaxHeight = 10000.0f; mMinPrimScale = 0.001f; @@ -67,7 +46,6 @@ void HippoLimits::setOpenSimLimits() void HippoLimits::setWhiteCoreLimits() { - setMaxAgentGroups(); mMaxPrimScale = 8192.0f; mMinPrimScale = 0.001f; mMaxHeight = 10000.0f; @@ -78,7 +56,6 @@ void HippoLimits::setWhiteCoreLimits() void HippoLimits::setSecondLifeLimits() { LL_INFOS() << "Using Second Life limits." << LL_ENDL; - setMaxAgentGroups(); mMinPrimScale = 0.01f; mMaxHeight = 4096.0f; diff --git a/indra/newview/hippolimits.h b/indra/newview/hippolimits.h index 6c48fc298..3ddfec165 100644 --- a/indra/newview/hippolimits.h +++ b/indra/newview/hippolimits.h @@ -8,7 +8,6 @@ class HippoLimits public: HippoLimits(); - int getMaxAgentGroups() const { return mMaxAgentGroups; } float getMaxHeight() const { return mMaxHeight; } float getMinHoleSize() const { return mMinHoleSize; } float getMaxHollow() const { return mMaxHollow; } @@ -18,14 +17,12 @@ public: void setLimits(); private: - int mMaxAgentGroups; float mMaxHeight; float mMinHoleSize; float mMaxHollow; float mMaxPrimScale; float mMinPrimScale; - void setMaxAgentGroups(); void setOpenSimLimits(); void setWhiteCoreLimits(); void setSecondLifeLimits(); diff --git a/indra/newview/importtracker.cpp b/indra/newview/importtracker.cpp index 5975948f6..284327d17 100644 --- a/indra/newview/importtracker.cpp +++ b/indra/newview/importtracker.cpp @@ -17,7 +17,7 @@ //#include "llsdserialize.h" #include "lltooldraganddrop.h" //#include "llassetuploadresponders.h" -//#include "lleconomy.h" +//#include "llagentbenefits.h" //#include "llfloaterperms.h" @@ -635,7 +635,7 @@ void ImportTracker::send_inventory(LLSD& prim) body["next_owner_mask"] = LLSD::Integer(U32_MAX); body["group_mask"] = LLSD::Integer(U32_MAX); body["everyone_mask"] = LLSD::Integer(U32_MAX); - body["expected_upload_cost"] = LLSD::Integer(LLGlobalEconomy::Singleton::getInstance()->getPriceUpload()); + body["expected_upload_cost"] = LLAgentBenefits::current().getTextureUploadCost(); //cmdline_printchat("posting "+ data->assetid.asString()); LLHTTPClient::post(url, body, new JCImportInventoryResponder(body, data->assetid, data->type,data)); //error = TRUE; diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 171205a2c..ac8b94b9f 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -31,6 +31,7 @@ #include "pipeline.h" #include "llagentaccess.h" +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llagentwearables.h" #include "llagentui.h" @@ -3160,7 +3161,7 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO BOOL LLAgent::canJoinGroups() const { - return (S32)mGroups.size() < gHippoLimits->getMaxAgentGroups(); + return (S32)mGroups.size() < LLAgentBenefitsMgr::current().getGroupMembershipLimit(); } LLQuaternion LLAgent::getHeadRotation() diff --git a/indra/newview/llagentbenefits.cpp b/indra/newview/llagentbenefits.cpp new file mode 100644 index 000000000..7a92dff35 --- /dev/null +++ b/indra/newview/llagentbenefits.cpp @@ -0,0 +1,260 @@ +/** +* @file llagentbenefits.cpp +* +* $LicenseInfo:firstyear=2019&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2019, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" +#include "llagentbenefits.h" + +LLAgentBenefits::LLAgentBenefits(): + m_initalized(false), + m_animated_object_limit(-1), + m_animation_upload_cost(-1), + m_attachment_limit(-1), + m_group_membership_limit(-1), + m_picks_limit(-1), + m_sound_upload_cost(-1), + m_texture_upload_cost(-1) +{ +} + +LLAgentBenefits::~LLAgentBenefits() +{ +} + +// This could be extended to a template scheme or otherwise modified +// to support other types, if and when needed. Currently all fields +// the viewer cares about are integer. +bool get_required_S32(const LLSD& sd, const LLSD::String& key, S32& value) +{ + value = -1; + if (sd.has(key)) + { + value = sd[key].asInteger(); + return true; + } + + LL_WARNS("Benefits") << "Missing required benefit field " << key << LL_ENDL; + return false; +} + +bool LLAgentBenefits::init(const LLSD& benefits_sd) +{ + LL_DEBUGS("Benefits") << "initializing benefits from " << benefits_sd << LL_ENDL; + + if (!get_required_S32(benefits_sd, "animated_object_limit", m_animated_object_limit)) + { + return false; + } + if (!get_required_S32(benefits_sd, "animation_upload_cost", m_animation_upload_cost)) + { + return false; + } + if (!get_required_S32(benefits_sd, "attachment_limit", m_attachment_limit)) + { + return false; + } + if (!get_required_S32(benefits_sd, "create_group_cost", m_create_group_cost)) + { + return false; + } + if (!get_required_S32(benefits_sd, "group_membership_limit", m_group_membership_limit)) + { + return false; + } + if (!get_required_S32(benefits_sd, "picks_limit", m_picks_limit)) + { + return false; + } + if (!get_required_S32(benefits_sd, "sound_upload_cost", m_sound_upload_cost)) + { + return false; + } + if (!get_required_S32(benefits_sd, "texture_upload_cost", m_texture_upload_cost)) + { + return false; + } + + // FIXME PREMIUM - either use this field or get rid of it + m_initalized = true; + return true; +} + +void LLAgentBenefits::initNonSL(const LLSD& benefits_sd) +{ + if (!get_required_S32(benefits_sd, "max_groups", m_group_membership_limit) + && !get_required_S32(benefits_sd, "max-agent-groups", m_group_membership_limit)) + m_group_membership_limit = S32_MAX; + m_picks_limit = m_animated_object_limit = m_attachment_limit = S32_MAX; + m_texture_upload_cost = m_sound_upload_cost = m_create_group_cost = m_animation_upload_cost = 0; +} + +void LLAgentBenefits::processEconomyData(LLMessageSystem* msg) +{ + msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceUpload, m_texture_upload_cost); + m_sound_upload_cost = m_animation_upload_cost = m_texture_upload_cost; + msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceGroupCreate, m_create_group_cost); + + LL_INFOS_ONCE("Messaging") << "EconomyData message arrived; upload cost is L$" << m_texture_upload_cost << " group cost is " << m_create_group_cost << LL_ENDL; +} + +S32 LLAgentBenefits::getAnimatedObjectLimit() const +{ + return m_animated_object_limit; +} + +S32 LLAgentBenefits::getAnimationUploadCost() const +{ + return m_animation_upload_cost; +} + +S32 LLAgentBenefits::getAttachmentLimit() const +{ + return m_attachment_limit; +} + +S32 LLAgentBenefits::getCreateGroupCost() const +{ + return m_create_group_cost; +} + +S32 LLAgentBenefits::getGroupMembershipLimit() const +{ + return m_group_membership_limit; +} + +S32 LLAgentBenefits::getPicksLimit() const +{ + return m_picks_limit; +} + +S32 LLAgentBenefits::getSoundUploadCost() const +{ + return m_sound_upload_cost; +} + +S32 LLAgentBenefits::getTextureUploadCost() const +{ + return m_texture_upload_cost; +} + +bool LLAgentBenefits::findUploadCost(LLAssetType::EType& asset_type, S32& cost) const +{ + bool succ = false; + if (asset_type == LLAssetType::AT_TEXTURE) + { + cost = getTextureUploadCost(); + succ = true; + } + else if (asset_type == LLAssetType::AT_SOUND) + { + cost = getSoundUploadCost(); + succ = true; + } + else if (asset_type == LLAssetType::AT_ANIMATION) + { + cost = getAnimationUploadCost(); + succ = true; + } + return succ; +} + +LLAgentBenefitsMgr::LLAgentBenefitsMgr() +{ +} + +LLAgentBenefitsMgr::~LLAgentBenefitsMgr() +{ +} + +// static +LLAgentBenefits& LLAgentBenefitsMgr::current() +{ + return instance().mCurrent; +} + +// static +const LLAgentBenefits& LLAgentBenefitsMgr::get(const std::string& package) +{ + if (instance().mPackageMap.find(package) != instance().mPackageMap.end()) + { + return instance().mPackageMap[package]; + } + else + { + return instance().mDefault; + } +} + +// static +bool LLAgentBenefitsMgr::init(const std::string& package, const LLSD& benefits_sd) +{ + LLAgentBenefits benefits; + if (!benefits.init(benefits_sd)) + { + LL_WARNS("Benefits") << "Unable to initialize package " << package << " from sd " << benefits_sd << LL_ENDL; + return false; + } + else + { + instance().mPackageMap[package] = benefits; + } + return true; + +} + +// static +bool LLAgentBenefitsMgr::initCurrent(const std::string& package, const LLSD& benefits_sd) +{ + LLAgentBenefits benefits; + if (!benefits.init(benefits_sd)) + { + LL_WARNS("Benefits") << "Unable to initialize package " << package << " from sd " << benefits_sd << LL_ENDL; + return false; + } + else + { + instance().mCurrent = benefits; + instance().mCurrentName = package; + } + return true; + +} + +void LLAgentBenefitsMgr::initNonSL(const LLSD& benefits_sd) +{ + mCurrent.initNonSL(benefits_sd); + mCurrentName = "NonSL"; +} + +// static +bool LLAgentBenefitsMgr::has(const std::string& package) +{ + return instance().mPackageMap.find(package) != instance().mPackageMap.end(); +} + +//static +bool LLAgentBenefitsMgr::isCurrent(const std::string& package) +{ + return instance().mCurrentName == package; +} diff --git a/indra/newview/llagentbenefits.h b/indra/newview/llagentbenefits.h new file mode 100644 index 000000000..b121e3389 --- /dev/null +++ b/indra/newview/llagentbenefits.h @@ -0,0 +1,92 @@ +/** +* @file llagentbenefits.h +* +* $LicenseInfo:firstyear=2019&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2019, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#ifndef LL_AGENTBENEFITS_H +#define LL_AGENTBENEFITS_H + +#include "llsingleton.h" +#include "llsd.h" +#include "llassettype.h" + +class LLAgentBenefits +{ +public: + LLAgentBenefits(); + ~LLAgentBenefits(); + LOG_CLASS(LLAgentBenefits); + + bool init(const LLSD& benefits_sd); + void initNonSL(const LLSD& benefits_sd); + void processEconomyData(LLMessageSystem*); + + S32 getAnimatedObjectLimit() const; + S32 getAnimationUploadCost() const; + S32 getAttachmentLimit() const; + S32 getCreateGroupCost() const; + S32 getGroupMembershipLimit() const; + S32 getPicksLimit() const; + S32 getSoundUploadCost() const; + S32 getTextureUploadCost() const; + + bool findUploadCost(LLAssetType::EType& asset_type, S32& cost) const; + +private: + S32 m_animated_object_limit; + S32 m_animation_upload_cost; + S32 m_attachment_limit; + S32 m_create_group_cost; + S32 m_group_membership_limit; + S32 m_picks_limit; + S32 m_sound_upload_cost; + S32 m_texture_upload_cost; + + bool m_initalized; +}; + +class LLAgentBenefitsMgr : public LLSingleton +{ + friend class LLSingleton; + LLAgentBenefitsMgr(); + ~LLAgentBenefitsMgr(); + LOG_CLASS(LLAgentBenefitsMgr); + +public: + static LLAgentBenefits& current(); + static const LLAgentBenefits& get(const std::string& package); + static bool init(const std::string& package, const LLSD& benefits_sd); + static bool initCurrent(const std::string& package, const LLSD& benefits_sd); + void initNonSL(const LLSD& benefits_sd); + static bool has(const std::string& package); + static bool isCurrent(const std::string& package); + +private: + std::string mCurrentName; + LLAgentBenefits mCurrent; + LLAgentBenefits mDefault; + std::map mPackageMap; +}; + + +#endif diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 7c58c7c03..b50d0202d 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -35,6 +35,7 @@ // viewer includes #include "llagent.h" +#include "llagentbenefits.h" #include "llcompilequeue.h" #include "llfloaterbuycurrency.h" #include "statemachine/aifilepicker.h" @@ -59,7 +60,6 @@ // library includes #include "lldir.h" -#include "lleconomy.h" #include "llfocusmgr.h" #include "llnotificationsutil.h" #include "llscrolllistctrl.h" @@ -326,7 +326,11 @@ void LLAssetUploadResponder::uploadFailure(const LLSD& content) // deal with L$ errors if (reason == "insufficient funds") { - S32 price = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); + S32 price; + if (content.has("upload_price")) + price = content["upload_price"]; + else + LLAgentBenefitsMgr::current().findUploadCost(mAssetType, price); LLFloaterBuyCurrency::buyCurrency("Uploading costs", price); } else @@ -390,13 +394,14 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content) // Update L$ and ownership credit information // since it probably changed on the server - if (asset_type == LLAssetType::AT_TEXTURE || + if (content.has("upload_price")) + expected_upload_cost = content["upload_price"]; + else if (asset_type == LLAssetType::AT_TEXTURE || asset_type == LLAssetType::AT_SOUND || asset_type == LLAssetType::AT_ANIMATION || asset_type == LLAssetType::AT_MESH) { - expected_upload_cost = - LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); + LLAgentBenefitsMgr::current().findUploadCost(asset_type, expected_upload_cost); } LL_INFOS() << "Adding " << content["new_inventory_item"].asUUID() << " " diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index 43ebdf14e..5bf24ddcc 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -36,13 +36,13 @@ #include "llbvhloader.h" #include "lldatapacker.h" #include "lldir.h" -#include "lleconomy.h" #include "llnotificationsutil.h" #include "llvfile.h" #include "llapr.h" #include "llstring.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llanimationstates.h" #include "llbbox.h" #include "llbutton.h" @@ -229,7 +229,7 @@ BOOL LLFloaterBvhPreview::postBuild() getChild("priority")->setMaxValue(7); } - childSetLabelArg("ok_btn", "[UPLOADFEE]", gHippoGridManager->getConnectedGrid()->getUploadFee()); + childSetLabelArg("ok_btn", "[UPLOADFEE]", gHippoGridManager->getConnectedGrid()->formatFee(LLAgentBenefitsMgr::current().getAnimationUploadCost())); childSetAction("ok_btn", onBtnOK, this); setDefaultBtn(); @@ -1238,7 +1238,7 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata) std::string name = floaterp->getChild("name_form")->getValue().asString(); std::string desc = floaterp->getChild("description_form")->getValue().asString(); LLAssetStorage::LLStoreAssetCallback callback = NULL; - S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); + S32 expected_upload_cost = LLAgentBenefitsMgr::current().getAnimationUploadCost(); void *userdata = NULL; // @@ -1268,7 +1268,9 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata) 0, LLFolderType::FT_NONE, LLInventoryType::IT_ANIMATION, - LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), + LLFloaterPerms::getNextOwnerPerms("Uploads"), + LLFloaterPerms::getGroupPerms("Uploads"), + LLFloaterPerms::getEveryonePerms("Uploads"), name, callback, expected_upload_cost, userdata); } diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index 0e3374ecf..f696bcef0 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -45,6 +45,7 @@ #include "hbfloatergrouptitles.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llbutton.h" #include "llfloatergroupinvite.h" #include "llgroupactions.h" @@ -187,7 +188,7 @@ void LLPanelGroups::setTexts() LLUICtrl* ctrl(getChild("groupcount")); size_t count(gAgent.mGroups.size()); ctrl->setTextArg("[COUNT]", llformat("%d", count)); - int maxgroups(gHippoLimits->getMaxAgentGroups()); + int maxgroups(LLAgentBenefitsMgr::current().getGroupMembershipLimit()); ctrl->setTextArg("[MAX]", llformat("%d", maxgroups)); ctrl->setTextArg("[LEFT]", llformat("%d", maxgroups - count)); } diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index d44333f04..b2efabd9d 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -40,6 +40,7 @@ #include "llimagej2c.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llbutton.h" #include "llcombobox.h" #include "lldrawable.h" @@ -96,7 +97,7 @@ BOOL LLFloaterImagePreview::postBuild() return FALSE; } - childSetLabelArg("ok_btn", "[UPLOADFEE]", gHippoGridManager->getConnectedGrid()->getUploadFee()); + childSetLabelArg("ok_btn", "[UPLOADFEE]", gHippoGridManager->getConnectedGrid()->formatFee(LLAgentBenefitsMgr::current().getTextureUploadCost())); LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo"); if (iface) diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index 465b7d376..a707df03e 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -48,11 +48,11 @@ #include "llviewermenufile.h" // upload_new_resource() #include "lluictrlfactory.h" #include "llstring.h" -#include "lleconomy.h" // linden includes #include "llassetstorage.h" #include "llinventorytype.h" +#include "llagentbenefits.h" #include "hippogridmanager.h" @@ -134,13 +134,37 @@ BOOL LLFloaterNameDesc::postBuild() // Cancel button getChild("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnCancel, this)); - getChild("ok_btn")->setLabelArg("[UPLOADFEE]", llformat("%s%d", gHippoGridManager->getConnectedGrid()->getCurrencySymbol().c_str(), LLGlobalEconomy::Singleton::getInstance()->getPriceUpload())); + S32 expected_upload_cost = getExpectedUploadCost(); + getChild("ok_btn")->setLabelArg("[UPLOADFEE]", llformat("%s%d", gHippoGridManager->getConnectedGrid()->getCurrencySymbol().c_str(), expected_upload_cost)); setDefaultBtn("ok_btn"); return TRUE; } +S32 LLFloaterNameDesc::getExpectedUploadCost() const +{ + std::string exten = gDirUtilp->getExtension(mFilename); + LLAssetType::EType asset_type = exten == "wav" ? LLAssetType::AT_SOUND + : (exten == "anim" || exten == "bvh") ? LLAssetType::AT_ANIMATION + : exten != "lsl" ? LLAssetType::AT_TEXTURE + : asset_type = LLAssetType::AT_NONE; + S32 upload_cost = -1; + + if (asset_type != LLAssetType::AT_NONE) + { + if (!LLAgentBenefitsMgr::current().findUploadCost(asset_type, upload_cost)) + { + LL_WARNS() << "Unable to find upload cost for asset type " << asset_type << LL_ENDL; + } + } + /*else + { + LL_WARNS() << "Unable to find upload cost for " << mFilename << LL_ENDL; + }*/ + return upload_cost; +} + //----------------------------------------------------------------------------- // LLFloaterNameDesc() //----------------------------------------------------------------------------- @@ -173,7 +197,8 @@ void LLFloaterNameDesc::onBtnOK() getChildView("ok_btn")->setEnabled(FALSE); // don't allow inadvertent extra uploads LLAssetStorage::LLStoreAssetCallback callback = NULL; - S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass). + S32 expected_upload_cost = getExpectedUploadCost(); + void *nruserdata = NULL; std::string display_name = LLStringUtil::null; diff --git a/indra/newview/llfloaternamedesc.h b/indra/newview/llfloaternamedesc.h index ad7472d4f..5b5229dd4 100644 --- a/indra/newview/llfloaternamedesc.h +++ b/indra/newview/llfloaternamedesc.h @@ -53,6 +53,8 @@ public: void onBtnCancel(); void doCommit(); + S32 getExpectedUploadCost() const; + protected: virtual void onCommit(); diff --git a/indra/newview/llfloaterpostcard.cpp b/indra/newview/llfloaterpostcard.cpp index 006524b5a..816eb3614 100644 --- a/indra/newview/llfloaterpostcard.cpp +++ b/indra/newview/llfloaterpostcard.cpp @@ -55,7 +55,6 @@ #include "llviewerwindow.h" #include "llstatusbar.h" #include "llviewerregion.h" -#include "lleconomy.h" #include "lltrans.h" #include "llgl.h" diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 99692709d..7c63c0e77 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -54,7 +54,7 @@ #include "llfocusmgr.h" #include "llbutton.h" #include "llcombobox.h" -#include "lleconomy.h" +#include "llagentbenefits.h" #include "llsliderctrl.h" #include "llspinctrl.h" #include "llviewercontrol.h" @@ -1414,7 +1414,7 @@ void LLSnapshotLivePreview::saveTexture() std::string who_took_it; LLAgentUI::buildFullname(who_took_it); LLAssetStorage::LLStoreAssetCallback callback = &LLSnapshotLivePreview::saveTextureDone; - S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); + S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); saveTextureUserData* user_data = new saveTextureUserData(this, sSnapshotIndex, gSavedSettings.getBOOL("TemporaryUpload")); if (upload_new_resource(tid, // tid LLAssetType::AT_TEXTURE, @@ -1752,7 +1752,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater, bool de { DoutEntering(dc::snapshot, "LLFloaterSnapshot::Impl::updateControls()"); const HippoGridInfo& grid(*gHippoGridManager->getConnectedGrid()); - floater->childSetLabelArg("upload_btn", "[UPLOADFEE]", gSavedSettings.getBOOL("TemporaryUpload") ? (grid.getCurrencySymbol() + '0') : grid.getUploadFee()); + floater->childSetLabelArg("upload_btn", "[UPLOADFEE]", grid.formatFee(gSavedSettings.getBOOL("TemporaryUpload") ? 0 : LLAgentBenefitsMgr::current().getTextureUploadCost())); LLSnapshotLivePreview::ESnapshotType shot_type = (LLSnapshotLivePreview::ESnapshotType)gSavedSettings.getS32("LastSnapshotType"); ESnapshotFormat shot_format = (ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat"); @@ -1857,7 +1857,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater, bool de { bytes_string = floater->getString("unknown"); } - S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); + S32 upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); floater->childSetLabelArg("texture", "[AMOUNT]", llformat("%d",upload_cost)); floater->childSetLabelArg("upload_btn", "[AMOUNT]", llformat("%d",upload_cost)); floater->childSetTextArg("file_size_label", "[SIZE]", bytes_string); diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 5ad340218..1804c558a 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -44,7 +44,6 @@ #include "roles_constants.h" #include "lltransactiontypes.h" #include "llstatusbar.h" -#include "lleconomy.h" #include "llviewerregion.h" #include "llviewerwindow.h" #include "llfloaterdirectory.h" diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 171301f9f..89f43f372 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -36,6 +36,7 @@ #include "lffloaterinvpanel.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llagentwearables.h" #include "llappearancemgr.h" @@ -6050,7 +6051,7 @@ bool confirm_attachment_rez(const LLSD& notification, const LLSD& response) if (!gAgentAvatarp->canAttachMoreObjects()) { LLSD args; - args["MAX_ATTACHMENTS"] = llformat("%d", MAX_AGENT_ATTACHMENTS); + args["MAX_ATTACHMENTS"] = llformat("%d", LLAgentBenefitsMgr::current().getAttachmentLimit()); LLNotificationsUtil::add("MaxAttachmentsOnOutfit", args); return false; } diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index f621f3b6b..004a08e6f 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -38,7 +38,6 @@ #include "lldatapacker.h" #include "llfasttimer.h" #include "llfloaterperms.h" -#include "lleconomy.h" #include "llimagej2c.h" #include "llhost.h" #include "llnotificationsutil.h" diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index d933b9a46..262913a84 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -45,6 +45,7 @@ #include "llwindow.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llavataractions.h" #include "llavatarpropertiesprocessor.h" #include "llcallingcard.h" @@ -984,23 +985,23 @@ void LLPanelAvatarPicks::processProperties(void* data, EAvatarProcessorType type // are no tabs in the container. tabs->selectFirstTab(); bool edit(getPanelAvatar()->isEditable()); - S32 tab_count = tabs->getTabCount(); + bool can_add = self && tabs->getTabCount() < LLAgentBenefitsMgr::current().getPicksLimit(); LLView* view = getChildView("New..."); - view->setEnabled(self && tab_count < MAX_AVATAR_PICKS + view->setEnabled(can_add // [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); // [/RLVa:KB] view->setVisible(self && edit); view = getChildView("Delete..."); - view->setEnabled(self && tab_count); + view->setEnabled(can_add); view->setVisible(self && edit); //For pick import/export - RK view = getChildView("Import..."); view->setVisible(self && edit); - view->setEnabled(tab_count < MAX_AVATAR_PICKS); + view->setEnabled(can_add); view = getChildView("Export..."); - view->setEnabled(self && tab_count); + view->setEnabled(can_add); view->setVisible(self); childSetVisible("loading_text", false); @@ -1022,13 +1023,13 @@ void LLPanelAvatarPicks::onClickNew() panel_pick->initNewPick(); tabs->addTabPanel(panel_pick, panel_pick->getPickName()); tabs->selectLastTab(); - S32 tab_count = tabs->getTabCount(); - getChildView("New...")->setEnabled(tab_count < MAX_AVATAR_PICKS + bool can_add = tabs->getTabCount() < LLAgentBenefitsMgr::current().getPicksLimit(); + getChildView("New...")->setEnabled(can_add // [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); // [/RLVa:KB] getChildView("Delete...")->setEnabled(true); - getChildView("Import...")->setEnabled(tab_count < MAX_AVATAR_PICKS); + getChildView("Import...")->setEnabled(can_add); } //Pick import and export - RK @@ -1039,17 +1040,17 @@ void LLPanelAvatarPicks::onClickImport() } // static -void LLPanelAvatarPicks::onClickImport_continued(void* data, bool import) +void LLPanelAvatarPicks::onClickImport_continued(void* data, bool importt) { LLPanelAvatarPicks* self = (LLPanelAvatarPicks*)data; LLTabContainer* tabs = self->getChild("picks tab"); - if (import && self->mPanelPick) + if (importt && self->mPanelPick) { tabs->addTabPanel(self->mPanelPick, self->mPanelPick->getPickName()); tabs->selectLastTab(); self->childSetEnabled("New...", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); self->childSetEnabled("Delete...", false); - self->childSetEnabled("Import...", tabs->getTabCount() < MAX_AVATAR_PICKS); + self->childSetEnabled("Import...", tabs->getTabCount() < LLAgentBenefitsMgr::current().getPicksLimit()); } } diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index a1faffb9e..6876b224c 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -251,7 +251,7 @@ private: //Pick import and export - RK void onClickImport(); - static void onClickImport_continued(void* self, bool import); + static void onClickImport_continued(void* self, bool importt); void onClickExport(); bool callbackDelete(const LLSD& notification, const LLSD& response); diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 86b6054e4..f7861eed4 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -35,6 +35,7 @@ #include "llpanelgroupgeneral.h" #include "llagent.h" +#include "llagentbenefits.h" #include "lluictrlfactory.h" #include "roles_constants.h" @@ -182,10 +183,11 @@ BOOL LLPanelGroupGeneral::postBuild() mCtrlOpenEnrollment->setCommitCallback(boost::bind(&LLPanelGroupGeneral::onCommitAny,this)); } + auto& grid = *gHippoGridManager->getConnectedGrid(); mCtrlEnrollmentFee = getChild("check_enrollment_fee", recurse); if (mCtrlEnrollmentFee) { - mCtrlEnrollmentFee->setLabelArg("[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol()); + mCtrlEnrollmentFee->setLabelArg("[CURRENCY]", grid.getCurrencySymbol()); mCtrlEnrollmentFee->setCommitCallback(boost::bind(&LLPanelGroupGeneral::onCommitEnrollment,this)); } @@ -242,7 +244,7 @@ BOOL LLPanelGroupGeneral::postBuild() } LLStringUtil::format_map_t args; - args["[GROUPCREATEFEE]"] = gHippoGridManager->getConnectedGrid()->getGroupCreationFee(); + args["[GROUPCREATEFEE]"] = grid.formatFee(LLAgentBenefitsMgr::current().getCreateGroupCost()); mIncompleteMemberDataStr = getString("incomplete_member_data_str"); mConfirmGroupCreateStr = getString("confirm_group_create_str", args); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 0ce1c93b8..659a5dfb4 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -29,7 +29,6 @@ #include "llagent.h" #include "llagentcamera.h" -#include "lleconomy.h" #include "llfirstuse.h" #include "llfiltereditor.h" #include "llinventorybridge.h" diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 2eab07463..e9d82f8c0 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -36,7 +36,6 @@ #include "llpanelobject.h" // linden library includes -#include "lleconomy.h" #include "llerror.h" #include "llfontgl.h" #include "llpermissionsflags.h" diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 42459df94..36cc6647e 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -36,7 +36,6 @@ // linden library includes #include "llclickaction.h" -#include "lleconomy.h" #include "llerror.h" #include "llfontgl.h" #include "llflexibleobject.h" diff --git a/indra/newview/llpreviewlandmark.cpp b/indra/newview/llpreviewlandmark.cpp index a73c1c3f4..ac70e0ccc 100644 --- a/indra/newview/llpreviewlandmark.cpp +++ b/indra/newview/llpreviewlandmark.cpp @@ -43,7 +43,6 @@ #include "llagent.h" #include "llbutton.h" -#include "lleconomy.h" #include "llfloaterinventory.h" #include "llfloaterworldmap.h" #include "lliconctrl.h" diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 371d4c68c..2e8a7b1f8 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -36,7 +36,6 @@ // library includes #include "llcachename.h" #include "lldbstrings.h" -#include "lleconomy.h" #include "llgl.h" #include "llmediaentry.h" #include "llrender.h" diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 6df4e95d0..d8fb118cf 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -95,6 +95,7 @@ #include "v3math.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llagentwearables.h" #include "llagentpilot.h" @@ -286,6 +287,7 @@ static LLHost gFirstSim; static std::string gFirstSimSeedCap; static LLVector3 gAgentStartLookAt(1.0f, 0.f, 0.f); static std::string gAgentStartLocation = "safe"; +static bool mBenefitsSuccessfullyInit = false; boost::scoped_ptr LLStartUp::sStateWatcher(new LLEventStream("StartupState")); @@ -316,6 +318,7 @@ void apply_udp_blacklist(const std::string& csv); //bool process_login_success_response(std::string& password); bool process_login_success_response(std::string& password, U32& first_sim_size_x, U32& first_sim_size_y); // Aurora Sim +void on_benefits_failed_callback(const LLSD& notification, const LLSD& response); void transition_back_to_login_panel(const std::string& emsg); void callback_cache_name(const LLUUID& id, const std::string& full_name, bool is_group) @@ -2009,7 +2012,7 @@ bool idle_startup() send_complete_agent_movement(regionp->getHost()); gAssetStorage->setUpstream(regionp->getHost()); gCacheName->setUpstream(regionp->getHost()); - msg->newMessageFast(_PREHASH_EconomyDataRequest); + if (!mBenefitsSuccessfullyInit) msg->newMessageFast(_PREHASH_EconomyDataRequest); gAgent.sendReliableMessage(); } display_startup(); @@ -2678,6 +2681,11 @@ bool idle_startup() set_startup_status(1.0, LLStringUtil::null, LLStringUtil::null); display_startup(); + if (!mBenefitsSuccessfullyInit && !gHippoGridManager->getConnectedGrid()->isSecondLife()) + { + LLNotificationsUtil::add("FailedToGetBenefits", LLSD(), LLSD(), boost::bind(on_benefits_failed_callback, _1, _2)); + } + // Let the map know about the inventory. LLFloaterWorldMap* floater_world_map = gFloaterWorldMap; if(floater_world_map) @@ -3886,10 +3894,70 @@ void apply_udp_blacklist(const std::string& csv) } +void on_benefits_failed_callback(const LLSD& notification, const LLSD& response) +{ + LL_WARNS("Benefits") << "Failed to load benefits information" << LL_ENDL; +} + +bool init_benefits(LLSD& response) +{ + bool succ = true; + + std::string package_name = response["account_type"].asString(); + const LLSD& benefits_sd = response["account_level_benefits"]; + if (!LLAgentBenefitsMgr::init(package_name, benefits_sd) || + !LLAgentBenefitsMgr::initCurrent(package_name, benefits_sd)) + { + succ = false; + } + else + { + LL_DEBUGS("Benefits") << "Initialized current benefits, level " << package_name << " from " << benefits_sd << LL_ENDL; + } + const LLSD& packages_sd = response["premium_packages"]; + for(LLSD::map_const_iterator package_iter = packages_sd.beginMap(); + package_iter != packages_sd.endMap(); + ++package_iter) + { + std::string package_name = package_iter->first; + const LLSD& benefits_sd = package_iter->second["benefits"]; + if (LLAgentBenefitsMgr::init(package_name, benefits_sd)) + { + LL_DEBUGS("Benefits") << "Initialized benefits for package " << package_name << " from " << benefits_sd << LL_ENDL; + } + else + { + LL_WARNS("Benefits") << "Failed init for package " << package_name << " from " << benefits_sd << LL_ENDL; + succ = false; + } + } + + if (!LLAgentBenefitsMgr::has("Base")) + { + LL_WARNS("Benefits") << "Benefits info did not include required package Base" << LL_ENDL; + succ = false; + } + if (!LLAgentBenefitsMgr::has("Premium")) + { + LL_WARNS("Benefits") << "Benefits info did not include required package Premium" << LL_ENDL; + succ = false; + } + + // FIXME PREMIUM - for testing if login does not yet provide Premium Plus. Should be removed thereafter. + //if (succ && !LLAgentBenefitsMgr::has("Premium Plus")) + //{ + // LLAgentBenefitsMgr::init("Premium Plus", packages_sd["Premium"]["benefits"]); + // llassert(LLAgentBenefitsMgr::has("Premium Plus")); + //} + return succ; +} + bool process_login_success_response(std::string& password, U32& first_sim_size_x, U32& first_sim_size_y) { LLSD response = LLUserAuth::getInstance()->getResponse(); + mBenefitsSuccessfullyInit = init_benefits(response); + std::string text(response["udp_blacklist"]); if(!text.empty()) { @@ -4112,14 +4180,15 @@ bool process_login_success_response(std::string& password, U32& first_sim_size_x LLWorldMap::gotMapServerURL(true); } - bool opensim = !gHippoGridManager->getConnectedGrid()->isSecondLife(); + auto& grid = *gHippoGridManager->getConnectedGrid(); + bool opensim = !grid.isSecondLife(); if (opensim) { std::string web_profile_url = response["web_profile_url"]; //if(!web_profile_url.empty()) // Singu Note: We're using this to check if this grid supports web profiles at all, so set empty if empty. gSavedSettings.setString("WebProfileURL", web_profile_url); } - else if(!gHippoGridManager->getConnectedGrid()->isInProductionGrid()) + else if(!grid.isInProductionGrid()) { gSavedSettings.setString("WebProfileURL", "https://my-demo.secondlife.com/[AGENT_NAME]"); } @@ -4180,34 +4249,34 @@ bool process_login_success_response(std::string& password, U32& first_sim_size_x // Override grid info with anything sent in the login response std::string tmp = response["gridname"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setGridName(tmp); + if (!tmp.empty()) grid.setGridName(tmp); tmp = response["loginuri"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setLoginUri(tmp); + if (!tmp.empty()) grid.setLoginUri(tmp); tmp = response["welcome"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setLoginPage(tmp); + if (!tmp.empty()) grid.setLoginPage(tmp); tmp = response["loginpage"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setLoginPage(tmp); + if (!tmp.empty()) grid.setLoginPage(tmp); tmp = response["economy"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setHelperUri(tmp); + if (!tmp.empty()) grid.setHelperUri(tmp); tmp = response["helperuri"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setHelperUri(tmp); + if (!tmp.empty()) grid.setHelperUri(tmp); tmp = response["about"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setWebSite(tmp); + if (!tmp.empty()) grid.setWebSite(tmp); tmp = response["website"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setWebSite(tmp); + if (!tmp.empty()) grid.setWebSite(tmp); tmp = response["help"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setSupportUrl(tmp); + if (!tmp.empty()) grid.setSupportUrl(tmp); tmp = response["support"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setSupportUrl(tmp); + if (!tmp.empty()) grid.setSupportUrl(tmp); tmp = response["register"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setRegisterUrl(tmp); + if (!tmp.empty()) grid.setRegisterUrl(tmp); tmp = response["account"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setRegisterUrl(tmp); + if (!tmp.empty()) grid.setRegisterUrl(tmp); tmp = response["password"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setPasswordUrl(tmp); + if (!tmp.empty()) grid.setPasswordUrl(tmp); tmp = response["search"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setSearchUrl(tmp); - else if (opensim) tmp = gHippoGridManager->getConnectedGrid()->getSearchUrl(); // Fallback from grid info response for setting + if (!tmp.empty()) grid.setSearchUrl(tmp); + else if (opensim) tmp = grid.getSearchUrl(); // Fallback from grid info response for setting if (opensim) { gSavedSettings.setString("SearchURL", tmp); // Singu Note: For web search purposes, always set this setting @@ -4216,32 +4285,31 @@ bool process_login_success_response(std::string& password, U32& first_sim_size_x gMenuBarView->getChildView("Avatar Picker")->setVisible(!tmp.empty()); gSavedSettings.setString("DestinationGuideURL", response["destination_guide_url"].asString()); tmp = response["classified_fee"].asString(); - gHippoGridManager->getConnectedGrid()->setClassifiedFee(tmp.empty() ? 0 : atoi(tmp.c_str())); + grid.setClassifiedFee(tmp.empty() ? 0 : atoi(tmp.c_str())); } tmp = response["currency"].asString(); if (!tmp.empty()) { LLTrans::setDefaultArg("[CURRENCY]", tmp); - gHippoGridManager->getConnectedGrid()->setCurrencySymbol(tmp); + grid.setCurrencySymbol(tmp); } tmp = response["currency_text"].asString(); if (!tmp.empty()) { LLTrans::setDefaultArg("[CURRENCY_TEXT]", tmp); - gHippoGridManager->getConnectedGrid()->setCurrencyText(tmp); + grid.setCurrencyText(tmp); } tmp = response["real_currency"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setRealCurrencySymbol(tmp); + if (!tmp.empty()) grid.setRealCurrencySymbol(tmp); tmp = response["directory_fee"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setDirectoryFee(atoi(tmp.c_str())); - tmp = response["max_groups"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setMaxAgentGroups(atoi(tmp.c_str())); - tmp = response["max-agent-groups"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setMaxAgentGroups(atoi(tmp.c_str())); + if (!tmp.empty()) grid.setDirectoryFee(atoi(tmp.c_str())); + if (mBenefitsSuccessfullyInit) tmp = response["VoiceConnector"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setVoiceConnector(tmp); + if (!tmp.empty()) grid.setVoiceConnector(tmp); tmp = response["upc_supported"].asString(); - if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setUPCSupported(true); + if (!tmp.empty()) grid.setUPCSupported(true); + if (opensim && !mBenefitsSuccessfullyInit) + LLAgentBenefitsMgr::instance().initNonSL(response); gHippoGridManager->saveFile(); gHippoLimits->setLimits(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 4fefe7e45..b594fe3cd 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -53,6 +53,7 @@ #include "lffloaterinvpanel.h" #include "lfsimfeaturehandler.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llappearancemgr.h" #include "llagentwearables.h" @@ -681,15 +682,15 @@ void init_menus() gViewerWindow->setMenuBackgroundColor(false, LLViewerLogin::getInstance()->isInProductionGrid()); - // Assume L$10 for now, the server will tell us the real cost at login - const std::string upload_cost("10"); - std::string fee = gHippoGridManager->getConnectedGrid()->getCurrencySymbol() + "10"; - gMenuHolder->childSetLabelArg("Upload Image", "[UPLOADFEE]", fee); - gMenuHolder->childSetLabelArg("Upload Sound", "[UPLOADFEE]", fee); - gMenuHolder->childSetLabelArg("Upload Animation", "[UPLOADFEE]", fee); - gMenuHolder->childSetLabelArg("Bulk Upload", "[UPLOADFEE]", fee); - gMenuHolder->childSetLabelArg("Buy and Sell L$...", "[CURRENCY]", - gHippoGridManager->getConnectedGrid()->getCurrencySymbol()); + std::string symbol = gHippoGridManager->getConnectedGrid()->getCurrencySymbol(); + auto& benefits = LLAgentBenefitsMgr::current(); + const std::string texture_upload_cost_str = symbol + std::to_string(benefits.getTextureUploadCost()); + const std::string sound_upload_cost_str = symbol + std::to_string(benefits.getSoundUploadCost()); + const std::string animation_upload_cost_str = symbol + std::to_string(benefits.getAnimationUploadCost()); + gMenuHolder->childSetLabelArg("Upload Image", "[UPLOADFEE]", texture_upload_cost_str); + gMenuHolder->childSetLabelArg("Upload Sound", "[UPLOADFEE]", sound_upload_cost_str); + gMenuHolder->childSetLabelArg("Upload Animation", "[UPLOADFEE]", animation_upload_cost_str); + gMenuHolder->childSetLabelArg("Buy and Sell L$...", "[CURRENCY]", symbol); gAFKMenu = gMenuBarView->getChild("Set Away", TRUE); gBusyMenu = gMenuBarView->getChild("Set Busy", TRUE); @@ -8876,6 +8877,43 @@ class LLWorldEnableEnvSettings final : public view_listener_t } }; +class LLUploadCostCalculator final : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) override + { + auto& asset_type_str = userdata["data"].asStringRef(); + S32 upload_cost = -1; + LLView* view; + + if (asset_type_str == "texture") + { + upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); + view = gMenuHolder->findChild("Upload Image"); + } + else if (asset_type_str == "animation") + { + upload_cost = LLAgentBenefitsMgr::current().getAnimationUploadCost(); + view = gMenuHolder->findChild("Upload Animation"); + } + else if (asset_type_str == "sound") + { + upload_cost = LLAgentBenefitsMgr::current().getSoundUploadCost(); + view = gMenuHolder->findChild("Upload Sound"); + } + else + { + LL_WARNS() << "Unable to find upload cost for asset_type_str " << asset_type_str << LL_ENDL; + return true; + } + auto ctrl = gMenuHolder->findControl(userdata["control"].asString()); + ctrl->setValue(gStatusBar && gStatusBar->getBalance() >= upload_cost); + view->setLabelArg("[UPLOADFEE]", gHippoGridManager->getConnectedGrid()->formatFee(upload_cost)); + + return true; + } +}; + +// TPV listeners go below here class SinguCloseAllDialogs final : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) override @@ -10013,6 +10051,8 @@ void initialize_menus() bool mMult; }; + addMenu(new LLUploadCostCalculator(), "Upload.CalculateCosts"); + // File menu init_menu_file(); diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 1432e4df7..0900f760e 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -35,6 +35,7 @@ // project includes #include "llagent.h" +#include "llagentbenefits.h" #include "llagentcamera.h" #include "statemachine/aifilepicker.h" #include "llfloaterbvhpreview.h" @@ -68,7 +69,6 @@ // linden libraries #include "llassetuploadresponders.h" -#include "lleconomy.h" #include "llhttpclient.h" #include "llmemberlistener.h" #include "llnotificationsutil.h" @@ -119,17 +119,6 @@ class LLFileEnableSaveAs : public view_listener_t } }; -class LLFileEnableUpload : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - bool new_value = gStatusBar && LLGlobalEconomy::Singleton::getInstance() && - gStatusBar->getBalance() >= LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; - } -}; - class LLFileEnableUploadModel : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -416,9 +405,7 @@ class LLFileUploadBulk : public view_listener_t } else { - S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); - const char* notification_type = expected_upload_cost ? "BulkTemporaryUpload" : "BulkTemporaryUploadFree"; - LLNotificationsUtil::add(notification_type, LLSD().with("UPLOADCOST", grid->getUploadFee()), LLSD(), onConfirmBulkUploadTemp); + LLNotificationsUtil::add("BulkTemporaryUpload", LLSD(), LLSD(), onConfirmBulkUploadTemp); } return true; } @@ -465,7 +452,6 @@ class LLFileUploadBulk : public view_listener_t std::string display_name = LLStringUtil::null; LLAssetStorage::LLStoreAssetCallback callback = NULL; - S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); void *userdata = NULL; gSavedSettings.setBOOL("TemporaryUpload", enabled); upload_new_resource( @@ -480,7 +466,7 @@ class LLFileUploadBulk : public view_listener_t LLFloaterPerms::getEveryonePerms("Uploads"), display_name, callback, - expected_upload_cost, + 0, userdata); } @@ -925,6 +911,9 @@ void upload_new_resource(const std::string& src_filename, std::string name, error = TRUE;; } + // Now that we've determined the type, figure out the cost + if (!error) LLAgentBenefitsMgr::current().findUploadCost(asset_type, expected_upload_cost); + // gen a new transaction ID for this asset tid.generate(); @@ -1396,7 +1385,6 @@ void init_menu_file() (new LLFileSavePreview())->registerListener(gMenuHolder, "File.SavePreview"); (new LLFileTakeSnapshotToDisk())->registerListener(gMenuHolder, "File.TakeSnapshotToDisk"); (new LLFileQuit())->registerListener(gMenuHolder, "File.Quit"); - (new LLFileEnableUpload())->registerListener(gMenuHolder, "File.EnableUpload"); (new LLFileEnableUploadModel())->registerListener(gMenuHolder, "File.EnableUploadModel"); (new LLFileEnableSaveAs())->registerListener(gMenuHolder, "File.EnableSaveAs"); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index c944f808c..e18c66c84 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -40,7 +40,6 @@ #include "llavatarnamecache.h" #include "llcororesponder.h" #include "../lscript/lscript_byteformat.h" //Need LSCRIPTRunTimePermissionBits and SCRIPT_PERMISSION_* -#include "lleconomy.h" #include "llfocusmgr.h" #include "llfollowcamparams.h" #include "llinventorydefines.h" @@ -54,6 +53,7 @@ #include "mean_collision_data.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llcallingcard.h" #include "llcontrolavatar.h" @@ -735,7 +735,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response) if (option == 0 && !group_id.isNull()) { // check for promotion or demotion. - S32 max_groups = gHippoLimits->getMaxAgentGroups(); + S32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit(); if (gAgent.isInGroup(group_id)) ++max_groups; if ((S32)gAgent.mGroups.size() < max_groups) @@ -5768,19 +5768,9 @@ void process_frozen_message(LLMessageSystem* msgsystem, void** user_data) // do some extra stuff once we get our economy data void process_economy_data(LLMessageSystem* msg, void** /*user_data*/) { - LLGlobalEconomy::processEconomyData(msg, LLGlobalEconomy::Singleton::getInstance()); - - S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); - - LL_INFOS_ONCE("Messaging") << "EconomyData message arrived; upload cost is L$" << upload_cost << LL_ENDL; - - std::string fee = gHippoGridManager->getConnectedGrid()->getUploadFee(); - gMenuHolder->childSetLabelArg("Upload Image", "[UPLOADFEE]", fee); - gMenuHolder->childSetLabelArg("Upload Sound", "[UPLOADFEE]", fee); - gMenuHolder->childSetLabelArg("Upload Animation", "[UPLOADFEE]", fee); - gMenuHolder->childSetLabelArg("Bulk Upload", "[UPLOADFEE]", fee); - gMenuHolder->childSetLabelArg("Buy and Sell L$...", "[CURRENCY]", - gHippoGridManager->getConnectedGrid()->getCurrencySymbol()); + auto& grid = *gHippoGridManager->getConnectedGrid(); + if (grid.isSecondLife() || !LLAgentBenefitsMgr::isCurrent("NonSL")) return; // Quick hack to allow other grids benefits management + LLAgentBenefitsMgr::current().processEconomyData(msg); } void notify_cautioned_script_question(const LLSD& notification, const LLSD& response, S32 orig_questions, BOOL granted) diff --git a/indra/newview/llviewerobjectbackup.cpp b/indra/newview/llviewerobjectbackup.cpp index 0c460d62a..c520909e9 100644 --- a/indra/newview/llviewerobjectbackup.cpp +++ b/indra/newview/llviewerobjectbackup.cpp @@ -35,7 +35,6 @@ #include "llcallbacklist.h" #include "lldir.h" -#include "lleconomy.h" #include "llhttpclient.h" #include "llinventorydefines.h" #include "llimagej2c.h" diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index ca1eb74ab..26a8dc092 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2072,6 +2072,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("UploadBakedTexture"); capabilityNames.append("UserInfo"); capabilityNames.append("ViewerAsset"); + capabilityNames.append("ViewerBenefits"); capabilityNames.append("ViewerMetrics"); capabilityNames.append("ViewerStartAuction"); capabilityNames.append("ViewerStats"); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 6d945b613..e11db0c88 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -42,6 +42,7 @@ #include "raytrace.h" #include "llagent.h" // Get state values from here +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llagentwearables.h" #include "llanimationstates.h" @@ -1131,7 +1132,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mCCSChatTextOverride(false) // { - mAttachedObjectsVector.reserve(MAX_AGENT_ATTACHMENTS); + mAttachedObjectsVector.reserve(38); static LLCachedControl const freeze_time("FreezeTime", false); mFreezeTimeLangolier = freeze_time; @@ -7808,7 +7809,7 @@ U32 LLVOAvatar::getNumAttachments() const //----------------------------------------------------------------------------- BOOL LLVOAvatar::canAttachMoreObjects(U32 n) const { - return (getNumAttachments() + n) <= MAX_AGENT_ATTACHMENTS; + return (getNumAttachments() + n) <= (U32)LLAgentBenefitsMgr::current().getAttachmentLimit(); } //----------------------------------------------------------------------------- @@ -7833,24 +7834,9 @@ U32 LLVOAvatar::getNumAnimatedObjectAttachments() const //----------------------------------------------------------------------------- U32 LLVOAvatar::getMaxAnimatedObjectAttachments() const { - U32 max_attach = 0; if (gSavedSettings.getBOOL("AnimatedObjectsIgnoreLimits")) - { - max_attach = MAX_AGENT_ATTACHMENTS; - } - else - { - if (gAgent.getRegion()) - { - LLSD features; - gAgent.getRegion()->getSimulatorFeatures(features); - if (features.has("AnimatedObjects")) - { - max_attach = (U32)llmax(0,features["AnimatedObjects"]["MaxAgentAnimatedObjectAttachments"].asInteger()); - } - } - } - return max_attach; + return U32_MAX; + return LLAgentBenefitsMgr::current().getAnimatedObjectLimit(); } //----------------------------------------------------------------------------- diff --git a/indra/newview/skins/default/xui/de/menu_viewer.xml b/indra/newview/skins/default/xui/de/menu_viewer.xml index 81d34029b..47d570027 100644 --- a/indra/newview/skins/default/xui/de/menu_viewer.xml +++ b/indra/newview/skins/default/xui/de/menu_viewer.xml @@ -5,7 +5,7 @@ - + diff --git a/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/indra/newview/skins/default/xui/en-us/menu_viewer.xml index 16bc7ceb3..b83ffe4f6 100644 --- a/indra/newview/skins/default/xui/en-us/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en-us/menu_viewer.xml @@ -8,24 +8,24 @@ - + - + - + - diff --git a/indra/newview/skins/default/xui/en-us/notifications.xml b/indra/newview/skins/default/xui/en-us/notifications.xml index 59d022ecf..53bfad2b9 100644 --- a/indra/newview/skins/default/xui/en-us/notifications.xml +++ b/indra/newview/skins/default/xui/en-us/notifications.xml @@ -996,7 +996,7 @@ You do not have enough [CURRENCY] to join this group. icon="alertmodal.tga" name="CreateGroupCost" type="alertmodal"> -Creating this group will cost L$[COST]. + Creating this group will cost [COST]. Groups need more than one member, or they are deleted forever. Please invite members within 48 hours. group @@ -1005,7 +1005,7 @@ Please invite members within 48 hours. canceltext="Cancel" name="okcancelbuttons" notext="Cancel" - yestext="Create group for L$[COST]"/> + yestext="Create group for [COST]"/> + + Unfortunately, we were unable to get benefits information for this session. This should not happen in a normal production environment. Please contact support. This session will not work normally and we recommend that you restart. + + Would you like to bulk upload the files as temporary files? -WARNING: Each upload costs [UPLOADCOST] if it's not temporary - - - - -Would you like to bulk upload the files as temporary files? +WARNING: Each upload will cost its normal price, if it's not temporary Chat + + Base + Premium + Premium Plus + Internal + Select an editor using the ExternalEditor setting. Cannot find the external editor you specified. diff --git a/indra/newview/skins/default/xui/es/menu_viewer.xml b/indra/newview/skins/default/xui/es/menu_viewer.xml index ba27b475b..b933c4226 100644 --- a/indra/newview/skins/default/xui/es/menu_viewer.xml +++ b/indra/newview/skins/default/xui/es/menu_viewer.xml @@ -5,7 +5,7 @@ - + diff --git a/indra/newview/skins/default/xui/fr/menu_viewer.xml b/indra/newview/skins/default/xui/fr/menu_viewer.xml index 556af4342..d40802142 100644 --- a/indra/newview/skins/default/xui/fr/menu_viewer.xml +++ b/indra/newview/skins/default/xui/fr/menu_viewer.xml @@ -5,7 +5,7 @@ - + diff --git a/indra/newview/skins/default/xui/it/menu_viewer.xml b/indra/newview/skins/default/xui/it/menu_viewer.xml index fcecb6526..349d2a60e 100644 --- a/indra/newview/skins/default/xui/it/menu_viewer.xml +++ b/indra/newview/skins/default/xui/it/menu_viewer.xml @@ -6,7 +6,7 @@ - + diff --git a/indra/newview/skins/default/xui/pt/menu_viewer.xml b/indra/newview/skins/default/xui/pt/menu_viewer.xml index 20db1a5a1..1347dc43d 100644 --- a/indra/newview/skins/default/xui/pt/menu_viewer.xml +++ b/indra/newview/skins/default/xui/pt/menu_viewer.xml @@ -4,7 +4,7 @@ - +