wpdev-commits Mailing List for Wolfpack Emu (Page 188)
Brought to you by:
rip,
thiagocorrea
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(14) |
Aug
(121) |
Sep
(256) |
Oct
(59) |
Nov
(73) |
Dec
(120) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(259) |
Feb
(381) |
Mar
(501) |
Apr
(355) |
May
(427) |
Jun
(270) |
Jul
(394) |
Aug
(412) |
Sep
(724) |
Oct
(578) |
Nov
(65) |
Dec
|
|
From: <xs...@us...> - 2003-09-23 15:37:17
|
Update of /cvsroot/wpdev/xmlscripts/definitions/npcs/humans In directory sc8-pr-cvs1:/tmp/cvs-serv5641/definitions/npcs/humans Modified Files: guards.xml Log Message: guard fixes Index: guards.xml =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/definitions/npcs/humans/guards.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** guards.xml 21 Sep 2003 17:03:40 -0000 1.5 --- guards.xml 23 Sep 2003 15:37:12 -0000 1.6 *************** *** 96,98 **** --- 96,108 ---- </npc> + <npc id="male_teleguard"> + <inherit>male_guard</inherit> + <ai>Human_Guard_Called</ai> + </npc> + + <npc id="female_teleguard"> + <inherit>female_guard</inherit> + <ai>Human_Guard_Called</ai> + </npc> + </definitions> |
|
From: <xs...@us...> - 2003-09-23 15:37:17
|
Update of /cvsroot/wpdev/xmlscripts/definitions
In directory sc8-pr-cvs1:/tmp/cvs-serv5641/definitions
Modified Files:
regions.xml
Log Message:
guard fixes
Index: regions.xml
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/definitions/regions.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** regions.xml 5 Jul 2003 15:12:24 -0000 1.9
--- regions.xml 23 Sep 2003 15:37:13 -0000 1.10
***************
*** 26,30 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
</guards>
<escortregion />
--- 26,30 ----
</flags>
<guards>
! <list id="standard_guards" />
</guards>
<escortregion />
***************
*** 48,52 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
</guards>
<guardowner>Lord British's</guardowner>
--- 48,52 ----
</flags>
<guards>
! <list id="standard_guards" />
</guards>
<guardowner>Lord British's</guardowner>
***************
*** 67,71 ****
<escortregion />
<guards>
! <getlist>standard_guards</getlist>
</guards>
<guardowner>Lord British's Personal</guardowner>
--- 67,71 ----
<escortregion />
<guards>
! <list id="standard_guards" />
</guards>
<guardowner>Lord British's Personal</guardowner>
***************
*** 83,87 ****
<escortregion />
<guards>
! <getlist>standard_guards</getlist>
</guards>
<guardowner>Lord Blackthorne's Personal</guardowner>
--- 83,87 ----
<escortregion />
<guards>
! <list id="standard_guards" />
</guards>
<guardowner>Lord Blackthorne's Personal</guardowner>
***************
*** 98,102 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
</guards>
<escortregion />
--- 98,102 ----
</flags>
<guards>
! <list id="standard_guards" />
</guards>
<escortregion />
***************
*** 115,119 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
</guards>
<escortregion />
--- 115,119 ----
</flags>
<guards>
! <list id="standard_guards" />
</guards>
<escortregion />
***************
*** 135,139 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
<guardowner>the city</guardowner>
</guards>
--- 135,139 ----
</flags>
<guards>
! <list id="standard_guards" />
<guardowner>the city</guardowner>
</guards>
***************
*** 158,162 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
</guards>
<guardowner>the city</guardowner>
--- 158,162 ----
</flags>
<guards>
! <list id="standard_guards" />
</guards>
<guardowner>the city</guardowner>
***************
*** 173,177 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
<guardowner>the city</guardowner>
</guards>
--- 173,177 ----
</flags>
<guards>
! <list id="standard_guards" />
<guardowner>the city</guardowner>
</guards>
***************
*** 190,194 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
<guardowner>the city</guardowner>
</guards>
--- 190,194 ----
</flags>
<guards>
! <list id="standard_guards" />
<guardowner>the city</guardowner>
</guards>
***************
*** 210,214 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
<guardowner>the city</guardowner>
</guards>
--- 210,214 ----
</flags>
<guards>
! <list id="standard_guards" />
<guardowner>the city</guardowner>
</guards>
***************
*** 226,230 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
<guardowner>the city</guardowner>
</guards>
--- 226,230 ----
</flags>
<guards>
! <list id="standard_guards" />
<guardowner>the city</guardowner>
</guards>
***************
*** 241,245 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
<guardowner>the city</guardowner>
</guards>
--- 241,245 ----
</flags>
<guards>
! <list id="standard_guards" />
<guardowner>the city</guardowner>
</guards>
***************
*** 292,296 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
</guards>
<escortregion />
--- 292,296 ----
</flags>
<guards>
! <list id="standard_guards" />
</guards>
<escortregion />
***************
*** 312,316 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
</guards>
<guardowner>Lord British's</guardowner>
--- 312,316 ----
</flags>
<guards>
! <list id="standard_guards" />
</guards>
<guardowner>Lord British's</guardowner>
***************
*** 331,335 ****
<escortregion />
<guards>
! <getlist>standard_guards</getlist>
</guards>
<guardowner>Lord British's Personal</guardowner>
--- 331,335 ----
<escortregion />
<guards>
! <list id="standard_guards" />
</guards>
<guardowner>Lord British's Personal</guardowner>
***************
*** 347,351 ****
<escortregion />
<guards>
! <getlist>standard_guards</getlist>
</guards>
<guardowner>Lord Blackthorne's Personal</guardowner>
--- 347,351 ----
<escortregion />
<guards>
! <list id="standard_guards" />
</guards>
<guardowner>Lord Blackthorne's Personal</guardowner>
***************
*** 362,366 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
</guards>
<escortregion />
--- 362,366 ----
</flags>
<guards>
! <list id="standard_guards" />
</guards>
<escortregion />
***************
*** 379,383 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
</guards>
<escortregion />
--- 379,383 ----
</flags>
<guards>
! <list id="standard_guards" />
</guards>
<escortregion />
***************
*** 399,403 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
<guardowner>the city</guardowner>
</guards>
--- 399,403 ----
</flags>
<guards>
! <list id="standard_guards" />
<guardowner>the city</guardowner>
</guards>
***************
*** 422,426 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
</guards>
<guardowner>the city</guardowner>
--- 422,426 ----
</flags>
<guards>
! <list id="standard_guards" />
</guards>
<guardowner>the city</guardowner>
***************
*** 437,441 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
<guardowner>the city</guardowner>
</guards>
--- 437,441 ----
</flags>
<guards>
! <list id="standard_guards" />
<guardowner>the city</guardowner>
</guards>
***************
*** 454,458 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
<guardowner>the city</guardowner>
</guards>
--- 454,458 ----
</flags>
<guards>
! <list id="standard_guards" />
<guardowner>the city</guardowner>
</guards>
***************
*** 474,478 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
<guardowner>the city</guardowner>
</guards>
--- 474,478 ----
</flags>
<guards>
! <list id="standard_guards" />
<guardowner>the city</guardowner>
</guards>
***************
*** 490,494 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
<guardowner>the city</guardowner>
</guards>
--- 490,494 ----
</flags>
<guards>
! <list id="standard_guards" />
<guardowner>the city</guardowner>
</guards>
***************
*** 505,509 ****
</flags>
<guards>
! <getlist>standard_guards</getlist>
<guardowner>the city</guardowner>
</guards>
--- 505,509 ----
</flags>
<guards>
! <list id="standard_guards" />
<guardowner>the city</guardowner>
</guards>
|
|
From: <xs...@us...> - 2003-09-23 15:37:17
|
Update of /cvsroot/wpdev/xmlscripts/definitions/lists In directory sc8-pr-cvs1:/tmp/cvs-serv5641/definitions/lists Modified Files: npcs.xml Log Message: guard fixes Index: npcs.xml =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/definitions/lists/npcs.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** npcs.xml 1 Aug 2002 14:56:30 -0000 1.2 --- npcs.xml 23 Sep 2003 15:37:12 -0000 1.3 *************** *** 12,14 **** --- 12,19 ---- <item>skeleton</item> </list> + + <list id="standard_guards"> + <item>male_teleguard</item> + <item>female_teleguard</item> + </list> </definitions> |
|
From: <xs...@us...> - 2003-09-23 15:36:35
|
Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv5514
Modified Files:
ai.cpp ai_humans.cpp ai_monsters.cpp npc.cpp
Log Message:
slight fixes
Index: ai.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ai.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** ai.cpp 20 Sep 2003 01:05:09 -0000 1.20
--- ai.cpp 23 Sep 2003 15:36:30 -0000 1.21
***************
*** 443,446 ****
--- 443,449 ----
void Action_Wander::execute()
{
+ if( m_npc->isAtWar() )
+ m_npc->toggleCombat();
+
switch( m_npc->wanderType() )
{
Index: ai_humans.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ai_humans.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ai_humans.cpp 23 Sep 2003 11:53:30 -0000 1.2
--- ai_humans.cpp 23 Sep 2003 15:36:30 -0000 1.3
***************
*** 412,415 ****
--- 412,418 ----
}
+ if( !m_npc->isAtWar() )
+ m_npc->toggleCombat();
+
// Fighting is handled within combat..
}
***************
*** 436,439 ****
--- 439,445 ----
void Human_Guard_MoveToTarget::execute()
{
+ if( !m_npc->isAtWar() )
+ m_npc->toggleCombat();
+
Human_Guard* pAI = dynamic_cast< Human_Guard* >(m_ai);
P_CHAR pTarget = ( pAI ? pAI->currentVictim() : NULL );
Index: ai_monsters.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ai_monsters.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** ai_monsters.cpp 20 Aug 2003 17:10:48 -0000 1.11
--- ai_monsters.cpp 23 Sep 2003 15:36:30 -0000 1.12
***************
*** 245,248 ****
--- 245,251 ----
void Monster_Aggr_MoveToTarget::execute()
{
+ if( !m_npc->isAtWar() )
+ m_npc->toggleCombat();
+
Monster_Aggressive* pAI = dynamic_cast< Monster_Aggressive* >( m_ai );
if( !pAI || !pAI->currentVictim() )
***************
*** 310,313 ****
--- 313,319 ----
void Monster_Aggr_Fight::execute()
{
+ if( !m_npc->isAtWar() )
+ m_npc->toggleCombat();
+
// the execution of combat is handled somewhere else ;)
// nothing to do
Index: npc.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/npc.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** npc.cpp 23 Sep 2003 12:40:18 -0000 1.47
--- npc.cpp 23 Sep 2003 15:36:30 -0000 1.48
***************
*** 921,925 ****
{
setAtWar( !isAtWar() );
! Movement::instance()->CombatWalk( this );
}
--- 921,925 ----
{
setAtWar( !isAtWar() );
! update();
}
|
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 )
{
! PyObject *args = Py_BuildValue( "O&O&b", PyGetCharObject, pChar, PyGetItemObject, this, layer );
! result = cPythonScript::callChainedEventHandler( EVENT_EQUIP, scriptChain, args );
! Py_DECREF( args );
}
! return result;
}
bool cItem::onBookUpdateInfo( P_CHAR pChar, const QString &author, const QString &title )
{
+ bool result = false;
+
if( scriptChain )
{
! PyObject *args = Py_BuildValue( "O&O&uu", PyGetCharObject, pChar, PyGetItemObject, this, author.ucs2(), title.ucs2() );
! result = cPythonScript::callChainedEventHandler( EVENT_BOOKUPDATEINFO, scriptChain, args );
! Py_DECREF( args );
}
! return result;
}
bool cItem::onBookRequestPage( P_CHAR pChar, unsigned short page )
{
+ bool result = false;
+
if( scriptChain )
{
! PyObject *args = Py_BuildValue( "O&O&h", PyGetCharObject, pChar, PyGetItemObject, this, page );
! result = cPythonScript::callChainedEventHandler( EVENT_BOOKREQUESTPAGE, scriptChain, args );
! Py_DECREF( args );
}
! return result;
}
bool cItem::onBookUpdatePage( P_CHAR pChar, unsigned short page, const QString &content )
{
+ bool result = false;
+
if( scriptChain )
{
! PyObject *args = Py_BuildValue( "O&O&hu", PyGetCharObject, pChar, PyGetItemObject, this, page, content.ucs2() );
! result = cPythonScript::callChainedEventHandler( EVENT_BOOKUPDATEPAGE, scriptChain, args );
! Py_DECREF( args );
}
! return result;
}
bool cItem::onUnequip( P_CHAR pChar, unsigned char layer )
{
+ bool result = false;
+
if( scriptChain )
{
! PyObject *args = Py_BuildValue( "O&O&b", PyGetCharObject, pChar, PyGetItemObject, this, layer );
! result = cPythonScript::callChainedEventHandler( EVENT_UNEQUIP, scriptChain, args );
! Py_DECREF( args );
}
! return result;
}
bool cItem::onWearItem( P_PLAYER pPlayer, P_CHAR pChar, unsigned char layer )
{
+ bool result = false;
+
if( scriptChain )
{
! PyObject *args = Py_BuildValue( "O&O&O&b", PyGetCharObject, pPlayer, PyGetCharObject, pChar, PyGetItemObject, this, layer );
! result = cPythonScript::callChainedEventHandler( EVENT_WEARITEM, scriptChain, args );
! Py_DECREF( args );
}
! return result;
}
bool cItem::onUse( P_CHAR pChar )
{
+ bool result = false;
+
if( scriptChain )
{
! PyObject *args = Py_BuildValue( "O&O&", PyGetCharObject, pChar, PyGetItemObject, this );
! result = cPythonScript::callChainedEventHandler( EVENT_USE, scriptChain, args );
! Py_DECREF( args );
}
! return result;
}
***************
*** 1060,1121 ****
bool cItem::onCollide( P_CHAR pChar )
{
if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onCollide( pChar, this ) )
! return true;
!
! ++i;
! }
}
! return false;
}
bool cItem::onDropOnChar( P_CHAR pChar )
{
! // If we got ANY events process them in order
if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onDropOnChar( pChar, this ) )
! return true;
!
! ++i;
! }
}
! return false;
}
bool cItem::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_ITEM, EVENT_SHOWTOOLTIP );
! for( it = hooks.begin(); it != hooks.end(); ++it )
! if( (*it)->onShowToolTip( sender, this, tooltip ) )
! return true;
! return false;
}
--- 1016,1063 ----
bool cItem::onCollide( P_CHAR pChar )
{
+ bool result = false;
+
if( scriptChain )
{
! PyObject *args = Py_BuildValue( "O&O&", PyGetCharObject, pChar, PyGetItemObject, this );
! result = cPythonScript::callChainedEventHandler( EVENT_COLLIDE, scriptChain, args );
! Py_DECREF( args );
}
! return result;
}
bool cItem::onDropOnChar( P_CHAR pChar )
{
! bool result = false;
!
if( scriptChain )
{
! PyObject *args = Py_BuildValue( "O&O&", PyGetCharObject, pChar, PyGetItemObject, this );
! result = cPythonScript::callChainedEventHandler( EVENT_DROPONCHAR, scriptChain, args );
! Py_DECREF( args );
}
! return result;
}
bool cItem::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, PyGetItemObject, this, PyGetTooltipObject, tooltip );
! result = cPythonScript::callChainedEventHandler( EVENT_SHOWTOOLTIP, scriptChain, args );
! if( !result && global )
! result = global->callEventHandler( EVENT_SHOWTOOLTIP, args );
! Py_DECREF( args );
! }
! return result;
}
***************
*** 1870,1877 ****
// Set the outside indices
! pi->setSpawnRegion( pi->spawnregion() );
! pi->SetOwnSerial( pi->ownSerial() );
!
! if( pi->maxhp() == 0)
pi->setMaxhp( pi->hp() );
}
--- 1812,1816 ----
// Set the outside indices
! if( pi->maxhp() == 0 )
pi->setMaxhp( pi->hp() );
}
Index: npc.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/npc.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** npc.cpp 20 Sep 2003 12:01:43 -0000 1.46
--- npc.cpp 23 Sep 2003 12:40:18 -0000 1.47
***************
*** 693,699 ****
return;
- if( onSingleClick( socket->player() ) )
- return;
-
QString charName = name();
--- 693,696 ----
Index: player.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/player.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** player.cpp 23 Sep 2003 11:53:31 -0000 1.42
--- player.cpp 23 Sep 2003 12:40:18 -0000 1.43
***************
*** 842,848 ****
return;
- if( onSingleClick( socket->player() ) )
- return;
-
QString charName = name();
--- 842,845 ----
***************
*** 1304,1404 ****
bool cPlayer::onPickup( P_ITEM pItem )
{
if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onPickup( this, pItem ) )
! return true;
!
! ++i;
! }
! }
! // Try to process the hooks then
! QValueVector< cPythonScript* > hooks;
! QValueVector< cPythonScript* >::const_iterator it;
! hooks = ScriptManager->getGlobalHooks( OBJECT_CHAR, EVENT_PICKUP );
! for( it = hooks.begin(); it != hooks.end(); ++it )
! if( (*it)->onPickup( this, pItem ) )
! return true;
! return false;
}
bool cPlayer::onLogin( void )
{
! if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onLogin( this ) )
! return true;
! ++i;
! }
! }
! // Try to process the hooks then
! QValueVector< cPythonScript* > hooks;
! QValueVector< cPythonScript* >::const_iterator it;
! hooks = ScriptManager->getGlobalHooks( OBJECT_CHAR, EVENT_LOGIN );
! for( it = hooks.begin(); it != hooks.end(); ++it )
! (*it)->onLogin( this );
! return false;
}
bool cPlayer::onCastSpell( unsigned int spell )
{
! if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onCastSpell( this, spell ) )
! return true;
! ++i;
! }
! }
! // Try to process the hooks then
! QValueVector< cPythonScript* > hooks;
! QValueVector< cPythonScript* >::const_iterator it;
! hooks = ScriptManager->getGlobalHooks( OBJECT_CHAR, EVENT_CASTSPELL );
! for( it = hooks.begin(); it != hooks.end(); ++it )
! (*it)->onCastSpell( this, spell );
! return false;
}
bool cPlayer::onLogout( void )
{
! if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onLogout( this ) )
! return true;
! ++i;
! }
! }
! // Try to process the hooks then
! QValueVector< cPythonScript* > hooks;
! QValueVector< cPythonScript* >::const_iterator it;
! hooks = ScriptManager->getGlobalHooks( OBJECT_CHAR, EVENT_LOGOUT );
! for( it = hooks.begin(); it != hooks.end(); ++it )
! (*it)->onLogout( this );
! return false;
}
--- 1301,1376 ----
bool cPlayer::onPickup( P_ITEM pItem )
{
+ bool result = false;
+
if( scriptChain )
{
! PyObject *args = Py_BuildValue( "O&O&", PyGetCharObject, this, PyGetItemObject, pItem );
! result = cPythonScript::callChainedEventHandler( EVENT_PICKUP, scriptChain, args );
! Py_DECREF( args );
! }
! return result;
}
bool cPlayer::onLogin( void )
{
! cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_LOGIN );
! bool result = false;
!
! if( scriptChain || global )
{
! PyObject *args = Py_BuildValue( "O&", PyGetCharObject, this );
! result = cPythonScript::callChainedEventHandler( EVENT_LOGIN, scriptChain, args );
! if( !result && global )
! result = global->callEventHandler( EVENT_LOGIN, args );
! Py_DECREF( args );
! }
! return result;
}
bool cPlayer::onCastSpell( unsigned int spell )
{
! cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_CASTSPELL );
! bool result = false;
!
! if( scriptChain || global )
{
! PyObject *args = Py_BuildValue( "O&i", PyGetCharObject, this, spell );
! result = cPythonScript::callChainedEventHandler( EVENT_CASTSPELL, scriptChain, args );
! if( !result && global )
! result = global->callEventHandler( EVENT_CASTSPELL, args );
! Py_DECREF( args );
! }
! return result;
}
bool cPlayer::onLogout( void )
{
! cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_LOGOUT );
! bool result = false;
!
! if( scriptChain || global )
{
! PyObject *args = Py_BuildValue( "O&", PyGetCharObject, this );
! result = cPythonScript::callChainedEventHandler( EVENT_LOGOUT, scriptChain, args );
! if( !result && global )
! result = global->callEventHandler( EVENT_LOGOUT, args );
! Py_DECREF( args );
! }
! return result;
}
***************
*** 1406,1432 ****
bool cPlayer::onHelp( void )
{
! // If we got ANY events process them in order
! if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onHelp( this ) )
! return true;
! ++i;
! }
! }
! // Try to process the hooks then
! QValueVector< cPythonScript* > hooks;
! QValueVector< cPythonScript* >::const_iterator it;
! hooks = ScriptManager->getGlobalHooks( OBJECT_CHAR, EVENT_HELP );
! for( it = hooks.begin(); it != hooks.end(); ++it )
! if( (*it)->onHelp( this ) )
! return true;
! return false;
}
--- 1378,1397 ----
bool cPlayer::onHelp( void )
{
! cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_HELP );
! bool result = false;
!
! if( scriptChain || global )
{
! PyObject *args = Py_BuildValue( "O&", PyGetCharObject, this );
! result = cPythonScript::callChainedEventHandler( EVENT_HELP, scriptChain, args );
! if( !result && global )
! result = global->callEventHandler( EVENT_HELP, args );
! Py_DECREF( args );
! }
! return result;
}
***************
*** 1434,1494 ****
bool cPlayer::onChat( void )
{
! // If we got ANY events process them in order
! if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onChat( this ) )
! return true;
! ++i;
! }
! }
! // Try to process the hooks then
! QValueVector< cPythonScript* > hooks;
! QValueVector< cPythonScript* >::const_iterator it;
! hooks = ScriptManager->getGlobalHooks( OBJECT_CHAR, EVENT_CHAT );
! for( it = hooks.begin(); it != hooks.end(); ++it )
! if( (*it)->onChat( this ) )
! return true;
! return false;
}
bool cPlayer::onShowContext( cUObject *object )
{
if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onShowContextMenu( this, object ) )
! return true;
!
! ++i;
! }
}
! return false;
}
bool cPlayer::onUse( P_ITEM pItem )
{
if( scriptChain )
{
! unsigned int i = 0;
! while( scriptChain[i] )
! {
! if( scriptChain[ i ]->onUse( this, pItem ) )
! return true;
!
! ++i;
! }
}
! return false;
}
--- 1399,1446 ----
bool cPlayer::onChat( void )
{
! cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_CHAT );
! bool result = false;
!
! if( scriptChain || global )
{
! PyObject *args = Py_BuildValue( "O&", PyGetCharObject, this );
! result = cPythonScript::callChainedEventHandler( EVENT_CHAT, scriptChain, args );
! if( !result && global )
! result = global->callEventHandler( EVENT_CHAT, args );
! Py_DECREF( args );
! }
! return result;
}
bool cPlayer::onShowContext( cUObject *object )
{
+ bool result = false;
+
if( scriptChain )
{
! PyObject *args = Py_BuildValue( "O&O&", PyGetCharObject, this, PyGetObjectObject, object );
! result = cPythonScript::callChainedEventHandler( EVENT_SHOWCONTEXTMENU, scriptChain, args );
! Py_DECREF( args );
}
! return result;
}
bool cPlayer::onUse( P_ITEM pItem )
{
+ bool result = false;
+
if( scriptChain )
{
! PyObject *args = Py_BuildValue( "O&O&", PyGetCharObject, this, PyGetItemObject, pItem );
! result = cPythonScript::callChainedEventHandler( EVENT_USE, scriptChain, args );
! Py_DECREF( args );
}
! return result;
}
Index: pythonscript.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/pythonscript.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** pythonscript.cpp 20 Sep 2003 01:05:10 -0000 1.11
--- pythonscript.cpp 23 Sep 2003 12:40:18 -0000 1.12
***************
*** 50,118 ****
#include "python/target.h"
! void cPythonScript::addKeyword( UINT16 data )
! {
! speechKeywords_.push_back( data );
! }
!
! void cPythonScript::addWord( const QString &data )
! {
! speechWords_.push_back( data );
! }
!
! void cPythonScript::addRegexp( const QRegExp &data )
{
! speechRegexp_.push_back( data );
}
! bool cPythonScript::canHandleSpeech( const QString &text, const QValueVector< UINT16 >& keywords )
{
- // Check keywords first.
- for( QValueVector< UINT16 >::const_iterator iter1 = keywords.begin(); iter1 != keywords.end(); ++iter1 )
- for( QValueVector< UINT16 >::const_iterator iter2 = speechKeywords_.begin(); iter2 != speechKeywords_.end(); ++iter2 )
- {
- if( *iter1 == *iter2 )
- return true;
- }
-
- for( QValueVector< QString >::const_iterator iter3 = speechWords_.begin(); iter3 != speechWords_.end(); ++iter3 )
- if( text.contains( *iter3 ) )
- return true;
-
- for( QValueVector< QRegExp >::const_iterator iter4 = speechRegexp_.begin(); iter4 != speechRegexp_.end(); ++iter4 )
- if( text.contains( *iter4 ) )
- return true;
-
- return false;
}
void cPythonScript::unload( void )
{
! if( !codeModule )
! return;
!
! PyObject* method = PyObject_GetAttrString( codeModule, "onUnload" );
!
! if( !method )
{
! PyErr_Clear();
! Py_DECREF( codeModule );
! codeModule = 0;
! return;
}
! if ( !PyCallable_Check( method ) )
! {
! Py_DECREF( method );
! Py_DECREF( codeModule );
! codeModule = 0;
! }
!
! PyObject* result = PyObject_CallObject( method, NULL );
! reportPythonError( name_ );
! Py_XDECREF( result ); // void
! Py_DECREF( method );
! Py_DECREF( codeModule );
! codeModule = 0;
}
--- 50,80 ----
#include "python/target.h"
! cPythonScript::cPythonScript()
{
! codeModule = 0;
! for( unsigned int i = 0; i < EVENT_COUNT; ++i )
! events[i] = 0;
}
! cPythonScript::~cPythonScript()
{
}
void cPythonScript::unload( void )
{
! // Free Cached Events
! for( unsigned int i = 0; i < EVENT_COUNT; ++i )
{
! if( events[ i ] )
! {
! Py_XDECREF( events[ i ] );
! events[ i ] = 0;
! }
}
! callEventHandler( "onUnload" );
+ Py_XDECREF( codeModule );
+ codeModule = 0;
}
***************
*** 120,138 ****
bool cPythonScript::load( const cElement *element )
{
- // Initialize it
- codeModule = NULL;
- catchAllSpeech_ = false;
-
QString name = element->text();
! if( name.isNull() )
return false;
setName( name );
! if( name.isNull() || name.isEmpty() )
! return false;
!
! codeModule = PyImport_ImportModule( const_cast<char*>(name.latin1()) );
if( !codeModule )
--- 82,93 ----
bool cPythonScript::load( const cElement *element )
{
QString name = element->text();
! if( name.isEmpty() )
return false;
setName( name );
! codeModule = PyImport_ImportModule( const_cast< char* >( name.latin1() ) );
if( !codeModule )
***************
*** 144,721 ****
}
! // Call the load Function
! PyObject* method = PyObject_GetAttrString( codeModule, "onLoad" );
!
! if ( method )
! {
! if ( PyCallable_Check( method ) )
! {
! PyObject* result = PyObject_CallObject( method, NULL );
! if( PyErr_Occurred() )
! {
! Console::instance()->ProgressFail();
! reportPythonError( name );
! Console::instance()->PrepareProgress( "Continuing loading" );
! }
! Py_XDECREF( result );
! }
! Py_DECREF( method );
! }
!
! handleSpeech_ = PyObject_HasAttrString( codeModule, "onSpeech" );
! return true;
! }
!
! //========================== OVERRIDDEN DEFAULT EVENTS
! bool cPythonScript::onServerstart()
! {
! PyHasMethod( "onServerstart" )
! return PyEvalMethod( "onServerstart", PyTuple_New( 0 ) );
! }
!
! bool cPythonScript::onUse( P_CHAR User, P_ITEM Used )
! {
! PyHasMethod( "onUse" )
!
! // Create our args for the python function
! PyObject *tuple = PyTuple_New( 2 );
! PyTuple_SetItem( tuple, 0, PyGetCharObject( User ) );
! PyTuple_SetItem( tuple, 1, PyGetItemObject( Used ) );
!
! return PyEvalMethod( "onUse", tuple );
! }
!
! bool cPythonScript::onSingleClick( P_ITEM Item, P_CHAR Viewer )
! {
! PyHasMethod( "onSingleClick" )
!
! PyObject *tuple = PyTuple_New( 2 ); // Create our args for the python function
! PyTuple_SetItem( tuple, 0, PyGetItemObject( Item ) );
! PyTuple_SetItem( tuple, 1, PyGetCharObject( Viewer ) );
!
! return PyEvalMethod( "onSingleClick", tuple );
! }
!
! bool cPythonScript::onSingleClick( P_CHAR Character, P_CHAR Viewer )
! {
! PyHasMethod( "onSingleClick" )
!
! PyObject *tuple = PyTuple_New( 2 ); // Create our args for the python function
! PyTuple_SetItem( tuple, 0, PyGetCharObject( Character ) );
! PyTuple_SetItem( tuple, 1, PyGetCharObject( Viewer ) );
!
! return PyEvalMethod( "onSingleClick", tuple );
! }
!
! bool cPythonScript::onLogout( P_CHAR Character )
! {
! PyHasMethod( "onLogout" )
!
! PyObject *tuple = PyTuple_New( 1 ); // Create our args for the python function
! PyTuple_SetItem( tuple, 0, PyGetCharObject( Character ) );
!
! return PyEvalMethod( "onLogout", tuple );
! }
!
! bool cPythonScript::onLogin( P_CHAR Character )
! {
! PyHasMethod( "onLogin" )
!
! PyObject *tuple = PyTuple_New( 1 ); // Create our args for the python function
! PyTuple_SetItem( tuple, 0, PyGetCharObject( Character ) );
!
! return PyEvalMethod( "onLogin", tuple );
! }
!
! bool cPythonScript::onCollide( P_CHAR Character, P_ITEM Obstacle )
! {
! PyHasMethod( "onCollide" )
!
! PyObject *tuple = PyTuple_New( 2 ); // Create our args for the python function
! PyTuple_SetItem( tuple, 0, PyGetCharObject( Character ) );
! PyTuple_SetItem( tuple, 1, PyGetItemObject( Obstacle ) );
!
! return PyEvalMethod( "onCollide", tuple );
! }
!
! bool cPythonScript::onWalk( P_CHAR Character, UINT8 Direction, UINT8 Sequence )
! {
! PyHasMethod( "onWalk" )
!
! PyObject *tuple = PyTuple_New( 3 ); // Create our args for the python function
! PyTuple_SetItem( tuple, 0, PyGetCharObject( Character ) );
! PyTuple_SetItem( tuple, 1, PyInt_FromLong( Direction ) );
! PyTuple_SetItem( tuple, 2, PyInt_FromLong( Sequence ) );
!
! return PyEvalMethod( "onWalk", tuple );
! }
!
! // if this events returns true (handeled) then we should not display the text
! bool cPythonScript::onTalk( P_CHAR Character, char speechType, UINT16 speechColor, UINT16 speechFont, const QString &Text, const QString &Lang )
! {
! PyHasMethod( "onTalk" )
!
! PyObject *tuple = PyTuple_New( 6 ); // Create our args for the python function
! PyTuple_SetItem( tuple, 0, PyGetCharObject( Character ) );
! PyTuple_SetItem( tuple, 1, PyInt_FromLong( speechType ) );
! PyTuple_SetItem( tuple, 2, PyInt_FromLong( speechColor ) );
! PyTuple_SetItem( tuple, 3, PyInt_FromLong( speechFont ) );
! PyTuple_SetItem( tuple, 4, PyString_FromString( Text.ascii() ) );
! PyTuple_SetItem( tuple, 5, PyString_FromString( Lang.ascii() ) );
!
! return PyEvalMethod( "onTalk", tuple );
! }
!
! bool cPythonScript::onWarModeToggle( P_CHAR Character, bool War )
! {
! PyHasMethod( "onWarModeToggle" )
!
! PyObject *tuple = PyTuple_New( 2 ); // Create our args for the python function
! PyTuple_SetItem( tuple, 0, PyGetCharObject( Character ) );
! PyTuple_SetItem( tuple, 1, ( War ? PyInt_FromLong( 1 ) : PyInt_FromLong( 0 ) ) );
!
! return PyEvalMethod( "onWarModeToggle", tuple );
! }
!
! bool cPythonScript::onHelp( P_CHAR Character )
! {
! PyHasMethod( "onHelp" )
!
! PyObject *tuple = PyTuple_New( 1 ); // Create our args for the python function
! PyTuple_SetItem( tuple, 0, PyGetCharObject( Character ) );
!
! return PyEvalMethod( "onHelp", tuple );
! }
!
!
! bool cPythonScript::onChat( P_CHAR Character )
! {
! PyHasMethod( "onChat" )
!
! PyObject *tuple = PyTuple_New( 1 ); // Create our args for the python function
! PyTuple_SetItem( tuple, 0, PyGetCharObject( Character ) );
!
! return PyEvalMethod( "onChat", tuple );
! }
!
!
! bool cPythonScript::onSkillUse( P_CHAR Character, UINT8 Skill )
! {
! PyHasMethod( "onSkillUse" )
!
! PyObject *tuple = PyTuple_New( 2 ); // Create our args for the python function
! PyTuple_SetItem( tuple, 0, PyGetCharObject( Character ) );
! PyTuple_SetItem( tuple, 1, PyInt_FromLong( Skill ) );
!
! return PyEvalMethod( "onSkillUse", tuple );
! }
!
! bool cPythonScript::onSkillGain( P_CHAR Character, UINT8 Skill, INT32 min, INT32 max, bool success )
! {
! PyHasMethod( "onSkillGain" )
!
! PyObject *tuple = PyTuple_New( 5 );
! PyTuple_SetItem( tuple, 0, PyGetCharObject( Character ) );
! PyTuple_SetItem( tuple, 1, PyInt_FromLong( Skill ) );
! PyTuple_SetItem( tuple, 2, PyInt_FromLong( min ) );
! PyTuple_SetItem( tuple, 3, PyInt_FromLong( max ) );
! PyTuple_SetItem( tuple, 4, PyInt_FromLong( success ) );
!
! return PyEvalMethod( "onSkillGain", tuple );
! }
!
! bool cPythonScript::onStatGain( P_CHAR Character, UINT8 stat, INT8 amount )
! {
! PyHasMethod( "onStatGain" )
!
! PyObject *tuple = PyTuple_New( 3 );
! PyTuple_SetItem( tuple, 0, PyGetCharObject( Character ) );
! PyTuple_SetItem( tuple, 1, PyInt_FromLong( stat ) );
! PyTuple_SetItem( tuple, 2, PyInt_FromLong( amount ) );
!
! return PyEvalMethod( "onStatGain", tuple );
! }
!
! bool cPythonScript::onContextEntry( P_CHAR pChar, cUObject *pObject, UINT16 id )
! {
! PyHasMethod( "onContextEntry" )
!
! PyObject *tuple = PyTuple_New( 3 );
! PyTuple_SetItem( tuple, 0, PyGetCharObject( pChar ) );
!
! if( isItemSerial( pObject->serial() ) )
! PyTuple_SetItem( tuple, 1, PyGetItemObject( (P_ITEM)pObject ) );
! else if( isCharSerial( pObject->serial() ) )
! PyTuple_SetItem( tuple, 1, PyGetCharObject( (P_CHAR)pObject ) );
!
! PyTuple_SetItem( tuple, 2, PyInt_FromLong( id ) );
!
! return PyEvalMethod( "onContextEntry", tuple );
! }
!
! bool cPythonScript::onShowContextMenu( P_CHAR pChar, cUObject *pObject )
! {
! PyHasMethod( "onShowContextMenu" )
!
! PyObject *tuple = PyTuple_New( 2 );
! PyTuple_SetItem( tuple, 0, PyGetCharObject( pChar ) );
!
! if( isItemSerial( pObject->serial() ) )
! PyTuple_SetItem( tuple, 1, PyGetItemObject( (P_ITEM)pObject ) );
! else if( isCharSerial( pObject->serial() ) )
! PyTuple_SetItem( tuple, 1, PyGetCharObject( (P_CHAR)pObject ) );
!
! return PyEvalMethod( "onShowContextMenu", tuple );
! }
!
! bool cPythonScript::onShowToolTip( P_CHAR pChar, cUObject *pObject, cUOTxTooltipList* tooltip )
! {
! PyHasMethod( "onShowToolTip" )
!
! PyObject *tuple = PyTuple_New( 3 );
! PyTuple_SetItem( tuple, 0, PyGetCharObject( pChar ) );
!
! if( isItemSerial( pObject->serial() ) )
! PyTuple_SetItem( tuple, 1, PyGetItemObject( (P_ITEM)pObject ) );
! else if( isCharSerial( pObject->serial() ) )
! PyTuple_SetItem( tuple, 1, PyGetCharObject( (P_CHAR)pObject ) );
!
! PyTuple_SetItem( tuple, 2, PyGetTooltipObject( tooltip ) );
!
! return PyEvalMethod( "onShowToolTip", tuple );
! }
!
! bool cPythonScript::onCHLevelChange( P_CHAR pChar, uint level )
! {
! PyHasMethod( "onCHLevelChange" )
!
! PyObject *tuple = PyTuple_New( 2 );
! PyTuple_SetItem( tuple, 0, PyGetCharObject( pChar ) );
! PyTuple_SetItem( tuple, 1, PyInt_FromLong( level ) );
!
! return PyEvalMethod( "onCHLevelChange", tuple );
! }
!
!
! unsigned int cPythonScript::onDamage( P_CHAR pChar, unsigned char type, unsigned int amount, cUObject *source )
! {
! if( !codeModule )
! return amount;
!
! PyObject *method = PyObject_GetAttrString( codeModule, "onDamage" );
!
! if( !method )
! return amount;
! if ( !PyCallable_Check( method ) )
{
! Py_DECREF( method );
! return amount;
}
! PyObject *args = PyTuple_New( 4 );
!
! PyTuple_SetItem( args, 0, PyGetCharObject( pChar ) );
! PyTuple_SetItem( args, 1, PyInt_FromLong( type ) );
! PyTuple_SetItem( args, 2, PyInt_FromLong( amount ) );
!
! if( source && source->isItem() )
! PyTuple_SetItem( args, 3, PyGetItemObject( dynamic_cast< P_ITEM >( source ) ) );
! else
! PyTuple_SetItem( args, 3, PyGetCharObject( dynamic_cast< P_CHAR >( source ) ) );
!
!
! PyObject *returnValue = PyObject_CallObject( method, args );
!
! reportPythonError( name_ );
! Py_DECREF( args );
! Py_DECREF( method );
!
! if( !returnValue )
! return amount;
! if ( !PyInt_Check( returnValue ) )
{
! Py_DECREF( returnValue );
! return amount;
! }
!
! amount = PyInt_AsLong( returnValue );
! Py_DECREF( returnValue );
! return amount;
! }
!
! bool cPythonScript::onCastSpell( cPlayer *player, unsigned int spell )
! {
! PyHasMethod( "onCastSpell" )
!
! PyObject *tuple = PyTuple_New( 2 );
! PyTuple_SetItem( tuple, 0, PyGetCharObject( player) );
! PyTuple_SetItem( tuple, 1, PyInt_FromLong( spell ) );
!
! return PyEvalMethod( "onCastSpell", tuple );
! }
!
! bool cPythonScript::onCreate( cUObject *object, const QString &definition )
! {
! PyHasMethod( "onCreate" )
!
! PyObject *tuple = PyTuple_New( 2 );
!
! if( object->isChar() )
! PyTuple_SetItem( tuple, 0, PyGetCharObject( (P_CHAR)object ) );
! else if( object->isItem() )
! PyTuple_SetItem( tuple, 0, PyGetItemObject( (P_ITEM)object ) );
!
! PyTuple_SetItem( tuple, 1, PyString_FromString( definition.latin1() ) );
!
! return PyEvalMethod( "onCreate", tuple );
! }
!
! bool cPythonScript::onSpeech( cUObject *listener, P_CHAR talker, const QString &text, const QValueVector< UINT16 >& keywords )
! {
! PyHasMethod( "onSpeech" )
!
! PyObject *tuple = PyTuple_New( 4 ); // Create our args for the python function
! if( isItemSerial( listener->serial() ) )
! PyTuple_SetItem( tuple, 0, PyGetItemObject( (P_ITEM)listener ) );
! else
! PyTuple_SetItem( tuple, 0, PyGetCharObject( (P_CHAR)listener ) );
! PyTuple_SetItem( tuple, 1, PyGetCharObject( talker ) );
! PyTuple_SetItem( tuple, 2, PyString_FromString( text.latin1() ) );
!
! // Convert the keywords into a list
! PyObject *list = PyList_New( 0 );
! for( QValueVector< UINT16 >::const_iterator iter = keywords.begin(); iter != keywords.end(); ++iter )
! PyList_Append( list, PyInt_FromLong( *iter ) );
!
!
! PyTuple_SetItem( tuple, 3, list );
!
! return PyEvalMethod( "onSpeech", tuple );
! }
! bool cPythonScript::onDropOnChar( P_CHAR pChar, P_ITEM pItem )
! {
! PyHasMethod( "onDropOnChar" )
!
! PyObject *tuple = PyTuple_New( 2 );
! PyTuple_SetItem( tuple, 0, PyGetCharObject( pChar ) );
! PyTuple_SetItem( tuple, 1, PyGetItemObject( pItem ) );
! return PyEvalMethod( "onDropOnChar", tuple );
! }
! bool cPythonScript::onDropOnItem( P_ITEM pCont, P_ITEM pItem )
! {
! PyHasMethod( "onDropOnItem" )
!
! PyObject *tuple = PyTuple_New( 2 );
! PyTuple_SetItem( tuple, 0, PyGetItemObject( pCont ) );
! PyTuple_SetItem( tuple, 1, PyGetItemObject( pItem ) );
! return PyEvalMethod( "onDropOnItem", tuple );
}
! bool cPythonScript::onDropOnGround( P_ITEM pItem, const Coord_cl &pos )
{
! PyHasMethod( "onDropOnGround" )
!
! PyObject *tuple = PyTuple_New( 2 );
! PyTuple_SetItem( tuple, 0, PyGetItemObject( pItem ) );
! PyTuple_SetItem( tuple, 1, PyGetCoordObject( pos ) );
! return PyEvalMethod( "onDropOnGround", tuple );
! }
! bool cPythonScript::onPickup( P_CHAR pChar, P_ITEM pItem )
! {
! PyHasMethod( "onPickup" )
!
! PyObject *tuple = PyTuple_New( 2 );
! PyTuple_SetItem( tuple, 0, PyGetCharObject( pChar ) );
! PyTuple_SetItem( tuple, 1, PyGetItemObject( pItem ) );
! return PyEvalMethod( "onPickup", tuple );
}
! bool cPythonScript::onCommand( cUOSocket *socket, const QString &name, const QString &args )
{
! PyHasMethod( "onCommand" )
!
! // Create our args for the python function
! PyObject *tuple = PyTuple_New( 3 );
! PyTuple_SetItem( tuple, 0, PyGetSocketObject( socket ) );
! PyTuple_SetItem( tuple, 1, PyString_FromString( name.latin1() ) );
! PyTuple_SetItem( tuple, 2, PyString_FromString( args.latin1() ) );
!
! return PyEvalMethod( "onCommand", tuple );
! }
! bool cPythonScript::onShowPaperdoll( P_CHAR pChar, P_CHAR pOrigin )
! {
! PyHasMethod( "onShowPaperdoll" )
...
[truncated message content] |
|
From: <dar...@us...> - 2003-09-23 12:40:24
|
Update of /cvsroot/wpdev/wolfpack/python
In directory sc8-pr-cvs1:/tmp/cvs-serv2528/python
Modified Files:
char.cpp global.cpp item.cpp multi.cpp utilities.h
Log Message:
Changed Python Interface
Changed behaviour of setGlobalHook and setCommandHook
Index: char.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/char.cpp,v
retrieving revision 1.105
retrieving revision 1.106
diff -C2 -d -r1.105 -r1.106
*** char.cpp 15 Sep 2003 12:49:05 -0000 1.105
--- char.cpp 23 Sep 2003 12:40:19 -0000 1.106
***************
*** 1789,1793 ****
continue;
! cPythonScript *script = ScriptManager->find( PyString_AsString( PyList_GetItem( value, i ) ) );
if( script )
self->pChar->addEvent( script );
--- 1789,1793 ----
continue;
! cPythonScript *script = ScriptManager::instance()->find( PyString_AsString( PyList_GetItem( value, i ) ) );
if( script )
self->pChar->addEvent( script );
Index: global.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/global.cpp,v
retrieving revision 1.93
retrieving revision 1.94
diff -C2 -d -r1.93 -r1.94
*** global.cpp 19 Sep 2003 20:41:08 -0000 1.93
--- global.cpp 23 Sep 2003 12:40:19 -0000 1.94
***************
*** 72,75 ****
--- 72,85 ----
#include <qmutex.h>
+ PyObject *PyGetObjectObject( cUObject *object )
+ {
+ if( dynamic_cast< P_ITEM >( object ) )
+ return PyGetItemObject( (P_ITEM)object );
+ else if( dynamic_cast< P_CHAR >( object ) )
+ return PyGetCharObject( (P_CHAR)object );
+
+ return 0;
+ }
+
static QStringList getFlagNames( const tile_st &tile )
{
***************
*** 738,752 ****
static PyObject *wpRegisterGlobal( PyObject* self, PyObject* args )
{
! if( !checkArgInt( 0 ) || !checkArgInt( 1 ) || !checkArgStr( 2 ) )
! {
! PyErr_BadArgument();
! return 0;
! }
! UINT32 object = getArgInt( 0 );
! UINT32 event = getArgInt( 1 );
! QString scriptName = getArgStr( 2 );
! cPythonScript *script = ScriptManager->find( scriptName );
if( script == 0 )
--- 748,758 ----
static PyObject *wpRegisterGlobal( PyObject* self, PyObject* args )
{
! unsigned int event;
! const char *scriptName;
! if( !PyArg_ParseTuple( args, "is:wolfpack.registerglobal", &event, &scriptName ) )
! return 0;
! cPythonScript *script = ScriptManager::instance()->find( scriptName );
if( script == 0 )
***************
*** 756,760 ****
}
! ScriptManager->addGlobalHook( object, event, script );
return PyTrue;
}
--- 762,772 ----
}
! if( event >= EVENT_COUNT )
! {
! PyErr_SetString( PyExc_RuntimeError, "Unknown script." );
! return 0;
! }
!
! ScriptManager::instance()->setGlobalHook( (ePythonEvent)event, script );
return PyTrue;
}
***************
*** 765,786 ****
static PyObject *wpRegisterCommand( PyObject* self, PyObject* args )
{
! if( !checkArgStr( 0 ) || !checkArgStr( 1 ) )
! {
! PyErr_BadArgument();
! return 0;
! }
!
! QString command = getArgStr( 0 );
! QString scriptName = getArgStr( 1 );
! cPythonScript *script = ScriptManager->find( scriptName );
! if( script == 0 )
{
! PyErr_SetString( PyExc_RuntimeError, "Unknown script." );
return 0;
}
! ScriptManager->addCommandHook( command, script );
return PyTrue;
}
--- 777,794 ----
static PyObject *wpRegisterCommand( PyObject* self, PyObject* args )
{
! const char *command;
! PyObject *function;
! if( !PyArg_ParseTuple( args, "sO:wolfpack.registercommand", &command, &function ) )
! return 0;
! if( !PyCallable_Check( function ) )
{
! PyErr_SetString( PyExc_TypeError, "wolfpack.registercommand( command, function ): function has to be a callable object" );
return 0;
}
! Py_INCREF( function );
! ScriptManager::instance()->setCommandHook( command, function );
return PyTrue;
}
***************
*** 1144,1261 ****
};
-
- /*!
- Adds a speech keyword to a wolfpack script object.
- */
- static PyObject *wpSpeechAddKeyword( PyObject* self, PyObject* args )
- {
- Q_UNUSED(self);
- if( !checkArgStr( 0 ) || !checkArgInt( 1 ) )
- {
- PyErr_BadArgument();
- return 0;
- }
-
- cPythonScript *script = ScriptManager->find( getArgStr( 0 ) );
-
- if( !script )
- {
- PyErr_Warn( PyExc_Warning, "Use of unknown script-id." );
- return PyFalse;
- }
-
- script->addKeyword( getArgInt( 1 ) );
-
- return PyTrue;
- }
-
- /*!
- Adds a speech trigger-word to a wolfpack script object.
- */
- static PyObject *wpSpeechAddWord( PyObject* self, PyObject* args )
- {
- Q_UNUSED(self);
- if( !checkArgStr( 0 ) || !checkArgStr( 1 ) )
- {
- PyErr_BadArgument();
- return 0;
- }
-
- cPythonScript *script = ScriptManager->find( getArgStr( 0 ) );
-
- if( !script )
- {
- PyErr_Warn( PyExc_Warning, "Use of unknown script-id." );
- return PyFalse;
- }
-
- script->addWord( getArgStr( 1 ) );
-
- return PyTrue;
- }
-
- /*!
- Adds a speech regular expression to a wolfpack script object.
- */
- static PyObject *wpSpeechAddRegexp( PyObject* self, PyObject* args )
- {
- Q_UNUSED(self);
- if( !checkArgStr( 0 ) || !checkArgStr( 1 ) )
- {
- PyErr_BadArgument();
- return 0;
- }
-
- cPythonScript *script = ScriptManager->find( getArgStr( 0 ) );
-
- if( !script )
- {
- PyErr_Warn( PyExc_Warning, "Use of unknown script-id." );
- return PyFalse;
- }
-
- script->addRegexp( QRegExp( getArgStr( 1 ) ) );
-
- return PyTrue;
- }
-
- /*!
- Specifies if a speech script should fetch all speech events and not just one case.
- */
- static PyObject *wpSpeechSetCatchAll( PyObject* self, PyObject* args )
- {
- Q_UNUSED(self);
- if( !checkArgStr( 0 ) || !checkArgInt( 1 ) )
- {
- PyErr_BadArgument();
- return 0;
- }
-
- cPythonScript *script = ScriptManager->find( getArgStr( 0 ) );
-
- if( !script )
- {
- PyErr_Warn( PyExc_Warning, "Use of unknown script-id." );
- return PyFalse;
- }
-
- script->setCatchAllSpeech( getArgInt( 1 ) != 0 );
-
- return PyTrue;
- }
-
- /*!
- wolfpack.speech
- speech related functions
- */
- static PyMethodDef wpSpeech[] =
- {
- { "addKeyword", wpSpeechAddKeyword, METH_VARARGS, "Adds a keyword to a specific speech script." },
- { "addWord", wpSpeechAddWord, METH_VARARGS, "Adds a triggerword to a specific speech script." },
- { "addRegexp", wpSpeechAddRegexp, METH_VARARGS, "Adds a regular expression to a specific speech script." },
- { "setCatchAll", wpSpeechSetCatchAll, METH_VARARGS, "Specifies if a speech script should fetch all speech events and not just one case." },
- { NULL, NULL, 0, NULL } // Terminator
- };
-
/*!
Finds an Account object.
--- 1152,1155 ----
***************
*** 1569,1575 ****
PyObject *mConsole = Py_InitModule( "_wolfpack.console", wpConsole );
PyObject_SetAttrString( wpNamespace, "console", mConsole );
-
- PyObject *mSpeech = Py_InitModule( "_wolfpack.speech", wpSpeech );
- PyObject_SetAttrString( wpNamespace, "speech", mSpeech );
PyObject *mAccounts = Py_InitModule( "_wolfpack.accounts", wpAccounts );
--- 1463,1466 ----
Index: item.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/item.cpp,v
retrieving revision 1.74
retrieving revision 1.75
diff -C2 -d -r1.74 -r1.75
*** item.cpp 11 Sep 2003 16:19:51 -0000 1.74
--- item.cpp 23 Sep 2003 12:40:19 -0000 1.75
***************
*** 752,756 ****
continue;
! cPythonScript *script = ScriptManager->find( PyString_AsString( PyList_GetItem( value, i ) ) );
if( script )
self->pItem->addEvent( script );
--- 752,756 ----
continue;
! cPythonScript *script = ScriptManager::instance()->find( PyString_AsString( PyList_GetItem( value, i ) ) );
if( script )
self->pItem->addEvent( script );
Index: multi.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/multi.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** multi.cpp 11 Sep 2003 16:19:51 -0000 1.18
--- multi.cpp 23 Sep 2003 12:40:20 -0000 1.19
***************
*** 646,650 ****
continue;
! cPythonScript *script = ScriptManager->find( PyString_AsString( PyList_GetItem( value, i ) ) );
if( script )
self->pMulti->addEvent( script );
--- 646,650 ----
continue;
! cPythonScript *script = ScriptManager::instance()->find( PyString_AsString( PyList_GetItem( value, i ) ) );
if( script )
self->pMulti->addEvent( script );
Index: utilities.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/utilities.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** utilities.h 20 Sep 2003 01:05:10 -0000 1.22
--- utilities.h 23 Sep 2003 12:40:20 -0000 1.23
***************
*** 86,89 ****
--- 86,91 ----
P_ITEM getWpItem( PyObject* );
+ PyObject *PyGetObjectObject( cUObject* );
+
bool checkWpChar( PyObject *object );
PyObject* PyGetCharObject( P_CHAR );
|
|
From: <dar...@us...> - 2003-09-23 12:40:23
|
Update of /cvsroot/wpdev/wolfpack/network In directory sc8-pr-cvs1:/tmp/cvs-serv2528/network Modified Files: uosocket.cpp Log Message: Changed Python Interface Changed behaviour of setGlobalHook and setCommandHook Index: uosocket.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/network/uosocket.cpp,v retrieving revision 1.296 retrieving revision 1.297 diff -C2 -d -r1.296 -r1.297 *** uosocket.cpp 20 Sep 2003 13:51:33 -0000 1.296 --- uosocket.cpp 23 Sep 2003 12:40:19 -0000 1.297 *************** *** 932,937 **** return; ! if( !pChar->onSingleClick( _player ) ) ! pChar->showName( this ); } else --- 932,936 ---- return; ! pChar->showName( this ); } else *************** *** 942,947 **** return; ! if( !pItem->onSingleClick( _player ) ) ! pItem->showName( this ); } } --- 941,945 ---- return; ! pItem->showName( this ); } } |
|
From: <dar...@us...> - 2003-09-23 12:22:50
|
Update of /cvsroot/wpdev/xmlscripts/scripts/wolfpack In directory sc8-pr-cvs1:/tmp/cvs-serv31886/wolfpack Removed Files: speech.py Log Message: Changed scripts to resemble changes in wolfpack.registerglobal and wolfpack.registercommand Added barebone for new magic system. --- speech.py DELETED --- |
|
From: <dar...@us...> - 2003-09-23 12:22:50
|
Update of /cvsroot/wpdev/xmlscripts/scripts/speech In directory sc8-pr-cvs1:/tmp/cvs-serv31886/speech Modified Files: banker.py barber.py pets.py stablemaster.py Log Message: Changed scripts to resemble changes in wolfpack.registerglobal and wolfpack.registercommand Added barebone for new magic system. Index: banker.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/speech/banker.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** banker.py 23 Sep 2003 12:21:04 -0000 1.7 --- banker.py 23 Sep 2003 12:22:46 -0000 1.8 *************** *** 8,12 **** #===============================================================# - from wolfpack.speech import addKeyword,setCatchAll from wolfpack.consts import * import wolfpack --- 8,11 ---- Index: barber.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/speech/barber.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** barber.py 23 Sep 2003 12:21:04 -0000 1.7 --- barber.py 23 Sep 2003 12:22:46 -0000 1.8 *************** *** 8,12 **** #===============================================================# - from wolfpack.speech import addKeyword,setCatchAll from wolfpack.consts import * from wolfpack.gumps import cGump --- 8,11 ---- Index: pets.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/speech/pets.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pets.py 23 Sep 2003 12:21:04 -0000 1.8 --- pets.py 23 Sep 2003 12:22:46 -0000 1.9 *************** *** 8,12 **** #===============================================================# - from wolfpack.speech import addKeyword,setCatchAll from wolfpack.consts import * import wolfpack --- 8,11 ---- Index: stablemaster.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/speech/stablemaster.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** stablemaster.py 23 Sep 2003 12:21:04 -0000 1.5 --- stablemaster.py 23 Sep 2003 12:22:46 -0000 1.6 *************** *** 8,12 **** #===============================================================# - from wolfpack.speech import addKeyword,setCatchAll from wolfpack.consts import * from wolfpack.gumps import cGump --- 8,11 ---- |
|
From: <dar...@us...> - 2003-09-23 12:21:08
|
Update of /cvsroot/wpdev/xmlscripts/scripts/speech In directory sc8-pr-cvs1:/tmp/cvs-serv31654/speech Modified Files: banker.py barber.py pets.py stablemaster.py Log Message: Changed scripts to resemble changes in wolfpack.registerglobal and wolfpack.registercommand Added barebone for new magic system. Index: banker.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/speech/banker.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** banker.py 6 Jul 2003 16:46:23 -0000 1.6 --- banker.py 23 Sep 2003 12:21:04 -0000 1.7 *************** *** 22,35 **** amountre = re.compile( '(\d+)' ) - def onLoad(): - setCatchAll( 'speech.banker', 0 ) - addKeyword( 'speech.banker', 0x0 ) - addKeyword( 'speech.banker', 0x1 ) - addKeyword( 'speech.banker', 0x2 ) - addKeyword( 'speech.banker', 0x3 ) - def onSpeech( listener, speaker, text, keywords ): for keyword in keywords: - # withdraw if keyword == 0x0: --- 22,27 ---- Index: barber.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/speech/barber.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** barber.py 6 Jul 2003 16:46:23 -0000 1.6 --- barber.py 23 Sep 2003 12:21:04 -0000 1.7 *************** *** 38,47 **** 0x204D: 50000 } ! ! # 0x0171 *buy* ! def onLoad(): ! setCatchAll( 'speech.barber', 0 ) ! addKeyword( 'speech.barber', 0x171 ) ! def onSpeech( listener, speaker, text, keywords ): # Check if our name is in the beginning of the string --- 38,42 ---- 0x204D: 50000 } ! def onSpeech( listener, speaker, text, keywords ): # Check if our name is in the beginning of the string Index: pets.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/speech/pets.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pets.py 6 Jul 2003 16:46:23 -0000 1.7 --- pets.py 23 Sep 2003 12:21:04 -0000 1.8 *************** *** 12,51 **** import wolfpack - def onLoad(): - # We only want to fetch the commands registered below - setCatchAll( 'speech.pets', 0 ) - - # Register some keywords - addKeyword( 'speech.pets', 0x155 ) # "*come" - addKeyword( 'speech.pets', 0x156 ) # "*drop" - addKeyword( 'speech.pets', 0x15A ) # "*follow" - addKeyword( 'speech.pets', 0x15B ) # "*friend" - addKeyword( 'speech.pets', 0x15C ) # "*guard" - addKeyword( 'speech.pets', 0x15D ) # "*kill" - addKeyword( 'speech.pets', 0x15E ) # "*attack" - addKeyword( 'speech.pets', 0x161 ) # "*stop" - addKeyword( 'speech.pets', 0x163 ) # "*follow me" - addKeyword( 'speech.pets', 0x164 ) # "all come" - addKeyword( 'speech.pets', 0x165 ) # "all follow" - addKeyword( 'speech.pets', 0x166 ) # "all guard" - addKeyword( 'speech.pets', 0x167 ) # "all stop" - addKeyword( 'speech.pets', 0x168 ) # "all kill" - addKeyword( 'speech.pets', 0x169 ) # "all attack" - addKeyword( 'speech.pets', 0x16B ) # "all guard me" - addKeyword( 'speech.pets', 0x16C ) # "all follow me" - addKeyword( 'speech.pets', 0x16D ) # "*release" - addKeyword( 'speech.pets', 0x16E ) # "*transfer" - addKeyword( 'speech.pets', 0x16F ) # "*stay" - addKeyword( 'speech.pets', 0x170 ) # "all stay" - - # We're missing a good state-ai therefore these are disabled for now - #addKeyword( 'speech.pets', 0x157 ) # "*fetch" - #addKeyword( 'speech.pets', 0x158 ) # "*get" - #addKeyword( 'speech.pets', 0x159 ) # "*bring" - #addKeyword( 'speech.pets', 0x15F ) # "*patrol" - #addKeyword( 'speech.pets', 0x160 ) # "*report" - #addKeyword( 'speech.pets', 0x162 ) # "*hire" - #addKeyword( 'speech.pets', 0x16A ) # "all report" - def onSpeech( pet, char, text, keywords ): if not char.socket: --- 12,15 ---- Index: stablemaster.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/speech/stablemaster.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** stablemaster.py 6 Jul 2003 16:46:23 -0000 1.4 --- stablemaster.py 23 Sep 2003 12:21:04 -0000 1.5 *************** *** 112,121 **** } - - def onLoad(): - setCatchAll( 'speech.stablemaster', 0 ) - addKeyword( 'speech.stablemaster', 0x171 ) - - def onSpeech( listener, speaker, text, keywords ): # Check if our name is in the beginning of the string --- 112,115 ---- |
|
From: <dar...@us...> - 2003-09-23 12:19:12
|
Update of /cvsroot/wpdev/xmlscripts/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv31325 Modified Files: signpost.py Log Message: Changed scripts to resemble changes in wolfpack.registerglobal and wolfpack.registercommand Added barebone for new magic system. Index: signpost.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/signpost.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** signpost.py 16 Sep 2003 18:16:42 -0000 1.5 --- signpost.py 23 Sep 2003 12:19:00 -0000 1.6 *************** *** 5,9 **** # Register as a global script def onLoad(): ! wolfpack.registerglobal( HOOK_CHAR, EVENT_CHLEVELCHANGE, "signpost" ) def onCHLevelChange( char, level ): --- 5,9 ---- # Register as a global script def onLoad(): ! wolfpack.registerglobal( EVENT_CHLEVELCHANGE, "signpost" ) def onCHLevelChange( char, level ): |
|
From: <dar...@us...> - 2003-09-23 12:18:27
|
Update of /cvsroot/wpdev/xmlscripts/definitions In directory sc8-pr-cvs1:/tmp/cvs-serv31248 Modified Files: scripts.xml Log Message: Changed scripts to resemble changes in wolfpack.registerglobal and wolfpack.registercommand Added barebone for new magic system. Index: scripts.xml =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/definitions/scripts.xml,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** scripts.xml 20 Sep 2003 01:07:51 -0000 1.60 --- scripts.xml 23 Sep 2003 12:18:24 -0000 1.61 *************** *** 24,30 **** <script>clothing_bless_deed</script> <script>item_bless_deed</script> ! <script>carpentry_deed</script> ! <script>scroll</script> ! <script>spellbook</script> <script>environment</script> <script>door</script> --- 24,28 ---- <script>clothing_bless_deed</script> <script>item_bless_deed</script> ! <script>carpentry_deed</script> <script>environment</script> <script>door</script> *************** *** 45,51 **** <!-- Magic --> <script>recall_rune</script> - <script>wolfpack.magic</script> <script>runebook</script> <!-- Multis --> --- 43,52 ---- <!-- Magic --> + <script>spellbook</script> <script>recall_rune</script> <script>runebook</script> + <script>scroll</script> + <script>wolfpack.magic</script> + <script>wolfpack.magic.circle1</script> <!-- Multis --> *************** *** 71,76 **** --- 72,79 ---- <!-- Skills --> + <script>skills</script> <script>skills.anatomy</script> <script>skills.animallore</script> + <script>skills.evaluatingintel</script> <script>skills.fishing</script> <script>skills.armslore</script> |
Update of /cvsroot/wpdev/xmlscripts/scripts/skills
In directory sc8-pr-cvs1:/tmp/cvs-serv31082/skills
Modified Files:
__init__.py anatomy.py animallore.py animaltaming.py
armslore.py begging.py detectinghidden.py evaluatingintel.py
hiding.py inscription.py itemid.py peacemaking.py
provocation.py spiritspeak.py stealth.py tasteid.py
tracking.py
Removed Files:
evaluateintelligence.py
Log Message:
Changed scripts to resemble changes in wolfpack.registerglobal and wolfpack.registercommand
Added barebone for new magic system.
Index: __init__.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/__init__.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** __init__.py 19 Feb 2003 21:15:54 -0000 1.1
--- __init__.py 23 Sep 2003 12:17:39 -0000 1.2
***************
*** 0 ****
--- 1,21 ----
+
+ import wolfpack
+ from wolfpack.consts import *
+
+ skills = {}
+
+ def register( id, handler ):
+ if skills.has_key( id ):
+ raise Exception, "Duplicate Skill: " + str( id )
+
+ skills[ id ] = handler
+
+ def onLoad():
+ wolfpack.registerglobal( EVENT_SKILLUSE, "skills" )
+
+ def onSkillUse( char, skill ):
+ if skills.has_key( skill ):
+ skills[ skill ]( char, skill )
+ return 1
+
+ return 0
Index: anatomy.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/anatomy.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** anatomy.py 23 Apr 2003 11:43:18 -0000 1.7
--- anatomy.py 23 Sep 2003 12:17:39 -0000 1.8
***************
*** 8,11 ****
--- 8,12 ----
from wolfpack.consts import *
import wolfpack
+ import skills
from wolfpack.time import *
from math import floor
***************
*** 13,22 ****
ANATOMY_DELAY = 5000
- # Register as a global script
- def onLoad():
- wolfpack.registerglobal( HOOK_CHAR, EVENT_SKILLUSE, "skills.anatomy" )
-
# Button for Anatomy pressed on skill gump
! def onSkillUse( char, skill ):
# We only handle anatomy
if skill != ANATOMY:
--- 14,19 ----
ANATOMY_DELAY = 5000
# Button for Anatomy pressed on skill gump
! def anatomy( char, skill ):
# We only handle anatomy
if skill != ANATOMY:
***************
*** 84,85 ****
--- 81,85 ----
socket.clilocmessage( msgId2, "", 0x3b2, 3, target.char )
+ # Register as a global script
+ def onLoad():
+ skills.register( ANATOMY, anatomy )
Index: animallore.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/animallore.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** animallore.py 23 Apr 2003 11:43:18 -0000 1.10
--- animallore.py 23 Sep 2003 12:17:39 -0000 1.11
***************
*** 10,21 ****
from wolfpack.time import *
from wolfpack.gumps import cGump
ANIMALLORE_DELAY = 5000
! # Register as a global script
! def onLoad():
! wolfpack.registerglobal( HOOK_CHAR, EVENT_SKILLUSE, "skills.animallore" )
!
! def onSkillUse( char, skill ):
if skill != ANIMALLORE:
return 0
--- 10,18 ----
from wolfpack.time import *
from wolfpack.gumps import cGump
+ import skills
ANIMALLORE_DELAY = 5000
! def animallore( char, skill ):
if skill != ANIMALLORE:
return 0
***************
*** 225,226 ****
--- 222,225 ----
char.settag( 'skill_delay', cur_time + ANIMALLORE_DELAY )
+ def onLoad():
+ skills.register( ANIMALLORE, animallore )
Index: animaltaming.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/animaltaming.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** animaltaming.py 16 Jun 2003 16:01:02 -0000 1.7
--- animaltaming.py 23 Sep 2003 12:17:39 -0000 1.8
***************
*** 8,11 ****
--- 8,12 ----
from wolfpack.consts import *
from wolfpack.time import *
+ import skills
import wolfpack
import whrandom
***************
*** 24,33 ****
TAMING_DELAY = 10000
- # Register as a global script
- def onLoad():
- wolfpack.registerglobal( HOOK_CHAR, EVENT_SKILLUSE, "skills.animaltaming" )
-
# Button for AnimalTaming pressed on skill gump
! def onSkillUse( char, skill ):
# We only handle animaltaming
if skill != TAMING:
--- 25,30 ----
TAMING_DELAY = 10000
# Button for AnimalTaming pressed on skill gump
! def animaltaming( char, skill ):
# We only handle animaltaming
if skill != TAMING:
***************
*** 224,225 ****
--- 221,225 ----
if char.hastag( 'angry' ):
char.deltag( 'angry' )
+
+ def onLoad():
+ skills.register( TAMING, animaltaming )
Index: armslore.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/armslore.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** armslore.py 23 Apr 2003 11:43:18 -0000 1.6
--- armslore.py 23 Sep 2003 12:17:39 -0000 1.7
***************
*** 10,20 ****
from wolfpack.time import *
import wolfpack
ARMSLORE_DELAY = 5000
! def onLoad():
! wolfpack.registerglobal( HOOK_CHAR, EVENT_SKILLUSE, "skills.armslore" )
!
! def onSkillUse( char, skill ):
# only handle armslore
if skill != ARMSLORE:
--- 10,18 ----
from wolfpack.time import *
import wolfpack
+ import skills
ARMSLORE_DELAY = 5000
! def armslore( char, skill ):
# only handle armslore
if skill != ARMSLORE:
***************
*** 74,75 ****
--- 72,75 ----
return 0
+ def onLoad():
+ skills.register( ARMSLORE, armslore )
Index: begging.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/begging.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** begging.py 23 Apr 2003 11:43:18 -0000 1.6
--- begging.py 23 Sep 2003 12:17:39 -0000 1.7
***************
*** 10,13 ****
--- 10,14 ----
from wolfpack.time import *
import wolfpack
+ import skills
# from UO Stratics:
***************
*** 26,33 ****
BEGGING_DELAY = 5000
! def onLoad():
! wolfpack.registerglobal( HOOK_CHAR, EVENT_SKILLUSE, "skills.begging" )
!
! def onSkillUse( char, skill ):
if skill != BEGGING:
return 0
--- 27,31 ----
BEGGING_DELAY = 5000
! def begging( char, skill ):
if skill != BEGGING:
return 0
***************
*** 112,113 ****
--- 110,113 ----
char.socket.clilocmessage( 500404, "", 0x3b2, 3, npc )
+ def onLoad():
+ skills.register( BEGGING, begging )
\ No newline at end of file
Index: detectinghidden.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/detectinghidden.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** detectinghidden.py 23 Apr 2003 11:43:18 -0000 1.4
--- detectinghidden.py 23 Sep 2003 12:17:39 -0000 1.5
***************
*** 10,13 ****
--- 10,14 ----
from wolfpack.time import *
import wolfpack
+ import skills
# UOSS : All dungeons can spawn the following traps at random locations: Floor saw trap, floor spike trap, poison gas trap and exploding mushroom trap.
***************
*** 23,30 ****
DETECTHIDDEN_DELAY = 5000
! def onLoad():
! wolfpack.registerglobal( HOOK_CHAR, EVENT_SKILLUSE, "skills.detectinghidden" )
!
! def onSkillUse( char, skill ):
# only handle detect hidden
if skill != DETECTINGHIDDEN:
--- 24,28 ----
DETECTHIDDEN_DELAY = 5000
! def detectinghidden( char, skill ):
# only handle detect hidden
if skill != DETECTINGHIDDEN:
***************
*** 131,132 ****
--- 129,132 ----
self.update()
+ def onLoad():
+ skills.register( DETECTINGHIDDEN, detectinghidden )
\ No newline at end of file
Index: evaluatingintel.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/evaluatingintel.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** evaluatingintel.py 23 Apr 2003 11:43:18 -0000 1.4
--- evaluatingintel.py 23 Sep 2003 12:17:39 -0000 1.5
***************
*** 1,32 ****
#################################################################
# ) (\_ # WOLFPACK 13.0.0 Scripts #
! # (( _/{ "-; # Created by: Viper #
# )).-' {{ ;'` # Revised by: #
# ( ( ;._ \\ ctr # Last Modification: Created #
#################################################################
!
import wolfpack
from wolfpack.consts import *
- from wolfpack.time import *
from math import floor
! EVALINT_DELAY = 5000
!
! def onLoad():
! wolfpack.registerglobal( HOOK_CHAR, EVENT_SKILLUSE, "skills.evaluatingintel" )
!
! def onSkillUse( char, skill ):
#Only Handle Evalint
if skill != EVALUATINGINTEL:
return 0
- if char.hastag( 'skill_delay' ):
- cur_time = servertime()
- if cur_time < char.gettag( 'skill_delay' ):
- char.socket.clilocmessage( 500118, "", 0x3b2, 3 )
- return 1
- else:
- char.deltag( 'skill_delay' )
-
char.socket.clilocmessage( 0x7A4AA, "", 0x3b2, 3 ) # What would you like to evaluate
char.socket.attachtarget( "skills.evaluatingintel.response" )
--- 1,19 ----
#################################################################
# ) (\_ # WOLFPACK 13.0.0 Scripts #
! # (( _/{ "-; # Created by: DarkStorm #
# )).-' {{ ;'` # Revised by: #
# ( ( ;._ \\ ctr # Last Modification: Created #
#################################################################
!
import wolfpack
from wolfpack.consts import *
from math import floor
+ import skills
! def evaluatingintel( char, skill ):
#Only Handle Evalint
if skill != EVALUATINGINTEL:
return 0
char.socket.clilocmessage( 0x7A4AA, "", 0x3b2, 3 ) # What would you like to evaluate
char.socket.attachtarget( "skills.evaluatingintel.response" )
***************
*** 41,53 ****
if not char.canreach( target.char, 8 ):
return 0
! cur_time = servertime()
! char.settag( 'skill_delay', cur_time + EVALINT_DELAY )
! #if target.char == char:
# Hmm, that person looks really silly.
! #char.socket.clilocmessage( 0x7A4AE, "", 0x3b2, 3, target.char )
! #return 0
if not char.checkskill( EVALUATINGINTEL, 0, 1000 ):
--- 28,41 ----
if not char.canreach( target.char, 8 ):
+ # No Cliloc when failing LoS or Distance Check
return 0
! # Vendors: 0x7A4AD That person could probably calculate the cost of what you buy from them.
! # Town Criers: 0x7A4AB He looks smart enough to remember the news. Ask him about it.
! if target.char == char:
# Hmm, that person looks really silly.
! char.socket.clilocmessage( 0x7A4AE, "", 0x3b2, 3, target.char )
! return 0
if not char.checkskill( EVALUATINGINTEL, 0, 1000 ):
***************
*** 71,72 ****
--- 59,64 ----
char.socket.clilocmessage( msgId2, "", 0x3b2, 3, target.char )
return 1
+
+ def onLoad():
+ skills.register( EVALUATINGINTEL, evaluatingintel )
+
\ No newline at end of file
Index: hiding.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/hiding.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** hiding.py 23 Apr 2003 11:43:18 -0000 1.5
--- hiding.py 23 Sep 2003 12:17:39 -0000 1.6
***************
*** 10,20 ****
from wolfpack.time import *
import wolfpack
HIDING_DELAY = 5000
! def onLoad():
! wolfpack.registerglobal( HOOK_CHAR, EVENT_SKILLUSE, "skills.hiding" )
!
! def onSkillUse( char, skill ):
if skill != HIDING:
return 0
--- 10,18 ----
from wolfpack.time import *
import wolfpack
+ import skills
HIDING_DELAY = 5000
! def hiding( char, skill ):
if skill != HIDING:
return 0
***************
*** 42,43 ****
--- 40,43 ----
return 1
+ def onLoad():
+ skills.register( HIDING, hiding )
Index: inscription.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/inscription.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** inscription.py 22 Apr 2003 09:28:42 -0000 1.2
--- inscription.py 23 Sep 2003 12:17:39 -0000 1.3
***************
*** 9,12 ****
--- 9,13 ----
from wolfpack.utilities import *
import wolfpack
+ import skills
# mana used when we create a scroll
***************
*** 20,29 ****
INS_EXCEPTIONAL = 750
- def onLoad():
- wolfpack.registerglobal( HOOK_CHAR, EVENT_SKILLUSE, "skills.inscription" )
-
# skill is used via the blue button on skill gump
# this will copy a book
! def onSkillUse( char, skill ):
if skill != INSCRIPTION:
return 0
--- 21,27 ----
INS_EXCEPTIONAL = 750
# skill is used via the blue button on skill gump
# this will copy a book
! def inscription( char, skill ):
if skill != INSCRIPTION:
return 0
***************
*** 394,395 ****
--- 392,396 ----
book.update()
return 1
+
+ def onLoad():
+ skills.register( INSCRIPTION, inscription )
Index: itemid.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/itemid.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** itemid.py 23 Apr 2003 11:43:18 -0000 1.4
--- itemid.py 23 Sep 2003 12:17:39 -0000 1.5
***************
*** 10,20 ****
from wolfpack.time import *
import wolfpack
ITEMID_DELAY = 5000
! def onLoad():
! wolfpack.registerglobal( HOOK_CHAR, EVENT_SKILLUSE, "skills.itemid" )
!
! def onSkillUse( char, skill ):
if skill != ITEMID:
return 0
--- 10,18 ----
from wolfpack.time import *
import wolfpack
+ import skills
ITEMID_DELAY = 5000
! def itemid( char, skill ):
if skill != ITEMID:
return 0
***************
*** 70,71 ****
--- 68,73 ----
return 1
+
+ def onLoad():
+ skills.register( ITEMID, itemid )
+
\ No newline at end of file
Index: peacemaking.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/peacemaking.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** peacemaking.py 23 Apr 2003 11:43:18 -0000 1.5
--- peacemaking.py 23 Sep 2003 12:17:39 -0000 1.6
***************
*** 10,22 ****
from wolfpack.utilities import *
from wolfpack.time import *
! #import skills
! from skills import *
PEACE_DELAY = 5000
! def onLoad():
! wolfpack.registerglobal( HOOK_CHAR, EVENT_SKILLUSE, "skills.peacemaking" )
!
! def onSkillUse( char, skill ):
if skill != PEACEMAKING:
return 0
--- 10,18 ----
from wolfpack.utilities import *
from wolfpack.time import *
! import skills
PEACE_DELAY = 5000
! def peacemaking( char, skill ):
if skill != PEACEMAKING:
return 0
***************
*** 132,133 ****
--- 128,131 ----
char.deltag( 'peacemaking' )
+ def onLoad():
+ skills.register( PEACEMAKING, peacemaking )
Index: provocation.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/provocation.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** provocation.py 24 Apr 2003 10:33:08 -0000 1.6
--- provocation.py 23 Sep 2003 12:17:39 -0000 1.7
***************
*** 10,18 ****
from math import floor
from wolfpack.utilities import *
! def onLoad():
! wolfpack.registerglobal( HOOK_CHAR, EVENT_SKILLUSE, "skills.provocation" )
!
! def onSkillUse( char, skill ):
# Only handle provocation
if skill != PROVOCATION:
--- 10,16 ----
from math import floor
from wolfpack.utilities import *
+ import skills
! def provocation( char, skill ):
# Only handle provocation
if skill != PROVOCATION:
***************
*** 217,218 ****
--- 215,219 ----
total /= 10.0
return total
+
+ def onLoad():
+ skills.register( PROVOCATION, provocation )
Index: spiritspeak.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/spiritspeak.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** spiritspeak.py 23 Apr 2003 11:43:18 -0000 1.4
--- spiritspeak.py 23 Sep 2003 12:17:39 -0000 1.5
***************
*** 11,23 ****
from math import floor
import random
SPSPEAK_DELAY = 5000
! def onLoad():
! wolfpack.registerglobal( HOOK_CHAR, EVENT_SKILLUSE, "skills.spiritspeak" )
!
! def onSkillUse( char, skill ):
if skill != SPIRITSPEAK:
return 0
socket = char.socket
--- 11,22 ----
from math import floor
import random
+ import skills
SPSPEAK_DELAY = 5000
! def spiritspeak( char, skill ):
if skill != SPIRITSPEAK:
return 0
+
socket = char.socket
***************
*** 85,86 ****
--- 84,87 ----
return 1
+ def onLoad():
+ skills.register( SPIRITSPEAK, spiritspeak )
Index: stealth.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/stealth.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** stealth.py 28 Apr 2003 05:27:38 -0000 1.1
--- stealth.py 23 Sep 2003 12:17:39 -0000 1.2
***************
*** 10,13 ****
--- 10,14 ----
from wolfpack.time import *
import wolfpack
+ import skills
STEALTH_DELAY = 5000
***************
*** 15,22 ****
MIN_HIDING = 800
! def onLoad():
! wolfpack.registerglobal( HOOK_CHAR, EVENT_SKILLUSE, "skills.stealth" )
!
! def onSkillUse( char, skill ):
if skill != STEALTH:
return 0
--- 16,20 ----
MIN_HIDING = 800
! def stealth( char, skill ):
if skill != STEALTH:
return 0
***************
*** 59,60 ****
--- 57,60 ----
return 1
+ def onLoad():
+ skills.register( STEALTH, stealth )
Index: tasteid.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/tasteid.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** tasteid.py 28 Aug 2003 20:47:57 -0000 1.2
--- tasteid.py 23 Sep 2003 12:17:39 -0000 1.3
***************
*** 10,13 ****
--- 10,14 ----
from wolfpack.time import *
import wolfpack
+ import skills
TASTEID_DELAY = 5000
***************
*** 18,22 ****
wolfpack.registerglobal( HOOK_CHAR, EVENT_SKILLUSE, "skills.tasteid" )
! def onSkillUse( char, skill ):
if skill != TASTEID:
return 0
--- 19,23 ----
wolfpack.registerglobal( HOOK_CHAR, EVENT_SKILLUSE, "skills.tasteid" )
! def tasteid( char, skill ):
if skill != TASTEID:
return 0
***************
*** 90,91 ****
--- 91,95 ----
char.poisoned = item.poisoned
+ def onLoad():
+ skills.register( TASTEID, tasteid )
+
\ No newline at end of file
Index: tracking.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/tracking.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** tracking.py 5 Sep 2003 20:15:29 -0000 1.1
--- tracking.py 23 Sep 2003 12:17:39 -0000 1.2
***************
*** 11,14 ****
--- 11,15 ----
from wolfpack.gumps import *
import wolfpack
+ import skills
STEALTH_DELAY = 5000
***************
*** 16,23 ****
MIN_HIDING = 800
! def onLoad():
! wolfpack.registerglobal( HOOK_CHAR, EVENT_SKILLUSE, "skills.tracking" )
!
! def onSkillUse( char, skill ):
if skill != TRACKING:
return 0
--- 17,21 ----
MIN_HIDING = 800
! def tracking( char, skill ):
if skill != TRACKING:
return 0
***************
*** 66,67 ****
--- 64,68 ----
return 1
+ def onLoad():
+ skills.register( TRACKING, tracking )
+
\ No newline at end of file
--- evaluateintelligence.py DELETED ---
|
Update of /cvsroot/wpdev/xmlscripts/scripts/wolfpack/commands
In directory sc8-pr-cvs1:/tmp/cvs-serv31082/wolfpack/commands
Modified Files:
__init__.py action.py bank.py decoration.py export.py
import.py info.py where.py wipe.py
Log Message:
Changed scripts to resemble changes in wolfpack.registerglobal and wolfpack.registercommand
Added barebone for new magic system.
Index: __init__.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/wolfpack/commands/__init__.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** __init__.py 10 Jul 2003 10:14:31 -0000 1.3
--- __init__.py 23 Sep 2003 12:17:39 -0000 1.4
***************
*** 2,11 ****
import wolfpack
def onLoad():
! wolfpack.registercommand( "enablegod", "wolfpack.commands" )
!
! def onCommand( socket, command, arguments ):
! if command == "ENABLEGOD":
! packet = [ 0x2b, 0x01 ]
! socket.sendpacket( packet )
!
\ No newline at end of file
--- 2,9 ----
import wolfpack
+ def enablegod( socket, command, arguments ):
+ packet = [ 0x2b, 0x01 ]
+ socket.sendpacket( packet )
+
def onLoad():
! wolfpack.registercommand( "enablegod", enablegod )
Index: action.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/wolfpack/commands/action.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** action.py 26 Jul 2003 01:54:43 -0000 1.1
--- action.py 23 Sep 2003 12:17:39 -0000 1.2
***************
*** 9,17 ****
import wolfpack
-
- def onLoad():
- wolfpack.registercommand( "action", "wolfpack.commands.action" )
! def onCommand( socket, command, arguments ):
try:
action = hex2dec( arguments )
--- 9,14 ----
import wolfpack
! def action( socket, command, arguments ):
try:
action = hex2dec( arguments )
***************
*** 19,20 ****
--- 16,20 ----
except:
socket.sysmessage( 'Usage: action <animation-id>' )
+
+ def onLoad():
+ wolfpack.registercommand( "action", action )
Index: bank.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/wolfpack/commands/bank.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** bank.py 26 Jul 2003 01:54:43 -0000 1.1
--- bank.py 23 Sep 2003 12:17:39 -0000 1.2
***************
*** 11,18 ****
from wolfpack.utilities import hex2dec
! def onLoad():
! wolfpack.registercommand( "bank", "wolfpack.commands.bank" )
!
! def onCommand( socket, command, arguments ):
arguments = arguments.strip() # Remove trailing and leading whitespaces
layer = 0x1d
--- 11,15 ----
from wolfpack.utilities import hex2dec
! def bank( socket, command, arguments ):
arguments = arguments.strip() # Remove trailing and leading whitespaces
layer = 0x1d
***************
*** 40,41 ****
--- 37,42 ----
char.socket.sendcontainer( container )
+
+ def onLoad():
+ wolfpack.registercommand( "bank", bank )
+
\ No newline at end of file
Index: decoration.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/wolfpack/commands/decoration.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** decoration.py 29 Aug 2003 17:58:11 -0000 1.1
--- decoration.py 23 Sep 2003 12:17:39 -0000 1.2
***************
*** 10,14 ****
import os
-
def processFile( filename, map ):
count = 0
--- 10,13 ----
***************
*** 62,69 ****
return 0
! def onLoad():
! wolfpack.registercommand("decoration", "wolfpack.commands.decoration")
!
! def onCommand( socket, command, arguments ):
char = socket.player
socket.sysmessage("Generating world decoration, please wait.")
--- 61,65 ----
return 0
! def decoration( socket, command, arguments ):
char = socket.player
socket.sysmessage("Generating world decoration, please wait.")
***************
*** 81,82 ****
--- 77,81 ----
socket.sysmessage("World generating complete. %i items were generated." % count )
+
+ def onLoad():
+ wolfpack.registercommand( "decoration", decoration )
Index: export.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/wolfpack/commands/export.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** export.py 18 Jun 2003 00:04:17 -0000 1.1
--- export.py 23 Sep 2003 12:17:39 -0000 1.2
***************
*** 11,21 ****
from wolfpack.gumps import cGump
def onLoad():
! wolfpack.registercommand( "export", "wolfpack.commands.export" )
!
! def onCommand( socket, command, arguments ):
! if command == "EXPORT":
! socket.sysmessage( "Target the upper left corner of the area you want to export." )
! socket.attachtarget( "wolfpack.commands.export.callback", [] )
def callback( char, args, target ):
--- 11,20 ----
from wolfpack.gumps import cGump
+ def export( socket, command, arguments ):
+ socket.sysmessage( "Target the upper left corner of the area you want to export." )
+ socket.attachtarget( "wolfpack.commands.export.callback", [] )
+
def onLoad():
! wolfpack.registercommand( "export", export )
def callback( char, args, target ):
Index: import.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/wolfpack/commands/import.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** import.py 1 Sep 2003 20:39:14 -0000 1.4
--- import.py 23 Sep 2003 12:17:39 -0000 1.5
***************
*** 12,48 ****
from wolfpack.utilities import hex2dec
! def onLoad():
! wolfpack.registercommand( "import", "wolfpack.commands.import" )
! def onCommand( socket, command, arguments ):
! if command == "IMPORT":
! char = socket.player
! gump = cGump( x=100, y=100, callback="wolfpack.commands.import.callback" )
! gump.addBackground( id=0x2436, width=350, height=300 )
!
! text = '<basefont color="#FEFEFE"><h3>Import</h3><br><basefont color="#FEFEFE">Enter the name of the worldfile you want to import below. But before clicking Import, choose the correct file format from the list. <!--You may also choose any other options you find suitable.-->'
! gump.addHtmlGump( x=20, y=20, width=310, height=200, html=text )
!
! # Radiobuttons
! gump.startGroup( 0 )
! gump.addRadioButton( x=20, y=160, off=0x25f8, on=0x25fb, id=1 )
! gump.addText( x=55, y=165, text='Sphere 51a', hue=0x835 )
!
! gump.addRadioButton( x=150, y=160, off=0x25f8, on=0x25fb, id=2, selected=1 )
! gump.addText( x=185, y=165, text='WSC', hue=0x835 )
!
! gump.addRadioButton( x=250, y=160, off=0x25f8, on=0x25fb, id=3 )
! gump.addText( x=285, y=165, text='Text', hue=0x835 )
! # InputField
! gump.addResizeGump( x=20, y=210, id=0xBB8, width=310, height=25 )
! gump.addInputField( x=25, y=212, width=295, height=20, hue=0x834, id=1, starttext="export.wsc" )
! gump.addText( x=265, y=250, text='Import', hue=0x835 )
! gump.addButton( x=310, y=250, up=0x26af, down=0x26b1, returncode=1 )
! gump.send( char )
"""
--- 12,47 ----
from wolfpack.utilities import hex2dec
! def import_command( socket, command, arguments ):
! char = socket.player
!
! gump = cGump( x=100, y=100, callback="wolfpack.commands.import.callback" )
!
! gump.addBackground( id=0x2436, width=350, height=300 )
!
! text = '<basefont color="#FEFEFE"><h3>Import</h3><br><basefont color="#FEFEFE">Enter the name of the worldfile you want to import below. But before clicking Import, choose the correct file format from the list. <!--You may also choose any other options you find suitable.-->'
! gump.addHtmlGump( x=20, y=20, width=310, height=200, html=text )
! # Radiobuttons
! gump.startGroup( 0 )
! gump.addRadioButton( x=20, y=160, off=0x25f8, on=0x25fb, id=1 )
! gump.addText( x=55, y=165, text='Sphere 51a', hue=0x835 )
!
! gump.addRadioButton( x=150, y=160, off=0x25f8, on=0x25fb, id=2, selected=1 )
! gump.addText( x=185, y=165, text='WSC', hue=0x835 )
! gump.addRadioButton( x=250, y=160, off=0x25f8, on=0x25fb, id=3 )
! gump.addText( x=285, y=165, text='Text', hue=0x835 )
! # InputField
! gump.addResizeGump( x=20, y=210, id=0xBB8, width=310, height=25 )
! gump.addInputField( x=25, y=212, width=295, height=20, hue=0x834, id=1, starttext="export.wsc" )
! gump.addText( x=265, y=250, text='Import', hue=0x835 )
! gump.addButton( x=310, y=250, up=0x26af, down=0x26b1, returncode=1 )
! gump.send( char )
! def onLoad():
! wolfpack.registercommand( "import", import_command )
"""
Index: info.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/wolfpack/commands/info.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** info.py 1 Sep 2003 22:15:11 -0000 1.9
--- info.py 23 Sep 2003 12:17:39 -0000 1.10
***************
*** 15,27 ****
from wolfpack import *
- def onLoad():
- wolfpack.registercommand( "info", "wolfpack.commands.info" )
-
- def onCommand( socket, command, argstring ):
- if command == "INFO":
- info( socket, command, argstring )
-
- return 1
-
def info( socket, command, argstring ):
args = argstring.split(" ")
--- 15,18 ----
***************
*** 32,35 ****
--- 23,29 ----
socket.attachtarget( "wolfpack.commands.info.infotargetresponse", args )
return 1
+
+ def onLoad():
+ wolfpack.registercommand( "info", info )
def infotargetresponse( char, args, target ):
Index: where.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/wolfpack/commands/where.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** where.py 26 Jul 2003 01:54:43 -0000 1.1
--- where.py 23 Sep 2003 12:17:39 -0000 1.2
***************
*** 9,17 ****
import wolfpack
-
- def onLoad():
- wolfpack.registercommand( "where", "wolfpack.commands.where" )
! def onCommand( socket, command, arguments ):
char = socket.player
region = char.region
--- 9,14 ----
import wolfpack
! def where( socket, command, arguments ):
char = socket.player
region = char.region
***************
*** 41,42 ****
--- 38,42 ----
else:
char.message( "You are at %d,%d,%d on %s" % ( pos.x, pos.y, pos.z, map ) )
+
+ def onLoad():
+ wolfpack.registercommand( "where", where )
Index: wipe.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/wolfpack/commands/wipe.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** wipe.py 2 Sep 2003 02:32:19 -0000 1.2
--- wipe.py 23 Sep 2003 12:17:39 -0000 1.3
***************
*** 23,33 ****
else:
args[1]( char.socket, args[2], target )
-
- def onLoad():
- wolfpack.registercommand( "wipe", "wolfpack.commands.wipe" )
- wolfpack.registercommand( "nuke", "wolfpack.commands.wipe" )
! def onCommand( socket, command, argstring ):
if len( argstring ) > 0:
if argstring.lower() == "all":
--- 23,29 ----
else:
args[1]( char.socket, args[2], target )
! def nuke( socket, command, argstring ):
if len( argstring ) > 0:
if argstring.lower() == "all":
***************
*** 68,69 ****
--- 64,68 ----
return 1
+ def onLoad():
+ wolfpack.registercommand( "wipe", nuke )
+ wolfpack.registercommand( "nuke", nuke )
|
|
From: <dar...@us...> - 2003-09-23 12:17:44
|
Update of /cvsroot/wpdev/xmlscripts/scripts/wolfpack/magic
In directory sc8-pr-cvs1:/tmp/cvs-serv31082/wolfpack/magic
Added Files:
__init__.py circle1.py spell.py utilities.py
Log Message:
Changed scripts to resemble changes in wolfpack.registerglobal and wolfpack.registercommand
Added barebone for new magic system.
--- NEW FILE: __init__.py ---
#===============================================================#
# ) (\_ | WOLFPACK 13.0.0 Scripts #
# (( _/{ "-; | Created by: Correa #
# )).-' {{ ;'` | Revised by: #
# ( ( ;._ \\ ctr | Last Modification: Created #
#===============================================================#
# Main Magic Script #
#===============================================================#
from wolfpack.consts import *
from wolfpack.magic.utilities import *
from wolfpack.magic.spell import *
import wolfpack
# Spell Registry
spells = {}
# Register spell information in the global registry
def registerspell( id, spell ):
global spells
if spells.has_key( id ):
return
spells[ id ] = spell
#
# Set up our global hook on script load
#
def onLoad():
wolfpack.registerglobal( EVENT_CASTSPELL, "wolfpack.magic" )
#
# A Spell has been Selected from our SpellBook
# This part of the code has to be npc safe!
#
# Mode: 0 = Book
def castSpell( char, spell, mode = 0, args = [] ):
if char.dead:
return
socket = char.socket
eventlist = char.events
if not spells.has_key( spell ):
if socket:
socket.log( LOG_ERROR, "Trying to cast unknown spell: %d\n" % spell )
socket.sysmessage( 'ERROR: Unknown Spell' )
return
# We are frozen
if char.frozen:
char.message( 502643 )
return
# We are already casting a spell
if 'wolfpack.magic' in eventlist or ( socket and socket.hastag( 'cast_target' ) ):
char.message( 502642 )
return
# If we are using a spellbook to cast, check if we do have
# the spell in our spellbook (0-based index)
if mode == 0 and not hasSpell( char, spell - 1 ):
char.message( "You don't know the spell you want to cast." )
return
# Are the requirements met?
spell = spells[ spell ]
if not spell.checkrequirements( char, mode ):
return
# Unhide the Caster
if char.hidden:
char.hidden = 0
char.update()
if spell.mantra:
char.say( spell.mantra )
# Precasting
char.events = [ 'wolfpack.magic' ] + eventlist
char.action( ANIM_CASTAREA )
char.addtimer( spell.calcdelay(), 'wolfpack.magic.callback', [ spell.spellid, mode ], 0, 0, "cast_delay" )
def callback( char, args ):
eventlist = char.events
eventlist.remove( 'wolfpack.magic' )
char.events = eventlist
if char.socket:
char.socket.settag( 'cast_target', 1 )
char.socket.attachtarget( 'wolfpack.magic.target_response', args, 'wolfpack.magic.target_cancel', 'wolfpack.magic.target_timeout', 8000 ) # Don't forget the timeout later on
else:
# Callback to the NPC AI ??
pass
# Target Cancel
def target_cancel( char ):
if char.hastag( 'cast_target' ):
char.deltag( 'cast_target' )
# Target Timeout
def target_timeout( char ):
char.message( 'You loose your concentration.' )
fizzle( char )
# Target Response
def target_response( char, args, target ):
# No more npc saftey from here
if not char.socket.hastag( 'cast_target' ):
return
char.socket.deltag( 'cast_target' )
spell = spells[ args[0] ]
mode = args[1]
# Char Targets
if target.char and ( spell.validtarget == TARGET_IGNORE or spell.validtarget == TARGET_CHAR ):
spell.target( char, mode, TARGET_CHAR, target.char )
# Item Target
elif target.item and ( spell.validtarget == TARGET_IGNORE or spell.validtarget == TARGET_ITEM ):
spell.target( char, mode, TARGET_ITEM, target.item )
# Ground Target
else:
char.message( 501857 )
def onCastSpell( char, spell ):
castSpell( char, spell )
# These Events happen for characters who are casting a spell right now
def onDamage( char, type, amount, source ):
char.message( 500641 )
fizzle( char )
def onWalk( char, direction, sequence ):
running = direction & 0x80
direction &= 0x7F
# Just turning
if direction != char.direction:
return
char.message( 500641 )
fizzle( char )
def onWarModeToggle( char, warmode ):
char.message( 500641 )
fizzle( char )
def onLogin( char ):
fizzle( char )
--- NEW FILE: circle1.py ---
from wolfpack.magic import registerspell
from wolfpack.magic.spell import Spell
from wolfpack.magic.utilities import *
class Clumsy ( Spell ):
def __init__( self ):
self.mana = 0
self.reagents = {}
self.valid_targets = TARGET_CHAR
self.spellid = 1
self.circle = 1
self.mantra = 'In Jux Sanct'
def target( self, char, mode, targettype, target ):
char.message( 'You targetted something' )
pass
# Register the spells in this module (wolfpack.magic.circle1)
def onLoad():
Clumsy().register()
pass
--- NEW FILE: spell.py ---
import wolfpack.magic
from wolfpack.magic.utilities import *
# Recursive Function for counting reagents
def countReagents( item, items ):
for key in items.keys():
if key == item.id and item.color == 0:
items[ key ] = max( 0, items[ key ] - item.amount )
return items # Reagents normally dont have content
for subitem in item.content:
items = countReagents( subitem, items )
return items
# Basic Spell Class
class Spell:
mana = 0
circle = 0
reagents = {}
validtarget = TARGET_IGNORE
spellid = None
mantra = None
# Static Method
def register( self ):
if not self.spellid:
raise Exception, 'Trying to register a spell with an unset id: ' + str( self.__class__.__name__ )
wolfpack.magic.registerspell( self.spellid, self )
def __init__( self ):
pass
def calcdelay( self ):
return 250 + ( 250 * self.circle )
def checkrequirements( self, char, mode ):
if mode == MODE_BOOK:
# Check for Mana
if char.mana < self.mana:
char.message( 502625 )
return 0
# Check for Reagents
if len( self.reagents ) > 0:
items = countReagents( char.getbackpack(), self.reagents )
for item in items.keys():
if items[ item ] > 0:
char.message( 502630 )
return 0
return 1
def consumerequirements( self, char, mode ):
return 0
def target( self, char, mode, targettype, target ):
return 0
--- NEW FILE: utilities.py ---
import spellbook
TARGET_CHAR = 1
TARGET_ITEM = 2
TARGET_GROUND = 3
TARGET_IGNORE = 4
REAGENT_BLACKPEARL = 0xf7a
REAGENT_BLOODMOSS = 0xf7b
REAGENT_GARLIC = 0xf84
REAGENT_GINSENG = 0xf85
REAGENT_MANDRAKE = 0xf86
REAGENT_NIGHTSHADE = 0xf88
REAGENT_SULFURASH = 0xf8c
REAGENT_SPIDERSILK = 0xf8d
MODE_BOOK = 0
MODE_SCROLL = 1
MODE_WAND = 2
def fizzle( char ):
# Remove a possible timer/targetrequest
char.dispel( char, 1, "cast_delay" )
eventlist = char.events
eventlist.remove( 'wolfpack.magic' )
char.events = eventlist
char.effect( 0x3735, 1, 30 )
char.soundeffect( 0x5c )
# Check whether the spellbook's of a char have that specific spell
def hasSpell( char, spell ):
book = char.itemonlayer( 1 )
if spellbook.hasspell( book, spell ):
return 1
for book in char.getbackpack().content:
if spellbook.hasspell( book, spell ):
return 1
return 0
|
|
From: <dar...@us...> - 2003-09-23 12:17:43
|
Update of /cvsroot/wpdev/xmlscripts/scripts/wolfpack In directory sc8-pr-cvs1:/tmp/cvs-serv31082/wolfpack Modified Files: __init__.py consts.py Removed Files: magic.py Log Message: Changed scripts to resemble changes in wolfpack.registerglobal and wolfpack.registercommand Added barebone for new magic system. Index: __init__.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/wolfpack/__init__.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** __init__.py 2 Sep 2003 02:32:19 -0000 1.32 --- __init__.py 23 Sep 2003 12:17:39 -0000 1.33 *************** *** 115,120 **** # Register a global hook ! def registerglobal( object, event, script ): ! return _wolfpack.registerglobal( object, event, script ) # Register this script to fetch a specific command --- 115,120 ---- # Register a global hook ! def registerglobal( event, script ): ! return _wolfpack.registerglobal( event, script ) # Register this script to fetch a specific command Index: consts.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/wolfpack/consts.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** consts.py 20 Sep 2003 01:07:33 -0000 1.25 --- consts.py 23 Sep 2003 12:17:39 -0000 1.26 *************** *** 192,236 **** HOOK_CHAR = 3 ! # Constants for the Events we can hook ! EVENT_USE = 1 ! EVENT_SINGLECLICK = 2 ! EVENT_COLLIDE = 3 ! EVENT_WORLDSAVE = 4 ! EVENT_WORLDLOAD = 5 ! EVENT_WALK = 6 ! EVENT_CREATE = 7 ! EVENT_LOGIN = 8 ! EVENT_LOGOUT = 9 ! EVENT_TALK = 10 ! EVENT_WARMODETOGGLE = 11 ! EVENT_HELP = 12 ! EVENT_CHAT = 13 ! EVENT_SKILLUSE = 14 ! EVENT_SELECTCONTEXTMENU = 15 ! EVENT_REQUESTCONTEXTMENU = 16 ! EVENT_DROPONCHAR = 17 ! EVENT_DROPONITEM = 18 ! EVENT_DROPONGROUND = 19 ! EVENT_PICKUP = 20 ! EVENT_SPEECH = 21 ! EVENT_BEGINCAST = 22 ! EVENT_ENDCAST = 23 ! EVENT_SPELLCHECKTARGET = 24 ! EVENT_SPELLSUCCESS = 25 ! EVENT_SPELLFAILURE = 26 ! EVENT_SHOWTOOLTIP = 27 ! EVENT_SKILLGAIN = 28 ! EVENT_DAMAGE = 29 ! EVENT_SHOWPAPERDOLL = 30 ! EVENT_SHOWSKILLGUMP = 31 ! EVENT_STATGAIN = 32 ! EVENT_CASTSPELL = 33 ! EVENT_CHLEVELCHANGE = 34 ! ! # Effect Constants ! EFFECT_MOVING = 0 ! EFFECT_LIGHTNING = 1 ! EFFECT_STAYSOURCEPOS = 2 ! EFFECT_STAYSOURCESER = 3 HOUSE = 0 --- 192,233 ---- HOOK_CHAR = 3 ! # Id's for Hooks (not all are hookable though) ! EVENT_USE = 0, ! EVENT_SINGLECLICK = 1 ! EVENT_COLLIDE = 2 ! EVENT_WALK = 3 ! EVENT_CREATE = 4 ! EVENT_TALK = 5 ! EVENT_WARMODETOGGLE = 6 ! EVENT_LOGIN = 7 ! EVENT_LOGOUT = 8 ! EVENT_HELP = 9 ! EVENT_CHAT = 10 ! EVENT_SKILLUSE = 11 ! EVENT_SKILLGAIN = 12 ! EVENT_STATGAIN = 13 ! EVENT_SHOWPAPERDOLL = 14 ! EVENT_SHOWSKILLGUMP = 15 ! EVENT_DEATH = 16 ! EVENT_SHOWPAPERDOLLNAME = 17 ! EVENT_CONTEXTENTRY = 18 ! EVENT_SHOWCONTEXTMENU = 19 ! EVENT_SHOWTOOLTIP = 20 ! EVENT_CHLEVELCHANGE = 21 ! EVENT_SPEECH = 22 ! EVENT_WEARITEM = 23 ! EVENT_EQUIP = 24 ! EVENT_UNEQUIP = 25 ! EVENT_DROPONCHAR = 26 ! EVENT_DROPONITEM = 27 ! EVENT_DROPONGROUND = 28 ! EVENT_PICKUP = 29 ! EVENT_COMMAND = 30 ! EVENT_BOOKUPDATEINFO = 31 ! EVENT_BOOKREQUESTPAGE = 32 ! EVENT_BOOKUPDATEPAGE = 33 ! EVENT_DAMAGE = 34 ! EVENT_CASTSPELL = 35 ! EVENT_COUN = 36 HOUSE = 0 --- magic.py DELETED --- |
|
From: <dar...@us...> - 2003-09-23 12:17:43
|
Update of /cvsroot/wpdev/xmlscripts/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv31082 Modified Files: spellbook.py tooltip.py Log Message: Changed scripts to resemble changes in wolfpack.registerglobal and wolfpack.registercommand Added barebone for new magic system. Index: spellbook.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/spellbook.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** spellbook.py 20 Sep 2003 02:22:09 -0000 1.3 --- spellbook.py 23 Sep 2003 12:17:39 -0000 1.4 *************** *** 11,59 **** import wolfpack ! def onLoad(): ! # Register .addspell, .removespell, .editspells (?) ! wolfpack.registercommand( "addspell", "spellbook" ) ! wolfpack.registercommand( "removespell", "spellbook" ) ! def onCommand( socket, command, arguments ): ! if command == "ADDSPELL": ! if arguments != 'all': ! try: ! if len( arguments ) < 1: ! raise Exception ! ! spell = int( arguments ) ! except: ! socket.sysmessage( 'Usage: addspell <spell> or addspell all' ) ! return ! ! if spell >= 64: ! socket.sysmessage( 'Values between 0 and 63 are valid.' ) ! return ! else: ! spell = 'all' ! socket.sysmessage( 'Select the spellbook you want to add the spell to.' ) ! socket.attachtarget( "spellbook.addspelltarget", [ spell ] ) ! ! elif command == "REMOVESPELL": ! if arguments != 'all': ! try: ! if len( arguments ) < 1: ! raise Exception ! ! spell = int( arguments ) ! except: ! socket.sysmessage( 'Usage: removespell <spell> or removespell all' ) ! return ! ! if spell >= 64: ! socket.sysmessage( 'Values between 0 and 63 are valid.' ) ! return ! else: ! spell = 'all' ! socket.sysmessage( 'Select the spellbook you want to remove the spell from.' ) ! socket.attachtarget( "spellbook.removespelltarget", [ spell ] ) # Does the Spellbook have a specific spell? --- 11,58 ---- import wolfpack ! def commandAddSpell( socket, command, arguments ): ! if arguments != 'all': ! try: ! if len( arguments ) < 1: ! raise Exception ! spell = int( arguments ) ! except: ! socket.sysmessage( 'Usage: addspell <spell> or addspell all' ) ! return ! ! if spell >= 64: ! socket.sysmessage( 'Values between 0 and 63 are valid.' ) ! return ! else: ! spell = 'all' ! socket.sysmessage( 'Select the spellbook you want to add the spell to.' ) ! socket.attachtarget( "spellbook.addspelltarget", [ spell ] ) ! ! def commandRemoveSpell( socket, command, arguments ): ! if arguments != 'all': ! try: ! if len( arguments ) < 1: ! raise Exception ! ! spell = int( arguments ) ! except: ! socket.sysmessage( 'Usage: removespell <spell> or removespell all' ) ! return ! if spell >= 64: ! socket.sysmessage( 'Values between 0 and 63 are valid.' ) ! return ! else: ! spell = 'all' ! ! socket.sysmessage( 'Select the spellbook you want to add the spell to.' ) ! socket.attachtarget( "spellbook.addspelltarget", [ spell ] ) ! ! def onLoad(): ! # Register .addspell, .removespell, .editspells (?) ! wolfpack.registercommand( "addspell", commandAddSpell ) ! wolfpack.registercommand( "removespell", commandRemoveSpell ) # Does the Spellbook have a specific spell? Index: tooltip.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/tooltip.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tooltip.py 20 Sep 2003 02:22:09 -0000 1.8 --- tooltip.py 23 Sep 2003 12:17:39 -0000 1.9 *************** *** 13,20 **** # Register as a global script def onLoad(): ! wolfpack.registerglobal( HOOK_CHAR, EVENT_SHOWTOOLTIP, "tooltip" ) ! wolfpack.registerglobal( HOOK_ITEM, EVENT_SHOWTOOLTIP, "tooltip" ) ! def onShowToolTip( sender, target, tooltip ): if target.isitem(): --- 13,19 ---- # Register as a global script def onLoad(): ! wolfpack.registerglobal( EVENT_SHOWTOOLTIP, "tooltip" ) ! def onShowTooltip( sender, target, tooltip ): if target.isitem(): |
|
From: <dar...@us...> - 2003-09-23 12:15:57
|
Update of /cvsroot/wpdev/xmlscripts/scripts/wolfpack/magic In directory sc8-pr-cvs1:/tmp/cvs-serv30702/magic Log Message: Directory /cvsroot/wpdev/xmlscripts/scripts/wolfpack/magic added to the repository |
|
From: <xs...@us...> - 2003-09-23 11:53:38
|
Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv26874
Modified Files:
ai.h ai_humans.cpp combat.cpp dragdrop.cpp items.cpp items.h
npc.h player.cpp spawnregions.cpp spawnregions.h
territories.cpp wolfpack.cpp world.cpp
Log Message:
spawn region fix for items,
spawn region registering loaded objects again,
npc saving fix,
guards
Index: ai.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ai.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** ai.h 20 Sep 2003 12:01:43 -0000 1.19
--- ai.h 23 Sep 2003 11:53:30 -0000 1.20
***************
*** 427,436 ****
};
! class Human_Guard_Fight : public AbstractAction
{
protected:
! Human_Guard_Fight() : AbstractAction() {}
public:
! Human_Guard_Fight( P_NPC npc, AbstractAI* ai ) : AbstractAction( npc, ai ) {}
virtual void execute();
virtual float preCondition();
--- 427,436 ----
};
! class Human_Guard_Called_Fight : public AbstractAction
{
protected:
! Human_Guard_Called_Fight() : AbstractAction() {}
public:
! Human_Guard_Called_Fight( P_NPC npc, AbstractAI* ai ) : AbstractAction( npc, ai ) {}
virtual void execute();
virtual float preCondition();
***************
*** 438,447 ****
};
! class Human_Guard_TeleToTarget : public AbstractAction
{
protected:
! Human_Guard_TeleToTarget() : AbstractAction() {}
public:
! Human_Guard_TeleToTarget( P_NPC npc, AbstractAI* ai ) : AbstractAction( npc, ai ) {}
virtual void execute();
virtual float preCondition();
--- 438,447 ----
};
! class Human_Guard_Called_TeleToTarget : public AbstractAction
{
protected:
! Human_Guard_Called_TeleToTarget() : AbstractAction() {}
public:
! Human_Guard_Called_TeleToTarget( P_NPC npc, AbstractAI* ai ) : AbstractAction( npc, ai ) {}
virtual void execute();
virtual float preCondition();
***************
*** 449,458 ****
};
! class Human_Guard_Disappear : public AbstractAction
{
protected:
! Human_Guard_Disappear() : AbstractAction() {}
public:
! Human_Guard_Disappear( P_NPC npc, AbstractAI* ai ) : AbstractAction( npc, ai ) {}
virtual void execute();
virtual float preCondition();
--- 449,458 ----
};
! class Human_Guard_Called_Disappear : public AbstractAction
{
protected:
! Human_Guard_Called_Disappear() : AbstractAction() {}
public:
! Human_Guard_Called_Disappear( P_NPC npc, AbstractAI* ai ) : AbstractAction( npc, ai ) {}
virtual void execute();
virtual float preCondition();
***************
*** 460,479 ****
};
! class Human_Guard : public AbstractAI
{
protected:
! Human_Guard() : AbstractAI()
{
notorityOverride_ = 1;
}
public:
! Human_Guard( P_NPC npc );
virtual void init( P_NPC npc );
static void registerInFactory();
! virtual QString name() { return "Human_Guard"; }
};
#endif /* AI_H_HEADER_INCLUDED */
--- 460,537 ----
};
! class cTerritory;
!
! class Human_Guard_Called : public AbstractAI
{
protected:
! Human_Guard_Called() : AbstractAI()
{
notorityOverride_ = 1;
}
+ cTerritory* region_;
+
public:
! Human_Guard_Called( P_NPC npc );
virtual void init( P_NPC npc );
static void registerInFactory();
! virtual QString name() { return "Human_Guard_Called"; }
! };
!
! class Human_Guard_Wander : public Action_Wander
! {
! protected:
! Human_Guard_Wander() : Action_Wander() {}
! public:
! Human_Guard_Wander( P_NPC npc, AbstractAI* ai ) : Action_Wander( npc, ai ) {}
! virtual float preCondition();
! virtual float postCondition();
! };
!
! class Human_Guard_MoveToTarget : public Action_Wander
! {
! protected:
! Human_Guard_MoveToTarget() : Action_Wander() {}
! public:
! Human_Guard_MoveToTarget( P_NPC npc, AbstractAI* ai ) : Action_Wander( npc, ai ) {}
! virtual void execute();
! virtual float preCondition();
! virtual float postCondition();
};
+ class Human_Guard_Fight : public AbstractAction
+ {
+ protected:
+ Human_Guard_Fight() : AbstractAction() {}
+ public:
+ Human_Guard_Fight( P_NPC npc, AbstractAI* ai ) : AbstractAction( npc, ai ) {}
+ virtual void execute();
+ virtual float preCondition();
+ virtual float postCondition();
+ };
+
+ class Human_Guard : public AbstractAI
+ {
+ protected:
+ Human_Guard() : AbstractAI(), m_currentVictim( NULL )
+ {
+ notorityOverride_ = 1;
+ }
+
+ public:
+ Human_Guard( P_NPC npc );
+
+ static void registerInFactory();
+ virtual QString name() { return "Human_Guard"; }
+
+ virtual void check();
+
+ P_CHAR currentVictim() const { return m_currentVictim; }
+ protected:
+ virtual void selectVictim();
+
+ P_CHAR m_currentVictim;
+ };
#endif /* AI_H_HEADER_INCLUDED */
Index: ai_humans.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ai_humans.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ai_humans.cpp 20 Sep 2003 12:01:44 -0000 1.1
--- ai_humans.cpp 23 Sep 2003 11:53:30 -0000 1.2
***************
*** 224,246 ****
}
! static AbstractAI* productCreator_HG()
{
! return new Human_Guard( NULL );
}
! void Human_Guard::registerInFactory()
{
! AIFactory::instance()->registerType("Human_Guard", productCreator_HG);
}
! Human_Guard::Human_Guard( P_NPC npc ) : AbstractAI( npc )
{
notorityOverride_ = 1;
! m_actions.append( new Human_Guard_Fight( npc, this ) );
! m_actions.append( new Human_Guard_TeleToTarget( npc, this ) );
! m_actions.append( new Human_Guard_Disappear( npc, this ) );
}
! void Human_Guard::init( P_NPC npc )
{
npc->setSummonTime( uiCurrentTime + MY_CLOCKS_PER_SEC * SrvParams->guardDispelTime() );
--- 224,246 ----
}
! static AbstractAI* productCreator_HGC()
{
! return new Human_Guard_Called( NULL );
}
! void Human_Guard_Called::registerInFactory()
{
! AIFactory::instance()->registerType("Human_Guard_Called", productCreator_HGC);
}
! Human_Guard_Called::Human_Guard_Called( P_NPC npc ) : AbstractAI( npc )
{
notorityOverride_ = 1;
! m_actions.append( new Human_Guard_Called_Fight( npc, this ) );
! m_actions.append( new Human_Guard_Called_TeleToTarget( npc, this ) );
! m_actions.append( new Human_Guard_Called_Disappear( npc, this ) );
}
! void Human_Guard_Called::init( P_NPC npc )
{
npc->setSummonTime( uiCurrentTime + MY_CLOCKS_PER_SEC * SrvParams->guardDispelTime() );
***************
*** 248,252 ****
}
! void Human_Guard_Fight::execute()
{
// talk only in about every 10th check
--- 248,252 ----
}
! void Human_Guard_Called_Fight::execute()
{
// talk only in about every 10th check
***************
*** 262,266 ****
}
! float Human_Guard_Fight::preCondition()
{
if( m_npc->combatTarget() == INVALID_SERIAL )
--- 262,266 ----
}
! float Human_Guard_Called_Fight::preCondition()
{
if( m_npc->combatTarget() == INVALID_SERIAL )
***************
*** 268,272 ****
P_CHAR pTarget = World::instance()->findChar( m_npc->combatTarget() );
! if( !pTarget || pTarget->isDead() )
return 0.0f;
--- 268,272 ----
P_CHAR pTarget = World::instance()->findChar( m_npc->combatTarget() );
! if( !pTarget || pTarget->isDead() || pTarget->isInnocent() || pTarget->region() != m_npc->region() )
return 0.0f;
***************
*** 277,286 ****
}
! float Human_Guard_Fight::postCondition()
{
return 1.0f - preCondition();
}
! void Human_Guard_TeleToTarget::execute()
{
m_npc->setSummonTime( uiCurrentTime + MY_CLOCKS_PER_SEC * SrvParams->guardDispelTime() );
--- 277,286 ----
}
! float Human_Guard_Called_Fight::postCondition()
{
return 1.0f - preCondition();
}
! void Human_Guard_Called_TeleToTarget::execute()
{
m_npc->setSummonTime( uiCurrentTime + MY_CLOCKS_PER_SEC * SrvParams->guardDispelTime() );
***************
*** 298,302 ****
}
! float Human_Guard_TeleToTarget::preCondition()
{
if( m_npc->combatTarget() == INVALID_SERIAL )
--- 298,302 ----
}
! float Human_Guard_Called_TeleToTarget::preCondition()
{
if( m_npc->combatTarget() == INVALID_SERIAL )
***************
*** 304,308 ****
P_CHAR pTarget = World::instance()->findChar( m_npc->combatTarget() );
! if( !pTarget || pTarget->isDead() )
return 0.0f;
--- 304,308 ----
P_CHAR pTarget = World::instance()->findChar( m_npc->combatTarget() );
! if( !pTarget || pTarget->isDead() || pTarget->isInnocent() || pTarget->region() != m_npc->region() )
return 0.0f;
***************
*** 313,327 ****
}
! float Human_Guard_TeleToTarget::postCondition()
{
return 1.0f - preCondition();
}
! void Human_Guard_Disappear::execute()
{
// nothing to do
}
! float Human_Guard_Disappear::preCondition()
{
if( m_npc->combatTarget() == INVALID_SERIAL )
--- 313,327 ----
}
! float Human_Guard_Called_TeleToTarget::postCondition()
{
return 1.0f - preCondition();
}
! void Human_Guard_Called_Disappear::execute()
{
// nothing to do
}
! float Human_Guard_Called_Disappear::preCondition()
{
if( m_npc->combatTarget() == INVALID_SERIAL )
***************
*** 329,333 ****
P_CHAR pTarget = World::instance()->findChar( m_npc->combatTarget() );
! if( !pTarget || pTarget->isDead() )
return 1.0f;
--- 329,333 ----
P_CHAR pTarget = World::instance()->findChar( m_npc->combatTarget() );
! if( !pTarget || pTarget->isDead() || pTarget->isInnocent() || pTarget->region() != m_npc->region() )
return 1.0f;
***************
*** 335,341 ****
}
! float Human_Guard_Disappear::postCondition()
{
- // not really needed in this case, but necessary for the system ;)
return 1.0f - preCondition();
! }
\ No newline at end of file
--- 335,483 ----
}
! float Human_Guard_Called_Disappear::postCondition()
{
return 1.0f - preCondition();
! }
!
! static AbstractAI* productCreator_HG()
! {
! return new Human_Guard( NULL );
! }
!
! void Human_Guard::registerInFactory()
! {
! AIFactory::instance()->registerType("Human_Guard", productCreator_HG);
! }
!
! Human_Guard::Human_Guard( P_NPC npc ) : AbstractAI( npc ), m_currentVictim( NULL )
! {
! notorityOverride_ = 1;
! m_actions.append( new Human_Guard_Wander( npc, this ) );
! m_actions.append( new Human_Guard_MoveToTarget( npc, this ) );
! m_actions.append( new Human_Guard_Fight( npc, this ) );
! }
!
! void Human_Guard::check()
! {
! selectVictim();
! AbstractAI::check();
! }
!
! void Human_Guard::selectVictim()
! {
! if( m_currentVictim )
! {
! // Check if the current target is valid, including:
! // - Target not dead.
! // - Target in attack range.
! // - Target not innocent.
! if( m_currentVictim->isDead() || m_currentVictim->isInnocent() )
! m_currentVictim = NULL;
! else if( !m_npc->inRange( m_currentVictim, SrvParams->attack_distance() ) )
! m_currentVictim = NULL;
! }
!
! if( !m_currentVictim )
! {
! // Get a criminal or murderer in range to attack it
! RegionIterator4Chars ri( m_npc->pos(), VISRANGE );
! for( ri.Begin(); !ri.atEnd(); ri++ )
! {
! P_CHAR pChar = ri.GetData();
! if( pChar && !pChar->free && pChar != m_npc && !pChar->isInvulnerable() && !pChar->isHidden() && !pChar->isInvisible() && !pChar->isDead() && !pChar->isInnocent() )
! {
! P_PLAYER pPlayer = dynamic_cast<P_PLAYER>(pChar);
! if( pPlayer && pPlayer->isGMorCounselor() )
! continue;
!
! m_currentVictim = pChar;
! break;
! }
! }
!
! // If we found a new target, let us attack it
! if( m_currentVictim )
! m_npc->fight( m_currentVictim );
! }
!
! }
!
! void Human_Guard_Fight::execute()
! {
! // talk only in about every 10th check
! switch( RandomNum( 0, 20 ) )
! {
! case 0: m_npc->talk( tr( "Thou shalt regret thine actions, swine!" ), -1, 0, true ); break;
! case 1: m_npc->talk( tr( "Death to all Evil!" ), -1, 0, true ); break;
! }
!
! // Fighting is handled within combat..
! }
!
! float Human_Guard_Fight::preCondition()
! {
! Human_Guard* pAI = dynamic_cast< Human_Guard* >(m_ai);
! P_CHAR pTarget = ( pAI ? pAI->currentVictim() : NULL );
!
! if( !pTarget || pTarget->isDead() || pTarget->isInnocent() )
! return 0.0f;
!
! if( pTarget && m_npc->dist( pTarget ) < 2 )
! return 1.0f;
! else
! return 0.0f;
! }
!
! float Human_Guard_Fight::postCondition()
! {
! return 1.0f - preCondition();
! }
!
! void Human_Guard_MoveToTarget::execute()
! {
! Human_Guard* pAI = dynamic_cast< Human_Guard* >(m_ai);
! P_CHAR pTarget = ( pAI ? pAI->currentVictim() : NULL );
!
! if( !pTarget )
! return;
!
! if( SrvParams->pathfind4Combat() )
! movePath( pTarget->pos() );
! else
! moveTo( pTarget->pos() );
! }
!
! float Human_Guard_MoveToTarget::preCondition()
! {
! Human_Guard* pAI = dynamic_cast< Human_Guard* >(m_ai);
! P_CHAR pTarget = ( pAI ? pAI->currentVictim() : NULL );
!
! if( !pTarget || pTarget->isDead() || pTarget->isInnocent() )
! return 0.0f;
!
! if( pTarget && m_npc->dist( pTarget ) >= 2 )
! return 1.0f;
! else
! return 0.0f;
! }
!
! float Human_Guard_MoveToTarget::postCondition()
! {
! return 1.0f - preCondition();
! }
!
! float Human_Guard_Wander::preCondition()
! {
! Human_Guard* pAI = dynamic_cast< Human_Guard* >(m_ai);
! P_CHAR pTarget = ( pAI ? pAI->currentVictim() : NULL );
!
! if( !pTarget || pTarget->isDead() || pTarget->isInnocent() )
! return 1.0f;
!
! return 0.0f;
! }
!
! float Human_Guard_Wander::postCondition()
! {
! return 1.0f - preCondition();
! }
Index: combat.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/combat.cpp,v
retrieving revision 1.155
retrieving revision 1.156
diff -C2 -d -r1.155 -r1.156
*** combat.cpp 20 Sep 2003 12:01:43 -0000 1.155
--- combat.cpp 23 Sep 2003 11:53:31 -0000 1.156
***************
*** 870,874 ****
{
// Only shot if our "head" can see the opponent
! if( !pAttacker->pos().lineOfSight( pDefender->pos() ) )
{
/*
--- 870,874 ----
{
// Only shot if our "head" can see the opponent
! if( pAttacker->pos().lineOfSight( pDefender->pos() ) )
{
/*
***************
*** 876,880 ****
Maybe a 100 ms delay would be appropiate
*/
! mayAttack = false;
}
}
--- 876,880 ----
Maybe a 100 ms delay would be appropiate
*/
! mayAttack = true;
}
}
***************
*** 1046,1050 ****
// Show flying arrows if archery was used
! /* if( fightskill == ARCHERY )
{
if( los )
--- 1046,1050 ----
// Show flying arrows if archery was used
! /* if( fightskill == ARCHERY )
{
if( los )
***************
*** 1263,1269 ****
return;
! if( pRegion->isGuarded() && SrvParams->guardsActive() && !pOffender->isInvulnerable() )
{
! P_NPC pGuard = cCharStuff::createScriptNpc( pRegion->getGuardSect(), pos );
if ( !pGuard )
--- 1263,1271 ----
return;
! if( pRegion->isGuarded() && SrvParams->guardsActive() /*&& !pOffender->isInvulnerable()*/ )
{
! QString guardsect = pRegion->getGuardSect();
!
! P_NPC pGuard = ( guardsect.isNull() ? NULL : cCharStuff::createScriptNpc( guardsect, pos ) );
if ( !pGuard )
Index: dragdrop.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/dragdrop.cpp,v
retrieving revision 1.203
retrieving revision 1.204
diff -C2 -d -r1.203 -r1.204
*** dragdrop.cpp 20 Sep 2003 02:12:26 -0000 1.203
--- dragdrop.cpp 23 Sep 2003 11:53:31 -0000 1.204
***************
*** 168,172 ****
pContainer->addItem( splitItem, false );
splitItem->SetOwnSerial( pItem->ownSerial() );
! splitItem->SetSpawnSerial( pItem->spawnserial );
// He needs to see the new item
--- 168,172 ----
pContainer->addItem( splitItem, false );
splitItem->SetOwnSerial( pItem->ownSerial() );
! splitItem->setSpawnRegion( pItem->spawnregion() );
// He needs to see the new item
***************
*** 174,178 ****
// If we're taking something out of a spawn-region it's spawning "flag" is removed isn't it?
! pItem->SetSpawnSerial( INVALID_SERIAL );
pItem->setAmount( pickedAmount );
}
--- 174,178 ----
// If we're taking something out of a spawn-region it's spawning "flag" is removed isn't it?
! pItem->setSpawnRegion( (char*)0 );
pItem->setAmount( pickedAmount );
}
Index: items.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/items.cpp,v
retrieving revision 1.353
retrieving revision 1.354
diff -C2 -d -r1.353 -r1.354
*** items.cpp 15 Sep 2003 12:49:05 -0000 1.353
--- items.cpp 23 Sep 2003 11:53:31 -0000 1.354
***************
*** 108,112 ****
this->setOwnSerialOnly(src.ownSerial());
this->visible_=src.visible_;
! this->spawnserial=src.spawnserial;
this->priv_=src.priv_;
this->buyprice_ = src.buyprice_;
--- 108,112 ----
this->setOwnSerialOnly(src.ownSerial());
this->visible_=src.visible_;
! this->spawnregion_=src.spawnregion_;
this->priv_=src.priv_;
this->buyprice_ = src.buyprice_;
***************
*** 201,210 ****
}
- void cItem::SetSpawnSerial(long spawnser)
- {
- spawnserial = spawnser;
- flagChanged();
- }
-
void cItem::SetMultiSerial(long mulser)
{
--- 201,204 ----
***************
*** 452,456 ****
addField("owner", ownserial_);
addField("visible", visible_);
! addField("spawn", spawnserial);
addField("priv", priv_);
addField("sellprice", sellprice_);
--- 446,450 ----
addField("owner", ownserial_);
addField("visible", visible_);
! addStrField("spawnregion", spawnregion_);
addField("priv", priv_);
addField("sellprice", sellprice_);
***************
*** 555,559 ****
this->setOwnSerialOnly(-1);
this->visible_=0; // 0=Normally Visible, 1=Owner & GM Visible, 2=GM Visible
! this->spawnserial=-1;
// Everything decays by default.
this->priv_ = 0; // Bit 0, nodecay off/on. Bit 1, newbie item off/on. Bit 2 Dispellable
--- 549,553 ----
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
***************
*** 576,580 ****
// Update Top Objects
! SetSpawnSerial( -1 );
SetOwnSerial( -1 );
--- 570,574 ----
// Update Top Objects
! setSpawnRegion( (char*)0 );
SetOwnSerial( -1 );
***************
*** 1876,1880 ****
// Set the outside indices
! pi->SetSpawnSerial( pi->spawnserial );
pi->SetOwnSerial( pi->ownSerial() );
--- 1870,1874 ----
// Set the outside indices
! pi->setSpawnRegion( pi->spawnregion() );
pi->SetOwnSerial( pi->ownSerial() );
***************
*** 1938,1942 ****
ownserial_ = atoi( result[offset++] );
visible_ = atoi( result[offset++] );
! spawnserial = atoi( result[offset++] );
priv_ = atoi( result[offset++] );
sellprice_ = atoi( result[offset++] );
--- 1932,1936 ----
ownserial_ = atoi( result[offset++] );
visible_ = atoi( result[offset++] );
! spawnregion_ = atoi( result[offset++] );
priv_ = atoi( result[offset++] );
sellprice_ = atoi( result[offset++] );
***************
*** 1953,1957 ****
{
cUObject::buildSqlString( fields, tables, conditions );
! fields.push_back( "items.id,items.color,items.cont,items.layer,items.type,items.type2,items.amount,items.decaytime,items.def,items.hidamage,items.lodamage,items.time_unused,items.weight,items.hp,items.maxhp,items.speed,items.poisoned,items.magic,items.owner,items.visible,items.spawn,items.priv,items.sellprice,items.buyprice,items.restock" );
tables.push_back( "items" );
conditions.push_back( "uobjectmap.serial = items.serial" );
--- 1947,1951 ----
{
cUObject::buildSqlString( fields, tables, conditions );
! fields.push_back( "items.id,items.color,items.cont,items.layer,items.type,items.type2,items.amount,items.decaytime,items.def,items.hidamage,items.lodamage,items.time_unused,items.weight,items.hp,items.maxhp,items.speed,items.poisoned,items.magic,items.owner,items.visible,items.spawnregion,items.priv,items.sellprice,items.buyprice,items.restock" );
tables.push_back( "items" );
conditions.push_back( "uobjectmap.serial = items.serial" );
***************
*** 2227,2231 ****
}
! else SET_INT_PROPERTY( "spawn", spawnserial )
else SET_INT_PROPERTY( "sellprice", sellprice_ )
else SET_INT_PROPERTY( "buyprice", buyprice_ )
--- 2221,2225 ----
}
! else SET_STR_PROPERTY( "spawnregion", spawnregion_ )
else SET_INT_PROPERTY( "sellprice", sellprice_ )
else SET_INT_PROPERTY( "buyprice", buyprice_ )
***************
*** 2342,2346 ****
else GET_PROPERTY( "visible", visible_ == 0 ? 1 : 0 )
else GET_PROPERTY( "ownervisible", visible_ == 1 ? 1 : 0 )
! else GET_PROPERTY( "spawn", FindItemBySerial( spawnserial ) )
else GET_PROPERTY( "buyprice", buyprice_ )
--- 2336,2340 ----
else GET_PROPERTY( "visible", visible_ == 0 ? 1 : 0 )
else GET_PROPERTY( "ownervisible", visible_ == 1 ? 1 : 0 )
! else GET_PROPERTY( "spawnregion", spawnregion_ )
else GET_PROPERTY( "buyprice", buyprice_ )
Index: items.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/items.h,v
retrieving revision 1.178
retrieving revision 1.179
diff -C2 -d -r1.178 -r1.179
*** items.h 30 Aug 2003 17:00:09 -0000 1.178
--- items.h 23 Sep 2003 11:53:31 -0000 1.179
***************
*** 108,111 ****
--- 108,113 ----
uchar priv() const { return priv_; }
+ QString spawnregion() const { return spawnregion_; }
+
//***************************END ADDED GETTERS************
***************
*** 134,137 ****
--- 136,140 ----
void setTotalweight( int data );
void setAntispamtimer ( uint data ) { antispamtimer_ = data; flagChanged();}
+ void setSpawnRegion( const QString &data ) { spawnregion_ = data; flagChanged(); }
cItem();
***************
*** 156,161 ****
//*******************************************END ADDED SETTERS**********
- SERIAL spawnserial;
-
bool incognito; //AntiChrist - for items under incognito effect
// ^^ NUTS !! - move that to priv
--- 159,162 ----
***************
*** 174,178 ****
int ownSerial() const {return ownserial_;}
- void SetSpawnSerial(long spawnser);
void SetMultiSerial(long mulser);
--- 175,178 ----
***************
*** 260,263 ****
--- 260,264 ----
int sellprice_;
int buyprice_;
+ QString spawnregion_;
ContainerContent content_;
Index: npc.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/npc.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** npc.h 20 Sep 2003 13:51:34 -0000 1.26
--- npc.h 23 Sep 2003 11:53:31 -0000 1.27
***************
*** 49,53 ****
const char *objectID() const
{
! return "cUObject";
}
--- 49,53 ----
const char *objectID() const
{
! return "cNPC";
}
Index: player.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/player.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** player.cpp 14 Sep 2003 16:31:48 -0000 1.41
--- player.cpp 23 Sep 2003 11:53:31 -0000 1.42
***************
*** 834,838 ****
bool cPlayer::isGMorCounselor() const
{
! return account() && ( account()->acl() == "admin" || account()->acl() == "gm" || account()->acl() == "counselor" );
}
--- 834,838 ----
bool cPlayer::isGMorCounselor() const
{
! return account() && ( account()->acl() == "admin" || account()->acl() == "gm" || account()->acl() == "counselor" ) && account()->isStaff();
}
Index: spawnregions.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/spawnregions.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** spawnregions.cpp 11 Sep 2003 16:19:50 -0000 1.50
--- spawnregions.cpp 23 Sep 2003 11:53:31 -0000 1.51
***************
*** 463,464 ****
--- 463,496 ----
return 0;
}
+
+ void cAllSpawnRegions::postWorldLoading()
+ {
+ cCharIterator iChars;
+ for( P_CHAR pChar = iChars.first(); pChar; pChar = iChars.next() )
+ {
+ if( pChar->objectType() == enNPC )
+ {
+ P_NPC pNPC = dynamic_cast< P_NPC >(pChar);
+ QString srname = pNPC->spawnregion();
+ if( !srname.isNull() )
+ {
+ cSpawnRegion* spawnregion = region( srname );
+ if( spawnregion )
+ spawnregion->add( pNPC->serial() );
+ }
+ }
+ }
+
+ cItemIterator iItems;
+ for( P_ITEM pItem = iItems.first(); pItem; pItem = iItems.next() )
+ {
+ QString srname = pItem->spawnregion();
+ if( !srname.isNull() )
+ {
+ cSpawnRegion* spawnregion = region( srname );
+ if( spawnregion )
+ spawnregion->add( pItem->serial() );
+ }
+ }
+ }
+
Index: spawnregions.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/spawnregions.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** spawnregions.h 6 Jul 2003 13:48:02 -0000 1.18
--- spawnregions.h 23 Sep 2003 11:53:31 -0000 1.19
***************
*** 163,166 ****
--- 163,168 ----
return numItems;
}
+
+ void postWorldLoading( void );
};
Index: territories.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/territories.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** territories.cpp 11 Sep 2003 12:22:24 -0000 1.32
--- territories.cpp 23 Sep 2003 11:53:31 -0000 1.33
***************
*** 55,59 ****
rainchance_ = 50;
guardSections_ = QStringList();
! guardSections_.push_back( "standard_guard" );
}
--- 55,59 ----
rainchance_ = 50;
guardSections_ = QStringList();
! // guardSections_.push_back( "standard_guard" );
}
***************
*** 239,243 ****
QString cTerritory::getGuardSect( void ) const
{
! return this->guardSections_[ RandomNum( 0, this->guardSections_.size()-1 ) ];
}
--- 239,246 ----
QString cTerritory::getGuardSect( void ) const
{
! if( guardSections_.count() > 0 )
! return this->guardSections_[ RandomNum( 0, this->guardSections_.size()-1 ) ];
! else
! return (char*)0;
}
Index: wolfpack.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolfpack.cpp,v
retrieving revision 1.469
retrieving revision 1.470
diff -C2 -d -r1.469 -r1.470
*** wolfpack.cpp 20 Sep 2003 12:01:44 -0000 1.469
--- wolfpack.cpp 23 Sep 2003 11:53:31 -0000 1.470
***************
*** 471,474 ****
--- 471,475 ----
Human_Stablemaster::registerInFactory();
Human_Guard::registerInFactory();
+ Human_Guard_Called::registerInFactory();
Animal_Wild::registerInFactory();
Animal_Domestic::registerInFactory();
Index: world.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/world.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** world.cpp 13 Sep 2003 13:08:41 -0000 1.46
--- world.cpp 23 Sep 2003 11:53:31 -0000 1.47
***************
*** 50,53 ****
--- 50,54 ----
#include "sectors.h"
#include "territories.h"
+ #include "spawnregions.h"
// Objects ( => Factory later on )
***************
*** 206,210 ****
owner int(11) NOT NULL default '-1',\
visible tinyint(3) NOT NULL default '0',\
! spawn int(11) NOT NULL default '-1',\
priv tinyint(3) NOT NULL default '0',\
sellprice int(11) NOT NULL default '0',\
--- 207,211 ----
owner int(11) NOT NULL default '-1',\
visible tinyint(3) NOT NULL default '0',\
! spawnregion varchar(255) default NULL,\
priv tinyint(3) NOT NULL default '0',\
sellprice int(11) NOT NULL default '0',\
***************
*** 644,647 ****
--- 645,651 ----
pChar->flagUnchanged(); // We've just loaded, nothing changes
}
+
+ // Post process spawnregions
+ SpawnRegions::instance()->postWorldLoading();
Console::instance()->ProgressDone();
|
|
From: <dr...@us...> - 2003-09-22 18:19:42
|
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1:/tmp/cvs-serv21349 Modified Files: wolfpack.pro Log Message: Removed the removed files from the list. :) Index: wolfpack.pro =================================================================== RCS file: /cvsroot/wpdev/wolfpack/wolfpack.pro,v retrieving revision 1.163 retrieving revision 1.164 diff -C2 -d -r1.163 -r1.164 *** wolfpack.pro 15 Sep 2003 02:00:41 -0000 1.163 --- wolfpack.pro 22 Sep 2003 18:19:37 -0000 1.164 *************** *** 159,163 **** ai_animals.cpp \ ai_monsters.cpp \ - ai_vendors.cpp \ basechar.cpp \ basedef.cpp \ --- 159,162 ---- |
|
From: <ri...@us...> - 2003-09-21 17:03:47
|
Update of /cvsroot/wpdev/xmlscripts/definitions/npcs/humans In directory sc8-pr-cvs1:/tmp/cvs-serv2161/definitions/npcs/humans Modified Files: guards.xml vendors.xml Log Message: added male & female guards. added a new look for guards Index: guards.xml =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/definitions/npcs/humans/guards.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** guards.xml 20 Sep 2003 12:00:10 -0000 1.4 --- guards.xml 21 Sep 2003 17:03:40 -0000 1.5 *************** *** 8,13 **** --> <definitions> ! <!-- Guard Base --> ! <npc id="base_guard"> <name><random list="NAMES_MALE" /></name> <skin><random list="SKINS_HUMAN" /></skin> --- 8,14 ---- --> <definitions> ! <!-- Male Guard Base --> ! <npc id="base_male_guard"> ! <id>0x190</id> <name><random list="NAMES_MALE" /></name> <skin><random list="SKINS_HUMAN" /></skin> *************** *** 19,25 **** </npc> ! <npc id="standard_guard"> ! <!-- The Equipment of a standard standard_guard --> ! <inherit>base_guard</inherit> <fame>10000</fame> --- 20,38 ---- </npc> ! <!-- Female Guard Base --> ! <npc id="base_female_guard"> ! <id>0x191</id> ! <name><random list="NAMES_FEMALE" /></name> ! <skin><random list="SKINS_HUMAN" /></skin> ! <ai>Human_Guard</ai> ! <direction><random min="0" max="7" /></direction> <!-- Facing a random direction --> ! <totame>1100</totame> ! <npcwander type="circle" radius="20" /> ! <notrain /> ! </npc> ! ! <npc id="male_guard"> ! <!-- The Equipment of a male_guard --> ! <inherit>base_male_guard</inherit> <fame>10000</fame> *************** *** 43,52 **** <equipped> ! <item inherit="13bb" /> ! <item inherit="e75" /> ! <item inheritlist="HAIR" /> ! <item inherit="1efd" /> ! <item inheritlist="PANTS" /> ! <item inheritlist="SHOES" /> </equipped> </npc> --- 56,96 ---- <equipped> ! <item inheritlist="HAIR" /> ! <item inherit="e75" /> <!-- Backpack --> ! <item inherit="143f" /> <!-- Halberd --> ! <item inherit="1f7b" /> <!-- Doublet --> ! <item inherit="1410" /> <!-- Plate Arms --> ! <item inherit="1411" /> <!-- Plate Legs --> ! </equipped> ! </npc> ! ! <npc id="female_guard"> ! <!-- The Equipment of a female_guard --> ! <inherit>base_female_guard</inherit> ! ! <fame>10000</fame> ! <karma>10000</karma> ! <defense>1000</defense> ! <attack>1000</attack> ! <priv1>4</priv1> ! <str><random min="1000" max="1500" /></str> ! <dex><random min="1000" max="1500" /></dex> ! <int><random min="1000" max="1500" /></int> ! ! <parrying>990</parrying> ! <magicresistance>990</magicresistance> ! <tactics>1000</tactics> ! <wrestling>990</wrestling> ! ! <hidamage>1000</hidamage> ! <lodamage>1000</lodamage> ! ! <title>the guard</title> ! ! <equipped> ! <item inheritlist="HAIR_FEMALE" /> ! <item inherit="e75" /> <!-- Backpack --> ! <item inherit="143f" /> <!-- Halberd --> ! <item inherit="1c04" /> <!-- Female Plate --> </equipped> </npc> Index: vendors.xml =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/definitions/npcs/humans/vendors.xml,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** vendors.xml 14 Sep 2003 18:57:30 -0000 1.21 --- vendors.xml 21 Sep 2003 17:03:40 -0000 1.22 *************** *** 16,19 **** --- 16,23 ---- <bindmenu>banker_menu</bindmenu> <ai>Human_Vendor</ai> + <equipped> + <item inherit="1515" /> <!-- Cloak --> + <item inherit="1541" /> <!-- Sash --> + </equipped> <category>Vendors\Banker (Male)</category> </npc> *************** *** 24,27 **** --- 28,35 ---- <bindmenu>banker_menu</bindmenu> <ai>Human_Vendor</ai> + <equipped> + <item inherit="1515" /> <!-- Cloak --> + <item inherit="1719" /> <!-- Bonnet --> + </equipped> <category>Vendors\Banker (Female)</category> </npc> |
|
From: <ri...@us...> - 2003-09-21 17:03:45
|
Update of /cvsroot/wpdev/xmlscripts/definitions/spawnregions In directory sc8-pr-cvs1:/tmp/cvs-serv2161/definitions/spawnregions Modified Files: britain_fel.xml britain_tram.xml Log Message: added male & female guards. added a new look for guards Index: britain_fel.xml =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/definitions/spawnregions/britain_fel.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** britain_fel.xml 14 Sep 2003 18:57:31 -0000 1.4 --- britain_fel.xml 21 Sep 2003 17:03:40 -0000 1.5 *************** *** 167,171 **** <maxtime>1</maxtime> <npcs> ! <npc>standard_guard</npc> </npcs> --- 167,171 ---- <maxtime>1</maxtime> <npcs> ! <npc>male_guard</npc> </npcs> *************** *** 178,182 **** <maxtime>1</maxtime> <npcs> ! <npc>standard_guard</npc> </npcs> --- 178,182 ---- <maxtime>1</maxtime> <npcs> ! <npc>female_guard</npc> </npcs> *************** *** 189,193 **** <maxtime>1</maxtime> <npcs> ! <npc>standard_guard</npc> </npcs> --- 189,193 ---- <maxtime>1</maxtime> <npcs> ! <npc>male_guard</npc> </npcs> Index: britain_tram.xml =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/definitions/spawnregions/britain_tram.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** britain_tram.xml 14 Sep 2003 18:57:31 -0000 1.2 --- britain_tram.xml 21 Sep 2003 17:03:40 -0000 1.3 *************** *** 167,171 **** <maxtime>1</maxtime> <npcs> ! <npc>standard_guard</npc> </npcs> --- 167,171 ---- <maxtime>1</maxtime> <npcs> ! <npc>male_guard</npc> </npcs> *************** *** 178,182 **** <maxtime>1</maxtime> <npcs> ! <npc>standard_guard</npc> </npcs> --- 178,182 ---- <maxtime>1</maxtime> <npcs> ! <npc>female_guard</npc> </npcs> *************** *** 189,193 **** <maxtime>1</maxtime> <npcs> ! <npc>standard_guard</npc> </npcs> --- 189,193 ---- <maxtime>1</maxtime> <npcs> ! <npc>male_guard</npc> </npcs> |
|
From: <xs...@us...> - 2003-09-20 13:51:38
|
Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv11422
Modified Files:
npc.h
Log Message:
guard calling fix
Index: npc.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/npc.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** npc.h 20 Sep 2003 12:01:43 -0000 1.25
--- npc.h 20 Sep 2003 13:51:34 -0000 1.26
***************
*** 593,597 ****
inline bool cNPC::isInnocent()
{
! return notority() != 1;
}
--- 593,597 ----
inline bool cNPC::isInnocent()
{
! return notority() == 1;
}
|
|
From: <xs...@us...> - 2003-09-20 13:51:38
|
Update of /cvsroot/wpdev/wolfpack/network
In directory sc8-pr-cvs1:/tmp/cvs-serv11422/network
Modified Files:
uosocket.cpp
Log Message:
guard calling fix
Index: uosocket.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/network/uosocket.cpp,v
retrieving revision 1.295
retrieving revision 1.296
diff -C2 -d -r1.295 -r1.296
*** uosocket.cpp 20 Sep 2003 12:01:44 -0000 1.295
--- uosocket.cpp 20 Sep 2003 13:51:33 -0000 1.296
***************
*** 1936,1940 ****
pn->setNextMoveTime();
}
! else
{
dynamic_cast<P_NPC>(pc_i)->setNextMoveTime();
--- 1936,1940 ----
pn->setNextMoveTime();
}
! else if( pc_i->objectType() == enNPC )
{
dynamic_cast<P_NPC>(pc_i)->setNextMoveTime();
|
|
From: <xs...@us...> - 2003-09-20 12:01:51
|
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1:/tmp/cvs-serv28299 Modified Files: ai.h basechar.h combat.cpp definable.cpp npc.cpp npc.h srvparams.cpp srvparams.h uobject.cpp wolf.dsp wolfpack.cpp wpdefmanager.cpp wpdefmanager.h Added Files: ai_humans.cpp Removed Files: ai_vendors.cpp Log Message: introducing guard ai, fixes performance issues with definition lists --- NEW FILE: ai_humans.cpp --- //================================================================================== // // Wolfpack Emu (WP) // UO Server Emulation Program // // Copyright 2001-2003 by holders identified in authors.txt // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Palace - Suite 330, Boston, MA 02111-1307, USA. // // * In addition to that license, if you are running this program or modified // * versions of it on a public system you HAVE TO make the complete source of // * the version used by you available or provide people with a location to // * download it. // // // // Wolfpack Homepage: http://wpdev.sf.net/ //================================================================================== #include "ai.h" #include "npc.h" #include "player.h" #include "network/uosocket.h" #include "speech.h" #include "targetrequests.h" #include "TmpEff.h" #include "srvparams.h" #include "globals.h" #include "sectors.h" #include "world.h" #include "basics.h" // library includes #include <math.h> static AbstractAI* productCreator_HV() { return new Human_Vendor( NULL ); } void Human_Vendor::registerInFactory() { AIFactory::instance()->registerType("Human_Vendor", productCreator_HV); } void Human_Vendor::onSpeechInput( P_PLAYER pTalker, const QString &comm ) { if( !pTalker->socket() ) return; if( m_npc->inRange( pTalker, 4 ) && VendorChkName( m_npc, comm ) ) { if( comm.contains( tr(" BUY") ) ) { P_ITEM pContA = m_npc->GetItemOnLayer( cBaseChar::BuyRestockContainer ); P_ITEM pContB = m_npc->GetItemOnLayer( cBaseChar::BuyNoRestockContainer ); m_npc->turnTo( pTalker ); if( !pContA && !pContB ) { m_npc->talk( tr( "Sorry but i have no goods to sell" ) ); return; } m_npc->talk( tr( "Take a look at my wares!" ) ); pTalker->socket()->sendBuyWindow( m_npc ); } else if( comm.contains( tr(" SELL") ) ) { P_ITEM pContC = m_npc->GetItemOnLayer( cBaseChar::SellContainer ); m_npc->turnTo( pTalker ); if( !pContC ) { m_npc->talk( tr( "Sorry, I cannot use any of your wares!" ) ); return; } m_npc->talk( tr( "This could be of interest!" ) ); pTalker->socket()->sendSellWindow( m_npc, pTalker ); } } } Human_Stablemaster::Human_Stablemaster( P_NPC npc ) : AbstractAI( npc ) { notorityOverride_ = 1; m_actions.append( new Action_Wander( npc, this ) ); m_actions.append( new Action_FleeAttacker( npc, this ) ); } void Human_Stablemaster::init( P_NPC npc ) { AbstractAI::init( npc ); } static AbstractAI* productCreator_HS() { return new Human_Stablemaster( NULL ); } void Human_Stablemaster::registerInFactory() { AIFactory::instance()->registerType("Human_Stablemaster", productCreator_HS); } void Human_Stablemaster::onSpeechInput( P_PLAYER pTalker, const QString &message ) { if( !pTalker->socket() ) return; if( m_npc->inRange( pTalker, 4 ) && ( VendorChkName( m_npc, message ) || message.contains( tr("STABLEMASTER") ) ) ) { if( message.contains( tr(" STABLE") ) ) { m_npc->talk( tr("Which pet do you want me to stable?") ); pTalker->socket()->attachTarget( new cStableTarget( m_npc ) ); } else if( message.contains( tr(" RELEASE") ) ) { int gold = pTalker->CountBankGold() + pTalker->CountGold(); P_ITEM pPack = m_npc->getBackpack(); cItem::ContainerContent stableitems; if( pPack ) { cItem::ContainerContent content = pPack->content(); cItem::ContainerContent::const_iterator it( content.begin() ); while( it != content.end() ) { if( !(*it)->tags().has( "player" ) || !(*it)->tags().has( "pet" ) ) continue; if( (*it) && (*it)->id() == 0x1ea7 && (*it)->tags().get( "player" ).asInt() == pTalker->serial() ) stableitems.push_back( (*it) ); ++it; } } if( !stableitems.empty() ) { cItem::ContainerContent::const_iterator it( stableitems.begin() ); while( it != stableitems.end() ) { if( (*it) ) { P_NPC pPet = dynamic_cast<P_NPC>(World::instance()->findChar( (*it)->tags().get( "pet" ).asInt() )); if( pPet ) { pPet->free = false; pPet->moveTo( m_npc->pos() ); pPet->resend(); } (*it)->remove(); } ++it; } pPack->update(); m_npc->talk( tr("Here's your pet back!") ); } } } } void Human_Stablemaster::refreshStock() { } void Human_Stablemaster::handleTargetInput( P_PLAYER player, cUORxTarget *target ) { if( !player ) return; P_ITEM pPack = m_npc->getBackpack(); if( !pPack ) return; P_NPC pPet = dynamic_cast< P_NPC >(World::instance()->findChar( target->serial() )); if( !pPet ) { m_npc->talk( tr("I cannot stable that!" ) ); return; } if( pPet->owner() != player ) { m_npc->talk( tr("This does not belong to you!" ) ); return; } // we spawn a worldgem in the stablemasters backpack for the pet // it does only hold the serial of it, the serial of the owner and the // number of refresh signals since begin of stabling // the pet becomes "free", which means, that it isnt in the world // but will still be saved. P_ITEM pGem = new cItem(); pGem->Init( false ); pGem->tags().set( "player", cVariant( player->serial() ) ); pGem->tags().set( "pet", cVariant( pPet->serial() ) ); pGem->setId( 0x1ea7 ); pGem->setName( tr("petitem: %1").arg(pPet->name()) ); pGem->setVisible( 2 ); // gm visible pPack->addItem( pGem ); pGem->update(); pPet->free = true; MapObjects::instance()->remove( pPet ); pPet->removeFromView(); m_npc->talk( tr("Say release to get your pet back!") ); } static AbstractAI* productCreator_HG() { return new Human_Guard( NULL ); } void Human_Guard::registerInFactory() { AIFactory::instance()->registerType("Human_Guard", productCreator_HG); } Human_Guard::Human_Guard( P_NPC npc ) : AbstractAI( npc ) { notorityOverride_ = 1; m_actions.append( new Human_Guard_Fight( npc, this ) ); m_actions.append( new Human_Guard_TeleToTarget( npc, this ) ); m_actions.append( new Human_Guard_Disappear( npc, this ) ); } void Human_Guard::init( P_NPC npc ) { npc->setSummonTime( uiCurrentTime + MY_CLOCKS_PER_SEC * SrvParams->guardDispelTime() ); AbstractAI::init( npc ); } void Human_Guard_Fight::execute() { // talk only in about every 10th check switch( RandomNum( 0, 20 ) ) { case 0: m_npc->talk( tr( "Thou shalt regret thine actions, swine!" ), -1, 0, true ); break; case 1: m_npc->talk( tr( "Death to all Evil!" ), -1, 0, true ); break; } m_npc->setSummonTime( uiCurrentTime + MY_CLOCKS_PER_SEC * SrvParams->guardDispelTime() ); // Fighting is handled within combat.. } float Human_Guard_Fight::preCondition() { if( m_npc->combatTarget() == INVALID_SERIAL ) return 0.0f; P_CHAR pTarget = World::instance()->findChar( m_npc->combatTarget() ); if( !pTarget || pTarget->isDead() ) return 0.0f; if( pTarget && m_npc->dist( pTarget ) < 2 ) return 1.0f; else return 0.0f; } float Human_Guard_Fight::postCondition() { return 1.0f - preCondition(); } void Human_Guard_TeleToTarget::execute() { m_npc->setSummonTime( uiCurrentTime + MY_CLOCKS_PER_SEC * SrvParams->guardDispelTime() ); // Teleports the guard towards the target P_CHAR pTarget = World::instance()->findChar( m_npc->combatTarget() ); if( pTarget ) { m_npc->moveTo( pTarget->pos() ); m_npc->soundEffect( 0x1FE ); m_npc->effect( 0x372A, 0x09, 0x06 ); m_npc->resend( false ); } } float Human_Guard_TeleToTarget::preCondition() { if( m_npc->combatTarget() == INVALID_SERIAL ) return 0.0f; P_CHAR pTarget = World::instance()->findChar( m_npc->combatTarget() ); if( !pTarget || pTarget->isDead() ) return 0.0f; if( pTarget && m_npc->dist( pTarget ) >= 2 ) return 1.0f; else return 0.0f; } float Human_Guard_TeleToTarget::postCondition() { return 1.0f - preCondition(); } void Human_Guard_Disappear::execute() { // nothing to do } float Human_Guard_Disappear::preCondition() { if( m_npc->combatTarget() == INVALID_SERIAL ) return 1.0f; P_CHAR pTarget = World::instance()->findChar( m_npc->combatTarget() ); if( !pTarget || pTarget->isDead() ) return 1.0f; return 0.0f; } float Human_Guard_Disappear::postCondition() { // not really needed in this case, but necessary for the system ;) return 1.0f - preCondition(); } Index: ai.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/ai.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ai.h 13 Sep 2003 13:37:15 -0000 1.18 --- ai.h 20 Sep 2003 12:01:43 -0000 1.19 *************** *** 263,267 **** { protected: ! Monster_Aggressive_L1() : Monster_Aggressive(){} public: --- 263,267 ---- { protected: ! Monster_Aggressive_L1() : Monster_Aggressive() {} public: *************** *** 342,345 **** --- 342,347 ---- public: + AnimalAI( P_NPC npc ) : AbstractAI( npc ) {} + virtual void onSpeechInput( P_PLAYER pTalker, const QString &comm ); }; *************** *** 351,355 **** public: ! Animal_Wild( P_NPC npc ) { m_actions.append( new Action_Wander( npc, this ) ); --- 353,357 ---- public: ! Animal_Wild( P_NPC npc ) : AnimalAI( npc ) { m_actions.append( new Action_Wander( npc, this ) ); *************** *** 369,373 **** public: ! Animal_Domestic( P_NPC npc ) { m_actions.append( new Action_Wander( npc, this ) ); --- 371,375 ---- public: ! Animal_Domestic( P_NPC npc ) : AnimalAI( npc ) { m_actions.append( new Action_Wander( npc, this ) ); *************** *** 423,426 **** --- 425,477 ---- QString m_name; QString onspeech; + }; + + class Human_Guard_Fight : public AbstractAction + { + protected: + Human_Guard_Fight() : AbstractAction() {} + public: + Human_Guard_Fight( P_NPC npc, AbstractAI* ai ) : AbstractAction( npc, ai ) {} + virtual void execute(); + virtual float preCondition(); + virtual float postCondition(); + }; + + class Human_Guard_TeleToTarget : public AbstractAction + { + protected: + Human_Guard_TeleToTarget() : AbstractAction() {} + public: + Human_Guard_TeleToTarget( P_NPC npc, AbstractAI* ai ) : AbstractAction( npc, ai ) {} + virtual void execute(); + virtual float preCondition(); + virtual float postCondition(); + }; + + class Human_Guard_Disappear : public AbstractAction + { + protected: + Human_Guard_Disappear() : AbstractAction() {} + public: + Human_Guard_Disappear( P_NPC npc, AbstractAI* ai ) : AbstractAction( npc, ai ) {} + virtual void execute(); + virtual float preCondition(); + virtual float postCondition(); + }; + + class Human_Guard : public AbstractAI + { + protected: + Human_Guard() : AbstractAI() + { + notorityOverride_ = 1; + } + + public: + Human_Guard( P_NPC npc ); + virtual void init( P_NPC npc ); + + static void registerInFactory(); + virtual QString name() { return "Human_Guard"; } }; Index: basechar.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/basechar.h,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** basechar.h 16 Sep 2003 18:15:24 -0000 1.36 --- basechar.h 20 Sep 2003 12:01:43 -0000 1.37 *************** *** 129,133 **** bool isMurderer() const; bool isCriminal() const; ! bool isInnocent() const; void unhide(); int CountItems(short ID, short col= -1); --- 129,133 ---- bool isMurderer() const; bool isCriminal() const; ! virtual bool isInnocent(); void unhide(); int CountItems(short ID, short col= -1); *************** *** 1316,1320 **** } ! inline bool cBaseChar::isInnocent() const { return !isMurderer() && !isCriminal(); --- 1316,1320 ---- } ! inline bool cBaseChar::isInnocent() { return !isMurderer() && !isCriminal(); Index: combat.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/combat.cpp,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -d -r1.154 -r1.155 *** combat.cpp 19 Sep 2003 22:02:41 -0000 1.154 --- combat.cpp 20 Sep 2003 12:01:43 -0000 1.155 *************** *** 950,967 **** if( pDefender->isDead() ) // Highlight // Repsys { - #pragma message("reimplement with new npc ai sys") - /* if( ( pAttacker->npcaitype() == 4 || pAttacker->npcaitype() == 9 ) && pDefender->isNpc() ) - { - pDefender->action( 0x15 ); - pDefender->playDeathSound(); - cCharStuff::DeleteChar( pDefender ); // Guards, don't give body - } - else - { - - pAttacker->setSwingTarget( -1 ); - } - */ - // murder count \/ if( ( pAttacker->objectType() == enPlayer ) && ( pDefender->objectType() == enPlayer ) ) //Player vs Player --- 950,953 ---- *************** *** 1289,1293 **** pGuard->toggleCombat(); pGuard->setNextMoveTime(); - pGuard->setSummonTime( ( uiCurrentTime + (MY_CLOCKS_PER_SEC*25) ) ); pGuard->soundEffect( 0x1FE ); --- 1275,1278 ---- *************** *** 1296,1306 **** // Send guard to surrounding Players pGuard->resend( false ); - - // 50% talk chance - switch( RandomNum( 0, 4 ) ) - { - case 0: pGuard->talk( tr( "Thou shalt regret thine actions, swine!" ), -1, 0, true ); break; - case 1: pGuard->talk( tr( "Death to all Evil!" ), -1, 0, true ); break; - } } } --- 1281,1284 ---- Index: definable.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/definable.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** definable.cpp 11 Sep 2003 16:19:50 -0000 1.14 --- definable.cpp 20 Sep 2003 12:01:43 -0000 1.15 *************** *** 35,38 **** --- 35,40 ---- #include "basics.h" + //#include "console.h" + // Qt Includes #include <qdom.h> *************** *** 41,44 **** --- 43,48 ---- void cDefinable::applyDefinition( const cElement* sectionNode ) { + //unsigned int starttime = getNormalizedTime(); + if( sectionNode->hasAttribute( "inherit" ) ) { *************** *** 74,77 **** --- 78,85 ---- for( unsigned int i = 0; i < sectionNode->childCount(); ++i ) processNode( sectionNode->getChild( i ) ); + + //unsigned int endtime = getNormalizedTime(); + + //Console::instance()->send( QString( "applyDefinition took %1 ms\n" ).arg( (float)(endtime - starttime) / MY_CLOCKS_PER_SEC * 1000.0f ) ); } Index: npc.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/npc.cpp,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** npc.cpp 14 Sep 2003 16:31:48 -0000 1.45 --- npc.cpp 20 Sep 2003 12:01:43 -0000 1.46 *************** *** 372,375 **** --- 372,378 ---- return ai_->notorityOverride(); + if( !pChar ) + return 3; + if( pChar->kills() > SrvParams->maxkills() ) result = 0x06; // 6 = Red -> Murderer Index: npc.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/npc.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** npc.h 5 Sep 2003 00:03:45 -0000 1.24 --- npc.h 20 Sep 2003 12:01:43 -0000 1.25 *************** *** 93,97 **** virtual void resend( bool clean = true, bool excludeself = false ); virtual void talk( const QString &message, UI16 color = 0xFFFF, UINT8 type = 0, bool autospam = false, cUOSocket* socket = NULL ); ! virtual UINT8 notority( P_CHAR pChar ); virtual void kill(); virtual void showName( cUOSocket *socket ); --- 93,97 ---- virtual void resend( bool clean = true, bool excludeself = false ); virtual void talk( const QString &message, UI16 color = 0xFFFF, UINT8 type = 0, bool autospam = false, cUOSocket* socket = NULL ); ! virtual UINT8 notority( P_CHAR pChar = NULL ); virtual void kill(); virtual void showName( cUOSocket *socket ); *************** *** 106,109 **** --- 106,110 ---- void awardFame( short amount ); void awardKarma( P_CHAR pKilled, short amount ); + virtual bool isInnocent(); // other public methods *************** *** 590,593 **** --- 591,598 ---- } + inline bool cNPC::isInnocent() + { + return notority() != 1; + } #endif /* CNPC_H_HEADER_INCLUDED */ Index: srvparams.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/srvparams.cpp,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** srvparams.cpp 19 Sep 2003 20:41:08 -0000 1.90 --- srvparams.cpp 20 Sep 2003 12:01:43 -0000 1.91 *************** *** 109,112 **** --- 109,113 ---- checkAITime_ = getDouble( "AI", "Default AI Check Time", 1.2, true ); animalWildFleeRange_ = getNumber( "AI", "Wild animals flee range", 8, true ); + guardDispelTime_ = getNumber( "AI", "Guard dispel time (sec)", 25, true ); // Persistency Index: srvparams.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/srvparams.h,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** srvparams.h 19 Sep 2003 20:41:08 -0000 1.58 --- srvparams.h 20 Sep 2003 12:01:44 -0000 1.59 *************** *** 130,133 **** --- 130,134 ---- float checkAITime_; unsigned int animalWildFleeRange_; + unsigned int guardDispelTime_; // Regenerate *************** *** 287,290 **** --- 288,294 ---- int pathfindFleeRadius() const; + // AI + unsigned int guardDispelTime() const; + private: void setDefaultStartLocation(); *************** *** 698,701 **** --- 702,710 ---- { return pathfindMaxIterations_; + } + + inline unsigned int cSrvParams::guardDispelTime() const + { + return guardDispelTime_; } Index: uobject.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/uobject.cpp,v retrieving revision 1.114 retrieving revision 1.115 diff -C2 -d -r1.114 -r1.115 *** uobject.cpp 12 Sep 2003 22:11:47 -0000 1.114 --- uobject.cpp 20 Sep 2003 12:01:44 -0000 1.115 *************** *** 439,444 **** QString Value = Tag->getValue(); //<direction>SE</direction> ! if( TagName == "direction" ) { if( Value == "NE" ) --- 439,449 ---- QString Value = Tag->getValue(); + if( TagName == "name" ) + { + name_ = Value; + } + //<direction>SE</direction> ! else if( TagName == "direction" ) { if( Value == "NE" ) Index: wolf.dsp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/wolf.dsp,v retrieving revision 1.236 retrieving revision 1.237 diff -C2 -d -r1.236 -r1.237 *** wolf.dsp 20 Sep 2003 01:05:10 -0000 1.236 --- wolf.dsp 20 Sep 2003 12:01:44 -0000 1.237 *************** *** 1,23 **** # Microsoft Developer Studio Project File - Name="wolf" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 ! # ** NICHT BEARBEITEN ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 CFG=wolf - Win32 Debug ! !MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE ! !MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl !MESSAGE !MESSAGE NMAKE /f "wolf.mak". !MESSAGE ! !MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben ! !MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: !MESSAGE !MESSAGE NMAKE /f "wolf.mak" CFG="wolf - Win32 Debug" !MESSAGE ! !MESSAGE Für die Konfiguration stehen zur Auswahl: !MESSAGE ! !MESSAGE "wolf - Win32 Release" (basierend auf "Win32 (x86) Console Application") ! !MESSAGE "wolf - Win32 Debug" (basierend auf "Win32 (x86) Console Application") !MESSAGE --- 1,23 ---- # Microsoft Developer Studio Project File - Name="wolf" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 ! # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 CFG=wolf - Win32 Debug ! !MESSAGE This is not a valid makefile. To build this project using NMAKE, ! !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "wolf.mak". !MESSAGE ! !MESSAGE You can specify a configuration when running NMAKE ! !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "wolf.mak" CFG="wolf - Win32 Debug" !MESSAGE ! !MESSAGE Possible choices for configuration are: !MESSAGE ! !MESSAGE "wolf - Win32 Release" (based on "Win32 (x86) Console Application") ! !MESSAGE "wolf - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE *************** *** 64,68 **** # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 ! # PROP Output_Dir "C:\wolfpack\" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 --- 64,68 ---- # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 ! # PROP Output_Dir "C:\Software Engineering\wolfpack\" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 *************** *** 77,81 **** LINK32=link.exe # 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 /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib ws2_32.lib $(QTDIR)\lib\qt-mt312.lib kernel32.lib user32.lib gdi32.lib advapi32.lib ws2_32.lib $(QTDIR)\lib\qt-mt312.lib shell32.lib /nologo /version:12.9 /subsystem:windows /map /debug /machine:I386 /out:"C:\wolfpack\wolfpack.exe" /pdbtype:sept /libpath:"lib\bugreport\lib" /libpath:"flatstore\Debug" # SUBTRACT LINK32 /pdb:none --- 77,81 ---- LINK32=link.exe # 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 /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib ws2_32.lib $(QTDIR)\lib\qt-mt320.lib kernel32.lib user32.lib gdi32.lib advapi32.lib ws2_32.lib $(QTDIR)\lib\qt-mt320.lib shell32.lib /nologo /version:12.9 /subsystem:windows /map /debug /machine:I386 /out:"C:\Software Engineering\wolfpack\wolfpack.exe" /pdbtype:sept /libpath:"lib\bugreport\lib" /libpath:"flatstore\Debug" # SUBTRACT LINK32 /pdb:none *************** *** 103,111 **** # Begin Source File ! SOURCE=.\ai_monsters.cpp # End Source File # Begin Source File ! SOURCE=.\ai_vendors.cpp # End Source File # Begin Source File --- 103,111 ---- # Begin Source File ! SOURCE=.\ai_humans.cpp # End Source File # Begin Source File ! SOURCE=.\ai_monsters.cpp # End Source File # Begin Source File Index: wolfpack.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/wolfpack.cpp,v retrieving revision 1.468 retrieving revision 1.469 diff -C2 -d -r1.468 -r1.469 *** wolfpack.cpp 17 Sep 2003 19:15:34 -0000 1.468 --- wolfpack.cpp 20 Sep 2003 12:01:44 -0000 1.469 *************** *** 470,473 **** --- 470,474 ---- Human_Vendor::registerInFactory(); Human_Stablemaster::registerInFactory(); + Human_Guard::registerInFactory(); Animal_Wild::registerInFactory(); Animal_Domestic::registerInFactory(); *************** *** 538,543 **** default: niceLevel.wait(10); break; } - - uiCurrentTime = getNormalizedTime(); // Python threading - end --- 539,542 ---- Index: wpdefmanager.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/wpdefmanager.cpp,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** wpdefmanager.cpp 13 Sep 2003 13:08:41 -0000 1.66 --- wpdefmanager.cpp 20 Sep 2003 12:01:44 -0000 1.67 *************** *** 268,271 **** --- 268,273 ---- BaseDefManager::instance()->unload(); + + listcache_.clear(); } *************** *** 293,296 **** --- 295,337 ---- Console::instance()->ProgressDone(); + // create a list cache, because reading all the lists on the fly + // means wasting time + QMap< QString, cElement* >::iterator it = impl->unique[ WPDT_LIST ].begin(); + + while( it != impl->unique[ WPDT_LIST ].end() ) + { + cElement *DefSection = it.data(); + + QStringList list; + QString data; + for( unsigned int i = 0; i < DefSection->childCount(); ++i ) + { + const cElement *childTag = DefSection->getChild( i ); + + // Using the nodename is a very very bad habit + // if the name of the node is "item" then + // use the node value instead + + if( childTag->name() == "item" ) + data = childTag->text(); + else + data = childTag->name(); + + int mult = childTag->getAttribute( "mult" ).toInt(); + if( mult <= 0 ) + mult = 1; + int i = 0; + while( i < mult ) + { + list.push_back( data ); + ++i; + } + } + + listcache_.insert( it.key(), list ); + + ++it; + } + Commands::instance()->loadACLs(); BaseDefManager::instance()->load(); *************** *** 314,358 **** } ! QString WPDefManager::getRandomListEntry( const QString& ListSection ) const { ! QStringList list = this->getList( ListSection ); ! if( list.isEmpty() ) return QString(); else ! return list[ RandomNum( 0, list.size()-1 ) ]; } ! QStringList WPDefManager::getList( const QString& ListSection ) const { - const cElement* DefSection = getDefinition( WPDT_LIST, ListSection ); QStringList list; - QString data; - - if( !DefSection ) - return list; ! for( unsigned int i = 0; i < DefSection->childCount(); ++i ) ! { ! const cElement *childTag = DefSection->getChild( i ); ! ! // Using the nodename is a very very bad habit ! // if the name of the node is "item" then ! // use the node value instead ! ! if( childTag->name() == "item" ) ! data = childTag->text(); ! else ! data = childTag->name(); ! ! int mult = childTag->getAttribute( "mult" ).toInt(); ! if( mult <= 0 ) ! mult = 1; ! int i = 0; ! while( i < mult ) ! { ! list.push_back( data ); ! ++i; ! } ! } return list; --- 355,379 ---- } ! QString WPDefManager::getRandomListEntry( const QString& ListSection ) { ! QStringList *list = NULL; ! ! QMap< QString, QStringList >::iterator it = listcache_.find( ListSection ); ! if( it != listcache_.end() ) ! list = &(it.data()); ! ! if( !list || list->isEmpty() ) return QString(); else ! return (*list)[ RandomNum( 0, list->size()-1 ) ]; } ! QStringList WPDefManager::getList( const QString& ListSection ) { QStringList list; ! QMap< QString, QStringList >::iterator it = listcache_.find( ListSection ); ! if( it != listcache_.end() ) ! list = it.data(); return list; Index: wpdefmanager.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/wpdefmanager.h,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** wpdefmanager.h 2 Sep 2003 02:06:34 -0000 1.31 --- wpdefmanager.h 20 Sep 2003 12:01:44 -0000 1.32 *************** *** 145,151 **** //const QDomElement* getSection( eDefCategory Type, const QString& Section ) const; QStringList getSections( eDefCategory Type ) const; ! QString getRandomListEntry( const QString& ListSection ) const; ! QStringList getList( const QString& ListSection ) const; QString getText( const QString& TextSection ) const; }; --- 145,154 ---- //const QDomElement* getSection( eDefCategory Type, const QString& Section ) const; QStringList getSections( eDefCategory Type ) const; ! QString getRandomListEntry( const QString& ListSection ); ! QStringList getList( const QString& ListSection ); QString getText( const QString& TextSection ) const; + + protected: + QMap< QString, QStringList > listcache_; }; --- ai_vendors.cpp DELETED --- |