Add support for Avination's "Upload Credits"
This commit is contained in:
@@ -58,7 +58,8 @@ HippoGridInfo::HippoGridInfo(const std::string& gridName) :
|
||||
mMaxAgentGroups(-1),
|
||||
mCurrencySymbol("OS$"),
|
||||
mRealCurrencySymbol("US$"),
|
||||
mDirectoryFee(30)
|
||||
mDirectoryFee(30),
|
||||
mUPCSupported(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -676,6 +677,19 @@ void HippoGridInfo::setAutoUpdate(bool b)
|
||||
mAutoUpdate = b;
|
||||
}
|
||||
|
||||
bool HippoGridInfo::getUPCSupported()
|
||||
{
|
||||
if(isSecondLife())
|
||||
return false;
|
||||
else
|
||||
return mUPCSupported;
|
||||
}
|
||||
|
||||
void HippoGridInfo::setUPCSupported(bool b)
|
||||
{
|
||||
mUPCSupported = b;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// ********************************************************************
|
||||
// HippoGridManager
|
||||
|
||||
@@ -82,6 +82,8 @@ public:
|
||||
void setRenderCompat(bool compat);
|
||||
void setMaxAgentGroups(int max) { mMaxAgentGroups = max; }
|
||||
void setVoiceConnector(const std::string& vc) { mVoiceConnector = vc; }
|
||||
void setUPCSupported(bool on);
|
||||
bool getUPCSupported();
|
||||
|
||||
void setCurrencySymbol(const std::string& sym);
|
||||
void setRealCurrencySymbol(const std::string& sym);
|
||||
@@ -116,6 +118,7 @@ private:
|
||||
bool mRenderCompat;
|
||||
bool mInvLinks;
|
||||
bool mAutoUpdate;
|
||||
bool mUPCSupported;
|
||||
int mMaxAgentGroups;
|
||||
|
||||
std::string mCurrencySymbol;
|
||||
|
||||
@@ -4385,6 +4385,8 @@ bool process_login_success_response(std::string& password)
|
||||
if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setMaxAgentGroups(atoi(tmp.c_str()));
|
||||
tmp = response["VoiceConnector"].asString();
|
||||
if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setVoiceConnector(tmp);
|
||||
tmp = response["upc_supported"].asString();
|
||||
if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setUPCSupported(true);
|
||||
gHippoGridManager->saveFile();
|
||||
gHippoLimits->setLimits();
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
#include "llworld.h"
|
||||
#include "llstatgraph.h"
|
||||
#include "llviewercontrol.h"
|
||||
#include "llviewergenericmessage.h"
|
||||
#include "llviewermenu.h" // for gMenuBarView
|
||||
#include "llviewerparcelmgr.h"
|
||||
#include "llviewerthrottle.h"
|
||||
@@ -137,9 +138,27 @@ std::vector<std::string> LLStatusBar::sDays;
|
||||
std::vector<std::string> LLStatusBar::sMonths;
|
||||
const U32 LLStatusBar::MAX_DATE_STRING_LENGTH = 2000;
|
||||
|
||||
class LLDispatchUPCBalance : public LLDispatchHandler
|
||||
{
|
||||
public:
|
||||
virtual bool operator()(
|
||||
const LLDispatcher* dispatcher,
|
||||
const std::string& key,
|
||||
const LLUUID& invoice,
|
||||
const sparam_t& strings)
|
||||
{
|
||||
S32 upc = atoi(strings[0].c_str());
|
||||
gStatusBar->setUPC(upc);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
static LLDispatchUPCBalance sDispatchUPCBalance;
|
||||
|
||||
LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect)
|
||||
: LLPanel(name, LLRect(), FALSE), // not mouse opaque
|
||||
mBalance(0),
|
||||
mUPC(0),
|
||||
mHealth(100),
|
||||
mSquareMetersCredit(0),
|
||||
mSquareMetersCommitted(0),
|
||||
@@ -147,6 +166,11 @@ mRegionCrossingSlot(),
|
||||
mNavMeshSlot(),
|
||||
mIsNavMeshDirty(false)
|
||||
{
|
||||
mUPCSupported = gHippoGridManager->getConnectedGrid()->getUPCSupported();
|
||||
|
||||
if (mUPCSupported)
|
||||
gGenericDispatcher.addHandler("upcbalance", &sDispatchUPCBalance);
|
||||
|
||||
// status bar can possible overlay menus?
|
||||
setMouseOpaque(FALSE);
|
||||
setIsChrome(TRUE);
|
||||
@@ -168,10 +192,14 @@ mIsNavMeshDirty(false)
|
||||
|
||||
mTextParcelName = getChild<LLTextBox>("ParcelNameText" );
|
||||
mTextBalance = getChild<LLTextBox>("BalanceText" );
|
||||
mTextUPC = getChild<LLTextBox>("UPCText" );
|
||||
|
||||
mTextHealth = getChild<LLTextBox>("HealthText" );
|
||||
mTextTime = getChild<LLTextBox>("TimeText" );
|
||||
|
||||
if (!mUPCSupported)
|
||||
mTextUPC->setVisible(false);
|
||||
|
||||
childSetAction("scriptout", onClickScriptDebug, this);
|
||||
childSetAction("health", onClickHealth, this);
|
||||
childSetAction("no_fly", onClickFly, this);
|
||||
@@ -595,6 +623,14 @@ void LLStatusBar::refresh()
|
||||
}
|
||||
|
||||
// Set rects of money, buy money, time
|
||||
if (mUPCSupported)
|
||||
{
|
||||
childGetRect("UPCText", r);
|
||||
r.translate( new_right - r.mRight, 0);
|
||||
childSetRect("UPCText", r);
|
||||
new_right -= r.getWidth() - 18;
|
||||
}
|
||||
|
||||
childGetRect("BalanceText", r);
|
||||
r.translate( new_right - r.mRight, 0);
|
||||
childSetRect("BalanceText", r);
|
||||
@@ -631,6 +667,8 @@ void LLStatusBar::refresh()
|
||||
void LLStatusBar::setVisibleForMouselook(bool visible)
|
||||
{
|
||||
mTextBalance->setVisible(visible);
|
||||
if (mUPCSupported)
|
||||
mTextUPC->setVisible(visible);
|
||||
mTextTime->setVisible(visible);
|
||||
childSetVisible("buycurrency", visible);
|
||||
childSetVisible("search_editor", visible);
|
||||
@@ -653,7 +691,7 @@ void LLStatusBar::creditBalance(S32 credit)
|
||||
void LLStatusBar::setBalance(S32 balance)
|
||||
{
|
||||
mTextBalance->setText(gHippoGridManager->getConnectedGrid()->getCurrencySymbol().c_str() +
|
||||
LLResMgr::getInstance()->getMonetaryString(balance));
|
||||
LLResMgr::getInstance()->getMonetaryString(balance - mUPC));
|
||||
|
||||
if (mBalance && (fabs((F32)(mBalance - balance)) > gSavedSettings.getF32("UISndMoneyChangeThreshold")))
|
||||
{
|
||||
@@ -670,6 +708,14 @@ void LLStatusBar::setBalance(S32 balance)
|
||||
}
|
||||
}
|
||||
|
||||
void LLStatusBar::setUPC(S32 upc)
|
||||
{
|
||||
mTextUPC->setText("UPC " + LLResMgr::getInstance()->getMonetaryString(upc));
|
||||
|
||||
mUPC = upc;
|
||||
|
||||
setBalance(mBalance);
|
||||
}
|
||||
|
||||
// static
|
||||
void LLStatusBar::sendMoneyBalanceRequest()
|
||||
|
||||
@@ -61,6 +61,7 @@ public:
|
||||
|
||||
// MANIPULATORS
|
||||
void setBalance(S32 balance);
|
||||
void setUPC(S32 balance);
|
||||
void debitBalance(S32 debit);
|
||||
void creditBalance(S32 credit);
|
||||
|
||||
@@ -99,6 +100,7 @@ private:
|
||||
|
||||
private:
|
||||
LLTextBox *mTextBalance;
|
||||
LLTextBox *mTextUPC;
|
||||
LLTextBox *mTextHealth;
|
||||
LLTextBox *mTextTime;
|
||||
|
||||
@@ -110,6 +112,7 @@ private:
|
||||
LLButton *mBtnBuyCurrency;
|
||||
|
||||
S32 mBalance;
|
||||
S32 mUPC;
|
||||
S32 mHealth;
|
||||
S32 mSquareMetersCredit;
|
||||
S32 mSquareMetersCommitted;
|
||||
@@ -118,6 +121,7 @@ private:
|
||||
boost::signals2::connection mRegionCrossingSlot;
|
||||
LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot;
|
||||
bool mIsNavMeshDirty;
|
||||
bool mUPCSupported;
|
||||
|
||||
static std::vector<std::string> sDays;
|
||||
static std::vector<std::string> sMonths;
|
||||
|
||||
@@ -105,7 +105,7 @@ void process_generic_message(LLMessageSystem* msg, void**)
|
||||
}
|
||||
else if (agent_id != gAgent.getID())
|
||||
{
|
||||
llwarns << "GenericMessage for wrong agent" << llendl;
|
||||
llwarns << "GenericMessage for wrong agent " << agent_id << llendl;
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -15,21 +15,29 @@
|
||||
<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||
bottom="-20" disabled_color="BalanceTextColor" drop_shadow_visible="true"
|
||||
enabled="true" follows="right|bottom" font="SansSerifSmall" h_pad="0"
|
||||
halign="right" height="18" left="-230" mouse_opaque="true"
|
||||
halign="right" height="18" left="-280" mouse_opaque="true"
|
||||
name="BalanceText" text_color="BalanceTextColor" tool_tip="Account Balance"
|
||||
v_pad="2" width="86">
|
||||
Loading...
|
||||
</text>
|
||||
<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||
bottom="-20" disabled_color="BalanceTextColor" drop_shadow_visible="true"
|
||||
enabled="true" follows="right|bottom" font="SansSerifSmall" h_pad="0"
|
||||
halign="right" height="18" left="-350" mouse_opaque="true"
|
||||
name="UPCText" text_color="BalanceTextColor" tool_tip="Upload credits"
|
||||
v_pad="2" width="106">
|
||||
UPC - N/A -
|
||||
</text>
|
||||
<button bottom="-17" enabled="true" follows="right|bottom" font="SansSerifSmall"
|
||||
halign="center" height="16"
|
||||
image_selected="status_buy_currency_pressed.tga"
|
||||
image_unselected="status_buy_currency.tga" label=""
|
||||
left="-220" mouse_opaque="true" name="buycurrency" scale_image="true"
|
||||
left="-340" mouse_opaque="true" name="buycurrency" scale_image="true"
|
||||
tool_tip="Buy currency" width="16" />
|
||||
<text type="string" length="12" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||
bottom="-20" disabled_color="TimeTextColor" drop_shadow_visible="true"
|
||||
enabled="true" follows="right|bottom" font="SansSerifSmall" h_pad="0"
|
||||
halign="right" height="18" left="-310" mouse_opaque="true" name="TimeText"
|
||||
halign="right" height="18" left="-430" mouse_opaque="true" name="TimeText"
|
||||
text_color="TimeTextColor" tool_tip="Current Time (Pacific)" v_pad="2" width="80">
|
||||
12:00 AM
|
||||
</text>
|
||||
|
||||
Reference in New Issue
Block a user