mirror of
https://github.com/SWG-Source/client-tools.git
synced 2026-07-13 22:01:07 -04:00
Added feature to use entertainer captcha percent from the server config
This commit is contained in:
@@ -267,7 +267,8 @@ m_userPort (0),
|
||||
m_acceptSceneCommand (false),
|
||||
m_stationId (static_cast<StationId>(ConfigFile::getKeyInt("Station", "stationId", 0))),
|
||||
m_taskConnection (0),
|
||||
m_weatherUpdateInterval (0)
|
||||
m_weatherUpdateInterval (0),
|
||||
m_entertainerCaptchaPercent (40)
|
||||
{
|
||||
uint16 taskConnectionPort = ConfigClientGame::getTaskConnectionPort();
|
||||
if(taskConnectionPort)
|
||||
@@ -687,6 +688,7 @@ void GameNetwork::receiveParametersMessage (const ParametersMessage & msg)
|
||||
{
|
||||
DEBUG_FATAL(s_instance == 0, ("GameNetwork not installed"));
|
||||
m_weatherUpdateInterval = msg.getWeatherUpdateInterval();
|
||||
m_entertainerCaptchaPercent = msg.getEntertainerCaptchaPercent();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@@ -860,6 +862,14 @@ int GameNetwork::getWeatherUpdateInterval()
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
int GameNetwork::getEntertainerCaptchaPercent()
|
||||
{
|
||||
DEBUG_FATAL(s_instance == 0, ("GameNetwork not installed"));
|
||||
return s_instance->m_entertainerCaptchaPercent;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
void GameNetwork::updateServerWithJediSlotInfo()
|
||||
{
|
||||
const CuiLoginManagerAvatarInfo * const avatarInfo = CuiLoginManager::findAvatarInfo(CuiLoginManager::getConnectedClusterId(), Game::getPlayerNetworkId());
|
||||
|
||||
@@ -110,6 +110,7 @@ public:
|
||||
static void setAcceptSceneCommand (bool b);
|
||||
|
||||
static int getWeatherUpdateInterval();
|
||||
static int getEntertainerCaptchaPercent();
|
||||
|
||||
static void updateServerWithJediSlotInfo();
|
||||
|
||||
@@ -153,6 +154,7 @@ private:
|
||||
StationId m_stationId;
|
||||
TaskConnection * m_taskConnection;
|
||||
int m_weatherUpdateInterval;
|
||||
int m_entertainerCaptchaPercent;
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
+16
-4
@@ -10,22 +10,34 @@
|
||||
|
||||
// ======================================================================
|
||||
|
||||
ParametersMessage::ParametersMessage(int weatherUpdateInterval) :
|
||||
ParametersMessage::ParametersMessage(int weatherUpdateInterval, int entertainerCaptchaPercent) :
|
||||
GameNetworkMessage("ParametersMessage"),
|
||||
m_weatherUpdateInterval(weatherUpdateInterval)
|
||||
m_weatherUpdateInterval(weatherUpdateInterval),
|
||||
m_entertainerCaptchaPercent(entertainerCaptchaPercent)
|
||||
{
|
||||
addVariable(m_weatherUpdateInterval);
|
||||
addVariable(m_entertainerCaptchaPercent);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
ParametersMessage::ParametersMessage(Archive::ReadIterator & source) :
|
||||
GameNetworkMessage("ParametersMessage"),
|
||||
m_weatherUpdateInterval()
|
||||
m_weatherUpdateInterval(),
|
||||
m_entertainerCaptchaPercent(40)
|
||||
{
|
||||
addVariable(m_weatherUpdateInterval);
|
||||
addVariable(m_entertainerCaptchaPercent);
|
||||
|
||||
unpack(source);
|
||||
unsigned short packedSize = 0;
|
||||
Archive::get(source, packedSize);
|
||||
|
||||
unsigned short unpackedSize = 0;
|
||||
std::vector<Archive::AutoVariableBase *>::iterator i;
|
||||
for(i = members.begin(); i != members.end() && unpackedSize < packedSize; ++i, ++unpackedSize)
|
||||
{
|
||||
(*i)->unpack(source);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
+10
-1
@@ -31,15 +31,17 @@
|
||||
class ParametersMessage : public GameNetworkMessage
|
||||
{
|
||||
public:
|
||||
ParametersMessage(int weatherUpdateInterval);
|
||||
ParametersMessage(int weatherUpdateInterval, int entertainerCaptchaPercent = 40);
|
||||
explicit ParametersMessage(Archive::ReadIterator & source);
|
||||
virtual ~ParametersMessage();
|
||||
|
||||
public:
|
||||
int getWeatherUpdateInterval() const;
|
||||
int getEntertainerCaptchaPercent() const;
|
||||
|
||||
private:
|
||||
Archive::AutoVariable<int> m_weatherUpdateInterval;
|
||||
Archive::AutoVariable<int> m_entertainerCaptchaPercent;
|
||||
|
||||
ParametersMessage();
|
||||
ParametersMessage(const ParametersMessage&);
|
||||
@@ -53,6 +55,13 @@ inline int ParametersMessage::getWeatherUpdateInterval() const
|
||||
return m_weatherUpdateInterval.get();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline int ParametersMessage::getEntertainerCaptchaPercent() const
|
||||
{
|
||||
return m_entertainerCaptchaPercent.get();
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
#endif
|
||||
|
||||
+2
-1
@@ -11,6 +11,7 @@
|
||||
#include "clientGame/ClientExpertiseManager.h"
|
||||
#include "clientGame/CreatureObject.h"
|
||||
#include "clientGame/Game.h"
|
||||
#include "clientGame/GameNetwork.h"
|
||||
#include "clientGame/ProsePackageManagerClient.h"
|
||||
#include "clientUserInterface/CuiManager.h"
|
||||
#include "clientUserInterface/CuiMessageBox.h"
|
||||
@@ -206,7 +207,7 @@ void SwgCuiBuffBuilderBuffer::OnButtonPressed( UIWidget *context )
|
||||
//send the update packet
|
||||
else if(context == m_acceptButton)
|
||||
{
|
||||
if(m_failedLastVerification || Random::random(1, 5) <= 2) // 40% chance
|
||||
if(m_failedLastVerification || Random::random(1, 100) <= GameNetwork::getEntertainerCaptchaPercent())
|
||||
{
|
||||
CuiStringVariablesData csvd;
|
||||
Object const * sourceObj = Game::getPlayer();
|
||||
|
||||
Reference in New Issue
Block a user