Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29787
Modified Files:
gumps.cpp targetrequests.cpp targetrequests.h
Log Message:
added rank chencking
Index: gumps.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/gumps.cpp,v
retrieving revision 1.148
retrieving revision 1.149
diff -C2 -d -r1.148 -r1.149
*** gumps.cpp 8 Jan 2004 23:43:57 -0000 1.148
--- gumps.cpp 22 Jan 2004 20:39:12 -0000 1.149
***************
*** 449,453 ****
case 1:
// Check if the privileges are ok
! if( mChar && !mChar->account()->authorized("command", "go" ))
{
socket->sysMessage( tr( "Access to command 'go' was denied" ) );
--- 449,453 ----
case 1:
// Check if the privileges are ok
! if( mChar && !mChar->account()->authorized( "command", "go" ) )
{
socket->sysMessage( tr( "Access to command 'go' was denied" ) );
***************
*** 464,470 ****
case 2:
// Check if the privileges are ok
! if( mChar && !mChar->account()->authorized("command", "go" ))
{
! socket->sysMessage( tr( "Access to command 'go' was denied" ) );
}
else if( mChar )
--- 464,470 ----
case 2:
// Check if the privileges are ok
! if( mChar && !mChar->account()->authorized( "command", "move" ) || pChar->account()->rank() >= mChar->account()->rank() )
{
! socket->sysMessage( tr( "Access to command 'move' was denied" ) );
}
else if( mChar )
***************
*** 485,489 ****
case 5:
// Check if the privileges are ok
! if( mChar && !mChar->account()->authorized("command", "info" ))
{
socket->sysMessage( tr( "Access to command 'info' was denied" ) );
--- 485,489 ----
case 5:
// Check if the privileges are ok
! if( mChar && !mChar->account()->authorized( "command", "info" ) )
{
socket->sysMessage( tr( "Access to command 'info' was denied" ) );
***************
*** 505,510 ****
break;
case 7:
! socket_->disconnect();
! socket->sysMessage( tr("Socket disconnected.") );
break;
}
--- 505,517 ----
break;
case 7:
! if( pChar->account()->rank() >= mChar->account()->rank() )
! {
! socket->sysMessage( tr( "You're getting megalomaniac!" ) );
! }
! else
! {
! socket_->disconnect();
! socket->sysMessage( tr("Socket disconnected.") );
! }
break;
}
***************
*** 712,716 ****
case 1:
// Check if the privileges are ok
! if( mChar && !mChar->account()->authorized("command", "go" ))
{
socket->sysMessage( tr( "Access to command 'go' was denied" ) );
--- 719,723 ----
case 1:
// Check if the privileges are ok
! if( mChar && !mChar->account()->authorized( "command", "go" ) )
{
socket->sysMessage( tr( "Access to command 'go' was denied" ) );
***************
*** 727,733 ****
case 2:
// Check if the privileges are ok
! if( mChar && !mChar->account()->authorized("command", "go" ))
{
! socket->sysMessage( tr( "Access to command 'go' was denied" ) );
}
else if( mChar )
--- 734,740 ----
case 2:
// Check if the privileges are ok
! if( mChar && !mChar->account()->authorized( "command", "move" ) || pChar->account()->rank() >= mChar->account()->rank() )
{
! socket->sysMessage( tr( "Access to command 'move' was denied" ) );
}
else if( mChar )
***************
*** 742,746 ****
case 3:
// Check if the privileges are ok
! if( mChar && !mChar->account()->authorized("command", "go" ))
{
socket->sysMessage( tr( "Access to command 'go' was denied" ) );
--- 749,753 ----
case 3:
// Check if the privileges are ok
! if( mChar && !mChar->account()->authorized("command", "go" ) )
{
socket->sysMessage( tr( "Access to command 'go' was denied" ) );
***************
*** 766,770 ****
case 5:
// Check if the privileges are ok
! if( mChar && !mChar->account()->authorized("command", "info" ))
{
socket->sysMessage( tr( "Access to command 'info' was denied" ) );
--- 773,777 ----
case 5:
// Check if the privileges are ok
! if( mChar && !mChar->account()->authorized("command", "info" ) || pChar->account()->rank() >= mChar->account()->rank() )
{
socket->sysMessage( tr( "Access to command 'info' was denied" ) );
Index: targetrequests.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/targetrequests.cpp,v
retrieving revision 1.81
retrieving revision 1.82
diff -C2 -d -r1.81 -r1.82
*** targetrequests.cpp 7 Jan 2004 03:09:09 -0000 1.81
--- targetrequests.cpp 22 Jan 2004 20:39:18 -0000 1.82
***************
*** 392,395 ****
--- 392,406 ----
}
+ // check for rank
+ if( pChar && pChar->objectType() == enPlayer )
+ {
+ P_PLAYER pp = dynamic_cast<P_PLAYER>( pChar );
+ if( pp->account()->rank() >= socket->player()->account()->rank() && pp != socket->player() )
+ {
+ socket->sysMessage( tr( "Better do not try that!" ) );
+ return true;
+ }
+ }
+
cVariant value( this->value );
stError *error = pObject->setProperty( key, value );
Index: targetrequests.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/targetrequests.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** targetrequests.h 22 Jan 2004 04:48:12 -0000 1.49
--- targetrequests.h 22 Jan 2004 20:39:19 -0000 1.50
***************
*** 240,243 ****
--- 240,254 ----
P_CHAR pChar = FindCharBySerial( target->serial() );
+ // check for rank
+ if( pChar && pChar->objectType() == enPlayer)
+ {
+ P_PLAYER pp = dynamic_cast<P_PLAYER>( pChar );
+ if( pp->account()->rank() >= socket->player()->account()->rank() && pp != socket->player() )
+ {
+ socket->sysMessage( tr( "You want to suicide?" ) );
+ return true;
+ }
+ }
+
if( !pChar )
{
***************
*** 323,328 ****
--- 334,351 ----
{
P_CHAR pChar = FindCharBySerial( target->serial() );
+
if( pChar )
{
+ // check for rank
+ if( pChar->objectType() == enPlayer)
+ {
+ P_PLAYER pp = dynamic_cast<P_PLAYER>( pChar );
+ if( pp->account()->rank() >= socket->player()->account()->rank() && pp != socket->player() )
+ {
+ socket->sysMessage( tr( "Better do not try that!" ) );
+ return true;
+ }
+ }
+
if( type_ )
pChar->setTag( key_, cVariant( value_.toInt() ) );
***************
*** 401,404 ****
--- 424,438 ----
if( pChar )
{
+ // check for rank
+ if( pChar->objectType() == enPlayer)
+ {
+ P_PLAYER pp = dynamic_cast<P_PLAYER>( pChar );
+ if( pp->account()->rank() >= socket->player()->account()->rank() && pp != socket->player() )
+ {
+ socket->sysMessage( tr( "Better do not try that!" ) );
+ return true;
+ }
+ }
+
if( key_.lower() == "all" )
{
***************
*** 559,562 ****
--- 593,608 ----
{
P_CHAR pChar = dynamic_cast< P_CHAR >( pObject );
+
+ // check for rank
+ if( pChar && pChar->objectType() == enPlayer)
+ {
+ P_PLAYER pp = dynamic_cast<P_PLAYER>( pChar );
+ if( pp->account()->rank() >= socket->player()->account()->rank() && pp != socket->player() )
+ {
+ socket->sysMessage( tr( "Better do not try that!" ) );
+ return true;
+ }
+ }
+
if( pChar )
pChar->resend();
|