Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv9847
Modified Files:
Timing.cpp accounts.cpp accounts.h commands.cpp console.cpp
console.h console_win.cpp globals.cpp globals.h items.cpp
npc.cpp persistentbroker.cpp persistentbroker.h player.cpp
player.h speech.cpp srvparams.cpp srvparams.h wolf.dsp
wolfpack.cpp world.cpp wpdefmanager.cpp
Log Message:
Implemented saving of Accounts to the Database and cleaned up a lot of srvparams.h and globals.h
Index: Timing.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/Timing.cpp,v
retrieving revision 1.178
retrieving revision 1.179
diff -C2 -d -r1.178 -r1.179
*** Timing.cpp 7 Sep 2003 19:07:46 -0000 1.178
--- Timing.cpp 9 Sep 2003 23:09:30 -0000 1.179
***************
*** 66,78 ****
#define DBGFILE "Timing.cpp"
- void checktimers() // Check shutdown timers
- {
- if (endtime)
- {
- if (endtime <= uiCurrentTime) keeprun = 0;
- }
- lclock = uiCurrentTime;
- }
-
void restockNPC( UINT32 currenttime, P_NPC pc_i )
{
--- 66,69 ----
***************
*** 578,588 ****
}
- //Time functions
- if( uotickcount <= currenttime )
- {
- uoTime.addSecs(1);
- uotickcount = currenttime + SrvParams->secondsPerUOMinute()*MY_CLOCKS_PER_SEC;
- }
-
// Recalculate and Resend Lightlevel
if( lighttime <= currenttime )
--- 569,572 ----
***************
*** 711,722 ****
if( checknpcs <= currenttime ) checknpcs=(unsigned int)((double)(SrvParams->checkNPCTime()*MY_CLOCKS_PER_SEC+currenttime)); //lb
! if( checktamednpcs <= currenttime ) checktamednpcs=(unsigned int)((double) currenttime+(SrvParams->checkTammedTime()*MY_CLOCKS_PER_SEC)); //AntiChrist
if( checknpcfollow <= currenttime ) checknpcfollow=(unsigned int)((double) currenttime+(SrvParams->checkFollowTime()*MY_CLOCKS_PER_SEC)); //Ripper
if( checkitemstime <= currenttime ) checkitemstime=(unsigned int)((double)(SrvParams->checkItemTime()*MY_CLOCKS_PER_SEC+currenttime)); //lb
if( shoprestocktime <= currenttime )
shoprestocktime = currenttime + MY_CLOCKS_PER_SEC * 60 * 20;
-
- // Update the delay for the next field-effect (every 500ms)
- if( nextfieldeffecttime <= currenttime )
- nextfieldeffecttime = (unsigned int) ( currenttime + ( 0.5 * MY_CLOCKS_PER_SEC ) );
}
--- 695,702 ----
if( checknpcs <= currenttime ) checknpcs=(unsigned int)((double)(SrvParams->checkNPCTime()*MY_CLOCKS_PER_SEC+currenttime)); //lb
! if( checktamednpcs <= currenttime ) checktamednpcs=(unsigned int)((double) currenttime+(SrvParams->checkTamedTime()*MY_CLOCKS_PER_SEC)); //AntiChrist
if( checknpcfollow <= currenttime ) checknpcfollow=(unsigned int)((double) currenttime+(SrvParams->checkFollowTime()*MY_CLOCKS_PER_SEC)); //Ripper
if( checkitemstime <= currenttime ) checkitemstime=(unsigned int)((double)(SrvParams->checkItemTime()*MY_CLOCKS_PER_SEC+currenttime)); //lb
if( shoprestocktime <= currenttime )
shoprestocktime = currenttime + MY_CLOCKS_PER_SEC * 60 * 20;
}
Index: accounts.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/accounts.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -C2 -d -r1.64 -r1.65
*** accounts.cpp 9 Sep 2003 03:24:15 -0000 1.64
--- accounts.cpp 9 Sep 2003 23:09:30 -0000 1.65
***************
*** 32,55 ****
#include "accounts.h"
#include "srvparams.h"
- #include "pfactory.h"
#include "network/uosocket.h"
!
#include "commands.h"
#include "player.h"
#include "network.h"
- #include "exceptions.h"
#include "globals.h"
#include "world.h"
/*****************************************************************************
! AccountRecord member functions
*****************************************************************************/
! AccountRecord::AccountRecord()
: acl_(0), inUse_(false), flags_(0)
{
}
! void AccountRecord::Serialize( ISerialization& archive )
{
if ( archive.isReading() )
--- 32,55 ----
#include "accounts.h"
#include "srvparams.h"
#include "network/uosocket.h"
! #include "dbdriver.h"
! #include "console.h"
#include "commands.h"
#include "player.h"
#include "network.h"
#include "globals.h"
+ #include "persistentbroker.h"
#include "world.h"
/*****************************************************************************
! cAccount member functions
*****************************************************************************/
! cAccount::cAccount()
: acl_(0), inUse_(false), flags_(0)
{
}
! /*void cAccount::Serialize( ISerialization& archive )
{
if ( archive.isReading() )
***************
*** 87,93 ****
}
cSerializable::Serialize( archive );
! }
! bool AccountRecord::isBlocked() const
{
if ( (blockUntil.isValid() && blockUntil < QDateTime::currentDateTime()) || flags_&0x00000001 )
--- 87,93 ----
}
cSerializable::Serialize( archive );
! }*/
! bool cAccount::isBlocked() const
{
if ( (blockUntil.isValid() && blockUntil < QDateTime::currentDateTime()) || flags_&0x00000001 )
***************
*** 97,101 ****
}
! uint AccountRecord::secsToUnblock() const
{
if ( isBlocked() )
--- 97,101 ----
}
! uint cAccount::secsToUnblock() const
{
if ( isBlocked() )
***************
*** 106,110 ****
}
! bool AccountRecord::addCharacter( P_PLAYER d )
{
if( qFind( characters_.begin(), characters_.end(), d ) == characters_.end() )
--- 106,110 ----
}
! bool cAccount::addCharacter( P_PLAYER d )
{
if( qFind( characters_.begin(), characters_.end(), d ) == characters_.end() )
***************
*** 116,120 ****
}
! bool AccountRecord::removeCharacter( P_PLAYER d )
{
QValueVector<P_PLAYER>::iterator it = qFind( characters_.begin(), characters_.end(), d );
--- 116,120 ----
}
! bool cAccount::removeCharacter( P_PLAYER d )
{
QValueVector<P_PLAYER>::iterator it = qFind( characters_.begin(), characters_.end(), d );
***************
*** 127,131 ****
}
! bool AccountRecord::authorized( const QString& group, const QString& value ) const
{
// No Valid ACL specified
--- 127,131 ----
}
! bool cAccount::authorized( const QString& group, const QString& value ) const
{
// No Valid ACL specified
***************
*** 160,169 ****
}
! void AccountRecord::remove()
{
Accounts::instance()->remove( this );
}
! void cAccounts::remove( AccountRecord *record )
{
if( accounts.contains( record->login() ) )
--- 160,169 ----
}
! void cAccount::remove()
{
Accounts::instance()->remove( this );
}
! void cAccounts::remove( cAccount *record )
{
if( accounts.contains( record->login() ) )
***************
*** 172,206 ****
}
! void AccountRecord::refreshAcl()
{
acl_ = cCommands::instance()->getACL( aclName_ );
}
! bool AccountRecord::isAllMove() const
{
return flags_&0x00000002;
}
! bool AccountRecord::isAllShow() const
{
return flags_&0x00000004;
}
! bool AccountRecord::isShowSerials() const
{
return flags_&0x00000008;
}
! bool AccountRecord::isPageNotify() const
{
return flags_&0x00000010;
}
! bool AccountRecord::isStaff() const
{
return flags_&0x00000020;
}
! void AccountRecord::setBlocked( bool data )
{
if( data )
--- 172,206 ----
}
! void cAccount::refreshAcl()
{
acl_ = cCommands::instance()->getACL( aclName_ );
}
! bool cAccount::isAllMove() const
{
return flags_&0x00000002;
}
! bool cAccount::isAllShow() const
{
return flags_&0x00000004;
}
! bool cAccount::isShowSerials() const
{
return flags_&0x00000008;
}
! bool cAccount::isPageNotify() const
{
return flags_&0x00000010;
}
! bool cAccount::isStaff() const
{
return flags_&0x00000020;
}
! void cAccount::setBlocked( bool data )
{
if( data )
***************
*** 210,214 ****
}
! void AccountRecord::setAllMove( bool data )
{
if( data )
--- 210,214 ----
}
! void cAccount::setAllMove( bool data )
{
if( data )
***************
*** 218,222 ****
}
! void AccountRecord::setAllShow( bool data )
{
if( data )
--- 218,222 ----
}
! void cAccount::setAllShow( bool data )
{
if( data )
***************
*** 226,230 ****
}
! void AccountRecord::setShowSerials( bool data )
{
if( data )
--- 226,230 ----
}
! void cAccount::setShowSerials( bool data )
{
if( data )
***************
*** 234,238 ****
}
! void AccountRecord::setPageNotify( bool data )
{
if( data )
--- 234,238 ----
}
! void cAccount::setPageNotify( bool data )
{
if( data )
***************
*** 242,246 ****
}
! void AccountRecord::setStaff( bool data )
{
if( data )
--- 242,246 ----
}
! void cAccount::setStaff( bool data )
{
if( data )
***************
*** 263,271 ****
iterator it = accounts.begin();
for (; it != accounts.end(); ++it)
! delete it.data();
!
}
! AccountRecord* cAccounts::authenticate(const QString& login, const QString& password, enErrorCode* error) const
{
const_iterator it = accounts.find(login);
--- 263,270 ----
iterator it = accounts.begin();
for (; it != accounts.end(); ++it)
! delete it.data();
}
! cAccount* cAccounts::authenticate(const QString& login, const QString& password, enErrorCode* error) const
{
const_iterator it = accounts.find(login);
***************
*** 298,309 ****
else
{
- // it.data()->loginAttemped();
if( error )
*error = BadPassword;
! // Now we check for the number of attempts;
! // if ( it.data()->loginAttempts() > SrvParams->MaxLoginAttempts() )
! // {
! // it.data()->block(SrvParams->AccountBlockTime());
! // }
return 0;
}
--- 297,303 ----
else
{
if( error )
*error = BadPassword;
!
return 0;
}
***************
*** 319,353 ****
void cAccounts::save()
{
! ISerialization* archive = cPluginFactory::serializationArchiver( SrvParams->accountsArchiver());
! archive->prepareWritting("accounts");
! // Now save accounts
! iterator it = accounts.begin();
! for (; it != accounts.end(); ++it )
{
! archive->writeObject( it.data() );
}
! archive->close();
! delete archive;
}
void cAccounts::load()
{
! ISerialization* archive = cPluginFactory::serializationArchiver( SrvParams->accountsArchiver());
! archive->prepareReading("accounts");
! for (uint i = 0; i < archive->size(); ++i)
{
! QString objectID;
! archive->readObjectID( objectID );
! if ( objectID == "ACCOUNT" )
{
! AccountRecord* d = new AccountRecord;
! archive->readObject( d );
! accounts.insert( d->login(), d );
}
- else
- throw wpException( "Error parsing account records." );
}
! archive->close();
! delete archive;
}
--- 313,408 ----
void cAccounts::save()
{
! // Open the Account Driver
! if( !persistentBroker->openDriver( SrvParams->accountsDriver() ) )
{
! Console::instance()->log( LOG_ERROR, QString( "Unknown Account Database Driver '%1', check your wolfpack.xml").arg( SrvParams->accountsDriver() ) );
! return;
}
!
! bool connected = false;
!
! try
! {
! persistentBroker->connect( SrvParams->accountsHost(), SrvParams->accountsName(), SrvParams->accountsUsername(), SrvParams->accountsPassword() );
! connected = true;
!
! persistentBroker->executeQuery( "BEGIN;" );
!
! persistentBroker->executeQuery( "DELETE FROM accounts;" );
!
! iterator it = accounts.begin();
! for (; it != accounts.end(); ++it)
! {
! // INSERT
! cAccount *account = it.data();
!
! QString sql( "INSERT INTO accounts VALUES( '%1', '%2', %3, '%4', %5, %6 );" );
!
! sql = sql.arg( account->login_ ).arg( account->password_ ).arg( account->flags_ ).arg( account->aclName_ ).arg( !account->lastLogin_.isNull() ? account->lastLogin_.toTime_t() : 0 ).arg( !account->blockUntil.isNull() ? account->blockUntil.toTime_t() : 0 );
!
! persistentBroker->executeQuery( sql );
! }
!
! persistentBroker->executeQuery( "COMMIT;" );
! }
! catch( QString &error )
! {
! if( connected )
! persistentBroker->executeQuery( "ROLLBACK;" );
! Console::instance()->log( LOG_ERROR, QString( "Error while saving Accounts: %1." ).arg( error ) );
! }
! catch( ... )
! {
! if( connected )
! persistentBroker->executeQuery( "ROLLBACK;" );
! Console::instance()->log( LOG_ERROR, "Unknown error while saving Accounts." );
! }
}
void cAccounts::load()
{
! // Open the Account Driver
! if( !persistentBroker->openDriver( SrvParams->accountsDriver() ) )
{
! Console::instance()->log( LOG_ERROR, QString( "Unknown Account Database Driver '%1', check your wolfpack.xml").arg( SrvParams->accountsDriver() ) );
! return;
! }
!
! // Load all Accounts
! try
! {
! persistentBroker->connect( SrvParams->accountsHost(), SrvParams->accountsName(), SrvParams->accountsUsername(), SrvParams->accountsPassword() );
!
! cDBResult result = persistentBroker->query( "SELECT accounts.login,accounts.password,accounts.flags,accounts.acl,accounts.lastlogin,accounts.blockuntil FROM accounts;" );
!
! // Clear Accounts HERE
! // Here we can be pretty sure that we have a valid datasource for accounts
! clear();
!
! while( result.fetchrow() )
{
! cAccount *account = new cAccount;
! account->login_ = result.getString( 0 );
! account->password_ = result.getString( 1 );
! account->flags_ = result.getInt( 2 );
! account->aclName_ = result.getString( 3 );
! account->refreshAcl();
! if( result.getInt( 4 ) != 0 )
! account->lastLogin_.setTime_t( result.getInt( 4 ) );
!
! if( result.getInt( 5 ) != 0 )
! account->blockUntil.setTime_t( result.getInt( 5 ) );
!
! accounts.insert( account->login_, account );
}
}
! catch( QString &error )
! {
! Console::instance()->log( LOG_ERROR, QString( "Error while loading Accounts: %1" ).arg( error ) );
! }
! catch( ... )
! {
! Console::instance()->log( LOG_ERROR, "Unknown error while loading Accounts" );
! }
}
***************
*** 377,381 ****
}
- clear();
load();
--- 432,435 ----
***************
*** 396,405 ****
++sit;
}
-
}
! AccountRecord* cAccounts::createAccount( const QString& login, const QString& password )
{
! AccountRecord* d = new AccountRecord;
d->login_ = login;
d->password_ = password;
--- 450,458 ----
++sit;
}
}
! cAccount* cAccounts::createAccount( const QString& login, const QString& password )
{
! cAccount* d = new cAccount;
d->login_ = login;
d->password_ = password;
***************
*** 419,423 ****
}
! AccountRecord* cAccounts::getRecord( const QString& login )
{
iterator it = accounts.find( login );
--- 472,476 ----
}
! cAccount* cAccounts::getRecord( const QString& login )
{
iterator it = accounts.find( login );
Index: accounts.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/accounts.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** accounts.h 9 Sep 2003 03:24:15 -0000 1.30
--- accounts.h 9 Sep 2003 23:09:30 -0000 1.31
***************
*** 54,58 ****
class cAcl;
! class AccountRecord : public cSerializable
{
friend class cAccounts; // my manager
--- 54,58 ----
class cAcl;
! class cAccount
{
friend class cAccounts; // my manager
***************
*** 78,82 ****
public:
! AccountRecord();
QString login() const;
--- 78,82 ----
public:
! cAccount();
QString login() const;
***************
*** 105,111 ****
UINT32 flags() const;
QDateTime blockedUntil() const { return blockUntil; }
-
- void Serialize( ISerialization& );
- QString objectID( void ) const;
// Flag Setters/Getters
--- 105,108 ----
***************
*** 129,134 ****
{
private:
! QMap<QString, AccountRecord*> accounts;
! typedef QMap<QString, AccountRecord*>::iterator iterator;
public:
enum enErrorCode {LoginNotFound, BadPassword, Banned, Wipped, AlreadyInUse, NoError};
--- 126,131 ----
{
private:
! QMap<QString, cAccount*> accounts;
! typedef QMap<QString, cAccount*>::iterator iterator;
public:
enum enErrorCode {LoginNotFound, BadPassword, Banned, Wipped, AlreadyInUse, NoError};
***************
*** 136,145 ****
public:
~cAccounts();
! AccountRecord* authenticate(const QString& login, const QString& password, enErrorCode* = 0) const;
! AccountRecord* getRecord( const QString& );
! AccountRecord* createAccount( const QString& login, const QString& password );
uint count();
! void remove( AccountRecord *record );
void save();
--- 133,142 ----
public:
~cAccounts();
! cAccount* authenticate(const QString& login, const QString& password, enErrorCode* = 0) const;
! cAccount* getRecord( const QString& );
! cAccount* createAccount( const QString& login, const QString& password );
uint count();
! void remove( cAccount *record );
void save();
***************
*** 148,152 ****
void clear();
! typedef QMap<QString, AccountRecord*>::const_iterator const_iterator;
const_iterator begin() const { return accounts.begin(); }
const_iterator end() const { return accounts.end(); }
--- 145,149 ----
void clear();
! typedef QMap<QString, cAccount*>::const_iterator const_iterator;
const_iterator begin() const { return accounts.begin(); }
const_iterator end() const { return accounts.end(); }
***************
*** 154,228 ****
// inline members
! inline QString AccountRecord::acl() const
{
return aclName_;
}
! inline QString AccountRecord::login() const
{
return login_;
}
! inline QString AccountRecord::password() const
{
return password_;
}
! inline void AccountRecord::setPassword( const QString& data )
{
password_ = data;
}
! inline QValueVector<P_PLAYER> AccountRecord::caracterList() const
{
return characters_;
}
! inline QString AccountRecord::objectID( void ) const
! {
! return "ACCOUNT";
! }
!
! inline void AccountRecord::setAcl( const QString &d )
{
aclName_ = d;
}
! inline void AccountRecord::block( int seconds )
{
blockUntil = QDateTime::currentDateTime().addSecs( seconds );
}
! inline QDateTime AccountRecord::lastLogin() const
{
return lastLogin_;
}
! inline UINT32 AccountRecord::flags() const
{
return flags_;
}
! inline void AccountRecord::setLastLogin( const QDateTime& d )
{
lastLogin_ = d;
}
! inline bool AccountRecord::inUse() const
{
return inUse_;
}
! inline void AccountRecord::setInUse( bool data )
{
inUse_ = data;
}
! inline void AccountRecord::setBlockUntil( const QDateTime &d )
{
blockUntil = d;
}
! inline void AccountRecord::setFlags( UINT32 data )
{
flags_ = data;
--- 151,220 ----
// inline members
! inline QString cAccount::acl() const
{
return aclName_;
}
! inline QString cAccount::login() const
{
return login_;
}
! inline QString cAccount::password() const
{
return password_;
}
! inline void cAccount::setPassword( const QString& data )
{
password_ = data;
}
! inline QValueVector<P_PLAYER> cAccount::caracterList() const
{
return characters_;
}
! inline void cAccount::setAcl( const QString &d )
{
aclName_ = d;
}
! inline void cAccount::block( int seconds )
{
blockUntil = QDateTime::currentDateTime().addSecs( seconds );
}
! inline QDateTime cAccount::lastLogin() const
{
return lastLogin_;
}
! inline UINT32 cAccount::flags() const
{
return flags_;
}
! inline void cAccount::setLastLogin( const QDateTime& d )
{
lastLogin_ = d;
}
! inline bool cAccount::inUse() const
{
return inUse_;
}
! inline void cAccount::setInUse( bool data )
{
inUse_ = data;
}
! inline void cAccount::setBlockUntil( const QDateTime &d )
{
blockUntil = d;
}
! inline void cAccount::setFlags( UINT32 data )
{
flags_ = data;
Index: commands.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/commands.cpp,v
retrieving revision 1.200
retrieving revision 1.201
diff -C2 -d -r1.200 -r1.201
*** commands.cpp 9 Sep 2003 03:24:15 -0000 1.200
--- commands.cpp 9 Sep 2003 23:09:30 -0000 1.201
***************
*** 409,413 ****
else
{
! AccountRecord *account = Accounts::instance()->getRecord( args[1].left( 30 ) );
QValueVector<P_PLAYER> characters = account->caracterList();
Accounts::instance()->remove( account );
--- 409,413 ----
else
{
! cAccount *account = Accounts::instance()->getRecord( args[1].left( 30 ) );
QValueVector<P_PLAYER> characters = account->caracterList();
Accounts::instance()->remove( account );
***************
*** 434,438 ****
else
{
! AccountRecord *account = Accounts::instance()->getRecord( args[1].left( 30 ) );
QString key = args[2];
QString value = args[3];
--- 434,438 ----
else
{
! cAccount *account = Accounts::instance()->getRecord( args[1].left( 30 ) );
QString key = args[2];
QString value = args[3];
***************
*** 502,506 ****
else
{
! AccountRecord *account = Accounts::instance()->getRecord( args[1].left( 30 ) );
QString key = args[2];
--- 502,506 ----
else
{
! cAccount *account = Accounts::instance()->getRecord( args[1].left( 30 ) );
QString key = args[2];
Index: console.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/console.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** console.cpp 8 Sep 2003 23:38:49 -0000 1.2
--- console.cpp 9 Sep 2003 23:09:30 -0000 1.3
***************
*** 247,248 ****
--- 247,256 ----
return true;
}
+
+ void cConsole::queueCommand( const QString &command )
+ {
+ commandMutex.lock();
+ commandQueue.push_back( command );
+ commandMutex.unlock();
+ }
+
Index: console.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/console.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** console.h 9 Sep 2003 15:17:07 -0000 1.3
--- console.h 9 Sep 2003 23:09:30 -0000 1.4
***************
*** 42,45 ****
--- 42,46 ----
#include <qstringlist.h>
#include <qstring.h>
+ #include <qmutex.h>
// Third Party includes
***************
*** 74,77 ****
--- 75,81 ----
QStringList linebuffer_;
QString incompleteLine_;
+ QStringList commandQueue;
+ QMutex commandMutex;
+
public:
cConsole();
***************
*** 100,107 ****
virtual void ChangeColor( WPC_ColorKeys Color );
virtual void setConsoleTitle( const QString& data );
-
QStringList linebuffer() const { return linebuffer_; }
!
! bool handleCommand( const QString &command, bool silentFail = false );
virtual void start();
virtual void poll();
--- 104,110 ----
virtual void ChangeColor( WPC_ColorKeys Color );
virtual void setConsoleTitle( const QString& data );
QStringList linebuffer() const { return linebuffer_; }
! void queueCommand( const QString &command ); // Thread-Safe
!
virtual void start();
virtual void poll();
***************
*** 114,117 ****
--- 117,121 ----
std::ostream *outputstrm;
bool bEnabled;
+ bool handleCommand( const QString &command, bool silentFail = false );
};
Index: console_win.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/console_win.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** console_win.cpp 9 Sep 2003 15:33:07 -0000 1.6
--- console_win.cpp 9 Sep 2003 23:09:30 -0000 1.7
***************
*** 84,87 ****
--- 84,90 ----
LRESULT CALLBACK wpWindowProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
+ if( mainWindow && hwnd != mainWindow )
+ return DefWindowProc( hwnd, msg, wparam, lparam );
+
CHARFORMAT cf;
LOGFONT lfont;
***************
*** 201,204 ****
--- 204,211 ----
return 0;
+ case WM_CLOSE:
+ keeprun = 0;
+ return 1;
+
case WM_DESTROY:
keeprun = 0;
***************
*** 336,342 ****
GetWindowText( inputWindow, command, 512 );
SetWindowText( inputWindow, "" );
!
! // Process Command
! Console::instance()->handleCommand( command );
}
--- 343,349 ----
GetWindowText( inputWindow, command, 512 );
SetWindowText( inputWindow, "" );
!
! // We are in a different Thread. Remember that.
! Console::instance()->queueCommand( command );
}
***************
*** 361,364 ****
--- 368,382 ----
void cConsole::poll()
{
+ // Poll for new Commands
+ commandMutex.lock();
+ QStringList commands = commandQueue;
+ commandQueue.clear();
+ commandMutex.unlock();
+
+ while( commands.count() > 0 )
+ {
+ handleCommand( commands.front() );
+ commands.pop_front();
+ }
}
***************
*** 520,521 ****
--- 538,540 ----
SendMessage( logWindow, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf );
}
+
Index: globals.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/globals.cpp,v
retrieving revision 1.102
retrieving revision 1.103
diff -C2 -d -r1.102 -r1.103
*** globals.cpp 9 Sep 2003 03:24:15 -0000 1.102
--- globals.cpp 9 Sep 2003 23:09:30 -0000 1.103
***************
*** 50,146 ****
#include <qdatetime.h>
-
- using namespace std;
-
enServerState serverState;
!
! // Instantiate our console object
! cConsole clConsole;
!
! time_t oldtime, newtime;
!
! unsigned int polyduration=90;
!
! //Time variables
QDateTime uoTime;
! int secondsperuominute=5; //Number of seconds for a WOLFPACK minute.
! int uotickcount=1;
! unsigned long initialserversec ;
! unsigned long initialservermill ;
! //int goldamount;
! unsigned int nextfieldeffecttime=0;
! unsigned int nextnpcaitime=0;
!
! // MSVC fails to compile WOLFPACK if this is unsigned, change it then
! int autosaved, saveinterval;
! int dosavewarning=0;
! bool heartbeat;
!
! int err, error;
volatile int keeprun;
- //int now;
-
- int secure; // Secure mode
-
- // - the below structure is for looking up items based on serial #
- // - item's serial, owner's serial, char's serial, and container's serial
-
- unsigned int raindroptime;
-
- int tnum;
-
- unsigned int starttime, endtime, lclock;
-
- unsigned int shoprestocktime=0;
-
- //int *spawnedguards;
- // Profiling
- int networkTime = 0;
- int timerTime = 0;
- int autoTime = 0;
- int loopTime = 0;
- int networkTimeCount = 1000;
- int timerTimeCount = 1000;
- int autoTimeCount = 1000;
- int loopTimeCount = 1000;
-
- unsigned long int serverstarttime;
-
- // Script files that need to be cached
- // Crackerjack Jul 31/99
-
- int escortRegions = 0;
-
-
- unsigned int hungerdamagetimer=0; // For hunger damage
-
- //-=-=-=-=-=-=-Classes Definitions=-=-=-=-=-=//
cSrvParams *SrvParams;
Maps *Map;
cSkills *Skills;
cSpeech *Speech;
- cBounty *Bounty;
cScriptManager *ScriptManager;
WPDefManager *DefManager;
PersistentBroker* persistentBroker;
!
! // - the below structure is for looking up items based on serial #
! // - item's serial, owner's serial, char's serial, and container's serial
!
! list<SERIAL> guilds;
!
! /******************************************************/
!
! ///////////////////////////////////////////
! /// and the rest /
! ///////////////////////////////////////////
! std::vector<std::string> clientsAllowed; // client version controll system
!
! /////////////////////////////////////////
! ///////////// global string vars /////////
! /////////////////////////////////////////
!
! char temp[1024];
--- 50,72 ----
#include <qdatetime.h>
enServerState serverState;
! time_t oldtime;
! time_t newtime;
QDateTime uoTime;
! int autosaved;
! int secure = 1;
! int dosavewarning = 0;
volatile int keeprun;
+ unsigned int shoprestocktime = 0;
+ unsigned int hungerdamagetimer = 0;
cSrvParams *SrvParams;
Maps *Map;
cSkills *Skills;
cSpeech *Speech;
cScriptManager *ScriptManager;
WPDefManager *DefManager;
PersistentBroker* persistentBroker;
! char temp[1024];
Index: globals.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/globals.h,v
retrieving revision 1.76
retrieving revision 1.77
diff -C2 -d -r1.76 -r1.77
*** globals.h 9 Sep 2003 03:24:16 -0000 1.76
--- globals.h 9 Sep 2003 23:09:30 -0000 1.77
***************
*** 32,37 ****
#if !defined(__GLOBALS_H__)
#define __GLOBALS_H__
! // Platform specifics
#include "platform.h"
// System Includes
--- 32,39 ----
#if !defined(__GLOBALS_H__)
#define __GLOBALS_H__
!
! // Wolfpack Includes
#include "platform.h"
+ #include "structs.h"
// System Includes
***************
*** 44,118 ****
#include <termios.h>
#endif
- // Third Party
-
-
- //Forward Class Declaration
class QDateTime;
class cScriptManager;
class WPDefManager;
- #include "structs.h"
-
// Global Variables
-
extern enServerState serverState;
-
extern unsigned int uiCurrentTime;
- extern unsigned int raindroptime;
- extern unsigned int polyduration;
- //extern wp_version_info wp_version;
-
- //Time variables
extern QDateTime uoTime;
- extern int uotickcount;
-
- //extern int goldamount;
- extern unsigned int nextfieldeffecttime;
extern unsigned int nextnpcaitime;
extern int autosaved, dosavewarning;
- extern int err, error;
extern volatile int keeprun;
- //extern int now;
- extern int secure; // Secure mode
! extern unsigned int starttime, endtime, lclock;
extern unsigned int shoprestocktime;
extern unsigned int hungerdamagetimer; // Used for hunger damage
- // Profiling
- extern int networkTime;
- extern int timerTime;
- extern int autoTime;
- extern int loopTime;
- extern int networkTimeCount;
- extern int timerTimeCount;
- extern int autoTimeCount;
- extern int loopTimeCount;
-
- extern unsigned long int serverstarttime;
-
- extern unsigned long initialserversec;
- extern unsigned long initialservermill ;
-
-
-
- // - the below structure is for looking up items based on serial #
- // - item's serial, owner's serial, char's serial, and container's serial
-
- extern std::list<SERIAL> guilds;
-
- /******************************************************/
-
- /////////////////////////////////////////
- ///////////// global string vars /////////
- /////////////////////////////////////////
extern char temp[1024];
- // Forward declarations
class cSrvParams;
class cBoat;
--- 46,73 ----
#include <termios.h>
#endif
+ // Forward Class Declaration
class QDateTime;
class cScriptManager;
class WPDefManager;
// Global Variables
extern enServerState serverState;
extern unsigned int uiCurrentTime;
extern QDateTime uoTime;
extern unsigned int nextnpcaitime;
extern int autosaved, dosavewarning;
extern volatile int keeprun;
! extern int secure; // Secure mode
extern unsigned int shoprestocktime;
extern unsigned int hungerdamagetimer; // Used for hunger damage
extern char temp[1024];
class cSrvParams;
class cBoat;
***************
*** 120,142 ****
class Maps;
class cSkills;
- class cTargets;
- class cMovement;
class cSpeech;
- class cBounty;
- class cAccounts;
class PersistentBroker;
- //-=-=-=-=-=-=-Classes Definitions=-=-=-=-=-=//
extern cSrvParams *SrvParams;
extern Maps *Map;
extern cSkills *Skills;
extern cSpeech *Speech;
- extern cBounty *Bounty;
extern cScriptManager *ScriptManager;
extern WPDefManager *DefManager;
extern PersistentBroker *persistentBroker;
- // END
- //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-//
-
#endif
--- 75,88 ----
Index: items.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/items.cpp,v
retrieving revision 1.348
retrieving revision 1.349
diff -C2 -d -r1.348 -r1.349
*** items.cpp 8 Sep 2003 10:58:47 -0000 1.348
--- items.cpp 9 Sep 2003 23:09:30 -0000 1.349
***************
*** 1877,1883 ****
World::instance()->registerObject( pi );
- if( pi->objectID() == "cGuildStone" ) // register as guild as well
- guilds.push_back(pi->serial());
-
// Set the outside indices
pi->SetSpawnSerial( pi->spawnserial );
--- 1877,1880 ----
Index: npc.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/npc.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** npc.cpp 9 Sep 2003 17:22:55 -0000 1.42
--- npc.cpp 9 Sep 2003 23:09:30 -0000 1.43
***************
*** 645,651 ****
if( mSock->player() && mSock->player()->inRange( this, mSock->player()->visualRange() ) )
{
! if( SrvParams->showDeathAnim() )
! mSock->send( &dAction );
!
mSock->send( &rObject );
}
--- 645,649 ----
if( mSock->player() && mSock->player()->inRange( this, mSock->player()->visualRange() ) )
{
! mSock->send( &dAction );
mSock->send( &rObject );
}
Index: persistentbroker.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/persistentbroker.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** persistentbroker.cpp 9 Sep 2003 03:24:16 -0000 1.26
--- persistentbroker.cpp 9 Sep 2003 23:09:30 -0000 1.27
***************
*** 117,140 ****
bool PersistentBroker::saveObject( PersistentObject* object )
{
! // Start Transaction
! if( sqlite )
! connection->exec( "BEGIN TRANSACTION;" );
!
! try
! {
! object->save();
! }
! catch( ... )
! {
! // Rollback
! if( sqlite )
! connection->exec( "ROLLBACK TRANSACTION;" );
! throw;
! }
!
! // Commit
! if( sqlite )
! connection->exec( "COMMIT TRANSACTION;" );
!
return true;
}
--- 117,121 ----
bool PersistentBroker::saveObject( PersistentObject* object )
{
! object->save();
return true;
}
***************
*** 233,235 ****
--- 214,234 ----
{
connection->unlockTable( table );
+ }
+
+ void PersistentBroker::startTransaction()
+ {
+ if( sqlite )
+ executeQuery( "BEGIN;" );
+ }
+
+ void PersistentBroker::commitTransaction()
+ {
+ if( sqlite )
+ executeQuery( "END;" );
+ }
+
+ void PersistentBroker::rollbackTransaction()
+ {
+ if( sqlite )
+ executeQuery( "ROLLBACK;" );
}
Index: persistentbroker.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/persistentbroker.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** persistentbroker.h 31 Aug 2003 18:47:26 -0000 1.22
--- persistentbroker.h 9 Sep 2003 23:09:30 -0000 1.23
***************
*** 83,86 ****
--- 83,90 ----
QString lastError() const;
cDBDriver* driver() const;
+
+ void startTransaction();
+ void commitTransaction();
+ void rollbackTransaction();
};
Index: player.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/player.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** player.cpp 8 Sep 2003 10:58:47 -0000 1.37
--- player.cpp 9 Sep 2003 23:09:30 -0000 1.38
***************
*** 645,651 ****
if( mSock->player() && mSock->player()->inRange( this, mSock->player()->visualRange() ) && ( mSock != socket_ ) )
{
! if( SrvParams->showDeathAnim() )
! mSock->send( &dAction );
!
mSock->send( &rObject );
}
--- 645,649 ----
if( mSock->player() && mSock->player()->inRange( this, mSock->player()->visualRange() ) && ( mSock != socket_ ) )
{
! mSock->send( &dAction );
mSock->send( &rObject );
}
Index: player.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/player.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** player.h 5 Sep 2003 00:03:45 -0000 1.22
--- player.h 9 Sep 2003 23:09:30 -0000 1.23
***************
*** 116,120 ****
// getters
! AccountRecord* account() const;
UINT32 additionalFlags() const;
UINT32 clientIdleTime() const;
--- 116,120 ----
// getters
! cAccount* account() const;
UINT32 additionalFlags() const;
UINT32 clientIdleTime() const;
***************
*** 142,146 ****
// setters
! void setAccount(AccountRecord* data, bool moveFromAccToAcc = true);
void setAdditionalFlags(UINT32 data);
void setClientIdleTime(UINT32 data);
--- 142,146 ----
// setters
! void setAccount(cAccount* data, bool moveFromAccToAcc = true);
void setAdditionalFlags(UINT32 data);
void setClientIdleTime(UINT32 data);
***************
*** 184,188 ****
// The account object including this char.
// cOldChar::account_
! AccountRecord* account_;
// time till char will be logged out
--- 184,188 ----
// The account object including this char.
// cOldChar::account_
! cAccount* account_;
// time till char will be logged out
***************
*** 242,251 ****
};
! inline AccountRecord* cPlayer::account() const
{
return account_;
}
! inline void cPlayer::setAccount(AccountRecord* data, bool moveFromAccToAcc)
{
if( moveFromAccToAcc && account_ != 0 )
--- 242,251 ----
};
! inline cAccount* cPlayer::account() const
{
return account_;
}
! inline void cPlayer::setAccount(cAccount* data, bool moveFromAccToAcc)
{
if( moveFromAccToAcc && account_ != 0 )
Index: speech.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/speech.cpp,v
retrieving revision 1.157
retrieving revision 1.158
diff -C2 -d -r1.157 -r1.158
*** speech.cpp 8 Sep 2003 10:58:47 -0000 1.157
--- speech.cpp 9 Sep 2003 23:09:30 -0000 1.158
***************
*** 737,753 ****
pChar->setSaycolor( color );
- if( SrvParams->speechLog() )
- {
- QFile lFile( "speech.log" );
-
- if( lFile.open( IO_Append ) )
- {
- QString logMessage( "[%1] %2: %3 [%4, 0x%5]" );
- logMessage = logMessage.arg( QDateTime::currentDateTime().toString() ).arg( pChar->name() ).arg( speech ).arg( pChar->account()->login() ).arg( pChar->serial(), 8, 16 );
- lFile.writeBlock( logMessage.latin1(), logMessage.length() );
- lFile.close();
- }
- }
-
if( pChar->onTalk( type, color, font, speech, lang ) )
return;
--- 737,740 ----
Index: srvparams.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/srvparams.cpp,v
retrieving revision 1.87
retrieving revision 1.88
diff -C2 -d -r1.87 -r1.88
*** srvparams.cpp 5 Sep 2003 00:03:45 -0000 1.87
--- srvparams.cpp 9 Sep 2003 23:09:30 -0000 1.88
***************
*** 101,117 ****
{
// Account Group
! autoAccountCreate_ = getBool("Accounts", "Auto Create", false, true);
! autoAccountReload_ = getNumber("Accounts", "Auto Reload", 10, true);
! checkCharAge_ = getBool("Accounts", "Check Delete Age", true, true);
! maxLoginAttempts_ = getNumber("Accounts", "Max Login Attempts", 5, true);
! resetAttemptCount_ = getNumber("Accounts", "Reset Attempts Count", 3*60, true);
! accountsBlockTime_ = getNumber("Accounts", "Block Failed Logins", 3*60, true);
! accountsArchiver_ = getString("Accounts", "Archiver Module", "xml", true);
!
// AI
! checkAITime_ = getDouble("AI", "Default AI Check Time", 1.2, true);
! stablemasterRefreshTime_ = getNumber( "AI", "Refresh time in sec (Stablemasters)", 60, true );
! stablemasterGoldPerRefresh_ = getDouble( "AI", "Gold cost per refresh cycle (Stablemaster)", 0.2, true );
! animalWildFleeRange_ = getNumber("AI", "Wild animals flee range", 8, true );
// Persistency
--- 101,114 ----
{
// Account Group
! autoAccountCreate_ = getBool("Accounts", "Auto Create", false, true );
! accountsDriver_ = getString( "Accounts", "Database Driver", "sqlite", true );
! accountsHost_ = getString( "Accounts", "Database Host", "", true );
! accountsName_ = getString( "Accounts", "Database Name", "accounts.db", true );
! accountsUsername_ = getString( "Accounts", "Database Username", "", true );
! accountsPassword_ = getString( "Accounts", "Database Password", "", true );
!
// AI
! checkAITime_ = getDouble( "AI", "Default AI Check Time", 1.2, true );
! animalWildFleeRange_ = getNumber( "AI", "Wild animals flee range", 8, true );
// Persistency
***************
*** 131,135 ****
checkItemTime_ = getDouble("Game Speed", "Items Check Time", 1.1, true);
checkNPCTime_ = getDouble("Game Speed", "NPCs Check Time", 1.0, true);
! checkTammedTime_ = getDouble("Game Speed", "Tamed Check Time", 0.5, true);
niceLevel_ = getNumber("Game Speed", "Nice Level", 2, true);
skillDelay_ = getNumber("Game Speed", "SkillDelay", 7, true);
--- 128,132 ----
checkItemTime_ = getDouble("Game Speed", "Items Check Time", 1.1, true);
checkNPCTime_ = getDouble("Game Speed", "NPCs Check Time", 1.0, true);
! checkTamedTime_ = getDouble("Game Speed", "Tamed Check Time", 0.5, true);
niceLevel_ = getNumber("Game Speed", "Nice Level", 2, true);
skillDelay_ = getNumber("Game Speed", "SkillDelay", 7, true);
***************
*** 143,147 ****
snoopdelay_ = getNumber("Game Speed", "Snoop Delay", 7, true);
housedecay_secs_ = getNumber("Game Speed", "House Decay-Sec.", 604800, true);
- default_jail_time_ = getNumber("Game Speed", "Default Jail Time", 86400, true);
spawnRegionCheckTime_ = getNumber("Game Speed", "SpawnRegion Check Time", 300, true);
itemDecayTime_ = getNumber("Game Speed", "Item Decay Time", 300, true);
--- 140,143 ----
***************
*** 149,159 ****
secondsPerUOMinute_ = getNumber("Game Speed", "Seconds Per UO Minute", 5, true);
- beggingTime_ = getNumber("Game Speed", "Begging Time", 120, true);
- checkTammedTime_ = getDouble("Game Speed", "Tamed Check Time", 1.0, true);
npcMoveTime_ = getDouble("Game Speed", "NPC Move Time", 3.0, true );
tamedNpcMoveTime_ = getDouble("Game Speed", "Tamed NPC Move Time", 0.6, true );
// General Group
! showSkillTitles_ = getBool("General", "ShowSkillTitles", true, true );
skillcap_ = getNumber("General", "SkillCap", 700, true);
statcap_ = getNumber("General", "StatsCap", 300, true);
--- 145,153 ----
secondsPerUOMinute_ = getNumber("Game Speed", "Seconds Per UO Minute", 5, true);
npcMoveTime_ = getDouble("Game Speed", "NPC Move Time", 3.0, true );
tamedNpcMoveTime_ = getDouble("Game Speed", "Tamed NPC Move Time", 0.6, true );
// General Group
! showSkillTitles_ = getBool("General", "ShowSkillTitles", true, true );
skillcap_ = getNumber("General", "SkillCap", 700, true);
statcap_ = getNumber("General", "StatsCap", 300, true);
***************
*** 161,185 ****
skillAdvanceModifier_ = getNumber("General", "Skill Advance Modifier", 1000, true);
statsAdvanceModifier_ = getNumber("General", "Stats Advance Modifier", 500, true);
- bgSound_ = getNumber("General", "BackGround Sound Chance", 2, true);
stealing_ = getBool("General", "Stealing Enabled", true, true);
guardsActive_ = getBool("General", "Guards Enabled", true, true);
- partMsg_ = getBool("General", "PartMessage", true, true);
- joinMsg_ = getBool("General", "JoinMessage", true, true);
saveSpawns_ = getBool("General", "Save Spawned Regions", true, true);
- stablingFee_ = getDouble("General", "StablingFee", 0.25, true);
- announceWorldSaves_ = getBool("General", "Announce WorldSaves", true, true);
- goldWeight_ = getDouble("General", "Gold Weight", 0.001000, true);
lootdecayswithcorpse_ = getBool("General", "Loot Decays With Corpse", true, true);
invisTimer_ = getDouble("General", "InvisTimer", 60, true);
bandageInCombat_ = getBool("General", "Bandage In Combat", true, true);
- gateTimer_ = getDouble("General", "GateTimer", 30, true);
- inactivityTimeout_ = getNumber("General", "Inactivity Timeout", 300, true);
- showDeathAnim_ = getNumber("General", "Show Death Animation", 1, true);
poisonTimer_ = getNumber("General", "PoisonTimer", 180, true);
- serverLog_ = getBool("General", "Server Log", false, true);
- speechLog_ = getBool("General", "Speech Log", false, true);
- pvpLog_ = getBool("General", "PvP Log", false, true);
- gmLog_ = getBool("General", "GM Log", false, true);
- backupSaveRatio_ = getNumber("General", "Backup Save Ratio", 1, true);
hungerDamage_ = getNumber("General", "Hunger Damage", 0, true);
persecute_ = getNumber("General", "Persecution", 1, true);
--- 155,165 ----
***************
*** 187,247 ****
houseInTown_ = getNumber("General", "House In Town", 0, true);
shopRestock_ = getNumber("General", "Shop Restock", 1, true);
- badNpcsRed_ = getNumber("General", "Bad Npcs Red", 1, true);
- slotAmount_ = getNumber("General", "Slot Amount", 5, true);
- hungeraffectsskills_ = getBool("General", "Hunger affects Skills", true, true);
- belowminskillfails_ = getBool("General", "Below Min Skill Fails", false, true);
- escortactive_ = getNumber("General", "Escort Active", 1, true);
- escortinitexpire_ = getNumber("General", "Escorting Expire", 86400, true);
- escortactiveexpire_ = getNumber("General", "Escort Active Expire", 1800, true);
- escortdoneexpire_ = getNumber("General", "Escort Done Expire", 1800, true);
- bountysactive_ = getNumber("General", "Bounty Active", 1, true);
- bountysexpire_ = getNumber("General", "Bounty Expire", 0, true);
quittime_ = getNumber("General", "Char Time Out", 300, true);
- errors_to_console_ = getNumber("General", "Errors To Console", 0, true);
- showCVCS_ = getNumber("General", "Show CVCS", 0, true);
cacheMulFiles_ = getBool ("General", "Cache Mul Files", true, true);
- beggingRange_ = getNumber("General", "Begging Range", 3, true);
- clientsAllowed_ = QStringList::split(",", getString("General", "Allowed Clients", "SERVER_DEFAULT", true).upper());
categoryTagAddMenu_ = getBool ("General", "Build AddMenu by Category Tags", true, true);
// We're saving the elapsed seconds since server-start (INGAME SECONDS!)
// fromString( QString::number(FIRST_YEAR) + "-" + getString("General", "Initial Date/Time", "01-18T01:00:00", true), Qt::ISODate);
uoTime.setTime_t( getNumber( "General", "UO Time", 0, true ) );
saveInterval_ = getNumber("General", "Save Interval", 900, true);
- heartBeat_ = getBool("General", "HeartBeat", false, true);
- defaultpriv2_ = getNumber("General", "DefaultPrivileage2", 0, true);
mulPath_ = QDir::convertSeparators( getString("General", "MulPath", "./muls/", true) );
logPath_ = QDir::convertSeparators( getString("General", "LogPath", "./logs/", true ) );
// Network
! loginPort_ = getNumber( "Network", "Loginserver Port", 2593, true );
! gamePort_ = getNumber( "Network", "Gameserver Port", 2592, true );
! enableLogin_ = getBool( "Network", "Enable Loginserver", true, true );
! enableGame_ = getBool( "Network", "Enable Gameserver", true, true );
! allowUnencryptedClients_ = getBool("Network", "Allow Unencrypted Clients", true, true );
// Combat
- combatHitMessage_ = getBool("Combat", "Hit Message", true, true );
- maxAbsorbtion_ = getNumber("Combat", "Max Absorbtion", 20, true );
- maxnohabsorbtion_ = getNumber("Combat", "Max Non Human Absorbtion", 100, true );
- monsters_vs_animals_ = getNumber("Combat", "Monsters vs Animals", 0, true );
- animals_attack_chance_ = getNumber("Combat", "Animals Attack Chance", 15, true );
- animals_guarded_ = getNumber("Combat", "Animals Guarded", 0, true );
- npcdamage_ = getNumber("Combat", "Npc Damage", 2, true );
- npc_base_fleeat_ = getNumber("Combat", "Npc Base Flee At", 20, true );
- npc_base_reattackat_ = getNumber("Combat", "Npc Base Reattack At", 40, true );
attackstamina_ = getNumber("Combat", "Attack Stamina", -2, true );
attack_distance_ = getNumber("Combat", "Attack Distance", 13, true );
- // Vendor
- sellbyname_ = getNumber("Vendor", "Sell By Name", 1, true );
- sellmaxitem_ = getNumber("Vendor", "Sell Max Item", 5, true );
- trade_system_ = getNumber("Vendor", "Trade System", 0, true );
- rank_system_ = getNumber("Vendor", "Rank System", 0, true );
- checkBank_ = getNumber("Vendor", "Check Bank", 2000, true );
- vendorGreet_ = getNumber("Vendor", "Vendor Greet", 1, true );
- showNpcTitles_ = getNumber("Vendor", "Show Npc Titles", 1, true);
-
// Regenerate
hitpointrate_ = getNumber("Regenerate", "Hitpoints Regenerate", 8, true);
--- 167,197 ----
houseInTown_ = getNumber("General", "House In Town", 0, true);
shopRestock_ = getNumber("General", "Shop Restock", 1, true);
quittime_ = getNumber("General", "Char Time Out", 300, true);
cacheMulFiles_ = getBool ("General", "Cache Mul Files", true, true);
categoryTagAddMenu_ = getBool ("General", "Build AddMenu by Category Tags", true, true);
+ showNpcTitles_ = getNumber("General", "Show Npc Titles", 1, true);
// We're saving the elapsed seconds since server-start (INGAME SECONDS!)
// fromString( QString::number(FIRST_YEAR) + "-" + getString("General", "Initial Date/Time", "01-18T01:00:00", true), Qt::ISODate);
+ /*
+ NOTE: This SHOULD be saved in the worldsave instead
+ */
uoTime.setTime_t( getNumber( "General", "UO Time", 0, true ) );
saveInterval_ = getNumber("General", "Save Interval", 900, true);
mulPath_ = QDir::convertSeparators( getString("General", "MulPath", "./muls/", true) );
logPath_ = QDir::convertSeparators( getString("General", "LogPath", "./logs/", true ) );
// Network
! loginPort_ = getNumber( "Network", "Loginserver Port", 2593, true );
! gamePort_ = getNumber( "Network", "Gameserver Port", 2592, true );
! enableLogin_ = getBool( "Network", "Enable Loginserver", true, true );
! enableGame_ = getBool( "Network", "Enable Gameserver", true, true );
! allowUnencryptedClients_ = getBool( "Network", "Allow Unencrypted Clients", true, true );
// Combat
attackstamina_ = getNumber("Combat", "Attack Stamina", -2, true );
attack_distance_ = getNumber("Combat", "Attack Distance", 13, true );
// Regenerate
hitpointrate_ = getNumber("Regenerate", "Hitpoints Regenerate", 8, true);
***************
*** 253,262 ****
resourceitemdecaytime_ = getNumber("Resources", "ResourceItem Decay Time (not empty)", 60*60*12, true);
- // Tracking
- baserange_ = getNumber("Tracking", "Base Tracking Range", 10, true);
- maxtargets_ = getNumber("Tracking", "Max Tracking Targets", 20, true);
- basetimer_ = getNumber("Tracking", "Base Tracking Time", 5, true);
- redisplaytime_ = getNumber("Tracking", "Tracking Message Redisplay Time", 5, true);
-
// Light
worldBrightLevel_ = getNumber("Light", "World Bright Level", 1, true);
--- 203,206 ----
***************
*** 264,273 ****
worldDarkLevel_ = getNumber("Light", "World Dark Level", 18, true);
dungeonLightLevel_ = getNumber("Light", "Dungeon Level", 18, true);
- season_ = getNumber("Light", "Set Season", 0, true);
-
- // Magic
- cutScrollReq_ = getBool( "Magic", "Cut Scroll Requirements", false, true );
- walkDisturbsCast_ = getBool( "Magic", "Walking Disturbs Casting", true, true );
- precasting_ = getBool( "Magic", "Precasting", true, true );
// Path Finding
--- 208,211 ----
***************
*** 391,405 ****
setString("General", "LogPath", data );
flush();
- }
-
- bool cSrvParams::isClientAllowed( const QString& data )
- {
- if ( clientsAllowed_.contains(data))
- return true;
- else if ( clientsAllowed_.contains("ALL"))
- return true;
- else if ( data == wp_version.clientsupportedstring && clientsAllowed_.contains("SERVER_DEFAULT"))
- return true;
- return false;
}
--- 329,332 ----
Index: srvparams.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/srvparams.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -d -r1.55 -r1.56
*** srvparams.h 5 Sep 2003 00:03:45 -0000 1.55
--- srvparams.h 9 Sep 2003 23:09:30 -0000 1.56
***************
*** 65,69 ****
std::vector<ServerList_st> serverList_;
std::vector<StartLocation_st> startLocation_;
- QStringList clientsAllowed_;
// loaded data
--- 65,68 ----
***************
*** 76,98 ****
unsigned int statsAdvanceModifier_;
unsigned short objectDelay_;
[...962 lines suppressed...]
! inline QString cSrvParams::accountsHost() const
{
! return accountsHost_;
}
! inline QString cSrvParams::accountsName() const
{
! return accountsName_;
}
! inline QString cSrvParams::accountsUsername() const
{
! return accountsUsername_;
}
! inline QString cSrvParams::accountsPassword() const
{
! return accountsPassword_;
}
Index: wolf.dsp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolf.dsp,v
retrieving revision 1.223
retrieving revision 1.224
diff -C2 -d -r1.223 -r1.224
*** wolf.dsp 9 Sep 2003 15:17:07 -0000 1.223
--- wolf.dsp 9 Sep 2003 23:09:30 -0000 1.224
***************
*** 53,57 ****
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib ws2_32.lib $(QTDIR)\lib\qt-mt312.lib libmysql.lib /nologo /subsystem:windows /map /machine:I386 /nodefaultlib:"libcmt MSVCRTD" /out:"..\wolfpack.exe" /libpath:"lib\ZThread\lib" /libpath:"lib\Python\lib" /libpath:"lib\bugreport\lib" /libpath:"flatstore\Release" /opt:ref /opt:nowin98
! # SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "wolf - Win32 Debug"
--- 53,57 ----
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib ws2_32.lib $(QTDIR)\lib\qt-mt312.lib libmysql.lib /nologo /subsystem:windows /map /machine:I386 /nodefaultlib:"libcmt MSVCRTD" /out:"..\wolfpack.exe" /libpath:"lib\ZThread\lib" /libpath:"lib\Python\lib" /libpath:"lib\bugreport\lib" /libpath:"flatstore\Release" /opt:ref /opt:nowin98
! # SUBTRACT LINK32 /pdb:none /debug
!ELSEIF "$(CFG)" == "wolf - Win32 Debug"
Index: wolfpack.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolfpack.cpp,v
retrieving revision 1.461
retrieving revision 1.462
diff -C2 -d -r1.461 -r1.462
*** wolfpack.cpp 9 Sep 2003 15:33:07 -0000 1.461
--- wolfpack.cpp 9 Sep 2003 23:09:31 -0000 1.462
***************
*** 268,274 ****
void SetGlobalVars()
{
! keeprun=1;
! error=0;
! secure=1;
autosaved = 0;
dosavewarning = 0;
--- 268,273 ----
void SetGlobalVars()
{
! keeprun = 1;
! secure = 1;
autosaved = 0;
dosavewarning = 0;
***************
*** 316,332 ****
signal( SIGTERM, &signal_handler ); // Terminate Server
signal( SIGPIPE, SIG_IGN ); // Ignore SIGPIPE
! #endif
!
! #define CIAO_IF_ERROR if (error==1) { cNetwork::instance()->shutdown(); exit( -1 ); }
!
! unsigned long tempSecs;
! unsigned long loopSecs;
! unsigned long tempTime;
! uiCurrentTime = serverstarttime = getNormalizedTime();
serverState = STARTUP;
- // Print a seperator somehow
- /*Console::instance()->send( QString::number( sizeof( cUObject ) ) );
- return 0;*/
Console::instance()->setAttributes( true, false, true, 60, 140, 70, 12, FONT_NOSERIF );
--- 315,321 ----
signal( SIGTERM, &signal_handler ); // Terminate Server
signal( SIGPIPE, SIG_IGN ); // Ignore SIGPIPE
! #endif
serverState = STARTUP;
Console::instance()->setAttributes( true, false, true, 60, 140, 70, 12, FONT_NOSERIF );
***************
*** 458,468 ****
// initial randomization call
srand( uiCurrentTime );
- serverstarttime = getNormalizedTime();
! // Try to open our driver
if( !persistentBroker->openDriver( SrvParams->databaseDriver() ) )
{
! Console::instance()->log( LOG_ERROR, QString("Error trying to open %1 database driver, check your wolfpack.xml").arg(SrvParams->databaseDriver()) );
! exit( -1 );
}
--- 447,464 ----
// initial randomization call
srand( uiCurrentTime );
! /*
! Check for valid database driers.
! */
if( !persistentBroker->openDriver( SrvParams->databaseDriver() ) )
{
! Console::instance()->log( LOG_ERROR, QString( "Unknown Worldsave Database Driver '%1', check your wolfpack.xml").arg( SrvParams->databaseDriver() ) );
! return 1;
! }
!
! if( !persistentBroker->openDriver( SrvParams->accountsDriver() ) )
! {
! Console::instance()->log( LOG_ERROR, QString( "Unknown Account Database Driver '%1', check your wolfpack.xml").arg( SrvParams->accountsDriver() ) );
! return 1;
}
***************
*** 511,535 ****
Console::instance()->ProgressDone();
- starttime = uiCurrentTime;
- endtime = 0;
- lclock = 0;
-
uiCurrentTime = getNormalizedTime();
- serverstarttime = getNormalizedTime(); // dont remove, its absolutly necassairy that its 3 times in the startup sequence for several timing reasons.
-
- CIAO_IF_ERROR;
-
- // print allowed clients
- Console::instance()->send( "Allowed clients: " );
-
- if( SrvParams->clientsAllowed().contains( "ALL" ) )
- Console::instance()->send( "All\n\n" );
- else
- Console::instance()->send( SrvParams->clientsAllowed().join( ", " ) + "\n\n" );
Console::instance()->PrepareProgress( "Starting up Network" );
cNetwork::startup();
Console::instance()->ProgressDone();
- CIAO_IF_ERROR;
if( SrvParams->enableLogin() )
--- 507,515 ----
***************
*** 570,591 ****
Console::instance()->poll();
- if( loopTimeCount >= 1000 )
- {
- loopTimeCount = 0;
- loopTime = 0;
- }
-
- ++loopTimeCount;
-
- loopSecs = getNormalizedTime(); // Starting time
-
- if( networkTimeCount >= 1000 )
- {
- networkTimeCount = 0;
- networkTime = 0;
- }
-
- tempSecs = getNormalizedTime();
-
// Process any Network Events
cNetwork::instance()->poll();
--- 550,553 ----
***************
*** 604,644 ****
}
- tempTime = getNormalizedTime() - tempSecs ;
- networkTime += tempTime;
- ++networkTimeCount;
-
- if( timerTimeCount >= 1000 )
- {
- timerTimeCount = 0;
- timerTime = 0;
- }
-
- tempSecs = getNormalizedTime() ;
-
- checktimers();
-
- uiCurrentTime = getNormalizedTime();
- tempTime = getNormalizedTime() - tempSecs;
- timerTime += tempTime;
- ++timerTimeCount;
-
- if( autoTimeCount >= 1000 )
- {
- autoTimeCount = 0;
- autoTime = 0;
- }
-
- tempSecs = getNormalizedTime() ;
-
checkauto();
-
- tempTime = getNormalizedTime() - tempSecs;
- autoTime += tempTime;
- ++autoTimeCount;
-
- tempTime = getNormalizedTime() - loopSecs;
-
- loopTime += tempTime;
-
qApp->processEvents( 40 );
}
--- 566,570 ----
***************
*** 775,791 ****
{
pp->makeCriminal();
- }
- }
- else if (pc->objectType() == enNPC) // && ((pc->npcaitype() == 2) || // bad npc
- //(pc->npcaitype() == 3) || // bad healer
- //(pc->npcaitype() == 50))) // EV & BS
- {
- if (SrvParams->badNpcsRed() == 0)
- {
- pc->setCriminalTime( uiCurrentTime + SrvParams->crimtime() * MY_CLOCKS_PER_SEC );
- }
- else
- {
- pc->setMurdererTime( uiCurrentTime + SrvParams->murderdecay() * MY_CLOCKS_PER_SEC );
}
}
--- 701,704 ----
Index: world.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/world.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** world.cpp 8 Sep 2003 10:58:47 -0000 1.38
--- world.cpp 9 Sep 2003 23:09:31 -0000 1.39
***************
*** 183,186 ****
--- 183,192 ----
Console::instance()->send( "Loading World...\n" );
+ if( !persistentBroker->openDriver( SrvParams...
[truncated message content] |