Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv2528
Modified Files:
basechar.cpp basechar.h commands.cpp contextmenu.cpp
customtags.cpp globals.cpp globals.h items.cpp npc.cpp
player.cpp pythonscript.cpp pythonscript.h scriptmanager.cpp
scriptmanager.h skills.cpp speech.cpp targetrequests.cpp
uobject.cpp wolf.dsp wolfpack.cpp
Log Message:
Changed Python Interface
Changed behaviour of setGlobalHook and setCommandHook
Index: basechar.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/basechar.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** basechar.cpp 16 Sep 2003 18:15:24 -0000 1.45
--- basechar.cpp 23 Sep 2003 12:40:17 -0000 1.46
***************
*** 1013,1276 ****
}
- // Shows the name of a character to someone else
- bool cBaseChar::onSingleClick( P_PLAYER Viewer )
- {
- // If we got ANY events process them in order
- if( scriptChain )
- {
- unsigned int i = 0;
- while( scriptChain[i] )
- {
- if( scriptChain[ i ]->onSingleClick( (P_PLAYER)this, (P_CHAR)Viewer ) )
- return true;
-
- ++i;
- }
- }
-
- // Try to process the hooks then
- QValueVector< cPythonScript* > hooks;
- QValueVector< cPythonScript* >::const_iterator it;
-
- hooks = ScriptManager->getGlobalHooks( OBJECT_CHAR, EVENT_SINGLECLICK );
- for( it = hooks.begin(); it != hooks.end(); ++it )
- if( (*it)->onSingleClick( (P_PLAYER)this, (P_CHAR)Viewer ) )
- return true;
-
- return false;
- }
-
- // Walks in a specific Direction
- bool cBaseChar::onWalk( UI08 Direction, UI08 Sequence )
- {
- // If we got ANY events process them in order
- if( scriptChain )
- {
- unsigned int i = 0;
- while( scriptChain[i] )
- {
- if( scriptChain[ i ]->onWalk( (P_CHAR)this, Direction, Sequence ) )
- return true;
- ++i;
- }
- }
-
- return false;
- }
-
- // The character says something
- bool cBaseChar::onTalk( char speechType, UI16 speechColor, UI16 speechFont, const QString &Text, const QString &Lang )
- {
- if( scriptChain )
- {
- unsigned int i = 0;
- while( scriptChain[i] )
- {
- if( scriptChain[ i ]->onTalk( (P_CHAR)this, speechType, speechColor, speechFont, Text, Lang ) )
- return true;
- ++i;
- }
- }
-
- return false;
- }
-
- // The character switches warmode
- bool cBaseChar::onWarModeToggle( bool War )
- {
- // If we got ANY events process them in order
- if( scriptChain )
- {
- unsigned int i = 0;
- while( scriptChain[i] )
- {
- if( scriptChain[ i ]->onWarModeToggle( this, War ) )
- return true;
-
- ++i;
- }
- }
-
- return false;
- }
-
- // The paperdoll of this character has been requested
- bool cBaseChar::onShowPaperdoll( P_CHAR pOrigin )
- {
- if( scriptChain )
- {
- unsigned int i = 0;
- while( scriptChain[i] )
- {
- if( scriptChain[ i ]->onShowPaperdoll( this, pOrigin ) )
- return true;
-
- ++i;
- }
- }
-
- return false;
- }
-
- bool cBaseChar::onShowSkillGump()
- {
- if( scriptChain )
- {
- unsigned int i = 0;
- while( scriptChain[i] )
- {
- if( scriptChain[ i ]->onShowSkillGump( this ) )
- return true;
-
- ++i;
- }
- }
-
- // Try to process the hooks then
- QValueVector< cPythonScript* > hooks;
- QValueVector< cPythonScript* >::const_iterator it;
-
- hooks = ScriptManager->getGlobalHooks( OBJECT_CHAR, EVENT_SHOWSKILLGUMP );
- for( it = hooks.begin(); it != hooks.end(); ++it )
- if( (*it)->onShowSkillGump( this ) )
- return true;
-
- return false;
- }
-
- // The character uses %Skill
- bool cBaseChar::onSkillUse( UI08 Skill )
- {
- // If we got ANY events process them in order
- if( scriptChain )
- {
- unsigned int i = 0;
- while( scriptChain[i] )
- {
- if( scriptChain[ i ]->onSkillUse( this, Skill ) )
- return true;
-
- ++i;
- }
- }
-
- // Try to process the hooks then
- QValueVector< cPythonScript* > hooks;
- QValueVector< cPythonScript* >::const_iterator it;
-
- hooks = ScriptManager->getGlobalHooks( OBJECT_CHAR, EVENT_SKILLUSE );
- for( it = hooks.begin(); it != hooks.end(); ++it )
- if( (*it)->onSkillUse( this, Skill ) )
- return true;
-
- return false;
- }
-
- bool cBaseChar::onDropOnChar( P_ITEM pItem )
- {
- // If we got ANY events process them in order
- if( scriptChain )
- {
- unsigned int i = 0;
- while( scriptChain[i] )
- {
- if( scriptChain[ i ]->onDropOnChar( this, pItem ) )
- return true;
-
- ++i;
- }
- }
-
- return false;
- }
-
- QString cBaseChar::onShowPaperdollName( P_CHAR pOrigin )
- {
- if( scriptChain )
- {
- unsigned int i = 0;
- while( scriptChain[i] )
- {
- QString result = scriptChain[ i ]->onShowPaperdollName( this, pOrigin );
-
- if( !result.isNull() )
- return result;
-
- ++i;
- }
- }
-
- return QString::null;
- }
-
- bool cBaseChar::onDeath()
- {
- // If we got ANY events process them in order
- if( scriptChain )
- {
- unsigned int i = 0;
- while( scriptChain[i] )
- {
- if( scriptChain[ i ]->onDeath( this ) )
- return true;
-
- ++i;
- }
- }
-
- return false;
- }
- bool cBaseChar::onCHLevelChange( uint level )
- {
- if( scriptChain )
- {
- unsigned int i = 0;
- while( scriptChain[i] )
- {
- if( scriptChain[ i ]->onCHLevelChange( this, level ) )
- return true;
-
- ++i;
- }
- }
-
- // Try to process the hooks then
- QValueVector< cPythonScript* > hooks;
- QValueVector< cPythonScript* >::const_iterator it;
-
- hooks = ScriptManager->getGlobalHooks( OBJECT_CHAR, EVENT_CHLEVELCHANGE );
- for( it = hooks.begin(); it != hooks.end(); ++it )
- if( (*it)->onCHLevelChange( this, level ) )
- return true;
-
-
- return false;
- }
- bool cBaseChar::onShowTooltip( P_PLAYER sender, cUOTxTooltipList* tooltip )
- {
- if( scriptChain )
- {
- unsigned int i = 0;
- while( scriptChain[i] )
- {
- if( scriptChain[ i ]->onShowToolTip( sender, this, tooltip ) )
- return true;
-
- ++i;
- }
- }
-
- // Try to process the hooks then
- QValueVector< cPythonScript* > hooks;
- QValueVector< cPythonScript* >::const_iterator it;
-
- hooks = ScriptManager->getGlobalHooks( OBJECT_CHAR, EVENT_SHOWTOOLTIP );
- for( it = hooks.begin(); it != hooks.end(); ++it )
- if( (*it)->onShowToolTip( sender, this, tooltip ) )
- return true;
-
- return false;
- }
-
void cBaseChar::processNode( const cElement *Tag )
{
--- 1013,1016 ----
***************
*** 1893,1950 ****
}
- bool cBaseChar::onSkillGain( UI08 Skill, SI32 min, SI32 max, bool success )
- {
- // If we got ANY events process them in order
- if( scriptChain )
- {
- unsigned int i = 0;
- while( scriptChain[i] )
- {
- if( scriptChain[ i ]->onSkillGain( this, Skill, min, max, success ) )
- return true;
-
- ++i;
- }
- }
-
- // Try to process the hooks then
- QValueVector< cPythonScript* > hooks;
- QValueVector< cPythonScript* >::const_iterator it;
-
- hooks = ScriptManager->getGlobalHooks( OBJECT_CHAR, EVENT_SKILLGAIN );
- for( it = hooks.begin(); it != hooks.end(); ++it )
- if( (*it)->onSkillGain( this, Skill, min, max, success ) )
- return true;
-
- return false;
- }
-
- bool cBaseChar::onStatGain( UI08 stat, SI08 amount )
- {
- // If we got ANY events process them in order
- if( scriptChain )
- {
- unsigned int i = 0;
- while( scriptChain[i] )
- {
- if( scriptChain[ i ]->onStatGain( this, stat, amount ) )
- return true;
-
- ++i;
- }
- }
-
- // Try to process the hooks then
- QValueVector< cPythonScript* > hooks;
- QValueVector< cPythonScript* >::const_iterator it;
-
- hooks = ScriptManager->getGlobalHooks( OBJECT_CHAR, EVENT_STATGAIN );
- for( it = hooks.begin(); it != hooks.end(); ++it )
- if( (*it)->onStatGain( this, stat,amount ) )
- return true;
-
- return false;
- }
-
unsigned int cBaseChar::damage( eDamageType type, unsigned int amount, cUObject *source )
{
--- 1633,1636 ----
***************
*** 1953,1973 ****
// to modify the damage if needed
//
-
if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
{
! amount = scriptChain[ i ]->onDamage( this, type, amount, source );
! ++i;
! }
! }
! QValueVector< cPythonScript* > hooks;
! QValueVector< cPythonScript* >::const_iterator it;
! hooks = ScriptManager->getGlobalHooks( OBJECT_CHAR, EVENT_DAMAGE );
! for( it = hooks.begin(); it != hooks.end(); ++it )
! amount = (*it)->onDamage( this, type, amount, source );
// Invulnerable Targets don't take any damage at all
--- 1639,1663 ----
// to modify the damage if needed
//
if( scriptChain )
{
! PyObject *args;
!
! if( dynamic_cast< P_CHAR >( source ) != 0 )
! args = Py_BuildValue( "O&iiO&", PyGetCharObject, this, (unsigned int)type, amount, PyGetCharObject, source );
! else if( dynamic_cast< P_ITEM >( source ) )
! args = Py_BuildValue( "O&iiO&", PyGetCharObject, this, (unsigned int)type, amount, PyGetItemObject, source );
!
! PyObject *result = cPythonScript::callChainedEvent( EVENT_DAMAGE, scriptChain, args );
!
! if( result )
{
! if( PyInt_Check( result ) )
! amount = PyInt_AsLong( result );
! Py_DECREF( result );
! }
! Py_DECREF( args );
! }
// Invulnerable Targets don't take any damage at all
***************
*** 2128,2130 ****
--- 1818,2041 ----
source->sendContainer( getBackpack() );
};
+ }
+
+ /*
+ Event Wrappers
+ */
+
+ bool cBaseChar::onWalk( unsigned char direction, unsigned char sequence )
+ {
+ bool result = false;
+
+ if( scriptChain )
+ {
+ PyObject *args = Py_BuildValue( "O&bb", PyGetCharObject, this, direction, sequence );
+ result = cPythonScript::callChainedEventHandler( EVENT_WALK, scriptChain, args );
+ Py_DECREF( args );
+ }
+
+ return result;
+ }
+
+ bool cBaseChar::onTalk( unsigned char type, unsigned short color, unsigned short font, const QString &text, const QString &lang )
+ {
+ bool result = false;
+
+ if( scriptChain )
+ {
+ PyObject *args = Py_BuildValue( "O&bhhuu", PyGetCharObject, this, type, color, font, text.ucs2(), lang.ucs2() );
+ result = cPythonScript::callChainedEventHandler( EVENT_TALK, scriptChain, args );
+ Py_DECREF( args );
+ }
+
+ return result;
+ }
+
+ bool cBaseChar::onWarModeToggle( bool war )
+ {
+ bool result = false;
+
+ if( scriptChain )
+ {
+ PyObject *args = Py_BuildValue( "O&i", PyGetCharObject, this, war ? 1 : 0 );
+ result = cPythonScript::callChainedEventHandler( EVENT_WARMODETOGGLE, scriptChain, args );
+ Py_DECREF( args );
+ }
+
+ return result;
+ }
+
+ bool cBaseChar::onShowPaperdoll( P_CHAR pOrigin )
+ {
+ bool result = false;
+
+ if( scriptChain )
+ {
+ PyObject *args = Py_BuildValue( "O&O&", PyGetCharObject, this, PyGetCharObject, pOrigin );
+ result = cPythonScript::callChainedEventHandler( EVENT_SHOWPAPERDOLL, scriptChain, args );
+ Py_DECREF( args );
+ }
+
+ return result;
+ }
+
+ bool cBaseChar::onShowSkillGump()
+ {
+ return cPythonScript::callChainedEventHandler( EVENT_SHOWSKILLGUMP, scriptChain );
+ }
+
+ bool cBaseChar::onSkillUse( unsigned char skill )
+ {
+ cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_SKILLUSE );
+ bool result = false;
+
+ if( scriptChain || global )
+ {
+ PyObject *args = Py_BuildValue( "O&b", PyGetCharObject, this, skill );
+
+ result = cPythonScript::callChainedEventHandler( EVENT_SKILLUSE, scriptChain, args );
+
+ if( !result && global )
+ result = global->callEventHandler( EVENT_SKILLUSE, args );
+
+ Py_DECREF( args );
+ }
+
+ return result;
+ }
+
+ bool cBaseChar::onDropOnChar( P_ITEM pItem )
+ {
+ bool result = false;
+
+ if( scriptChain )
+ {
+ PyObject *args = Py_BuildValue( "O&O&", PyGetCharObject, this, PyGetItemObject, pItem );
+ result = cPythonScript::callChainedEventHandler( EVENT_DROPONCHAR, scriptChain, args );
+ Py_DECREF( args );
+ }
+
+ return result;
+ }
+
+ QString cBaseChar::onShowPaperdollName( P_CHAR pOrigin )
+ {
+ // I hate this event by the way (DarkStorm)
+ QString name = QString::null;
+
+ if( scriptChain )
+ {
+ PyObject *args = Py_BuildValue( "O&O&", PyGetCharObject, this, PyGetCharObject, pOrigin );
+
+ PyObject *result = cPythonScript::callChainedEvent( EVENT_SHOWPAPERDOLLNAME, scriptChain, args );
+
+ if( result )
+ {
+ // Strings and Unicode Objects gladly accepted
+ if( PyString_Check( result ) )
+ name = PyString_AsString( result );
+
+ if( PyUnicode_Check( result ) )
+ name = QString::fromUcs2( PyUnicode_AS_UNICODE( result ) );
+ }
+
+ Py_XDECREF( result );
+
+ Py_DECREF( args );
+ }
+
+ return name;
+ }
+
+ bool cBaseChar::onDeath()
+ {
+ bool result = false;
+
+ if( scriptChain )
+ {
+ PyObject *args = Py_BuildValue( "O&", PyGetCharObject, this );
+ result = cPythonScript::callChainedEventHandler( EVENT_DEATH, scriptChain, args );
+ Py_DECREF( args );
+ }
+
+ return result;
+ }
+ bool cBaseChar::onCHLevelChange( unsigned int level )
+ {
+ cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_CHLEVELCHANGE );
+ bool result = false;
+
+ if( scriptChain || global )
+ {
+ PyObject *args = Py_BuildValue( "O&i", PyGetCharObject, this, level );
+
+ result = cPythonScript::callChainedEventHandler( EVENT_CHLEVELCHANGE, scriptChain, args );
+
+ if( !result && global )
+ result = global->callEventHandler( EVENT_CHLEVELCHANGE, args );
+
+ Py_DECREF( args );
+ }
+
+ return result;
+ }
+
+ bool cBaseChar::onShowTooltip( P_PLAYER sender, cUOTxTooltipList* tooltip )
+ {
+ cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_SHOWTOOLTIP );
+ bool result = false;
+
+ if( scriptChain || global )
+ {
+ PyObject *args = Py_BuildValue( "O&O&O&", PyGetCharObject, sender, PyGetCharObject, this, PyGetTooltipObject, tooltip );
+
+ result = cPythonScript::callChainedEventHandler( EVENT_SHOWTOOLTIP, scriptChain, args );
+
+ if( !result && global )
+ result = global->callEventHandler( EVENT_SHOWTOOLTIP, args );
+
+ Py_DECREF( args );
+ }
+
+ return result;
+ }
+
+ bool cBaseChar::onSkillGain( unsigned char skill, unsigned short min, unsigned short max, bool success )
+ {
+ cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_SKILLGAIN );
+ bool result = false;
+
+ if( scriptChain || global )
+ {
+ PyObject *args = Py_BuildValue( "O&bhhi", PyGetCharObject, this, skill, min, max, success ? 1 : 0 );
+
+ result = cPythonScript::callChainedEventHandler( EVENT_SKILLGAIN, scriptChain, args );
+
+ if( !result && global )
+ result = global->callEventHandler( EVENT_SKILLGAIN, args );
+
+ Py_DECREF( args );
+ }
+
+ return result;
+ }
+
+ bool cBaseChar::onStatGain( unsigned char stat )
+ {
+ cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_STATGAIN );
+ bool result = false;
+
+ if( scriptChain || global )
+ {
+ PyObject *args = Py_BuildValue( "O&b", PyGetCharObject, this, stat );
+
+ result = cPythonScript::callChainedEventHandler( EVENT_STATGAIN, scriptChain, args );
+
+ if( !result && global )
+ result = global->callEventHandler( EVENT_STATGAIN, args );
+
+ Py_DECREF( args );
+ }
+
+ return result;
}
Index: basechar.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/basechar.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** basechar.h 20 Sep 2003 12:01:43 -0000 1.37
--- basechar.h 23 Sep 2003 12:40:18 -0000 1.38
***************
*** 159,176 ****
// Wrapper events
! virtual bool onSingleClick( P_PLAYER Viewer ); // Shows the name of a character to someone else
! virtual bool onWalk( UI08 Direction, UI08 Sequence ); // Walks in a specific Direction
! virtual bool onTalk( char speechType, UI16 speechColor, UI16 speechFont, const QString &Text, const QString &Lang ); // The character says something
virtual bool onWarModeToggle( bool War ); // The character switches warmode
virtual bool onShowPaperdoll( P_CHAR pOrigin ); // The paperdoll of this character is requested, there is no vice-versa call
virtual bool onShowSkillGump(); //Show Skillgump
virtual bool onSkillUse( UI08 Skill ); // The character uses %Skill
! bool onDeath();
! bool onDropOnChar( P_ITEM pItem );
! QString onShowPaperdollName( P_CHAR pOrigin ); // only change the viewed name
virtual bool onShowTooltip( P_PLAYER sender, cUOTxTooltipList* tooltip ); // Shows a tool tip for specific object
virtual bool onCHLevelChange( uint level ); // Fired when player moving trough levels
! bool onSkillGain( UI08 Skill, SI32 min, SI32 max, bool success );
! bool onStatGain( UI08 stat, SI08 amount );
// getters
--- 159,175 ----
// Wrapper events
! virtual bool onWalk( unsigned char dir, unsigned char sequence ); // Walks in a specific Direction
! virtual bool onTalk( unsigned char speechType, UI16 speechColor, UI16 speechFont, const QString &Text, const QString &Lang ); // The character says something
virtual bool onWarModeToggle( bool War ); // The character switches warmode
virtual bool onShowPaperdoll( P_CHAR pOrigin ); // The paperdoll of this character is requested, there is no vice-versa call
virtual bool onShowSkillGump(); //Show Skillgump
virtual bool onSkillUse( UI08 Skill ); // The character uses %Skill
! virtual bool onDeath();
! virtual bool onDropOnChar( P_ITEM pItem );
! virtual QString onShowPaperdollName( P_CHAR pOrigin ); // only change the viewed name
virtual bool onShowTooltip( P_PLAYER sender, cUOTxTooltipList* tooltip ); // Shows a tool tip for specific object
virtual bool onCHLevelChange( uint level ); // Fired when player moving trough levels
! virtual bool onSkillGain( unsigned char skill, unsigned short min, unsigned short max, bool success );
! virtual bool onStatGain( unsigned char stat );
// getters
Index: commands.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/commands.cpp,v
retrieving revision 1.205
retrieving revision 1.206
diff -C2 -d -r1.205 -r1.206
*** commands.cpp 20 Sep 2003 02:15:09 -0000 1.205
--- commands.cpp 23 Sep 2003 12:40:18 -0000 1.206
***************
*** 97,109 ****
// Check for custom commands
! cPythonScript *script = ScriptManager->getCommandHook( command );
! if( script )
{
QString argString = arguments.join( " " );
if( argString.isNull() )
argString = "";
! script->onCommand( socket, command, argString );
return;
}
--- 97,117 ----
// Check for custom commands
! PyObject *function = ScriptManager::instance()->getCommandHook( command.latin1() );
! if( function )
{
QString argString = arguments.join( " " );
+
if( argString.isNull() )
argString = "";
! PyObject *args = Py_BuildValue( "O&uu", PyGetSocketObject, socket, command.ucs2(), argString.ucs2() );
!
! PyObject *result = PyObject_CallObject( function, args );
! Py_XDECREF( result );
! reportPythonError();
!
! Py_DECREF( args );
!
return;
}
***************
*** 871,875 ****
{
Console::instance()->send( "Reloading python scripts\n" );
! ScriptManager->reload();
ContextMenus::instance()->reload();
}
--- 879,883 ----
{
Console::instance()->send( "Reloading python scripts\n" );
! ScriptManager::instance()->reload();
ContextMenus::instance()->reload();
}
***************
*** 889,893 ****
Resources::instance()->reload();
MakeMenus::instance()->reload();
! ScriptManager->reload(); // Reload Scripts
Skills->reload();
ContextMenus::instance()->reload();
--- 897,901 ----
Resources::instance()->reload();
MakeMenus::instance()->reload();
! ScriptManager::instance()->reload(); // Reload Scripts
Skills->reload();
ContextMenus::instance()->reload();
***************
*** 920,924 ****
Resources::instance()->reload();
MakeMenus::instance()->reload();
! ScriptManager->reload(); // Reload Scripts
ContextMenus::instance()->reload();
--- 928,932 ----
Resources::instance()->reload();
MakeMenus::instance()->reload();
! ScriptManager::instance()->reload(); // Reload Scripts
ContextMenus::instance()->reload();
***************
*** 963,967 ****
// No such event
! if( !ScriptManager->find( event ) )
{
socket->sysMessage( tr( "Invalid event: '%1'" ).arg( event ) );
--- 971,975 ----
// No such event
! if( !ScriptManager::instance()->find( event.latin1() ) )
{
socket->sysMessage( tr( "Invalid event: '%1'" ).arg( event ) );
Index: contextmenu.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/contextmenu.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** contextmenu.cpp 7 Sep 2003 19:07:46 -0000 1.15
--- contextmenu.cpp 23 Sep 2003 12:40:18 -0000 1.16
***************
*** 94,98 ****
for( ; myIter != eventList_.end(); ++myIter )
{
! cPythonScript *myScript = ScriptManager->find( *myIter );
// Script not found
--- 94,98 ----
for( ; myIter != eventList_.end(); ++myIter )
{
! cPythonScript *myScript = ScriptManager::instance()->find( (*myIter).latin1() );
// Script not found
***************
*** 110,117 ****
return false;
// If we got ANY events process them in order
for( UI08 i = 0; i < scriptChain.size(); i++ )
{
! if ( scriptChain[ i ]->onContextEntry( Caller, Target, Tag ) )
return true;
}
--- 110,119 ----
return false;
+ PyObject *args = Py_BuildValue( "O&O&h", PyGetCharObject, Caller, PyGetObjectObject, Target, Tag );
+
// If we got ANY events process them in order
for( UI08 i = 0; i < scriptChain.size(); i++ )
{
! if ( scriptChain[ i ]->callEventHandler( EVENT_CONTEXTENTRY, args ) )
return true;
}
Index: customtags.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/customtags.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** customtags.cpp 13 Sep 2003 13:27:26 -0000 1.31
--- customtags.cpp 23 Sep 2003 12:40:18 -0000 1.32
***************
*** 720,730 ****
tags_->clear();
! cDBResult result = persistentBroker->query( QString( "SELECT serial,name,type,value FROM tags WHERE serial = '%1'" ).arg( key ) );
while( result.fetchrow() )
{
! QString name = result.getString( 1 );
! QString type = result.getString( 2 );
! QString value = result.getString( 3 );
if( !tags_ )
--- 720,730 ----
tags_->clear();
! cDBResult result = persistentBroker->query( QString( "SELECT name,type,value FROM tags WHERE serial = '%1'" ).arg( key ) );
while( result.fetchrow() )
{
! QString name = result.getString( 0 );
! QString type = result.getString( 1 );
! QString value = result.getString( 2 );
if( !tags_ )
Index: globals.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/globals.cpp,v
retrieving revision 1.103
retrieving revision 1.104
diff -C2 -d -r1.103 -r1.104
*** globals.cpp 9 Sep 2003 23:09:30 -0000 1.103
--- globals.cpp 23 Sep 2003 12:40:18 -0000 1.104
***************
*** 34,38 ****
#include "verinfo.h"
#include "walking.h"
- #include "scriptmanager.h"
#include "wpdefmanager.h"
#include "wptargetrequests.h"
--- 34,37 ----
***************
*** 65,69 ****
cSkills *Skills;
cSpeech *Speech;
- cScriptManager *ScriptManager;
WPDefManager *DefManager;
PersistentBroker* persistentBroker;
--- 64,67 ----
Index: globals.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/globals.h,v
retrieving revision 1.77
retrieving revision 1.78
diff -C2 -d -r1.77 -r1.78
*** globals.h 9 Sep 2003 23:09:30 -0000 1.77
--- globals.h 23 Sep 2003 12:40:18 -0000 1.78
***************
*** 49,53 ****
// Forward Class Declaration
class QDateTime;
- class cScriptManager;
class WPDefManager;
--- 49,52 ----
***************
*** 82,86 ****
extern cSkills *Skills;
extern cSpeech *Speech;
- extern cScriptManager *ScriptManager;
extern WPDefManager *DefManager;
extern PersistentBroker *persistentBroker;
--- 81,84 ----
Index: items.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/items.cpp,v
retrieving revision 1.354
retrieving revision 1.355
diff -C2 -d -r1.354 -r1.355
*** items.cpp 23 Sep 2003 11:53:31 -0000 1.354
--- items.cpp 23 Sep 2003 12:40:18 -0000 1.355
***************
*** 78,81 ****
--- 78,82 ----
buyprice_( 0 ), restock_( 1 ), antispamtimer_( 0 )
{
+ spawnregion_ = QString::null;
Init( false );
};
***************
*** 549,554 ****
this->setOwnSerialOnly(-1);
this->visible_=0; // 0=Normally Visible, 1=Owner & GM Visible, 2=GM Visible
- this->spawnregion_=(char*)0;
- // Everything decays by default.
this->priv_ = 0; // Bit 0, nodecay off/on. Bit 1, newbie item off/on. Bit 2 Dispellable
this->poisoned_ = 0; //AntiChrist -- for poisoning skill
--- 550,553 ----
***************
*** 570,574 ****
// Update Top Objects
! setSpawnRegion( (char*)0 );
SetOwnSerial( -1 );
--- 569,573 ----
// Update Top Objects
! setSpawnRegion( QString::null );
SetOwnSerial( -1 );
***************
*** 862,1058 ****
bool cItem::onSingleClick( P_PLAYER Viewer )
{
!
if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onSingleClick( this, Viewer ) )
! return true;
!
! ++i;
! }
}
! return false;
}
bool cItem::onDropOnItem( P_ITEM pItem )
{
if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! // we are the item being dragged
! if( layer_ == 0x1E )
! {
! if( scriptChain[ i ]->onDropOnItem( pItem, this ) )
! return true;
! }
! else
! {
! if( scriptChain[ i ]->onDropOnItem( this, pItem ) )
! return true;
! }
!
! ++i;
! }
}
! return false;
}
bool cItem::onDropOnGround( const Coord_cl &pos )
{
if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onDropOnGround( this, pos ) )
! return true;
!
! ++i;
! }
}
! return false;
}
bool cItem::onPickup( P_CHAR pChar )
{
if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onPickup( pChar, this ) )
! return true;
!
! ++i;
! }
}
! return false;
}
bool cItem::onEquip( P_CHAR pChar, unsigned char layer )
{
if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onEquip( pChar, this, layer ) )
! return true;
!
! ++i;
! }
}
! return false;
}
bool cItem::onBookUpdateInfo( P_CHAR pChar, const QString &author, const QString &title )
{
if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onBookUpdateInfo( pChar, this, author, title ) )
! return true;
!
! ++i;
! }
}
! return false;
}
bool cItem::onBookRequestPage( P_CHAR pChar, unsigned short page )
{
if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onBookRequestPage( pChar, this, page ) )
! return true;
!
! ++i;
! }
}
! return false;
}
bool cItem::onBookUpdatePage( P_CHAR pChar, unsigned short page, const QString &content )
{
if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onBookUpdatePage( pChar, this, page, content ) )
! return true;
!
! ++i;
! }
}
! return false;
}
bool cItem::onUnequip( P_CHAR pChar, unsigned char layer )
{
if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onUnequip( pChar, this, layer ) )
! return true;
!
! ++i;
! }
}
! return false;
}
bool cItem::onWearItem( P_PLAYER pPlayer, P_CHAR pChar, unsigned char layer )
{
if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onWearItem( pPlayer, pChar, this, layer ) )
! return true;
!
! ++i;
! }
}
! return false;
}
bool cItem::onUse( P_CHAR pChar )
{
if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onUse( pChar, this ) )
! return true;
!
! ++i;
! }
}
! return false;
}
--- 861,1014 ----
bool cItem::onSingleClick( P_PLAYER Viewer )
{
! bool result = false;
!
if( scriptChain )
{
! PyObject *args = Py_BuildValue( "O&O&", PyGetItemObject, this, PyGetCharObject, Viewer );
! result = cPythonScript::callChainedEventHandler( EVENT_SINGLECLICK, scriptChain, args );
! Py_DECREF( args );
}
! return result;
}
bool cItem::onDropOnItem( P_ITEM pItem )
{
+ bool result = false;
+
if( scriptChain )
{
! PyObject *args = Py_BuildValue( "O&O&", PyGetItemObject, layer_ == 0x1E ? pItem : this, PyGetItemObject, layer_ == 0x1E ? this : pItem );
! result = cPythonScript::callChainedEventHandler( EVENT_DROPONITEM, scriptChain, args );
! Py_DECREF( args );
}
! return result;
}
bool cItem::onDropOnGround( const Coord_cl &pos )
{
+ bool result = false;
+
if( scriptChain )
{
! PyObject *args = Py_BuildValue( "O&N", PyGetItemObject, this, PyGetCoordObject( pos ) );
! result = cPythonScript::callChainedEventHandler( EVENT_DROPONGROUND, scriptChain, args );
! Py_DECREF( args );
}
! return result;
}
bool cItem::onPickup( P_CHAR pChar )
{
+ bool result = false;
+
if( scriptChain )
{
! PyObject *args = Py_BuildValue( "O&O&", PyGetCharObject, pChar, PyGetItemObject, this );
! result = cPythonScript::callChainedEventHandler( EVENT_PICKUP, scriptChain, args );
! Py_DECREF( args );
}
! return result;
}
bool cItem::onEquip( P_CHAR pChar, unsigned char layer )
{
+ bool result = false;
+
if( scriptChain...
[truncated message content] |