Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv566
Modified Files:
commands.cpp targetrequests.cpp targetrequests.h
Log Message:
addevent, removeevent moved to scripts
fixed an issue for doors
Index: targetrequests.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/targetrequests.cpp,v
retrieving revision 1.98
retrieving revision 1.99
diff -C2 -d -r1.98 -r1.99
*** targetrequests.cpp 2 Jun 2004 15:04:07 -0000 1.98
--- targetrequests.cpp 6 Jul 2004 13:04:07 -0000 1.99
***************
*** 218,256 ****
}
- bool cAddEventTarget::responsed( cUOSocket* socket, cUORxTarget* target )
- {
- cUObject* pObject = 0;
-
- if ( isCharSerial( target->serial() ) )
- pObject = FindCharBySerial( target->serial() );
- else if ( isItemSerial( target->serial() ) )
- pObject = FindItemBySerial( target->serial() );
-
- // We have to have a valid target
- if ( !pObject )
- {
- socket->sysMessage( tr( "You have to target a character or an item." ) );
- return true;
- }
-
- // Check if we already have the event
- if ( pObject->hasEvent( _event ) )
- {
- socket->sysMessage( tr( "This object already has the event '%1'" ).arg( _event ) );
- return true;
- }
-
- cPythonScript* script = ScriptManager::instance()->find( _event.latin1() );
-
- if ( !script )
- {
- socket->sysMessage( tr( "Invalid event: '%1'" ).arg( _event ) );
- return true;
- }
-
- pObject->addEvent( script );
- return true;
- }
-
bool cShowTarget::responsed( cUOSocket* socket, cUORxTarget* target )
{
--- 218,221 ----
Index: targetrequests.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/targetrequests.h,v
retrieving revision 1.69
retrieving revision 1.70
diff -C2 -d -r1.69 -r1.70
*** targetrequests.h 5 Jul 2004 14:03:16 -0000 1.69
--- targetrequests.h 6 Jul 2004 13:04:07 -0000 1.70
***************
*** 417,469 ****
};
- class cAddEventTarget : public cTargetRequest
- {
- private:
- QString _event;
- public:
- cAddEventTarget( const QString& event ) : _event( event )
- {
- }
-
- bool responsed( cUOSocket* socket, cUORxTarget* target );
- };
-
- class cRemoveEventTarget : public cTargetRequest
- {
- private:
- QString _event;
- public:
- cRemoveEventTarget( const QString& event ) : _event( event )
- {
- }
-
- virtual bool responsed( cUOSocket* socket, cUORxTarget* target )
- {
- cUObject* pObject = 0;
-
- if ( isCharSerial( target->serial() ) )
- pObject = FindCharBySerial( target->serial() );
- else if ( isItemSerial( target->serial() ) )
- pObject = FindItemBySerial( target->serial() );
-
- // We have to have a valid target
- if ( !pObject )
- {
- socket->sysMessage( tr( "You have to target a character or an item." ) );
- return true;
- }
-
- // Check if we already have the event
- if ( !pObject->hasEvent( _event ) )
- {
- socket->sysMessage( tr( "This object doesn't have the event '%1'" ).arg( _event ) );
- return true;
- }
-
- pObject->removeEvent( _event );
- return true;
- }
- };
-
class cMoveTarget : public cTargetRequest
{
--- 417,420 ----
Index: commands.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/commands.cpp,v
retrieving revision 1.240
retrieving revision 1.241
diff -C2 -d -r1.240 -r1.241
*** commands.cpp 5 Jul 2004 18:33:19 -0000 1.240
--- commands.cpp 6 Jul 2004 13:04:06 -0000 1.241
***************
*** 867,919 ****
/*
- \command addevent
- \description Attach a script to an object.
- \usage - <code>addevent [script]</code>
- Script is the id of the script you want to attach.
- */
- void commandAddEvent( cUOSocket* socket, const QString& command, const QStringList& args ) throw()
- {
- Q_UNUSED( command );
- if ( args.size() < 1 )
- {
- socket->sysMessage( "Usage: addevent <identifier>" );
- return;
- }
-
- QString event = args.join( " " );
-
- // No such event
- if ( !ScriptManager::instance()->find( event.latin1() ) )
- {
- socket->sysMessage( tr( "Invalid event: '%1'" ).arg( event ) );
- return;
- }
-
- socket->sysMessage( tr( "Please select a target to add event '%1' to." ).arg( event ) );
- socket->attachTarget( new cAddEventTarget( event ) );
- }
-
- /*
- \command removeevent
- \description Remove a script from an object.
- \usage - <code>removeevent [script]</code>
- Script is the id of the script you want to remove.
- */
- void commandRemoveEvent( cUOSocket* socket, const QString& command, const QStringList& args ) throw()
- {
- Q_UNUSED( command );
- if ( args.size() < 1 )
- {
- socket->sysMessage( "Usage: removeevent <identifier>" );
- return;
- }
-
- QString event = args.join( " " );
-
- socket->sysMessage( tr( "Please select a target to remove event '%1' from." ).arg( event ) );
- socket->attachTarget( new cRemoveEventTarget( event ) );
- }
-
- /*
\command move
\description Move an object relatively to its current position.
--- 867,870 ----
***************
*** 1396,1421 ****
stCommand cCommands::commands[] =
{
! { "ACCOUNT", commandAccount },
! { "ADDEVENT", commandAddEvent },
{ "ALLMOVE", commandAllMove },
! { "ALLSHOW", commandAllShow },
! { "ALLSKILLS", commandAllSkills },
! { "BROADCAST", commandBroadcast },
! { "DOORGEN", commandDoorGenerator },
! { "FIX", commandFix },
! { "GMTALK", commandGmtalk },
! { "INVIS", commandInvis },
! { "KILL", commandKill },
! { "MOVE", commandMove },
! { "PAGES", commandPages },
! { "PAGENOTIFY", commandPageNotify },
! { "PASSWORD", commandPassword },
! { "RELOAD", commandReload },
! { "REMOVE", commandRemove },
! { "REMOVEEVENT", commandRemoveEvent },
! { "RESEND", commandResend },
! { "RESTOCK", commandRestock },
! { "RESURRECT", commandResurrect },
! { "SAVE", commandSave },
{ "SERVERTIME", commandServerTime },
{ "SET", commandSet },
--- 1347,1370 ----
stCommand cCommands::commands[] =
{
! { "ACCOUNT", commandAccount },
{ "ALLMOVE", commandAllMove },
! { "ALLSHOW", commandAllShow },
! { "ALLSKILLS", commandAllSkills },
! { "BROADCAST", commandBroadcast },
! { "DOORGEN", commandDoorGenerator },
! { "FIX", commandFix },
! { "GMTALK", commandGmtalk },
! { "INVIS", commandInvis },
! { "KILL", commandKill },
! { "MOVE", commandMove },
! { "PAGES", commandPages },
! { "PAGENOTIFY", commandPageNotify },
! { "PASSWORD", commandPassword },
! { "RELOAD", commandReload },
! { "REMOVE", commandRemove },
! { "RESEND", commandResend },
! { "RESTOCK", commandRestock },
! { "RESURRECT", commandResurrect },
! { "SAVE", commandSave },
{ "SERVERTIME", commandServerTime },
{ "SET", commandSet },
|