Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv24987
Modified Files:
Timing.cpp ai_animals.cpp basechar.cpp basechar.h combat.cpp
defines.h dragdrop.cpp npc.cpp player.cpp prototypes.h
targetrequests.cpp wolf.dsp wolfpack.cpp world.cpp
Log Message:
Cleaned up the code alot.
Index: Timing.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/Timing.cpp,v
retrieving revision 1.180
retrieving revision 1.181
diff -C2 -d -r1.180 -r1.181
*** Timing.cpp 11 Sep 2003 12:22:24 -0000 1.180
--- Timing.cpp 11 Sep 2003 15:33:58 -0000 1.181
***************
*** 320,376 ****
}
- setcharflag( pc );
-
- /* still needed !?
- if( pc->isPlayer() && pc->casting() )//PC casting a spell
- {
- pc->setNextact( pc->nextact() - 1 );
- if( pc->spelltime() <= currenttime )//Spell is complete target it
- {
- // TODO: Reactivate when spellcasting is redone
- //Magic->AfterSpellDelay( s, pc );
- }
- else if( pc->nextact() <= 0 )//redo the spell action
- {
- pc->setNextact( 75 );
- pc->action( pc->spellaction() );
- }
- }
- */
- /*
- // Reset spirit-speak
- if( pc->spiritspeaktimer() > 0 && pc->spiritspeaktimer() <= uiCurrentTime )
- pc->setSpiritSpeakTimer(0);
- */
-
- #pragma message("TODO: jail reimplementation with python")
- /*
- // Jail stuff
- if( pc->cell() > 0 )
- {
- if( ( pc->jailtimer() > 0 ) && ( pc->jailtimer() <= uiCurrentTime ) )
- {
- socket->sysMessage( tr( "Your jail time is over!" ) );
-
- if( pc )
- {
- jails[ pc->cell() ].occupied = false;
-
- pc->removeFromView( false );
- pc->moveTo( jails[ pc->cell() ].oldpos );
- pc->resend( false );
-
- pc->setCell(0);
- pc->setJailSecs(0);
- pc->setJailTimer(0);
- pc->setPriv2(0);
-
- savelog( tr( "%1 [0x%2] is automatically released from jail." ).arg( pc->name() ).arg( pc->serial(), 8, 16 ), "server.log" );
- socket->sysMessage( tr( "You have been released." ) );
- }
- }
- }
- */
-
if( SrvParams->hungerRate() > 1 && ( pc->hungerTime() <= currenttime ) )
{
--- 320,323 ----
***************
*** 422,427 ****
pc->ai()->check();
}
-
- setcharflag( pc );
// We are at war and want to prepare a new swing
--- 369,372 ----
Index: ai_animals.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ai_animals.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ai_animals.cpp 20 Aug 2003 17:10:48 -0000 1.5
--- ai_animals.cpp 11 Sep 2003 15:33:58 -0000 1.6
***************
*** 78,82 ****
m_npc->setWanderFollowTarget( pTalker );
m_npc->setWanderType( enFollowTarget );
! playmonstersound( m_npc, m_npc->bodyID(), SND_STARTATTACK );
}
else
--- 78,82 ----
m_npc->setWanderFollowTarget( pTalker );
m_npc->setWanderType( enFollowTarget );
! m_npc->bark( cBaseChar::Bark_Attacking );
}
else
Index: basechar.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/basechar.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** basechar.cpp 8 Sep 2003 10:58:46 -0000 1.41
--- basechar.cpp 11 Sep 2003 15:33:58 -0000 1.42
***************
*** 31,34 ****
--- 31,35 ----
// wolfpack includes
#include "basechar.h"
+ #include "basedef.h"
#include "player.h"
#include "globals.h"
***************
*** 532,536 ****
else
{
! playmonstersound( this, orgBodyID_, SND_DIE );
}
}
--- 533,537 ----
else
{
! bark( Bark_Death );
}
}
***************
*** 1965,1967 ****
--- 1966,2015 ----
return amount;
+ }
+
+ void cBaseChar::bark( enBark type )
+ {
+ cCharBaseDef *basedef = BaseDefManager::instance()->getCharBaseDef( bodyID_ );
+
+ if( !basedef || !basedef->basesound() ) // Nothing known about this creature
+ return;
+
+ switch( basedef->soundmode() )
+ {
+ // Only Attack, Hit and Death sounds available (Falltrough!)
+ case 2:
+ if( type == Bark_GetHit )
+ return;
+
+ // Only Attack, Hit, GetHit and Death
+ case 3:
+ if( type == Bark_Idle )
+ return;
+
+ break;
+
+ // Only the first sound is available
+ case 4:
+ if( type != Bark_Attacking )
+ return;
+
+ default:
+ break;
+ }
+
+ soundEffect( basedef->basesound() + (unsigned char)type );
+ }
+
+ void cBaseChar::goldSound( unsigned short amount, bool hearall )
+ {
+ unsigned short sound;
+
+ if( amount == 1 )
+ sound = 0x35;
+ else if( amount > 1 && amount < 6 )
+ sound = 0x36;
+ else
+ sound = 0x37;
+
+ soundEffect( sound, hearall );
}
Index: basechar.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/basechar.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** basechar.h 9 Sep 2003 20:56:53 -0000 1.32
--- basechar.h 11 Sep 2003 15:33:58 -0000 1.33
***************
*** 77,80 ****
--- 77,88 ----
BuyNoRestockContainer, SellContainer, BankBox, Dragging };
+ enum enBark {
+ Bark_Attacking= 0,
+ Bark_Idle,
+ Bark_Hit,
+ Bark_GetHit,
+ Bark_Death
+ };
+
// implementation of interfaces
void load( char **, ushort& );
***************
*** 138,141 ****
--- 146,151 ----
P_ITEM rightHandItem() const;
P_ITEM leftHandItem() const;
+ void bark( enBark ); // Play a body dependant sound
+ void goldSound( unsigned short amount, bool hearall = true ); // Play a sound for dropping goldcoins depending on the amount
virtual bool checkSkill( UI16 skill, SI32 min, SI32 max, bool advance = true );
cItem* atLayer( enLayer layer ) const;
Index: combat.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/combat.cpp,v
retrieving revision 1.150
retrieving revision 1.151
diff -C2 -d -r1.150 -r1.151
*** combat.cpp 11 Sep 2003 12:22:24 -0000 1.150
--- combat.cpp 11 Sep 2003 15:33:58 -0000 1.151
***************
*** 189,193 ****
}
else
! playmonstersound( pChar, pChar->bodyID(), SND_DEFEND );
}
--- 189,193 ----
}
else
! pChar->bark( cBaseChar::Bark_GetHit );
}
***************
*** 1108,1112 ****
pAttacker->action( action );
! playmonstersound( pAttacker, pAttacker->bodyID(), SND_ATTACK );
}
else if (pAttacker->atLayer(cBaseChar::Mount))
--- 1108,1112 ----
pAttacker->action( action );
! pAttacker->bark( cBaseChar::Bark_Hit );
}
else if (pAttacker->atLayer(cBaseChar::Mount))
Index: defines.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/defines.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** defines.h 11 Jun 2003 10:54:07 -0000 1.41
--- defines.h 11 Sep 2003 15:33:58 -0000 1.42
***************
*** 93,104 ****
//////////////////
-
- // List of monster sounds
- #define SND_STARTATTACK 0
- #define SND_IDLE 1
- #define SND_ATTACK 2
- #define SND_DEFEND 3
- #define SND_DIE 4
-
// List of skill numbers (For later implementation)
#define ALCHEMY 0
--- 93,96 ----
Index: dragdrop.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/dragdrop.cpp,v
retrieving revision 1.198
retrieving revision 1.199
diff -C2 -d -r1.198 -r1.199
*** dragdrop.cpp 7 Sep 2003 19:07:46 -0000 1.198
--- dragdrop.cpp 11 Sep 2003 15:33:58 -0000 1.199
***************
*** 468,472 ****
// Handle the sound-effect
if( pItem->id() == 0xEED )
! goldsfx( socket, pItem->amount(), true );
// Update our weight.
--- 468,472 ----
// Handle the sound-effect
if( pItem->id() == 0xEED )
! pChar->goldSound( pItem->amount() );
// Update our weight.
Index: npc.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/npc.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** npc.cpp 9 Sep 2003 23:09:30 -0000 1.43
--- npc.cpp 11 Sep 2003 15:33:58 -0000 1.44
***************
*** 831,835 ****
return;
! playmonstersound( this, bodyID_, SND_STARTATTACK );
unsigned int cdist=0 ;
--- 831,835 ----
return;
! bark( Bark_Attacking );
unsigned int cdist=0 ;
Index: player.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/player.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** player.cpp 9 Sep 2003 23:09:30 -0000 1.38
--- player.cpp 11 Sep 2003 15:33:58 -0000 1.39
***************
*** 470,477 ****
if( pp_t->kills_ >= SrvParams->maxkills() )
pp_t->socket()->sysMessage( tr( "You are now a murderer!" ) );
}
-
- setcharflag( pp_t );
}
}
--- 470,480 ----
if( pp_t->kills_ >= SrvParams->maxkills() )
+ {
pp_t->socket()->sysMessage( tr( "You are now a murderer!" ) );
+
+ // Set the Murder Decay Time
+ pp_t->setMurdererTime( getNormalizedTime() + SrvParams->murderdecay() * MY_CLOCKS_PER_SEC );
+ }
}
}
}
***************
*** 1063,1068 ****
}
! if( socket_ )
! goldsfx( socket_, amount, false );
}
--- 1066,1070 ----
}
! goldSound( amount, false );
}
***************
*** 1084,1089 ****
}
! if( socket_ )
! goldsfx( socket_, dAmount, false );
return dAmount;
--- 1086,1090 ----
}
! goldSound( amount, false );
return dAmount;
Index: prototypes.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/prototypes.h,v
retrieving revision 1.110
retrieving revision 1.111
diff -C2 -d -r1.110 -r1.111
*** prototypes.h 7 Sep 2003 19:07:47 -0000 1.110
--- prototypes.h 11 Sep 2003 15:33:58 -0000 1.111
***************
*** 37,47 ****
void showPaperdoll( cUOSocket *socket, P_CHAR pTarget, bool hotkey );
-
- void goldsfx( cUOSocket *socket, UINT16 amount, bool hearall );
-
- void playmonstersound(P_CHAR monster, unsigned short id, int sfx);
void reloadScripts();
-
- void setcharflag(P_CHAR pc);
#endif
--- 37,41 ----
Index: targetrequests.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/targetrequests.cpp,v
retrieving revision 1.77
retrieving revision 1.78
diff -C2 -d -r1.77 -r1.78
*** targetrequests.cpp 7 Sep 2003 19:07:47 -0000 1.77
--- targetrequests.cpp 11 Sep 2003 15:33:58 -0000 1.78
***************
*** 152,156 ****
// Send the char to it's surroundings
- setcharflag( pChar );
pChar->resend( false ); // It's new so no need to remove it first
--- 152,155 ----
Index: wolf.dsp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolf.dsp,v
retrieving revision 1.225
retrieving revision 1.226
diff -C2 -d -r1.225 -r1.226
*** wolf.dsp 11 Sep 2003 12:22:24 -0000 1.225
--- wolf.dsp 11 Sep 2003 15:33:58 -0000 1.226
***************
*** 43,47 ****
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
! # ADD CPP /nologo /MT /GR /GX /O2 /Ob0 /I "lib/Python/PC" /I "sqlite" /I "lib/Python/include" /I "lib\ZThread\include" /I "$(QTDIR)\include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "QT_DLL" /D "QT_THREAD_SUPPORT" /Fr /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
--- 43,47 ----
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
! # ADD CPP /nologo /MD /GR /GX /O2 /Ob0 /I "lib/Python/PC" /I "sqlite" /I "lib/Python/include" /I "lib\ZThread\include" /I "$(QTDIR)\include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "QT_DLL" /D "QT_THREAD_SUPPORT" /Fr /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
***************
*** 52,56 ****
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 /machine:I386
! # ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib wsock32.lib $(QTDIR)\lib\qt-mt320.lib python22.lib /nologo /subsystem:windows /map /machine:I386 /out:"..\wolfpack.exe" /libpath:"lib\ZThread\lib" /libpath:"lib\Python\lib" /libpath:"lib\bugreport\lib" /libpath:"flatstore\Release" /opt:ref /opt:nowin98
# SUBTRACT LINK32 /pdb:none
--- 52,56 ----
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 /machine:I386
! # ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib ws2_32.lib $(QTDIR)\lib\qt-mt320.lib python22.lib /nologo /subsystem:windows /map /machine:I386 /out:"..\wolfpack.exe" /libpath:"lib\ZThread\lib" /libpath:"lib\Python\lib" /libpath:"lib\bugreport\lib" /libpath:"flatstore\Release" /opt:ref /opt:nowin98
# SUBTRACT LINK32 /pdb:none
Index: wolfpack.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolfpack.cpp,v
retrieving revision 1.463
retrieving revision 1.464
diff -C2 -d -r1.463 -r1.464
*** wolfpack.cpp 11 Sep 2003 12:22:24 -0000 1.463
--- wolfpack.cpp 11 Sep 2003 15:33:58 -0000 1.464
***************
*** 30,74 ****
//==================================================================================
! #include "world.h"
! #include "verinfo.h"
! #include "speech.h"
! #include "territories.h"
#include "basics.h"
! #include "TmpEff.h"
! #include "combat.h"
! #include "sectors.h"
! #include "srvparams.h"
! #include "network.h"
! #include "exceptions.h"
! #include "gumps.h"
#include "commands.h"
! #include "spawnregions.h"
! #include "Timing.h"
! #include "tilecache.h"
! #include "accounts.h"
! #include "makemenus.h"
! #include "skills.h"
! #include "resources.h"
#include "contextmenu.h"
- #include "maps.h"
- #include "wpdefmanager.h"
- #include "log.h"
- #include "scriptmanager.h"
- #include "wptargetrequests.h"
- #include "python/engine.h"
- #include "persistentbroker.h"
#include "corpse.h"
#include "house.h"
! #include "boats.h"
#include "multiscache.h"
! #include "Trade.h"
! #include "network/uotxpackets.h"
! #include "basechar.h"
! #include "player.h"
#include "npc.h"
! #include "ai.h"
#include "sectors.h"
! #include "basedef.h"
! #include "console.h"
// Library Includes
--- 30,67 ----
//==================================================================================
! #include "accounts.h"
! #include "ai.h"
! #include "basedef.h"
#include "basics.h"
! #include "boats.h"
#include "commands.h"
! #include "console.h"
#include "contextmenu.h"
#include "corpse.h"
#include "house.h"
! #include "inlines.h"
! #include "log.h"
! #include "makemenus.h"
! #include "maps.h"
#include "multiscache.h"
! #include "network.h"
#include "npc.h"
! #include "persistentbroker.h"
! #include "player.h"
! #include "resources.h"
! #include "scriptmanager.h"
#include "sectors.h"
! #include "skills.h"
! #include "spawnregions.h"
! #include "srvparams.h"
! #include "territories.h"
! #include "tilecache.h"
! #include "Timing.h"
! #include "verinfo.h"
! #include "world.h"
! #include "wpdefmanager.h"
!
! #include "python/engine.h"
! #include "python/utilities.h"
// Library Includes
***************
*** 82,87 ****
#include <qthread.h>
- #include "python/utilities.h"
-
using namespace std;
--- 75,78 ----
***************
*** 592,751 ****
return 0;
- }
-
- void goldsfx( cUOSocket *socket, UINT16 amount, bool hearall )
- {
- if( !socket || !socket->player() )
- return;
-
- UINT16 sEffect = 0x37;
-
- if( amount == 1 )
- sEffect = 0x35;
- else if( amount > 1 && amount < 6 )
- sEffect = 0x36;
-
- if( !hearall )
- socket->soundEffect( sEffect );
- else
- {
- for( cUOSocket *mSock = cNetwork::instance()->first(); mSock; mSock = cNetwork::instance()->next() )
- if( mSock->inRange( socket ) )
- mSock->soundEffect( sEffect );
- }
- }
-
- void playmonstersound(P_CHAR monster, unsigned short id, int sfx)
- {
- int basesound=0,x;
- char sf; short offset;
-
- cCharBaseDef *basedef = BaseDefManager::instance()->getCharBaseDef( id );
-
- if( !basedef ) // Nothing known about this creature
- return;
-
- x=id;
- basesound=basedef->basesound();
- sf=basedef->soundmode();
- offset=sfx;
-
- if (basesound != 0)
- {
- switch(sf)
- {
- case 0: break; // in normal case the offset is correct
- case 1: break; // birds sounds will be implmented later
-
- case 2: // only start-attack, attack & dýing sounds available
- if (sfx==1 || sfx==3) offset=-1; // idle, defend ? play nothing
- else if (sfx==2) offset=1; // correct offset
- else if (sfx==4) offset=2;
- break;
- case 3: // only start-attack, attack, defense & dying
- if (sfx==1) offset=-1; // idle -> play nothing
- else if (sfx==2) offset=1; // otherwise correct offsets
- else if (sfx==3) offset=2;
- else if (sfx==4) offset=3;
- break;
- case 4: // only a single sound
-
- if (sfx!=0) offset=-1; else offset=0;
-
- break;
- }
- basesound += offset;
- if (offset!=-1)
- monster->soundEffect( basesound );
- return;
- }
- }
-
- /*!
- Update the flagging of this character based
- on his reputation.
- */
- void setcharflag( P_CHAR pc )
- {
- //First, let's see their karma.
- if( pc->karma() <= -200 )
- {
- pc->setMurdererTime( uiCurrentTime + SrvParams->murderdecay() * MY_CLOCKS_PER_SEC );
- }
-
- if( pc->objectType() == enPlayer )
- {
- P_PLAYER pp = dynamic_cast<P_PLAYER>(pc);
- if (pp->isGMorCounselor())
- {
- pp->setMurdererTime( 0 );
- pp->setCriminalTime( 0 );
- return;
- }
- else if (pc->kills() >= (unsigned) SrvParams->maxkills())
- {
- pp->setMurdererTime( uiCurrentTime + SrvParams->murderdecay() * MY_CLOCKS_PER_SEC );
- return;
- }
- else if (pc->criminalTime() == 0)
- {
- pp->setMurdererTime( 0 );
- return;
- }
- else if (pc->criminalTime() > 0)
- {
- pp->makeCriminal();
- return;
- }
- else
- {
- pp->makeCriminal();
- }
- }
- else
- {
- /* switch (pc->npcaitype())
- {
- case 2: // bad npcs
- case 3: // bad healers
- case 50: // EV & BS
- pc->setMurderer();
- break;
- case 1: // good healers
- case 4: // teleport guard
- case 5: // beggars
- case 6: // chaos guard
- case 7: // order guard
- case 8: // banker
- case 9: // town guard
- case 11: // good npcs
- case 17: // player vendor
- case 18: // escort npcs
- case 19: // real estate brokers
- pc->setInnocent();
- break;
- default:
- if (pc->isHuman())
- {
- pc->setMurdererTime( 0 );
- pc->setCriminalTime( 0 );
- return;
- }
- if (SrvParams->animals_guarded() == 1 && pc->npcaitype() == 0 && !pc->isHuman() && !pc->tamed())
- {
- if (pc->inGuardedArea()) // in a guarded region, with guarded animals, animals == blue
- pc->setMurdererTime( 0 );
- pc->setCriminalTime( 0 );
- else // if the region's not guarded, they're gray
- pc->criminal();
- }
- else if( pc->owner() && !pc->isHuman() )
- {
- pc->setFlag( pc->owner()->flag() );
- }
- else
- pc->criminal();
- break;
- }*/
- }
}
--- 583,585 ----
Index: world.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/world.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** world.cpp 11 Sep 2003 12:45:28 -0000 1.41
--- world.cpp 11 Sep 2003 15:33:58 -0000 1.42
***************
*** 419,425 ****
pChar->setRegion( region );
- // Now that we have our owner set correctly
- // do the charflags
- setcharflag( pChar );
pChar->flagUnchanged(); // We've just loaded, nothing changes
}
--- 419,422 ----
|