00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00023 #ifndef __JOB_H
00024 #define __JOB_H
00025
00026 #include <winsock2.h>
00027 #include <list>
00028
00029 #include "Shared.h"
00030
00031 #define JOB_NORMAL 0
00032 #define JOB_DISABLE 1
00033 #define JOB_REMOVE 2
00034
00035 #define JOB_INFINITE -1
00036
00037 typedef int (*MessageCall)( LPVOID a, LPVOID b );
00038
00039 class cJob
00040 {
00041 public:
00042 cJob( )
00043 : m_fEnabled( FALSE )
00044 {
00045 }
00046 cJob( MessageCall func, LPVOID wp, LPVOID lp, int iFreq, int iNumReps, char *szName, int iJobID )
00047 : m_mcFunction( func ),
00048 m_wParam ( wp ),
00049 m_lParam ( lp ),
00050 m_iNumTimes ( iNumReps ),
00051 m_iJobID ( iJobID ),
00052 m_iCounter ( 0 ),
00053 m_iFrequency( iFreq ),
00054 m_fEnabled ( TRUE )
00055 {
00056 lstrcpy( m_szJobName, szName );
00057 }
00058
00059 ~cJob( )
00060 {
00061 }
00062
00063 int Tick ( );
00064
00065 inline LPVOID GetWParam ( ) { return m_wParam; }
00066 inline LPVOID GetLParam ( ) { return m_lParam; }
00067 inline void SetWParam ( LPVOID wp ) { m_wParam = wp; }
00068 inline void SetLParam ( LPVOID lp ) { m_lParam = lp; }
00069 inline int GetJobID ( ) { return m_iJobID; }
00070 inline char *GetName ( ) { return m_szJobName; }
00071 inline void SetFrequency( int iFreq ) { m_iFrequency = iFreq; }
00072 inline int GetFrequency( ) { return m_iFrequency; }
00073 inline void Enable ( BOOL fState ) { m_fEnabled = fState; }
00074
00075 private:
00076 MessageCall m_mcFunction;
00077 LPVOID m_wParam;
00078 LPVOID m_lParam;
00079 int m_iJobID;
00080 int m_iFrequency;
00081 int m_iNumTimes;
00082 int m_iCounter;
00083 char m_szJobName[100];
00084 BOOL m_fEnabled;
00085 };
00086
00087
00088 class cJobPool
00089 {
00090 public:
00091 cJobPool( )
00092 : m_iJobID( 0 )
00093 {
00094 NextTickTime = clock()/(CLOCKS_PER_SEC/TICKS_PER_SEC);
00095 }
00096
00097 ~cJobPool( )
00098 {
00099 while ( !m_lstJobList.empty( ) )
00100 {
00101 SAFEDELETE( m_lstJobList.front( ) )
00102 m_lstJobList.pop_front( );
00103 }
00104 }
00105
00106 void Tick ( );
00107 int CreateJob ( MessageCall mc, LPVOID wParam, LPVOID lParam, char *szName, int iFreq, int iNumTimes );
00108 cJob *GetJobByID ( int iID );
00109 int GetJobIDByName ( char *szName );
00110 void RemoveJob ( int iID );
00111
00112 static clock_t longtime;
00113 static clock_t NextTickTime;
00114
00115 private:
00116 int m_iJobID;
00117 std::list< cJob * > m_lstJobList;
00118 };
00119
00120 class cWarJobParam
00121 {
00122 friend class cAvatar;
00123 public:
00124 cWarJobParam()
00125 {
00126 }
00127
00128 cWarJobParam( DWORD SpellID, DWORD CasterGUID, DWORD TargetGUID, cLocation CastLocation, DWORD SpellSequence)
00129 : m_dwSpellID ( SpellID ),
00130 m_dwCasterGUID ( CasterGUID ),
00131 m_dwTargetGUID ( TargetGUID ),
00132 m_CastLocation ( CastLocation ),
00133 m_dwSpellSequence ( SpellSequence )
00134 {
00135 }
00136
00137 ~cWarJobParam()
00138 {
00139 }
00140
00141 inline DWORD GetSpellID ( ) { return m_dwSpellID; }
00142 inline DWORD GetCasterGUID ( ) { return m_dwCasterGUID; }
00143 inline DWORD GetTargetGUID ( ) { return m_dwTargetGUID; }
00144 inline cLocation GetCastLocation ( ) { return m_CastLocation; }
00145 inline DWORD GetSpellSequence ( ) { return m_dwSpellSequence; }
00146
00147 private:
00148 DWORD m_dwSpellID;
00149 DWORD m_dwCasterGUID;
00150 DWORD m_dwTargetGUID;
00151 cLocation m_CastLocation;
00152 DWORD m_dwSpellSequence;
00153
00154 };
00155
00156 class cSpellMoveParam
00157 {
00158 public:
00159 cSpellMoveParam()
00160 {
00161 }
00162
00163 cSpellMoveParam( DWORD CasterGUID, cLocation CastLocation, DWORD WarSpellGUID )
00164 : m_dwCasterGUID ( CasterGUID ),
00165 m_CastLocation ( CastLocation ),
00166 m_dwWarSpellGUID ( WarSpellGUID )
00167 {
00168 }
00169
00170 ~cSpellMoveParam()
00171 {
00172 }
00173
00174 inline DWORD GetCasterGUID ( ) { return m_dwCasterGUID; }
00175 inline cLocation GetCastLocation ( ) { return m_CastLocation; }
00176 inline DWORD GetWarSpellGUID ( ) { return m_dwWarSpellGUID; }
00177
00178 private:
00179 DWORD m_dwCasterGUID;
00180 cLocation m_CastLocation;
00181 DWORD m_dwWarSpellGUID;
00182
00183 };
00184
00185 class cMonsterDeathParam
00186 {
00187 public:
00188 cMonsterDeathParam()
00189 {
00190 }
00191
00192 cMonsterDeathParam( DWORD MonsterGUID, DWORD MonsterModelID, DWORD ClientGUID )
00193 : m_dwMonsterGUID ( MonsterGUID ),
00194 m_dwMonsterModelID ( MonsterModelID ),
00195 m_dwClientGUID ( ClientGUID )
00196 {
00197 }
00198
00199 ~cMonsterDeathParam()
00200 {
00201 }
00202
00203 inline DWORD GetMonsterGUID ( ) { return m_dwMonsterGUID; }
00204 inline DWORD GetMonsterModelID ( ) { return m_dwMonsterModelID;}
00205 inline DWORD GetClientGUID ( ) { return m_dwClientGUID; }
00206
00207 private:
00208 DWORD m_dwMonsterGUID;
00209 DWORD m_dwMonsterModelID;
00210 DWORD m_dwClientGUID;
00211
00212 };
00213
00214
00215 class cAvatarGenericAnimation
00216 {
00217 public:
00218 cAvatarGenericAnimation()
00219 {
00220 }
00221
00222 ~cAvatarGenericAnimation()
00223 {
00224 }
00225 };
00226
00227 #endif // #ifndef __JOB_H